Examples of ByteArray


Examples of net.imglib2.img.basictypeaccess.array.ByteArray

  public static < T extends NativeType< T >> ArrayImgAWTScreenImage< T, ? > emptyScreenImage( final T type, final long[] dims )
  {

    if ( ByteType.class.isAssignableFrom( type.getClass() ) )
    {
      final ByteArray array = new ByteArray( numElements( dims ) );
      final ArrayImgAWTScreenImage< ByteType, ByteArray > container = new ByteAWTScreenImage( new ByteType( array ), array, dims );
      container.setLinkedType( new ByteType( container ) );
      return ( ArrayImgAWTScreenImage ) container;
    }

    if ( UnsignedByteType.class.isAssignableFrom( type.getClass() ) )
    {
      final ByteArray array = new ByteArray( numElements( dims ) );
      final ArrayImgAWTScreenImage< UnsignedByteType, ByteArray > container = new UnsignedByteAWTScreenImage( new UnsignedByteType( array ), array, dims );
      container.setLinkedType( new UnsignedByteType( container ) );
      return ( ArrayImgAWTScreenImage ) container;
    }
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

     */
    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<yacySeed> targets = PeerSelection.getAcceptRemoteIndexSeedsList(
                    this.seeds,
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

     * 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

Examples of net.yacy.kelondro.util.ByteArray

        // 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

Examples of net.yacy.kelondro.util.ByteArray

     * this works with heaps in write- and read-mode
     * @param key
     * @return true, if the key is used in the heap; false otherwise
     */
    public boolean has(final byte[] key) {
        return this.cache.containsKey(new ByteArray(key));
    }
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

     * @param key
     * @return the indexContainer if one exist, null otherwise
     * @throws
     */
    public ReferenceContainer<ReferenceType> get(final byte[] key, final HandleSet urlselection) {
        final ReferenceContainer<ReferenceType> c = this.cache.get(new ByteArray(key));
        if (urlselection == null) return c;
        if (c == null) return null;
        // because this is all in RAM, we must clone the entries (flat)
        try {
            final ReferenceContainer<ReferenceType> c1 = new ReferenceContainer<ReferenceType>(this.factory, c.getTermHash(), c.size());
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

     * return the size of the container with corresponding key
     * @param key
     * @return
     */
    public int count(final byte[] key) {
        final ReferenceContainer<ReferenceType> c = this.cache.get(new ByteArray(key));
        if (c == null) return 0;
        return c.size();
    }
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

     */
    public ReferenceContainer<ReferenceType> delete(final byte[] termHash) {
        // returns the index that had been deleted
        assert this.cache != null;
        if (this.cache == null) return null;
        return this.cache.remove(new ByteArray(termHash));
    }
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

        remove(termHash, urlHashBytes);
    }
    public boolean remove(final byte[] termHash, final byte[] urlHashBytes) {
        assert this.cache != null;
        if (this.cache == null) return false;
        final ByteArray tha = new ByteArray(termHash);
        synchronized (this.cache) {
          final ReferenceContainer<ReferenceType> c = this.cache.get(tha);
          if (c != null && c.delete(urlHashBytes)) {
              // removal successful
              if (c.isEmpty()) {
View Full Code Here

Examples of net.yacy.kelondro.util.ByteArray

    public int remove(final byte[] termHash, final HandleSet urlHashes) {
        assert this.cache != null;
        if (this.cache == null) return  0;
        if (urlHashes.isEmpty()) return 0;
        final ByteArray tha = new ByteArray(termHash);
        int count;
        synchronized (this.cache) {
            final ReferenceContainer<ReferenceType> c = this.cache.get(tha);
            if ((c != null) && ((count = c.removeEntries(urlHashes)) > 0)) {
                // removal successful
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.