VTT Java
2010 Version

gov.nih.nlm.nls.vtt.Lib
Class StringStats

java.lang.Object
  extended by gov.nih.nlm.nls.vtt.Lib.StringStats

public class StringStats
extends java.lang.Object

This code is to calculate the stats for a String. It includes character count, word count, and line count.

History:

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

Constructor Summary
StringStats()
          The constructor of StringStats object.
StringStats(int charNum, int charNum2, int wordNum, int lineNum, java.util.Vector<java.lang.Integer> linePos)
          The constructor of StringStats object by specifying total number of characters, total number of characters with line feed, total number of words, total number of lines, and a vector of start position of each line
 
Method Summary
 int GetCharNum()
          Get the total number of characters without line feed
 int GetCharNum2()
          Get the total number of characters with line feed
static int GetLineEndPos(java.util.Vector<java.lang.Integer> linePos, int lineNo)
          Get the line end positions.
 int GetLineNum()
          Get the total number of lines
 java.util.Vector<java.lang.Integer> GetLinePos()
          Get the start position of each line
static int GetLineStartPos(java.util.Vector<java.lang.Integer> linePos, int lineNo)
          Get the line start positions.
static StringStats GetStringStats(java.lang.String inStr)
          Get the difference stats of an input string in string presentation
 int GetWordNum()
          Get the total number of words
 java.lang.String ToString()
          The string representation of the string difference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringStats

public StringStats()
The constructor of StringStats object.


StringStats

public StringStats(int charNum,
                   int charNum2,
                   int wordNum,
                   int lineNum,
                   java.util.Vector<java.lang.Integer> linePos)
The constructor of StringStats object by specifying total number of characters, total number of characters with line feed, total number of words, total number of lines, and a vector of start position of each line

Method Detail

GetCharNum

public int GetCharNum()
Get the total number of characters without line feed

Returns:
total number of characters without line feed

GetCharNum2

public int GetCharNum2()
Get the total number of characters with line feed

Returns:
total number of characters with line feed

GetWordNum

public int GetWordNum()
Get the total number of words

Returns:
total number of words

GetLineNum

public int GetLineNum()
Get the total number of lines

Returns:
total number of lines

GetLinePos

public java.util.Vector<java.lang.Integer> GetLinePos()
Get the start position of each line

Returns:
a vector of start position of each line

GetStringStats

public static StringStats GetStringStats(java.lang.String inStr)
Get the difference stats of an input string in string presentation

Parameters:
inStr - input string of difference
Returns:
the stats of string difference

GetLineStartPos

public static int GetLineStartPos(java.util.Vector<java.lang.Integer> linePos,
                                  int lineNo)
Get the line start positions.

Parameters:
linePos - the position of all lines
lineNo - the line no in interested
Returns:
the starting position of the specified line

GetLineEndPos

public static int GetLineEndPos(java.util.Vector<java.lang.Integer> linePos,
                                int lineNo)
Get the line end positions.

Parameters:
linePos - the position of all lines
lineNo - the line no in interested
Returns:
the end position of the specified line

ToString

public java.lang.String ToString()
The string representation of the string difference.

Returns:
string representation of the string difference

VTT Java
2010 Version

Submit a bug or feature

Copyright © 2010 National Library of Medicine