Class QN2JAVA
Network.
Port of matlab/src/io/QN2JAVA.m. The output is the body of a static method
public static Network ex() (or only its statements when headers is false) laid out in
the same three blocks as the MATLAB generator: nodes, classes with their arrival and service
processes, and the routing matrix read from sn.rtnodes. It compiles against
jline.lang.*, jline.lang.nodes.*, jline.lang.processes.* and
jline.lang.constant.*.
Processes are written as MATLAB writes them, from their first two moments: an SCV of 1 becomes
Exp.fitMean, an SCV of at least 0.5 becomes APH.fitMeanAndSCV, a lower SCV becomes an
Erlang with round(1/SCV) phases, and a mean below GlobalConstants.CoarseTol becomes
Immediate. A trace-driven process keeps its file. So mean-value measures of the rebuilt model
equal the original's, while a non-exponential process is represented by its two-moment fit. Class
switching nodes become Routers whose switching is carried by the routing matrix, exactly as in MATLAB.
Differences from the MATLAB text, each made so the output compiles and rebuilds the same model:
distributions are instantiated with new; a number MATLAB's %f would round is printed
in full; an Erlang phase count is an integer literal; a Fork row is written with probability 1 and a
tasks-per-link other than 1 is restored through setTasksPerLink. Node types MATLAB would
silently omit (Cache, Logger, Place, Transition) are refused by name instead.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the generated method, with headers, for a model named aftermodel.getName().static StringReturns the generated method, with headers.static StringReturns the generated code;headersadds theex()method signature and return.static voidwrite(Network model, String modelName, PrintStream out) Writes the generated method, with headers, to a stream (e.g.static voidwrite(Network model, String modelName, PrintStream out, boolean headers) Writes the generated code to a stream, which is flushed but not closed.static voidWrites the generated method, with headers, to a writer.static voidWrites the generated code to a writer, which is flushed but not closed.static voidWrites the generated method, with headers, tofilename.static voidWrites the generated code tofilename, overwriting it.
-
Method Details
-
generate
Returns the generated method, with headers, for a model named aftermodel.getName(). -
generate
Returns the generated method, with headers. -
generate
Returns the generated code;headersadds theex()method signature and return. -
write
Writes the generated method, with headers, to a stream (e.g.System.out). -
write
Writes the generated code to a stream, which is flushed but not closed. -
write
Writes the generated method, with headers, to a writer. -
write
Writes the generated code to a writer, which is flushed but not closed. -
write
Writes the generated method, with headers, tofilename. -
write
Writes the generated code tofilename, overwriting it.
-