Package de.saar.chorus.domgraph.codec
Class CodecTools
java.lang.Object
de.saar.chorus.domgraph.codec.CodecTools
Methods that are useful in the implementation of codecs.
- Author:
- Alexander Koller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringComputes a string that is a valid Oz or Prolog atom from the argument.static voidgraphLabelsConsistencyAssertion(DomGraph graph, NodeLabels labels) Asserts that all labelled nodes in the dominance graph actually have labels.static voidremoveTopEmptyFragment(DomGraph graph, int errorcode) static StringComputes a string that is a valid Prolog variable from the argument.
-
Constructor Details
-
CodecTools
public CodecTools()
-
-
Method Details
-
atomify
Computes a string that is a valid Oz or Prolog atom from the argument. If the argument starts with a lowercase letter and all later symbols are letters, digit, or underscore, the argument itself is returned; otherwise, the argument is surrounded by quotes '...'.- Parameters:
label- a string- Returns:
- the string possibly surrounded with quotes
-
varify
Computes a string that is a valid Prolog variable from the argument. If the argument starts with an uppercase letter or an underscore, it is returned directly; otherwise, it is prefixed with an underscore.Note that the returned string will still not be a valid Prolog variable name if it contains symbols that are not valid in Prolog variable names.
- Parameters:
label- a String- Returns:
- the string, possibly prefixed with an underscore
-
graphLabelsConsistencyAssertion
Asserts that all labelled nodes in the dominance graph actually have labels. If this is not the case and assertions are enabled, then an assertion exception is thrown. This is useful in debugging codecs.- Parameters:
graph- a dominance graphlabels- a matching labels object
-
removeTopEmptyFragment
public static void removeTopEmptyFragment(DomGraph graph, int errorcode) throws MalformedDomgraphException - Throws:
MalformedDomgraphException
-