// Path: rabbit-core/src/main/java/org/ohdsi/utilities/collections/IntegerComparator.java
// public class IntegerComparator implements Comparator<Integer> {
// 	
// 	@Override
// 	public int compare(Integer arg0, Integer arg1) {
// 		if (arg0 < arg1)
// 			return -1;
// 		else if (arg0 > arg1)
// 			return 1;
// 		else
// 			return 0;
// 	}
// 	
// 	public static int compare(int arg0, int arg1) {
// 		if (arg0 < arg1)
// 			return -1;
// 		else if (arg0 > arg1)
// 			return 1;
// 		else
// 			return 0;
// 	}
// }


import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Hashtable;
import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import org.ohdsi.rabbitInAHat.Arrow.HighlightStatus;
import org.ohdsi.rabbitInAHat.dataModel.*;
import org.ohdsi.utilities.collections.IntegerComparator;

		if (dragArrow != null) {
			if (event.getX() < sourceX + ITEM_WIDTH + Arrow.headThickness)
				dragArrow.setTargetPoint(null);
			else
				dragArrow.setTargetPoint(event.getPoint());
			repaint();
		}
		this.scrollRectToVisible(new Rectangle(event.getX() - 40, event.getY() - 40, 80, 80));

	}

	@Override
	public void mouseMoved(MouseEvent event) {
		if (event.getX() > sourceX + ITEM_WIDTH && event.getX() < sourceX + ITEM_WIDTH + ARROW_START_WIDTH && dragArrow == null) {
			if (!showingArrowStarts) {
				showingArrowStarts = true;
				repaint();
			}
		} else {
			if (showingArrowStarts) {
				showingArrowStarts = false;
				repaint();
			}
		}
	}

	private class YComparator implements Comparator<LabeledRectangle> {

		@Override
		public int compare(LabeledRectangle o1, LabeledRectangle o2) {

// Path: rabbit-core/src/main/java/org/ohdsi/utilities/collections/IntegerComparator.java
// public class IntegerComparator implements Comparator<Integer> {
// 	
// 	@Override
// 	public int compare(Integer arg0, Integer arg1) {
// 		if (arg0 < arg1)
// 			return -1;
// 		else if (arg0 > arg1)
// 			return 1;
// 		else
// 			return 0;
// 	}
// 	
// 	public static int compare(int arg0, int arg1) {
// 		if (arg0 < arg1)
// 			return -1;
// 		else if (arg0 > arg1)
// 			return 1;
// 		else
// 			return 0;
// 	}
// }


// Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/MappingPanel.java
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Hashtable;
import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import org.ohdsi.rabbitInAHat.Arrow.HighlightStatus;
import org.ohdsi.rabbitInAHat.dataModel.*;
import org.ohdsi.utilities.collections.IntegerComparator;

		if (dragArrow != null) {
			if (event.getX() < sourceX + ITEM_WIDTH + Arrow.headThickness)
				dragArrow.setTargetPoint(null);
			else
				dragArrow.setTargetPoint(event.getPoint());
			repaint();
		}
		this.scrollRectToVisible(new Rectangle(event.getX() - 40, event.getY() - 40, 80, 80));

	}

	@Override
	public void mouseMoved(MouseEvent event) {
		if (event.getX() > sourceX + ITEM_WIDTH && event.getX() < sourceX + ITEM_WIDTH + ARROW_START_WIDTH && dragArrow == null) {
			if (!showingArrowStarts) {
				showingArrowStarts = true;
				repaint();
			}
		} else {
			if (showingArrowStarts) {
				showingArrowStarts = false;
				repaint();
			}
		}
	}

	private class YComparator implements Comparator<LabeledRectangle> {

		@Override
		public int compare(LabeledRectangle o1, LabeledRectangle o2) {

			return IntegerComparator.compare(o1.getY(), o2.getY());
