Changeset 96 for java/main/src/main/java/com/framsticks/core/Path.java
- Timestamp:
- 07/04/13 20:29:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/core/Path.java
r90 r96 11 11 import java.util.List; 12 12 13 import javax.annotation.Nonnull; 13 14 import javax.annotation.concurrent.Immutable; 14 15 … … 32 33 } 33 34 try { 34 instance. registry.prepareAccess(param);35 instance.prepareAccess(param); 35 36 return child; 36 37 } catch (FramsticksException e) { … … 119 120 } 120 121 121 public PathBuilder resolve(Instance instance, String textual) { 122 public static Iterator<String> splitPath(String path) { 123 List<String> list = new LinkedList<String>(); 124 for (String s : path.split("/")) { 125 if (!s.isEmpty()) { 126 list.add(s); 127 } 128 } 129 return list.iterator(); 130 } 131 132 public PathBuilder resolve(@Nonnull Instance instance, String textual) { 122 133 123 134 assert nodes.isEmpty(); … … 129 140 130 141 StringBuilder b = new StringBuilder(); 131 Iterator<String> i = Instance.splitPath(textual);142 Iterator<String> i = splitPath(textual); 132 143 while (i.hasNext() && current.getObject() != null) { 133 AccessInterface access = instance. registry.prepareAccess(current.getParam());144 AccessInterface access = instance.prepareAccess(current.getParam()); 134 145 if (access == null) { 135 146 break; … … 205 216 } 206 217 207 public final Instance getInstance() {218 public final @Nonnull Instance getInstance() { 208 219 assert Dispatching.isThreadSafe(); 209 220 return instance; 210 221 } 211 222 223 public Path tryResolveIfNeeded() { 224 if (isResolved()) { 225 return this; 226 } 227 return tryFindResolution(); 228 } 212 229 213 230 /** Attach resolution at end, if available. … … 221 238 return Path.build().resolve(instance, "/").finish();//appendResolution(instance.root.object); 222 239 } 223 Object child = getKnownChild(instance, instance.bindAccess(getUnder()), getTop().getParam());240 Object child = getKnownChild(instance, InstanceUtils.bindAccess(instance, getUnder()), getTop().getParam()); 224 241 if (child == null) { 225 242 return this; … … 266 283 } 267 284 } 285 286 public static Path to(@Nonnull Instance instance, String textual) { 287 return Path.build().resolve(instance, textual).finish(); 288 } 268 289 } 269 290
Note: See TracChangeset
for help on using the changeset viewer.