jsutil.compress
Class VWJSCStatistics

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.array.VectorWrapper
              |
              +--xbn.array.VWObject
                    |
                    +--jsutil.compress.VWJSCStatistics
All Implemented Interfaces:
Cloneable

public class VWJSCStatistics
extends VWObject

The statistics for multiple compression processes, with ways to automatically gather and display them. A VWObject for JSCStatistics.

Source code:  VWJSCStatistics.java

Tab-Delimited Data File (tddf) Format for JSCStatistics

Here is a valid example for a single JavaScript file:

validate_form	max	validate_form_c	139287	js_uncompressed/	js_maxc/	compression_vfmax.log
validate_form	max	1	63662	MLCs_Xd		Eliminated multilple-line comments.
validate_form	max	2	62626	elim_XCSTDs	Eliminated my personal sanity checks.
validate_form	max	3	47429	elim_XCMAXs 	Eliminated error checking.
validate_form	max	4	34645	SLCs_Xd 	Eliminated single-line comments.
validate_form	max	5	32427	SPC_X_SPC 	Eliminated unneeded spaces.
validate_form	max	6	28022	TRIM_AND_NLNL	Trimmed all lines of tabs and spaces, and eliminated empty lines.
validate_form	max	7	25873	NL_X_NL	Eliminated unneeded line breaks.
validate_form	max	8	19905	IDENTS_RPLCd	Non-public identifiers replaced with two-letter replacements.

Line one for each JavaScript file in the tddf has this format, each separated by a tab:

  1. 1: The name of the JavaScript file before compression, without the '.js' postfix
  2. 2: The descriptive name for the compression level. The combination of this and the JavaScript file name, must be unique in the tddf.
  3. 3: The name of the JavaScript file after compression, without '.js'.
  4. 4: The name of the log file written to by this JavaScript file's compression process. This is required, even if the log doesn't exist.
  5. 5: The byte size of the original JavaScript file.
  6. 6: The relative directory (within the build directory) in which the uncompressed JavaScript file exists.
  7. 7: The relative directory (within the build directory) in which the compressed JavaScript file exists.

Line two (and all subsequent) for each JavaScript file in the tddf has this format, each separated by a tab:

  1. 1, 2: Same as line one
  2. 3: The array index, starting with one, representing the #-th step in the compression process.
  3. 4: The byte size of the JavaScript file, after this step's compression is completed.
  4. 5: The name of this step.
  5. 6: The description of this step, for display in an HMTL page.

Uniqueness

Each JavaScript file may exist only once, for each possible level of compression. Specifically, each line's first three items must be unique for the entire file.

Ordering

A single JavaScript file's statistics must be ordered by step ('ORIG', then 1 then 2 ...) and all its lines must exist before the statistic lines for another file's. For example:

validate_form	max	validate_form	158603	js_uncompressed\	js_maxc\	compression_vfmax.log
validate_form	max	1	ELIM_MLCS	73949	Eliminated all comments.
validate_form	max	2	ELIM_XCSTDs	72913	Eliminated my personal sanity checks.
validate_form	max	3	ELIM_XCMAXs	57409	Eliminated error checking.
validate_form	max	4	SPC_X_SPC	40099	Eliminated unneeded spaces.
validate_form	max	5	NL_X_NL	32666	Eliminated unneeded line breaks.
validate_form	max	6	IDENTS_RPLCD	26682	Replaced all identifiers with one/two character tokens.
vf_dbgVF	stdmax	vf_dbgVF	4085	js_uncompressed\	js_stdc\	compression_dbg.log
vf_dbgVF	stdmax	1	ELIM_COMMENTS	2190	Eliminated all comments.
vf_dbgVF	stdmax	2	SPC_X_SPC	2032	Eliminated unneeded spaces.
vf_dbgVF	stdmax	3	NL_X_NL	1747	Eliminated unneeded line breaks.
vf_dbgVF	stdmax	4	IDENTS_RPLCD	1295	Eliminated unneeded line breaks.
vf_stASIF	max	vf_stASIF	5545	js_uncompressed\	js_maxc\	compression_stasifmax.log
vf_stASIF	max	1	ELIM_MLCs	3833	Eliminated multi-line comments.
vf_stASIF	max	2	ELIM_XCMAXs	2290	Eliminated error checking.
vf_stASIF	max	3	ELIM_SLCs	979	Eliminated single-line comments.
vf_stASIF	max	4	SPC_X_SPC	926	Eliminated unneeded spaces.
vf_stASIF	max	5	NL_X_NL	678	Eliminated unneeded line breaks.
vf_stASIF	max	6	IDENTS_RPLCD	490	Replaced all identifiers with one/two character tokens.


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
VWJSCStatistics()
          Create a VWJSCStatistics.
