1 9 package org.ozoneDB.DxLib; 10 11 12 18 public class DxTreeSet extends DxAbstractSet implements DxTreeCollection { 19 21 final static long serialVersionUID = 1L; 22 23 protected transient DxBBTree bbtree; 24 25 protected DxComparator comparator; 26 27 28 32 public DxTreeSet() { 33 comparator = new DxStandardComparator(); 34 bbtree = new DxBBTree( comparator ); 35 } 36 37 38 42 public DxTreeSet( DxComparator _comparator ) { 43 comparator = _comparator; 44 bbtree = new DxBBTree( comparator ); 45 } 46 47 48 public Object clone() { 49 DxSet newSet = new DxTreeSet( comparator ); 50 return clone( newSet ); 51 } 52 53 54 public synchronized boolean add( Object obj ) { 55 return bbtree.addForKey( obj, obj ); 56 } 57 58 59 public synchronized boolean remove( Object obj ) { 60 return bbtree.removeForKey( obj ) != null; 61 } 62 63 64 public boolean contains( Object obj ) { 65 return bbtree.containsKey( obj ); 66 } 67 68 69 public DxIterator iterator() { 70 return new DxBBIterator( this ); 71 } 72 73 74 public int count() { 75 return bbtree.count(); 76 } 77 78 79 public boolean isEmpty() { 80 return bbtree.isEmpty(); 81 } 82 83 84 public synchronized void clear() { 85 bbtree = new DxBBTree(); 86 } 87 88 89 public DxBBTree internalTree() { 90 return bbtree; 91 } 92 93 94 107 } 108 | Popular Tags |