FUNCTION acyclic_mapped_representation

(* SCHEMA representation_schema; *)
  FUNCTION acyclic_mapped_representation
    (parent_set   : SET OF representation;
     children_set : SET OF representation_item) : BOOLEAN;
    LOCAL
      x,y : SET OF representation_item;
    END_LOCAL;
    -- Determine the subset of children_set that are mapped_items
    x := QUERY(z <* children_set | 'REPRESENTATION_SCHEMA.MAPPED_ITEM'
      IN TYPEOF(z));
    -- Determine that the subset has elements
    IF SIZEOF(x) > 0 THEN
      -- Check each element of the set
      REPEAT i := 1 TO HIINDEX(x);
        -- If the selected element maps a representation in the
        -- parent_set, then return false
        IF x[i]\mapped_item.mapping_source.mapped_representation
          IN parent_set THEN
          RETURN (FALSE);
        END_IF;
        -- Recursive check of the items of mapped_representation
        IF NOT acyclic_mapped_representation
          (parent_set +
          x[i]\mapped_item.mapping_source.mapped_representation,
          x[i]\mapped_item.mapping_source.mapped_representation.items) THEN
          RETURN (FALSE);
        END_IF;
      END_REPEAT;
    END_IF;
    -- Determine the subset of children_set that are not
    -- mapped_items
    x := children_set - x;
    -- Determine that the subset has elements
    IF SIZEOF(x) > 0 THEN
      -- For each element of the set:
      REPEAT i := 1 TO HIINDEX(x);
        -- Determine the set of representation_items referenced
        y := QUERY(z <* bag_to_set( USEDIN(x[i], '')) |
             'REPRESENTATION_SCHEMA.REPRESENTATION_ITEM' IN TYPEOF(z));
        -- Recursively check for an offending mapped_item
        -- Return false for any errors encountered
        IF NOT acyclic_mapped_representation(parent_set, y) THEN
          RETURN (FALSE);
        END_IF;
      END_REPEAT;
    END_IF;
    -- Return true when all elements are checked and
    -- no error conditions found
    RETURN (TRUE);
  END_FUNCTION;

Referenced By

Defintion acyclic_mapped_representation is references by the following definitions:
DefinitionType
 mapped_item ENTITY


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2012-03-27T17:13:58-04:00