Changeset 6175 in josm for trunk/src/org
- Timestamp:
- 2013-08-22T14:41:30+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r6104 r6175 37 37 private CopyOnWriteArrayList<IConflictListener> listeners; 38 38 39 /** 40 * Constructs a new {@code ConflictCollection}. 41 */ 39 42 public ConflictCollection() { 40 conflicts = new ArrayList<Conflict<? >>();43 conflicts = new ArrayList<Conflict<? extends OsmPrimitive>>(); 41 44 listeners = new CopyOnWriteArrayList<IConflictListener>(); 42 45 } 43 46 47 /** 48 * Adds the specified conflict listener, if not already present. 49 * @param listener The conflict listener to add 50 */ 44 51 public void addConflictListener(IConflictListener listener) { 45 52 if (listener != null) { … … 48 55 } 49 56 57 /** 58 * Removes the specified conflict listener. 59 * @param listener The conflict listener to remove 60 */ 50 61 public void removeConflictListener(IConflictListener listener) { 51 62 listeners.remove(listener); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r5899 r6175 236 236 if (s.isProperLineStyle() || s instanceof AreaElemStyle) { 237 237 hasIndependentElemStyle = true; 238 break; 238 239 } 239 240 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/Environment.java
r6105 r6175 23 23 24 24 /** 25 * If not null, this is the matching parent object if a ncondition or an expression25 * If not null, this is the matching parent object if a condition or an expression 26 26 * is evaluated in a {@link LinkSelector} (within a child selector) 27 27 */ 28 28 public OsmPrimitive parent; 29 29 30 /** 30 31 * The same for parent selector. Only one of the 2 fields (parent or child) is not null in any environment. … … 38 39 39 40 /** 40 * Creates a new uninitialized environment 41 * Creates a new uninitialized environment. 41 42 */ 42 43 public Environment() {} 43 44 45 /** 46 * Creates a new environment. 47 */ 44 48 public Environment(OsmPrimitive osm, MultiCascade mc, String layer, StyleSource source) { 45 49 this.osm = osm; … … 50 54 51 55 /** 52 * Creates a clone of the environment {@code other} 56 * Creates a clone of the environment {@code other}. 53 57 * 54 58 * @param other the other environment. Must not be null. 55 */ 56 public Environment(Environment other) throws IllegalArgumentException{ 59 * @throws IllegalArgumentException if {@code param} is {@code null} 60 */ 61 public Environment(Environment other) throws IllegalArgumentException { 57 62 CheckParameterUtil.ensureParameterNotNull(other); 58 63 this.osm = other.osm; … … 66 71 } 67 72 73 /** 74 * Creates a clone of this environment, with the specified primitive. 75 * @return A clone of this environment, with the specified primitive 76 * @see #osm 77 */ 68 78 public Environment withPrimitive(OsmPrimitive osm) { 69 79 Environment e = new Environment(this); … … 72 82 } 73 83 84 /** 85 * Creates a clone of this environment, with the specified parent. 86 * @param parent the matching parent object 87 * @return A clone of this environment, with the specified parent 88 * @see #parent 89 */ 74 90 public Environment withParent(OsmPrimitive parent) { 75 91 Environment e = new Environment(this); … … 78 94 } 79 95 96 /** 97 * Creates a clone of this environment, with the specified parent, index, and context set to {@link Context#LINK}. 98 * @param parent the matching parent object 99 * @param index index of node in parent way or member in parent relation 100 * @return A clone of this environment, with the specified parent, index, and context set to {@link Context#LINK} 101 * @since 6175 102 * @see #parent 103 * @see #index 104 */ 105 public Environment withParentAndIndexAndLinkContext(OsmPrimitive parent, int index) { 106 Environment e = new Environment(this); 107 e.parent = parent; 108 e.index = index; 109 e.context = Context.LINK; 110 return e; 111 } 112 113 /** 114 * Creates a clone of this environment, with the specified child. 115 * @param child the matching child object 116 * @return A clone of this environment, with the specified child 117 * @see #child 118 */ 80 119 public Environment withChild(OsmPrimitive child) { 81 120 Environment e = new Environment(this); … … 84 123 } 85 124 125 /** 126 * Creates a clone of this environment, with the specified child, index, and context set to {@link Context#LINK}. 127 * @param child the matching child object 128 * @param index index of node in parent way or member in parent relation 129 * @return A clone of this environment, with the specified child, index, and context set to {@code Context#LINK} 130 * @since 6175 131 * @see #child 132 * @see #index 133 */ 134 public Environment withChildAndIndexAndLinkContext(OsmPrimitive child, int index) { 135 Environment e = new Environment(this); 136 e.child = child; 137 e.index = index; 138 e.context = Context.LINK; 139 return e; 140 } 141 142 /** 143 * Creates a clone of this environment, with the specified index. 144 * @param index index of node in parent way or member in parent relation 145 * @return A clone of this environment, with the specified index 146 * @see #index 147 */ 86 148 public Environment withIndex(int index) { 87 149 Environment e = new Environment(this); … … 90 152 } 91 153 154 /** 155 * Creates a clone of this environment, with the specified {@link Context}. 156 * @return A clone of this environment, with the specified {@code Context} 157 */ 92 158 public Environment withContext(Context context) { 93 159 Environment e = new Environment(this); … … 96 162 } 97 163 164 /** 165 * Creates a clone of this environment, with context set to {@link Context#LINK}. 166 * @return A clone of this environment, with context set to {@code Context#LINK} 167 */ 98 168 public Environment withLinkContext() { 99 169 Environment e = new Environment(this); … … 102 172 } 103 173 174 /** 175 * Determines if the context of this environment is {@link Context#LINK}. 176 * @return {@code true} if the context of this environment is {@code Context#LINK}, {@code false} otherwise 177 */ 104 178 public boolean isLinkContext() { 105 179 return Context.LINK.equals(context); 106 180 } 107 181 182 /** 183 * Determines if this environment has a relation as parent. 184 * @return {@code true} if this environment has a relation as parent, {@code false} otherwise 185 * @see #parent 186 */ 108 187 public boolean hasParentRelation() { 109 188 return parent instanceof Relation; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r6148 r6175 173 173 sub = "default"; 174 174 } 175 176 if (sub.equals("*")) { 175 else if ("*".equals(sub)) { 177 176 for (Entry<String, Cascade> entry : mc.getLayers()) { 178 177 env.layer = entry.getKey(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r6070 r6175 108 108 Node n = w.getNode(i); 109 109 if (n.equals(e.osm)) { 110 if (link.matches(e.withParent (w).withIndex(i).withLinkContext())) {110 if (link.matches(e.withParentAndIndexAndLinkContext(w, i))) { 111 111 e.parent = w; 112 112 e.index = i; … … 130 130 RelationMember m = r.getMember(i); 131 131 if (m.getMember().equals(e.osm)) { 132 if (link.matches(e.withParent (r).withIndex(i).withLinkContext())) {132 if (link.matches(e.withParentAndIndexAndLinkContext(r, i))) { 133 133 e.parent = r; 134 134 e.index = i; … … 156 156 Node n = wayNodes.get(i); 157 157 if (left.matches(e.withPrimitive(n))) { 158 if (link.matches(e.withChild (n).withIndex(i).withLinkContext())) {158 if (link.matches(e.withChildAndIndexAndLinkContext(n, i))) { 159 159 e.child = n; 160 160 e.index = i; … … 169 169 OsmPrimitive member = members.get(i).getMember(); 170 170 if (left.matches(e.withPrimitive(member))) { 171 if (link.matches(e.withChild (member).withIndex(i).withLinkContext())) {171 if (link.matches(e.withChildAndIndexAndLinkContext(member, i))) { 172 172 e.child = member; 173 173 e.index = i; -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6123 r6175 401 401 } 402 402 403 private static final char[] HEX_ARRAY = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; 404 403 405 /** 404 406 * Converts a byte array to a string of hexadecimal characters. … … 409 411 */ 410 412 public static String toHexString(byte[] bytes) { 411 char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; 412 char[] hexChars = new char[bytes.length * 2]; 413 for (int j=0; j<bytes.length; j++) { 414 int v = bytes[j] & 0xFF; 415 hexChars[j*2] = hexArray[v/16]; 416 hexChars[j*2 + 1] = hexArray[v%16]; 413 414 if (bytes == null) { 415 return ""; 416 } 417 418 final int len = bytes.length; 419 if (len == 0) { 420 return ""; 421 } 422 423 char[] hexChars = new char[len * 2]; 424 for (int i = 0, j = 0; i < len; i++) { 425 final int v = bytes[i]; 426 hexChars[j++] = HEX_ARRAY[(v & 0xf0) >> 4]; 427 hexChars[j++] = HEX_ARRAY[v & 0xf]; 417 428 } 418 429 return new String(hexChars);
Note:
See TracChangeset
for help on using the changeset viewer.