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:
@@ -28,14 +28,14 @@ import appeng.tile.networking.TileController;
|
||||
public class ControllerValidator implements IGridVisitor
|
||||
{
|
||||
|
||||
public boolean isValid = true;
|
||||
public int found = 0;
|
||||
int minX;
|
||||
int minY;
|
||||
int minZ;
|
||||
int maxX;
|
||||
int maxY;
|
||||
int maxZ;
|
||||
private boolean isValid = true;
|
||||
private int found = 0;
|
||||
private int minX;
|
||||
private int minY;
|
||||
private int minZ;
|
||||
private int maxX;
|
||||
private int maxY;
|
||||
private int maxZ;
|
||||
|
||||
public ControllerValidator( final int x, final int y, final int z )
|
||||
{
|
||||
@@ -51,7 +51,7 @@ public class ControllerValidator implements IGridVisitor
|
||||
public boolean visitNode( final IGridNode n )
|
||||
{
|
||||
final IGridHost host = n.getMachine();
|
||||
if( this.isValid && host instanceof TileController )
|
||||
if( this.isValid() && host instanceof TileController )
|
||||
{
|
||||
final TileController c = (TileController) host;
|
||||
|
||||
@@ -64,17 +64,37 @@ public class ControllerValidator implements IGridVisitor
|
||||
|
||||
if( this.maxX - this.minX < 7 && this.maxY - this.minY < 7 && this.maxZ - this.minZ < 7 )
|
||||
{
|
||||
this.found++;
|
||||
this.setFound( this.getFound() + 1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
this.isValid = false;
|
||||
this.setValid( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.isValid();
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return this.isValid;
|
||||
}
|
||||
|
||||
private void setValid( final boolean isValid )
|
||||
{
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
public int getFound()
|
||||
{
|
||||
return this.found;
|
||||
}
|
||||
|
||||
private void setFound( final int found )
|
||||
{
|
||||
this.found = found;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ import appeng.me.cache.PathGridCache;
|
||||
public class PathSegment
|
||||
{
|
||||
|
||||
final PathGridCache pgc;
|
||||
final Set<IPathItem> semiOpen;
|
||||
final Set<IPathItem> closed;
|
||||
public boolean isDead;
|
||||
List<IPathItem> open;
|
||||
private final PathGridCache pgc;
|
||||
private final Set<IPathItem> semiOpen;
|
||||
private final Set<IPathItem> closed;
|
||||
private boolean isDead;
|
||||
private List<IPathItem> open;
|
||||
|
||||
public PathSegment( final PathGridCache myPGC, final List<IPathItem> open, final Set<IPathItem> semiOpen, final Set<IPathItem> closed )
|
||||
{
|
||||
@@ -46,7 +46,7 @@ public class PathSegment
|
||||
this.semiOpen = semiOpen;
|
||||
this.closed = closed;
|
||||
this.pgc = myPGC;
|
||||
this.isDead = false;
|
||||
this.setDead( false );
|
||||
}
|
||||
|
||||
public boolean step()
|
||||
@@ -125,12 +125,12 @@ public class PathSegment
|
||||
pi = start;
|
||||
while( pi != null )
|
||||
{
|
||||
this.pgc.channelsByBlocks++;
|
||||
this.pgc.setChannelsByBlocks( this.pgc.getChannelsByBlocks() + 1 );
|
||||
pi.incrementChannelCount( 1 );
|
||||
pi = pi.getControllerRoute();
|
||||
}
|
||||
|
||||
this.pgc.channelsInUse++;
|
||||
this.pgc.setChannelsInUse( this.pgc.getChannelsInUse() + 1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -150,12 +150,22 @@ public class PathSegment
|
||||
pi = start;
|
||||
while( pi != null )
|
||||
{
|
||||
this.pgc.channelsByBlocks++;
|
||||
this.pgc.setChannelsByBlocks( this.pgc.getChannelsByBlocks() + 1 );
|
||||
pi.incrementChannelCount( 1 );
|
||||
pi = pi.getControllerRoute();
|
||||
}
|
||||
|
||||
this.pgc.channelsInUse++;
|
||||
this.pgc.setChannelsInUse( this.pgc.getChannelsInUse() + 1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isDead()
|
||||
{
|
||||
return this.isDead;
|
||||
}
|
||||
|
||||
public void setDead( final boolean isDead )
|
||||
{
|
||||
this.isDead = isDead;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user