Skip to content

Commit

Permalink
Refactor Tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
minborg committed May 12, 2017
1 parent 1813575 commit ecab49a
Show file tree
Hide file tree
Showing 197 changed files with 27,132 additions and 1,035 deletions.
2 changes: 1 addition & 1 deletion common-parent/common-all/pom.xml
Expand Up @@ -42,7 +42,7 @@
<invariant.version>1.0.1</invariant.version> <invariant.version>1.0.1</invariant.version>
<function.version>1.0.1</function.version> <function.version>1.0.1</function.version>
<json.version>1.0.3</json.version> <json.version>1.0.3</json.version>
<tuple.version>1.0.3</tuple.version> <tuple.version>1.0.4-SNAPSHOT</tuple.version>
<logger.version>1.0.4</logger.version> <logger.version>1.0.4</logger.version>
<codegen.version>2.4.6-SNAPSHOT</codegen.version> <codegen.version>2.4.6-SNAPSHOT</codegen.version>
<codegenxml.version>1.0.2</codegenxml.version> <codegenxml.version>1.0.2</codegenxml.version>
Expand Down
6 changes: 3 additions & 3 deletions common-parent/tuple/pom.xml
Expand Up @@ -26,16 +26,16 @@
<parent> <parent>
<groupId>com.speedment.common</groupId> <groupId>com.speedment.common</groupId>
<artifactId>common-parent</artifactId> <artifactId>common-parent</artifactId>
<version>1.0.4</version> <version>3.0.9-SNAPSHOT</version>
</parent> </parent>


<artifactId>tuple</artifactId> <artifactId>tuple</artifactId>
<version>1.0.3</version> <version>1.0.4-SNAPSHOT</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>


<name>Speedment - Common - Tuple</name> <name>Speedment - Common - Tuple</name>
<description> <description>
A collection of Tuple classes that represent sets of a fixed length A collection of Immutable Tuple classes that represent sets of a fixed length
where every element has a specific type. where every element has a specific type.
</description> </description>
<url>https://github.com/speedment/speedment/wiki/Tuple</url> <url>https://github.com/speedment/speedment/wiki/Tuple</url>
Expand Down
Expand Up @@ -25,14 +25,13 @@
*/ */
public interface BasicTuple<R> { public interface BasicTuple<R> {



/** /**
* Returns the length of the Tuple. For example, a Tuple2 has a length of 2 * Returns the degree of the Tuple. For example, a Tuple2 has a degree of 2
* whereas a Tuple3 has a length of 3. * whereas a Tuple3 has a degree of 3.
* *
* @return the length of the Tuple * @return the degree of the Tuple
*/ */
int length(); int degree();


/** /**
* Gets the tuple element at the given index. For example, get(0) will * Gets the tuple element at the given index. For example, get(0) will
Expand All @@ -46,10 +45,10 @@ public interface BasicTuple<R> {
R get(int index); R get(int index);


/** /**
* Returns a {@link Stream} of all non-null values for this Tuple of the * Returns a {@link Stream} of all values for this Tuple of the given class.
* given class. I.e. all non-null members of a Tuple that can be cast to the * I.e. all non-null members of a Tuple that can be cast to the given class
* given class are included in the Stream. If sequential, the Stream will * are included in the Stream. If sequential, the Stream will start with the
* start with the 0:th tuple and progress upwards. * 0:th tuple and progress upwards.
* *
* @param <T> The type of stream * @param <T> The type of stream
* @param clazz The class of the type of the stream * @param clazz The class of the type of the stream
Expand Down
Expand Up @@ -35,13 +35,14 @@ public interface Tuple extends BasicTuple<Object> {
* @return a {@link Stream} of all values for this Tuple * @return a {@link Stream} of all values for this Tuple
*/ */
Stream<Object> stream(); Stream<Object> stream();

@Override @Override
default <T> Stream<T> streamOf(Class<T> clazz) { default <T> Stream<T> streamOf(Class<T> clazz) {
return stream() return stream()
.filter(s -> s != null)
.filter(clazz::isInstance) .filter(clazz::isInstance)
.map(clazz::cast); .map(clazz::cast);
} }


//<T> T map(Function<? extends Tuple, T> mapper);

} }

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit ecab49a

Please sign in to comment.