abstract class Operator[R] extends Postfix[R] with Precedence[R]
Represents an operator.
An operator is something that takes in the values on either side of it as arguments. For example, in the
expression 3 + 4
, +
is an operator that takes in the arguments 3
and 4
.
Operators also have precedence
. Operators with higher precedence are evaluated first. For example,
the expression 3 + 4 * 2
, is interpreted as 3 + (4 * 2)
because the *
operator has higher precedence than
the +
operator.
- R
The type that the evaluator should return after evaluating the tokens
- Source
- Token.scala
- Alphabetic
- By Inheritance
- Operator
- Precedence
- Postfix
- Token
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Operator(precedence: Int, associativity: Associativity)
- precedence
The precedence of this operator. This cannot be
Int.MinValue
orInt.MaxValue
, as these are reserved for brackets and functions respectively.- associativity
The associativity of the token - either
Associativity.Left
orAssociativity.Right
. See Associativity for more information.
Abstract Value Members
-
abstract
def
apply(left: R, right: R): R
Returns the result of applying this operator on two values.
Returns the result of applying this operator on two values.
- left
The value to the left of the operator
- right
The value to the right of the operator
- returns
The result of applying the operator
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val associativity: Associativity
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
val
precedence: Int
- Definition Classes
- Operator → Precedence
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
This is the documentation for the Evaluator project (see GitHub).
The main package net.totietje.evaluator. The net.totietje.complex package contains an example usage of this package, which may also be useful.