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


Java SortedSet.size方法代码示例

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


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

示例1: SuiteProperties

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Creates a new instance of SuiteProperties
 */
public SuiteProperties(SuiteProject project, AntProjectHelper helper,
        PropertyEvaluator evaluator, Set<NbModuleProject> subModules) {
    super(helper, evaluator);
    this.project = project;
    refresh(subModules);
    this.disabledModules = getArrayProperty(evaluator, DISABLED_MODULES_PROPERTY);
    this.enabledClusters = getArrayProperty(evaluator, ENABLED_CLUSTERS_PROPERTY);
    if (enabledClusters.length == 0 && activePlatform != null) {
        // Compatibility.
        SortedSet<String> clusters = new TreeSet<String>();
        for (ModuleEntry module : activePlatform.getModules()) {
            clusters.add(module.getClusterDirectory().getName());
        }
        clusters.removeAll(Arrays.asList(getArrayProperty(evaluator, DISABLED_CLUSTERS_PROPERTY)));
        enabledClusters = new String[clusters.size()];
        int i = 0; for (String cluster : clusters) {
            enabledClusters[i++] = SingleModuleProperties.clusterBaseName(cluster);
        }
    }
    brandingModel = new SuiteBrandingModel(this);
    brandingModel.init();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SuiteProperties.java

示例2: getAllTokens

import java.util.SortedSet; //导入方法依赖的package包/类
String[] getAllTokens() {
    if (allTokens == null) {
        try {
            SortedSet<String> provTokens = new TreeSet<String>();
            provTokens.addAll(Arrays.asList(IDE_TOKENS));
            for (ModuleEntry me : getModuleList().getAllEntries()) {
                provTokens.addAll(Arrays.asList(me.getProvidedTokens()));
            }
            String[] result = new String[provTokens.size()];
            return provTokens.toArray(result);
        } catch (IOException e) {
            allTokens = new String[0];
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return allTokens;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SingleModuleProperties.java

示例3: printMock

import java.util.SortedSet; //导入方法依赖的package包/类
protected String printMock(List<ServerAndLoad> balancedCluster) {
  SortedSet<ServerAndLoad> sorted = new TreeSet<ServerAndLoad>(balancedCluster);
  ServerAndLoad[] arr = sorted.toArray(new ServerAndLoad[sorted.size()]);
  StringBuilder sb = new StringBuilder(sorted.size() * 4 + 4);
  sb.append("{ ");
  for (int i = 0; i < arr.length; i++) {
    if (i != 0) {
      sb.append(" , ");
    }
    sb.append(arr[i].getServerName().getHostname());
    sb.append(":");
    sb.append(arr[i].getLoad());
  }
  sb.append(" }");
  return sb.toString();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:BalancerTestBase.java

示例4: TranslitUtil

import java.util.SortedSet; //导入方法依赖的package包/类
public TranslitUtil(InputStream is) {
    SortedSet<SymbolReplacement> symbolReplacements = loadReplacements(is);

    if (symbolReplacements.size() == 0) {
        Log.i(TAG, "No transliteration replacements loaded");
        symbols = null;
        replacements = null;
    } else {
        Log.i(TAG, "Loaded " + symbolReplacements.size() + " transliteration replacements");
        symbols = new int[symbolReplacements.size()];
        replacements = new String[symbolReplacements.size()];

        int pos = 0;
        for (SymbolReplacement sr : symbolReplacements) {
            symbols[pos] = sr.symbol;
            replacements[pos] = sr.replacement;
            pos++;
        }
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:21,代码来源:TranslitUtil.java

示例5: UnicodeLocaleExtension

import java.util.SortedSet; //导入方法依赖的package包/类
UnicodeLocaleExtension(SortedSet<String> attributes, SortedMap<String, String> keywords) {
    this();
    if (attributes != null && attributes.size() > 0) {
        _attributes = attributes;
    }
    if (keywords != null && keywords.size() > 0) {
        _keywords = keywords;
    }

    if (_attributes.size() > 0 || _keywords.size() > 0) {
        StringBuilder sb = new StringBuilder();
        for (String attribute : _attributes) {
            sb.append(LanguageTag.SEP).append(attribute);
        }
        for (Entry<String, String> keyword : _keywords.entrySet()) {
            String key = keyword.getKey();
            String value = keyword.getValue();

            sb.append(LanguageTag.SEP).append(key);
            if (value.length() > 0) {
                sb.append(LanguageTag.SEP).append(value);
            }
        }
        _value = sb.substring(1);   // skip leading '-'
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:27,代码来源:UnicodeLocaleExtension.java

示例6: shuffleAndSortUsingTreeSet

import java.util.SortedSet; //导入方法依赖的package包/类
private void shuffleAndSortUsingTreeSet(Comparator<MethodDesc> compare) {
	SortedSet<MethodDesc> cachedDescriptors = new TreeSet<>(compare);

	List<MethodDesc> copy = new ArrayList<>(methods);
	Collections.shuffle(copy);
	cachedDescriptors.addAll(copy);

	if (cachedDescriptors.size() != methods.size()) {
		StringBuilder msg = new StringBuilder();
		msg.append("TreeSet swallowed ").append(methods.size() - cachedDescriptors.size()).append(" methods");
		throw new RuntimeException(msg.toString());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:TestPolymorphicDispatcher.java

示例7: getXMLDisplay

import java.util.SortedSet; //导入方法依赖的package包/类
public Document getXMLDisplay()
	{
		Document doc = createNewDocument() ;
		FieldComparator comp = new FieldComparator() ;
		SortedSet<Element> setFields = new TreeSet<Element>(comp) ;
//		if (m_SendMapOrder != null)
//		{
//			Form form = m_SendMapOrder.m_varFrom ;
//		}
		
		Element eRoot = createNewFormBody(doc, "CESM", "CESM") ;
		Element eBody = createVBox(doc, eRoot);
		int nb = setFields.size() ;
		Element[] arr = new Element[nb] ;
		setFields.toArray(arr);
		int curline = 0 ;
		int curCol = 0 ;
		Element curLineElem = null ;
		for (int i=0; i<nb; i++)
		{
			Element f = arr[i] ;
			int nl = NumberParser.getAsInt(f.getAttribute("PosLine"));
			if (curline != nl)
			{
				curLineElem = createHBox(doc, eBody);
				curline = nl ;
				curCol = 1 ;
			}
			int nc = NumberParser.getAsInt(f.getAttribute("PosCol"));
			int nlen = NumberParser.getAsInt(f.getAttribute("Length"));
			if (nc > curCol +1)
			{
				createBlank(doc, curLineElem, nc - curCol) ;
			}
			curCol = nc + nlen ;
			curLineElem.appendChild(f);
		}
		
		return doc;
	}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:41,代码来源:OnlineEnvironment.java

示例8: rebuildItems

import java.util.SortedSet; //导入方法依赖的package包/类
private void rebuildItems(BlocklyCategory category) throws BlockLoadingException {
    for (BlocklyCategory.CategoryItem item : category.getItems()) {
        if (item.getType() == BlocklyCategory.CategoryItem.TYPE_BLOCK) {
            // Clean up the old views
            BlocklyCategory.BlockItem blockItem = (BlocklyCategory.BlockItem) item;
            mController.unlinkViews(blockItem.getBlock());
        }
    }
    category.clear();

    category.addItem(new BlocklyCategory.ButtonItem(
            mContext.getString(R.string.create_variable), ACTION_CREATE_VARIABLE));
    SortedSet<String> varNames = mVariableNameManager.getUsedNames();
    if (varNames.size() == 0) {
        return;
    }

    Block setter = mBlockFactory.obtainBlockFrom(SET_VAR_TEMPLATE);
    setter.getFieldByName(GET_VAR_FIELD).setFromString(varNames.first());
    category.addItem(new BlocklyCategory.BlockItem(setter));

    Block changer = mBlockFactory.obtainBlockFrom(CHANGE_VAR_TEMPLATE);
    changer.getFieldByName(GET_VAR_FIELD).setFromString(varNames.first());
    category.addItem(new BlocklyCategory.BlockItem(changer));

    for (String name : varNames) {
        Block varBlock = mBlockFactory.obtainBlockFrom(GET_VAR_TEMPLATE);
        varBlock.getFieldByName(GET_VAR_FIELD).setFromString(name);
        category.addItem(new BlocklyCategory.BlockItem(varBlock));
    }
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:32,代码来源:VariableCustomCategory.java

示例9: extractFormToForumCondition

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Extract form content to ForumCondition.
    *
    * @param request
    * @param form
    * @throws Exception
    */
   private void extractFormToForumCondition(HttpServletRequest request, ForumConditionForm form) throws Exception {

SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(form.getSessionMapID());
// check whether it is "edit(old item)" or "add(new item)"
SortedSet<ForumCondition> conditionSet = getForumConditionSet(sessionMap);
int orderId = form.getOrderId();
ForumCondition condition = null;

if (orderId == -1) { // add
    String properConditionName = getForumService().createTextSearchConditionName(conditionSet);
    condition = form.extractCondition();
    condition.setName(properConditionName);
    int maxOrderId = 1;
    if (conditionSet != null && conditionSet.size() > 0) {
	ForumCondition last = conditionSet.last();
	maxOrderId = last.getOrderId() + 1;
    }
    condition.setOrderId(maxOrderId);
    conditionSet.add(condition);
} else { // edit
    List<ForumCondition> conditionList = new ArrayList<ForumCondition>(conditionSet);
    condition = conditionList.get(orderId - 1);
    form.extractCondition(condition);
}

Long[] selectedItems = form.getSelectedItems();
Set<Message> conditionTopics = new TreeSet<Message>(new ConditionTopicComparator());
Set<MessageDTO> messageDTOs = getMessageDTOList(sessionMap);

for (Long selectedItem : selectedItems) {
    for (MessageDTO messageDTO : messageDTOs) {
	Message topic = messageDTO.getMessage();
	if (selectedItem.equals(topic.getCreated().getTime())) {
	    conditionTopics.add(topic);
	}
    }
}
condition.setTopics(conditionTopics);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:AuthoringConditionAction.java

示例10: toLocaleList

import java.util.SortedSet; //导入方法依赖的package包/类
private static String toLocaleList(SortedSet<String> set) {
    StringBuilder sb = new StringBuilder(set.size() * 6);
    for (String id : set) {
        if (!"root".equals(id)) {
            if (sb.length() > 0) {
                sb.append(' ');
            }
            sb.append(id);
        }
    }
    return sb.toString();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:ResourceBundleGenerator.java

示例11: assertRelativePath

import java.util.SortedSet; //导入方法依赖的package包/类
public static void assertRelativePath(String expectedPath, SortedSet<String> paths) {
    String[] s = new String[paths.size()];
    assertRelativePath(expectedPath, paths.toArray(s));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CreatedModifiedFilesTest.java

示例12: remove

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Remove the range indices. If this range is  
 * found in existing ranges, the existing ranges 
 * are shrunk.
 * If range is of 0 length, doesn't do anything.
 * @param range Range to be removed.
 */
synchronized void remove(Range range) {
  if(range.isEmpty()) {
    return;
  }
  long startIndex = range.getStartIndex();
  long endIndex = range.getEndIndex();
  //make sure that there are no overlapping ranges
  SortedSet<Range> headSet = ranges.headSet(range);
  if(headSet.size()>0) {
    Range previousRange = headSet.last();
    LOG.debug("previousRange "+previousRange);
    if(startIndex<previousRange.getEndIndex()) {
      //previousRange overlaps this range
      //narrow down the previousRange
      if(ranges.remove(previousRange)) {
        indicesCount-=previousRange.getLength();
        LOG.debug("removed previousRange "+previousRange);
      }
      add(previousRange.getStartIndex(), startIndex);
      if(endIndex<=previousRange.getEndIndex()) {
        add(endIndex, previousRange.getEndIndex());
      }
    }
  }
  
  Iterator<Range> tailSetIt = ranges.tailSet(range).iterator();
  while(tailSetIt.hasNext()) {
    Range nextRange = tailSetIt.next();
    LOG.debug("nextRange "+nextRange +"   startIndex:"+startIndex+
        "  endIndex:"+endIndex);
    if(endIndex>nextRange.getStartIndex()) {
      //nextRange overlaps this range
      //narrow down the nextRange
      tailSetIt.remove();
      indicesCount-=nextRange.getLength();
      if(endIndex<nextRange.getEndIndex()) {
        add(endIndex, nextRange.getEndIndex());
        break;
      }
    } else {
      break;
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:52,代码来源:SortedRanges.java

示例13: LevenshteinAutomata

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Expert: specify a custom maximum possible symbol
 * (alphaMax); default is Character.MAX_CODE_POINT.
 */
public LevenshteinAutomata(int[] word, int alphaMax, boolean withTranspositions) {
  this.word = word;
  this.alphaMax = alphaMax;

  // calculate the alphabet
  SortedSet<Integer> set = new TreeSet<>();
  for (int i = 0; i < word.length; i++) {
    int v = word[i];
    if (v > alphaMax) {
      throw new IllegalArgumentException("alphaMax exceeded by symbol " + v + " in word");
    }
    set.add(v);
  }
  alphabet = new int[set.size()];
  Iterator<Integer> iterator = set.iterator();
  for (int i = 0; i < alphabet.length; i++)
    alphabet[i] = iterator.next();
    
  rangeLower = new int[alphabet.length + 2];
  rangeUpper = new int[alphabet.length + 2];
  // calculate the unicode range intervals that exclude the alphabet
  // these are the ranges for all unicode characters not in the alphabet
  int lower = 0;
  for (int i = 0; i < alphabet.length; i++) {
    int higher = alphabet[i];
    if (higher > lower) {
      rangeLower[numRanges] = lower;
      rangeUpper[numRanges] = higher - 1;
      numRanges++;
    }
    lower = higher + 1;
  }
  /* add the final endpoint */
  if (lower <= alphaMax) {
    rangeLower[numRanges] = lower;
    rangeUpper[numRanges] = alphaMax;
    numRanges++;
  }

  descriptions = new ParametricDescription[] {
      null, /* for n=0, we do not need to go through the trouble */
      withTranspositions ? new Lev1TParametricDescription(word.length) : new Lev1ParametricDescription(word.length),
      withTranspositions ? new Lev2TParametricDescription(word.length) : new Lev2ParametricDescription(word.length),
  };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:50,代码来源:LevenshteinAutomata.java

示例14: getBranches

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Get a list of branch names, their associated group id and the number of groups for this branch. Designed to
    * respond to an AJAX call.
    *
    * Input parameters: activityID (which is the branching activity id)
    * 
    * Output format: "branchid,name,num groups;branchid,groupid,name,num groups"
    */
   public ActionForward getBranches(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {

// get the branching data and sort it.
Long activityID = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID);
IMonitoringService monitoringService = MonitoringServiceProxy
	.getMonitoringService(getServlet().getServletContext());
BranchingActivity activity = (BranchingActivity) monitoringService.getActivityById(activityID);

TreeSet<Activity> sortedBranches = new TreeSet<Activity>(new ActivityTitleComparator());
sortedBranches.addAll(activity.getActivities());

// build the output string to return to the chosen branching page.
// there should only ever be one group for each branch in chosen branching
String branchesOutput = "";

boolean first = true;
for (Activity childActivity : sortedBranches) {

    SequenceActivity branch = (SequenceActivity) monitoringService
	    .getActivityById(childActivity.getActivityId(), SequenceActivity.class);

    Long branchId = branch.getActivityId();
    String name = branch.getTitle();

    SortedSet<Group> groups = branch.getGroupsForBranch();
    int numberOfGroups = groups != null ? groups.size() : 0;

    if (!first) {
	branchesOutput = branchesOutput + ";";
    } else {
	first = false;
    }

    branchesOutput = branchesOutput + branchId + "," + name + "," + numberOfGroups;
}

if (log.isDebugEnabled()) {
    log.debug("getBranches activity id " + activityID + " returning " + branchesOutput);
}

writeAJAXResponse(response, branchesOutput);
return null;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:53,代码来源:GroupBasedBranchingAJAXAction.java

示例15: extractFormToTaskListCondition

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Extract form content to taskListContent.
    *
    * @param request
    * @param form
    * @throws TaskListException
    */
   private void extractFormToTaskListCondition(HttpServletRequest request, TaskListConditionForm form)
    throws Exception {
/*
 * BE CAREFUL: This method will copy necessary info from request form to a old or new TaskListItem instance. It
 * gets all info EXCEPT TaskListItem.createDate and TaskListItem.createBy, which need be set when persisting
 * this taskList item.
 */

SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(form.getSessionMapID());
// check whether it is "edit(old item)" or "add(new item)"
SortedSet<TaskListCondition> conditionList = getTaskListConditionList(sessionMap);
int sequenceId = NumberUtils.stringToInt(form.getSequenceId(), -1);
TaskListCondition condition = null;

if (sequenceId == -1) { // add
    condition = new TaskListCondition();
    int maxSeq = 1;
    if (conditionList != null && conditionList.size() > 0) {
	TaskListCondition last = conditionList.last();
	maxSeq = last.getSequenceId() + 1;
    }
    condition.setSequenceId(maxSeq);
    conditionList.add(condition);
} else { // edit
    List<TaskListCondition> rList = new ArrayList<TaskListCondition>(conditionList);
    condition = rList.get(sequenceId);
}

condition.setName(form.getName());

String[] selectedItems = form.getSelectedItems();
SortedSet<TaskListItem> itemList = getTaskListItemList(sessionMap);
SortedSet<TaskListItem> conditionItemList = new TreeSet<TaskListItem>(new TaskListItemComparator());

for (String selectedItem : selectedItems) {
    for (TaskListItem item : itemList) {
	if (selectedItem.equals((new Integer(item.getSequenceId())).toString())) {
	    conditionItemList.add(item);
	}
    }
}
condition.setTaskListItems(conditionItemList);

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:52,代码来源:AuthoringTaskListConditionAction.java


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