esoe
2 years ago
11 changed files with 156 additions and 18 deletions
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
package ru.molokoin; |
||||
|
||||
public class Dimensions { |
||||
int width; |
||||
int height; |
||||
Dimensions(int width, int height){ |
||||
setWidth(width); |
||||
setHeight(height); |
||||
} |
||||
public void setWidth(int width) { |
||||
this.width = width; |
||||
} |
||||
public void setHeight(int height) { |
||||
this.height = height; |
||||
} |
||||
public int getWidth() { |
||||
return width; |
||||
} |
||||
public int getHeight() { |
||||
return height; |
||||
} |
||||
} |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
public class DocumentFile extends File{ |
||||
|
||||
} |
@ -1,16 +1,40 @@
@@ -1,16 +1,40 @@
|
||||
package ru.molokoin; |
||||
|
||||
/** |
||||
* Класс - обертка |
||||
* предоставляет инструментарий обращения с отдельным файлом |
||||
*/ |
||||
public class File { |
||||
String name; |
||||
Byte size; |
||||
Extension extension; |
||||
|
||||
public File (String name, Byte size, Extension extension){ |
||||
|
||||
private String name; |
||||
private byte size; |
||||
private Extension extension; |
||||
public File(String name, byte size, Extension extension){ |
||||
setName(name); |
||||
setSize(size); |
||||
setExtension(extension); |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
//
|
||||
public void print(){ |
||||
System.out.println("name: " + getName()); |
||||
System.out.println("size: " + (byte) getSize()); |
||||
System.out.println("extension: " + extension); |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
public void setSize(byte size) { |
||||
this.size = size; |
||||
} |
||||
public void setExtension(Extension extension) { |
||||
this.extension = extension; |
||||
} |
||||
public String getName() { |
||||
return name; |
||||
} |
||||
public byte getSize() { |
||||
return size; |
||||
} |
||||
public Extension getExtension() { |
||||
return extension; |
||||
} |
||||
} |
||||
|
@ -1,3 +1,27 @@
@@ -1,3 +1,27 @@
|
||||
package ru.molokoin; |
||||
/** |
||||
* Класс - хранилище |
||||
* предоставляет инструментарий обращения с массивом файлов |
||||
*/ |
||||
public class Storage { |
||||
File[] files; |
||||
private File[] files; |
||||
|
||||
public void setFiles(File[] files) { |
||||
this.files = files; |
||||
} |
||||
public File[] getFiles() { |
||||
return files; |
||||
} |
||||
|
||||
|
||||
public static void main(String[] args) { |
||||
Storage storage = new Storage(); |
||||
storage.setFiles(new File[1]); |
||||
Extension e = Extension.DOCUMENT; |
||||
e.initDocument("null", 0); |
||||
storage.files[0] = new File("noname", (byte)0, e); |
||||
storage.files[0].print(); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue