Exemple #1
0
 public Condition(IConditionExpr expr, int trueAction, int falseAction, TreeReference contextRef, ArrayList targets)
     : base(expr, contextRef)
 {
     this.trueAction  = trueAction;
     this.falseAction = falseAction;
     this.targets     = targets;
 }
Exemple #2
0
        private void evaluatePivot(CmpPivot pivot, IConditionExpr conditional, EvaluationContext c, FormInstance instance)
        {
            double unit = this.unit();
            double val  = pivot.Val;
            double lt   = val - unit;
            double gt   = val + unit;

            c.isConstraint = true;


            c.candidateValue = (IAnswerData)(Object)castToValue(val);
            Boolean eq = XPathFuncExpr.toBoolean(conditional.eval(instance, c));

            c.candidateValue = (IAnswerData)(Object)castToValue(lt);
            Boolean ltr = XPathFuncExpr.toBoolean(conditional.eval(instance, c));

            c.candidateValue = (IAnswerData)(Object)castToValue(gt);
            Boolean gtr = XPathFuncExpr.toBoolean(conditional.eval(instance, c));

            if (ltr && !gtr)
            {
                max          = (Double)(val);
                maxInclusive = eq;
            }

            if (!ltr && gtr)
            {
                min          = (Double)(val);
                minInclusive = eq;
            }
        }
Exemple #3
0
        public void init(EvaluationContext c, IConditionExpr conditional, FormInstance instance)
        {
            List <Object> pivots = conditional.pivot(instance, c);

            List <CmpPivot> internalPivots = new List <CmpPivot>();

            foreach (Object p in pivots)
            {
                if (!(p is CmpPivot))
                {
                    throw new UnpivotableExpressionException();
                }
                internalPivots.Add((CmpPivot)p);
            }

            if (internalPivots.Count > 2)
            {
                //For now.
                throw new UnpivotableExpressionException();
            }

            foreach (CmpPivot pivot in internalPivots)
            {
                evaluatePivot(pivot, conditional, c, instance);
            }
        }
Exemple #4
0
		public Triggerable(IConditionExpr expr, TreeReference contextRef)
		{
			InitBlock();
			this.expr = expr;
			this.contextRef = contextRef;
			this.originalContextRef = contextRef;
			this.targets = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
		}
Exemple #5
0
		//UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
		public virtual void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
		{
			expr = (IConditionExpr) ExtUtil.read(in_Renamed, new ExtWrapTagged(), pf);
			contextRef = (TreeReference) ExtUtil.read(in_Renamed, typeof(TreeReference), pf);
			originalContextRef = (TreeReference) ExtUtil.read(in_Renamed, typeof(TreeReference), pf);
			
			targets =(List< TreeReference >) ExtUtil.read(in, new ExtWrapList(TreeReference.
		}
Exemple #6
0
 public void readExternal(BinaryReader in_renamed, PrototypeFactory pf)
 {
     nodesetRef   = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf);
     nodesetExpr  = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapTagged(), pf);
     contextRef   = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf);
     labelRef     = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf);
     labelExpr    = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapTagged(), pf);
     valueRef     = (TreeReference)ExtUtil.read(in_renamed, new ExtWrapNullable(typeof(TreeReference)), pf);
     valueExpr    = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapNullable(new ExtWrapTagged()), pf);
     copyRef      = (TreeReference)ExtUtil.read(in_renamed, new ExtWrapNullable(typeof(TreeReference)), pf);
     labelIsItext = ExtUtil.readBool(in_renamed);
     copyMode     = ExtUtil.readBool(in_renamed);
 }
Exemple #7
0
 public void readExternal(BinaryReader in_, PrototypeFactory pf)
 {
     constraint    = (IConditionExpr)ExtUtil.read(in_, new ExtWrapTagged(), pf);
     constraintMsg = ExtUtil.nullIfEmpty(ExtUtil.readString(in_));
     attemptConstraintCompile();
 }
Exemple #8
0
 public Constraint(IConditionExpr constraint, String constraintMsg)
 {
     this.constraint    = constraint;
     this.constraintMsg = constraintMsg;
     attemptConstraintCompile();
 }
Exemple #9
0
 public Recalculate(IConditionExpr expr, TreeReference target, TreeReference contextRef) :
     base(expr, contextRef)
 {
     addTarget(target);
 }
Exemple #10
0
 public Recalculate(IConditionExpr expr, TreeReference contextRef)
     : base(expr, contextRef)
 {
 }
Exemple #11
0
 public Condition(IConditionExpr expr, int trueAction, int falseAction, TreeReference contextRef) : this(expr, trueAction, falseAction, contextRef, System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)))
 {
 }
Exemple #12
0
 public Triggerable(IConditionExpr expr, TreeReference contextRef)
 {
     this.expr       = expr;
     this.contextRef = contextRef;
     this.targets    = new ArrayList();
 }
Exemple #13
0
 public void readExternal(BinaryReader in_renamed, PrototypeFactory pf)
 {
     expr       = (IConditionExpr)ExtUtil.read(in_renamed, new ExtWrapTagged(), pf);
     contextRef = (TreeReference)ExtUtil.read(in_renamed, typeof(TreeReference), pf);
     targets    = (ArrayList)ExtUtil.read(in_renamed, new ExtWrapList(typeof(TreeReference)), pf);
 }
Exemple #14
0
 public Condition(IConditionExpr expr, int trueAction, int falseAction, TreeReference contextRef)
     : this(expr, trueAction, falseAction, contextRef, new ArrayList())
 {
 }