Package net.yacy.kelondro.util

Examples of net.yacy.kelondro.util.ByteArray


            }
        }

        public void remove() {
            System.arraycopy(this.cachecopy, this.p, this.cachecopy, this.p - 1, this.cachecopy.size() - this.p);
            ReferenceContainerCache.this.cache.remove(new ByteArray(this.latestTermHash));
        }
View Full Code Here


            return new Rating<byte[]>(c.getObject().asBytes(), c.getScore());
        }

        public void remove() {
            System.arraycopy(this.cachecounts, this.p, this.cachecounts, this.p - 1, this.cachecounts.size() - this.p);
            ReferenceContainerCache.this.cache.remove(new ByteArray(this.latestTermHash));
        }
View Full Code Here

        // test ByteArray
        System.out.println("unsorted map");
        Runtime.getRuntime().gc();
        final long freeStartBA = MemoryControl.available();
        HashMap<ByteArray, Integer> bm = new HashMap<ByteArray, Integer>();
        for (int i = 0; i < count; i++) bm.put(new ByteArray(tests[i]), 1);
        final long t8 = System.currentTimeMillis();
        System.out.println("time   for HashMap<ByteArray> generation: " + (t8 - t7));
       
        bugs = 0;
        for (int i = 0; i < count; i++) if (bm.get(new ByteArray(tests[i])) == null) bugs++;
        Runtime.getRuntime().gc();
        final long freeEndBA = MemoryControl.available();
        bm.clear(); bm = null;
        final long t9 = System.currentTimeMillis();
        System.out.println("time   for HashMap<ByteArray> test: " + (t9 - t8) + ", " + bugs + " bugs");
View Full Code Here

     */
    private void enqueueContainersToCloud(final List<ReferenceContainer<WordReference>>[] containers) {
        if (this.transmissionCloud == null) return;
        ReferenceContainer<WordReference> lastContainer;
        byte[] primaryTarget;
        ByteArray pTArray;
        Transmission.Chunk entry;
        for (int vertical = 0; vertical < containers.length; vertical++) {
            // the 'new' primary target is the word hash of the last container in the array
            lastContainer = containers[vertical].get(containers[vertical].size() - 1);
            primaryTarget = FlatWordPartitionScheme.positionToHash(this.seeds.scheme.dhtPosition(lastContainer.getTermHash(), vertical));
            assert primaryTarget[2] != '@';
            pTArray = new ByteArray(primaryTarget);

            // get or make a entry object
            entry = this.transmissionCloud.get(pTArray); // if this is not null, the entry is extended here
            final List<Seed> targets = PeerSelection.getAcceptRemoteIndexSeedsList(
                    this.seeds,
View Full Code Here

     * This method returns true if a container was dequeued, false if not
     */
    public boolean dequeueContainer() {
      if (this.transmissionCloud == null) return false;
        if (this.indexingTransmissionProcessor.queueSize() > this.indexingTransmissionProcessor.concurrency()) return false;
        ByteArray maxtarget = null;
        int maxsize = -1;
        for (final Map.Entry<ByteArray, Transmission.Chunk> chunk: this.transmissionCloud.entrySet()) {
            if (chunk.getValue().containersSize() > maxsize) {
                maxsize = chunk.getValue().containersSize();
                maxtarget = chunk.getKey();
View Full Code Here

TOP

Related Classes of net.yacy.kelondro.util.ByteArray

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.