public SDVariable addVariable ( SDVariable variable ) { Preconditions . checkState ( variable . getSameDiff ( ) == this , "Samediff instance must be the same." ) ; if ( variables . containsKey ( variable . getVarName ( ) ) && ! variables . get ( variable . getVarName ( ) ) . getVariable ( ) . equals ( variable ) ) { throw new IllegalArgumentException ( "Variable already found with variable opName " + variable . getVarName ( ) ) ; } Preconditions . checkState ( variable . getSameDiff ( ) == this , "Same diff instance for variable must be the same!" ) ; variables . put ( variable . getVarName ( ) , Variable . builder ( ) . name ( variable . getVarName ( ) ) . variable ( variable ) . build ( ) ) ; return variable ; }
Add the specified variable to this SameDiff instance