psdi.server

Class UserInputBulletin

  • java.lang.Object
    • java.util.AbstractMap
      • java.util.HashMap
        • java.util.LinkedHashMap
          • psdi.server.UserInputBulletin
  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map


    public class UserInputBulletin
    extends java.util.LinkedHashMap
    See Also:
    Serialized Form
    • Nested Class Summary

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

        java.util.AbstractMap.SimpleEntry, java.util.AbstractMap.SimpleImmutableEntry
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void clearUserInput(UserInfo ui)
      This is only here to make you feel good.
      java.lang.Object get(UserInfo ui) 
      java.lang.Object getUserInput(java.lang.String id, UserInfo ui)
      Get the user input of the id.
      void postUserInput(java.lang.String id, java.lang.Object value, UserInfo ui)
      Post the user Input.
      void put(UserInfo ui, java.lang.Object value) 
      void remove(UserInfo ui) 
      protected boolean removeEldestEntry(java.util.Map.Entry eldest) 
      void removeUserInput(java.lang.String id, UserInfo ui)
      Remove the user input from the bulletin board.
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

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

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
    • Constructor Detail

      • UserInputBulletin

        public UserInputBulletin()
    • Method Detail

      • postUserInput

        public void postUserInput(java.lang.String id,
                                  java.lang.Object value,
                                  UserInfo ui)
        Post the user Input. If there hasn't any message for this user info yet, one hashmap to hold this kind of messages will be created. Since there shouldn't be two threads trying to post for the same user info at the same time, we don't need to synchronize this.
      • get

        public java.lang.Object get(UserInfo ui)
      • put

        public void put(UserInfo ui,
                        java.lang.Object value)
      • getUserInput

        public java.lang.Object getUserInput(java.lang.String id,
                                             UserInfo ui)
        Get the user input of the id.
        Parameters:
        id -
        ui -
        Returns:
      • removeUserInput

        public void removeUserInput(java.lang.String id,
                                    UserInfo ui)
        Remove the user input from the bulletin board.
        Parameters:
        id -
        ui -
      • removeEldestEntry

        protected boolean removeEldestEntry(java.util.Map.Entry eldest)
        Overrides:
        removeEldestEntry in class java.util.LinkedHashMap
      • remove

        public void remove(UserInfo ui)
      • clearUserInput

        public void clearUserInput(UserInfo ui)
        This is only here to make you feel good. When a user expires, it triggers a cleanup if there are any too old ones. In normal situate, like normal log out, there shouldn't be left-over in the hash.
        Parameters:
        ui -