mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-28 09:24:14 +01:00
Removed a lot of useless equals overrides.
Those introduces a very convoluted logic that is needed only in two cases. Moreover those are better handled by directly checking the object.
This commit is contained in:
parent
cd3639a574
commit
f111905da6
@ -46,9 +46,4 @@ public class CategoryPredicate implements Predicate<ContributedLibrary> {
|
||||
return input.getCategory() != null && category.equals(input.getCategory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof CategoryPredicate && ((CategoryPredicate) obj).category.equals(category);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,9 +51,4 @@ public class InstalledLibraryPredicate implements Predicate<ContributedLibrary>
|
||||
.count() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof InstalledLibraryPredicate;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,8 +41,4 @@ public class OnlyUpstreamReleasePredicate implements Predicate<ContributedLibrar
|
||||
return !(input instanceof UserLibrary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof OnlyUpstreamReleasePredicate;
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,4 @@ public class DropdownInstalledLibraryItem implements DropdownItem<ContributedLib
|
||||
return new InstalledLibraryPredicate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownInstalledLibraryItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,9 +54,4 @@ public class DropdownLibraryOfCategoryItem implements DropdownItem<ContributedLi
|
||||
return new CategoryPredicate(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownLibraryOfCategoryItem && ((DropdownLibraryOfCategoryItem) obj).category.equals(category);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,9 +54,4 @@ public class DropdownLibraryOfTypeItem implements DropdownItem<ContributedLibrar
|
||||
return new TypePredicate(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownLibraryOfTypeItem && ((DropdownLibraryOfTypeItem) obj).type.equals(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,9 +49,4 @@ public class DropdownUpdatableLibrariesItem implements DropdownItem<ContributedL
|
||||
return tr("Updatable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownUpdatableLibrariesItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
DropdownItem<ContributedLibrary> selected = (DropdownItem<ContributedLibrary>) typeChooser.getSelectedItem();
|
||||
previousRowAtPoint = -1;
|
||||
if (typeFilter == null || !typeFilter.equals(selected)) {
|
||||
if (typeFilter == null || typeFilter != selected.getFilterPredicate()) {
|
||||
typeFilter = selected.getFilterPredicate();
|
||||
if (contribTable.getCellEditor() != null) {
|
||||
contribTable.getCellEditor().stopCellEditing();
|
||||
@ -143,10 +143,10 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
categoryChooser.removeActionListener(categoryChooserActionListener);
|
||||
typeChooser.removeActionListener(typeChooserActionListener);
|
||||
|
||||
categoryFilter = null;
|
||||
categoryChooser.removeAllItems();
|
||||
|
||||
// Load categories
|
||||
categoryFilter = x -> true;
|
||||
categoryChooser.removeAllItems();
|
||||
categoryChooser.addItem(new DropdownAllItem());
|
||||
Collection<String> categories = BaseNoGui.librariesIndexer.getIndex().getCategories();
|
||||
for (String category : categories) {
|
||||
@ -162,7 +162,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
categoryChooser.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
typeFilter = null;
|
||||
typeFilter = x -> true;
|
||||
typeChooser.removeAllItems();
|
||||
typeChooser.addItem(new DropdownAllItem());
|
||||
typeChooser.addItem(new DropdownUpdatableLibrariesItem());
|
||||
|
@ -46,9 +46,4 @@ public class CategoryPredicate implements Predicate<ContributedPlatform> {
|
||||
return input.getCategory() != null && category.equals(input.getCategory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof CategoryPredicate && ((CategoryPredicate) obj).category.equals(category);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,14 +98,13 @@ public class ContributionManagerUI extends InstallerJDialog {
|
||||
|
||||
categoryChooser.removeActionListener(categoryChooserActionListener);
|
||||
|
||||
categoryFilter = null;
|
||||
categoryChooser.removeAllItems();
|
||||
|
||||
filterField.setEnabled(getContribModel().getRowCount() > 0);
|
||||
|
||||
categoryChooser.addActionListener(categoryChooserActionListener);
|
||||
|
||||
// Enable categories combo only if there are two or more choices
|
||||
categoryFilter = x -> true;
|
||||
categoryChooser.removeAllItems();
|
||||
categoryChooser.addItem(new DropdownAllCoresItem());
|
||||
categoryChooser.addItem(new DropdownUpdatableCoresItem());
|
||||
Collection<String> categories = BaseNoGui.indexer.getCategories();
|
||||
|
@ -47,8 +47,4 @@ public class DropdownAllCoresItem implements DropdownItem<ContributedPlatform> {
|
||||
return x -> true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownAllCoresItem;
|
||||
}
|
||||
}
|
||||
|
@ -54,9 +54,4 @@ public class DropdownCoreOfCategoryItem implements DropdownItem<ContributedPlatf
|
||||
return new CategoryPredicate(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownCoreOfCategoryItem && ((DropdownCoreOfCategoryItem) obj).category.equals(category);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,8 +49,4 @@ public class DropdownUpdatableCoresItem implements DropdownItem<ContributedPlatf
|
||||
return tr("Updatable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownUpdatableCoresItem;
|
||||
}
|
||||
}
|
||||
|
@ -46,9 +46,4 @@ public class DropdownAllItem implements DropdownItem<DownloadableContribution> {
|
||||
return x -> true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DropdownAllItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public abstract class InstallerJDialog<T> extends JDialog {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
DropdownItem<T> selected = (DropdownItem<T>) categoryChooser.getSelectedItem();
|
||||
previousRowAtPoint = -1;
|
||||
if (categoryFilter == null || !categoryFilter.equals(selected)) {
|
||||
if (categoryFilter == null || categoryFilter != selected.getFilterPredicate()) {
|
||||
categoryFilter = selected.getFilterPredicate();
|
||||
if (contribTable.getCellEditor() != null) {
|
||||
contribTable.getCellEditor().stopCellEditing();
|
||||
|
@ -40,8 +40,4 @@ public class BuiltInPredicate implements Predicate<DownloadableContribution> {
|
||||
return input.isReadOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof BuiltInPredicate;
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,4 @@ public class InstalledPredicate implements Predicate<DownloadableContribution> {
|
||||
return input.isInstalled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DownloadableContribution;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,9 +46,4 @@ public class TypePredicate implements Predicate<ContributedLibrary> {
|
||||
return input.getTypes() != null && input.getTypes().contains(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof TypePredicate && ((TypePredicate) obj).type.equals(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user