FileDocCategorySizeDatePackage
Tabs.javaAPI DocExample1477Fri Feb 27 20:48:16 GMT 2004None

Tabs

public class Tabs extends Object
Basic tab-character handling stuff.

N.B. Can only handle equally-spaced tab stops as written.

author
Ian F. Darwin, http://www.darwinsys.com/
version
$Id: Tabs.java,v 1.9 2004/02/28 02:48:15 ian Exp $

Fields Summary
public static final int
DEFTABSPACE
tabs every so often
protected int
tabSpace
the current tab stop setting.
public static final int
MAXLINE
The longest line that we initially set tabs for.
protected boolean[]
tabstops
the current tab stops
Constructors Summary
public Tabs(int n)
Construct a Tabs object with a given tab stop settings


	           
	   
		if (n <= 0) {
			n = 1;
		}
		tabstops = new boolean[MAXLINE];
		tabSpace = n;
		settabs();
	
public Tabs()
Construct a Tabs object with a default tab stop settings

		this(DEFTABSPACE);
	
Methods Summary
public intgetTabSpacing()

return
Returns the tabSpace.

		return tabSpace;
	
public booleanisTabStop(int col)
isTabStop - returns true if given column is a tab stop.

param
col - the current column number

		if (col > tabstops.length - 1) {
			tabstops = new boolean[tabstops.length * 2];
			settabs();
		}
		return tabstops[col];
	
private voidsettabs()
settabs - set initial tab stops

		for (int i = 0; i < tabstops.length; i++) {
			tabstops[i] = ((i+1) % tabSpace) == 0;
			Debug.println("tabs", "Tabs[" + i + "]=" + tabstops[i]);
		}