[java] Remove multi-return API (#2724)

This commit is contained in:
Hao Chen
2018-08-26 15:04:54 +08:00
committed by Robert Nishihara
parent dbba7f2a53
commit 4f4bea086a
98 changed files with 615 additions and 7637 deletions
+4 -9
View File
@@ -1,5 +1,6 @@
package org.ray.api;
import com.google.common.collect.ImmutableList;
import java.util.List;
import org.ray.api.internal.RayConnector;
import org.ray.util.exception.TaskExecutionException;
@@ -58,25 +59,19 @@ public final class Ray extends Rpc {
* @param numReturns how many of ready is enough
* @param timeoutMilliseconds in millisecond
*/
public static <T> WaitResult<T> wait(RayList<T> waitfor, int numReturns,
public static <T> WaitResult<T> wait(List<RayObject<T>> waitfor, int numReturns,
int timeoutMilliseconds) {
return impl.wait(waitfor, numReturns, timeoutMilliseconds);
}
public static <T> WaitResult<T> wait(RayList<T> waitfor, int numReturns) {
public static <T> WaitResult<T> wait(List<RayObject<T>> waitfor, int numReturns) {
return impl.wait(waitfor, numReturns, Integer.MAX_VALUE);
}
public static <T> WaitResult<T> wait(RayList<T> waitfor) {
public static <T> WaitResult<T> wait(List<RayObject<T>> waitfor) {
return impl.wait(waitfor, waitfor.size(), Integer.MAX_VALUE);
}
public static <T> WaitResult<T> wait(RayObject<T> waitfor, int timeoutMilliseconds) {
RayList<T> waits = new RayList<>();
waits.add(waitfor);
return impl.wait(waits, 1, timeoutMilliseconds);
}
/**
* create actor object.
*/
+8 -44
View File
@@ -1,9 +1,7 @@
package org.ray.api;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.ray.api.internal.RayFunc;
import org.ray.api.funcs.RayFunc;
import org.ray.util.exception.TaskExecutionException;
/**
@@ -39,11 +37,11 @@ public interface RayApi {
/**
* wait until timeout or enough RayObjects are ready.
*
* @param waitfor wait for who
* @param waitfor wait for who
* @param numReturns how many of ready is enough
* @param timeout in millisecond
* @param timeout in millisecond
*/
<T> WaitResult<T> wait(RayList<T> waitfor, int numReturns, int timeout);
<T> WaitResult<T> wait(List<RayObject<T>> waitfor, int numReturns, int timeout);
/**
* create remote actor.
@@ -51,46 +49,12 @@ public interface RayApi {
<T> RayActor<T> create(Class<T> cls);
/**
* submit a new task by invoking a remote function.
* Invoke a remote function.
*
* @param taskId nil
* @param funcCls the target running function's class
* @param lambda the target running function
* @param returnCount the number of to-be-returned objects from funcRun
* @param args arguments to this funcRun, can be its original form or RayObject
* @param func the target running function
* @param args arguments to this funcRun, can be its original form or RayObject
* @return a set of ray objects with their return ids
*/
RayObjects call(UniqueID taskId, Class<?> funcCls, RayFunc lambda, int returnCount,
Object... args);
RayObject call(RayFunc func, Object... args);
/**
* In some cases, we would like the return value of a remote function to be splitted into multiple
* parts so that they are consumed by multiple further functions separately (potentially on
* different machines). We therefore introduce this API so that developers can annotate the
* outputs with a set of labels (usually with Integer or String).
*
* @param taskId nil
* @param funcCls the target running function's class
* @param lambda the target running function
* @param returnids a set of labels to be used by the returned objects
* @param args arguments to this funcRun, can be its original form or
* RayObject<original-type>
* @return a set of ray objects with their labels and return ids
*/
<R, RIDT> RayMap<RIDT, R> callWithReturnLabels(UniqueID taskId, Class<?> funcCls,
RayFunc lambda, Collection<RIDT> returnids, Object... args);
/**
* a special case for the above RID-based labeling as <0...returnCount - 1>.
*
* @param taskId nil
* @param funcCls the target running function's class
* @param lambda the target running function
* @param returnCount the number of to-be-returned objects from funcRun
* @param args arguments to this funcRun, can be its original form or
* RayObject<original-type>
* @return an array of returned objects with their Unique ids
*/
<R> RayList<R> callWithReturnIndices(UniqueID taskId, Class<?> funcCls, RayFunc lambda,
Integer returnCount, Object... args);
}
@@ -1,213 +0,0 @@
package org.ray.api;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
/**
* A RayList&lt;E&gt; holds a list of RayObject&lt;E&gt;,
* and can serves as parameters and/or return values of Ray calls.
*/
public class RayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 2129403593610953658L;
private final ArrayList<RayObject<E>> ids = new ArrayList<>();
public List<RayObject<E>> Objects() {
return ids;
}
@Override
public int size() {
// throw new UnsupportedOperationException();
return ids.size();
}
@Override
public boolean isEmpty() {
// throw new UnsupportedOperationException();
return ids.isEmpty();
}
@Override
public boolean contains(Object o) {
// throw new UnsupportedOperationException();
return ids.contains(o);
}
@Override
public int indexOf(Object o) {
//throw new UnsupportedOperationException();
return ids.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
//throw new UnsupportedOperationException();
return ids.lastIndexOf(o);
}
@Override
public Object[] toArray() {
//throw new UnsupportedOperationException();
return ids.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
//throw new UnsupportedOperationException();
return ids.toArray(a);
}
@Override
public E get(int index) {
return ids.get(index).get();
}
public List<E> get() {
List<UniqueID> objectIds = new ArrayList<>();
for (RayObject<E> id : ids) {
objectIds.add(id.getId());
}
return Ray.get(objectIds);
}
@RayDisabled
@Deprecated
@Override
public E set(int index, E element) {
throw new UnsupportedOperationException();
}
public RayObject<E> set(int index, RayObject<E> element) {
return ids.set(index, element);
}
@RayDisabled
@Deprecated
@Override
public boolean add(E e) {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public void add(int index, E element) {
throw new UnsupportedOperationException();
}
public boolean add(RayObject<E> e) {
return ids.add(e);
}
public void add(int index, RayObject<E> element) {
ids.add(index, element);
}
@RayDisabled
@Deprecated
@Override
public E remove(int index) {
throw new UnsupportedOperationException();
}
@Override
public boolean remove(Object o) {
//throw new UnsupportedOperationException();
return ids.remove(o);
}
@Override
public void clear() {
//throw new UnsupportedOperationException();
ids.clear();
}
@RayDisabled
@Deprecated
@Override
public boolean addAll(Collection<? extends E> c) {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public boolean addAll(int index, Collection<? extends E> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean removeAll(Collection<?> c) {
//throw new UnsupportedOperationException();
return ids.removeAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
//throw new UnsupportedOperationException();
return ids.retainAll(c);
}
@RayDisabled
@Deprecated
@Override
public ListIterator<E> listIterator(int index) {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public ListIterator<E> listIterator() {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public Iterator<E> iterator() {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public List<E> subList(int fromIndex, int toIndex) {
throw new UnsupportedOperationException();
}
public Iterator<RayObject<E>> Iterator() {
return ids.iterator();
}
@Override
public boolean containsAll(Collection<?> c) {
//throw new UnsupportedOperationException();
return ids.containsAll(c);
}
public <T> List<T> getMeta() {
List<UniqueID> objectIds = new ArrayList<>();
for (RayObject<E> id : ids) {
objectIds.add(id.getId());
}
return Ray.getMeta(objectIds);
}
public <TMT> TMT getMeta(int index) {
return ids.get(index).getMeta();
}
public RayObject<E> Get(int index) {
return ids.get(index);
}
public RayObject<E> Remove(int index) {
return ids.remove(index);
}
}
@@ -1,138 +0,0 @@
package org.ray.api;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* A RayMap&lt;K&gt; maintains a map from K to RayObject&lt;V&gt;,
* and serves as parameters and/or return values of Ray calls.
*/
public class RayMap<K, V> extends HashMap<K, V> {
private static final long serialVersionUID = 7296072498584721265L;
private final HashMap<K, RayObject<V>> ids = new HashMap<>();
public HashMap<K, RayObject<V>> Objects() {
return ids;
}
@Override
public int size() {
// throw new UnsupportedOperationException();
return ids.size();
}
@Override
public boolean isEmpty() {
//throw new UnsupportedOperationException();
return ids.isEmpty();
}
@Override
public V get(Object key) {
return ids.get(key).get();
}
// TODO: try to use multiple get
public Map<K, V> get() {
Map<K, V> objs = new HashMap<>();
for (Map.Entry<K, RayObject<V>> id : ids.entrySet()) {
objs.put(id.getKey(), id.getValue().get());
}
return objs;
}
@Override
public boolean containsKey(Object key) {
//throw new UnsupportedOperationException();
return ids.containsKey(key);
}
@RayDisabled
@Deprecated
@Override
public V put(K key, V value) {
throw new UnsupportedOperationException();
}
public RayObject<V> put(K key, RayObject<V> value) {
return ids.put(key, value);
}
@RayDisabled
@Deprecated
@Override
public void putAll(Map<? extends K, ? extends V> m) {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public V remove(Object key) {
throw new UnsupportedOperationException();
}
@Override
public void clear() {
//throw new UnsupportedOperationException();
ids.clear();
}
@Override
public boolean containsValue(Object value) {
//throw new UnsupportedOperationException();
return ids.containsValue(value);
}
@Override
public Set<K> keySet() {
return ids.keySet();
}
@RayDisabled
@Deprecated
@Override
public Collection<V> values() {
throw new UnsupportedOperationException();
}
@RayDisabled
@Deprecated
@Override
public Set<java.util.Map.Entry<K, V>> entrySet() {
throw new UnsupportedOperationException();
}
public <TMT> Map<K, TMT> getMeta() {
Map<K, TMT> metas = new HashMap<>();
for (Map.Entry<K, RayObject<V>> id : ids.entrySet()) {
TMT meta = id.getValue().getMeta();
metas.put(id.getKey(), meta);
}
return metas;
}
public <TMT> TMT getMeta(K key) {
return ids.get(key).getMeta();
}
public RayObject<V> Get(K key) {
return ids.get(key);
}
public RayObject<V> Remove(K key) {
return ids.remove(key);
}
public Collection<RayObject<V>> Values() {
return ids.values();
}
public Set<java.util.Map.Entry<K, RayObject<V>>> EntrySet() {
return ids.entrySet();
}
}
@@ -1,32 +0,0 @@
package org.ray.api;
import org.apache.commons.lang3.ArrayUtils;
/**
* Real object or ray future proxy for multiple returns.
*/
public class RayObjects {
protected RayObject[] objs;
public RayObjects(UniqueID[] ids) {
this.objs = new RayObject[ids.length];
for (int k = 0; k < ids.length; k++) {
this.objs[k] = new RayObject<>(ids[k]);
}
}
public RayObjects(RayObject[] objs) {
this.objs = objs;
}
public RayObject pop() {
RayObject lastObj = objs[objs.length - 1];
objs = ArrayUtils.subarray(objs, 0, objs.length - 1);
return lastObj;
}
public RayObject[] getObjs() {
return objs;
}
}
File diff suppressed because it is too large Load Diff
@@ -1,24 +1,26 @@
package org.ray.api;
import java.util.List;
/**
* The result of Ray.wait() distinguish the ready ones and the remain ones
*/
public class WaitResult<T> {
private final RayList<T> readyOnes;
private final RayList<T> remainOnes;
private final List<RayObject<T>> readyOnes;
private final List<RayObject<T>> remainOnes;
public WaitResult(RayList<T> readyOnes, RayList<T> remainOnes) {
public WaitResult(List<RayObject<T>> readyOnes, List<RayObject<T>> remainOnes) {
this.readyOnes = readyOnes;
this.remainOnes = remainOnes;
}
public RayList<T> getReadyOnes() {
public List<RayObject<T>> getReadyOnes() {
return readyOnes;
}
public RayList<T> getRemainOnes() {
public List<RayObject<T>> getRemainOnes() {
return remainOnes;
}
@@ -1,9 +1,9 @@
package org.ray.api.internal;
package org.ray.api.funcs;
import java.io.Serializable;
/**
* Base of the ray remote function.
* Interface of all Ray remote functions.
*/
public interface RayFunc extends Serializable {
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc0<R> extends RayFunc {
R apply();
}
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc1<T0, R> extends RayFunc {
R apply(T0 t0);
}
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc2<T0, T1, R> extends RayFunc {
R apply(T0 t0, T1 t1);
}
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc3<T0, T1, T2, R> extends RayFunc {
R apply(T0 t0, T1 t1, T2 t2);
}
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc4<T0, T1, T2, T3, R> extends RayFunc {
R apply(T0 t0, T1 t1, T2 t2, T3 t3);
}
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc5<T0, T1, T2, T3, T4, R> extends RayFunc {
R apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4);
}
@@ -0,0 +1,8 @@
// generated automatically, do not modify.
package org.ray.api.funcs;
@FunctionalInterface
public interface RayFunc6<T0, T1, T2, T3, T4, T5, R> extends RayFunc {
R apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5);
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_0_1<R0> extends RayFunc {
R0 apply() throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_0_2<R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply() throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_0_3<R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply() throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_0_4<R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply() throws Throwable;
}
@@ -1,13 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_0_n<R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_0_n_list<R> extends RayFunc {
List<R> apply() throws Throwable;
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_1_1<T0, R0> extends RayFunc {
R0 apply(T0 t0) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_1_2<T0, R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply(T0 t0) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_1_3<T0, R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply(T0 t0) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_1_4<T0, R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply(T0 t0) throws Throwable;
}
@@ -1,13 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_1_n<T0, R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids, T0 t0) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_1_n_list<T0, R> extends RayFunc {
List<R> apply(T0 t0) throws Throwable;
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_2_1<T0, T1, R0> extends RayFunc {
R0 apply(T0 t0, T1 t1) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_2_2<T0, T1, R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply(T0 t0, T1 t1) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_2_3<T0, T1, R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply(T0 t0, T1 t1) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_2_4<T0, T1, R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply(T0 t0, T1 t1) throws Throwable;
}
@@ -1,13 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_2_n<T0, T1, R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids, T0 t0, T1 t1) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_2_n_list<T0, T1, R> extends RayFunc {
List<R> apply(T0 t0, T1 t1) throws Throwable;
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_3_1<T0, T1, T2, R0> extends RayFunc {
R0 apply(T0 t0, T1 t1, T2 t2) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_3_2<T0, T1, T2, R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply(T0 t0, T1 t1, T2 t2) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_3_3<T0, T1, T2, R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply(T0 t0, T1 t1, T2 t2) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_3_4<T0, T1, T2, R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply(T0 t0, T1 t1, T2 t2) throws Throwable;
}
@@ -1,13 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_3_n<T0, T1, T2, R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids, T0 t0, T1 t1, T2 t2) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_3_n_list<T0, T1, T2, R> extends RayFunc {
List<R> apply(T0 t0, T1 t1, T2 t2) throws Throwable;
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_4_1<T0, T1, T2, T3, R0> extends RayFunc {
R0 apply(T0 t0, T1 t1, T2 t2, T3 t3) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_4_2<T0, T1, T2, T3, R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply(T0 t0, T1 t1, T2 t2, T3 t3) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_4_3<T0, T1, T2, T3, R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply(T0 t0, T1 t1, T2 t2, T3 t3) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_4_4<T0, T1, T2, T3, R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply(T0 t0, T1 t1, T2 t2, T3 t3) throws Throwable;
}
@@ -1,13 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_4_n<T0, T1, T2, T3, R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids, T0 t0, T1 t1, T2 t2, T3 t3) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_4_n_list<T0, T1, T2, T3, R> extends RayFunc {
List<R> apply(T0 t0, T1 t1, T2 t2, T3 t3) throws Throwable;
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_5_1<T0, T1, T2, T3, T4, R0> extends RayFunc {
R0 apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_5_2<T0, T1, T2, T3, T4, R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_5_3<T0, T1, T2, T3, T4, R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_5_4<T0, T1, T2, T3, T4, R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) throws Throwable;
}
@@ -1,14 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_5_n<T0, T1, T2, T3, T4, R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_5_n_list<T0, T1, T2, T3, T4, R> extends RayFunc {
List<R> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) throws Throwable;
}
@@ -1,11 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_6_1<T0, T1, T2, T3, T4, T5, R0> extends RayFunc {
R0 apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns2;
@FunctionalInterface
public interface RayFunc_6_2<T0, T1, T2, T3, T4, T5, R0, R1> extends RayFunc {
MultipleReturns2<R0, R1> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns3;
@FunctionalInterface
public interface RayFunc_6_3<T0, T1, T2, T3, T4, T5, R0, R1, R2> extends RayFunc {
MultipleReturns3<R0, R1, R2> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
import org.ray.api.returns.MultipleReturns4;
@FunctionalInterface
public interface RayFunc_6_4<T0, T1, T2, T3, T4, T5, R0, R1, R2, R3> extends RayFunc {
MultipleReturns4<R0, R1, R2, R3> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) throws Throwable;
}
@@ -1,14 +0,0 @@
package org.ray.api.funcs;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_6_n<T0, T1, T2, T3, T4, T5, R, RIDT> extends RayFunc {
Map<RIDT, R> apply(Collection<RIDT> returnids, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
throws Throwable;
}
@@ -1,12 +0,0 @@
package org.ray.api.funcs;
import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.ray.api.internal.RayFunc;
@FunctionalInterface
public interface RayFunc_6_n_list<T0, T1, T2, T3, T4, T5, R> extends RayFunc {
List<R> apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) throws Throwable;
}
@@ -1,18 +0,0 @@
package org.ray.api.returns;
/**
* Multiple return objects for user's method.
*/
public class MultipleReturns {
protected final Object[] values;
public MultipleReturns(Object[] values) {
this.values = values;
}
public Object[] getValues() {
return values;
}
}
@@ -1,17 +0,0 @@
package org.ray.api.returns;
@SuppressWarnings("unchecked")
public class MultipleReturns2<R0, R1> extends MultipleReturns {
public MultipleReturns2(R0 r0, R1 r1) {
super(new Object[] {r0, r1});
}
public R0 get0() {
return (R0) this.values[0];
}
public R1 get1() {
return (R1) this.values[1];
}
}
@@ -1,21 +0,0 @@
package org.ray.api.returns;
@SuppressWarnings("unchecked")
public class MultipleReturns3<R0, R1, R2> extends MultipleReturns {
public MultipleReturns3(R0 r0, R1 r1, R2 r2) {
super(new Object[] {r0, r1, r2});
}
public R0 get0() {
return (R0) this.values[0];
}
public R1 get1() {
return (R1) this.values[1];
}
public R2 get2() {
return (R2) this.values[2];
}
}
@@ -1,25 +0,0 @@
package org.ray.api.returns;
@SuppressWarnings("unchecked")
public class MultipleReturns4<R0, R1, R2, R3> extends MultipleReturns {
public MultipleReturns4(R0 r0, R1 r1, R2 r2, R3 r3) {
super(new Object[] {r0, r1, r2, r3});
}
public R0 get0() {
return (R0) this.values[0];
}
public R1 get1() {
return (R1) this.values[1];
}
public R2 get2() {
return (R2) this.values[2];
}
public R3 get3() {
return (R3) this.values[3];
}
}
@@ -1,25 +0,0 @@
package org.ray.api.returns;
import org.ray.api.RayObject;
import org.ray.api.RayObjects;
import org.ray.api.UniqueID;
@SuppressWarnings({"rawtypes", "unchecked"})
public class RayObjects2<R0, R1> extends RayObjects {
public RayObjects2(UniqueID[] ids) {
super(ids);
}
public RayObjects2(RayObject[] objs) {
super(objs);
}
public RayObject<R0> r0() {
return objs[0];
}
public RayObject<R1> r1() {
return objs[1];
}
}
@@ -1,29 +0,0 @@
package org.ray.api.returns;
import org.ray.api.RayObject;
import org.ray.api.RayObjects;
import org.ray.api.UniqueID;
@SuppressWarnings({"rawtypes", "unchecked"})
public class RayObjects3<R0, R1, R2> extends RayObjects {
public RayObjects3(UniqueID[] ids) {
super(ids);
}
public RayObjects3(RayObject[] objs) {
super(objs);
}
public RayObject<R0> r0() {
return objs[0];
}
public RayObject<R1> r1() {
return objs[1];
}
public RayObject<R2> r2() {
return objs[2];
}
}
@@ -1,33 +0,0 @@
package org.ray.api.returns;
import org.ray.api.RayObject;
import org.ray.api.RayObjects;
import org.ray.api.UniqueID;
@SuppressWarnings({"rawtypes", "unchecked"})
public class RayObjects4<R0, R1, R2, R3> extends RayObjects {
public RayObjects4(UniqueID[] ids) {
super(ids);
}
public RayObjects4(RayObject[] objs) {
super(objs);
}
public RayObject<R0> r0() {
return objs[0];
}
public RayObject<R1> r1() {
return objs[1];
}
public RayObject<R2> r2() {
return objs[2];
}
public RayObject<R3> r3() {
return objs[3];
}
}