-
Notifications
You must be signed in to change notification settings - Fork 56
Enum All
Ori Roth edited this page Apr 2, 2017
·
3 revisions
public enum All {
/*
* Utilities (2)
*/
static boolean notNull(T[] ts);
static boolean notNull(Iterable<T> ts);
}
Input types: Iterable.
// SSDLPedia
package il.ac.technion.cs.ssdl.utils;
import il.ac.technion.cs.ssdl.stereotypes.Utility;
/**
* A utility class to realize universally quantified checks of an entire
* collection.
*
* Author: Yossi Gil, the Technion.
* See: 21/06/2008
*/
@Utility public enum All {
;
/**
* Determine whether all elements in an array are not null.
*
* <T> type of elements in the array
* ts an array of elements to be tested
* Return: true iff ts is not
* null and all elements in it are not
* null.
*/
public static <T> boolean notNull(final T[] ts) {
if (ts == null)
return false;
for (final T t : ts)
if (t == null)
return false;
return true;
}
/**
* Determine whether all elements in an Iterable collection are not
* null.
*
* <T> type of elements in the collection
* ts an Iterable collection of elements to be tested
* Return: true iff ts is not
* null and all elements in it is not are not
* null
*/
public static <T> boolean notNull(final Iterable<T> ts) {
if (ts == null)
return false;
for (final T t : ts)
if (t == null)
return false;
return true;
}
}
Metric | Value | Acronym | Explanation |
---|---|---|---|
LOC | 52 | Lines Of Code | Total number of lines in the code |
SCC | 9 | SemiColons Count | Total number of semicolon tokens found in the code. |
NOT | 126 | Number Of Tokens | Comments, whitespace and text which cannot be made into a token not included. |
VCC | 1118 | Visible Characters Count | The total number of non-white (i.e., not space, tab, newline, carriage return, form feed) characters. |
CCC | 349 | Code Characters Count | Total number of non-white characters in tokens. White space characters in string and character literals are not counted. |
UIC | 14 | Unique Identifiers Count | The number of different identifiers found in the code |
WHC | 3 | Weighted Horizontal Complexity | A heuritistic on horizontal complexity |
Statistic | Value |
---|---|
Average token length | 2.8 |
Tokens/line | 2.4 |
Visible characters/line | 22 |
Code characters/line | 6.7 |
Semicolons/tokens | 7% |
Comment text percentage | 68% |
Token Kind | Occurrences |
---|---|
KEYWORD | 36 |
OPERATOR | 10 |
LITERAL | 0 |
ID | 34 |
PUNCTUATION | 46 |
COMMENT | 4 |
OTHER | 72 |