1
0
mirror of https://github.com/ellmau/adf-obdd.git synced 2025-12-20 09:39:38 +01:00

Fix code formatting

This commit is contained in:
monsterkrampe 2022-09-02 12:01:35 +02:00
parent b8038dccfa
commit 3f3659a98f
No known key found for this signature in database
GPG Key ID: B8ADC1F5A5CE5057
3 changed files with 65 additions and 55 deletions

View File

@ -84,7 +84,10 @@ function App() {
helperText={( helperText={(
<> <>
For more info on the syntax, have a For more info on the syntax, have a
look <Link href="https://github.com/ellmau/adf-obdd" target="_blank" rel="noreferrer">here</Link>. look
{' '}
<Link href="https://github.com/ellmau/adf-obdd" target="_blank" rel="noreferrer">here</Link>
.
</> </>
)} )}
multiline multiline

View File

@ -20,7 +20,7 @@ G6.registerNode('nodeWithFlag', {
opacity: cfg.opacity, opacity: cfg.opacity,
}, },
name: 'rectMainLabel', name: 'rectMainLabel',
draggable: true draggable: true,
}); });
group.addShape('text', { group.addShape('text', {
@ -36,7 +36,7 @@ G6.registerNode('nodeWithFlag', {
// must be assigned in G6 3.3 and later versions. it can be any value you want // must be assigned in G6 3.3 and later versions. it can be any value you want
name: 'textMailLabel', name: 'textMailLabel',
// allow the shape to response the drag events // allow the shape to response the drag events
draggable: true draggable: true,
}); });
if (cfg.subLabel) { if (cfg.subLabel) {
@ -58,7 +58,7 @@ G6.registerNode('nodeWithFlag', {
opacity: cfg.opacity, opacity: cfg.opacity,
}, },
name: 'rectMainLabel', name: 'rectMainLabel',
draggable: true draggable: true,
}); });
group.addShape('text', { group.addShape('text', {
@ -75,7 +75,7 @@ G6.registerNode('nodeWithFlag', {
// must be assigned in G6 3.3 and later versions. it can be any value you want // must be assigned in G6 3.3 and later versions. it can be any value you want
name: 'textMailLabel', name: 'textMailLabel',
// allow the shape to response the drag events // allow the shape to response the drag events
draggable: true draggable: true,
}); });
} }
@ -84,17 +84,17 @@ G6.registerNode('nodeWithFlag', {
getAnchorPoints() { getAnchorPoints() {
return [[0.5, 0], [0, 0.5], [1, 0.5], [0.5, 1]]; return [[0.5, 0], [0, 0.5], [1, 0.5], [0.5, 1]];
}, },
//nodeStateStyles: { // nodeStateStyles: {
//hover: { // hover: {
//fill: 'lightsteelblue', // fill: 'lightsteelblue',
//}, // },
//highlight: { // highlight: {
//lineWidth: 3, // lineWidth: 3,
//}, // },
//lowlight: { // lowlight: {
//opacity: 0.3, // opacity: 0.3,
//}, // },
//}, // },
setState(name, value, item) { setState(name, value, item) {
const group = item.getContainer(); const group = item.getContainer();
const shape = group.get('children')[0]; // Find the first graphics shape of the node. It is determined by the order of being added const shape = group.get('children')[0]; // Find the first graphics shape of the node. It is determined by the order of being added
@ -157,36 +157,36 @@ function Graph(props: Props) {
default: ['drag-canvas', 'zoom-canvas', 'drag-node'], default: ['drag-canvas', 'zoom-canvas', 'drag-node'],
}, },
layout: { type: 'dagre' }, layout: { type: 'dagre' },
//defaultNode: { // defaultNode: {
//anchorPoints: [[0.5, 0], [0, 0.5], [1, 0.5], [0.5, 1]], // anchorPoints: [[0.5, 0], [0, 0.5], [1, 0.5], [0.5, 1]],
//type: 'rect', // type: 'rect',
//style: { // style: {
//radius: 2, // radius: 2,
//}, // },
//labelCfg: { // labelCfg: {
//style: { // style: {
//// fontWeight: 700, /// / fontWeight: 700,
//fontFamily: 'Roboto', // fontFamily: 'Roboto',
//}, // },
//}, // },
//}, // },
defaultNode: { type: 'nodeWithFlag' }, defaultNode: { type: 'nodeWithFlag' },
defaultEdge: { defaultEdge: {
style: { style: {
endArrow: true, endArrow: true,
}, },
}, },
//nodeStateStyles: { // nodeStateStyles: {
//hover: { // hover: {
//fill: 'lightsteelblue', // fill: 'lightsteelblue',
//}, // },
//highlight: { // highlight: {
//lineWidth: 3, // lineWidth: 3,
//}, // },
//lowlight: { // lowlight: {
//opacity: 0.3, // opacity: 0.3,
//}, // },
//}, // },
edgeStateStyles: { edgeStateStyles: {
lowlight: { lowlight: {
opacity: 0.3, opacity: 0.3,
@ -303,10 +303,10 @@ function Graph(props: Props) {
// }); // });
}); });
return () => { graph.off('node:click') }; return () => { graph.off('node:click'); };
}, },
[graphProps], [graphProps],
) );
useEffect( useEffect(
() => { () => {
@ -316,16 +316,16 @@ function Graph(props: Props) {
const mainLabel = graphProps.node_labels[id]; const mainLabel = graphProps.node_labels[id];
const subLabel = graphProps.tree_root_labels[id].length > 0 ? `Root for: ${graphProps.tree_root_labels[id].join(' ; ')}` : undefined; const subLabel = graphProps.tree_root_labels[id].length > 0 ? `Root for: ${graphProps.tree_root_labels[id].join(' ; ')}` : undefined;
//const label = subLabel.length > 0 ? `${mainLabel}\n${subLabel}` : mainLabel; // const label = subLabel.length > 0 ? `${mainLabel}\n${subLabel}` : mainLabel;
return { return {
id: id.toString(), id: id.toString(),
mainLabel, mainLabel,
subLabel, subLabel,
//style: { // style: {
//height: subLabel.length > 0 ? 60 : 30, // height: subLabel.length > 0 ? 60 : 30,
//width: Math.max(30, 5 * mainLabel.length + 10, 5 * subLabel.length + 10), // width: Math.max(30, 5 * mainLabel.length + 10, 5 * subLabel.length + 10),
//}, // },
}; };
}); });
const edges = graphProps.lo_edges.map(([source, target]) => ({ const edges = graphProps.lo_edges.map(([source, target]) => ({
@ -344,13 +344,16 @@ function Graph(props: Props) {
[graphProps], [graphProps],
); );
return <> return (
<>
<div ref={ref} style={{ overflow: 'hidden' }} /> <div ref={ref} style={{ overflow: 'hidden' }} />
<div> <div>
<span style={{ color: '#ed6c02' }}>lo edge (condition is false)</span> <span style={{ color: '#ed6c02' }}>lo edge (condition is false)</span>
{' '} {' '}
<span style={{ color: '#1976d2' }}>hi edge (condition is true)</span> <span style={{ color: '#1976d2' }}>hi edge (condition is true)</span>
</div></>; </div>
</>
);
} }
export default Graph; export default Graph;

View File

@ -58,7 +58,11 @@ async fn solve(req_body: web::Json<SolveReqBody>) -> impl Responder {
Strategy::FirstStable => Some(adf.stable().next().unwrap()), Strategy::FirstStable => Some(adf.stable().next().unwrap()),
// TODO: error handling if no such model exists! // TODO: error handling if no such model exists!
// TODO: support more than just default heuristics // TODO: support more than just default heuristics
Strategy::FirstStableNogood => Some(adf.stable_nogood(adf_bdd::adf::heuristics::Heuristic::default()).next().unwrap()), Strategy::FirstStableNogood => Some(
adf.stable_nogood(adf_bdd::adf::heuristics::Heuristic::default())
.next()
.unwrap(),
),
}; };
let dto = adf.into_double_labeled_graph(ac.as_ref()); let dto = adf.into_double_labeled_graph(ac.as_ref());