C# Class SimpleFramework.Xml.Stream.Indenter.Cache

The Cache object is used create an indexable list which allows the indenter to quickly acquire an indent using a stack position. This ensures that the indenter need only create an index once for a given stack position. The number of indents held within this cache can also be tracked.
Datei anzeigen Open project: ngallagher/simplexml

Public Methods

Method Description
Cache ( int size ) : System

Constructor for the Cache object. This creates a cache of the specified size, the specified size acts as an initial size and the cache can be expanded on demand.

Get ( int index ) : String

This method is used to retrieve an indent from the given position. This allows the indenter to use the cache as a stack, by increasing and decreasing the index as required.

Resize ( int size ) : void

Should the number of indents to be cache grows larger than the default initial size then this will increase the size of the cache. This ensures that the indenter can handle an arbitrary number of indents for a given output.

Set ( int index, String text ) : void

This method is used to add the specified indent on to the cache. The index allows the cache to act as a stack, when the index is specified it can be used to retrieve the same indent using that index.

Size ( ) : int

This method is used to retrieve the number of indents that have been added to the cache. This is used to determine if an indent request is the first.

Method Details

Cache() public method

Constructor for the Cache object. This creates a cache of the specified size, the specified size acts as an initial size and the cache can be expanded on demand.
public Cache ( int size ) : System
size int /// the initial number of entries in the cache ///
return System

Get() public method

This method is used to retrieve an indent from the given position. This allows the indenter to use the cache as a stack, by increasing and decreasing the index as required.
public Get ( int index ) : String
index int /// the position to retrieve the indent from ///
return String

Resize() public method

Should the number of indents to be cache grows larger than the default initial size then this will increase the size of the cache. This ensures that the indenter can handle an arbitrary number of indents for a given output.
public Resize ( int size ) : void
size int /// this is the size to expand the cache to ///
return void

Set() public method

This method is used to add the specified indent on to the cache. The index allows the cache to act as a stack, when the index is specified it can be used to retrieve the same indent using that index.
public Set ( int index, String text ) : void
index int /// this is the position to add the index to ///
text String /// this is the indent to add to the position ///
return void

Size() public method

This method is used to retrieve the number of indents that have been added to the cache. This is used to determine if an indent request is the first.
public Size ( ) : int
return int