Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
@@ -18,15 +18,17 @@
package appeng.me.cache.helpers;
import appeng.api.networking.IGridConnection;
public class ConnectionWrapper
{
public IGridConnection connection;
public ConnectionWrapper(IGridConnection gc) {
public ConnectionWrapper( IGridConnection gc )
{
this.connection = gc;
}
}
+5 -4
View File
@@ -18,22 +18,24 @@
package appeng.me.cache.helpers;
import java.util.HashMap;
import java.util.concurrent.Callable;
import appeng.api.networking.IGridNode;
import appeng.parts.p2p.PartP2PTunnelME;
public class Connections implements Callable
{
final private PartP2PTunnelME me;
final public HashMap<IGridNode, TunnelConnection> connections = new HashMap<IGridNode, TunnelConnection>();
final private PartP2PTunnelME me;
public boolean create = false;
public boolean destroy = false;
public Connections(PartP2PTunnelME o) {
public Connections( PartP2PTunnelME o )
{
this.me = o;
}
@@ -56,5 +58,4 @@ public class Connections implements Callable
this.create = true;
this.destroy = false;
}
}
+16 -13
View File
@@ -18,6 +18,7 @@
package appeng.me.cache.helpers;
import net.minecraft.crash.CrashReportCategory;
import appeng.api.networking.IGridNode;
@@ -27,6 +28,7 @@ import appeng.api.util.DimensionalCoord;
import appeng.me.cache.TickManagerCache;
import appeng.parts.AEBasePart;
public class TickTracker implements Comparable<TickTracker>
{
@@ -40,44 +42,45 @@ public class TickTracker implements Comparable<TickTracker>
public long lastTick;
public int current_rate;
public TickTracker(TickingRequest req, IGridNode node, IGridTickable gt, long currentTick, TickManagerCache tickManagerCache) {
public TickTracker( TickingRequest req, IGridNode node, IGridTickable gt, long currentTick, TickManagerCache tickManagerCache )
{
this.request = req;
this.gt = gt;
this.node = node;
this.current_rate = (req.minTickRate + req.maxTickRate) / 2;
this.current_rate = ( req.minTickRate + req.maxTickRate ) / 2;
this.lastTick = currentTick;
this.host = tickManagerCache;
}
public long getAvgNanos()
{
return (this.LastFiveTicksTime / 5);
return ( this.LastFiveTicksTime / 5 );
}
public void setRate(int rate)
public void setRate( int rate )
{
this.current_rate = rate;
if ( this.current_rate < this.request.minTickRate )
if( this.current_rate < this.request.minTickRate )
this.current_rate = this.request.minTickRate;
if ( this.current_rate > this.request.maxTickRate )
if( this.current_rate > this.request.maxTickRate )
this.current_rate = this.request.maxTickRate;
}
@Override
public int compareTo(TickTracker t)
public int compareTo( TickTracker t )
{
int nextTick = (int) ((this.lastTick - this.host.getCurrentTick()) + this.current_rate);
int ts_nextTick = (int) ((t.lastTick - this.host.getCurrentTick()) + t.current_rate);
int nextTick = (int) ( ( this.lastTick - this.host.getCurrentTick() ) + this.current_rate );
int ts_nextTick = (int) ( ( t.lastTick - this.host.getCurrentTick() ) + t.current_rate );
return nextTick - ts_nextTick;
}
public void addEntityCrashInfo(CrashReportCategory crashreportcategory)
public void addEntityCrashInfo( CrashReportCategory crashreportcategory )
{
if ( this.gt instanceof AEBasePart )
if( this.gt instanceof AEBasePart )
{
AEBasePart part = (AEBasePart)this.gt;
AEBasePart part = (AEBasePart) this.gt;
part.addEntityCrashInfo( crashreportcategory );
}
@@ -89,7 +92,7 @@ public class TickTracker implements Comparable<TickTracker>
crashreportcategory.addCrashSection( "ConnectedSides", this.node.getConnectedSides() );
DimensionalCoord dc = this.node.getGridBlock().getLocation();
if ( dc != null )
if( dc != null )
crashreportcategory.addCrashSection( "Location", dc );
}
}
+14 -11
View File
@@ -18,32 +18,27 @@
package appeng.me.cache.helpers;
import java.util.Collection;
import java.util.Iterator;
import appeng.parts.p2p.PartP2PTunnel;
import appeng.util.iterators.NullIterator;
public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
{
final Class clz;
Collection<T> tunnelSources;
public TunnelCollection(Collection<T> src, Class c) {
public TunnelCollection( Collection<T> src, Class c )
{
this.tunnelSources = src;
this.clz = c;
}
@Override
public Iterator<T> iterator()
{
if ( this.tunnelSources == null )
return new NullIterator<T>();
return new TunnelIterator<T>( this.tunnelSources, this.clz );
}
public void setSource(Collection<T> c)
public void setSource( Collection<T> c )
{
this.tunnelSources = c;
}
@@ -53,7 +48,15 @@ public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
return !this.iterator().hasNext();
}
public boolean matches(Class<? extends PartP2PTunnel> c)
@Override
public Iterator<T> iterator()
{
if( this.tunnelSources == null )
return new NullIterator<T>();
return new TunnelIterator<T>( this.tunnelSources, this.clz );
}
public boolean matches( Class<? extends PartP2PTunnel> c )
{
return this.clz == c;
}
@@ -18,16 +18,19 @@
package appeng.me.cache.helpers;
import appeng.api.networking.IGridConnection;
import appeng.parts.p2p.PartP2PTunnelME;
public class TunnelConnection
{
final public PartP2PTunnelME tunnel;
final public IGridConnection c;
public TunnelConnection(PartP2PTunnelME t, IGridConnection con) {
public TunnelConnection( PartP2PTunnelME t, IGridConnection con )
{
this.tunnel = t;
this.c = con;
}
+13 -11
View File
@@ -18,11 +18,13 @@
package appeng.me.cache.helpers;
import java.util.Collection;
import java.util.Iterator;
import appeng.parts.p2p.PartP2PTunnel;
public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
{
@@ -30,22 +32,23 @@ public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
final Class targetType;
T Next;
private void findNext()
public TunnelIterator( Collection<T> tunnelSources, Class clz )
{
while (this.Next == null && this.wrapped.hasNext())
{
this.Next = this.wrapped.next();
if ( !this.targetType.isInstance( this.Next ) )
this.Next = null;
}
}
public TunnelIterator(Collection<T> tunnelSources, Class clz) {
this.wrapped = tunnelSources.iterator();
this.targetType = clz;
this.findNext();
}
private void findNext()
{
while( this.Next == null && this.wrapped.hasNext() )
{
this.Next = this.wrapped.next();
if( !this.targetType.isInstance( this.Next ) )
this.Next = null;
}
}
@Override
public boolean hasNext()
{
@@ -66,5 +69,4 @@ public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
{
// no.
}
}