Schema: support_resource_schema

Source : ISO 10303-41



SCHEMA support_resource_schema;


TYPE identifier = STRING;
END_TYPE;

TYPE label = STRING;
END_TYPE;

TYPE text = STRING;
END_TYPE;

FUNCTION bag_to_set
 (the_bag : BAG[0:?] OF GENERIC : intype) : SET[0:?] OF GENERIC : intype;
LOCAL
      the_set : SET OF GENERIC:intype := [];
    END_LOCAL;

    IF SIZEOF(the_bag) > 0 THEN
      REPEAT i := 1 TO HIINDEX(the_bag);
        the_set := the_set + the_bag[i];
      END_REPEAT;
    END_IF;
    RETURN (the_set);
END_FUNCTION;

FUNCTION type_check_function
 (the_type : GENERIC; sub_names : SET[0:?] OF STRING; criterion : INTEGER) : LOGICAL;
IF ((NOT EXISTS(the_type)) OR (SIZEOF(sub_names) = 0)) THEN
      RETURN (UNKNOWN);
    ELSE
      CASE criterion OF 
        0: RETURN (SIZEOF(sub_names * TYPEOF(the_type)) > 0);
        1: RETURN (SIZEOF(sub_names * TYPEOF(the_type)) = 0);
        2: RETURN (SIZEOF(sub_names * TYPEOF(the_type)) = 1);
        3: RETURN (SIZEOF(sub_names * TYPEOF(the_type)) <= 1);
        OTHERWISE : RETURN (UNKNOWN);
      END_CASE;
    END_IF;
END_FUNCTION;

END_SCHEMA;  -- support_resource_schema