1579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson/* 2579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Copyright (C) 2007 The Android Open Source Project 3579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 4579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Licensed under the Apache License, Version 2.0 (the "License"); 5579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * you may not use this file except in compliance with the License. 6579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * You may obtain a copy of the License at 7579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 8579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 9579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 10579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Unless required by applicable law or agreed to in writing, software 11579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 12579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * See the License for the specific language governing permissions and 14579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * limitations under the License. 15579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 16579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 17579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilsonpackage com.android.dx.rop.type; 18579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 19579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson/** 20579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * List of {@link Type} instances (or of things that contain types). 21579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 22579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilsonpublic interface TypeList { 23579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 24579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Returns whether this instance is mutable. Note that the 25579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * {@code TypeList} interface itself doesn't provide any 26579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * means of mutation, but that doesn't mean that there isn't an 27579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * extra-interface way of mutating an instance. 28579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 29579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @return {@code true} if this instance is mutable or 30579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * {@code false} if it is immutable 31579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 32579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public boolean isMutable(); 33579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 34579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 35579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Gets the size of this list. 36579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 37579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @return {@code >= 0;} the size 38579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 39579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public int size(); 40579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 41579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 42579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Gets the indicated element. It is an error to call this with the 43579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * index for an element which was never set; if you do that, this 44579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * will throw {@code NullPointerException}. 45579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 46579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @param n {@code >= 0, < size();} which element 47579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @return {@code non-null;} the indicated element 48579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 49579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public Type getType(int n); 50579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 51579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 52579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Gets the number of 32-bit words required to hold instances of 53579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * all the elements of this list. This is a sum of the widths (categories) 54579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * of all the elements. 55579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 56579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @return {@code >= 0;} the required number of words 57579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 58579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public int getWordCount(); 59579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 60579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 61579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Returns a new instance which is identical to this one, except that 62579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * the given item is appended to the end and it is guaranteed to be 63579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * immutable. 64579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 65579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @param type {@code non-null;} item to append 66579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @return {@code non-null;} an appropriately-constructed instance 67579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 68579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public TypeList withAddedType(Type type); 69579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson} 70