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,8 +1,57 @@
@@ -1,8 +1,57 @@
|
||||
public enum Extension { |
||||
package ru.molokoin; |
||||
|
||||
import java.sql.Time; |
||||
|
||||
public enum Extension{ |
||||
DOCUMENT, |
||||
IMAGE, |
||||
AUDIO, |
||||
VIDEO, |
||||
OTHER; |
||||
|
||||
private String format; |
||||
private int lists; |
||||
private Dimensions dimensions; |
||||
private String content; |
||||
private Time lenght; |
||||
|
||||
protected void initDocument(String format, int lists){ |
||||
setFormat(format); |
||||
setLists(lists); |
||||
} |
||||
protected void printDocument(){ |
||||
System.out.println("format: " + getFormat()); |
||||
System.out.println("lists: " + getLists()); |
||||
} |
||||
|
||||
protected void setFormat(String format) { |
||||
this.format = format; |
||||
} |
||||
protected void setLists(int lists) { |
||||
this.lists = lists; |
||||
} |
||||
protected void setDimensions(Dimensions dimensions) { |
||||
this.dimensions = dimensions; |
||||
} |
||||
protected void setContent(String content) { |
||||
this.content = content; |
||||
} |
||||
protected void setLenght(Time lenght) { |
||||
this.lenght = lenght; |
||||
} |
||||
protected String getFormat() { |
||||
return format; |
||||
} |
||||
protected int getLists() { |
||||
return lists; |
||||
} |
||||
protected Dimensions getDimensions() { |
||||
return dimensions; |
||||
} |
||||
protected String getContent() { |
||||
return content; |
||||
} |
||||
protected Time getLenght() { |
||||
return lenght; |
||||
} |
||||
} |
||||
|
@ -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