EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
TimeSeriesImpl.java
1 /*******************************************************************************
2  * Copyright 2013 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 package emlab.gen.trend;
17 
18 import org.springframework.data.neo4j.annotation.NodeEntity;
19 
20 import agentspring.trend.TimeSeries;
21 
22 
23 
28 @NodeEntity
29 public class TimeSeriesImpl implements TimeSeries {
30 
35  private double[] timeSeries;
36 
41  private double startingYear;
42 
43  @Override
44  public double getValue(long time) {
45  return timeSeries[(int) time - (int) startingYear];
46  }
47 
48  public void setValue(long time, double value) {
49  timeSeries[(int) time - (int) startingYear] = value;
50  }
51 
52  public double[] getTimeSeries() {
53  return timeSeries;
54  }
55 
56  public void setTimeSeries(double[] timeSeries) {
57  this.timeSeries = timeSeries;
58  }
59 
60  public double getStartingYear() {
61  return startingYear;
62  }
63 
64  public void setStartingYear(double startingYear) {
65  this.startingYear = startingYear;
66  }
67 
68 
69 
70 }