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 SingletonCopyright (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:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- 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 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 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 JRefint
type()
returns the type of this term, as one of org.jpl7.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etcjava.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
-
-
-
-
Method Detail
-
atomType
public final java.lang.String atomType()
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.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 classTerm
- Parameters:
name
- a possible name for the functor of a termarity
- 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 classTerm
- 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.
-
ref
public java.lang.Object ref()
Deprecated.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 classjava.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
-
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"
-
-