Skip to content

Commit 90f7450

Browse files
committed
Merge branch 'heterogeneous'
2 parents 062f6bd + d3c6793 commit 90f7450

File tree

122 files changed

+830633
-1115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+830633
-1115
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ node {
1717
sh "mvn -B clean install"
1818

1919
stage 'Deploy'
20-
sh "mvn -s ${env.HOME}/usethesource-maven-settings.xml -B deploy"
20+
sh "mvn -s ${env.HOME}/usethesource-maven-settings.xml -B deploy -DskipTests"
2121

2222
stage 'Archive'
2323
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true])

capsule-core/capsule-core.iml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
4+
<output url="file://$MODULE_DIR$/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
6+
<content url="file://$MODULE_DIR$">
7+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9+
<excludeFolder url="file://$MODULE_DIR$/target" />
10+
</content>
11+
<orderEntry type="inheritedJdk" />
12+
<orderEntry type="sourceFolder" forTests="false" />
13+
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
14+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15+
</component>
16+
</module>

capsule-core/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>io.usethesource</groupId>
8+
<artifactId>capsule-pom-parent</artifactId>
9+
<version>0.3.0.HETEROGENEOUS-SNAPSHOT</version>
10+
</parent>
11+
12+
<groupId>io.usethesource</groupId>
13+
<artifactId>capsule</artifactId>
14+
<version>0.3.0.HETEROGENEOUS-SNAPSHOT</version>
15+
<packaging>jar</packaging>
16+
17+
<properties>
18+
<topleveldir>${project.parent.basedir}</topleveldir>
19+
</properties>
20+
21+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
3+
* All rights reserved.
4+
*
5+
* This file is licensed under the BSD 2-Clause License, which accompanies this project
6+
* and is available under https://opensource.org/licenses/BSD-2-Clause.
7+
*/
8+
package io.usethesource.capsule;
9+
10+
public interface BinaryRelation<T, U> extends SetMultimap<T, U> {
11+
12+
BinaryRelation<U, T> inverse();
13+
14+
SetMultimap<T, U> toSetMultimap();
15+
16+
interface Immutable<K, V> extends BinaryRelation<K, V>, SetMultimap.Immutable<K, V> {
17+
18+
@Override
19+
boolean isTransientSupported();
20+
21+
@Override
22+
BinaryRelation.Transient<K, V> asTransient();
23+
24+
}
25+
26+
interface Transient<K, V> extends BinaryRelation<K, V>, SetMultimap.Transient<K, V> {
27+
28+
@Override
29+
BinaryRelation.Immutable<K, V> freeze();
30+
31+
}
32+
33+
}
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
/**
2+
* Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
3+
* All rights reserved.
4+
*
5+
* This file is licensed under the BSD 2-Clause License, which accompanies this project
6+
* and is available under https://opensource.org/licenses/BSD-2-Clause.
7+
*/
8+
package io.usethesource.capsule;
9+
10+
import java.util.Iterator;
11+
12+
import io.usethesource.capsule.core.PersistentTrieMap;
13+
14+
public interface Map<K, V> extends java.util.Map<K, V>, MapEq<K, V> {
15+
16+
@Override
17+
int size();
18+
19+
@Override
20+
boolean isEmpty();
21+
22+
@Override
23+
boolean containsKey(final Object o);
24+
25+
@Override
26+
boolean containsValue(final Object o);
27+
28+
@Override
29+
V get(final Object o);
30+
31+
Iterator<K> keyIterator();
32+
33+
Iterator<V> valueIterator();
34+
35+
Iterator<Entry<K, V>> entryIterator();
36+
37+
interface Immutable<K, V> extends Map<K, V>, MapEq.Immutable<K, V> {
38+
39+
Map.Immutable<K, V> __put(final K key, final V val);
40+
41+
Map.Immutable<K, V> __remove(final K key);
42+
43+
Map.Immutable<K, V> __putAll(final java.util.Map<? extends K, ? extends V> map);
44+
45+
boolean isTransientSupported();
46+
47+
Map.Transient<K, V> asTransient();
48+
49+
static <K, V> Map.Immutable<K, V> of() {
50+
return PersistentTrieMap.of();
51+
}
52+
53+
static <K, V> Map.Immutable<K, V> of(K key, V value) {
54+
return PersistentTrieMap.of(key, value);
55+
}
56+
57+
static <K, V> Map.Immutable<K, V> of(K key0, V value0, K key1, V value1) {
58+
return PersistentTrieMap.of(key0, value0, key1, value1);
59+
}
60+
61+
}
62+
63+
interface Transient<K, V> extends Map<K, V>, MapEq.Transient<K, V> {
64+
65+
V __put(final K key, final V val);
66+
67+
V __remove(final K key);
68+
69+
boolean __putAll(final java.util.Map<? extends K, ? extends V> map);
70+
71+
// default boolean union(final Map<? extends K, ? extends V> map) {
72+
// boolean modified = false;
73+
//
74+
// for (java.util.Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
75+
// // NOTE: does only work when map does not support `null` values
76+
// if (this.__put(entry.getKey(), entry.getValue()) != null) {
77+
// modified |= true;
78+
// }
79+
// }
80+
//
81+
// return modified;
82+
// }
83+
//
84+
// default boolean intersect(final Map<? extends K, ? extends V> map) {
85+
// throw new UnsupportedOperationException("Not yet implemented @ Map.");
86+
// }
87+
//
88+
// default boolean complement(final Map<? extends K, ? extends V> map) {
89+
// throw new UnsupportedOperationException("Not yet implemented @ Map");
90+
// }
91+
92+
Map.Immutable<K, V> freeze();
93+
94+
static <K, V> Map.Transient<K, V> of() {
95+
return PersistentTrieMap.transientOf();
96+
}
97+
98+
static <K, V> Map.Transient<K, V> of(K key0, V value0) {
99+
final Map.Transient<K, V> tmp = Map.Transient.of();
100+
101+
tmp.__put(key0, value0);
102+
103+
return tmp;
104+
}
105+
106+
static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1) {
107+
final Map.Transient<K, V> tmp = Map.Transient.of();
108+
109+
tmp.__put(key0, value0);
110+
tmp.__put(key1, value1);
111+
112+
return tmp;
113+
}
114+
115+
static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
116+
V value2) {
117+
final Map.Transient<K, V> tmp = Map.Transient.of();
118+
119+
tmp.__put(key0, value0);
120+
tmp.__put(key1, value1);
121+
tmp.__put(key2, value2);
122+
123+
return tmp;
124+
}
125+
126+
static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
127+
V value2, K key3, V value3) {
128+
final Map.Transient<K, V> tmp = Map.Transient.of();
129+
130+
tmp.__put(key0, value0);
131+
tmp.__put(key1, value1);
132+
tmp.__put(key2, value2);
133+
tmp.__put(key3, value3);
134+
135+
return tmp;
136+
}
137+
138+
static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
139+
V value2, K key3, V value3, K key4, V value4) {
140+
final Map.Transient<K, V> tmp = Map.Transient.of();
141+
142+
tmp.__put(key0, value0);
143+
tmp.__put(key1, value1);
144+
tmp.__put(key2, value2);
145+
tmp.__put(key3, value3);
146+
tmp.__put(key4, value4);
147+
148+
return tmp;
149+
}
150+
151+
static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
152+
V value2, K key3, V value3, K key4, V value4, K key5, V value5) {
153+
final Map.Transient<K, V> tmp = Map.Transient.of();
154+
155+
tmp.__put(key0, value0);
156+
tmp.__put(key1, value1);
157+
tmp.__put(key2, value2);
158+
tmp.__put(key3, value3);
159+
tmp.__put(key4, value4);
160+
tmp.__put(key5, value5);
161+
162+
return tmp;
163+
}
164+
165+
}
166+
167+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
3+
* All rights reserved.
4+
*
5+
* This file is licensed under the BSD 2-Clause License, which accompanies this project
6+
* and is available under https://opensource.org/licenses/BSD-2-Clause.
7+
*/
8+
package io.usethesource.capsule;
9+
10+
import java.util.Comparator;
11+
12+
/**
13+
* Map extension providing methods that take a comparator. Closes over base (and not extended) map.
14+
*/
15+
@Deprecated
16+
public interface MapEq<K, V> extends java.util.Map<K, V> {
17+
18+
default boolean containsKeyEquivalent(final Object o, final Comparator<Object> cmp) {
19+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
20+
}
21+
22+
default boolean containsValueEquivalent(final Object o, final Comparator<Object> cmp) {
23+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
24+
}
25+
26+
default V getEquivalent(final Object o, final Comparator<Object> cmp) {
27+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
28+
}
29+
30+
@Deprecated
31+
interface Immutable<K, V> extends MapEq<K, V> {
32+
33+
default Map.Immutable<K, V> __putEquivalent(final K key, final V val,
34+
final Comparator<Object> cmp) {
35+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
36+
}
37+
38+
default Map.Immutable<K, V> __removeEquivalent(final K key, final Comparator<Object> cmp) {
39+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
40+
}
41+
42+
default Map.Immutable<K, V> __putAllEquivalent(
43+
final java.util.Map<? extends K, ? extends V> map, final Comparator<Object> cmp) {
44+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
45+
}
46+
47+
}
48+
49+
@Deprecated
50+
interface Transient<K, V> extends MapEq<K, V> {
51+
52+
default V __putEquivalent(final K key, final V val, final Comparator<Object> cmp) {
53+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
54+
}
55+
56+
default V __removeEquivalent(final K key, final Comparator<Object> cmp) {
57+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
58+
}
59+
60+
default boolean __putAllEquivalent(final java.util.Map<? extends K, ? extends V> map,
61+
final Comparator<Object> cmp) {
62+
throw new UnsupportedOperationException("Not yet implemented @ Map.");
63+
}
64+
65+
}
66+
}

0 commit comments

Comments
 (0)