FileDocCategorySizeDatePackage
Tabs.javaAPI DocExample1409Sat Mar 31 17:18:16 BST 2001None

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, ian@darwinsys.com
version
$Id: Tabs.java,v 1.5 2001/03/31 21:18:17 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 worry about 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


	           
	   
		tabstops = new boolean[MAXLINE];
		tabSpace = n;
		settabs();
	
public Tabs()
Construct a Tabs object with a default tab stop settings

		tabstops = new boolean[MAXLINE];
		settabs();
	
Methods Summary
public voidsettabs()
settabs - set initial tab stops

		int i;
		for (i = 0; i < tabstops.length; i++) {
			tabstops[i] = 0 == (i % tabSpace);
			Debug.println("settabs", "Tabs[" + i + "]=" + tabstops[i]);
		}
	
booleantabpos(int col)
tabpos - returns true if given column is a tab stop. If current input line is too long, we just put tabs whereever, no exception is thrown.

argument
col - the current column number

		if (col > tabstops.length-1)
			return true;
		else 
			return tabstops[col];