Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.edu.uwm.wmii.dorozkogrzegorz.Kolokwium;
- public class Plik implements Cloneable
- {
- private String nazwa;
- private Integer rozmiar;
- private Boolean czyDoZapisu;
- private static Integer ile=0;
- public Plik(String nazwa, Integer rozmiar, boolean czyDoZapisu)
- {
- setNazwa(nazwa);
- setRozmiar(rozmiar);
- setCzyDoZapisu(czyDoZapisu);
- ile++;
- }
- public Plik(int rozmiar, boolean czyDoZapisu)
- {
- setNazwa("Jakis Plik");
- }
- public static int getIle()
- {
- return ile;
- }
- public Integer getRozmiar()
- {
- return rozmiar;
- }
- public String getNazwa()
- {
- return nazwa;
- }
- public Boolean getczyDoZapisu()
- {
- return czyDoZapisu;
- }
- public void setCzyDoZapisu(Boolean czyDoZapisu)
- {
- this.czyDoZapisu=czyDoZapisu;
- }
- public void setNazwa(String nazwa)
- {
- this.nazwa = nazwa;
- }
- public void setRozmiar(Integer rozmiar)
- {
- this.rozmiar = rozmiar;
- }
- public boolean equals(Object obj)
- {
- Plik temp = (Plik) obj;
- if(this.nazwa.equals(temp.nazwa)&&this.rozmiar.equals(temp.rozmiar)&&this.czyDoZapisu.equals(temp.czyDoZapisu)&&this.ile.equals(temp.ile))
- return true;
- return false;
- }
- protected Object clone() throws CloneNotSupportedException
- {
- Plik temp=new Plik(this.getNazwa(),this.getRozmiar(),this.getczyDoZapisu());
- return temp;
- }
- public String toString()
- {
- return this.getNazwa()+", rozmiar: "+this.getRozmiar()+", zapis: "+this.getczyDoZapisu()+", ile: "+this.getIle();
- }
- public boolean compareTo(Plik maly)
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement