JRef
Date: 2018-01-12

org.jpl7

## Class JRef

- java.lang.Object
- - org.jpl7.Term
  - - org.jpl7.JRef

-     public class JRef
      extends Term

  JRef is a specialised Term with a (non-null, non-String) Object field, representing JPL 7.4's Prolog references to Java objects, e.g. <jref>(0x01D8000).

  Copyright (C) 2004-2017 Paul Singleton

  Copyright (C) 1998 Fred Dushin

  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  See Also:
    `Term`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRef(java.lang.Object object)` This constructor creates a JRef, initialized with the supplied (non-null, non-String) Object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `atomType()`
    `boolean` | `equals(java.lang.Object obj)`
    `boolean` | `hasFunctor(java.lang.String name, int arity)` Whether this Term's functor has 'name' and 'arity' (c.f.
    `java.lang.Object` | `jrefToObject()` Deprecated. Use org.jpl7.JRef.object()
    `java.lang.Object` | `object()` The (non-null, non-String) Object which this org.jpl7.JRef refers to, iff this Term is a JRef.
    `java.lang.Object` | `ref()` Deprecated.
    `java.lang.String` | `toString()` Returns a Prolog source text representation of this JRef
    `int` | `type()` returns the type of this term, as one of org.jpl7.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" or "JRef"

    - ### Methods inherited from class org.jpl7.Term

      `arg, args, arity, bigValue, doubleValue, floatValue, hasFunctor, hasFunctor, hasFunctor, intValue, isAtom, isBig, isBigInteger, isCompound, isFloat, isInteger, isJFalse, isJNull, isJRef, isJTrue, isJVoid, isListNil, isListPair, isVariable, listLength, longValue, name, objectToJRef, putParams, putTerm, toString, toTermArray`

    - ### Methods inherited from class java.lang.Object

      `getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### JRef

          public JRef(java.lang.Object object)

      This constructor creates a JRef, initialized with the supplied (non-null, non-String) Object.
      Parameters:
        `object` - this JRef's value (a non-null, non-String Object)

  - ### Method Detail

    - #### atomType

          public final java.lang.String atomType()

      Overrides:
        `atomType` in class `Term`
      Returns:
        the type ("text", "string", "reserved_symbol", "jref" etc.) of an Atom

    - #### equals

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

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hasFunctor

          public boolean hasFunctor(java.lang.String name,
                                    int arity)

      Description copied from class: `Term`
      Whether this Term's functor has 'name' and 'arity' (c.f. behaviour of SWI Prolog's functor/3)
      Overrides:
        `hasFunctor` in class `Term`
      Parameters:
        `name` - a possible name for the functor of a term
        `arity` - an arity 0+
      Returns:
        whether this Term's functor has 'name' and 'arity'

    - #### jrefToObject

          public java.lang.Object jrefToObject()

      Deprecated. Use org.jpl7.JRef.object()
      Overrides:
        `jrefToObject` in class `Term`
      Returns:
        the Object which this JRef references
      See Also:
        `object()`

    - #### object

          public java.lang.Object object()

      Description copied from class: `Term`
      The (non-null, non-String) Object which this org.jpl7.JRef refers to, iff this Term is a JRef.
      Overrides:
        `object` in class `Term`
      Returns:
        the (non-null, non-String) Object which this Term refers to, iff this Term is a JRef.

    - #### ref

          public java.lang.Object ref()

      Deprecated.
      The (non-null, non-String) Object which this org.jpl7.JRef represents
      Overrides:
        `ref` in class `Term`
      Returns:
        the (non-null, non-String) Object which this org.jpl7.JRef represents

    - #### toString

          public java.lang.String toString()

      Returns a Prolog source text representation of this JRef
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a Prolog source text representation of this JRef

    - #### type

          public final int type()

      Description copied from class: `Term`
      returns the type of this term, as one of org.jpl7.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc
      Specified by:
        `type` in class `Term`
      Returns:
        the type of this term, as one of org.jpl7.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" or "JRef"
      Specified by:
        `typeName` in class `Term`
      Returns:
        the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" or "JRef"