Package net.oijon.utils.parser.data
Class Language
- java.lang.Object
-
- net.oijon.utils.parser.data.Language
-
public class Language extends java.lang.ObjectBundles all parts of a language together into one object- Author:
- alex
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)voidgenerateID()java.lang.StringgetAutonym()Gets the autonym of a languagejava.util.DategetCreated()Gets the datetime when the language was created.java.util.DategetEdited()Gets the last edit date of a language.java.lang.StringgetID()static java.io.File[]getLanguageFiles()Deprecated.as of v1.1.2, as this was Oijon Susquehanna-specific.static java.io.File[]getLanguageFiles(java.io.File f)Gets a list of all .language files in a specified directory.LexicongetLexicon()Gets a lexicon of a languagejava.lang.StringgetName()Gets the name of a Language objectOrthographygetOrtho()Gets an orthography of a languageLanguagegetParent()Gets the parent language of a language (for example, the parent language of a dialect) This method used to be deprecated, however no longer is.java.lang.StringgetParentName()Gets the name of the parent language.PhonologygetPhono()Gets a phonology of a languagejava.lang.StringgetVersion()Gets the version that the language was last edited in.booleanisReadOnly()Checks if the language is flagged as read-onlyvoidsetAutonym(java.lang.String autonym)Sets an autonym for a languagevoidsetCreated(java.util.Date date)Sets the creation date for a Language.voidsetEdited(java.util.Date date)Sets the last edit date of a language.voidsetID(java.lang.String id)voidsetLexicon(Lexicon lexicon)Sets a new lexicon for a languagevoidsetOrtho(Orthography ortho)voidsetParent(java.lang.String parentName, java.io.File dir)Sets a parent language of a languagevoidsetParent(Language parent)Deprecated.as of v1.1.2, as this just straight up does not work currently.voidsetPhono(Phonology phono)Sets a new phonology for a languagevoidsetReadOnly(boolean bool)Sets the read-only status of a language Please note! This only makes it so that Utils will not edit it, however that cannot be said for the file itself.voidsetVersion(java.lang.String version)Sets the version that the language was last edited in.voidtoFile(java.io.File file)Writes a language to a filejava.lang.StringtoString()Converts a language into a string
-
-
-
Field Detail
-
NULL
public static final Language NULL
-
-
Constructor Detail
-
Language
public Language(java.lang.String name)
Creates a Language object- Parameters:
name- The name of the language
-
Language
public Language(Language l)
Copy constructor- Parameters:
l- The language to copy
-
-
Method Detail
-
getLanguageFiles
@Deprecated public static java.io.File[] getLanguageFiles()
Deprecated.as of v1.1.2, as this was Oijon Susquehanna-specific. Please usegetLanguageFiles(File)instead.Gets all the .language files in the Susquehanna directory- Returns:
- A list of .language files
-
getLanguageFiles
public static java.io.File[] getLanguageFiles(java.io.File f)
Gets a list of all .language files in a specified directory. Does not currently support looking into subdirectories.- Parameters:
f- The directory to look in- Returns:
- A list of all .language files in a specified directory.
-
getName
public java.lang.String getName()
Gets the name of a Language object- Returns:
- The name of the language
-
getAutonym
public java.lang.String getAutonym()
Gets the autonym of a language- Returns:
- The autonym of the language
-
setAutonym
public void setAutonym(java.lang.String autonym)
Sets an autonym for a language- Parameters:
autonym- The autonym to be set
-
getPhono
public Phonology getPhono()
Gets a phonology of a language- Returns:
- a Phonology object of the language
-
setPhono
public void setPhono(Phonology phono)
Sets a new phonology for a language- Parameters:
phono- The Phonology object to be set
-
getOrtho
public Orthography getOrtho()
Gets an orthography of a language- Returns:
- an Orthography object of the language
-
setOrtho
public void setOrtho(Orthography ortho)
-
getLexicon
public Lexicon getLexicon()
Gets a lexicon of a language- Returns:
- a Lexicon object of the language
-
setLexicon
public void setLexicon(Lexicon lexicon)
Sets a new lexicon for a language- Parameters:
lexicon- The Lexicon object to be set
-
getParent
public Language getParent()
Gets the parent language of a language (for example, the parent language of a dialect) This method used to be deprecated, however no longer is.- Returns:
- a Language object representing the parent language
-
getParentName
public java.lang.String getParentName()
Gets the name of the parent language. Please note that this will most likely return null.- Returns:
- The name of the parent language
-
setParent
public void setParent(Language parent)
Deprecated.as of v1.1.2, as this just straight up does not work currently. The way this is currently set, an *entire language* would be stored for each parent. If we, say, stored English like this, we would have language files going all the way back to Proto-Indo-European, which would be a disaster file-size and memory wise. Please usesetParent(String, File)instead.Sets a parent language of a language- Parameters:
parent- The language to be the parent
-
setParent
public void setParent(java.lang.String parentName, java.io.File dir)Sets a parent language of a language- Parameters:
parentName- The name of the parent language.dir- The directory that the language is in.
-
getCreated
public java.util.Date getCreated()
Gets the datetime when the language was created.- Returns:
- The datetime when the language was created.
-
setCreated
public void setCreated(java.util.Date date)
Sets the creation date for a Language. Should only be used for reading in files, should not be used for writing to files.- Parameters:
date- The datetime when the language was created.
-
getEdited
public java.util.Date getEdited()
Gets the last edit date of a language.- Returns:
- The datetime when the language was last edited.
-
setEdited
public void setEdited(java.util.Date date)
Sets the last edit date of a language. Should be used when changing anything about a language.- Parameters:
date- The datetime (preferably the exact time the method was called) that the language was last edited.
-
isReadOnly
public boolean isReadOnly()
Checks if the language is flagged as read-only- Returns:
- true if read-only, false otherwise.
-
setReadOnly
public void setReadOnly(boolean bool)
Sets the read-only status of a language Please note! This only makes it so that Utils will not edit it, however that cannot be said for the file itself.- Parameters:
bool- The read-only status desired
-
getVersion
public java.lang.String getVersion()
Gets the version that the language was last edited in.- Returns:
- The version the language was last edited in.
-
setVersion
public void setVersion(java.lang.String version)
Sets the version that the language was last edited in. Should be called after every edit.- Parameters:
version- The version the language was last edited in.
-
getID
public java.lang.String getID()
-
setID
public void setID(java.lang.String id)
-
toFile
public void toFile(java.io.File file) throws java.io.IOExceptionWrites a language to a file- Parameters:
file- The file to write to- Throws:
java.io.IOException- Should never be thrown, however would not compile without it. If thrown, something has gone horribly wrong...
-
generateID
public void generateID()
-
toString
public java.lang.String toString()
Converts a language into a string- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-