csheets.core.formula.lang
Class Negator

java.lang.Object
  extended by csheets.core.formula.lang.Negator
All Implemented Interfaces:
Operator, UnaryOperator, Serializable

public class Negator
extends Object
implements UnaryOperator

A negator (negative sign).

Author:
Einar Pehrson
See Also:
Serialized Form

Constructor Summary
Negator()
          Creates a new negator.
 
Method Summary
 Value applyTo(Expression operand)
          Returns the negation of the operand's value.
 String getIdentifier()
          Returns the operator's string identirifer.
 Value.Type getOperandValueType()
          Returns the type of value that the operator's operands can have.
 boolean isPrefix()
          Returns whether the operator is a prefix operator, i.e. it appears before its operand.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Negator

public Negator()
Creates a new negator.

Method Detail

applyTo

public Value applyTo(Expression operand)
              throws IllegalValueTypeException
Returns the negation of the operand's value.

Specified by:
applyTo in interface UnaryOperator
Returns:
the negation of the operand's value
Throws:
IllegalValueTypeException - if the value of the operand is not numeric

getIdentifier

public String getIdentifier()
Description copied from interface: Operator
Returns the operator's string identirifer.

Specified by:
getIdentifier in interface Operator
Returns:
a string representation of the operator.

isPrefix

public boolean isPrefix()
Description copied from interface: UnaryOperator
Returns whether the operator is a prefix operator, i.e. it appears before its operand.

Specified by:
isPrefix in interface UnaryOperator
Returns:
true for prefix operators, false for postfix operators

getOperandValueType

public Value.Type getOperandValueType()
Description copied from interface: Operator
Returns the type of value that the operator's operands can have.

Specified by:
getOperandValueType in interface Operator
Returns:
the type of value that the operator's operands can have

toString

public String toString()
Overrides:
toString in class Object