Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator for parameters checks the sub values un case of arrays of arrays #216

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ class RosSystemValidator extends AbstractRosSystemValidator {
}

def void CheckParameterValue (EObject expected_parameter, EObject given_parameter){

if (expected_parameter.eClass.name=="Parameter"){
expected_type = (expected_parameter as Parameter).type.eClass.name;
expected_sub_types = expected_parameter.eContents.get(0).eContents.toList
Expand Down Expand Up @@ -256,11 +255,15 @@ class RosSystemValidator extends AbstractRosSystemValidator {
if (given_parameter.class.toString.contains("ParameterSequence")){
value_sub_type = given_parameter.eContents.toList
expected_type=expected_sub_types.get(0).eClass.name
for (i=0;i<value_sub_type.length;i++){
if(!check_matched_type(expected_type,value_sub_type.get(i).eClass.name)){
error( "Element "+i+" , expected type: "+expected_type+" given type "+value_sub_type.get(i).eClass.name, null, INVALID_TYPE)
if(expected_type.contains("ParameterArrayType")){
CheckParameterValue((expected_sub_types.get(0).eContents.get(0)),(value_sub_type.get(0).eContents.get(0)))
} else {
for (i=0;i<value_sub_type.length;i++){
if (!check_matched_type(expected_type,value_sub_type.get(i).eClass.name)){
error( "Element "+i+" , expected type: "+expected_type+" given type "+value_sub_type.get(i).eClass.name, null, INVALID_TYPE)
}
}
}
}
}
else {
error( "Expect a list of elements; format { , , }", null, INVALID_LENGHT)
Expand All @@ -287,7 +290,6 @@ class RosSystemValidator extends AbstractRosSystemValidator {
error("Element expected names: "+expected_sub_names+ " instead of: "+name_given_element,null, INVALID_NAME)
info("Struct format: value { {first_element {value value_fisrt element}}, {second_element {value value_second element}}}",null, INVALID_NAME)
} else {

for (j=0;j<expected_sub_types.length;j++){
if (expected_sub_types.get(j).toString.contains("name")){
if ( ((getName(expected_sub_types.get(j).toString))==name_given_element) ){
Expand Down
Loading