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


Java TreeSet.add方法代码示例

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


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

示例1: newOverallFeedback

import java.util.TreeSet; //导入方法依赖的package包/类
/**
    * Ajax call, will add one more input line for new OverallFeedback.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward newOverallFeedback(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
TreeSet<AssessmentOverallFeedback> overallFeedbackList = getOverallFeedbacksFromRequest(request, false);
AssessmentOverallFeedback overallFeedback = new AssessmentOverallFeedback();
int maxSeq = 1;
if ((overallFeedbackList != null) && (overallFeedbackList.size() > 0)) {
    AssessmentOverallFeedback last = overallFeedbackList.last();
    maxSeq = last.getSequenceId() + 1;
}
overallFeedback.setSequenceId(maxSeq);
overallFeedbackList.add(overallFeedback);

request.setAttribute(AssessmentConstants.ATTR_OVERALL_FEEDBACK_LIST, overallFeedbackList);
return mapping.findForward(AssessmentConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:AuthoringAction.java

示例2: expandMethodLevelCluster2Bodies

import java.util.TreeSet; //导入方法依赖的package包/类
private TreeSet<LSDFact> expandMethodLevelCluster2Bodies (PrintStream p, List<LSDFact> methodLevelCluster) { 
	TreeSet<LSDFact> ontheflyDeltaKB = new TreeSet<LSDFact>(); 
	TreeSet<String> methodConstants = null; 
	if (methodLevelCluster!=null) { 
		methodConstants= new TreeSet<String>(); 
		for (LSDFact methodF: methodLevelCluster) { 
			methodConstants.add(methodF.getBindings().get(0).getGroundConst());
		}
	}

	for (LSDFact fact:originalDeltaKB) {
		String involvedMethod =null;  
		if (fact.getPredicate().getName().indexOf("_calls")>0) { 
			involvedMethod= fact.getBindings().get(0).getGroundConst(); 
		}
		else if (fact.getPredicate().getName().indexOf("_accesses")>0) { 
			involvedMethod = fact.getBindings().get(1).getGroundConst(); 
		}
		if (involvedMethod!=null && (methodConstants==null || methodConstants.contains(involvedMethod))){
			if (p!=null) p.println("\t\t\t"+ fact); 
			ontheflyDeltaKB.add(fact);
		}
	}
	return ontheflyDeltaKB;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:26,代码来源:LSdiffHierarchialDeltaKB.java

示例3: addOption

import java.util.TreeSet; //导入方法依赖的package包/类
/**
    * Ajax call, will add one more input line for new resource item instruction.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward addOption(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
TreeSet<AssessmentQuestionOption> optionList = getOptionsFromRequest(request, false);
AssessmentQuestionOption option = new AssessmentQuestionOption();
int maxSeq = 1;
if ((optionList != null) && (optionList.size() > 0)) {
    AssessmentQuestionOption last = optionList.last();
    maxSeq = last.getSequenceId() + 1;
}
option.setSequenceId(maxSeq);
option.setGrade(0);
optionList.add(option);

request.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID,
	WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID));
request.setAttribute(AssessmentConstants.ATTR_QUESTION_TYPE,
	WebUtil.readIntParam(request, AssessmentConstants.ATTR_QUESTION_TYPE));
request.setAttribute(AssessmentConstants.ATTR_OPTION_LIST, optionList);
return mapping.findForward(AssessmentConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AuthoringAction.java

示例4: removeStopWordsRemoveAll

import java.util.TreeSet; //导入方法依赖的package包/类
public static void removeStopWordsRemoveAll(String text){
	//******************EXAMPLE WITH REMOVE ALL *******************************************************************************************

	try {
		out.println(text);
		Scanner stopWordList = new Scanner(new File("C://Jenn Personal//Packt Data Science//Chapter 3 Data Cleaning//stopwords.txt"));
		TreeSet<String> stopWords = new TreeSet<String>();
		while(stopWordList.hasNextLine()){
			stopWords.add(stopWordList.nextLine());
		}
		ArrayList<String> dirtyText = new ArrayList<String>(Arrays.asList(text.split(" ")));
		dirtyText.removeAll(stopWords);
		out.println("Clean words: ");
		for(String x : dirtyText){
			out.print(x + " ");
		}
		out.println();
		stopWordList.close();
	} catch (FileNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Made-Easy,代码行数:24,代码来源:SimpleStringCleaning.java

示例5: findPlatform

import java.util.TreeSet; //导入方法依赖的package包/类
private static File findPlatform() {
    try {
        Class<?> lookup = Class.forName("org.openide.util.Lookup"); // NOI18N
        File util = new File(lookup.getProtectionDomain().getCodeSource().getLocation().toURI());
        Assert.assertTrue("Util exists: " + util, util.exists());

        return util.getParentFile().getParentFile();
    } catch (Exception ex) {
        try {
            File nbjunit = new File(MeasureStartupTimeTestCase.class.getProtectionDomain().getCodeSource().getLocation().toURI());
            File harness = nbjunit.getParentFile().getParentFile();
            Assert.assertEquals("NbJUnit is in harness", "harness", harness.getName());
            TreeSet<File> sorted = new TreeSet<>();
            for (File p : harness.getParentFile().listFiles()) {
                if (p.getName().startsWith("platform")) {
                    sorted.add(p);
                }
            }
            Assert.assertFalse("Platform shall be found in " + harness.getParent(), sorted.isEmpty());
            return sorted.last();
        } catch (Exception ex2) {
            Assert.fail("Cannot find utilities JAR: " + ex + " and: " + ex2);
        }
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:MeasureStartupTimeTestCase.java

示例6: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:ModelStandardIndexedDirectorTest.java

示例7: getOverallFeedbacksFromRequest

import java.util.TreeSet; //导入方法依赖的package包/类
/**
    * Get overall feedbacks from <code>HttpRequest</code>
    *
    * @param request
    */
   private TreeSet<AssessmentOverallFeedback> getOverallFeedbacksFromRequest(HttpServletRequest request,
    boolean skipBlankOverallFeedbacks) {
int count = NumberUtils.toInt(request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_COUNT));
TreeSet<AssessmentOverallFeedback> overallFeedbackList = new TreeSet<AssessmentOverallFeedback>(
	new SequencableComparator());
