| 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(); |