Interface VectorOperators.Operator
- All Known Subinterfaces:
VectorOperators.Associative
,VectorOperators.Binary
,VectorOperators.Comparison
,VectorOperators.Conversion<E,
,F> VectorOperators.Ternary
,VectorOperators.Test
,VectorOperators.Unary
- Enclosing class:
VectorOperators
public static interface VectorOperators.Operator
Root type for all operator tokens, providing queries for common
properties such as arity, argument and return types, symbolic
name, and operator name.
- API Note:
- User code should not implement this interface. A future release of this type may restrict implementations to be members of the same package.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
arity()
Returns the arity of this operator (1, 2, or 3).boolean
compatibleWith
(Class<?> elementType) Reports whether this operator is compatible with the proposed element type.boolean
Returns the associativity of this operator.boolean
Reports whether this operator returns a boolean (a mask).name()
Returns the symbolic name of this operator, as a constant inVectorOperators
.Returns the Java operator symbol or method name corresponding to this operator.Class
<?> Reports the special return type of this operator.
-
Method Details
-
name
String name()Returns the symbolic name of this operator, as a constant inVectorOperators
. The operator symbol, Java method name, or example expression, such as"+"
,"max"
or"-a"
, is also available asoperatorName()
.- Returns:
- the symbolic name of this operator,
such as
"ADD"
-
operatorName
String operatorName()Returns the Java operator symbol or method name corresponding to this operator. If there is no symbol or method, return a string containing a representative expression for the operator, using operand namesa
,b
(for non-unary operators), andc
(for ternary operators). The symbolic name of the constant, such as"ADD"
, is also available asname()
.- Returns:
- an operator token, such as
"+"
, or a method name, such as"max"
, or a representative expression, such as"-a"
-
arity
int arity()Returns the arity of this operator (1, 2, or 3).- Returns:
- the arity of this operator (1, 2, or 3)
-
isBoolean
boolean isBoolean()Reports whether this operator returns a boolean (a mask). A boolean operator also reportsboolean
as therangeType
.- Returns:
- whether this operator returns a boolean
-
rangeType
Class<?> rangeType()Reports the special return type of this operator. If this operator is a boolean, returnsboolean.class
. If this operator is aConversion
, returns its range type. Otherwise, the operator's return value always has whatever type was given as an input, and this method returnsObject.class
to denote that fact.- Returns:
- the special return type, or
Object.class
if none
-
isAssociative
boolean isAssociative()Returns the associativity of this operator. Only binary operators can be associative.- Returns:
- the associativity of this operator
-
compatibleWith
Reports whether this operator is compatible with the proposed element type. First, unrestricted operators are compatible with all element types. Next, if the element type isdouble
orfloat
and the operator is restricted to floating point types, it is compatible. Otherwise, if the element type is neitherdouble
norfloat
and the operator is restricted to integral types, it is compatible. Otherwise, the operator is not compatible.- Parameters:
elementType
- the proposed operand type for the operator- Returns:
- whether the proposed type is compatible with this operator
-