net.intelie.pipes.ast.RawNode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes.ast;
import net.intelie.pipes.util.Preconditions;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class RawNode implements AstNode {
private static final long serialVersionUID = 1L;
private final SourceLocation location;
private final Object value;
private final int _hash;
public RawNode(SourceLocation location, Object value) {
this.location = location;
this.value = value;
this._hash = Objects.hash(this.value);
}
public static List fromArray(Object... args) {
List nodes = new ArrayList<>();
for (Object o : args) {
nodes.add(new RawNode(null, o));
}
return nodes;
}
public Object getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@Override
public SourceLocation getLocation() {
return location;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RawNode that = (RawNode) o;
return Objects.equals(this.value, that.value);
}
@Override
public int hashCode() {
return _hash;
}
}