|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectmyDataBases.MediaBase
public class MediaBase
Allows to retrieve the names of the media to sort as well as other characteristics specified in the media.xml file.
The media's names and other characteristics are stored in the '../data/media.xml' file. The aim of this class is to allow other parts of this program to access quickly and simply to these informations.
The structure of the media.xml file must be :
< content >< media >< id >identifier< /id >< name >the name of the file as used by crowdFlower< /name > < characteristic >a first characteristic< /characteristic >< othercharac >another characteristic< /othercharac > < /media > ... < /content >
IMPORTANT: Identifiers must go from zero to $number_of_media without any gap. For instance, [0,2,1,5,4,3] works (the order does not matter), but [0,1,1337,42,5] does NOT.
Field Summary | |
---|---|
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.String>> |
content
The list of the media contained in the file and their characteristics. |
Constructor Summary | |
---|---|
MediaBase(java.lang.String path)
Creates an instance of MediaBase and sets its attributes. |
Method Summary | |
---|---|
java.util.List<java.lang.Integer[]> |
getAllMedia()
Returns a List of all the identifier of the media considered. |
java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.String>> |
getContent()
Returns content, the map of map containing all the information available in the media.xml file. |
java.lang.String |
getMedia(java.lang.Integer id)
Returns the name of the media wanted. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.String>> content
Constructor Detail |
---|
public MediaBase(java.lang.String path)
Generates a hashMap containing all the media and their characteristics, content, by parsing the path xml file. All the information contained in this file will be in the content attribute (as long as it is correctly xml formatted).
path
- Path to the file containing the dataMethod Detail |
---|
public java.util.List<java.lang.Integer[]> getAllMedia()
Reads the content attribute and adds every < id > it founds in a list.
public java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.String>> getContent()
public java.lang.String getMedia(java.lang.Integer id)
id
- The identifier of the media wanted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |