com.unitesk.atp.text.filters
Class PositionFilter

java.lang.Object
  extended by com.unitesk.atp.text.filters.Filter
      extended by com.unitesk.atp.text.filters.PositionFilter
All Implemented Interfaces:
TextReceiver

public class PositionFilter
extends Filter

Calculates line and position in output text. Line is counted from 1. Column is counted from 0.

Since:
3.3-beta-050628
Version:
$Id: PositionFilter.java,v 1.3 2005/07/06 10:24:06 all-x Exp $
Author:
Alexey Demakov

Field Summary
static boolean DEFAULT_FIXED_TAB_SIZE
           
static int DEFAULT_TAB_SIZE
           
protected  boolean fixedTabSize
           
protected  int tabSize
           
 
Fields inherited from class com.unitesk.atp.text.filters.Filter
client
 
Constructor Summary
PositionFilter(TextReceiver client)
           
PositionFilter(TextReceiver client, int tabSize, boolean fixedTabSize)
          Filter constructor.
 
Method Summary
 int getColumn()
           
 int getLine()
           
 Position getPosition()
           
static int lineLength(String s)
           
 void nl()
          The default implementation passes line separator to the client without any changes.
 void setColumn(int c)
           
 void setLine(int l)
           
 void setPosition(Position position)
           
 void txt(String s)
          The default implementation passes input string to the client without any changes.
static int updateColumn(int currentColumn, String s)
           
 
Methods inherited from class com.unitesk.atp.text.filters.Filter
getClient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TAB_SIZE

public static final int DEFAULT_TAB_SIZE
See Also:
Constant Field Values

DEFAULT_FIXED_TAB_SIZE

public static final boolean DEFAULT_FIXED_TAB_SIZE
See Also:
Constant Field Values

tabSize

protected int tabSize

fixedTabSize

protected boolean fixedTabSize
Constructor Detail

PositionFilter

public PositionFilter(TextReceiver client,
                      int tabSize,
                      boolean fixedTabSize)
Filter constructor.

Parameters:
client - Filter client.
tabSize - Tab size.
fixedTabSize - If true, tab char always increases column by tabSize. Otherwise column is increased to the next value divisible by tabSize.

PositionFilter

public PositionFilter(TextReceiver client)
Method Detail

getLine

public int getLine()

setLine

public void setLine(int l)

getColumn

public int getColumn()

setColumn

public void setColumn(int c)

getPosition

public Position getPosition()

setPosition

public void setPosition(Position position)

lineLength

public static int lineLength(String s)

updateColumn

public static int updateColumn(int currentColumn,
                               String s)

txt

public void txt(String s)
Description copied from class: Filter
The default implementation passes input string to the client without any changes.

Specified by:
txt in interface TextReceiver
Overrides:
txt in class Filter
Parameters:
s - The string to process.

nl

public void nl()
Description copied from class: Filter
The default implementation passes line separator to the client without any changes.

Specified by:
nl in interface TextReceiver
Overrides:
nl in class Filter


Copyright © 2001-2006 ISP RAS, RedVerst Group. All Rights Reserved.