1b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato/* 2b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ProGuard -- shrinking, optimization, obfuscation, and preverification 3b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * of Java bytecode. 4b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 52270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 7b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This program is free software; you can redistribute it and/or modify it 8b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * under the terms of the GNU General Public License as published by the Free 9b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Software Foundation; either version 2 of the License, or (at your option) 10b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * any later version. 11b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 12b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This program is distributed in the hope that it will be useful, but WITHOUT 13b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * more details. 16b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 17b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * You should have received a copy of the GNU General Public License along 18b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * with this program; if not, write to the Free Software Foundation, Inc., 19b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 21b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratopackage proguard.evaluation.value; 22b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 232270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstromimport proguard.classfile.Clazz; 24b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 25b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato/** 262270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * This class represents a partially evaluated reference value. 27b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 28b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * @author Eric Lafortune 29b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 302270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrompublic abstract class ReferenceValue extends Category1Value 31b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato{ 322270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 332270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the type. 342270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 352270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract String getType(); 362270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom; 37b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 382270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 392270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the class that is referenced by the type. 402270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 412270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract Clazz getReferencedClass(); 42b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 43b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 442270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Basic unary methods. 45b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 46b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 472270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether the type is <code>null</code>. 48b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 492270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract int isNull(); 50b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 51b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 52b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 532270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether the type is an instance of the given type. 542270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 552270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract int instanceOf(String otherType, Clazz otherReferencedClass); 562270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 572270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 582270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 592270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns a generalization of this ReferenceValue that may be null, 602270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * depending on the flag. 612270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 622270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract ReferenceValue generalizeMayBeNull(boolean mayBeNull); 632270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 642270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 652270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 662270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the length of the array, assuming this type is an array. 67b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 682270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public IntegerValue arrayLength(ValueFactory valueFactory) 69b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 702270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return valueFactory.createIntegerValue(); 71b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 72b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 73b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 74b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 752270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the value of the array at the given index, assuming this type 762270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * is an integer array. 77b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 782270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public IntegerValue integerArrayLoad(IntegerValue indexValue, ValueFactory valueFactory) 79b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 802270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return valueFactory.createIntegerValue(); 81b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 82b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 83b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 84b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 852270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the value of the array at the given index, assuming this type 862270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * is an long array. 87b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 882270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public LongValue longArrayLoad(IntegerValue indexValue, ValueFactory valueFactory) 89b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 902270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return valueFactory.createLongValue(); 91b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 92b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 93b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 94b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 952270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the value of the array at the given index, assuming this type 962270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * is an float array. 97b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 982270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public FloatValue floatArrayLoad(IntegerValue indexValue, ValueFactory valueFactory) 99b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 1002270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return valueFactory.createFloatValue(); 101b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 102b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 103b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 104b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 1052270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the value of the array at the given index, assuming this type 1062270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * is an double array. 107b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 1082270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public DoubleValue doubleArrayLoad(IntegerValue indexValue, ValueFactory valueFactory) 109b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 1102270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return valueFactory.createDoubleValue(); 111b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 112b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 113b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 114b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 115b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Returns the value of the array at the given index, assuming this type 1162270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * is a reference array. 1172270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 1182270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract ReferenceValue referenceArrayLoad(IntegerValue indexValue, ValueFactory valueFactory); 1192270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1202270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1212270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 1222270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Stores the given value at the given index in the given array, assuming 1232270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * this type is an array. 124b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 1252270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public void arrayStore(IntegerValue indexValue, Value value) 126b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 127b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 128b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 129b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 130b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Basic binary methods. 131b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 132b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 133b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Returns the generalization of this ReferenceValue and the given other 134b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ReferenceValue. 135b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 1362270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract ReferenceValue generalize(ReferenceValue other); 1372270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1382270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1392270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 1402270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue is equal to the given other 1412270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * ReferenceValue. 1422270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 1432270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 1442270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public abstract int equal(ReferenceValue other); 1452270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1462270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1472270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Derived unary methods. 1482270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 1492270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 1502270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue is not <code>null</code>. 1512270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 1522270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 1532270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public final int isNotNull() 154b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 1552270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return -isNull(); 156b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 157b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 158b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 1592270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Derived binary methods. 1602270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 161b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 1622270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue and the given ReferenceValue are different. 1632270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 164b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 1652270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public final int notEqual(ReferenceValue other) 166b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 1672270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return -equal(other); 1682270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom } 169b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 170b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 1712270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Similar binary methods, but this time with typed reference arguments. 172b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 1732270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 1742270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the generalization of this ReferenceValue and the given other 1752270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * TypedReferenceValue. 1762270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 1772270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public ReferenceValue generalize(TypedReferenceValue other) 1782270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom { 1792270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return generalize((ReferenceValue)other); 180b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 181b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 182b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 183b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 184b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Returns whether this ReferenceValue is equal to the given other 1852270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * TypedReferenceValue. 186b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 187b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 1882270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public int equal(TypedReferenceValue other) 189b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 1902270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return equal((ReferenceValue)other); 191b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 192b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 193b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 1942270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Similar binary methods, but this time with identified reference 1952270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // arguments. 196b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 197b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 1982270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the generalization of this ReferenceValue and the given other 1992270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * IdentifiedReferenceValue. 2002270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 2012270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public ReferenceValue generalize(IdentifiedReferenceValue other) 2022270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom { 2032270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return generalize((TypedReferenceValue)other); 2042270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom } 2052270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 2062270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 2072270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 2082270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue is equal to the given other 2092270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * IdentifiedReferenceValue. 210b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 211b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 2122270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public int equal(IdentifiedReferenceValue other) 213b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2142270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return equal((TypedReferenceValue)other); 215b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 216b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 217b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2182270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Similar binary methods, but this time with array reference arguments. 2192270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 220b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 221b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Returns the generalization of this ReferenceValue and the given other 2222270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * ArrayReferenceValue. 223b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 2242270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public ReferenceValue generalize(ArrayReferenceValue other) 225b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2262270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return generalize((TypedReferenceValue)other); 227b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 228b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 229b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 230b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 2312270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue is equal to the given other 2322270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * ArrayReferenceValue. 233b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 234b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 2352270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public int equal(ArrayReferenceValue other) 236b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2372270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return equal((TypedReferenceValue)other); 238b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 239b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 240b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2412270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Similar binary methods, but this time with identified array reference 2422270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // arguments. 243b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2442270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 2452270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the generalization of this ReferenceValue and the given other 2462270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * IdentifiedArrayReferenceValue. 2472270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 2482270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public ReferenceValue generalize(IdentifiedArrayReferenceValue other) 249b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2502270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return generalize((ArrayReferenceValue)other); 251b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 252b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 253b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2542270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 2552270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue is equal to the given other 2562270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * IdentifiedArrayReferenceValue. 2572270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 2582270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 2592270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public int equal(IdentifiedArrayReferenceValue other) 260b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2612270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return equal((ArrayReferenceValue)other); 262b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 263b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2642270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 2652270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Similar binary methods, but this time with detailed array reference 2662270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // arguments. 2672270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 2682270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 2692270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns the generalization of this ReferenceValue and the given other 2702270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * DetailedArrayReferenceValue. 2712270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 2722270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public ReferenceValue generalize(DetailedArrayReferenceValue other) 273b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2742270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return generalize((IdentifiedArrayReferenceValue)other); 275b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 276b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2772270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom 2782270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom /** 2792270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * Returns whether this ReferenceValue is equal to the given other 2802270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * DetailedArrayReferenceValue. 2812270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom * @return <code>NEVER</code>, <code>MAYBE</code>, or <code>ALWAYS</code>. 2822270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom */ 2832270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public int equal(DetailedArrayReferenceValue other) 284b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2852270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return equal((IdentifiedArrayReferenceValue)other); 286b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 287b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 288b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2892270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom // Implementations for Value. 290b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2912270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public final ReferenceValue referenceValue() 292b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2932270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return this; 294b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 295b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 2962270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public final Value generalize(Value other) 297b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 2982270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return this.generalize(other.referenceValue()); 299b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 300b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 3012270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom public final int computationalType() 302b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 3032270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom return TYPE_REFERENCE; 304b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 305b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato} 306