VTT Java
2010 Version

gov.nih.nlm.nls.vtt.Model
Class Tags

java.lang.Object
  extended by gov.nih.nlm.nls.vtt.Model.Tags

public class Tags
extends java.lang.Object

This is the collection of Tag Java objects class. It is used directly in VTT.

History:

Version:
V-2010
Author:
NLM NLS Development Team, clu

Constructor Summary
Tags()
          Create a tags list Java object with default values.
Tags(java.lang.String inFile)
          Create a tags list Java object from a input file.
Tags(Tags tags)
          Create a tags list Java object by specifying tags.
 
Method Summary
 void AddTag(Tag tag)
          Add a tag to tags list.
 boolean ContainsNameCategory(java.lang.String nameCategory)
          Check if category list contains the specified name category.
static boolean ContainsTextTag(java.util.Vector<Tag> tags)
          Check if specified tags contain text tag, "Text/Clear".
 void DeleteTag(int index)
          Delete a tag from tags list.
 java.util.Vector<TagFilter> GetCategoryList()
          Get category list from tags list.
 int GetIndexByTag(java.lang.String nameCategory)
          Get the index of tags list by the specifying name category
 java.util.Vector<java.lang.String> GetNameCategoryList()
          Get name category list from tags list.
 java.util.Vector<TagFilter> GetNameList()
          Get name list from tags list.
 int GetQuickKeyMappingIndex(int index)
          Get the index of tags at the specified quick key index (0 ~ 9)
 java.util.Vector<java.lang.String> GetQuickKeyMappings()
          Get quick key mapping of tags.
 Tag GetTagAt(int index)
          Get the tag from tags list by specifying the index
 Tag GetTagByIndex(int index)
          Get tag by the specified index
 Tag GetTagByNameCategory(java.lang.String nameCategory)
          Get tag by specifying name and category
 java.util.Vector<java.lang.String> GetTagNames()
          Get names of tags in a format of Vector of String
 java.util.Vector<Tag> GetTags()
          Get the tags list
 boolean IsDisplayAfterFilter(Tag tag)
          Get the boolean flag of display after filter.
 void LoadTagsFromFile(java.lang.String inFile)
          Load tags from a file
 void MoveDown(int index)
          Move down a specified indexed tag on the tags list.
 void MoveUp(int index)
          Move up a speficied indexed tag on the tags list.
static Tag ReadTagFromLine(java.lang.String line)
          Read a tag information from a line with verbose options of both gui and stnadard system io.
static Tag ReadTagFromLine(java.lang.String line, int verboseType)
          Read a tag information from a line with specifying verbose option.
static void SaveTagsToFile(java.lang.String outFile, java.util.Vector<Tag> tags)
          Save tags to a specified file.
 void SetCategoryList(java.util.Vector<TagFilter> categoryList)
          Set category list.
 void SetNameList(java.util.Vector<TagFilter> nameList)
          Set name list.
 void SetQucikKeyMappingAt(java.lang.String tagNameCategory, int index)
          Set quick key mapping of tags with specified name category at the specified index.
 void SetQuickKeyMappings(java.util.Vector<java.lang.String> quickKeyMappings)
          Set quick key mapping of tags.
 void SetQuickKeyMappingsToDefault()
          Set quick key mapping to default (same order as the order of tags list).
 void SetTagAt(int index, Tag tag, boolean updateFlag)
          Set the tag at the specified position with specifying tag and update flag.
 void SortTags()
          Sort Tags by name|category.
static java.lang.String ToString(java.util.Vector<Tag> tags)
          Convert tags to string representation of VTT format: header + tags
static java.lang.String ToString(java.util.Vector<Tag> tags, boolean headerFlag)
          Convert tags to string representation of VTT format: header + tags
static void WriteTagsToFile(java.io.BufferedWriter out, java.util.Vector<Tag> tags)
          Write tags to a buffered writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tags

public Tags()
Create a tags list Java object with default values.


Tags

public Tags(Tags tags)
Create a tags list Java object by specifying tags.

Parameters:
tags - the tags to be instantiated for this tags list

Tags

public Tags(java.lang.String inFile)
Create a tags list Java object from a input file.

Parameters:
inFile - the input file with data of tags
Method Detail

GetTags

public java.util.Vector<Tag> GetTags()
Get the tags list

Returns:
the tags list

GetTagAt

public Tag GetTagAt(int index)
Get the tag from tags list by specifying the index

Parameters:
index - the position of interest
Returns:
the tag at the specified index

SetTagAt

public void SetTagAt(int index,
                     Tag tag,
                     boolean updateFlag)
Set the tag at the specified position with specifying tag and update flag.

Parameters:
index - the position of interest
tag - tag to be set
updateFlag - a boolean flag of update

GetTagNames

public java.util.Vector<java.lang.String> GetTagNames()
Get names of tags in a format of Vector of String

Returns:
names of tags list

GetTagByNameCategory

public Tag GetTagByNameCategory(java.lang.String nameCategory)
Get tag by specifying name and category

Parameters:
nameCategory - the name and category string of interest
Returns:
tag of the specified name and category from tags list

GetTagByIndex

public Tag GetTagByIndex(int index)
Get tag by the specified index

