<commit_before>package joshua.ui.hypergraph_visualizer;

import javax.swing.DefaultListModel;

import joshua.decoder.hypergraph.HyperEdge;
import edu.uci.ics.jung.algorithms.layout.StaticLayout;
import edu.uci.ics.jung.visualization.picking.MultiPickedState;

public class HyperGraphPickedState extends MultiPickedState<Vertex> {
	private HyperGraphViewer viewer;
	
	public HyperGraphPickedState(HyperGraphViewer vv) {
		super();
		this.viewer = vv;
	}
	
	public boolean pick(Vertex v, boolean state)
	{
		if (!(v instanceof HyperEdgeVertex))
			return false;
		NodeVertex node = (NodeVertex) viewer.graph.getPredecessors(v).toArray()[0];
		viewer.graph.picked = node;
	//	viewer.graph.incrementHyperEdge(node);
	//	viewer.setGraphLayout(new StaticLayout<Vertex,Edge>(viewer.graph, new HyperGraphTransformer(viewer.graph)));
		DefaultListModel edgeListModel = (DefaultListModel) viewer.edgeList.getModel();
		edgeListModel.removeAllElements();
		for (HyperEdge e : node.getNode().l_hyperedges) {
			edgeListModel.addElement(e);
		}
		viewer.edgeList.setSelectedValue(((HyperEdgeVertex) v).getHyperEdge(), true);
		return true;
	}
}<commit_msg>Changed the hypergraph visualizer so that the vertex to pick is a HG item, rather than a hyper edge.<commit_after>package joshua.ui.hypergraph_visualizer;

import javax.swing.DefaultListModel;

import joshua.decoder.hypergraph.HyperEdge;
import edu.uci.ics.jung.algorithms.layout.StaticLayout;
import edu.uci.ics.jung.visualization.picking.MultiPickedState;

public class HyperGraphPickedState extends MultiPickedState<Vertex> {
	private HyperGraphViewer viewer;
	
	public HyperGraphPickedState(HyperGraphViewer vv) {
		super();
		this.viewer = vv;
	}
	
	public boolean pick(Vertex v, boolean state)
	{
		if (!(v instanceof NodeVertex))
			return false;
		NodeVertex node =  (NodeVertex) v; //(NodeVertex) viewer.graph.getPredecessors(v).toArray()[0];
		viewer.graph.picked = node;
	//	viewer.graph.incrementHyperEdge(node);
	//	viewer.setGraphLayout(new StaticLayout<Vertex,Edge>(viewer.graph, new HyperGraphTransformer(viewer.graph)));
		DefaultListModel edgeListModel = (DefaultListModel) viewer.edgeList.getModel();
		edgeListModel.removeAllElements();
		for (HyperEdge e : node.getNode().l_hyperedges) {
			edgeListModel.addElement(e);
		}
		if (node.getNode().l_hyperedges.size() == 0)
			return true;
		HyperEdgeVertex currentEdge = (HyperEdgeVertex) viewer.graph.getSuccessors(v).toArray()[0];
		viewer.edgeList.setSelectedValue(currentEdge.getHyperEdge(), true);
		return true;
	}
}
{'fraction_non_alphanumeric': 0.11523283346487766, 'fraction_numerical': 0.0015785319652722968, 'mean_word_length': 5.814516129032258, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6271153', 'n_tokens_mistral': 898, 'n_tokens_neox': 824, 'n_words': 152}