概要 | パッケージ | クラス | 使用 | 階層ツリー | 非推奨 API | 索引 | ヘルプ
| UDK 3.1.0 Java API Reference
前のクラス 次のクラス | フレームあり フレームなし
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド

## com.sun.star.lib.uno.helper
クラス InterfaceContainer

    java.lang.Object
      |
      +--com.sun.star.lib.uno.helper.InterfaceContainer

すべての実装インタフェース:
  Cloneable

public class InterfaceContainer
extends Object
implements Cloneable

This class is a container for interfaces. It is intended to be used as storage for UNO interface of a specific type. The client has to ensure that the container contains only elements of the same type. If one needs to store different types, then one uses OMultiTypeInterfaceContainer. When the client calls disposeAndClear, the contained objects are queried for com.sun.star.lang.XEventListener and disposing is called. Afterwards the list cannot be used anymore. This list does not allow null values. All methods are thread-safe. The same holds true for iterators, issued by this class. Several iterators can exist at the same time and can also be modified (java.util.ListIterator.add, java.util.ListIterator.remove etc.). To make this work, the InterfaceContainer provides the iterators with copys of the list's data. The add and remove calls on the iterator modify the data in the iterator's list as well as in InterfaceContainer. Modification on InterfaceContainer, however, are not synchronized with existing iterators. For example

     InterfaceContainer cont= new InterfaceContainer();
     ListIterator it= cont.listIterator();

     cont.add( someInterface);
     // one cannot obtain someInterface through iterator it,
     // instead get a new iterator
     it= cont.listIterator();
     // it now keeps a fresh copy of cont and hence contains someInterface

     // Adding an interface on the iterator will cause the interface also to be added
     // to InterfaceContainer
     it.add( someOtherInterface);
     // someOtherInterface is now in it and cont
     ListIterator it2= cont.listIterator();
     //someOtherInterface can also be obtained by all newly created iterators, e.g. it2.

The add and remove methods of an iterator work on a particular location within a list, dependent on what the value of the iterator's cursor is. After the call the value at the appropriate position has been modified. Since the iterator received a copy of InterfaceContainer's data, InterfaceContainer may have been modified (by List methods or through other iterators). Therefore both data sets may not contain the same elements anymore. Consequently, a List method that modifies data, does not modify InterfaceContainer's data at a certain index (according to the iterators cursor). Instead, new elements are added at the end of list. When Iterator.remove is called, then the first occurrence of that element in InterfaceContainer is removed. ListIterator.set is not supported. A lot of methods resemble those of the to java.util.List interface, allthough this class does not implement it. However, the list iterators returned, for example by the listIterator method implement the java.util.ListIterator interface. Implementing the List interface would mean to support all none - optional methods as prescribed by the interface declaration. Among those is the subList method which returns a range of values of the list's data wrapped in a List implementation. Changes to the sub list have to cause changes in the main list. This is a problem, since this class is to be used in a multi-threaded environment. The sub list could work on a copy as the iterators do, but all the functions which work on an given index could not be properly supported. Unfortunatly, the List interface documentation states that all optional methods implemented by the list have to be implemented in the sub list. That would mean to do without all those critical methods, allthough they might work well in the "main list" (as opposed to sub list).

コンストラクタの概要
`InterfaceContainer()` Creates a new instance of InterfaceContainer
`InterfaceContainer(int initialCapacity)` Constructs an empty list with the specified initial capacity.

メソッドの概要
`void` | `add(int index, Object element)` Inserts the specified element at the specified position in this list.
`boolean` | `add(Object o)` Appends the specified element to the end of this list.
`boolean` | `addAll(Collection c)` Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
`boolean` | `addAll(int index, Collection c)` Inserts all of the elements in the specified Collection into this list, starting at the specified position.
`void` | `clear()` Removes all of the elements from this list.
`Object` | `clone()` Returns a shallow copy of this `ArrayList` instance.
`boolean` | `contains(Object elem)` Returns `true` if this list contains the specified element.
`boolean` | `containsAll(Collection collection)`
`void` | `disposeAndClear(EventObject evt)`
`void` | `ensureCapacity(int minCapacity)` Increases the capacity of this `ArrayList` instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
`Object` | `get(int index)` Returns the element at the specified position in this list.
`int` | `indexOf(Object elem)` Searches for the first occurence of the given argument, testing for equality using the `equals` method.
`boolean` | `isEmpty()` Tests if this list has no elements.
`Iterator` | `iterator()`
`int` | `lastIndexOf(Object elem)` Returns the index of the last occurrence of the specified object in this list.
`ListIterator` | `listIterator()`
`ListIterator` | `listIterator(int index)` The iterator keeps a copy of the list.
`Object` | `remove(int index)` Removes the element at the specified position in this list.
`boolean` | `remove(Object obj)` Parameter obj may
`boolean` | `removeAll(Collection collection)`
`boolean` | `retainAll(Collection collection)`
`Object` | `set(int index, Object element)` Not supported.
`int` | `size()` Returns the number of elements in this list.
`Object[]` | `toArray()` Returns an array containing all of the elements in this list in the correct order.
`Object[]` | `toArray(Object[] a)` Returns an array containing all of the elements in this list in the correct order.
`void` | `trimToSize()` Trims the capacity of this `ArrayList` instance to be the list's current size.

クラス java.lang.Object から継承したメソッド
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

コンストラクタの詳細

