//# 10 errors, 101 messages
//#
/*
    //#PingHistoryPanel.java:1:1: class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#PingHistoryPanel.java:1:1: method: com.dmdirc.addons.lagdisplay.PingHistoryPanel.com.dmdirc.addons.lagdisplay.PingHistoryPanel__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.addons.lagdisplay;

import com.dmdirc.Main;
import com.dmdirc.ServerManager;
import com.dmdirc.util.RollingList;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;

/**
 * Shows a ping history graph for the current server.
 *
 * @author chris
 */
public class PingHistoryPanel extends JPanel {

    /**
     * A version number for this class. It should be changed whenever the class
     * structure is changed (or anything else that would prevent serialized
     * objects being unserialized with the new class).
     */
    private static final long serialVersionUID = 1;

    /** The plugin that this panel is for. */
    protected final LagDisplayPlugin plugin;

    /** The history that we're graphing. */
    protected final RollingList<Long> history;

    /** The maximum ping value. */
    protected long maximum = 0l;

    /**
     * Creates a new history panel for the specified plugin.
     *
     * @param plugin The plugin that owns this panel
     */
    public PingHistoryPanel(final LagDisplayPlugin plugin) {
        super();
    //#PingHistoryPanel.java:67: method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel.com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#input(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): plugin
    //#input(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this
    //#output(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this.history
    //#output(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this.maximum
    //#output(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this.plugin
    //#pre[1] (void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): plugin != null
    //#presumption(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): com.dmdirc.Main:getUI(...)@74 != null
    //#presumption(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): com.dmdirc.ServerManager:getServerManager(...)@74 != null
    //#presumption(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): com.dmdirc.addons.lagdisplay.LagDisplayPlugin:getHistory(...)@74 != null
    //#presumption(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): com.dmdirc.util.RollingList:getList(...)@77 != null
    //#presumption(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): java.util.Iterator:next(...)@77 != null
    //#post(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this.history != null
    //#post(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): init'ed(this.maximum)
    //#post(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this.plugin == plugin
    //#post(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): this.plugin != null
    //#test_vector(void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)): java.util.Iterator:hasNext(...)@77: {0}, {1}

        setMinimumSize(new Dimension(50, 100));
    //#PingHistoryPanel.java:69: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.lagdisplay.PingHistoryPanel:setMinimumSize(Dimension)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.lagdisplay.PingHistoryPanel:setMinimumSize(Dimension)
        setMaximumSize(new Dimension(Integer.MAX_VALUE, 100));
    //#PingHistoryPanel.java:70: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.lagdisplay.PingHistoryPanel:setMaximumSize(Dimension)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.lagdisplay.PingHistoryPanel:setMaximumSize(Dimension)
        setOpaque(false);
    //#PingHistoryPanel.java:71: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.lagdisplay.PingHistoryPanel:setOpaque(bool)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: void com.dmdirc.addons.lagdisplay.PingHistoryPanel:setOpaque(bool)
        
        this.plugin = plugin;
        this.history = plugin.getHistory(ServerManager.getServerManager()
    //#PingHistoryPanel.java:74: Warning: method not available - call not analyzed
    //#    call on ServerManager com.dmdirc.ServerManager:getServerManager()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: ServerManager com.dmdirc.ServerManager:getServerManager()
    //#PingHistoryPanel.java:74: Warning: method not available - call not analyzed
    //#    call on UIController com.dmdirc.Main:getUI()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: UIController com.dmdirc.Main:getUI()
    //#PingHistoryPanel.java:74: Warning: method not available - call not analyzed
    //#    call on Window com.dmdirc.ui.interfaces.UIController:getActiveWindow()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: Window com.dmdirc.ui.interfaces.UIController:getActiveWindow()
    //#PingHistoryPanel.java:74: Warning: method not available - call not analyzed
    //#    call on Server com.dmdirc.ServerManager:getServerFromFrame(Window)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: Server com.dmdirc.ServerManager:getServerFromFrame(Window)
    //#PingHistoryPanel.java:74: Warning: method not available - call not analyzed
    //#    call on RollingList com.dmdirc.addons.lagdisplay.LagDisplayPlugin:getHistory(Server)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: RollingList com.dmdirc.addons.lagdisplay.LagDisplayPlugin:getHistory(Server)
                .getServerFromFrame(Main.getUI().getActiveWindow()));

        for (Long value : history.getList()) {
    //#PingHistoryPanel.java:77: Warning: method not available - call not analyzed
    //#    call on List com.dmdirc.util.RollingList:getList()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)
    //#    unanalyzed callee: List com.dmdirc.util.RollingList:getList()
            maximum = Math.max(value, maximum);
        }
    }
    //#PingHistoryPanel.java:80: end of method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel.com.dmdirc.addons.lagdisplay.PingHistoryPanel(LagDisplayPlugin)

