Packagecom.bourre.pattern.memento
Classpublic class CarTaker

Player version: Flash Player 9.0
Language version: ActionScript 3.0

CarTaker is the class used to store states of an object and to redo and undo state of the object



Protected Properties
 PropertyDefined by
  _aStack : Array
The stack.
CarTaker
  _curIndex : uint
CarTaker
  _maxSize : uint
The maximun size of the stack, can be null
CarTaker
  _originator : IOriginator
The originator
CarTaker
Public Methods
 MethodDefined by
  
CarTaker(originator:IOriginator = null, maxSize:uint = 0)
Creates a new CarTaker
CarTaker
  
clear():void
Clear the IMemento list
CarTaker
  
getIndex():uint
Return the current index
CarTaker
  
getMemento(index:uint):IMemento
return the IMemento at the index in the list
CarTaker
  
redo():void
Redo the state of the IMemento
CarTaker
  
saveMemento(m:IMemento = null):void
store a new IMemento in the list
CarTaker
  
setIndex(index:uint):void
Set the current index
CarTaker
  
size():uint
Return the size of the stack
CarTaker
  
toString():String
Returns the string representation of this instance.
CarTaker
  
undo():void
Undo the state of the IMemento
CarTaker
Property detail
_aStackproperty
protected var _aStack:Array

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The stack.

_curIndexproperty 
protected var _curIndex:uint

Player version: Flash Player 9.0
Language version: ActionScript 3.0

_maxSizeproperty 
protected var _maxSize:uint

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The maximun size of the stack, can be null

_originatorproperty 
protected var _originator:IOriginator

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The originator

Constructor detail
CarTaker()constructor
public function CarTaker(originator:IOriginator = null, maxSize:uint = 0)

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Creates a new CarTaker

Parameters
originator:IOriginator (default = null)
 
maxSize:uint (default = 0)
Method detail
clear()method
public function clear():void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Clear the IMemento list

getIndex()method 
public function getIndex():uint

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Return the current index

Returns
uint — The current index in the list.
getMemento()method 
public function getMemento(index:uint):IMemento

Player version: Flash Player 9.0
Language version: ActionScript 3.0

return the IMemento at the index in the list

Parameters
index:uint — The index in the list.

Returns
IMemento
redo()method 
public function redo():void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Redo the state of the IMemento

saveMemento()method 
public function saveMemento(m:IMemento = null):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

store a new IMemento in the list

Parameters
m:IMemento (default = null) — m the new memento to save

if the memento is null creates a new memento with the originator

setIndex()method 
public function setIndex(index:uint):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Set the current index

Parameters
index:uint — The new current index in the list.
size()method 
public function size():uint

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Return the size of the stack

Returns
uint — The size of the stack.
toString()method 
public function toString():String

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the string representation of this instance.

Returns
String — the string representation of this instance
undo()method 
public function undo():void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Undo the state of the IMemento