Skip to content

Commit

Permalink
Merge branch 'heterogeneous'
Browse files Browse the repository at this point in the history
  • Loading branch information
msteindorfer committed Mar 3, 2017
2 parents 062f6bd + d3c6793 commit 90f7450
Show file tree
Hide file tree
Showing 122 changed files with 830,633 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ node {
sh "mvn -B clean install"

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

stage 'Archive'
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true])
Expand Down
16 changes: 16 additions & 0 deletions capsule-core/capsule-core.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
21 changes: 21 additions & 0 deletions capsule-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.usethesource</groupId>
<artifactId>capsule-pom-parent</artifactId>
<version>0.3.0.HETEROGENEOUS-SNAPSHOT</version>
</parent>

<groupId>io.usethesource</groupId>
<artifactId>capsule</artifactId>
<version>0.3.0.HETEROGENEOUS-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<topleveldir>${project.parent.basedir}</topleveldir>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
* All rights reserved.
*
* This file is licensed under the BSD 2-Clause License, which accompanies this project
* and is available under https://opensource.org/licenses/BSD-2-Clause.
*/
package io.usethesource.capsule;

public interface BinaryRelation<T, U> extends SetMultimap<T, U> {

BinaryRelation<U, T> inverse();

SetMultimap<T, U> toSetMultimap();

interface Immutable<K, V> extends BinaryRelation<K, V>, SetMultimap.Immutable<K, V> {

@Override
boolean isTransientSupported();

@Override
BinaryRelation.Transient<K, V> asTransient();

}

interface Transient<K, V> extends BinaryRelation<K, V>, SetMultimap.Transient<K, V> {

@Override
BinaryRelation.Immutable<K, V> freeze();

}

}
167 changes: 167 additions & 0 deletions capsule-core/src/main/java/io/usethesource/capsule/Map.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/**
* Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
* All rights reserved.
*
* This file is licensed under the BSD 2-Clause License, which accompanies this project
* and is available under https://opensource.org/licenses/BSD-2-Clause.
*/
package io.usethesource.capsule;

import java.util.Iterator;

import io.usethesource.capsule.core.PersistentTrieMap;

public interface Map<K, V> extends java.util.Map<K, V>, MapEq<K, V> {

@Override
int size();

@Override
boolean isEmpty();

@Override
boolean containsKey(final Object o);

@Override
boolean containsValue(final Object o);

@Override
V get(final Object o);

Iterator<K> keyIterator();

Iterator<V> valueIterator();

Iterator<Entry<K, V>> entryIterator();

interface Immutable<K, V> extends Map<K, V>, MapEq.Immutable<K, V> {

Map.Immutable<K, V> __put(final K key, final V val);

Map.Immutable<K, V> __remove(final K key);

Map.Immutable<K, V> __putAll(final java.util.Map<? extends K, ? extends V> map);

boolean isTransientSupported();

Map.Transient<K, V> asTransient();

static <K, V> Map.Immutable<K, V> of() {
return PersistentTrieMap.of();
}

static <K, V> Map.Immutable<K, V> of(K key, V value) {
return PersistentTrieMap.of(key, value);
}

static <K, V> Map.Immutable<K, V> of(K key0, V value0, K key1, V value1) {
return PersistentTrieMap.of(key0, value0, key1, value1);
}

}

interface Transient<K, V> extends Map<K, V>, MapEq.Transient<K, V> {

V __put(final K key, final V val);

V __remove(final K key);

boolean __putAll(final java.util.Map<? extends K, ? extends V> map);

// default boolean union(final Map<? extends K, ? extends V> map) {
// boolean modified = false;
//
// for (java.util.Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
// // NOTE: does only work when map does not support `null` values
// if (this.__put(entry.getKey(), entry.getValue()) != null) {
// modified |= true;
// }
// }
//
// return modified;
// }
//
// default boolean intersect(final Map<? extends K, ? extends V> map) {
// throw new UnsupportedOperationException("Not yet implemented @ Map.");
// }
//
// default boolean complement(final Map<? extends K, ? extends V> map) {
// throw new UnsupportedOperationException("Not yet implemented @ Map");
// }

Map.Immutable<K, V> freeze();

static <K, V> Map.Transient<K, V> of() {
return PersistentTrieMap.transientOf();
}

static <K, V> Map.Transient<K, V> of(K key0, V value0) {
final Map.Transient<K, V> tmp = Map.Transient.of();

tmp.__put(key0, value0);

return tmp;
}

static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1) {
final Map.Transient<K, V> tmp = Map.Transient.of();

tmp.__put(key0, value0);
tmp.__put(key1, value1);

return tmp;
}

static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
V value2) {
final Map.Transient<K, V> tmp = Map.Transient.of();

tmp.__put(key0, value0);
tmp.__put(key1, value1);
tmp.__put(key2, value2);

return tmp;
}

static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
V value2, K key3, V value3) {
final Map.Transient<K, V> tmp = Map.Transient.of();

tmp.__put(key0, value0);
tmp.__put(key1, value1);
tmp.__put(key2, value2);
tmp.__put(key3, value3);

return tmp;
}

static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
V value2, K key3, V value3, K key4, V value4) {
final Map.Transient<K, V> tmp = Map.Transient.of();

tmp.__put(key0, value0);
tmp.__put(key1, value1);
tmp.__put(key2, value2);
tmp.__put(key3, value3);
tmp.__put(key4, value4);

return tmp;
}

static <K, V> Map.Transient<K, V> of(K key0, V value0, K key1, V value1, K key2,
V value2, K key3, V value3, K key4, V value4, K key5, V value5) {
final Map.Transient<K, V> tmp = Map.Transient.of();

tmp.__put(key0, value0);
tmp.__put(key1, value1);
tmp.__put(key2, value2);
tmp.__put(key3, value3);
tmp.__put(key4, value4);
tmp.__put(key5, value5);

return tmp;
}

}

}
66 changes: 66 additions & 0 deletions capsule-core/src/main/java/io/usethesource/capsule/MapEq.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
* All rights reserved.
*
* This file is licensed under the BSD 2-Clause License, which accompanies this project
* and is available under https://opensource.org/licenses/BSD-2-Clause.
*/
package io.usethesource.capsule;

import java.util.Comparator;

/**
* Map extension providing methods that take a comparator. Closes over base (and not extended) map.
*/
@Deprecated
public interface MapEq<K, V> extends java.util.Map<K, V> {

default boolean containsKeyEquivalent(final Object o, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

default boolean containsValueEquivalent(final Object o, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

default V getEquivalent(final Object o, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

@Deprecated
interface Immutable<K, V> extends MapEq<K, V> {

default Map.Immutable<K, V> __putEquivalent(final K key, final V val,
final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

default Map.Immutable<K, V> __removeEquivalent(final K key, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

default Map.Immutable<K, V> __putAllEquivalent(
final java.util.Map<? extends K, ? extends V> map, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

}

@Deprecated
interface Transient<K, V> extends MapEq<K, V> {

default V __putEquivalent(final K key, final V val, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

default V __removeEquivalent(final K key, final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

default boolean __putAllEquivalent(final java.util.Map<? extends K, ? extends V> map,
final Comparator<Object> cmp) {
throw new UnsupportedOperationException("Not yet implemented @ Map.");
}

}
}
Loading

0 comments on commit 90f7450

Please sign in to comment.