se.biltmore.tools.fileeditor
Class Position

java.lang.Object
  extended by se.biltmore.tools.fileeditor.Position

public class Position
extends Object

This represents a position in a text file by line number and column. The origin is at 1,1 not 0,0! Trying to set a value less than 1 will set it to 1.


Constructor Summary
Position()
          Creates a new instance of Position.
Position(int column, int line)
          Creates a new instance of Position.
 
Method Summary
 void adjustLimits(int maxLines, int maxColumns)
          Adjusts the position to be withing limits.
 Position clone()
          Returns a clone of this Position.
 void decrementColumnm()
          Decrements the column.
 void decrementLine()
          Decrements the line number.
 int getColumn()
          Returns the current column number.
 int getLine()
          Returns the number of current line.
 void incrementColumn()
          Increments the column.
 void incrementLine()
          Increments the line number.
 void setColumn(int column)
          Sets the current column.
 void setColumn(int column, int maxColumn)
          Sets the current column.
 void setLine(int line)
          Sets the line of the position.
 void setLine(int line, int maxLine)
          Sets the line of the position.
 String toString()
          Returns a String representation of the position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Position

public Position()
Creates a new instance of Position.


Position

public Position(int column,
                int line)
Creates a new instance of Position.

Parameters:
line - The line this position points to.
column - The column this position points to.
Method Detail

adjustLimits

public void adjustLimits(int maxLines,
                         int maxColumns)
Adjusts the position to be withing limits.

Parameters:
maxLines -
maxColumns -

setLine

public void setLine(int line)
Sets the line of the position.

Parameters:
line - The line to set.

setLine

public void setLine(int line,
                    int maxLine)
Sets the line of the position.

Parameters:
line - The line to set.
maxLine - The maximul line that can be set.

getLine

public int getLine()
Returns the number of current line.


setColumn

public void setColumn(int column)
Sets the current column.

Parameters:
column - The colum to set.

setColumn

public void setColumn(int column,
                      int maxColumn)
Sets the current column.

Parameters:
column - The colum to set.
maxColumn - the max column that can be set.

getColumn

public int getColumn()
Returns the current column number.


incrementLine

public void incrementLine()
Increments the line number.


decrementLine

public void decrementLine()
Decrements the line number.


incrementColumn

public void incrementColumn()
Increments the column.


decrementColumnm

public void decrementColumnm()
Decrements the column.


clone

public Position clone()
Returns a clone of this Position.

Overrides:
clone in class Object

toString

public String toString()
Returns a String representation of the position.

Overrides:
toString in class Object


Copyright © 2009-2010 Biltmore Group AB. All Rights Reserved.