Exemplo n.º 1
0
        public Contexte copy()
        {
            Contexte c = new Contexte();

            components.ForEach(component => c.addContextComponent(component));
            return(c);
        }
Exemplo n.º 2
0
        public override bool checkValue(Contexte contexte)
        {
            if (this.value)
            {
                return(this.value);
            }
            bool isSet = false;
            bool res   = false;
            bool error = false;

            for (var i = 0; i < this.relations.Count; i++)
            {
                var rel = this.relations[i];
                ContexteComponent component = new ContexteComponent(this.name, i);
                if (contexte.addContextComponent(component))
                {
                    isSet = true;
                    continue;
                }
                try
                {
                    res   = rel.checkValue(contexte);
                    isSet = true;
                }
                catch (UndefinedValueException)
                {}
                if (res)
                {
                    return(true);
                }
            }

            if (!isSet && this.relations.Count != 0)
            {
                throw new UndefinedValueException();
            }
            return((this.relations.Count == 0)?this.value:res);
        }