Class RspList<T>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Rsp<T>>, java.util.Map<Address,​Rsp<T>>

    public class RspList<T>
    extends java.util.HashMap<Address,​Rsp<T>>
    implements java.lang.Iterable<Rsp<T>>
    Contains responses from all members. Marks faulty members. A RspList is a response list used in peer-to-peer protocols. This class is unsynchronized
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RspList<T> addRsp​(Address sender, T retval)  
      T getFirst()
      Returns the first value in the response set.
      java.util.List<T> getResults()
      Returns the results from non-suspected members that are not null.
      java.util.List<Address> getSuspectedMembers()  
      T getValue​(java.lang.Object key)
      Returns the value associated with address key
      boolean isReceived​(Address sender)  
      boolean isSuspected​(Address sender)  
      java.util.Iterator<Rsp<T>> iterator()  
      int numReceived()  
      int numSuspectedMembers()  
      java.lang.String toString()  
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • RspList

        public RspList()
      • RspList

        public RspList​(int size)
      • RspList

        public RspList​(java.util.Map<Address,​Rsp<T>> map)
    • Method Detail

      • getValue

        public T getValue​(java.lang.Object key)
        Returns the value associated with address key
        Parameters:
        key -
        Returns:
        Object value
      • isReceived

        public boolean isReceived​(Address sender)
      • numSuspectedMembers

        public int numSuspectedMembers()
      • numReceived

        public int numReceived()
      • getFirst

        public T getFirst()
        Returns the first value in the response set. This is random, but we try to return a non-null value first
      • getResults

        public java.util.List<T> getResults()
        Returns the results from non-suspected members that are not null.
      • getSuspectedMembers

        public java.util.List<Address> getSuspectedMembers()
      • isSuspected

        public boolean isSuspected​(Address sender)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractMap<Address,​Rsp<T>>
      • iterator

        public java.util.Iterator<Rsp<T>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>