[cooja] Automated code updates that do not make any functional changes
- made loggers final - added some diamond interface cosmetic - shortened if-return statements - replaced size == 0 check with .isEmpty()
This commit is contained in:
parent
6e9b0e1497
commit
84b687efeb
|
@ -51,7 +51,7 @@ import org.contikios.mrm.ChannelModel.TxPair;
|
||||||
@ClassDescription("Radio environment (MRM)")
|
@ClassDescription("Radio environment (MRM)")
|
||||||
@SupportedArguments(radioMediums = {MRM.class})
|
@SupportedArguments(radioMediums = {MRM.class})
|
||||||
public class MRMVisualizerSkin implements VisualizerSkin {
|
public class MRMVisualizerSkin implements VisualizerSkin {
|
||||||
private static Logger logger = Logger.getLogger(MRMVisualizerSkin.class);
|
private static final Logger logger = Logger.getLogger(MRMVisualizerSkin.class);
|
||||||
|
|
||||||
private Simulation simulation = null;
|
private Simulation simulation = null;
|
||||||
private Visualizer visualizer = null;
|
private Visualizer visualizer = null;
|
||||||
|
|
|
@ -140,7 +140,7 @@ import org.contikios.cooja.plugins.skins.UDGMVisualizerSkin;
|
||||||
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
@PluginType(PluginType.SIM_STANDARD_PLUGIN)
|
||||||
public class Visualizer extends VisPlugin implements HasQuickHelp {
|
public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static Logger logger = Logger.getLogger(Visualizer.class);
|
private static final Logger logger = Logger.getLogger(Visualizer.class);
|
||||||
|
|
||||||
public static final int MOTE_RADIUS = 8;
|
public static final int MOTE_RADIUS = 8;
|
||||||
private static final Color[] DEFAULT_MOTE_COLORS = { Color.WHITE };
|
private static final Color[] DEFAULT_MOTE_COLORS = { Color.WHITE };
|
||||||
|
@ -186,8 +186,8 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
private Selection selection;
|
private Selection selection;
|
||||||
|
|
||||||
/* Visualizers */
|
/* Visualizers */
|
||||||
private static ArrayList<Class<? extends VisualizerSkin>> visualizerSkins =
|
private static final ArrayList<Class<? extends VisualizerSkin>> visualizerSkins =
|
||||||
new ArrayList<Class<? extends VisualizerSkin>>();
|
new ArrayList<>();
|
||||||
static {
|
static {
|
||||||
/* Register default visualizer skins */
|
/* Register default visualizer skins */
|
||||||
registerVisualizerSkin(IDVisualizerSkin.class);
|
registerVisualizerSkin(IDVisualizerSkin.class);
|
||||||
|
@ -200,13 +200,13 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
registerVisualizerSkin(MoteTypeVisualizerSkin.class);
|
registerVisualizerSkin(MoteTypeVisualizerSkin.class);
|
||||||
registerVisualizerSkin(AttributeVisualizerSkin.class);
|
registerVisualizerSkin(AttributeVisualizerSkin.class);
|
||||||
}
|
}
|
||||||
private ArrayList<VisualizerSkin> currentSkins = new ArrayList<VisualizerSkin>();
|
private ArrayList<VisualizerSkin> currentSkins = new ArrayList<>();
|
||||||
|
|
||||||
/* Generic visualization */
|
/* Generic visualization */
|
||||||
private MoteCountListener newMotesListener;
|
private MoteCountListener newMotesListener;
|
||||||
private Observer posObserver = null;
|
private Observer posObserver = null;
|
||||||
private Observer moteHighligtObserver = null;
|
private Observer moteHighligtObserver = null;
|
||||||
private ArrayList<Mote> highlightedMotes = new ArrayList<Mote>();
|
private ArrayList<Mote> highlightedMotes = new ArrayList<>();
|
||||||
private final static Color HIGHLIGHT_COLOR = Color.CYAN;
|
private final static Color HIGHLIGHT_COLOR = Color.CYAN;
|
||||||
private final static Color MOVE_COLOR = Color.WHITE;
|
private final static Color MOVE_COLOR = Color.WHITE;
|
||||||
private Observer moteRelationsObserver = null;
|
private Observer moteRelationsObserver = null;
|
||||||
|
@ -224,9 +224,9 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Class<? extends SimulationMenuAction>> simulationMenuActions =
|
private ArrayList<Class<? extends SimulationMenuAction>> simulationMenuActions =
|
||||||
new ArrayList<Class<? extends SimulationMenuAction>>();
|
new ArrayList<>();
|
||||||
private ArrayList<Class<? extends MoteMenuAction>> moteMenuActions =
|
private ArrayList<Class<? extends MoteMenuAction>> moteMenuActions =
|
||||||
new ArrayList<Class<? extends MoteMenuAction>>();
|
new ArrayList<>();
|
||||||
|
|
||||||
public Visualizer(Simulation simulation, Cooja gui) {
|
public Visualizer(Simulation simulation, Cooja gui) {
|
||||||
super("Network", gui);
|
super("Network", gui);
|
||||||
|
@ -859,10 +859,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!showMenuItem) {
|
return showMenuItem;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleMousePress(MouseEvent mouseEvent) {
|
private void handleMousePress(MouseEvent mouseEvent) {
|
||||||
|
@ -1097,7 +1094,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
double xCoord = transformToPositionX(clickedX);
|
double xCoord = transformToPositionX(clickedX);
|
||||||
double yCoord = transformToPositionY(clickedY);
|
double yCoord = transformToPositionY(clickedY);
|
||||||
|
|
||||||
ArrayList<Mote> motes = new ArrayList<Mote>();
|
ArrayList<Mote> motes = new ArrayList<>();
|
||||||
|
|
||||||
// Calculate painted mote radius in coordinates
|
// Calculate painted mote radius in coordinates
|
||||||
double paintedMoteWidth = transformToPositionX(MOTE_RADIUS)
|
double paintedMoteWidth = transformToPositionX(MOTE_RADIUS)
|
||||||
|
@ -1118,7 +1115,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
motes.add(simulation.getMote(i));
|
motes.add(simulation.getMote(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (motes.size() == 0) {
|
if (motes.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1398,7 +1395,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Element> getConfigXML() {
|
public Collection<Element> getConfigXML() {
|
||||||
ArrayList<Element> config = new ArrayList<Element>();
|
ArrayList<Element> config = new ArrayList<>();
|
||||||
Element element;
|
Element element;
|
||||||
|
|
||||||
/* Show mote-to-mote relations */
|
/* Show mote-to-mote relations */
|
||||||
|
@ -1693,10 +1690,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(Visualizer visualizer, Simulation simulation) {
|
public boolean isEnabled(Visualizer visualizer, Simulation simulation) {
|
||||||
if (!(visualizer.getUI() instanceof BasicInternalFrameUI)) {
|
return visualizer.getUI() instanceof BasicInternalFrameUI;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.contikios.cooja.radiomediums.DirectedGraphMedium;
|
||||||
@ClassDescription("Radio environment (DGRM)")
|
@ClassDescription("Radio environment (DGRM)")
|
||||||
@SupportedArguments(radioMediums = {DirectedGraphMedium.class})
|
@SupportedArguments(radioMediums = {DirectedGraphMedium.class})
|
||||||
public class DGRMVisualizerSkin implements VisualizerSkin {
|
public class DGRMVisualizerSkin implements VisualizerSkin {
|
||||||
private static Logger logger = Logger.getLogger(DGRMVisualizerSkin.class);
|
private static final Logger logger = Logger.getLogger(DGRMVisualizerSkin.class);
|
||||||
|
|
||||||
private Simulation simulation = null;
|
private Simulation simulation = null;
|
||||||
private Visualizer visualizer = null;
|
private Visualizer visualizer = null;
|
||||||
|
|
Loading…
Reference in a new issue