diff --git a/constraintSolver/ISR.h b/constraintSolver/ISR.h index eb2ad27d04a410ffd88ad1430cccb9c1cb79fd63..bc4044180e6a45750efc085833bdc457f1b575d5 100644 --- a/constraintSolver/ISR.h +++ b/constraintSolver/ISR.h @@ -12,13 +12,28 @@ class ISR public: // ISR* DocumentEnd; - virtual Post* Next( ); - virtual Post* NextDocument( ); - virtual Post* Seek( Location target); - virtual Location GetStartLocation( ); - virtual Location GetEndLocation( ); + // Returns + virtual Location First( ); + + //Returns next post of a word given current location + virtual Location Next( ); + + + //Calls seek onto one past the current end doc location + //Return first instance of word at new document + virtual Location NextDocument( ); + //Returns first instance of word after target location + virtual Location Seek( Location target); virtual ISR *GetDocumentISR( ); + //Returns the location of the end of the document + virtual Location GetEndDocument( ); + + + Location currentLocation; + + + }; diff --git a/constraintSolver/ISROr.h b/constraintSolver/ISROr.h index 5c1889ba653ec38b5bb269b9a471af82c1c1701e..fd4f5bf4ddd75e4fa51b9d36cf99f43b09f5f482 100644 --- a/constraintSolver/ISROr.h +++ b/constraintSolver/ISROr.h @@ -17,13 +17,19 @@ class ISROr : publicISR unsigned NumberOfTerms; Location GetStartLocation( );//{return nearestStartLocation;} Location GetEndLocation( );// {return nearestEndLocation;} - Post*Seek( Location target); + Post* Seek( Location target); // Seek all the ISRs to the first occurrence beginning at// the target location. Return null if there is no match. // The document is the document containing the nearest term. - Post*Next( );//{ Do a next on the nearest term, then return// the new nearest match.} - - Post*NextDocument( ); - //{ Seek all the ISRs to the first occurrence just past the end of this document.returnSeek( DocumentEnd->GetEndLocation( ) + 1 );} + //seek past target locations, + //seek all terms in or past starting location, take the ones that nears + //the document that the nearest term is in is the document ur in + //updates private members + Post* Next( ); + //{ Do a next on the nearest term, then return// the new nearest match.} + //next on nearest term, return nearest temr + Post* NextDocument( ); + // + // { Seek all the ISRs to the first occurrence just past the end of this document.returnSeek( DocumentEnd->GetEndLocation( ) + 1 );} private: unsigned nearestTerm; // nearStartLocation and nearestEndLocation are// the start and end of the nearestTerm. diff --git a/constraintSolver/ISRWord.cpp b/constraintSolver/ISRWord.cpp index 4d4e7ecbdf2a42b525e266f300d97edb0c90cf63..d042058392d53c1f61aedefc193a2ab136c08702 100644 --- a/constraintSolver/ISRWord.cpp +++ b/constraintSolver/ISRWord.cpp @@ -3,3 +3,68 @@ // #include "ISRWord.h" + + + +void ISRWord::getChunks() + { + //Memory map master index file + + //Binary search thru memory map until you find word + + //Get list of chunks that you need + + //set current chunk + + + + } + + +Location ISRWord::First() + { + + + //Go to current chunk + + //Look in seek dictionary for chunk (mem map, binary search) + + //Have offset into chunk, find post seek to post, return value + //update ISR currentLocation + //set current memory map + //returns offset into corpus + + + + } +//returns next absolute location in corpus + +Location ISRWord::Next() + { + + //looks at memory map + + //if new line ( end of current list for that file + + //move to next chunk, update chunk + //find new offset, return first location + + + //else + //find way to increment to next delta + //return new location + + + + } + +Location ISRWord::Seek( Location target ) + { + //look thru each chunk + //check if absolute position at offset in chunk is less then chunk, + //check seek lookup table to find if offset+absulte is bigger than target + //if so, set location to that big chunk + //go to next chunk + + } + diff --git a/constraintSolver/ISRWord.h b/constraintSolver/ISRWord.h index 4c807ced695c0c51291e2d91a04afad3927aba9c..a7724a8e0644d8fba35a79f035d0a2da097ec5f1 100644 --- a/constraintSolver/ISRWord.h +++ b/constraintSolver/ISRWord.h @@ -13,8 +13,45 @@ class ISRWord : ISR public: unsigned GetDocumentCount( ); unsigned GetNumberOfOccurrences( ); - virtual Post *GetCurrentPost( ); + ISR* DocumentEnd; + // Returns + virtual Location First( ); + //Returns next post of a word given current location + virtual Location Next( ); + + //Calls seek onto one past the current end doc location + //Return first instance of word at new document + virtual Location NextDocument( ); + //Returns first instance of word after target location + virtual Location Seek( Location target); + + + virtual ISR *GetDocumentISR( ); + + //Returns the location of the end of the document + virtual Location GetEndDocument( ); + + //Current location of word on disk + Location currentLocation; + char* term; + char* masterIndex; + vector<size_t> listOfChunks; + size_t currentChunk; + char* currentMemMap; + + //set member variables to all of the chunks that occur, update current chunk + virtual getChunks(); + + + + ISRWord(char * term_in ) : term( term_in ) + { + getChunks(); + currentLocation = First(); + + + } }; diff --git a/constraintSolver/Post.h b/constraintSolver/Post.h index eed13b50d44da6aa833c08ced31fb9b426c0aaa7..0cbe3c2a7c40ca41a13ed4399df1e7064ad83d44 100644 --- a/constraintSolver/Post.h +++ b/constraintSolver/Post.h @@ -19,14 +19,14 @@ class Post //What Start / End Location virtual Location GetStartLocation( ); virtual Location GetEndLocation( ); - virtual Attributes GetAttributes( ); + virtual Attributes GetAttributes( ); //Returns Next next delta //TO-DO NICK/ZANE virtual Post* Next( ); - + Location currentLocation; //*why? - virtual ISR* GetIsr( ); + //virtual ISR* GetIsr( ); };