VWJSCStatistics(ForLineRetrieval flr_tabDelimData)
          Create a VWJSCStatistics.
VWJSCStatistics(Vector v_ector)
          Create a VWJSCStatistics.
 
Method Summary
 void addJSCStatistics(JSCStatistics jsc_statistics)
          Add a JSCStatistics.
 void addJSCXtraInfo(sb_sb_c[] asbsbc_configVars, String s_defaultCLevel)
          Add the JSCXtraInfo to each existing JSCStatistics.
 void addJSCXtraInfo(sb_sb_c[] asbsbc_configVars, String s_defaultCLevel, Outputter optr_dbg)
          Add the JSCXtraInfo to each existing JSCStatistics.
 boolean doesJSCSExist(String s_jsNoPostUncmprsd, String s_cLevel)
          Does the given name-plus-clevel represent an existing JSCStatistics?.
 int getIdxOfJSCS(String s_jsNoPostUncmprsd, String s_cLevel)
          Get the array index of the JSCStatistics having the provided name.
 JSCStatistics getJSCStatistics(int i_dx)
          Get the JSCStatistics at an index.
 JSCStatistics getJSCStatistics(String s_jsNoPostUncmprsd, String s_cLevel)
          Get the JSCStatistics having the provided name and compression level.
 int getJSCStatsIdx(String s_jsNoPostUncmprsd, String s_cLevel)
          Get the array index at which the desired JSCStatistics exists.
static void main(String[] as_cmdLineParams)
          Command-line interface for writeStatDocs().
 void writeStatDocs(ForLineRetrieval flr_mainTemplate, ForLineRetrieval flr_tocRow, ForLineRetrieval flr_bodySection, ForLineRetrieval flr_cStepRow, String s_rUrlToBldBase, String s_rUrlLogDir, String s_rUrlStepDir, int i_chopDec, OWriter ow_output)
          Write html documentation representing the statistics currently represented by the JSCStatistics held by this VWJSCStatistics.
 void writeStatDocs(ForLineRetrieval flr_mainTemplate, ForLineRetrieval flr_tocRow, ForLineRetrieval flr_bodySection, ForLineRetrieval flr_cStepRow, String s_rUrlToBldBase, String s_rUrlLogDir, String s_rUrlStepDir, int i_chopDec, OWriter ow_output, Outputter optr_dbg)
          Write html documentation representing the statistics currently represented by the JSCStatistics held by this VWJSCStatistics.
 
Methods inherited from class xbn.array.VWObject
add, addAPObject, addArray, clone, getAOObject, getObject, getString, getVWIClone, isNull
 
Methods inherited from class xbn.array.VectorWrapper
doAddInOrder, elementAt, getList, getOrderDirAscDesc, getVector, initializeVector, size
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VWJSCStatistics

public VWJSCStatistics()

Create a VWJSCStatistics.

First line calls VWObject()


VWJSCStatistics

public VWJSCStatistics(ForLineRetrieval flr_tabDelimData)

Create a VWJSCStatistics.

This first calls VWObject()

Parameters:
flr_tabDelimData - Represents the text of the tab-delimited data file. Must represent an existing, readable, populated and properly formatted JSCStatistics tab-delimited data file.

VWJSCStatistics

public VWJSCStatistics(Vector v_ector)

Create a VWJSCStatistics.

Equal to VWObject(v_ector)

Method Detail

getJSCStatistics

public final JSCStatistics getJSCStatistics(int i_dx)

Get the JSCStatistics at an index.

Returns:
(JSCStatistics)[VWObject].getObject(i_dx)


addJSCStatistics

public final void addJSCStatistics(JSCStatistics jsc_statistics)

Add a JSCStatistics.

Equal to [VWObject].add(jsc_statistics)


getJSCStatsIdx

public final int getJSCStatsIdx(String s_jsNoPostUncmprsd,
                                String s_cLevel)

Get the array index at which the desired JSCStatistics exists.

Parameters:
s_jsNoPostUncmprsd - The name of the JavaScript file (minus the '.js' postfix) before it was compressed. See JSCStatistics.getJSNoPostUncmprsd.
s_cLevel - The compression level for the JavaScript file.
Returns:
The array index at which the JSCStatistics, having this s_jsNoPostUncmprsd and s_cLevel, exists.
-1 If no existing JSCStatistics has the provided s_jsNoPostUncmprsd and s_cLevel.

addJSCXtraInfo

public final void addJSCXtraInfo(sb_sb_c[] asbsbc_configVars,
                                 String s_defaultCLevel)

Add the JSCXtraInfo to each existing JSCStatistics.

Equal to addJSCXtraInfo(asbsbc_configVars, s_defaultCLevel, (new Outputter()))


addJSCXtraInfo

public final void addJSCXtraInfo(sb_sb_c[] asbsbc_configVars,
                                 String s_defaultCLevel,
                                 Outputter optr_dbg)

Add the JSCXtraInfo to each existing JSCStatistics. See JSCStatistics.setJSCXtraInfo.

[PARAMETER DOCUMENTATION]

JSCXtraInfo configuration text

There are three sets of variables in the configuration text, one for each JSCXtraInfo constructor parameter:

Rules:

Example

Tab-delimited data file

This is the same tab-delimited data file as exists under 'Ordering' in the tddf format documentation section:

validate_form	max	validate_form	158603	js_uncompressed/	js_maxc/	compression_vfmax.log
validate_form	max	1	ELIM_MLCS	73949	Eliminated all comments.
validate_form	max	2	ELIM_XCSTDs	72913	Eliminated my personal sanity checks.
validate_form	max	3	ELIM_XCMAXs	57409	Eliminated error checking.
validate_form	max	4	SPC_X_SPC	40099	Eliminated unneeded spaces.
validate_form	max	5	NL_X_NL	32666	Eliminated unneeded line breaks.
validate_form	max	6	IDENTS_RPLCD	26682	Replaced all identifiers with one/two character tokens.
vf_dbgVF	stdmax	vf_dbgVF	4085	js_uncompressed/	js_stdc/	compression_dbg.log
vf_dbgVF	stdmax	1	ELIM_COMMENTS	2190	Eliminated all comments.
vf_dbgVF	stdmax	2	SPC_X_SPC	2032	Eliminated unneeded spaces.
vf_dbgVF	stdmax	3	NL_X_NL	1747	Eliminated unneeded line breaks.
vf_dbgVF	stdmax	4	IDENTS_RPLCD	1295	Eliminated unneeded line breaks.
vf_stASIF	max	vf_stASIF	5545	js_uncompressed/	js_maxc/	compression_stasifmax.log
vf_stASIF	max	1	ELIM_MLCs	3833	Eliminated multi-line comments.
vf_stASIF	max	2	ELIM_XCMAXs	2290	Eliminated error checking.
vf_stASIF	max	3	ELIM_SLCs	979	Eliminated single-line comments.
vf_stASIF	max	4	SPC_X_SPC	926	Eliminated unneeded spaces.
vf_stASIF	max	5	NL_X_NL	678	Eliminated unneeded line breaks.
vf_stASIF	max	6	IDENTS_RPLCD	490	Replaced all identifiers with one/two character tokens.

Compression configuration text

Section:  The description, line one
   dl1_validate_form_max^
      Maximum compression, with <I>no</I> error-checking.  Use this when minimal client download is critical.
   dl1_vf_stASIF_max^
      Maximum compression, with no error-checking.
   dl1_vf_dbgVF^
      Standard compression, with full error-checking.
   
Section:  The rest of the description
   dr_validate_form_max^
      <P>Line two...</P>
      <P>Line three...</P>
   dr_vf_stASIF_max^
   dr_vf_dbgVF^
   
Section:  When downloaded
   wd_validate_form_max^
      <I>Core functionality.</I>  Always downloaded (when importing from <CODE>js_maxc/</CODE>).
   wd_vf_stASIF_max^
      When the <CODE><A HREF="javascript/validate_form.html">validate_form</A>.<A HREF="javascript/validate_form.html#loadVF">loadVF</A>()</CODE> parameter <CODE>s_sifCfgUrl</CODE>, as provided by you, is defined.
   wd_vf_dbgVF ^ When you <B>activate</B> it.

Code

Assume the tddf is in
   "C:\vwjscs_test\tddf.txt"
and the compression configuration text is in
   "C:\vwjscs_test\cconfig.txt"

import xbn.array.VWObject;
import jsutil.compress.VWJSCStatistics;

import xbn.config.*;
import xbn.output.OSysDotOut;
import xbn.placeholder.sb_sb_c;
import xbn.util.FLRFile;

public class VWJSCSTest  {
   public static final void main(String[] as_cmdLineParams)  {
      VWJSCStatistics vwjscs = new VWJSCStatistics(new new FLRFile("C:\\vwjscs_test\\tddf.txt"));

      for(int i = 0; i < vwjscs.getVector().size(); i++)  {
         System.out.println(vwjscs.getJSCStatistics(i).getReport() + "\n\n\n");
      }

      OSysDotOut osdo = new OSysDotOut();
      ConfigReader cr = new ConfigReader();
      VWObject vwo = null;
      try  {
         vwo = cr.getVWObject(
            new FLRFile("C:\\vwjscs_test\\cconfig.txt"),
            new CRConfig(
               new CRCDelimiters(new char[]{'^'}, ''),
               new CRCVariable(false)),
            osdo);
      }  catch(ConfigFormatException cfx)  {
         throw new NullPointerException("ERROR while attempting to read in config-file: " + cfx.toString());
      }

      sb_sb_c[] aSbSbC = (new UtilConfig()).getAOsb_sb_c(vwo);

      vwjscs.addJSCXtraInfo(aSbSbC, "stdmax", osdo);
   }
}

The output

[c:\vwjscs_test]java VWJSCSTest
Uncompressed:  js_uncompressed\validate_form.js
Compressed:    js_maxc\validate_form.js
Log:           compression_vfmax.log
Compress lvl:  max

Step Name     BYTES    FrmO   %O     %Oi       FrmP  %P     %Pi
-----------------------------------------------------------------------------
              15860
ELIM_MLCS     73949    84654  46.625 53.374    84654 46.625 53.374
ELIM_XCSTDs   72913    85690  45.972 54.027    1036  98.599 1.4009
ELIM_XCMAXs   57409    101194 36.196 63.803    15504 78.736 21.263
SPC_X_SPC     40099    118504 25.282 74.717    17310 69.847 30.152
NL_X_NL       32666    125937 20.596 79.403    7433  81.463 18.536
IDENTS_RPLCD  26682    131921 16.823 83.176    5984  81.681 18.318



