Skip to content

Instantly share code, notes, and snippets.

@mingan
Forked from goldfish01/gist:1276446
Created October 10, 2011 20:43
Show Gist options
  • Save mingan/1276469 to your computer and use it in GitHub Desktop.
Save mingan/1276469 to your computer and use it in GitHub Desktop.
Martiny úkol
public class Vysledek
{
//== Datové atributy (statické i instancí)======================================
private Tym domaci;
private Tym hoste;
private int kolo;
private String datum;
private int domaciGolu;
private int hosteGolu;
private boolean prodlouzeni;
//== Konstruktory a tovární metody =============================================
/***************************************************************************
* Konstruktor ....
*/
// častější je, že prodloužení není
public Vysledek(Tym domaci, Tym hoste,int kolo, String datum,
int domaciGolu, int hosteGolu) {
Vysledek(domaci, hoste, kolo, datum, domaciGolu, hosteGolu, false);
}
public Vysledek(Tym domaci, Tym hoste,int kolo, String datum,
int domaciGolu, int hosteGolu, boolean prodlouzeni)
{
this.domaci = domaci;
this.hoste = hoste;
this.nastavKolo(kolo);
this.datum = datum;
this.nastavDomaciGolu(domaciGolu);
this.nastavHosteGolu(hosteGolu);
this.prodlouzeni = prodlouzeni;
}
//== Nesoukromé metody (instancí i třídy) ======================================
public Tym getDomaci()
{
return domaci;
}
public Tym getHoste()
{
return hoste;
}
public String getDatum()
{
return datum;
}
public int getKolo()
{
return kolo;
}
public int getDomaciGolu()
{
return domaciGolu;
}
public int getHosteGolu()
{
return hosteGolu;
}
public boolean getProdlouzeni () {
return prodlouzeni;
}
public void setKolo(int kolo) {
this.kolo = kolo;
}
public void setDomaciGolu(int domaciGolu) {
this.domaciGolu = domaciGolu;
}
public void setHosteGolu(int hosteGolu) {
this.hosteGolu = hosteGolu;
}
public void setProdlouzeni(boolean prodlouzeni) {
this.prodlouzeni= prodlouzeni;
}
@Override
public String toString() {
String vysledek = domaci + " (" + domaciGolu + ") vs. " + hoste + " (" + hosteGolu + ")";
if (prodlouzeni) {
vysledek = vysledek + " (prodl.)"
}
return vysledek;
}
//== Soukromé metody (instancí i třídy) ========================================
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment