Package org.apache.xindice.core.data

Examples of org.apache.xindice.core.data.Key


    }

    private IndexMatch getIndexMatch(Value v) {
        byte[] b = v.getData();
        int l = b.length - 13;
        Key key = new Key(b, 0, b.length - 13);

        int pos = ((b[l + 1] << 24) | (b[l + 2] << 16) | (b[l + 3] << 8) | b[l + 4]);
        int len = ((b[l + 5] << 24) | (b[l + 6] << 16) | (b[l + 7] << 8) | b[l + 8]);
        short elemID = (short) ((b[l + 9] << 8) | b[l + 10]);
        short attrID = (short) ((b[l + 11] << 8) | b[l + 12]);
View Full Code Here


            return pos < files.length;
        }

        public synchronized Record getNextRecord() throws DBException {
            File file = files[pos++];
            return readRecord(new Key(file.getName()));
        }
View Full Code Here

        public synchronized Value getNextValue() throws DBException {
            return getNextRecord().getValue();
        }

        public synchronized Key getNextKey() {
            return new Key(files[pos++].getName());
        }
View Full Code Here

        final IndexPattern pattern = query.getPattern();

        try {
            query(query, new BTreeCallback() {
                public boolean indexInfo(Value value, long pos) {
                    results.add(new IndexMatch(new Key(value), pattern));
                    return true;
                }
            });
        } catch (DBException e) {
            throw e;
View Full Code Here

                        // iterate over locators for current value adding each to result
                        Iterator aLocatorIterator = ((TreeSet) ((Map.Entry) aValueIterator.next()).getValue()).iterator();
                        for (; aLocatorIterator.hasNext(); ++aResultIndex) {
                            ValueLocator aLocator = (ValueLocator) aLocatorIterator.next();
                            aResult[aResultIndex] = new IndexMatch(
                                    new Key(aLocator.getKey()), aLocator.getPosition(), aLocator.getLength(), aLocator.getElementID(), aLocator.getAttributeID());
                        }
                    }
                } else {
                    // allocate return array to include all locators except those attached to excluded value
                    aResult = new IndexMatch[itsValueLocatorCount - anExcludedLocatorSet.size()];

                    // iterate over the values adding locators for each to result
                    // must filter out the locator set for the excluded value while iterating values
                    while (aValueIterator.hasNext()) {
                        aLocatorSet = (TreeSet) ((Map.Entry) aValueIterator.next()).getValue();

                        // apply the exclusion filter for the matched value
                        if (aLocatorSet != anExcludedLocatorSet) {
                            // iterate over locators for current value adding each to result
                            Iterator aLocatorIterator = ((TreeSet) ((Map.Entry) aValueIterator.next()).getValue()).iterator();
                            for (; aLocatorIterator.hasNext(); ++aResultIndex) {
                                ValueLocator aLocator = (ValueLocator) aLocatorIterator.next();
                                aResult[aResultIndex] = new IndexMatch(
                                        new Key(aLocator.getKey()), aLocator.getPosition(), aLocator.getLength(), aLocator.getElementID(), aLocator.getAttributeID());
                            }
                        }
                    }
                }
                break;
View Full Code Here

            // iterate over locators for current value adding each to result
            Iterator aLocatorIterator = ((TreeSet) ((Map.Entry) aValueIterator.next()).getValue()).iterator();
            for (; aLocatorIterator.hasNext(); ++theStartIndex) {
                ValueLocator aLocator = (ValueLocator) aLocatorIterator.next();
                theArray[theStartIndex] = new IndexMatch(
                        new Key(aLocator.getKey()), aLocator.getPosition(), aLocator.getLength(), aLocator.getElementID(), aLocator.getAttributeID());
            }
        }

        return theStartIndex;
    }
View Full Code Here

        Iterator aLocatorIterator = theSet.iterator();
        for (; aLocatorIterator.hasNext(); ++theStartIndex) {
            ValueLocator aLocator = (ValueLocator) aLocatorIterator.next();
            theArray[theStartIndex] = new IndexMatch(
                    new Key(aLocator.getKey()), aLocator.getPosition(), aLocator.getLength(), aLocator.getElementID(), aLocator.getAttributeID());
        }
        return theStartIndex;
    }
View Full Code Here

        }
        filer.open();

        RecordSet set = filer.getRecordSet();
        while (set.hasMoreRecords()) {
            Key key = set.getNextKey();
            filer.deleteRecord(key);
        }
        assertEquals(0, filer.getRecordCount());
    }
View Full Code Here

    public void testFailReadRecordEmptyKey() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        // Empty key
        Record result = filer.readRecord(new Key(""));
        assertNull(result);
    }
View Full Code Here

    public void testFailReadRecordUnknownKey() throws Exception {
        assertTrue(filer.writeRecord(TEST_KEY, TEST_VALUE));
        assertEquals(1, filer.getRecordCount());

        // Non-existant key
        Record result = filer.readRecord(new Key("non-existant-key"));
        assertNull(result);
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.data.Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.