src/main/java/Alergia.java
private void fold(FptaNode red, FptaNode blue, FptaNode blueTreeNode) {
        for (String io : blue.children.keySet()){
            if(red.children.containsKey(io)){
                red.inputFrequency.put(io, red.inputFrequency.get(io) + blueTreeNode.inputFrequency.getOrDefault(io, 0));
                fold(red.children.get(io), blue.children.get(io), getNodeFromT(blue.children.get(io)));
            }else{
                red.children.put(io, blue.children.get(io));
                red.inputFrequency.put(io, blueTreeNode.inputFrequency.getOrDefault(io, 0));
            }
        }
    }
/**
     * Folds blue subtree in red subtree.
     * @param red red node
     * @param blue blue node in red tree
     * @param blueTreeNode blue node from blue tree
     */
Folds blue subtree in red subtree.
@param red red node
@param blue blue node in red tree
@param blueTreeNode blue node from blue tree
Folds blue subtree in red subtree . @param red red node @param blue blue node in red tree @param blueTreeNode blue node from blue tree
private void fold(FptaNode red, FptaNode blue, FptaNode blueTreeNode) {
        for (String io : blue.children.keySet()){
            if(red.children.containsKey(io)){
                red.inputFrequency.put(io, red.inputFrequency.get(io) + blueTreeNode.inputFrequency.getOrDefault(io, 0));
                fold(red.children.get(io), blue.children.get(io), getNodeFromT(blue.children.get(io)));
            }else{
                red.children.put(io, blue.children.get(io));
                red.inputFrequency.put(io, blueTreeNode.inputFrequency.getOrDefault(io, 0));
            }
        }
    }
private void fold ( FptaNode red , FptaNode blue , FptaNode blueTreeNode ) { for ( String io : blue . children . keySet ( ) ) { if ( red . children . containsKey ( io ) ) { red . inputFrequency . put ( io , red . inputFrequency . get ( io ) + blueTreeNode . inputFrequency . getOrDefault ( io , 0 ) ) ; fold ( red . children . get ( io ) , blue . children . get ( io ) , getNodeFromT ( blue . children . get ( io ) ) ) ; } else { red . children . put ( io , blue . children . get ( io ) ) ; red . inputFrequency . put ( io , blueTreeNode . inputFrequency . getOrDefault ( io , 0 ) ) ; } } }
Folds blue subtree in red subtree.
Folds blue subtree in red subtree .