本文整理汇总了Java中clojure.lang.IPersistentMap类的典型用法代码示例。如果您正苦于以下问题:Java IPersistentMap类的具体用法?Java IPersistentMap怎么用?Java IPersistentMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IPersistentMap类属于clojure.lang包,在下文中一共展示了IPersistentMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assoc
import clojure.lang.IPersistentMap; //导入依赖的package包/类
public IPersistentMap assoc(final Object key, final Object val) {
final int keyHash = Util.hasheq(key);
final MapResult details = MapResult.unchanged();
final CompactMapNode newRootNode = rootNode.updated(null, key, val,
keyHash, 0, details);
if (details.isModified()) {
if (details.hasReplacedValue()) {
return new TrieMap_5Bits(newRootNode, cachedSize);
}
return new TrieMap_5Bits(newRootNode, cachedSize + 1);
}
return this;
}
示例2: put
import clojure.lang.IPersistentMap; //导入依赖的package包/类
@Override
public IMap put(IValue key, IValue value) {
Type newMapType = getType();
Type newKeyType = getType().getKeyType().lub(key.getType());
Type newValueType = getType().getValueType().lub(value.getType());
/*
* special treatment necessary if type contains labels
*/
if (newKeyType != getType().getKeyType()
|| newValueType != getType().getValueType()) {
newMapType = TypeFactory.getInstance().mapType(
newKeyType,
getType().getKeyLabel(),
newValueType,
getType().getValueLabel());
}
return new Map(newMapType, (IPersistentMap) xs.assoc(key, value));
}
示例3: done
import clojure.lang.IPersistentMap; //导入依赖的package包/类
@Override
public IMap done() {
IPersistentMap resultMap = xs.persistent();
if (resultMap.count() == 0) {
/*
* special treatment necessary if type contains labels
*/
Type voidType = TypeFactory.getInstance().voidType();
Type voidMapType = TypeFactory.getInstance().mapType(voidType, mapType.getKeyLabel(), voidType, mapType.getValueLabel());
return new Map(voidMapType, resultMap);
} else {
return new Map(mapType, resultMap);
}
}
示例4: applySetupMap
import clojure.lang.IPersistentMap; //导入依赖的package包/类
/**
* Constructs a new OnyxEnv object directly from a setup map of type IPersistentMap.
* The setupMap should contain keyword value pairs directing how the environment
* should be constructed.
* @param setupMap a map containing keywords and values describing the environment
* @return new OnyxEnv object
*/
public OnyxEnv applySetupMap(IPersistentMap setupMap){
if( (boolean) MapFns.get(setupMap, "generateTenancyId") ) {
generateTenancyId();
}
setTaskScheduler(new TaskScheduler((String) MapFns.get(setupMap, "taskScheduler")));
setVirtualPeerCount(((Long) MapFns.get(setupMap, "virtualPeerCount")).intValue());
loadEnvConfig((String) MapFns.get(setupMap, "envEdn"));
loadPeerConfig((String) MapFns.get(setupMap, "peerEdn"));
String logEdn = (String) MapFns.get(setupMap, "logEdn");
// Don't force people to use logging
if (null != logEdn) {
configureLog(logEdn);
}
return this;
}
示例5: killJob
import clojure.lang.IPersistentMap; //导入依赖的package包/类
/**
* Uses an IPersistentMap of Job data (metadata) which contains a keyword reference
* to the job-id to kill a currently running job.
* @param jobMetadata IPersistentMap containing a keyword linked to the current job id.
* @return a true/false status of job kill effort
* @throws Exception if the job cannot be killed returns false
*/
public boolean killJob(IPersistentMap jobMetadata) throws Exception {
try {
String jobId = (MapFns.get(jobMetadata, "job-id")).toString();
System.out.println("Killing job...");
boolean killStatus = API.killJob(peerConfig, jobId);
System.out.println("Kill status: ");
System.out.println(killStatus);
return killStatus;
}
catch (Exception e) {
System.out.println("Killing job failed. Exception follows:");
System.out.println(e);
return false;
}
}
示例6: without
import clojure.lang.IPersistentMap; //导入依赖的package包/类
public IPersistentMap without(final Object key) {
final int keyHash = Util.hasheq(key);
final MapResult details = MapResult.unchanged();
final CompactMapNode newRootNode = rootNode.removed(null, key,
keyHash, 0, details);
if (details.isModified()) {
assert details.hasReplacedValue();
return new TrieMap_5Bits(newRootNode, cachedSize - 1);
}
return this;
}
示例7: persistent
import clojure.lang.IPersistentMap; //导入依赖的package包/类
@Override
public IPersistentMap persistent() {
if (mutator.get() == null) {
throw new IllegalStateException("Transient already frozen.");
}
mutator.set(null);
return new TrieMap_5Bits(rootNode, cachedSize);
}
示例8: Seq
import clojure.lang.IPersistentMap; //导入依赖的package包/类
private Seq(IPersistentMap meta, long bitmap, Object[] array, ISeq nexts, int lvl) {
super(meta);
this.bitmap = bitmap;
this.array = array;
this.nexts = nexts;
this.lvl = lvl;
}
示例9: create
import clojure.lang.IPersistentMap; //导入依赖的package包/类
static public IPersistentMap create(Map other) {
IPersistentMap ret = EMPTY;
for (Object o : other.entrySet()) {
Map.Entry e = (Entry) o;
ret = ret.assoc(e.getKey(), e.getValue());
}
return ret;
}
示例10: PersistentPrioritySearchQueue
import clojure.lang.IPersistentMap; //导入依赖的package包/类
PersistentPrioritySearchQueue(Comparator kcomp,
Comparator pcomp,
IPersistentMap meta) {
this.winner = null;
this.kcomp = kcomp;
this.pcomp = pcomp;
this._meta = meta;
this._count = 0;
}
示例11: doInsert
import clojure.lang.IPersistentMap; //导入依赖的package包/类
IPersistentMap doInsert (IPersistentMap pm) {
for (int iter = 0; iter < inserts.length; iter += 2)
{
pm = pm.assoc(inserts[iter + 0], inserts[iter + 1]);
}
return pm;
}
示例12: lookup
import clojure.lang.IPersistentMap; //导入依赖的package包/类
void lookup(IPersistentMap pm) {
boolean allFound = true;
for (int iter = 0; iter < inserts.length; iter += 2) {
Object k = inserts[iter + 0];
Object v = inserts[iter + 1];
IMapEntry me = pm.entryAt(k);
allFound &= me != null;
}
if (!allFound) {
throw new RuntimeException("Expected all to be found");
}
}
示例13: insert
import clojure.lang.IPersistentMap; //导入依赖的package包/类
void insert(IPersistentMap pm) {
for (int iter = 0; iter < inserts.length; iter += 2) {
Object k = inserts[iter + 0];
Object v = inserts[iter + 1];
pm = pm.assoc(k, v);
}
if (pm.count() != inserted.count()) {
throw new RuntimeException("Expected count to be equal to inserted");
}
}
示例14: Seq
import clojure.lang.IPersistentMap; //导入依赖的package包/类
public Seq(IPersistentMap meta, List<String> fields,
List<Object> values, int i) {
super(meta);
this.fields = fields;
this.values = values;
assert i >= 0;
this.i = i;
}
示例15: getMap
import clojure.lang.IPersistentMap; //导入依赖的package包/类
@Override
public IPersistentMap getMap() {
if (_map == null) {
setMap(toMap());
}
return _map;
}