1 19 package jcckit.plot; 20 21 import java.util.Properties ; 22 import java.util.StringTokenizer ; 23 24 import jcckit.graphic.ClippingShape; 25 import jcckit.util.ConfigParameters; 26 import jcckit.util.PropertiesBasedConfigData; 27 28 33 public class SimpleCurveFactory implements CurveFactory { 34 35 public static final String DEFINITIONS_KEY = "definitions"; 36 37 private ConfigParameters[] _configs = new ConfigParameters[] 38 {new ConfigParameters(new PropertiesBasedConfigData(new Properties ()))}; 39 40 53 public SimpleCurveFactory(ConfigParameters config) { 54 String value = config.get(DEFINITIONS_KEY, null); 55 if (value != null) { 56 StringTokenizer tokenizer = new StringTokenizer (value); 57 _configs = new ConfigParameters[tokenizer.countTokens()]; 58 for (int i = 0; i < _configs.length; i++) { 59 _configs[i] = config.getNode(tokenizer.nextToken()); 60 } 61 } 62 } 63 64 75 public Curve create(int curveIndex, int numberOfCurves, 76 ClippingShape clippingShape, Legend legend) { 77 return new SimpleCurve(_configs[curveIndex % _configs.length], curveIndex, 78 numberOfCurves, clippingShape, legend); 79 } 80 } 81 | Popular Tags |