Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

EdgeArray Class Reference

#include <Graph.h>

Inheritance diagram for EdgeArray:

ArrayList< Edge > List of all members.

Detailed Description

An array of edges.

Author:
Thomas Jacob

Definition at line 121 of file Graph.h.

Public Member Functions

EdgeGet (long nr)
 Returns the edge at a given position.

long GetCount ()
 Returns the number of edges in the array.

bool IsEmpty ()
 Returns, if the array is empty.


Private Member Functions

void Append (Edge *Element)
 Appends an element to the array.

void AppendAll (const ArrayList< Edge > *Elements)
 Appends all elements of another array list to this one.

virtual int Compare (const Edge *Element1, const Edge *Element2) const
 Compares two elements and returns -1, if the first is less than the second, 0, if both elements are equal and 1, if the first is more than the second.

bool Contains (const Edge *Element, int(*compare)(const Edge *Element1, const Edge *Element2)) const
 Returns whether a given element is contained in this array.

bool Contains (const Edge *Element) const
 Returns whether a given element is contained in this array.

bool Delete (Edge *Element)
 Deletes a given element from the array.

bool Delete (long from, long count)
 Deletes multiple elements at a given range.

bool Delete (long nr)
 Deletes an element at a given position.

void DeleteAll ()
 Deletes all elements from the array.

bool DeleteFirst ()
 Deletes the first element from the array.

bool DeleteLast ()
 Deletes the last element from the array.

 EdgeArray ()
 Creates a new array of edges.

int Find (const Edge *Element, int(*compare)(const Edge *Element1, const Edge *Element2)) const
 Returns the 0-indexed position of a given element within the array list.

int Find (const Edge *Element) const
 Returns the 0-indexed position of a given element within the array list.

EdgeGet (long nr) const
 Returns the element at a given position.

long GetCount () const
 Returns the number of used array cells.

int GetDesiredFillRatio () const
 Returns the fill ratio after an array resize.

int GetFillRatio () const
 Returns the current fill ratio.

EdgeGetFirst () const
 Returns the first element of the array.

EdgeGetLast () const
 Returns the last element of the array.

int GetMinimumFillRatio () const
 Returns the minimum fill ratio for the array.

void Insert (Edge *Element, long nr)
 Inserts an element before a given position.

void InsertAll (const ArrayList< Edge > *Elements, long nr)
 Inserts all elements of another array list before a given position.

bool IsEmpty () const
 Returns, whether there are no elements in the array.

void Prepend (Edge *Element)
 Prepends an element to the array.

void PrependAll (const ArrayList< Edge > *Elements)
 Prepends all elements of another array list to this one.

EdgeReplace (Edge *NewElement, long nr)
 Replaces an element by another one.

void Shuffle ()
 Shuffles all entries randomly.

void Sort (int(*compare)(const Edge *Element1, const Edge *Element2))
 Sorts the elements in the array according to a given comparison function.

void Sort ()
 Sorts the elements in the array according to the Compare method.

bool Unlink (long from, long count)
 Removes multiple elements from the array.

EdgeUnlink (Edge *Element)
 Removes a given element from the array.

EdgeUnlink (long nr)
 Removes an element at a given position.

void UnlinkAll ()
 Removes all elements from the array without freeing them or returning them.

EdgeUnlinkFirst ()
 Removes the first element from the array.

EdgeUnlinkLast ()
 Removes the last element from the array.

 ~EdgeArray ()
 Destroys the array of edges.


Private Attributes

friend ArrayList<Edge>
friend ArrayList<Vertex>
friend Edge
friend EdgeArray
friend Graph
friend Vertex
friend VertexArray


Constructor & Destructor Documentation

EdgeArray  )  [private]
 

Creates a new array of edges.

~EdgeArray  )  [private]
 

Destroys the array of edges.


Member Function Documentation

void Append Edge Element  )  [inherited]
 

Appends an element to the array.

Parameters:
Element The element to be appended.

void AppendAll const ArrayList< Edge > *  Elements  )  [inherited]
 

Appends all elements of another array list to this one.

Warning:
The elements' memory is shared by both array lists, so one array should get its elements unlinked before destruction.
Parameters:
Elements The elements to be appended.

virtual int Compare const Edge Element1,
const Edge Element2
const [virtual, inherited]
 

Compares two elements and returns -1, if the first is less than the second, 0, if both elements are equal and 1, if the first is more than the second.

