Skip to content

Commit

Permalink
Renamed insts_info_struct
Browse files Browse the repository at this point in the history
  • Loading branch information
oskari1 committed Dec 12, 2023
1 parent 4d8bfdf commit 011da6c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use smt_log_parser::parsers::z3::inst_graph::EdgeType;
use material_yew::WeakComponentLink;
use super::graph::graph_container::GraphContainer;

pub struct InstsInfo {
pub struct GraphInfo {
is_expanded_node: IndexMap<NodeIndex, bool>,
selected_nodes: IndexMap<NodeIndex, InstInfo>,
selected_nodes_ref: NodeRef,
Expand All @@ -30,19 +30,19 @@ pub enum Msg {
}

#[derive(Properties, PartialEq)]
pub struct InstsInfoProps {
pub weak_link: WeakComponentLink<InstsInfo>,
pub struct GraphInfoProps {
pub weak_link: WeakComponentLink<GraphInfo>,
pub node_info: Callback<(NodeIndex, bool, Rc<Z3Parser>), InstInfo>,
pub edge_info: Callback<(EdgeIndex, bool, Rc<Z3Parser>), EdgeInfo>,
pub parser: Rc<Z3Parser>,
pub svg_text: AttrValue,
pub update_selected_nodes: Callback<Vec<InstInfo>>,
}

impl Component for InstsInfo {
impl Component for GraphInfo {
type Message = Msg;

type Properties = InstsInfoProps;
type Properties = GraphInfoProps;

fn create(ctx: &Context<Self>) -> Self {
ctx.props()
Expand Down
78 changes: 0 additions & 78 deletions axiom-profiler-GUI/src/results/insts_info.rs

This file was deleted.

3 changes: 1 addition & 2 deletions axiom-profiler-GUI/src/results/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ pub mod filters;
pub mod graph;
pub mod svg_result;
pub mod worker;
pub mod insts_info;
pub mod insts_info_struct;
pub mod graph_info;
21 changes: 6 additions & 15 deletions axiom-profiler-GUI/src/results/svg_result.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::results::insts_info_struct::{InstsInfo, Msg as InstsInfoMsg};
use crate::results::graph_info::{GraphInfo, Msg as GraphInfoMsg};

use self::colours::HSVColour;
use super::{filters::{
Expand Down Expand Up @@ -65,7 +65,7 @@ pub struct SVGResult {
inst_graph: InstGraph,
svg_text: AttrValue,
filter_chain_link: WeakComponentLink<FilterChain>,
insts_info_link: WeakComponentLink<InstsInfo>,
insts_info_link: WeakComponentLink<GraphInfo>,
graph_dim: GraphDimensions,
worker: Option<Box<dyn yew_agent::Bridge<Worker>>>,
async_graph_and_filter_chain: bool,
Expand Down Expand Up @@ -131,7 +131,7 @@ impl Component for SVGResult {
.borrow()
.clone()
.unwrap()
.send_message(InstsInfoMsg::SelectNodes(path.clone()));
.send_message(GraphInfoMsg::SelectNodes(path.clone()));
false
} else {
false
Expand All @@ -147,17 +147,8 @@ impl Component for SVGResult {
log::debug!("The current node count is {}", node_count);
self.graph_dim.node_count = node_count;
self.graph_dim.edge_count = edge_count;
let safe_to_render = edge_count <= EDGE_LIMIT || node_count <= DEFAULT_NODE_COUNT || edge_count_decreased;
// let safe_to_render = if let Some(prev_edge_count) = self.graph_dim.prev_edge_count {
// edge_count <= prev_edge_count || edge_count <= EDGE_LIMIT
// } else {
// // initially the node-count is 125 so it should be safe to render regardless of the
// // number of edges
// // we are using the fact that only initially the self.prev_edge_count is None
// true
// };
let safe_to_render = edge_count <= EDGE_LIMIT || node_count <= DEFAULT_NODE_COUNT || edge_count_decreased || node_count_decreased;
if safe_to_render || permission {

self.async_graph_and_filter_chain = false;
log::debug!("Rendering graph");
let filtered_graph = &self.inst_graph.visible_graph;
Expand Down Expand Up @@ -284,7 +275,7 @@ impl Component for SVGResult {
.borrow()
.clone()
.unwrap()
.send_message(InstsInfoMsg::DeselectAll);
.send_message(GraphInfoMsg::DeselectAll);
}
true
} else {
Expand Down Expand Up @@ -326,7 +317,7 @@ impl Component for SVGResult {
{async_graph_and_filter_chain_warning}
{node_and_edge_count_preview}
</div>
<InstsInfo
<GraphInfo
weak_link={self.insts_info_link.clone()}
node_info={self.get_node_info.clone()}
edge_info={self.get_edge_info.clone()}
Expand Down
1 change: 0 additions & 1 deletion smt-log-parser/src/parsers/z3/inst_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ impl InstGraph {
for node in self.orig_graph.node_weights_mut() {
node.visible = true;
}
self.visible_graph = self.orig_graph.clone();
}

pub fn show_neighbours(&mut self, node: NodeIndex, direction: petgraph::Direction) {
Expand Down

0 comments on commit 011da6c

Please sign in to comment.