PolyLine
Class Realizer

java.lang.Object
  extended by PolyLine.Realizer

public class Realizer
extends java.lang.Object

A class representing Realizer DataSturcture.

This class is an object to represent a realizer. This object is initializes with a text files. The format is given below
row 1 -> number of nodes in the realizer
row 2
to
row n+1 ->
row n+2->
row n+3 -> root of t0 ... root of t2
row n+4
to
row n+6->ccw postordering of id with space given
row n+7->space

example file:

15
14 -1 -1 -1
5 -1 -1 -1
6 -1 -1 -1
0 14 11 4
1 0 11 4
2 1 11 3
3 1 11 4
4 14 11 5
7 12 6 11
8 7 6 11
9 8 6 11
10 9 6 11
11 14 6 5
12 13 6 11
13 14 6 11

14 6 5
10 9 8 7 12 13 11 2 3 1 0 4 14
4 3 2 1 0 11 10 9 8 7 12 13 6
0 1 2 3 4 13 12 7 8 9 10 11 5


init method inputs the file by BufferedReader and FileReader

Copyright: Copyright (c) 2008


Company: Bangladesh University of engineering and technology


Field Summary
(package private)  java.io.BufferedReader br
          Used to read the "file" object
(package private)  int[][] ccwPostOrder
          a 2D array where each row represents a tree's counter clockwise postordering.
(package private)  java.io.File file
          A native File object which is later initializes to the input text file
(package private)  java.io.FileReader fr
          Used to read the "file" object
(package private)  java.util.LinkedList<java.lang.Integer> leafT0
          Contains the list of all leafs in tree T0.
(package private)  RealizerNode[] node
          Array of Realizer nodes.
(package private)  int[][] parentList
          A 2D array of integer where every row represents a vertex and every column represents which tree.
(package private)  int[] root
          This array contains only the root ids.
 
Constructor Summary
Realizer(java.io.File file)
          Construcctor .
 
Method Summary
 void fixChild(RealizerNode u)
          While doing the weak stratification .
 int[][] getCCWPostOrder()
           
 java.util.LinkedList<java.lang.Integer> getLeafT0()
           
 RealizerNode[] getNodes()
           
 int[] getRoot()
           
 void init()
          This method initializes all the data structures from the input file
(package private)  boolean isLeafT0(int val)
          Checks whether the id is a leaf of T0 tree.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

file

java.io.File file
A native File object which is later initializes to the input text file


parentList

int[][] parentList
A 2D array of integer where every row represents a vertex and every column represents which tree. e.g: parentList[8][2] means the id of the node who is the parent of vertx 8 in tree 2 for root of any tree all of the value in each column is set to -1.


br

java.io.BufferedReader br
Used to read the "file" object


fr

java.io.FileReader fr
Used to read the "file" object


node

RealizerNode[] node
Array of Realizer nodes. This array is initialized during the init() function call.


root

int[] root
This array contains only the root ids. e.g: root[1] contains id of the tree t1.


ccwPostOrder

int[][] ccwPostOrder
a 2D array where each row represents a tree's counter clockwise postordering. For n vertices each tree will have n-2 vertices in its counter clockwise postordering. total 3 rows . Each rows have the indices form 0 to n-3 for the ordering. e.g: 2 4 5 3 in row 0 means CCW ordering of T0 isn 2-4-5-3


leafT0

java.util.LinkedList<java.lang.Integer> leafT0
Contains the list of all leafs in tree T0.

Constructor Detail

Realizer

public Realizer(java.io.File file)
Construcctor . Just initializes the file in "file" object Then calls init().

Method Detail

fixChild

public void fixChild(RealizerNode u)
While doing the weak stratification . Some layer of any vertex can get higher. Every node have a childMax list. So when any one gets higher layer it's parents need to set its childMax list which is done in this method.

Parameters:
u - the RealizerNode object who's child max layer value to be adjusted.

getCCWPostOrder

public int[][] getCCWPostOrder()
Returns:
ccwPostorder array

getRoot

public int[] getRoot()
Returns:
root array

getNodes

public RealizerNode[] getNodes()
Returns:
node array of type RealizerNode

getLeafT0

public java.util.LinkedList<java.lang.Integer> getLeafT0()
Returns:
leafT0 linked list

init

public void init()
This method initializes all the data structures from the input file


isLeafT0

boolean isLeafT0(int val)
Checks whether the id is a leaf of T0 tree.

Parameters:
val - the id of the node which is going to be checked is a leaf of tree_0 or not.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String of the Format:
prints every node or Realizer.toString() invokation
prints every roots
prints every ccw postorder
prints all leafs of t0 tree