LiveGraph
data visualisation and analysis framework

org.LiveGraph.dataFile.read
Class DataLineTokenizer

java.lang.Object
  extended by org.LiveGraph.dataFile.read.DataLineTokenizer
All Implemented Interfaces:
java.lang.Iterable<java.lang.String>

public class DataLineTokenizer
extends java.lang.Object
implements java.lang.Iterable<java.lang.String>

This tokeniser can split a string into tokens using a separator which is a string itself. (Note that the standard tokeniser java.util.StringTokenizer only supports single characters as separators.) This tokeniser supports empty tokens.

This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)
Copyright (c) 2007 G. Paperin.
All rights reserved.

File: DataLineTokenizer.java

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)

4. All advertising materials distributed in form of HTML pages or any other technology permitting active hyper-links that mention features or use of this software or any derived software must display the acknowledgment specified in condition 3 of this agreement, and in addition, include a visible and working hyper-link to the LiveGraph homepage (http://www.live-graph.org).

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"1.1.1"
Author:
Greg Paperin (http://www.paperin.org)

Field Summary
private  java.util.List<java.lang.String> tokens
          Internal buffer for the tokens.
 
Constructor Summary
DataLineTokenizer(java.lang.String line, java.lang.String separator)
          Creates a new tokeniser on the specified string using the specified separator.
 
Method Summary
 java.util.List<java.lang.String> getTokens()
          Provides this tokeniser's tokens as an unmodifiable list.
 com.softnetConsult.utils.collections.ReadOnlyIterator<java.lang.String> iterator()
          Provides a read-only iteration over the tokens of this tokeniser.
private  void parseLine(java.lang.String line, java.lang.String sep)
          Internal routine used for parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

private java.util.List<java.lang.String> tokens
Internal buffer for the tokens.

Constructor Detail

DataLineTokenizer

public DataLineTokenizer(java.lang.String line,
                         java.lang.String separator)
Creates a new tokeniser on the specified string using the specified separator.

Parameters:
line - The string to tokenise.
separator - The separator to use.
Method Detail

parseLine

private void parseLine(java.lang.String line,
                       java.lang.String sep)
Internal routine used for parsing.

Parameters:
line - The string to tokenise.
sep - The separator to use.

iterator

public com.softnetConsult.utils.collections.ReadOnlyIterator<java.lang.String> iterator()
Provides a read-only iteration over the tokens of this tokeniser.

Specified by:
iterator in interface java.lang.Iterable<java.lang.String>
Returns:
A read-only iterator over the tokens of this tokeniser

getTokens

public java.util.List<java.lang.String> getTokens()
Provides this tokeniser's tokens as an unmodifiable list.

Returns:
A read-only list of this tokeniser's tokens.

LiveGraph
data visualisation and analysis framework