Du bist hier: Snippet-Verzeichnis » Java (241)
Sprache:

2-dimensional orthogonal range searching

Sprache: English
Programmiersprache: Java
Veröffentlicht von: menny [nicht registriert]
Letzte Änderung: 15.05.2006
Aufrufe: 1050


Beschreibung

This is class Leaf. Also known as Node.I made a little mistake, and called it Leaf, which supposed to be a childless node.nevermind, it's just words...

Code

1 // A part of the 2d Orth Search. 2 3 class Leaf 4 { 5 private Object Data=null; //this will hold the data (Tree object or Point) 6 private Leaf lc=null,rc=null; //left and right children 7 private int el=0; //this will help in findSplitLeaf and Query1D/2D 8 // Will hold the X or Y coordinate of the object in the tree. 9 10 //constructors 11 12 public Leaf() {;} 13 14 public Leaf(Object d) 15 { 16 this.setData(d); 17 } 18 19 // functions 20 21 public void setEl(int e) //set apropriate coordinate dipending on the tree type. 22 { 23 this.el=e; 24 }//setElemnt 25 26 public int getEl() 27 { 28 return this.el; 29 }//getEl 30 31 public boolean childless() //checks if left and right children doesnt not exist. 32 { 33 return ((this.lc==null)&&(this.rc==null)); 34 } 35 36 public void setData(Object d) 37 { 38 this.Data=d; 39 } 40 41 public Object getData() 42 { 43 return this.Data; 44 }// getData 45 46 public Leaf getLc() 47 { 48 return this.lc; 49 }//Left Child 50 51 public Leaf getRc() 52 { 53 return this.rc; 54 }//right child 55 56 public void setLeft(Leaf O) 57 { 58 this.lc=O; 59 } 60 61 public void setRight(Leaf O) 62 { 63 this.rc=O; 64 } 65 }//class Leaf 66 67

Noch kein Kommentar vorhanden

Dieses Snippet kommentieren

Name *  

E-Mail (wird nicht angezeigt) *    

Website  

Kommentar *  

Sicherheitscode Sicherheitscode *    

RSS