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


Java MutableInt类代码示例

本文整理汇总了Java中org.apache.commons.lang.mutable.MutableInt的典型用法代码示例。如果您正苦于以下问题:Java MutableInt类的具体用法?Java MutableInt怎么用?Java MutableInt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MutableInt类属于org.apache.commons.lang.mutable包,在下文中一共展示了MutableInt类的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());
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:18,代码来源:TestImportRecon.java

示例2: searchObjectsIterative

import org.apache.commons.lang.mutable.MutableInt; //导入依赖的package包/类
protected <O extends ObjectType> void searchObjectsIterative(Class<O> type, ObjectQuery query, Consumer<PrismObject<O>> handler, Integer expectedNumberOfObjects) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
  	Task task = taskManager.createTaskInstance(AbstractModelIntegrationTest.class.getName() + ".assertObjects");
      OperationResult result = task.getResult();
      final MutableInt count = new MutableInt(0);
// Cannot convert to lambda here. Java does not want to understand the generic types properly.
SearchResultMetadata searchMetadata = modelService.searchObjectsIterative(type, query, new ResultHandler<O>() {
		@Override
		public boolean handle(PrismObject<O> object, OperationResult oresult) {
			count.increment();
			if (handler != null) {
				handler.accept(object);
			}
			return true;
		}
	}, null, task, result);
      if (verbose) display(type.getSimpleName()+"s", count.getValue());
      assertEquals("Unexpected number of "+type.getSimpleName()+"s", expectedNumberOfObjects, count.getValue());
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:19,代码来源:AbstractModelIntegrationTest.java

示例3: 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());
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:21,代码来源:TestLdap.java

示例4: 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());
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:19,代码来源:AbstractLdapConnTest.java

示例5: in_which_order_should_multiple_registered_callbacks_executed

import org.apache.commons.lang.mutable.MutableInt; //导入依赖的package包/类
@Test
public void in_which_order_should_multiple_registered_callbacks_executed() throws Exception {
    // arrange / given
    final MutableInt result=new MutableInt(0);
    final DataStoreState initial=DataStoreStates.create(originDataStore);

    final DataStoreState reserved = initial.reserve();
    reserved.register((ds)->result.setValue(result.intValue()/5));                              // result /=5
    reserved.register((ds)->result.setValue(result.intValue()*20));                              // result *=20
    reserved.register((ds)->result.setValue(result.intValue()+7));                               // result += 7

    // act / when
    reserved.release();

    // assert / then
    assertThat("Executed in LIFO-Order?", result.intValue(), is((7*20)/5));
}
 
开发者ID:dataz,项目名称:dataz-core,代码行数:18,代码来源:DataStoreStatesTest.java

示例6: readMatrixFromInputStream

import org.apache.commons.lang.mutable.MutableInt; //导入依赖的package包/类
@Override
public MatrixBlock readMatrixFromInputStream(InputStream is, long rlen, long clen, int brlen, int bclen, long estnnz) 
	throws IOException, DMLRuntimeException 
{
	//allocate output matrix block
	MatrixBlock ret = createOutputMatrixBlock(rlen, clen, (int)rlen, (int)clen, estnnz, true, false);
	
	//core read 
	long lnnz = readCSVMatrixFromInputStream(is, "external inputstream", ret, new MutableInt(0), rlen, clen, 
		brlen, bclen, _props.hasHeader(), _props.getDelim(), _props.isFill(), _props.getFillValue(), true);
			
	//finally check if change of sparse/dense block representation required
	ret.setNonZeros( lnnz );
	ret.examSparsity();
	
	return ret;
}
 
开发者ID:apache,项目名称:systemml,代码行数:18,代码来源:ReaderTextCSV.java

示例7: 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;
}
 
开发者ID:ilsaul,项目名称:PrisonArchitect-translation,代码行数:25,代码来源:Row.java

示例8: 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;
}
 
开发者ID:ilsaul,项目名称:PrisonArchitect-translation,代码行数:26,代码来源:Row.java

示例9: 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);
		}
}
 
