| Home >> All |
Source code: engine/Result.java
1 2 /* ********************************** 3 File: Result.java 4 Author alec(panovici@elcom.pub.ro) 5 Created on: 22.03.1999 18:45:19 6 Comments: Part of the vIDE Project 7 Copyright 1999 the vIDE Team.er 8 ***********************************/ 9 10 package engine; 11 12 /** 13 * Performs some useful conversions between DataHolders 14 * of various types. Is implemented by all DataHolders 15 * this is used to allow conversion between all types of 16 * data obtained as results of expression evaluation 17 * *NOTE* none of the operations that return a Result does not gurantees 18 * the integrity of the operands ( and often the returned Result is one of them). 19 * So, *do not* use them after one of these ! Use getxxx to make a copy when necessary. 20 */ 21 public interface Result { 22 /** 23 * @return a new Real object based on this DataHolder 24 */ 25 public Real getReal(); 26 27 /** 28 * @return a new BitVector object containing the binary 29 * representation of this DataHolder 30 */ 31 public BitVector getBits(); 32 33 /** 34 * @return a new BitVector object representing an int 35 * based on this DataHolder 36 */ 37 public BitVector getInt(); 38 39 /** 40 * @return an int value representing some boolean (0, 1, X or Z) 41 * based on the actual value of this Result 42 */ 43 public int getBool(); 44 45 /** 46 * Returns the long value closest to this Result 47 */ 48 public long getLong(); 49 50 /** 51 * works pretty much like clone 52 */ 53 public Result duplicate(); 54 55 public void shl(Result r)throws InterpretTimeException; 56 public void shr(Result r)throws InterpretTimeException; 57 58 public void neg(); 59 60 public void bAndR()throws InterpretTimeException; 61 public void bOrR()throws InterpretTimeException; 62 public void bXOrR()throws InterpretTimeException; 63 public void bNAndR()throws InterpretTimeException; 64 public void bNOrR()throws InterpretTimeException; 65 public void bNXOrR()throws InterpretTimeException; 66 public void bNot()throws InterpretTimeException; 67 public void lNot(); 68 69 public Result lEq(Result r); 70 public Result lNEq(Result r); 71 72 public void bOr(Result r)throws InterpretTimeException; 73 public void bNOr(Result r)throws InterpretTimeException; 74 public void bAnd(Result r)throws InterpretTimeException; 75 public void bNAnd(Result r)throws InterpretTimeException; 76 public void bXor(Result r)throws InterpretTimeException; 77 public void bNXor(Result r)throws InterpretTimeException; 78 79 /** 80 * case equality 81 */ 82 public Result cEq(Result r)throws InterpretTimeException; 83 84 /** 85 * case nonequality 86 */ 87 public Result cNEq(Result r)throws InterpretTimeException; 88 89 /** 90 * lower than 91 */ 92 public Result lt(Result r); 93 94 /** 95 * greather than 96 */ 97 public Result gt(Result r); 98 99 /** 100 * lower or equal than 101 */ 102 public Result le(Result r); 103 104 /** 105 * greater than 106 */ 107 public Result ge(Result r); 108 109 public Result add(Result r); 110 public Result sub(Result r); 111 public Result mul(Result r); 112 public Result div(Result r); 113 public Result mod(Result r)throws InterpretTimeException; 114 115 /** 116 * Checks whether this reult is defined (unambiguous (x, z)). 117 * @return true if this result is unambiguous( no X's or Z's) 118 */ 119 public boolean isDefined(); 120 121 /** 122 * Checks whether this Result is true. 123 * @return true if this result is true ( i.e. has a nonnull and 124 * well defined value (no X's or Z's)) 125 */ 126 public boolean isTrue(); 127 128 /** 129 * Returns the String representation in the specified base. 130 */ 131 public String toString(int base); 132 133 134 /** 135 * Returns the type of this result. 136 * @see Symbol 137 */ 138 public int getType(); 139 140 /** 141 * @return the length (in bits) of the Result. 142 */ 143 public int length(); 144 } 145 146 147 148 149 150 151 152 153 154 155