This method is used for comparison in the sorting. Override this method to provide your own comparison.

Parameters:
Element1 The first element to be compared.
Element2 The second element to be compared.
Returns:
-1, 0 or 1, if Element1<Element2, Element1==Element2 or Element1>Element2.

bool Contains const Edge Element,
int(*  compare)(const Edge *Element1, const Edge *Element2)
const [inherited]
 

Returns whether a given element is contained in this array.

This method uses a given compare method to compare the elements.

Note:
This method performs a linear search.
Parameters:
Element The element to be searched.
compare A functions that compares two elements and returns -1, if the first is less than the second, 0, if both elements are equal and 1, if the first is more than the second.
Returns:
Whether the element is contained.

bool Contains const Edge Element  )  const [inherited]
 

Returns whether a given element is contained in this array.

This method uses the Compare method to compare the elements.

Note:
This method performs a linear search.
Parameters:
Element The element to be searched.
Returns:
Whether the element is contained.

bool Delete Edge Element  )  [inherited]
 

Deletes a given element from the array.

The element is searched, removed from the array and freed. If the element is not contained, nothing happens. If the element is contained multiple times, only one instance is deleted.

Parameters:
Element The element to be deleted.
Returns:
Whether the element was found.

bool Delete long  from,
long  count
[inherited]
 

Deletes multiple elements at a given range.

The elements are removed from the array and freed.

Parameters:
from The starting position of the range. If from is invalid, nothing happens.
count The number of elements to be removed. If count is invalid, nothing happens.
Returns:
Whether the range was found.

bool Delete long  nr  )  [inherited]
 

Deletes an element at a given position.

The element is removed from the array and freed.

Parameters:
nr The position of the element. If nr is invalid, nothing happens.
Returns:
Whether the element was found.

void DeleteAll  )  [inherited]
 

Deletes all elements from the array.

All elements are removed from the array and freed.

bool DeleteFirst  )  [inline, inherited]
 

Deletes the first element from the array.

The element is removed from the array and freed. If the array is empty, nothing happens.

Returns:
Whether the element was found.

bool DeleteLast  )  [inherited]
 

Deletes the last element from the array.

The element is removed from the array and freed. If the array is empty, nothing happens.

Returns:
Whether the element was found.

int Find const Edge Element,
int(*  compare)(const Edge *Element1, const Edge *Element2)
const [inherited]
 

Returns the 0-indexed position of a given element within the array list.

This method uses a given compare method to compare the elements.

Note:
This method performs a linear search.
Parameters:
element The element to be looked up.
compare A functions that compares two elements and returns -1, if the first is less than the second, 0, if both elements are equal and 1, if the first is more than the second.
Returns:
The 0-indexed position of the element or -1, if the element is not found.

int Find const Edge Element  )  const [inherited]
 

Returns the 0-indexed position of a given element within the array list.

This method uses the Compare method to compare the elements.

Note:
This method performs a linear search.
Parameters:
element The element to be looked up.
Returns:
The 0-indexed position of the element or -1, if the element is not found.

Edge * Get long  nr  )  const [inherited]
 

Returns the element at a given position.

Parameters:
nr The position of the element. If nr is invalid, the method returns NULL.
Returns:
The element at the position or NULL.

Edge* Get long  nr  )  [inline]
 

Returns the edge at a given position.

Parameters:
nr The position of the edge.
Returns:
The edge at the position.

long GetCount  )  const [inline, inherited]
 

Returns the number of used array cells.

This is the number of added objects.

Returns:
The number of used array cells.

long GetCount  )  [inline]
 

Returns the number of edges in the array.

Returns:
The number of edges in the array.

int GetDesiredFillRatio  )  const [inline, inherited]
 

Returns the fill ratio after an array resize.

Returns:
The fill ratio after an array resize.
See also:
DesiredFillRatio

int GetFillRatio  )  const [inline, inherited]
 

Returns the current fill ratio.

Returns:
The current fill ratio.

Edge * GetFirst  )  const [inherited]
 

Returns the first element of the array.

If the array is empty, the method returns NULL.

Returns:
The first element or NULL.

Edge * GetLast  )  const [inherited]
 

Returns the last element of the array.

If the array is empty, the method returns NULL.

Returns:
The last element or NULL.

int GetMinimumFillRatio  )  const [inline, inherited]
 

Returns the minimum fill ratio for the array.

