Class ReverseLink

  • All Implemented Interfaces:
    java.lang.Runnable

    public class ReverseLink
    extends MapReduceAlgorithm
    Reverse a link in the Map/Reduce demo.
    Since:
    Ptolemy II 6.1
    Version:
    $Id$
    Author:
    Adam Cataldo
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Constructor Summary

      Constructors 
      Constructor Description
      ReverseLink()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<KeyValuePair> map​(java.lang.String key, java.lang.String value)
      Subclasses should implement their map method here.
      java.util.List<java.lang.String> reduce​(java.lang.String key, java.util.concurrent.BlockingQueue<java.lang.String> values)
      Subclasses should implement their reduce method here, calling the take method of the BlockingQueue to get the next value, and checking the parameter noMoreInputs to test if no more values can be put on the queue.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

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

      • ReverseLink

        public ReverseLink()
    • Method Detail

      • map

        public java.util.List<KeyValuePair> map​(java.lang.String key,
                                                java.lang.String value)
        Description copied from class: MapReduceAlgorithm
        Subclasses should implement their map method here.
        Specified by:
        map in class MapReduceAlgorithm
        Parameters:
        key - The key passed to the map method.
        value - The value passed to the map method.
        Returns:
        The list of key value pairs for the given input.
      • reduce

        public java.util.List<java.lang.String> reduce​(java.lang.String key,
                                                       java.util.concurrent.BlockingQueue<java.lang.String> values)
                                                throws java.lang.InterruptedException
        Description copied from class: MapReduceAlgorithm
        Subclasses should implement their reduce method here, calling the take method of the BlockingQueue to get the next value, and checking the parameter noMoreInputs to test if no more values can be put on the queue. The last value put on the queue may be the empty string. If this is the case, just discard it.
        Specified by:
        reduce in class MapReduceAlgorithm
        Parameters:
        key - The key to reduce over.
        values - The queue of values in reduction.
        Returns:
        The reduced list of values
        Throws:
        java.lang.InterruptedException - If thrown while reducing.