Class Language


  • public class Language
    extends java.lang.Object
    Bundles all parts of a language together into one object
    Author:
    alex
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Language NULL  
    • Constructor Summary

      Constructors 
      Constructor Description
      Language​(java.lang.String name)
      Creates a Language object
      Language​(Language l)
      Copy constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      void generateID()  
      java.lang.String getAutonym()
      Gets the autonym of a language
      java.util.Date getCreated()
      Gets the datetime when the language was created.
      java.util.Date getEdited()
      Gets the last edit date of a language.
      java.lang.String getID()  
      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.
      Lexicon getLexicon()
      Gets a lexicon of a language
      java.lang.String getName()
      Gets the name of a Language object
      Orthography getOrtho()
      Gets an orthography of a language
      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.
      java.lang.String getParentName()
      Gets the name of the parent language.
      Phonology getPhono()
      Gets a phonology of a language
      java.lang.String getVersion()
      Gets the version that the language was last edited in.
      boolean isReadOnly()
      Checks if the language is flagged as read-only
      void setAutonym​(java.lang.String autonym)
      Sets an autonym for a language
      void setCreated​(java.util.Date date)
      Sets the creation date for a Language.
      void setEdited​(java.util.Date date)
      Sets the last edit date of a language.
      void setID​(java.lang.String id)  
      void setLexicon​(Lexicon lexicon)
      Sets a new lexicon for a language
      void setOrtho​(Orthography ortho)  
      void setParent​(java.lang.String parentName, java.io.File dir)
      Sets a parent language of a language
      void setParent​(Language parent)
      Deprecated.
      as of v1.1.2, as this just straight up does not work currently.
      void setPhono​(Phonology phono)
      Sets a new phonology for a language
      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.
      void setVersion​(java.lang.String version)
      Sets the version that the language was last edited in.
      void toFile​(java.io.File file)
      Writes a language to a file
      java.lang.String toString()
      Converts a language into a string
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 use getLanguageFiles(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 use setParent(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.IOException
        Writes 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:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object