Logo Search packages:      
Sourcecode: libgnucrypto-java version File versions  Download package

Object gnu::crypto::assembly::Cascade::insert ( int  index,
Stage  stage 
) throws IllegalArgumentException, IndexOutOfBoundsException [inline]

Inserts a Stage into the current chain, at the specified index (zero-based) position.

stage the Stage to insert into the chain.
a unique identifier for this stage, within this cascade.
IllegalArgumentException if the designated stage is already in the chain, or it has incompatible characteristics with the current elements already in the chain.
IllegalStateException if the instance is already initialised.
IndexOutOfBoundsException if index is less than 0 or greater than the current size of this cascade.

Definition at line 174 of file Cascade.java.

References blockSizes(), size(), stageKeys, stages(), and wired.

Referenced by append(), and prepend().

      if (stages.containsValue(stage)) {
         throw new IllegalArgumentException();
      if (wired != null || stage == null) {
         throw new IllegalStateException();

      if (index < 0 || index > size()) {
         throw new IndexOutOfBoundsException();

      // check that there is a non-empty set of common block-sizes
      Set set = stage.blockSizes();
      if (stages.isEmpty()) {
         if (set.isEmpty()) {
            throw new IllegalArgumentException("1st stage with no block sizes");
      } else {
         Set common = this.blockSizes();
         if (common.isEmpty()) {
            throw new IllegalArgumentException("no common block sizes found");

      Object result = new Object();
      stageKeys.add(index, result);
      stages.put(result, stage);

      return result;

Generated by  Doxygen 1.6.0   Back to index