public class Plik implements Cloneable, Comparable<Plik>{
public Plik(String nazwa, int rozmiar, boolean czyDoZapisu){
this.nazwa = nazwa;
this.rozmiar = rozmiar;
this.czyDoZapisu = czyDoZapisu;
ile++;
}
public Plik(int rozmiar, boolean czyDoZapisu){
this("Jakis Plik", rozmiar, czyDoZapisu);
}
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
Plik other = (Plik) obj;
if (nazwa == null) if (other.nazwa != null) return false;
else if (!nazwa.equals(other.nazwa)) return false;
if (this.rozmiar != other.rozmiar) return false;
if (this.czyDoZapisu != other.czyDoZapisu) return false;
if (this.ile != other.ile) return false;
return true;
}
public int compareTo(Plik other)
{
if((this.nazwa.compareTo(other.nazwa)) == 0){
if(this.rozmiar == other.rozmiar) {
if(this.czyDoZapisu == other.czyDoZapisu){
if(this.ile == other.ile){
return 0;
}
else if (this.ile > other.ile) return 1;
else return -1;
} else return 1;
} else if(this.rozmiar > other.rozmiar) return 1;
else return -1;
}else return this.nazwa.compareTo(other.nazwa);
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public String toString(){
if(nazwa == "Jakis Plik"){
return this.getClass().getSimpleName() + " [" + this.rozmiar + "]" + " , " + "[" + this.czyDoZapisu + "]" + " , " + "[" + this.ile + "]";
}
return this.getClass().getSimpleName() + " [" + this.nazwa + "]" + " , " + "[" + this.rozmiar + "]" + " , " + "[" + this.czyDoZapisu + "]" + " , " + "[" + this.ile + "]";
}
public void setNazwa(String nazwa){
this.nazwa = nazwa;
}
public void setRozmiar(int rozmiar){
this.rozmiar = rozmiar;
}
public void setCzyDoZapisu(boolean czyDoZapisu){
this.czyDoZapisu = czyDoZapisu;
}
public void setIle(int ile){
this.ile = ile;
}
public String getNazwa(){
return this.nazwa;
}
public int getRozmiar(){
return this.rozmiar;
}
public boolean getCzyDoZapisu(){
return this.czyDoZapisu;
}
public static int getIle(){
return ile;
}
private String nazwa;
private int rozmiar;
private boolean czyDoZapisu;
public static int ile = 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}