Uncompressed:  js_uncompressed\vf_dbgVF.js
Compressed:    js_stdc\vf_dbgVF.js
Log:           compression_dbg.log
Compress lvl:  stdmax

Step Name      BYTE    FrmO %O     %Oi       FrmP %P     %Pi
-----------------------------------------------------------------------------
               4085
ELIM_COMMENTS  2190    1895 53.610 46.389    1895 53.610 46.389
SPC_X_SPC      2032    2053 49.742 50.257    158  92.785 7.2146
NL_X_NL        1747    2338 42.766 57.233    285  85.974 14.025
IDENTS_RPLCD   1295    2790 31.701 68.298    452  74.127 25.872



Uncompressed:  js_uncompressed\vf_stASIF.js
Compressed:    js_maxc\vf_stASIF.js
Log:           compression_stasifmax.log
Compress lvl:  max

Step Name     BYTE    FrmO %O     %Oi       FrmP %P     %Pi
-----------------------------------------------------------------------------
              5545
ELIM_MLCs     3833    1712 69.125 30.874    1712 69.125 30.874
ELIM_XCMAXs   2290    3255 41.298 58.701    1543 59.744 40.255
ELIM_SLCs     979     4566 17.655 82.344    1311 42.751 57.248
SPC_X_SPC     926     4619 16.699 83.300    53   94.586 5.4136
NL_X_NL       678     4867 12.227 87.772    248  73.218 26.781
IDENTS_RPLCD  490     5055 8.8367 91.163    188  72.271 27.728



