01: /*-
02: * See the file LICENSE for redistribution information.
03: *
04: * Copyright (c) 2002,2008 Oracle. All rights reserved.
05: *
06: * $Id: LevelOrderedINMap.java,v 1.7.2.3 2008/01/07 15:14:18 cwl Exp $
07: */
08:
09: package com.sleepycat.je.utilint;
10:
11: import java.util.HashSet;
12: import java.util.Set;
13: import java.util.TreeMap;
14:
15: import com.sleepycat.je.tree.IN;
16:
17: /**
18: * A level ordered map holds collection of INs, sorted by level. The map is
19: * keyed by level and each datum is a set of INs belonging to that level.
20: */
21: public class LevelOrderedINMap extends TreeMap {
22:
23: public void putIN(IN in) {
24: Integer level = new Integer(in.getLevel());
25: Set inSet = (Set) get(level);
26: if (inSet == null) {
27: inSet = new HashSet();
28: put(level, inSet);
29: }
30: inSet.add(in);
31: }
32: }
|