Skip to content
Snippets Groups Projects

Mal aufn Master megren

Merged Fabio-Andre Heyming requested to merge classes_Fabio into master
106 files
+ 6185
20
Compare changes
  • Side-by-side
  • Inline
Files
106
package com.example.mampfmobil.ui.Classes;
import android.content.Context;
import android.util.Log;
import com.example.mampfmobil.R;
import com.example.mampfmobil.ui.MampfMobil;
import java.util.Vector;
public class Bestellung {
static int idCounter = 1;
public boolean delivery = true;
public Deliverer deliverer = null;
public String state;
public Supplier supplier;
public Customer costumer;
public Vector<BestellungsTeil> bestellungsTeile;
public int id;
public Bestellung(Supplier supplier, Boolean delivery, Context context){
bestellungsTeile = new Vector<>();
this.supplier = supplier;
state = context.getString(R.string.ordered) ;
this.delivery = delivery;
this.costumer = MampfMobil.currentCustomer;
id = idCounter;
idCounter++;
}
public Bestellung(Supplier supplier, Boolean delivery,String state){
bestellungsTeile = new Vector<>();
this.supplier = supplier;
this.state = state ;
this.delivery = delivery;
this.costumer = MampfMobil.currentCustomer;
id = idCounter;
idCounter++;
}
//for dummy data
public Bestellung(Supplier supplier, Boolean delivery,String state,Customer costumer){
bestellungsTeile = new Vector<>();
this.supplier = supplier;
this.state = state ;
this.delivery = delivery;
this.costumer = costumer;
id = idCounter;
idCounter++;
}
public Bestellung(int id,Supplier supplier, Boolean delivery,String state,Customer costumer, int delivererID){
bestellungsTeile = new Vector<>();
this.supplier = supplier;
this.state = state ;
this.delivery = delivery;
this.costumer = costumer;
this.id = id;
if(delivererID != 0){
for(Deliverer d: MampfMobil.deliverers){
if(d.id == delivererID) {
this.deliverer = d;
}
}
}
}
public void addBestellungsteil(BestellungsTeil bt){
Boolean notFound = true;
for(BestellungsTeil btOld: bestellungsTeile){
if(btOld.item == bt.item){
notFound = false;
btOld.quantity = btOld.quantity + bt.quantity;
}
}
if(notFound){
bestellungsTeile.add(bt);
}
}
}
Loading