name: BiGraphVertex <TObject> : public Node<TObject>
synopsis:

>     g++ [flags ...] file ...

>     #include <BiGraphVertex.h>;

>     BiGraphVertex(const BiGraphVertex<TObject>& copy_vertex);
>     boolean setParentGraph(Graph<TObject>* parent);
>     BiGraph<TObject>* getParentGraph() const;
>     static boolean initCleanUp();
>     static boolean finishCleanUp();

quick start:

>     // declare the graph vertex object
>     //
>     BiGraphVertex<Char>* vertex[5];
>     Char* chr[5];

>     for (long i=0; i<5; i++) {
>       chr[i] = new Char((unichar)i);
>       vertex[i] = new BiGraphVertex<Char>(false);
>       vertex[i]->setItem(chr[i]);
>     }

description:
BiGraphVertex is an element in a Graph. Each vertex contains an object and a list of BiGraphArcs. From the BiGraphArcs, it is possible to access the vertices originating from the given vertex.
dependencies:

- SingleLinkedList
- NameMap
- MemoryManager
- String
- Char
- Console
- Graph
- BiGraphArc

public constants:

- define the class name:

      static const String CLASS_NAME = L"BiGraphVertex";

- i/o related constants:

      static const String DEF_PARAM = L"vertex";

error codes:

- error code indicating BiGraphVertex class general error:

      static const long ERR = 41100;

      static const long ERR_NULLD = 41101;

      static const long ERR_NOPAR = 41102;

protected data:

- adjacency list manipulation methods

      DoubleLinkedList< BiGraphArc<TObject> > parents_d;

      DoubleLinkedList< BiGraphArc<TObject> > children_d;

- what graph does this vertex belong to:

      BiGraph<TObject>* parent_graph_d;

- define the memory manager:

      static MemoryManager mgr_d;

required public methods:

- static methods: this class currently does not have a standalone diagnose method. Instead, it is tested extensively in the BiGraph classes.

      static const String& name();

- debug methods: the setDebug method is inherited from the SingleLinkedList template class

      boolean debug(const unichar* message) const;

- destructor/constructor(s):

      ~BiGraphVertex();

      BiGraphVertex(boolean self_alloc = true);

      BiGraphVertex(const BiGraphVertex<TObject>& copy_vertex);

- assign methods:

      boolean assign(const BiGraphVertex<TObject>& copy_vertex);

- operator= methods:

      BiGraphVertex<TObject>& operator=(const BiGraphVertex<TObject>& arg);

- equality methods:

      boolean eq(const BiGraphVertex<TObject>& compare_vertex) const;

- i/o methods:

      i/o methods are not defined for this class.

- memory management methods:

      void* operator new(size_t size);

      void* operator new[](size_t size);

      void operator delete(void* ptr);

      void operator delete[](void* ptr);

      static boolean setGrowSize(long grow_size);

      boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);

class-specific public methods:

- parent graph manipulation methods:

      boolean setParentGraph(BiGraph<TObject>* parent);

      BiGraph<TObject>* getParentGraph() const;

- vertex manipulation methods:

      boolean insertArcChild(BiGraphVertex<TObject>* vertex, float weight = BiGraphArc<TObject>::DEF_WEIGHT, boolean is_epsilon = BiGraphArc<TObject>::DEF_EPSILON);

      boolean insertArcParent(BiGraphVertex<TObject>* vertex, float weight = BiGraphArc<TObject>::DEF_WEIGHT, boolean is_epsilon = BiGraphArc<TObject>::DEF_EPSILON);

      boolean insertArcChild(BiGraphVertex<TObject>* vertex, boolean is_epsilon = BiGraphArc<TObject>::DEF_EPSILON);

      boolean insertArcParent(BiGraphVertex<TObject>* vertex, boolean is_epsilon = BiGraphArc<TObject>::DEF_EPSILON);

      boolean removeArcChild(BiGraphVertex<TObject>* vertex);

      boolean removeArcParent(BiGraphVertex<TObject>* vertex);

      boolean removeArcChild();

      boolean removeArcParent();

      boolean removeAllArcsChild();

      boolean removeAllArcsParent();

      boolean isAdjacentChild(BiGraphVertex<TObject>* vertex) const;

      boolean isAdjacentParent(BiGraphVertex<TObject>* vertex) const;

- vertex comparison methods:

      boolean compareVertices(const BiGraphVertex<TObject>& compare_vertex_a) const;

- adjacency list retrieval methods:

      DoubleLinkedList<BiGraphArc<TObject&> >* getParents();

      DoubleLinkedList<BiGraphArc<TObject&> >* getChildren();

- adjacency list positioning methods:

      boolean gotoFirstChild();

      boolean gotoLastChild();

      boolean gotoNextChild();

      boolean gotoPrevChild();

      boolean gotoMarkChild();

      boolean gotoPositionChild(long arg);

      long getPositionChild();

      boolean gotoFirstParent();

      boolean gotoLastParent();

      boolean gotoNextParent();

      boolean gotoPrevParent();

      boolean gotoMarkParent();

      boolean gotoPositionParent(long arg);

      long getPositionParent();

- adjacency list marking methods:

      boolean markIsSetChild();

      boolean isMarkedElementChild();

      boolean clearMarkChild();

      boolean setMarkChild();

      boolean markIsSetParent();

      boolean isMarkedElementParent();

      boolean clearMarkParent();

      boolean setMarkParent();

