NumberFunctor.java

// FILE. . . . . d:/hak/hlt/src/hlt/fot/NumberFunctor.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Sat Jul 14 07:23:52 2018

// NB: this is used nowhere so far in the package or elsewhere - why define it?

package hlt.fot;



This is a class for a functor denoting a numerical value. Note that it is not related to the class Functor.

See also:  Functor
Copyright:  © by the author
Author:  Hassan Aït-Kaci
Version:  Last modified on Sun Aug 05 06:41:55 2018 by hak



public class NumberFunctor
{ /* ************************************************************************ */
  
  

Numerical double value of this functor when it is a number constant.


  protected double value = Double.NaN;

  

Returns the double value of this number functor.


  public double value ()
  {
    return this.value;
  }

  

Sets the number value of this number functor to the given double and returns this number functor.


  public NumberFunctor setValue (double value)
  {
    this.value = value;
    return this;
  }

  protected boolean isInteger = false;

  

Sets the number value of this number functor to the given int and returns this number functor.


  public NumberFunctor setValue (int value)
  {
    isInteger = true;
    return setValue((double)value);
  }

  

Returns true when this functor numerical value is an int.


  public boolean isInteger ()
  {
    return isInteger;
  }

  /* ************************************************************************ */
  
  public String toString ()
  {
    return isInteger() ? Integer.toString((int)value) : Double.toString(value);
  }
  
}


This file was generated on Sat Aug 25 07:59:54 CEST 2018 from file NumberFunctor.java
by the hlt.language.tools.Hilite Java tool written by Hassan Aït-Kaci