當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。