# GC.Spread.Sheets.GanttSheet.Collection

## Content

# Class: Collection<T\>

[Sheets](../modules/GC.Spread.Sheets).[GanttSheet](../modules/GC.Spread.Sheets.GanttSheet).Collection

## Type parameters

| Name |
| :------ |
| `T` |

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.GanttSheet.Collection#constructor)

### Methods

- [add](GC.Spread.Sheets.GanttSheet.Collection#add)
- [all](GC.Spread.Sheets.GanttSheet.Collection#all)
- [clear](GC.Spread.Sheets.GanttSheet.Collection#clear)
- [getIndexByItem](GC.Spread.Sheets.GanttSheet.Collection#getindexbyitem)
- [getItemAt](GC.Spread.Sheets.GanttSheet.Collection#getitemat)
- [getRule](GC.Spread.Sheets.GanttSheet.Collection#getrule)
- [insert](GC.Spread.Sheets.GanttSheet.Collection#insert)
- [length](GC.Spread.Sheets.GanttSheet.Collection#length)
- [remove](GC.Spread.Sheets.GanttSheet.Collection#remove)
- [removeAt](GC.Spread.Sheets.GanttSheet.Collection#removeat)
- [setItemAt](GC.Spread.Sheets.GanttSheet.Collection#setitemat)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new Collection**<`T`\>()

Creates an instance of Collection.

**`classdesc`** A collection of objects.

#### Type parameters

| Name |
| :------ |
| `T` |

## Methods

### <a id="add" name="add"></a> add

▸ **add**(`item`): `void`

Adds the item into list.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `item` | `T` | The item to add. |

#### Returns

`void`

___

### <a id="all" name="all"></a> all

▸ **all**(): `T`[]

Get all item form collection.

#### Returns

`T`[]

A collection item list.

___

### <a id="clear" name="clear"></a> clear

▸ **clear**(): `void`

Removes all items from list.

#### Returns

`void`

___

### <a id="getindexbyitem" name="getindexbyitem"></a> getIndexByItem

▸ **getIndexByItem**(`item`): `number`

Get the item index from collection list.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `item` | `T` | The item of the collection. |

#### Returns

`number`

The index of item in the collection list.

___

### <a id="getitemat" name="getitemat"></a> getItemAt

▸ **getItemAt**(`index`): `T`

Get the item with the corresponding index

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The collection list index. |

#### Returns

`T`

The rule with the specified name.

___

### <a id="getrule" name="getrule"></a> getRule

▸ **getRule**(`name`): ``null`` \| `T`

Gets the item with the specified name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | A string value indicates the name of the rule. |

#### Returns

``null`` \| `T`

The rule with the specified name.

___

### <a id="insert" name="insert"></a> insert

▸ **insert**(`item`): `void`

Insert the item into list.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `item` | `T` | The item to insert. |

#### Returns

`void`

___

### <a id="length" name="length"></a> length

▸ **length**(): `number`

Get the collection list length.

#### Returns

`number`

The collection list length.

___

### <a id="remove" name="remove"></a> remove

▸ **remove**(`item`): `void`

Removes the item from list.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `item` | `T` | The item to remove. |

#### Returns

`void`

___

### <a id="removeat" name="removeat"></a> removeAt

▸ **removeAt**(`index`): `void`

Delete the corresponding item from an index

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The collection list index. |

#### Returns

`void`

___

### <a id="setitemat" name="setitemat"></a> setItemAt

▸ **setItemAt**(`index`, `item`): `void`

Set the item to index.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `index` | `number` | The index to insert. |
| `item` | `T` | The item. |

#### Returns

`void`
