Fix indention of ViewRSSI.java

This commit is contained in:
Moritz 'Morty' Strübe 2013-08-14 16:27:05 +02:00
parent fe0a0423cb
commit fae6c530de

View file

@ -13,6 +13,8 @@
import javax.swing.*;
import java.awt.*;
import java.io.*;
public class ViewRSSI extends JPanel {
private int[] rssi = new int[80];
@ -30,7 +32,8 @@ public class ViewRSSI extends JPanel {
double factor = (h - 20.0) / RSSI_MAX_VALUE;
double sSpacing = (w - 15) / 80.0;
int sWidth = (int) (sSpacing - 1);
if (sWidth == 0) sWidth = 1;
if (sWidth == 0)
sWidth = 1;
g.setColor(Color.white);
g.fillRect(0, 0, w, h);
@ -39,8 +42,7 @@ public class ViewRSSI extends JPanel {
double xpos = 10;
for (int i = 0, n = rssi.length; i < n; i++) {
int rssi = (int) (rssiMax[i] * factor);
g.fillRect((int) xpos, h - 20 - rssi,
sWidth, rssi + 1);
g.fillRect((int) xpos, h - 20 - rssi, sWidth, rssi + 1);
xpos += sSpacing;
}
@ -48,15 +50,13 @@ public class ViewRSSI extends JPanel {
xpos = 10;
for (int i = 0, n = rssi.length; i < n; i++) {
int rssiVal = (int) (rssi[i] * factor);
g.fillRect((int) xpos, h - 20 - rssiVal,
sWidth, rssiVal + 1);
g.fillRect((int) xpos, h - 20 - rssiVal, sWidth, rssiVal + 1);
xpos += sSpacing;
}
}
private void handleInput() throws IOException {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String line = reader.readLine();
if (line.startsWith("RSSI:")) {
@ -64,8 +64,10 @@ public class ViewRSSI extends JPanel {
String[] parts = line.substring(5).split(" ");
for (int i = 0, n = parts.length; i < n; i++) {
rssi[i] = 3 * Integer.parseInt(parts[i]);
if (rssi[i] > rssiMax[i]) rssiMax[i] = rssi[i];
else if (rssiMax[i] > 0) rssiMax[i]--;
if (rssi[i] > rssiMax[i])
rssiMax[i] = rssi[i];
else if (rssiMax[i] > 0)
rssiMax[i]--;
}
} catch (Exception e) {
/* report but do not fail... */