Package org.apache.xpath.objects

Examples of org.apache.xpath.objects.XBoolean


      String[] formats = {dt, d, gym, gy};
      double dbl = getNumber(datetime, formats, Calendar.YEAR);
      if (dbl == Double.NaN)
        return new XNumber(Double.NaN);
      int yr = (int)dbl;
      return new XBoolean(yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0));
    }
View Full Code Here


     */
    public static XBoolean leapYear()
    {
      Calendar cal = Calendar.getInstance();
      int yr = (int)cal.get(Calendar.YEAR);
      return new XBoolean(yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0));     
    }   
View Full Code Here

      {
        textNodeValue = (String) rtf;
      }
      else if (rtf instanceof Boolean)
      {
        textNodeValue = new XBoolean(((Boolean) rtf).booleanValue()).str();
      }
      else if (rtf instanceof Double)
      {
        textNodeValue = new XNumber(((Double) rtf).doubleValue()).str();
      }
View Full Code Here

                if (Class.forName("org.w3c.dom.Node").isInstance( varObject)) {
                    newXObject = new XNodeSetForDOM ( new JSTLNodeList( (Node)varObject ),xctxt );
                } else if ( Class.forName("java.lang.String").isInstance( varObject)){
                    newXObject = new XString ( (String)varObject );
                } else if ( Class.forName("java.lang.Boolean").isInstance( varObject) ) {
                    newXObject = new XBoolean ( (Boolean)varObject );
                } else if ( Class.forName("java.lang.Number").isInstance( varObject) ) {
                    newXObject = new XNumber ( (Number)varObject );
                }

                return newXObject;
View Full Code Here

         Object left = evaluate(owner, l);
         Object right = evaluate(owner, r);

         if ( ( left instanceof XObject ) && ( right instanceof XObject ) ) {
            switch ( op ) {
               case OpCodes.OP_NOTEQUALS: return new XBoolean(((XObject)left).notEquals((XObject)right));
               case OpCodes.OP_EQUALS:    return new XBoolean(((XObject)left).equals((XObject)right));
               case OpCodes.OP_LTE:       return new XBoolean(((XObject)left).lessThanOrEqual((XObject)right));
               case OpCodes.OP_LT:        return new XBoolean(((XObject)left).lessThan((XObject)right));
               case OpCodes.OP_GTE:       return new XBoolean(((XObject)left).greaterThanOrEqual((XObject)right));
               case OpCodes.OP_GT:        return new XBoolean(((XObject)left).greaterThan((XObject)right));
               default:                   return null; // Won't happen
            }
         }
         else
            return queryComparison(op, owner, left, right);
View Full Code Here

      private Object evalUnaryOperation(int op, String owner, int pos) throws Exception {
         XObject val = (XObject)evaluate(owner, cmp.getFirstChildPos(pos));
         switch ( op ) {
            case OpCodes.OP_NEG:    return new XNumber(-val.num());
            case OpCodes.OP_STRING: return new XString(val.str());
            case OpCodes.OP_BOOL:   return new XBoolean(val.bool());
            case OpCodes.OP_NUMBER: return new XNumber(val.num());
            default:                return null; // Won't happen
         }
      }
View Full Code Here

      String[] formats = {dt, d, gym, gy};
      double dbl = getNumber(datetime, formats, Calendar.YEAR);
      if (dbl == Double.NaN)
        return new XNumber(Double.NaN);
      int yr = (int)dbl;
      return new XBoolean(yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0));
    }
View Full Code Here

      {
        value = new XString((String) obj);
      }
      else if (obj instanceof Boolean)
      {
        value = new XBoolean(((Boolean) obj).booleanValue());
      }
      else if (obj instanceof Double)
      {
        value = new XNumber(((Double) obj).doubleValue());
      }
View Full Code Here

      String[] formats = {dt, d, gym, gy};
      double dbl = getNumber(datetime, formats, Calendar.YEAR);
      if (dbl == Double.NaN)
        return new XNumber(Double.NaN);
      int yr = (int)dbl;
      return new XBoolean(yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0));
    }
View Full Code Here

      {
        textNodeValue = (String) rtf;
      }
      else if (rtf instanceof Boolean)
      {
        textNodeValue = new XBoolean(((Boolean) rtf).booleanValue()).str();
      }
      else if (rtf instanceof Double)
      {
        textNodeValue = new XNumber(((Double) rtf).doubleValue()).str();
      }
View Full Code Here

TOP

Related Classes of org.apache.xpath.objects.XBoolean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.