tauZaman
v0.1

tauzaman.io
Class FormatParser

java.lang.Object
  |
  +--tauzaman.io.FormatParser

public class FormatParser
extends java.lang.Object

FormatParser class tokenizes given Format content to its variables and non-variables. Variables are String sequences , which matches with regular expression, "$[a-zA-Z]+" . Non-variables are the String tokens that are left when variables are fetched.

  "$month $year $day" => "$month", " ", "$year", " ", "$day"
 

Status:
design complete, implementation complete

Field Summary
private  java.lang.String input
          String input that will be tokenized
private  java.util.regex.Matcher matcher
          Matcher class of java.util.regex, that will be used when finding variable patterns in input string
private  java.util.regex.Pattern pattern
          Pattern class of java.util.regex, that will be used when finding variable patterns in input string
private  java.lang.String varPattern
           
 
Constructor Summary
protected FormatParser(java.lang.String input)
          Constructs a FormatParser object, which is ready to parse given input.
 
Method Summary
protected  java.lang.String[] parseFormat(boolean variablesOnly)
          Returns tokens, which are resulted from parsing process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

private java.lang.String input
String input that will be tokenized


varPattern

private java.lang.String varPattern

pattern

private java.util.regex.Pattern pattern
Pattern class of java.util.regex, that will be used when finding variable patterns in input string


matcher

private java.util.regex.Matcher matcher
Matcher class of java.util.regex, that will be used when finding variable patterns in input string

Constructor Detail

FormatParser

protected FormatParser(java.lang.String input)
Constructs a FormatParser object, which is ready to parse given input.

Parameters:
input - String, which will be tokenized into its tokens
Method Detail

parseFormat

protected java.lang.String[] parseFormat(boolean variablesOnly)
Returns tokens, which are resulted from parsing process.

Parameters:
variablesOnly - a boolean variable, which determines if all tokens or just variable tokens will be returned
Returns:
array of String, which include resulted tokens

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project