Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. package pl.edu.uwm.wmii.dorozkogrzegorz.Kolokwium;
  2. public class Plik implements Cloneable
  3. {
  4.     private String nazwa;
  5.     private Integer rozmiar;
  6.     private Boolean czyDoZapisu;
  7.     private static Integer ile=0;
  8.     public Plik(String nazwa, Integer rozmiar, boolean czyDoZapisu)
  9.     {
  10.         setNazwa(nazwa);
  11.         setRozmiar(rozmiar);
  12.         setCzyDoZapisu(czyDoZapisu);
  13.         ile++;
  14.     }
  15.     public Plik(int rozmiar, boolean czyDoZapisu)
  16.     {
  17.         setNazwa("Jakis Plik");
  18.     }
  19.     public static int getIle()
  20.     {
  21.         return ile;
  22.     }
  23.     public Integer getRozmiar()
  24.     {
  25.         return rozmiar;
  26.     }
  27.     public String getNazwa()
  28.     {
  29.         return nazwa;
  30.     }
  31.     public Boolean getczyDoZapisu()
  32.     {
  33.         return czyDoZapisu;
  34.     }
  35.     public void setCzyDoZapisu(Boolean czyDoZapisu)
  36.     {
  37.         this.czyDoZapisu=czyDoZapisu;
  38.     }
  39.     public void setNazwa(String nazwa)
  40.     {
  41.         this.nazwa = nazwa;
  42.     }
  43.     public void setRozmiar(Integer rozmiar)
  44.     {
  45.         this.rozmiar = rozmiar;
  46.     }
  47.     public boolean equals(Object obj)
  48.     {
  49.         Plik temp = (Plik) obj;
  50.         if(this.nazwa.equals(temp.nazwa)&&this.rozmiar.equals(temp.rozmiar)&&this.czyDoZapisu.equals(temp.czyDoZapisu)&&this.ile.equals(temp.ile))
  51.             return true;
  52.         return false;
  53.     }
  54.     protected Object clone() throws CloneNotSupportedException
  55.     {
  56.         Plik temp=new Plik(this.getNazwa(),this.getRozmiar(),this.getczyDoZapisu());
  57.         return temp;
  58.     }
  59.     public String toString()
  60.     {
  61.         return this.getNazwa()+", rozmiar: "+this.getRozmiar()+", zapis: "+this.getczyDoZapisu()+", ile: "+this.getIle();
  62.     }
  63.     public boolean compareTo(Plik maly)
  64.     {
  65.         return false;
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement