Beispiel #1
0
        public CVar get(CVar key, Posision pos, EnegyData data, VariabelDatabase db)
        {
            if (!keyExists(key, pos, data, db))
            {
                data.setError(new ScriptError("Unknown key in array: " + key.toString(pos, data, db), pos), db);
                return new NullVariabel();
            }

            return container[key.toString(pos, data, db)];
        }
Beispiel #2
0
        public override bool compare(CVar var, Posision pos, EnegyData data, VariabelDatabase db)
        {
            if (Types.instanceof((ClassVariabel)db.get("string", data), this))
            {
                return toString(pos, data, db) == var.toString(pos, data, db);
            }else if (Types.instanceof((ClassVariabel)db.get("int", data), this))
            {
                return toInt(pos, data, db) == var.toInt(pos, data, db);
            }

            return this == var;
        }
Beispiel #3
0
 public bool keyExists(CVar key, Posision pos, EnegyData data, VariabelDatabase db)
 {
     return container.ContainsKey(key.toString(pos, data, db));
 }
Beispiel #4
0
        private void controlID(CVar key, Posision pos, EnegyData data, VariabelDatabase db)
        {
            double k;

            if(Types.instanceof((ClassVariabel)db.get("int", data), (ObjectVariabel)key))
            {
                k = key.toInt(pos, data, db);
            }else if(key is NullVariabel)
            {
                k = 0;
            }else if(Types.instanceof((ClassVariabel)db.get("string", data), (ObjectVariabel)key) && System.Text.RegularExpressions.Regex.IsMatch(key.toString(pos, data, db), "^[0-9]*?$"))
            {
                k = Convert.ToDouble(key.toString(pos, data, db));
            }
            else
            {
                return;
            }

            while (k >= nextID)
                getNextID(data, db, pos);
        }
Beispiel #5
0
        //wee add one element in the array
        public void put(CVar key, CVar value, Posision pos, EnegyData data, VariabelDatabase db)
        {
            //wee controlt he key
            controlID(key, pos, data, db);
            //wee control if wee got this id allready :)
            if (container.ContainsKey(key.toString(pos, data, db)))
                container.Remove(key.toString(pos, data, db));

            //wee add the key and value :)
            container.Add(key.toString(pos, data, db), value);
        }