Examples of asInt()


Examples of cambridge.model.Expression.asInt()

    public void testParseSimple() throws Exception
    {
        ExpressionContext context = language.createNewContext();
        Expression expression = language.parse("5 + 8", 1, 1);

        int i = expression.asInt(context);
        assertEquals(13, i);
    }

    @Test
    public void testParseVariable() throws Exception
View Full Code Here

Examples of com.eclipsesource.json.JsonValue.asInt()

    }

    public static int getInt(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asInt();
    }

    public static int getInt(JsonObject object, String field, int defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null) {
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.jackson.databind.JsonNode.asInt()

            String host = root.path("hostText").asText();
            JsonNode n = root.get("port");
            if (n == null) {
                return HostAndPort.fromString(host);
            }
            return HostAndPort.fromParts(host, n.asInt());
        }
        if (t == JsonToken.VALUE_STRING) {
            return HostAndPort.fromString(jp.getText().trim());
        }
        // could also support arrays?
View Full Code Here

Examples of com.fasterxml.jackson.databind.JsonNode.asInt()

            JsonNode capacity = typeNode.path(JsonConstants.Vehicle.Type.CAPACITY);
            Iterator<JsonNode> capacity_dimension_iterator = capacity.iterator();
            int capacity_index = 0;
            while(capacity_dimension_iterator.hasNext()){
                JsonNode capacity_value = capacity_dimension_iterator.next();
                int capacity_val = capacity_value.asInt();
                typeBuilder.addCapacityDimension(capacity_index,capacity_val);
                capacity_index++;
            }
            VehicleTypeImpl type = typeBuilder.build();
            vehicle_type_map.put(type.getTypeId(),type);
View Full Code Here

Examples of com.github.jsonj.JsonPrimitive.asInt()

public class JsonBuilderTest {
    public void shouldConstructInteger() {
        JsonPrimitive p1 = primitive(1234);
        double d1 = p1.asDouble();
        JsonPrimitive p2 = primitive(d1);
        Assert.assertEquals(1234, p2.asInt());
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void shouldConvertCollectionToJsonElement() {
        Map m = new HashMap();
View Full Code Here

Examples of com.google.common.hash.HashCode.asInt()

     * Default constructor.
     */
    ExceptionKey() {
        final HashFunction hashFunction = Hashing.md5();
        final HashCode hashCode = hashFunction.newHasher().putString(UUID.randomUUID().toString()).hash();
        this.key = hashCode.asInt();
        this.machineName = "UNKNOWN";
        try {
            InetAddress localMachine = java.net.InetAddress.getLocalHost();
            if (localMachine != null) {
                this.machineName = localMachine.getHostName();
View Full Code Here

Examples of com.hazelcast.com.eclipsesource.json.JsonValue.asInt()

    }

    public static int getInt(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asInt();
    }

    public static int getInt(JsonObject object, String field, int defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null) {
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OType.asInt()

        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName()
            + "' contains less characters than " + min + " requested");
      else if (p.getType().equals(OType.BINARY) && (fieldValue != null && ((byte[]) fieldValue).length < Integer.parseInt(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains less bytes than "
            + min + " requested");
      else if (p.getType().equals(OType.INTEGER) && (fieldValue != null && type.asInt(fieldValue) < Integer.parseInt(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
      else if (p.getType().equals(OType.LONG) && (fieldValue != null && type.asLong(fieldValue) < Long.parseLong(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
      else if (p.getType().equals(OType.FLOAT) && (fieldValue != null && type.asFloat(fieldValue) < Float.parseFloat(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OType.asInt()

        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName()
            + "' contains more characters than " + max + " requested");
      else if (p.getType().equals(OType.BINARY) && (fieldValue != null && ((byte[]) fieldValue).length > Integer.parseInt(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains more bytes than "
            + max + " requested");
      else if (p.getType().equals(OType.INTEGER) && (fieldValue != null && type.asInt(fieldValue) > Integer.parseInt(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
      else if (p.getType().equals(OType.LONG) && (fieldValue != null && type.asLong(fieldValue) > Long.parseLong(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
      else if (p.getType().equals(OType.FLOAT) && (fieldValue != null && type.asFloat(fieldValue) > Float.parseFloat(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
View Full Code Here

Examples of com.sk89q.jnbt.CompoundTag.asInt()

            boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ");
            boolean hasDirection = tag.containsKey("Direction");
            boolean hasLegacyDirection = tag.containsKey("Dir");

            if (hasTilePosition) {
                Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
                Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);

                CompoundTagBuilder builder = tag.createBuilder()
                        .putInt("TileX", newTilePosition.getBlockX())
                        .putInt("TileY", newTilePosition.getBlockY())
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.