Package jline.api.sn
Class SnContractValidate
java.lang.Object
jline.api.sn.SnContractValidate
Checks a
NetworkStruct against its contract, SnContract: the JAR twin of MATLAB's
sn_validate.
Four kinds of violation are reported, one string each: a required field is missing, a field is not in the contract at all (a misspelled or undeclared field), a value has a type the contract does not admit, and a non-empty value has a shape none of the field's shapes admits. A null value is an empty one and is not checked further.
The check runs on a name-to-value snapshot of the struct (snapshot(jline.lang.NetworkStruct)), so a test can drop or
inject a field exactly as the MATLAB test does with rmfield. Network.getStruct runs it once per
rebuild at VerboseLevel.DEBUG or with LINE_VALIDATE_SN=1, and warns.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue when the session asks getStruct to validate: debug verbosity or LINE_VALIDATE_SN=1.Every instance field of the struct, by its JAR name, in declaration order.The violations of a snapshot; witherrortrue, raises LINE:internal:Contract on any.The violations of a struct, empty when it conforms.validate(NetworkStruct sn, boolean error) Asvalidate(NetworkStruct); witherrortrue, raises LINE:internal:Contract instead.
-
Method Details
-
requested
public static boolean requested()True when the session asks getStruct to validate: debug verbosity or LINE_VALIDATE_SN=1. -
snapshot
Every instance field of the struct, by its JAR name, in declaration order. -
validate
The violations of a struct, empty when it conforms. -
validate
Asvalidate(NetworkStruct); witherrortrue, raises LINE:internal:Contract instead. -
validate
The violations of a snapshot; witherrortrue, raises LINE:internal:Contract on any.
-