本文整理汇总了Java中org.apache.commons.lang.mutable.MutableInt.increment方法的典型用法代码示例。如果您正苦于以下问题:Java MutableInt.increment方法的具体用法?Java MutableInt.increment怎么用?Java MutableInt.increment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.mutable.MutableInt
的用法示例。
在下文中一共展示了MutableInt.increment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertDummyAccountShadows
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void assertDummyAccountShadows(int expected, boolean raw, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(RESOURCE_DUMMY_OID,
new QName(RESOURCE_DUMMY_NAMESPACE, "AccountObjectClass"), prismContext);
final MutableInt count = new MutableInt(0);
ResultHandler<ShadowType> handler = (shadow, parentResult) -> {
count.increment();
display("Found",shadow);
return true;
};
Collection<SelectorOptions<GetOperationOptions>> options = null;
if (raw) {
options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
}
modelService.searchObjectsIterative(ShadowType.class, query, handler, options, task, result);
assertEquals("Unexpected number of search results (raw="+raw+")", expected, count.getValue());
}
示例2: assertOpenDjAccountShadows
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void assertOpenDjAccountShadows(int expected, boolean raw, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(RESOURCE_OPENDJ_OID,
new QName(RESOURCE_OPENDJ_NAMESPACE, "inetOrgPerson"), prismContext);
final MutableInt count = new MutableInt(0);
ResultHandler<ShadowType> handler = new ResultHandler<ShadowType>() {
@Override
public boolean handle(PrismObject<ShadowType> shadow, OperationResult parentResult) {
count.increment();
display("Found",shadow);
return true;
}
};
Collection<SelectorOptions<GetOperationOptions>> options = null;
if (raw) {
options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
}
modelService.searchObjectsIterative(ShadowType.class, query, handler, options, task, result);
assertEquals("Unexpected number of search results (raw="+raw+")", expected, count.getValue());
}
示例3: singleInfernoSearch
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void singleInfernoSearch(ObjectQuery query, int expectedNumberOfResults, Integer offset, Integer maxSize, String sortAttrName, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectPaging paging = ObjectPaging.createPaging(offset, maxSize);
paging.setOrdering(getAttributePath(resource, sortAttrName), OrderDirection.ASCENDING);
query.setPaging(paging);
final MutableInt count = new MutableInt();
ResultHandler<ShadowType> handler = new ResultHandler<ShadowType>() {
@Override
public boolean handle(PrismObject<ShadowType> object, OperationResult parentResult) {
count.increment();
return true;
}
};
modelService.searchObjectsIterative(ShadowType.class, query, handler, null, task, result);
assertEquals("Unexpected number of search results", expectedNumberOfResults, count.intValue());
}
示例4: getWord
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private static String getWord(String line, MutableInt pos) {
String word = "";
boolean marker = false;
boolean start = false;
char ch;
word = "";
if (line.length() > 0) {
do {
ch = line.charAt(pos.intValue());
start |= ((ch != ' ') || (ch != '\t'));
if (ch == '"') marker = !marker;
if ((marker && start) || (start && (ch != ' ' && ch != '\t'))) {
word += ch;
}
pos.increment();
} while ((pos.intValue() < line.length()) && (marker || !start || (ch != ' ' && ch != '\t')));
}
if (word.length() == 0) word = null;
return word;
}
示例5: getAllFromPos
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private String getAllFromPos(String line, MutableInt pos) {
String word = "";
boolean start = false;
char ch;
word = "";
if (line.length() > 0) {
do {
ch = line.charAt(pos.intValue());
start |= ((ch != ' ') && (ch != '\t'));
if (start || (ch != ' ' && ch != '\t')) {
if (startValue == 0) startValue = pos.intValue();
word += ch;
}
pos.increment();
} while (pos.intValue() < line.length());
endValue = pos.intValue();
}
if (word.length() == 0) word = null;
return word;
}
示例6: process
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
this.docIt++;
Optional<SourceDocumentInformation> sourceDocumentAnnotation = JCasUtils.getSourceDocumentAnnotation(aJCas);
if(sourceDocumentAnnotation.isPresent())
this.cumulatedFileSize += sourceDocumentAnnotation.get().getDocumentSize();
FSIterator<Annotation> it = aJCas.getAnnotationIndex().iterator();
Annotation a;
MutableInt i;
while(it.hasNext()) {
a = it.next();
i = counters.get(a.getType().getShortName());
if(i == null)
counters.put(a.getType().getShortName(), new MutableInt(1));
else
i.increment();
}
if(periodicStatEnabled && this.docIt % this.docPeriod == 0)
try {
traceToFile();
} catch (IOException e) {
throw new AnalysisEngineProcessException(e);
}
}
示例7: assertDummyAccountShadows
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void assertDummyAccountShadows(int expected, boolean raw, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(RESOURCE_DUMMY_OID,
new QName(RESOURCE_DUMMY_NAMESPACE, "AccountObjectClass"), prismContext);
final MutableInt count = new MutableInt(0);
ResultHandler<ShadowType> handler = (shadow, parentResult) -> {
count.increment();
display("Found",shadow);
return true;
};
Collection<SelectorOptions<GetOperationOptions>> options = null;
if (raw) {
options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
}
modelService.searchObjectsIterative(ShadowType.class, query, handler, options, task, result);
assertEquals("Unexpected number of search results (raw="+raw+")", expected, count.getValue());
}
示例8: assertOpenDjAccountShadows
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void assertOpenDjAccountShadows(int expected, boolean raw, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(RESOURCE_OPENDJ_OID,
new QName(RESOURCE_OPENDJ_NAMESPACE, "inetOrgPerson"), prismContext);
final MutableInt count = new MutableInt(0);
ResultHandler<ShadowType> handler = new ResultHandler<ShadowType>() {
@Override
public boolean handle(PrismObject<ShadowType> shadow, OperationResult parentResult) {
count.increment();
display("Found",shadow);
return true;
}
};
Collection<SelectorOptions<GetOperationOptions>> options = null;
if (raw) {
options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
}
modelService.searchObjectsIterative(ShadowType.class, query, handler, options, task, result);
assertEquals("Unexpected number of search results (raw="+raw+")", expected, count.getValue());
}
示例9: singleInfernoSearch
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void singleInfernoSearch(ObjectQuery query, int expectedNumberOfResults, Integer offset, Integer maxSize, String sortAttrName, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
ObjectPaging paging = ObjectPaging.createPaging(offset, maxSize);
paging.setOrdering(getAttributePath(resource, sortAttrName), OrderDirection.ASCENDING);
query.setPaging(paging);
final MutableInt count = new MutableInt();
ResultHandler<ShadowType> handler = new ResultHandler<ShadowType>() {
@Override
public boolean handle(PrismObject<ShadowType> object, OperationResult parentResult) {
count.increment();
return true;
}
};
modelService.searchObjectsIterative(ShadowType.class, query, handler, null, task, result);
assertEquals("Unexpected number of search results", expectedNumberOfResults, count.intValue());
}
示例10: 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();
}
}
}
示例11: traverseFilterQueryAndPopulateMap
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree tree,
Map<Integer, FilterQuery> filterQueryMap, MutableInt currentId) {
int currentNodeId = currentId.intValue();
currentId.increment();
final List<Integer> f = new ArrayList<Integer>();
if (null != tree.getChildren()) {
for (final FilterQueryTree c : tree.getChildren()) {
int childNodeId = currentId.intValue();
currentId.increment();
f.add(childNodeId);
final FilterQuery q = traverseFilterQueryAndPopulateMap(c, filterQueryMap, currentId);
filterQueryMap.put(childNodeId, q);
}
}
FilterQuery query = new FilterQuery();
query.setColumn(tree.getColumn());
query.setId(currentNodeId);
query.setNestedFilterQueryIds(f);
query.setOperator(tree.getOperator());
query.setValue(tree.getValue());
return query;
}
示例12: traverseHavingFilterQueryAndPopulateMap
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private static HavingFilterQuery traverseHavingFilterQueryAndPopulateMap(HavingQueryTree tree,
Map<Integer, HavingFilterQuery> filterQueryMap, MutableInt currentId) {
int currentNodeId = currentId.intValue();
currentId.increment();
final List<Integer> filterIds = new ArrayList<Integer>();
if (null != tree.getChildren()) {
for (final HavingQueryTree child : tree.getChildren()) {
int childNodeId = currentId.intValue();
currentId.increment();
filterIds.add(childNodeId);
final HavingFilterQuery filterQuery = traverseHavingFilterQueryAndPopulateMap(child, filterQueryMap, currentId);
filterQueryMap.put(childNodeId, filterQuery);
}
}
HavingFilterQuery havingFilterQuery = new HavingFilterQuery();
havingFilterQuery.setAggregationInfo(tree.getAggregationInfo());
havingFilterQuery.setId(currentNodeId);
havingFilterQuery.setNestedFilterQueryIds(filterIds);
havingFilterQuery.setOperator(tree.getOperator());
havingFilterQuery.setValue(tree.getValue());
return havingFilterQuery;
}
示例13: processException
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void processException(Exception e, MethodInvocation invocation, MutableInt attempt) {
StringBuilder message = new StringBuilder("When invoking method \"").append(invocation.getMethod().getName())
.append("\" caught \"").append(e.getMessage()).append("\". Attempt #").append(attempt);
attempt.increment();
if (attempt.intValue() <= TransactionRetryInterceptor.MAX_ATTEMPTS) {
message.append(". Retrying.");
} else {
message.append(". Giving up.");
}
TransactionRetryInterceptor.log.warn(message);
}
示例14: parseType
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private Synonym.Type parseType(String value, MutableInt fromIndex) {
Synonym.Type type = Synonym.Type.RELATED;
while(fromIndex.intValue() < value.length()
&& Character.isWhitespace(value.charAt(fromIndex.intValue()))) {
fromIndex.increment();
}
int start = fromIndex.intValue();
while(fromIndex.intValue() < value.length()
&& Character.isLetter(value.charAt(fromIndex.intValue()))) {
fromIndex.increment();
}
if(start < fromIndex.intValue()) {
String scope = value.substring(start, fromIndex.intValue());
try {
type = Synonym.Type.valueOf(scope.toUpperCase());
} catch(IllegalArgumentException e) {
type = Synonym.Type.RELATED;
fromIndex.setValue(start);
}
}
return type;
}
示例15: offer
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
/**
* Adds object
* @param e object to be added
* @return true if offer() succeeds
*/
@SuppressWarnings("unchecked")
public boolean offer(E e)
{
MutableInt ival = hmap.get(e);
if (ival != null) { // already exists, so no insertion
ival.increment();
return true;
}
if (q.size() < qbound) {
if (ival == null) {
hmap.put(e, new MutableInt(1));
}
return q.offer(e);
}
boolean ret = false;
boolean insert;
Comparable<? super E> head = (Comparable<? super E>)q.peek();
if (ascending) { // means head is the lowest value due to inversion
insert = head.compareTo(e) < 0; // e > head
} else { // means head is the highest value due to inversion
insert = head.compareTo(e) > 0; // head is < e
}
// object e makes it, someone else gets dropped
if (insert && q.offer(e)) {
hmap.put(e, new MutableInt(1));
ret = true;
// the dropped object will never make it to back in anymore
E drop = q.poll();
hmap.remove(drop);
}
return ret;
}