codesimian.opsys.windows
Class JavaCompilerWindowsOpSys

java.lang.Object
  extended by codesimian.CS<CSGeneric>
      extended by codesimian.DefaultCS
          extended by codesimian.opsys.windows.JavaCompilerWindowsOpSys
All Implemented Interfaces:
CodeSimian

public class JavaCompilerWindowsOpSys
extends DefaultCS

JavaCompilerWindowsOpSys will probably work in most versions of Windows because it uses key combinations and program names that rarely differ between versions. But I doubt it will work in Windows Vista and other paranoid operating-systems.

returns a positive number if compiled with no errors (and outputs the Jar bytes into P(0)), else returns 0 or a negative number, and outputs the errors as a string into P(0). P(2) is, for example, a folder on a hard drive, and the folder as text ends with "/".

All constants for simulating typing on a Keyboard must be UPPERCASE. Example: JAVAC.EXE on the command-line. This error is related to caps-lock.


Nested Class Summary
static class JavaCompilerWindowsOpSys.DownloadAndInstall
          this class is not finished
 
Field Summary
protected static java.lang.String[] improbableJavaFolderSubstrings
           
protected static java.lang.String jarExeFileName
           
protected static java.lang.String javacExeFileName
           
protected static java.lang.String javaExeFileName
           
protected  int maxFoldersToSearchForJavaCompiler
          Default: 10000.
protected  double maxRelativeOutputJarBytes
          Output jar file can be at most this many times bigger than input file(s), else there must have been a compile error.
protected  double minRelativeOutputJarBytes
          Output jar file size cant be any smaller than this times input files size, else there must have been a compile error.
protected  java.lang.String outputJarFileName
           
protected static java.lang.String[] probableJavaFolderSubstrings
           
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS
 
Constructor Summary
JavaCompilerWindowsOpSys()
          Finds javac.exe and (is this the right name?) jar.exe find a temporary path to unzip files into, and unzip the files.
 
Method Summary
static double chanceFolderRecursivelyContainsJavaCompiler(java.lang.String folderName)
          Example: "C:/program files/abcsunxyz/" should return a high chance.
static java.lang.String compilerVersionOrNullIfNotCompiler(java.io.File folder)
          java compiler for Windows OS only
 java.lang.String description()
          a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for.
 double DForProxy()
          Execute this CS and cast to double.
static java.lang.String findCompilerOnHardDrive(int maxFoldersToSearch)
          a good value for maxFoldersToSearch is 10000
static boolean isCompilerFolderNameAndAtLeastCSVersion(java.lang.String folderName)
          is it a java compiler folder and a version that can compile codesimian?
static boolean isJavaCompilerAndAtLeastVersion(java.io.File compilerFolder, java.lang.String minVersion)
           
 java.lang.String keyword()
          For the CodeSimian language as a String.
CodeSimian language keyword, like "+" "*" "max" ">" etc.

Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add.

Some CSs might never be intended to be used in the language by their keyword.
The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()".
 int minP()
          For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.
 
Methods inherited from class codesimian.DefaultCS
B, C, countP, decrementMyFuel, deleteP, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, LForProxy, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setPType, setS, setZ, start, toString, V, Z
 
Methods inherited from class codesimian.CS
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, JForProxy, L, L, L, L, L, maxD, maxP, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

javacExeFileName

protected static java.lang.String javacExeFileName

jarExeFileName

protected static java.lang.String jarExeFileName

javaExeFileName

protected static java.lang.String javaExeFileName

outputJarFileName

protected java.lang.String outputJarFileName

minRelativeOutputJarBytes

protected double minRelativeOutputJarBytes
Output jar file size cant be any smaller than this times input files size, else there must have been a compile error.


maxRelativeOutputJarBytes

protected double maxRelativeOutputJarBytes
Output jar file can be at most this many times bigger than input file(s), else there must have been a compile error.


maxFoldersToSearchForJavaCompiler

protected int maxFoldersToSearchForJavaCompiler
Default: 10000. Increase this to increase the chance of finding a java compiler. Despite there being probably over 100k files, 10k should be able to find it with this semi-intelligent search.


probableJavaFolderSubstrings

protected static java.lang.String[] probableJavaFolderSubstrings

improbableJavaFolderSubstrings

protected static java.lang.String[] improbableJavaFolderSubstrings
Constructor Detail

JavaCompilerWindowsOpSys

public JavaCompilerWindowsOpSys()
                         throws GetJavaCompiler.JavaCompilerNotFoundException
Finds javac.exe and (is this the right name?) jar.exe find a temporary path to unzip files into, and unzip the files. Uses javac.exe and jar.exe to compile the files. If it does not compile right, put the error text from the compile into P(0) as a string and return 0. If it does compile right, put the Jar bytes in P(0) and return 1.

Throws:
GetJavaCompiler.JavaCompilerNotFoundException
Method Detail

keyword

public java.lang.String keyword()
Description copied from class: DefaultCS
For the CodeSimian language as a String.
CodeSimian language keyword, like "+" "*" "max" ">" etc.

Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add.

Some CSs might never be intended to be used in the language by their keyword.
The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()".
Default: Returns class name, minus package name (and its dots), and change the first letter to lowercase.

For example, CS.MaxParams does not override keyword(), which returns "maxP".

Overrides:
keyword in class DefaultCS
See Also:
CS.parent(), CS.newInstance(), CS.name()

minP

public int minP()
Description copied from class: DefaultCS
For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.

Overrides:
minP in class DefaultCS

DForProxy

public double DForProxy()
Description copied from class: CS
Execute this CS and cast to double.

D() and DForProxy() are the 2 most important functions in CS. They execute this CS. All other execute functions, by default, return DForProxy cast to their own type.

For example, J() calls the proxy which calls JForProxy() which calls DForProxy(). D() calls the proxy which calls DForProxy().

By default, all other primitive EXECUTE functions defer to D.
Functions that EXECUTE this CS: L(Class) L(int,Class,int) Z() B() C() S() I() J() F() D() V()

Specified by:
DForProxy in class DefaultCS

description

public java.lang.String description()
Description copied from class: CS
a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for. Example use: in automatically generated webpages for CodeSimian. Example: "returns sum of all params" for Add.

Overrides:
description in class DefaultCS

findCompilerOnHardDrive

public static java.lang.String findCompilerOnHardDrive(int maxFoldersToSearch)
a good value for maxFoldersToSearch is 10000


chanceFolderRecursivelyContainsJavaCompiler

public static double chanceFolderRecursivelyContainsJavaCompiler(java.lang.String folderName)
Example: "C:/program files/abcsunxyz/" should return a high chance. Does not test if it is a java compiler folder. Only predicts itself and children recursively.


isCompilerFolderNameAndAtLeastCSVersion

public static boolean isCompilerFolderNameAndAtLeastCSVersion(java.lang.String folderName)
is it a java compiler folder and a version that can compile codesimian?


isJavaCompilerAndAtLeastVersion

public static boolean isJavaCompilerAndAtLeastVersion(java.io.File compilerFolder,
                                                      java.lang.String minVersion)

compilerVersionOrNullIfNotCompiler

public static java.lang.String compilerVersionOrNullIfNotCompiler(java.io.File folder)
java compiler for Windows OS only