Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package data;
- import java.util.Map;
- // Time-window statistics
- public class Statistic extends TableObject {
- private static final int DEFAULT_ID = -1;
- private int totalRevenue;
- private int totalExpense;
- private int totalProfit;
- public Statistic(){
- super(DEFAULT_ID);
- }
- public Statistic(int totalRevenue, int totalExpense, int totalProfit){
- super(DEFAULT_ID);
- this.totalRevenue = totalRevenue;
- this.totalExpense = totalExpense;
- this.totalProfit = totalProfit;
- }
- public Statistic(int id, int totalRevenue, int totalExpense, int totalProfit){
- super(id);
- this.totalRevenue = totalRevenue;
- this.totalExpense = totalExpense;
- this.totalProfit = totalProfit;
- }
- protected Statistic(int ID) {
- super(ID);
- }
- @Override
- public int getUniqueColumnIndex() {
- return 0;
- }
- @Override
- public int getColumnCount() {
- return 3;
- }
- @Override
- public String[] getColumnNames() {
- return new String[]{"totalRevenue", "totalExpense", "totalProfit"};
- }
- @Override
- public String[] getColumnTypes() {
- return new String[]{"INTEGER","INTEGER","INTEGER"};
- }
- @Override
- public Object[] getColumnValues() {
- return new Object[]{totalRevenue,totalExpense,totalProfit};
- }
- @Override
- protected TableObject rebuild(Map<String, Object> values) {
- int _id = (int) values.get(ID_COLUMN);
- int _totalRevenue = (int) values.get("totalRevenue");
- int _totalExpense = (int) values.get("totalExpense");
- int _totalProfit = (int) values.get("totalProfit");
- return new Statistic(_id,_totalRevenue,_totalExpense,_totalProfit);
- }
- public int getTotalRevenue() {
- return totalRevenue;
- }
- public void setTotalRevenue(int totalRevenue) {
- this.totalRevenue = totalRevenue;
- }
- public int getTotalExpense() {
- return totalExpense;
- }
- public void setTotalExpense(int totalExpense) {
- this.totalExpense = totalExpense;
- }
- public int getTotalProfit() {
- return totalProfit;
- }
- public void setTotalProfit(int totalProfit) {
- this.totalProfit = totalProfit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement