Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * generated by Xtext 2.15.0
- */
- package mars.rover.validation
- import org.eclipse.xtext.validation.Check
- import mars.rover.dSL.Mission
- import mars.rover.dSL.FindLakes
- import mars.rover.dSL.PushBricks
- /**
- * This class contains custom validation rules.
- *
- * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation
- */
- class DSLValidator extends AbstractDSLValidator {
- @Check
- def checkTimeout(Mission root) {
- val globalTimeout = root.duration.dl
- for (task: root.tasks){
- try{
- val lakeType = task.name as FindLakes
- if(lakeType !== null && lakeType instanceof FindLakes){
- if(lakeType.duration.dl > globalTimeout){
- error("FindLakes timeout cannot be greater than global timeout", null)
- }
- }
- } catch (Exception e){
- }
- try{
- val brickType = task.name as PushBricks
- if(brickType !== null && brickType instanceof PushBricks){
- if(brickType.duration.dl > globalTimeout){
- error("PushBricks timeout cannot be greater than global timeout", null)
- }
- }
- } catch (Exception e){
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement