Class Record

java.lang.Object
  extended byRecord

public class Record
extends java.lang.Object

This class represents a data record of information about a language sound file. The record contains information such as the transcription of the words which are contained in the language sound file. This transcription could be in a 'native' alphabet or writing system as well as in other more widespread writing systems such as the latin alplhabet. The record will also contain, preferably, translations of the transcription into any number of languages. The record may also contain cognates or a set of cognate objects which will give information about words in other languages which are derived from this word, have a common ancestor as this word, or are the source of this word.

If the record does not contain some parts of this information it doesnt really matter, but the record should contain at the very least information to locate a sound resource on the internet.

This class is used by the DownloadManager class and also the SoundDownload class in order to go about the business of actually obtaining the sound resource. One design pattern idea would be to make this class implement and 'data record' interface which would consist just of one method, such as 'getDownloadableResourceIndicator' although that is a mouthful. The idea of this interface would be to allow the DownloadManager class to be able to work with different sorts of data records and different types of resources (not just sound resourced). The DownloadManager class should not really have to worry about what sort of resource it is trying to get. Its job is just to manage the getting process. One possible format for the data file in text format is

   =
   sound-url=http://www.somewhere.com/dir/sound.mp3
   ts=marhaba fi tanger
   tr=[en]welcome to tanger
   tr=[fr]bienvenue a tanger
   cognates=
   =
 


Constructor Summary
Record(java.lang.String dataString)
          Create a new Record object by parsing a string containing data.
 
Method Summary
 java.lang.String debug()
          provides a string which is informative about the internal state of the object
 java.lang.String getSoundUrl()
           
static void main(java.lang.String[] args)
          This method is just for testing.
 void parseDataString(java.lang.String sDataString)
          populate internal data fields by parsing a string containin information about a sound file and its language content.
 java.lang.String print()
           
 java.lang.String toString()
          overrides the default Object toString method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Record

public Record(java.lang.String dataString)
Create a new Record object by parsing a string containing data. Internally Translation and Transcription objects will be created by handing string segments to their constructors

Method Detail

parseDataString

public void parseDataString(java.lang.String sDataString)
populate internal data fields by parsing a string containin information about a sound file and its language content.

The implementation is sketchy for a few reason. It uses an old java class to split the string and it cant deal with strange new line characters. Also the StringTokenizer class may not work with an arabic character set. I think the solution to this is either to user regular expressions or write my own LineIterator class. This has the advantage of being able to use internationalization, via the Character class's static methods without using regular expressions. This avoidance of regular expressions may seem excessive and probably is.

Parameters:
sDataString - string to parse

getSoundUrl

public java.lang.String getSoundUrl()

print

public java.lang.String print()

toString

public java.lang.String toString()
overrides the default Object toString method


debug

public java.lang.String debug()
provides a string which is informative about the internal state of the object


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This method is just for testing. It could well be in a class by itself to avoid clutter.

Throws:
java.lang.Exception


Hosted by www.Geocities.ws

1