diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-10-25 19:18:09 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-10-25 19:34:44 +0000 |
| commit | 368f2dd010defaf5f4b6deb70f45285cee8f244d (patch) | |
| tree | 55494f85341f23dd1e588fa070ef863ef7cfdef5 /src/main/java/org/zwobble/couscous/backends/python/ast | |
| parent | 060ae04a695df6abac7445df3c5394b59da40f41 (diff) | |
Remove lombok
Diffstat (limited to 'src/main/java/org/zwobble/couscous/backends/python/ast')
15 files changed, 703 insertions, 118 deletions
diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAssignmentNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAssignmentNode.java index 9c5b20a..37ca7b7 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAssignmentNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAssignmentNode.java @@ -2,15 +2,59 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonAssignment") -public class PythonAssignmentNode implements PythonStatementNode { - PythonExpressionNode target; - PythonExpressionNode value; +public final class PythonAssignmentNode implements PythonStatementNode { + private final PythonExpressionNode target; + private final PythonExpressionNode value; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonAssignmentNode(final PythonExpressionNode target, final PythonExpressionNode value) { + this.target = target; + this.value = value; + } + + public static PythonAssignmentNode pythonAssignment(final PythonExpressionNode target, final PythonExpressionNode value) { + return new PythonAssignmentNode(target, value); + } + + public PythonExpressionNode getTarget() { + return this.target; + } + + public PythonExpressionNode getValue() { + return this.value; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonAssignmentNode)) return false; + final PythonAssignmentNode other = (PythonAssignmentNode)o; + final java.lang.Object this$target = this.getTarget(); + final java.lang.Object other$target = other.getTarget(); + if (this$target == null ? other$target != null : !this$target.equals(other$target)) return false; + final java.lang.Object this$value = this.getValue(); + final java.lang.Object other$value = other.getValue(); + if (this$value == null ? other$value != null : !this$value.equals(other$value)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $target = this.getTarget(); + result = result * PRIME + ($target == null ? 43 : $target.hashCode()); + final java.lang.Object $value = this.getValue(); + result = result * PRIME + ($value == null ? 43 : $value.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonAssignmentNode(target=" + this.getTarget() + ", value=" + this.getValue() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAttributeAccessNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAttributeAccessNode.java index ccd795f..bb46af3 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAttributeAccessNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonAttributeAccessNode.java @@ -2,15 +2,59 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonAttributeAccess") -public class PythonAttributeAccessNode implements PythonExpressionNode { - PythonExpressionNode left; - String attributeName; +public final class PythonAttributeAccessNode implements PythonExpressionNode { + private final PythonExpressionNode left; + private final String attributeName; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonAttributeAccessNode(final PythonExpressionNode left, final String attributeName) { + this.left = left; + this.attributeName = attributeName; + } + + public static PythonAttributeAccessNode pythonAttributeAccess(final PythonExpressionNode left, final String attributeName) { + return new PythonAttributeAccessNode(left, attributeName); + } + + public PythonExpressionNode getLeft() { + return this.left; + } + + public String getAttributeName() { + return this.attributeName; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonAttributeAccessNode)) return false; + final PythonAttributeAccessNode other = (PythonAttributeAccessNode)o; + final java.lang.Object this$left = this.getLeft(); + final java.lang.Object other$left = other.getLeft(); + if (this$left == null ? other$left != null : !this$left.equals(other$left)) return false; + final java.lang.Object this$attributeName = this.getAttributeName(); + final java.lang.Object other$attributeName = other.getAttributeName(); + if (this$attributeName == null ? other$attributeName != null : !this$attributeName.equals(other$attributeName)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $left = this.getLeft(); + result = result * PRIME + ($left == null ? 43 : $left.hashCode()); + final java.lang.Object $attributeName = this.getAttributeName(); + result = result * PRIME + ($attributeName == null ? 43 : $attributeName.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonAttributeAccessNode(left=" + this.getLeft() + ", attributeName=" + this.getAttributeName() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonBooleanLiteralNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonBooleanLiteralNode.java index 349ab4b..3f3d9a0 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonBooleanLiteralNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonBooleanLiteralNode.java @@ -2,14 +2,8 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Value; - -@Value(staticConstructor="pythonBooleanLiteral") -public class PythonBooleanLiteralNode implements PythonExpressionNode { - @Getter(value = AccessLevel.NONE) - boolean value; +public final class PythonBooleanLiteralNode implements PythonExpressionNode { + private final boolean value; public boolean getValue() { return value; @@ -19,4 +13,34 @@ public class PythonBooleanLiteralNode implements PythonExpressionNode { public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonBooleanLiteralNode(final boolean value) { + this.value = value; + } + + public static PythonBooleanLiteralNode pythonBooleanLiteral(final boolean value) { + return new PythonBooleanLiteralNode(value); + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonBooleanLiteralNode)) return false; + final PythonBooleanLiteralNode other = (PythonBooleanLiteralNode)o; + if (this.getValue() != other.getValue()) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + (this.getValue() ? 79 : 97); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonBooleanLiteralNode(value=" + this.getValue() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonCallNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonCallNode.java index 92c8b20..6cc5b11 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonCallNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonCallNode.java @@ -1,19 +1,61 @@ package org.zwobble.couscous.backends.python.ast; import java.util.List; - import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonCall") -public class PythonCallNode implements PythonExpressionNode { - PythonExpressionNode callee; - List<PythonExpressionNode> arguments; - +public final class PythonCallNode implements PythonExpressionNode { + private final PythonExpressionNode callee; + private final List<PythonExpressionNode> arguments; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonCallNode(final PythonExpressionNode callee, final List<PythonExpressionNode> arguments) { + this.callee = callee; + this.arguments = arguments; + } + + public static PythonCallNode pythonCall(final PythonExpressionNode callee, final List<PythonExpressionNode> arguments) { + return new PythonCallNode(callee, arguments); + } + + public PythonExpressionNode getCallee() { + return this.callee; + } + + public List<PythonExpressionNode> getArguments() { + return this.arguments; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonCallNode)) return false; + final PythonCallNode other = (PythonCallNode)o; + final java.lang.Object this$callee = this.getCallee(); + final java.lang.Object other$callee = other.getCallee(); + if (this$callee == null ? other$callee != null : !this$callee.equals(other$callee)) return false; + final java.lang.Object this$arguments = this.getArguments(); + final java.lang.Object other$arguments = other.getArguments(); + if (this$arguments == null ? other$arguments != null : !this$arguments.equals(other$arguments)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $callee = this.getCallee(); + result = result * PRIME + ($callee == null ? 43 : $callee.hashCode()); + final java.lang.Object $arguments = this.getArguments(); + result = result * PRIME + ($arguments == null ? 43 : $arguments.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonCallNode(callee=" + this.getCallee() + ", arguments=" + this.getArguments() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonClassNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonClassNode.java index 3ed7eba..8fe2ffe 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonClassNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonClassNode.java @@ -1,15 +1,11 @@ package org.zwobble.couscous.backends.python.ast; import java.util.List; - import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; - import com.google.common.collect.ImmutableList; -import lombok.Value; - -@Value(staticConstructor="pythonClass") -public class PythonClassNode implements PythonStatementNode { +public final class PythonClassNode implements PythonStatementNode { + public static Builder builder(String name) { return new Builder(name); } @@ -17,7 +13,7 @@ public class PythonClassNode implements PythonStatementNode { public static class Builder { private final String name; private final ImmutableList.Builder<PythonStatementNode> statements; - + public Builder(String name) { this.name = name; this.statements = ImmutableList.builder(); @@ -26,7 +22,7 @@ public class PythonClassNode implements PythonStatementNode { public PythonClassNode build() { return new PythonClassNode(name, new PythonBlock(statements.build())); } - + public Builder statement(PythonStatementNode statement) { statements.add(statement); return this; @@ -36,13 +32,58 @@ public class PythonClassNode implements PythonStatementNode { public static PythonClassNode pythonClass(String name, List<? extends PythonStatementNode> body) { return new PythonClassNode(name, new PythonBlock(body)); } - - String name; - PythonBlock body; + private final String name; + private final PythonBlock body; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } - -} + + private PythonClassNode(final String name, final PythonBlock body) { + this.name = name; + this.body = body; + } + + public static PythonClassNode pythonClass(final String name, final PythonBlock body) { + return new PythonClassNode(name, body); + } + + public String getName() { + return this.name; + } + + public PythonBlock getBody() { + return this.body; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonClassNode)) return false; + final PythonClassNode other = (PythonClassNode)o; + final java.lang.Object this$name = this.getName(); + final java.lang.Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; + final java.lang.Object this$body = this.getBody(); + final java.lang.Object other$body = other.getBody(); + if (this$body == null ? other$body != null : !this$body.equals(other$body)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final java.lang.Object $body = this.getBody(); + result = result * PRIME + ($body == null ? 43 : $body.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonClassNode(name=" + this.getName() + ", body=" + this.getBody() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonConditionalExpressionNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonConditionalExpressionNode.java index e39dce1..13f5e99 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonConditionalExpressionNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonConditionalExpressionNode.java @@ -2,16 +2,70 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonConditionalExpression") -public class PythonConditionalExpressionNode implements PythonExpressionNode { - PythonExpressionNode condition; - PythonExpressionNode trueValue; - PythonExpressionNode falseValue; +public final class PythonConditionalExpressionNode implements PythonExpressionNode { + private final PythonExpressionNode condition; + private final PythonExpressionNode trueValue; + private final PythonExpressionNode falseValue; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonConditionalExpressionNode(final PythonExpressionNode condition, final PythonExpressionNode trueValue, final PythonExpressionNode falseValue) { + this.condition = condition; + this.trueValue = trueValue; + this.falseValue = falseValue; + } + + public static PythonConditionalExpressionNode pythonConditionalExpression(final PythonExpressionNode condition, final PythonExpressionNode trueValue, final PythonExpressionNode falseValue) { + return new PythonConditionalExpressionNode(condition, trueValue, falseValue); + } + + public PythonExpressionNode getCondition() { + return this.condition; + } + + public PythonExpressionNode getTrueValue() { + return this.trueValue; + } + + public PythonExpressionNode getFalseValue() { + return this.falseValue; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonConditionalExpressionNode)) return false; + final PythonConditionalExpressionNode other = (PythonConditionalExpressionNode)o; + final java.lang.Object this$condition = this.getCondition(); + final java.lang.Object other$condition = other.getCondition(); + if (this$condition == null ? other$condition != null : !this$condition.equals(other$condition)) return false; + final java.lang.Object this$trueValue = this.getTrueValue(); + final java.lang.Object other$trueValue = other.getTrueValue(); + if (this$trueValue == null ? other$trueValue != null : !this$trueValue.equals(other$trueValue)) return false; + final java.lang.Object this$falseValue = this.getFalseValue(); + final java.lang.Object other$falseValue = other.getFalseValue(); + if (this$falseValue == null ? other$falseValue != null : !this$falseValue.equals(other$falseValue)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $condition = this.getCondition(); + result = result * PRIME + ($condition == null ? 43 : $condition.hashCode()); + final java.lang.Object $trueValue = this.getTrueValue(); + result = result * PRIME + ($trueValue == null ? 43 : $trueValue.hashCode()); + final java.lang.Object $falseValue = this.getFalseValue(); + result = result * PRIME + ($falseValue == null ? 43 : $falseValue.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonConditionalExpressionNode(condition=" + this.getCondition() + ", trueValue=" + this.getTrueValue() + ", falseValue=" + this.getFalseValue() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonFunctionDefinitionNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonFunctionDefinitionNode.java index a7983d6..8c50ebd 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonFunctionDefinitionNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonFunctionDefinitionNode.java @@ -1,15 +1,11 @@ package org.zwobble.couscous.backends.python.ast; import java.util.List; - import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; - import com.google.common.collect.ImmutableList; -import lombok.Value; - -@Value(staticConstructor="pythonFunctionDefinition") -public class PythonFunctionDefinitionNode implements PythonStatementNode { +public final class PythonFunctionDefinitionNode implements PythonStatementNode { + public static Builder builder(String name) { return new Builder(name); } @@ -24,7 +20,7 @@ public class PythonFunctionDefinitionNode implements PythonStatementNode { this.argumentNames = ImmutableList.builder(); this.body = ImmutableList.builder(); } - + public Builder argument(String argumentName) { argumentNames.add(argumentName); return this; @@ -34,13 +30,69 @@ public class PythonFunctionDefinitionNode implements PythonStatementNode { return pythonFunctionDefinition(name, argumentNames.build(), new PythonBlock(body.build())); } } - - String name; - List<String> argumentNames; - PythonBlock body; + private final String name; + private final List<String> argumentNames; + private final PythonBlock body; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonFunctionDefinitionNode(final String name, final List<String> argumentNames, final PythonBlock body) { + this.name = name; + this.argumentNames = argumentNames; + this.body = body; + } + + public static PythonFunctionDefinitionNode pythonFunctionDefinition(final String name, final List<String> argumentNames, final PythonBlock body) { + return new PythonFunctionDefinitionNode(name, argumentNames, body); + } + + public String getName() { + return this.name; + } + + public List<String> getArgumentNames() { + return this.argumentNames; + } + + public PythonBlock getBody() { + return this.body; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonFunctionDefinitionNode)) return false; + final PythonFunctionDefinitionNode other = (PythonFunctionDefinitionNode)o; + final java.lang.Object this$name = this.getName(); + final java.lang.Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; + final java.lang.Object this$argumentNames = this.getArgumentNames(); + final java.lang.Object other$argumentNames = other.getArgumentNames(); + if (this$argumentNames == null ? other$argumentNames != null : !this$argumentNames.equals(other$argumentNames)) return false; + final java.lang.Object this$body = this.getBody(); + final java.lang.Object other$body = other.getBody(); + if (this$body == null ? other$body != null : !this$body.equals(other$body)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final java.lang.Object $argumentNames = this.getArgumentNames(); + result = result * PRIME + ($argumentNames == null ? 43 : $argumentNames.hashCode()); + final java.lang.Object $body = this.getBody(); + result = result * PRIME + ($body == null ? 43 : $body.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonFunctionDefinitionNode(name=" + this.getName() + ", argumentNames=" + this.getArgumentNames() + ", body=" + this.getBody() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonGetSliceNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonGetSliceNode.java index 27c191e..2298086 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonGetSliceNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonGetSliceNode.java @@ -1,18 +1,61 @@ package org.zwobble.couscous.backends.python.ast; import java.util.List; - import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonGetSlice") -public class PythonGetSliceNode implements PythonExpressionNode { - PythonExpressionNode receiver; - List<PythonExpressionNode> arguments; +public final class PythonGetSliceNode implements PythonExpressionNode { + private final PythonExpressionNode receiver; + private final List<PythonExpressionNode> arguments; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonGetSliceNode(final PythonExpressionNode receiver, final List<PythonExpressionNode> arguments) { + this.receiver = receiver; + this.arguments = arguments; + } + + public static PythonGetSliceNode pythonGetSlice(final PythonExpressionNode receiver, final List<PythonExpressionNode> arguments) { + return new PythonGetSliceNode(receiver, arguments); + } + + public PythonExpressionNode getReceiver() { + return this.receiver; + } + + public List<PythonExpressionNode> getArguments() { + return this.arguments; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonGetSliceNode)) return false; + final PythonGetSliceNode other = (PythonGetSliceNode)o; + final java.lang.Object this$receiver = this.getReceiver(); + final java.lang.Object other$receiver = other.getReceiver(); + if (this$receiver == null ? other$receiver != null : !this$receiver.equals(other$receiver)) return false; + final java.lang.Object this$arguments = this.getArguments(); + final java.lang.Object other$arguments = other.getArguments(); + if (this$arguments == null ? other$arguments != null : !this$arguments.equals(other$arguments)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $receiver = this.getReceiver(); + result = result * PRIME + ($receiver == null ? 43 : $receiver.hashCode()); + final java.lang.Object $arguments = this.getArguments(); + result = result * PRIME + ($arguments == null ? 43 : $arguments.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonGetSliceNode(receiver=" + this.getReceiver() + ", arguments=" + this.getArguments() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportAliasNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportAliasNode.java index 9fb531a..783eb4e 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportAliasNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportAliasNode.java @@ -1,8 +1,42 @@ package org.zwobble.couscous.backends.python.ast; -import lombok.Value; +public final class PythonImportAliasNode { + private final String name; -@Value(staticConstructor="pythonImportAlias") -public class PythonImportAliasNode { - String name; -} + private PythonImportAliasNode(final String name) { + this.name = name; + } + + public static PythonImportAliasNode pythonImportAlias(final String name) { + return new PythonImportAliasNode(name); + } + + public String getName() { + return this.name; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonImportAliasNode)) return false; + final PythonImportAliasNode other = (PythonImportAliasNode)o; + final java.lang.Object this$name = this.getName(); + final java.lang.Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonImportAliasNode(name=" + this.getName() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportNode.java index c639829..4916cf7 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonImportNode.java @@ -1,18 +1,61 @@ package org.zwobble.couscous.backends.python.ast; import java.util.List; - import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonImport") -public class PythonImportNode implements PythonStatementNode { - String moduleName; - List<PythonImportAliasNode> aliases; +public final class PythonImportNode implements PythonStatementNode { + private final String moduleName; + private final List<PythonImportAliasNode> aliases; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonImportNode(final String moduleName, final List<PythonImportAliasNode> aliases) { + this.moduleName = moduleName; + this.aliases = aliases; + } + + public static PythonImportNode pythonImport(final String moduleName, final List<PythonImportAliasNode> aliases) { + return new PythonImportNode(moduleName, aliases); + } + + public String getModuleName() { + return this.moduleName; + } + + public List<PythonImportAliasNode> getAliases() { + return this.aliases; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonImportNode)) return false; + final PythonImportNode other = (PythonImportNode)o; + final java.lang.Object this$moduleName = this.getModuleName(); + final java.lang.Object other$moduleName = other.getModuleName(); + if (this$moduleName == null ? other$moduleName != null : !this$moduleName.equals(other$moduleName)) return false; + final java.lang.Object this$aliases = this.getAliases(); + final java.lang.Object other$aliases = other.getAliases(); + if (this$aliases == null ? other$aliases != null : !this$aliases.equals(other$aliases)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $moduleName = this.getModuleName(); + result = result * PRIME + ($moduleName == null ? 43 : $moduleName.hashCode()); + final java.lang.Object $aliases = this.getAliases(); + result = result * PRIME + ($aliases == null ? 43 : $aliases.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonImportNode(moduleName=" + this.getModuleName() + ", aliases=" + this.getAliases() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonIntegerLiteralNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonIntegerLiteralNode.java index 1c273d7..459ad6d 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonIntegerLiteralNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonIntegerLiteralNode.java @@ -2,14 +2,45 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonIntegerLiteral") -public class PythonIntegerLiteralNode implements PythonExpressionNode { - int value; +public final class PythonIntegerLiteralNode implements PythonExpressionNode { + private final int value; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonIntegerLiteralNode(final int value) { + this.value = value; + } + + public static PythonIntegerLiteralNode pythonIntegerLiteral(final int value) { + return new PythonIntegerLiteralNode(value); + } + + public int getValue() { + return this.value; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonIntegerLiteralNode)) return false; + final PythonIntegerLiteralNode other = (PythonIntegerLiteralNode)o; + if (this.getValue() != other.getValue()) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getValue(); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonIntegerLiteralNode(value=" + this.getValue() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonModuleNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonModuleNode.java index b3fd728..a95b6c5 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonModuleNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonModuleNode.java @@ -1,18 +1,50 @@ package org.zwobble.couscous.backends.python.ast; import java.util.List; - import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonModule") -public class PythonModuleNode implements PythonNode { - List<PythonStatementNode> statements; +public final class PythonModuleNode implements PythonNode { + private final List<PythonStatementNode> statements; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } - -} + + private PythonModuleNode(final List<PythonStatementNode> statements) { + this.statements = statements; + } + + public static PythonModuleNode pythonModule(final List<PythonStatementNode> statements) { + return new PythonModuleNode(statements); + } + + public List<PythonStatementNode> getStatements() { + return this.statements; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonModuleNode)) return false; + final PythonModuleNode other = (PythonModuleNode)o; + final java.lang.Object this$statements = this.getStatements(); + final java.lang.Object other$statements = other.getStatements(); + if (this$statements == null ? other$statements != null : !this$statements.equals(other$statements)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $statements = this.getStatements(); + result = result * PRIME + ($statements == null ? 43 : $statements.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonModuleNode(statements=" + this.getStatements() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonReturnNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonReturnNode.java index adb4168..1967dd3 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonReturnNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonReturnNode.java @@ -2,15 +2,48 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonReturn") -public class PythonReturnNode implements PythonStatementNode { - PythonExpressionNode value; +public final class PythonReturnNode implements PythonStatementNode { + private final PythonExpressionNode value; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + private PythonReturnNode(final PythonExpressionNode value) { + this.value = value; + } + + public static PythonReturnNode pythonReturn(final PythonExpressionNode value) { + return new PythonReturnNode(value); + } + + public PythonExpressionNode getValue() { + return this.value; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonReturnNode)) return false; + final PythonReturnNode other = (PythonReturnNode)o; + final java.lang.Object this$value = this.getValue(); + final java.lang.Object other$value = other.getValue(); + if (this$value == null ? other$value != null : !this$value.equals(other$value)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $value = this.getValue(); + result = result * PRIME + ($value == null ? 43 : $value.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonReturnNode(value=" + this.getValue() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonStringLiteralNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonStringLiteralNode.java index bd35621..3907555 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonStringLiteralNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonStringLiteralNode.java @@ -2,14 +2,48 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonStringLiteral") -public class PythonStringLiteralNode implements PythonExpressionNode { - String value; +public final class PythonStringLiteralNode implements PythonExpressionNode { + private final String value; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonStringLiteralNode(final String value) { + this.value = value; + } + + public static PythonStringLiteralNode pythonStringLiteral(final String value) { + return new PythonStringLiteralNode(value); + } + + public String getValue() { + return this.value; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonStringLiteralNode)) return false; + final PythonStringLiteralNode other = (PythonStringLiteralNode)o; + final java.lang.Object this$value = this.getValue(); + final java.lang.Object other$value = other.getValue(); + if (this$value == null ? other$value != null : !this$value.equals(other$value)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $value = this.getValue(); + result = result * PRIME + ($value == null ? 43 : $value.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonStringLiteralNode(value=" + this.getValue() + ")"; + } +}
\ No newline at end of file diff --git a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonVariableReferenceNode.java b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonVariableReferenceNode.java index a67da73..4edad3e 100644 --- a/src/main/java/org/zwobble/couscous/backends/python/ast/PythonVariableReferenceNode.java +++ b/src/main/java/org/zwobble/couscous/backends/python/ast/PythonVariableReferenceNode.java @@ -2,14 +2,48 @@ package org.zwobble.couscous.backends.python.ast; import org.zwobble.couscous.backends.python.ast.visitors.PythonNodeVisitor; -import lombok.Value; - -@Value(staticConstructor="pythonVariableReference") -public class PythonVariableReferenceNode implements PythonExpressionNode { - String name; +public final class PythonVariableReferenceNode implements PythonExpressionNode { + private final String name; @Override public void accept(PythonNodeVisitor visitor) { visitor.visit(this); } -} + + private PythonVariableReferenceNode(final String name) { + this.name = name; + } + + public static PythonVariableReferenceNode pythonVariableReference(final String name) { + return new PythonVariableReferenceNode(name); + } + + public String getName() { + return this.name; + } + + @java.lang.Override + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof PythonVariableReferenceNode)) return false; + final PythonVariableReferenceNode other = (PythonVariableReferenceNode)o; + final java.lang.Object this$name = this.getName(); + final java.lang.Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + @java.lang.Override + public java.lang.String toString() { + return "PythonVariableReferenceNode(name=" + this.getName() + ")"; + } +}
\ No newline at end of file |
