java.lang.Object
nl.pim16aap2.animatedarchitecture.core.structures.StructureID

public final class StructureID extends Object
Represents an Identifier (ID) that has been assigned to a structure.

There are three types of UIDs:

  • Registered UIDs: Always >= 1.

    These are UIDs that have been assigned to structures by the storage system.

    These are assigned by the database system and should not be assigned manually. Consequently, these are only available after the structure has been stored in the database.

  • Unassigned ID: Always -1.

    This is used for structures that have not been assigned a UID yet.

    You can get this value by calling getUnassignedID().

  • Unregistered UID: Always <= -1000.

    Like the unassigned ID, this is used for structures that have not been assigned a UID yet. However, unlike the unassigned ID, an unregistered ID is guaranteed to be unique.

    These can be used for temporary structures that are never stored in the database (e.g. to show a user an animation preview).

  • Method Details

    • getUnassignedID

      public static StructureID getUnassignedID()
      Gets a StructureID used for structures that do not have an ID assigned yet.
      Returns:
      A StructureID with an ID of -1.
    • getUnregisteredID

      public static StructureID getUnregisteredID()
      Gets an unregistered ID.

      This is a unique ID that is not registered in the database.

      Returns:
      A unique unregistered StructureID.
    • of

      public static StructureID of(AssignedUIDSqlite assignedUIDSqlite)
      Creates an AssignedUID object from an AssignedUIDSqlite object.
      Parameters:
      assignedUIDSqlite - The AssignedUIDSqlite object to create an AssignedUID object from.
      Returns:
      The created AssignedUID object.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public long getId()
      The ID that has been assigned to the structure.