001/* An interface for tokens that can be partially ordered. 002 003 Copyright (c) 2010-2014 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 */ 027package ptolemy.data; 028 029import ptolemy.data.expr.ASTPtRelationalNode; 030import ptolemy.kernel.util.IllegalActionException; 031 032/** An interface for tokens that can be partially ordered. 033 034 <p>The default implementation of visitRelationalNode 035 {@link ptolemy.data.expr.ParseTreeEvaluator#visitRelationalNode(ASTPtRelationalNode)} 036 uses this interface, so any tokens that implement this interface can be used 037 with the inequality operators (<, ≤, >, and ≥) in the Ptolemy expression 038 language. 039 040 @author Ben Lickly 041 @since Ptolemy II 10.0 042 @Pt.ProposedRating Red (blickly) 043 @Pt.AcceptedRating Red (blickly) 044 */ 045public interface PartiallyOrderedToken { 046 // FIXME: Should this be a class below ptolemy.data.Token but 047 // above ptolemy.data.ScalarToken and 048 // ptolemy.data.ontologies.ConceptToken} rather than an interface? 049 050 /** Check whether the value of this token is strictly less than that of the 051 * argument token. 052 * 053 * Only a partial order is assumed, so !(a < b) need not imply (a ≥ b). 054 * 055 * @param rightArgument The token on greater than side of the inequality. 056 * @return BooleanToken.TRUE, if this token is less than the 057 * argument token. BooleanToken.FALSE, otherwise. 058 * @exception IllegalActionException If the tokens are incomparable. 059 */ 060 public abstract BooleanToken isLessThan(PartiallyOrderedToken rightArgument) 061 throws IllegalActionException; 062}