Package ons

Class Flow

java.lang.Object
ons.Flow

public class Flow
extends java.lang.Object
The Flow class defines an object that can be thought of as a flow of data, going from a source node to a destination node.
  • Constructor Summary

    Constructors 
    Constructor Description
    Flow​(long id, int src, int dst, int bw, double duration, int cos)
    Creates a new Flow object.
  • Method Summary

    Modifier and Type Method Description
    int getCOS()
    Retrieves a given Flow's "class of service".
    int getDestination()
    Retrieves the destination node for a given Flow.
    double getDuration()
    Retrieves the duration time, in seconds, of a given Flow.
    long getID()
    Retrieves the unique identifier for a given Flow.
    int getRate()
    Retrieves the required bandwidth for a given Flow.
    int getSource()
    Retrieves the source node for a given Flow.
    protected void setDuration​(double time)
    Sets the duration time, in seconds, of a given Flow.
    java.lang.String toString()
    Prints all information related to a given Flow.
    java.lang.String toTrace()
    Creates a string with relevant information about the flow, to be printed on the Trace file.

    Methods inherited from class java.lang.Object

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

    • Flow

      public Flow​(long id, int src, int dst, int bw, double duration, int cos)
      Creates a new Flow object.
      Parameters:
      id - unique identifier
      src - source node
      dst - destination node
      bw - bandwidth required (Mbps)
      duration - duration time (seconds)
      cos - class of service
  • Method Details

    • getID

      public long getID()
      Retrieves the unique identifier for a given Flow.
      Returns:
      the value of the Flow's id attribute
    • getSource

      public int getSource()
      Retrieves the source node for a given Flow.
      Returns:
      the value of the Flow's src attribute
    • getDestination

      public int getDestination()
      Retrieves the destination node for a given Flow.
      Returns:
      the value of the Flow's dst attribute
    • getRate

      public int getRate()
      Retrieves the required bandwidth for a given Flow.
      Returns:
      the value of the Flow's bw attribute.
    • getDuration

      public double getDuration()
      Retrieves the duration time, in seconds, of a given Flow.
      Returns:
      the value of the Flow's duration attribute
    • getCOS

      public int getCOS()
      Retrieves a given Flow's "class of service". A "class of service" groups together similar types of traffic (for example, email, streaming video, voice,...) and treats each type with its own level of service priority.
      Returns:
      the value of the Flow's cos attribute
    • setDuration

      protected void setDuration​(double time)
      Sets the duration time, in seconds, of a given Flow.
      Parameters:
      time - the time in seconds
    • toString

      public java.lang.String toString()
      Prints all information related to a given Flow.
      Overrides:
      toString in class java.lang.Object
      Returns:
      string containing all the values of the flow's parameters
    • toTrace

      public java.lang.String toTrace()
      Creates a string with relevant information about the flow, to be printed on the Trace file.
      Returns:
      string with values of the flow's parameters