MCPcopy Create free account
hub / github.com/antlr/codebuff / _toFileInfoString

Method _toFileInfoString

src/org/antlr/codebuff/Trainer.java:834–865  ·  view source on GitHub ↗
(FeatureMetaData[] FEATURES, InputDocument doc, int[] features)

Source from the content-addressed store, hash-verified

832 }
833
834 public static String _toFileInfoString(FeatureMetaData[] FEATURES, InputDocument doc, int[] features) {
835 StringBuilder buf = new StringBuilder();
836 for (int i=0; i<FEATURES.length; i++) {
837 if ( FEATURES[i].type!=INFO_FILE &&
838 FEATURES[i].type!=INFO_LINE &&
839 FEATURES[i].type!=INFO_CHARPOS )
840 {
841 continue;
842 }
843 if ( i>0 ) buf.append(" ");
844 int displayWidth = FEATURES[i].type.displayWidth;
845 switch ( FEATURES[i].type ) {
846 case INFO_LINE:
847 case INFO_CHARPOS:
848 if ( features[i]>=0 ) {
849 buf.append(String.format("%"+displayWidth+"s", StringUtils.center(String.valueOf(features[i]), displayWidth)));
850 }
851 else {
852 buf.append(Tool.sequence(displayWidth, " "));
853 }
854 break;
855 case INFO_FILE:
856 String fname = new File(doc.fileName).getName();
857 fname = StringUtils.abbreviate(fname, displayWidth);
858 buf.append(String.format("%"+displayWidth+"s", fname));
859 break;
860 default :
861 System.err.println("NO STRING FOR FEATURE TYPE: "+ FEATURES[i].type);
862 }
863 }
864 return buf.toString();
865 }
866
867 public static String featureNameHeader(FeatureMetaData[] FEATURES) {
868 StringBuilder buf = new StringBuilder();

Callers

nothing calls this directly

Calls 7

sequenceMethod · 0.95
toStringMethod · 0.65
appendMethod · 0.45
formatMethod · 0.45
valueOfMethod · 0.45
getNameMethod · 0.45
abbreviateMethod · 0.45

Tested by

no test coverage detected