com.imaginary.meme
Class Meme

java.lang.Object
  |
  +--com.imaginary.meme.Meme

public class Meme
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A representation of a single concept that has many translations. It is generally something as simple as a word, like "red". It can, however, represent more complex memes like "a barrel full of monkeys" or even full sentences or paragraphs. An example of the use of this class is: Meme meme = getSomeMeme(); System.out.println(meme.getTranslation(Locale.getDefault));
Last modified $Date: 1999/11/06 19:50:47 $

See Also:
Serialized Form

Constructor Summary
Meme()
          Constructs an empty meme object.
Meme(java.lang.String k)
          Constructs a meme object having the specified key.
Meme(java.lang.String k, java.lang.String def)
          Constructs a meme object having the specified key and default translation.
 
Method Summary
 void addTranslation(java.util.Locale l, java.lang.String ph)
          Adds a translation for this meme for the specified Locale.
 java.lang.String getDefaultTranslation()
          The default translation is the translation for this ph that is provided whenever a translation is requested for an unsupported Locale.
 java.lang.String getKey()
          The ph key is an identifier that can be used to uniquely identify this ph.
 java.lang.String getTranslation(java.util.Locale loc)
          Provides a translation of this Meme for the specified Locale.
 void setDefaultTranslation(java.lang.String trans)
          Sets the default translation.
 void setKey(java.lang.String key)
          Sets the meme key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Meme

public Meme()
Constructs an empty meme object.

Meme

public Meme(java.lang.String k)
Constructs a meme object having the specified key.
Parameters:
the - value to use as the meme key

Meme

public Meme(java.lang.String k,
            java.lang.String def)
Constructs a meme object having the specified key and default translation.
Parameters:
k - the meme key
def - the default translation
Method Detail

addTranslation

public void addTranslation(java.util.Locale l,
                           java.lang.String ph)
Adds a translation for this meme for the specified Locale.
Parameters:
l - the Locale for which you wish to add a translation
meme - the translated meme

getDefaultTranslation

public java.lang.String getDefaultTranslation()
The default translation is the translation for this ph that is provided whenever a translation is requested for an unsupported Locale.
Returns:
the default translation

getKey

public java.lang.String getKey()
The ph key is an identifier that can be used to uniquely identify this ph. For example, "RED" might be a good ph key for the color red.
Returns:
the ph key

getTranslation

public java.lang.String getTranslation(java.util.Locale loc)
Provides a translation of this Meme for the specified Locale.
Parameters:
loc - the Locale for which a translation is desired
Returns:
the translated meme

setDefaultTranslation

public void setDefaultTranslation(java.lang.String trans)
Sets the default translation.
Parameters:
trans - the default translation

setKey

public void setKey(java.lang.String key)
Sets the meme key.
Parameters:
key - the meme key