org.encog.app.analyst.util
Class CSVHeaders

java.lang.Object
  extended by org.encog.app.analyst.util.CSVHeaders

public class CSVHeaders
extends Object

Utility class to help deal with CSV headers.


Constructor Summary
CSVHeaders(File filename, boolean headers, CSVFormat format)
          Construct the object.
CSVHeaders(List<String> inputHeadings)
          Construct the object.
CSVHeaders(String[] inputHeadings)
          Construct the object.
 
Method Summary
 int find(String name)
          Find the specified column.
 String getBaseHeader(int index)
          Get the base header, strip any (...).
 String getHeader(int index)
          Get the specified header.
 List<String> getHeaders()
           
 int getSlice(int currentIndex)
          Get the timeslice for the specified index.
static int parseTimeSlice(String name)
          Parse a timeslice from a header such as (t-1).
 int size()
           
static String tagColumn(String name, int part, int timeSlice, boolean multiPart)
          Tag a column with part # and timeslice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVHeaders

public CSVHeaders(File filename,
                  boolean headers,
                  CSVFormat format)
Construct the object.

Parameters:
filename - The filename.
headers - False if headers are not extended.
format - The CSV format.

CSVHeaders

public CSVHeaders(List<String> inputHeadings)
Construct the object.

Parameters:
inputHeadings - The input headings.

CSVHeaders

public CSVHeaders(String[] inputHeadings)
Construct the object.

Parameters:
inputHeadings - The input headings.
Method Detail

parseTimeSlice

public static int parseTimeSlice(String name)
Parse a timeslice from a header such as (t-1).

Parameters:
name - The column name.
Returns:
The timeslice.

tagColumn

public static String tagColumn(String name,
                               int part,
                               int timeSlice,
                               boolean multiPart)
Tag a column with part # and timeslice.

Parameters:
name - The name of the column.
part - The part #.
timeSlice - The timeslice.
multiPart - True if this is a multipart column.
Returns:
The new tagged column.

find

public int find(String name)
Find the specified column.

Parameters:
name - The column name.
Returns:
The index of the column.

getBaseHeader

public String getBaseHeader(int index)
Get the base header, strip any (...).

Parameters:
index - The index of the header.
Returns:
The base header.

getHeader

public String getHeader(int index)
Get the specified header.

Parameters:
index - The index of the header to get.
Returns:
The header value.

getHeaders

public List<String> getHeaders()
Returns:
The headers.

getSlice

public int getSlice(int currentIndex)
Get the timeslice for the specified index.

Parameters:
currentIndex - The index to get the time slice for.
Returns:
The timeslice.

size

public int size()
Returns:
The number of headers.


Copyright © 2014. All Rights Reserved.