Package Torello.HTML.NodeSearch
Class CursorException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.IllegalArgumentException
-
- Torello.HTML.NodeSearch.CursorException
-
- All Implemented Interfaces:
java.io.Serializable
public class CursorException extends java.lang.IllegalArgumentException
CursorException - Documentation.
This is exception is thrown if code attempts to violate a . ACursor Bounds Window
is created for a givenHTML Node List Iterator (HNLI, or HNLIInclusive
by invoking the methodrestrictCursor(...)
. When such a bounding limit is set for anHNLI
, the returnedIterator
-matches that lay outside these limits may not be returned by theIterator
.
Internally, the code easily avoids returning such user-requested out-of-bounds matches. However, if any of theHNLI
"setter" methods attempt to set a portion of the vectorized-html that is not within the bounds that were set by the programmer, this exception shall throw.
This class provides somepublic final
"inspection & convenience" fields which should guarantee to avoid havingnull
values when thisException
is thrown by an internal method. If as a programmer, you intended to extend use of this class, make sure to pass valid-information & valid-data, to the constructors of this class.- See Also:
- Serialized Form
Hi-Lited Source-Code:
- View Here: Torello/HTML/NodeSearch/CursorException.java
- Open New Browser-Tab: Torello/HTML/NodeSearch/CursorException.java
-
-
Field Summary
Fields Modifier and Type Field int
maxCursor
int
minCursor
int
pos
static long
serialVersionUID
-
Constructor Summary
Constructors Constructor CursorException(String message, int minCursor, int maxCursor, int pos)
CursorException(String message, Throwable cause, int minCursor, int maxCursor, int pos)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method static void
check(int minCursor, int maxCursor, int pos)
static void
check(int minCursor, int maxCursor, int[] posArr)
static void
check(int minCursor, int maxCursor, DotPair dp)
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
Note that Java'sjava.lang.Exception
andjava.lang.Error
classes implement theSerializable interface
, and a warning-free build expects this field be defined here.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
1
public static final long serialVersionUID = 1;
-
minCursor
public final int minCursor
This field is provided to the user as a matter of convenience. All instantiations of thisException
are guaranteed to enforce and ensure that when an instance of this exception is thrown, the convenience field will not be null. If this package is extended, it is up to the programmer/user to make sure not to leave this field null when using one of these constructors. This constructor will not check whether a convenience field isnull
or not, when constructing the exception.
IMPORTANT: All this is really trying to explain is that, when debugging your code, if in the analysis of a particularException
, that analysis causes another exception throw (likeNullPointerException
) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache.
This will contain the value forminCursor
defined in anHTML Node Iterator's
settings for theCursor Bounds
.- Code:
- Exact Field Declaration Expression:
1
public final int minCursor;
-
maxCursor
public final int maxCursor
This field is provided to the user as a matter of convenience. All instantiations of thisException
are guaranteed to enforce and ensure that when an instance of this exception is thrown, the convenience field will not be null. If this package is extended, it is up to the programmer/user to make sure not to leave this field null when using one of these constructors. This constructor will not check whether a convenience field isnull
or not, when constructing the exception.
IMPORTANT: All this is really trying to explain is that, when debugging your code, if in the analysis of a particularException
, that analysis causes another exception throw (likeNullPointerException
) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache.
This will contain the value formaxCursor
defined in anHTML Node Iterator's
settings for theCursor Bounds
.- Code:
- Exact Field Declaration Expression:
1
public final int maxCursor;
-
pos
public final int pos
This field is provided to the user as a matter of convenience. All instantiations of thisException
are guaranteed to enforce and ensure that when an instance of this exception is thrown, the convenience field will not be null. If this package is extended, it is up to the programmer/user to make sure not to leave this field null when using one of these constructors. This constructor will not check whether a convenience field isnull
or not, when constructing the exception.
IMPORTANT: All this is really trying to explain is that, when debugging your code, if in the analysis of a particularException
, that analysis causes another exception throw (likeNullPointerException
) - BECAUSE THIS CONVENIENCE FIELD WAS LEFT NULL - would be an unnecessary source of headache.
This will contain the value for passed to anHNLI Iterator
'setter' method which was not within the bounds of the suppliedCursor Boundary Window
.- Code:
- Exact Field Declaration Expression:
1
public final int pos;
-
-
Constructor Detail
-
CursorException
public CursorException(java.lang.String message, int minCursor, int maxCursor, int pos)
Constructs a new exception with the specified detail message, and the twopublic, final
parameters:maxCursor, minCursor
andpos
.- Parameters:
message
- the detail message.minCursor
- This was the setting for theCursor Boundary Window
inside an instance ofHTML Node List Iterator
, when an exception threw.maxCursor
- This was the setting for theCursor Boundary Window
inside an instance ofHTML Node List Iterator
, when an exception threw.pos
- The position that generated this exception throw.- See Also:
minCursor
,maxCursor
,pos
-
CursorException
public CursorException(java.lang.String message, java.lang.Throwable cause, int minCursor, int maxCursor, int pos)
Constructs a new exception with the specified detail message, and the twopublic, final
parameters:maxCursor, minCursor
andpos
.- Parameters:
message
- The detail message (which is saved for later retrieval by theThrowable.getMessage()
method).cause
- the cause (which is saved for later retrieval by theThrowable.getCause()
method). (A null value is permitted, and indicates that the cause is nonexistent or unknown).minCursor
- This was the setting for theCursor Boundary Window
inside an instance ofHTML Node List Iterator
, when an exception threw.maxCursor
- This was the setting for theCursor Boundary Window
inside an instance ofHTML Node List Iterator
, when an exception threw.pos
- The position that generated this exception throw.- See Also:
minCursor
,maxCursor
,pos
-
-
Method Detail
-
check
public static void check(int minCursor, int maxCursor, int pos)
Checks that a supplied position parameter,'pos'
, is within the bounds of a given window, and throws an appropriately formatted exception if it is not.- Parameters:
minCursor
- This is the setting for aCursor Boundary Window
which was applied to an instance ofHTML Node List Iterator
, when an exception threw.maxCursor
- This is the setting for aCursor Boundary Window
which was applied to an instance ofHTML Node List Iterator
, when an exception threw.pos
- This is the position to be checked against the window bounds.- Throws:
CursorException
- Throws this exception if the provided position parameter'pos'
is not within the suppliedCursor Bounds
.- See Also:
minCursor
,maxCursor
,pos
- Code:
- Exact Method Body:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
if ((maxCursor == -1) && (minCursor == -1)) return; if (pos < minCursor) throw new CursorException( "This iterator has had a Minimum-Cursor index [" + minCursor + "] set using the " + "restrictCursor(...) method. Unfortunately, the position passed as a " + "parameter [" + pos + "], is less than this minimum-cursor index.", minCursor, maxCursor, pos ); if (pos > maxCursor) throw new CursorException( "This iterator has had a Maximum-Cursor index [" + maxCursor + "] set using the " + "restrictCursor(...) method. Unfortunately, the DotPair 'range' passed as a " + "parameter [" + pos + "], is greater than this maximum-cursor index.", minCursor, maxCursor, pos );
-
check
public static void check(int minCursor, int maxCursor, DotPair dp)
Checks that a suppliedDotPair
parameter,'dp'
, is FULLY within the bounds (READ: bothDotPair.start
andDotPair.end
) of a given window, and throws an appropriately formatted exception if it is not.- Parameters:
minCursor
- This is the setting for aCursor Boundary Window
which was applied to an instance ofHTML Node List Iterator
, when an exception threw.maxCursor
- This is the setting for aCursor Boundary Window
which was applied to an instance ofHTML Node List Iterator
, when an exception threw.dp
- This is the sub-list or sub-section to be checked against the window bounds. It must fully lay within the provided window in order for this method to avoid throwing theCursorException
.- Throws:
CursorException
- Throws this exception if the provided position parameter'pos'
is not within the suppliedCursor Bounds
.- See Also:
minCursor
,maxCursor
,pos
- Code:
- Exact Method Body:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
if ((maxCursor == -1) && (minCursor == -1)) return; if (dp.start < minCursor) throw new CursorException( "This iterator has had a Minimum-Cursor index [" + minCursor + "] set using the " + "restrictCursor(...) method. Unfortunately, the DotPair 'range' " + dp + " passed " + "as a paremter starts before this minimum-cursor index.", minCursor, maxCursor, dp.start ); if (dp.end > maxCursor) throw new CursorException( "This iterator has had a Maximum-Cursor index [" + maxCursor + "] set using the " + "restrictCursor(...) method. Unfortunately, the DotPair 'range' " + dp + " passed " + "as a paremter extends past this maximum-cursor index.", minCursor, maxCursor, dp.end );
-
check
public static void check(int minCursor, int maxCursor, int[] posArr)
Checks that each an every index-position from a supplied position-array parameter,'posArr'
, is within the bounds of a given window, and throws an appropriately formatted exception if any of the indices in'posArr'
are not within the windows bounds.- Parameters:
minCursor
- This is the setting for aCursor Boundary Window
which was applied to an instance ofHTML Node List Iterator
, when an exception threw.maxCursor
- This is the setting for aCursor Boundary Window
which was applied to an instance ofHTML Node List Iterator
, when an exception threw.posArr
- This is theint[]
position-array to be checked against the window bounds. It value in this array must be within the provided window in order for this method to avoid throwing theCursorException
.- Throws:
CursorException
- Throws this exception if the provided position parameter'pos'
is not within the suppliedCursor Bounds
.- See Also:
minCursor
,maxCursor
,pos
- Code:
- Exact Method Body:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
if ((maxCursor == -1) && (minCursor == -1)) return; int pos; // Temp Var for (int i=0; i < posArr.length; i++) if ((pos=posArr[i]) < minCursor) throw new CursorException( "This iterator has had a Minimum-Cursor, index [" + minCursor + "] set using " + "the restrictCursor(...) method. Unfortunately, One of the elements of the " + "indices-list var-args array (parameter 'posArr') contains a Vector-position " + "index [" + pos + "], at varargs-array index [" + i + "] that is less than " + "this Minimum Cursor Vale.", minCursor, maxCursor, pos ); else if (pos > maxCursor) throw new CursorException( "This iterator has had a Maximum-Cursor, index [" + maxCursor + "] set using " + "the setCursorBounds(...) method. Unfortunately, One of the elements of the " + "indices-list var-args array (parameter 'posArr') contains a Vector-position " + "index [" + pos + "], at varargs-array index [" + i + "] that is greater than " + "this Maximum Cursor Vale.", minCursor, maxCursor, pos );
-
-