Skip to content
Draft
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 @@ -76,7 +76,7 @@ public static synchronized void registerPV(AlarmPV alarmPV)
{
if(!pvs.containsKey(alarmPV.getInfo().getCompletePath()))
{
pvs.put(alarmPV.getInfo().getCompletePath(), new ArrayList<AlarmPV>());
pvs.put(alarmPV.getInfo().getCompletePath(), new ArrayList<>());
}
pvs.get(alarmPV.getInfo().getCompletePath()).add(alarmPV);
// Check if the alarm client associated with the root is created and running
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public Runnable getRunnable() {

List<AlarmLogTableItem> result = objectMapper
.readValue(response.body(),
new TypeReference<List<AlarmLogTableItem>>() {
});
new TypeReference<>() {
});
if (result.size() >= 1) {
alarmMessageHandler.accept(result.get(0));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public static class Builder {
private String name;
// optional
private String owner;
private Set<Tag.Builder> tags = new HashSet<Tag.Builder>();
private Set<Property.Builder> properties = new HashSet<Property.Builder>();
private Set<Tag.Builder> tags = new HashSet<>();
private Set<Property.Builder> properties = new HashSet<>();

/**
* Create a channel builder initialized to a copy of the channel
Expand Down Expand Up @@ -170,12 +170,12 @@ public Channel build() {
public Channel(XmlChannel channel) {
this.name = channel.getName();
this.owner = channel.getOwner();
Map<String, Tag> newTags = new HashMap<String, Tag>();
Map<String, Tag> newTags = new HashMap<>();
for (XmlTag tag : channel.getTags()) {
newTags.put(tag.getName(), new Tag(tag));
}
this.tags = Collections.unmodifiableMap(newTags);
Map<String, Property> newProperties = new HashMap<String, Property>();
Map<String, Property> newProperties = new HashMap<>();
for (XmlProperty property : channel.getProperties()) {
newProperties.put(property.getName(), new Property(property));
}
Expand All @@ -186,12 +186,12 @@ public Channel(XmlChannel channel) {
private Channel(Builder builder) {
this.name = builder.name;
this.owner = builder.owner;
Map<String, Tag> newTags = new HashMap<String, Tag>();
Map<String, Tag> newTags = new HashMap<>();
for (Tag.Builder tag : builder.tags) {
newTags.put(tag.build().getName(), tag.build());
}
this.tags = Collections.unmodifiableMap(newTags);
Map<String, Property> newProperties = new HashMap<String, Property>();
Map<String, Property> newProperties = new HashMap<>();
for (Property.Builder property : builder.properties) {
newProperties.put(property.build().getName(), property.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ChannelFinderService {
private static final String DEFAULT = "default";

private ChannelFinderService() {
channelFinderClients = new HashMap<String, ChannelFinderClient>();
channelFinderClients = new HashMap<>();
}

public static ChannelFinderService getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Result(Exception exception, Collection<Channel> channels) {
// Guarded by this: will keep track whether a query is already running
private boolean running = false;

private List<ChannelQueryListener> listeners = new CopyOnWriteArrayList<ChannelQueryListener>();
private List<ChannelQueryListener> listeners = new CopyOnWriteArrayList<>();

public static class Builder {
private String query = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private ChannelUtil() {
* @return Collection of names of tags
*/
public static Collection<String> getTagNames(Channel channel) {
Collection<String> tagNames = new HashSet<String>();
Collection<String> tagNames = new HashSet<>();
for (Tag tag : channel.getTags()) {
tagNames.add(tag.getName());
}
Expand All @@ -50,7 +50,7 @@ public static Collection<String> getTagNames(Channel channel) {
* channel in channels
*/
public static Collection<String> getAllTagNames(Collection<Channel> channels) {
Collection<String> tagNames = new HashSet<String>();
Collection<String> tagNames = new HashSet<>();
for (Channel channel : channels) {
tagNames.addAll(getTagNames(channel));
}
Expand All @@ -65,7 +65,7 @@ public static Collection<String> getAllTagNames(Collection<Channel> channels) {
* @return Collection of names of properties
*/
public static Collection<String> getPropertyNames(Channel channel) {
Collection<String> propertyNames = new HashSet<String>();
Collection<String> propertyNames = new HashSet<>();
for (Property property : channel.getProperties()) {
if (property.getValue() != null)
propertyNames.add(property.getName());
Expand All @@ -82,15 +82,15 @@ public static Collection<String> getPropertyNames(Channel channel) {
* more channel in channels
*/
public static Collection<String> getPropertyNames(Collection<Channel> channels) {
Collection<String> propertyNames = new HashSet<String>();
Collection<String> propertyNames = new HashSet<>();
for (Channel channel : channels) {
propertyNames.addAll(getPropertyNames(channel));
}
return propertyNames;
}

public static Collection<String> getPropValues(Collection<Channel> channels, String propertyName) {
SortedSet<String> propertyValues = new TreeSet<String>();
SortedSet<String> propertyValues = new TreeSet<>();
for (Channel channel : channels) {
if (channel.getProperty(propertyName) != null && channel.getProperty(propertyName).getValue() != null)
propertyValues.add(channel.getProperty(propertyName).getValue());
Expand All @@ -107,7 +107,7 @@ public static Collection<String> getPropValues(Collection<Channel> channels, Str
* channels
*/
public static Collection<String> getChannelNames(Collection<Channel> channels) {
Collection<String> channelNames = new HashSet<String>();
Collection<String> channelNames = new HashSet<>();
for (Channel channel : channels) {
channelNames.add(channel.getName());
}
Expand All @@ -126,8 +126,8 @@ public static Collection<String> getChannelNames(Collection<Channel> channels) {
* @return Collection of Channels which contains all properties with propNames
*/
public static Collection<Channel> filterbyProperties(Collection<Channel> channels, Collection<String> propNames) {
Collection<Channel> result = new ArrayList<Channel>();
Collection<Channel> input = new ArrayList<Channel>(channels);
Collection<Channel> result = new ArrayList<>();
Collection<Channel> input = new ArrayList<>(channels);
for (Channel channel : input) {
if (channel.getPropertyNames().containsAll(propNames)) {
result.add(channel);
Expand All @@ -148,8 +148,8 @@ public static Collection<Channel> filterbyProperties(Collection<Channel> channel
* @return Collections of Channels which have all the tags within tagNames
*/
public static Collection<Channel> filterbyTags(Collection<Channel> channels, Collection<String> tagNames) {
Collection<Channel> result = new ArrayList<Channel>();
Collection<Channel> input = new ArrayList<Channel>(channels);
Collection<Channel> result = new ArrayList<>();
Collection<Channel> input = new ArrayList<>(channels);
for (Channel channel : input) {
if (channel.getTagNames().containsAll(tagNames)) {
result.add(channel);
Expand All @@ -174,8 +174,8 @@ public static Collection<Channel> filterbyTags(Collection<Channel> channels, Col
*/
public static Collection<Channel> filterbyElements(Collection<Channel> channels, Collection<String> propNames,
Collection<String> tagNames) {
Collection<Channel> result = new ArrayList<Channel>();
Collection<Channel> input = new ArrayList<Channel>(channels);
Collection<Channel> result = new ArrayList<>();
Collection<Channel> input = new ArrayList<>(channels);
for (Channel channel : input) {
if (channel.getPropertyNames().containsAll(propNames) && channel.getTagNames().containsAll(tagNames)) {
result.add(channel);
Expand All @@ -193,7 +193,7 @@ public static Collection<Channel> filterbyElements(Collection<Channel> channels,
* @return Collection of {@link Channel} built from the channelBuilders
*/
public static Collection<Channel> toChannels(Collection<Channel.Builder> channelBuilders) {
Collection<Channel> channels = new HashSet<Channel>();
Collection<Channel> channels = new HashSet<>();
for (Channel.Builder builder : channelBuilders) {
channels.add(builder.build());
}
Expand All @@ -209,7 +209,7 @@ public static Collection<Channel> toChannels(Collection<Channel.Builder> channel
* @return Collection of {@link Channel} built from the channelBuilders
*/
public static List<XmlChannel> toCollectionXmlChannels(Collection<Channel.Builder> channelBuilders) {
List<XmlChannel> xmlchannels = new ArrayList<XmlChannel>();
List<XmlChannel> xmlchannels = new ArrayList<>();
for (Channel.Builder builder : channelBuilders) {
xmlchannels.add(builder.toXml());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
public class XmlChannel {
private String name;
private String owner;
private List<XmlProperty> properties = new ArrayList<XmlProperty>();
private List<XmlTag> tags = new ArrayList<XmlTag>();
private List<XmlProperty> properties = new ArrayList<>();
private List<XmlTag> tags = new ArrayList<>();

/** Creates a new instance of XmlChannel */
public XmlChannel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class XmlProperty {
private String name = null;
private String owner = null;
private String value = null;
private List<XmlChannel> channels = new ArrayList<XmlChannel>();
private List<XmlChannel> channels = new ArrayList<>();

/**
* Creates a new instance of XmlProperty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class XmlTag {
private String name = null;
private String owner = null;
private List<XmlChannel> channels = new ArrayList<XmlChannel>();
private List<XmlChannel> channels = new ArrayList<>();

/**
* Creates a new instance of XmlTag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public CFProposalProvider() {
return;
}

ConnectionCheckJob.submit(this.client, new BiConsumer<String, Exception>() {
ConnectionCheckJob.submit(this.client, new BiConsumer<>() {
@Override
public void accept(String s, Exception e) {
active = false;
Throwable cause = e.getCause();
while (cause != null && ! (cause instanceof ChannelFinderException))
while (cause != null && !(cause instanceof ChannelFinderException))
cause = cause.getCause();
if (cause != null)
e = (Exception)cause;
e = (Exception) cause;
CFProposalProvider.logger.log(Level.INFO, "Failed to create Channel Finder PVProposalProvider", e);
}
});
Expand All @@ -67,7 +67,7 @@ public List<Proposal> lookup(String searchString) {
}
// TODO this needs the v3.0.2 of channelfinder
if (active) {
Map<String, String> searchMap = new HashMap<String, String>();
Map<String, String> searchMap = new HashMap<>();
searchMap.put("~name", "*" + searchString + "*");
// searchMap.put("~size", "20");
result = client.find(searchMap).stream().limit(20).map((channel) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ public class AddPropertyController {

@FXML
public void initialize() {
availableProperties.setCellFactory(new Callback<ListView<Property>, ListCell<Property>>(){
availableProperties.setCellFactory(new Callback<>() {

@Override
public ListCell<Property> call(ListView<Property> p) {

ListCell<Property> cell = new ListCell<Property>(){
ListCell<Property> cell = new ListCell<>() {

@Override
protected void updateItem(Property property, boolean bln) {
super.updateItem(property, bln);
if (property != null) {
setText(property.getName() + " ("+property.getOwner()+")");
setText(property.getName() + " (" + property.getOwner() + ")");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public void initialize() {

tableView.getColumns().clear();
TableColumn<Channel, String> nameCol = new TableColumn<>(Messages.ChannelTableNameColumn);
nameCol.setCellValueFactory(new PropertyValueFactory<Channel, String>("name"));
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));

TableColumn<Channel, String> ownerCol = new TableColumn<>(Messages.ChannelTableOwnerColumn);
ownerCol.setCellValueFactory(new PropertyValueFactory<Channel, String>("owner"));
ownerCol.setCellValueFactory(new PropertyValueFactory<>("owner"));
tableView.getColumns().addAll(nameCol, ownerCol);

if (showActiveCb) {
Expand Down Expand Up @@ -287,12 +287,12 @@ public void setChannels(Collection<Channel> channels) {
@Override
public TableColumn<Channel, String> apply(String propName) {
TableColumn<Channel, String> propCol = new TableColumn<>(propName);
propCol.setCellValueFactory(new Callback<CellDataFeatures<Channel, String>, ObservableValue<String>>() {
propCol.setCellValueFactory(new Callback<>() {

@Override
public ObservableValue<String> call(CellDataFeatures<Channel, String> channel) {
Property prop = channel.getValue().getProperty(propName);
return new SimpleStringProperty(prop != null ? prop.getValue(): "");
return new SimpleStringProperty(prop != null ? prop.getValue() : "");
}
});
return propCol;
Expand All @@ -304,7 +304,7 @@ public ObservableValue<String> call(CellDataFeatures<Channel, String> channel) {
@Override
public TableColumn<Channel, String> apply(String tagName) {
TableColumn<Channel, String> tagCol = new TableColumn<>(tagName);
tagCol.setCellValueFactory(new Callback<CellDataFeatures<Channel, String>, ObservableValue<String>>() {
tagCol.setCellValueFactory(new Callback<>() {

@Override
public ObservableValue<String> call(CellDataFeatures<Channel, String> channel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public ChannelTreeByPropertyModel(String query, Collection<Channel> allChannels,

// Filter the channels that would not show up as leaf because they don't
// have a value for all properties
this.allChannels = new ArrayList<Channel>(ChannelUtil.filterbyProperties(allChannels, properties));
this.allChannels = new ArrayList<>(ChannelUtil.filterbyProperties(allChannels, properties));
this.properties = properties;

this.nodePVs = new ArrayList<PV>();
this.nodePVValues = new HashMap<String, VType>();
this.nodePVs = new ArrayList<>();
this.nodePVValues = new HashMap<>();

this.query = query;
this.showChannelNames = showChannelNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeBy
nodeChannels = model.allChannels;
} else if (getPropertyName() == null) {
// leaf node, channels that match the name
nodeChannels = new ArrayList<Channel>();
nodeChannels = new ArrayList<>();
for (Channel channel : parentNode.nodeChannels) {
if (this.displayName.equals(channel.getName())) {
nodeChannels.add(channel);
Expand All @@ -92,7 +92,7 @@ public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeBy
}
} else {
// Filter the channels that match the property name
nodeChannels = new ArrayList<Channel>();
nodeChannels = new ArrayList<>();
for (Channel channel : parentNode.nodeChannels) {
if (this.displayName.equals(channel.getProperty(getPropertyName()).getValue())) {
nodeChannels.add(channel);
Expand All @@ -102,12 +102,12 @@ public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeBy

if (depth < model.properties.size()) {
// Children will be property values
childrenNames = new ArrayList<String>(ChannelUtil.getPropValues(nodeChannels, model.properties.get(depth)));
childrenNames = new ArrayList<>(ChannelUtil.getPropValues(nodeChannels, model.properties.get(depth)));
Collections.sort(childrenNames);
} else if (depth == model.properties.size()) {
// Children will be channels
if (model.isShowChannelNames()) {
childrenNames = new ArrayList<String>(ChannelUtil.getChannelNames(nodeChannels));
childrenNames = new ArrayList<>(ChannelUtil.getChannelNames(nodeChannels));
Collections.sort(childrenNames);
} else {
childrenNames = null;
Expand Down Expand Up @@ -221,7 +221,7 @@ private void includePropertyAndValue(Map<String, String> map) {
}

public Map<String, String> getPropertiesAndValues() {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
includePropertyAndValue(map);
return map;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void initialize() {
treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
treeTableView.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
if (newSelection != null) {
final List<Channel> selectedChannels = new ArrayList<Channel>();
final List<Channel> selectedChannels = new ArrayList<>();
treeTableView.getSelectionModel().getSelectedItems().stream().forEach(item -> {
selectedChannels.addAll(item.getValue().getNodeChannels());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private List<Channel> testChannels() throws IOException {

final ObjectMapper mapper = new ObjectMapper();
try {
List<XmlChannel> xmlChannels = mapper.readValue(this.getClass().getClassLoader().getResource("testChannels.json"), new TypeReference<List<XmlChannel>>() {
List<XmlChannel> xmlChannels = mapper.readValue(this.getClass().getClassLoader().getResource("testChannels.json"), new TypeReference<>() {
});
for (XmlChannel xmlchannel : xmlChannels) {
channels.add(new Channel(xmlchannel));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private List<Channel> testChannels() throws IOException {

final ObjectMapper mapper = new ObjectMapper();
try {
List<XmlChannel> xmlChannels = mapper.readValue(this.getClass().getClassLoader().getResource("testChannels.json"), new TypeReference<List<XmlChannel>>() {
List<XmlChannel> xmlChannels = mapper.readValue(this.getClass().getClassLoader().getResource("testChannels.json"), new TypeReference<>() {
});
for (XmlChannel xmlchannel : xmlChannels) {
channels.add(new Channel(xmlchannel));
Expand Down
Loading
Loading