engine.lua.lib.EnumType

Here are the examples of the java api engine.lua.lib.EnumType taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : LuaField.java
with Mozilla Public License 2.0
from orange451

public LuaField setEnum(EnumType enumType) {
    this.enumType = enumType;
    return this;
}

18 Source : LuaField.java
with Mozilla Public License 2.0
from orange451

public clreplaced LuaField {

    private LuaValue fieldName;

    private Clreplaced<?> fieldType;

    private boolean canModify;

    protected boolean isInstance;

    private Clamp<?> clamp;

    private EnumType enumType;

    private int flags;

    public LuaField(String fieldName, Clreplaced<?> fieldType, boolean isFinal) {
        this.fieldName = LuaValue.valueOf(fieldName);
        this.fieldType = fieldType;
        this.canModify = !isFinal;
    }

    public boolean matches(Object o) {
        if (o == null)
            return false;
        Clreplaced<? extends Object> cls = o.getClreplaced();
        if (o.equals(LuaValue.NIL)) {
            if (Instance.clreplaced.isreplacedignableFrom(fieldType))
                return true;
        }
        if (o instanceof Instance) {
            if (fieldType.equals(LuaValue.NIL.getClreplaced()))
                return true;
            if (Instance.clreplaced.isreplacedignableFrom(fieldType)) {
                return true;
            }
        }
        if (o instanceof LuaValue) {
            LuaValue v = ((LuaValue) o);
            if (v.isnumber() && (fieldType.equals(LuaInteger.clreplaced) || fieldType.equals(LuaDouble.clreplaced) || fieldType.equals(LuaNumber.clreplaced))) {
                return true;
            }
        }
        if (fieldType.equals(LuaString.clreplaced) && o instanceof LuaString) {
            return true;
        }
        return cls.equals(fieldType);
    }

    public LuaValue clamp(LuaValue value) {
        if (clamp == null)
            return value;
        return clamp.clamp(value);
    }

    public boolean canModify() {
        return canModify;
    }

    public LuaValue getName() {
        return this.fieldName;
    }

    public Clreplaced<?> getType() {
        if (Instance.clreplaced.isreplacedignableFrom(fieldType) || isInstance)
            return Instance.clreplaced;
        return this.fieldType;
    }

    public LuaField setLocked(boolean b) {
        this.canModify = !b;
        return this;
    }

    /**
     * Returns true if the lua field is an instance-reference pointer.
     * @return
     */
    public boolean isInstance() {
        return isInstance;
    }

    public void cleanup() {
        fieldName = null;
        fieldType = null;
    }

    public LuaField setClamp(Clamp<?> clamp) {
        this.clamp = clamp;
        return this;
    }

    public Clamp<?> getClamp() {
        return this.clamp;
    }

    public LuaField setEnum(EnumType enumType) {
        this.enumType = enumType;
        return this;
    }

    public EnumType getEnumType() {
        return this.enumType;
    }

    public LuaField addFlag(int flag) {
        flags |= flag;
        return this;
    }

    public LuaField removeFlag(int flag) {
        flags &= ~flag;
        return this;
    }

    public boolean hasFlag(int flag) {
        return ((flags & flag) == flag);
    }
}