📄 ozoneodmgdbag.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: OzoneODMGDBag.java,v 1.4 2000/10/28 16:55:19 daniela Exp $package org.ozoneDB.odmg;import org.odmg.*;//import org.ozoneDB.*;import java.util.*;/** * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.4 $Date: 2000/10/28 16:55:19 $ */public class OzoneODMGDBag extends ArrayList implements DBag { public OzoneODMGDBag() { super(); } public OzoneODMGDBag( Collection _collection ) { super( _collection ); } /** * A new <code>DBag</code> instance is created that is the union of this object * and <code>otherBag</code>. * This method is similar to the <code>addAll</code> method in <code>Collection</code>, * except that this method creates a new collection and <code>addAll</code> * modifies the object to contain the result. * @param otherBag The other bag to use in the union operation. * @return A <code>DBag</code> instance that contains the union of this object * and <code>otherBag</code>. */ // * @see com.sun.java.util.collections.Collection#addAll public DBag union( DBag otherBag ) { DBag result = new OzoneODMGDBag( this ); result.addAll( otherBag ); return result; } /** * A new <code>DBag</code> instance is created that contains the intersection of * this object and the <code>DBag</code> referenced by <code>otherBag</code>. * This method is similar to the <code>retainAll</code> method in <code>Collection</code>, * except that this method creates a new collection and <code>retainAll</code> * modifies the object to contain the result. * @param otherBag The other bag to use in creating the intersection. * @return A <code>DBag</code> instance that contains the intersection of this * object and <code>otherBag</code>. */ // @see com.sun.java.util.collections.Collection#retainAll public DBag intersection( DBag otherBag ) { DBag result = new OzoneODMGDBag(); return result; } /** * A new <code>DBag</code> instance is created that contains the difference of * this object and the <code>DBag</code> instance referenced by <code>otherBag</code>. * This method is similar to the <code>removeAll</code> method in <code>Collection</code>, * except that this method creates a new collection and <code>removeAll</code> * modifies the object to contain the result. * @param otherBag The other bag to use in creating the difference. * @return A <code>DBag</code> instance that contains the elements of this object * minus the elements in <code>otherBag</code>. */ // * @see com.sun.java.util.collections.Collection#removeAll public DBag difference( DBag otherBag ) { DBag result = union( otherBag ); result.removeAll( otherBag ); result.removeAll( this ); return result; } /** * This method returns the number of occurrences of the object <code>obj</code> * in the <code>DBag</code> collection. * @param obj The value that may have elements in the collection. * @return The number of occurrences of <code>obj</code> in this collection. */ public int occurrences( Object obj ) { int result = 0; if (obj != null) { for (int i = 0, size = size(); i < size; ++i) { if (obj.equals( get( i ) )) { ++result; } } } return result; } /** * NOT SUPPORTED! */ public Object selectElement( String predicate ) throws QueryInvalidException { throw new NotImplementedException( "OQL not supported" ); } /** * NOT SUPPORTED! */ public java.util.Iterator select( String predicate ) throws QueryInvalidException { throw new NotImplementedException( "OQL not supported" ); } /** * NOT SUPPORTED! */ public DCollection query( String predicate ) throws QueryInvalidException { throw new NotImplementedException( "OQL not supported" ); } /** * NOT SUPPORTED! */ public boolean existsElement( String predicate ) throws QueryInvalidException { throw new NotImplementedException( "OQL not supported" ); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -