Class RealDependency

  • All Implemented Interfaces:
    java.lang.Comparable<Dependency>, Dependency

    public class RealDependency
    extends java.lang.Object
    implements Dependency
    This dependency represents causal relationships that have a real value or are infinite. Infinity represents the lack of a causal relationship. A finite positive real value represents a causal dependency with (typically) a time delay. A zero value represents an immediate causal relationship. See the paper "Causality Interfaces for Actor Networks" by Ye Zhou and Edward A. Lee, ACM Transactions on Embedded Computing Systems (TECS), April 2008, as available as Technical Report No. UCB/EECS-2006-148, November 16, 2006.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (eal)
    Pt.ProposedRating:
    Yellow (eal)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Dependency dependency)
      Return Dependency.LESS_THAN, EQUALS, or GREATER_THAN depending on whether the argument is less than, equal to, or greater than this dependency.
      boolean equals​(java.lang.Object object)
      Return true if the value of this dependency equals that of the specified one, and the specified one is an instance of RealDependency.
      int hashCode()
      Return the same hashCode that that Java Double object would return had it the same value.
      Dependency oPlus​(Dependency d)
      Return a dependency that results from parallel composition of this one and the specified one.
      Dependency oPlusIdentity()
      Return the dependency that when added to any other dependency using oPlus() yields the other dependency.
      Dependency oTimes​(Dependency d)
      Return a dependency that results from serial composition of this one and the specified one.
      Dependency oTimesIdentity()
      Return the dependency that when multiplied by any other dependency using oTimes() yields the other dependency.
      java.lang.String toString()
      Return a string representation in the form "RealDependency(value)".
      double value()
      Return the double value of the dependency.
      static RealDependency valueOf​(double value)
      Return an instance of RealDependency with the specified value.
      • Methods inherited from class java.lang.Object

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

      • OPLUS_IDENTITY

        public static final RealDependency OPLUS_IDENTITY
        The additive identity.
      • OTIMES_IDENTITY

        public static final RealDependency OTIMES_IDENTITY
        The multiplicative identity.
    • Method Detail

      • compareTo

        public int compareTo​(Dependency dependency)
        Return Dependency.LESS_THAN, EQUALS, or GREATER_THAN depending on whether the argument is less than, equal to, or greater than this dependency. Real dependencies are totally ordered, so this never returns Dependency.INCOMPARABLE. The order is the usual numerical ordering of doubles, with Double.POSITIVE_INFINITY on top.
        Specified by:
        compareTo in interface java.lang.Comparable<Dependency>
        Parameters:
        dependency - The dependency to compare against.
        Returns:
        The result of comparison.
        Throws:
        java.lang.ClassCastException - If the argument is not an instance of RealDependency.
      • equals

        public boolean equals​(java.lang.Object object)
        Return true if the value of this dependency equals that of the specified one, and the specified one is an instance of RealDependency.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        object - The object to compare against.
        Returns:
        true if this object is the same as the object argument.
      • hashCode

        public int hashCode()
        Return the same hashCode that that Java Double object would return had it the same value.
        Overrides:
        hashCode in class java.lang.Object
      • oPlus

        public Dependency oPlus​(Dependency d)
        Return a dependency that results from parallel composition of this one and the specified one.
        Specified by:
        oPlus in interface Dependency
        Parameters:
        d - The dependency to add.
        Returns:
        A dependency whose value is the minimum of the two dependency values.
        Throws:
        java.lang.ClassCastException - if d is not a RealDependency.
      • oPlusIdentity

        public Dependency oPlusIdentity()
        Return the dependency that when added to any other dependency using oPlus() yields the other dependency.
        Specified by:
        oPlusIdentity in interface Dependency
        Returns:
        The additive identity.
      • oTimes

        public Dependency oTimes​(Dependency d)
        Return a dependency that results from serial composition of this one and the specified one.
        Specified by:
        oTimes in interface Dependency
        Parameters:
        d - The dependency to multiply.
        Returns:
        A dependency whose value is the sum of the value of this one and the specified one.
        Throws:
        java.lang.ClassCastException - if d is not a RealDependency.
      • oTimesIdentity

        public Dependency oTimesIdentity()
        Return the dependency that when multiplied by any other dependency using oTimes() yields the other dependency.
        Specified by:
        oTimesIdentity in interface Dependency
        Returns:
        The multiplicative identity.
      • toString

        public java.lang.String toString()
        Return a string representation in the form "RealDependency(value)".
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation.
      • value

        public double value()
        Return the double value of the dependency.
        Returns:
        The value of the dependency.
      • valueOf

        public static RealDependency valueOf​(double value)
        Return an instance of RealDependency with the specified value. This is preferable to use over the constructor because it uses the same instances for the most common values.
        Parameters:
        value - The value used to determine the RealDependency to be returned.
        Returns:
        an instance of RealDependency, if value is 0.0, then OTIMES_IDENTITY is returned, if value is Double.POSITIVE_INFINITY, then OPLUS_IDENTITY is returned. Otherwise the RealDependency constructor is called.