001/* A concrete scalar token. 002 003 Copyright (c) 1997-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 027 028 */ 029package ptolemy.data.expr; 030 031import ptolemy.data.BooleanToken; 032import ptolemy.data.ScalarToken; 033import ptolemy.data.type.BaseType; 034import ptolemy.data.type.Type; 035import ptolemy.kernel.util.IllegalActionException; 036 037/////////////////////////////////////////////////////////////////// 038//// ConcreteScalarToken 039 040/** 041 A token that represents a scalar of any type. 042 This is instantiated by the Constants class with name "scalar". 043 044 @author Edward A. Lee 045 @version $Id$ 046 @since Ptolemy II 2.0 047 @Pt.ProposedRating Yellow (yuhong) 048 @Pt.AcceptedRating Yellow (wbwu) 049 */ 050public class ConcreteScalarToken extends ScalarToken { 051 /////////////////////////////////////////////////////////////////// 052 //// public methods //// 053 054 /** Return the type of this token. 055 * @return BaseType.SCALAR. 056 */ 057 @Override 058 public Type getType() { 059 return BaseType.SCALAR; 060 } 061 062 /** Return this token. 063 * @return This token. 064 */ 065 @Override 066 protected ScalarToken _absolute() { 067 return this; 068 } 069 070 /** Throw an exception. 071 */ 072 @Override 073 protected ScalarToken _add(ScalarToken rightArgument) 074 throws IllegalActionException { 075 throw new IllegalActionException( 076 notSupportedMessage("add", this, rightArgument)); 077 } 078 079 /** Throw an exception. 080 */ 081 @Override 082 protected ScalarToken _bitwiseAnd(ScalarToken rightArgument) 083 throws IllegalActionException { 084 throw new IllegalActionException( 085 notSupportedMessage("bitwiseAnd", this, rightArgument)); 086 } 087 088 /** Throw an exception. 089 */ 090 @Override 091 protected ScalarToken _bitwiseNot() throws IllegalActionException { 092 throw new IllegalActionException( 093 notSupportedMessage("bitwiseNot", this, this)); 094 } 095 096 /** Throw an exception. 097 */ 098 @Override 099 protected ScalarToken _bitwiseOr(ScalarToken rightArgument) 100 throws IllegalActionException { 101 throw new IllegalActionException( 102 notSupportedMessage("bitwiseOr", this, rightArgument)); 103 } 104 105 /** Throw an exception. 106 */ 107 @Override 108 protected ScalarToken _bitwiseXor(ScalarToken rightArgument) 109 throws IllegalActionException { 110 throw new IllegalActionException( 111 notSupportedMessage("bitwiseXor", this, rightArgument)); 112 } 113 114 /** Throw an exception. 115 */ 116 @Override 117 protected ScalarToken _divide(ScalarToken rightArgument) 118 throws IllegalActionException { 119 throw new IllegalActionException( 120 notSupportedMessage("divide", this, rightArgument)); 121 } 122 123 /** Throw an exception. 124 */ 125 @Override 126 protected BooleanToken _isCloseTo(ScalarToken rightArgument, double epsilon) 127 throws IllegalActionException { 128 throw new IllegalActionException( 129 notSupportedMessage("isCloseTo", this, rightArgument)); 130 } 131 132 /** Throw an exception. 133 */ 134 @Override 135 protected BooleanToken _isLessThan(ScalarToken rightArgument) 136 throws IllegalActionException { 137 throw new IllegalActionException( 138 notSupportedMessage("isLessThan", this, rightArgument)); 139 } 140 141 /** Throw an exception. 142 */ 143 @Override 144 protected ScalarToken _modulo(ScalarToken rightArgument) 145 throws IllegalActionException { 146 throw new IllegalActionException( 147 notSupportedMessage("modulo", this, rightArgument)); 148 } 149 150 /** Throw an exception. 151 */ 152 @Override 153 protected ScalarToken _multiply(ScalarToken rightArgument) 154 throws IllegalActionException { 155 throw new IllegalActionException( 156 notSupportedMessage("multiply", this, rightArgument)); 157 } 158 159 /** Throw an exception. 160 */ 161 @Override 162 protected ScalarToken _subtract(ScalarToken rightArgument) 163 throws IllegalActionException { 164 throw new IllegalActionException( 165 notSupportedMessage("subtract", this, rightArgument)); 166 } 167}