/** * implementation of the Initializable interface. * @param args the defaulot argument */ public void initialize(final Tree args) { String s = null; int period = StatControllerImpl.DEFAULT_PERIOD; if (args.getSubTree(0) != null) { s = args.getSubTree(0).toString(); } try { period = Integer.parseInt(s); } catch (final NumberFormatException e) { } final Timer timer = new Timer(); timer.schedule(new WriteStatsTask(this), 0, period); }
public Object newObject(final Tree objectDescriptor, final Object loader) throws Exception { if (objectDescriptor.getSize() == 0) { return loadClass(objectDescriptor.toString(), loader).newInstance(); } else { Object o; o = loadClass(objectDescriptor.getSubTree(0), loader).newInstance(); if (objectDescriptor.getSize() > 1) { Tree[] trees = objectDescriptor.getSubTrees(); Tree[] args = new Tree[trees.length - 1]; System.arraycopy(trees, 1, args, 0, args.length); ((Initializable) o).initialize(new Tree(args)); } return o; } }
/** * Initializes this object with the given arguments. * The first subtree (if any) must represent the value of {@link #_period period}. * * @param args the arguments to be used to initialize this object. * @throws NumberFormatException * if the first subtree is not a valid string representation of a long value. * @throws IllegalStateException if the firts subtree does not represent a positive value. */ public void initialize(final Tree args) { //System.out.println("-- " + args.toString() + ", period=" + period); if (args.getSize() == 0) return; _period = Long.valueOf(args.getSubTree(0).toString()).longValue(); if (_period < 1) throw new IllegalStateException("period=" + _period + " is invalid. The value must be positive."); //System.out.println("-- " + args.toString() + ", period=" + period); }
/** * Return the fully-qualified name of the ADL descriptor associated to the * specified controller descriptor. */ protected String getADLDesc( String ctrlDesc ) throws NoSuchControllerDescriptorException { Tree t = jloader.loadTree(KOCK_PREFIX+ctrlDesc); // may throw ArrayOutOfBoundException String adl = t.getSubTree(0).toString(); return adl; }
public void initialize (final Tree args) throws Exception { _super_initialize(args); for (int i = 0; i < args.getSize(); ++i) { Tree arg = args.getSubTree(i); if (arg.getSize() == 2 && arg.getSubTree(0).equals("monolog-conf-file")) { String monologConfFile = arg.getSubTree(1).toString(); if (Monolog.monologFactory == Monolog.getDefaultMonologFactory()) { Monolog.getMonologFactory(monologConfFile); } } } }
public void initialize (final Tree args) throws Exception { _super_initialize(args); for (int i = 0; i < args.getSize(); ++i) { Tree arg = args.getSubTree(i); if (arg.getSize() == 2 && arg.getSubTree(0).equals("monolog-conf-file")) { String monologConfFile = arg.getSubTree(1).toString(); if (Monolog.monologFactory == Monolog.getDefaultMonologFactory()) { Monolog.getMonologFactory(monologConfFile); } } } }
break; } else { definitions.put(def.getSubTree(0).toString(), def .getSubTree(1));
ClassGenerator classGen = null; try { classGen = (ClassGenerator)newObject(classDescriptor.getSubTree(0), loader); } catch (ClassCastException e) { throw new ClassGenerationException(
/** * Initializes this object with the given arguments. * The first subtree (if any) must represent the value of {@link #_period period}. * The second subtree (if any) must represent the value of the {@link #_alpha smoothing constant}. * * @param args the arguments to be used to initialize this object. * @throws NumberFormatException * if the first subtree is not a valid string representation of a long value, * or if the second subtree is not a valid string representation of a double value. * @throws IllegalStateException * if the firts subtree does not represent a positive value * or if the second subtree does not represent a value in the interval [0-1]. */ public void initialize(final Tree args) { //System.out.println("-- " + args.toString() + ", period=" + period + ", alpha=" + alpha); if (args.getSize() == 0) return; else if (args.getSize() == 1){ super.initialize(args); return; } super.initialize(args); _alpha = Double.valueOf(args.getSubTree(1).toString()).doubleValue(); if ((_alpha < 0) || (_alpha > 1)) throw new IllegalStateException("alpha=" + _alpha + " is invalid. The value must in the interval [0-1]."); //System.out.println("-- " + args.toString() + ", period=" + period + ", alpha=" + alpha); }
new InterceptorSourceCodeGeneratorItf[ t.getSize() - 1 ]; for (int i = 0; i < iscgs.length; i++) { Tree tt = t.getSubTree(i+1); String name = tt.toString(); Class<InterceptorSourceCodeGeneratorItf> cl = jc.loadClass(name); Tree tt = t.getSubTree(0); String name = tt.toString(); Class<InterceptorClassGenerator> cl = jc.loadClass(name);