Returns:
The minimum fill ratio for the array.
See also:
MinimumFillRatio

void Insert Edge Element,
long  nr
[inherited]
 

Inserts an element before a given position.

All elements at and after the position are moved by one.

Parameters:
Element The element to be inserted.
nr The position to insert before. If nr is invalid, nothing happens.

void InsertAll const ArrayList< Edge > *  Elements,
long  nr
[inherited]
 

Inserts all elements of another array list before a given position.

All elements at and after the position are moved.

Warning:
The elements' memory is shared by both array lists, so one array should get its elements unlinked before destruction.
Parameters:
Elements The elements to be inserted.
nr The position to insert before. If nr is invalid, nothing happens.

bool IsEmpty  )  const [inline, inherited]
 

Returns, whether there are no elements in the array.

bool IsEmpty  )  [inline]
 

Returns, if the array is empty.

Returns:
If the array is empty.

void Prepend Edge Element  )  [inline, inherited]
 

Prepends an element to the array.

Parameters:
Element The element to be prepended.

void PrependAll const ArrayList< Edge > *  Elements  )  [inline, inherited]
 

Prepends all elements of another array list to this one.

Warning:
The elements' memory is shared by both array lists, so one array should get its elements unlinked before destruction.
Parameters:
Elements The elements to be prepended.

Edge * Replace Edge NewElement,
long  nr
[inherited]
 

Replaces an element by another one.

The replaced element is not freed, but returned.

Parameters:
NewElement The element that replaces the old one.
nr The position of the element to be replaced. If nr is invalid, nothing happens and the method returns NULL.
Returns:
The old element.

void Shuffle  )  [inherited]
 

Shuffles all entries randomly.

void Sort int(*  compare)(const Edge *Element1, const Edge *Element2)  )  [inherited]
 

Sorts the elements in the array according to a given comparison function.

The whole array has a sorted order afterwards, but is not harmed at all in any other way. All elements remain the same.

Parameters:
compare A functions that compares two elements and returns -1, if the first is less than the second, 0, if both elements are equal and 1, if the first is more than the second.

void Sort  )  [inline, inherited]
 

Sorts the elements in the array according to the Compare method.

The whole array has a sorted order afterwards, but is not harmed at all in any other way. All elements remain the same.

bool Unlink long  from,
long  count
[inherited]
 

Removes multiple elements from the array.

The elements are not freed.

Parameters:
from The starting position of the range. If from is invalid, nothing happens.
count The number of elements to be removed. If count is invalid, nothing happens.
Returns:
Whether the range was found.

Edge * Unlink Edge Element  )  [inherited]
 

Removes a given element from the array.

The element is not freed, but returned. If the element is not contained, nothing happens and the method returns NULL. If the element is contained multiple times, only one instance is unlinked.

Parameters:
Element The element to be removed.
Returns:
The element or NULL.

Edge * Unlink long  nr  )  [inherited]
 

Removes an element at a given position.

The element is not freed, but returned.

Parameters:
nr The position of the element. If nr is invalid, nothing happens and the method returns NULL.
Returns:
The element or NULL.

void UnlinkAll  )  [inherited]
 

Removes all elements from the array without freeing them or returning them.

Warning:
No element is freed, so you have to have a pointer to the objects, or the memory is lost.

Edge * UnlinkFirst  )  [inline, inherited]
 

Removes the first element from the array.

The element is not freed, but returned. If the array is empty, nothing happens and the method returns NULL.

Returns:
The element or NULL.

Edge * UnlinkLast  )  [inherited]
 

Removes the last element from the array.

The element is not freed, but returned. If the array is empty, nothing happens and the method returns NULL.

Returns:
The element or NULL.


Member Data Documentation

friend ArrayList<Edge> [private]
 

Definition at line 129 of file Graph.h.

friend ArrayList<Vertex> [private]
 

Definition at line 126 of file Graph.h.

friend Edge [private]
 

Definition at line 127 of file Graph.h.

friend EdgeArray [private]
 

Definition at line 128 of file Graph.h.

friend Graph [private]
 

Definition at line 123 of file Graph.h.

friend Vertex [private]
 

Definition at line 124 of file Graph.h.

friend VertexArray [private]
 

Definition at line 125 of file Graph.h.


The documentation for this class was generated from the following file:
Generated on Tue Oct 3 00:23:39 2006 for ToolBox by doxygen 1.3.6