private void writeClassData ( ) { try ( PrintStream out = new PrintStream ( openResultFileOuputStream ( resultDirectory , "classes.json" ) ) ) { out . println ( "{" ) ; // Add direct subclass information: for ( Entry < Integer , ClassRecord > classEntry : this . classRecords . entrySet ( ) ) { if ( classEntry . getValue ( ) . subclassCount == 0 && classEntry . getValue ( ) . itemCount == 0 ) { continue ; } for ( Integer superClass : classEntry . getValue ( ) . directSuperClasses ) { this . classRecords . get ( superClass ) . nonemptyDirectSubclasses . add ( classEntry . getKey ( ) . toString ( ) ) ; } } int count = 0 ; int countNoLabel = 0 ; for ( Entry < Integer , ClassRecord > classEntry : this . classRecords . entrySet ( ) ) { if ( classEntry . getValue ( ) . subclassCount == 0 && classEntry . getValue ( ) . itemCount == 0 ) { continue ; } if ( classEntry . getValue ( ) . label == null ) { countNoLabel ++ ; } if ( count > 0 ) { out . println ( "," ) ; } out . print ( "\"" + classEntry . getKey ( ) + "\":" ) ; mapper . writeValue ( out , classEntry . getValue ( ) ) ; count ++ ; } out . println ( "\n}" ) ; System . out . println ( " Serialized information for " + count + " class items." ) ; System . out . println ( " -- class items with missing label: " + countNoLabel ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Writes all data that was collected about classes to a json file .