5353import com .ibm .icu .util .ULocale ;
5454import com .ibm .icu .util .VersionInfo ;
5555
56+ /**
57+ * Provides data for candidates, reading the file candidateData.txt.
58+ * Note: At the end of a release, before the Draft Candidates are retired, run CandidateData.java to get the proposals for those
59+ * candidates, and add to the end of proposalData.txt
60+ */
5661public class CandidateData implements Transform <String , String >, EmojiDataSource {
5762 private static final String TEST_STRING = "👩🤝👩" ;
5863 private static final boolean SHOW_COMBOS = false ;
@@ -128,6 +133,7 @@ public Set<Comparable> make() {
128133 private final UnicodeMap <Status > statuses = new UnicodeMap <>();
129134 private final UnicodeSet singleCharacters = new UnicodeSet ();
130135 private final UnicodeSet allCharacters = new UnicodeSet ();
136+ private final UnicodeSet fullDraftForProposals ;
131137 private final UnicodeSet allNonProvisional = new UnicodeSet ();
132138 private final UnicodeSet textPresentation = new UnicodeSet ();
133139 private UnicodeSet provisional = new UnicodeSet ();
@@ -305,6 +311,7 @@ private CandidateData(String sourceFile) {
305311 // allCharacters.removeAll(singleCharacters);
306312
307313 allCharacters .removeAll (duplicates ).freeze ();
314+ fullDraftForProposals = new UnicodeSet (statuses .getSet (Status .Draft_Candidate )).freeze ();
308315 statuses .removeAll (duplicates ).freeze ();
309316 comments .freeze ();
310317 categories .freeze ();
@@ -424,7 +431,9 @@ private void addHackName(String name, String singleton, String prefix, String su
424431 compoundName += ", " + jName ;
425432 }
426433 names .put (sequence , compoundName );
427- System .out .println (Utility .hex (sequence ) + " => " + compoundName );
434+ if (DEBUG ) {
435+ System .out .println (Utility .hex (sequence ) + " => " + compoundName );
436+ }
428437 }
429438 }
430439 }
@@ -797,7 +806,20 @@ public String getCategory(int source) {
797806 }
798807 public String getCategory (String source ) {
799808 String result = EmojiOrder .STD_ORDER .charactersToOrdering .get (source );
800- return result != null ? result : categories .get (source );
809+ if (result != null ) {
810+ return result ;
811+ }
812+ // final String stripped = EmojiData.removeEmojiVariants(EmojiData.MODIFIERS.stripFrom(source, true));
813+ // result = EmojiOrder.STD_ORDER.charactersToOrdering.get(stripped);
814+ // if (result != null) {
815+ // return result;
816+ // }
817+ result = categories .get (source );
818+ if (result != null ) {
819+ return result ;
820+ }
821+ System .out .println (Utility .hex (source ) + "; " + source );
822+ return null ;
801823 }
802824
803825 public List <Integer > getOrder () {
@@ -825,7 +847,7 @@ public static void main(String[] args) {
825847 DEBUG = true ;
826848 CandidateData candidateData = CandidateData .getInstance ();
827849 if (args .length == 0 ) {
828- throw new IllegalArgumentException () ;
850+ args = new String [] { "proposals" } ;
829851 }
830852 int count = 0 ;
831853 for (String arg : args ) {
@@ -896,10 +918,10 @@ private static void generateProposalData(CandidateData instance) {
896918 //1F931; L2/16-280,L2/16-282r; BREAST-FEEDING
897919 Set <String > done = new HashSet <>();
898920 UnicodeSet missing = new UnicodeSet ();
899- for (String item : instance .allCharacters ) {
921+ for (String item : instance .fullDraftForProposals ) {
900922 if (instance .statuses .get (item ) == Status .Provisional_Candidate
901- || EmojiData .MODIFIERS .containsSome (item )
902- || Emoji .GENDER_MARKERS .containsSome (item )
923+ // || EmojiData.MODIFIERS.containsSome(item)
924+ // || Emoji.GENDER_MARKERS.containsSome(item)
903925 ) {
904926 continue ;
905927 }
@@ -909,9 +931,9 @@ private static void generateProposalData(CandidateData instance) {
909931 }
910932 done .add (skeleton );
911933 Set <String > proposals = instance .getProposal (item );
912- if (proposals == null ) {
913- missing .add (item );
914- }
934+ // if (proposals == null) {
935+ // missing.add(item);
936+ // }
915937 System .out .println (Utility .hex (skeleton )
916938 + "; " + CollectionUtilities .join (proposals , ", " )
917939 + "; " + instance .getName (item ));
0 commit comments