private void parseVRule(String word) { String[] tokens1 = new ColonSplitter(word).split(); if (tokens1.length < 2 || tokens1.length > 3) { throw new IllegalArgumentException("Invalid VRULE statement: " + word); } String[] tokens2 = tokens1[1].split("#"); if (tokens2.length != 2) { throw new IllegalArgumentException("Invalid VRULE statement: " + word); } long timestamp = Util.getTimestamp(tokens2[0]); Paint color = Util.parseColor(tokens2[1]); gdef.vrule(timestamp, color, tokens1.length == 3 ? tokens1[2] : null); }
private void parseHRule(String word) { String[] tokens1 = new ColonSplitter(word).split(); if (tokens1.length < 2 || tokens1.length > 3) { throw new IllegalArgumentException("Invalid HRULE statement: " + word); } String[] tokens2 = tokens1[1].split("#"); if (tokens2.length != 2) { throw new IllegalArgumentException("Invalid HRULE statement: " + word); } double value = parseDouble(tokens2[0]); Paint color = Util.parseColor(tokens2[1]); gdef.hrule(value, color, tokens1.length == 3 ? tokens1[2] : null); }
private void parseColors(String[] colorOptions) { if (colorOptions == null) { return; } for (String colorOption : colorOptions) { String[] tokens = colorOption.split("#"); if (tokens.length != 2) { throw new IllegalArgumentException("Invalid COLOR specification: " + colorOption); } String colorName = tokens[0]; Paint paint = Util.parseColor(tokens[1]); gdef.setColor(colorName, paint); } }
private void parseStack(String word) { String[] tokens1 = new ColonSplitter(word).split(); if (tokens1.length != 2 && tokens1.length != 3) { throw new IllegalArgumentException("Invalid STACK statement: " + word); } String[] tokens2 = tokens1[1].split("#"); if (tokens2.length != 1 && tokens2.length != 2) { throw new IllegalArgumentException("Invalid STACK statement: " + word); } String name = tokens2[0]; Paint color = tokens2.length == 2 ? Util.parseColor(tokens2[1]) : BLIND_COLOR; String legend = tokens1.length == 3 ? tokens1[2] : null; gdef.stack(name, color, legend); }
private void parseLine(String word) { String[] tokens1 = new ColonSplitter(word).split(); if (tokens1.length != 2 && tokens1.length != 3) { throw new IllegalArgumentException("Invalid LINE statement: " + word); } String[] tokens2 = tokens1[1].split("#"); if (tokens2.length != 1 && tokens2.length != 2) { throw new IllegalArgumentException("Invalid LINE statement: " + word); } float width = Integer.parseInt(tokens1[0].substring(tokens1[0].length() - 1)); String name = tokens2[0]; Paint color = tokens2.length == 2 ? Util.parseColor(tokens2[1]) : BLIND_COLOR; String legend = tokens1.length == 3 ? tokens1[2] : null; gdef.line(name, color, legend, width); }