Changeset 10657 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2016-07-27T02:08:34+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10625 r10657 294 294 if (middleMouseDown || isAtOldPosition) { 295 295 Collection<OsmPrimitive> osms = mv.getAllNearest(ms.mousePos, 296 o -> isUsablePredicate. evaluate(o) && isSelectablePredicate.evaluate(o));296 o -> isUsablePredicate.test(o) && isSelectablePredicate.test(o)); 297 297 298 298 final JPanel c = new JPanel(new GridBagLayout()); -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r10634 r10657 26 26 import java.util.TreeMap; 27 27 import java.util.concurrent.CopyOnWriteArrayList; 28 import java.util.function.Predicate; 28 29 import java.util.zip.CRC32; 29 30 … … 59 60 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 60 61 import org.openstreetmap.josm.gui.util.CursorManager; 61 import org.openstreetmap.josm.tools.Predicate;62 62 import org.openstreetmap.josm.tools.Utils; 63 63 … … 818 818 819 819 for (Node n : ds.searchNodes(getBBox(p, PROP_SNAP_DISTANCE.get()))) { 820 if (predicate. evaluate(n)820 if (predicate.test(n) 821 821 && (dist = getPoint2D(n).distanceSq(p)) < snapDistanceSq) { 822 822 List<Node> nlist; … … 1027 1027 1028 1028 for (Way w : ds.searchWays(getBBox(p, Main.pref.getInteger("mappaint.segment.snap-distance", 10)))) { 1029 if (!predicate. evaluate(w)) {1029 if (!predicate.test(w)) { 1030 1030 continue; 1031 1031 } … … 1471 1471 for (OsmPrimitive o : nearestList) { 1472 1472 for (OsmPrimitive r : o.getReferrers()) { 1473 if (r instanceof Relation && predicate. evaluate(r)) {1473 if (r instanceof Relation && predicate.test(r)) { 1474 1474 parentRelations.add(r); 1475 1475 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java
r10611 r10657 25 25 import org.openstreetmap.josm.data.osm.RelationToChildReference; 26 26 import org.openstreetmap.josm.gui.util.GuiHelper; 27 import org.openstreetmap.josm.tools.Utils;28 27 29 28 /** … … 200 199 public void prepareDefaultRelationDecisions() { 201 200 202 if ( Utils.forAll(primitives,OsmPrimitive.nodePredicate)) {201 if (primitives.stream().allMatch(OsmPrimitive.nodePredicate)) { 203 202 final Collection<OsmPrimitive> primitivesInDecisions = new HashSet<>(); 204 203 for (final RelationMemberConflictDecision i : decisions) { … … 234 233 iterators.add(i.iterator()); 235 234 } 236 while ( Utils.forAll(iterators,it -> it.hasNext())) {235 while (iterators.stream().allMatch(it -> it.hasNext())) { 237 236 final List<RelationMemberConflictDecision> decisions = new ArrayList<>(); 238 237 final Collection<String> roles = new HashSet<>(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r10619 r10657 80 80 import org.openstreetmap.josm.tools.InputMapUtils; 81 81 import org.openstreetmap.josm.tools.Shortcut; 82 import org.openstreetmap.josm.tools. Utils;82 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 83 83 84 84 /** … … 488 488 private void updateFilteredRelations() { 489 489 if (filter != null) { 490 filteredRelations = new ArrayList<>( Utils.filter(relations, filter::match));490 filteredRelations = new ArrayList<>(SubclassFilteredCollection.filter(relations, filter::match)); 491 491 } else if (filteredRelations != null) { 492 492 filteredRelations = null; -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r10619 r10657 878 878 private Set<OsmPrimitive> members = new HashSet<>(); 879 879 private List<Integer> position = new ArrayList<>(); 880 private Iterable<OsmPrimitive> selection;880 private Collection<OsmPrimitive> selection; 881 881 private String positionString; 882 882 private String roleString; 883 883 884 MemberInfo( Iterable<OsmPrimitive> selection) {884 MemberInfo(Collection<OsmPrimitive> selection) { 885 885 this.selection = selection; 886 886 } … … 896 896 positionString = Utils.getPositionListString(position); 897 897 // if not all objects from the selection are member of this relation 898 if ( Utils.exists(selection,Predicates.not(Predicates.inCollection(members)))) {898 if (selection.stream().anyMatch(Predicates.not(Predicates.inCollection(members)))) { 899 899 positionString += ",\u2717"; 900 900 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r10611 r10657 17 17 import java.util.Map.Entry; 18 18 import java.util.Set; 19 import java.util.function.Predicate; 19 20 20 21 import javax.swing.JTree; … … 36 37 import org.openstreetmap.josm.tools.Destroyable; 37 38 import org.openstreetmap.josm.tools.MultiMap; 38 import org.openstreetmap.josm.tools.Predicate;39 39 import org.openstreetmap.josm.tools.Predicates; 40 import org.openstreetmap.josm.tools.Utils;41 40 42 41 /** … … 364 363 final TestError error = (TestError) ((DefaultMutableTreeNode) child).getUserObject(); 365 364 if (error.getPrimitives() != null) { 366 if ( Utils.exists(error.getPrimitives(),isRelevant)) {365 if (error.getPrimitives().stream().anyMatch(isRelevant)) { 367 366 paths.add(p.pathByAddingChild(child)); 368 367 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r10611 r10657 14 14 import java.util.Map.Entry; 15 15 import java.util.Objects; 16 import java.util.function.Predicate; 16 17 17 18 import javax.swing.JOptionPane; … … 26 27 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 27 28 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 28 import org.openstreetmap.josm.tools.Predicate; 29 import org.openstreetmap.josm.tools.Utils; 29 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 30 30 import org.openstreetmap.josm.tools.WindowGeometry; 31 31 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; … … 177 177 */ 178 178 public void showHistory(final Collection<? extends PrimitiveId> primitives) { 179 final Collection<? extends PrimitiveId> notNewPrimitives = Utils.filter(primitives, notNewPredicate);179 final Collection<? extends PrimitiveId> notNewPrimitives = SubclassFilteredCollection.filter(primitives, notNewPredicate); 180 180 if (notNewPrimitives.isEmpty()) { 181 181 JOptionPane.showMessageDialog( … … 187 187 } 188 188 189 Collection<? extends PrimitiveId> toLoad = Utils.filter(primitives, unloadedHistoryPredicate);189 Collection<? extends PrimitiveId> toLoad = SubclassFilteredCollection.filter(primitives, unloadedHistoryPredicate); 190 190 if (!toLoad.isEmpty()) { 191 191 HistoryLoadTask task = new HistoryLoadTask(); … … 217 217 218 218 @Override 219 public boolean evaluate(PrimitiveId p) {219 public boolean test(PrimitiveId p) { 220 220 History h = hds.getHistory(p); 221 221 if (h == null) -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r10607 r10657 11 11 import java.util.Objects; 12 12 import java.util.Set; 13 import java.util.function.Predicate; 13 14 import java.util.regex.Pattern; 14 15 … … 26 27 import org.openstreetmap.josm.gui.mappaint.Environment; 27 28 import org.openstreetmap.josm.tools.CheckParameterUtil; 28 import org.openstreetmap.josm.tools.Predicate;29 29 import org.openstreetmap.josm.tools.Predicates; 30 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 30 31 import org.openstreetmap.josm.tools.Utils; 31 32 … … 463 464 return e.osm.isKeyFalse(label) ^ negateResult; 464 465 case REGEX: 465 return Utils.exists(e.osm.keySet(),containsPattern) ^ negateResult;466 return e.osm.keySet().stream().anyMatch(containsPattern) ^ negateResult; 466 467 default: 467 468 return e.osm.hasKey(label) ^ negateResult; … … 486 487 String key = label; 487 488 if (KeyMatchType.REGEX.equals(matchType)) { 488 final Collection<String> matchingKeys = Utils.filter(p.keySet(), containsPattern);489 final Collection<String> matchingKeys = SubclassFilteredCollection.filter(p.keySet(), containsPattern); 489 490 if (!matchingKeys.isEmpty()) { 490 491 key = matchingKeys.iterator().next(); … … 666 667 */ 667 668 static boolean inDownloadedArea(Environment e) { // NO_UCD (unused code) 668 return IN_DOWNLOADED_AREA. evaluate(e.osm);669 return IN_DOWNLOADED_AREA.test(e.osm); 669 670 } 670 671 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r10627 r10657 38 38 import org.openstreetmap.josm.tools.Predicates; 39 39 import org.openstreetmap.josm.tools.RightAndLefthandTraffic; 40 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 40 41 import org.openstreetmap.josm.tools.Utils; 41 42 import org.openstreetmap.josm.tools.Utils.Function; … … 1134 1135 public Float aggregateList(List<?> lst) { 1135 1136 final List<Float> floats = Utils.transform(lst, (Function<Object, Float>) x -> Cascade.convertTo(x, float.class)); 1136 final Collection<Float> nonNullList = Utils.filter(floats, Predicates.not(Predicates.isNull()));1137 final Collection<Float> nonNullList = SubclassFilteredCollection.filter(floats, Predicates.not(Predicates.isNull())); 1137 1138 return nonNullList.isEmpty() ? (Float) Float.NaN : computeMax ? Collections.max(nonNullList) : Collections.min(nonNullList); 1138 1139 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r10627 r10657 25 25 import org.openstreetmap.josm.tools.Pair; 26 26 import org.openstreetmap.josm.tools.Predicates; 27 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 27 28 import org.openstreetmap.josm.tools.Utils; 28 29 … … 320 321 throw new NoSuchElementException(); 321 322 } 322 final Collection<Relation> multipolygons = Utils.filteredCollection( Utils.filter(323 final Collection<Relation> multipolygons = Utils.filteredCollection(SubclassFilteredCollection.filter( 323 324 e.osm.getReferrers(), Predicates.hasTag("type", "multipolygon")), Relation.class); 324 325 final Relation multipolygon = multipolygons.iterator().next(); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java
r10611 r10657 19 19 import org.openstreetmap.josm.gui.widgets.JosmTextField; 20 20 import org.openstreetmap.josm.tools.GBC; 21 import org.openstreetmap.josm.tools. Utils;21 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 22 22 23 23 /** … … 43 43 @Override 44 44 public List<String> getData() { 45 return new ArrayList<>( Utils.filter(model.getData(), object -> object != null && !object.isEmpty()));45 return new ArrayList<>(SubclassFilteredCollection.filter(model.getData(), object -> object != null && !object.isEmpty())); 46 46 } 47 47 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r10634 r10657 21 21 import java.util.Map; 22 22 import java.util.Set; 23 import java.util.function.Predicate; 23 24 24 25 import javax.swing.AbstractAction; … … 60 61 import org.openstreetmap.josm.tools.ImageProvider; 61 62 import org.openstreetmap.josm.tools.ImageProvider.ImageResourceCallback; 62 import org.openstreetmap.josm.tools.Predicate;63 63 import org.openstreetmap.josm.tools.Utils; 64 64 import org.openstreetmap.josm.tools.template_engine.ParseError; … … 297 297 } 298 298 299 boolean presetInitiallyMatches = !selected.isEmpty() && Utils.forAll(selected,this);299 boolean presetInitiallyMatches = !selected.isEmpty() && selected.stream().allMatch(this); 300 300 JPanel items = new JPanel(new GridBagLayout()); 301 301 for (TaggingPresetItem i : data) { … … 556 556 */ 557 557 @Override 558 public boolean evaluate(OsmPrimitive p) {558 public boolean test(OsmPrimitive p) { 559 559 return matches(EnumSet.of(TaggingPresetType.forPrimitive(p)), p.getKeys(), false); 560 560 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java
r10590 r10657 282 282 && preset.roles != null && !preset.roles.roles.isEmpty()) { 283 283 suitable = preset.roles.roles.stream().anyMatch( 284 object -> object.memberExpression != null && Utils.exists(selectedPrimitives,object.memberExpression));284 object -> object.memberExpression != null && selectedPrimitives.stream().anyMatch(object.memberExpression)); 285 285 // keep the preset to allow the creation of new relations 286 286 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r10590 r10657 115 115 * @param primitive the primitive 116 116 * @return a new collection of all presets matching the given preset. 117 * @see TaggingPreset# evaluate(OsmPrimitive)117 * @see TaggingPreset#test(OsmPrimitive) 118 118 * @since 9265 119 119 */ 120 120 public static Collection<TaggingPreset> getMatchingPresets(final OsmPrimitive primitive) { 121 return SubclassFilteredCollection.filter(getTaggingPresets(), preset -> preset. evaluate(primitive));121 return SubclassFilteredCollection.filter(getTaggingPresets(), preset -> preset.test(primitive)); 122 122 } 123 123
Note:
See TracChangeset
for help on using the changeset viewer.