Vue/graf/src/middleware/GrafModel.js
// Helper function to create a new selection model given a type and quantity
Helper function to create a new selection model given a type and quantity
Helper function to create a new selection model given a type and quantity
createSelection(type, amount) {
		let new_selection = null;
		let is_node = type == "Node";
		let is_edge = type == "Edge";
		let is_many = amount > 2;
		let is_two = amount == 2;
		let is_one = amount == 1;
		if (is_node && is_many) {
			new_selection = new SelectionModel.ManyNodeSelection();
			console.log("Created ManyNodeSelection");
		}
		else if (is_node && is_two) {
			new_selection = new SelectionModel.TwoNodeSelection();
			console.log("Created TwoNodeSelection");
		}
		else if (is_node && is_one) {
			new_selection = new SelectionModel.OneNodeSelection();
			console.log("Created OneNodeSelection");
		}
		else if (is_edge && (is_many || is_two)) {
			new_selection = new SelectionModel.ManyEdgeSelection();
			console.log("Created ManyEdgeSelection");
		}
		else if (is_edge && is_one) {
			new_selection = new SelectionModel.OneEdgeSelection();
			console.log("Created OneEdgeSelection");
		}
		else if (is_many || is_two) {
			new_selection = new SelectionModel.ManyHybridSelection();
			console.log("Created ManyHybridSelection");
		}
		else if (is_one) {
			new_selection = new SelectionModel.SingleHybridSelection();
			console.log("Created SingleHybridSelection");
		}
		return new_selection;
	}
createSelection ( type , amount ) { let new_selection = null ; let is_node = type == "Node" ; let is_edge = type == "Edge" ; let is_many = amount > 2 ; let is_two = amount == 2 ; let is_one = amount == 1 ; if ( is_node && is_many ) { new_selection = new SelectionModel . ManyNodeSelection ( ) ; console . log ( "Created ManyNodeSelection" ) ; } else if ( is_node && is_two ) { new_selection = new SelectionModel . TwoNodeSelection ( ) ; console . log ( "Created TwoNodeSelection" ) ; } else if ( is_node && is_one ) { new_selection = new SelectionModel . OneNodeSelection ( ) ; console . log ( "Created OneNodeSelection" ) ; } else if ( is_edge && ( is_many || is_two ) ) { new_selection = new SelectionModel . ManyEdgeSelection ( ) ; console . log ( "Created ManyEdgeSelection" ) ; } else if ( is_edge && is_one ) { new_selection = new SelectionModel . OneEdgeSelection ( ) ; console . log ( "Created OneEdgeSelection" ) ; } else if ( is_many || is_two ) { new_selection = new SelectionModel . ManyHybridSelection ( ) ; console . log ( "Created ManyHybridSelection" ) ; } else if ( is_one ) { new_selection = new SelectionModel . SingleHybridSelection ( ) ; console . log ( "Created SingleHybridSelection" ) ; } return new_selection ; }
Helper function to create a new selection model given a type and quantity
Helper function to create a new selection model given a type and quantity