Minor utilities and fixes
This commit is contained in:
		
							parent
							
								
									8c5c35c725
								
							
						
					
					
						commit
						8dbb8f793d
					
				| @ -46,7 +46,7 @@ public abstract class Entity<E extends Entity<E, L>, L extends Comparable<? supe | |||||||
| 	 | 	 | ||||||
| 	public boolean attached() | 	public boolean attached() | ||||||
| 	{ | 	{ | ||||||
| 		return this.getColl() != null; | 		return this.getColl() != null && this.getId() != null; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public boolean detached() | 	public boolean detached() | ||||||
|  | |||||||
| @ -381,6 +381,14 @@ public class MUtil | |||||||
| 		return herp.equals(derp); | 		return herp.equals(derp); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	public static <T> int compare(Comparable<T> herp, T derp) | ||||||
|  | 	{ | ||||||
|  | 		if (herp == null && derp == null) return 0; | ||||||
|  | 		if (herp == null) return -1; | ||||||
|  | 		if (derp == null) return +1; | ||||||
|  | 		return herp.compareTo(derp); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	// -------------------------------------------- // | 	// -------------------------------------------- // | ||||||
| 	// SORTING | 	// SORTING | ||||||
| 	// -------------------------------------------- // | 	// -------------------------------------------- // | ||||||
|  | |||||||
| @ -36,6 +36,19 @@ public class TimeUnit implements Comparable<TimeUnit> | |||||||
| 		 | 		 | ||||||
| 	private static final TreeSet<TimeUnit> all = new TreeSet<TimeUnit>(); | 	private static final TreeSet<TimeUnit> all = new TreeSet<TimeUnit>(); | ||||||
| 	public static TreeSet<TimeUnit> getAll() { return new TreeSet<TimeUnit>(all); } | 	public static TreeSet<TimeUnit> getAll() { return new TreeSet<TimeUnit>(all); } | ||||||
|  | 	public static TreeSet<TimeUnit> getAllButMillis() | ||||||
|  | 	{ | ||||||
|  | 		TreeSet<TimeUnit> ret = new TreeSet<TimeUnit>(all); | ||||||
|  | 		ret.remove(MILLISECOND); | ||||||
|  | 		return ret; | ||||||
|  | 	} | ||||||
|  | 	public static TreeSet<TimeUnit> getAllButMillisAndSeconds() | ||||||
|  | 	{ | ||||||
|  | 		TreeSet<TimeUnit> ret = new TreeSet<TimeUnit>(all); | ||||||
|  | 		ret.remove(MILLISECOND); | ||||||
|  | 		ret.remove(SECOND); | ||||||
|  | 		return ret; | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
| 	public static TimeUnit get(String timeUnitString) | 	public static TimeUnit get(String timeUnitString) | ||||||
| 	{ | 	{ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user