LINE 2 [delim=^]:  '   dl1_validate_form_max'
LINE 4 [delim=^]:  '   dl1_vf_stASIF_max'
LINE 6 [delim=^]:  '   dl1_vf_dbgVF'
LINE 10 [delim=^]:  '   dr_validate_form_max'
LINE 11 [delim=^]:  '   dr_vf_stASIF_max'
LINE 12 [delim=^]:  '   dr_vf_dbgVF'
LINE 15 [delim=^]:  '   wd_validate_form_max'
LINE 17 [delim=^]:  '   wd_vf_stASIF_max'
LINE 19 [delim=^]:  '   wd_vf_dbgVF'
addJSCXtraInfo...START
   Original order of JSCStatistics:
      0:  validate_form_max
      1:  vf_dbgVF_stdmax
      2:  vf_stASIF_max
   All c-levels:  ['max', 'stdmax']
   Ordered, with config vars:
      validate_form_max  [0]
            dl1_  [Maximum compression, with <I>no</I> erro...]
            dr_   [<P>Line two...</P>\r\n<P>Line three...</...]
            wd_   [<I>Core functionality.</I>  Always downl...]
      vf_stASIF_max  [1]
            dl1_  [Maximum compression, with no error-check...]
            dr_   []
            wd_   [When the <CODE><A HREF="javascript/valid...]
      vf_dbgVF_stdmax  [2]
            dl1_  [Standard compression, with full error-ch...]
            dr_   []
            wd_   [When you <B>activate</B> it.]
addJSCXtraInfo...END

[c:\vwjscs_test]


BACK     addJSCXtraInfo(): Parameter documentation

Parameters:
asbsbc_configVars - The config-variables, as returned by ConfigReader.getVWObject, or created by you. Must conform to the above restrictions, and no name (sb_sb_c[idx].sb1) or value (sb_sb_c[idx].sb2) may be null.
s_defaultCLevel - The default compression-level. When non-null, this c-level must equal the c-level of an actually-existing JSCStatistics. When non-null, it is assumed, when no [_clevel] postfix exists in the config-variable name, that this is the c-level for it. When null, every config-variable name must have a [_clevel] postfix.
optr_dbg - The Outputter to use for debugging output. May not be null.

getJSCStatistics

public final JSCStatistics getJSCStatistics(String s_jsNoPostUncmprsd,
                                            String s_cLevel)

Get the JSCStatistics having the provided name and compression level.

Parameters:
s_jsNoPostUncmprsd - The name of the JavaScript file (minus the '.js' postfix) before it was compressed. See JSCStatistics.getJSNoPostUncmprsd.
s_cLevel - The compression level for the JavaScript file.
Throws:
AssertException - If no existing JSCStatistics has the provided s_jsNoPostUncmprsd and s_cLevel.

doesJSCSExist

public final boolean doesJSCSExist(String s_jsNoPostUncmprsd,
                                   String s_cLevel)

Does the given name-plus-clevel represent an existing JSCStatistics?.

Returns:
(getIdxOfJSCS(s_jsNoPostUncmprsd, s_cLevel) != -1)

getIdxOfJSCS

public final int getIdxOfJSCS(String s_jsNoPostUncmprsd,
                              String s_cLevel)

Get the array index of the JSCStatistics having the provided name.

Returns:
The array index of the (first) JSCStatistics where isNameEqual(s_jsNoPostUncmprsd, s_cLevel) equals true.
-1 if no existing JSCStatistics has this name.

writeStatDocs

public void writeStatDocs(ForLineRetrieval flr_mainTemplate,
                          ForLineRetrieval flr_tocRow,
                          ForLineRetrieval flr_bodySection,
                          ForLineRetrieval flr_cStepRow,
                          String s_rUrlToBldBase,
                          String s_rUrlLogDir,
                          String s_rUrlStepDir,
                          int i_chopDec,
                          OWriter ow_output)

Write html documentation representing the statistics currently represented by the JSCStatistics held by this VWJSCStatistics.

Equal to writeStatDocs(flr_mainTemplate, flr_tocRow, flr_bodySection, flr_cStepRow, s_rUrlToBldBase, s_rUrlLogDir, s_rUrlLogDir, ow_output, (new Outputter()))


writeStatDocs

public void writeStatDocs(ForLineRetrieval flr_mainTemplate,
                          ForLineRetrieval flr_tocRow,
                          ForLineRetrieval flr_bodySection,
                          ForLineRetrieval flr_cStepRow,
                          String s_rUrlToBldBase,
                          String s_rUrlLogDir,
                          String s_rUrlStepDir,
                          int i_chopDec,
                          OWriter ow_output,
                          Outputter optr_dbg)

Write html documentation representing the statistics currently represented by the JSCStatistics held by this VWJSCStatistics.

Abbreviations for below

JSCStatistics jscs = getJSCStatistics([idx]);
JSCXtraInfo jscxi = jscs.getJSCXtraInfo();
int iIdxLastJSCS = (getVector().size() - 1);

Notes for all flr_* (Template) parameters

  • No extra or missing gaps are allowed.
  • All gap names must be surrounded by ~G~ and ~EG~. For example:
       ~G~total_bytes_original~EG~
  • To display the tilde character ('~') literally, use '\~'.
  • Every percentage value (jscs.getByteSizePrctg*()) is sent through a Double, translated to a string, and then chopped to i_chopDec characters. For example:
       [PadChopString].get(new Double(jscs.getByteSizeImprv(j, (j - 1))).toString())

 

Parameters:
flr_mainTemplate - Points to the source text for the 'main' Template. May not be null, and must contain the following unique gaps:

Gap Filled with Notes
rurl_build_base s_rUrlToBldBase. Must be the first unique gap. For linking to other things within your project, without having to manually change the link when the output file is moved.
all_toc_items Filled with multiple-and-appended results of the flr_tocRow Template. Must be singular, and must be the second unique gap in the file.
total_bytes_original The total bytes of every JavaScript file, before compression.  
total_bytes_compressed The total bytes of every JavaScript file, after compression.  
avg_bytes_original The average bytes of every JavaScript file, before compression.  
avg_bytes_compressed The average bytes of every JavaScript file, after compression.  
avg_prctg_of_orig (avg_bytes_original / avg_bytes_compressed) * 100  
average_improvement (100 - avg_prctg_of_orig)  
all_body_items Filled with multiple-and-appended results of the flr_bodySection Template. Must be singular, and must be the last unique gap in the file.

flr_tocRow - Points to the source text for the Template representing every table of contents row. This Template is duplicated and appended together, all of which is filled into the flr_mainTemplate-s all_toc_items gap. May not be null, and must contain the following unique gaps:

Gap Filled with Notes
rurl_dir_bld_to_cmprsd jscs.getRUrlDirBld2Cmprsd()  
js_no_post_cmprsd jscs.getJSNoPostCmprsd()  
compression_level jscs.getCLevel()  
when_downloaded jscxi.getWhenDwnldd()  
original_bytes jscs.getJSCStep(0).getByteSize()  
compressed_bytes jscs.getJSCStep(iIdxLastJSCS).getByteSize()  
percentage_improved jscs.getByteSizePrctgImprv(iIdxLastJSCS, 0)  
percentage_of_original jscs.getByteSizePrctgOf(iIdxLastJSCS, 0)  
jsc_summary jscxi.getDescLine1()  

flr_bodySection - Points to the source text for the Template representing the main section for each compression process. This Template is duplicated and appended together, all of which is filled into the flr_mainTemplate-s all_body_items gap. May not be null, and must contain the following unique gaps:

Gap Filled with Notes
rurl_build_base s_rUrlToBldBase. For linking to other things within your project, without having to manually change the link when the output file is moved.
rurl_dir_bld_to_cmprsd jscs.getRUrlDirBld2Cmprsd()  
js_no_post_cmprsd jscs.getJSNoPostCmprsd()  
compression_level jscs.getCLevel()  
rurl_dir_bld_to_uncmprsd jscs.getRUrlDirBld2Uncmprsd()  
js_no_post_uncmprsd jscs.getJSNoPostUncmprsd()  
log_url s_rUrlLogDir + jscs.getCLog()  
when_downloaded jscxi.getWhenDwnldd()  
original_bytes jscs.getJSCStep(0).getByteSize()  
jsc_desc_line_one jscxi.getDescLine1()  
jsc_desc_the_rest jscxi.getDescTheRest()  
all_step_rows Filled with multiple-and-appended results of the flr_cStepRow Template. Must be singular, and must be the last unique gap in the file.

flr_cStepRow - Points to the source text for the Template representing every step (except the original) in the compression process. This Template is duplicated and appended together, all of which is filled into the flr_bodySection Template's all_step_rows gap. May not be null, and must contain the following unique gaps:

Gap Filled with Notes
step_source_url For rows (and step indexes) 1 through the second-to-last:
   s_rUrlStepDir + "zc_" + jscs.getJSNoPostCmprsd() + "_" + jscs.getCLevel() + "_" + idx + "_" + jscs.getJSCStep(idx).getName() + ".js"
For the final step:
   s_rUrlToBldBase + jscs.getRUrlDirBld2Cmprsd() + jscs.getJSNoPostCmprsd() + ".js"
 
index 1..(jscs.getVector().size() - 1)  
byte_count jscs.getJSCStep(idx).getByteSize()  
bytes_since_orig jscs.getByteSizeImprv(idx, 0)  
bytes_prctg_of_orig jscs.getByteSizePrctgOf(idx, 0)  
bytes_prctg_imprv_over_orig jscs.getByteSizePrctgImprv(idx, 0)  
bytes_since_prev jscs.getByteSizePrctgImprv(idx, (idx - 1))  
bytes_prctg_of_prev jscs.getByteSizePrctgOf(idx, (idx - 1))  
bytes_prctg_imprv_over_prev jscs.getByteSizePrctgImprv(idx, (idx - 1))  
description jscs.getJSCStep(idx).getDescHtml()  

s_rUrlToBldBase - The relative link to the build base directory. Used to partially fill all gaps in which jscs.getRUrlDirBld2Uncmprsd or jscs.getRUrlDirBld2Cmprsd is used. May not be null or zero characters in length, and must end with a url slash ('/').
s_rUrlLogDir - The relative link to the compression-log directory, in which the overall compression logs exist. Used to partially fill the gap named step_source_url, in the flr_cStepRow Template. May not be null or zero characters in length, and must end with a url slash ('/').
s_rUrlStepDir - The relative link to the compression-step directory, in which the overall compression logs exist. Used to partially fill the gap named log_url, in the flr_bodySection Template. May not be null or zero characters in length, and must end with a url slash ('/').
i_chopDec - As in JSCStatistics.getReport, this is the chop number for decimals/percentages. Same restrictions as in getReport. This function only chops, where getReport, because it is text only, also pads.
optr_output - The OWriter for this function's final output. May not be null. For example,
   new OWFile("C:\\my_web_pages\\compression.html", false)
optr_dbg - The Outputter to use for debugging output. May not be null.
Throws:
AssertException - If getVector().size() equals zero, or addJSCXtraInfo was not called.

main

public static final void main(String[] as_cmdLineParams)

Command-line interface for writeStatDocs(). See writeStatDocs()

Command line parameters

  What Rqd Provided to... ...as How cmd-line value is translated to function parameter
tddf File path to the tab-delimited data file X constructor flr_tabDelimData new VWJSCStatistics(new FLRFile(value))
ccfg File path to the compression configuration file. X addJSCXtraInfo asbsbc_configVars Uses the example code, including comment and variable delimiters, as documented in addJSCXtraInfo
dfltclvl The default compression level.   addJSCXtraInfo s_defaultCLevel When provided:
   [As provided]
When not provided:
   null
tmplmain File path for main Template X writeStatDocs flr_mainTemplate new FLRFile(value)
tmpltoc File path for table-of-contents-row Template X writeStatDocs flr_tocRow new FLRFile(value)
tmplbody File path for body-section Template X writeStatDocs flr_bodySection new FLRFile(value)
tmplstep File path for body-compression-step Template X writeStatDocs flr_cStepRow new FLRFile(value)
bldbase The relative url to the build base. X writeStatDocs s_rUrlToBldBase [As provided]
rurllogdir The relative url from s_rUrlToBldBase to the compression-log directory. X writeStatDocs s_rUrlLogDir [As provided]
rurlstepdir The relative url from s_rUrlToBldBase to the step-log directory.   writeStatDocs s_rUrlStepDir When provided:
   [As provided]
When not provided:
   set to equal s_rUrlLogDir
chopdec The chop-length for decimal numbers/percentages. X writeStatDocs i_chopDec [As provided]
destfile The full path and name of the final destination html file. X writeStatDocs ow_output new OWFile(value, false)
dbg Should debugging be written to screen?   writeStatDocs optr_dbg When provided
   new OSysDotOut()
When not provided:
   new Outputter()

Example

Assumes the same example data as documented in writeStatDocs().

Assume these Templates exist in C:\vwjscs_test\):

Call this:

  • java jsutil.compress.VWJSCStatistics -tddf C:\vwjscs_test\tddf.txt -ccfg C:\vwjscs_test\cconfig.txt -dfltclvl stdmax -tmplmain C:\vwjscs_test\compression.html -tmpltoc C:\vwjscs_test\toc_item.tmpl -tmplbody C:\vwjscs_test\body.tmpl -tmplstep C:\vwjscs_test\body_step_row.tmpl -bldbase ../ -rurllogdir log/ -rurlstepdir documentation/log/ -chopdec 8 -destfile C:\vwjscs_test\output\compression.html -dbg > C:\vwjscs_test\output\stat_docs.log

Here's the resulting output and log. Realistic output can be seen in the validate_form.js project.




Copyright 2003-2005, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/jsutiljava

 

SourceForge.net Logo