Improve code readability in binnie.genetics package

Drop unused (empty) method MachinePackage#register() from all classes
This commit is contained in:
kordum authored and mezz committed 2017-04-27 14:48:45 -07:00
1 parent 856f08b752
commit 730043ba9c
112 files changed
+4354 -4697

No files matched your search

@@ -1,87 +1,86 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.craftgui;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.genetics.Gene;
import java.util.ArrayList;
import forestry.api.genetics.IAllele;
import java.util.List;
import forestry.api.genetics.IChromosomeType;
import java.util.Map;
import binnie.Binnie;
import binnie.genetics.genetics.GeneTracker;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.IWidget;
import binnie.core.genetics.BreedingSystem;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.genetics.BreedingSystem;
import binnie.core.genetics.Gene;
import binnie.genetics.genetics.GeneTracker;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
public class ControlGeneScroll extends Control implements IControlValue<BreedingSystem>
{
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ControlGeneScroll extends Control implements IControlValue<BreedingSystem> {
private String filter;
private BreedingSystem system;
protected ControlGeneScroll(final IWidget parent, final float x, final float y, final float w, final float h) {
protected ControlGeneScroll(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
this.filter = "";
this.system = null;
filter = "";
system = null;
}
public void setFilter(final String filter) {
public void setFilter(String filter) {
this.filter = filter.toLowerCase();
this.refresh();
refresh();
}
public void setGenes(final BreedingSystem system) {
public void setGenes(BreedingSystem system) {
this.system = system;
this.refresh();
refresh();
}
public void refresh() {
this.deleteAllChildren();
final GeneTracker tracker = GeneTracker.getTracker(Window.get(this).getWorld(), Window.get(this).getUsername());
final Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(this.system.getSpeciesRoot());
int x = 0;
deleteAllChildren();
GeneTracker tracker = GeneTracker.getTracker(Window.get(this).getWorld(), Window.get(this).getUsername());
Map<IChromosomeType, List<IAllele>> genes = Binnie.Genetics.getChromosomeMap(system.getSpeciesRoot());
int x;
int y = 0;
final boolean isNEI = ((WindowGeneBank) Window.get(this)).isNei;
for (final Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
final List<IAllele> discovered = new ArrayList<IAllele>();
for (final IAllele allele : entry.getValue()) {
final Gene gene = new Gene(allele, entry.getKey(), this.system.getSpeciesRoot());
if ((isNEI || tracker.isSequenced(new Gene(allele, entry.getKey(), this.system.getSpeciesRoot()))) && gene.getName().toLowerCase().contains(this.filter)) {
boolean isNEI = ((WindowGeneBank) Window.get(this)).isNei;
for (Map.Entry<IChromosomeType, List<IAllele>> entry : genes.entrySet()) {
List<IAllele> discovered = new ArrayList<IAllele>();
for (IAllele allele : entry.getValue()) {
Gene gene = new Gene(allele, entry.getKey(), system.getSpeciesRoot());
if ((isNEI || tracker.isSequenced(new Gene(allele, entry.getKey(), system.getSpeciesRoot()))) && gene.getName().toLowerCase().contains(filter)) {
discovered.add(allele);
}
}
if (discovered.size() == 0) {
continue;
}
x = 0;
new ControlText(this, new IPoint(x, y), this.system.getChromosomeName(entry.getKey()));
new ControlText(this, new IPoint(x, y), system.getChromosomeName(entry.getKey()));
y += 12;
for (final IAllele allele : discovered) {
if (x + 18 > this.getSize().x()) {
for (IAllele allele : discovered) {
if (x + 18 > getSize().x()) {
y += 20;
x = 0;
}
new ControlGene(this, x, y).setValue(new Gene(allele, entry.getKey(), this.system.getSpeciesRoot()));
new ControlGene(this, x, y).setValue(new Gene(allele, entry.getKey(), system.getSpeciesRoot()));
x += 18;
}
y += 24;
}
this.setSize(new IPoint(this.getSize().x(), y));
}
@Override
public void setValue(final BreedingSystem system) {
this.setGenes(system);
setSize(new IPoint(getSize().x(), y));
}
@Override
public BreedingSystem getValue() {
return this.system;
return system;
}
@Override
public void setValue(BreedingSystem system) {
setGenes(system);
}
}