Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent f054bd699b
commit e94a0cfccf
497 changed files with 7865 additions and 6908 deletions
+11 -12
View File
@@ -30,7 +30,7 @@ public class CompassManager
{
public static final CompassManager INSTANCE = new CompassManager();
final HashMap<CompassRequest, CompassResult> requests = new HashMap<CompassRequest, CompassResult>();
private final HashMap<CompassRequest, CompassResult> requests = new HashMap<CompassRequest, CompassResult>();
public void postResult( final long attunement, final int x, final int y, final int z, final CompassResult result )
{
@@ -46,7 +46,7 @@ public class CompassManager
while( i.hasNext() )
{
final CompassResult res = i.next();
final long diff = now - res.time;
final long diff = now - res.getTime();
if( diff > 20000 )
{
i.remove();
@@ -62,11 +62,11 @@ public class CompassManager
this.requests.put( r, res );
this.requestUpdate( r );
}
else if( now - res.time > 1000 * 3 )
else if( now - res.getTime() > 1000 * 3 )
{
if( !res.requested )
if( !res.isRequested() )
{
res.requested = true;
res.setRequested( true );
this.requestUpdate( r );
}
}
@@ -79,15 +79,14 @@ public class CompassManager
NetworkHandler.instance.sendToServer( new PacketCompassRequest( r.attunement, r.cx, r.cz, r.cdy ) );
}
static class CompassRequest
private static class CompassRequest
{
final int hash;
final long attunement;
final int cx;
final int cdy;
final int cz;
private final int hash;
private final long attunement;
private final int cx;
private final int cdy;
private final int cz;
public CompassRequest( final long attunement, final int x, final int y, final int z )
{
+35 -6
View File
@@ -22,12 +22,11 @@ package appeng.hooks;
public class CompassResult
{
public final boolean hasResult;
public final boolean spin;
public final double rad;
public final long time;
public boolean requested = false;
private final boolean hasResult;
private final boolean spin;
private final double rad;
private final long time;
private boolean requested = false;
public CompassResult( final boolean hasResult, final boolean spin, final double rad )
{
@@ -36,4 +35,34 @@ public class CompassResult
this.rad = rad;
this.time = System.currentTimeMillis();
}
public boolean isValidResult()
{
return this.hasResult;
}
public boolean isSpin()
{
return this.spin;
}
public double getRad()
{
return this.rad;
}
boolean isRequested()
{
return this.requested;
}
void setRequested( final boolean requested )
{
this.requested = requested;
}
long getTime()
{
return this.time;
}
}
+10 -10
View File
@@ -59,14 +59,14 @@ public class TickHandler
{
public static final TickHandler INSTANCE = new TickHandler();
final Queue<IWorldCallable<?>> serverQueue = new LinkedList<IWorldCallable<?>>();
final Multimap<World, CraftingJob> craftingJobs = LinkedListMultimap.create();
private final Queue<IWorldCallable<?>> serverQueue = new LinkedList<IWorldCallable<?>>();
private final Multimap<World, CraftingJob> craftingJobs = LinkedListMultimap.create();
private final WeakHashMap<World, Queue<IWorldCallable<?>>> callQueue = new WeakHashMap<World, Queue<IWorldCallable<?>>>();
private final HandlerRep server = new HandlerRep();
private final HandlerRep client = new HandlerRep();
private final HashMap<Integer, PlayerColor> cliPlayerColors = new HashMap<Integer, PlayerColor>();
private final HashMap<Integer, PlayerColor> srvPlayerColors = new HashMap<Integer, PlayerColor>();
CableRenderMode crm = CableRenderMode.Standard;
private CableRenderMode crm = CableRenderMode.Standard;
public HashMap<Integer, PlayerColor> getPlayerColors()
{
@@ -105,7 +105,7 @@ public class TickHandler
}
}
HandlerRep getRepo()
private HandlerRep getRepo()
{
if( Platform.isServer() )
{
@@ -302,14 +302,14 @@ public class TickHandler
}
}
static class HandlerRep
private static class HandlerRep
{
public Queue<AEBaseTile> tiles = new LinkedList<AEBaseTile>();
private Queue<AEBaseTile> tiles = new LinkedList<AEBaseTile>();
public Collection<Grid> networks = new NetworkList();
private Collection<Grid> networks = new NetworkList();
public void clear()
private void clear()
{
this.tiles = new LinkedList<AEBaseTile>();
this.networks = new NetworkList();
@@ -321,8 +321,8 @@ public class TickHandler
{
public final AEColor myColor;
protected final int myEntity;
protected int ticksLeft;
private final int myEntity;
private int ticksLeft;
public PlayerColor( final int id, final AEColor col, final int ticks )
{