fi.hut.tcm.spki.impl
Class Composite

java.lang.Object
  |
  +--fi.hut.tcm.spki.impl.Composite
Direct Known Subclasses:
Cert, GeneralOp, Hash, HashAlgName, HashList, HashOp, Issuer, IssuerInfo, Keyholder, LowLim, Name, NotAfter, NotBefore, ObjHash, OnlineTest, PubKey, PubSigAlgId, SecKey, SecSigAlgId, Sequence, SExpr, Sig, SPart, Subject, SubjectInfo, Tag, TagExpr, TagPrefix, TagRange, TagSet, TagSimple, TagStar, TagString, ThresholdSubj, UpLim, Valid

public abstract class Composite
extends java.lang.Object
implements Composite, Component

Composite Data structure part, which has child classes.


Field Summary
protected  java.util.Vector children
           
 
Constructor Summary
Composite()
           
 
Method Summary
 void accept(Visitor visitor)
           
 int add(Component addThis)
          Add a new component to a composite.
abstract  boolean check(Component addition)
          Checks if the component to be added is of correct type.
 Component get(Component childClass)
          This function returns the first child x that fullfills (x instanceof childClass).
 Component get(int number)
          Get returns the wanted child by it's number.
 java.util.Iterator iterator()
          GetEnum returns enumeration of all the children.
 boolean remove(Component child)
          Removes the first occurrence of this object.
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

children

protected java.util.Vector children
Constructor Detail

Composite

public Composite()
Method Detail

accept

public void accept(Visitor visitor)
Specified by:
accept in interface Component

add

public int add(Component addThis)
        throws java.lang.IllegalArgumentException,
               java.lang.IllegalStateException
Add a new component to a composite. Returns the index of the added component. This index number may later change if earlier components are removed.
Specified by:
add in interface Composite

check

public abstract boolean check(Component addition)
                       throws java.lang.IllegalStateException
Checks if the component to be added is of correct type. Returns true if it is, false if it is not. Throws IllegalStateException if this component is of right type, but cannot be added now (there is already a max number of such components, for example). All composites override this to restrict what classes can be added to them.
Specified by:
check in interface Composite

get

public Component get(int number)
              throws java.lang.ArrayIndexOutOfBoundsException
Get returns the wanted child by it's number. If not found, throws ArrayIndexOutOfBoundsException.
Specified by:
get in interface Composite

get

public Component get(Component childClass)
This function returns the first child x that fullfills (x instanceof childClass). This is handy for searching Composites and subclasses of ByteString, but not ByteStrings.
Specified by:
get in interface Composite

remove

public boolean remove(Component child)
Removes the first occurrence of this object. Returns true if the argument was a component of this composite; false otherwise. Elements of a higher index are moved one step downwards.
Specified by:
remove in interface Composite

iterator

public java.util.Iterator iterator()
GetEnum returns enumeration of all the children.
Specified by:
iterator in interface Composite

size

public int size()
Specified by:
size in interface Composite

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object