001/* Interface representing a dependency between ports. 002 003 Copyright (c) 2003-2013 The Regents of the University of California. 004 All rights reserved. 005 Permission is hereby granted, without written agreement and without 006 license or royalty fees, to use, copy, modify, and distribute this 007 software and its documentation for any purpose, provided that the above 008 copyright notice and the following two paragraphs appear in all copies 009 of this software. 010 011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 015 SUCH DAMAGE. 016 017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 022 ENHANCEMENTS, OR MODIFICATIONS. 023 024 PT_COPYRIGHT_VERSION_2 025 COPYRIGHTENDKEY 026 027 */ 028package ptolemy.actor.util; 029 030/////////////////////////////////////////////////////////////////// 031//// Dependency 032 033/** 034 This interface provides a dependency for causality interfaces as described 035 in the paper "Causality Interfaces for Actor Networks" by Ye Zhou and 036 Edward A. Lee, ACM Transactions on Embedded Computing Systems (TECS), 037 April 2008, as available as <a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-148.pdf"> 038 Technical Report No. UCB/EECS-2006-148</a>, 039 November 16, 2006. 040 <p> 041 A dependency represents a causality relationship between two ports. 042 Implementations of this interface are required to satisfy certain 043 algebraic properties, but as long as these are satisfied, there is 044 considerable freedom. 045 046 @author Edward A. Lee 047 @version $Id$ 048 @since Ptolemy II 8.0 049 @Pt.ProposedRating Yellow (eal) 050 @Pt.AcceptedRating Red (eal) 051 */ 052public interface Dependency extends Comparable<Dependency> { 053 054 /////////////////////////////////////////////////////////////////// 055 //// public methods //// 056 057 /** Return a dependency that results from parallel composition of 058 * this one and the specified one. This is required to be 059 * associative and commutative. That is, d1.oPlus(d2).oPlus(d3) 060 * should be equal to d1.oPlus(d2.oPlus(d3)), and 061 * d1.oPlus(d2) should be equal to d2.oPlus(d1). 062 * In addition, any implementation should be idempotent, 063 * meaning that d.oPlus(d) is equal to d. 064 * @param d The dependency to add. 065 * @return A dependency whose value is the logical OR of the two dependency 066 * values. 067 * @exception ClassCastException if d is not a BooleanDependency. 068 */ 069 public Dependency oPlus(Dependency d); 070 071 /** Return the dependency that when added to any other 072 * dependency using oPlus() yields the other dependency. 073 * @return The additive identity. 074 */ 075 public Dependency oPlusIdentity(); 076 077 /** Return a dependency that results from serial composition of 078 * this one and the specified one. This is required to be 079 * associative, but not necessarily commutative. 080 * That is, d1.oTimes(d2).oTimes(d3) 081 * should be equal to d1.oTimes(d2.oTimes(d3)). 082 * Moreover, it should be distributive over oPlus. 083 * That is, d1.oTimes(d2.oPlus(d3)) should be equal to 084 * (d1.oTimes(d2)).oPlus(d1.oTimes(d3)). 085 * @param d The dependency to multiply. 086 * @return A dependency whose value is the logical AND of the value of 087 * this one and the specified one. 088 * @exception ClassCastException if d is not a BooleanDependency. 089 */ 090 public Dependency oTimes(Dependency d); 091 092 /** Return the dependency that when multiplied by any other 093 * dependency using oTimes() yields the other dependency. 094 * @return The multiplicative identity. 095 */ 096 public Dependency oTimesIdentity(); 097 098 /////////////////////////////////////////////////////////////////// 099 //// public fields //// 100 101 /** Return value of compareTo() if this is equal to the argument. */ 102 public static final int EQUALS = 0; 103 104 /** Return value of compareTo() if this is greater than the argument. */ 105 public static final int GREATER_THAN = 1; 106 107 /** Return value of compareTo() if this is incomparable to the argument. */ 108 public static final int INCOMPARABLE = 2; 109 110 /** Return value of compareTo() if this is less than the argument. */ 111 public static final int LESS_THAN = -1; 112}