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