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 TypeMethodDescriptionboolean
canRepositionTo
(TElement element) Checks if search can be repositioned to given element.boolean
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).boolean
Checks if searcher not traversed to the end of the input and next element is given.boolean
Checks if searcher not traversed to the beginning of the input and previous element is given.Provides search element typeGets current filter data.void
Initializes searcher by specified container to search in.void
repositionTo
(TElement element) Repositions to specific element.Repositions to next element.Repositions to prev element.void
Starts searching from the beginning of data.void
Starts searching from the end of data.void
Resets search progress to start searching again.search()
Searches forward.Searches backward.void
setFilterData
(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:
true
if the searching can be executed,false
otherwise
-
search
TElement search()Searches forward.- Returns:
- the found element, may be
null
if matching element not found
-
searchBack
TElement searchBack()Searches backward.- Returns:
- the found element, may be
null
if 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:
false
current element is the first one in collection or reached beginning of data,true
otherwise
-
canSearchNext
boolean canSearchNext()Checks if searcher not traversed to the end of the input and next element is given.- Returns:
false
current element is the last one in collection or reached end of data,true
otherwise
-
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:
true
if repositioning is possible,false
otherwise
-
getElementType
Provides search element type- Returns:
- search element type, can be
null
if element type is not applicable/used
-