Package com._1c.g5.v8.dt.common.search
Interface ISearcher<TElement>
- Type Parameters:
TElement- type of collection elements
- All Known Subinterfaces:
IBorderedSearcher<TElement>
- All Known Implementing Classes:
AttributesSearcher,BorderedSearcher,FormCommandSearcher,FormParameterSearcher,ItemsSearcher,NodeSearcher,Searcher
public interface ISearcher<TElement>
Represents a generic bidirectional ordered searcher with repositioning and narrowing search scope between two
elements.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRepositionTo(TElement element) Checks if search can be repositioned to given element.booleanGets a value indicating whether the searching can be executed.
The searching can be executed if the filter was set from non-empty data; see setFilterData(FilterData).booleanChecks if searcher not traversed to the end of the input and next element is given.booleanChecks if searcher not traversed to the beginning of the input and previous element is given.Provides search element typeGets current filter data.voidInitializes searcher by specified container to search in.voidrepositionTo(TElement element) Repositions to specific element.Repositions to next element.Repositions to prev element.voidStarts searching from the beginning of data.voidStarts searching from the end of data.voidResets search progress to start searching again.search()Searches forward.Searches backward.voidsetFilterData(FilterData filterData) Sets the filter data for searching.
-
Method Details
-
init
Initializes searcher by specified container to search in.- Parameters:
containerToSearchIn- the container to search in, cannot benull
-
setFilterData
Sets the filter data for searching.- Parameters:
filterData- the filter data for searching, cannot benull
-
getFilterData
FilterData getFilterData()Gets current filter data.- Returns:
- the current filter data, can be
null
-
canSearch
boolean canSearch()Gets a value indicating whether the searching can be executed.
The searching can be executed if the filter was set from non-empty data; see setFilterData(FilterData).- Returns:
trueif the searching can be executed,falseotherwise
-
search
TElement search()Searches forward.- Returns:
- the found element, may be
nullif matching element not found
-
searchBack
TElement searchBack()Searches backward.- Returns:
- the found element, may be
nullif matching element not found
-
resetSearch
void resetSearch()Resets search progress to start searching again. -
repositionTo
Repositions to specific element.- Parameters:
element- the element to which to reposition, cannot benull- Throws:
NoSuchElementException- when the requested element does not exist
-
repositionToNextElement
TElement repositionToNextElement()Repositions to next element.- Returns:
- next element, never
null - Throws:
NoSuchElementException- when thecanSearchNext()isfalse
-
repositionToPrevElement
TElement repositionToPrevElement()Repositions to prev element.- Returns:
- prev element, never
null - Throws:
NoSuchElementException- when thecanSearchPrev()isfalse
-
repositionToTheEnd
void repositionToTheEnd()Starts searching from the end of data. -
repositionToTheBeginning
void repositionToTheBeginning()Starts searching from the beginning of data. -
canSearchPrev
boolean canSearchPrev()Checks if searcher not traversed to the beginning of the input and previous element is given.- Returns:
falsecurrent element is the first one in collection or reached beginning of data,trueotherwise
-
canSearchNext
boolean canSearchNext()Checks if searcher not traversed to the end of the input and next element is given.- Returns:
falsecurrent element is the last one in collection or reached end of data,trueotherwise
-
canRepositionTo
Checks if search can be repositioned to given element. Searcher can be repositioned to given element, if element is present in input.- Parameters:
element- the element to reposition searcher to, cannot benull- Returns:
trueif repositioning is possible,falseotherwise
-
getElementType
Provides search element type- Returns:
- search element type, can be
nullif element type is not applicable/used
-