# IGNITE-515 removed pcollection and romix.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c1f89b21 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c1f89b21 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c1f89b21 Branch: refs/heads/ignite-443 Commit: c1f89b2176f3d299a0a758b66ee4905d26240167 Parents: f08fe8b Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Mar 20 13:51:45 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Mar 20 13:51:45 2015 +0700 ---------------------------------------------------------------------- LICENSE.txt | 26 - NOTICE.txt | 11 - modules/core/pom.xml | 2 +- .../src/main/java/com/romix/scala/None.java | 27 - .../src/main/java/com/romix/scala/Option.java | 42 - .../src/main/java/com/romix/scala/Some.java | 38 - .../scala/collection/concurrent/BasicNode.java | 32 - .../scala/collection/concurrent/CNodeBase.java | 49 - .../romix/scala/collection/concurrent/Gen.java | 29 - .../scala/collection/concurrent/INodeBase.java | 47 - .../scala/collection/concurrent/ListMap.java | 247 --- .../scala/collection/concurrent/MainNode.java | 51 - .../romix/scala/collection/concurrent/Pair.java | 54 - .../scala/collection/concurrent/TrieMap.java | 1826 ------------------ .../java/org/pcollections/AmortizedPQueue.java | 156 -- .../main/java/org/pcollections/ConsPStack.java | 225 --- .../src/main/java/org/pcollections/Empty.java | 47 - .../main/java/org/pcollections/HashPMap.java | 175 -- .../java/org/pcollections/HashTreePBag.java | 47 - .../java/org/pcollections/HashTreePMap.java | 52 - .../java/org/pcollections/HashTreePSet.java | 46 - .../src/main/java/org/pcollections/IntTree.java | 320 --- .../main/java/org/pcollections/IntTreePMap.java | 165 -- .../src/main/java/org/pcollections/MapPBag.java | 143 -- .../src/main/java/org/pcollections/MapPSet.java | 101 - .../main/java/org/pcollections/OrderedPSet.java | 85 - .../src/main/java/org/pcollections/PBag.java | 23 - .../main/java/org/pcollections/PCollection.java | 56 - .../src/main/java/org/pcollections/PMap.java | 49 - .../main/java/org/pcollections/POrderedSet.java | 25 - .../src/main/java/org/pcollections/PQueue.java | 38 - .../main/java/org/pcollections/PSequence.java | 73 - .../src/main/java/org/pcollections/PSet.java | 23 - .../src/main/java/org/pcollections/PStack.java | 51 - .../src/main/java/org/pcollections/PVector.java | 45 - .../org/pcollections/SimpleImmutableEntry.java | 146 -- .../main/java/org/pcollections/TreePVector.java | 155 -- .../resources/META-INF/classnames.properties | 2 - .../GridImmutableCollectionsPerfomanceTest.java | 120 -- .../ignite/lang/utils/GridPCollectionsTest.java | 54 - .../ignite/lang/utils/GridTrieMapSelfTest.java | 242 --- pom.xml | 4 +- 42 files changed, 2 insertions(+), 5147 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/LICENSE.txt ---------------------------------------------------------------------- diff --git a/LICENSE.txt b/LICENSE.txt index 185cf44..623a7be 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -213,32 +213,6 @@ licenses. ============================================================================== -For the pcollections library (https://github.com/blackdrag/pcollections) -============================================================================== -The MIT License (MIT) - -Copyright (c) <year> <copyright holders> - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -============================================================================== For SnapTree: ============================================================================== BSD LICENSE http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/NOTICE.txt ---------------------------------------------------------------------- diff --git a/NOTICE.txt b/NOTICE.txt index 25d1463..7ca4e12 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -5,22 +5,11 @@ This product includes software developed at The Apache Software Foundation (http://www.apache.org/). -This software has a dependency on Java port of a concurrent trie hash -map implementation from the Scala collections library, licensed -under Apache License, Version 2.0. -https://github.com/romix/java-concurrent-hash-trie-map - - This software has a dependency on JetBrains Annotations licensed under Apache License, Version 2.0. http://search.maven.org/#artifactdetails%7Corg.jetbrains%7Cannotations%7C13.0%7Cjar -This software has a dependency on Persistent Collections library, -licensed under MIT license. -https://github.com/blackdrag/pcollections - - This software has a dependency on snaptree library, licensed under BSD 3-clause license. https://github.com/nbronson/snaptree/ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/pom.xml ---------------------------------------------------------------------- diff --git a/modules/core/pom.xml b/modules/core/pom.xml index bd374fd..a717792 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -214,7 +214,7 @@ # ]]> </argument> - <argument>org.apache.ignite:org.jdk8.backport:org.pcollections:com.romix.scala</argument> + <argument>org.apache.ignite:org.jdk8.backport</argument> </arguments> </configuration> </execution> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/None.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/None.java b/modules/core/src/main/java/com/romix/scala/None.java deleted file mode 100644 index 4f615f8..0000000 --- a/modules/core/src/main/java/com/romix/scala/None.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.romix.scala; - -/** - * Mimic None in Scala - * - * @param <V> - * @author Roman Levenstein <romix...@gmail.com> - */ -public class None<V> extends Option<V> { - -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/Option.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/Option.java b/modules/core/src/main/java/com/romix/scala/Option.java deleted file mode 100644 index c40c18a..0000000 --- a/modules/core/src/main/java/com/romix/scala/Option.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package com.romix.scala; - -/** - * Mimic Option in Scala - * - * @param <V> - * @author Roman Levenstein <romix...@gmail.com> - */ -@SuppressWarnings({"rawtypes", "unchecked"}) -public class Option<V> { - static None none = new None(); - - public static <V> Option<V> makeOption(V o) { - if (o != null) - return new Some<V>(o); - else - return (Option<V>) none; - } - - public static <V> Option<V> makeOption() { - return (Option<V>) none; - } - - public boolean nonEmpty() { - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/Some.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/Some.java b/modules/core/src/main/java/com/romix/scala/Some.java deleted file mode 100644 index bc1f47f..0000000 --- a/modules/core/src/main/java/com/romix/scala/Some.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package com.romix.scala; - -/** - * Mimic Some in Scala - * - * @param <V> - * @author Roman Levenstein <romix...@gmail.com> - */ -public class Some<V> extends Option<V> { - final V value; - - public Some(V v) { - value = v; - } - - public V get() { - return value; - } - - public boolean nonEmpty() { - return value != null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/BasicNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/BasicNode.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/BasicNode.java deleted file mode 100644 index 84a926e..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/BasicNode.java +++ /dev/null @@ -1,32 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2012, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.romix.scala.collection.concurrent; - - -abstract class BasicNode { - - public abstract String string(int lev); - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/CNodeBase.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/CNodeBase.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/CNodeBase.java deleted file mode 100644 index a5aa66f..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/CNodeBase.java +++ /dev/null @@ -1,49 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2012, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.romix.scala.collection.concurrent; - - -import java.util.concurrent.atomic.*; - - -abstract class CNodeBase<K, V> extends MainNode<K, V> { - - public static final AtomicIntegerFieldUpdater<CNodeBase> updater = AtomicIntegerFieldUpdater.newUpdater(CNodeBase.class, "csize"); - - public volatile int csize = -1; - - public boolean CAS_SIZE(int oldval, int nval) { - return updater.compareAndSet(this, oldval, nval); - } - - public void WRITE_SIZE(int nval) { - updater.set(this, nval); - } - - public int READ_SIZE() { - return updater.get(this); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/Gen.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/Gen.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/Gen.java deleted file mode 100644 index 0b2af3c..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/Gen.java +++ /dev/null @@ -1,29 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2012, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.romix.scala.collection.concurrent; - - -final class Gen { -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/INodeBase.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/INodeBase.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/INodeBase.java deleted file mode 100644 index c7e39c9..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/INodeBase.java +++ /dev/null @@ -1,47 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2012, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.romix.scala.collection.concurrent; - - -import java.util.concurrent.atomic.*; - - -abstract class INodeBase<K, V> extends BasicNode { - - public static final AtomicReferenceFieldUpdater<INodeBase, MainNode> updater = AtomicReferenceFieldUpdater.newUpdater(INodeBase.class, MainNode.class, "mainnode"); - - public static final Object RESTART = new Object(); - public final Gen gen; - public volatile MainNode<K, V> mainnode = null; - - public INodeBase(Gen generation) { - gen = generation; - } - - public BasicNode prev() { - return null; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/ListMap.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/ListMap.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/ListMap.java deleted file mode 100644 index b277658..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/ListMap.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package com.romix.scala.collection.concurrent; - -import com.romix.scala.*; - -import java.util.*; -import java.util.Map.*; - -/** - * Mimic immutable ListMap in Scala - * - * @param <V> - * @author Roman Levenstein <romix...@gmail.com> - */ -abstract class ListMap<K, V> { - - ListMap<K, V> next; - - static <K, V> ListMap<K, V> map(K k, V v, ListMap<K, V> tail) { - return new Node<K, V>(k, v, tail); - } - - static <K, V> ListMap<K, V> map(K k, V v) { - return new Node<K, V>(k, v, null); - } - - static <K, V> ListMap<K, V> map(K k1, V v1, K k2, V v2) { - return new Node<K, V>(k1, v1, new Node<K, V>(k2, v2, null)); - } - - public abstract int size(); - - public abstract boolean isEmpty(); - - abstract public boolean contains(K k, V v); - - abstract public boolean contains(K key); - - abstract public Option<V> get(K key); - - abstract public ListMap<K, V> add(K key, V value); - - abstract public ListMap<K, V> remove(K key); - - abstract public Iterator<Entry<K, V>> iterator(); - - - static class EmptyListMap<K, V> extends ListMap<K, V> { - public ListMap<K, V> add(K key, V value) { - return ListMap.map(key, value, null); - } - - public boolean contains(K k, V v) { - return false; - } - - public boolean contains(K k) { - return false; - } - - public ListMap<K, V> remove(K key) { - return this; - } - - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return true; - } - - @Override - public Option<V> get(K key) { - return Option.makeOption(null); - } - - @Override - public Iterator<Entry<K, V>> iterator() { - return new EmptyListMapIterator<K, V>(); - } - - static class EmptyListMapIterator<K, V> implements Iterator<Entry<K, V>> { - - @Override - public boolean hasNext() { - return false; - } - - @Override - public Entry<K, V> next() { - return null; - } - - @Override - public void remove() { - throw new RuntimeException("Operation not supported"); - } - - } - } - - static class Node<K, V> extends ListMap<K, V> { - final K k; - final V v; - - Node(K k, V v, ListMap<K, V> next) { - this.k = k; - this.v = v; - this.next = next; - } - - public ListMap<K, V> add(K key, V value) { - return ListMap.map(key, value, remove(key)); - } - - public boolean contains(K k, V v) { - if (k.equals(this.k) && v.equals(this.v)) - return true; - else if (next != null) - return next.contains(k, v); - return false; - } - - public boolean contains(K k) { - if (k.equals(this.k)) - return true; - else if (next != null) - return next.contains(k); - return false; - } - - public ListMap<K, V> remove(K key) { - if (!contains(key)) - return this; - else - return remove0(key); - } - - private ListMap<K, V> remove0(K key) { - ListMap<K, V> n = this; - ListMap<K, V> newN = null; - ListMap<K, V> lastN = null; - while (n != null) { - if (n instanceof EmptyListMap) { - newN.next = n; - break; - } - Node<K, V> nn = (Node<K, V>) n; - if (key.equals(nn.k)) { - n = n.next; - continue; - } - else { - if (newN != null) { - lastN.next = ListMap.map(nn.k, nn.v, null); - lastN = lastN.next; - } - else { - newN = ListMap.map(nn.k, nn.v, null); - lastN = newN; - } - } - n = n.next; - } - return newN; - } - - @Override - public int size() { - if (next == null) - return 1; - else - return 1 + next.size(); - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public Option<V> get(K key) { - if (key.equals(k)) - return Option.makeOption(v); - if (next != null) - return next.get(key); - return Option.makeOption(null); - } - - - @Override - public Iterator<Entry<K, V>> iterator() { - return new NodeIterator<K, V>(this); - } - - static class NodeIterator<K, V> implements Iterator<Entry<K, V>> { - ListMap<K, V> n; - - public NodeIterator(Node<K, V> n) { - this.n = n; - } - - @Override - public boolean hasNext() { -// return n!= null && n.next != null && !(n.next instanceof EmptyListMap); - return n != null && !(n instanceof EmptyListMap); - } - - @Override - public Entry<K, V> next() { - if (n instanceof Node) { - Node<K, V> nn = (Node<K, V>) n; - Pair<K, V> res = new Pair<K, V>(nn.k, nn.v); - n = n.next; - return res; - } - else { - return null; - } - } - - @Override - public void remove() { - throw new RuntimeException("Operation not supported"); - } - - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/MainNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/MainNode.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/MainNode.java deleted file mode 100644 index 24e7ce5..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/MainNode.java +++ /dev/null @@ -1,51 +0,0 @@ -/* __ *\ - ** ________ ___ / / ___ Scala API ** - ** / __/ __// _ | / / / _ | (c) 2003-2012, LAMP/EPFL ** - ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** - ** /____/\___/_/ |_/____/_/ | | ** - ** |/ ** -\* */ - -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package com.romix.scala.collection.concurrent; - -import java.util.concurrent.atomic.*; - -abstract class MainNode<K, V> extends BasicNode { - - public static final AtomicReferenceFieldUpdater<MainNode, MainNode> updater = AtomicReferenceFieldUpdater.newUpdater(MainNode.class, MainNode.class, "prev"); - - public volatile MainNode<K, V> prev = null; - - public abstract int cachedSize(Object ct); - - public boolean CAS_PREV(MainNode<K, V> oldval, MainNode<K, V> nval) { - return updater.compareAndSet(this, oldval, nval); - } - - public void WRITE_PREV(MainNode<K, V> nval) { - updater.set(this, nval); - } - - // do we need this? unclear in the javadocs... - // apparently not - volatile reads are supposed to be safe - // regardless of whether there are concurrent ARFU updates - public MainNode<K, V> READ_PREV() { - return updater.get(this); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1f89b21/modules/core/src/main/java/com/romix/scala/collection/concurrent/Pair.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/com/romix/scala/collection/concurrent/Pair.java b/modules/core/src/main/java/com/romix/scala/collection/concurrent/Pair.java deleted file mode 100644 index 40ebfbb..0000000 --- a/modules/core/src/main/java/com/romix/scala/collection/concurrent/Pair.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) Roman Levenstein. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package com.romix.scala.collection.concurrent; - -import java.util.*; - -/** - * Helper class simulating a tuple of 2 elements in Scala - * - * @param <K> - * @param <V> - * @author Roman Levenstein <romix...@gmail.com> - */ -public class Pair<K, V> implements Map.Entry<K, V> { - - final K k; - final V v; - - Pair(K k, V v) { - this.k = k; - this.v = v; - } - - @Override - public K getKey() { - // TODO Auto-generated method stub - return k; - } - - @Override - public V getValue() { - // TODO Auto-generated method stub - return v; - } - - @Override - public V setValue(V value) { - throw new RuntimeException("Operation not supported"); - } - -}