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


Java TreeSet.isEmpty方法代码示例

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


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

示例1: applyTextRecovery

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Applies text recovery to the gray image. See section IV.B
 * @param map The gray image after global thresholding.
 * @param postLocalThresholdMap The gray image after local thresholding.
 * @return The gray image after text recovery.
 */
public static GrayImage applyTextRecovery(GrayImage map,
	GrayImage postLocalThresholdMap) {

	GrayImage res = textLabeling(map, postLocalThresholdMap);
	TreeSet<Pixel> newTextPixels = new TreeSet<>();

	for (int j = 0; j < map.getHeight(); ++j) {
		for (int i = 0; i < map.getWidth(); ++i) {
			newTextPixels.clear();
			if (res.getValue(i, j) > 0) {
				int x = i, y = j;
				do {
					if (!newTextPixels.isEmpty()) {
						Point p = newTextPixels.pollFirst();
						x = (int) p.getX();
						y = (int) p.getY();
					}
					applyHysteresisMask(map, res, x, y, newTextPixels);
				} while (!newTextPixels.isEmpty());
			}
		}
	}

	return res;
}
 
开发者ID:MX-Futhark,项目名称:text-position-detector,代码行数:32,代码来源:EdgeMap.java

示例2: getMeetingRooms

import java.util.TreeSet; //导入方法依赖的package包/类
protected String getMeetingRooms(boolean html, Class_ clazz) {
    String meetingRooms = "";
    Assignment assignment = clazz.getCommittedAssignment();
    TreeSet<Meeting> meetings = (clazz.getEvent()==null?null:new TreeSet(clazz.getEvent().getMeetings()));
    TreeSet<Location> locations = new TreeSet<Location>();
    if (meetings!=null && !meetings.isEmpty()) {
        for (Meeting meeting : meetings)
            if (meeting.getLocation()!=null) locations.add(meeting.getLocation());
    } else if (assignment!=null && assignment.getDatePattern()!=null) {
        for (Iterator i=assignment.getRooms().iterator();i.hasNext();) {
            locations.add((Location)i.next());
        }
    }
    for (Location location: locations) {
        if (meetingRooms.length()>0) meetingRooms+=", ";
        meetingRooms+=(html ? location.getLabelWithHint() : location.getLabel());
    }
    return meetingRooms;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:20,代码来源:ClassesAction.java

示例3: print

import java.util.TreeSet; //导入方法依赖的package包/类
public static boolean print(OutputStream out, Collection<SubjectArea> subjectAreas) throws IOException, DocumentException {
    TreeSet courses = new TreeSet(new Comparator() {
        public int compare(Object o1, Object o2) {
            CourseOffering co1 = (CourseOffering)o1;
            CourseOffering co2 = (CourseOffering)o2;
            int cmp = co1.getCourseName().compareTo(co2.getCourseName());
            if (cmp != 0) return cmp;
            return co1.getUniqueId().compareTo(co2.getUniqueId());
        }
    });
    String subjectIds = "";
    for (SubjectArea sa: subjectAreas)
    	subjectIds += (subjectIds.isEmpty() ? "" : ",") + sa.getUniqueId();
    courses.addAll(SessionDAO.getInstance().getSession().createQuery(
    		"select co from CourseOffering co where  co.subjectArea.uniqueId in (" + subjectIds + ")").list());
    if (courses.isEmpty()) return false;
    PdfWorksheet w = new PdfWorksheet(out, subjectAreas, null);
    for (Iterator i=courses.iterator();i.hasNext();) {
        w.print((CourseOffering)i.next());
    }
    w.lastPage();
    w.close();
    return true;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:25,代码来源:PdfWorksheet.java

示例4: generateUnavailabilityEvent

import java.util.TreeSet; //导入方法依赖的package包/类
public static EventInterface generateUnavailabilityEvent(Location location, EventInterface parent) {
	TreeSet<MeetingInterface> meetings = generateUnavailabilityMeetings(location, false);
	if (meetings == null || meetings.isEmpty()) return null;
	EventInterface event = new EventInterface();
	event.setId(-location.getUniqueId());
	event.setName(MESSAGES.unavailableEventDefaultName());
	event.setType(EventInterface.EventType.Unavailabile);
	if (parent == null)
		event.setMeetings(meetings);
	else
		for (MeetingInterface m: meetings)
			if (parent.inConflict(m))
				event.addMeeting(m);
	if (location.getNote() != null && !location.getNote().isEmpty()) {
		NoteInterface n = new NoteInterface();
		n.setNote(location.getNote());
		event.addNote(n);
	}
	return event;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:21,代码来源:EventLookupBackend.java

示例5: computeContiguousDayRanges

import java.util.TreeSet; //导入方法依赖的package包/类
private String computeContiguousDayRanges(int[] days) {
    final TreeSet<Integer> daySet = new TreeSet<>();
    for (int i = 0; days != null && i < days.length; i++) {
        daySet.add(days[i]);
    }
    if (daySet.isEmpty()) {
        return getString(R.string.zen_mode_schedule_rule_days_none);
    }
    final int N = ALL_DAYS.length;
    if (daySet.size() == N) {
        return getString(R.string.zen_mode_schedule_rule_days_all);
    }
    String rt = null;
    for (int i = 0; i < N; i++) {
        final int startDay = ALL_DAYS[i];
        final boolean active = daySet.contains(startDay);
        if (!active) continue;
        int end = 0;
        while (daySet.contains(ALL_DAYS[(i + end + 1) % N])) {
            end++;
        }
        if (!(i == 0 && daySet.contains(ALL_DAYS[N - 1]))) {
            final String v = end == 0 ? dayString(startDay)
                    : getString(R.string.summary_range_symbol_combination,
                            dayString(startDay),
                            dayString(ALL_DAYS[(i + end) % N]));
            rt = rt == null ? v : getString(R.string.summary_divider_text, rt, v);
        }
        i += end;
    }
    return rt;
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:33,代码来源:ZenModeAutomationSettings.java

示例6: getInstalledKits

import java.util.TreeSet; //导入方法依赖的package包/类
public TreeSet<UpdateElement> getInstalledKits(String cluster) {
    TreeSet<UpdateElement> res;
    final Cache c = getCache();
    TreeSet<UpdateElement> kits = c.createMapCluster2installedKits().get(cluster);
    if (kits == null || kits.isEmpty()) {
        res = new TreeSet<UpdateElement>() {
            Cache keepIt = c;
        };
    } else {
        res = new TreeSet<UpdateElement>(kits) {
            Cache keepIt = c;
        };
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:UpdateManagerImpl.java

示例7: getTemplate

import java.util.TreeSet; //导入方法依赖的package包/类
public String getTemplate() {
	if (iCurriculumCourses == null) return null;
	TreeSet<String> templates = new TreeSet<String>();
	for (CurriculumCourseInterface c: iCurriculumCourses)
		if (c != null && c.hasTemplates())
			templates.addAll(c.getTemplates());
	if (templates.isEmpty()) return null;
	String ret = "";
	for (String template: templates) {
		ret += (ret.isEmpty() ? "" : ", ") + template;
	}
	return ret;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:14,代码来源:CurriculumInterface.java

示例8: removeSpan

import java.util.TreeSet; //导入方法依赖的package包/类
@Override
public synchronized void removeSpan(CacheSpan span) {
  TreeSet<CacheSpan> spansForKey = cachedSpans.get(span.key);
  totalSpace -= span.length;
  Assertions.checkState(spansForKey.remove(span));
  span.file.delete();
  if (spansForKey.isEmpty()) {
    cachedSpans.remove(span.key);
  }
  notifySpanRemoved(span);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:12,代码来源:SimpleCache.java

示例9: getMeetingComparable

import java.util.TreeSet; //导入方法依赖的package包/类
protected long getMeetingComparable(Class_ clazz) {
    Assignment assignment = clazz.getCommittedAssignment();
    TreeSet meetings = (clazz.getEvent()==null?null:new TreeSet(clazz.getEvent().getMeetings()));
    if (meetings!=null && !meetings.isEmpty()) {
        return ((Meeting)meetings.first()).getMeetingDate().getTime();
    } else if (assignment!=null) {
        return assignment.getTimeLocation().getStartSlot();
    }
    return -1;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:ClassesAction.java

示例10: onActionItemClicked

import java.util.TreeSet; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, actionMode, menuItem);
    TreeSet<Long> selectionIds;
    switch (menuItem.getItemId()) {
        case R.id.query_cab_schedule:
            selectionIds = originalSelectedIds();
            if (!selectionIds.isEmpty()) {
                displayScheduleTimestampDialog(R.id.query_cab_schedule, selectionIds);
            }
            break;

        case R.id.query_cab_state:
            /* Add all known states to menu. */
            SubMenu subMenu = menuItem.getSubMenu();
            if (subMenu != null) {
                subMenu.clear();
                for (String str: new NoteStateSpinner(getActivity(), null).getValues()) {
                    subMenu.add(STATE_ITEM_GROUP, Menu.NONE, Menu.NONE, str);
                }
            }
            break;

        default:
            /* Click on one of the state keywords. */
            if (menuItem.getGroupId() == STATE_ITEM_GROUP) {
                if (mListener != null) {
                    selectionIds = originalSelectedIds();
                    if (!selectionIds.isEmpty()) {
                        mListener.onStateChangeRequest(selectionIds, menuItem.getTitle().toString());
                    }
                }
                return true;
            }

            return false; // Not handled.
    }

    return true; // Handled.
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:41,代码来源:AgendaFragment.java

示例11: find

import java.util.TreeSet; //导入方法依赖的package包/类
@Override
public Collection<? extends Point> find(Point from, Point destination, DistanceComparator distanceComparator,
		CollisionDetector collisionDetector)
{
	Map<Point, Point> parents = new HashMap<>();
	TreeSet<Point> openList = new TreeSet<>(distanceComparator);
	HashSet<Point> closedList = new HashSet<>();
	openList.add(from);
	Point n = null; 
	Point closestNode = from;
	while (!openList.isEmpty())
	{
		n = openList.pollFirst();

		if(distanceComparator.compare(closestNode, n) > 0)
			closestNode = n;
		if (n.equals(destination))
			return createPath(from, destination, parents);
		
		closedList.add(n);
		List<Point> successors = createSuccessors(n, collisionDetector);
		for (Point successor: successors)
		{
			if (!closedList.contains(successor))
			{
				openList.add(successor);
				if (!parents.containsKey(successor)) 
					parents.put(successor, n);
			}
		}
	}

	return createPath(from, closestNode, parents);
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:35,代码来源:BestFirstPathFinder.java

示例12: findByIndex

import java.util.TreeSet; //导入方法依赖的package包/类
public static ExamPeriod findByIndex(Long sessionId, ExamType type, Integer idx) {
    if (idx==null || idx<0) return null;
    int x = 0;
    TreeSet periods = findAll(sessionId, type);
    for (Iterator i=periods.iterator();i.hasNext();x++) {
        ExamPeriod period = (ExamPeriod)i.next();
        if (x==idx) return period;
    }
    return (periods.isEmpty()?null:(ExamPeriod)periods.last());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:ExamPeriod.java

示例13: coumputeExams

import java.util.TreeSet; //导入方法依赖的package包/类
protected void coumputeExams(String courseOfferingId, Long examType, PrintWriter out) throws Exception {
    if (courseOfferingId==null || courseOfferingId.length()==0 || courseOfferingId.equals(Preference.BLANK_PREF_VALUE)) return;
    TreeSet exams = new TreeSet(Exam.findExamsOfCourseOffering(Long.valueOf(courseOfferingId),examType));
    if (exams.size()>1 || exams.isEmpty())
        print(out, "-1", "-");
    for (Iterator i=exams.iterator();i.hasNext();) {
        Exam exam = (Exam)i.next();
        print(out, exam.getUniqueId().toString(), exam.getLabel().replaceAll("&","@[email protected]")); 
    }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:DistributionPrefsAjax.java

示例14: getShortestPath

import java.util.TreeSet; //导入方法依赖的package包/类
public static java.util.ArrayList<Vector> getShortestPath(Vector start, Vector end, Dijkstra.Description desc)
{
	TreeSet<Vector> closedSet = new TreeSet<Vector>();
	TreeSet<FVWrapper> openSet = new TreeSet<FVWrapper>();
	openSet.add(new FVWrapper(start, heuristic(start, end)));
	
	TreeMap<Vector, Vector> cameFrom = new TreeMap<Vector, Vector>();
	TreeMap<Vector, Double> gScore = new TreeMap<Vector, Double>();
	gScore.put(start, 0.0);
	
	TreeMap<Vector, Double> fScore = new TreeMap<Vector, Double>();
	fScore.put(start, heuristic(start, end));
	
	while(!openSet.isEmpty())
	{
		FVWrapper current = openSet.first();
		openSet.remove(current);
		
		if(current.v.equals(end))
			return getReturn(cameFrom, current.v);
		
		closedSet.add(current.v);
		
		java.util.List<Vector> neighbor = desc.getNeighbor(current.v);
		
		for(int i = 0 ; i < neighbor.size() ; i++)
		{
			Vector nei = neighbor.get(i); 
			if(!closedSet.contains(nei))
			{
				FVWrapper neiOpen = new FVWrapper(nei, null); 
				
				double tenative = gScore.get(current.v) + current.v.skew(nei);
				
				Double g = gScore.get(nei);
				g = g == null? Triangle.LARGE_VALUE : g;
				if(tenative < g)
				{
					cameFrom.put(nei, current.v);
					gScore.put(nei, tenative);
					double f = g + heuristic(nei, end);
					fScore.put(nei, f);
					
					neiOpen.fScore = f;
					
					
				}
				
				openSet.add(neiOpen);
			}
		}
	}
	
	return null;
}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:56,代码来源:AStar.java

示例15: createQueryString

import java.util.TreeSet; //导入方法依赖的package包/类
protected String createQueryString(TreeSet<SubjectArea> subjectAreas){
	StringBuilder sb = new StringBuilder();

	sb.append("select s.externalUniqueId, s.lastName, s.firstName, s.middleName,")
	  .append(" sce.courseOffering.subjectArea.subjectAreaAbbreviation, sce.courseOffering.courseNbr,")
	  .append(" sce.courseOffering.title, sce.clazz.schedulingSubpart.itype.abbv, sce.clazz.sectionNumberCache,")
	  .append(" sce.clazz.schedulingSubpart.schedulingSubpartSuffixCache, c.schedulingSubpart.itype.abbv,")
	  .append(" c.sectionNumberCache, c.schedulingSubpart.schedulingSubpartSuffixCache,")
	  .append(" ( select count(sce1) from StudentClassEnrollment sce1 where sce1.clazz.uniqueId = c.uniqueId and sce1.student.uniqueId = s.uniqueId ),")
	  .append(" ( select distinct sce2.clazz.schedulingSubpart.itype.abbv || ' ' || sce2.clazz.sectionNumberCache || ' ' ||  sce2.clazz.schedulingSubpart.schedulingSubpartSuffixCache")
	  .append(" from StudentClassEnrollment sce2 where sce2.clazz.schedulingSubpart.uniqueId = c.schedulingSubpart.uniqueId and sce2.student.uniqueId = s.uniqueId and sce2.courseOffering.uniqueId = sce.courseOffering.uniqueId )")
	  .append(" from Student s inner join s.classEnrollments as sce, Class_ c")
	  .append(" where s.session.uniqueId = :sessId")
	  .append(" and c.uniqueId = sce.clazz.parentClass.uniqueId");

	if(subjectAreas != null && !subjectAreas.isEmpty()){
		sb.append(" and sce.courseOffering.subjectArea.uniqueId in (");
		boolean first = true;
		for (SubjectArea sa : subjectAreas){
			if (first){
				first = false;
			} else {
				sb.append(",");
			}
			sb.append(" ");
			sb.append(sa.getUniqueId().toString());
		}
		sb.append(" ) ");
	}

	sb.append(" and 1 != ( select count(sce1) from StudentClassEnrollment sce1 where sce1.clazz.uniqueId = c.uniqueId and sce1.student.uniqueId = s.uniqueId )")
	  .append(" order by sce.courseOffering.subjectArea.subjectAreaAbbreviation, sce.courseOffering.courseNbr,")
	  .append(" sce.courseOffering.title, sce.clazz.schedulingSubpart.itype.abbv, sce.clazz.sectionNumberCache,")
	  .append(" sce.clazz.schedulingSubpart.schedulingSubpartSuffixCache");
	if (isShowId()){
		sb.append(", s.externalUniqueId");
	} else if (isShowName()) {
		sb.append(", s.lastName, s.firstName, s.middleName");
	}

	
	return(sb.toString());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:44,代码来源:EnrollmentsViolatingCourseStructureAuditReport.java


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