开发者ID:termsuite,项目名称:termsuite-core,代码行数:25,代码来源:CasStatCounter.java

示例10: getChannelSelection

import org.apache.commons.lang.mutable.MutableInt; //导入依赖的package包/类
public BaseComponent[] getChannelSelection() {
    String currentLine = " " + StringUtils.capitalize(currentChannel.getName(selfUUID));
    ComponentBuilder builder = new ComponentBuilder(currentLine).bold(true).color(ChatColor.GREEN);

    for (Map.Entry<Channel, MutableInt> entry : unreadChannels.entrySet()) {
        Channel channel = entry.getKey();
        int unreadMessage = entry.getValue().intValue();
        if (!channel.equals(currentChannel)) {
            builder.append(CHANNEL_SEPERATOR).reset();
            builder.append(channel.getName(selfUUID))
                    .color(ChatColor.GREEN)
                    .event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/switch " + channel.getId()));

            //show the number of unread messages
            if (unreadMessage > 0) {
                builder.append("(").reset()
                        .append(Integer.toString(unreadMessage)).color(ChatColor.YELLOW)
                        .append(")").reset();
            }
        }
    }

    return builder.create();
}
 
开发者ID:games647,项目名称:TabChannels,代码行数:25,代码来源:Subscriber.java

示例11: 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());
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:18,代码来源:TestImportRecon.java

示例12: 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());
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:21,代码来源:TestLdap.java

示例13: 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());
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:19,代码来源:AbstractLdapConnTest.java

示例14: MutectDownsampler

import org.apache.commons.lang.mutable.MutableInt; //导入依赖的package包/类
/**
 * @param maxReadsPerAlignmentStart Maximum number of reads per alignment start position. Must be > 0
 * @param stride Length in bases constituting a single pool of reads to downsample
 */
public MutectDownsampler(final int maxReadsPerAlignmentStart,
                         final int maxSuspiciousReadsPerAlignmentStart,
                         final int stride) {
    // convert coverage per base to coverage per stride
    maxCoverage = maxReadsPerAlignmentStart <= 0 ? Integer.MAX_VALUE : (maxReadsPerAlignmentStart * stride);
    this.stride = ParamUtils.isPositive(stride, "stride must be > 0");
    maxSuspiciousReadsPerStride = maxSuspiciousReadsPerAlignmentStart <= 0 ? Integer.MAX_VALUE : stride * ParamUtils.isPositive(maxSuspiciousReadsPerAlignmentStart, "maxSuspiciousReadsPerAlignmentStart must be > 0");

    pendingReads = new ArrayList<>();
    finalizedReads = new ArrayList<>();
    rejectAllReadsInStride = false;
    suspiciousReadCount = new MutableInt(0);

    clearItems();
    resetStats();
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:21,代码来源:MutectDownsampler.java

示例15: incrementCounts

import org.apache.commons.lang.mutable.MutableInt; //导入依赖的package包/类
/**
 *  If the allele is not in the count mappings, then it is not counted.  No exception will be thrown
 *  Modifies count variables in place.
 *
 * @param pileupElement pileup overlapping the alleles
 * @param f1r2Counts a mapping of allele to f1r2 counts
 * @param f2r1Counts a mapping of allele to f2r1 counts
 */
private static void incrementCounts(final PileupElement pileupElement, final Map<Allele, MutableInt> f1r2Counts,
                                final Map<Allele, MutableInt> f2r1Counts, final Allele referenceAllele,
                                    final List<Allele> altAlleles, int minBaseQualityCutoff) {

    final Map<Allele, MutableInt> countMap = isF2R1(pileupElement.getRead()) ? f2r1Counts : f1r2Counts;

    final Allele pileupAllele = GATKProtectedVariantContextUtils.chooseAlleleForRead(pileupElement, referenceAllele, altAlleles, minBaseQualityCutoff);

    if (pileupAllele == null) {
        return;
    }

    if (countMap.containsKey(pileupAllele)) {
        countMap.get(pileupAllele).increment();
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:25,代码来源:OxoGReadCounts.java


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