package mfl;

public class Number
extends mfl.Value
{
  double java_value;

  public Number(){
    java_value = 0.0;
  }
  public Number(double v){
    java_value = v;
  }

 public mfl.Value divide_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.divide_op(x);
    return new Number(java_value / ((Number)x).java_value);}

  public boolean equals(Object x)
    {if (!(x instanceof Number)) return false;
    return java_value == ((Number)x).java_value;}

  public mfl.Value exponentiate_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.exponentiate_op(x);
    return new Number(java.lang.Math.pow(java_value, ((Number)x).java_value));}

  public mfl.Value greater_than_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.greater_than_op(x);
    return java_value > ((Number)x).java_value ? mfl.Boolean.True : mfl.Boolean.False;}

  public mfl.Value greater_than_or_equal_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.greater_than_or_equal_op(x);
    return java_value >= ((Number)x).java_value ? mfl.Boolean.True : mfl.Boolean.False;}

  public mfl.Value less_than_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.less_than_op(x);
    return java_value < ((Number)x).java_value ? mfl.Boolean.True : mfl.Boolean.False;}

  public mfl.Value less_than_or_equal_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.less_than_or_equal_op(x);
    return java_value <= ((Number)x).java_value ? mfl.Boolean.True : mfl.Boolean.False;}

  public mfl.Value minus_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.minus_op(x);
    return new Number(java_value - ((Number)x).java_value);}

  public mfl.Value multiply_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.multiply_op(x);
    return new Number(java_value * ((Number)x).java_value);}

  public mfl.Value not_equal_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.not_equal_op(x);
    return java_value != ((Number)x).java_value ? mfl.Boolean.True : mfl.Boolean.False;}

  public mfl.Value plus_op(mfl.Value x)
    {if (!(x instanceof Number)) return super.plus_op(x);
    return new Number(java_value + ((Number)x).java_value);}

  public java.lang.String toString()
    {java.lang.String result; long i = (long)java_value;
     if ((double)i == java_value) return new java.lang.Long(i).toString();
     return new java.lang.Double(java_value).toString();}    
   
  public mfl.Value unary_minus_op()
    {return new Number(-java_value);}

}
