当前位置: 首页>>代码示例>>Java>>正文


Java IPersistentMap类代码示例

本文整理汇总了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;
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:18,代码来源:TrieMap_5Bits.java

示例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));
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:23,代码来源:Map.java

示例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);
	}
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:17,代码来源:MapWriter.java

示例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;
}
 
开发者ID:onyx-platform,项目名称:onyx-java,代码行数:27,代码来源:OnyxEnv.java

示例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;
	}
}
 
开发者ID:onyx-platform,项目名称:onyx-java,代码行数:23,代码来源:OnyxEnv.java

示例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;
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:15,代码来源:TrieMap_5Bits.java

示例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);
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:10,代码来源:TrieMap_5Bits.java

示例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;
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:8,代码来源:ConfluentHashMap.java

示例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;
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:9,代码来源:PersistentPrioritySearchQueue.java

示例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;
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:10,代码来源:PersistentPrioritySearchQueue.java

示例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;
}
 
开发者ID:mrange,项目名称:fsharpadvent2016,代码行数:8,代码来源:main.java

示例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");
    }
}
 
开发者ID:mrange,项目名称:fsharpadvent2016,代码行数:13,代码来源:main.java

示例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");
    }
}
 
开发者ID:mrange,项目名称:fsharpadvent2016,代码行数:11,代码来源:main.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:9,代码来源:TupleImpl.java

示例15: getMap

import clojure.lang.IPersistentMap; //导入依赖的package包/类
@Override
public IPersistentMap getMap() {
	if (_map == null) {
		setMap(toMap());
	}
	return _map;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:TupleImpl.java


注:本文中的clojure.lang.IPersistentMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。