@Test public void setChild() throws Exception { VariableIdentifierExpr v = new VariableIdentifierExpr("v"); VariableIdentifierExpr w = new VariableIdentifierExpr("w"); MemberLookupExpr mle = new MemberLookupExpr( v, "foo"); mle.setChild(0, w); assertEquals(w, mle.getStructure()); }
@Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } MemberLookupExpr(Expr structure, String member); }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } MemberLookupExpr(Expr structure, String member); Expr getStructure(); void setStructure(Expr structure); String getMember(); void setMember(String member); @Override void accept(IAstVisitor visitor); @Override MemberLookupExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren(); }
MemberLookupExpr extends Expr { @Override public void setChild(int index, Expr expr) { if (index == 0) { setStructure(expr); return; } throw new IndexOutOfBoundsException("Index for MemberLookupExpr must be 0"); } MemberLookupExpr(Expr structure, String member); Expr getStructure(); void setStructure(Expr structure); String getMember(); void setMember(String member); @Override void accept(IAstVisitor visitor); @Override MemberLookupExpr clone(); @Override boolean hasChild(IAstNode candidateChild); @Override Expr getChild(int index); @Override void setChild(int index, Expr expr); @Override int getNumChildren();  }