Record Class BetweenNode
java.lang.Object
java.lang.Record
cloud.opencode.base.expression.ast.BetweenNode
- Record Components:
value- the value to test | 要测试的值lower- the lower bound (inclusive) | 下界(包含)upper- the upper bound (inclusive) | 上界(包含)
- All Implemented Interfaces:
Node
Range Test Node
范围测试节点
Represents the between operator which tests whether a value falls
within a range (inclusive on both ends).
表示 between 运算符,用于测试一个值是否在范围内(两端包含)。
Features | 主要功能:
- Inclusive range test: lower <= value <= upper - 包含范围测试:下界 <= 值 <= 上界
- Numeric comparison via doubleValue for Number types - 数值类型通过 doubleValue 比较
- Comparable comparison for other types - 其他类型通过 Comparable 比较
Usage Examples | 使用示例:
// age between 18 and 65
Node between = BetweenNode.of(ageNode, lowerNode, upperNode);
Object result = between.evaluate(ctx); // true or false
Security | 安全性:
- Thread-safe: Yes, immutable record - 线程安全: 是,不可变记录
- Null-safe: No, value/lower/upper required non-null - 空值安全: 否,值/下界/上界要求非空
- Since:
- JDK 25, opencode-base-expression V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBetweenNode(Node value, Node lower, Node upper) Creates an instance of aBetweenNoderecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.evaluate(EvaluationContext context) Evaluate this node 求值此节点final inthashCode()Returns a hash code value for this object.lower()Returns the value of thelowerrecord component.static BetweenNodeCreate range test node 创建范围测试节点Get string representation for debugging 获取用于调试的字符串表示final StringtoString()Returns a string representation of this record class.upper()Returns the value of theupperrecord component.value()Returns the value of thevaluerecord component.Methods inherited from interface Node
getTypeName
-
Constructor Details
-
BetweenNode
-
-
Method Details
-
of
Create range test node 创建范围测试节点- Parameters:
value- the value to test | 要测试的值lower- the lower bound (inclusive) | 下界(包含)upper- the upper bound (inclusive) | 上界(包含)- Returns:
- the range test node | 范围测试节点
-
evaluate
Description copied from interface:NodeEvaluate this node 求值此节点 -
toExpressionString
Description copied from interface:NodeGet string representation for debugging 获取用于调试的字符串表示- Specified by:
toExpressionStringin interfaceNode- Returns:
- the string representation | 字符串表示
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
-
lower
-
upper
-