public void addClause ( final Literal ... literals ) { if ( this . miniSat == null && this . cleaneLing == null ) this . result . add ( this . f . clause ( literals ) ) ; else if ( this . miniSat != null ) { final LNGIntVector clauseVec = new LNGIntVector ( literals . length ) ; for ( final Literal lit : literals ) { int index = this . miniSat . underlyingSolver ( ) . idxForName ( lit . name ( ) ) ; if ( index == - 1 ) { index = this . miniSat . underlyingSolver ( ) . newVar ( ! this . miniSat . initialPhase ( ) , true ) ; this . miniSat . underlyingSolver ( ) . addName ( lit . name ( ) , index ) ; } final int litNum ; if ( lit instanceof EncodingAuxiliaryVariable ) litNum = ! ( ( EncodingAuxiliaryVariable ) lit ) . negated ? index * 2 : ( index * 2 ) ^ 1 ; else litNum = lit . phase ( ) ? index * 2 : ( index * 2 ) ^ 1 ; clauseVec . push ( litNum ) ; } this . miniSat . underlyingSolver ( ) . addClause ( clauseVec , null ) ; this . miniSat . setSolverToUndef ( ) ; } else { for ( final Literal lit : literals ) { final int index = this . cleaneLing . getOrCreateVarIndex ( lit . variable ( ) ) ; if ( lit instanceof EncodingAuxiliaryVariable ) this . cleaneLing . underlyingSolver ( ) . addlit ( ! ( ( EncodingAuxiliaryVariable ) lit ) . negated ? index : - index ) ; else this . cleaneLing . underlyingSolver ( ) . addlit ( lit . phase ( ) ? index : - index ) ; } this . cleaneLing . underlyingSolver ( ) . addlit ( CleaneLing . CLAUSE_TERMINATOR ) ; this . cleaneLing . setSolverToUndef ( ) ; } }
Adds a clause to the result