C# Class Azavea.NijPredictivePolicing.Common.Data.FixedWidthField

Represents a column, and contains data about where that column is located in a row and what type of data it contains. This class contains some error checking, but it can be used in some very weird ways (for example, it doesn't care if columns overlap with each other). In general, it's your responsibility to use it sensibly.
Mostrar archivo Open project: azavea/acs-alchemist Class Usage Examples

Public Properties

Property Type Description
ColumnName string
DefaultValue object
Description string
End int
Seeker FixedWidthPositions
Start int
Strict bool
Terminator FixedWidthTerminators
Type FixedWidthTypes

Public Methods

Method Description
FixedWidthField ( ) : System
FixedWidthField ( FixedWidthField old ) : System
FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator ) : System
FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator, object defaultValue, bool strict ) : System
FixedWidthField ( string columnName, string description, int length, int start ) : System
FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type ) : System
FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type, FixedWidthTerminators term ) : System
GetFieldData ( string row, int &currentPos ) : string

Gets the raw data for this field from a row and updates the current position. Does not do any parsing. Throws errors if Strict is false.

GetFieldObject ( string row, int &currentPos ) : object

Gets the parsed object for this field from a row and updates the current position, as determined by Type.

Private Methods

Method Description
GetFieldRange ( string row, int currentPos, int &start, int &end ) : void

Method Details

FixedWidthField() public method

public FixedWidthField ( ) : System
return System

FixedWidthField() public method

public FixedWidthField ( FixedWidthField old ) : System
old FixedWidthField
return System

FixedWidthField() public method

public FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator ) : System
start int
end int
type FixedWidthTypes
seeker FixedWidthPositions
terminator FixedWidthTerminators
return System

FixedWidthField() public method

public FixedWidthField ( int start, int end, FixedWidthTypes type, FixedWidthPositions seeker, FixedWidthTerminators terminator, object defaultValue, bool strict ) : System
start int
end int
type FixedWidthTypes
seeker FixedWidthPositions
terminator FixedWidthTerminators
defaultValue object
strict bool
return System

FixedWidthField() public method

public FixedWidthField ( string columnName, string description, int length, int start ) : System
columnName string
description string
length int
start int
return System

FixedWidthField() public method

public FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type ) : System
columnName string
description string
length int
start int
type FixedWidthTypes
return System

FixedWidthField() public method

public FixedWidthField ( string columnName, string description, int length, int start, FixedWidthTypes type, FixedWidthTerminators term ) : System
columnName string
description string
length int
start int
type FixedWidthTypes
term FixedWidthTerminators
return System

GetFieldData() public method

Gets the raw data for this field from a row and updates the current position. Does not do any parsing. Throws errors if Strict is false.
public GetFieldData ( string row, int &currentPos ) : string
row string The row to read from
currentPos int The current position in the row
return string

GetFieldObject() public method

Gets the parsed object for this field from a row and updates the current position, as determined by Type.
public GetFieldObject ( string row, int &currentPos ) : object
row string The row to read from
currentPos int The current position in the row
return object

Property Details

ColumnName public_oe property

public string ColumnName
return string

DefaultValue public_oe property

If we fail to retrieve a value for this field, what should we use instead? Note this isn't checked against Type, so if you set this to one type and Type to something else, it's your fault when you get type errors.
public object DefaultValue
return object

Description public_oe property

public string Description
return string

End public_oe property

Determines where the record ends
public int End
return int

Seeker public_oe property

Determines how we interpret Start
public FixedWidthPositions Seeker
return FixedWidthPositions

Start public_oe property

Determines where the record starts
public int Start
return int

Strict public_oe property

If true, throws exceptions on error. If false, silently uses DefaultValue and continues.
public bool Strict
return bool

Terminator public_oe property

Determines how we interpret End
public FixedWidthTerminators Terminator
return FixedWidthTerminators

Type public_oe property

What type is this field?
public FixedWidthTypes Type
return FixedWidthTypes