當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeSet.addAll方法代碼示例

本文整理匯總了Java中java.util.TreeSet.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeSet.addAll方法的具體用法?Java TreeSet.addAll怎麽用?Java TreeSet.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.TreeSet的用法示例。


在下文中一共展示了TreeSet.addAll方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getItems

import java.util.TreeSet; //導入方法依賴的package包/類
/**
    * Gets items from the DB. IF the mode is learner filters them based on the group sessionId
    */
   private TreeSet<KalturaItem> getItems(ToolAccessMode mode, Kaltura kaltura, Long toolSessionId, Long userId) {

// Create set of images, along with this filtering out items added by users from other groups
TreeSet<KalturaItem> items = new TreeSet<KalturaItem>(new KalturaItemComparator());
items.addAll(service.getGroupItems(kaltura.getToolContentId(), toolSessionId, userId, mode.isTeacher()));

for (KalturaItem item : items) {
    // initialize login name to avoid session close error in proxy object
    if (item.getCreatedBy() != null) {
	item.getCreatedBy().getLoginName();
    }
}

return items;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:19,代碼來源:LearningAction.java

示例2: buildEventMapsForHaplotypes

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * Build event maps for each haplotype, returning the sorted set of all of the starting positions of all
 * events across all haplotypes
 *
 * @param haplotypes a list of haplotypes
 * @param ref        the reference bases
 * @param refLoc     the span of the reference bases
 * @param debug      if true, we'll emit debugging information during this operation
 * @return a sorted set of start positions of all events among all haplotypes
 */
public static TreeSet<Integer> buildEventMapsForHaplotypes(final List<Haplotype> haplotypes,
                                                           final byte[] ref,
                                                           final GenomeLoc refLoc,
                                                           final boolean debug) {
    // Using the cigar from each called haplotype figure out what events need to be written out in a VCF file
    final TreeSet<Integer> startPosKeySet = new TreeSet<Integer>();
    int hapNumber = 0;

    if (debug) logger.info("=== Best Haplotypes ===");
    for (final Haplotype h : haplotypes) {
        // Walk along the alignment and turn any difference from the reference into an event
        h.setEventMap(new EventMap(h, ref, refLoc, "HC" + hapNumber++));
        startPosKeySet.addAll(h.getEventMap().getStartPositions());

        if (debug) {
            logger.info(h.toString());
            logger.info("> Cigar = " + h.getCigar());
            logger.info(">> Events = " + h.getEventMap());
        }
    }

    return startPosKeySet;
}
 
開發者ID:PAA-NCIC,項目名稱:SparkSeq,代碼行數:34,代碼來源:EventMap.java

示例3: getAuditResults

import java.util.TreeSet; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected List getAuditResults(TreeSet<SubjectArea> subjectAreas){
	TreeSet<SubjectArea> subjects = new TreeSet<SubjectArea>();
	if (subjectAreas != null && !subjectAreas.isEmpty()){
		subjects.addAll(subjectAreas);
	} else {
		subjects.addAll(SubjectArea.getSubjectAreaList(getSession().getUniqueId()));
	}

	String query = createQueryString(subjects);
	Vector results = new Vector();
	for (SubjectArea sa : subjects){
		Debug.info(getTitle() + " - Checking Subject Area:  " + sa.getSubjectAreaAbbreviation());
		results.addAll(StudentClassEnrollmentDAO.getInstance()
			 .getQuery(query)
			 .setLong("sessId", getSession().getUniqueId().longValue())
			 .setLong("subjectId", sa.getUniqueId().longValue())
			 .list());
	}
	return(results);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:MultipleCourseEnrollmentsAuditReport.java

示例4: getLeafNodeComplexity

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * Gets the complexity of a leaf node computation in the tree convolution algorithm.
 * Implements equation (8) in Lam/Lien paper which gives time of
 * convolution between 2 subnets in tree.
 * @param node The leaf node.
 * @param pv The per class population vector of the network.
 * @return A ComplexityBundle containing the expected time and space complexities.
 */
@Override
protected ComplexityBundle getLeafNodeComplexity(Node n, PopulationVector popVec) {
	TreeSet<Integer> pcUfc = n.pcs;
	pcUfc.addAll(n.fcs);
	int time = 1;
	for (int k : pcUfc) {
		time *= (popVec.get(k) + 1);
	}
	
	time *= 4;
	
	int space = n.pcs.size() + n.fcs.size();
	
	return new ComplexityBundle(time, space);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:24,代碼來源:TCComplexityEvaluator.java

示例5: getEntityChildren

import java.util.TreeSet; //導入方法依賴的package包/類
@Override
protected Collection<Course> getEntityChildren(Course source) {
	Collection<Course> renewals = source.getRenewals();
	if (renewals.size() > 1) {
		TreeSet<Course> result = new TreeSet<Course>(new CourseComparator());
		result.addAll(renewals);
		return result;
	} else {
		return renewals;
	}
	// Collection<Course> precedingCourses = source.getPrecedingCourses();
	// if (precedingCourses.size() > 1) {
	// TreeSet<Course> result = new TreeSet<Course>(new CourseComparator());
	// result.addAll(precedingCourses);
	// return result;
	// } else {
	// return precedingCourses;
	// }
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:20,代碼來源:CourseReflexionGraph.java

示例6: findAll

import java.util.TreeSet; //導入方法依賴的package包/類
public static TreeSet<ExamPeriod> findAll(Long sessionId, Long examTypeId) {
	TreeSet<ExamPeriod> ret = new TreeSet<ExamPeriod>();
	if (examTypeId==null)
		ret.addAll(new ExamPeriodDAO().getSession().
            createQuery("select ep from ExamPeriod ep where ep.session.uniqueId=:sessionId").
            setLong("sessionId", sessionId).
            setCacheable(true).
            list());
	else
		ret.addAll(new ExamPeriodDAO().getSession().
                createQuery("select ep from ExamPeriod ep where ep.session.uniqueId=:sessionId and ep.examType.uniqueId=:typeId").
                setLong("sessionId", sessionId).
                setLong("typeId", examTypeId).
                setCacheable(true).
                list());
    return ret;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:ExamPeriod.java

示例7: getStudentConflicts

import java.util.TreeSet; //導入方法依賴的package包/類
public TreeSet<StudentConflict> getStudentConflicts() {
	TreeSet<StudentConflict> ret = new TreeSet();
	if (iChange!=null) {
		HashSet<String> ids = new HashSet();
		for (ClassAssignmentInfo assignment:iChange.getAssignments()) {
			for (StudentConflict conf:assignment.getStudentConflicts()) {
				String id = (assignment.getClassId().compareTo(conf.getOtherClass().getClassId())<0?
						assignment.getClassId()+":"+conf.getOtherClass().getClassId():
			            conf.getOtherClass().getClassId()+":"+assignment.getClassId());
				if (ids.add(id)) ret.add(conf);
			}
		}
	} else if (getClassAssignment()!=null) {
		ret.addAll(getClassAssignment().getStudentConflicts());
	}
	return ret;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:ClassInfoModel.java

示例8: testAddAll2

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * addAll of a collection with null elements throws NPE
 */
public void testAddAll2() {
    TreeSet q = new TreeSet();
    Integer[] ints = new Integer[SIZE];
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:TreeSetTest.java

示例9: getDistributionPreferences

import java.util.TreeSet; //導入方法依賴的package包/類
public Set getDistributionPreferences() {
	TreeSet prefs = new TreeSet();
	for (Iterator i=getDepartments().iterator();i.hasNext();) {
		Department d = (Department)i.next();
		prefs.addAll(d.getDistributionPreferences());
	}    	
	return prefs;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:9,代碼來源:SolverGroup.java

示例10: testConstructor7

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * The comparator used in constructor is used
 */
public void testConstructor7() {
    MyReverseComparator cmp = new MyReverseComparator();
    TreeSet q = new TreeSet(cmp);
    assertEquals(cmp, q.comparator());
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE; ++i)
        ints[i] = new Integer(i);
    q.addAll(Arrays.asList(ints));
    for (int i = SIZE - 1; i >= 0; --i)
        assertEquals(ints[i], q.pollFirst());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:TreeSetTest.java

示例11: coumputeClasses

import java.util.TreeSet; //導入方法依賴的package包/類
protected void coumputeClasses(String schedulingSubpartId, String courseId, PrintWriter out) throws Exception {
    if (schedulingSubpartId==null || schedulingSubpartId.length()==0 || schedulingSubpartId.equals(Preference.BLANK_PREF_VALUE)) {
        print(out, "-1", "N/A");
        return;
    }
    SchedulingSubpart subpart = (Long.parseLong(schedulingSubpartId)>0?new SchedulingSubpartDAO().get(Long.valueOf(schedulingSubpartId)):null);
    if (subpart==null) {
        print(out, "-1", "N/A");
        return;
    }
    CourseOffering co = null;
    if (courseId != null && !courseId.isEmpty()) {
    	co = CourseOfferingDAO.getInstance().get(Long.valueOf(courseId));
    }
    TreeSet classes = new TreeSet(new ClassComparator(ClassComparator.COMPARE_BY_HIERARCHY));
    classes.addAll(new Class_DAO().
        getSession().
        createQuery("select distinct c from Class_ c "+
                "where c.schedulingSubpart.uniqueId=:schedulingSubpartId").
        setFetchSize(200).
        setCacheable(true).
        setLong("schedulingSubpartId", Long.parseLong(schedulingSubpartId)).
        list());
    if (classes.size()>1)
        print(out, "-1", "-");
    for (Iterator i=classes.iterator();i.hasNext();) {
        Class_ c = (Class_)i.next();
        String extId = c.getClassSuffix(co);
        print(out, c.getUniqueId().toString(), c.getSectionNumberString() + (extId == null || extId.isEmpty() || extId.equalsIgnoreCase(c.getSectionNumberString()) ? "" : " - " + extId)); 
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:32,代碼來源:ExamEditAjax.java

示例12: getClassNumbers

import java.util.TreeSet; //導入方法依賴的package包/類
public Collection getClassNumbers(int idx) {
    Vector ret = new Vector();
    boolean contains = false;
    SchedulingSubpart subpart = (getItype(idx)>0?new SchedulingSubpartDAO().get(getItype(idx)):null);
    CourseOffering co = (getItype(idx)>0?new CourseOfferingDAO().get(getCourseNbr(idx)):null);
    if (subpart!=null) {
        TreeSet classes = new TreeSet(new ClassComparator(ClassComparator.COMPARE_BY_HIERARCHY));
        classes.addAll(new Class_DAO().
            getSession().
            createQuery("select distinct c from Class_ c "+
                    "where c.schedulingSubpart.uniqueId=:schedulingSubpartId").
            setFetchSize(200).
            setCacheable(true).
            setLong("schedulingSubpartId", getItype(idx)).
            list());
        for (Iterator i=classes.iterator();i.hasNext();) {
            Class_ c = (Class_)i.next();
            if (c.getUniqueId().equals(getClassNumber(idx))) contains = true;
            String extId = c.getClassSuffix(co);
            ret.add(new IdValue(c.getUniqueId(), c.getSectionNumberString() +
            		 (extId == null || extId.isEmpty() || extId.equalsIgnoreCase(c.getSectionNumberString()) ? "" : " - " + extId))); 
        }
    }
    if (ret.isEmpty()) ret.add(new IdValue(-1L,"N/A"));
    if (!contains) setClassNumber(idx, -1L);
    if (ret.size()==1) setClassNumber(idx, ((IdValue)ret.firstElement()).getId());
    else ret.insertElementAt(new IdValue(-1L,"-"), 0);
    return ret;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:30,代碼來源:ExamEditForm.java

示例13: getLockPath

import java.util.TreeSet; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected String getLockPath(String createdZNode, List<String> children) throws IOException {
  TreeSet<String> sortedChildren =
      new TreeSet<String>(ZNodeComparator.COMPARATOR);
  sortedChildren.addAll(children);
  String pathToWatch = sortedChildren.lower(createdZNode);
  if (pathToWatch != null) {
    String nodeHoldingLock = sortedChildren.first();
    String znode = ZKUtil.joinZNode(parentLockNode, nodeHoldingLock);
    handleLockMetadata(znode);
  }
  return pathToWatch;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:17,代碼來源:ZKInterProcessWriteLock.java

示例14: sortedConfigs

import java.util.TreeSet; //導入方法依賴的package包/類
private Collection<InstrOfferingConfig> sortedConfigs(InstructionalOffering offering) {
  	if (offering.getInstrOfferingConfigs().size() <= 1)
  		return offering.getInstrOfferingConfigs();
  	TreeSet<InstrOfferingConfig> configs = new TreeSet<InstrOfferingConfig>(new InstrOfferingConfigComparator(offering.getControllingCourseOffering().getSubjectArea().getUniqueId()));
configs.addAll(offering.getInstrOfferingConfigs());
return configs;
  }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:8,代碼來源:TimetableDatabaseLoader.java

示例15: load

import java.util.TreeSet; //導入方法依賴的package包/類
public void load(Department department) {
	setId(department.getUniqueId());
	setSessionId(department.getSessionId());
	setName(department.getName());
	setAbbv(department.getAbbreviation());
	setDistPrefPriority(department.getDistributionPrefPriority()==null?0:department.getDistributionPrefPriority().intValue());
	setDeptCode(department.getDeptCode());
	setStatusType(department.getStatusType()==null?null:department.getStatusType().getReference());
	setExternalId(department.getExternalUniqueId());
	setIsExternal(department.isExternalManager().booleanValue());
	setExtAbbv(department.getExternalMgrAbbv());
	setExtName(department.getExternalMgrLabel());
       setAllowReqRoom(department.isAllowReqRoom()!=null && department.isAllowReqRoom().booleanValue());
       setAllowReqTime(department.isAllowReqTime()!=null && department.isAllowReqTime().booleanValue());
       setAllowReqDist(department.isAllowReqDistribution()!=null && department.isAllowReqDistribution().booleanValue());
       setAllowEvents(department.isAllowEvents());
       setAllowStudentScheduling(department.isAllowStudentScheduling());
       setInheritInstructorPreferences(department.isInheritInstructorPreferences());
       iDependentDepartments.clear(); iDependentStatuses.clear();
       if (department.isExternalManager() && department.getExternalStatusTypes() != null) {
       	if (!department.getExternalStatusTypes().isEmpty()) {
           	TreeSet<ExternalDepartmentStatusType> set = new TreeSet<ExternalDepartmentStatusType>(new Comparator<ExternalDepartmentStatusType>() {
   				@Override
   				public int compare(ExternalDepartmentStatusType e1, ExternalDepartmentStatusType e2) {
   					return e1.getDepartment().compareTo(e2.getDepartment());
   				}
   			});
           	set.addAll(department.getExternalStatusTypes());
           	for (ExternalDepartmentStatusType e: set) {
           		iDependentDepartments.add(e.getDepartment().getUniqueId().toString());
           		iDependentStatuses.add(e.getStatusType().getReference());
           	}
       	}
           addBlankDependentDepartment();
           addBlankDependentDepartment();
       }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:38,代碼來源:DepartmentEditForm.java


注:本文中的java.util.TreeSet.addAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。