class HIERARCHIC_GRAPH_NODE [E -> HASHABLE]

Features exported to HIERARCHIC_GRAPH_NODE

Direct parents

conformant parents

HASHABLE

non-conformant parents

ANY, PLATFORM

Known children

conformant children

LOADED_HIERARCHIC_GRAPH_NODE

Summary

creation features

exported features

Details

make (i: E)

ensure

  • parents_count = 0
  • children_count = 0
  • item = i

make (i: E)

ensure

  • parents_count = 0
  • children_count = 0
  • item = i

item: E
max_rank: INTEGER
min_rank: INTEGER
parents: FAST_ARRAY[HIERARCHIC_GRAPH_NODE [E -> HASHABLE]]
children: FAST_ARRAY[HIERARCHIC_GRAPH_NODE [E -> HASHABLE]]
set_item (i: E)
parents_count: INTEGER
children_count: INTEGER
add_parent (node: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

require

  • node /= Void

add_child (node: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

require

  • node /= Void

remove_parent (node: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

require

  • has_parent(node)

has_parent_edge (id: INTEGER): BOOLEAN
has_child_edge (id: INTEGER): BOOLEAN
remove_child (node: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

require

  • has_child(node)

remove_parent_edge (id: INTEGER): HIERARCHIC_GRAPH_NODE [E -> HASHABLE]

Return connected node.

require

  • has_parent_edge(id)

ensure

  • not has_parent_edge(id)

restore_parent_edge (id: INTEGER, node: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

require

  • not has_parent_edge(id)
  • has_parent_edge(-1)
  • has_parent(node)
  • not node.has_child_edge(id)
  • node.has_child_edge(-1)

ensure

  • has_parent_edge(id)

remove_child_edge (id: INTEGER): HIERARCHIC_GRAPH_NODE [E -> HASHABLE]

Return connected node.

require

  • has_child_edge(id)

ensure

  • not has_child_edge(id)

restore_child_edge (id: INTEGER, node: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

require

  • not has_child_edge(id)
  • has_child_edge(-1)
  • has_child(node)
  • not node.has_parent_edge(id)
  • node.has_parent_edge(-1)

ensure

  • has_child_edge(id)

deep_reset_edges

Set edge identifiers with values starting from 0.

parent (i: INTEGER): HIERARCHIC_GRAPH_NODE [E -> HASHABLE]

require

  • i.in_range(1, parents_count)

child (i: INTEGER): HIERARCHIC_GRAPH_NODE [E -> HASHABLE]

require

  • i.in_range(1, children_count)

has_parent (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE]): BOOLEAN

ensure

  • Result = other.has_child(Current)

has_child (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE]): BOOLEAN

ensure

  • Result = other.has_parent(Current)

parent_edge (i: INTEGER): INTEGER

require

  • i.in_range(1, parents_count)

child_edge (i: INTEGER): INTEGER

require

  • i.in_range(1, children_count)

has_cycle: BOOLEAN
has_parent_cycle: BOOLEAN
has_children_cycle: BOOLEAN
is_toplevel: BOOLEAN

ensure

  • Result = (parents_count = 0)

is_leaf: BOOLEAN

ensure

  • Result = (children_count = 0)

is_connected_to (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE]): BOOLEAN

require

  • other /= Void

ensure

    distance (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE]): INTEGER

    require

    • other /= Void

    ensure

      set_rank

      require

      • not has_cycle

        TODO: no graph cycle

      add_connected_nodes_in (list: COLLECTION[HIERARCHIC_GRAPH_NODE[E]])

      Add in list all nodes belonging to the same graph as Current

      require

      • list /= Void

      fill_path_to (path: COLLECTION [E_][INTEGER], destination: HIERARCHIC_GRAPH_NODE [E -> HASHABLE])

      Add in path edges identifiers corresponding to a path from current node to destination node.

      require

      • is_connected_to(destination)
      • destination /= Current

      hash_code: INTEGER

      The hash-code value of Current.

      ensure

      • good_hash_value: Result >= 0

      internal_has_parent_cycle: BOOLEAN
      internal_has_children_cycle: BOOLEAN
      internal_is_connected_to (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE]): BOOLEAN

      require

      • other /= Void

      internal_unmark_parents
      internal_unmark_children
      internal_unmark_connected

      unmark parents and children

      internal_deep_reset_edges: INTEGER
      internal_deep_init_edges (use: INTEGER): INTEGER
      internal_distance (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE], pos: INTEGER, max: INTEGER): INTEGER

      Returns Maximum_integer if unaccessibility detected Returns -1 when break needed Distance from current point otherwise Warning: max length and pos are from the search start.

      require

      • max >= pos

      ensure

        clean_mark_score
        internal_set_rank
        internal_add_connected_nodes_in (list: COLLECTION[HIERARCHIC_GRAPH_NODE[E]])
        internal_fill_path_to (path: COLLECTION [E_][INTEGER], destination: HIERARCHIC_GRAPH_NODE [E -> HASHABLE], position: INTEGER): BOOLEAN
        parents_edge: FAST_ARRAY [E_][INTEGER]
        children_edge: FAST_ARRAY [E_][INTEGER]
        mark: BOOLEAN
        unmark
        set_mark
        deep_unmark_connected

        deep unmark parents and children (paths stops at unmarked nodes)

        mark_score: INTEGER
        deferred is_equal (other: HIERARCHIC_GRAPH_NODE [E -> HASHABLE]): BOOLEAN

        Is other attached to an object considered equal to current object ?

        require

        • other /= Void

        ensure

        • Result implies hash_code = other.hash_code
        • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)

        Class invariant