Class MetamapGroup

java.lang.Object
uk.ac.starlink.datanode.nodes.MetamapGroup
Direct Known Subclasses:
ValueInfoMetamapGroup

public class MetamapGroup extends Object
Represents a group of items containing related sets of metadata. Each set of metadata is a key/value map, in which the key is a string. If different items have metadata entries with the same key, they may be supposed to represent the same kind of quantity. A single, automatically maintained list is therefore kept of the keys which crop up in entries in any of the items' metadata sets. An ordering may be imposed on this list.
Author:
Mark Taylor (Starlink)
  • Constructor Summary

    Constructors
    Constructor
    Description
    MetamapGroup(int nitem)
    Initialises a MetamapGroup which will contain a given number of items.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEntry(int item, String key, Object value)
    Adds an entry to one of the metadata sets.
    getEntry(int item, String key)
    Retrieves an entry from one of the metadata sets by key.
    Returns the list which defines ordering for any keys which crop up.
    Returns a list of all the keys which appear in any of the metadata sets.
    Map[]
    Returns the array of metadata maps.
    int
    Returns the number of metadata maps.
    boolean
    hasEntry(int item, String key)
    Indicates whether an entry with a given key is present in one of the metadata sets.
    void
    setKeyOrder(List ordering)
    Mandates an ordering to be imposed on the metadata keys.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MetamapGroup

      public MetamapGroup(int nitem)
      Initialises a MetamapGroup which will contain a given number of items.
      Parameters:
      nitem - the number of items in the group
  • Method Details

    • addEntry

      public void addEntry(int item, String key, Object value)
      Adds an entry to one of the metadata sets. No entry is added if value==null or if value.toString().length()==0.
      Parameters:
      item - the index of the set to which the entry should be added
      key - the metadatum key
      value - the metadatum value
    • getEntry

      public Object getEntry(int item, String key)
      Retrieves an entry from one of the metadata sets by key. null is returned if no such entry exists.
      Parameters:
      item - the index of the set from which the entry should be got
      key - the metadatum key
      Returns:
      the value of the entry associated with key, or null if there isn't one
    • hasEntry

      public boolean hasEntry(int item, String key)
      Indicates whether an entry with a given key is present in one of the metadata sets.
      Parameters:
      item - the index of the set from which the entry should be got
      key - the metadatum key
      Returns:
      true iff the entry corresponding to key exists in set number item
    • setKeyOrder

      public void setKeyOrder(List ordering)
      Mandates an ordering to be imposed on the metadata keys. The effect of this call is to influence the order of the list returned by subsequent calls of getKnownKeys().

      The supplied argument ordering is a list of strings; a string which appears earlier in this list is considered to be earlier in the list of metadata keys. Any which do not appear in this list will be ranked in an unspecified order at the end.

      Parameters:
      ordering - a list of strings which may appear in the metadata keys
    • getKeyOrder

      public List getKeyOrder()
      Returns the list which defines ordering for any keys which crop up. This will have the same contents as the argument of the last call to setKeyOrder(java.util.List), or an empty list if that method has not been called.
      Returns:
      current key ordering
    • getKnownKeys

      public List getKnownKeys()
      Returns a list of all the keys which appear in any of the metadata sets. The order is determined by the most recent call of setKeyOrder(java.util.List). If it has never been called they will be returned in insertion order.
      Returns:
      the list of map keys
    • getMetamaps

      public Map[] getMetamaps()
      Returns the array of metadata maps.
      Returns:
      an array in which the n'th element is the n'th item's metadata map
    • getNumMaps

      public int getNumMaps()
      Returns the number of metadata maps.
      Returns:
      the number of maps in this group