
org.snapscript.tree.collection.RangeOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-all Show documentation
Show all versions of snap-all Show documentation
Dynamic scripting for the JVM
The newest version!
package org.snapscript.tree.collection;
import org.snapscript.parse.StringToken;
public enum RangeOperator {
DOT("..", true),
TO("to", true),
FROM("from", false);
public final String operator;
public final boolean forward;
private RangeOperator(String operator, boolean forward) {
this.operator = operator;
this.forward = forward;
}
public boolean isForward() {
return forward;
}
public boolean isReverse() {
return !forward;
}
public static RangeOperator resolveOperator(StringToken token) {
if(token != null) {
String value = token.getValue();
for(RangeOperator operator : VALUES) {
if (operator.operator.equals(value)) {
return operator;
}
}
}
return null;
}
private static final RangeOperator[] VALUES = {
DOT,
TO,
FROM
};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy