You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/09/09 13:20:07 UTC
[07/15] cut down the included source code from javolution (no more
OSGi dependencies) and updated NOTICE and LICENSE files in source root
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/Index.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/Index.java b/commons/marmotta-commons/src/ext/java/javolution/util/Index.java
deleted file mode 100644
index e63df1f..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/util/Index.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.util;
-
-import java.io.IOException;
-import java.io.ObjectStreamException;
-
-import javolution.lang.Configurable;
-import javolution.lang.MathLib;
-import javolution.lang.Realtime;
-import javolution.lang.ValueType;
-import javolution.text.Cursor;
-import javolution.text.DefaultTextFormat;
-import javolution.text.TextContext;
-import javolution.text.TextFormat;
-import javolution.text.TypeFormat;
-
-/**
- * <p> A non-negative number representing a position in an arrangement.
- * For example:
- * [code]
- * class SparseVector<F> {
- * FastMap<Index, F> elements = new FastMap<Index, F>();
- * ...
- * }[/code]</p>
-
- * <p> Index performance is on-par with the primitive {@code int} type
- * for small values and similar to {@link Integer} instances for large
- * values. Small indexes have no adverse effect on the garbage collector
- * and have fast {@link #equals(Object) equals} method due to their unicity.</p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 5.1, July 26, 2007
- */
-@Realtime
-@DefaultTextFormat(Index.Decimal.class)
-public final class Index extends Number implements Comparable<Index>,
- ValueType<Index> {
-
- /**
- * Default text format for indices (decimal value representation).
- */
- public static class Decimal extends TextFormat<Index> {
-
- @Override
- public Appendable format(Index obj, Appendable dest) throws IOException {
- return TypeFormat.format(obj.intValue(), dest);
- }
-
- @Override
- public Index parse(CharSequence csq, Cursor cursor)
- throws IllegalArgumentException {
- return Index.valueOf(TypeFormat.parseInt(csq, cursor));
- }
-
- }
-
- /**
- * Holds the number of unique preallocated instances (default {@code 1024}).
- * This number is configurable, for example with
- * {@code -Djavolution.util.Index#UNIQUE=0} there is no unique instance.
- */
- public static final Configurable<Integer> UNIQUE = new Configurable<Integer>() {
-
- @Override
- protected Integer getDefault() {
- return 1024;
- }
-
- @Override
- protected Integer initialized(Integer value) {
- return MathLib.min(value, 65536); // Hard-limiting
- }
-
- @Override
- protected Integer reconfigured(Integer oldCount, Integer newCount) {
- throw new UnsupportedOperationException(
- "Unicity reconfiguration not supported.");
- }
- };
-
- /**
- * Holds the index zero (value <code>0</code>).
- */
- public static final Index ZERO = new Index(0);
-
- private static final long serialVersionUID = 0x600L; // Version.
- private static final Index[] INSTANCES = new Index[UNIQUE.get()];
- static {
- INSTANCES[0] = ZERO;
- for (int i = 1; i < INSTANCES.length; i++) {
- INSTANCES[i] = new Index(i);
- }
- }
-
- /**
- * Returns the index for the specified {@code int} non-negative
- * value (returns a preallocated instance if the specified value is
- * small).
- *
- * @param value the index value.
- * @return the corresponding index.
- * @throws IndexOutOfBoundsException if <code>value < 0</code>
- */
- public static Index valueOf(int value) {
- return (value < INSTANCES.length) ? INSTANCES[value] : new Index(value);
- }
-
- /**
- * Holds the index value.
- */
- private final int value;
-
- /**
- * Creates an index having the specified value.
- */
- private Index(int value) {
- this.value = value;
- }
-
- /**
- * Compares this index with the specified index for order. Returns a
- * negative integer, zero, or a positive integer as this index is less
- * than, equal to, or greater than the specified index.
- *
- * @param that the index to be compared.
- * @return a negative integer, zero, or a positive integer as this index
- * is less than, equal to, or greater than the specified index.
- */
- public int compareTo(Index that) {
- return this.value - that.value;
- }
-
- /**
- * Compares this index with the specified integer value for order. Returns a
- * negative integer, zero, or a positive integer as this index is less
- * than, equal to, or greater than the specified value.
- *
- * @param value the value to be compared.
- * @return a negative integer, zero, or a positive integer as this index
- * is less than, equal to, or greater than the specified value.
- */
- public int compareTo(int value) {
- return this.value - value;
- }
-
- /**
- * Returns a copy of this index or <code>this</code> if the indexes
- * is small (in permanent memory) in order to maintain unicity.
- */
- public Index copy() {
- return value < INSTANCES.length ? this : new Index(value);
- }
-
- /**
- * Returns the index value as <code>double</code>.
- *
- * @return the index value.
- */
- public double doubleValue() {
- return (double) value;
- }
-
- /**
- * Indicates if this index is equals to the one specified (for small
- * indices this method is equivalent to <code>==</code>).
- */
- @Override
- public boolean equals(Object obj) {
- return (this.value < INSTANCES.length) ? (this == obj)
- : ((obj instanceof Index) ? (((Index) obj).value == value)
- : false);
- }
-
- /**
- * Returns the index value as <code>float</code>.
- *
- * @return the index value.
- */
- public float floatValue() {
- return (float) value;
- }
-
- /**
- * Returns the hash code for this index.
- */
- @Override
- public int hashCode() {
- return value;
- }
-
- /**
- * Returns the index value as <code>int</code>.
- *
- * @return the index value.
- */
- public int intValue() {
- return value;
- }
-
- /**
- * Indicates if this index is zero.
- *
- * @return {@code this == ZERO}
- */
- public boolean isZero() {
- return this == ZERO;
- }
-
- /**
- * Returns the index value as <code>long</code>.
- *
- * @return the index value.
- */
- public long longValue() {
- return value;
- }
-
- /**
- * Returns the index after this one.
- */
- public Index next() {
- return Index.valueOf(value + 1);
- }
-
- /**
- * Returns the index before this one.
- *
- * @throws IndexOutOfBoundsException if (this == Index.ZERO)
- */
- public Index previous() {
- return Index.valueOf(value - 1);
- }
-
- /**
- * Ensures index unicity during deserialization.
- */
- protected final Object readResolve() throws ObjectStreamException {
- return Index.valueOf(value);
- }
-
- /**
- * Returns the {@link String} representation of this index.
- *
- * @return {@code TextContext.getFormat(Index.class).format(this)}
- */
- @Override
- public String toString() {
- return TextContext.getFormat(Index.class).format(this);
- }
-
- @Override
- public Index value() {
- return this;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/function/Equalities.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/function/Equalities.java b/commons/marmotta-commons/src/ext/java/javolution/util/function/Equalities.java
index 75e1441..4eb4c29 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/function/Equalities.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/function/Equalities.java
@@ -2,12 +2,7 @@ package javolution.util.function;
import javolution.lang.Parallelizable;
import javolution.lang.Realtime;
-import javolution.util.internal.comparator.ArrayComparatorImpl;
-import javolution.util.internal.comparator.IdentityComparatorImpl;
-import javolution.util.internal.comparator.LexicalCaseInsensitiveComparatorImpl;
-import javolution.util.internal.comparator.LexicalComparatorImpl;
-import javolution.util.internal.comparator.LexicalFastComparatorImpl;
-import javolution.util.internal.comparator.StandardComparatorImpl;
+import javolution.util.internal.comparator.*;
import static javolution.lang.Realtime.Limit.*;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/function/Reducers.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/function/Reducers.java b/commons/marmotta-commons/src/ext/java/javolution/util/function/Reducers.java
index 8705e12..020c44e 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/function/Reducers.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/function/Reducers.java
@@ -8,7 +8,9 @@
*/
package javolution.util.function;
-import static javolution.lang.Realtime.Limit.LINEAR;
+import javolution.lang.Parallelizable;
+import javolution.lang.Realtime;
+import javolution.util.FastCollection;
import java.util.Collection;
import java.util.Comparator;
@@ -16,9 +18,7 @@ import java.util.Iterator;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import javolution.lang.Parallelizable;
-import javolution.lang.Realtime;
-import javolution.util.FastCollection;
+import static javolution.lang.Realtime.Limit.LINEAR;
/**
* <p> A set of useful {@link Reducer reducers} of collection elements.</p>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetIteratorImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetIteratorImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetIteratorImpl.java
deleted file mode 100644
index d5cadc9..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetIteratorImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.util.internal.bitset;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import javolution.util.Index;
-import javolution.util.service.BitSetService;
-
-/**
- * An iterator over a bit set.
- */
-public final class BitSetIteratorImpl implements Iterator<Index> {
-
- private final BitSetService that;
-
- private int nextIndex;
-
- private int currentIndex = -1;
-
- public BitSetIteratorImpl(BitSetService that, int index) {
- this.that = that;
- this.nextIndex = that.nextSetBit(index);
- }
-
- public boolean hasNext() {
- return (nextIndex >= 0);
- }
-
- public Index next() {
- if (nextIndex < 0)
- throw new NoSuchElementException();
- currentIndex = nextIndex;
- nextIndex = that.nextSetBit(nextIndex + 1);
- return Index.valueOf(currentIndex);
- }
-
- public void remove() {
- if (currentIndex < 0)
- throw new IllegalStateException();
- that.clear(currentIndex);
- currentIndex = -1;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetServiceImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetServiceImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetServiceImpl.java
deleted file mode 100644
index 77c8c0c..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/bitset/BitSetServiceImpl.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.util.internal.bitset;
-
-import java.io.Serializable;
-import java.util.Iterator;
-
-import javolution.lang.MathLib;
-import javolution.util.Index;
-import javolution.util.function.Equalities;
-import javolution.util.function.Equality;
-import javolution.util.internal.set.SetView;
-import javolution.util.service.BitSetService;
-
-/**
- * A table of indices implemented using packed bits (long[]).
- */
-public class BitSetServiceImpl extends SetView<Index> implements BitSetService, Serializable {
-
- private static final long serialVersionUID = 0x600L; // Version.
-
- /** Holds the bits (64 bits per long), trimmed. */
- private long[] bits;
-
- /** Creates a bit set (256 bits). */
- public BitSetServiceImpl() {
- super(null); // Root.
- bits = new long[4];
- }
-
- @Override
- public boolean add(Index index) {
- return !getAndSet(index.intValue(), true);
- }
-
- @Override
- public void and(BitSetService that) {
- long[] thatBits = that.toLongArray();
- int n = MathLib.min(this.bits.length, thatBits.length);
- for (int i = 0; i < n; i++) {
- this.bits[i] &= thatBits[i];
- }
- for (int i = n; i < bits.length; i++) {
- this.bits[i] = 0L;
- }
- trim();
- }
-
- @Override
- public void andNot(BitSetService that) {
- long[] thatBits = that.toLongArray();
- int n = MathLib.min(this.bits.length, thatBits.length);
- for (int i = 0; i < n; i++) {
- this.bits[i] &= ~thatBits[i];
- }
- trim();
- }
-
- @Override
- public int cardinality() {
- int sum = 0;
- for (int i = 0; i < bits.length; i++) {
- sum += MathLib.bitCount(bits[i]);
- }
- return sum;
- }
-
- @Override
- public void clear() {
- bits = new long[0];
- }
-
- @Override
- public void clear(int bitIndex) {
- int longIndex = bitIndex >> 6;
- if (longIndex >= bits.length)
- return;
- bits[longIndex] &= ~(1L << bitIndex);
- trim();
- }
-
- @Override
- public void clear(int fromIndex, int toIndex) {
- if ((fromIndex < 0) || (toIndex < fromIndex))
- throw new IndexOutOfBoundsException();
- int i = fromIndex >>> 6;
- if (i >= bits.length)
- return; // Ensures that i < _length
- int j = toIndex >>> 6;
- if (i == j) {
- bits[i] &= ((1L << fromIndex) - 1) | (-1L << toIndex);
- return;
- }
- bits[i] &= (1L << fromIndex) - 1;
- if (j < bits.length) {
- bits[j] &= -1L << toIndex;
- }
- for (int k = i + 1; (k < j) && (k < bits.length); k++) {
- bits[k] = 0;
- }
- trim();
- }
-
- @Override
- public Equality<? super Index> comparator() {
- return Equalities.IDENTITY;
- }
-
- @Override
- public boolean contains(Object index) {
- return get(((Index)index).intValue());
- }
-
- @Override
- public void flip(int bitIndex) {
- int i = bitIndex >> 6;
- ensureCapacity(i + 1);
- bits[i] ^= 1L << bitIndex;
- trim();
- }
-
- @Override
- public void flip(int fromIndex, int toIndex) {
- if ((fromIndex < 0) || (toIndex < fromIndex))
- throw new IndexOutOfBoundsException();
- int i = fromIndex >>> 6;
- int j = toIndex >>> 6;
- ensureCapacity(j + 1);
- if (i == j) {
- bits[i] ^= (-1L << fromIndex) & ((1L << toIndex) - 1);
- return;
- }
- bits[i] ^= -1L << fromIndex;
- bits[j] ^= (1L << toIndex) - 1;
- for (int k = i + 1; k < j; k++) {
- bits[k] ^= -1;
- }
- trim();
- }
-
- @Override
- public boolean get(int bitIndex) {
- int i = bitIndex >> 6;
- return (i >= bits.length) ? false : (bits[i] & (1L << bitIndex)) != 0;
- }
-
- @Override
- public BitSetServiceImpl get(int fromIndex, int toIndex) {
- if (fromIndex < 0 || fromIndex > toIndex)
- throw new IndexOutOfBoundsException();
- BitSetServiceImpl bitSet = new BitSetServiceImpl();
- int length = MathLib.min(bits.length, (toIndex >>> 6) + 1);
- bitSet.bits = new long[length];
- System.arraycopy(bits, 0, bitSet.bits, 0, length);
- bitSet.clear(0, fromIndex);
- bitSet.clear(toIndex, length << 6);
- return bitSet;
- }
-
- /** Sets the specified bit, returns <code>true</code> if previously set. */
- @Override
- public boolean getAndSet(int bitIndex, boolean value) {
- int i = bitIndex >> 6;
- ensureCapacity(i + 1);
- boolean previous = (bits[i] & (1L << bitIndex)) != 0;
- if (value) {
- bits[i] |= 1L << bitIndex;
- } else {
- bits[i] &= ~(1L << bitIndex);
- }
- trim();
- return previous;
- }
-
- @Override
- public boolean intersects(BitSetService that) {
- long[] thatBits = that.toLongArray();
- int i = MathLib.min(this.bits.length, thatBits.length);
- while (--i >= 0) {
- if ((bits[i] & thatBits[i]) != 0) return true;
- }
- return false;
- }
-
- @Override
- public Iterator<Index> iterator() {
- return new BitSetIteratorImpl(this, 0);
- }
-
- @Override
- public int length() {
- if (bits.length == 0) return 0;
- return (bits.length << 6) - MathLib.numberOfLeadingZeros(bits[bits.length -1]);
- }
-
- @Override
- public int nextClearBit(int fromIndex) {
- int offset = fromIndex >> 6;
- long mask = 1L << fromIndex;
- while (offset < bits.length) {
- long h = bits[offset];
- do {
- if ((h & mask) == 0) { return fromIndex; }
- mask <<= 1;
- fromIndex++;
- } while (mask != 0);
- mask = 1;
- offset++;
- }
- return fromIndex;
- }
-
- @Override
- public int nextSetBit(int fromIndex) {
- int offset = fromIndex >> 6;
- long mask = 1L << fromIndex;
- while (offset < bits.length) {
- long h = bits[offset];
- do {
- if ((h & mask) != 0)
- return fromIndex;
- mask <<= 1;
- fromIndex++;
- } while (mask != 0);
- mask = 1;
- offset++;
- }
- return -1;
- }
-
- @Override
- public void or(BitSetService that) {
- long[] thatBits = (that instanceof BitSetServiceImpl) ? ((BitSetServiceImpl) that).bits
- : that.toLongArray();
- ensureCapacity(thatBits.length);
- for (int i = thatBits.length; --i >= 0;) {
- bits[i] |= thatBits[i];
- }
- trim();
- }
-
- @Override
- public int previousClearBit(int fromIndex) {
- int offset = fromIndex >> 6;
- long mask = 1L << fromIndex;
- while (offset >= 0) {
- long h = bits[offset];
- do {
- if ((h & mask) == 0)
- return fromIndex;
- mask >>= 1;
- fromIndex--;
- } while (mask != 0);
- mask = 1L << 63;
- offset--;
- }
- return -1;
- }
-
- @Override
- public int previousSetBit(int fromIndex) {
- int offset = fromIndex >> 6;
- long mask = 1L << fromIndex;
- while (offset >= 0) {
- long h = bits[offset];
- do {
- if ((h & mask) != 0)
- return fromIndex;
- mask >>= 1;
- fromIndex--;
- } while (mask != 0);
- mask = 1L << 63;
- offset--;
- }
- return -1;
- }
-
- @Override
- public boolean remove(Object index) {
- return getAndSet(((Index)index).intValue(), false);
- }
-
- @Override
- public void set(int bitIndex) {
- int i = bitIndex >> 6;
- ensureCapacity(i + 1);
- bits[i] |= 1L << bitIndex;
- }
-
- @Override
- public void set(int bitIndex, boolean value) {
- if (value) {
- set(bitIndex);
- } else {
- clear(bitIndex);
- }
- }
-
- @Override
- public void set(int fromIndex, int toIndex) {
- int i = fromIndex >>> 6;
- int j = toIndex >>> 6;
- ensureCapacity(j + 1);
- if (i == j) {
- bits[i] |= (-1L << fromIndex) & ((1L << toIndex) - 1);
- return;
- }
- bits[i] |= -1L << fromIndex;
- bits[j] |= (1L << toIndex) - 1;
- for (int k = i + 1; k < j; k++) {
- bits[k] = -1;
- }
- }
-
- @Override
- public void set(int fromIndex, int toIndex, boolean value) {
- if (value) {
- set(fromIndex, toIndex);
- } else {
- clear(fromIndex, toIndex);
- }
- }
-
- @Override
- public int size() {
- return cardinality();
- }
-
- @Override
- public long[] toLongArray() {
- return bits;
- }
-
- @Override
- public void xor(BitSetService that) {
- long[] thatBits = (that instanceof BitSetServiceImpl) ? ((BitSetServiceImpl) that).bits
- : that.toLongArray();
- ensureCapacity(thatBits.length);
- for (int i = thatBits.length; --i >= 0;) {
- bits[i] ^= thatBits[i];
- }
- trim();
- }
-
- // Checks capacity.
- private void ensureCapacity(int capacity) {
- if (bits.length < capacity) resize(capacity);
- }
-
- // Resize.
- private void resize(int min) {
- int newLength = bits.length * 2;
- while (newLength < min) newLength *= 2;
- long[] tmp = new long[newLength];
- System.arraycopy(bits, 0, tmp, 0, bits.length);
- bits = tmp;
- }
-
- /**
- * Removes the tails words if cleared.
- */
- private void trim() {
- int n = bits.length;
- while ((--n >= 0) && (bits[n] == 0L)) {}
- if (++n < bits.length) ensureCapacity(n);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/AtomicCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/AtomicCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/AtomicCollectionImpl.java
index 9773743..a76ce38 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/AtomicCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/AtomicCollectionImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.collection;
-import java.util.Collection;
-import java.util.Iterator;
-
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
+import java.util.Collection;
+import java.util.Iterator;
+
/**
* An atomic view over a collection (copy-on-write).
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/CollectionView.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/CollectionView.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/CollectionView.java
index c077ad7..a2ed55b 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/CollectionView.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/CollectionView.java
@@ -8,17 +8,17 @@
*/
package javolution.util.internal.collection;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
import javolution.util.FastCollection;
import javolution.util.function.Consumer;
import javolution.util.function.Equalities;
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
/**
* Collection view implementation; can be used as root class for implementations
* if target is {@code null}.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/DistinctCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/DistinctCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/DistinctCollectionImpl.java
index 713dc5b..404e76e 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/DistinctCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/DistinctCollectionImpl.java
@@ -8,12 +8,12 @@
*/
package javolution.util.internal.collection;
-import java.util.Iterator;
-
import javolution.util.FastSet;
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
+import java.util.Iterator;
+
/**
* A view which does not iterate twice over the same elements.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/FilteredCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/FilteredCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/FilteredCollectionImpl.java
index 8f1574c..e64f4c5 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/FilteredCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/FilteredCollectionImpl.java
@@ -8,12 +8,12 @@
*/
package javolution.util.internal.collection;
-import java.util.Iterator;
-
import javolution.util.function.Equality;
import javolution.util.function.Predicate;
import javolution.util.service.CollectionService;
+import java.util.Iterator;
+
/**
* A filtered view over a collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/MappedCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/MappedCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/MappedCollectionImpl.java
index 425b7b8..114bba4 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/MappedCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/MappedCollectionImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.collection;
-import java.util.Iterator;
-
import javolution.util.function.Equalities;
import javolution.util.function.Equality;
import javolution.util.function.Function;
import javolution.util.service.CollectionService;
+import java.util.Iterator;
+
/**
* A mapped view over a collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ParallelCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ParallelCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ParallelCollectionImpl.java
deleted file mode 100644
index 8056aed..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ParallelCollectionImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.util.internal.collection;
-
-import java.util.Iterator;
-
-import javolution.context.ConcurrentContext;
-import javolution.util.function.Consumer;
-import javolution.util.function.Equality;
-import javolution.util.service.CollectionService;
-
-/**
- * A parallel view over a collection.
- */
-public class ParallelCollectionImpl<E> extends CollectionView<E> {
-
- private static final long serialVersionUID = 0x600L; // Version.
-
- public ParallelCollectionImpl(CollectionService<E> target) {
- super(target);
- }
-
- @Override
- public boolean add(E e) {
- return target().add(e);
- }
-
- @Override
- public void clear() {
- target().clear();
- }
-
- @Override
- public Equality<? super E> comparator() {
- return target().comparator();
- }
-
- @Override
- public boolean contains(Object obj) {
- return target().contains(obj);
- }
-
- @Override
- public boolean isEmpty() {
- return target().isEmpty();
- }
-
- @Override
- public Iterator<E> iterator() {
- return target().iterator();
- }
-
- @Override
- public void perform(final Consumer<CollectionService<E>> action,
- CollectionService<E> view) {
- ConcurrentContext ctx = ConcurrentContext.enter();
- try {
- int concurrency = ctx.getConcurrency();
- CollectionService<E>[] subViews = view.split(concurrency + 1, false);
- for (int i = 1; i < subViews.length; i++) {
- final CollectionService<E> subView = subViews[i];
- ctx.execute(new Runnable() {
- @Override
- public void run() {
- target().perform(action, subView);
- }
- });
- }
- target().perform(action, subViews[0]); // This thread works too !
- } finally {
- // Any exception raised during parallel iterations will be re-raised here.
- ctx.exit();
- }
- }
-
- @Override
- public boolean remove(Object obj) {
- return target().remove(obj);
- }
-
- @Override
- public int size() {
- return target().size();
- }
-
- @Override
- public CollectionService<E>[] split(int n, boolean threadsafe) {
- return target().split(n, threadsafe); // Forwards.
- }
-
- @Override
- public void update(final Consumer<CollectionService<E>> action,
- CollectionService<E> view) {
- ConcurrentContext ctx = ConcurrentContext.enter();
- try {
- int concurrency = ctx.getConcurrency();
- CollectionService<E>[] subViews = view.split(concurrency + 1, true);
- for (int i = 1; i < subViews.length; i++) {
- final CollectionService<E> subView = subViews[i];
- ctx.execute(new Runnable() {
- @Override
- public void run() {
- target().update(action, subView);
- }
- });
- }
- target().perform(action, subViews[0]); // This thread works too !
- } finally {
- // Any exception raised during parallel iterations will be re-raised here.
- ctx.exit();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ReversedCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ReversedCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ReversedCollectionImpl.java
index 4eef132..edb5b1d 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ReversedCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/ReversedCollectionImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.collection;
-import java.util.Iterator;
-
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
+import java.util.Iterator;
+
/**
* A reversed view over a collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SequentialCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SequentialCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SequentialCollectionImpl.java
index 5b7ff6f..0623bfe 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SequentialCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SequentialCollectionImpl.java
@@ -8,12 +8,12 @@
*/
package javolution.util.internal.collection;
-import java.util.Iterator;
-
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
+import java.util.Iterator;
+
/**
* A sequential view over a collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SharedCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SharedCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SharedCollectionImpl.java
index 74ff05c..689fa5c 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SharedCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SharedCollectionImpl.java
@@ -8,14 +8,14 @@
*/
package javolution.util.internal.collection;
-import java.util.Collection;
-import java.util.Iterator;
-
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.internal.ReadWriteLockImpl;
import javolution.util.service.CollectionService;
+import java.util.Collection;
+import java.util.Iterator;
+
/**
* A shared view over a collection (reads-write locks).
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SortedCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SortedCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SortedCollectionImpl.java
index 6f35d53..9c04c9c 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SortedCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/SortedCollectionImpl.java
@@ -8,14 +8,14 @@
*/
package javolution.util.internal.collection;
-import java.util.Comparator;
-import java.util.Iterator;
-
import javolution.util.FastTable;
import javolution.util.function.Equality;
import javolution.util.internal.comparator.WrapperComparatorImpl;
import javolution.util.service.CollectionService;
+import java.util.Comparator;
+import java.util.Iterator;
+
/**
* A sorted view over a collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/UnmodifiableCollectionImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/UnmodifiableCollectionImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/UnmodifiableCollectionImpl.java
index d6b0481..be13365 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/UnmodifiableCollectionImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/collection/UnmodifiableCollectionImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.collection;
-import java.util.Iterator;
-
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
+import java.util.Iterator;
+
/**
* An unmodifiable view over a collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/comparator/WrapperComparatorImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/comparator/WrapperComparatorImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/comparator/WrapperComparatorImpl.java
index 5578107..e5f0b51 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/comparator/WrapperComparatorImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/comparator/WrapperComparatorImpl.java
@@ -8,10 +8,10 @@
*/
package javolution.util.internal.comparator;
-import java.util.Comparator;
-
import javolution.util.function.Equality;
+import java.util.Comparator;
+
/**
* A comparator service wrapping a {@ link Comparator}, since
* consistency with hashcode cannot be maintained. The hashcode
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/AtomicMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/AtomicMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/AtomicMapImpl.java
index 988b677..3c097ee 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/AtomicMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/AtomicMapImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.map;
-import java.util.Iterator;
-import java.util.Map;
-
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.service.MapService;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* An atomic view over a map (copy-on-write).
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/FastMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/FastMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/FastMapImpl.java
index 7676647..8e13e89 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/FastMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/FastMapImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.map;
+import javolution.util.function.Equality;
+
import java.util.Iterator;
import java.util.NoSuchElementException;
-import javolution.util.function.Equality;
-
/**
* The default {@link javolution.util.FastMap FastMap} implementation
* based on {@link FractalMapImpl fractal maps}.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/MapView.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/MapView.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/MapView.java
index 6ec0238..f957c55 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/MapView.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/MapView.java
@@ -8,10 +8,6 @@
*/
package javolution.util.internal.map;
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.Map;
-
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.function.Function;
@@ -22,6 +18,10 @@ import javolution.util.service.CollectionService;
import javolution.util.service.MapService;
import javolution.util.service.SetService;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* Map view implementation; can be used as root class for implementations
* if target is {@code null}.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/ParallelMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/ParallelMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/ParallelMapImpl.java
deleted file mode 100644
index 21d079e..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/ParallelMapImpl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.util.internal.map;
-
-import java.util.Iterator;
-
-import javolution.context.ConcurrentContext;
-import javolution.util.function.Consumer;
-import javolution.util.function.Equality;
-import javolution.util.service.MapService;
-
-/**
- * A parallel view over a map.
- */
-public class ParallelMapImpl<K, V> extends MapView<K, V> {
-
- private static final long serialVersionUID = 0x600L; // Version.
-
- public ParallelMapImpl(MapService<K, V> target) {
- super(target);
- }
-
- @Override
- public void clear() {
- target().clear();
- }
-
- @Override
- public boolean containsKey(Object key) {
- return target().containsKey(key);
- }
-
- @Override
- public V get(Object key) {
- return target().get(key);
- }
-
- @Override
- public boolean isEmpty() {
- return target().isEmpty();
- }
-
- @Override
- public Iterator<java.util.Map.Entry<K, V>> iterator() {
- return target().iterator();
- }
-
- @Override
- public Equality<? super K> keyComparator() {
- return target().keyComparator();
- }
-
- @Override
- public void perform(final Consumer<MapService<K, V>> action,
- MapService<K, V> view) {
- ConcurrentContext ctx = ConcurrentContext.enter();
- try {
- int concurrency = ctx.getConcurrency();
- MapService<K, V>[] subViews = view.split(concurrency + 1, false);
- for (int i = 1; i < subViews.length; i++) {
- final MapService<K, V> subView = subViews[i];
- ctx.execute(new Runnable() {
- @Override
- public void run() {
- target().perform(action, subView);
- }
- });
- }
- target().perform(action, subViews[0]); // This thread works too !
- } finally {
- // Any exception raised during parallel iterations will be re-raised here.
- ctx.exit();
- }
- }
-
- @Override
- public V put(K key, V value) {
- return target().put(key, value);
- }
-
- @Override
- public V remove(Object key) {
- return target().remove(key);
- }
-
- @Override
- public int size() {
- return target().size();
- }
-
- @Override
- public void update(final Consumer<MapService<K, V>> action,
- MapService<K, V> view) {
- ConcurrentContext ctx = ConcurrentContext.enter();
- try {
- int concurrency = ctx.getConcurrency();
- MapService<K, V>[] subViews = view.split(concurrency + 1, true);
- for (int i = 1; i < subViews.length; i++) {
- final MapService<K, V> subView = subViews[i];
- ctx.execute(new Runnable() {
- @Override
- public void run() {
- target().update(action, subView);
- }
- });
- }
- target().perform(action, subViews[0]); // This thread works too !
- } finally {
- // Any exception raised during parallel iterations will be re-raised here.
- ctx.exit();
- }
- }
-
- @Override
- public Equality<? super V> valueComparator() {
- return target().valueComparator();
- }
-
- @Override
- public MapService<K, V>[] split(int n, boolean threadsafe) {
- return target().split(n, threadsafe); // Forwards.
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SequentialMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SequentialMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SequentialMapImpl.java
index 114a884..86b9f40 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SequentialMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SequentialMapImpl.java
@@ -8,12 +8,12 @@
*/
package javolution.util.internal.map;
-import java.util.Iterator;
-
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.service.MapService;
+import java.util.Iterator;
+
/**
* A sequential view over a map.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SharedMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SharedMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SharedMapImpl.java
index 833e728..1df80ac 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SharedMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/SharedMapImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.map;
-import java.util.Iterator;
-import java.util.Map;
-
import javolution.util.function.Equality;
import javolution.util.internal.ReadWriteLockImpl;
import javolution.util.service.MapService;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* A shared view over a map.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/UnmodifiableMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/UnmodifiableMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/UnmodifiableMapImpl.java
index 196e9cc..c448166 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/UnmodifiableMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/UnmodifiableMapImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.map;
-import java.util.Iterator;
-
import javolution.util.function.Equality;
import javolution.util.service.MapService;
+import java.util.Iterator;
+
/**
* * An unmodifiable view over a map.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/AtomicSortedMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/AtomicSortedMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/AtomicSortedMapImpl.java
index c26c500..5cc4839 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/AtomicSortedMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/AtomicSortedMapImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.map.sorted;
-import java.util.Comparator;
-import java.util.Map;
-
import javolution.util.internal.map.AtomicMapImpl;
import javolution.util.service.SortedMapService;
import javolution.util.service.SortedSetService;
+import java.util.Comparator;
+import java.util.Map;
+
/**
* An atomic view over a sorted map (copy-on-write).
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/FastSortedMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/FastSortedMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/FastSortedMapImpl.java
index 111bc1d..f30cc49 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/FastSortedMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/FastSortedMapImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.map.sorted;
-import java.util.Iterator;
-
import javolution.util.function.Equality;
import javolution.util.internal.table.sorted.FastSortedTableImpl;
+import java.util.Iterator;
+
/**
* A map view over a sorted table of entries.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SharedSortedMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SharedSortedMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SharedSortedMapImpl.java
index fecc094..9d1df7d 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SharedSortedMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SharedSortedMapImpl.java
@@ -8,14 +8,14 @@
*/
package javolution.util.internal.map.sorted;
-import java.util.Comparator;
-import java.util.Map;
-
import javolution.util.internal.ReadWriteLockImpl;
import javolution.util.internal.map.SharedMapImpl;
import javolution.util.service.SortedMapService;
import javolution.util.service.SortedSetService;
+import java.util.Comparator;
+import java.util.Map;
+
/**
* A shared view over a sorted map.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SortedMapView.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SortedMapView.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SortedMapView.java
index bb51d56..bd7e54f 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SortedMapView.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SortedMapView.java
@@ -8,14 +8,14 @@
*/
package javolution.util.internal.map.sorted;
-import java.util.Comparator;
-import java.util.Map;
-
import javolution.util.internal.map.MapView;
import javolution.util.internal.set.sorted.SubSortedSetImpl;
import javolution.util.service.SortedMapService;
import javolution.util.service.SortedSetService;
+import java.util.Comparator;
+import java.util.Map;
+
/**
* Sorted map view implementation; can be used as root class for implementations
* if target is {@code null}.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SubSortedMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SubSortedMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SubSortedMapImpl.java
index 59e4cbd..481e653 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SubSortedMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/SubSortedMapImpl.java
@@ -8,12 +8,12 @@
*/
package javolution.util.internal.map.sorted;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
import javolution.util.function.Equality;
import javolution.util.service.SortedMapService;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
/**
* A view over a portion of a sorted map.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/UnmodifiableSortedMapImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/UnmodifiableSortedMapImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/UnmodifiableSortedMapImpl.java
index 60db2b2..fc80711 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/UnmodifiableSortedMapImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/map/sorted/UnmodifiableSortedMapImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.map.sorted;
-import java.util.Comparator;
-import java.util.Map;
-
import javolution.util.internal.map.UnmodifiableMapImpl;
import javolution.util.service.SortedMapService;
import javolution.util.service.SortedSetService;
+import java.util.Comparator;
+import java.util.Map;
+
/**
* * An unmodifiable view over a map.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/set/sorted/SubSortedSetImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/set/sorted/SubSortedSetImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/set/sorted/SubSortedSetImpl.java
index 3673004..d44ca86 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/set/sorted/SubSortedSetImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/set/sorted/SubSortedSetImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.set.sorted;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
import javolution.util.service.SortedSetService;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
/**
* A view over a portion of a sorted set.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/AtomicTableImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/AtomicTableImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/AtomicTableImpl.java
index 056c149..4ed8926 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/AtomicTableImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/AtomicTableImpl.java
@@ -8,13 +8,13 @@
*/
package javolution.util.internal.table;
+import javolution.util.internal.collection.AtomicCollectionImpl;
+import javolution.util.service.TableService;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.ListIterator;
-import javolution.util.internal.collection.AtomicCollectionImpl;
-import javolution.util.service.TableService;
-
/**
* An atomic view over a table.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/FastTableImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/FastTableImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/FastTableImpl.java
index 070da4d..dc92d09 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/FastTableImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/FastTableImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.table;
+import javolution.util.function.Equality;
+
import java.util.Iterator;
import java.util.NoSuchElementException;
-import javolution.util.function.Equality;
-
/**
* The default {@link javolution.util.FastTable FastTable} implementation
* based on {@link FractalTableImpl fractal tables}. The memory footprint
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/QuickSort.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/QuickSort.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/QuickSort.java
index 13cf342..4bfd9f8 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/QuickSort.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/QuickSort.java
@@ -8,10 +8,10 @@
*/
package javolution.util.internal.table;
-import java.util.Comparator;
-
import javolution.util.service.TableService;
+import java.util.Comparator;
+
/**
* A quick sort utility class.
* From Wikipedia Quick Sort - http://en.wikipedia.org/wiki/Quicksort
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/SharedTableImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/SharedTableImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/SharedTableImpl.java
index bc68a16..4f77098 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/SharedTableImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/SharedTableImpl.java
@@ -8,14 +8,14 @@
*/
package javolution.util.internal.table;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ListIterator;
-
import javolution.util.internal.ReadWriteLockImpl;
import javolution.util.internal.collection.SharedCollectionImpl;
import javolution.util.service.TableService;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+
/**
* A shared view over a table allowing concurrent access and sequential updates.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableIteratorImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableIteratorImpl.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableIteratorImpl.java
index 913e9a0..b280181 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableIteratorImpl.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableIteratorImpl.java
@@ -8,11 +8,11 @@
*/
package javolution.util.internal.table;
+import javolution.util.service.TableService;
+
import java.util.ListIterator;
import java.util.NoSuchElementException;
-import javolution.util.service.TableService;
-
/**
* A generic iterator over a table.
*/
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableView.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableView.java b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableView.java
index eaa8a4d..e377755 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableView.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/internal/table/TableView.java
@@ -8,15 +8,15 @@
*/
package javolution.util.internal.table;
+import javolution.util.function.Equality;
+import javolution.util.internal.collection.CollectionView;
+import javolution.util.service.TableService;
+
import java.util.Collection;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
-import javolution.util.function.Equality;
-import javolution.util.internal.collection.CollectionView;
-import javolution.util.service.TableService;
-
/**
* Table view implementation; can be used as root class for implementations
* if target is {@code null}.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/service/BitSetService.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/service/BitSetService.java b/commons/marmotta-commons/src/ext/java/javolution/util/service/BitSetService.java
deleted file mode 100644
index 6c45891..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/util/service/BitSetService.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.util.service;
-
-import javolution.util.FastBitSet;
-import javolution.util.FastTable;
-import javolution.util.Index;
-
-/**
- * The set of related functionalities which can be used/reused to
- * implement bit-sets collections.
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 6.0, July 21, 2013
- * @see FastTable
- */
-public interface BitSetService extends SetService<Index> {
-
- //
- // Read Accessors.
- //
-
- /** See {@link FastBitSet#cardinality() } */
- int cardinality();
-
- /** See {@link FastBitSet#get(int) } */
- boolean get(int bitIndex);
-
- /** See {@link FastBitSet#get(int, int) } */
- BitSetService get(int fromIndex, int toIndex);
-
- /** See {@link FastBitSet#intersects(FastBitSet) } */
- boolean intersects(BitSetService that);
-
- /** See {@link FastBitSet#length() } */
- int length();
-
- //
- // Iterations
- //
-
- /** See {@link FastBitSet#nextClearBit(int) } */
- int nextClearBit(int fromIndex);
-
- /** See {@link FastBitSet#nextSetBit(int) } */
- int nextSetBit(int fromIndex);
-
- /** See {@link FastBitSet#previousClearBit(int) } */
- int previousClearBit(int fromIndex);
-
- /** See {@link FastBitSet#previousSetBit(int) } */
- int previousSetBit(int fromIndex);
-
- //
- // Clear/Set/Flip Operations
- //
-
- /** See {@link FastBitSet#clear(int) } */
- void clear(int bitIndex);
-
- /** See {@link FastBitSet#clear(int, int) } */
- void clear(int fromIndex, int toIndex);
-
- /** Clear or sets the specified bit, returns <code>true</code>
- * if previously set; <code>false</code> otherwise. */
- boolean getAndSet(int bitIndex, boolean value);
-
- /** See {@link FastBitSet#set(int) } */
- void set(int bitIndex);
-
- /** See {@link FastBitSet#set(int, boolean) } */
- void set(int bitIndex, boolean value);
-
- /** See {@link FastBitSet#set(int, int) } */
- void set(int fromIndex, int toIndex);
-
- /** See {@link FastBitSet#set(int, int, boolean) } */
- void set(int fromIndex, int toIndex, boolean value);
-
- /** See {@link FastBitSet#flip(int) } */
- void flip(int bitIndex);
-
- /** See {@link FastBitSet#flip(int, int) } */
- void flip(int fromIndex, int toIndex);
-
- //
- // Operators Operations
- //
-
- /** See {@link FastBitSet#and(FastBitSet) } */
- void and(BitSetService that);
-
- /** See {@link FastBitSet#andNot(FastBitSet) } */
- void andNot(BitSetService that);
-
- /** See {@link FastBitSet#or(FastBitSet) } */
- void or(BitSetService that);
-
- /** See {@link FastBitSet#xor(FastBitSet) } */
- void xor(BitSetService that);
-
- //
- // Misc.
- //
-
- /** Returns the minimal length <code>long[]</code> representation of this
- * bitset. */
- long[] toLongArray();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/service/CollectionService.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/service/CollectionService.java b/commons/marmotta-commons/src/ext/java/javolution/util/service/CollectionService.java
index 37dbb8a..f4664a8 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/service/CollectionService.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/service/CollectionService.java
@@ -8,12 +8,12 @@
*/
package javolution.util.service;
-import java.io.Serializable;
-import java.util.Collection;
-
import javolution.util.function.Equality;
import javolution.util.function.Splittable;
+import java.io.Serializable;
+import java.util.Collection;
+
/**
* The fundamental set of related functionalities required to implement
* fast collections.
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/service/MapService.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/service/MapService.java b/commons/marmotta-commons/src/ext/java/javolution/util/service/MapService.java
index 20090a3..c4a8f91 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/service/MapService.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/service/MapService.java
@@ -8,14 +8,14 @@
*/
package javolution.util.service;
+import javolution.util.function.Equality;
+import javolution.util.function.Splittable;
+
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
-import javolution.util.function.Equality;
-import javolution.util.function.Splittable;
-
/**
* The set of related map functionalities required to implement fast maps.
*
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/util/service/TableService.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/util/service/TableService.java b/commons/marmotta-commons/src/ext/java/javolution/util/service/TableService.java
index 21af9d7..e338840 100644
--- a/commons/marmotta-commons/src/ext/java/javolution/util/service/TableService.java
+++ b/commons/marmotta-commons/src/ext/java/javolution/util/service/TableService.java
@@ -8,8 +8,8 @@
*/
package javolution.util.service;
-import java.util.List;
import java.util.Deque;
+import java.util.List;
import java.util.RandomAccess;
/**
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/DefaultXMLFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/DefaultXMLFormat.java b/commons/marmotta-commons/src/ext/java/javolution/xml/DefaultXMLFormat.java
deleted file mode 100644
index f4e894e..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/DefaultXMLFormat.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-
-/**
- * <p> Specifies the default xml format of a class (for xml serialization/deserialization).
- * The default format is used by the {@link javolution.xml.XMLObjectReader}
- * and {@link javolution.xml.XMLObjectWriter} classes. It can be locally overridden
- * in the scope of a {@link javolution.xml.XMLContext XMLContext}.</p>
- *
- * [code]
- * @DefaultXMLFormat(Complex.XML.class)
- * public class Complex {
- * public Complex(double real, double imaginary) { ... }
- * public double getReal() { ... }
- * public double getImaginary() { ... }
- * public static class XML extends XMLFormat<Complex> {
- * public Complex newInstance(Class<? extends Complex> cls, InputElement xml) throws XMLStreamException {
- * return new Complex(xml.getAttribute("real", 0.0), xml.getAttribute("imaginary", 0.0));
- * }
- * public void read(InputElement xml, Complex c) throws XMLStreamException {
- * // Immutable object, no further processing.
- * }
- * public void write(Complex c, OutputElement xml) throws XMLStreamException {
- * xml.setAttribute("real", c.getReal());
- * xml.setAttribute("imaginary", c.getImaginary());
- * }
- * };
- * }[/code]
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 6.0, July 21, 2013
- */
-@Documented
-@Inherited
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface DefaultXMLFormat {
-
- /**
- * Returns the default xml format of the annotated class.
- */
- Class<? extends XMLFormat<?>> value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/QName.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/QName.java b/commons/marmotta-commons/src/ext/java/javolution/xml/QName.java
deleted file mode 100644
index 0b8298a..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/QName.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2007 - Javolution (http://javolution.org/)
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml;
-
-import java.io.ObjectStreamException;
-import java.lang.CharSequence;
-
-import javolution.lang.Immutable;
-import javolution.text.CharArray;
-import javolution.text.TextBuilder;
-import javolution.util.FastMap;
-import javolution.util.function.Equalities;
-
-/**
- * <p> This class represents unique identifiers for XML elements (tags) or
- * attributes (names).</p>
- *
- * <p> It should be noted that <code>QName.valueOf(null, "name")</code> and
- * <code>QName.valueOf("", "name")</code> are distinct; the first one has no
- * namespace associated with; whereas the second is associated
- * to the root namespace.</p>
- *
- * <p> {@link QName} have a textual representation ({@link CharSequence}) which
- * is either the local name (if no namespace URI) or
- * <code>{namespaceURI}localName</code> (otherwise).</p>
- *
- * @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 5.3, January 14, 2007
- * @see <a href="http://en.wikipedia.org/wiki/Qname">Wikipedia: QName</a>
- */
-public final class QName implements XMLSerializable, Immutable<QName>, CharSequence {
-
- /**
- * Holds the local name.
- */
- private transient final CharArray _localName;
-
- /**
- * Holds the namespace URI reference or <code>null</code> if none.
- */
- private transient final CharArray _namespaceURI;
-
- /**
- * Holds the string representation.
- */
- private final String _toString;
-
- /**
- * Holds the full name (String) to QName mapping.
- */
- private static final FastMap<CharSequence, QName> FULL_NAME_TO_QNAME = new FastMap<CharSequence, QName>(
- Equalities.LEXICAL);
-
- /**
- * Creates a qualified name having the specified local name and namespace
- * reference.
- *
- * @param namespaceURI the URI reference or <code>null</code> if none.
- * @param localName the local name.
- * @param toString the string representation.
- */
- private QName(String namespaceURI, String localName, String toString) {
- _namespaceURI = (namespaceURI == null) ? null : new CharArray(
- namespaceURI);
- _localName = new CharArray(localName);
- _toString = toString;
- }
-
- /**
- * Returns the qualified name corresponding to the specified character
- * sequence representation (may include the "{namespaceURI}" prefix).
- *
- * @param name the qualified name lexical representation.
- * @see #toString()
- */
- public static QName valueOf(CharSequence name) {
- QName qName = (QName) FULL_NAME_TO_QNAME.get(name);
- return (qName != null) ? qName : QName.createNoNamespace(name
- .toString());
- }
-
- private static QName createNoNamespace(String name) {
- String localName = name;
- String namespaceURI = null;
- if (name.length() > 0 && name.charAt(0) == '{') { // Namespace URI.
- int index = name.lastIndexOf('}');
- localName = name.substring(index + 1);
- namespaceURI = name.substring(1, index);
- }
- QName qName = new QName(namespaceURI, localName, name);
- synchronized (FULL_NAME_TO_QNAME) {
- QName tmp = (QName) FULL_NAME_TO_QNAME.putIfAbsent(name, qName);
- return tmp == null ? qName : tmp;
- }
- }
-
- /**
- * Equivalent to {@link #valueOf(CharSequence)} (for J2ME compatibility).
- *
- * @param name the qualified name lexical representation.
- * @see #toString()
- */
- public static QName valueOf(String name) {
- QName qName = (QName) FULL_NAME_TO_QNAME.get(name);
- return (qName != null) ? qName : QName.createNoNamespace(name);
- }
-
- /**
- * Returns the qualified name corresponding to the specified namespace URI
- * and local name.
- *
- * @param namespaceURI the URI reference or <code>null</code> if none.
- * @param localName the local name.
- * @see #toString()
- */
- public static QName valueOf(CharSequence namespaceURI,
- CharSequence localName) {
- if (namespaceURI == null)
- return QName.valueOf(localName);
- TextBuilder tmp = new TextBuilder();
- tmp.append('{');
- tmp.append(namespaceURI);
- tmp.append('}');
- tmp.append(localName);
- return QName.valueOf(tmp);
- }
-
- /**
- * Returns the local part of this qualified name or the full qualified
- * name if there is no namespace.
- *
- * @return the local name.
- */
- public CharSequence getLocalName() {
- return _localName;
- }
-
- /**
- * Returns the namespace URI of this qualified name or <code>null</code>
- * if none (the local name is then the full qualified name).
- *
- * @return the URI reference or <code>null</code>
- */
- public CharSequence getNamespaceURI() {
- return _namespaceURI;
- }
-
- /**
- * Instances of this class are unique; object's equality can be
- * replaced object identity (<code>==</code>).
- *
- * @return <code>this == obj</code>
- */
- public boolean equals(Object obj) {
- return this == obj;
- }
-
- /**
- * Returns the <code>String</code> representation of this qualified name.
- *
- * @return the textual representation.
- */
- public String toString() {
- return _toString;
- }
-
- /**
- * Returns the hash code for this qualified name.
- *
- * <p> Note: Returns the same hashCode as <code>java.lang.String</code>
- * (consistent with {@link #equals})</p>
- * @return the hash code value.
- */
- public int hashCode() {
- return _toString.hashCode();
- }
-
- /**
- * Returns the character at the specified index.
- *
- * @param index the index of the character starting at <code>0</code>.
- * @return the character at the specified index of this character sequence.
- * @throws IndexOutOfBoundsException if <code>((index < 0) ||
- * (index >= length))</code>
- */
- public char charAt(int index) {
- return _toString.charAt(index);
- }
-
- /**
- * Returns the length of this character sequence.
- *
- * @return the number of characters (16-bits Unicode) composing this
- * character sequence.
- */
- public int length() {
- return _toString.length();
- }
-
- /**
- * Returns a new character sequence that is a subsequence of this sequence.
- *
- * @param start the index of the first character inclusive.
- * @param end the index of the last character exclusive.
- * @return the character sequence starting at the specified
- * <code>start</code> position and ending just before the specified
- * <code>end</code> position.
- * @throws IndexOutOfBoundsException if {@code (start < 0) || (end < 0) ||
- * (start > end) || (end > this.length())}
- */
- public CharSequence subSequence(int start, int end) {
- return _toString.substring(start, end);
- }
-
- //Maintains unicity.
- private Object readResolve() throws ObjectStreamException {
- return QName.valueOf(_toString);
- }
-
- private static final long serialVersionUID = -6126031630693748647L;
-
- @Override
- public QName value() {
- return this;
- }
-
-}
\ No newline at end of file