@@ -344,86 +344,27 @@ public static String matchInfo(final MatchingResult res) {
344344 return sb .toString ();
345345 }
346346
347- /**
348- * Gets a string describing the given op, highlighting the specific
349- * parameter.
350- *
351- * @param info
352- * The {@link OpInfo} metadata which describes the op.
353- * @param special
354- * A parameter of particular interest when describing the op.
355- * @return A string describing the op.
356- */
357- public static String opString (final OpInfo info , final Member <?> special ) {
358- final StringBuilder sb = new StringBuilder ();
359- final String outputString = paramString (outputs (info .struct ()), null ).trim ();
360- if (!outputString .isEmpty ())
361- sb .append ("(" + outputString + ") =\n \t " );
362- sb .append (info .implementationName ());
363- sb .append ("(" + paramString (inputs (info .struct ()), special ) + ")" );
364- return sb .toString ();
365- }
366-
367- /**
368- * Helper method of {@link #opString(OpInfo, Member)} which parses a set of
369- * items with a default delimiter of ","
370- */
371- private static String paramString (final Iterable <Member <?>> items , final Member <?> special ) {
372- return paramString (items , special , "," );
373- }
374-
375- /**
376- * As {@link #paramString(Iterable, Member, String)} with an optional
377- * delimiter.
378- */
379- private static String paramString (final Iterable <Member <?>> items , final Member <?> special , final String delim ) {
380- return paramString (items , special , delim , false );
381- }
382-
383- /**
384- * As {@link #paramString(Iterable, Member, String)} with a toggle to
385- * control if inputs are types only or include the names/descriptions.
386- */
387- private static String paramString (final Iterable <Member <?>> items , final Member <?> special , final String delim ,
388- final boolean typeOnly ) {
389- final StringBuilder sb = new StringBuilder ();
390- boolean first = true ;
391- for (final Member <?> item : items ) {
392- if (first )
393- first = false ;
394- else
395- sb .append (delim );
396- sb .append ("\n " );
397- if (item == special )
398- sb .append ("==>" ); // highlight special item
399- sb .append ("\t \t " );
400- sb .append (item .getType ().getTypeName ());
401-
402- if (!typeOnly ) {
403- sb .append (" " + item .getKey ());
404- sb .append (" -> " + item .getDescription ());
405- }
406- }
407- return sb .toString ();
347+ public static String opString (final OpInfo info ) {
348+ return opString (info , null );
408349 }
409350
410- public static String opString (final OpInfo info ) {
351+ public static String opString (final OpInfo info , final Member <?> special ) {
411352 final StringBuilder sb = new StringBuilder ();
412353 sb .append (info .implementationName () + "(\n \t Inputs:\n " );
413354 for (final Member <?> arg : info .inputs ()) {
414- sb .append ("\t \t " );
415- sb .append (arg .getType ().getTypeName ());
416- sb .append (" " );
417- sb .append (arg .getKey ());
418- if (!arg .getDescription ().isEmpty ()) {
419- sb .append (" -> " );
420- sb .append (arg .getDescription ());
421- }
422- sb .append ("\n " );
355+ appendParam (sb , arg , special );
423356 }
424357 sb .append ("\t Outputs:\n " );
425- final Member <?> arg = info .output ();
426- sb .append ("\t \t " );
358+ appendParam (sb , info .output (), special );
359+ sb .append (")\n " );
360+ return sb .toString ();
361+ }
362+
363+ private static void appendParam (final StringBuilder sb , final Member <?> arg ,
364+ final Member <?> special )
365+ {
366+ if (arg == special ) sb .append ("==> \t " ); // highlight special item
367+ else sb .append ("\t \t " );
427368 sb .append (arg .getType ().getTypeName ());
428369 sb .append (" " );
429370 sb .append (arg .getKey ());
@@ -432,8 +373,7 @@ public static String opString(final OpInfo info) {
432373 sb .append (arg .getDescription ());
433374 }
434375 sb .append ("\n " );
435- sb .append (")\n " );
436- return sb .toString ();
376+ return ;
437377 }
438378
439379 public static Class <?> findFirstImplementedFunctionalInterface (final OpRef opRef ) {
0 commit comments