Class MemberController


  • public class MemberController
    extends Controller
    Creates a new MemberController for a PLP.
    Author:
    Hundt, El-Sharkawy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String memberID  
      private java.util.LinkedHashMap<java.lang.String,​PLPInfo> predecessors  
      private java.util.LinkedHashMap<java.lang.String,​PLPInfo> successors  
    • Constructor Summary

      Constructors 
      Constructor Description
      MemberController​(java.lang.String memberID)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPredecessor​(java.lang.String predecessorID)
      Adds a predecessor project to this model.
      void addPredecessor​(PLPInfo info)
      This method adds a predecessor in case, the predecessor name is known.
      void addSuccessor​(java.lang.String successorID)
      Adds a sucessor project to this model.
      void addSuccessor​(PLPInfo info)
      This method adds a successor.
      void clear()
      This method removes all stored information about pre- and successors.
      boolean containsPredecessor​(java.lang.String projectName)
      Check for a specified Predecessor.
      boolean containsPredecessor​(java.util.UUID inputID)
      Check for a specified Predecessor.
      boolean containsSuccessor​(java.lang.String inputID)
      Check for a specified Successor.
      private java.util.List<java.lang.String> getAllSuccessors()
      Returns a list of all direct and indirect successor-IDs.
      java.util.List<java.lang.String> getPossiblePredecessors()
      Returns only the successors that are valid in terms of not creating a loop of successors and predecessors.
      java.util.Set<java.lang.String> getPredecessorIDs()
      Returns the List of all predecessor ids.
      java.util.Collection<PLPInfo> getPredecessors()
      Returns the List of all predecessors.
      int getPredecessorsCount()
      Getter returns the size of the Predecessors because getPredecessors returns a Collection and we may need this parameter.
      java.lang.Iterable<java.lang.String> getSuccessorIDs()
      Returns the List of all successor ids.
      java.lang.Iterable<PLPInfo> getSuccessors()
      Returns a list of all successor projects.
      int getSuccessorsCount()
      Getter returns the size of the Successors because getSuccessors returns Collection and we may need this parameter.
      boolean hasPredecessors()
      Check for Predecessors.
      boolean hasSuccessors()
      Check for Successors.
      MemberIterator predecessors()
      Returns an iterator for all predecessor PLPInfos.
      void removePredecessor​(java.lang.String predecessorID)
      Removes a predecessor by given ID.
      void removeSuccessor​(java.lang.String successorID)
      Removes a successor by given ID.
      private static void replacePLPInfo​(java.util.LinkedHashMap<java.lang.String,​PLPInfo> map, PLPInfo newPLP)
      Replaces a PLP info stored with same ID.
      void replacePLPInfo​(PLPInfo newPLP)
      Replaces a PLP info stored with same ID in this controller.
      void setPredecessors​(java.util.List<PLPInfo> predecessors)
      This method replaces all stored information of existing predecessors.
      void setSuccessors​(java.util.List<PLPInfo> successors)
      This method replaces all stored information of existing successors.
      MemberIterator successors()
      Returns an iterator for all successor PLPInfos.
      • Methods inherited from class java.util.Observable

        addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
      • Methods inherited from class java.lang.Object

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

      • memberID

        private java.lang.String memberID
      • predecessors

        private java.util.LinkedHashMap<java.lang.String,​PLPInfo> predecessors
      • successors

        private java.util.LinkedHashMap<java.lang.String,​PLPInfo> successors
    • Constructor Detail

      • MemberController

        public MemberController​(java.lang.String memberID)
        Constructor.
        Parameters:
        memberID - the ID of the product inheriting this MemberController
    • Method Detail

      • replacePLPInfo

        public void replacePLPInfo​(PLPInfo newPLP)
        Replaces a PLP info stored with same ID in this controller.
        Parameters:
        newPLP - the replacing PLP
      • replacePLPInfo

        private static void replacePLPInfo​(java.util.LinkedHashMap<java.lang.String,​PLPInfo> map,
                                           PLPInfo newPLP)
        Replaces a PLP info stored with same ID.
        Parameters:
        map - the map to be modified
        newPLP - the replacing PLP
      • hasPredecessors

        public boolean hasPredecessors()
        Check for Predecessors.
        Returns:
        returns true if there is at least one predecessor
      • hasSuccessors

        public boolean hasSuccessors()
        Check for Successors.
        Returns:
        returns true if there is at least one successor
      • containsPredecessor

        public boolean containsPredecessor​(java.util.UUID inputID)
        Check for a specified Predecessor.
        Parameters:
        inputID - the UUID of the product line member in question
        Returns:
        returns true if this UUID is already listed as a predecessor
      • containsPredecessor

        public boolean containsPredecessor​(java.lang.String projectName)
        Check for a specified Predecessor.
        Parameters:
        projectName - the name of the product line member in question
        Returns:
        returns true if this name is already listed as a predecessor
      • containsSuccessor

        public boolean containsSuccessor​(java.lang.String inputID)
        Check for a specified Successor.
        Parameters:
        inputID - the UUID of the product line member in question
        Returns:
        returns true if this UUID is already listed as a successor
      • getPredecessors

        public java.util.Collection<PLPInfo> getPredecessors()
        Returns the List of all predecessors.
        Returns:
        the predecessors
      • getPredecessorIDs

        public java.util.Set<java.lang.String> getPredecessorIDs()
        Returns the List of all predecessor ids.
        Returns:
        the predecessor ids
      • getSuccessorIDs

        public java.lang.Iterable<java.lang.String> getSuccessorIDs()
        Returns the List of all successor ids.
        Returns:
        the successor ids
      • getSuccessors

        public java.lang.Iterable<PLPInfo> getSuccessors()
        Returns a list of all successor projects.
        Returns:
        the successors
      • setPredecessors

        public void setPredecessors​(java.util.List<PLPInfo> predecessors)
        This method replaces all stored information of existing predecessors.
        Parameters:
        predecessors - A list of all predecessors
      • setSuccessors

        public void setSuccessors​(java.util.List<PLPInfo> successors)
        This method replaces all stored information of existing successors.
        Parameters:
        successors - A list of all successors
      • addPredecessor

        public void addPredecessor​(java.lang.String predecessorID)
        Adds a predecessor project to this model.
        Parameters:
        predecessorID - the UUID of the new predecessor
      • addPredecessor

        public void addPredecessor​(PLPInfo info)
        This method adds a predecessor in case, the predecessor name is known.
        Parameters:
        info - the predecessor info
      • addSuccessor

        public void addSuccessor​(java.lang.String successorID)
        Adds a sucessor project to this model.
        Parameters:
        successorID - the UUID of the new successor
      • addSuccessor

        public void addSuccessor​(PLPInfo info)
        This method adds a successor.
        Parameters:
        info - the information on the successor.
      • removePredecessor

        public void removePredecessor​(java.lang.String predecessorID)
        Removes a predecessor by given ID.
        Parameters:
        predecessorID - The ID of the predecessor
      • removeSuccessor

        public void removeSuccessor​(java.lang.String successorID)
        Removes a successor by given ID.
        Parameters:
        successorID - The ID of the successor
      • clear

        public void clear()
        This method removes all stored information about pre- and successors.
      • getPossiblePredecessors

        public java.util.List<java.lang.String> getPossiblePredecessors()
        Returns only the successors that are valid in terms of not creating a loop of successors and predecessors.
        Returns:
        a List of all possible Successors
      • getAllSuccessors

        private java.util.List<java.lang.String> getAllSuccessors()
        Returns a list of all direct and indirect successor-IDs.
        Returns:
        A list of UUIDs from successors
        Since:
        18.10.2011
      • predecessors

        public MemberIterator predecessors()
        Returns an iterator for all predecessor PLPInfos.
        Returns:
        Iterator for all predecessor PLPInfos.
        Since:
        23.07.2012
      • successors

        public MemberIterator successors()
        Returns an iterator for all successor PLPInfos.
        Returns:
        Iterator for all successor PLPInfos.
        Since:
        23.07.2012
      • getPredecessorsCount

        public int getPredecessorsCount()
        Getter returns the size of the Predecessors because getPredecessors returns a Collection and we may need this parameter.
        Returns:
        size The size of the Predecessors-List.
      • getSuccessorsCount

        public int getSuccessorsCount()
        Getter returns the size of the Successors because getSuccessors returns Collection and we may need this parameter.
        Returns:
        size The size of the Successors.List.