calculation
Class Tree

java.lang.Object
  extended by calculation.Tree

public class Tree
extends java.lang.Object

Class Tree implements the arrival tree for airplanes. It determines tree-shaped path of which the planes follow most of the time when they fly to the airport.

Version:
1
Author:
Potkuri-group

Field Summary
private  TreeNode root
          The root of a tree.
private  java.util.ArrayList<TreeNode> treeMergePoints
          Merge points of the tree.
private  java.util.ArrayList<TreeNode> treeNodes
          Collection of nodes.
private  java.util.ArrayList<Vertex> vertexTree
          Vertexes of the tree.
 
Constructor Summary
Tree()
          Constructor, creates empty array lists for nodes.
 
Method Summary
 boolean addToTree(java.util.ArrayList<Vertex> path)
          Adds given path (list of Vertexes) to the tree.
 java.util.ArrayList<TreeNode> getLeaves()
          Returns the leaves of a tree (=every node without children).
 TreeNode getRoot()
          Returns this.root.
 java.util.ArrayList<TreeNode> getTree()
          Returns this.treeNodes.
 java.util.ArrayList<TreeNode> getTreeMergePoints()
          Returns merge points of the tree.
 java.util.ArrayList<Vertex> getVertexLeaves()
          Returns the leaves of a tree (=every node without children) as an ArrayList of Vertexes.
 java.util.ArrayList<Vertex> getVertexTree()
          Returns this.treeNodes as arrayList of Vertexes.
 void setTreeMergePoints(java.util.ArrayList<Vertex> mergePoints)
          Sets this.treeMergePoints from parameter.
 java.util.ArrayList<TreeNode> treeNodePath(java.util.ArrayList<Vertex> path)
          Makes a path containing tree nodes from path containing vertexes by creating new treenodes corresponding to vertexes and adding them, in same order as in parameter path, to a new ArrayList.
 void treeToString()
          Prints x and y -coordinates of the tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private TreeNode root
The root of a tree.


treeMergePoints

private java.util.ArrayList<TreeNode> treeMergePoints
Merge points of the tree.


treeNodes

private java.util.ArrayList<TreeNode> treeNodes
Collection of nodes.


vertexTree

private java.util.ArrayList<Vertex> vertexTree
Vertexes of the tree.

Constructor Detail

Tree

public Tree()
Constructor, creates empty array lists for nodes.

Method Detail

addToTree

public boolean addToTree(java.util.ArrayList<Vertex> path)
Adds given path (list of Vertexes) to the tree.

Parameters:
path - ArrayList of Vertexes representing the path to be added.
Returns:
boolean Success.

getLeaves

public java.util.ArrayList<TreeNode> getLeaves()
Returns the leaves of a tree (=every node without children).

Returns:
leaves The leaves of the tree.

getRoot

public TreeNode getRoot()
Returns this.root.

Returns:
this.root

getTree

public java.util.ArrayList<TreeNode> getTree()
Returns this.treeNodes.

Returns:
this.treeNodes

getTreeMergePoints

public java.util.ArrayList<TreeNode> getTreeMergePoints()
Returns merge points of the tree.

Returns:
this.treeMergePoints

getVertexLeaves

public java.util.ArrayList<Vertex> getVertexLeaves()
Returns the leaves of a tree (=every node without children) as an ArrayList of Vertexes.

Returns:
leaves The leaves of the tree as vertexes.

getVertexTree

public java.util.ArrayList<Vertex> getVertexTree()
Returns this.treeNodes as arrayList of Vertexes.

Returns:
this.vertexTree

setTreeMergePoints

public void setTreeMergePoints(java.util.ArrayList<Vertex> mergePoints)
Sets this.treeMergePoints from parameter.

Parameters:
mergePoints - List of all merge points.

treeNodePath

public java.util.ArrayList<TreeNode> treeNodePath(java.util.ArrayList<Vertex> path)
Makes a path containing tree nodes from path containing vertexes by creating new treenodes corresponding to vertexes and adding them, in same order as in parameter path, to a new ArrayList.

Parameters:
path - ArrayList of Vertexes to be made as path of tree nodes.
Returns:
treeNodeTable ArrayList of parameter path vertexes corresponding TreeNodes, order is the same.

treeToString

public void treeToString()
Prints x and y -coordinates of the tree.