java.lang.Object
io.github.tonywasher.joceanus.metis.list.MetisListSetVersioned
All Implemented Interfaces:
MetisDataItem.MetisDataObjectFormat, MetisFieldItem, OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>

public class MetisListSetVersioned extends Object implements MetisFieldItem, OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>
Versioned ListSet.
  • Constructor Details

    • MetisListSetVersioned

      public MetisListSetVersioned()
      Constructor.
    • MetisListSetVersioned

      public MetisListSetVersioned(MetisListStyle pStyle)
      Constructor.
      Parameters:
      pStyle - the listSet Style
    • MetisListSetVersioned

      public MetisListSetVersioned(MetisListStyle pStyle, MetisListSetVersioned pBase)
      Constructor.
      Parameters:
      pStyle - the listSet style
      pBase - the base listSet
  • Method Details

    • getDataFieldSet

      public MetisFieldItem.MetisFieldSetDef getDataFieldSet()
      Description copied from interface: MetisFieldItem
      Obtain the fieldSet.
      Specified by:
      getDataFieldSet in interface MetisFieldItem
      Returns:
      the fieldSet
    • getEventRegistrar

      public OceanusEventRegistrar<MetisListEvent> getEventRegistrar()
      Description copied from interface: OceanusEventRegistrar.OceanusEventProvider
      Obtain registration object for listeners.
      Specified by:
      getEventRegistrar in interface OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>
      Returns:
      the registrar
    • formatObject

      public String formatObject(OceanusDataFormatter pFormatter)
      Description copied from interface: MetisDataItem.MetisDataObjectFormat
      Obtain Object summary.
      Specified by:
      formatObject in interface MetisDataItem.MetisDataObjectFormat
      Parameters:
      pFormatter - the data formatter
      Returns:
      the display summary of the object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getStyle

      public MetisListStyle getStyle()
      Obtain the style.
      Returns:
      the style
    • getBase

      public MetisListSetVersioned getBase()
      Obtain the base listSet.
      Returns:
      the base listSet
    • getVersion

      public int getVersion()
      Obtain the version.
      Returns:
      the version
    • setVersion

      protected void setVersion(int pVersion)
      Set version.
      Parameters:
      pVersion - the version
    • keyIterator

      public Iterator<MetisListKey> keyIterator()
      Obtain the key iterator.
      Returns:
      the iterator
    • reverseKeyIterator

      public Iterator<MetisListKey> reverseKeyIterator()
      Obtain the reverse key iterator.
      Returns:
      the iterator
    • listIterator

      public Iterator<MetisListVersioned<? extends MetisFieldVersionedItem>> listIterator()
      Obtain the List iterator.
      Returns:
      the iterator
    • declareList

      protected void declareList(MetisListKey pItemType, MetisListVersioned<? extends MetisFieldVersionedItem> pList)
      Declare list.
      Parameters:
      pItemType - the itemType for the list
      pList - the list
    • getList

      public <L extends MetisListVersioned<?>> L getList(MetisListKey pListKey, Class<L> pClazz)
      Obtain the relevant list.
      Type Parameters:
      L - the list type
      Parameters:
      pListKey - the list key
      pClazz - the list class
      Returns:
      the list (or null)
    • isEmpty

      public boolean isEmpty()
      Is this an empty listSet?
      Returns:
      true/false
    • deriveDifferences

      public MetisListSetVersioned deriveDifferences(MetisListSetVersioned pListSet)
      derive differences.
      Parameters:
      pListSet - the listSet to compare against
      Returns:
      the differences
    • deriveUpdates

      public MetisListSetVersioned deriveUpdates()
      derive updates.
      Returns:
      the updates
    • condenseHistory

      public void condenseHistory(int pNewVersion)
      Condense history.
      Parameters:
      pNewVersion - the new maximum version
    • reBase

      public void reBase(MetisListSetVersioned pBase)
      Re-base the listSet against a database image. This method is used to re-synchronise between two sources. Items that are in this listSet, but not in the base listSet will be viewed as inserted. Items that are in the base listSet but not in this listSet will be viewed as deleted. Items that are in both listSets but differ will be viewed as changed.
      Parameters:
      pBase - the base listSet
    • deriveChangesOnIncrement

      public void deriveChangesOnIncrement()
      deriveChanges on version increment.
    • rewindToVersion

      public void rewindToVersion(int pVersion)
      Rewind items to the required version.
      Parameters:
      pVersion - the version to rewind to