EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
MarketVerificationRole.java
1 /*******************************************************************************
2  * Copyright 2012 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.role.market;
17 
18 import java.util.ArrayList;
19 import java.util.List;
20 
21 import org.springframework.beans.factory.annotation.Autowired;
22 
23 import agentspring.role.Role;
24 import agentspring.role.RoleComponent;
30 
43 @RoleComponent
44 public class MarketVerificationRole extends AbstractMarketRole<ElectricitySpotMarket> implements Role<ElectricitySpotMarket> {
45 
46  @Autowired
47  private Reps reps;
48 
49 
50  public void act(ElectricitySpotMarket aRandomMarketNotToBeUsed) {
51 
52  logger.info("Validating the markets");
53 
54  // find all power plants and store the ones operational to a list.
55  List<PowerPlant> powerPlants = new ArrayList<PowerPlant>();
56  for (PowerPlant plant : reps.powerPlantRepository.findAll()) {
57  if (plant.isOperational(getCurrentTick())) {
58  powerPlants.add(plant);
59  }
60  }
61  }
62 
63  @Override
64  public Reps getReps() {
65  return reps;
66  }
67 
68 }