Package org.openrdf.model.impl

Examples of org.openrdf.model.impl.NumericLiteralImpl


          double left = leftLit.doubleValue();
          double right = rightLit.doubleValue();

          switch (op) {
            case PLUS:
              return new NumericLiteralImpl(left + right);
            case MINUS:
              return new NumericLiteralImpl(left - right);
            case MULTIPLY:
              return new NumericLiteralImpl(left * right);
            case DIVIDE:
              return new NumericLiteralImpl(left / right);
            default:
              throw new IllegalArgumentException("Unknown operator: " + op);
          }
        }
        else if (commonDatatype.equals(XMLSchema.FLOAT)) {
          float left = leftLit.floatValue();
          float right = rightLit.floatValue();

          switch (op) {
            case PLUS:
              return new NumericLiteralImpl(left + right);
            case MINUS:
              return new NumericLiteralImpl(left - right);
            case MULTIPLY:
              return new NumericLiteralImpl(left * right);
            case DIVIDE:
              return new NumericLiteralImpl(left / right);
            default:
              throw new IllegalArgumentException("Unknown operator: " + op);
          }
        }
        else if (commonDatatype.equals(XMLSchema.DECIMAL)) {
View Full Code Here


  public void testValueRoundTrip5()
    throws Exception
  {
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new NumericLiteralImpl(3);

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

  public void testDecimalRoundTrip()
    throws Exception
  {
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new NumericLiteralImpl(3, XMLSchema.DECIMAL);

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

  public void testValueRoundTrip5()
    throws Exception
  {
    URI subj = new URIImpl(EXAMPLE_NS + PICASSO);
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    Literal obj = new NumericLiteralImpl(3);

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

          double left = leftLit.doubleValue();
          double right = rightLit.doubleValue();

          switch (op) {
            case PLUS:
              return new NumericLiteralImpl(left + right);
            case MINUS:
              return new NumericLiteralImpl(left - right);
            case MULTIPLY:
              return new NumericLiteralImpl(left * right);
            case DIVIDE:
              return new NumericLiteralImpl(left / right);
            default:
              throw new IllegalArgumentException("Unknown operator: " + op);
          }
        }
        else if (commonDatatype.equals(XMLSchema.FLOAT)) {
          float left = leftLit.floatValue();
          float right = rightLit.floatValue();

          switch (op) {
            case PLUS:
              return new NumericLiteralImpl(left + right);
            case MINUS:
              return new NumericLiteralImpl(left - right);
            case MULTIPLY:
              return new NumericLiteralImpl(left * right);
            case DIVIDE:
              return new NumericLiteralImpl(left / right);
            default:
              throw new IllegalArgumentException("Unknown operator: " + op);
          }
        }
        else if (commonDatatype.equals(XMLSchema.DECIMAL)) {
View Full Code Here

  public static Value asLiteral(java.net.URI uri) {
    return new LiteralImpl(((java.net.URI)uri).toString());
  }
 
  public static Value asLiteral(Integer i) {
    return new NumericLiteralImpl(i);
  }
View Full Code Here

TOP

Related Classes of org.openrdf.model.impl.NumericLiteralImpl

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.