tribble.io
Class CharDfl

java.lang.Object
  extended by tribble.io.CharDfl
All Implemented Interfaces:
CharI

public class CharDfl
extends java.lang.Object
implements CharI

Default generic source character.

This is a default implementation of a character class that is capable of representing a single character. Such a class can be used to hold a single text character read from a source file, containing information in addition to the character code itself such as the source line, column number, and filename from which the character was read.

Since:
2001-05-30
Version:
$Revision: 1.1 $ $Date: 2001/05/30 16:27:08 $
Author:
David R. Tribble, david@tribble.com.
Copyright 2001 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.
See Also:
CharInputStreamI

Field Summary
protected  int m_char
          Character code.
protected  int m_colNo
          Source column number.
protected  java.lang.String m_fName
          Source filename.
protected  int m_lineNo
          Source line number.
(package private) static java.lang.String REV
          Revision information.
 
Constructor Summary
CharDfl()
          Constructor.
CharDfl(char ch)
          Constructor.
 
Method Summary
 char getChar()
          Retrieves the character code of this character.
 int getColNo()
          Retrieves the source column number of this character.
 java.lang.String getFileName()
          Retrieves the source filename of this character.
 int getLineNo()
          Retrieves the source line number of this character.
 void setChar(char ch)
          Establishes the character code of this character.
 void setFileName(java.lang.String fname)
          Establishes the source filename of this character.
 void setLineNo(int ln, int col)
          Establishes the source line number and column number of this character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

m_char

protected int m_char
Character code.


m_lineNo

protected int m_lineNo
Source line number.


m_colNo

protected int m_colNo
Source column number.


m_fName

protected java.lang.String m_fName
Source filename.

Constructor Detail

CharDfl

public CharDfl()
Constructor.

Since:
1.1, 2001-05-30

CharDfl

public CharDfl(char ch)
Constructor. Establishes the character code of this character.

Parameters:
ch - The character code for this character.
Since:
1.1, 2001-05-30
Method Detail

setChar

public void setChar(char ch)
Establishes the character code of this character.

Specified by:
setChar in interface CharI
Parameters:
ch - The character code for this character.
Since:
1.1, 2001-05-30

getChar

public char getChar()
Retrieves the character code of this character.

Specified by:
getChar in interface CharI
Returns:
The character code for this character.
Since:
1.1, 2001-05-30

setLineNo

public void setLineNo(int ln,
                      int col)
Establishes the source line number and column number of this character.

Specified by:
setLineNo in interface CharI
Parameters:
ln - The source line number for this character.
col - The source column number for this token.
Since:
1.1, 2001-05-30

getLineNo

public int getLineNo()
Retrieves the source line number of this character.

Specified by:
getLineNo in interface CharI
Returns:
The source line number for this character.
Since:
1.1, 2001-05-30

getColNo

public int getColNo()
Retrieves the source column number of this character.

Specified by:
getColNo in interface CharI
Returns:
The source column number for this character.
Since:
1.1, 2001-05-30

setFileName

public void setFileName(java.lang.String fname)
Establishes the source filename of this character.

Specified by:
setFileName in interface CharI
Parameters:
fname - The source filename for this character.
Since:
1.1, 2001-05-30

getFileName

public java.lang.String getFileName()
Retrieves the source filename of this character.

Specified by:
getFileName in interface CharI
Returns:
The source filename for this character.
Since:
1.1, 2001-05-30