/** Reset method is used to initialize finder. *Itiscalledonceatthebeginingoffind.Tobemosteffective *<CODE>reset()</CODE>iscalledafterboth<CODE>setForward()</CODE> *and<CODE>setLimitPos()</CODE>hadbeencalled.
*/ publicvoid reset();
/** This is the most important function in finder. It can be called several *timesifthewholesearchareadoesn'tfitinthecachebuffer. *Usualforwardsearchshouldlooklikethis:<CODE> *intoffset=reqPos-bufferStartPos; *while(offset<offset2){ *if(buffer[offset]-meets-condition){ *set-found-flag *returnoffset+bufferStartPos; *} *offset++; *} *returnoffset+bufferStartPos;</CODE> *Bakwardsearchfollows:<CODE> *intoffset=reqPos-bufferStartPos *while(offset>=offset1){ *if(buffer[offset]-meets-condition){ *set-found-flag *returnoffset+bufferStartPos; *} *offset--; *} *returnoffset+bufferStartPos;</CODE> *Caution!Nothingcanbewrittentothedatacomminginbufferto *<CODE>find()</CODE>methodbecauseofperformancereasons *theseareprimarydocumentdata,notacopy. *Bufferisalwaysguaranteedtohaveatleastonechar-itis *charstandingatreqPos.Howevertherecanbecallsto<CODE>find()</CODE> *whentherewillbeonlythatonecharacter,so<CODE>find()</CODE>must *mustbepreparedforthis. *Unlikecalling<CODE>DocCache.find()</CODE>theoffset1<offset2even *forbackwardsearches. *@parambufferStartPosbeginingpositionofthebuffer(notsearcharea). *@parambufferbufferwithcharstobesearched *@paramoffset1offsetofbeginingofsearchableareainbuffer. *Nosearchingbelowthisoffsetcanbeperformed. *@paramoffset2offsetofendofsearchableareainbuffer. *Nosearchingbeyondthisoffsetcanbeperformed. *@paramreqPosrequiredposition.Initiallyitisthebegining *searchpositionrequestedbycaller.Insubsequentcalls *itisthesamevalueasreturnedfrompreviouscall *to<CODE>find()</CODE>method. *@paramlimitPosisfilledwithpositionbeyondwhichsearchcannotgo. *(i.e.forward:pos<limitPosandbackward:pos>=limitPos) *Somefindersi.e.finderthattriestofindsomewordwith *whole-words-onlyflagturnedoncanbenefit *fromthisinformation.Ifthesearchedwordisattheveryendof *thedocumentthefinderwouldn'tnormallyfinditasitwouldrequest *thenextbufferevenwhenthewholewordwasmatchedbecausethefinder *needstofindwhitespacetoknowthewordendedthere.Howeverthis *wouldbebeyondthesearchareasoEOTexceptionwouldberaised. *TocorrectlymanagethissituationfindermustcareforlimitPos. *Whenitseesthewordandknowsthisisthelasttextindocument *itsignalsthatitfoundtheword. *@returnincasethestringwasfound,<CODE>find()</CODE> *methodreturnstheposition(notoffset)wherethestringstarts *(andmustalsosetsomeflagresultingtothat<CODE>isFound()</CODE> *methodwillreturntrue). *Ifthestringwasnotyetfound,thefunctionshouldreturn *position(notoffset)wherethenextsearchshouldcontinue.Ifthis *positionisgreaterorequalthanlimitposition *(lowerthanlimitpositionforbackwardsearch), *searchingwillstopresultingin-1asreturnedposition. *Thepositionreturnedwillbepassedas<CODE>reqPos</CODE>innext *callto<CODE>find()</CODE>method.
*/ publicint find(int bufferStartPos, char buffer[], int offset1, int offset2, int reqPos, int limitPos);
/** Using this function caller determines if finder found *desiredstring.Thereturnedpositionof<CODE>find</CODE>method *givesthepositionwherethestringoccurs.
*/ publicboolean isFound();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.