private void clear() { appearance_to_subfigure.Clear(); all_subfigures.Clear(); ended_subfigures.Clear(); figure = null; representation = null; last_subfigure_id = 0; }
private IList <ISubfigure> get_occurances_of_subnode_in_graph( IFigure figure, IFigure_representation target ) { IList <ISubfigure> occurances = target.get_subfigures().Where(subnode => subnode.referenced_figure == figure ).ToList(); return(occurances); }
public void prune_exessive_links( IFigure_representation representation ) { foreach (ISubfigure base_child in representation.get_subfigures()) { var reachebles_from_base = base_child.next; IReadOnlyList <ISubfigure> reacheble_from_next = find_subfigures_reacheble_from_each_other(reachebles_from_base); remove_exsessive_connections(base_child, reacheble_from_next); } }
private IList <Stencil_mapping> map_first_nodes( IStencil stencil, IFigure_representation target ) { //get arrays of stencil's subnodes // index = figure; // value = appearances of its subfigures in the beginning of the stencil IList <IList <ISubfigure> > appearances_in_stencil = new List <IList <ISubfigure> >(); //get array of target's subnodes IList <IList <ISubfigure> > appearances_in_target = new List <IList <ISubfigure> >(); //initialise combinator int figures_qty = appearances_in_stencil.Count; // array of figures -> // array of their appearances in the stencil -> // target's subfigure onto which it's mapped var combinator_input = new List <Mapping_enumerator_requirement>(); foreach (var appearances_in_source in appearances_in_stencil) { IFigure mapped_figure = appearances_in_source.First().referenced_figure; IReadOnlyList <ISubfigure> appearances_int_target = get_appearances_of_figure_in_graph(mapped_figure, target); combinator_input.Add( //array of stencil's subfigures which need mapping new Mapping_enumerator_requirement( appearances_in_source.Count, appearances_int_target.Count ) ); } Enumerator_of_orders enumerator_of_orders = new Enumerator_of_orders( combinator_input ); //transform iterations of combinator into potential mappings foreach (var combination in enumerator_of_orders) { var test = combination; } IList <IList <ISubfigure> > subnode_occurances = get_all_subnodes_occurances(stencil, target); IList <Stencil_mapping> potential_mappings = recombine_subnodes_as_mappings(subnode_occurances); return(potential_mappings); }
private IList <Stencil_mapping> map_stencil_onto_target( IStencil stencil, IFigure_representation target ) { IList <Stencil_mapping> potential_mappings = map_first_nodes(stencil, target); for (int i_node = 1; i_node < stencil.get_subfigures().Count; i_node++) { ISubfigure subfigure = stencil.get_subfigures()[i_node]; //map_next_node(potential_mappings, subfigure, target); } return(potential_mappings); }
public IFigure create_figure_from_action_history( IReadOnlyList <IAction_group> action_groups ) { clear(); figure = figure_provider.provide_figure(figure_provider.get_next_id_for_prefix("f")) as Figure; representation = figure.create_representation(); foreach (IAction_group group in action_groups) { parce_actions_of(group); } return(figure); }
private IList <IList <ISubfigure> > get_all_subnodes_occurances( IStencil stencil, IFigure_representation target ) { IList <IList <ISubfigure> > subnode_occurances = new List <IList <ISubfigure> >(); foreach (ISubfigure subfigure in stencil.get_first_subfigures()) { IList <ISubfigure> occurances = get_occurances_of_subnode_in_graph( subfigure.referenced_figure, target ); subnode_occurances.Add(occurances); } return(subnode_occurances); }
// public static IList<IFigure> apply_stencil( // Stencil stencil, // IReadOnlyList<IAction_group> action_groups // ) { // // stencils can be only applied to the Figures. // // conversion img: conversion of Action_istory into Figure // IFigure figure = create_figure_from_action_history(action_groups); // return apply_stencil(stencil, figure); // } public IList <IFigure> apply_stencil( IStencil stencil, IFigure_representation target ) { IList <Stencil_mapping> mappings = map_stencil_onto_target(stencil, target); foreach (Stencil_mapping mapping in mappings) { IReadOnlyList <IFigure> out_figures = extract_figures_out_of_projected_stencils(mapping); } return(null); }
private IReadOnlyList <ISubfigure> get_appearances_of_figure_in_graph(IFigure figure, IFigure_representation graph) { List <ISubfigure> result = new List <ISubfigure>(); foreach (ISubfigure subfigure in graph.get_subfigures()) { if (subfigure.referenced_figure == figure) { result.Add(subfigure); } } return(result.AsReadOnly()); //return graph.get_subfigures().(ISubfigure subfigure -> subfigure.refe) }