Examples of OutOfLimitsException


Examples of net.yacy.cora.storage.OutOfLimitsException

    public void set(final E obj, final int newScore) {
        if (obj == null) return;
        synchronized (this) {
            Long usk = this.map.remove(obj); // get unique score key, old entry is not needed any more
            if (newScore < 0) throw new OutOfLimitsException(newScore);

            if (usk == null) {
                // set new value
                usk = Long.valueOf(scoreKey(this.encnt++, newScore));
View Full Code Here

Examples of net.yacy.cora.storage.OutOfLimitsException

        synchronized (this) {
            Long usk = this.map.remove(obj); // get unique score key, old entry is not needed any more

            if (usk == null) {
                // set new value
                if (incrementScore < 0) throw new OutOfLimitsException(incrementScore);
                usk = Long.valueOf(scoreKey(this.encnt++, incrementScore));

                // put new value into cluster
                this.map.put(obj, usk);
                this.pam.put(usk, obj);

            } else {
                // delete old entry
                this.pam.remove(usk);

                // get previous handle and score
                final long c = usk.longValue();
                final int oldScore = (int) ((c & 0xFFFFFFFF00000000L) >> 32);
                final int oldHandle = (int) (c & 0xFFFFFFFFL);

                // set new value
                final int newValue = oldScore + incrementScore;
                if (newValue < 0) throw new OutOfLimitsException(newValue);
                usk = Long.valueOf(scoreKey(oldHandle, newValue)); // generates an unique key for a specific score
                this.map.put(obj, usk);
                this.pam.put(usk, obj);
            }
        }
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.