Beispiel #1
0
        public CharProperty remove_property(List <string> path)
        {
            CharDictProperty dict_prop = this.properties;
            int i;

            for (i = 0; i < path.Count - 1; i++)
            {
                if (!dict_prop.value.ContainsKey(path[i]))
                {
                    throw new ArgumentOutOfRangeException(nameof(path));
                }
                dict_prop = dict_prop.value[path[i]] as CharDictProperty;
                if (dict_prop is null)
                {
                    throw new ArgumentOutOfRangeException(nameof(path));
                }
            }
            if (!dict_prop.value.ContainsKey(path[i]))
            {
                throw new ArgumentOutOfRangeException(nameof(path));
            }

            CharProperty result = dict_prop.value[path[i]];

            dict_prop.value.Remove(path[i]);

            return(result);
        }
Beispiel #2
0
        public override CharDictProperty copy()
        {
            CharDictProperty result = new CharDictProperty();

            foreach (string s in this.value.Keys)
            {
                result.value[s] = this.value[s].copy();
            }
            return(result);
        }
Beispiel #3
0
        public override void subtract(CharProperty prop)
        {
            CharDictProperty p = prop as CharDictProperty;

            if (p is null)
            {
                throw new ArgumentOutOfRangeException(nameof(prop));
            }
            foreach (string k in p.value.Keys)
            {
                this.value.Remove(k);
            }
        }
Beispiel #4
0
        public override void add(CharProperty prop)
        {
            CharDictProperty p = prop as CharDictProperty;

            if (p is null)
            {
                throw new ArgumentOutOfRangeException(nameof(prop));
            }
            foreach (string k in p.value.Keys)
            {
                this.value[k] = p.value[k].copy();
            }
        }
Beispiel #5
0
 public Character(string name)
 {
     this.name       = name;
     this.properties = new CharDictProperty();
 }