- adjacency list access methods:

      BiGraphArc<TObject>* getFirstChild();

      BiGraphArc<TObject>* getLastChild();

      BiGraphArc<TObject>* getNextChild();

      BiGraphArc<TObject>* getPrevChild();

      BiGraphArc<TObject>* getMarkChild();

      BiGraphArc<TObject>* getCurrChild();

      BiGraphArc<TObject>* getFirstChild() const;

      BiGraphArc<TObject>* getLastChild() const;

      BiGraphArc<TObject>* getNextChild() const;

      BiGraphArc<TObject>* getPrevChild() const;

      BiGraphArc<TObject>* getMarkChild() const;

      BiGraphArc<TObject>* getCurrChild() const;

      BiGraphArc<TObject>* getFirstParent();

      BiGraphArc<TObject>* getLastParent();

      BiGraphArc<TObject>* getNextParent();

      BiGraphArc<TObject>* getPrevParent();

      BiGraphArc<TObject>* getMarkParent();

      BiGraphArc<TObject>* getCurrParent();

      BiGraphArc<TObject>* getFirstParent() const;

      BiGraphArc<TObject>* getLastParent() const;

      BiGraphArc<TObject>* getNextParent() const;

      BiGraphArc<TObject>* getPrevParent() const;

      BiGraphArc<TObject>* getMarkParent() const;

      BiGraphArc<TObject>* getCurrParent() const;

- adjacency list insert-remove methods:

      boolean insertChild(BiGraphArc<TObject>* arg);

      boolean insertChild(DoubleLinkedList<BiGraphArc<TObject> >& arg);

      boolean insertFirstChild(BiGraphArc<TObject>* arg);

      boolean insertFirstChild(DoubleLinkedList<BiGraphArc<TObject> >& arg);

      boolean insertLastChild(BiGraphArc<TObject>* arg);

      boolean insertLastChild(DoubleLinkedList<BiGraphArc<TObject> >& arg);

      boolean removeChild(BiGraphArc<TObject>*& arg);

      boolean removeChild();

      boolean removeFirstChild(BiGraphArc<TObject>*& arg);

      boolean removeFirstChild();

      boolean removeLastChild(BiGraphArc<TObject>*& arg);

      boolean removeLastChild();

      boolean insertParent(BiGraphArc<TObject>* arg);

      boolean insertParent(DoubleLinkedList<BiGraphArc<TObject> >& arg);

      boolean insertFirstParent(BiGraphArc<TObject>* arg);

      boolean insertFirstParent(DoubleLinkedList<BiGraphArc<TObject> >& arg);

      boolean insertLastParent(BiGraphArc<TObject>* arg);

      boolean insertLastParent(DoubleLinkedList<BiGraphArc<TObject> >& arg);

      boolean removeParent(BiGraphArc<TObject>*& arg);

      boolean removeParent();

      boolean removeFirstParent(BiGraphArc<TObject>*& arg);

      boolean removeFirstParent();

      boolean removeLastParent(BiGraphArc<TObject>*& arg);

      boolean removeLastParent();

- adjacency list property methods:

      boolean isEmptyChild() const;

      boolean isFirstChild() const;

      boolean isLastChild() const;

      long lengthChild() const;

      boolean findChild(const BiGraphArc<TObject>* arg) const;

      boolean containsChild(const BiGraphArc<TObject>* arg) const;

      boolean isEmptyParent() const;

      boolean isFirstParent() const;

      boolean isLastParent() const;

      long lengthParent() const;

      boolean findParent(const BiGraphArc<TObject>* arg) const;

      boolean containsParent(const BiGraphArc<TObject>* arg) const;

- adjacency list ordering methods:

      boolean sortChild(Integral::ORDER sort_order = Integral::ASCENDING, SORT_ALGO = DEF_SORT_ALGO);

      boolean reverseChild();

      boolean swapChild(long i, long j);

      boolean sortParent(Integral::ORDER sort_order = Integral::ASCENDING, SORT_ALGO = DEF_SORT_ALGO);

      boolean reverseParent();

      boolean swapParent(long i, long j);

- adjacency list ordering methods:

      ALLOCATION getAllocationModeChild();

      boolean setAllocationModeChild(ALLOCATION arg);

      ALLOCATION getAllocationModeParent();

      boolean setAllocationModeParent(ALLOCATION arg);

private methods:

- none.

examples:

- This example shows how to manipulate item, arc and parent graph of a BiGraphVertex:

      // create a set of test characters
      //
      Char* chars[128];
      for (long i = 0; i < 128; i++) {
        chars[i] = new Char((unichar)i);
      }

      // create two graphs to manipulate
      //
      Graph<Char> graph1(false);
      Graph<Char> graph2(false);

      // create an array of vertices to test
      //
      BiGraphVertex<Char>* vertices[128];
      for (long i = 0; i < 128; i++) {

        vertices[i] = new BiGraphVertex<Char>(false);

        // set the item in each vertex
        //
        vertices[i]->setItem(chars[i]);
      }

      // make sure the setParentGraph and getParentGraph methods work
      //
      // assign one of the two graphs to each node
      //
      for (long i = 0; i < 64; i++) {
        if (!vertices[i]->setParentGraph(&graph1)) {
          Console::put(L"Error in setParentGraph");
        }
      }
      for (long i = 64; i < 128; i++) {
        if (!vertices[i]->setParentGraph(&graph2)) {
           Console::put(L"Error in setParentGraph");
        }
      }

      // make sure that the proper graph was assigned
      //
      for (long i = 0; i < 64; i++) {
        if ((vertices[i]->getParentGraph() != &graph1) ||
            (vertices[128 - i - 1]->getParentGraph() != &graph2) ||
            (vertices[i]->getParentGraph() ==
             vertices[128 - i - 1]->getParentGraph())) {
           Console::put(L"Error in getParentGraph");
        }
      }

notes:

- The BiGraphVertex class is a support class for the BiGraph class.