Class ItemContents


  • public class ItemContents
    extends java.lang.Object
    Contains the information that is shared between multiple items.
    • Constructor Summary

      Constructors 
      Constructor Description
      ItemContents()
      Class Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItemRelation​(java.lang.String relationName, Item item)
      Adds the given item to the set of relations.
      FeatureSet getFeatures()
      Returns the feature set for this item contents.
      Item getItemRelation​(java.lang.String relationName)
      Given the name of a relation, returns the item the shares the same ItemContents.
      void removeItemRelation​(java.lang.String relationName)
      Removes the relation/item mapping from this ItemContents.
      void showRelations()  
      • Methods inherited from class java.lang.Object

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

      • ItemContents

        public ItemContents()
        Class Constructor.
    • Method Detail

      • addItemRelation

        public void addItemRelation​(java.lang.String relationName,
                                    Item item)
        Adds the given item to the set of relations. Whenever an item is added to a relation, it should add the name and the Item reference to this set of name/item mappings. This allows an item to find out the set of all relations that it is contained in.
        Parameters:
        relationName - the name of the relation
        item - the item reference in the relation
      • removeItemRelation

        public void removeItemRelation​(java.lang.String relationName)
        Removes the relation/item mapping from this ItemContents.
        Parameters:
        relationName - the name of the relation/item to remove
      • showRelations

        public void showRelations()
      • getItemRelation

        public Item getItemRelation​(java.lang.String relationName)
        Given the name of a relation, returns the item the shares the same ItemContents.
        Parameters:
        relationName - the name of the relation of interest
        Returns:
        the item associated with this ItemContents in the named relation, or null if it does not exist
      • getFeatures

        public FeatureSet getFeatures()
        Returns the feature set for this item contents.
        Returns:
        the FeatureSet for this contents