![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
System related utilities. More...
Classes | |
class | ExternalProgram |
Get path of an external program. | |
Static Public Member Functions | |
static synchronized String | env (String varname) |
Get environment variable varname . More... | |
static String | indent (int level) |
get indentation string filled with spaces More... | |
static File | writeToFile (File file, String text) |
write text to file @endiliteral More... | |
static File | writeToTempFile (String text, String suffix) |
write text to temporary file More... | |
static String | readFile (File file) |
read entire file and return contents as String More... | |
static void | execAndDetach (String command) |
Execute command in a new process and detach. More... | |
static void | viewPDFFile (String filename) |
open PDF viewer More... | |
static String | whereAmI (int depth) |
get code location (like __FILE__,__LINE__ More... | |
static String | whereAmI () |
get code location (like __FILE__,__LINE__ More... | |
static void | emacsclient (String file, int line, int column) |
open emacs client (Un*x only) (or no action otherwise) More... | |
static void | openCallersSourceInEmacs (int depth) |
open emacs whereAmI (Un*x only) More... | |
System related utilities.
Some functions require external tools. The paths of the tools can be set as envionment variables.
tool | environment variable | default path (colon-separated list) | purpose |
PDF viewer | AUD_PDFVIEWER | /usr/bin/evince | view PDF files |
GraphViz dot | AUD_DOT | /usr/bin/dot:/usr/local/bin/dot:/local/usr/bin/dot:/opt/homebrew/bin | layout and render graphs |
Emacs | AUD_EMACS | /usr/bin/emacs | editor (Un*x only) |
Emacs client | AUD_EMACSCLIENT | /usr/bin/emacsclient | editor (Un*x only) |
Notes
This is not "production code"! There are tests missing, and not all potential errors are handled. In this sense, this is "bad" code!
In particular, some functions just return null
on error and use the fact that Java checks references and would raise a NullPointerException
if return values are not checked. – Don't try this in C++! Never!
|
static |
open emacs client (Un*x only) (or no action otherwise)
Definition at line 273 of file Sys.java.
Referenced by aud.util.Sys.openCallersSourceInEmacs().
|
static |
Get environment variable varname
.
varname | variable name |
null
if undefined Definition at line 176 of file Sys.java.
Referenced by aud.util.SingleStepper.SingleStepper().
|
static |
Execute command
in a new process and detach.
Java seems unable to "really" detach processes, so we start the process within a new Java thread.
command | same as for Runtime.exec |
Definition at line 237 of file Sys.java.
Referenced by aud.util.Sys.viewPDFFile().
|
static |
get indentation string filled with spaces
Definition at line 183 of file Sys.java.
Referenced by aud.BinaryTree< T >.toTikZ().
|
static |
open emacs whereAmI
(Un*x only)
Definition at line 284 of file Sys.java.
References aud.util.Sys.emacsclient().
Referenced by aud.util.SingleStepper.showSource().
|
static |
read entire file and return contents as String
Definition at line 216 of file Sys.java.
Referenced by aud.util.DotViewer.main().
|
static |
open PDF viewer
Definition at line 255 of file Sys.java.
References aud.util.Sys.execAndDetach().
Referenced by aud.util.Graphviz.displayAsPDF().
|
static |
get code location (like __FILE__,__LINE__
Definition at line 268 of file Sys.java.
References aud.util.Sys.whereAmI().
Referenced by aud.util.Sys.whereAmI().
|
static |
get code location (like __FILE__,__LINE__
Definition at line 260 of file Sys.java.
Referenced by aud.util.SingleStepper.halt(), and aud.util.SingleStepper.whereAmI().
|
static |
write text
to file @endiliteral
Definition at line 192 of file Sys.java.
Referenced by aud.util.DotViewer.display(), and aud.util.Sys.writeToTempFile().
|
static |
write text
to temporary file
Definition at line 206 of file Sys.java.
References aud.util.Sys.writeToFile().
Referenced by aud.util.Graphviz.displayAsPDF().