com.thinkaurelius.titan.graphdb.internal

## Class AbstractElement

- java.lang.Object
- - com.thinkaurelius.titan.graphdb.internal.AbstractElement

- All Implemented Interfaces:
    Idfiable, TitanElement, InternalElement, Removable, com.tinkerpop.blueprints.Element, Comparable<TitanElement>
  Direct Known Subclasses:
    AbstractTypedRelation, AbstractVertex

      public abstract class AbstractElement
      extends Object
      implements InternalElement, Comparable<TitanElement>

  AbstractElement is the base class for all elements in Titan. It is defined and uniquely identified by its id. For the id, it holds that: id<0: Temporary id, will be assigned id>0 when the transaction is committed id=0: Virtual or implicit element that does not physically exist in the database id>0: Physically persisted element
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractElement(long id)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `InternalVertex` | `clone()`
    `static int` | `compare(TitanElement e1, TitanElement e2)`
    `int` | `compareTo(TitanElement other)`
    `boolean` | `equals(Object other)`
    `protected long` | `getCompareId()` Long identifier used to compare elements.
    `long` | `getLongId()` Unique identifier for this entity.
    `int` | `hashCode()`
    `boolean` | `hasId()` Checks whether this entity has a unique identifier.
    `boolean` | `isHidden()` Whether this element is hidden and should only be returned to queries that explicitly ask for hidden elements.
    `boolean` | `isLoaded()` Checks whether this entity has been loaded into the current transaction and not yet modified.
    `boolean` | `isNew()` Checks whether this entity has been newly created in the current transaction.
    `boolean` | `isRemoved()` Checks whether this entity has been deleted into the current transaction.
    `static boolean` | `isTemporaryId(long elementId)`
    `void` | `setId(long id)`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.thinkaurelius.titan.graphdb.internal.InternalElement

      `getLifeCycle, it, tx`

    - ### Methods inherited from interface com.thinkaurelius.titan.core.TitanElement

      `getId, getProperty, getProperty, remove, removeProperty, removeProperty, setProperty, setProperty`

    - ### Methods inherited from interface com.tinkerpop.blueprints.Element

      `getPropertyKeys`

- - ### Constructor Detail

    - #### AbstractElement

          public AbstractElement(long id)

  - ### Method Detail

    - #### isTemporaryId

          public static boolean isTemporaryId(long elementId)

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### compareTo

          public int compareTo(TitanElement other)

      Specified by:
        `compareTo` in interface `Comparable<TitanElement>`

    - #### compare

          public static int compare(TitanElement e1,
                    TitanElement e2)

    - #### clone

          public InternalVertex clone()
                               throws CloneNotSupportedException

      Overrides:
        `clone` in class `Object`
      Throws:
        `CloneNotSupportedException`

    - #### getCompareId

          protected long getCompareId()

      Long identifier used to compare elements. Often, this is the same as `getLongId()` but some instances of elements may be considered the same even if their ids differ. In that case, this method should be overwritten to return an id that can be used for comparison.
      Returns:

    - #### getLongId

          public long getLongId()

      Description copied from interface: `TitanElement`
      Unique identifier for this entity. This id can be temporarily assigned and might change. Use `TitanElement.getId()` for the permanent id.
      Specified by:
        `getLongId` in interface `Idfiable`
      Specified by:
        `getLongId` in interface `TitanElement`
      Returns:
        Unique long id

    - #### hasId

          public boolean hasId()

      Description copied from interface: `TitanElement`
      Checks whether this entity has a unique identifier.

      Note that some entities may never be assigned an identifier and others will only be assigned an identifier at the end of a transaction.
      Specified by:
        `hasId` in interface `TitanElement`
      Returns:
        true if this entity has been assigned a unique id, else false
      See Also:
        `TitanElement.getLongId()`

    - #### setId

          public void setId(long id)

      Specified by:
        `setId` in interface `InternalElement`

    - #### isHidden

          public boolean isHidden()

      Description copied from interface: `InternalElement`
      Whether this element is hidden and should only be returned to queries that explicitly ask for hidden elements.
      Specified by:
        `isHidden` in interface `InternalElement`
      Returns:

    - #### isNew

          public boolean isNew()

      Description copied from interface: `TitanElement`
      Checks whether this entity has been newly created in the current transaction.
      Specified by:
        `isNew` in interface `TitanElement`
      Returns:
        True, if entity has been newly created, else false.

    - #### isLoaded

          public boolean isLoaded()

      Description copied from interface: `TitanElement`
      Checks whether this entity has been loaded into the current transaction and not yet modified.
      Specified by:
        `isLoaded` in interface `TitanElement`
      Returns:
        True, has been loaded and not modified, else false.

    - #### isRemoved

          public boolean isRemoved()

      Description copied from interface: `TitanElement`
      Checks whether this entity has been deleted into the current transaction.
      Specified by:
        `isRemoved` in interface `TitanElement`
      Returns:
        True, has been deleted, else false.

Copyright © 2012–2014. All rights reserved.