1 11 package org.eclipse.core.internal.dtree; 12 13 19 public class NodeInfo { 20 21 private int type; 22 private Object data; 23 private String namesOfChildren[], namesOfDeletedChildren[]; 24 25 33 public NodeInfo(int type, Object data, String [] children, String [] deleted) { 34 this.type = type; 35 this.data = data; 36 this.namesOfChildren = children; 37 this.namesOfDeletedChildren = deleted; 38 } 39 40 43 public Object getData() { 44 return data; 45 } 46 47 50 public String [] getNamesOfChildren() { 51 return namesOfChildren; 52 } 53 54 57 public String [] getNamesOfDeletedChildren() { 58 return namesOfDeletedChildren; 59 } 60 61 public int getType() { 62 return type; 63 } 64 65 68 public boolean hasData() { 69 return (type == AbstractDataTreeNode.T_COMPLETE_NODE || type == AbstractDataTreeNode.T_DELTA_NODE); 70 } 71 72 75 public boolean isComplete() { 76 return this.getType() == AbstractDataTreeNode.T_COMPLETE_NODE; 77 } 78 79 83 public boolean isDeleted() { 84 return this.getType() == AbstractDataTreeNode.T_DELETED_NODE; 85 } 86 87 90 public boolean isDelta() { 91 int type = this.getType(); 92 return (type == AbstractDataTreeNode.T_DELTA_NODE || type == AbstractDataTreeNode.T_NO_DATA_DELTA_NODE); 93 } 94 95 99 public boolean isEmptyDelta() { 100 return (this.getType() == AbstractDataTreeNode.T_NO_DATA_DELTA_NODE && this.getNamesOfChildren().length == 0 && this.getNamesOfDeletedChildren().length == 0); 101 } 102 103 107 public boolean isPresent() { 108 return this.getType() != AbstractDataTreeNode.T_MISSING_NODE; 109 } 110 111 114 static NodeInfo missing() { 115 return new NodeInfo(AbstractDataTreeNode.T_MISSING_NODE, null, new String [0], new String [0]); } 119 120 public void setData(Object o) { 121 data = o; 122 } 123 124 public void setNamesOfChildren(String names[]) { 125 namesOfChildren = names; 126 } 127 128 public void setNamesOfDeletedChildren(String names[]) { 129 namesOfDeletedChildren = names; 130 } 131 132 public void setType(int type) { 133 this.type = type; 134 } 135 } | Popular Tags |