本文整理汇总了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();
}
示例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;
}
示例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();
}
示例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++;
}
}
}
示例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 '-'
}
}
示例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());
}
}
示例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;
}
示例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));
}
}
示例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);
}
示例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();
}
示例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));
}
示例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;
}
}
}
示例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),
};
}
示例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;
}
示例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);
}