Changeset 98 for java/main/src/main/java/com/framsticks/core/Node.java
- Timestamp:
- 07/08/13 23:04:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/core/Node.java
r90 r98 5 5 6 6 import com.framsticks.params.CompositeParam; 7 import com.framsticks.params.ParamBuilder; 7 import com.framsticks.util.FramsticksException; 8 // import com.framsticks.params.ParamBuilder; 9 import com.framsticks.util.lang.Strings; 8 10 9 11 /** … … 13 15 public class Node { 14 16 17 protected final Tree tree; 15 18 protected final CompositeParam param; 16 19 protected final Object object; 17 //protected final Map<String, Node> children = new HashMap<String, Node>();18 20 19 public Node() { 20 param = null; 21 object = null; 22 } 23 24 public Node(@Nonnull CompositeParam param, Object object) { 21 public Node(Tree tree, @Nonnull CompositeParam param, Object object) { 25 22 assert param != null; 23 assert tree != null; 24 this.tree = tree; 26 25 this.param = param; 27 26 this.object = object; 28 27 } 29 28 30 public Node(@Nonnull ParamBuilder builder, Object object) { 31 this(builder.finish(CompositeParam.class), object); 29 30 public final Tree getTree() { 31 return tree; 32 32 } 33 33 … … 40 40 } 41 41 42 @Override 43 public String toString() { 44 return param.toString() + ":" + Strings.toStringNullProof(object, "<null>"); 45 } 46 47 public final boolean isResolved() { 48 return object != null; 49 } 50 51 public Node assureResolved() { 52 if (!isResolved()) { 53 throw new FramsticksException().msg("path is not resolved").arg("node", this); 54 } 55 return this; 56 } 57 42 58 }
Note: See TracChangeset
for help on using the changeset viewer.