Class Port<E>


  • public class Port<E>
    extends Object
    Class for the ports of the components in the DEVS formalism. A port is a connection point of a component. It can be an input port or an output port. The input port is used to receive values from other components, and the output port is used to send values to other components.
    • Field Detail

      • parent

        protected Component parent
        The parent component of the port.
      • name

        protected String name
        The name of the port.
      • values

        protected LinkedList<E> values
        The values stored in the port.
    • Constructor Detail

      • Port

        public Port​(String name)
        Constructor of the port.
        Parameters:
        name - The name of the port.
      • Port

        public Port()
        Constructor of the port.
    • Method Detail

      • getName

        public String getName()
        Get the name of the port.
        Returns:
        The name of the port.
      • clear

        public void clear()
        Empties the values stored in the port.
      • isEmpty

        public boolean isEmpty()
        Returns true if the port is empty.
        Returns:
        True if the port is empty.
      • getSingleValue

        public E getSingleValue()
        Returns the first value stored in the port.
        Returns:
        The first value stored in the port.
      • getValues

        public Collection<E> getValues()
        Returns the values stored in the port.
        Returns:
        The values stored in the port.
      • addValue

        public void addValue​(E value)
        Adds a value to the port.
        Parameters:
        value - The value to add to the port.
      • addValues

        public void addValues​(Collection<E> valuesPort)
        Adds a collection of values to the port.
        Parameters:
        valuesPort - The collection of values to add to the port.
      • getParent

        public Component getParent()
        Get the parent component of the port.
        Returns:
        The parent component of the port.
      • toString

        public String toString()
        Returns the qualified name of the port.
        Overrides:
        toString in class Object
        Returns:
        The qualified name of the port.