refactoring
This commit is contained in:
parent
e12747ca05
commit
b93f0ac559
|
@ -4,12 +4,13 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author Andrey Belomutskiy
|
||||
* 2/7/14.
|
||||
* 2/7/14.
|
||||
*/
|
||||
public class GrLineNode extends PcbNode {
|
||||
public final LayerNode layerNode;
|
||||
public GrLineNode(String nodeName, int i, List<Object> children) {
|
||||
super(nodeName, i, children);
|
||||
layerNode = (LayerNode) find("layer");
|
||||
|
||||
public GrLineNode(int i, List<Object> children) {
|
||||
super(TOKEN_GR_LINE, i, children);
|
||||
layerNode = find("layer");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PcbNode {
|
|||
} else if ("add_net".equals(nodeName)) {
|
||||
return new AddNetNode(nodeName, index + 1, children);
|
||||
} else if (TOKEN_GR_LINE.equals(nodeName)) {
|
||||
return new GrLineNode(nodeName, index + 1, children);
|
||||
return new GrLineNode(index + 1, children);
|
||||
} else if ("layer".equals(nodeName)) {
|
||||
return new LayerNode(nodeName, index + 1, children);
|
||||
} else if ("module".equals(nodeName)) {
|
||||
|
@ -212,12 +212,12 @@ public class PcbNode {
|
|||
public <T extends PcbNode> T find(String key) {
|
||||
List<PcbNode> r = iterate(key);
|
||||
if (r.size() != 1)
|
||||
throw new IllegalStateException("More that one " + key + " in " + nodeName);
|
||||
throw new IllegalStateException("Exactly one " + key + " expected in " + nodeName);
|
||||
return (T) r.get(0);
|
||||
}
|
||||
|
||||
public List<PcbNode> nodes() {
|
||||
List<PcbNode> result = new ArrayList<PcbNode>();
|
||||
List<PcbNode> result = new ArrayList<>();
|
||||
for (Object child : children) {
|
||||
if (child instanceof String)
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue