• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.dx.rop.type;
18 
19 import com.android.dx.util.ToHuman;
20 
21 /**
22  * Object which has an associated type, possibly itself.
23  */
24 public interface TypeBearer
25         extends ToHuman {
26     /**
27      * Gets the type associated with this instance.
28      *
29      * @return {@code non-null;} the type
30      */
getType()31     public Type getType();
32 
33     /**
34      * Gets the frame type corresponding to this type. This method returns
35      * {@code this}, except if {@link Type#isIntlike} on the underlying
36      * type returns {@code true} but the underlying type is not in
37      * fact {@link Type#INT}, in which case this method returns an instance
38      * whose underlying type <i>is</i> {@code INT}.
39      *
40      * @return {@code non-null;} the frame type for this instance
41      */
getFrameType()42     public TypeBearer getFrameType();
43 
44     /**
45      * Gets the basic type corresponding to this instance.
46      *
47      * @return the basic type; one of the {@code BT_*} constants
48      * defined by {@link Type}
49      */
getBasicType()50     public int getBasicType();
51 
52     /**
53      * Gets the basic type corresponding to this instance's frame type. This
54      * is equivalent to {@code getFrameType().getBasicType()}, and
55      * is the same as calling {@code getFrameType()} unless this
56      * instance is an int-like type, in which case this method returns
57      * {@code BT_INT}.
58      *
59      * @see #getBasicType
60      * @see #getFrameType
61      *
62      * @return the basic frame type; one of the {@code BT_*} constants
63      * defined by {@link Type}
64      */
getBasicFrameType()65     public int getBasicFrameType();
66 
67     /**
68      * Returns whether this instance represents a constant value.
69      *
70      * @return {@code true} if this instance represents a constant value
71      * and {@code false} if not
72      */
isConstant()73     public boolean isConstant();
74 }
75