Methods Summary |
---|
public void | accept(IClassDefVisitor visitor, java.lang.Object ctx)
visitor.visit (this, ctx);
|
public int | add(Field_info field)
final int newoffset = m_fields.size (); // use size() if class becomes non-final
m_fields.add (field);
return newoffset;
|
public java.lang.Object | clone()Performs a deep copy.
try
{
final FieldCollection _clone = (FieldCollection) super.clone ();
// deep clone:
final int fields_count = m_fields.size (); // use size() if class becomes non-final
_clone.m_fields = new ArrayList (fields_count);
for (int f = 0; f < fields_count; ++ f)
{
_clone.m_fields.add (((Field_info) m_fields.get (f)).clone ());
}
return _clone;
}
catch (CloneNotSupportedException e)
{
throw new InternalError (e.toString ());
}
|
public Field_info | get(int offset)
return (Field_info) m_fields.get (offset);
|
public int[] | get(ClassDef cls, java.lang.String name)
if (cls == null) throw new IllegalArgumentException ("null input: cls");
// TODO: hash impl [not possible without having access to the parent ClassDef]
final int count = m_fields.size (); // use size() if class becomes non-final
final IntVector result = new IntVector (count);
for (int f = 0; f < count; ++ f)
{
final Field_info field = (Field_info) m_fields.get (f);
if (field.getName (cls).equals (name))
result.add (f);
}
return result.values (); // IntVector optimizes for the empty case
|
public Field_info | set(int offset, Field_info field)
return (Field_info) m_fields.set (offset, field);
|
public int | size()
return m_fields.size ();
|
public void | writeInClassFormat(com.vladium.jcd.lib.UDataOutputStream out)
final int fields_count = m_fields.size (); // use size() if class becomes non-final
out.writeU2 (fields_count);
for (int i = 0; i < fields_count; i++)
{
get (i).writeInClassFormat (out);
}
|