/** * for scala compatible, scala-to-java type conversion always has an object wrapper */ public CollectionDataSource(Object... args) { this(new CollectionInputFormat(), args); }
@SuppressWarnings("unchecked") public CollectionDataSource(CollectionInputFormat f, Object... data) { super(f, OperatorInfoHelper.source(), DEFAULT_NAME); if (data.length == 1 && data[0] instanceof Iterator) { f.setIter((Iterator<Object>) data[0]); } else if (data.length == 1 && data[0] instanceof Collection) { checkFormat((Collection<Object>) data[0]); f.setData((Collection<Object>) data[0]); } Collection<Object> tmp = new ArrayList<Object>(); for (Object o : data) { tmp.add(o); } checkFormat(tmp); f.setData(tmp); }
public CollectionDataSource(CollectionInputFormat f, String name, Object[][] data) { super(f, OperatorInfoHelper.source(), name); Collection<Object> tmp = new ArrayList<Object>(); for (Object o : data) { tmp.add(o); } checkFormat(tmp); f.setData(tmp); }
public <T extends Iterator<?>, Serializable> CollectionDataSource(CollectionInputFormat f, T data, String name) { super(f, OperatorInfoHelper.source(), name); f.setIter(data); }
public CollectionDataSource(CollectionInputFormat f, Collection<?> data, String name) { super(f, OperatorInfoHelper.source(), name); checkFormat(data); f.setData(data); }
/** * Creates a new instance for the given input using the given input format. The contract has the default name. * The input types will be checked. If the input types don't agree, an exception will occur. * * @param args * The input data. It should be a collection, an array or a serializable iterator. * @param name * The given name for the Pact, used in plans, logs and progress messages. */ public CollectionDataSource(String name, Object... args) { this(new CollectionInputFormat(), name, args); }
/** * Creates a new instance for the given input using the given input format. * * @param f * The {@link CollectionInputFormat} implementation used to read the data. * @param data * The input data. It should be a collection, an array or a serializable iterator. * @param name * The given name for the Pact, used in plans, logs and progress messages. */ public CollectionDataSource(CollectionInputFormat f, String name, Object... data) { super(f, OperatorInfoHelper.source(), name); Collection<Object> tmp = new ArrayList<Object>(); for (Object o : data) { tmp.add(o); } checkFormat(tmp); f.setData(tmp); }
public CollectionDataSource(Collection<?> args, String name) { this(new CollectionInputFormat(), args, name); }
public <T extends Iterator<?>, Serializable> CollectionDataSource(T args, String name) { this(new CollectionInputFormat(), args, name); }
public CollectionDataSource(String name, Object[][] args) { this(new CollectionInputFormat(), name, args); }