/** * Precondition: The specified index contains a float. Gets the float at the given index. * * @param index The index. * @return The float at the given index, or null of the index is undefined. */ public double getFloat(int index) { return get(index).floatValue(); }
/** * Precondition: The specified index contains a float. Gets the float at the given index. * * @param index The index. * @return The float at the given index, or null of the index is undefined. */ public double getFloat(int index) { return get(index).floatValue(); }
@Override public SoyData compute(List<SoyData> args) { SoyData arg = args.get(0); if (arg instanceof IntegerData) { return arg; } else { return toSoyData((int) Math.floor(arg.floatValue())); } }
/** * Precondition: The specified index contains a float. * Gets the float at the given index. * @param index The index. * @return The float at the given index, or null of the index is undefined. */ public double getFloat(int index) { return get(index).floatValue(); }
@Override public SoyData compute(List<SoyData> args) { SoyData arg = args.get(0); if (arg instanceof IntegerData) { return arg; } else { return toSoyData((int) Math.ceil(arg.floatValue())); } }
/** * Precondition: The specified key string is the path to a float. * Gets the float at the specified key string. * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. * @return The float at the specified key string. * @throws IllegalArgumentException If no data is stored at the specified key. */ public double getFloat(String keyStr) { SoyData valueData = get(keyStr); if (valueData == null) { throw new IllegalArgumentException("Missing key: " + keyStr); } return valueData.floatValue(); }
/** * Precondition: The specified key string is the path to a float. Gets the float at the specified * key string. * * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. * @return The float at the specified key string. * @throws IllegalArgumentException If no data is stored at the specified key. */ public double getFloat(String keyStr) { SoyData valueData = get(keyStr); if (valueData == null) { throw new IllegalArgumentException("Missing key: " + keyStr); } return valueData.floatValue(); }
/** * Precondition: The specified key string is the path to a float. Gets the float at the specified * key string. * * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. * @return The float at the specified key string. * @throws IllegalArgumentException If no data is stored at the specified key. */ public double getFloat(String keyStr) { SoyData valueData = get(keyStr); if (valueData == null) { throw new IllegalArgumentException("Missing key: " + keyStr); } return valueData.floatValue(); }
@Override protected SoyData visitNegativeOpNode(NegativeOpNode node) { SoyData operand = visit(node.getChild(0)); if (operand instanceof IntegerData) { return convertResult( - operand.integerValue() ); } else { return convertResult( - operand.floatValue() ); } }