Methods Summary |
---|
public boolean | equals(java.lang.Object o)Indicates whether this TabSet is equal to another one.
if (o == this) {
return true;
}
if (o instanceof TabSet) {
TabSet ts = (TabSet) o;
int count = getTabCount();
if (ts.getTabCount() != count) {
return false;
}
for (int i=0; i < count; i++) {
TabStop ts1 = getTab(i);
TabStop ts2 = ts.getTab(i);
if ((ts1 == null && ts2 != null) ||
(ts1 != null && !getTab(i).equals(ts.getTab(i)))) {
return false;
}
}
return true;
}
return false;
|
public javax.swing.text.TabStop | getTab(int index)Returns the TabStop at index index . This will throw an
IllegalArgumentException if index is outside the range
of tabs.
int numTabs = getTabCount();
if(index < 0 || index >= numTabs)
throw new IllegalArgumentException(index +
" is outside the range of tabs");
return tabs[index];
|
public javax.swing.text.TabStop | getTabAfter(float location)Returns the Tab instance after location . This will
return null if there are no tabs after location .
int index = getTabIndexAfter(location);
return (index == -1) ? null : tabs[index];
|
public int | getTabCount()Returns the number of Tab instances the receiver contains.
return (tabs == null) ? 0 : tabs.length;
|
public int | getTabIndex(javax.swing.text.TabStop tab)
for(int counter = getTabCount() - 1; counter >= 0; counter--)
// should this use .equals?
if(getTab(counter) == tab)
return counter;
return -1;
|
public int | getTabIndexAfter(float location)Returns the index of the Tab to be used after location .
This will return -1 if there are no tabs after location .
int current, min, max;
min = 0;
max = getTabCount();
while(min != max) {
current = (max - min) / 2 + min;
if(location > tabs[current].getPosition()) {
if(min == current)
min = max;
else
min = current;
}
else {
if(current == 0 || location > tabs[current - 1].getPosition())
return current;
max = current;
}
}
// no tabs after the passed in location.
return -1;
|
public int | hashCode()Returns a hashcode for this set of TabStops.
if (hashCode == Integer.MAX_VALUE) {
hashCode = 0;
int len = getTabCount();
for (int i = 0; i < len; i++) {
TabStop ts = getTab(i);
hashCode ^= ts != null ? getTab(i).hashCode() : 0;
}
if (hashCode == Integer.MAX_VALUE) {
hashCode -= 1;
}
}
return hashCode;
|
public java.lang.String | toString()Returns the string representation of the set of tabs.
int tabCount = getTabCount();
StringBuffer buffer = new StringBuffer("[ ");
for(int counter = 0; counter < tabCount; counter++) {
if(counter > 0)
buffer.append(" - ");
buffer.append(getTab(counter).toString());
}
buffer.append(" ]");
return buffer.toString();
|