资源简介
ssd3 的所有的exercise答案 和exam 答案 保证正确
ssd3 的所有的exercise答案 和exam 答案 保证正确
ssd3 的所有的exercise答案 和exam 答案 保证正确
ssd3 的所有的exercise答案 和exam 答案 保证正确
ssd3 的所有的exercise答案 和exam 答案 保证正确
代码片段和文件信息
import java.util.ArrayList;
import java.util.*;
/**
* The class AudioDatabase maintains a collection of AudioFile objects.This
* class implements the interface Iterable to facilitate iterating
* through the collection.
*
* @author linchen
* @version 1.0.0
*
*/
public class AudioDatabase implements Iterable {
private ArrayList files;
/**
* Constructs a AudioDatabase
object which is initially
* empty.
*/
public AudioDatabase() {
this.files = new ArrayList();
}
/**
* Adds a {@link AudioFile} object to this AudioFileDatabase.
*
* @param audioFile
* the {@link AudioFile} object.
*/
public void addFile(AudioFile audioFile) {
this.files.add(audioFile);
}
/**
* Removes a {@link AudioFile} object to this AudioFileDatabase.
*
* @param audioFile
* the {@link AudioFile} object.
*/
public void removeFile(AudioFile audioFile) {
this.files.remove(audioFile);
}
/**
* Returns an iterator over the instances in the collection files.
*
*
* return an {@link Iterator} over the instances in the collection files.
*/
public Iterator iterator() {
return this.files.iterator();
}
/**
* Returns a reference to the AudioFile object with the specified name.
* Returns null if there are no files in the database with the specified
* name.
*
* @param name
* the name of the audiofile.
* @return Returns a reference to the AudioFile object with the specified
* name.
*/
public AudioFile getFile(String name) {
for (AudioFile audioFile : this.files) {
if (audioFile.getName().equals(name)) {
return audioFile;
}
}
return null;
}
/**
* Returns the number of instances in the collection files.
*
* @return Returns the number of instances in the collection files.
*
*/
public int getNumberOfFiles() {
return this.files.size();
}
/**
* Returns an array containing the names of all the files stored in the
* collection files.
*
* @return Returns an array containing the names of all the files stored in
* the collection files.
*
*/
public String[] getFileNames() {
String[] fn = new String[this.files.size()];
int i = 0;
for (MediaFile mediaFile : this.files) {
fn[i] = mediaFile.getName();
i++;
}
return fn;
}
/**
* Returns the total duration (play time) of audio available in the database
*
* @return Returns the total duration (play time) of audio available in the
* database
*/
public int getDuration() {
int p = 0;
for (AudioFile audioFile : this.files) {
p += audioFile.getDuration();
}
return p;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2823 2010-01-16 00:06 ssd3\exam2\AudioDataba
文件 2238 2010-01-16 00:06 ssd3\exam2\AudioFile.java
文件 317 2010-01-16 00:06 ssd3\exam2\File.java
文件 549 2010-01-16 00:06 ssd3\exam2\MediaFile.java
文件 8877 2010-01-16 00:07 ssd3\exam3\StockDataba
文件 3284 2010-01-16 00:03 ssd3\exercise1\ShoppingCartApplication.java
文件 91530 2010-01-16 00:04 ssd3\exercise2\uml-gou-cof.jpg
文件 3349 2010-01-16 00:04 ssd3\exercise3\Coffee.java
文件 2417 2010-01-16 00:04 ssd3\exercise3\CoffeeBrewer.java
文件 1909 2010-01-16 00:04 ssd3\exercise3\OrderItem.java
文件 2237 2010-01-16 00:05 ssd3\exercise3\Product.java
文件 7504 2010-01-16 00:05 ssd3\exercise5\GourmetCoffee.java
文件 2053 2010-01-16 00:06 ssd3\exercise5\HTMLSalesFormatter.java
文件 1899 2010-01-16 00:06 ssd3\exercise5\PlainTextSalesFormatter.java
文件 410 2010-01-16 00:06 ssd3\exercise5\SalesFormatter.java
..A.SH. 4608 2010-01-15 23:55 ssd3\exercise5\Thumbs.db
文件 1824 2010-01-16 00:06 ssd3\exercise5\xm
文件 5549 2010-01-16 00:07 ssd3\exercise6\FileCatalogLoader.java
文件 5776 2010-01-16 00:07 ssd3\exercise6\GourmetCoffee.java
文件 5298 2010-01-16 00:07 ssd3\exercise7\CatalogGUI.java
文件 16021 2010-01-16 00:07 ssd3\exercise8\GourmetCoffeeGUI.java
目录 0 2010-01-16 00:02 ssd3\exam1
目录 0 2010-01-16 00:06 ssd3\exam2
目录 0 2010-01-16 00:07 ssd3\exam3
目录 0 2010-01-16 00:03 ssd3\exercise1
目录 0 2010-01-15 23:55 ssd3\exercise10
目录 0 2010-01-16 00:04 ssd3\exercise2
目录 0 2010-01-16 00:05 ssd3\exercise3
目录 0 2010-01-16 00:02 ssd3\exercise4
目录 0 2010-01-16 00:06 ssd3\exercise5
............此处省略8个文件信息
评论
共有 条评论