Class FRAG.FragmentationList

  • Enclosing class:
    FRAG

    static class FRAG.FragmentationList
    extends java.lang.Object
    A fragmentation list keeps a list of fragmentation tables sorted by an Address ( the sender ). This way, if the sender disappears or leaves the group half way sending the content, we can simply remove this members fragmentation table and clean up the memory of the receiver. We do not have to do the same for the sender, since the sender doesn't keep a fragmentation table
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(Address sender, FRAG.FragmentationTable table)
      Adds a fragmentation table for this particular sender If this sender already has a fragmentation table, an IllegalArgumentException will be thrown.
      boolean containsSender​(Address sender)
      returns true if this sender already holds a fragmentation for this sender, false otherwise
      FRAG.FragmentationTable get​(Address sender)
      returns a fragmentation table for this sender returns null if the sender doesn't have a fragmentation table
      Address[] getSenders()
      returns a list of all the senders that have fragmentation tables opened.
      boolean remove​(Address sender)
      removes the fragmentation table from the list.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • FragmentationList

        FragmentationList()
    • Method Detail

      • add

        public void add​(Address sender,
                        FRAG.FragmentationTable table)
                 throws java.lang.IllegalArgumentException
        Adds a fragmentation table for this particular sender If this sender already has a fragmentation table, an IllegalArgumentException will be thrown.
        Parameters:
        sender - - the address of the sender, cannot be null
        table - - the fragmentation table of this sender, cannot be null
        Throws:
        java.lang.IllegalArgumentException - if an entry for this sender already exist
      • get

        public FRAG.FragmentationTable get​(Address sender)
        returns a fragmentation table for this sender returns null if the sender doesn't have a fragmentation table
        Returns:
        the fragmentation table for this sender, or null if no table exist
      • containsSender

        public boolean containsSender​(Address sender)
        returns true if this sender already holds a fragmentation for this sender, false otherwise
        Parameters:
        sender - - the sender, cannot be null
        Returns:
        true if this sender already has a fragmentation table
      • remove

        public boolean remove​(Address sender)
        removes the fragmentation table from the list. after this operation, the fragementation list will no longer hold a reference to this sender's fragmentation table
        Parameters:
        sender - - the sender who's fragmentation table you wish to remove, cannot be null
        Returns:
        true if the table was removed, false if the sender doesn't have an entry
      • getSenders

        public Address[] getSenders()
        returns a list of all the senders that have fragmentation tables opened.
        Returns:
        an array of all the senders in the fragmentation list
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object