# HG changeset patch # User Thomas Wuerthinger # Date 1303994135 -7200 # Node ID 590c2f6a0c4f7158c64bf9e1568743d1ca1388a7 # Parent ce6b257921030c5f603c662ab2109f96a3bbab6f Checkstyle fixes. diff -r ce6b25792103 -r 590c2f6a0c4f graal/GraalGraph/src/com/oracle/graal/graph/Node.java --- a/graal/GraalGraph/src/com/oracle/graal/graph/Node.java Thu Apr 28 14:29:54 2011 +0200 +++ b/graal/GraalGraph/src/com/oracle/graal/graph/Node.java Thu Apr 28 14:35:35 2011 +0200 @@ -48,10 +48,10 @@ this.successors = new NodeArray(successors); this.predecessors = new ArrayList(); this.usages = new ArrayList(); - for(Node input : inputs) { + for (Node input : inputs) { input.usages.add(this); } - for(Node successor : successors) { + for (Node successor : successors) { successor.predecessors.add(this); } } @@ -116,7 +116,7 @@ System.arraycopy(nodes, 0, copy, 0, nodes.length); return copy; } - + public int size() { return nodes.length; } @@ -154,7 +154,7 @@ for (int i = 0; i < myInputs.length; i++) { other.inputs.set(i, myInputs[i]); } - while(!usages.isEmpty()) { + while (!usages.isEmpty()) { Node usage = usages.get(0); usage.inputs.replace(this, other); } @@ -167,11 +167,11 @@ predecessor.successors.replace(this, other); } } - + protected Node setInput(int index, Node in) { return this.getInputs().set(index, in); } - + protected Node setSuccessor(int index, Node sux) { return this.getSuccessors().set(index, sux); } @@ -193,4 +193,4 @@ } return nodes; } -} \ No newline at end of file +} diff -r ce6b25792103 -r 590c2f6a0c4f graal/GraalGraph/src/com/oracle/graal/graph/NullNode.java --- a/graal/GraalGraph/src/com/oracle/graal/graph/NullNode.java Thu Apr 28 14:29:54 2011 +0200 +++ b/graal/GraalGraph/src/com/oracle/graal/graph/NullNode.java Thu Apr 28 14:35:35 2011 +0200 @@ -27,7 +27,7 @@ public NullNode(int inputs, int successors, Graph graph) { super(inputs, successors, graph); } - + public NullNode(Graph graph) { super(0, 0, graph); } diff -r ce6b25792103 -r 590c2f6a0c4f graal/GraalGraph/test/com/oracle/graal/graph/NodeTest.java --- a/graal/GraalGraph/test/com/oracle/graal/graph/NodeTest.java Thu Apr 28 14:29:54 2011 +0200 +++ b/graal/GraalGraph/test/com/oracle/graal/graph/NodeTest.java Thu Apr 28 14:35:35 2011 +0200 @@ -39,34 +39,36 @@ DummyNode n3 = new DummyNode(0, 0, g1); n2.dummySetInput(0, null1); n2.dummySetSuccessor(0, n3); - + assertSame(null1, n2.getInput(0)); assertSame(n3, n2.getSuccessor(0)); - - for(Node in : n1.getInputs()) + + for (Node in : n1.getInputs()) { assertNotNull(in); - for(Node sux : n1.getSuccessors()) + } + for (Node sux : n1.getSuccessors()) { assertNotNull(sux); + } assertEquals(n1.getInputs().size(), 2); assertEquals(n1.getSuccessors().size(), 1); } - + @Test public void testReplace() { Graph g2 = new Graph(); - + NullNode null2 = new NullNode(g2); NullNode null3 = new NullNode(g2); NullNode null4 = new NullNode(g2); NullNode null5 = new NullNode(g2); - + DummyOp2 o1 = new DummyOp2(null2, null3, g2); DummyOp2 o2 = new DummyOp2(o1, null4, g2); DummyOp2 o3 = new DummyOp2(o2, null4, g2); DummyOp2 o4 = new DummyOp2(null5, null5, g2); - + o2.replace(o4); - + assertTrue(o1.getUsages().contains(o4)); assertTrue(null4.getUsages().contains(o4)); assertFalse(o3.getInputs().contains(o2)); @@ -82,11 +84,11 @@ public DummyNode(Node[] inputs, Node[] successors, Graph graph) { super(inputs, successors, graph); } - + public void dummySetInput(int idx, Node n) { this.setInput(idx, n); } - + public void dummySetSuccessor(int idx, Node n) { this.setSuccessor(idx, n); } @@ -97,13 +99,13 @@ } } - - private static class DummyOp2 extends Node{ + + private static class DummyOp2 extends Node { public DummyOp2(Node x, Node y, Graph graph) { super(new Node[] {x, y}, new Node[] {}, graph); } - + public Node x() { return this.getInput(0); } @@ -111,11 +113,12 @@ public Node y() { return this.getInput(1); } - + @Override public Node cloneNode(Graph into) { - return new DummyOp2(x(), y(), into); // this may create a Node which has inputs which do not belong to its graph + return new DummyOp2(x(), y(), into); // this may create a Node which has inputs which do not belong to its + // graph } - + } }