Examples of LiteralImpl


Examples of org.apache.jackrabbit.oak.query.ast.LiteralImpl

            default:
                throw getSyntaxError("Illegal operation: -" + currentValue);
            }
        }
        if (currentTokenType == VALUE) {
            LiteralImpl literal = getUncastLiteral(currentValue);
            read();
            return literal;
        } else if (currentTokenType == PARAMETER) {
            read();
            String name = readName();
            if (readIf(":")) {
                name = name + ':' + readName();
            }
            BindVariableValueImpl var = bindVariables.get(name);
            if (var == null) {
                var = factory.bindVariable(name);
                bindVariables.put(name, var);
            }
            return var;
        } else if (readIf("TRUE")) {
            LiteralImpl literal = getUncastLiteral(valueFactory.createValue(true));
            return literal;
        } else if (readIf("FALSE")) {
            LiteralImpl literal = getUncastLiteral(valueFactory.createValue(false));
            return literal;
        } else if (readIf("CAST")) {
            read("(");
            StaticOperandImpl op = parseStaticOperand();
            if (!(op instanceof LiteralImpl)) {
                throw getSyntaxError("literal");
            }
            LiteralImpl literal = (LiteralImpl) op;
            CoreValue value = literal.getLiteralValue();
            read("AS");
            value = parseCastAs(value);
            read(")");
            // CastLiteral
            literal = factory.literal(value);
View Full Code Here

Examples of org.auraframework.impl.expression.LiteralImpl

     * Number literals include integers, decimals, and exponents.
     */
    public void testLiteralNumbers() throws Exception {
        Expression e = buildExpression("5");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        LiteralImpl l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 5.0, l.getValue());

        e = buildExpression("5.345");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 5.345, l.getValue());

        e = buildExpression("911.");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 911., l.getValue());

        e = buildExpression(".119");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", .119, l.getValue());

        e = buildExpression("1e10");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 1e10, l.getValue());

        e = buildExpression("2.e20");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 2.e20, l.getValue());

        e = buildExpression("0e0");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 0e0, l.getValue());

        e = buildExpression("1e01");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", 1e01, l.getValue());

        e = buildExpression(".3e3");
        assertEquals("Unexpected expression type", ExpressionType.LITERAL, e.getExpressionType());
        l = (LiteralImpl) e;
        assertEquals("Unexpected number literal value", .3e3, l.getValue());
    }
View Full Code Here

Examples of org.jrdf.graph.global.LiteralImpl

        final Node value = getValue(str);
        if (value != null) {
            Node node = value;
            if (Literal.class.isAssignableFrom(node.getClass())) {
                Literal literal = (Literal) value;
                return new LiteralImpl(literal.getLexicalForm());
            }
        }
        return null;
    }
View Full Code Here

Examples of org.jrdf.graph.global.LiteralImpl

        final Node value = getValue(lang);
        if (value != null) {
            Node node = value;
            if (Literal.class.isAssignableFrom(node.getClass())) {
                Literal literal = (Literal) node;
                return new LiteralImpl(literal.getLanguage());
            }
        }
        return null;
    }
View Full Code Here

Examples of org.jrdf.graph.local.LiteralImpl

        String lexicalForm = strings[0];
        String language = strings[1];
        String datatype = strings[2];
        Literal literal;
        if (language != null) {
            literal = new LiteralImpl(lexicalForm, language);
        } else if (datatype != null) {
            literal = new LiteralImpl(lexicalForm, URI.create(datatype));
        } else {
            literal = new LiteralImpl(lexicalForm);
        }
        ((LiteralMutableId) literal).setId(nodeId);
        return literal;
    }
View Full Code Here

Examples of org.openrdf.model.impl.LiteralImpl

    List<String> bindingNames = Arrays.asList("a", "b", "c");

    MapBindingSet solution1 = new MapBindingSet(bindingNames.size());
    solution1.addBinding("a", new URIImpl("foo:bar"));
    solution1.addBinding("b", new BNodeImpl("bnode"));
    solution1.addBinding("c", new LiteralImpl("baz"));

    MapBindingSet solution2 = new MapBindingSet(bindingNames.size());
    solution2.addBinding("a", new LiteralImpl("1", XMLSchema.INTEGER));
    solution2.addBinding("c", new LiteralImpl("Hello World!", "en"));

    List<? extends BindingSet> bindingSetList = Arrays.asList(solution1, solution2);

    TupleResultImpl result = new TupleResultImpl(bindingNames, bindingSetList);
View Full Code Here

Examples of org.openrdf.model.impl.LiteralImpl

  public void testNotCompiled()
    throws Exception
  {
    Regex node = new Regex(expression, expression, null);
    Pattern pattern = node.compile(new LiteralImpl("regex"), null);
    assertNotNull(pattern);
    assertEquals("regex", pattern.pattern());
  }
View Full Code Here

Examples of org.openrdf.model.impl.LiteralImpl

    return memLiteral;
  }

  @Override
  public synchronized Literal createLiteral(String value) {
    Literal tempLiteral = new LiteralImpl(value);
    MemLiteral memLiteral = literalRegistry.get(tempLiteral);

    if (memLiteral == null) {
      memLiteral = createMemLiteral(tempLiteral);
    }
View Full Code Here

Examples of org.openrdf.model.impl.LiteralImpl

    return memLiteral;
  }

  @Override
  public synchronized Literal createLiteral(String value, String language) {
    Literal tempLiteral = new LiteralImpl(value, language);
    MemLiteral memLiteral = literalRegistry.get(tempLiteral);

    if (memLiteral == null) {
      memLiteral = createMemLiteral(tempLiteral);
    }
View Full Code Here

Examples of org.openrdf.model.impl.LiteralImpl

    return memLiteral;
  }

  @Override
  public synchronized Literal createLiteral(String value, URI datatype) {
    Literal tempLiteral = new LiteralImpl(value, datatype);
    MemLiteral memLiteral = literalRegistry.get(tempLiteral);

    if (memLiteral == null) {
      memLiteral = createMemLiteral(tempLiteral);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.