package com.framsticks.portals; import com.framsticks.core.Tree; import com.framsticks.params.annotations.FramsClassAnnotation; import com.framsticks.params.annotations.ParamAnnotation; import com.framsticks.util.dispatching.JoinableCollection; /** * @author Piotr Sniegowski */ @FramsClassAnnotation public class Portal extends JoinableCollection { @ParamAnnotation public Integer counter = 0; public Portal() { } // @Override // public void run() { // super.run(); // new PeriodicTask(this, 1000) { // @Override // public void run() { // ++counter; // log.debug("counter is now: {}", counter); // again(); // } // }; // } @Override public void add(final Tree tree) { super.add(tree); // tree.addListener(new AbstractTreeListener() { // @Override // public void onRun(Exception e) { // assert Dispatching.isThreadSafe(); // super.onRun(e); // if (e != null) { // return; // } // final String path = "/simulator/genepools/groups/0/genotypes"; // tree.dispatch(new RunAt(ThrowExceptionHandler.getInstance()) { // @Override // protected void runAt() { // tryGet(tree, path, new FutureHandler(Logging.logger(log, "resolve", path)) { // @Override // public void result(Path result) { // Logging.log(log, "resolve", path, null); // } // }); // } // }); // } // }); } @ParamAnnotation(id = "counter_squared", name = "Counter Squared") public Double getCounterSquared() { return (double)(counter * counter); } }