Parameters:
index - the specified index of interest
Returns:
tag of the specified index from tags list

GetNameList

public java.util.Vector<TagFilter> GetNameList()
Get name list from tags list.

Returns:
name list from tags list.

GetCategoryList

public java.util.Vector<TagFilter> GetCategoryList()
Get category list from tags list.

Returns:
category list from tags list.

GetNameCategoryList

public java.util.Vector<java.lang.String> GetNameCategoryList()
Get name category list from tags list.

Returns:
name category list from tags list.

GetQuickKeyMappings

public java.util.Vector<java.lang.String> GetQuickKeyMappings()
Get quick key mapping of tags.

Returns:
quick key mapping of tags

SetQuickKeyMappings

public void SetQuickKeyMappings(java.util.Vector<java.lang.String> quickKeyMappings)
Set quick key mapping of tags.

Parameters:
quickKeyMappings - quick key mapping of tags

SetQucikKeyMappingAt

public void SetQucikKeyMappingAt(java.lang.String tagNameCategory,
                                 int index)
Set quick key mapping of tags with specified name category at the specified index.

Parameters:
tagNameCategory - name category of tag to be set on quick key
index - the specified index of quick key mapping

GetQuickKeyMappingIndex

public int GetQuickKeyMappingIndex(int index)
Get the index of tags at the specified quick key index (0 ~ 9)

Parameters:
index - the quick key index
Returns:
index of tags list for the specified quick key index

AddTag

public void AddTag(Tag tag)
Add a tag to tags list.

Parameters:
tag - the tag to be added

DeleteTag

public void DeleteTag(int index)
Delete a tag from tags list.

Parameters:
index - the index of tags list to be deleted

SortTags

public void SortTags()
Sort Tags by name|category.


GetIndexByTag

public int GetIndexByTag(java.lang.String nameCategory)
Get the index of tags list by the specifying name category

Parameters:
nameCategory - name and category of interest
Returns:
the index of tags list

MoveUp

public void MoveUp(int index)
Move up a speficied indexed tag on the tags list.

Parameters:
index - the index of tag to be moved up

MoveDown

public void MoveDown(int index)
Move down a specified indexed tag on the tags list.

Parameters:
index - the index of tag to be moved down

IsDisplayAfterFilter

public boolean IsDisplayAfterFilter(Tag tag)
Get the boolean flag of display after filter.

Parameters:
tag - the tag of interest
Returns:
a boolean flag of display after filter

ContainsNameCategory

public boolean ContainsNameCategory(java.lang.String nameCategory)
Check if category list contains the specified name category.

Parameters:
nameCategory - the name and category of interest
Returns:
true if contains the specified name and category and vise versa

SetQuickKeyMappingsToDefault

public void SetQuickKeyMappingsToDefault()
Set quick key mapping to default (same order as the order of tags list).


SaveTagsToFile

public static void SaveTagsToFile(java.lang.String outFile,
                                  java.util.Vector<Tag> tags)
Save tags to a specified file.

Parameters:
outFile - the output file to be saved
tags - the tags list to be saved

WriteTagsToFile

public static void WriteTagsToFile(java.io.BufferedWriter out,
                                   java.util.Vector<Tag> tags)
                            throws java.io.IOException
Write tags to a buffered writer.

Parameters:
out - buffered writer to be write to
tags - the tags list to be saved
Throws:
java.io.IOException

ToString

public static java.lang.String ToString(java.util.Vector<Tag> tags)
Convert tags to string representation of VTT format: header + tags

Parameters:
tags - the tags list of interest
Returns:
the string representation

ToString

public static java.lang.String ToString(java.util.Vector<Tag> tags,
                                        boolean headerFlag)
Convert tags to string representation of VTT format: header + tags

Parameters:
tags - the tags list of interest
headerFlag - the boolean flag of showing header
Returns:
the string representation

LoadTagsFromFile

public void LoadTagsFromFile(java.lang.String inFile)
Load tags from a file

Parameters:
inFile - the input file of tags

ReadTagFromLine

public static Tag ReadTagFromLine(java.lang.String line)
Read a tag information from a line with verbose options of both gui and stnadard system io.

Parameters:
line - a line represents a tag
Returns:
the tag of the line

ReadTagFromLine

public static Tag ReadTagFromLine(java.lang.String line,
                                  int verboseType)
Read a tag information from a line with specifying verbose option.

Parameters:
line - a line represents a tag
verboseType - verbose types: VERVOSE_GUI and VERBOSE_STD_IO
Returns:
the tag of the line

ContainsTextTag

public static boolean ContainsTextTag(java.util.Vector<Tag> tags)
Check if specified tags contain text tag, "Text/Clear".

Parameters:
tags - the tags list to be checked
Returns:
true if the specified tags list contains text tag

SetNameList

public void SetNameList(java.util.Vector<TagFilter> nameList)
Set name list.

Parameters:
nameList - the name list to be set

SetCategoryList

public void SetCategoryList(java.util.Vector<TagFilter> categoryList)
Set category list.

Parameters:
categoryList - the category list to be set

VTT Java
2010 Version

Submit a bug or feature

Copyright © 2010 National Library of Medicine