1 package de.dhbwloe.campusapp.mensaplan;
3 import java.text.DateFormat;
4 import java.text.ParseException;
5 import java.text.SimpleDateFormat;
7 import java.util.Locale;
8 import java.util.zip.CRC32;
11 * Created by pk910 on 22.01.2016.
13 public class MensaTagesplan {
14 private long iPlanDate;
16 private String sMenuName, sName, sNameHtml, sAdditional, sNotes;
17 private int[] aPriceArray = new int[4];
19 private boolean bIsNew = false;
21 public MensaTagesplan(long plandate, String menuname, long chksum, String name, String namehtml, String additional, String notes, int price1, int price2, int price3, int price4) {
27 sAdditional = (additional == null ? "" : additional);
29 aPriceArray[0] = price1; // Student
30 aPriceArray[1] = price2; // Employees
31 aPriceArray[2] = price3; // Guest
32 aPriceArray[3] = price4; // School
35 public long calculateChkSum() {
36 CRC32 crc = new CRC32();
37 crc.update(sMenuName.getBytes());
38 crc.update(sName.getBytes());
39 crc.update(sNameHtml.getBytes());
40 if(sAdditional!= null)
41 crc.update(sAdditional.getBytes());
43 crc.update(sNotes.getBytes());
44 crc.update(aPriceArray[0]);
45 crc.update(aPriceArray[1]);
46 crc.update(aPriceArray[2]);
47 crc.update(aPriceArray[3]);
49 long crcvalue = crc.getValue();
54 public long getPlanDate() {
58 public String getFormatedDate() {
59 DateFormat df = new SimpleDateFormat("dd.MM.yyyy", Locale.ENGLISH);
60 return df.format(new Date(iPlanDate * 1000));
63 public long getChkSum() {
67 public String getMenuName() {
71 public String getName() {
75 public String getNameHtml() {
79 public String getAdditional() {
83 public String getNotes() {
87 public int[] getPlainPrice() {
91 public double getStudentPrice() {
92 double price = (aPriceArray[0] / 100.0);
96 public double getEmployeePrice() {
97 double price = (aPriceArray[1] / 100.0);
101 public double getGuestPrice() {
102 double price = (aPriceArray[2] / 100.0);
106 public double getSchoolPrice() {
107 double price = (aPriceArray[3] / 100.0);
111 public void setIsNew() {
115 public boolean getIsNew(boolean reset) {
116 boolean isnew = bIsNew;