public void handleContextVector(String focusKey,
                                    String secondaryKey,
                                    SparseDoubleVector context) {
        // Get the list of context vectors for the focus key.
        List<SparseDoubleVector> termContexts = dataVectors.get(focusKey);
        if (termContexts == null) {
            synchronized (this) {
                termContexts = dataVectors.get(focusKey);
                if (termContexts == null) {
                    termContexts = new ArrayList<SparseDoubleVector>();
                    dataVectors.put(focusKey, termContexts);
                }
            }
        }

        // Add the new context vector.
        int contextId = 0;
        synchronized (termContexts) {
            contextId = termContexts.size();
            termContexts.add(context);
        }

        // Record the association.
        if (reporter != null)
            reporter.assignContextToKey(focusKey, secondaryKey, contextId);
    }
public void handleContextVector ( String focusKey , String secondaryKey , SparseDoubleVector context ) { List < SparseDoubleVector > termContexts = dataVectors . get ( focusKey ) ; if ( termContexts == null ) { synchronized ( this ) { termContexts = dataVectors . get ( focusKey ) ; if ( termContexts == null ) { termContexts = new ArrayList < SparseDoubleVector > ( ) ; dataVectors . put ( focusKey , termContexts ) ; } } } int contextId = 0 ; synchronized ( termContexts ) { contextId = termContexts . size ( ) ; termContexts . add ( context ) ; } if ( reporter != null ) reporter . assignContextToKey ( focusKey , secondaryKey , contextId ) ; }
Adds the context vector to the end of the list of context vectors
associated with {@code focusKey}.