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


Java TreeSet.clear方法代码示例

本文整理汇总了Java中java.util.TreeSet.clear方法的典型用法代码示例。如果您正苦于以下问题:Java TreeSet.clear方法的具体用法?Java TreeSet.clear怎么用?Java TreeSet.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.TreeSet的用法示例。


在下文中一共展示了TreeSet.clear方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populateEntryEventList

import java.util.TreeSet; //导入方法依赖的package包/类
private void populateEntryEventList(DistributedMember target,
    ArrayList<ArrayList<DistTxThinEntryState>> entryEventList, TreeSet<String> sortedRegionMap) {
  DistTXCoordinatorInterface distTxItem = target2realDeals.get(target);
  sortedRegionMap.clear();
  distTxItem.gatherAffectedRegionsName(sortedRegionMap, false, true);

  // Get region as per sorted order of region path
  entryEventList.clear();
  for (String rName : sortedRegionMap) {
    ArrayList<DistTxThinEntryState> entryStates = this.txEntryEventMap.get(rName);
    if (entryStates == null) {
      throw new UnsupportedOperationInTransactionException(LocalizedStrings.DISTTX_TX_EXPECTED
          .toLocalizedString("entryStates for " + rName + " at target " + target, "null"));
    }
    entryEventList.add(entryStates);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:DistTXStateProxyImplOnCoordinator.java

示例2: applyTextRecovery

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Applies text recovery to the gray image. See section IV.B
 * @param map The gray image after global thresholding.
 * @param postLocalThresholdMap The gray image after local thresholding.
 * @return The gray image after text recovery.
 */
public static GrayImage applyTextRecovery(GrayImage map,
	GrayImage postLocalThresholdMap) {

	GrayImage res = textLabeling(map, postLocalThresholdMap);
	TreeSet<Pixel> newTextPixels = new TreeSet<>();

	for (int j = 0; j < map.getHeight(); ++j) {
		for (int i = 0; i < map.getWidth(); ++i) {
			newTextPixels.clear();
			if (res.getValue(i, j) > 0) {
				int x = i, y = j;
				do {
					if (!newTextPixels.isEmpty()) {
						Point p = newTextPixels.pollFirst();
						x = (int) p.getX();
						y = (int) p.getY();
					}
					applyHysteresisMask(map, res, x, y, newTextPixels);
				} while (!newTextPixels.isEmpty());
			}
		}
	}

	return res;
}
 
开发者ID:MX-Futhark,项目名称:text-position-detector,代码行数:32,代码来源:EdgeMap.java

示例3: beforeCommit

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Release any open locks with extreme prejudice i.e. the commit will fail if the
 * locks cannot be released.  The locks are released in a single transaction -
 * ordering is therefore not important.  Should this fail, the post-commit phase
 * will do a final cleanup with individual locks.
 */
@Override
public void beforeCommit(boolean readOnly)
{
    final String txnId = AlfrescoTransactionSupport.getTransactionId();
    final TreeSet<QName> heldLocks = TransactionalResourceHelper.getTreeSet(KEY_RESOURCE_LOCKS);
    // Shortcut if there are no locks
    if (heldLocks.size() == 0)
    {
        return;
    }
    // Clean up the locks
    RetryingTransactionCallback<Object> releaseCallback = new RetryingTransactionCallback<Object>()
    {
        public Object execute() throws Throwable
        {
            // Any one of the them could fail
            for (QName lockQName : heldLocks)
            {
                lockDAO.releaseLock(lockQName, txnId, false);
            }
            return null;
        }
    };
    retryingTransactionHelper.doInTransaction(releaseCallback, false, true);
    // So they were all successful
    heldLocks.clear();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:JobLockServiceImpl.java

示例4: getBestDefUseCoveringSolutions

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Get the currently best solutions based on the def-use chain coverage. This method will return a Set of those
 * solutions that have the highest number of def-use chains not yet covered by the already picked solutions.
 * @param solutionTreeSet The Set of solutions to choose the beast ones from.
 * @return A Set of the best solutions based on the def-use coverage.
 */
private TreeSet<TestCaseSolutionEliminationWrap> getBestDefUseCoveringSolutions(
		TreeSet<TestCaseSolutionEliminationWrap> solutionTreeSet) {
	// TreeSet for the best solutions.
	TreeSet<TestCaseSolutionEliminationWrap> bestSolutions = new TreeSet<TestCaseSolutionEliminationWrap>();

	// Starting at zero.
	long highestDefUseChainsCoverageCount = 0;
	// Iterate through all solutions.
	Iterator<TestCaseSolutionEliminationWrap> solutionIterator = solutionTreeSet.iterator();
	while (solutionIterator.hasNext()) {
		TestCaseSolutionEliminationWrap solution = solutionIterator.next();
		// Better or equal to the yet best solution?
		long defUseChainsCoverageCount = solution.getNumberOfCoveredDefUseChains();
		if (defUseChainsCoverageCount >= highestDefUseChainsCoverageCount) {
			// Is it even better?
			if (defUseChainsCoverageCount > highestDefUseChainsCoverageCount) {
				// Remove all solutions from the TreeSet.
				bestSolutions.clear();

				// Make this solutions the best one, yet.
				highestDefUseChainsCoverageCount = defUseChainsCoverageCount;
			}
			// Add the found to the TreeSet of the best solutions.
			bestSolutions.add(solution);
		}
	}

	// Return the best solutions found.
	return bestSolutions;
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:37,代码来源:TestCaseEliminationAlgorithms.java

示例5: getBestControlFlowCoveringSolutions

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Get the currently best solutions based on the control graph edge coverage. This method will return a Set
 * of those solutions that have the highest number of control graph edges not yet covered by the already
 * picked solutions.
 * @param solutionTreeSet The Set of solutions to choose the beast ones from.
 * @return A Set of the best solutions based on the control graph coverage.
 */
private TreeSet<TestCaseSolutionEliminationWrap> getBestControlFlowCoveringSolutions(
		TreeSet<TestCaseSolutionEliminationWrap> solutionTreeSet) {
	// TreeSet for the best solutions.
	TreeSet<TestCaseSolutionEliminationWrap> bestSolutions = new TreeSet<TestCaseSolutionEliminationWrap>();

	// Starting at zero.
	long highestControlGraphEdgeCoverageCount = 0;
	// Iterate through all solutions.
	Iterator<TestCaseSolutionEliminationWrap> solutionIterator = solutionTreeSet.iterator();
	while (solutionIterator.hasNext()) {
		TestCaseSolutionEliminationWrap solution = solutionIterator.next();
		// Better or equal to the yet best solution?
		long controlGraphEdgeCoverageCount = solution.getNumberOfCoveredControlGraphEdges();
		if (controlGraphEdgeCoverageCount >= highestControlGraphEdgeCoverageCount) {
			// Is it even better?
			if (controlGraphEdgeCoverageCount > highestControlGraphEdgeCoverageCount) {
				// Remove all solutions from the TreeSet.
				bestSolutions.clear();

				// Make this solutions the best one, yet.
				highestControlGraphEdgeCoverageCount = controlGraphEdgeCoverageCount;
			}
			// Add the found to the TreeSet of the best solutions.
			bestSolutions.add(solution);
		}
	}

	// Return the best solutions found.
	return bestSolutions;
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:38,代码来源:TestCaseEliminationAlgorithms.java

示例6: populateEntryEventMap

import java.util.TreeSet; //导入方法依赖的package包/类
private void populateEntryEventMap(DistributedMember target,
    ArrayList<ArrayList<DistTxThinEntryState>> entryEventList, TreeSet<String> sortedRegionName) {
  if (this.txEntryEventMap == null) {
    this.txEntryEventMap = new HashMap<String, ArrayList<DistTxThinEntryState>>();
  }

  DistTXCoordinatorInterface distTxIface = target2realDeals.get(target);
  if (distTxIface.getPrimaryTransactionalOperations() != null
      && distTxIface.getPrimaryTransactionalOperations().size() > 0) {
    sortedRegionName.clear();
    distTxIface.gatherAffectedRegionsName(sortedRegionName, true, false);

    if (sortedRegionName.size() != entryEventList.size()) {
      throw new UnsupportedOperationInTransactionException(
          LocalizedStrings.DISTTX_TX_EXPECTED.toLocalizedString(
              "size of " + sortedRegionName.size() + " {" + sortedRegionName + "}"
                  + " for target=" + target,
              entryEventList.size() + " {" + entryEventList + "}"));
    }

    int index = 0;
    // Get region as per sorted order of region path
    for (String rName : sortedRegionName) {
      txEntryEventMap.put(rName, entryEventList.get(index++));
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:28,代码来源:DistTXStateProxyImplOnCoordinator.java

示例7: testDirector

import java.util.TreeSet; //导入方法依赖的package包/类
private static void testDirector(ModelPerformer[] performers) throws Exception
{
    final TreeSet<Integer> played = new TreeSet<Integer>();
    ModelDirectedPlayer player = new ModelDirectedPlayer()
    {
        public void play(int performerIndex,
                ModelConnectionBlock[] connectionBlocks) {
            played.add(performerIndex);
        }
    };
    ModelStandardIndexedDirector idirector =
        new ModelStandardIndexedDirector(performers, player);
    ModelStandardDirector director =
        new ModelStandardDirector(performers, player);

    for (int n = 0; n < 128; n++)
    {
        for (int v = 0; v < 128; v++)
        {
            director.noteOn(n, v);
            String p1 = treeToString(played);
            played.clear();
            idirector.noteOn(n, v);
            String p2 = treeToString(played);
            played.clear();
            if(!p1.equals(p2))
                throw new Exception(
                        "Note = " + n + ", Vel = " + v + " failed");
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:ModelStandardIndexedDirectorTest.java

示例8: testClear

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * clear removes all elements
 */
public void testClear() {
    TreeSet q = populatedSet(SIZE);
    q.clear();
    assertTrue(q.isEmpty());
    assertEquals(0, q.size());
    q.add(new Integer(1));
    assertFalse(q.isEmpty());
    q.clear();
    assertTrue(q.isEmpty());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:TreeSetTest.java

示例9: decomposeHaplotypesIntoVariantContexts

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Go through the haplotypes we assembled, and decompose them into their constituent variant contexts
 *
 * @param haplotypes the list of haplotypes we're working with
 * @param readLikelihoods map from samples -> the per read allele likelihoods
 * @param ref the reference bases (over the same interval as the haplotypes)
 * @param refLoc the span of the reference bases
 * @param activeAllelesToGenotype alleles we want to ensure are scheduled for genotyping (GGA mode)
 * @return never {@code null} but perhaps an empty list if there is no variants to report.
 */
private TreeSet<Integer> decomposeHaplotypesIntoVariantContexts(final List<Haplotype> haplotypes,
                                                                final ReadLikelihoods readLikelihoods,
                                                                final byte[] ref,
                                                                final GenomeLoc refLoc,
                                                                final List<VariantContext> activeAllelesToGenotype) {
    final boolean in_GGA_mode = !activeAllelesToGenotype.isEmpty();

    // Using the cigar from each called haplotype figure out what events need to be written out in a VCF file
    final TreeSet<Integer> startPosKeySet = EventMap.buildEventMapsForHaplotypes(haplotypes, ref, refLoc, configuration.DEBUG);

    if ( !in_GGA_mode ) {
        // run the event merger if we're not in GGA mode
        if (crossHaplotypeEventMerger == null)
            throw new IllegalStateException(" no variant merger was provided at set-up when needed in GGA mode");
        final boolean mergedAnything = crossHaplotypeEventMerger.merge(haplotypes, readLikelihoods, startPosKeySet, ref, refLoc);
        if ( mergedAnything )
            cleanUpSymbolicUnassembledEvents( haplotypes ); // the newly created merged events could be overlapping the unassembled events
    } else {
        startPosKeySet.clear();
        for( final VariantContext compVC : activeAllelesToGenotype ) {
            startPosKeySet.add( compVC.getStart() );
        }
    }

    return startPosKeySet;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:37,代码来源:HaplotypeCallerGenotypingEngine.java


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