File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414package monkstone ;
1515
1616import java .util .ArrayList ;
17- import java .util .Arrays ;
18- import java .util .Collections ;
1917import java .util .List ;
2018import java .util .Random ;
2119
2523 */
2624public class ColorUtil {
2725
26+ static final String TOO_BIG = "produces a line too long a line for code" ;
27+
2828 /**
2929 * Returns hex long as a positive int unless greater than Integer.MAX_VALUE
3030 * else return the complement as a negative integer or something like that
@@ -63,13 +63,14 @@ static public int[] webArray(String[] web) {
6363 }
6464
6565 /**
66- * Return a ruby string of the form "%w( a b c) " where a, b, c are raw web
66+ * Return a ruby string of the form "%w[ a b c] " where a, b, c are raw web
6767 * strings. This string can be used in ruby code.
6868 *
6969 * @param p5colors cols of p5 colors (int)
7070 * @return String for use in ruby
7171 */
7272 static public String rubyString (int [] p5colors ) {
73+ if (p5colors .length > 8 ){ return TOO_BIG ;}
7374 StringBuilder sb = new StringBuilder ("%w[" );
7475 for (int p5color : p5colors ) {
7576 sb .append (String .format ("#%06X" , (0xFFFFFF & p5color )));
You can’t perform that action at this time.
0 commit comments