@Test public void testSort() { Overlay tlh = new TestOverlay(OverlayPosition.TOP_LEFT, OverlayPriority.HIGH); Overlay tll = new TestOverlay(OverlayPosition.TOP_LEFT, OverlayPriority.LOW); List<Overlay> overlays = Arrays.asList(tlh, tll); OverlayRenderer.sortOverlays(overlays); assertEquals(tlh, overlays.get(0)); assertEquals(tll, overlays.get(1)); }
static void sortOverlays(List<Overlay> overlays) { overlays.sort((a, b) -> { if (a.getPosition() != b.getPosition()) { return a.getPosition().compareTo(b.getPosition()); } return a.getPosition() == OverlayPosition.DYNAMIC ? a.getPriority().compareTo(b.getPriority()) : b.getPriority().compareTo(a.getPriority()); }); }
OverlayRenderer extends MouseListener implements KeyListener { static void sortOverlays(List<Overlay> overlays) { overlays.sort((a, b) -> { if (a.getPosition() != b.getPosition()) { return a.getPosition().compareTo(b.getPosition()); } return a.getPosition() == OverlayPosition.DYNAMIC ? a.getPriority().compareTo(b.getPriority()) : b.getPriority().compareTo(a.getPriority()); }); } }
OverlayRenderer extends MouseListener implements KeyListener { static void sortOverlays(List<Overlay> overlays) { overlays.sort((a, b) -> { if (a.getPosition() != b.getPosition()) { return a.getPosition().compareTo(b.getPosition()); } return a.getPosition() == OverlayPosition.DYNAMIC ? a.getPriority().compareTo(b.getPriority()) : b.getPriority().compareTo(a.getPriority()); }); } @Inject private  OverlayRenderer(
		final Provider<Client> clientProvider,
		final PluginManager pluginManager,
		final MouseManager mouseManager,
		final KeyManager keyManager,
		final TooltipOverlay tooltipOverlay,
		final InfoBoxOverlay infoBoxOverlay,
		final WorldMapOverlay worldMapOverlay,
		final ConfigManager configManager,
		final RuneLiteConfig runeLiteConfig); }
OverlayRenderer extends MouseListener implements KeyListener { static void sortOverlays(List<Overlay> overlays) { overlays.sort((a, b) -> { if (a.getPosition() != b.getPosition()) { return a.getPosition().compareTo(b.getPosition()); } return a.getPosition() == OverlayPosition.DYNAMIC ? a.getPriority().compareTo(b.getPriority()) : b.getPriority().compareTo(a.getPriority()); }); } @Inject private  OverlayRenderer(
		final Provider<Client> clientProvider,
		final PluginManager pluginManager,
		final MouseManager mouseManager,
		final KeyManager keyManager,
		final TooltipOverlay tooltipOverlay,
		final InfoBoxOverlay infoBoxOverlay,
		final WorldMapOverlay worldMapOverlay,
		final ConfigManager configManager,
		final RuneLiteConfig runeLiteConfig); @Subscribe void onGameStateChanged(GameStateChanged event); @Subscribe void onPluginChanged(PluginChanged event); @Subscribe void onFocusChanged(FocusChanged event); void render(Graphics2D graphics, final OverlayLayer layer); @Override MouseEvent mousePressed(MouseEvent mouseEvent); @Override MouseEvent mouseDragged(MouseEvent mouseEvent); @Override MouseEvent mouseReleased(MouseEvent mouseEvent); @Override void keyTyped(KeyEvent e); @Override void keyPressed(KeyEvent e); @Override void keyReleased(KeyEvent e); }
OverlayRenderer extends MouseListener implements KeyListener { static void sortOverlays(List<Overlay> overlays) { overlays.sort((a, b) -> { if (a.getPosition() != b.getPosition()) { return a.getPosition().compareTo(b.getPosition()); } return a.getPosition() == OverlayPosition.DYNAMIC ? a.getPriority().compareTo(b.getPriority()) : b.getPriority().compareTo(a.getPriority()); }); } @Inject private  OverlayRenderer(
		final Provider<Client> clientProvider,
		final PluginManager pluginManager,
		final MouseManager mouseManager,
		final KeyManager keyManager,
		final TooltipOverlay tooltipOverlay,
		final InfoBoxOverlay infoBoxOverlay,
		final WorldMapOverlay worldMapOverlay,
		final ConfigManager configManager,
		final RuneLiteConfig runeLiteConfig); @Subscribe void onGameStateChanged(GameStateChanged event); @Subscribe void onPluginChanged(PluginChanged event); @Subscribe void onFocusChanged(FocusChanged event); void render(Graphics2D graphics, final OverlayLayer layer); @Override MouseEvent mousePressed(MouseEvent mouseEvent); @Override MouseEvent mouseDragged(MouseEvent mouseEvent); @Override MouseEvent mouseReleased(MouseEvent mouseEvent); @Override void keyTyped(KeyEvent e); @Override void keyPressed(KeyEvent e); @Override void keyReleased(KeyEvent e);  }