Class Node


  • public class Node
    extends java.lang.Object
    An instance of this class represents an independent task of a workflow. A task has PET(predicted execution time), list of input data sources(parent tasks), and list of output data(child tasks). This class also used for BTS algorithm such as EST, LFT, schdeuled start/finish time and core methods for BTS algorithm used by OccupationDiagram class.
    Author:
    Eunkyu Byun
    • Constructor Summary

      Constructors 
      Constructor Description
      Node​(java.lang.String id)  
      Node​(java.lang.String id, java.lang.String name, int n, long w)  
      Node​(java.lang.String id, java.lang.String name, long w)
      constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIn​(Edge e)
      add a data dependency edge to this task
      void addOut​(Edge e)
      add a data dependency edge from this task
      java.util.Set buildAncestors()
      build the list of ancestor tasks
      java.util.Set buildDescendants()
      build the list of descendant tasks
      boolean checkIn()
      check whether all parent tasks are finished.
      void checkIntegrity()
      check all child task's start time is scheduled after the finishtime of this task
      boolean equals​(java.lang.Object e)  
      long evalWeight()
      return execution time of this task
      long getAncET()  
      int getAncSize()  
      long getDepET()  
      int getDepSize()  
      long getDesET()  
      int getDesSize()  
      long getDownLen()
      return the DnLength of this task.
      java.lang.String getID()  
      java.util.LinkedList getIn()
      return the list of incoming edges.
      java.util.LinkedList getOut()
      return the list of outgoing edges.
      long getUpLen()
      return the UpLength of this task.
      void init()  
      void initOut​(boolean s, long et)
      notify child nodes that this task will finish at time et
      boolean isAnc​(Node n)  
      boolean isBottom()
      Check whether this task is the exit task or not.
      boolean isDes​(Node n)  
      boolean isFree()
      used for DSC algorithm
      boolean isTop()
      Check whether this task is the entry task or not.
      boolean moveLeft​(java.util.LinkedList[] timeMap, int limit, long bound)
      Redistribute this task to the earlier time.
      boolean moveRight​(java.util.LinkedList[] timeMap, int limit, long bound)
      Redistribute this task to the later time.
      boolean NPbalance​(java.util.LinkedList[] timeMap, int limit, boolean force)
      Non-propagate redistribution of this task
      void print()  
      private int pushedChildren​(long timeLimit)  
      private int pushedParents​(long timeLimit)  
      void removeIn​(Edge e)
      remove a specified data dependency edge from this task
      void removeOut​(Edge e)
      remove a specified data dependency edge from this task
      void setWeight​(long w)
      set execution time of this task
      private void updateDownLen()  
      void updateLeftBound​(long nlb, java.util.TreeSet set)
      update EST(earliest start time) of this task.
      void updateRightBound​(long nrb, java.util.TreeSet set)
      update LFT(latest finish time) of this task.
      private void updateUpLen()  
      • Methods inherited from class java.lang.Object

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

      • inEdges

        private java.util.LinkedList inEdges
      • outEdges

        private java.util.LinkedList outEdges
      • critEdge

        private Edge critEdge
      • id

        private java.lang.String id
      • taskName

        private java.lang.String taskName
      • weight

        private long weight
      • upLen

        private long upLen
      • downLen

        private long downLen
      • ancestors

        private java.util.HashSet ancestors
      • descendants

        private java.util.HashSet descendants
      • st

        public long st
      • stacked

        public boolean stacked
      • lb

        public long lb
      • rb

        public long rb
      • olb

        public long olb
      • orb

        public long orb
      • tempST

        public long tempST
      • tempFT

        public long tempFT
      • ancET

        private long ancET
      • desET

        private long desET
      • cluster

        public int cluster
      • tlevel

        public long tlevel
      • examined

        public boolean examined
    • Constructor Detail

      • Node

        public Node​(java.lang.String id,
                    java.lang.String name,
                    long w)
        constructor
        Parameters:
        id - the unique ID of this task
        name - task name(executable name)
        w - predicted execution time
      • Node

        public Node​(java.lang.String id,
                    java.lang.String name,
                    int n,
                    long w)
      • Node

        public Node​(java.lang.String id)
    • Method Detail

      • init

        public void init()
      • setWeight

        public void setWeight​(long w)
        set execution time of this task
        Parameters:
        w - excution time
      • evalWeight

        public long evalWeight()
        return execution time of this task
        Returns:
        excution time
      • addIn

        public void addIn​(Edge e)
        add a data dependency edge to this task
        Parameters:
        e - the edge to be added
      • removeIn

        public void removeIn​(Edge e)
        remove a specified data dependency edge from this task
        Parameters:
        e - the edge to be removed
      • addOut

        public void addOut​(Edge e)
        add a data dependency edge from this task
        Parameters:
        e - the edge to be added
      • removeOut

        public void removeOut​(Edge e)
        remove a specified data dependency edge from this task
        Parameters:
        e - the edge to be removed
      • checkIn

        public boolean checkIn()
        check whether all parent tasks are finished.
        Returns:
        true if all parent tasks are finished.
      • getIn

        public java.util.LinkedList getIn()
        return the list of incoming edges.
        Returns:
        LinkedList of edges.
      • getOut

        public java.util.LinkedList getOut()
        return the list of outgoing edges.
        Returns:
        LinkedList of edges.
      • initOut

        public void initOut​(boolean s,
                            long et)
        notify child nodes that this task will finish at time et
        Parameters:
        et - finish time
      • updateUpLen

        private void updateUpLen()
      • getUpLen

        public long getUpLen()
        return the UpLength of this task. UpLength is the longest path from the entry task
        Returns:
        UpLength
      • updateDownLen

        private void updateDownLen()
      • getDownLen

        public long getDownLen()
        return the DnLength of this task. DnLength is the longest path to the exit task
        Returns:
        DnLength
      • isTop

        public boolean isTop()
        Check whether this task is the entry task or not.
        Returns:
        true or false
      • isBottom

        public boolean isBottom()
        Check whether this task is the exit task or not.
        Returns:
        true or false
      • getID

        public java.lang.String getID()
      • updateLeftBound

        public void updateLeftBound​(long nlb,
                                    java.util.TreeSet set)
        update EST(earliest start time) of this task.
        Parameters:
        nlb - new EST
        set - set of ancestor tasks
      • updateRightBound

        public void updateRightBound​(long nrb,
                                     java.util.TreeSet set)
        update LFT(latest finish time) of this task.
        Parameters:
        nrb - new LFT
        set - set of descendant tasks
      • NPbalance

        public boolean NPbalance​(java.util.LinkedList[] timeMap,
                                 int limit,
                                 boolean force)
        Non-propagate redistribution of this task
        Parameters:
        timeMap - List of scheduled tasks at each time slot. i.e., Occupation diagram itself
        limit - maximum height of Occupation diagram. The result of redistribution should cause taller height of this limit.
        force - Not used.
        Returns:
        true if this task is redistributed.
      • moveLeft

        public boolean moveLeft​(java.util.LinkedList[] timeMap,
                                int limit,
                                long bound)
        Redistribute this task to the earlier time. This causes ancestor tasks to be redistributed too.
        Parameters:
        timeMap - List of scheduled tasks at each time slot. i.e., Occupation diagram itself
        limit - maximum height of Occupation diagram. The result of redistribution should cause taller height of this limit.
        bound - Earliest time this tasks can be scheduled.
        Returns:
        true if this task is redistributed.
      • moveRight

        public boolean moveRight​(java.util.LinkedList[] timeMap,
                                 int limit,
                                 long bound)
        Redistribute this task to the later time. This causes descensant tasks to be redistributed too.
        Parameters:
        timeMap - List of scheduled tasks at each time slot. i.e., Occupation diagram itself
        limit - maximum height of Occupation diagram. The result of redistribution should cause taller height of this limit.
        bound - Lastest time this tasks can be scheduled.
        Returns:
        true if this task is redistributed.
      • pushedParents

        private int pushedParents​(long timeLimit)
      • pushedChildren

        private int pushedChildren​(long timeLimit)
      • checkIntegrity

        public void checkIntegrity()
        check all child task's start time is scheduled after the finishtime of this task
      • buildDescendants

        public java.util.Set buildDescendants()
        build the list of descendant tasks
        Returns:
        the list of descensant tasks
      • buildAncestors

        public java.util.Set buildAncestors()
        build the list of ancestor tasks
        Returns:
        the list of ancestor tasks
      • getDepSize

        public int getDepSize()
      • getAncSize

        public int getAncSize()
      • getDesSize

        public int getDesSize()
      • getAncET

        public long getAncET()
        Returns:
        the sum of execution time of all ancestor tasks
      • getDesET

        public long getDesET()
        Returns:
        the sum of execution time of all descendant tasks
      • getDepET

        public long getDepET()
        Returns:
        the sum of execution time of all dependent tasks
      • isAnc

        public boolean isAnc​(Node n)
      • isDes

        public boolean isDes​(Node n)
      • print

        public void print()
      • isFree

        public boolean isFree()
        used for DSC algorithm
      • equals

        public boolean equals​(java.lang.Object e)
        Overrides:
        equals in class java.lang.Object