import emf; | |
import metaabm; | |
import metaabm::act; | |
import metaabm::function; | |
extension metaabm::tmpl::names; | |
extension metaabm::tmpl::types; | |
extension metaabm::tmpl::infer; | |
extension metaabm::tmpl::util; | |
context IID ERROR "ID for " + usageLabel() + " is not valid. (It must contain only alphanumeric characters and begin with a letter.)": | |
id().validateID(); | |
context IID ERROR "Label for " + usageLabel() + " is blank.": | |
label != null && label != ""; | |
context IID ERROR "ID for " + usageLabel() + " is blank": | |
id() != null && id() != "" || !id().validateID(); | |
context ARoot ERROR "Agent Root Acts cannot refer to another agent : " + usageLabel(): | |
agent == reference; | |
context AAct ERROR "Orphaned act: " + usageLabel() + ". This should not happen, please run cleanup.": | |
ARoot.isInstance(this) || AGroup.isInstance(this) || sources.size > 0; | |
context ASink ERROR "Function not defined for " + usageLabel(): | |
function != null; | |
context ASink ERROR "Unknown Function \"" + function.label + "\" for " + usageLabel(): | |
function.eContainer != null; | |
context SAttribute WARNING "Potential watch cycle for " + usageLabel() + ": "+ this.watchers().watchCycle(this).ids(): | |
this.watchers().watchCycle(this).isEmpty; | |
context AAct ERROR "Cycle Detected from " + usageLabel(): | |
!allTargets.contains(this); | |
context ASink ERROR "Circular reference for " + usageLabel() + " Input: " + allTargets.intersect(inputs.collect(i | i.value)): | |
allTargets.intersect(inputs.collect(i | i.value)).isEmpty; | |
context AAct ERROR "Selection for " + usageLabel() + " is not in path": | |
this == selected || AGroup.isInstance(this) || allSources.contains(selected); | |
context AInput ERROR "Selection for " + usageLabel() + " is not in path": | |
sink.allSources.contains(selected); | |
context AInput ERROR "Input " + usageLabel() + " has no value": | |
value != null; | |
context AInput ERROR "Selection not specified for Input " + usageLabel(): | |
selected != null || literal != null; | |
context AInput ERROR "Input " + usageLabel() + " is not in path": | |
selected == null || value == null || SAttribute.isInstance(value) || SStateValue.isInstance(value) || ALiteral.isInstance(value) || sink.allSources.contains(value); | |
context AAct ERROR "Selection not specified for " + usageLabel(): | |
AGroup.isInstance(this) || selected != null; | |
context ATransform ERROR "Destination for " + usageLabel() + " is not reachable": | |
allSources.contains(destination); | |
context ITyped ERROR "Type not specified for " + usageLabel(): | |
sType != null; | |
context ASet ERROR "Parameter not specified for " + usageLabel() : | |
parameter != null; | |
context AAccessor ERROR "Attribute not specified for " + usageLabel() : | |
attribute != null; | |
context ABuildProjection ERROR "Space not specified for " + usageLabel(): | |
projection != null; | |
//context ASelect WARNING "Space not specified for " + usageLabel() + "; assuming that search is across all agents of type": | |
// space != null || ARoot.isInstance(this) || ACreateAgents.isInstance(this) || ABuildProjection.isInstance(this); | |
context ASelect ERROR "Agent not specified for " + usageLabel(): | |
agent != null || space.metaType == SContinuousSpace || space.metaType == SGrid; | |
context ASelect ERROR "Selection refers to itself in " + usageLabel(): | |
selected != this || rootSelected == this; | |
context EObject ERROR "Required values missing for " + usageLabel() + ": " + missingNames().toString(", ") : | |
ASet.isInstance(this) || missingFeatures().size == 0; | |
context ASelect WARNING "Sorry, metaABM currently only supports selection of ONE agent": | |
for == ASelectTypes::One || for == null; | |
context AQuery WARNING "Currently, spatial queries should only be direct targets of selections. The behavior of other usages is undefined": | |
!isSpatialControl() || sources.typeSelect(ASelect).size == sources.size; | |
context SState ERROR "Default Option not specified for " + usageLabel(): | |
defaultValue != null; | |
context SAttribute ERROR "Default Value needed for " + usageLabel(): | |
!SNDimensional.isInstance(owner) || (defaultValue != null && defaultValue != "") || SAttributeArray.isInstance(this); | |
context SAttribute WARNING "Default Value not set for " + usageLabel() + ". Assuming empty value": | |
SNDimensional.isInstance(owner) || SAttributeArray.isInstance(this) || (defaultValue != ""); | |
context SNDimensional ERROR "Dimensionality of 0 for " + usageLabel() + ". A space must have dimensionality of 1 or greater" : | |
dimensionality > 0; | |
context ANetwork ERROR "Within network not specified in " + usageLabel(): | |
within != null; | |
context AMove ERROR "Agent not specified for " + usageLabel(): | |
selected.agent != null; | |
context AMove ERROR "Destination not specified for " + usageLabel(): | |
destination.space != null; | |
context AMove WARNING "Destination for " + usageLabel() + " is the same as selection, do you really want to apply the selection into itself?": | |
selected != destination; | |
context SAttribute ERROR "An attribute cannot be both derived and immutable: " + usageLabel(): | |
derived == false || immutable == false; | |
context ASet ERROR "Cannot set a derived value: " + usageLabel(): | |
attribute == null || attribute.derived == false; | |
context ASet ERROR "Cannot set an immutable value: " + usageLabel(): | |
attribute == null || attribute.immutable == false; | |
//context AMove ERROR "Destination " + destination.usageLabel() + " for " + usageLabel() + " is not a cell. (The destination agent is " + destination.agent.usageLabel() + " and the fill agent for the destination is " + ((SGrid) destination.space).builder().fillAgent.usageLabel() + ".)": | |
// destination.space.metaType != SGrid || ((SGrid) destination.space).builder().fillAgent == null || ((SGrid) destination.space).builder().fillAgent == destination.agent || !destination.controlFunctions({"toward"}).isEmpty; | |
//Too common a situation | |
//context SAttribute WARNING "No default value specified for " + usageLabel() + ". Assuming " + defaultValue(): | |
// SState.isInstance(this) || defaultValue != null; | |