[graphl-cvs] graphl/src/org/mediavirus/util ParseUtils.java
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2006-06-30 14:32:12
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/util In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv11488/src/org/mediavirus/util Modified Files: ParseUtils.java Log Message: - migrated from jxpath to jaxen, which gives a much cleaner implementation of custom axes Index: ParseUtils.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/util/ParseUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParseUtils.java 27 Oct 2004 10:55:41 -0000 1.4 --- ParseUtils.java 30 Jun 2006 14:31:37 -0000 1.5 *************** *** 20,26 **** Color col = null; if (colstr != null) { ! colstr = colstr.substring(1); ! int colval = Integer.parseInt(colstr, 16); ! col = new Color(colval); } return col; --- 20,44 ---- Color col = null; if (colstr != null) { ! // web notation ! if (colstr.startsWith("#")) { ! colstr = colstr.substring(1); ! int colval = Integer.parseInt(colstr, 16); ! col = new Color(colval); ! } ! // rgb notation ! else { ! StringTokenizer coltok = new StringTokenizer(colstr,","); ! int i=0; ! int[] rgb = {0,0,0}; ! while (coltok.hasMoreTokens()) { ! String val = coltok.nextToken(); ! rgb[i] = Integer.parseInt(val); ! // clamp color values ! if (rgb[i] > 255) rgb[i] = 255; ! if (rgb[i] < 0) rgb[i] = 0; ! if (i++ == 3) break; ! } ! col = new Color(rgb[0],rgb[1],rgb[2]); ! } } return col; |