1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Torello.Browser.JsonAST;

import static Torello.Java.C.BYELLOW;
import static Torello.Java.C.RESET;

import Torello.Java.FileRW;

import Torello.HTML.Balance;
import Torello.HTML.HTMLPage;

import java.io.IOException;

/** Iterates both trees - the "Browser Protocol" and the "Java Script Protocol" */
@Torello.JavaDoc.Annotations.StaticFunctional
@Torello.JavaDoc.Annotations.JDHeaderBackgroundImg(EmbedTagFileID="TOHTML_JDHBI")
public class WriteBothHTMLFiles
{
    private WriteBothHTMLFiles() { }

    static void write(
            final String    ROOT_DIR,
            final API       browser,
            final API       js
        )
        throws IOException
    {
        String html, report;

        html = HTML$API.run(js);
        System.out.println("Writing File: " + BYELLOW + ROOT_DIR + "js.html" + RESET);
        FileRW.writeFile(html,  ROOT_DIR + "js.html");

        report = Balance.toStringBalance
            (Balance.checkNonZero(Balance.check(HTMLPage.getPageTokens(html, false))));
        System.out.println("Balance Report:\n" + report);

        html = HTML$API.run(browser);
        System.out.println("Writing File: " + BYELLOW + ROOT_DIR + "browser.html" + RESET);
        FileRW.writeFile(html, ROOT_DIR + "browser.html");

        report = Balance.toStringBalance
            (Balance.checkNonZero(Balance.check(HTMLPage.getPageTokens(html, false))));
        System.out.println("Balance Report:\n" + report);

    }
}