File: docs/ItSummary.md

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson  >  Asit PHP Collection Class  >  docs/ItSummary.md  >  Download  
File: docs/ItSummary.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Asit PHP Collection Class
Manages collections of elements stored in arrays
Author: By
Last change: 1.4.10
Date: 3 months ago
Size: 3,426 bytes
 

Contents

Class file image Download

[comment]: # (This file is part of Asit, manages array collections. Copyright 2020 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence LGPL 3.0)

It Summary

Class It implements * SeekableIterator, Countable and IteratorAggregate methods

The collection element may be of any valueType.

Collection elements are searchable using * Iterator etc methods, below

It class extends : * [ItList], assert collection elements of expected valueType * [Asit], implements assoc array collection element get-/set-methods

* Class It construct method
* ```collection``` _array_ / _Traversable_
* Throws CollectionException

  • Class It factory method
  • 
    
  • Return _static_
  • Throws CollectionException
  • Static
* Class It singleton method
* ```collection``` _array_ / _Traversable_
* Return _static_
* Throws CollectionException
* Static
    
#### Get method

  • Return (non-assoc) array of element(s) in collection
  • 
    
  • Return _array_
  • Throws SortException

Set methods

* Append element to (array) collection
* Note, last appended element is always ```current```
* ```element``` _mixed_
* Return _static_
    
  • Set collection
  • Multiple setCollections allowed, i.e. batch appends
  • 
    
  • Return _static_
  • Throws CollectionException
* Clear (remove) collection

#### Iterator etc methods

  • Return count of collection elements
  • Required method implementing the Countable interface
  • Return int
* Return the current element
* Required method implementing the Iterator interface
* Return mixed

  • Checks if position is set
  • 
    
  • Return bool
* Return an external iterator
* Required method implementing the IteratorAggregate interface, i.e. makes the class traversable using foreach.
* Usage : ```foreach( $class as $value ) { .... }```
* Return Traversable

  • Return _bool_ - true if collection is not empty
* Return the (numeric) key of the current element
* Required method implementing the Iterator interface
* Return int

  • Move position to last element, if empty 0
  • Return _static_
* Move position forward to next element
* Required method implementing the Iterator interface
* Return _static_

  • Move position backward to previous element
  • Return _static_
* Rewind the Iterator to the first element, if empty 0
* Required method implementing the Iterator interface
* Return _static_

  • Seeks to a given position in the iterator
  • Required method implementing the SeekableIterator interface
  • 
    
  • Return void
  • Throws OutOfBoundsException
* Checks if current position is valid
* Required method implementing the Iterator interface
* Return bool

---
Go to [README] - [Asit] summary - [Asittag] summary - [ItList] Summary 

[Asit]:AsitSummary.md
[Asittag]:AsittagSummary.md
[ItList]:ListSummary.md
[README]:../README.md

For more information send a message to info at phpclasses dot org.