onig4j
Class OnigRegion

java.lang.Object
  extended by onig4j.OnigRegion
All Implemented Interfaces:
java.io.Closeable, java.lang.Cloneable

public class OnigRegion
extends java.lang.Object
implements java.lang.Cloneable

Oniguruma region class

See Also:
Oniguruma, Oniguruma API, 鬼車, 鬼車インターフェース

Nested Class Summary
static interface OnigRegion.Callback
          Callback interface for onig_capture_tree_traverse() function.
 
Field Summary
protected  long handle
          object handle.
static int ONIG_REGION_NOTPOS
          mismatched position value of region
static int ONIG_TRAVERSE_CALLBACK_AT_BOTH
          callback first, then traverse children, and at last callback again
static int ONIG_TRAVERSE_CALLBACK_AT_FIRST
          callback first, then traverse children
static int ONIG_TRAVERSE_CALLBACK_AT_LAST
          traverse children first, then callback
 
Constructor Summary
OnigRegion()
          invoke onig_region_new() function.
 
Method Summary
 int allocated()
          Returns the value of OnigRegion.allocated.
 int begin(int index)
          Returns the value of OnigRegion.beg[index].
 void clear()
          invoke onig_region_clear() function.
 OnigRegion clone()
          invoke onig_region_copy() function.
 void close()
          invoke free() method.
 int count()
          Returns the value of OnigRegion.num_regs.
 int end(int index)
          Returns the value of OnigRegion.end[index].
protected  void finalize()
          invoke close() method.
protected  void free()
          invoke onig_region_free(1) function.
 OnigCaptureTreeNode getCaptureTreeNode()
          invoke onig_get_capture_tree() function.
 void resize(int n)
          invoke onig_region_resize() funcation.
 void resizeClear(int n)
          invoke onig_region_resize() and onig_region_clear() funcation.
 int traverseCaptureTree(OnigRegion.Callback callback, int at)
          invoke onig_capture_tree_traverse() function.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONIG_TRAVERSE_CALLBACK_AT_FIRST

public static final int ONIG_TRAVERSE_CALLBACK_AT_FIRST
callback first, then traverse children

See Also:
Constant Field Values

ONIG_TRAVERSE_CALLBACK_AT_LAST

public static final int ONIG_TRAVERSE_CALLBACK_AT_LAST
traverse children first, then callback

See Also:
Constant Field Values

ONIG_TRAVERSE_CALLBACK_AT_BOTH

public static final int ONIG_TRAVERSE_CALLBACK_AT_BOTH
callback first, then traverse children, and at last callback again

See Also:
Constant Field Values

ONIG_REGION_NOTPOS

public static final int ONIG_REGION_NOTPOS
mismatched position value of region

See Also:
Constant Field Values

handle

protected volatile long handle
object handle.

Constructor Detail

OnigRegion

public OnigRegion()
invoke onig_region_new() function.

Method Detail

free

protected final void free()
invoke onig_region_free(1) function.


clear

public void clear()
invoke onig_region_clear() function.

See Also:
resizeClear(int)

clone

public OnigRegion clone()
invoke onig_region_copy() function.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance

getCaptureTreeNode

public OnigCaptureTreeNode getCaptureTreeNode()
invoke onig_get_capture_tree() function.

Returns:
The root node of capture history data tree
See Also:
OnigSyntaxType.isActiveCaputureHistory()

resize

public void resize(int n)
invoke onig_region_resize() funcation.

Parameters:
n - The new size
See Also:
resizeClear(int)

resizeClear

public void resizeClear(int n)
invoke onig_region_resize() and onig_region_clear() funcation.

Parameters:
n - The new size

allocated

public int allocated()
Returns the value of OnigRegion.allocated.

Returns:
The value of OnigRegion.allocated

count

public int count()
Returns the value of OnigRegion.num_regs.

Returns:
The value of OnigRegion.num_regs

begin

public int begin(int index)
Returns the value of OnigRegion.beg[index].

Parameters:
index - The index value
Returns:
The value of OnigRegion.beg[index]

end

public int end(int index)
Returns the value of OnigRegion.end[index].

Parameters:
index - The index value
Returns:
The value of OnigRegion.end[index]

traverseCaptureTree

public int traverseCaptureTree(OnigRegion.Callback callback,
                               int at)
invoke onig_capture_tree_traverse() function.

Parameters:
callback - The callback object
at - The callback position (ONIG_TRAVERSE_CALLBACK_AT_FIRST or ONIG_TRAVERSE_CALLBACK_AT_LAST or ONIG_TRAVERSE_CALLBACK_AT_BOTH)
Returns:
The callback object return value

close

public final void close()
invoke free() method.

Specified by:
close in interface java.io.Closeable
See Also:
free()

finalize

protected final void finalize()
                       throws java.lang.Throwable
invoke close() method.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
close()