sears.search.data
Class CharIndexIterator

java.lang.Object
  extended by sears.search.data.CharIndexIterator

public class CharIndexIterator
extends java.lang.Object

Data structure to manage result of a search.
CharIndexIterator performs a loop iteration


Constructor Summary
CharIndexIterator(java.util.ArrayList<Subtitle> subtitleList, java.lang.String str)
          Constructs a new CharIndexIterator object
 
Method Summary
 int[] getNextRowAndCharIndex()
          Gets the next row and char index
INCOHERENCE: row < 0 or row > last row...
 int[] getNextRowAndCharIndexBeginAtRow(int row)
          Gets the row and first char index of the next occurrence after row
 int[] getPreviousRowAndCharIndex()
          Gets the row and first char index of the previous occurrence
 int[] getPreviousRowAndCharIndexBeginAtRow(int row)
          Gets the row and first char index of the previous occurrence after row
 void setANewSubtitleList(java.util.ArrayList<Subtitle> newSubtitleList)
          Sets a new array of Subtitle object
 boolean setANewTextForTheSearch(java.lang.String str)
          Set if needed a new text for the search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharIndexIterator

public CharIndexIterator(java.util.ArrayList<Subtitle> subtitleList,
                         java.lang.String str)
Constructs a new CharIndexIterator object

Parameters:
subtitleList - the subtitle list
str - the searched string
Throws:
java.lang.IllegalArgumentException - if one of the arguments id null
Method Detail

setANewSubtitleList

public void setANewSubtitleList(java.util.ArrayList<Subtitle> newSubtitleList)
Sets a new array of Subtitle object

Parameters:
newSubtitleList - the new array

setANewTextForTheSearch

public boolean setANewTextForTheSearch(java.lang.String str)
Set if needed a new text for the search

Parameters:
str - the new text
Returns:
true if the set is needed, false if not

getNextRowAndCharIndex

public int[] getNextRowAndCharIndex()
Gets the next row and char index
INCOHERENCE: row < 0 or row > last row...

Returns:
an array of two positive int or null if an incoherence appears during the method

getPreviousRowAndCharIndex

public int[] getPreviousRowAndCharIndex()
Gets the row and first char index of the previous occurrence

Returns:
an array of two int, the row and the first char index of the searched text null if there's no previous occurrence (this means that there's no occurrence at all

getNextRowAndCharIndexBeginAtRow

public int[] getNextRowAndCharIndexBeginAtRow(int row)
Gets the row and first char index of the next occurrence after row

Parameters:
row - the row
Returns:
an array of two int, the row and the first char index of the searched text

getPreviousRowAndCharIndexBeginAtRow

public int[] getPreviousRowAndCharIndexBeginAtRow(int row)
Gets the row and first char index of the previous occurrence after row

Parameters:
row - the row
Returns:
an array of two int, the row and the first char index of the searched text