當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。