for (int i = 0; i < count; i++) {
    String gradeBoundaryStr = request
	    .getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_GRADE_BOUNDARY_PREFIX + i);
    String feedback = request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_FEEDBACK_PREFIX + i);
    String sequenceId = request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_SEQUENCE_ID_PREFIX + i);

    if ((StringUtils.isBlank(feedback) || StringUtils.isBlank(gradeBoundaryStr)) && skipBlankOverallFeedbacks) {
	continue;
    }
    AssessmentOverallFeedback overallFeedback = new AssessmentOverallFeedback();
    overallFeedback.setSequenceId(NumberUtils.toInt(sequenceId));
    if (!StringUtils.isBlank(gradeBoundaryStr)) {
	int gradeBoundary = NumberUtils.toInt(
		request.getParameter(AssessmentConstants.ATTR_OVERALL_FEEDBACK_GRADE_BOUNDARY_PREFIX + i));
	overallFeedback.setGradeBoundary(gradeBoundary);
    }
    overallFeedback.setFeedback(feedback);
    overallFeedbackList.add(overallFeedback);
}
return overallFeedbackList;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:AuthoringAction.java

示例8: DistributionConflict

import java.util.TreeSet; //导入方法依赖的package包/类
protected DistributionConflict(DistributionPref pref, org.unitime.timetable.model.Exam exclude) {
    iPref = pref;
    iId = pref.getUniqueId();
    iType = pref.getDistributionType().getLabel();
    iOtherExams = new TreeSet();
    for (Iterator i=pref.getDistributionObjects().iterator();i.hasNext();) {
        DistributionObject dObj = (DistributionObject)i.next();
        org.unitime.timetable.model.Exam exam = (org.unitime.timetable.model.Exam)dObj.getPrefGroup();
        if (exam.equals(exclude)) continue;
        iOtherExams.add(exam.getAssignedPeriod()==null?new ExamInfo(exam):new ExamAssignment(exam));
    }
    iPreference = pref.getPrefLevel().getPrefProlog(); 
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:14,代码来源:ExamAssignmentInfo.java

示例9: handleKeySet

import java.util.TreeSet; //导入方法依赖的package包/类
@Override
protected Set<String> handleKeySet() {
    ICUResourceBundleReader reader = wholeBundle.reader;
    TreeSet<String> keySet = new TreeSet<String>();
    ICUResourceBundleReader.Table table = (ICUResourceBundleReader.Table)value;
    for (int i = 0; i < table.getSize(); ++i) {
        keySet.add(table.getKey(reader, i));
    }
    return keySet;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:11,代码来源:ICUResourceBundleImpl.java

示例10: sessionsCanManage

import java.util.TreeSet; //导入方法依赖的package包/类
public Set sessionsCanManage(){
	TreeSet sessions = new TreeSet();
	Department dept = null;
	for(Iterator it = getDepartments().iterator(); it.hasNext();){
		dept = (Department) it.next();
		sessions.add(dept.getSession());
	}
	return(sessions);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:TimetableManager.java

示例11: getUniqueStationName

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Returns given name if a station with the same name does not exists or makes it unique
 * @param name station name
 * @return unique name
 */
private String getUniqueStationName(String name) {
	TreeSet<String> names = new TreeSet<String>(); // Map of all unique names with their first users
	Vector keys = getStationKeys();
	// Finds all used names
	for (int i = 0; i < keys.size(); i++) {
		names.add(this.getStationName(keys.get(i)));
	}

	// If name is new, returns it
	if (!names.contains(name)) {
		return name;
	}

	int num;
	// If format is already '*_[number]' increment number
	char[] charname = name.toCharArray();
	int n = charname.length - 1;
	while (charname[n] >= '0' && charname[n] <= '9' && n > 0) {
		n--;
	}
	if (charname[n] == '_') {
		num = Integer.parseInt(name.substring(n + 1));
		name = name.substring(0, n); // Removes suffix
	}
	// Otherwise uses number 1
	else {
		num = 1;
	}
	// Finds unique number
	while (names.contains(name + "_" + num)) {
		num++;
	}
	return name + "_" + num;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:40,代码来源:JMODELModel.java

示例12: get

import java.util.TreeSet; //导入方法依赖的package包/类
public TreeSet<TimeBlock> get(Long roomPermId, String excludeType) {
    TreeSet<TimeBlock> roomAvailability = iAvailability.get(roomPermId);
    if (roomAvailability==null || excludeType==null || excludeType.equals(iExcludeType)) return roomAvailability;
    TreeSet<TimeBlock> ret = new TreeSet();
    for (TimeBlock block : roomAvailability) {
    	if (excludeType.equals(block.getEventType())) continue;
        ret.add(block);
    }
    return ret;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:DefaultRoomAvailabilityService.java

示例13: showScheduledEmails

import java.util.TreeSet; //导入方法依赖的package包/类
/**
    * Renders a page listing all scheduled emails.
    */
   public ActionForward showScheduledEmails(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException, SchedulerException {
getUserManagementService();
Scheduler scheduler = getScheduler();
TreeSet<EmailScheduleMessageJobDTO> scheduleList = new TreeSet<EmailScheduleMessageJobDTO>();
Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID, true);
boolean isLessonNotifications = (lessonId != null);
Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true);
if (isLessonNotifications) {
    if (!getSecurityService().isLessonMonitor(lessonId, getCurrentUser().getUserID(),
	    "show scheduled lesson email notifications", false)) {
	response.sendError(HttpServletResponse.SC_FORBIDDEN, "The user is not a monitor in the lesson");
	return null;
    }
} else {
    if (!getSecurityService().isGroupMonitor(organisationId, getCurrentUser().getUserID(),
	    "show scheduled course email notifications", false)) {
	response.sendError(HttpServletResponse.SC_FORBIDDEN, "The user is not a monitor in the organisation");
	return null;
    }
}

Set<TriggerKey> triggerKeys = scheduler
	.getTriggerKeys(GroupMatcher.triggerGroupEquals(Scheduler.DEFAULT_GROUP));
for (TriggerKey triggerKey : triggerKeys) {
    String triggerName = triggerKey.getName();
    if (triggerName.startsWith(EmailNotificationsAction.TRIGGER_PREFIX_NAME)) {
	Trigger trigger = scheduler.getTrigger(triggerKey);
	JobDetail jobDetail = scheduler.getJobDetail(trigger.getJobKey());
	JobDataMap jobDataMap = jobDetail.getJobDataMap();

	// filter triggers
	if (isLessonNotifications) {
	    Object jobLessonId = jobDataMap.get(AttributeNames.PARAM_LESSON_ID);
	    if ((jobLessonId == null) || (!lessonId.equals(jobLessonId))) {
		continue;
	    }
	} else {
	    Object jobOrganisationId = jobDataMap.get(AttributeNames.PARAM_ORGANISATION_ID);
	    if ((jobOrganisationId == null) || (!organisationId.equals(jobOrganisationId))) {
		continue;
	    }
	}

	Date triggerDate = trigger.getNextFireTime();
	String emailBody = WebUtil.convertNewlines((String) jobDataMap.get("emailBody"));
	int searchType = (Integer) jobDataMap.get("searchType");
	EmailScheduleMessageJobDTO emailScheduleJobDTO = new EmailScheduleMessageJobDTO();
	emailScheduleJobDTO.setTriggerName(triggerName);
	emailScheduleJobDTO.setTriggerDate(triggerDate);
	emailScheduleJobDTO.setEmailBody(emailBody);
	emailScheduleJobDTO.setSearchType(searchType);
	scheduleList.add(emailScheduleJobDTO);
    }
}

request.setAttribute("scheduleList", scheduleList);
request.setAttribute(AttributeNames.PARAM_LESSON_ID, lessonId);
request.setAttribute(AttributeNames.PARAM_ORGANISATION_ID, organisationId);

return mapping.findForward("scheduledEmailList");
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:66,代码来源:EmailNotificationsAction.java

示例14: cnbs

import java.util.TreeSet; //导入方法依赖的package包/类
private static Set<String> cnbs(Set<Module> modules) {
    TreeSet<String> set = new TreeSet<String>();
    for (Module m : modules) {
        set.add(m.getCodeNameBase());
    }
    return set;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ModuleListTest.java

示例15: printFieldOfType

import java.util.TreeSet; //导入方法依赖的package包/类
private void printFieldOfType (PrintStream p, TreeSet<LSDFact> ontheflyDeltaKB, LSDFact fieldF) { 
	for (LSDFact fact:originalDeltaKB) {
		if (fact.getPredicate().getName().indexOf("_fieldoftype")>0 && fact.getBindings().get(0).getGroundConst().equals(fieldF.getBindings().get(0).getGroundConst())){ 
			if (filter.fieldLevel) ontheflyDeltaKB.add(fact);
			if (filter.fieldLevel && p!=null) p.println("\t\t\t"+ fact); 
		}
	}
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:9,代码来源:LSdiffHierarchialDeltaKB.java


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