Examples of optDouble()


Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        Assert.assertTrue(json.has(GraphSONTokens._ID));
        Assert.assertTrue(json.has(GraphSONTokens._TYPE));
        Assert.assertTrue(json.has(GraphSONTokens._LABEL));
        Assert.assertTrue(json.has(GraphSONTokens._IN_V));
        Assert.assertTrue(json.has(GraphSONTokens._OUT_V));
        Assert.assertEquals(0.5d, json.optDouble("weight"), 0.0d);
    }


    @Test
    public void jsonFromElementVertexNoPropertiesNoKeysNoTypes() throws JSONException {
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        Assert.assertTrue(json.has("keyLong"));
        Assert.assertEquals(1L, json.optLong("keyLong"));
        Assert.assertTrue(json.has("keyInt"));
        Assert.assertEquals(2, json.optInt("keyInt"));
        Assert.assertTrue(json.has("keyFloat"));
        Assert.assertEquals(3.3f, (float) json.optDouble("keyFloat"), 0);
        Assert.assertTrue(json.has("keyExponentialDouble"));
        Assert.assertEquals(1312928167.626012, json.optDouble("keyExponentialDouble"), 0);
        Assert.assertTrue(json.has("keyDouble"));
        Assert.assertEquals(4.4, json.optDouble("keyDouble"), 0);
        Assert.assertTrue(json.has("keyBoolean"));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        Assert.assertTrue(json.has("keyInt"));
        Assert.assertEquals(2, json.optInt("keyInt"));
        Assert.assertTrue(json.has("keyFloat"));
        Assert.assertEquals(3.3f, (float) json.optDouble("keyFloat"), 0);
        Assert.assertTrue(json.has("keyExponentialDouble"));
        Assert.assertEquals(1312928167.626012, json.optDouble("keyExponentialDouble"), 0);
        Assert.assertTrue(json.has("keyDouble"));
        Assert.assertEquals(4.4, json.optDouble("keyDouble"), 0);
        Assert.assertTrue(json.has("keyBoolean"));
        Assert.assertTrue(json.optBoolean("keyBoolean"));
    }
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

        Assert.assertTrue(json.has("keyFloat"));
        Assert.assertEquals(3.3f, (float) json.optDouble("keyFloat"), 0);
        Assert.assertTrue(json.has("keyExponentialDouble"));
        Assert.assertEquals(1312928167.626012, json.optDouble("keyExponentialDouble"), 0);
        Assert.assertTrue(json.has("keyDouble"));
        Assert.assertEquals(4.4, json.optDouble("keyDouble"), 0);
        Assert.assertTrue(json.has("keyBoolean"));
        Assert.assertTrue(json.optBoolean("keyBoolean"));
    }

    @Test
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

            JSONObject json = response.getEntity(JSONObject.class);
            Assert.assertNotNull(json);
            Assert.assertTrue(json.has("name"));
            Assert.assertEquals(tg.getGraphName(), json.optString("name"));
            Assert.assertTrue(json.has(Tokens.QUERY_TIME));
            Assert.assertTrue(json.optDouble(Tokens.QUERY_TIME) > 0);
            Assert.assertTrue(json.has(Tokens.UP_TIME));
            Assert.assertTrue(json.has(Tokens.READ_ONLY));
            Assert.assertTrue(json.has("version"));
            Assert.assertTrue(json.has("type"));
            Assert.assertEquals(tg.getGraphType(), json.optString("type"));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optDouble()

    }

    private void assertPostedEdgeComplexProperties(JSONObject createdEdgeJson) {
        JSONObject mapRootProperty = createdEdgeJson.optJSONObject("complex");
        Assert.assertEquals(123, mapRootProperty.optInt("propertya"));
        Assert.assertEquals(321.5, mapRootProperty.optDouble("propertyb"));

        JSONArray listInMapProperty = mapRootProperty.optJSONArray("propertyc");
        Assert.assertEquals(3, listInMapProperty.length());

        JSONObject mapInMapProperty = mapRootProperty.optJSONObject("propertyd");
View Full Code Here

Examples of org.json.JSONArray.optDouble()

    public void testArray() {
        JSONArray json = OTJson.array("string", 123, 123.456, true, false, null);
        Assert.assertNotNull(json);
        Assert.assertEquals("string", json.optString(0));
        Assert.assertEquals(123, json.optInt(1));
        Assert.assertEquals(123.456, json.optDouble(2), 1e-15);
        Assert.assertEquals(true, json.optBoolean(3));
        Assert.assertEquals(false, json.optBoolean(4));
        Assert.assertEquals(null, json.opt(5));
    }
View Full Code Here

Examples of org.json.JSONArray.optDouble()

        }
        leaderboardId = json.optString("leaderboard");
        value = json.optInt("value");
        if (json.has("loc")) {
            JSONArray locArray = json.optJSONArray("loc");
            lng = locArray.optDouble(0); // NOTE: lng first in mongodb!
            lat = locArray.optDouble(1);
        } else {
            lat = 0;
            lng = 0;
        }
View Full Code Here

Examples of org.json.JSONArray.optDouble()

        leaderboardId = json.optString("leaderboard");
        value = json.optInt("value");
        if (json.has("loc")) {
            JSONArray locArray = json.optJSONArray("loc");
            lng = locArray.optDouble(0); // NOTE: lng first in mongodb!
            lat = locArray.optDouble(1);
        } else {
            lat = 0;
            lng = 0;
        }
        createdAt = OTUtils.toDate(json.optString("createdAt"));
View Full Code Here

Examples of org.json.JSONObject.optDouble()

            for (int i = 0; i < streamsJson.length(); i++) {
                JSONObject streamsIndexJson = streamsJson.optJSONObject(i);
                if (streamsIndexJson != null) {
                    JSONObject tagsJson = streamsIndexJson.optJSONObject("tags");
                    if (tagsJson != null) {
                        Double optionalRotate = tagsJson.optDouble("rotate");
                        if (!Double.isNaN(optionalRotate)) {
                            Integer rotate = optionalRotate.intValue() % 360;
                            return rotate;
                        }
                    }
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.