@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (getArguments() != null ? getArguments().hashCode() : 0); return result; } }
@Override public void removeSourceLocation() { super.removeSourceLocation(); for (ModelASTValue argument : arguments) { argument.removeSourceLocation(); } }
private String withOrWithoutParens(ModelASTArgumentList argList) { if (argList == null) { return name + "()"; } else { String argGroovy = argList.toGroovy(); if (!(this instanceof ModelASTTreeStep) && argList instanceof ModelASTSingleArgument && // Special-casing for list/map args since they still need parentheses. !argGroovy.startsWith("[")) { return name + " " + argGroovy; } else { return name + "(" + argGroovy + ")"; } } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTPositionalArgumentList that = (ModelASTPositionalArgumentList) o; return getArguments() != null ? getArguments().equals(that.getArguments()) : that.getArguments() == null; }
@Override public void validate(@Nonnull ModelValidator validator) { validator.validateElement(this); if (args != null) { args.validate(validator); } }
@Override public JSONObject toJSON() { JSONObject o = new JSONObject(); o.accumulate("name", name); if (args != null) { o.accumulate("arguments", args.toJSON()); } return o; }
assertEquals("First branch", val.getValue()); assertNull(firstStep.getArgs().getSourceLocation()); assertNull(val.getSourceLocation()); assertNull(scriptStep.getSourceLocation()); assertTrue(scriptStep instanceof ModelASTScriptBlock); assertNull(scriptStep.getArgs().getSourceLocation()); ModelASTValue scriptVal = null; if (scriptStep.getArgs() instanceof ModelASTSingleArgument) {
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTNamedArgumentList that = (ModelASTNamedArgumentList) o; return getArguments() != null ? getArguments().equals(that.getArguments()) : that.getArguments() == null; }
@Override public void validate(ModelValidator validator) { validator.validateElement(this); if (args != null) { args.validate(validator); } }
@Override public JSONObject toJSON() { JSONObject o = new JSONObject(); o.accumulate("name", name); if (args != null) { o.accumulate("arguments", args.toJSON()); } return o; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTNamedArgumentList that = (ModelASTNamedArgumentList) o; return getArguments() != null ? getArguments().equals(that.getArguments()) : that.getArguments() == null; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (getArguments() != null ? getArguments().hashCode() : 0); return result; } }
@Override public void removeSourceLocation() { super.removeSourceLocation(); if (args != null) { args.removeSourceLocation(); } }
private String withOrWithoutParens(ModelASTArgumentList argList) { if (argList == null) { return name + "()"; } else { String argGroovy = argList.toGroovy(); if (!(this instanceof ModelASTTreeStep) && argList instanceof ModelASTSingleArgument && // Special-casing for list/map args since they still need parentheses. !argGroovy.startsWith("[")) { return name + " " + argGroovy; } else { return name + "(" + argGroovy + ")"; } } }
@Override public void validate(@Nonnull ModelValidator validator) { validator.validateElement(this); if (args != null) { args.validate(validator); } for (ModelASTWhenContent c : children) { c.validate(validator); } }
@Override public JSONObject toJSON() { JSONObject o = new JSONObject(); o.accumulate("name", name); if (args != null) { o.accumulate("arguments", args.toJSON()); } if (!children.isEmpty()) { final JSONArray a = new JSONArray(); for (ModelASTWhenContent child : children) { a.add(child.toJSON()); } o.accumulate("children", a); } return o; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTPositionalArgumentList that = (ModelASTPositionalArgumentList) o; return getArguments() != null ? getArguments().equals(that.getArguments()) : that.getArguments() == null; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (getArguments() != null ? getArguments().hashCode() : 0); return result; } }
@Override public void removeSourceLocation() { super.removeSourceLocation(); for (ModelASTValue argument : arguments) { argument.removeSourceLocation(); } }
@Override public String toGroovy() { StringBuilder result = new StringBuilder(); if (!children.isEmpty()) { result.append(name).append(" {\n"); for (ModelASTWhenContent child : children) { result.append(child.toGroovy()).append("\n"); } result.append("}\n"); } else { result.append(name).append(" ").append(getArgs().toGroovy()); } return result.toString(); }