예제 #1
0
 public override bool Equals(System.Object o)
 {
     if (o is XPathReference)
     {
         return(ref_Renamed.Equals(((XPathReference)o).ref_Renamed));
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
        //
        //	boolean nodeset = forceNodeset;
        //	if (!nodeset) {
        //		//is this a nodeset? it is if the ref contains any unbound multiplicities AND the unbound nodes are repeatable
        //		//the way i'm calculating this sucks; there has got to be an easier way to find out if a node is repeatable
        //		TreeReference repeatTestRef = TreeReference.rootRef();
        //		for (int i = 0; i < ref.size(); i++) {
        //			repeatTestRef.add(ref.getName(i), ref.getMultiplicity(i));
        //			if (ref.getMultiplicity(i) == TreeReference.INDEX_UNBOUND) {
        //				if (m.getTemplate(repeatTestRef) != null) {
        //					nodeset = true;
        //					break;
        //				}
        //			}
        //		}
        //	}

        public static System.Object getRefValue(FormInstance model, EvaluationContext ec, TreeReference ref_Renamed)
        {
            if (ec.isConstraint && ref_Renamed.Equals(ec.ContextRef))
            {
                //ITEMSET TODO: need to update this; for itemset/copy constraints, need to simulate a whole xml sub-tree here
                return(unpackValue(ec.candidateValue));
            }
            else
            {
                TreeElement node = model.resolveReference(ref_Renamed);
                if (node == null)
                {
                    //shouldn't happen -- only existent nodes should be in nodeset
                    throw new XPathTypeMismatchException("Node " + ref_Renamed.ToString() + " does not exist!");
                }

                return(unpackValue(node.isRelevant()?node.Value:null));
            }
        }
예제 #3
0
        private void  InitBlock()
        {
            TreeReference ref_Renamed = this.getReference();

            //Either concretely the sentinal, or "."
            if (ref_Renamed.Equals(sentinal) || (ref_Renamed.RefLevel == 0))
            {
                return(sentinal);
            }
            else
            {
                //It's very, very hard to figure out how to pivot predicates. For now, just skip it
                for (int i = 0; i < ref_Renamed.size(); ++i)
                {
                    if (ref_Renamed.getPredicate(i) != null && ref_Renamed.getPredicate(i).size() > 0)
                    {
                        throw new UnpivotableExpressionException("Can't pivot filtered treereferences. Ref: " + ref_Renamed.toString(true) + " has predicates.");
                    }
                }
                return(this.eval(model, evalContext));
            }
        }