Skip to content

Enum Once

Ori Roth edited this page Apr 2, 2017 · 3 revisions

Synopsis of Class Once

public class Once { 
    /*
     * Forge (1)
     */
        Once(String value); 
    /*
     * Type (1)
     */
        String toString(); 
} 

Code

// SSDLPedia
package il.ac.technion.cs.ssdl.utils;

import il.ac.technion.cs.ssdl.stereotypes.Instantiable;

/**
 * A class to manage printing a String exactly once. In the first
 * invocation of #toString(), the initial value is returned. In all
 * subsequent invocations, the empty string is returned.
 * 
 * See: Separator
 * Author: Yossi Gil
 * See:  21/08/2007
 */
@Instantiable public class Once {
    private String value;
    
    public Once(final String value) {
        this.value = Defaults.to(value, "");
    }
    
    @Override public String toString() {
        final String $ = value;
        value = null;
        return $;
    }
}

Metrics

Metric Value Acronym Explanation
LOC 28 Lines Of Code Total number of lines in the code
SCC 7 SemiColons Count Total number of semicolon tokens found in the code.
NOT 81 Number Of Tokens Comments, whitespace and text which cannot be made into a token not included.
VCC 569 Visible Characters Count The total number of non-white (i.e., not space, tab, newline, carriage return, form feed) characters.
CCC 273 Code Characters Count Total number of non-white characters in tokens. White space characters in string and character literals are not counted.
UIC 15 Unique Identifiers Count The number of different identifiers found in the code
WHC 2 Weighted Horizontal Complexity A heuritistic on horizontal complexity

Statistics

Statistic Value
Average token length 3.4
Tokens/line 2.9
Visible characters/line 20
Code characters/line 9.8
Semicolons/tokens 8%
Comment text percentage 52%

Tokens by Kind

Token Kind Occurrences
KEYWORD 12
OPERATOR 3
LITERAL 1
ID 32
PUNCTUATION 33
COMMENT 2
OTHER 40
Clone this wiki locally