public BigInteger deserialize(Literal literal) { return literal.integerValue(); }
public BigInteger integerValue() { return lit.integerValue(); }
public BigInteger deserialize(Literal literal) { return literal.integerValue(); }
public BigInteger deserialize(Literal literal) { return literal.integerValue(); }
/** * Gets the integer value of the supplied literal. The fallback value is * returned in case {@link Literal#integerValue()} throws a * {@link NumberFormatException}. * * @param l * The literal to get the integer value for. * @param fallback * The value to fall back to in case no integer value could gotten * from the literal. * @return Either the literal's integer value, or the fallback value. */ public static BigInteger getIntegerValue(Literal l, BigInteger fallback) { try { return l.integerValue(); } catch (NumberFormatException e) { return fallback; } }
/** * Gets the integer value of the supplied literal. The fallback value is * returned in case {@link Literal#integerValue()} throws a * {@link NumberFormatException}. * * @param l * The literal to get the integer value for. * @param fallback * The value to fall back to in case no integer value could gotten * from the literal. * @return Either the literal's integer value, or the fallback value. */ public static BigInteger getIntegerValue(Literal l, BigInteger fallback) { try { return l.integerValue(); } catch (NumberFormatException e) { return fallback; } }
/** * Implements {@link Literal#integerValue()}. */ @Override public BigInteger integerValue() { if (!isLiteral()) throw new ClassCastException(); return ((Literal) getValue()).integerValue(); }
/** * Implements {@link Literal#integerValue()}. */ @Override public BigInteger integerValue() { if (!isLiteral()) throw new ClassCastException(); return ((Literal) getValue()).integerValue(); }
@Override public BigInteger integerValue(Value node) { try { return ((Literal)node).integerValue(); } catch (ClassCastException e) { throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" + "but of type "+debugType(node)); } }
@Override public BigInteger integerValue(Value node) { try { return ((Literal)node).integerValue(); } catch (ClassCastException e) { throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" + "but of type "+debugType(node)); } }
@Override public BigInteger integerValue(Value node) { try { return ((Literal)node).integerValue(); } catch (ClassCastException e) { throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" + "but of type "+debugType(node)); } }
@Override public BigInteger integerValue(Value node) { try { return ((Literal)node).integerValue(); } catch (ClassCastException e) { throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" + "but of type "+debugType(node)); } }
public static BigInteger integer(final Object arg) { return ((Literal) evaluate(new IntegerCast(), arg)).integerValue(); }
@Override public void update(final AggregationElement aggregation, final AggregationState state, final VisibilityBindingSet childBindingSet) { checkArgument(aggregation.getAggregationType() == AggregationType.COUNT, "The CountFunction only accepts COUNT AggregationElements."); requireNonNull(state); requireNonNull(childBindingSet); // Only add one to the count if the child contains the binding that we are counting. final String aggregatedName = aggregation.getAggregatedBindingName(); if(childBindingSet.hasBinding(aggregatedName)) { final MapBindingSet result = state.getBindingSet(); final String resultName = aggregation.getResultBindingName(); final boolean newBinding = !result.hasBinding(resultName); if(newBinding) { // Initialize the binding. result.addBinding(resultName, new IntegerLiteralImpl(BigInteger.ONE)); } else { // Update the existing binding. final Literal count = (Literal) result.getValue(resultName); final BigInteger updatedCount = count.integerValue().add( BigInteger.ONE ); result.addBinding(resultName, new IntegerLiteralImpl(updatedCount)); } } } }
@Override protected Value evaluate(ValueFactory valueFactory, Value arg1, Value arg2) throws ValueExprEvaluationException { if (!(arg1 instanceof Literal) || !(arg2 instanceof Literal)) { throw new ValueExprEvaluationException("Both arguments must be literals"); } Literal number = (Literal) arg1; Literal format = (Literal) arg2; java.text.DecimalFormat formatter = new java.text.DecimalFormat(format.getLabel()); String value; if (XMLSchema.INT.equals(number.getDatatype()) || XMLSchema.LONG.equals(number.getDatatype()) || XMLSchema.SHORT.equals(number.getDatatype()) || XMLSchema.BYTE.equals(number.getDatatype())) { value = formatter.format(number.longValue()); } else if (XMLSchema.DECIMAL.equals(number.getDatatype())) { value = formatter.format(number.decimalValue()); } else if (XMLSchema.INTEGER.equals(number.getDatatype())) { value = formatter.format(number.integerValue()); } else { value = formatter.format(number.doubleValue()); } return valueFactory.createLiteral(value); } }
integerValue = literal.integerValue();
BigInteger left = l1.integerValue(); BigInteger right = l2.integerValue(); return numericalMath(left, right, op);
return numericalFunc(lit.decimalValue(), op); } else if (dte1.equals(XMLSchema.INTEGER)) { return numericalFunc(lit.integerValue(), op); } else if (dte1.equals(XMLSchema.FLOAT)) { return numericalFunc(lit.floatValue(), op);
return numericalFunc(lit.decimalValue(), op); } else if (dte1.equals(XMLSchema.INTEGER)) { return numericalFunc(lit.integerValue(), op); } else if (dte1.equals(XMLSchema.FLOAT)) { return numericalFunc(lit.floatValue(), op);
return l.getLabel(); } else if (XMLSchema.INTEGER.equals(datatype)) { return l.integerValue(); } else if (XMLSchema.INT.equals(datatype)) { return l.intValue();