|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.array.VectorWrapper | +--xbn.array.VWObject | +--jsutil.compress.JSCStatistics
Statistics from a JavaScript file's compression process.
Source code: JSCStatistics.java
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
JSCStatistics(String s_rUrlDirBld2Uncmprsd,
String s_rBldDirCmprsd,
String s_jsNoPost,
int i_originalBytes,
String s_cLevel,
String s_cLog)
Create a JSCStatistics . |
|
JSCStatistics(String s_rUrlDirBld2Uncmprsd,
String s_rUrlDirBld2Cmprsd,
String s_jsNoPostUncmprsd,
int i_originalBytes,
String s_jsNoPostCmprsd,
String s_cLevel,
String s_cLog)
Create a JSCStatistics . |
Method Summary | |
void |
addJSCStep(JSCStep jsc_step)
Add a JSCStep to this JSCStatistics. |
int |
getByteSizeImprv(int i_dxStepThis,
int i_dxStepPrev)
Get the number of bytes removed between two steps. |
double |
getByteSizePrctgImprv(int i_dxStepThis,
int i_dxStepPrev)
Get the number of bytes for a step, as a percentage of the bytes from a previous step. |
double |
getByteSizePrctgOf(int i_dxStepThis,
int i_dxStepPrev)
Get the number of bytes for a step, as a percentage of the bytes from a previous step. |
String |
getCLevel()
Get the name of the JavaScript file being compressed. |
String |
getCLog()
Get the name of the log file written to by this compression process. |
JSCStep |
getJSCStep(int i_dx)
Get the JSCStep at an index. |
JSCXtraInfo |
getJSCXtraInfo()
Get the JSCXtraInfo . |
String |
getJSNoPostCmprsd()
Get the name of the compressed JavaScript file. |
String |
getJSNoPostUncmprsd()
Get the name of the uncompressed JavaScript file. |
String |
getName()
Get the name of this JSCStatistics , as required by the Named interface. |
String |
getReport()
Get a text-only statistical report for this JavaScript's compression process. |
String |
getReport(int i_prctgPadChop)
Get a text-only statistical report for this JavaScript's compression process. |
String |
getRUrlDirBld2Cmprsd()
Get the relative directory (to the build directory) in which the compressed JavaScript file exists. |
String |
getRUrlDirBld2Uncmprsd()
Get the relative directory (to the build directory) in which the uncompressed JavaScript file exists. |
String |
getStepLog(int i_stepIdx,
boolean b_visible)
Get the default name of a step's output log file. |
String |
getStepLog(String s_stepName,
boolean b_visible)
Get the default name of a step's output log file. |
boolean |
isNameEqual(String s_jsNoPostUncmprsd,
String s_cLevel)
Is the name of another JSCStatistics equal to this one?. |
void |
setJSCXtraInfo(JSCXtraInfo jsc_extraInfo)
Set the JSCXtraInfo . |
String |
toString()
Get some information about this JSCStatistics . |
void |
writeFinalStep(String s_pathJS,
String s_pathJSVisible,
StringOrBuffer sob_source,
String s_stepName,
String s_stepDescHtml,
String s_pathTDDFile,
Outputter optr_log)
Write the compressed source code to its final destination, and add a final JSCStep . |
void |
writeSource(String s_pathJS,
StringOrBuffer sob_source,
boolean b_visible,
Outputter optr_log)
Write the source code to file. |
void |
writeStep(String s_jsPath,
String s_pathJSVisible,
StringOrBuffer sob_source,
String s_stepName,
String s_stepDescHtml,
Outputter optr_log)
Write a step's source, and then add it. |
void |
writeToTDDFile(String s_tddFile,
boolean b_deleteOldData)
Write this JSCStatistics to the tab-delimited data file. |
void |
writeToTDDFile(String s_tddFile,
boolean b_deleteOldData,
Outputter optr_log)
Write this JSCStatistics to the tab-delimited data file. |
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, wait, wait, wait |
Constructor Detail |
public JSCStatistics(String s_rUrlDirBld2Uncmprsd, String s_rBldDirCmprsd, String s_jsNoPost, int i_originalBytes, String s_cLevel, String s_cLog)
Create a JSCStatistics
.
Equal to JSCStatistics(s_rUrlDirBld2Uncmprsd, s_rBldDirCmprsd, s_jsNoPost, i_originalBytes, s_jsNoPost, s_cLevel, s_cLog)
public JSCStatistics(String s_rUrlDirBld2Uncmprsd, String s_rUrlDirBld2Cmprsd, String s_jsNoPostUncmprsd, int i_originalBytes, String s_jsNoPostCmprsd, String s_cLevel, String s_cLog)
Create a JSCStatistics
.
The final line in this constructor is
addStep(new JSCStep("ORIG", i_originalBytes, "The original, uncompressed file."))
s_rUrlDirBld2Uncmprsd
- The relative url, from the build directory to the one in which the uncompressed file exists. May not be null or zero characters in length, and may only contain url slashes ('/'). Must end with a url slash. See getRUrlDirBld2Uncmprsd
.s_rUrlDirBld2Cmprsd
- The relative directory in which s_jsNoPostCmprsd
exists. May not be null, zero characters in length, or contain any non-url slashes ('/'). Must end with a url slash. For the purposes of linking to this file from a web page. See getRUrlDirBld2Cmprsd
. It is expected that the final compressed result is always put in the build directory, exclusively in its own file.s_jsNoPostUncmprsd
- The name of the uncompressed JavaScript file, minus the '.js' postfix. May not be null or zero characters in length. See getJSNoPostUncmprsd
.i_originalBytes
- The byte-size of the original, uncompressed file. May not be less than 1. Obtained by getJSCStep(0).getByteSize()
.s_jsNoPostCmprsd
- The name of the compressed JavaScript file, minus the '.js' postfix. May not be null or zero characters in length. See getJSNoPostCmprsd
.s_cLevel
- The descriptive 'level' of this compression. For example, 'min', 'max', 'minmax', 'std', 'max', 'stdmax', .... May not be null or zero characters in length, and it is assumed that this contains no tab, or newline characters. See getCLevel
.s_cLog
- The name of the log file (name only, no path) to which the compression process is writing to. This is for informational purposes only, but is required regardless if the log actually exists. May not be null. See getCLog
.Method Detail |
public final String getRUrlDirBld2Uncmprsd()
Get the relative directory (to the build directory) in which the uncompressed JavaScript file exists.
s_rUrlDirBld2Uncmprsd
, exactly as provided to the constructor.public final String getRUrlDirBld2Cmprsd()
Get the relative directory (to the build directory) in which the compressed JavaScript file exists.
s_rUrlDirBld2Cmprsd
, exactly as provided to the constructor.public final String getJSNoPostUncmprsd()
Get the name of the uncompressed JavaScript file.
s_jsNoPostUncmprsd
, exactly as provided to the constructor.public final String getJSNoPostCmprsd()
Get the name of the compressed JavaScript file.
s_jsNoPostUncmprsd
, exactly as provided to the constructor.public final String getCLevel()
Get the name of the JavaScript file being compressed.
s_cLevel
, exactly as provided to the constructor.public final String getCLog()
Get the name of the log file written to by this compression process.
s_cLog
, exactly as provided to the constructor.public final JSCStep getJSCStep(int i_dx)
Get the JSCStep at an index.
(JSCStep)[VWObject].getObject(i_dx)
public final void addJSCStep(JSCStep jsc_step)
public final String getName()
Get the name of this JSCStatistics
, as required by the Named
interface. See Named
.
getName
in interface Named
getJSNoPostUncmprsd() + "_" + getCLevel()
Created once, in the constructorpublic final boolean isNameEqual(String s_jsNoPostUncmprsd, String s_cLevel)
Is the name of another JSCStatistics
equal to this one?.
getName().equals(s_jsNoPostUncmprsd + "_" + s_cLevel)
public final void setJSCXtraInfo(JSCXtraInfo jsc_extraInfo)
Set the JSCXtraInfo
.
Get with getJSCXtraInfo
.
public final JSCXtraInfo getJSCXtraInfo()
Get the JSCXtraInfo
.
Set with setJSCXtraInfo
.
public final int getByteSizeImprv(int i_dxStepThis, int i_dxStepPrev)
Get the number of bytes removed between two steps.
i_dxStepThis
- May not be be greater than i_dxStepPrev
.i_dxStepPrev
- May not be less than i_dxStepThis
.(getJSCStep(i_dxStepPrev).getByteSize() - getJSCStep(i_dxStepThis).getByteSize())
public final double getByteSizePrctgOf(int i_dxStepThis, int i_dxStepPrev)
Get the number of bytes for a step, as a percentage of the bytes from a previous step.
i_dxStepThis
- May not be be greater than i_dxStepPrev
.i_dxStepPrev
- May not be less than i_dxStepThis
.(new Double(
new Integer(
getJSCStep(i_dxStepThis).getByteSize()).toString()).doubleValue() /
new Double(
new Integer(
getJSCStep(i_dxStepPrev).getByteSize()).toString()).doubleValue() *
100)
public final double getByteSizePrctgImprv(int i_dxStepThis, int i_dxStepPrev)
Get the number of bytes for a step, as a percentage of the bytes from a previous step.
(100 - getByteSizePrctgOf(i_dxStepThis, i_dxStepPrev))
public String getStepLog(int i_stepIdx, boolean b_visible)
Get the default name of a step's output log file.
getStepLog(getJSCStep(i_stepIdx).getName(), b_visible)
public String getStepLog(String s_stepName, boolean b_visible)
Get the default name of a step's output log file.
i_stepIdx
- The index of the step whose log file name you want. Provided directly to getJSCStep
.b_visible
- Do you want the step's 'visible' log file? See writeSource
. "zc" + (b_visible?"VIZ":"") + "_" +
getJSNoPostCmprsd() + "_" +
getCLevel() + "_" +
getVector().size() + "_" + s_stepName + ".js"
public final void writeSource(String s_pathJS, StringOrBuffer sob_source, boolean b_visible, Outputter optr_log)
Write the source code to file.
s_pathJS
- The directory-plus-JavaScript-file-name (including '.js') to write to. Must point to a writeable and potentially-existing file which, if it does exists, will be overwritten.;sob_source
- The JavaScript source code to write. May not be null or less than one character in length.b_visible
- Should the source code be made visible, via [UtilString].makeVisible
? If true, yes. If false, no.optr_log
- The Outputter
through which activity in this function should be logged to. May not be null.public final void writeFinalStep(String s_pathJS, String s_pathJSVisible, StringOrBuffer sob_source, String s_stepName, String s_stepDescHtml, String s_pathTDDFile, Outputter optr_log)
Write the compressed source code to its final destination, and add a final JSCStep
.
This does three things, in order:
writeStep(s_pathJS, s_pathJSVisible, sob_source, s_stepName, s_stepDescHtml, optr_log)
writeToTDDFile(s_pathTDDFile, true, optr_log)
optr_log.(getReport(6));
It also logs the facts that it's about to call both writeToTDDFile
and getReport
.
s_pathJS
- May not be null. The final result must be written somewhere.public final void writeStep(String s_jsPath, String s_pathJSVisible, StringOrBuffer sob_source, String s_stepName, String s_stepDescHtml, Outputter optr_log)
Write a step's source, and then add it.
s_jsPath
- The path to write this step to. If null, no source is written for this step. When non-null, provided directly to writeSource
, where b_visible
is false..s_pathJSVisible
- The path to visibly-write this step to. If null, no source is visibly-written for this step. When non-null, provided directly to writeSource
, where b_visible
is true.sob_source
- As an object, this is directly provided to writeSource
. It's length is provided to the JSCStep
constructor.s_stepName
- Provided directly to the JSCStep
constructor.s_stepDescHtml
- Provided directly to the JSCStep
constructor.optr_log
- Provided directly to writeSource
, and also used here to log the call to addJSCStep
.public String getReport()
Get a text-only statistical report for this JavaScript's compression process.
getReport(6)
public String getReport(int i_prctgPadChop)
Get a text-only statistical report for this JavaScript's compression process.
For example:
Uncompressed: uncompressed/validate_form.js Compressed: maxc/validate_form.js Log: compress_vfmax.log Compress lvl: max Step Name BYTES FrmO %O %Oi FrmP %P %Pi ----------------------------------------------------------------------------- 175103 ELIM_MLC 74271 100832 42.415 57.584 100832 42.415 57.584 ELIM_XCSTD 73235 101868 41.823 58.176 1036 98.605 1.3948 ELIM_SLC 57929 117174 33.082 66.917 15306 79.100 20.899 SPC_X_SPC 52370 122733 29.908 70.091 5559 90.403 9.5962 NL_X_NL 44071 131032 25.168 74.831 8299 84.153 15.846 IDENTS_RPLCD 34925 140178 19.945 80.054 9146 79.247 20.752
i_prctgPadChop
- How many characters should the percentage numbers be padded or chopped, in order to display evenly? Provided directly to [PadChopString].getPCSConfig().setLength()
. Must not be less than two, but should not be less than three. For example, five means (assuming numbers less than 100 and greater than or equal to 10):public final void writeToTDDFile(String s_tddFile, boolean b_deleteOldData)
Write this JSCStatistics to the tab-delimited data file.
Equal to writeToTDDFile(s_tddFile, b_deleteOldData, (new Outputter()))
public final void writeToTDDFile(String s_tddFile, boolean b_deleteOldData, Outputter optr_log)
Write this JSCStatistics to the tab-delimited data file.
The format for a JSCStatistics
tab-delimited data file is documented at the top of VWJSCStatistics.
s_tddFile
- The full path and name of the tab-delimited data file.b_deleteOldData
- Should pre-existing data having this JSCStatistics' file name-plus-compression level, if it exists, be deleted from the file, before any of this processes statistics are written? If true, yes. If false, no.optr_log
- The Outputter to debug activity in this function. May not be null.public final String toString()
Get some information about this JSCStatistics
.
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2003-2005, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/jsutiljava