Report Banner - Edit rsm.cfg File Resource Standard Metrics™ for C, C++, C# and Java Version 7.71 - mSquaredTechnologies.com License Type: Company Site License Licensed To : M Squared Technologies LLC License No. : ST1000 License Date: Mar 06, 2013 Build Date : Mar 7 2013 Run Date: Mar 07, 2013 ©2013 M Squared Technologies LLC™
_________________________________________________________________________ License File: C:\Program Files\MSquared\M2 RSM\rsm.lic Config. File: C:\Program Files\MSquared\M2 RSM\rsm.cfg Command Line: -H -SDetermine Line LOC Report -d Rolodex.java Determine Line LOC Report ~~ Determine Source vs. LOC Algorithms ~~ File: Rolodex.java ________________________________________________________________________ Line 1: LOC Type(s): Blank Line 2: package rolodex; LOC Type(s): LOC Effective Logical Line 3: import rolodex.Contact; LOC Type(s): LOC Effective Logical Line 4: import java.util.LinkedList; LOC Type(s): LOC Effective Logical Line 5: import java.io.FileInputStream; LOC Type(s): LOC Effective Logical Line 6: import java.io.FileOutputStream; LOC Type(s): LOC Effective Logical Line 7: import java.io.File; LOC Type(s): LOC Effective Logical Line 8: import java.io.ObjectInputStream; LOC Type(s): LOC Effective Logical Line 9: import java.io.ObjectOutputStream; LOC Type(s): LOC Effective Logical Line 10: LOC Type(s): Blank Line 11: public class Rolodex LOC Type(s): LOC Effective Line 12: { LOC Type(s): LOC Non-Effective Line 13: LOC Type(s): Blank Line 14: private LinkedList rololist = new LinkedList(); LOC Type(s): LOC Effective Logical Line 15: LOC Type(s): Blank Line 16: public Rolodex() LOC Type(s): LOC Effective Line 17: { LOC Type(s): LOC Non-Effective Line 18: System.out.println ( "Rolodex" ); LOC Type(s): LOC Effective Logical Line 19: } LOC Type(s): LOC Non-Effective Line 20: LOC Type(s): Blank Line 21: public boolean open ( String datafilename ) LOC Type(s): LOC Effective Line 22: { LOC Type(s): LOC Non-Effective Line 23: System.out.println ( "Open Rolodex" ); LOC Type(s): LOC Effective Logical Line 24: LOC Type(s): Blank Line 25: FileInputStream inputfile = null; LOC Type(s): LOC Effective Logical Line 26: ObjectInputStream ois = null; LOC Type(s): LOC Effective Logical Line 27: LOC Type(s): Blank Line 28: File f = new File ( datafilename ); LOC Type(s): LOC Effective Logical Line 29: if ( f.exists() ) LOC Type(s): LOC Effective Line 30: { LOC Type(s): LOC Non-Effective Line 31: // open the input file stream LOC Type(s): Java Comment Line 32: if ( f.canRead() ) LOC Type(s): LOC Effective Line 33: { LOC Type(s): LOC Non-Effective Line 34: try LOC Type(s): LOC Effective Line 35: { LOC Type(s): LOC Non-Effective Line 36: inputfile = new FileInputStream ( f ); LOC Type(s): LOC Effective Logical Line 37: } LOC Type(s): LOC Non-Effective Line 38: catch ( Exception e ) LOC Type(s): LOC Effective Line 39: { LOC Type(s): LOC Non-Effective Line 40: System.err.println ( "Cannot Open or Currupted File: " + datafilename ); LOC Type(s): LOC Effective Logical Line 41: return(false); LOC Type(s): LOC Effective Logical Line 42: } LOC Type(s): LOC Non-Effective Line 43: } LOC Type(s): LOC Non-Effective Line 44: else LOC Type(s): LOC Effective Line 45: { LOC Type(s): LOC Non-Effective Line 46: System.err.println ( "Cannot Read From File: " + datafilename ); LOC Type(s): LOC Effective Logical Line 47: return(false); LOC Type(s): LOC Effective Logical Line 48: } LOC Type(s): LOC Non-Effective Line 49: LOC Type(s): Blank Line 50: // read from the file to the list LOC Type(s): Java Comment Line 51: try LOC Type(s): LOC Effective Line 52: { LOC Type(s): LOC Non-Effective Line 53: ois = new ObjectInputStream ( inputfile ); LOC Type(s): LOC Effective Logical Line 54: } LOC Type(s): LOC Non-Effective Line 55: catch ( Exception e ) LOC Type(s): LOC Effective Line 56: { LOC Type(s): LOC Non-Effective Line 57: System.err.println ( "Cannot open input stream for object read." ); LOC Type(s): LOC Effective Logical Line 58: return(false); LOC Type(s): LOC Effective Logical Line 59: } LOC Type(s): LOC Non-Effective Line 60: LOC Type(s): Blank Line 61: Object testo = null; LOC Type(s): LOC Effective Logical Line 62: try LOC Type(s): LOC Effective Line 63: { LOC Type(s): LOC Non-Effective Line 64: testo = ois.readObject(); LOC Type(s): LOC Effective Logical Line 65: } LOC Type(s): LOC Non-Effective Line 66: catch ( Exception e ) LOC Type(s): LOC Effective Line 67: { LOC Type(s): LOC Non-Effective Line 68: System.err.println ( "Cannot read Rolodex List" ); LOC Type(s): LOC Effective Logical Line 69: return(false); LOC Type(s): LOC Effective Logical Line 70: } LOC Type(s): LOC Non-Effective Line 71: LOC Type(s): Blank Line 72: if ( testo instanceof LinkedList ) LOC Type(s): LOC Effective Line 73: { LOC Type(s): LOC Non-Effective Line 74: rololist = (LinkedList)testo; LOC Type(s): LOC Effective Logical Line 75: } LOC Type(s): LOC Non-Effective Line 76: System.out.println ( "Rolodex " + datafilename + " Opened" ); LOC Type(s): LOC Effective Logical Line 77: } LOC Type(s): LOC Non-Effective Line 78: return(true); LOC Type(s): LOC Effective Logical Line 79: } LOC Type(s): LOC Non-Effective Line 80: LOC Type(s): Blank Line 81: public boolean close( String datafilename ) LOC Type(s): LOC Effective Line 82: { LOC Type(s): LOC Non-Effective Line 83: System.out.println ( "Close Rolodex" ); LOC Type(s): LOC Effective Logical Line 84: LOC Type(s): Blank Line 85: FileOutputStream outputfile = null; LOC Type(s): LOC Effective Logical Line 86: ObjectOutputStream oos = null; LOC Type(s): LOC Effective Logical Line 87: LOC Type(s): Blank Line 88: File f = new File ( datafilename ); LOC Type(s): LOC Effective Logical Line 89: try LOC Type(s): LOC Effective Line 90: { LOC Type(s): LOC Non-Effective Line 91: outputfile = new FileOutputStream ( f ); LOC Type(s): LOC Effective Logical Line 92: } LOC Type(s): LOC Non-Effective Line 93: catch ( Exception e ) LOC Type(s): LOC Effective Line 94: { LOC Type(s): LOC Non-Effective Line 95: System.err.println ( "Cannot Create File: " + datafilename ); LOC Type(s): LOC Effective Logical Line 96: return(false); LOC Type(s): LOC Effective Logical Line 97: } LOC Type(s): LOC Non-Effective Line 98: LOC Type(s): Blank Line 99: // write list LOC Type(s): Java Comment Line 100: try LOC Type(s): LOC Effective Line 101: { LOC Type(s): LOC Non-Effective Line 102: oos = new ObjectOutputStream ( outputfile ); LOC Type(s): LOC Effective Logical Line 103: } LOC Type(s): LOC Non-Effective Line 104: catch ( Exception e ) LOC Type(s): LOC Effective Line 105: { LOC Type(s): LOC Non-Effective Line 106: System.err.println ( "Cannot open output stream for object write." ); LOC Type(s): LOC Effective Logical Line 107: return(false); LOC Type(s): LOC Effective Logical Line 108: } LOC Type(s): LOC Non-Effective Line 109: LOC Type(s): Blank Line 110: try LOC Type(s): LOC Effective Line 111: { LOC Type(s): LOC Non-Effective Line 112: oos.writeObject( (Object)rololist ); LOC Type(s): LOC Effective Logical Line 113: } LOC Type(s): LOC Non-Effective Line 114: catch ( Exception e ) LOC Type(s): LOC Effective Line 115: { LOC Type(s): LOC Non-Effective Line 116: System.err.println ( "Cannot write Rolodex List" ); LOC Type(s): LOC Effective Logical Line 117: return(false); LOC Type(s): LOC Effective Logical Line 118: } LOC Type(s): LOC Non-Effective Line 119: System.out.println ( "Rolodex " + datafilename + " Closed" ); LOC Type(s): LOC Effective Logical Line 120: return(true); LOC Type(s): LOC Effective Logical Line 121: } LOC Type(s): LOC Non-Effective Line 122: LOC Type(s): Blank Line 123: public void add(Contact c) LOC Type(s): LOC Effective Line 124: { LOC Type(s): LOC Non-Effective Line 125: rololist.add(c); LOC Type(s): LOC Effective Logical Line 126: } LOC Type(s): LOC Non-Effective Line 127: LOC Type(s): Blank Line 128: public int addContacts() LOC Type(s): LOC Effective Line 129: { LOC Type(s): LOC Non-Effective Line 130: int newcontacts = 0; LOC Type(s): LOC Effective Logical Line 131: while (true) LOC Type(s): LOC Effective Line 132: { LOC Type(s): LOC Non-Effective Line 133: Contact newc = new Contact(); LOC Type(s): LOC Effective Logical Line 134: if ( newc.getName().length() == 0 ) LOC Type(s): LOC Effective Line 135: { LOC Type(s): LOC Non-Effective Line 136: break; LOC Type(s): LOC Effective Logical Line 137: } LOC Type(s): LOC Non-Effective Line 138: else LOC Type(s): LOC Effective Line 139: { LOC Type(s): LOC Non-Effective Line 140: add(newc); LOC Type(s): LOC Effective Logical Line 141: newcontacts++; LOC Type(s): LOC Effective Logical Line 142: } LOC Type(s): LOC Non-Effective Line 143: } LOC Type(s): LOC Non-Effective Line 144: return(newcontacts); LOC Type(s): LOC Effective Logical Line 145: } LOC Type(s): LOC Non-Effective Line 146: LOC Type(s): Blank Line 147: public void show() LOC Type(s): LOC Effective Line 148: { LOC Type(s): LOC Non-Effective Line 149: for ( int i=0; i<rololist.size(); i++ ) LOC Type(s): LOC Effective Logical Line 150: { LOC Type(s): LOC Non-Effective Line 151: ((Contact)rololist.get(i)).show(); LOC Type(s): LOC Effective Logical Line 152: } LOC Type(s): LOC Non-Effective Line 153: } LOC Type(s): LOC Non-Effective Line 154: LOC Type(s): Blank Line 155: static public void main ( String args[] ) LOC Type(s): LOC Effective Line 156: { LOC Type(s): LOC Non-Effective Line 157: Rolodex rolo = new Rolodex(); LOC Type(s): LOC Effective Logical Line 158: LOC Type(s): Blank Line 159: if ( args.length < 1 ) LOC Type(s): LOC Effective Line 160: { LOC Type(s): LOC Non-Effective Line 161: System.err.println ( "Usage: java rolodex.Rolodex datafile" ); LOC Type(s): LOC Effective Logical Line 162: System.exit(1); LOC Type(s): LOC Effective Logical Line 163: } LOC Type(s): LOC Non-Effective Line 164: else LOC Type(s): LOC Effective Line 165: { LOC Type(s): LOC Non-Effective Line 166: if ( rolo.open(args[0]) == false ) LOC Type(s): LOC Effective Line 167: { LOC Type(s): LOC Non-Effective Line 168: System.err.println ( "Error: Failed to open Rolodex" ); LOC Type(s): LOC Effective Logical Line 169: System.exit(1); LOC Type(s): LOC Effective Logical Line 170: } LOC Type(s): LOC Non-Effective Line 171: } LOC Type(s): LOC Non-Effective Line 172: LOC Type(s): Blank Line 173: rolo.show(); LOC Type(s): LOC Effective Logical Line 174: rolo.addContacts(); LOC Type(s): LOC Effective Logical Line 175: rolo.show(); LOC Type(s): LOC Effective Logical Line 176: rolo.close(args[0]); LOC Type(s): LOC Effective Logical Line 177: LOC Type(s): Blank Line 178: } LOC Type(s): LOC Non-Effective Line 179: } LOC Type(s): LOC Non-Effective Line 180: LOC Type(s): Blank Line 181: LOC Type(s): Blank ------------------------------------------------------------------------ ~~ Total File Summary ~~ LOC 154 eLOC 92 lLOC 62 Comment 3 Lines 181 ________________________________________________________________________ End of File: Rolodex.java ------------------------------------------------------------------------ ~~ Total Metrics For 1 Files ~~ ------------------------------------------------------------------------ ~~ Total Project Summary ~~ LOC 154 eLOC 92 lLOC 62 Comment 3 Lines 181 Average per File, metric/1 files LOC 154 eLOC 92 lLOC 62 Comment 3 Lines 181 ------------------------------------------------------------------------ ~~ File Summary ~~ C Source Files *.c ....: 0 C/C++ Include Files *.h: 0 C++ Source Files *.c* .: 0 C++ Include Files *.h* : 0 C# Source Files *.cs ..: 0 Java Source File *.jav*: 1 Other Source Files ....: 0 Total File Count ......: 1 ________________________________________________________________________ Report Banner - Edit rsm.cfg File