    /** {@inheritDoc} */
    @Override
    public void paint(final Graphics g) {
        super.paint(g);
    //#PingHistoryPanel.java:85: method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel.paint(Graphics)
    //#input(void paint(Graphics)): g
    //#input(void paint(Graphics)): java.awt.Color.DARK_GRAY
    //#input(void paint(Graphics)): this
    //#input(void paint(Graphics)): this.history
    //#input(void paint(Graphics)): this.maximum
    //#input(void paint(Graphics)): this.plugin
    //#pre[1] (void paint(Graphics)): (float) (this.maximum) != +0
    //#pre[2] (void paint(Graphics)): g != null
    //#pre[4] (void paint(Graphics)): this.history != null
    //#pre[5] (void paint(Graphics)): init'ed(this.maximum)
    //#pre[6] (void paint(Graphics)): (soft) this.plugin != null
    //#presumption(void paint(Graphics)): (float) (com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@95 - 10)/(float) (this.maximum) != +0
    //#presumption(void paint(Graphics)): (float) (com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth(...)@93 - 3)/(float) (1) != +0
    //#presumption(void paint(Graphics)): (int) ((java.awt.geom.Rectangle2D:getHeight(...)@126/2 + lastY) - 1) in {-2_147_483_648..4_294_967_295}
    //#presumption(void paint(Graphics)): (int) (-((float) (java.lang.Long:longValue(...)@109)*((float) (com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@95 - 10)/(float) (this.maximum)) - (float) (com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@109 - 5))) in {-2_147_483_647..4_294_967_295}
    //#presumption(void paint(Graphics)): (int) (-((java.awt.geom.Rectangle2D:getHeight(...)@123 + 10)/((float) (com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@95 - 10)/(float) (this.maximum)) - (float) (last1))) in {-2_147_483_648..4_294_967_295}
    //#presumption(void paint(Graphics)): (int) (java.awt.geom.Rectangle2D:getHeight(...)@151) in {-2_147_483_651..4_294_967_292}
    //#presumption(void paint(Graphics)): (int) (java.awt.geom.Rectangle2D:getWidth(...)@121) in {-2_147_483_658..4_294_967_285}
    //#presumption(void paint(Graphics)): (int) (java.awt.geom.Rectangle2D:getWidth(...)@151) in {-2_147_483_653..4_294_967_290}
    //#presumption(void paint(Graphics)): (int) (java.lang.Math:ceil(...)@122) in {-2_147_483_648..4_294_967_295}
    //#presumption(void paint(Graphics)): com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@88 >= -2_147_483_647
    //#presumption(void paint(Graphics)): com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@89 >= -2_147_483_646
    //#presumption(void paint(Graphics)): com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight(...)@89 >= -2_147_483_646
    //#presumption(void paint(Graphics)): com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth(...)@89 >= -2_147_483_647
    //#presumption(void paint(Graphics)): com.dmdirc.util.RollingList:getList(...)@102 != null
    //#presumption(void paint(Graphics)): com.dmdirc.util.RollingList:getList(...)@93 != null
    //#presumption(void paint(Graphics)): com.dmdirc.util.RollingList:getList(...)@93 != null
    //#presumption(void paint(Graphics)): init'ed(java.awt.Color.DARK_GRAY)
    //#presumption(void paint(Graphics)): java.awt.Font:getStringBounds(...)@119 != null
    //#presumption(void paint(Graphics)): java.awt.Graphics:getFont(...)@119 != null
    //#presumption(void paint(Graphics)): java.awt.Graphics:getFont(...)@90 != null
    //#presumption(void paint(Graphics)): java.util.Iterator:next(...)@155 != null
    //#presumption(void paint(Graphics)): java.util.List:get(...)@106 != null
    //#presumption(void paint(Graphics)): java.util.List:get(...)@131 != null
    //#presumption(void paint(Graphics)): java.util.List:get(...)@143 != null
    //#presumption(void paint(Graphics)): java.util.List:size(...)@93 >= -2_147_483_647
    //#test_vector(void paint(Graphics)): com.dmdirc.addons.lagdisplay.LagDisplayPlugin:shouldShowLabels(...)@117: {0}, {1}
    //#test_vector(void paint(Graphics)): com.dmdirc.util.RollingList:isEmpty(...)@97: {0}, {1}
    //#test_vector(void paint(Graphics)): java.awt.Rectangle:intersects(...)@156: {0}, {1}
    //#test_vector(void paint(Graphics)): java.util.Iterator:hasNext(...)@155: {0}, {1}
        
        g.setColor(Color.DARK_GRAY);
        g.drawLine(2, 1, 2, getHeight() - 1);
    //#PingHistoryPanel.java:88: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
        g.drawLine(1, getHeight() - 2, getWidth() - 1, getHeight() - 2);
    //#PingHistoryPanel.java:89: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
    //#PingHistoryPanel.java:89: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
        g.setFont(g.getFont().deriveFont(10f));

        float lastX = -1, lastY = -1;
        float pixelsperpointX = (getWidth() - 3) / (float) (history.getList().size() == 1 ? 1
    //#PingHistoryPanel.java:93: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
    //#PingHistoryPanel.java:93: Warning: method not available - call not analyzed
    //#    call on List com.dmdirc.util.RollingList:getList()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: List com.dmdirc.util.RollingList:getList()
    //#PingHistoryPanel.java:93: ?divide by zero
    //#    (float) (1) != +0
    //#    severity: LOW
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_4
    //#    assertion: (float) (1) != +0
    //#    VN: (float) (__Temp_Initially_1)
    //#    Expected: {-Inf <= x < +0, +0+e <= x < +Inf+e}
    //#    Bad: {+0 <= x < +0+e}
    //#    Attribs:  Rat  Bad singleton  Bad overlaps +/-1000
                : history.getList().size() - 1);
        float pixelsperpointY = (getHeight() - 10) / (float) maximum;
    //#PingHistoryPanel.java:95: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()

        if (history.isEmpty()) {
    //#PingHistoryPanel.java:97: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.util.RollingList:isEmpty()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: bool com.dmdirc.util.RollingList:isEmpty()
            g.drawString("No data", getWidth() / 2 - 25, getHeight() / 2 + 5);
    //#PingHistoryPanel.java:98: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
    //#PingHistoryPanel.java:98: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
        }

        long last1 = -1, last2 = -1;
        final List<Long> list = history.getList();
    //#PingHistoryPanel.java:102: Warning: method not available - call not analyzed
    //#    call on List com.dmdirc.util.RollingList:getList()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: List com.dmdirc.util.RollingList:getList()
        final List<Rectangle> rects = new ArrayList<Rectangle>();

        for (int i = 0; i < list.size(); i++) {
            final Long value = list.get(i);
           
            float x = lastX == -1 ? 2 : lastX + pixelsperpointX;
            float y = getHeight() - 5 - value * pixelsperpointY;
    //#PingHistoryPanel.java:109: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getHeight()

            if (lastX > -1) {
                g.drawLine((int) lastX, (int) lastY, (int) x, (int) y);
    //#PingHistoryPanel.java:112: ?overflow
    //#    (int) (lastX) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_12
    //#    assertion: (int) (lastX) in {-2_147_483_648..4_294_967_295}
    //#    VN: (int) (lastX)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-Inf..-2_147_483_649, 4_294_967_296..+Inf}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp
    //#PingHistoryPanel.java:112: ?overflow
    //#    (int) (lastY) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_12
    //#    assertion: (int) (lastY) in {-2_147_483_648..4_294_967_295}
    //#    VN: (int) (lastY)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-Inf..-2_147_483_649, 4_294_967_296..+Inf}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp
    //#PingHistoryPanel.java:112: ?overflow
    //#    (int) (x) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_12
    //#    assertion: (int) (x) in {-2_147_483_648..4_294_967_295}
    //#    VN: (int) (__Temp_Initially_2)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-Inf..-2_147_483_649, 4_294_967_296..+Inf}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp
            }

            g.drawRect((int) x - 1, (int) y - 1, 2, 2);
    //#PingHistoryPanel.java:115: ?overflow
    //#    (int) (x) in {-2_147_483_647..4_294_967_296}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_13
    //#    assertion: (int) (x) in {-2_147_483_647..4_294_967_296}
    //#    VN: (int) (__Temp_Initially_2) - 1
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-Inf..-2_147_483_649, 4_294_967_296..+Inf}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp

            if (plugin.shouldShowLabels() && last1 > -1 && (last2 <= last1 || last1 >= value)) {
    //#PingHistoryPanel.java:117: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.addons.lagdisplay.LagDisplayPlugin:shouldShowLabels()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: bool com.dmdirc.addons.lagdisplay.LagDisplayPlugin:shouldShowLabels()
                final String text = plugin.formatTime(last1);
    //#PingHistoryPanel.java:118: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.lagdisplay.LagDisplayPlugin:formatTime(Object)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: String com.dmdirc.addons.lagdisplay.LagDisplayPlugin:formatTime(Object)
                final Rectangle2D rect = g.getFont().getStringBounds(text,
                        ((Graphics2D) g).getFontRenderContext());
                final int width = 10 + (int) rect.getWidth();
                final int points = (int) Math.ceil(width / pixelsperpointX);
                final int diffy = (int) (last1 - (10 + rect.getHeight()) / pixelsperpointY);

                float posX = lastX - width + 7;
                float posY = (float) (lastY + rect.getHeight() / 2) - 1;
                boolean failed = posX < 0;

                // Check left
                for (int j = Math.max(0, i - points); j < i - 1; j++) {
    //#PingHistoryPanel.java:130: ?overflow
    //#    i - points in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_20
    //#    assertion: i - points in {-2_147_483_648..4_294_967_295}
    //#    VN: i - (int) (java.lang.Math:ceil(...)@122)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-4_294_967_295..-2_147_483_649, 4_294_967_296..6_442_450_942}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp
                    if (list.get(j) > diffy) {
                        failed = true;
                        break;
                    }
                }

                if (failed) {
                    posX = lastX + 3;
                    failed = posX + width > getWidth();
    //#PingHistoryPanel.java:139: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    unanalyzed callee: int com.dmdirc.addons.lagdisplay.PingHistoryPanel:getWidth()

                    // Check right
                    for (int j = i; j < Math.min(list.size(), i + points); j++) {
    //#PingHistoryPanel.java:142: ?overflow
    //#    i + points in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_30
    //#    assertion: i + points in {-2_147_483_648..4_294_967_295}
    //#    VN: (int) (java.lang.Math:ceil(...)@122) + i
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296..8_589_934_589}
    //#    Attribs:  Int  Bad > Exp
                        if (list.get(j) > diffy) {
                            failed = true;
                            break;
                        }
                    }
                }

                if (!failed) {
                    final Rectangle myrect = new Rectangle((int) posX - 2,
    //#PingHistoryPanel.java:151: ?overflow
    //#    (int) (posX) in {-2_147_483_646..4_294_967_297}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_35
    //#    assertion: (int) (posX) in {-2_147_483_646..4_294_967_297}
    //#    VN: (int) (posX) - 2
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-Inf..-2_147_483_649, 4_294_967_296..+Inf}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp
    //#PingHistoryPanel.java:151: ?overflow
    //#    (int) (lastY) in {-2_147_483_641..4_294_967_302}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_35
    //#    assertion: (int) (lastY) in {-2_147_483_641..4_294_967_302}
    //#    VN: (int) (lastY) - 7
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {-Inf..-2_147_483_649, 4_294_967_296..+Inf}
    //#    Attribs:  Int  Bad < Exp  Bad > Exp
                            (int) lastY - 7, 5 + (int) rect.getWidth(),
                            3 + (int) rect.getHeight());

                    for (Rectangle test : rects) {
                        if (test.intersects(myrect)) {
                            failed = true;
                        }
                    }

                    if (!failed) {
                        g.drawString(text, (int) posX, (int) posY);
    //#PingHistoryPanel.java:162: ?overflow
    //#    (int) (posX) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
    //#    method: void paint(Graphics)
    //#    basic block: bb_41
    //#    assertion: (int) (posX) in {-2_147_483_648..4_294_967_295}
    //#    VN: (int) (posX)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296,4_294_967_297}
    //#    Attribs:  Int  Bad > Exp
                        rects.add(myrect);
                    }
                }
            }

            lastX = x;
            lastY = y;

            last2 = last1;
            last1 = value;
        }
    }
    //#PingHistoryPanel.java:174: end of method: void com.dmdirc.addons.lagdisplay.PingHistoryPanel.paint(Graphics)

}
    //#output(com.dmdirc.addons.lagdisplay.PingHistoryPanel__static_init): __Descendant_Table[com/dmdirc/addons/lagdisplay/PingHistoryPanel]
    //#output(com.dmdirc.addons.lagdisplay.PingHistoryPanel__static_init): __Dispatch_Table.paint(Ljava/awt/Graphics;)V
    //#post(com.dmdirc.addons.lagdisplay.PingHistoryPanel__static_init): __Descendant_Table[com/dmdirc/addons/lagdisplay/PingHistoryPanel] == &__Dispatch_Table
    //#post(com.dmdirc.addons.lagdisplay.PingHistoryPanel__static_init): __Dispatch_Table.paint(Ljava/awt/Graphics;)V == &paint
    //#PingHistoryPanel.java:: end of method: com.dmdirc.addons.lagdisplay.PingHistoryPanel.com.dmdirc.addons.lagdisplay.PingHistoryPanel__static_init
    //#PingHistoryPanel.java:: end of class: com.dmdirc.addons.lagdisplay.PingHistoryPanel
