Last change
on this file since 78 was
78,
checked in by psniegowski, 11 years ago
|
Add f0 parsing and f0->Model transformation.
|
File size:
1.2 KB
|
Line | |
---|
1 | package com.framsticks.portals; |
---|
2 | |
---|
3 | import com.framsticks.core.Parameters; |
---|
4 | import com.framsticks.observers.Observer; |
---|
5 | import com.framsticks.params.FramsClass; |
---|
6 | import com.framsticks.util.PeriodicTask; |
---|
7 | import org.apache.log4j.Logger; |
---|
8 | |
---|
9 | |
---|
10 | /** |
---|
11 | * @author Piotr Sniegowski |
---|
12 | */ |
---|
13 | public class Portal extends Observer { |
---|
14 | |
---|
15 | private final static Logger LOGGER = Logger.getLogger(Portal.class.getName()); |
---|
16 | |
---|
17 | public Integer counter = 0; |
---|
18 | |
---|
19 | public Portal(Parameters parameters) { |
---|
20 | super(parameters); |
---|
21 | } |
---|
22 | |
---|
23 | @Override |
---|
24 | public void run() { |
---|
25 | super.run(); |
---|
26 | new PeriodicTask(this, 1000) { |
---|
27 | |
---|
28 | @Override |
---|
29 | public void run() { |
---|
30 | ++counter; |
---|
31 | LOGGER.debug("counter is now: " + counter); |
---|
32 | again(); |
---|
33 | } |
---|
34 | }; |
---|
35 | } |
---|
36 | |
---|
37 | @Override |
---|
38 | protected void configure() throws Exception { |
---|
39 | super.configure(); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | @Override |
---|
44 | protected PortalEndpoint createEndpoint() { |
---|
45 | return new PortalEndpoint(); |
---|
46 | } |
---|
47 | |
---|
48 | public Double getCounterSquared() { |
---|
49 | return (double)(counter * counter); |
---|
50 | } |
---|
51 | |
---|
52 | public static void constructFramsClass(FramsClass.Constructor constructor) { |
---|
53 | constructor.method("getCounterSquared").field("counter"); |
---|
54 | } |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.