当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.getDouble方法代码示例

本文整理汇总了Java中com.amazonaws.util.json.JSONObject.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.getDouble方法的具体用法?Java JSONObject.getDouble怎么用?Java JSONObject.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.util.json.JSONObject的用法示例。


在下文中一共展示了JSONObject.getDouble方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyRecord

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private boolean verifyRecord(ByteBuffer buffer) throws JSONException, UnsupportedEncodingException {
	buffer.get(bytearray, 0, buffer.remaining());
	JSONObject json = new JSONObject(new String(bytearray, "UTF-8"));
	String user = json.getString("user");
	if (users.contains(user)) {
		MessageProxy proxy = MessageProxy.getInstance();
		double x = json.getDouble("latitude");
		double y = json.getDouble("longitude");
		proxy.sendMesg(user + "," + json.getDouble("latitude") + "," + json.getDouble("longitude"));
		System.out.println(x + "," + y);
		if (coordsListener.verifyCoordinates(x, y)) {
			System.out.println("Matched! '" + user + "' is at (" + x + ", " + y + ")");
			loader.put(user, System.currentTimeMillis(), x, y);
			return true;
		}
	}
	
	return false;
}
 
开发者ID:tyagihas,项目名称:awsbigdata,代码行数:20,代码来源:Processor.java

示例2: queryRectangle

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void queryRectangle(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint minPoint = new GeoPoint(requestObject.getDouble("minLat"), requestObject.getDouble("minLng"));
	GeoPoint maxPoint = new GeoPoint(requestObject.getDouble("maxLat"), requestObject.getDouble("maxLng"));
	String filterUserId = requestObject.getString("filterUserId");

	List<String> attributesToGet = new ArrayList<String>();
	attributesToGet.add(config.getRangeKeyAttributeName());
	attributesToGet.add(config.getGeoJsonAttributeName());
	attributesToGet.add("title");
	attributesToGet.add("userId");

	QueryRectangleRequest queryRectangleRequest = new QueryRectangleRequest(minPoint, maxPoint);
	queryRectangleRequest.getQueryRequest().setAttributesToGet(attributesToGet);
	QueryRectangleResult queryRectangleResult = geoDataManager.queryRectangle(queryRectangleRequest);

	printGeoQueryResult(queryRectangleResult, out, filterUserId);
}
 
开发者ID:aws-samples,项目名称:reinvent2013-mobile-photo-share,代码行数:18,代码来源:GeoDynamoDBServlet.java

示例3: queryRadius

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void queryRadius(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint centerPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	double radiusInMeter = requestObject.getDouble("radiusInMeter");
	String filterUserId = requestObject.getString("filterUserId");

	List<String> attributesToGet = new ArrayList<String>();
	attributesToGet.add(config.getRangeKeyAttributeName());
	attributesToGet.add(config.getGeoJsonAttributeName());
	attributesToGet.add("title");
	attributesToGet.add("userId");

	QueryRadiusRequest queryRadiusRequest = new QueryRadiusRequest(centerPoint, radiusInMeter);
	queryRadiusRequest.getQueryRequest().setAttributesToGet(attributesToGet);
	QueryRadiusResult queryRadiusResult = geoDataManager.queryRadius(queryRadiusRequest);

	printGeoQueryResult(queryRadiusResult, out, filterUserId);
}
 
开发者ID:aws-samples,项目名称:reinvent2013-mobile-photo-share,代码行数:18,代码来源:GeoDynamoDBServlet.java

示例4: putPoint

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void putPoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(requestObject.getString("s3-photo-url"));
	AttributeValue titleAttributeValue = new AttributeValue().withS(requestObject.getString("title"));
	AttributeValue userIdAttributeValue = new AttributeValue().withS(requestObject.getString("userId"));

	PutPointRequest putPointRequest = new PutPointRequest(geoPoint, rangeKeyAttributeValue);
	putPointRequest.getPutItemRequest().addItemEntry("title", titleAttributeValue);
	putPointRequest.getPutItemRequest().addItemEntry("userId", userIdAttributeValue);

	PutPointResult putPointResult = geoDataManager.putPoint(putPointRequest);
	printPutPointResult(putPointResult, out);
}
 
开发者ID:aws-samples,项目名称:reinvent2013-mobile-photo-share,代码行数:14,代码来源:GeoDynamoDBServlet.java

示例5: getPoint

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void getPoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(requestObject.getString("rangeKey"));

	GetPointRequest getPointRequest = new GetPointRequest(geoPoint, rangeKeyAttributeValue);
	GetPointResult getPointResult = geoDataManager.getPoint(getPointRequest);

	printGetPointRequest(getPointResult, out);
}
 
开发者ID:aws-samples,项目名称:reinvent2013-mobile-photo-share,代码行数:10,代码来源:GeoDynamoDBServlet.java

