本文整理汇总了Java中clojure.lang.IPersistentCollection类的典型用法代码示例。如果您正苦于以下问题:Java IPersistentCollection类的具体用法?Java IPersistentCollection怎么用?Java IPersistentCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IPersistentCollection类属于clojure.lang包,在下文中一共展示了IPersistentCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorkerDependenciesCount
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
/**
* Returns the amount of worker dependencies in <code>assignment</code>.
*
* @param assignment the assignment to return the amount for
* @return the amount of worker dependencies
*/
public static int getWorkerDependenciesCount(Assignment assignment) {
int result = 0;
IPersistentCollection coll = getWorkerDependencies(assignment);
if (null != coll) {
result = coll.count();
}
return result;
}
示例2: createAssignment
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
/**
* Creates an assignment instance. This method is required to support both, the original Storm version as
* well as the enhanced QM version.
*
* @param masterCodeDir the directory where the pipeline code is located
* @param nodeHost the node-host mapping (assignmentId - physical host names)
* @param executorNodePort the executor - node/port mapping, i.e. [start/end task Id] to port and assignmentId
* @param executorStart the executorId - start time mapping
* @param workerDependencies the optional worker dependencies for enacting changes in the correct sequence
* @return the created assignment instance, <b>null</b> if creation was not possible for some reason
*/
public static Assignment createAssignment(Object masterCodeDir, IPersistentMap nodeHost,
IPersistentMap executorNodePort, IPersistentMap executorStart, IPersistentCollection workerDependencies) {
Assignment result = null;
Constructor<?> consEx = null; // the QM extended version
Constructor<?> consDflt = null; // the default version
for (Constructor<?> cons : Assignment.class.getConstructors()) {
int paramCount = cons.getParameterTypes().length;
if (5 == paramCount) {
consEx = cons;
} else if (4 == paramCount) {
consDflt = cons;
}
}
try {
if (null != consEx) {
result = (Assignment) consEx.newInstance(masterCodeDir, nodeHost, executorNodePort, executorStart,
workerDependencies);
} else if (null != consDflt) {
LOGGER.warn("This is not the QM Storm version running. Falling back to original assignment");
result = (Assignment) consDflt.newInstance(masterCodeDir, nodeHost, executorNodePort, executorStart);
}
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
LOGGER.error(e.getMessage(), e);
}
return result;
}
示例3: empty
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
@Override
public IPersistentCollection empty() {
return EMPTY_MAP;
}
示例4: empty
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
public IPersistentCollection empty() {
// TODO support meta
return new ConfluentHashMap(Node.EMPTY);
}
示例5: cons
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
@Override
public IPersistentCollection cons(Object o) {
return getMap().cons(o);
}
示例6: empty
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
@Override
public IPersistentCollection empty() {
return new IndifferentAccessMap(PersistentArrayMap.EMPTY);
}
示例7: cons
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
public IPersistentCollection cons(Object o) {
return getMap().cons(o);
}
示例8: empty
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
public IPersistentCollection empty() {
return new IndifferentAccessMap(PersistentArrayMap.EMPTY);
}
示例9:
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
public final static ISeq core$cons(Object x, IPersistentCollection xs) {
return (ISeq) core$cons.invoke(x, xs);
}
示例10: replaceInSeq
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
protected static ISeq replaceInSeq(ISeq xs, int i, IValue x) {
IPersistentVector leftRight = core$splitAt(i, xs);
ISeq newLeft = (ISeq) leftRight.nth(0);
ISeq newRight = (ISeq) core$cons.invoke(x, core$next((IPersistentCollection) leftRight.nth(1)));
return core$concat(newLeft, newRight);
}
示例11: toPersistent
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
/**
* Returns a persistent immutable version of this TransientSet. This operation is performed in
* constant time. Note that after this method is called, this transient instance will no longer
* be usable and attempts to modify it will fail.
*/
public ClojureSet<T> toPersistent() {
IPersistentCollection persistent = delegate.persistent();
IPersistentSet asSet = (IPersistentSet) persistent;
return ClojureSet.wrap(asSet);
}
示例12: toPersistent
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
/**
* Returns a persistent immutable version of this TransientList. This operation is performed in
* constant time. Note that after this method is called, this transient instance will no longer
* be usable and attempts to modify it will fail.
*/
public ClojureList<T> toPersistent() {
IPersistentCollection persistent = delegate.persistent();
IPersistentVector asVector = (IPersistentVector) persistent;
return ClojureList.wrap(asVector);
}
示例13: cons
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
public IPersistentCollection cons(Object o) {
return getMap().cons(o);
}
示例14: empty
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
public IPersistentCollection empty() {
return new IndifferentAccessMap(PersistentArrayMap.EMPTY);
}
示例15: count
import clojure.lang.IPersistentCollection; //导入依赖的package包/类
@Override
public int count() {
return ((IPersistentCollection) map).count();
}