com.mapinfo.midev.coordsys

## Class CodeSet

- java.lang.Object
- - com.mapinfo.midev.coordsys.CodeSet

All Implemented Interfaces:
  Serializable, Iterable

    public class CodeSet
    extends Object
    implements Iterable, Serializable

A unique set of codes. A single object may be identified by different codes in different code spaces.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`CodeSet()` Create an empty set of codes.
`CodeSet(Code code)` Create this object with a single code.
`CodeSet(Code[] codeList)` Create this object with all the codes in the specified array.
`CodeSet(Collection codeCollection)` Create this object with all the codes in the specified collection.
`CodeSet(String codeSpace, String code)` Create this object with a single code.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `contains(String codeSpace, String code)` Determine whether or not this code set contains the specified code.
`Collection` `getCodes(String codeSpace)` Get all of the codes for the specified code space.
`Code` `getFirstCode(String codeSpace)` Get a code for the specified code space.
`boolean` `isEmpty()` Determine whether or not this code set is empty.
`Iterator` `iterator()` Get an iteration of all the codes in this set.
`int` `size()` Get the number of codes in this code set.
`String` `toString()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### CodeSet

    public CodeSet()

Create an empty set of codes.

#### CodeSet

    public CodeSet(String codeSpace,
                   String code)

Create this object with a single code.

Parameters:
  `codeSpace` - The codeSpace of the code.
  `code` - The code value.

#### CodeSet

    public CodeSet(Code code)

Create this object with a single code.

Parameters:
  `code` - The code to be contained in this set.

#### CodeSet

    public CodeSet(Code[] codeList)

Create this object with all the codes in the specified array.

Parameters:
  `codeList` - The new CodeSet will create all of these codes.

#### CodeSet

    public CodeSet(Collection codeCollection)

Create this object with all the codes in the specified collection.

Parameters:
  `codeCollection` - The new CodeSet will create all of these codes.

### Method Detail

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### size

    public int size()

Get the number of codes in this code set.

Returns:
  The number of codes in this code set.

#### isEmpty

    public boolean isEmpty()

Determine whether or not this code set is empty.

Returns:
  `true` if this set contains no codes.

#### getCodes

    public Collection getCodes(String codeSpace)

Get all of the codes for the specified code space.

Parameters:
  `codeSpace` - Get the codes from this set with this code space.
Returns:
  The codes for the specified code space.

#### getFirstCode

    public Code getFirstCode(String codeSpace)

Get a code for the specified code space. Because the set may have multiple codes per codespace, this methods returns the first in the list.

Parameters:
  `codeSpace` - Get the first code from this set with this code space.
Returns:
  The code for the specified code space.

#### iterator

    public Iterator iterator()

Get an iteration of all the codes in this set.

Specified by:
  `iterator` in interface `Iterable`
Returns:
  An iteration of all the codes in this set. This iterator will throw an `UnsupportedOperationException` if `Iterator.remove()` } is called.

#### contains

    public boolean contains(String codeSpace,
                            String code)

Determine whether or not this code set contains the specified code.

Parameters:
  `codeSpace` - Check the code in this code space.
  `code` - Check the set for this code.
Returns:
  Whether or not this code set contains the specified code.