1 9 package org.ozoneDB.odmg; 10 11 import org.odmg.*; 12 import java.util.*; 14 15 16 20 public class OzoneODMGDBag extends ArrayList implements DBag { 21 22 23 public OzoneODMGDBag() { 24 super(); 25 } 26 27 28 public OzoneODMGDBag( Collection _collection ) { 29 super( _collection ); 30 } 31 32 33 43 public DBag union( DBag otherBag ) { 45 DBag result = new OzoneODMGDBag( this ); 46 result.addAll( otherBag ); 47 return result; 48 } 49 50 51 61 public DBag intersection( DBag otherBag ) { 63 DBag result = new OzoneODMGDBag(); 64 return result; 65 } 66 67 68 78 public DBag difference( DBag otherBag ) { 80 DBag result = union( otherBag ); 81 result.removeAll( otherBag ); 82 result.removeAll( this ); 83 return result; 84 } 85 86 87 93 public int occurrences( Object obj ) { 94 int result = 0; 95 if (obj != null) { 96 for (int i = 0, size = size(); i < size; ++i) { 97 if (obj.equals( get( i ) )) { 98 ++result; 99 } 100 } 101 } 102 return result; 103 } 104 105 106 109 public Object selectElement( String predicate ) throws QueryInvalidException { 110 throw new NotImplementedException( "OQL not supported" ); 111 } 112 113 114 117 public java.util.Iterator select( String predicate ) throws QueryInvalidException { 118 throw new NotImplementedException( "OQL not supported" ); 119 } 120 121 122 125 public DCollection query( String predicate ) throws QueryInvalidException { 126 throw new NotImplementedException( "OQL not supported" ); 127 } 128 129 130 133 public boolean existsElement( String predicate ) throws QueryInvalidException { 134 throw new NotImplementedException( "OQL not supported" ); 135 } 136 137 } 138 | Popular Tags |