### InterfaceContainer

    public InterfaceContainer()

  Creates a new instance of InterfaceContainer

### InterfaceContainer

    public InterfaceContainer(int initialCapacity)

  Constructs an empty list with the specified initial capacity.

パラメータ:
  `initialCapacity` - the initial capacity of the list.
例外:
  `IllegalArgumentException` - if the specified initial capacity is negative

メソッドの詳細

### trimToSize

    public void trimToSize()

  Trims the capacity of this `ArrayList` instance to be the list's current size. An application can use this operation to minimize the storage of an `ArrayList` instance.

### ensureCapacity

    public void ensureCapacity(int minCapacity)

  Increases the capacity of this `ArrayList` instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.

  パラメータ:
    `minCapacity` - the desired minimum capacity.

### add

    public boolean add(Object o)

  Appends the specified element to the end of this list.

  パラメータ:
    `o` - element to be appended to this list.
  戻り値:
    `true` (as per the general contract of Collection.add).

### add

    public void add(int index,
                    Object element)

  Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

  パラメータ:
    `index` - index at which the specified element is to be inserted.
    `element` - element to be inserted.
  例外:
    `IndexOutOfBoundsException` - if index is out of range `(index < 0 || index > size())`.

### addAll

    public boolean addAll(Collection c)

  Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this list, and this list is nonempty.)

  パラメータ:
    `c` - the elements to be inserted into this list.
  例外:
    `IndexOutOfBoundsException` - if index out of range `(index < 0 || index > size())`.

### addAll

    public boolean addAll(int index,
                          Collection c)

  Inserts all of the elements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified Collection's iterator.

  パラメータ:
    `index` - index at which to insert first element from the specified collection.
    `c` - elements to be inserted into this list.
  例外:
    `IndexOutOfBoundsException` - if index out of range `(index < 0 || index > size())`.

### clear

    public void clear()

  Removes all of the elements from this list. The list will be empty after this call returns.

### contains

    public boolean contains(Object elem)

  Returns `true` if this list contains the specified element.

  パラメータ:
    `elem` - element whose presence in this List is to be tested.

### containsAll

    public boolean containsAll(Collection collection)

### get

    public Object get(int index)

  Returns the element at the specified position in this list.

  パラメータ:
    `index` - index of element to return.
  戻り値:
    the element at the specified position in this list.
  例外:
    `IndexOutOfBoundsException` - if index is out of range `(index < 0 || index >= size())`.

### indexOf

    public int indexOf(Object elem)

  Searches for the first occurence of the given argument, testing for equality using the `equals` method.

  パラメータ:
    `elem` - an object.
  戻り値:
    the index of the first occurrence of the argument in this list; returns `-1` if the object is not found.
  関連項目:
    `Object.equals(Object)`

### isEmpty

    public boolean isEmpty()

  Tests if this list has no elements.

  戻り値:
    `true` if this list has no elements; `false` otherwise.

### iterator

    public Iterator iterator()

### lastIndexOf

    public int lastIndexOf(Object elem)

  Returns the index of the last occurrence of the specified object in this list.

  パラメータ:
    `elem` - the desired element.
  戻り値:
    the index of the last occurrence of the specified object in this list; returns -1 if the object is not found.

### clone

    public Object clone()

  Returns a shallow copy of this `ArrayList` instance. The contained references are copied but the objects not.

  オーバーライド:
    クラス `Object` 内の `clone`
  戻り値:
    a clone of this `List` instance.

### listIterator

    public ListIterator listIterator()

### listIterator

    public ListIterator listIterator(int index)

  The iterator keeps a copy of the list. Changes to InterfaceContainer do not affect the data of the iterator. Conversly, changes to the iterator are effect InterfaceContainer.

### remove

    public Object remove(int index)

  Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

  パラメータ:
    `index` - the index of the element to removed.
  戻り値:
    the element that was removed from the list.
  例外:
    `IndexOutOfBoundsException` - if index out of range `(index < 0 || index >= size())`.

### remove

    public boolean remove(Object obj)

  Parameter obj may

### removeAll

    public boolean removeAll(Collection collection)

### retainAll

    public boolean retainAll(Collection collection)

### set

    public Object set(int index,
                      Object element)

  Not supported.

  パラメータ:
    `index` - index of element to replace.
    `element` - element to be stored at the specified position.
  戻り値:
    the element previously at the specified position.
  例外:
    `IndexOutOfBoundsException` - if index out of range `(index < 0 || index >= size())`.

### size

    public int size()

  Returns the number of elements in this list.

  戻り値:
    the number of elements in this list.

### toArray

    public Object[] toArray()

  Returns an array containing all of the elements in this list in the correct order.

  戻り値:
    an array containing all of the elements in this list in the correct order.

### toArray

    public Object[] toArray(Object[] a)

  Returns an array containing all of the elements in this list in the correct order. The runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.

  If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to `null`. This is useful in determining the length of the list only if the caller knows that the list does not contain any `null` elements.

  パラメータ:
    `a` - the array into which the elements of the list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
  戻り値:
    an array containing the elements of the list.
  例外:
    `ArrayStoreException` - if the runtime type of a is not a supertype of the runtime type of every element in this list.

### disposeAndClear

    public void disposeAndClear(EventObject evt)

概要 | パッケージ | クラス | 使用 | 階層ツリー | 非推奨 API | 索引 | ヘルプ
| UDK 3.1.0 Java API Reference
前のクラス 次のクラス | フレームあり フレームなし
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド