/** * Get the score that this test will return if a test succeeds. * * * @return the score that this test will return if a test succeeds. */ public double getDefaultScore() { return m_score.num(); }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { final XObject obj = m_arg0.execute(xctxt); final double val= obj.num(); if (val >= -0.5 && val < 0) return new XNumber(-0.0); if (val == 0.0) return new XNumber(val); return new XNumber(java.lang.Math.floor(val + 0.5)); } }
/** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The value of this XNumber as a Double object */ public Object object() { if(null == m_obj) setObject(new Double(m_val)); return m_obj; }
/** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. int t = obj2.getType(); try { if (t == XObject.CLASS_NODESET) return obj2.equals(this); else if(t == XObject.CLASS_BOOLEAN) return obj2.bool() == bool(); else return m_val == obj2.num(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } }
/** * Construct a XNodeSet object. * * @param num Value of the object */ public XNumber(Number num) { super(); m_val = num.doubleValue(); setObject(num); }
/** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. int t = obj2.getType(); try { if (t == XObject.CLASS_NODESET) return obj2.equals(this); else if(t == XObject.CLASS_BOOLEAN) return obj2.bool() == bool(); else return m_val == obj2.num(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { return new XNumber(getArg0AsNumber(xctxt)); } }
/** * Get the score that this test will return if a test succeeds. * * * @return the score that this test will return if a test succeeds. */ public double getDefaultScore() { return m_score.num(); }
/** * Construct a XNodeSet object. * * @param num Value of the object */ public XNumber(Number num) { super(); m_val = num.doubleValue(); setObject(num); }
/** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. int t = obj2.getType(); try { if (t == XObject.CLASS_NODESET) return obj2.equals(this); else if(t == XObject.CLASS_BOOLEAN) return obj2.bool() == bool(); else return m_val == obj2.num(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } }
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { double pos = (double) getPositionInContextNodeList(xctxt); return new XNumber(pos); }
return new SimpleNumber(Double.valueOf(((XNumber) xresult).num()));
/** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The value of this XNumber as a Double object */ public Object object() { if(null == m_obj) setObject(new Double(m_val)); return m_obj; }
/** * Tell if two objects are functionally equal. * * @param obj2 Object to compare this to * * @return true if the two objects are equal * * @throws javax.xml.transform.TransformerException */ public boolean equals(XObject obj2) { // In order to handle the 'all' semantics of // nodeset comparisons, we always call the // nodeset function. int t = obj2.getType(); try { if (t == XObject.CLASS_NODESET) return obj2.equals(this); else if(t == XObject.CLASS_BOOLEAN) return obj2.bool() == bool(); else return m_val == obj2.num(); } catch(javax.xml.transform.TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } }