Ejemplo n.º 1
0
 public Boolean equals(Object o)
 {
     if (o is XPathReference)
     {
         return(ref_.Equals(((XPathReference)o).ref_));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        public Object pivot(FormInstance model, EvaluationContext evalContext, List <Object> pivots, Object sentinal)
        {
            TreeReference out_ = this.getReference();

            //Either concretely the sentinal, or "."
            if (out_.Equals(sentinal) || (out_.getRefLevel() == 0))
            {
                return(sentinal);
            }
            else
            {
                return(this.eval(model, evalContext));
            }
        }
Ejemplo n.º 3
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 Object getRefValue(FormInstance model, EvaluationContext ec, TreeReference ref_)
        {
            if (ec.isConstraint && ref_.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_);
                if (node == null)
                {
                    //shouldn't happen -- only existent nodes should be in nodeset
                    throw new XPathTypeMismatchException("Node " + ref_.toString() + " does not exist!");
                }

                return(unpackValue(node.isRelevant() ? node.getValue() : null));
            }
        }