Skip to content

Commit

Permalink
update tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcclean committed Sep 13, 2015
1 parent 332992a commit ed2f77a
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static <T> Seq<T> toJooqLambda(javaslang.collection.Stream<T> s){
return Seq.seq(s.iterator());
}
public static <T> LazyFutureStream<T> toFutureStream(javaslang.collection.Stream<T> s){
return LazyFutureStream.of(s.iterator());
return LazyFutureStream.lazyFutureStream(s.iterator());
}

public static <T> LazySeq<T> toLazySeq(javaslang.collection.Stream<T> s){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.aol.cyclops.lambda.api;

import java.util.List;
import java.util.stream.Collectors;

import com.aol.cyclops.invokedynamic.ExceptionSoftener;
import com.aol.cyclops.invokedynamic.ReflectionCache;

public interface TupleWrapper {

public Object getInstance();

@SuppressWarnings("unchecked")
default List<Object> values(){

try {
return (List)ReflectionCache.getFields(getInstance().getClass()).stream().map(f ->{
try {

return f.get(getInstance());
} catch (Exception e) {
ExceptionSoftener.throwSoftenedException(e);
return null;
}
}).collect(Collectors.toList());
} catch (Exception e) {
ExceptionSoftener
.throwSoftenedException(e);
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import java.util.function.Consumer;

import org.junit.Test;

import com.aol.cyclops.lambda.tuple.PTuple2;
import com.aol.cyclops.lambda.tuple.PowerTuples;
public class TryTest {

@Test(expected=IOException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
import java.util.stream.Stream;

import lombok.AllArgsConstructor;
import lombok.val;

import com.aol.cyclops.lambda.api.Monoid;
import com.aol.cyclops.lambda.utils.Mutable;
import com.aol.cyclops.closures.mutable.Mutable;
import com.aol.cyclops.matcher.builders.CheckValues;
import com.aol.cyclops.matcher.builders.MatchingInstance;
import com.aol.cyclops.matcher.builders.PatternMatcher;
import com.aol.cyclops.matcher.builders._Simpler_Case;
import com.aol.cyclops.sequence.Monoid;
import com.aol.cyclops.value.StreamableValue;
import com.nurkiewicz.lazyseq.LazySeq;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import com.aol.cyclops.lambda.utils.ExceptionSoftener;
import com.aol.cyclops.invokedynamic.ExceptionSoftener;

public class DynamicInvoker {

Expand All @@ -40,7 +40,7 @@ else if(o instanceof File){
try {
return Files.lines(Paths.get( ((File)o).getAbsolutePath()));
} catch (IOException e) {
ExceptionSoftener.singleton.factory.getInstance().throwSoftenedException(e);
ExceptionSoftener.throwSoftenedException(e);
}
}
else if(o instanceof URL){
Expand All @@ -50,7 +50,7 @@ else if(o instanceof URL){
((URL)o).openStream()));
return ((BufferedReader)o).lines();
} catch (IOException e) {
ExceptionSoftener.singleton.factory.getInstance().throwSoftenedException(e);
ExceptionSoftener.throwSoftenedException(e);
}

}else if(o!=null && o.getClass().isArray())
Expand All @@ -70,13 +70,13 @@ private Object executeMethod(Object t, Method m, Class z) {
try {
return new ConstantCallSite(MethodHandles.publicLookup().unreflect(m2));
} catch (Exception e) {
ExceptionSoftener.singleton.factory.getInstance().throwSoftenedException(e);
ExceptionSoftener.throwSoftenedException(e);
}
return null;
}).dynamicInvoker().invoke(t);

} catch (Throwable e) {
ExceptionSoftener.singleton.factory.getInstance().throwSoftenedException(e);
ExceptionSoftener.throwSoftenedException(e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap1PTuple8;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap2PTuple8;
import com.aol.cyclops.lambda.tuple.memo.Memo2;
import com.aol.cyclops.lambda.utils.LazyImmutable;

public interface PTuple2<T1,T2> extends PTuple1<T1>{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
import java.util.function.Function;

import com.aol.cyclops.functions.HexFunction;
import com.aol.cyclops.lambda.tuple.lazymap.*;
import com.aol.cyclops.lambda.utils.LazyImmutable;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap1PTuple8;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap2PTuple8;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap3PTuple8;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap4PTuple8;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap5PTuple8;
import com.aol.cyclops.lambda.tuple.lazymap.LazyMap6PTuple8;

public interface PTuple6<T1,T2,T3,T4,T5,T6> extends PTuple5<T1,T2,T3,T4,T5> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.aol.cyclops.lambda.utils.ExceptionSoftener;
import com.aol.cyclops.invokedynamic.ExceptionSoftener;

class ParamMatcher {

Expand All @@ -29,7 +29,7 @@ public <T> T create(Class<T> to, int arity, List<Object> values, Throwable t){

}
}
ExceptionSoftener.singleton.factory.getInstance().throwSoftenedException(t);
ExceptionSoftener.throwSoftenedException(t);
return null;
}
private List<Object> order(List<Object> values,Constructor c) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Wither;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.lambda.tuple.PTuple2;
import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

public class LazyMap1PTuple8<T,T1,T2,T3,T4,T5,T6,T7,T8> extends TupleImpl<T,T2,T3,T4,T5,T6,T7,T8> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.lambda.tuple.PTuple2;
import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

public class LazyMap2PTuple8<T,T1,T2,T3,T4,T5,T6,T7,T8> extends TupleImpl<T1,T,T3,T4,T5,T6,T7,T8> {
private final LazyImmutable<T> value = LazyImmutable.def();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.lambda.tuple.PTuple2;
import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

public class LazyMap3PTuple8<T,T1,T2,T3,T4,T5,T6,T7,T8> extends TupleImpl<T1,T2,T,T4,T5,T6,T7,T8> {
private final LazyImmutable<T> value = LazyImmutable.def();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.lambda.tuple.PTuple2;
import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

public class LazyMap4PTuple8<T, T1, T2, T3, T4, T5, T6, T7, T8> extends
TupleImpl<T1, T2, T3, T, T5, T6, T7, T8> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.aol.cyclops.lambda.tuple.lazymap;

import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;

/**
* Created by johnmcclean on 5/21/15.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.aol.cyclops.lambda.tuple.lazymap;

import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;

/**
* Created by johnmcclean on 5/21/15.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.aol.cyclops.lambda.tuple.lazymap;

import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;

/**
* Created by johnmcclean on 5/21/15.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.aol.cyclops.lambda.tuple.lazymap;

import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;
import com.aol.cyclops.lambda.utils.LazyImmutable;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;

import com.aol.cyclops.closures.immutable.LazyImmutable;
import com.aol.cyclops.lambda.tuple.PTuple8;
import com.aol.cyclops.lambda.tuple.TupleImpl;

/**
* Created by johnmcclean on 5/21/15.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.junit.Ignore;
import org.junit.Test;

import com.aol.cyclops.lambda.api.Monoid;
import com.aol.cyclops.sequence.Monoid;

public class ReducerTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.aol.cyclops.lambda.tuple;

import static com.aol.cyclops.functions.Curry.*;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import org.junit.Test;

import com.aol.cyclops.functions.Curry;
import com.aol.cyclops.functions.QuintFunction;
import static com.aol.cyclops.functions.currying.Curry.*;

public class TupleMethodChainingAsyncTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.aol.cyclops.lambda.tuple;

import static com.aol.cyclops.functions.Curry.*;
import static com.aol.cyclops.functions.currying.Curry.*;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

Expand All @@ -9,7 +9,7 @@

import org.junit.Test;

import com.aol.cyclops.functions.Curry;

import com.aol.cyclops.functions.QuintFunction;

public class WithExecutorChainingAsyncTest {
Expand Down

0 comments on commit ed2f77a

Please sign in to comment.