Revision: 5028
http://sourceforge.net/p/jump-pilot/code/5028
Author: michaudm
Date: 2016-09-21 07:00:32 +0000 (Wed, 21 Sep 2016)
Log Message:
-----------
Small cleaning
Modified Paths:
--------------
core/trunk/src/com/vividsolutions/jump/task/TaskMonitorSupport.java
core/trunk/src/com/vividsolutions/jump/tools/OverlayEngine.java
core/trunk/src/com/vividsolutions/jump/util/commandline/CommandLine.java
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AbstractAggregator.java
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregator.java
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregators.java
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AttributeAggregator.java
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/FeatureCollectionAggregator.java
Modified: core/trunk/src/com/vividsolutions/jump/task/TaskMonitorSupport.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/task/TaskMonitorSupport.java
2016-09-21 06:10:02 UTC (rev 5027)
+++ core/trunk/src/com/vividsolutions/jump/task/TaskMonitorSupport.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -1,6 +1,6 @@
package com.vividsolutions.jump.task;
public interface TaskMonitorSupport {
- public void setTaskMonitor(TaskMonitor taskMonitor);
- public TaskMonitor getTaskMonitor();
+ void setTaskMonitor(TaskMonitor taskMonitor);
+ TaskMonitor getTaskMonitor();
}
Modified: core/trunk/src/com/vividsolutions/jump/tools/OverlayEngine.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/tools/OverlayEngine.java
2016-09-21 06:10:02 UTC (rev 5027)
+++ core/trunk/src/com/vividsolutions/jump/tools/OverlayEngine.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -142,7 +142,7 @@
addFeature(intersection, overlay, mapping, a, b);
}
- protected void addFeature(Geometry intersection, FeatureCollection overlay,
+ private void addFeature(Geometry intersection, FeatureCollection overlay,
AttributeMapping mapping, Feature a, Feature b) {
if (splittingGeometryCollections && intersection instanceof
GeometryCollection) {
GeometryCollection gc = (GeometryCollection) intersection;
Modified:
core/trunk/src/com/vividsolutions/jump/util/commandline/CommandLine.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/util/commandline/CommandLine.java
2016-09-21 06:10:02 UTC (rev 5027)
+++ core/trunk/src/com/vividsolutions/jump/util/commandline/CommandLine.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -47,14 +47,13 @@
// store options defs
Vector<OptionSpec> optSpecs = new Vector<>();
+
// store optionless file parameters
Vector<String> parVec = new Vector<>(); // store plain params (e.g.
projects/files to open)
- char optionChar; // the char that indicates an option. Default is '/', which
- // is
+ char optionChar; // the char that indicates an option. Default is '/', which
is
// NT Standard, but this causes problems on Unix systems, so
- // '-' should
- // be used for cross-platform apps
+ // '-' is used by JUMPWorkbench (better for cross-platform
apps)
public CommandLine() {
this('/');
Modified:
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AbstractAggregator.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AbstractAggregator.java
2016-09-21 06:10:02 UTC (rev 5027)
+++
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AbstractAggregator.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -8,7 +8,7 @@
/**
* Basic implementation of Aggregator interface.
*/
-public abstract class AbstractAggregator<T> implements Aggregator<T> {
+abstract class AbstractAggregator<T> implements Aggregator<T> {
final private AttributeType outputType;
private boolean ignoreNull;
@@ -20,14 +20,15 @@
this.ignoreNull = ignoreNull;
if (kv != null) {
if (kv.length % 2 == 1) {
- throw new IllegalArgumentException("Aggregator constructor
should have an even number of arguments representing successively keys and
values");
+ throw new IllegalArgumentException("Aggregator constructor
should have " +
+ "an even number of arguments representing successively
keys and values");
}
- this.parameters = new LinkedHashMap<String,Object>();
+ this.parameters = new LinkedHashMap<>();
for (int i = 0 ; i < kv.length/2 ; i += 2) {
this.parameters.put(kv[i].toString(), kv[i+1]);
}
}
- values = new ArrayList<T>();
+ values = new ArrayList<>();
}
public Set<String> getParameters() {
@@ -36,7 +37,7 @@
public void setParameter(String name, Object value) {
if (parameters == null) {
- parameters = new LinkedHashMap<String, Object>();
+ parameters = new LinkedHashMap<>();
}
parameters.put(name, value);
}
Modified:
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregator.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregator.java
2016-09-21 06:10:02 UTC (rev 5027)
+++ core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregator.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -30,7 +30,7 @@
/**
* Return parameter names used by this aggregator
- * @return
+ * @return the set of parameters
*/
Set<String> getParameters();
@@ -53,7 +53,7 @@
String getName();
/**
- * Returns AttributeType of the aggregated value.
+ * @Return the AttributeType of the aggregated value.
*/
AttributeType getOutputAttributeType();
@@ -64,13 +64,12 @@
void addValue(T value);
/**
- * Returns all the values accumulated by this aggregator.
- * @return
+ * @return the values accumulated by this aggregator.
*/
List<T> getValues();
/**
- * Returns the aggregated value.
+ * @return the aggregated value.
*/
Object getResult();
Modified:
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregators.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregators.java
2016-09-21 06:10:02 UTC (rev 5027)
+++ core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/Aggregators.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -38,7 +38,7 @@
aggregatorsByName.put(aggregator.getName(), aggregator);
Map<String,Aggregator> map = aggregatorsByType.get(inputType);
if (map == null) {
- map = new HashMap<String, Aggregator>();
+ map = new HashMap<>();
aggregatorsByType.put(inputType, map);
}
map.put(aggregator.getName(), aggregator);
Modified:
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AttributeAggregator.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AttributeAggregator.java
2016-09-21 06:10:02 UTC (rev 5027)
+++
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/AttributeAggregator.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -20,7 +20,7 @@
this.outputName = outputName;
}
- public String getInputName() {
+ String getInputName() {
return inputName;
}
@@ -28,7 +28,7 @@
return aggregator;
}
- public String getOutputName() {
+ String getOutputName() {
return outputName;
}
}
Modified:
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/FeatureCollectionAggregator.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/FeatureCollectionAggregator.java
2016-09-21 06:10:02 UTC (rev 5027)
+++
core/trunk/src/org/openjump/core/ui/plugin/tools/aggregate/FeatureCollectionAggregator.java
2016-09-21 07:00:32 UTC (rev 5028)
@@ -19,7 +19,7 @@
private FeatureCollection fc;
private List<String> keyAttributes;
- List<AttributeAggregator> aggregators;
+ private List<AttributeAggregator> aggregators;
public FeatureCollectionAggregator(FeatureCollection fc, List<String>
keyAttributes, List<AttributeAggregator> aggregators)
throws AggregatorException {
@@ -27,9 +27,9 @@
this.keyAttributes = keyAttributes;
this.aggregators = aggregators;
// Check validity of input attribute names
- for (int i = 0 ; i < keyAttributes.size() ; i++) {
- if (!fc.getFeatureSchema().hasAttribute(keyAttributes.get(i))) {
- throw new AggregatorException(I18N.getMessage(KEY +
".attribute-does-not-exists", keyAttributes.get(i)));
+ for (String attributeName : keyAttributes) {
+ if (!fc.getFeatureSchema().hasAttribute(attributeName)) {
+ throw new AggregatorException(I18N.getMessage(KEY +
".attribute-does-not-exists", attributeName));
}
}
for (AttributeAggregator aggregator : aggregators) {
@@ -44,17 +44,17 @@
* aggregated on features having the same key.
* Feature's key are defined by one or more attributes from the source
* featureCollection.
- * @return
+ * @return the featureCollection with aggregated attributes
*/
public FeatureCollection getAggregatedFeatureCollection() {
- Map<Key,List<AttributeAggregator>> map = new HashMap<Key,
List<AttributeAggregator>>();
+ Map<Key,List<AttributeAggregator>> map = new HashMap<>();
// Add attributes values to features with teh same key
for (Object object : fc.getFeatures()) {
Feature feature = (Feature)object;
Key key = new Key(feature, keyAttributes);
List<AttributeAggregator> featureAggregators = map.get(key);
if (featureAggregators == null) {
- featureAggregators = new ArrayList<AttributeAggregator>();
+ featureAggregators = new ArrayList<>();
for (AttributeAggregator agg : aggregators) {
featureAggregators.add(new AttributeAggregator(
@@ -87,9 +87,9 @@
private FeatureSchema getFeatureSchema() {
FeatureSchema oldSchema = fc.getFeatureSchema();
FeatureSchema newSchema = new FeatureSchema();
- for (int i = 0 ; i < keyAttributes.size() ; i++) {
- newSchema.addAttribute(keyAttributes.get(i),
-
oldSchema.getAttributeType(oldSchema.getAttributeIndex(keyAttributes.get(i))));
+ for (String attributeName : keyAttributes) {
+ newSchema.addAttribute(attributeName,
+
oldSchema.getAttributeType(oldSchema.getAttributeIndex(attributeName)));
}
for (AttributeAggregator agg : aggregators) {
newSchema.addAttribute(agg.getOutputName(),
agg.getAggregator().getOutputAttributeType());
@@ -99,7 +99,7 @@
public static class Key {
- private Map<String,Object> map = new HashMap<String, Object>();
+ private Map<String,Object> map = new HashMap<>();
Key(Feature feature, List<String> attributes) {
for (String name : attributes) {
@@ -122,8 +122,8 @@
}
- public static class AggregatorException extends Exception {
- public AggregatorException(String message) {
+ private static class AggregatorException extends Exception {
+ AggregatorException(String message) {
super(message);
}
}
------------------------------------------------------------------------------
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel