01: // indexContainerOrder.java
02: // (C) 2007 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
03: // first published 2007 on http://yacy.net
04: //
05: // This is a part of YaCy, a peer-to-peer based web search engine
06: //
07: // $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
08: // $LastChangedRevision: 1986 $
09: // $LastChangedBy: orbiter $
10: //
11: // LICENSE
12: //
13: // This program is free software; you can redistribute it and/or modify
14: // it under the terms of the GNU General Public License as published by
15: // the Free Software Foundation; either version 2 of the License, or
16: // (at your option) any later version.
17: //
18: // This program is distributed in the hope that it will be useful,
19: // but WITHOUT ANY WARRANTY; without even the implied warranty of
20: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: // GNU General Public License for more details.
22: //
23: // You should have received a copy of the GNU General Public License
24: // along with this program; if not, write to the Free Software
25: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26:
27: package de.anomic.index;
28:
29: import de.anomic.kelondro.kelondroAbstractOrder;
30: import de.anomic.kelondro.kelondroOrder;
31:
32: public class indexContainerOrder extends
33: kelondroAbstractOrder<indexContainer> implements
34: kelondroOrder<indexContainer> {
35:
36: private kelondroOrder<byte[]> embeddedOrder;
37:
38: public indexContainerOrder(kelondroOrder<byte[]> embedOrder) {
39: this .embeddedOrder = embedOrder;
40: }
41:
42: public boolean wellformed(indexContainer a) {
43: return embeddedOrder.wellformed(a.getWordHash().getBytes());
44: }
45:
46: public void direction(boolean ascending) {
47: this .embeddedOrder.direction(ascending);
48: }
49:
50: public long partition(byte[] key, int forks) {
51: return this .embeddedOrder.partition(key, forks);
52: }
53:
54: public int compare(indexContainer a, indexContainer b) {
55: return this .embeddedOrder.compare(a.getWordHash().getBytes(), b
56: .getWordHash().getBytes());
57: }
58:
59: public void rotate(indexContainer zero) {
60: this .embeddedOrder.rotate(zero.getWordHash().getBytes());
61: this .zero = new indexContainer(new String(this .embeddedOrder
62: .zero()), zero);
63: }
64:
65: public kelondroOrder<indexContainer> clone() {
66: return new indexContainerOrder(this .embeddedOrder.clone());
67: }
68:
69: public String signature() {
70: return this .embeddedOrder.signature();
71: }
72:
73: public long cardinal(byte[] key) {
74: return this .embeddedOrder.cardinal(key);
75: }
76:
77: public boolean equals(kelondroOrder<indexContainer> otherOrder) {
78: if (!(otherOrder instanceof indexContainerOrder))
79: return false;
80: return this .embeddedOrder
81: .equals(((indexContainerOrder) otherOrder).embeddedOrder);
82: }
83:
84: public long cardinal(indexContainer key) {
85: return this.embeddedOrder
86: .cardinal(key.getWordHash().getBytes());
87: }
88:
89: }
|