├── .gitignore ├── LICENSE.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── pacoworks │ │ │ └── rxtuples │ │ │ └── MainActivity.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── pacoworks │ └── rxtuples │ └── RxTuplesTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── rxtuples ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── pacoworks │ └── rxtuples │ └── RxTuples.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .DS_Store 4 | */build 5 | */intermediates 6 | /captures 7 | /obj 8 | target 9 | .idea 10 | *.iml -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License, Version 2.0 2 | =========================== 3 | 4 | Copyright 2015 pakoito 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License.n 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RxTuples 2 | 3 | RxTuples is a library to smooth RxJava usage by adding simple Tuple creation functions. 4 | 5 | For the RxJava 2.X version, please go to [RxTuples2](https://github.com/pakoito/RxTuples2). 6 | 7 | ## Rationale 8 | 9 | Quite often when using RxJava you find the need to forward a value alongside the result of an operation, combine several values, or simply adding an external value to the current internal state of the chain. For this you either create ad-hoc types that may only be used locally, which is inefficient. 10 | 11 | Other languages have the concept of a Tuple built into them, which is an in-place list of values. Lots of Java libraries implement their own concept of Tuple, being a Pair, a Point, or VecX types. This library uses [javatuples](http://www.javatuples.org/) in an attempt to unify them[.](https://imgs.xkcd.com/comics/standards.png) Javatuples are all "typesafe, immutable, iterable, serializable, comparable" classes ranging from 1 to 10 elements. 12 | 13 | ## Usage 14 | 15 | RxTuples come as lazily evaluated FuncN and its main use case is alongside the combineLatest, withLatestFrom, zip, and zipWith operators. 16 | 17 | Zip a list element into a pair with their position: 18 | 19 | Observable.zip(Observable.from(myStringList), Observable.range(0, myStringList.size()), 20 | RxTuples.toPair()); 21 | 22 | Merge the value of several hot observables: 23 | 24 | Observable.combineLatest(networkSubject(), bluetoothSubject(), compassSubject(), 25 | RxTuples.toTriplet()); 26 | 27 | Get the previous element from a sequence alongside the current one: 28 | 29 | Observable.zip(compassSubject(), compassSubject().skip(1), 30 | RxTuples.toPair()); 31 | 32 | or more complicated cases 33 | 34 | Observable.just(Quintet.with(1, 2, 3, 4, 5)) 35 | .zipWith( 36 | Observable.just(Triplet.with(6, 7, 8)), 37 | RxTuples. toOctetFromQuintet()); 38 | 39 | ## Distribution 40 | 41 | Add as a dependency to your `build.gradle` 42 | 43 | repositories { 44 | ... 45 | maven { url "https://jitpack.io" } 46 | ... 47 | } 48 | 49 | dependencies { 50 | ... 51 | compile 'com.github.pakoito:RxTuples:1.0.+' 52 | ... 53 | } 54 | 55 | or to your `pom.xml` 56 | 57 | 58 | 59 | jitpack.io 60 | https://jitpack.io 61 | 62 | 63 | 64 | 65 | com.github.pakoito 66 | RxTuples 67 | 1.0.0 68 | 69 | 70 | ## License 71 | 72 | Copyright (c) pakoito 2015 73 | 74 | The Apache Software License, Version 2.0 75 | 76 | See LICENSE.md 77 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .DS_Store 4 | */build 5 | */intermediates 6 | /captures 7 | /obj 8 | target 9 | .idea 10 | *.iml -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) pakoito 2015 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | android { 20 | compileSdkVersion 22 21 | buildToolsVersion "22.0.1" 22 | 23 | defaultConfig { 24 | applicationId "com.pacoworks.rxtuples" 25 | minSdkVersion 9 26 | targetSdkVersion 22 27 | versionCode 1 28 | versionName "1.0" 29 | } 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | } 37 | 38 | repositories { 39 | maven { url "https://jitpack.io" } 40 | } 41 | 42 | dependencies { 43 | compile fileTree(include: ['*.jar'], dir: 'libs') 44 | testCompile 'junit:junit:4.12' 45 | compile 'com.android.support:appcompat-v7:22.2.1' 46 | compile 'com.github.pakoito:RxTuples:1.0.+' 47 | androidTestCompile 'junit:junit:4.12' 48 | } 49 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in S:\android-sdk-windows/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/pacoworks/rxtuples/MainActivity.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) pakoito 2015 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.pacoworks.rxtuples; 19 | 20 | import android.os.Bundle; 21 | import android.support.v7.app.AppCompatActivity; 22 | 23 | public class MainActivity extends AppCompatActivity { 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_main); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pakoito/RxTuples/04acca33d92b52510a22a777023557ca96344f80/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pakoito/RxTuples/04acca33d92b52510a22a777023557ca96344f80/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pakoito/RxTuples/04acca33d92b52510a22a777023557ca96344f80/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pakoito/RxTuples/04acca33d92b52510a22a777023557ca96344f80/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pakoito/RxTuples/04acca33d92b52510a22a777023557ca96344f80/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 21 | 64dp 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | #3F51B5 19 | #303F9F 20 | #FF4081 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 16dp 20 | 16dp 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | RxTuples 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/test/java/com/pacoworks/rxtuples/RxTuplesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) pakoito 2015 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pacoworks.rxtuples; 18 | 19 | import org.javatuples.Octet; 20 | import org.javatuples.Pair; 21 | import org.javatuples.Quartet; 22 | import org.javatuples.Quintet; 23 | import org.javatuples.Septet; 24 | import org.javatuples.Sextet; 25 | import org.javatuples.Triplet; 26 | import org.junit.Assert; 27 | import org.junit.Test; 28 | 29 | import rx.Observable; 30 | 31 | public class RxTuplesTest { 32 | public static final Pair RES_PAIR = Pair.with(1, 2); 33 | 34 | public static final Triplet RES_TRIPLET = Triplet.with(1, 2, 3); 35 | 36 | public static final Quartet RES_QUARTET = Quartet.with(1, 37 | 2, 3, 4); 38 | 39 | public static final Quintet RES_QUINTET = Quintet 40 | .with(1, 2, 3, 4, 5); 41 | 42 | public static final Sextet RES_SEXTET = Sextet 43 | .with(1, 2, 3, 4, 5, 6); 44 | 45 | public static final Septet RES_SEPTET = Septet 46 | .with(1, 2, 3, 4, 5, 6, 7); 47 | 48 | public static final Octet RES_OCTET = Octet 49 | .with(1, 2, 3, 4, 5, 6, 7, 8); 50 | 51 | private static final Observable RANGE = Observable.range(1, 10); 52 | 53 | private static final Observable> ZIP_RANGE = RANGE 54 | .zipWith(RANGE, RxTuples. toPair()) 55 | .zipWith(RANGE, RxTuples. toTripletFromPair()) 56 | .zipWith(RANGE, RxTuples. toQuartetFromTriplet()) 57 | .zipWith(RANGE, 58 | RxTuples. toQuintetFromQuartet()) 59 | .zipWith( 60 | RANGE, 61 | RxTuples. toSextetFromQuintet()) 62 | .zipWith( 63 | RANGE, 64 | RxTuples. toSeptetFromSextet()) 65 | .zipWith( 66 | RANGE, 67 | RxTuples. toOctetFromSeptet()); 68 | 69 | @Test 70 | public void testWarmup() throws Exception { 71 | Assert.assertEquals(true, 72 | ZIP_RANGE.toBlocking().first().equals(Octet.with(1, 1, 1, 1, 1, 1, 1, 1))); 73 | Assert.assertEquals(true, 74 | ZIP_RANGE.toBlocking().last().equals(Octet.with(10, 10, 10, 10, 10, 10, 10, 10))); 75 | Assert.assertEquals( 76 | true, 77 | Observable 78 | .combineLatest(Observable.just(1), Observable.just(2), Observable.just(3), 79 | Observable.just(4), 80 | RxTuples. toQuartet()) 81 | .toBlocking().first().equals(RES_QUARTET)); 82 | } 83 | 84 | @Test 85 | public void testToPair() throws Exception { 86 | Assert.assertEquals(true, RxTuples.toPair().call(1, 2).equals(RES_PAIR)); 87 | } 88 | 89 | @Test 90 | public void testToTriplet() throws Exception { 91 | Assert.assertEquals(true, RxTuples. toTriplet().call(1, 2, 3) 92 | .equals(RES_TRIPLET)); 93 | Assert.assertEquals(true, 94 | RxTuples. toTripletFromPair().call(Pair.with(1, 2), 3) 95 | .equals(RES_TRIPLET)); 96 | Assert.assertEquals(true, 97 | RxTuples. toTripletFromSingle().call(1, Pair.with(2, 3)) 98 | .equals(RES_TRIPLET)); 99 | } 100 | 101 | @Test 102 | public void testToQuartet() throws Exception { 103 | Assert.assertEquals( 104 | true, 105 | RxTuples. toQuartet().call(1, 2, 3, 4) 106 | .equals(RES_QUARTET)); 107 | Assert.assertEquals(true, RxTuples 108 | . toQuartetFromTriplet().call(RES_TRIPLET, 4) 109 | .equals(RES_QUARTET)); 110 | Assert.assertEquals( 111 | true, 112 | RxTuples. toQuartetFromSingle() 113 | .call(1, Triplet.with(2, 3, 4)).equals(RES_QUARTET)); 114 | Assert.assertEquals(true, RxTuples. toQuartetFromPair() 115 | .call(Pair.with(1, 2), Pair.with(3, 4)).equals(RES_QUARTET)); 116 | } 117 | 118 | @Test 119 | public void testToQuintet() throws Exception { 120 | Assert.assertEquals(true, RxTuples 121 | . toQuintet().call(1, 2, 3, 4, 5) 122 | .equals(RES_QUINTET)); 123 | Assert.assertEquals( 124 | true, 125 | RxTuples. toQuintetFromQuartet() 126 | .call(RES_QUARTET, 5).equals(RES_QUINTET)); 127 | Assert.assertEquals( 128 | true, 129 | RxTuples. toQuintetFromSingle() 130 | .call(1, Quartet.with(2, 3, 4, 5)).equals(RES_QUINTET)); 131 | Assert.assertEquals( 132 | true, 133 | RxTuples. toQuintetFromTriplet() 134 | .call(Triplet.with(1, 2, 3), Pair.with(4, 5)).equals(RES_QUINTET)); 135 | Assert.assertEquals( 136 | true, 137 | RxTuples. toQuintetFromPair() 138 | .call(Pair.with(1, 2), Triplet.with(3, 4, 5)).equals(RES_QUINTET)); 139 | } 140 | 141 | @Test 142 | public void testToSextet() throws Exception { 143 | Assert.assertEquals( 144 | true, 145 | RxTuples. toSextet() 146 | .call(1, 2, 3, 4, 5, 6).equals(RES_SEXTET)); 147 | Assert.assertEquals( 148 | true, 149 | RxTuples. toSextetFromQuintet() 150 | .call(RES_QUINTET, 6).equals(RES_SEXTET)); 151 | Assert.assertEquals( 152 | true, 153 | RxTuples. toSextetFromSingle() 154 | .call(1, Quintet.with(2, 3, 4, 5, 6)).equals(RES_SEXTET)); 155 | Assert.assertEquals( 156 | true, 157 | RxTuples. toSextetFromQuartet() 158 | .call(Quartet.with(1, 2, 3, 4), Pair.with(5, 6)).equals(RES_SEXTET)); 159 | Assert.assertEquals(true, 160 | RxTuples. toSextetFromPair() 161 | .call(Pair.with(1, 2), Quartet.with(3, 4, 5, 6)).equals(RES_SEXTET)); 162 | Assert.assertEquals( 163 | true, 164 | RxTuples. toSextetFromTriplet() 165 | .call(Triplet.with(1, 2, 3), Triplet.with(4, 5, 6)).equals(RES_SEXTET)); 166 | } 167 | 168 | @Test 169 | public void testToSeptet() throws Exception { 170 | Assert.assertEquals(true, 171 | RxTuples. toSeptet() 172 | .call(1, 2, 3, 4, 5, 6, 7).equals(RES_SEPTET)); 173 | Assert.assertEquals( 174 | true, 175 | RxTuples. toSeptetFromSextet() 176 | .call(RES_SEXTET, 7).equals(RES_SEPTET)); 177 | Assert.assertEquals( 178 | true, 179 | RxTuples. toSeptetFromSingle() 180 | .call(1, Sextet.with(2, 3, 4, 5, 6, 7)).equals(RES_SEPTET)); 181 | Assert.assertEquals( 182 | true, 183 | RxTuples. toSeptetFromQuintet() 184 | .call(Quintet.with(1, 2, 3, 4, 5), Pair.with(6, 7)).equals(RES_SEPTET)); 185 | Assert.assertEquals(true, RxTuples 186 | . toSeptetFromPair() 187 | .call(Pair.with(1, 2), Quintet.with(3, 4, 5, 6, 7)).equals(RES_SEPTET)); 188 | Assert.assertEquals( 189 | true, 190 | RxTuples. toSeptetFromQuartet() 191 | .call(Quartet.with(1, 2, 3, 4), Triplet.with(5, 6, 7)).equals(RES_SEPTET)); 192 | Assert.assertEquals( 193 | true, 194 | RxTuples. toSeptetFromTriplet() 195 | .call(Triplet.with(1, 2, 3), Quartet.with(4, 5, 6, 7)).equals(RES_SEPTET)); 196 | } 197 | 198 | @Test 199 | public void testToOctet() throws Exception { 200 | Assert.assertEquals(true, RxTuples 201 | . toOctet() 202 | .call(1, 2, 3, 4, 5, 6, 7, 8).equals(RES_OCTET)); 203 | Assert.assertEquals( 204 | true, 205 | RxTuples. toOctetFromSeptet() 206 | .call(RES_SEPTET, 8).equals(RES_OCTET)); 207 | Assert.assertEquals( 208 | true, 209 | RxTuples. toOctetFromSingle() 210 | .call(1, Septet.with(2, 3, 4, 5, 6, 7, 8)).equals(RES_OCTET)); 211 | Assert.assertEquals( 212 | true, 213 | RxTuples. toOctetFromSextet() 214 | .call(Sextet.with(1, 2, 3, 4, 5, 6), Pair.with(7, 8)).equals(RES_OCTET)); 215 | Assert.assertEquals( 216 | true, 217 | RxTuples. toOctetFromPair() 218 | .call(Pair.with(1, 2), Sextet.with(3, 4, 5, 6, 7, 8)).equals(RES_OCTET)); 219 | Assert.assertEquals( 220 | true, 221 | RxTuples. toOctetFromQuintet() 222 | .call(Quintet.with(1, 2, 3, 4, 5), Triplet.with(6, 7, 8)).equals(RES_OCTET)); 223 | Assert.assertEquals( 224 | true, 225 | RxTuples. toOctetFromTriplet() 226 | .call(Triplet.with(1, 2, 3), Quintet.with(4, 5, 6, 7, 8)).equals(RES_OCTET)); 227 | Assert.assertEquals( 228 | true, 229 | RxTuples. toOctetFromQuartet() 230 | .call(Quartet.with(1, 2, 3, 4), Quartet.with(5, 6, 7, 8)).equals(RES_OCTET)); 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) pakoito 2015 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | 19 | buildscript { 20 | repositories { 21 | jcenter() 22 | } 23 | dependencies { 24 | classpath 'com.android.tools.build:gradle:2.0.0-alpha2' 25 | 26 | // NOTE: Do not place your application dependencies here; they belong 27 | // in the individual module build.gradle files 28 | } 29 | } 30 | 31 | allprojects { 32 | repositories { 33 | jcenter() 34 | } 35 | } 36 | 37 | task clean(type: Delete) { 38 | delete rootProject.buildDir 39 | } 40 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) pakoito 2015 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Gradle settings configured through the IDE *will override* 21 | # any settings specified in this file. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pakoito/RxTuples/04acca33d92b52510a22a777023557ca96344f80/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) pakoito 2015 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | #Wed Oct 21 11:34:03 PDT 2015 18 | distributionBase=GRADLE_USER_HOME 19 | distributionPath=wrapper/dists 20 | zipStoreBase=GRADLE_USER_HOME 21 | zipStorePath=wrapper/dists 22 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 23 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /rxtuples/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .DS_Store 4 | */build 5 | */intermediates 6 | /captures 7 | /obj 8 | target 9 | .idea 10 | *.iml -------------------------------------------------------------------------------- /rxtuples/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) pakoito 2015 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'java' 18 | apply plugin: 'maven' 19 | 20 | group = 'com.github.pakoito' 21 | 22 | sourceCompatibility = 1.6 23 | targetCompatibility = 1.6 24 | 25 | dependencies { 26 | compile 'org.javatuples:javatuples:1.2' 27 | compile 'io.reactivex:rxjava:1.1.0' 28 | } 29 | 30 | install { 31 | repositories.mavenInstaller { 32 | pom.project { 33 | licenses { 34 | license { 35 | name 'The Apache Software License, Version 2.0' 36 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 37 | distribution 'repo' 38 | } 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /rxtuples/src/main/java/com/pacoworks/rxtuples/RxTuples.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) pakoito 2015 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pacoworks.rxtuples; 18 | 19 | import org.javatuples.Octet; 20 | import org.javatuples.Pair; 21 | import org.javatuples.Quartet; 22 | import org.javatuples.Quintet; 23 | import org.javatuples.Septet; 24 | import org.javatuples.Sextet; 25 | import org.javatuples.Triplet; 26 | 27 | import rx.functions.Func2; 28 | import rx.functions.Func3; 29 | import rx.functions.Func4; 30 | import rx.functions.Func5; 31 | import rx.functions.Func6; 32 | import rx.functions.Func7; 33 | import rx.functions.Func8; 34 | 35 | public final class RxTuples { 36 | private RxTuples() { 37 | } 38 | 39 | /* Pair */ 40 | public static rx.functions.Func2> toPair() { 41 | return new Func2>() { 42 | @Override 43 | public Pair call(T t, U t2) { 44 | return Pair.with(t, t2); 45 | } 46 | }; 47 | } 48 | 49 | /* Triplet */ 50 | public static Func3> toTriplet() { 51 | return new Func3>() { 52 | @Override 53 | public Triplet call(A a, B b, C c) { 54 | return Triplet.with(a, b, c); 55 | } 56 | }; 57 | } 58 | 59 | public static rx.functions.Func2, Triplet> toTripletFromSingle() { 60 | return new Func2, Triplet>() { 61 | @Override 62 | public Triplet call(T t, Pair objects) { 63 | return Triplet.with(t, objects.getValue0(), objects.getValue1()); 64 | } 65 | }; 66 | } 67 | 68 | public static Func2, T, Triplet> toTripletFromPair() { 69 | return new Func2, T, Triplet>() { 70 | @Override 71 | public Triplet call(Pair objects, T t) { 72 | return Triplet.with(objects.getValue0(), objects.getValue1(), t); 73 | } 74 | }; 75 | } 76 | 77 | /* Quartet */ 78 | public static Func4> toQuartet() { 79 | return new Func4>() { 80 | @Override 81 | public Quartet call(A a, B b, C c, D d) { 82 | return Quartet.with(a, b, c, d); 83 | } 84 | }; 85 | } 86 | 87 | public static Func2, Quartet> toQuartetFromSingle() { 88 | return new Func2, Quartet>() { 89 | @Override 90 | public Quartet call(T t, Triplet objects) { 91 | return Quartet.with(t, objects.getValue0(), objects.getValue1(), 92 | objects.getValue2()); 93 | } 94 | }; 95 | } 96 | 97 | public static Func2, Pair, Quartet> toQuartetFromPair() { 98 | return new Func2, Pair, Quartet>() { 99 | @Override 100 | public Quartet call(Pair objects, Pair objects2) { 101 | return Quartet.with(objects.getValue0(), objects.getValue1(), objects2.getValue0(), 102 | objects2.getValue1()); 103 | } 104 | }; 105 | } 106 | 107 | public static Func2, T, Quartet> toQuartetFromTriplet() { 108 | return new Func2, T, Quartet>() { 109 | @Override 110 | public Quartet call(Triplet objects, T t) { 111 | return Quartet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 112 | t); 113 | } 114 | }; 115 | } 116 | 117 | /* Quintet */ 118 | 119 | public static Func5> toQuintet() { 120 | return new Func5>() { 121 | @Override 122 | public Quintet call(A a, B b, C c, D d, E e) { 123 | return Quintet.with(a, b, c, d, e); 124 | } 125 | }; 126 | } 127 | 128 | public static Func2, Quintet> toQuintetFromSingle() { 129 | return new Func2, Quintet>() { 130 | @Override 131 | public Quintet call(T t, Quartet objects) { 132 | return Quintet.with(t, objects.getValue0(), objects.getValue1(), 133 | objects.getValue2(), objects.getValue3()); 134 | } 135 | }; 136 | } 137 | 138 | public static Func2, Triplet, Quintet> toQuintetFromPair() { 139 | return new Func2, Triplet, Quintet>() { 140 | @Override 141 | public Quintet call(Pair objects, Triplet objects2) { 142 | return Quintet.with(objects.getValue0(), objects.getValue1(), objects2.getValue0(), 143 | objects2.getValue1(), objects2.getValue2()); 144 | } 145 | }; 146 | } 147 | 148 | public static Func2, Pair, Quintet> toQuintetFromTriplet() { 149 | return new Func2, Pair, Quintet>() { 150 | @Override 151 | public Quintet call(Triplet objects, Pair objects2) { 152 | return Quintet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 153 | objects2.getValue0(), objects2.getValue1()); 154 | } 155 | }; 156 | } 157 | 158 | public static Func2, T, Quintet> toQuintetFromQuartet() { 159 | return new Func2, T, Quintet>() { 160 | @Override 161 | public Quintet call(Quartet objects, T t) { 162 | return Quintet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 163 | objects.getValue3(), t); 164 | } 165 | }; 166 | } 167 | 168 | /* Sextet */ 169 | 170 | public static Func6> toSextet() { 171 | return new Func6>() { 172 | @Override 173 | public Sextet call(A a, B b, C c, D d, E e, F f) { 174 | return Sextet.with(a, b, c, d, e, f); 175 | } 176 | }; 177 | } 178 | 179 | public static Func2, Sextet> toSextetFromSingle() { 180 | return new Func2, Sextet>() { 181 | @Override 182 | public Sextet call(T t, Quintet objects) { 183 | return Sextet.with(t, objects.getValue0(), objects.getValue1(), 184 | objects.getValue2(), objects.getValue3(), objects.getValue4()); 185 | } 186 | }; 187 | } 188 | 189 | public static Func2, Quartet, Sextet> toSextetFromPair() { 190 | return new Func2, Quartet, Sextet>() { 191 | @Override 192 | public Sextet call(Pair objects, Quartet objects2) { 193 | return Sextet.with(objects.getValue0(), objects.getValue1(), objects2.getValue0(), 194 | objects2.getValue1(), objects2.getValue2(), objects2.getValue3()); 195 | } 196 | }; 197 | } 198 | 199 | public static Func2, Triplet, Sextet> toSextetFromTriplet() { 200 | return new Func2, Triplet, Sextet>() { 201 | @Override 202 | public Sextet call(Triplet objects, Triplet objects2) { 203 | return Sextet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 204 | objects2.getValue0(), objects2.getValue1(), objects2.getValue2()); 205 | } 206 | }; 207 | } 208 | 209 | public static Func2, Pair, Sextet> toSextetFromQuartet() { 210 | return new Func2, Pair, Sextet>() { 211 | @Override 212 | public Sextet call(Quartet objects, Pair objects2) { 213 | return Sextet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 214 | objects.getValue3(), objects2.getValue0(), objects2.getValue1()); 215 | } 216 | }; 217 | } 218 | 219 | public static Func2, T, Sextet> toSextetFromQuintet() { 220 | return new Func2, T, Sextet>() { 221 | @Override 222 | public Sextet call(Quintet objects, T t) { 223 | return Sextet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 224 | objects.getValue3(), objects.getValue4(), t); 225 | } 226 | }; 227 | } 228 | 229 | /* Septet */ 230 | 231 | public static Func7> toSeptet() { 232 | return new Func7>() { 233 | @Override 234 | public Septet call(A a, B b, C c, D d, E e, F f, G g) { 235 | return Septet.with(a, b, c, d, e, f, g); 236 | } 237 | }; 238 | } 239 | 240 | public static Func2, Septet> toSeptetFromSingle() { 241 | return new Func2, Septet>() { 242 | @Override 243 | public Septet call(T t, Sextet objects) { 244 | return Septet.with(t, objects.getValue0(), objects.getValue1(), 245 | objects.getValue2(), objects.getValue3(), objects.getValue4(), 246 | objects.getValue5()); 247 | } 248 | }; 249 | } 250 | 251 | public static Func2, Quintet, Septet> toSeptetFromPair() { 252 | return new Func2, Quintet, Septet>() { 253 | @Override 254 | public Septet call(Pair objects, 255 | Quintet objects2) { 256 | return Septet.with(objects.getValue0(), objects.getValue1(), objects2.getValue0(), 257 | objects2.getValue1(), objects2.getValue2(), objects2.getValue3(), 258 | objects2.getValue4()); 259 | } 260 | }; 261 | } 262 | 263 | public static Func2, Quartet, Septet> toSeptetFromTriplet() { 264 | return new Func2, Quartet, Septet>() { 265 | @Override 266 | public Septet call(Triplet objects, 267 | Quartet objects2) { 268 | return Septet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 269 | objects2.getValue0(), objects2.getValue1(), objects2.getValue2(), 270 | objects2.getValue3()); 271 | } 272 | }; 273 | } 274 | 275 | public static Func2, Triplet, Septet> toSeptetFromQuartet() { 276 | return new Func2, Triplet, Septet>() { 277 | @Override 278 | public Septet call(Quartet objects, 279 | Triplet objects2) { 280 | return Septet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 281 | objects.getValue3(), objects2.getValue0(), objects2.getValue1(), 282 | objects2.getValue2()); 283 | } 284 | }; 285 | } 286 | 287 | public static Func2, Pair, Septet> toSeptetFromQuintet() { 288 | return new Func2, Pair, Septet>() { 289 | @Override 290 | public Septet call(Quintet objects, 291 | Pair objects2) { 292 | return Septet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 293 | objects.getValue3(), objects.getValue4(), objects2.getValue0(), 294 | objects2.getValue1()); 295 | } 296 | }; 297 | } 298 | 299 | public static Func2, T, Septet> toSeptetFromSextet() { 300 | return new Func2, T, Septet>() { 301 | @Override 302 | public Septet call(Sextet objects, T t) { 303 | return Septet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 304 | objects.getValue3(), objects.getValue4(), objects.getValue5(), t); 305 | } 306 | }; 307 | } 308 | 309 | /* Octet */ 310 | public static Func8> toOctet() { 311 | return new Func8>() { 312 | @Override 313 | public Octet call(A a, B b, C c, D d, E e, F f, G g, H h) { 314 | return Octet.with(a, b, c, d, e, f, g, h); 315 | } 316 | }; 317 | } 318 | 319 | 320 | public static Func2, Octet> toOctetFromSingle() { 321 | return new Func2, Octet>() { 322 | @Override 323 | public Octet call(T t, Septet objects) { 324 | return Octet.with(t, objects.getValue0(), objects.getValue1(), objects.getValue2(), 325 | objects.getValue3(), objects.getValue4(), objects.getValue5(), 326 | objects.getValue6()); 327 | } 328 | }; 329 | } 330 | 331 | public static Func2, Sextet, Octet> toOctetFromPair() { 332 | return new Func2, Sextet, Octet>() { 333 | @Override 334 | public Octet call(Pair objects, 335 | Sextet objects2) { 336 | return Octet.with(objects.getValue0(), objects.getValue1(), objects2.getValue0(), 337 | objects2.getValue1(), objects2.getValue2(), objects2.getValue3(), 338 | objects2.getValue4(), objects2.getValue5()); 339 | } 340 | }; 341 | } 342 | 343 | public static Func2, Quintet, Octet> toOctetFromTriplet() { 344 | return new Func2, Quintet, Octet>() { 345 | @Override 346 | public Octet call(Triplet objects, 347 | Quintet objects2) { 348 | return Octet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 349 | objects2.getValue0(), objects2.getValue1(), objects2.getValue2(), 350 | objects2.getValue3(), objects2.getValue4()); 351 | } 352 | }; 353 | } 354 | 355 | public static Func2, Quartet, Octet> toOctetFromQuartet() { 356 | return new Func2, Quartet, Octet>() { 357 | @Override 358 | public Octet call(Quartet objects, 359 | Quartet objects2) { 360 | return Octet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 361 | objects.getValue3(), objects2.getValue0(), objects2.getValue1(), 362 | objects2.getValue2(), objects2.getValue3()); 363 | } 364 | }; 365 | } 366 | 367 | public static Func2, Triplet, Octet> toOctetFromQuintet() { 368 | return new Func2, Triplet, Octet>() { 369 | @Override 370 | public Octet call(Quintet objects, 371 | Triplet objects2) { 372 | return Octet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 373 | objects.getValue3(), objects.getValue4(), objects2.getValue0(), 374 | objects2.getValue1(), objects2.getValue2()); 375 | } 376 | }; 377 | } 378 | 379 | public static Func2, Pair, Octet> toOctetFromSextet() { 380 | return new Func2, Pair, Octet>() { 381 | @Override 382 | public Octet call(Sextet objects, 383 | Pair objects2) { 384 | return Octet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 385 | objects.getValue3(), objects.getValue4(), objects.getValue5(), 386 | objects2.getValue0(), objects2.getValue1()); 387 | } 388 | }; 389 | } 390 | 391 | public static Func2, T, Octet> toOctetFromSeptet() { 392 | return new Func2, T, Octet>() { 393 | @Override 394 | public Octet call(Septet objects, T t) { 395 | return Octet.with(objects.getValue0(), objects.getValue1(), objects.getValue2(), 396 | objects.getValue3(), objects.getValue4(), objects.getValue5(), 397 | objects.getValue6(), t); 398 | } 399 | }; 400 | } 401 | } 402 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) pakoito 2015 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include ':app', ':rxtuples' 18 | --------------------------------------------------------------------------------