39 lines
862 B
Java
39 lines
862 B
Java
package be.jeffcheasey88.peeratcode.parser.java.operation;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
|
import be.jeffcheasey88.peeratcode.parser.java.Operation;
|
|
import be.jeffcheasey88.peeratcode.parser.java.Value;
|
|
|
|
public class AssignOperation extends Operation{
|
|
|
|
private Value left;
|
|
private Value right;
|
|
|
|
public AssignOperation(Value left, Value right){
|
|
this.left = left;
|
|
this.right = right;
|
|
}
|
|
|
|
public Value left(){
|
|
return left;
|
|
}
|
|
|
|
public Value right(){
|
|
return right;
|
|
}
|
|
|
|
@Override
|
|
public void build(Builder builder) throws Exception{
|
|
left.build(builder);
|
|
builder.append("=");
|
|
right.build(builder);
|
|
}
|
|
|
|
@Override
|
|
public <E extends JavaElement> E find(Function<JavaElement, Boolean> finder){
|
|
return finder.apply(left) ? (E)left : finder.apply(right) ? (E)right : null;
|
|
}
|
|
|
|
}
|