📄 dxtreemap.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: DxTreeMap.java,v 1.7 2000/10/28 16:55:14 daniela Exp $package org.ozoneDB.DxLib;import java.io.*;/** * A DxMap implementation that is based on a weight balanced tree. * * * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.7 $Date: 2000/10/28 16:55:14 $ */public class DxTreeMap extends DxAbstractMap implements DxTreeCollection, Externalizable { final static long serialVersionUID = 1L; protected transient DxBBTree bbtree; protected DxComparator comparator = null; public DxTreeMap() { comparator = new DxStandardComparator(); bbtree = new DxBBTree( comparator ); } public DxTreeMap( DxComparator _comparator ) { comparator = _comparator; bbtree = new DxBBTree( comparator ); } public Object clone() { DxMap newMap = new DxTreeMap( comparator ); return clone( newMap ); } /** */ public synchronized boolean addForKey( Object obj, Object key ) { return bbtree.addForKey( obj, key ); } /** */ public Object elementForKey( Object key ) { return bbtree.elementForKey( key ); } /** */ public Object keyForElement( Object obj ) { return bbtree.keyForElement( obj ); } /** */ public synchronized Object removeForKey( Object key ) { return bbtree.removeForKey( key ); } /** */ public synchronized boolean remove( Object obj ) { Object key = keyForElement( obj ); if (key != null) { removeForKey( key ); return true; } return false; } /** */ public DxIterator iterator() { return new DxBBIterator( this ); } /** */ public int count() { return bbtree.count(); } /** */ public boolean isEmpty() { return bbtree.isEmpty(); } /** */ public boolean containsKey( Object key ) { return bbtree.containsKey( key ); } /** */ public synchronized void clear() { bbtree = new DxBBTree( comparator ); } /** */ public DxBBTree internalTree() { return bbtree; } public void writeExternal( ObjectOutput out ) throws IOException { // System.out.println (getClass().getName() + ".writeExternal()..."); out.writeObject( comparator ); super.writeExternal( out ); } public synchronized void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException { // System.out.println ("tree.readExternal()..."); comparator = (DxComparator)in.readObject(); bbtree = new DxBBTree( comparator ); super.readExternal( in ); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -