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.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name
the name of this Compound
|
protected java.lang.String |
type |
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
|
protected void |
put(java.util.Map<java.lang.String,term_t> varnames_to_vars,
term_t term)
To put an Atom in a term, we create a sequence of term_t references from the Term.terms_to_term_ts() method, and then use the Prolog.cons_functor_v() method to create a Prolog compound term.
|
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, getSubst, getSubsts, getTerm, getTerm, hasFunctor, hasFunctor, intValue, isAtom, isBigInteger, isCompound, isFloat, isInteger, isJFalse, isJNull, isJObject, isJRef, isJTrue, isJVoid, isListPair, isVariable, jrefToObject, listLength, longValue, objectToJRef, put, putParams, putParams, putParams1, putParams2, putTerm, putTerms, terms_equals, toString, toTermArray
protected final java.lang.String name
protected final java.lang.String type
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()
protected void put(java.util.Map<java.lang.String,term_t> varnames_to_vars, term_t term)
public java.lang.String toString()
toString
in class java.lang.Object
public final int type()