public class Atom extends Term
Atom a = new Atom("hello");An Atom can be used (and re-used) as an argument of Compound Terms. Two Atom instances are equal (by equals()) iff they have equal names.
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.
Constructor and Description |
---|
Atom(java.lang.String name) |
Atom(java.lang.String name,
java.lang.String type) |
Modifier and Type | Method and Description |
---|---|
Term[] |
args()
the (zero) arguments of an Atom, as a (zero-length) Term[]
|
java.lang.String |
atomType() |
boolean |
equals(java.lang.Object obj)
Two Atoms are equal if they are identical (same object) or their respective names and blobTypes are equal
|
boolean |
hasFunctor(java.lang.String name,
int arity)
Tests whether this Compound's functor has (String) 'name' and 'arity'.
|
boolean |
isListNil()
whether this Term denotes (syntax-specifically) an empty list
|
java.lang.String |
name()
the name (unquoted) of this Compound
|
java.lang.String |
toString()
an Atom's name is quoted if it is not a simple identifier.
|
int |
type()
returns the type of this term, as "Prolog.ATOM"
|
java.lang.String |
typeName()
returns the name of the type of this term, as "Atom"
|
arg, arity, bigValue, doubleValue, floatValue, hasFunctor, hasFunctor, intValue, isAtom, isBigInteger, isCompound, isFloat, isInteger, isJFalse, isJNull, isJObject, isJRef, isJTrue, isJVoid, isListPair, isVariable, jrefToObject, listLength, longValue, objectToJRef, putParams, putTerm, toString, toTermArray
public Atom(java.lang.String name)
name
- the Atom's name (unquoted)public Atom(java.lang.String name, java.lang.String type)
public Term[] args()
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the Object to compare (not necessarily another Atom)public final boolean hasFunctor(java.lang.String name, int arity)
hasFunctor
in class Term
public boolean isListNil()
public final java.lang.String name()
public java.lang.String toString()
toString
in class java.lang.Object
public final int type()