示例6: deletePoint

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void deletePoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(requestObject.getString("rangeKey"));

	DeletePointRequest deletePointRequest = new DeletePointRequest(geoPoint, rangeKeyAttributeValue);
	DeletePointResult deletePointResult = geoDataManager.deletePoint(deletePointRequest);

	printDeletePointResult(deletePointResult, out);
}
 
开发者ID:aws-samples,项目名称:reinvent2013-mobile-photo-share,代码行数:10,代码来源:GeoDynamoDBServlet.java

示例7: putPoint

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void putPoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(UUID.randomUUID().toString());
	AttributeValue schoolNameKeyAttributeValue = new AttributeValue().withS(requestObject.getString("schoolName"));

	PutPointRequest putPointRequest = new PutPointRequest(geoPoint, rangeKeyAttributeValue);
	putPointRequest.getPutItemRequest().addItemEntry("schoolName", schoolNameKeyAttributeValue);

	PutPointResult putPointResult = geoDataManager.putPoint(putPointRequest);

	printPutPointResult(putPointResult, out);
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:13,代码来源:GeoDynamoDBServlet.java

示例8: updatePoint

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void updatePoint(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint geoPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	AttributeValue rangeKeyAttributeValue = new AttributeValue().withS(requestObject.getString("rangeKey"));

	String schoolName = requestObject.getString("schoolName");
	AttributeValueUpdate schoolNameValueUpdate = null;

	String memo = requestObject.getString("memo");
	AttributeValueUpdate memoValueUpdate = null;

	if (schoolName == null || schoolName.equalsIgnoreCase("")) {
		schoolNameValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.DELETE);
	} else {
		AttributeValue schoolNameAttributeValue = new AttributeValue().withS(schoolName);
		schoolNameValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(
				schoolNameAttributeValue);
	}

	if (memo == null || memo.equalsIgnoreCase("")) {
		memoValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.DELETE);
	} else {
		AttributeValue memoAttributeValue = new AttributeValue().withS(memo);
		memoValueUpdate = new AttributeValueUpdate().withAction(AttributeAction.PUT).withValue(memoAttributeValue);
	}

	UpdatePointRequest updatePointRequest = new UpdatePointRequest(geoPoint, rangeKeyAttributeValue);
	updatePointRequest.getUpdateItemRequest().addAttributeUpdatesEntry("schoolName", schoolNameValueUpdate);
	updatePointRequest.getUpdateItemRequest().addAttributeUpdatesEntry("memo", memoValueUpdate);

	UpdatePointResult updatePointResult = geoDataManager.updatePoint(updatePointRequest);

	printUpdatePointResult(updatePointResult, out);
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:34,代码来源:GeoDynamoDBServlet.java

示例9: queryRectangle

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void queryRectangle(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint minPoint = new GeoPoint(requestObject.getDouble("minLat"), requestObject.getDouble("minLng"));
	GeoPoint maxPoint = new GeoPoint(requestObject.getDouble("maxLat"), requestObject.getDouble("maxLng"));
	
	List<String> attributesToGet = new ArrayList<String>();
	attributesToGet.add(config.getRangeKeyAttributeName());
	attributesToGet.add(config.getGeoJsonAttributeName());
	attributesToGet.add("schoolName");

	QueryRectangleRequest queryRectangleRequest = new QueryRectangleRequest(minPoint, maxPoint);
	queryRectangleRequest.getQueryRequest().setAttributesToGet(attributesToGet);
	QueryRectangleResult queryRectangleResult = geoDataManager.queryRectangle(queryRectangleRequest);

	printGeoQueryResult(queryRectangleResult, out);
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:16,代码来源:GeoDynamoDBServlet.java

示例10: queryRadius

import com.amazonaws.util.json.JSONObject; //导入方法依赖的package包/类
private void queryRadius(JSONObject requestObject, PrintWriter out) throws IOException, JSONException {
	GeoPoint centerPoint = new GeoPoint(requestObject.getDouble("lat"), requestObject.getDouble("lng"));
	double radiusInMeter = requestObject.getDouble("radiusInMeter");
	
	List<String> attributesToGet = new ArrayList<String>();
	attributesToGet.add(config.getRangeKeyAttributeName());
	attributesToGet.add(config.getGeoJsonAttributeName());
	attributesToGet.add("schoolName");

	QueryRadiusRequest queryRadiusRequest = new QueryRadiusRequest(centerPoint, radiusInMeter);
	queryRadiusRequest.getQueryRequest().setAttributesToGet(attributesToGet);
	QueryRadiusResult queryRadiusResult = geoDataManager.queryRadius(queryRadiusRequest);

	printGeoQueryResult(queryRadiusResult, out);
}
 
开发者ID:awslabs,项目名称:dynamodb-geo,代码行数:16,代码来源:GeoDynamoDBServlet.java


注:本文中的com.amazonaws.util.json.JSONObject.getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。