private static void addFunctionDependence ( Function function , Procedure procedure , Statement catalogStmt ) { String funcDeps = function . getStmtdependers ( ) ; Set < String > stmtSet = new TreeSet <> ( ) ; for ( String stmtName : funcDeps . split ( "," ) ) { if ( ! stmtName . isEmpty ( ) ) { stmtSet . add ( stmtName ) ; } } String statementName = procedure . getTypeName ( ) + ":" + catalogStmt . getTypeName ( ) ; if ( stmtSet . contains ( statementName ) ) { return ; } stmtSet . add ( statementName ) ; StringBuilder sb = new StringBuilder ( ) ; // We will add this procedure:statement pair. So make sure we have // an initial comma. Note that an empty set must be represented // by an empty string. We represent the set {pp:ss, qq:tt}, // where "pp" and "qq" are procedures and "ss" and "tt" are // statements in their procedures respectively, with // the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will // never find "ppp:sss" by accident. // // Do to this, when we add something to string we start with a single // comma, and then add "qq:tt," at the end. sb . append ( "," ) ; for ( String stmtName : stmtSet ) { sb . append ( stmtName + "," ) ; } function . setStmtdependers ( sb . toString ( ) ) ; }
Add a dependence to a function of a statement . The function s dependence string is altered with this function .