EMlab-generation Documentation  1.0
Documentation of the EMLab-Generation model.
Bid.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.domain.market;
17 
18 import org.neo4j.graphdb.Direction;
19 import org.springframework.data.neo4j.annotation.Indexed;
20 import org.springframework.data.neo4j.annotation.NodeEntity;
21 import org.springframework.data.neo4j.annotation.RelatedTo;
22 import org.springframework.transaction.annotation.Transactional;
23 
25 
26 @NodeEntity
27 public class Bid {
28 
29  public static int FAILED = -1;
30  public static int NOT_SUBMITTED = 0;
31  public static int SUBMITTED = 1;
32  public static int PARTLY_ACCEPTED = 2;
33  public static int ACCEPTED = 3;
34 
35  @RelatedTo(type = "BIDDER", elementClass = DecarbonizationAgent.class, direction = Direction.INCOMING)
36  private DecarbonizationAgent bidder;
37 
38  @RelatedTo(type = "BIDDINGMARKET", elementClass = DecarbonizationMarket.class, direction = Direction.OUTGOING)
39  private DecarbonizationMarket biddingMarket;
40 
41  private double amount;
42  private double acceptedAmount;
43  private double price;
44  @Indexed(indexName = "bidTime")
45  private long time;
46  private int status;
47  private boolean supplyBid;
48 
49  public DecarbonizationAgent getBidder() {
50  return bidder;
51  }
52 
53  public void setBidder(DecarbonizationAgent agent) {
54  this.bidder = agent;
55  }
56 
57  public DecarbonizationMarket getBiddingMarket() {
58  return biddingMarket;
59  }
60 
61  public void setBiddingMarket(DecarbonizationMarket market) {
62  this.biddingMarket = market;
63  }
64 
72  public double getAmount() {
73  return amount;
74  }
75 
76  public void setAmount(double amount) {
77  this.amount = amount;
78  }
79 
80  public double getAcceptedAmount() {
81  return acceptedAmount;
82  }
83 
84  public void setAcceptedAmount(double acceptedAmount) {
85  this.acceptedAmount = acceptedAmount;
86  }
87 
88  public double getPrice() {
89  return price;
90  }
91 
92  public void setPrice(double price) {
93  this.price = price;
94  }
95 
96  public long getTime() {
97  return time;
98  }
99 
100  public void setTime(long time) {
101  this.time = time;
102  }
103 
104  public boolean isSupplyBid() {
105  return supplyBid;
106  }
107 
108  public void setSupplyBid(boolean supplyBid) {
109  this.supplyBid = supplyBid;
110  }
111 
112  public int getStatus() {
113  return status;
114  }
115 
116  public void setStatus(int status) {
117  this.status = status;
118  }
119 
128  @Transactional
129  public void updateAmount(double amount) {
130  setAmount(amount);
131  }
132 
141  @Transactional
142  public void updateStatus(int status) {
143  setStatus(status);
144  }
145 
146  @Override
147  public String toString() {
148  return "for " + getBiddingMarket() + " price: " + getPrice() + " amount: " + getAmount() + " isSupply: "
149  + isSupplyBid();
150  }
151 }
void updateStatus(int status)
Definition: Bid.java:142
void updateAmount(double amount)
Definition: Bid.java:129