Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void sendConfigHierarchy(final Producer<String, AlarmTreeItem<?>> produc
}

// Place all keys (alarm tree paths) in the same partition
private static final Integer partition = Integer.valueOf(0);
private static final Integer partition = 0;

private void sendItemConfig(final Producer<String, AlarmTreeItem<?>> producer,
final String topic, final AlarmTreeItem<?> item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void close()
@SuppressWarnings("resource")
Producer<String, BasicState> producer = new KafkaProducer<>(props, key_serializer, value_serializer);
// Place all keys (alarm tree paths) in the same partition
Integer partition = Integer.valueOf(0);
Integer partition = 0;

while (true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private void startup()
// expand tree item if is matches item name
if (tree_config_view.getRoot() != null && itemName != null) {
for (TreeItem treeItem : tree_config_view.getRoot().getChildren()) {
if (((AlarmTreeItem) treeItem.getValue()).getName().equals(itemName)) {
if (((AlarmTreeItem<?>) treeItem.getValue()).getName().equals(itemName)) {
expandAlarms(treeItem);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void startup()
// expand tree item if is matches item name
if (tree_view.getRoot() != null && itemName != null) {
for (TreeItem treeItem : tree_view.getRoot().getChildren()) {
if (((AlarmTreeItem) treeItem.getValue()).getName().equals(itemName)) {
if (((AlarmTreeItem<?>) treeItem.getValue()).getName().equals(itemName)) {
expandAlarms(treeItem);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public String getDisplayValue()
private String formatVType(VType value )
{
Alarm alarm = Alarm.alarmOf(value);
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(FormatOptionHandler.format(value, FormatOption.DEFAULT, -1, true));
if (!alarm.getSeverity().equals(AlarmSeverity.NONE))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ public static VType readValue(
// Ensure that we have labels for all indices.
int min_value = Integer.MAX_VALUE;
int max_value = Integer.MIN_VALUE;
for (var i = 0; i < enum_value.size(); ++i) {
final var value = enum_value.get(i);
for (final Integer value : enum_value) {
min_value = Math.min(min_value, value);
max_value = Math.max(max_value, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ private void exportTable(final JobMonitor monitor) throws Exception
final VType line[] = iter.next();

cell = createTimeCell(row = sheet.createRow(row.getRowNum() + 1), time);
for (int i=0; i<line.length; ++i)
cell = createValueCells(row, cell.getColumnIndex()+1, line[i]);
for (VType vType : line) cell = createValueCells(row, cell.getColumnIndex() + 1, vType);
++line_count;
if ((line_count % PROGRESS_UPDATE_LINES) == 0)
monitor.beginTask(MessageFormat.format("Wrote {0} samples", line_count));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ protected void performExport(final JobMonitor monitor,
final VType line[] = sheet.next();
out.print(unixTimeStamp ? time.toEpochMilli() : TimestampFormats.MILLI_FORMAT.format(time));

for (int i=0; i<line.length; ++i)
out.print(Messages.Export_Delimiter + formatter.format(line[i]));
for (VType vType : line) out.print(Messages.Export_Delimiter + formatter.format(vType));
out.println();
++line_count;
if ((line_count % PROGRESS_UPDATE_LINES) == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,11 @@
while (more_input)
{ // Find oldest time stamp of all the inputs
time = null;
for (int i = 0; i < values.length; i++)
{
if (values[i] == null)
for (VType vType : values) {
if (vType == null)
continue;
final Instant sample_time = org.phoebus.core.vtypes.VTypeHelper.getTimestamp(values[i]);
if (time == null || sample_time.compareTo(time) < 0)
final Instant sample_time = org.phoebus.core.vtypes.VTypeHelper.getTimestamp(vType);

Check warning on line 201 in app/databrowser/src/main/java/org/csstudio/trends/databrowser3/model/FormulaItem.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AZ7Qa1L3B_nxfnuejfYJ&open=AZ7Qa1L3B_nxfnuejfYJ&pullRequest=3834
if (time == null || sample_time.compareTo(time) < 0)
time = sample_time;
}
if (time == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ private Node createContent(final Model model, final int count)
Tooltip displayNameTextFieldTooltip = new Tooltip(Messages.TraceDisplayNameTT);
displayNameTextField.setTooltip(displayNameTextFieldTooltip);
gridPane.add(displayNameTextField, 1, row, 2, 1);
nameAndDisplayNames.add(new Pair(name, displayNameTextField));
nameAndDisplayNames.add(new Pair<>(name, displayNameTextField));
}
else {
nameAndDisplayNames.add(new Pair(name, name));
nameAndDisplayNames.add(new Pair<>(name, name));
}

if (! formula)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public FormulaTreeCategoryNode(FormulaFunction firstChild) {
*/
public void addChild(FormulaFunction child) {
FormulaTreeByCategoryNode leafNode = new FormulaTreeByCategoryNode(child.getSignature(), child.getDescription());
getChildren().add(new TreeItem(leafNode));
getChildren().add(new TreeItem<>(leafNode));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public <T> Optional<T> adapt(Object adaptableObject, Class<T> adapterType)
{
EmailEntry emailEntry = new EmailEntry();

StringBuffer title = new StringBuffer();
StringBuilder title = new StringBuilder();
title.append("Display Screenshot for : " + selectionInfo.getName());
emailEntry.setSubject(title.toString());
emailEntry.setBody(getBody(selectionInfo));
Expand Down Expand Up @@ -81,7 +81,7 @@ else if (adapterType.isAssignableFrom(LogEntry.class))

private String getBody(SelectionInfo selectionInfo)
{
StringBuffer body = new StringBuffer();
StringBuilder body = new StringBuilder();
body.append("Display Screenshot for the resource :" + System.lineSeparator());
body.append(selectionInfo.toURI());
body.append(System.lineSeparator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public boolean isExistInEDL(){

@Override
public String toString() {
StringBuffer concatenatedValues = new StringBuffer();
StringBuilder concatenatedValues = new StringBuilder();

Iterator<String> iterator = values.iterator();
while (iterator.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ private void parseStaticColorListDefinition() throws EdmException {
try {
String[] color = getValue(2).split(" ");

red = Integer.valueOf(color[0]).intValue();
green = Integer.valueOf(color[1]).intValue();
blue = Integer.valueOf(color[2]).intValue();
red = Integer.valueOf(color[0]);
green = Integer.valueOf(color[1]);
blue = Integer.valueOf(color[2]);

if (getValueCount() == 4) {
blinking = true;
color = getValue(3).split(" ");
blinkRed = Integer.valueOf(color[0]).intValue();
blinkGreen = Integer.valueOf(color[1]).intValue();
blinkBlue = Integer.valueOf(color[2]).intValue();
blinkRed = Integer.valueOf(color[0]);
blinkGreen = Integer.valueOf(color[1]);
blinkBlue = Integer.valueOf(color[2]);
}
else {
blinking = false;
Expand Down Expand Up @@ -172,9 +172,9 @@ private void parseRGBColor() throws EdmException {

try {
name = null;
red = Integer.valueOf(m.group(2)).intValue();
green = Integer.valueOf(m.group(3)).intValue();
blue = Integer.valueOf(m.group(4)).intValue();
red = Integer.valueOf(m.group(2));
green = Integer.valueOf(m.group(3));
blue = Integer.valueOf(m.group(4));
blinking = false;

log.config("Parsed RGB color.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
Expand Down Expand Up @@ -89,9 +88,8 @@ private void populateMenuColorsMap(EdmEntity colorsData) throws EdmException {

if (!nonMenuColors.isEmpty()) {
log.fine("Color definitions exist that are not in menumap. Adding them at the end.");
Iterator<EdmColor> iterator = nonMenuColors.iterator();
while (iterator.hasNext()) {
menuColorsMap.put(menuInd, iterator.next());
for (EdmColor nonMenuColor : nonMenuColors) {
menuColorsMap.put(menuInd, nonMenuColor);
menuInd++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public EdmFont(EdmAttribute genericAttribute, boolean required) throws EdmExcept
}

try {
size = Double.valueOf(sizeStr).doubleValue();
size = Double.valueOf(sizeStr);
} catch (Exception e) {
throw new EdmException(EdmException.COLOR_FORMAT_ERROR, "Invalid RGB color format.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public EdmMultilineText(EdmAttribute genericAtrtibute, boolean required) throws
}
}

StringBuffer textBuffer = new StringBuffer();
StringBuilder textBuffer = new StringBuilder();
for (int valueIndex = 0; valueIndex < getValueCount(); valueIndex++) {

textBuffer.append(getValue(valueIndex));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ private void parseCompoundProperty(Matcher m, EdmAttribute a) throws EdmExceptio
}

boolean nestError = false;
for (int c = 0; c < reservedWords.length; c ++) {
if (line.contains(reservedWords[c])) {
for (String reservedWord : reservedWords) {
if (line.contains(reservedWord)) {
nestError = true;
break;
}
Expand Down Expand Up @@ -247,16 +247,16 @@ private int[] getClosingPosition(Vector<Integer> begins,
int level = 0;
int end = 0;
int endIndex = 0;
for (int x = 0; x < all.size(); x++) {
if (begins.contains(all.get(x)))
for (Integer integer : all) {
if (begins.contains(integer))
level = level + 1;
if (ends.contains(all.get(x))) {
if (ends.contains(integer)) {
level = level - 1;
endIndex = endIndex + 1;
}

if (level == 0) {
end = all.get(x);
end = integer;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,29 +422,24 @@ public Macros makeMacros(String args)
*/
public String removeParentMacros(String args) {
String[] argList = args.split(",");
StringBuffer strBuff = new StringBuffer();
for (int ii = 0; ii < argList.length; ii++) {
String[] argParts = argList[ii].split("=");
if (argParts.length == 1)
{
if (! argParts[0].isEmpty())
{ // Pass X=""
StringBuilder strBuff = new StringBuilder();
for (String s : argList) {
String[] argParts = s.split("=");
if (argParts.length == 1) {
if (!argParts[0].isEmpty()) { // Pass X=""
if (strBuff.length() != 0)
strBuff.append(", ");
strBuff.append(argParts[0]).append("=\"\"");
}
// else: Empty
}
else if (argParts.length == 2)
{
} else if (argParts.length == 2) {
if (!argParts[1].replaceAll(" ", "").equals(
"$(" + argParts[0].trim() + ")")) {
"$(" + argParts[0].trim() + ")")) {
if (strBuff.length() != 0)
strBuff.append(", ");
strBuff.append(argList[ii]);
strBuff.append(s);
}
}
else
} else
logger.log(Level.WARNING, "Erroneous macro setting in " + args);
}
String resArgs = strBuff.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public final String getFill() {
@Override
public Object[] getChildren(){
Object[] ret = new Object[4];
ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_clr));
ret[1] = new ADLResource(ADLResource.LINE_WIDTH, Integer.valueOf(_width));
ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, _clr);
ret[1] = new ADLResource(ADLResource.LINE_WIDTH, _width);
ret[2] = new ADLResource(ADLResource.STYLE, _style);
ret[3] = new ADLResource(ADLResource.FILL, _fill);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ protected final void parseWidgetPart(final ADLWidget adlWidget)
@Override
public Object[] getChildren() {
Object[] ret = new Object[3];
ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_clr));
ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, Integer.valueOf(_bclr));
ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, _clr);
ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, _bclr);
ret[2] = new ADLResource(ADLResource.CHANNEL, _chan);
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public ADLLimits(){
public Object[] getChildren() {
Object[] ret = new Object[6];
ret[0] = new ADLResource(ADLResource.LOPR_SRC, new String(loprSrc));
ret[1] = new ADLResource(ADLResource.LOPR_DEFAULT, Float.valueOf(loprDefault));
ret[1] = new ADLResource(ADLResource.LOPR_DEFAULT, loprDefault);
ret[2] = new ADLResource(ADLResource.HOPR_SRC, new String(hoprSrc));
ret[3] = new ADLResource(ADLResource.HOPR_DEFAULT, Float.valueOf(hoprDefault));
ret[3] = new ADLResource(ADLResource.HOPR_DEFAULT, hoprDefault);
ret[4] = new ADLResource(ADLResource.PREC_SRC, new String(precSrc));
ret[5] = new ADLResource(ADLResource.PREC_DEFAULT, Float.valueOf(precDefault));
ret[5] = new ADLResource(ADLResource.PREC_DEFAULT, (float) precDefault);

return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ public final int getHeight() {
@Override
public Object[] getChildren(){
Object[] ret = new Object[4];
ret[0] = new ADLResource(ADLResource.X, Integer.valueOf(_x));
ret[1] = new ADLResource(ADLResource.Y, Integer.valueOf(_y));
ret[2] = new ADLResource(ADLResource.WIDTH, Integer.valueOf(_width));
ret[3] = new ADLResource(ADLResource.HEIGHT, Integer.valueOf(_height));
ret[0] = new ADLResource(ADLResource.X, _x);
ret[1] = new ADLResource(ADLResource.Y, _y);
ret[2] = new ADLResource(ADLResource.WIDTH, _width);
ret[3] = new ADLResource(ADLResource.HEIGHT, _height);

return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Object[] getChildren() {
else {
ret = new Object[2];
}
ret[0] = new ADLResource(ADLResource.PEN_COLOR, Integer.valueOf(lineColor));
ret[0] = new ADLResource(ADLResource.PEN_COLOR, lineColor);
ret[1] = new ADLResource(ADLResource.CHANNEL, channel);
if (_hasLimits){
ret[2] = new ADLResource(ADLResource.ADL_LIMITS, _adlLimit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public Object[] getChildren() {
ArrayList<Object> ret = new ArrayList<>();
ret.add(new ADLResource(ADLResource.PLOT_AXIS_STYLE, axisStyle));
ret.add(new ADLResource(ADLResource.PLOT_RANGE_STYLE, rangeStyle));
ret.add(new ADLResource(ADLResource.PLOT_RANGE_MIN, Float.valueOf(minRange)));
ret.add(new ADLResource(ADLResource.PLOT_RANGE_MAX, Float.valueOf(maxRange)));
ret.add(new ADLResource(ADLResource.PLOT_RANGE_MIN, minRange));
ret.add(new ADLResource(ADLResource.PLOT_RANGE_MAX, maxRange));
return ret.toArray();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Object[] getChildren() {
ArrayList<Object> ret = new ArrayList<>();
if (!xData.equals(""))ret.add(new ADLResource(ADLResource.PLOT_XDATA, xData));
if (!yData.equals(""))ret.add(new ADLResource(ADLResource.PLOT_YDATA, yData));
ret.add(new ADLResource(ADLResource.PLOT_DATA_COLOR, Integer.valueOf(dataColor)));
ret.add(new ADLResource(ADLResource.PLOT_DATA_COLOR, dataColor));
return ret.toArray();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public ADLPlotcom(){
@Override
public Object[] getChildren() {
Object[] ret = new Object[5];
ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_clr));
ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, Integer.valueOf(_bclr));
ret[0] = new ADLResource(ADLResource.FOREGROUND_COLOR, _clr);
ret[1] = new ADLResource(ADLResource.BACKGROUND_COLOR, _bclr);
ret[2] = new ADLResource(ADLResource.CHANNEL, title);
ret[3] = new ADLResource(ADLResource.PLOT_XLABEL, xLabel);
ret[4] = new ADLResource(ADLResource.PLOT_YLABEL, yLabel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ public boolean isForeColorDefined() {
public Object[] getChildren() {
ArrayList<Object> ret = new ArrayList<>();
if (_hasObject) ret.add( _adlObject);
if (_isBackColorDefined) ret.add(new ADLResource(ADLResource.BACKGROUND_COLOR, Integer.valueOf(_bclr)) );
if (_isForeColorDefined) ret.add(new ADLResource(ADLResource.FOREGROUND_COLOR, Integer.valueOf(_bclr)) );
ret.add(new ADLResource(ADLResource.SNAP_TO_GRID, Boolean.valueOf(_snapToGrid)) );
ret.add(new ADLResource(ADLResource.GRID_ON, Boolean.valueOf(_gridOn)));
ret.add(new ADLResource(ADLResource.GRID_SPACING, Integer.valueOf(_gridSpacing)));
if (_isBackColorDefined) ret.add(new ADLResource(ADLResource.BACKGROUND_COLOR, _bclr) );
if (_isForeColorDefined) ret.add(new ADLResource(ADLResource.FOREGROUND_COLOR, _bclr) );
ret.add(new ADLResource(ADLResource.SNAP_TO_GRID, _snapToGrid) );
ret.add(new ADLResource(ADLResource.GRID_ON, _gridOn));
ret.add(new ADLResource(ADLResource.GRID_SPACING, _gridSpacing));
return ret.toArray();
}

Expand Down
Loading
Loading