From 7dff1cba624ab221aba9409ebe1b5baa87fc84b1 Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 13 Mar 2009 16:52:31 +0000 Subject: [PATCH] removed option to use different primary keys in kelondro tables this option was never used and there is also no use to set other columns but the first as the primary key. as a result, access methods to the key do not need to compute key positions, and they work faster. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5711 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Supporter.java | 2 +- htroot/Surftips.java | 2 +- source/dbtest.java | 2 +- source/de/anomic/crawler/Balancer.java | 2 +- source/de/anomic/crawler/CrawlEntry.java | 5 ++-- source/de/anomic/crawler/IndexingStack.java | 4 +-- source/de/anomic/crawler/ZURL.java | 4 +-- source/de/anomic/data/URLFetcherStack.java | 4 +-- source/de/anomic/kelondro/blob/BLOBTree.java | 2 +- source/de/anomic/kelondro/blob/Cache.java | 2 +- .../de/anomic/kelondro/index/HandleSet.java | 2 +- .../kelondro/index/IntegerHandleIndex.java | 2 +- .../kelondro/index/LongHandleIndex.java | 2 +- .../kelondro/index/ObjectArrayCache.java | 2 +- source/de/anomic/kelondro/index/Row.java | 20 +++++-------- .../anomic/kelondro/index/RowCollection.java | 28 +++++++------------ source/de/anomic/kelondro/index/RowSet.java | 8 +++--- .../kelondro/table/AbstractRecords.java | 2 +- source/de/anomic/kelondro/table/EcoTable.java | 5 ++-- .../kelondro/table/FixedWidthArray.java | 2 +- .../de/anomic/kelondro/table/FlexTable.java | 2 +- .../anomic/kelondro/table/FlexWidthArray.java | 6 ++-- .../de/anomic/kelondro/table/Hashtable.java | 2 +- .../de/anomic/kelondro/table/Relations.java | 2 +- .../de/anomic/kelondro/table/SplitTable.java | 2 +- source/de/anomic/kelondro/table/Stack.java | 2 +- source/de/anomic/kelondro/table/Tree.java | 22 +++++++-------- .../anomic/kelondro/text/IndexCollection.java | 8 ++---- .../kelondro/text/MetadataRowContainer.java | 4 +-- .../kelondro/text/ReferenceContainer.java | 6 ++-- .../de/anomic/kelondro/text/ReferenceRow.java | 6 ++-- source/de/anomic/kelondro/util/AttrSeq.java | 2 +- .../anomic/plasma/plasmaRankingCRProcess.java | 6 ++-- source/de/anomic/yacy/yacyNewsQueue.java | 2 +- source/de/anomic/yacy/yacyNewsRecord.java | 2 +- 35 files changed, 77 insertions(+), 99 deletions(-) diff --git a/htroot/Supporter.java b/htroot/Supporter.java index 8442e6cfd..ce5a2136a 100644 --- a/htroot/Supporter.java +++ b/htroot/Supporter.java @@ -104,7 +104,7 @@ public class Supporter { //accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB); //accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB); final ScoreCluster ranking = new ScoreCluster(); // score cluster for url hashes - final Row rowdef = new Row("String url-255, String title-120, String description-120, String refid-" + (DateFormatter.PATTERN_SHORT_SECOND.length() + 12), NaturalOrder.naturalOrder, 0); + final Row rowdef = new Row("String url-255, String title-120, String description-120, String refid-" + (DateFormatter.PATTERN_SHORT_SECOND.length() + 12), NaturalOrder.naturalOrder); final HashMap Supporter = new HashMap(); // a mapping from an url hash to a kelondroRow.Entry with display properties accumulateSupporter(sb, Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB); //accumulateSupporter(Supporter, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB); diff --git a/htroot/Surftips.java b/htroot/Surftips.java index 6fef81b07..ee95a25c6 100644 --- a/htroot/Surftips.java +++ b/htroot/Surftips.java @@ -112,7 +112,7 @@ public class Surftips { //accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB); //accumulateVotes(negativeHashes, positiveHashes, yacyNewsPool.PUBLISHED_DB); final ScoreCluster ranking = new ScoreCluster(); // score cluster for url hashes - final Row rowdef = new Row("String url-255, String title-120, String description-120, String refid-" + (DateFormatter.PATTERN_SHORT_SECOND.length() + 12), NaturalOrder.naturalOrder, 0); + final Row rowdef = new Row("String url-255, String title-120, String description-120, String refid-" + (DateFormatter.PATTERN_SHORT_SECOND.length() + 12), NaturalOrder.naturalOrder); final HashMap surftips = new HashMap(); // a mapping from an url hash to a kelondroRow.Entry with display properties accumulateSurftips(sb, surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.INCOMING_DB); //accumulateSurftips(surftips, ranking, rowdef, negativeHashes, positiveHashes, yacyNewsPool.OUTGOING_DB); diff --git a/source/dbtest.java b/source/dbtest.java index 1b7097398..966386bdf 100644 --- a/source/dbtest.java +++ b/source/dbtest.java @@ -284,7 +284,7 @@ public class dbtest { profiler.start(); // create the database access - final Row testRow = new Row("byte[] key-" + keylength + ", byte[] dummy-" + keylength + ", value-" + valuelength, Base64Order.enhancedCoder, 0); + final Row testRow = new Row("byte[] key-" + keylength + ", byte[] dummy-" + keylength + ", value-" + valuelength, Base64Order.enhancedCoder); final ObjectIndex table_test = selectTableType(dbe_test, tablename_test, testRow); final ObjectIndex table_reference = (dbe_reference == null) ? null : selectTableType(dbe_reference, tablename_reference, testRow); diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.java index 7224f9ff1..142705137 100644 --- a/source/de/anomic/crawler/Balancer.java +++ b/source/de/anomic/crawler/Balancer.java @@ -47,7 +47,7 @@ public class Balancer { private static final int EcoFSBufferSize = 200; // definition of payload for fileStack - private static final Row stackrow = new Row("byte[] urlhash-" + yacySeedDB.commonHashLength, Base64Order.enhancedCoder, 0); + private static final Row stackrow = new Row("byte[] urlhash-" + yacySeedDB.commonHashLength, Base64Order.enhancedCoder); // class variables private final ConcurrentHashMap> diff --git a/source/de/anomic/crawler/CrawlEntry.java b/source/de/anomic/crawler/CrawlEntry.java index 30982e8a2..afea2bb60 100755 --- a/source/de/anomic/crawler/CrawlEntry.java +++ b/source/de/anomic/crawler/CrawlEntry.java @@ -59,9 +59,8 @@ public class CrawlEntry extends serverProcessorJob { "Cardinal loaddate-8 {b256}," + // time when the file was loaded "Cardinal serverdate-8 {b256}," + // time when that the server returned as document date "Cardinal modifiedSince-8 {b256}", // time that was given to server as ifModifiedSince - Base64Order.enhancedCoder, - 0 - ); + Base64Order.enhancedCoder + ); // a shared domainAccess map for all balancers. the key is a domain-hash (6 bytes) public static final ConcurrentHashMap domainAccess = new ConcurrentHashMap(); diff --git a/source/de/anomic/crawler/IndexingStack.java b/source/de/anomic/crawler/IndexingStack.java index e0bebd842..bd9fadec1 100644 --- a/source/de/anomic/crawler/IndexingStack.java +++ b/source/de/anomic/crawler/IndexingStack.java @@ -72,8 +72,8 @@ public class IndexingStack { "Cardinal depth-2 {b64e}, " + // the prefetch depth so far, starts at 0 "String profile-" + yacySeedDB.commonHashLength + ", " + // the name of the prefetch profile handle "String urldescr-80", - NaturalOrder.naturalOrder, - 0); + NaturalOrder.naturalOrder + ); public int size() { return (sbQueueStack == null) ? 0 : sbQueueStack.size(); diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.java index 1125102e5..656492ba3 100755 --- a/source/de/anomic/crawler/ZURL.java +++ b/source/de/anomic/crawler/ZURL.java @@ -53,8 +53,8 @@ public class ZURL { "Cardinal workcount-4 {b256}, " + // number of load retries "String anycause-132, " + // string describing load failure "byte[] entry-" + CrawlEntry.rowdef.objectsize, // extra space - Base64Order.enhancedCoder, - 0); + Base64Order.enhancedCoder + ); // the class object private final ObjectIndex urlIndex; diff --git a/source/de/anomic/data/URLFetcherStack.java b/source/de/anomic/data/URLFetcherStack.java index 31b36d01a..dc0abf313 100644 --- a/source/de/anomic/data/URLFetcherStack.java +++ b/source/de/anomic/data/URLFetcherStack.java @@ -42,9 +42,7 @@ public class URLFetcherStack { private static final Row rowdef = new Row( "String urlstring-256", - Base64Order.enhancedCoder, - 0 - ); + Base64Order.enhancedCoder ); private final Stack db; private final Log log; diff --git a/source/de/anomic/kelondro/blob/BLOBTree.java b/source/de/anomic/kelondro/blob/BLOBTree.java index c65c6cb2a..035b2337f 100644 --- a/source/de/anomic/kelondro/blob/BLOBTree.java +++ b/source/de/anomic/kelondro/blob/BLOBTree.java @@ -77,7 +77,7 @@ public class BLOBTree implements BLOB { public BLOBTree(final File file, final boolean useNodeCache, final boolean useObjectCache, final int key, final int nodesize, final char fillChar, final ByteOrder objectOrder, final boolean usetree, final boolean writebuffer, final boolean resetOnFail) { // creates or opens a dynamic tree - rowdef = new Row("byte[] key-" + (key + counterlen) + ", byte[] node-" + nodesize, objectOrder, 0); + rowdef = new Row("byte[] key-" + (key + counterlen) + ", byte[] node-" + nodesize, objectOrder); this.file = file; ObjectIndex fbi; if (usetree) { diff --git a/source/de/anomic/kelondro/blob/Cache.java b/source/de/anomic/kelondro/blob/Cache.java index 169791646..48f97242f 100644 --- a/source/de/anomic/kelondro/blob/Cache.java +++ b/source/de/anomic/kelondro/blob/Cache.java @@ -76,7 +76,7 @@ public class Cache implements ObjectIndex { } private void init() { - this.keyrow = new Row(new Column[]{index.row().column(index.row().primaryKeyIndex)}, index.row().objectOrder, 0); + this.keyrow = new Row(new Column[]{index.row().column(0)}, index.row().objectOrder); this.readHitCache = new RowSet(index.row(), 0); this.readMissCache = new RowSet(this.keyrow, 0); this.readHit = 0; diff --git a/source/de/anomic/kelondro/index/HandleSet.java b/source/de/anomic/kelondro/index/HandleSet.java index ce45ee761..04feb115e 100644 --- a/source/de/anomic/kelondro/index/HandleSet.java +++ b/source/de/anomic/kelondro/index/HandleSet.java @@ -43,7 +43,7 @@ public class HandleSet implements Iterable { private ObjectIndex index; public HandleSet(final int keylength, final ByteOrder objectOrder, final int initialspace, final int expectedspace) { - this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key")}, objectOrder, 0); + this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key")}, objectOrder); this.index = new ObjectIndexCache(rowdef, initialspace, expectedspace); } diff --git a/source/de/anomic/kelondro/index/IntegerHandleIndex.java b/source/de/anomic/kelondro/index/IntegerHandleIndex.java index e7f5fb723..0414f8def 100644 --- a/source/de/anomic/kelondro/index/IntegerHandleIndex.java +++ b/source/de/anomic/kelondro/index/IntegerHandleIndex.java @@ -56,7 +56,7 @@ public class IntegerHandleIndex { private ObjectIndexCache index; public IntegerHandleIndex(final int keylength, final ByteOrder objectOrder, final int initialspace, final int expectedspace) { - this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key"), new Column("int c-4 {b256}")}, objectOrder, 0); + this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key"), new Column("int c-4 {b256}")}, objectOrder); this.index = new ObjectIndexCache(rowdef, initialspace, expectedspace); } diff --git a/source/de/anomic/kelondro/index/LongHandleIndex.java b/source/de/anomic/kelondro/index/LongHandleIndex.java index f347ee23e..37708d780 100644 --- a/source/de/anomic/kelondro/index/LongHandleIndex.java +++ b/source/de/anomic/kelondro/index/LongHandleIndex.java @@ -59,7 +59,7 @@ public class LongHandleIndex { * @param space */ public LongHandleIndex(final int keylength, final ByteOrder objectOrder, final int initialspace, final int expectedspace) { - this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key"), new Column("long c-8 {b256}")}, objectOrder, 0); + this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key"), new Column("long c-8 {b256}")}, objectOrder); this.index = new ObjectIndexCache(rowdef, initialspace, expectedspace); } diff --git a/source/de/anomic/kelondro/index/ObjectArrayCache.java b/source/de/anomic/kelondro/index/ObjectArrayCache.java index bd9ee4210..58fd1d403 100644 --- a/source/de/anomic/kelondro/index/ObjectArrayCache.java +++ b/source/de/anomic/kelondro/index/ObjectArrayCache.java @@ -46,7 +46,7 @@ public class ObjectArrayCache { //private final kelondroOrder entryOrder; public ObjectArrayCache(final int payloadSize, final int initSize) { - this.rowdef = new Row("Cardinal key-4 {b256}, byte[] payload-" + payloadSize, NaturalOrder.naturalOrder, 0); + this.rowdef = new Row("Cardinal key-4 {b256}, byte[] payload-" + payloadSize, NaturalOrder.naturalOrder); this.index0 = new RowSet(rowdef, initSize); this.index1 = null; //this.entryOrder = new kelondroRow.EntryComparator(rowdef.objectOrder); diff --git a/source/de/anomic/kelondro/index/Row.java b/source/de/anomic/kelondro/index/Row.java index a5f230746..c42163511 100644 --- a/source/de/anomic/kelondro/index/Row.java +++ b/source/de/anomic/kelondro/index/Row.java @@ -52,10 +52,10 @@ public final class Row { public final int[] colstart; public final ByteOrder objectOrder; public final int objectsize; - public final int primaryKeyIndex, primaryKeyLength; + public final int primaryKeyLength; protected Map nickref = null; // a mapping from nicknames to Object[2]{kelondroColumn, Integer(colstart)} - public Row(final Column[] row, final ByteOrder objectOrder, final int primaryKey) { + public Row(final Column[] row, final ByteOrder objectOrder) { assert objectOrder != null; this.objectOrder = objectOrder; this.row = row; @@ -67,11 +67,10 @@ public final class Row { os+= this.row[i].cellwidth; } this.objectsize = os; - this.primaryKeyIndex = primaryKey; - this.primaryKeyLength = (primaryKey < 0) ? this.objectsize : row[primaryKeyIndex].cellwidth; + this.primaryKeyLength = row[0].cellwidth; } - public Row(String structure, final ByteOrder objectOrder, final int primaryKey) { + public Row(String structure, final ByteOrder objectOrder) { assert (objectOrder != null); this.objectOrder = objectOrder; // define row with row syntax @@ -102,8 +101,7 @@ public final class Row { os += this.row[i].cellwidth; } this.objectsize = os; - this.primaryKeyIndex = primaryKey; - this.primaryKeyLength = (primaryKey < 0) ? this.objectsize : row[primaryKeyIndex].cellwidth; + this.primaryKeyLength = row[0].cellwidth; } public final ByteOrder getOrdering() { @@ -119,11 +117,7 @@ public final class Row { public final int columns() { return this.row.length; } - /* - public final int objectsize() { - return this.objectsize; - } - */ + public final Column column(final int col) { return row[col]; } @@ -567,7 +561,7 @@ public final class Row { public final byte[] getPrimaryKeyBytes() { final byte[] c = new byte[primaryKeyLength]; - System.arraycopy(rowinstance, offset + ((primaryKeyIndex < 0) ? 0 : colstart[primaryKeyIndex]), c, 0, primaryKeyLength); + System.arraycopy(rowinstance, offset, c, 0, primaryKeyLength); return c; } diff --git a/source/de/anomic/kelondro/index/RowCollection.java b/source/de/anomic/kelondro/index/RowCollection.java index 86c43b788..d513dae2e 100644 --- a/source/de/anomic/kelondro/index/RowCollection.java +++ b/source/de/anomic/kelondro/index/RowCollection.java @@ -155,7 +155,7 @@ public class RowCollection implements Iterable { "byte[] orderkey-2," + "int orderbound-4 {b256}," + "byte[] collection-" + chunkcachelength, - NaturalOrder.naturalOrder, 0 + NaturalOrder.naturalOrder ); } @@ -866,16 +866,14 @@ public class RowCollection implements Iterable { assert (j >= 0) && (j < chunkcount) : "j = " + j + ", chunkcount = " + chunkcount; assert (this.rowdef.objectOrder != null); if (i == j) return 0; - assert (this.rowdef.primaryKeyIndex == 0) : "this.sortColumn = " + this.rowdef.primaryKeyIndex; - final int colstart = (this.rowdef.primaryKeyIndex <= 0) ? 0 : this.rowdef.colstart[this.rowdef.primaryKeyIndex]; //assert (!bugappearance(chunkcache, i * this.rowdef.objectsize + colstart, this.rowdef.primaryKeyLength)); //assert (!bugappearance(chunkcache, j * this.rowdef.objectsize + colstart, this.rowdef.primaryKeyLength)); final int c = this.rowdef.objectOrder.compare( chunkcache, - i * this.rowdef.objectsize + colstart, + i * this.rowdef.objectsize, this.rowdef.primaryKeyLength, chunkcache, - j * this.rowdef.objectsize + colstart, + j * this.rowdef.objectsize, this.rowdef.primaryKeyLength); return c; } @@ -884,16 +882,13 @@ public class RowCollection implements Iterable { assert (i >= 0) && (i < chunkcount) : "i = " + i + ", chunkcount = " + chunkcount; assert (this.rowdef.objectOrder != null); assert (this.rowdef.objectOrder instanceof Base64Order); - assert (this.rowdef.primaryKeyIndex == 0) : "this.sortColumn = " + this.rowdef.primaryKeyIndex; - final int colstart = (this.rowdef.primaryKeyIndex <= 0) ? 0 : this.rowdef.colstart[this.rowdef.primaryKeyIndex]; //assert (!bugappearance(chunkcache, i * this.rowdef.objectsize + colstart, this.rowdef.primaryKeyLength)); - return ((Base64Order) this.rowdef.objectOrder).compilePivot(chunkcache, i * this.rowdef.objectsize + colstart, this.rowdef.primaryKeyLength); + return ((Base64Order) this.rowdef.objectOrder).compilePivot(chunkcache, i * this.rowdef.objectsize, this.rowdef.primaryKeyLength); } protected final byte[] compilePivot(final byte[] a, final int astart, final int alength) { assert (this.rowdef.objectOrder != null); assert (this.rowdef.objectOrder instanceof Base64Order); - assert (this.rowdef.primaryKeyIndex == 0) : "this.sortColumn = " + this.rowdef.primaryKeyIndex; return ((Base64Order) this.rowdef.objectOrder).compilePivot(a, astart, alength); } @@ -902,13 +897,11 @@ public class RowCollection implements Iterable { assert (j >= 0) && (j < chunkcount) : "j = " + j + ", chunkcount = " + chunkcount; assert (this.rowdef.objectOrder != null); assert (this.rowdef.objectOrder instanceof Base64Order); - assert (this.rowdef.primaryKeyIndex == 0) : "this.sortColumn = " + this.rowdef.primaryKeyIndex; - final int colstart = (this.rowdef.primaryKeyIndex <= 0) ? 0 : this.rowdef.colstart[this.rowdef.primaryKeyIndex]; //assert (!bugappearance(chunkcache, j * this.rowdef.objectsize + colstart, this.rowdef.primaryKeyLength)); final int c = ((Base64Order) this.rowdef.objectOrder).comparePivot( compiledPivot, chunkcache, - j * this.rowdef.objectsize + colstart, + j * this.rowdef.objectsize, this.rowdef.primaryKeyLength); return c; } @@ -916,7 +909,7 @@ public class RowCollection implements Iterable { protected synchronized int compare(final byte[] a, final int astart, final int alength, final int chunknumber) { assert (chunknumber < chunkcount); final int l = Math.min(this.rowdef.primaryKeyLength, Math.min(a.length - astart, alength)); - return rowdef.objectOrder.compare(a, astart, l, chunkcache, chunknumber * this.rowdef.objectsize + ((rowdef.primaryKeyIndex <= 0) ? 0 : this.rowdef.colstart[rowdef.primaryKeyIndex]), this.rowdef.primaryKeyLength); + return rowdef.objectOrder.compare(a, astart, l, chunkcache, chunknumber * this.rowdef.objectsize, this.rowdef.primaryKeyLength); } protected final boolean match(final int i, final int j) { @@ -927,9 +920,8 @@ public class RowCollection implements Iterable { if (j >= chunkcount) return false; assert (this.rowdef.objectOrder != null); if (i == j) return true; - final int colstart = (this.rowdef.primaryKeyIndex <= 0) ? 0 : this.rowdef.colstart[this.rowdef.primaryKeyIndex]; - int astart = i * this.rowdef.objectsize + colstart; - int bstart = j * this.rowdef.objectsize + colstart; + int astart = i * this.rowdef.objectsize; + int bstart = j * this.rowdef.objectsize; int k = this.rowdef.primaryKeyLength; while (k-- != 0) { if (chunkcache[astart++] != chunkcache[bstart++]) return false; @@ -939,7 +931,7 @@ public class RowCollection implements Iterable { protected synchronized boolean match(final byte[] a, int astart, final int alength, final int chunknumber) { if (chunknumber >= chunkcount) return false; - int p = chunknumber * this.rowdef.objectsize + ((rowdef.primaryKeyIndex <= 0) ? 0 : this.rowdef.colstart[rowdef.primaryKeyIndex]); + int p = chunknumber * this.rowdef.objectsize; int len = Math.min(this.rowdef.primaryKeyLength, Math.min(alength, a.length - astart)); while (len-- != 0) { if (a[astart++] != chunkcache[p++]) return false; @@ -967,7 +959,7 @@ public class RowCollection implements Iterable { public static void test(final int testsize) { final Row r = new Row(new Column[]{ new Column("hash", Column.celltype_string, Column.encoder_bytes, 12, "hash")}, - Base64Order.enhancedCoder, 0); + Base64Order.enhancedCoder); RowCollection a = new RowCollection(r, testsize); a.add("AAAAAAAAAAAA".getBytes()); diff --git a/source/de/anomic/kelondro/index/RowSet.java b/source/de/anomic/kelondro/index/RowSet.java index d03b9f36a..6494253cc 100644 --- a/source/de/anomic/kelondro/index/RowSet.java +++ b/source/de/anomic/kelondro/index/RowSet.java @@ -116,7 +116,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable collectionReSortLimit) { sort(); } - int index = find(entry.bytes(), (rowdef.primaryKeyIndex < 0) ? 0 :super.rowdef.colstart[rowdef.primaryKeyIndex], super.rowdef.primaryKeyLength); + int index = find(entry.bytes(), 0, super.rowdef.primaryKeyLength); if (index < 0) { super.addUnique(entry); } else { @@ -135,7 +135,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable collectionReSortLimit) { sort(); } - index = find(entry.bytes(), (rowdef.primaryKeyIndex < 0) ? 0 :super.rowdef.colstart[rowdef.primaryKeyIndex], super.rowdef.primaryKeyLength); + index = find(entry.bytes(), 0, super.rowdef.primaryKeyLength); if (index < 0) { super.addUnique(entry); } else { @@ -488,7 +488,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable 4) || (args.length < 2)) { System.err.println("usage: kelondroStack -c|-p|-v|-g|-i|-s [file]|[key [value]] "); diff --git a/source/de/anomic/kelondro/table/Tree.java b/source/de/anomic/kelondro/table/Tree.java index 9592a3a0b..28afcd33c 100644 --- a/source/de/anomic/kelondro/table/Tree.java +++ b/source/de/anomic/kelondro/table/Tree.java @@ -1280,7 +1280,7 @@ public class Tree extends CachedRecords implements ObjectIndex { // test script final File testFile = new File("test.db"); while (testFile.exists()) testFile.delete(); - final Tree fm = new Tree(testFile, true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(testFile, true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); final byte[] dummy = "".getBytes(); fm.put("abc0".getBytes(), dummy); fm.put("bcd0".getBytes(), dummy); fm.put("def0".getBytes(), dummy); fm.put("bab0".getBytes(), dummy); @@ -1302,7 +1302,7 @@ public class Tree extends CachedRecords implements ObjectIndex { ret = null; } } else if (args.length == 2) { - final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); if (args[0].equals("-v")) { fm.print(); ret = null; @@ -1310,11 +1310,11 @@ public class Tree extends CachedRecords implements ObjectIndex { fm.close(); } else if (args.length == 3) { if (args[0].equals("-d")) { - final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); fm.remove(args[2].getBytes()); fm.close(); } else if (args[0].equals("-i")) { - final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); final int i = fm.imp(new File(args[1]),";"); fm.close(); ret = (i + " records imported").getBytes(); @@ -1337,12 +1337,12 @@ public class Tree extends CachedRecords implements ObjectIndex { if (f != null) try {f.close();}catch(final Exception e){} } } else if (args[0].equals("-g")) { - final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); final Row.Entry ret2 = fm.get(args[2].getBytes()); ret = ((ret2 == null) ? null : ret2.getColBytes(1)); fm.close(); } else if (args[0].equals("-n")) { - final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); //byte[][] keys = fm.getSequentialKeys(args[2].getBytes(), 500, true); final Iterator rowIt = fm.rows(true, (args[2].length() == 0) ? null : args[2].getBytes()); final Vector v = new Vector(); @@ -1355,11 +1355,11 @@ public class Tree extends CachedRecords implements ObjectIndex { // create final File f = new File(args[3]); if (f.exists()) f.delete(); - final Row lens = new Row("byte[] key-" + Integer.parseInt(args[1]) + ", byte[] value-" + Integer.parseInt(args[2]), NaturalOrder.naturalOrder, 0); + final Row lens = new Row("byte[] key-" + Integer.parseInt(args[1]) + ", byte[] value-" + Integer.parseInt(args[2]), NaturalOrder.naturalOrder); final Tree fm = new Tree(f, true, 10, lens); fm.close(); } else if (args[0].equals("-u")) { - final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree fm = new Tree(new File(args[1]), true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); ret = fm.put(args[1].getBytes(), args[2].getBytes()); fm.close(); } @@ -1418,7 +1418,7 @@ public class Tree extends CachedRecords implements ObjectIndex { int steps = 0; while (true) { if (testFile.exists()) testFile.delete(); - tt = new Tree(testFile, true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + tt = new Tree(testFile, true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); steps = 10 + ((int) System.currentTimeMillis() % 7) * (((int) System.currentTimeMillis() + 17) % 11); t = s; d = ""; @@ -1484,7 +1484,7 @@ public class Tree extends CachedRecords implements ObjectIndex { final File f = new File("test.db"); if (f.exists()) f.delete(); try { - final Tree tt = new Tree(f, true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree tt = new Tree(f, true, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); byte[] b; b = testWord('B'); tt.put(b, b); //tt.print(); b = testWord('C'); tt.put(b, b); //tt.print(); @@ -1549,7 +1549,7 @@ public class Tree extends CachedRecords implements ObjectIndex { public static Tree testTree(final File f, final String testentities) throws IOException { if (f.exists()) f.delete(); - final Tree tt = new Tree(f, false, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder, 0)); + final Tree tt = new Tree(f, false, 10, new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder)); byte[] b; for (int i = 0; i < testentities.length(); i++) { b = testWord(testentities.charAt(i)); diff --git a/source/de/anomic/kelondro/text/IndexCollection.java b/source/de/anomic/kelondro/text/IndexCollection.java index e3a3902fd..07622da3b 100644 --- a/source/de/anomic/kelondro/text/IndexCollection.java +++ b/source/de/anomic/kelondro/text/IndexCollection.java @@ -269,7 +269,7 @@ public class IndexCollection implements Index { "int indexpos-4 {b256}," + "short lastread-2 {b256}, " + "short lastwrote-2 {b256}", - payloadOrder, 0 + payloadOrder ); } @@ -486,9 +486,7 @@ public class IndexCollection implements Index { final Row rowdef = new Row( "byte[] key-" + keylength + "," + "byte[] collection-" + (RowCollection.exportOverheadSize + load * objectsize), - indexOrder, - 0 - ); + indexOrder ); if ((!(f.exists())) && (!create)) return null; final FixedWidthArray a = new FixedWidthArray(f, rowdef, 0); Log.logFine("STARTUP", "opened array file " + f + " with " + a.size() + " RWIs"); @@ -1033,7 +1031,7 @@ public class IndexCollection implements Index { public static void main(final String[] args) { // define payload structure - final Row rowdef = new Row("byte[] a-10, byte[] b-80", NaturalOrder.naturalOrder, 0); + final Row rowdef = new Row("byte[] a-10, byte[] b-80", NaturalOrder.naturalOrder); final File path = new File(args[0]); final String filenameStub = args[1]; diff --git a/source/de/anomic/kelondro/text/MetadataRowContainer.java b/source/de/anomic/kelondro/text/MetadataRowContainer.java index 37b28610c..e636c3175 100644 --- a/source/de/anomic/kelondro/text/MetadataRowContainer.java +++ b/source/de/anomic/kelondro/text/MetadataRowContainer.java @@ -71,8 +71,8 @@ public class MetadataRowContainer { "Cardinal laudio-2 {b256}, " + // # of embedded audio links; for audio: track number; for video: number of audio tracks "Cardinal lvideo-2 {b256}, " + // # of embedded video links "Cardinal lapp-2 {b256}", // # of embedded links to applications - Base64Order.enhancedCoder, - 0); + Base64Order.enhancedCoder + ); /* =========================================================================== * Constants to access the various columns of an URL entry diff --git a/source/de/anomic/kelondro/text/ReferenceContainer.java b/source/de/anomic/kelondro/text/ReferenceContainer.java index 6c79abda6..7df94010b 100644 --- a/source/de/anomic/kelondro/text/ReferenceContainer.java +++ b/source/de/anomic/kelondro/text/ReferenceContainer.java @@ -350,8 +350,7 @@ public class ReferenceContainer extends RowSet { final int keylength = i1.rowdef.width(0); assert (keylength == i2.rowdef.width(0)); final ReferenceContainer conj = new ReferenceContainer(null, i1.rowdef, 0); // start with empty search result - if (!((i1.rowdef.getOrdering().signature().equals(i2.rowdef.getOrdering().signature())) && - (i1.rowdef.primaryKeyIndex == i2.rowdef.primaryKeyIndex))) return conj; // ordering must be equal + if (!((i1.rowdef.getOrdering().signature().equals(i2.rowdef.getOrdering().signature())))) return conj; // ordering must be equal final Iterator e1 = i1.entries(); final Iterator e2 = i2.entries(); int c; @@ -424,8 +423,7 @@ public class ReferenceContainer extends RowSet { assert pivot.rowdef.equals(excl.rowdef) : "i1 = " + pivot.rowdef.toString() + "; i2 = " + excl.rowdef.toString(); final int keylength = pivot.rowdef.width(0); assert (keylength == excl.rowdef.width(0)); - if (!((pivot.rowdef.getOrdering().signature().equals(excl.rowdef.getOrdering().signature())) && - (pivot.rowdef.primaryKeyIndex == excl.rowdef.primaryKeyIndex))) return pivot; // ordering must be equal + if (!((pivot.rowdef.getOrdering().signature().equals(excl.rowdef.getOrdering().signature())))) return pivot; // ordering must be equal final Iterator e1 = pivot.entries(); final Iterator e2 = excl.entries(); int c; diff --git a/source/de/anomic/kelondro/text/ReferenceRow.java b/source/de/anomic/kelondro/text/ReferenceRow.java index 17b2e110e..23f3e4ec7 100644 --- a/source/de/anomic/kelondro/text/ReferenceRow.java +++ b/source/de/anomic/kelondro/text/ReferenceRow.java @@ -59,9 +59,9 @@ public final class ReferenceRow implements Reference, Cloneable { new Column("o", Column.celltype_cardinal, Column.encoder_b256, 1, "posofphrase"), new Column("i", Column.celltype_cardinal, Column.encoder_b256, 1, "worddistance"), new Column("k", Column.celltype_cardinal, Column.encoder_b256, 1, "reserve") - }, - Base64Order.enhancedCoder, - 0); + }, + Base64Order.enhancedCoder + ); // available chars: b,e,j,q // static properties diff --git a/source/de/anomic/kelondro/util/AttrSeq.java b/source/de/anomic/kelondro/util/AttrSeq.java index 4c002eff1..3c19bccfc 100644 --- a/source/de/anomic/kelondro/util/AttrSeq.java +++ b/source/de/anomic/kelondro/util/AttrSeq.java @@ -316,7 +316,7 @@ public class AttrSeq { rowdef.append('-'); rowdef.append(seq_len[i]); } - seqrow = new Row(new String(rowdef), null, 0); + seqrow = new Row(new String(rowdef), null); } public String toString() { diff --git a/source/de/anomic/plasma/plasmaRankingCRProcess.java b/source/de/anomic/plasma/plasmaRankingCRProcess.java index 8c827959c..9315f133b 100644 --- a/source/de/anomic/plasma/plasmaRankingCRProcess.java +++ b/source/de/anomic/plasma/plasmaRankingCRProcess.java @@ -61,11 +61,11 @@ public class plasmaRankingCRProcess { "Cardinal WACount-3 {b64e}, Cardinal WUCount-3 {b64e}, Cardinal Flags-1 {b64e}, " + "Cardinal FUDate-3 {b64e}, Cardinal FDDate-3 {b64e}, Cardinal LUDate-3 {b64e}, " + "Cardinal UCount-2 {b64e}, Cardinal PCount-2 {b64e}, Cardinal ACount-2 {b64e}, Cardinal VCount-2 {b64e}, Cardinal Vita-2 {b64e}", - Base64Order.enhancedCoder, 0); - public static final Row CRG_colrow = new Row("byte[] Anchor-12", Base64Order.enhancedCoder, 0); + Base64Order.enhancedCoder); + public static final Row CRG_colrow = new Row("byte[] Anchor-12", Base64Order.enhancedCoder); public static final String CRG_accname = "CRG-a-attr"; public static final String CRG_seqname = "CRG-a-coli"; - public static final Row RCI_coli = new Row("byte[] RefereeDom-6", Base64Order.enhancedCoder, 0); + public static final Row RCI_coli = new Row("byte[] RefereeDom-6", Base64Order.enhancedCoder); public static final String RCI_colname = "RCI-a-coli"; private static boolean accumulate_upd(final File f, final AttrSeq acc) { diff --git a/source/de/anomic/yacy/yacyNewsQueue.java b/source/de/anomic/yacy/yacyNewsQueue.java index ea44c8e40..04955b51c 100644 --- a/source/de/anomic/yacy/yacyNewsQueue.java +++ b/source/de/anomic/yacy/yacyNewsQueue.java @@ -66,7 +66,7 @@ public class yacyNewsQueue { new Column("newsid", Column.celltype_string, Column.encoder_bytes, yacyNewsRecord.idLength, "id = created + originator"), new Column("last touched", Column.celltype_string, Column.encoder_bytes, DateFormatter.PATTERN_SHORT_SECOND.length(), "") }, - NaturalOrder.naturalOrder, 0 + NaturalOrder.naturalOrder ); public yacyNewsQueue(final File path, final yacyNewsDB newsDB) { diff --git a/source/de/anomic/yacy/yacyNewsRecord.java b/source/de/anomic/yacy/yacyNewsRecord.java index 1d77fc736..c4546cab7 100644 --- a/source/de/anomic/yacy/yacyNewsRecord.java +++ b/source/de/anomic/yacy/yacyNewsRecord.java @@ -81,7 +81,7 @@ public class yacyNewsRecord { "String rec-" + DateFormatter.PATTERN_SHORT_SECOND.length() + "," + "short dis-2 {b64e}," + "String att-" + attributesMaxLength, - NaturalOrder.naturalOrder, 0 + NaturalOrder.naturalOrder ); public static yacyNewsRecord newRecord(final String newsString) {