private TernaryVector getTermIndexVector ( String term ) { TernaryVector iv = termToIndexVector . get ( term ) ; if ( iv == null ) { // lock in case multiple threads attempt to add it at once synchronized ( this ) { // recheck in case another thread added it while we were waiting // for the lock iv = termToIndexVector . get ( term ) ; if ( iv == null ) { // since this is a new term, also map it to its index for // later look-up when the integer documents are processed termToIndex . put ( term , termIndexCounter ++ ) ; // next, map it to its reflective vector which will be // filled in process space termToReflectiveSemantics . put ( term , createVector ( ) ) ; // last, create an index vector for the term iv = indexVectorGenerator . generate ( ) ; termToIndexVector . put ( term , iv ) ; } } } return iv ; }
Returns the index vector for the term or if creates one if the term to index vector mapping does not yet exist .