コード例 #1
0
ファイル: CompoundName.java プロジェクト: GregBowyer/Hotspot
 /**
  * Adds the components of a compound name -- in order -- at a specified position within this
  * compound name. Components of this compound name at or after the index of the first new
  * component are shifted up (away from index 0) to accommodate the new components.
  *
  * <p>Implementation note: Currently the syntax properties of suffix is not used or checked. They
  * might be in the future.
  *
  * @param n The non-null components to add.
  * @param posn The index in this name at which to add the new components. Must be in the range
  *     [0,size()].
  * @return The updated CompoundName, not a new one. Cannot be null.
  * @exception ArrayIndexOutOfBoundsException If posn is outside the specified range.
  * @exception InvalidNameException If n is not a compound name, or if the addition of the
  *     components violates the syntax of this compound name (e.g. exceeding number of components).
  */
 public Name addAll(int posn, Name n) throws InvalidNameException {
   if (n instanceof CompoundName) {
     impl.addAll(posn, n.getAll());
     return this;
   } else {
     throw new InvalidNameException("Not a compound name: " + n.toString());
   }
 }
コード例 #2
0
ファイル: CompoundName.java プロジェクト: GregBowyer/Hotspot
 /**
  * Adds the components of a compound name -- in order -- to the end of this compound name.
  *
  * <p>Implementation note: Currently the syntax properties of suffix is not used or checked. They
  * might be in the future.
  *
  * @param suffix The non-null components to add.
  * @return The updated CompoundName, not a new one. Cannot be null.
  * @exception InvalidNameException If suffix is not a compound name, or if the addition of the
  *     components violates the syntax of this compound name (e.g. exceeding number of components).
  */
 public Name addAll(Name suffix) throws InvalidNameException {
   if (suffix instanceof CompoundName) {
     impl.addAll(suffix.getAll());
     return this;
   } else {
     throw new InvalidNameException("Not a compound name: " + suffix.toString());
   }
 }