Skip to content

Commit

Permalink
Changing variable name
Browse files Browse the repository at this point in the history
fitting methods
fitting junit tests
  • Loading branch information
Rosario Trischitta authored and FabiKo117 committed Nov 6, 2020
1 parent 59a95bf commit 360508a
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ public class AreaController {
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response}
* @throws Exception thrown by
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate() aggregate}
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate()
* aggregate}
*/
@ApiOperation(value = "Area of OSM elements", nickname = "area",
response = DefaultAggregationResponse.class)
@RequestMapping(value = "", method = {RequestMethod.GET, RequestMethod.POST},
produces = {"application/json", "text/csv"})
public Response area(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception
{
public Response area(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
throws Exception {
AggregateRequestExecutor executor =
new AggregateRequestExecutor(RequestResource.AREA, servletRequest, servletResponse, false);
return executor.aggregate();
Expand Down Expand Up @@ -77,7 +78,8 @@ public Response areaGroupByType(HttpServletRequest servletRequest,
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response}
* @throws Exception thrown by
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary() aggregateGroupByBoundary}
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary()
* aggregateGroupByBoundary}
*/
@ApiOperation(
value = "Area of OSM elements grouped by the boundary (bboxes, bcircles, or bpolys)",
Expand Down Expand Up @@ -174,7 +176,8 @@ public Response areaGroupByTag(HttpServletRequest servletRequest,
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response}
* @throws Exception thrown by
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate() aggregate}
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregate()
* aggregate}
*/
@ApiOperation(
value = "Density of OSM elements (area of elements divided "
Expand Down Expand Up @@ -217,7 +220,8 @@ public Response areaDensityGroupByType(HttpServletRequest servletRequest,
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.ohsome.ohsomeapi.output.dataaggregationresponse.Response Response}
* @throws Exception thrown by
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary() aggregateGroupByBoundary}
* {@link org.heigit.ohsome.ohsomeapi.executor.AggregateRequestExecutor#aggregateGroupByBoundary()
* aggregateGroupByBoundary}
*/
@ApiOperation(
value = "Density of OSM elements grouped by the boundary (bboxes, bcircles, or bpolys)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForElements
List<String[]> rows = new LinkedList<>();
for (int i = 0; i < resultSet.length; i++) {
GroupByResult groupByResult = (GroupByResult) resultSet[i];
Object groupByObject = groupByResult.getGroupByObject();
Object groupByObject = groupByResult.getGroupByObjectId();
if (groupByObject instanceof Object[]) {
Object[] groupByObjectArr = (Object[]) groupByObject;
columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForElements
List<String[]> rows = new LinkedList<>();
for (int i = 0; i < resultSet.length; i++) {
GroupByResult groupByResult = (GroupByResult) resultSet[i];
Object groupByObject = groupByResult.getGroupByObject();
Object groupByObject = groupByResult.getGroupByObjectId();
if (groupByObject instanceof Object[]) {
Object[] groupByObjectArr = (Object[]) groupByObject;
columnNames.add(groupByObjectArr[0].toString() + "_" + groupByObjectArr[1].toString());
Expand Down Expand Up @@ -814,9 +814,9 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForElements
List<String[]> rows = new LinkedList<>();
for (int i = 0; i < resultSet.length; i++) {
RatioGroupByResult ratioGroupByResult = (RatioGroupByResult) resultSet[i];
columnNames.add(ratioGroupByResult.getGroupByObject() + "_value");
columnNames.add(ratioGroupByResult.getGroupByObject() + "_value2");
columnNames.add(ratioGroupByResult.getGroupByObject() + "_ratio");
columnNames.add(ratioGroupByResult.getGroupByObjectId() + "_value");
columnNames.add(ratioGroupByResult.getGroupByObjectId() + "_value2");
columnNames.add(ratioGroupByResult.getGroupByObjectId() + "_ratio");
for (int j = 0; j < ratioGroupByResult.getRatioResult().length; j++) {
RatioResult ratioResult = ratioGroupByResult.getRatioResult()[j];
if (i == 0) {
Expand Down Expand Up @@ -852,7 +852,7 @@ private ImmutablePair<List<String>, List<String[]>> createCsvResponseForUsersGro
List<String[]> rows = new LinkedList<>();
for (int i = 0; i < resultSet.length; i++) {
GroupByResult groupByResult = (GroupByResult) resultSet[i];
columnNames.add(groupByResult.getGroupByObject().toString());
columnNames.add(groupByResult.getGroupByObjectId().toString());
for (int j = 0; j < groupByResult.getResult().length; j++) {
UsersResult usersResult = (UsersResult) groupByResult.getResult()[j];
if (i == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
public abstract class GroupByObject {

@ApiModelProperty(notes = "Object on which the results are grouped on", required = true)
protected Object groupByObject;
protected Object groupByObjectId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class RatioGroupByResult extends GroupByObject {
required = true)
private RatioResult[] ratioResult;

public RatioGroupByResult(Object groupByObject, RatioResult[] ratioResult) {
super(groupByObject);
public RatioGroupByResult(Object groupByObjectId, RatioResult[] ratioResult) {
super(groupByObjectId);
this.ratioResult = ratioResult;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static Feature[] generateGroupByResultGeoJson(GroupByObject[] results,
}
feature.setProperty("value", res.getValue());
// needed for /groupBy/boundary/groupBy/tag
if (results[groupByResultCount].getGroupByObject() instanceof Object[]) {
if (results[groupByResultCount].getGroupByObjectId() instanceof Object[]) {
feature.setGeometry(geojsonGeoms[boundaryCount]);
if ((i + 1) % nestedGroupByNextBoundaryInterval == 0) {
boundaryCount++;
Expand Down Expand Up @@ -132,7 +132,7 @@ private static Feature fillGeojsonFeature(GroupByObject[] results, int groupByRe
/** Fills a GeoJSON Feature with the groupByBoundaryId and the geometry. */
private static Feature makeGeojsonFeature(GroupByObject[] results, int groupByResultCount,
String id) {
Object groupByBoundaryId = results[groupByResultCount].getGroupByObject();
Object groupByBoundaryId = results[groupByResultCount].getGroupByObjectId();
Feature feature = new Feature();
if (groupByBoundaryId instanceof Object[]) {
Object[] groupByBoundaryIdArr = (Object[]) groupByBoundaryId;
Expand Down
Loading

0 comments on commit 360508a

Please sign in to comment.