com.vladium.jcd.cls
Interface IInterfaceCollection

All Superinterfaces:
java.lang.Cloneable, IClassFormatOutput
All Known Implementing Classes:
InterfaceCollection

public interface IInterfaceCollection
extends java.lang.Cloneable, IClassFormatOutput

An abstraction of the 'interfaces' component of .class format. The contents are constant pool indices of CONSTANT_Class_info structures corresponding to direct superinterfaces of this class/interface. The order in which they appear is the left-to-right order of their declaration in the implements/extends clause.

Author:
(C) 2001, Vlad Roubtsov

Method Summary
 void accept(IClassDefVisitor visitor, java.lang.Object ctx)
           
 int add(int interface_index)
          Appends a new superinterface pointer to the collection.
 java.lang.Object clone()
           
 int get(int offset)
          Returns the CONSTANT_Class_info constant pool index for offset'th direct superinterface.
 int set(int offset, int interface_index)
          Replaces superinterface pointer number 'offset' with new value 'interface_index'.
 int size()
          Returns the number of direct superinterfaces for this class/interface.
 
Methods inherited from interface com.vladium.jcd.compiler.IClassFormatOutput
writeInClassFormat
 

Method Detail

get

int get(int offset)
Returns the CONSTANT_Class_info constant pool index for offset'th direct superinterface.

Parameters:
offset - superinterface number [must be in [0, size()) range]
Returns:
constant pool index [always positive]
Throws:
java.lang.IndexOutOfBoundsException - if 'offset' is outside of valid range

size

int size()
Returns the number of direct superinterfaces for this class/interface.

Returns:
int number of direct superinterfaces [can be 0]

clone

java.lang.Object clone()

accept

void accept(IClassDefVisitor visitor,
            java.lang.Object ctx)

add

int add(int interface_index)
Appends a new superinterface pointer to the collection. No duplicate checks are made.

Parameters:
interface_index - constant pool index [must be positive; input not validated]
Returns:
offset of the new pointer [same as size()-1 when called after this method]

set

int set(int offset,
        int interface_index)
Replaces superinterface pointer number 'offset' with new value 'interface_index'. No duplicate checks are made. It is the responsibility of the caller to ensure that the relevant CONSTANT_Class_info descriptor will be found in the constant pool, in the slot pointed to by 'interface_index'.

Parameters:
offset - offset of the superinterface pointer to replace [must be in [0, size()) range]
interface_index - constant pool index [must be positive; input not validated]
Returns:
previous value at the given index [always positive]
Throws:
java.lang.IndexOutOfBoundsException - if 'offset' is outside of valid range