## org.opencyc.cycobject
Class CycConstant

    java.lang.Object
      |
      +--org.opencyc.cycobject.CycObject
            |
            +--org.opencyc.cycobject.CycFort
                  |
                  +--org.opencyc.cycobject.CycConstant

All Implemented Interfaces:
  java.lang.Comparable, java.io.Serializable

public class CycConstant
extends CycFort
implements java.lang.Comparable

Provides the behavior and attributes of an OpenCyc Constant.

Author:
  Stefano Bertolo, Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  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.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` `constantXMLTag` Field for storing the name of the XML tag for CycConstant objects
`Guid` `guid` The GUID (Globally Unique IDentifier) of the `CycConstant`object.``
`static int` `indentLength` The default indentation for printing CycConstant objects to XML
`java.lang.String` `name` The name of the `CycConstant`object.``
`static java.lang.String` `nameXMLTag` Field for storing the name of the XML tag for the name of CycConstant objects

Fields inherited from class org.opencyc.cycobject.CycFort
`idXMLTag`

Constructor Summary
`CycConstant()` Constructs a new incomplete `CycConstant` object.
`CycConstant(java.lang.String name, Guid guid, java.lang.Integer id)` Constructs a new `CycConstant` object from name, guid and id.

Method Summary
`java.lang.String` `cyclify()` Returns the name of the `CycConstant` with "#$" prefixed.
`java.lang.Object` `cycListApiValue()` Returns this object in a form suitable for use as an `CycList` api expression value.
`boolean` `equals(java.lang.Object object)` Returns `true` some object equals this `CycConstant`.
`Guid` `getGuid()` Gets the guid
`java.lang.Integer` `getId()` Gets the id.
`java.lang.String` `getName()` Gets the name
`int` `hashCode()` Provides the hash code appropriate for the `CycConstant`.
`static java.lang.String` `makeValidConstantName(java.lang.String candidateName)` Makes a valid constant name from the candidate name by substituting an underline character for the invalid characters.
`java.lang.String` `safeToString()` Returns a string representation without causing additional api calls to determine constant names.
`void` `setGuid(Guid guid)` Sets the guid
`void` `setName(java.lang.String name)` Sets the name
`java.lang.String` `stringApiValue()` Returns this object in a form suitable for use as an `String` api expression value.
`java.lang.String` `toString()` Returns a String representation of the `CycConstant`.
`void` `toXML(XMLWriter xmlWriter, int indent, boolean relative)` Prints the XML representation of the CycConstant to an `XMLWriter`
`java.lang.String` `toXMLString()` Returns the XML representation of this object.

Methods inherited from class org.opencyc.cycobject.CycFort
`compareTo, setId`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.lang.Comparable
`compareTo`

Field Detail

### constantXMLTag

    public static final java.lang.String constantXMLTag

  Field for storing the name of the XML tag for CycConstant objects

### nameXMLTag

    public static final java.lang.String nameXMLTag

  Field for storing the name of the XML tag for the name of CycConstant objects

### indentLength

    public static int indentLength

  The default indentation for printing CycConstant objects to XML

### guid

    public Guid guid

  The GUID (Globally Unique IDentifier) of the `CycConstant`object. A string such as "c10af8ae-9c29-11b1-9dad-c379636f7270"``

### name

    public java.lang.String name

  The name of the `CycConstant`object. A string such as "HandGrenade"``

Constructor Detail

### CycConstant

    public CycConstant()

  Constructs a new incomplete `CycConstant` object.

### CycConstant

    public CycConstant(java.lang.String name,
                       Guid guid,
                       java.lang.Integer id)

  Constructs a new `CycConstant` object from name, guid and id.
  Parameters:
    `name` - the constant name
    `guid` - the GUID that uniquely identifies the constant everywhere
    `id` - the id that uniquely identifies the constant on a given OpenCyc server

Method Detail

### getId

    public java.lang.Integer getId()

  Gets the id.
  Overrides:
    `getId` in class `CycFort`
  Returns:
    the id

### getName

    public java.lang.String getName()

  Gets the name
  Returns:
    the name

### setName

    public void setName(java.lang.String name)

  Sets the name
  Parameters:
    `name` - the name

### getGuid

    public Guid getGuid()

  Gets the guid
  Returns:
    the guid

### setGuid

    public void setGuid(Guid guid)

  Sets the guid
  Parameters:
    `guid` - the guid

### toXMLString

    public java.lang.String toXMLString()
                                 throws java.io.IOException

  Returns the XML representation of this object.
  Returns:
    the XML representation of this object

### toXML

    public void toXML(XMLWriter xmlWriter,
                      int indent,
                      boolean relative)
               throws java.io.IOException

  Prints the XML representation of the CycConstant to an `XMLWriter`
  Overrides:
    `toXML` in class `CycFort`
  Parameters:
    `xmlWriter` - an `XMLWriter`
    `indent` - an int that specifies by how many spaces to indent
    `relative` - a boolean; if true indentation is relative, otherwise absolute

### hashCode

    public int hashCode()

  Provides the hash code appropriate for the `CycConstant`.
  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    the hash code for the `CycConstant`

### equals

    public boolean equals(java.lang.Object object)

  Returns `true` some object equals this `CycConstant`. The equality check uses whatever instance attributes are locally available from both CycConstant objects. Completion of missing attributes is performed if required for the comparison of like attributes.
  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `object` - the `Object` for equality comparison
  Returns:
    equals `boolean` value indicating equality or non-equality.

### toString

    public java.lang.String toString()

  Returns a String representation of the `CycConstant`.
  Overrides:
    `toString` in class `java.lang.Object`

### safeToString

    public java.lang.String safeToString()

  Returns a string representation without causing additional api calls to determine constant names.
  Overrides:
    `safeToString` in class `CycFort`
  Returns:
    a string representation without causing additional api calls to determine constant names

### cyclify

    public java.lang.String cyclify()

  Returns the name of the `CycConstant` with "#$" prefixed.
  Overrides:
    `cyclify` in class `CycFort`
  Returns:
    the name of the `CycConstant` with "#$" prefixed.

### stringApiValue

    public java.lang.String stringApiValue()

  Returns this object in a form suitable for use as an `String` api expression value.
  Overrides:
    `stringApiValue` in class `CycFort`
  Returns:
    this object in a form suitable for use as an `String` api expression value

### cycListApiValue

    public java.lang.Object cycListApiValue()

  Returns this object in a form suitable for use as an `CycList` api expression value.
  Overrides:
    `cycListApiValue` in class `CycFort`
  Returns:
    this object in a form suitable for use as an `CycList` api expression value

### makeValidConstantName

    public static java.lang.String makeValidConstantName(java.lang.String candidateName)

  Makes a valid constant name from the candidate name by substituting an underline character for the invalid characters.