unsw.cse.framescript
Class FSDouble

java.lang.Object
  extended by unsw.cse.framescript.Term
      extended by unsw.cse.framescript.FSNumber
          extended by unsw.cse.framescript.FSDouble

public class FSDouble
extends FSNumber

This class provides FrameScript with real/decimal numbers.

Author:
mmcgill

Constructor Summary
FSDouble(double d)
          Creates a double with a given value.
 
Method Summary
 FSNumber add(FSNumber n)
          Adds two numbers.
 FSNumber divide(FSNumber n)
          Divides two numbers.
 boolean eq(FSNumber n)
          Compares two numbers for equality.
 boolean ge(FSNumber n)
          Greater than or equal to comparison of two numbers.
 double getValue()
          Gets the value of the number as a double.
 boolean gt(FSNumber n)
          Greater than comparison of two numbers.
 boolean le(FSNumber n)
          Less than or equal to comparison of two numbers.
 boolean lt(FSNumber n)
          Less than comparison of two numbers.
 FSNumber mod(FSNumber n)
          Gets the modular of two numbers.
 FSNumber multiply(FSNumber n)
          Multiplies two numbers.
 FSNumber negate()
          Gets the negative of a number.
 FSNumber subtract(FSNumber n)
          Subtracts two numbers.
 java.lang.String toString()
          Turns the Term into a string.
 
Methods inherited from class unsw.cse.framescript.FSNumber
equals, eval, getNumber
 
Methods inherited from class unsw.cse.framescript.Term
assign, asString, fullMatch, indents, mapVars, match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSDouble

public FSDouble(double d)
Creates a double with a given value.

Parameters:
d - the numerical value
Method Detail

getValue

public double getValue()
Description copied from class: FSNumber
Gets the value of the number as a double.

Specified by:
getValue in class FSNumber
Returns:
the value of the number

negate

public FSNumber negate()
Description copied from class: FSNumber
Gets the negative of a number.

Specified by:
negate in class FSNumber
Returns:
a number whose value is the negative of this

add

public FSNumber add(FSNumber n)
Description copied from class: FSNumber
Adds two numbers.

Specified by:
add in class FSNumber
Parameters:
n - the number being added to this
Returns:
a number whose value is the sum of this and n

subtract

public FSNumber subtract(FSNumber n)
Description copied from class: FSNumber
Subtracts two numbers.

Specified by:
subtract in class FSNumber
Parameters:
n - the number being subtracted from this
Returns:
a number whose value is this minus n

multiply

public FSNumber multiply(FSNumber n)
Description copied from class: FSNumber
Multiplies two numbers.

Specified by:
multiply in class FSNumber
Parameters:
n - the number this is being multiplied by
Returns:
a number whose value is the product of this and n

divide

public FSNumber divide(FSNumber n)
                throws FSException
Description copied from class: FSNumber
Divides two numbers.

Specified by:
divide in class FSNumber
Parameters:
n - the number this is being divided by
Returns:
a number whose value is this divided by n
Throws:
FSException - if n is 0

mod

public FSNumber mod(FSNumber n)
             throws FSException
Description copied from class: FSNumber
Gets the modular of two numbers.

Specified by:
mod in class FSNumber
Parameters:
n - the modular number
Returns:
a number whose value is this mod n
Throws:
FSException - if this or n is not an integer or n is 0

lt

public boolean lt(FSNumber n)
Description copied from class: FSNumber
Less than comparison of two numbers.

Specified by:
lt in class FSNumber
Parameters:
n - the potentially larger number
Returns:
true if this is smaller than n, else false

le

public boolean le(FSNumber n)
Description copied from class: FSNumber
Less than or equal to comparison of two numbers.

Specified by:
le in class FSNumber
Parameters:
n - the potentially larger number
Returns:
true if this is smaller than or equal to n, else false

gt

public boolean gt(FSNumber n)
Description copied from class: FSNumber
Greater than comparison of two numbers.

Specified by:
gt in class FSNumber
Parameters:
n - the potentially smaller number
Returns:
true if this is greater than n, else false

ge

public boolean ge(FSNumber n)
Description copied from class: FSNumber
Greater than or equal to comparison of two numbers.

Specified by:
ge in class FSNumber
Parameters:
n - the potentially smaller number
Returns:
true if this is greater than or equal to n, else false

eq

public boolean eq(FSNumber n)
Description copied from class: FSNumber
Compares two numbers for equality.

Specified by:
eq in class FSNumber
Parameters:
n - number this is being compared to
Returns:
true if they are equal, false otherwise

toString

public java.lang.String toString()
Description copied from class: Term
Turns the Term into a string.

Specified by:
toString in class Term