|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.ArrayList | +--org.opencyc.cycobject.CycList
Provides the behavior and attributes of an OpenCyc list, typically used to represent assertions in their external (EL) form.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED 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 OPENCYC ORGANIZATION OR ITS 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 AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Field Summary | |
static java.lang.String |
cycListXMLTag
XML serialization tags. |
static java.lang.String |
dottedElementXMLTag
|
static java.lang.String |
doubleXMLTag
|
static int |
indentLength
XML serialization indentation. |
static java.lang.String |
integerXMLTag
|
static java.lang.String |
stringXMLTag
|
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
CycList()
Constructs a new empty CycList object. |
|
CycList(java.util.Collection c)
Constructs a new CycList object, containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
CycList(java.lang.Object element)
Constructs a new CycList object, containing as its sole element element |
|
CycList(java.lang.Object firstElement,
java.util.Collection remainingElements)
Constructs a new CycList object, containing as its first element firstElement, and containing as its remaining elements the contents of the Collection remaining elements. |
|
CycList(java.lang.Object element1,
java.lang.Object element2)
Constructs a new CycList object, containing as its first element element1, and element2 as its second element. |
Method Summary | |
void |
addAllNew(java.util.Collection objects)
Adds the given elements to this list if they are not already contained. |
void |
addNew(java.lang.Object object)
Adds the given element to this list if it is not already contained. |
void |
addQuoted(java.lang.Object object)
Forms a quote expression for the given object and adds it to the list. |
java.lang.Object |
clone()
Creates and returns a copy of this CycList. |
CycList |
combinationsOf(int n)
Returns a CycList of the length N combinations of sublists from this object. |
static CycList |
construct(java.lang.Object object1,
java.lang.Object object2)
Constructs a CycList using the semantics of Lisp symbolic expressions. 1. |
boolean |
containsDuplicates()
Returns true iff this list contains duplicate elements. |
java.lang.String |
cyclify()
Returns a cyclified string representation of the OpenCyc CycList. |
java.lang.Object |
cycListApiValue()
Returns this object in a form suitable for use as an CycList api expression value. |
CycListVisitor |
cycListVisitor()
Returns a CycListVisitor enumeration of the non-CycList and non-nil elements. |
CycList |
deepCopy()
Creates and returns a deep copy of this CycList. |
boolean |
doesElementPrecedeOthers(java.lang.Object element,
CycList otherElements)
Returns true if the element is a member of this CycList and no element in CycList otherElements precede it. |
java.lang.Object |
first()
Returns the first element of the CycList. |
java.lang.Object |
fourth()
Returns the fourth element of the CycList. |
java.lang.Object |
getDottedElement()
Gets the dotted element. |
java.lang.Object |
getValueForKeyword(CycSymbol keyword)
Gets the value following the given keyword symbol. |
boolean |
isProperList()
Returns true if this is a proper list. |
boolean |
isValid()
Answers true iff the CycList contains valid elements. |
java.lang.Object |
last()
Returns the last element of the CycList. |
static CycList |
list(java.lang.Object element)
Creates a new CycList containing the given element. |
static CycList |
list(java.lang.Object element1,
java.lang.Object element2)
Creates a new CycList containing the given two elements. |
static CycList |
list(java.lang.Object element1,
java.lang.Object element2,
java.lang.Object element3)
Creates a new CycList containing the given three elements. |
CycList |
randomPermutation()
Returns a random ordering of the CycList without recursion. |
CycList |
rest()
Returns the CycList after removing the first element. |
CycList |
reverse()
Returns a new CycList whose elements are the reverse of this CycList, which is unaffected. |
java.lang.String |
safeToString()
Returns a String representation of this List without causing additional api calls to complete the name field of constants. |
java.lang.Object |
second()
Returns the second element of the CycList. |
void |
setDottedElement(java.lang.Object dottedElement)
Sets the dotted element and set the improper list attribute to true. |
CycList |
sort()
Returns a new CycList, which is sorted in the default collating sequence. |
java.lang.String |
stringApiValue()
Returns this object in a form suitable for use as an String api expression value. |
CycList |
subst(java.lang.Object newObject,
java.lang.Object oldObject)
Returns a new CycList with every occurrance of Object oldObject replaced by Object newObject. |
java.lang.Object |
third()
Returns the third element of the CycList. |
java.lang.String |
toPrettyString(java.lang.String indent)
Returns a `pretty-printed' String representation of this CycList. |
java.lang.String |
toString()
Returns a String representation of this List. |
protected java.lang.String |
toStringHelper(boolean safe)
Returns a String representation of this CycList. |
protected void |
toXML(java.lang.Object object,
XMLWriter xmlWriter,
int indent,
boolean relative)
Writes a CycList element the the given XML output stream. |
void |
toXML(XMLWriter xmlWriter,
int indent,
boolean relative)
Prints the XML representation of the |
java.lang.String |
toXMLString()
Returns the XML representation of this object. |
boolean |
treeContains(java.lang.Object object)
Returns true if the proper list tree contains the given object anywhere in the tree. |
Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
Field Detail |
public static final java.lang.String cycListXMLTag
public static final java.lang.String integerXMLTag
public static final java.lang.String doubleXMLTag
public static final java.lang.String stringXMLTag
public static final java.lang.String dottedElementXMLTag
public static int indentLength
Constructor Detail |
public CycList()
public CycList(java.util.Collection c)
c
- the collection of assumed valid OpenCyc objects.public CycList(java.lang.Object firstElement, java.util.Collection remainingElements)
firstElement
- the object which becomes the head of the CycListremainingElements
- a Collection, whose elements become the
remainder of the CycListpublic CycList(java.lang.Object element)
element
- the object which becomes the head of the CycListpublic CycList(java.lang.Object element1, java.lang.Object element2)
element1
- the object which becomes the head of the CycListelement2
- the object which becomes the second element of the CycListMethod Detail |
public static CycList construct(java.lang.Object object1, java.lang.Object object2)
object1
- the first Object in the CycListobject2
- NIL or an Objectpublic java.lang.Object clone()
clone
in class java.util.ArrayList
public CycList deepCopy()
public java.lang.Object getDottedElement()
public void setDottedElement(java.lang.Object dottedElement)
public boolean isProperList()
public boolean isValid()
public static CycList list(java.lang.Object element)
element
- the contents of the new CycListpublic static CycList list(java.lang.Object element1, java.lang.Object element2)
element1
- the first item of the new CycListelement2
- the second item of the new CycListpublic static CycList list(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3)
element1
- the first item of the new CycListelement2
- the second item of the new CycListelement3
- the third item of the new CycListpublic java.lang.Object first()
public java.lang.Object second()
public java.lang.Object third()
public java.lang.Object fourth()
public java.lang.Object last()
public CycList rest()
public void addNew(java.lang.Object object)
public void addAllNew(java.util.Collection objects)
public boolean containsDuplicates()
public CycList reverse()
public CycList combinationsOf(int n)
n
- the length of the sublistpublic CycList randomPermutation()
public CycList subst(java.lang.Object newObject, java.lang.Object oldObject)
public java.lang.String toString()
toString
in class java.util.AbstractCollection
public java.lang.String safeToString()
protected java.lang.String toStringHelper(boolean safe)
safe
- when true, the representation is created without causing
additional api calls to complete the name field of constantspublic java.lang.String toPrettyString(java.lang.String indent)
indent,
- the indent string that is added before the
String representation this CycListpublic java.lang.String cyclify()
public java.lang.String stringApiValue()
public java.lang.Object cycListApiValue()
public CycList sort()
public CycListVisitor cycListVisitor()
public boolean treeContains(java.lang.Object object)
object
- the object to be found in the tree.public boolean doesElementPrecedeOthers(java.lang.Object element, CycList otherElements)
element
- the element under considerationotherElements
- the CycList of other elements under considerationpublic java.lang.String toXMLString() throws java.io.IOException
public void toXML(XMLWriter xmlWriter, int indent, boolean relative) throws java.io.IOException
xmlWriter
- the output XML serialization writerindent
- specifies by how many spaces the XML output should be indentedrelative
- specifies whether the indentation should be absolute --
indentation with respect to the beginning of a new line, relative = false
-- or relative to the indentation currently specified in the indent_string field
of the xml_writer object, relative = true.protected void toXML(java.lang.Object object, XMLWriter xmlWriter, int indent, boolean relative) throws java.io.IOException
object
- the object to be serialized as XMLxmlWriter
- the output XML serialization writerindent
- specifies by how many spaces the XML output should be indentedrelative
- specifies whether the indentation should be absolute --
indentation with respect to the beginning of a new line, relative = false
-- or relative to the indentation currently specified in the indent_string field
of the xml_writer object, relative = true.public java.lang.Object getValueForKeyword(CycSymbol keyword)
keyword
- the keyword symbolpublic void addQuoted(java.lang.Object object)
object
- the object to be quoted and added to this list
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |