pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,45 +18,38 @@
package appeng.util.iterators;
import java.util.Iterator;
import appeng.api.storage.data.IAEItemStack;
import appeng.tile.inventory.AppEngInternalAEInventory;
public final class AEInvIterator implements Iterator<IAEItemStack> {
private final AppEngInternalAEInventory inventory;
private final int size;
public final class AEInvIterator implements Iterator<IAEItemStack>
{
private final AppEngInternalAEInventory inventory;
private final int size;
private int counter = 0;
private int counter = 0;
public AEInvIterator(final AppEngInternalAEInventory inventory) {
this.inventory = inventory;
this.size = this.inventory.getSlots();
}
public AEInvIterator( final AppEngInternalAEInventory inventory )
{
this.inventory = inventory;
this.size = this.inventory.getSlots();
}
@Override
public boolean hasNext() {
return this.counter < this.size;
}
@Override
public boolean hasNext()
{
return this.counter < this.size;
}
@Override
public IAEItemStack next() {
final IAEItemStack result = this.inventory.getAEStackInSlot(this.counter);
@Override
public IAEItemStack next()
{
final IAEItemStack result = this.inventory.getAEStackInSlot( this.counter );
this.counter++;
this.counter++;
return result;
}
return result;
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
@@ -18,38 +18,31 @@
package appeng.util.iterators;
import java.util.Iterator;
public final class ChainedIterator<T> implements Iterator<T> {
private final T[] list;
public final class ChainedIterator<T> implements Iterator<T>
{
private final T[] list;
private int offset = 0;
private int offset = 0;
public ChainedIterator(final T... list) {
this.list = list;
}
public ChainedIterator( final T... list )
{
this.list = list;
}
@Override
public boolean hasNext() {
return this.offset < this.list.length;
}
@Override
public boolean hasNext()
{
return this.offset < this.list.length;
}
@Override
public T next() {
final T result = this.list[this.offset];
this.offset++;
return result;
}
@Override
public T next()
{
final T result = this.list[this.offset];
this.offset++;
return result;
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
@@ -18,44 +18,37 @@
package appeng.util.iterators;
import java.util.Iterator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
public final class InvIterator implements Iterator<ItemStack> {
private final IItemHandler inventory;
private final int size;
public final class InvIterator implements Iterator<ItemStack>
{
private final IItemHandler inventory;
private final int size;
private int counter = 0;
private int counter = 0;
public InvIterator(final IItemHandler inventory) {
this.inventory = inventory;
this.size = this.inventory.getSlots();
}
public InvIterator( final IItemHandler inventory )
{
this.inventory = inventory;
this.size = this.inventory.getSlots();
}
@Override
public boolean hasNext() {
return this.counter < this.size;
}
@Override
public boolean hasNext()
{
return this.counter < this.size;
}
@Override
public ItemStack next() {
final ItemStack result = this.inventory.getStackInSlot(this.counter);
this.counter++;
@Override
public ItemStack next()
{
final ItemStack result = this.inventory.getStackInSlot( this.counter );
this.counter++;
return result;
}
return result;
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
@@ -18,28 +18,22 @@
package appeng.util.iterators;
import java.util.Iterator;
public class NullIterator<T> implements Iterator<T> {
public class NullIterator<T> implements Iterator<T>
{
@Override
public boolean hasNext() {
return false;
}
@Override
public boolean hasNext()
{
return false;
}
@Override
public T next() {
return null;
}
@Override
public T next()
{
return null;
}
@Override
public void remove() {
@Override
public void remove()
{
}
}
}
@@ -18,39 +18,32 @@
package appeng.util.iterators;
import java.util.Iterator;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.util.AEPartLocation;
public final class ProxyNodeIterator implements Iterator<IGridNode> {
private final Iterator<IGridHost> hosts;
public final class ProxyNodeIterator implements Iterator<IGridNode>
{
private final Iterator<IGridHost> hosts;
public ProxyNodeIterator(final Iterator<IGridHost> hosts) {
this.hosts = hosts;
}
public ProxyNodeIterator( final Iterator<IGridHost> hosts )
{
this.hosts = hosts;
}
@Override
public boolean hasNext() {
return this.hosts.hasNext();
}
@Override
public boolean hasNext()
{
return this.hosts.hasNext();
}
@Override
public IGridNode next() {
final IGridHost host = this.hosts.next();
return host.getGridNode(AEPartLocation.INTERNAL);
}
@Override
public IGridNode next()
{
final IGridHost host = this.hosts.next();
return host.getGridNode( AEPartLocation.INTERNAL );
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
@@ -18,44 +18,37 @@
package appeng.util.iterators;
import java.util.Iterator;
import net.minecraft.item.ItemStack;
import appeng.util.inv.ItemSlot;
public class StackToSlotIterator implements Iterator<ItemSlot> {
public class StackToSlotIterator implements Iterator<ItemSlot>
{
private final ItemSlot iss = new ItemSlot();
private final Iterator<ItemStack> is;
private int x = 0;
private final ItemSlot iss = new ItemSlot();
private final Iterator<ItemStack> is;
private int x = 0;
public StackToSlotIterator(final Iterator<ItemStack> is) {
this.is = is;
}
public StackToSlotIterator( final Iterator<ItemStack> is )
{
this.is = is;
}
@Override
public boolean hasNext() {
return this.is.hasNext();
}
@Override
public boolean hasNext()
{
return this.is.hasNext();
}
@Override
public ItemSlot next() {
this.iss.setSlot(this.x);
this.x++;
this.iss.setItemStack(this.is.next());
return this.iss;
}
@Override
public ItemSlot next()
{
this.iss.setSlot( this.x );
this.x++;
this.iss.setItemStack( this.is.next() );
return this.iss;
}
@Override
public void remove()
{
// uhh no.
}
@Override
public void remove() {
// uhh no.
}
}