private void memorySizeCheck ( ) { if ( this . stm . numInstances ( ) + this . ltm . numInstances ( ) > this . maxSTMSize + this . maxLTMSize ) { if ( this . ltm . numInstances ( ) > this . maxLTMSize ) { this . clusterDown ( ) ; } else { //shift values from STM directly to LTM since STM is full int numShifts = this . maxLTMSize - this . ltm . numInstances ( ) + 1 ; for ( int i = 0 ; i < numShifts ; i ++ ) { this . ltm . add ( this . stm . get ( 0 ) . copy ( ) ) ; this . stm . delete ( 0 ) ; this . stmHistory . remove ( 0 ) ; this . ltmHistory . remove ( 0 ) ; this . cmHistory . remove ( 0 ) ; } this . clusterDown ( ) ; this . predictionHistories . clear ( ) ; for ( int i = 0 ; i < this . stm . numInstances ( ) ; i ++ ) { for ( int j = 0 ; j < this . stm . numInstances ( ) ; j ++ ) { this . distanceMatrixSTM [ i ] [ j ] = this . distanceMatrixSTM [ numShifts + i ] [ numShifts + j ] ; } } } } }
Makes sure that the STM and LTM combined doe not surpass the maximum size .