1
2
3
4
5
6
7
8
9
10
11 package org.mule.example.cep;
12
13
14
15
16
17
18 public class Company
19 {
20 private String name;
21 private String symbol;
22 private double currentPrice;
23 private double previousPrice;
24
25 public Company(String name, String symbol)
26 {
27 this(name, symbol, 0, 0);
28 }
29
30 public Company(String name, String symbol, double current, double previous)
31 {
32 this.name = name;
33 this.symbol = symbol;
34 this.currentPrice = current;
35 this.previousPrice = previous;
36 }
37
38 public String getName()
39 {
40 return name;
41 }
42
43 public void setName(String name)
44 {
45 this.name = name;
46 }
47
48 public String getSymbol()
49 {
50 return symbol;
51 }
52
53 public void setSymbol(String symbol)
54 {
55 this.symbol = symbol;
56 }
57
58 public double getCurrentPrice()
59 {
60 return currentPrice;
61 }
62
63 public void setCurrentPrice(double current)
64 {
65 this.previousPrice = this.currentPrice;
66 this.currentPrice = current;
67 }
68
69 public double getPreviousPrice()
70 {
71 return previousPrice;
72 }
73
74 public double getDelta()
75 {
76 return (previousPrice == 0) ? 0.0 : ((currentPrice / previousPrice) - 1.0);
77 }
78
79 }