PreviousUpNext

15.4.779  src/lib/graph/no-exit.pkg

# no-exit.pkg
#
# These modules provide views in which all entry or exit edges
# are invisible.
#
# -- Allen Leung

# Compiled by:
#     src/lib/graph/graphs.lib

stipulate
    package odg =  oop_digraph;                                         # oop_digraph   is from   src/lib/graph/oop-digraph.pkg
herein

    api No_Entry_View {
        no_entry_view:  odg::Digraph(N,E,G) -> odg::Digraph(N,E,G);     # Here N,E,G stand stead for the types of client-package-supplied records associated with (respectively) nodes, edges and graphs.
    };
end;


stipulate
    package odg =  oop_digraph;                                         # oop_digraph   is from   src/lib/graph/oop-digraph.pkg
herein

    api No_Exit_View {
        no_exit_view:  odg::Digraph(N,E,G) -> odg::Digraph(N,E,G); 
    };
end;



stipulate
    package odg =  oop_digraph;                                         # oop_digraph   is from   src/lib/graph/oop-digraph.pkg
herein

    package   no_entry_view
    : (weak)  No_Entry_View
    {
        fun no_entry_view (odg::DIGRAPH graph)
            =
            {   fun none _ = [];
                fun unimplemented _ = raise exception odg::READ_ONLY;

                odg::DIGRAPH
                  { name            => graph.name,
                    graph_info      => graph.graph_info,
                    allot_node_id   => graph.allot_node_id,
                    add_node        => graph.add_node,
                    add_edge        => graph.add_edge,
                    remove_node     => graph.remove_node,
                    set_in_edges    => graph.set_in_edges,
                    set_out_edges   => graph.set_out_edges,
                    set_entries     => unimplemented,
                    set_exits       => graph.set_exits,
                    garbage_collect => graph.garbage_collect,
                    nodes           => graph.nodes,
                    edges           => graph.edges,
                    order           => graph.order,
                    size            => graph.size,
                    capacity        => graph.capacity,
                    out_edges       => graph.out_edges,
                    in_edges        => graph.in_edges,
                    next            => graph.next,
                    prior           => graph.prior,
                    has_edge        => graph.has_edge,
                    has_node        => graph.has_node,
                    node_info       => graph.node_info,
                    entries         => none,
                    exits           => graph.exits,
                    entry_edges     => none,
                    exit_edges      => graph.exit_edges,
                    forall_nodes    => graph.forall_nodes,
                    forall_edges    => graph.forall_edges
                  };
            };
    };
end;


stipulate
    package odg =  oop_digraph;                                         # oop_digraph   is from   src/lib/graph/oop-digraph.pkg
herein

    package   no_exit_view
    : (weak)  No_Exit_View
    {
        fun no_exit_view (odg::DIGRAPH graph)
            =
            {   fun none _ = [];
                fun unimplemented _ = raise exception odg::READ_ONLY;

                odg::DIGRAPH
                  {
                    name            => graph.name,
                    graph_info      => graph.graph_info,
                    allot_node_id   => graph.allot_node_id,
                    add_node        => graph.add_node,
                    add_edge        => graph.add_edge,
                    remove_node     => graph.remove_node,
                    set_in_edges    => graph.set_in_edges,
                    set_out_edges   => graph.set_out_edges,
                    set_entries     => graph.set_entries,
                    set_exits       => unimplemented,
                    garbage_collect => graph.garbage_collect,
                    nodes           => graph.nodes,
                    edges           => graph.edges,
                    order           => graph.order,
                    size            => graph.size,
                    capacity        => graph.capacity,
                    out_edges       => graph.out_edges,
                    in_edges        => graph.in_edges,
                    next            => graph.next,
                    prior            => graph.prior,
                    has_edge        => graph.has_edge,
                    has_node        => graph.has_node,
                    node_info       => graph.node_info,
                    entries         => graph.entries,
                    exits           => none,
                    entry_edges     => graph.entry_edges,
                    exit_edges      => none,
                    forall_nodes    => graph.forall_nodes,
                    forall_edges    => graph.forall_edges
                  };
            };
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext