class LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]

Features exported to ANY

Direct parents

conformant parents

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

parent_edge_load (i: INTEGER): LOAD

require

  • i.in_range(1, parents_count)

child_edge_load (i: INTEGER): LOAD

require

  • i.in_range(1, children_count)

add_parent (node: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD])

require

  • node /= Void

add_child (node: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD])

require

  • node /= Void

remove_parent (node: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD])

require

  • has_parent(node)

remove_child (node: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD])

require

  • has_child(node)

item: E
max_rank: INTEGER
min_rank: INTEGER
parents: FAST_ARRAY[LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]]
children: FAST_ARRAY[LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]]
set_item (i: E)
parents_count: INTEGER
children_count: INTEGER
has_parent_edge (id: INTEGER): BOOLEAN
has_child_edge (id: INTEGER): BOOLEAN
remove_parent_edge (id: INTEGER): LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]

Return connected node.

require

  • has_parent_edge(id)

ensure

  • not has_parent_edge(id)

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

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): LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]

Return connected node.

require

  • has_child_edge(id)

ensure

  • not has_child_edge(id)

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

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): LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]

require

  • i.in_range(1, parents_count)

child (i: INTEGER): LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]

require

  • i.in_range(1, children_count)

has_parent (other: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]): BOOLEAN

ensure

  • Result = other.has_child(Current)

has_child (other: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]): 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: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]): BOOLEAN

require

  • other /= Void

ensure

    distance (other: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]): 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: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD])

      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

      deferred is_equal (other: LOADED_HIERARCHIC_GRAPH_NODE [E -> HASHABLE, LOAD]): 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