本文整理汇总了Java中org.apache.commons.lang.mutable.MutableInt.decrement方法的典型用法代码示例。如果您正苦于以下问题:Java MutableInt.decrement方法的具体用法?Java MutableInt.decrement怎么用?Java MutableInt.decrement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.mutable.MutableInt
的用法示例。
在下文中一共展示了MutableInt.decrement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectTerm
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void collectTerm(int fieldId,
MiruTermId termId,
boolean fieldTermIn,
List<MiruTermId> fieldTermIds,
Map<FieldAndTermId, MutableInt> termCollector) throws Exception {
fieldTermIds.add(termId);
if (termCollector != null) {
MutableInt count = termCollector.computeIfAbsent(new FieldAndTermId(fieldId, termId), key -> new MutableInt());
if (fieldTermIn) {
count.increment();
} else {
count.decrement();
}
}
}
示例2: run
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public void run() {
//let the players update smoother
int remainingUpdates = getNextUpdates();
for (Map.Entry<Player, MutableInt> entry : queue.entrySet()) {
Player player = entry.getKey();
MutableInt remainingTicks = entry.getValue();
if (remainingTicks.intValue() == 0) {
if (remainingUpdates != 0) {
//Smoother refreshing; limit the updates
plugin.getScoreboardManager().onUpdate(player);
remainingTicks.setValue(20 * Settings.getInterval());
remainingUpdates--;
}
} else {
remainingTicks.decrement();
}
}
nextGlobalUpdate--;
if (nextGlobalUpdate == 0) {
nextGlobalUpdate = 20 * Settings.getInterval();
//update globals
plugin.getReplaceManager().updateGlobals();
}
}
示例3: enableBehaviour
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public void enableBehaviour(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
if (logger.isDebugEnabled())
{
logger.debug("Behaviour: ENABLE (" + AlfrescoTransactionSupport.getTransactionId() + "): " + nodeRef + "/ALL");
}
TransactionalResourceHelper.decrementCount(KEY_FILTER_COUNT, false);
if (!TransactionalResourceHelper.isResourcePresent(KEY_INSTANCE_FILTERS))
{
// Nothing was disabled
return;
}
nodeRef = tenantService.getName(nodeRef);
Map<NodeRef, MutableInt> instanceFilters = TransactionalResourceHelper.getMap(KEY_INSTANCE_FILTERS);
MutableInt filter = instanceFilters.get(nodeRef);
if (filter == null)
{
// Instance was not disabled
return;
}
else if (filter.intValue() <= 0)
{
// Can't go below zero for this
}
else
{
filter.decrement();
}
if (logger.isDebugEnabled())
{
logger.debug(" Now:" + filter);
}
}
示例4: decrement
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private boolean decrement(Map<Object, MutableInt> map, Object obj) {
MutableInt i = map.get(obj);
if(i == null) {
return false;
}
i.decrement();
if(i.intValue() == 0) {
map.remove(obj);
}
return true;
}
示例5: decrVertexTaskCount
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void decrVertexTaskCount(Priority priority, RequestPriorityStats stats, int vertexIndex) {
Integer vertexIndexInt = vertexIndex;
MutableInt taskCount = stats.vertexTaskCount.get(vertexIndexInt);
taskCount.decrement();
if (taskCount.intValue() <= 0) {
removeVertexFromRequestStats(priority, stats, vertexIndexInt);
}
}