com.ibm.dse.tools.workbench.tbg
Class TbgTagParser

java.lang.Object
  |
  +--com.ibm.dse.tools.workbench.tbg.TbgTagParser

public class TbgTagParser
extends java.lang.Object
implements TbgNames

This class implements a String parser used by the TBG application.


Fields inherited from interface com.ibm.dse.tools.workbench.tbg.TbgNames
ATTRIB_LAST, ATTRIB_SEP, ATTRIBUTE, END_SIMPLE_TAG, END_TAG, INI_FINAL_TAG, INI_TAG, LITERAL, LITERAL_LAST1, LITERAL_LAST2, LITERAL_LAST3, LITERAL_SEP1, LITERAL_SEP2, LITERAL_SEP3
 
Constructor Summary
TbgTagParser()
          This constructor creates a TbgParser object.
 
Method Summary
static boolean contains(java.lang.String line, java.lang.String word)
          Checks if the specified word is part of the specified line.
static java.lang.String getAttribute(java.lang.String params, java.lang.String attribute)
          Returns the value of the required attribute if it exists.
static java.lang.String getDate()
          Returns the actual date.
static java.lang.String getLiteral(java.lang.String text)
          If the text is a literal returns its the value.
static java.lang.String getTab(java.lang.String line)
          Returns the initial blanks from a String.
static java.lang.String getVariable(java.lang.String text)
          Parses the structure name1.name2.name3 getting name1.
static java.lang.String getVariableOut(java.lang.String text)
          Parses the structure name1.name2.name3 taking out name1.
static java.lang.String isAttribute(java.lang.String text)
          If the specified text represents an attribute, returns the attribute name, otherwise returns the null.
static boolean isFile(java.lang.String url)
          Evaluates if the specified url is a file.
static boolean isURL(java.lang.String url)
          Evaluates if the specified url is a valid URL.
static java.lang.String parseFirst(java.lang.String tag)
          Parses the structure name1.name2.name3 getting name1.
static java.lang.String parseFirstOut(java.lang.String tag)
          Parses the structure name1.name2.name3 taking out name1 and returns name2.name3.
static java.lang.String parseLast(java.lang.String tag)
          Parses the structure name1.name2.name3 getting name3.
static java.lang.String parseLastOut(java.lang.String text)
          Parses the structure name1.name2.name3 taking out name3 and returns name1.name2 .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TbgTagParser

public TbgTagParser()
This constructor creates a TbgParser object.
Method Detail

contains

public static boolean contains(java.lang.String line,
                               java.lang.String word)
Checks if the specified word is part of the specified line.
Parameters:
line - java.lang.String The line.
word - java.lang.String The tag.
Returns:
boolean

getAttribute

public static java.lang.String getAttribute(java.lang.String params,
                                            java.lang.String attribute)
Returns the value of the required attribute if it exists. Otherwise, returns null.
Parameters:
params - java.lang.String The line to look into.
attribute - java.lang.String The attribute to look for.
Returns:
java.lang.String The attribute value.

getDate

public static java.lang.String getDate()
Returns the actual date.
Returns:
java.lang.String

getLiteral

public static java.lang.String getLiteral(java.lang.String text)
If the text is a literal returns its the value. Otherwise returns the whole text.

The literal form can be:

  • literal(literal_text)
  • literal[literal_text]
  • literal{literal_text}
    Parameters:
    text - java.lang.String The text to compare.
    Returns:
    java.lang.String

  • getTab

    public static java.lang.String getTab(java.lang.String line)
    Returns the initial blanks from a String.
    Parameters:
    line - java.lang.String
    Returns:
    java.lang.String

    getVariable

    public static java.lang.String getVariable(java.lang.String text)
    Parses the structure name1.name2.name3 getting name1.

    If the structure doesn't follow this structure returns null.

    Parameters:
    text - java.lang.String String to parse.
    Returns:
    java.lang.String

    getVariableOut

    public static java.lang.String getVariableOut(java.lang.String text)
    Parses the structure name1.name2.name3 taking out name1.

    If the structure doesn't follow this structure returns null.

    Parameters:
    text - java.lang.String String to parse.
    Returns:
    java.lang.String

    isAttribute

    public static java.lang.String isAttribute(java.lang.String text)
    If the specified text represents an attribute, returns the attribute name, otherwise returns the null.
    Parameters:
    text - java.lang.String The text to examine.
    Returns:
    java.lang.String The attribute name.

    isFile

    public static boolean isFile(java.lang.String url)
    Evaluates if the specified url is a file.
    Parameters:
    url - java.lang.String The url to evaluate.
    Returns:
    boolean Returns true if the specified url is a file, false elsewhere.

    isURL

    public static boolean isURL(java.lang.String url)
    Evaluates if the specified url is a valid URL.
    Parameters:
    url - java.lang.String The url to evaluate.
    Returns:
    boolean Returns true if the specified url is a valid URL, false elsewhere.

    parseFirst

    public static java.lang.String parseFirst(java.lang.String tag)
    Parses the structure name1.name2.name3 getting name1.

    If the structure doesn't follow this structure returns null.

    Parameters:
    tag - java.lang.String String to parse.
    Returns:
    java.lang.String

    parseFirstOut

    public static java.lang.String parseFirstOut(java.lang.String tag)
    Parses the structure name1.name2.name3 taking out name1 and returns name2.name3.

    If the structure doesn't follow this structure returns the text.

    Parameters:
    tag - java.lang.String String to parse.
    Returns:
    java.lang.String

    parseLast

    public static java.lang.String parseLast(java.lang.String tag)
    Parses the structure name1.name2.name3 getting name3.

    If the structure doesn't follow this structure returns null.

    Parameters:
    tag - java.lang.String String to parse.
    Returns:
    java.lang.String

    parseLastOut

    public static java.lang.String parseLastOut(java.lang.String text)
    Parses the structure name1.name2.name3 taking out name3 and returns name1.name2 .

    If the structure doesn't follow this structure returns the whole text.

    Parameters:
    text - java.lang.String String to parse.
    Returns:
    java.lang.String