esoe
2 years ago
14 changed files with 159 additions and 42 deletions
@ -1,10 +1,72 @@
@@ -1,10 +1,72 @@
|
||||
package ru.molokoin; |
||||
|
||||
/** |
||||
* Класс, хранящий данные о аудиотреке/audio |
||||
*/ |
||||
public class Audio extends File{ |
||||
private String format; |
||||
private String content; |
||||
private Duration duration; |
||||
|
||||
public Audio(String name, byte size, Extension extension) { |
||||
/** |
||||
* Основной конструктор файлов аудио |
||||
* @param name |
||||
* @param size |
||||
* @param extension |
||||
* @param format |
||||
* @param content |
||||
* @param duration |
||||
*/ |
||||
public Audio(String name, int size, Extension extension, String format, String content, Duration duration) { |
||||
super(name, size, extension); |
||||
//TODO Auto-generated constructor stub
|
||||
setFormat(format); |
||||
setContent(content); |
||||
setDuration(duration); |
||||
} |
||||
|
||||
@Override |
||||
public void print() { |
||||
System.out.println("--------------------------------------------"); |
||||
super.print(); |
||||
System.out.println("format: " + getFormat()); |
||||
System.out.println("content: " + getContent()); |
||||
System.out.println("duration: " + getDuration().getSeconds() + " sec."); |
||||
} |
||||
/** |
||||
* @return the format |
||||
*/ |
||||
public String getFormat() { |
||||
return format; |
||||
} |
||||
/** |
||||
* @param format the format to set |
||||
*/ |
||||
public void setFormat(String format) { |
||||
this.format = format; |
||||
} |
||||
/** |
||||
* @return the content |
||||
*/ |
||||
public String getContent() { |
||||
return content; |
||||
} |
||||
/** |
||||
* @param content the content to set |
||||
*/ |
||||
public void setContent(String content) { |
||||
this.content = content; |
||||
} |
||||
/** |
||||
* @return the duration |
||||
*/ |
||||
public Duration getDuration() { |
||||
return duration; |
||||
} |
||||
/** |
||||
* @param duration the duration to set |
||||
*/ |
||||
public void setDuration(Duration duration) { |
||||
this.duration = duration; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
package ru.molokoin; |
||||
|
||||
/** |
||||
* Класс хранит данные о длительности (аудио/видео). |
||||
* TODO подготовить формат возвращаемого значения в виде: ХХ мин. ХХ сек. |
||||
*/ |
||||
public class Duration { |
||||
private long milliseconds; |
||||
public Duration(long milliseconds){ |
||||
setMilliseconds(milliseconds); |
||||
} |
||||
public void print(){ |
||||
System.out.println(getSeconds() + "секунд."); |
||||
} |
||||
/** |
||||
* Возвращает время в секундах |
||||
* @return |
||||
*/ |
||||
public long getSeconds(){ |
||||
return getMilliseconds()/1000; |
||||
} |
||||
|
||||
/** |
||||
* @param milliseconds the milliseconds to set |
||||
*/ |
||||
public void setMilliseconds(long milliseconds) { |
||||
this.milliseconds = milliseconds; |
||||
} |
||||
/** |
||||
* @return the milliseconds |
||||
*/ |
||||
public long getMilliseconds() { |
||||
return milliseconds; |
||||
} |
||||
|
||||
} |
@ -1,10 +1,31 @@
@@ -1,10 +1,31 @@
|
||||
package ru.molokoin; |
||||
|
||||
public class Video extends File{ |
||||
/** |
||||
* Класс, хранящий метаданные о видео/video |
||||
*/ |
||||
public class Video extends Audio{ |
||||
private Dimensions dimensions; |
||||
|
||||
public Video(String name, byte size, Extension extension) { |
||||
super(name, size, extension); |
||||
//TODO Auto-generated constructor stub
|
||||
public Video(String name, int size, Extension extension, String format, String content, Duration duration, Dimensions dimensions) { |
||||
super(name, size, extension, format, content, duration); |
||||
setDimensions(dimensions); |
||||
} |
||||
@Override |
||||
public void print() { |
||||
super.print(); |
||||
System.out.println(dimensions.getWidth() + " x " + dimensions.getHeight()); |
||||
} |
||||
/** |
||||
* @param dimensions the dimensions to set |
||||
*/ |
||||
public void setDimensions(Dimensions dimensions) { |
||||
this.dimensions = dimensions; |
||||
} |
||||
/** |
||||
* @return the dimensions |
||||
*/ |
||||
public Dimensions getDimensions() { |
||||
return dimensions; |
||||
} |
||||
|
||||
} |
||||
|
Binary file not shown.
Binary file not shown.
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