Показать сообщение отдельно
Старый 28.01.2014, 23:38
dimarik вне форума Посмотреть профиль Отправить личное сообщение для dimarik Найти все сообщения от dimarik
  № 7  
Ответить с цитированием
dimarik
.
 
Аватар для dimarik

модератор форума
Регистрация: Sep 2003
Адрес: Москва
Сообщений: 4,630
Записей в блоге: 20
Код AS3:
public class Enumeration {
    public function Enumeration(id:*) {
        this.id = id;
    }
 
    public var id:*;
 
    public function etElementsList(/*enumerationClass:Class этот параметр, к.м.к., не имеет смысла */):Vector.<Enumeration> {
        return null;
    }
 
    public function toString():String {
        return this.id.toString();
    }
}
 
public class UintEnumeration extends Enumeration {
    public function UintEnumeration(id:uint) {
        super(id);
    }
}
 
public class UnitType extends UintEnumeration {
    public static const HERO:      UnitType = new UnitType(1);
    public static const WARRIOR:   UnitType = new UnitType(2);
    public static const MAGE:      UnitType = new UnitType(3);
    public static const ENEMY:     UnitType = new UnitType(4);
 
    private static const _elementsList:Vector.<Enumeration> = new <Enumeration>[HERO, WARRIOR, MAGE, ENEMY];
 
    public function UnitType(id:uint) {
        super(id);
    }
 
    public override function etElementsList(/*enumerationClass:Class*/):Vector.<Enumeration> {
        return _elementsList.slice();
    }
 
}
__________________
Воспитан в TimeZero. Работаю в Mail.ru.