## jpl
Class Integer

    java.lang.Object
      jpl.Term
          jpl.Integer

public class Integer
extends Term

Integer is a specialised Term with a long field, representing a Prolog integer value.

     Integer i = new Integer(1024);

Once constructed, the value of an Integer instance cannot be altered. An Integer can be used (and re-used) as an argument of Compounds. Beware confusing jpl.Integer with java.lang.Integer.

Copyright (C) 2004 Paul Singleton

Copyright (C) 1998 Fred Dushin

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.

Version:
  $Revision: 1.2 $
See Also:
  `Term`, `Compound`

Constructor Summary
`Integer(int value)`
`Integer(long value)`

Method Summary
`Term[]` `args()` Deprecated.
`int` `arity()` Returns the arity (0) of this jpl.Integer
`java.lang.String` `debugString()` Deprecated.
`double` `doubleValue()` Returns the value of this Integer converted to a double
`boolean` `equals(java.lang.Object obj)` Two Integer instances are equal if they are the same object, or if their values are equal
`float` `floatValue()` Returns the value of this Integer converted to a float
`boolean` `hasFunctor(int val, int arity)` Tests whether this Integer's functor has (int) 'name' and 'arity'
`int` `intValue()` Returns the value of this Integer as an int if possible, else throws exception
`long` `longValue()` Returns the value of this Integer converted to a long
`java.lang.String` `toString()` Returns a Prolog source text representation of this Integer's value
`int` `type()` returns the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
`java.lang.String` `typeName()` returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc
`int` `value()` Deprecated.

Methods inherited from class jpl.Term
`arg, debugString, hasFunctor, hasFunctor, isAtom, isCompound, isFloat, isInteger, isJBoolean, isJRef, isJVoid, isVariable, listLength, name, putParams, putParams, toString, toTermArray`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Integer

    public Integer(long value)

Parameters:
  `value` - This Integer's (long) value

### Integer

    public Integer(int value)

Parameters:
  `value` - This Integer's (int) value

Method Detail

### hasFunctor

    public final boolean hasFunctor(int val,
                                    int arity)

  Tests whether this Integer's functor has (int) 'name' and 'arity'

  Overrides:
    `hasFunctor` in class `Term`
  Returns:
    whether this Integer's functor has (int) 'name' and 'arity'

### arity

    public final int arity()

  Returns the arity (0) of this jpl.Integer

  Overrides:
    `arity` in class `Term`
  Returns:
    the arity (0) of this jpl.Integer

### intValue

    public final int intValue()

  Returns the value of this Integer as an int if possible, else throws exception

  Overrides:
    `intValue` in class `Term`
  Returns:
    the int value of this Integer (if representable)

### longValue

    public final long longValue()

  Returns the value of this Integer converted to a long

  Overrides:
    `longValue` in class `Term`
  Returns:
    the value of this Integer converted to a long

### floatValue

    public final float floatValue()

  Returns the value of this Integer converted to a float

  Overrides:
    `floatValue` in class `Term`
  Returns:
    the value of this Integer converted to a float

### doubleValue

    public final double doubleValue()

  Returns the value of this Integer converted to a double

  Overrides:
    `doubleValue` in class `Term`
  Returns:
    the value of this Integer converted to a double

### toString

    public java.lang.String toString()

  Returns a Prolog source text representation of this Integer's value

  Returns:
    a Prolog source text representation of this Integer's value

### equals

    public final boolean equals(java.lang.Object obj)

  Two Integer instances are equal if they are the same object, or if their values are equal

  Parameters:
    `obj` - The Object to compare (not necessarily an Integer)
  Returns:
    true if the Object satisfies the above condition

### type

    public final int type()

  Description copied from class: `Term`
  returns the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc

  Specified by:
    `type` in class `Term`
  Returns:
    the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc

### typeName

    public java.lang.String typeName()

  Description copied from class: `Term`
  returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc

  Specified by:
    `typeName` in class `Term`
  Returns:
    the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc

### value

    public final int value()

  Deprecated.

  Returns the int value of this jpl.Integer

  Returns:
    the Integer's value

### args

    public Term[] args()

  Deprecated.

  The (nonexistent) args of this Integer

  Specified by:
    `args` in class `Term`
  Returns:
    the (nonexistent) args of this Integer

### debugString

    public java.lang.String debugString()

  Deprecated.

  Returns a debug-friendly representation of this Integer's value

  Specified by:
    `debugString` in class `Term`
  Returns:
    a debug-friendly representation of this Integer's value