Java PrimerMethod Properties in Java

Listing 1. The set method "void component(int, String)" of VectorName in a preliminary version.


/**
 * Set a name component to a new value.
 * @methodtype set
 */
public void component(int index, String cs) throws InvalidIndexException {
	assertIsValidIndex(index); // check whether index is valid
	fComponents.setElementAt(cs, index); // set new value
	notifyListeners(new ComponentChangeEvent(...)); // inform listeners
}