final variables and parameters

seeing some methods it does actually help to enforce the parameters
This commit is contained in:
thatsIch
2015-09-25 23:10:56 +02:00
parent e52400bf26
commit 410d2f1e0d
819 changed files with 9390 additions and 9396 deletions
+3 -3
View File
@@ -51,15 +51,15 @@ public enum AEApi
HELD_API = (IAppEngApi) apiField.get( apiClass );
}
catch( ClassNotFoundException e )
catch( final ClassNotFoundException e )
{
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared." );
}
catch( NoSuchFieldException e )
catch( final NoSuchFieldException e )
{
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without it being declared." );
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without enough access permissions." );
}
@@ -30,22 +30,22 @@ public enum AccessRestriction
private final int permissionBit;
AccessRestriction( int v )
AccessRestriction( final int v )
{
this.permissionBit = v;
}
public boolean hasPermission( AccessRestriction ar )
public boolean hasPermission( final AccessRestriction ar )
{
return ( this.permissionBit & ar.permissionBit ) == ar.permissionBit;
}
public AccessRestriction restrictPermissions( AccessRestriction ar )
public AccessRestriction restrictPermissions( final AccessRestriction ar )
{
return this.getPermByBit( this.permissionBit & ar.permissionBit );
}
private AccessRestriction getPermByBit( int bit )
private AccessRestriction getPermByBit( final int bit )
{
switch( bit )
{
@@ -61,12 +61,12 @@ public enum AccessRestriction
}
}
public AccessRestriction addPermissions( AccessRestriction ar )
public AccessRestriction addPermissions( final AccessRestriction ar )
{
return this.getPermByBit( this.permissionBit | ar.permissionBit );
}
public AccessRestriction removePermissions( AccessRestriction ar )
public AccessRestriction removePermissions( final AccessRestriction ar )
{
return this.getPermByBit( this.permissionBit & ( ~ar.permissionBit ) );
}
@@ -32,13 +32,13 @@ public enum FuzzyMode
public final float breakPoint;
public final float percentage;
FuzzyMode( float p )
FuzzyMode( final float p )
{
this.percentage = p;
this.breakPoint = p / 100.0f;
}
public int calculateBreakPoint( int maxDamage )
public int calculateBreakPoint( final int maxDamage )
{
return (int) ( ( this.percentage * maxDamage ) / 100.0f );
}
@@ -33,12 +33,12 @@ public enum PowerMultiplier
*/
public double multiplier = 1.0;
public double multiply( double in )
public double multiply( final double in )
{
return in * this.multiplier;
}
public double divide( double in )
public double divide( final double in )
{
return in / this.multiplier;
}
@@ -41,7 +41,7 @@ public enum PowerUnits
*/
public double conversionRatio = 1.0;
PowerUnits( String un )
PowerUnits( final String un )
{
this.unlocalizedName = un;
}
@@ -58,7 +58,7 @@ public enum PowerUnits
*
* @return value converted to target units, from this units.
*/
public double convertTo( PowerUnits target, double value )
public double convertTo( final PowerUnits target, final double value )
{
return ( value * this.conversionRatio ) / target.conversionRatio;
}
+1 -1
View File
@@ -60,7 +60,7 @@ public enum Settings
private final EnumSet<? extends Enum<?>> values;
Settings( @Nonnull EnumSet<? extends Enum<?>> possibleOptions )
Settings( @Nonnull final EnumSet<? extends Enum<?>> possibleOptions )
{
if( possibleOptions.isEmpty() )
{
+5 -5
View File
@@ -59,7 +59,7 @@ public enum Upgrades
@Deprecated
private final Map<ItemStack, Integer> supportedMax = new HashMap<ItemStack, Integer>();
Upgrades( int tier )
Upgrades( final int tier )
{
this.tier = tier;
}
@@ -78,10 +78,10 @@ public enum Upgrades
* @param item machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem( IItemDefinition item, int maxSupported )
public void registerItem( final IItemDefinition item, final int maxSupported )
{
final Optional<ItemStack> maybeStack = item.maybeStack( 1 );
for( ItemStack stack : maybeStack.asSet() )
for( final ItemStack stack : maybeStack.asSet() )
{
this.registerItem( stack, maxSupported );
}
@@ -93,7 +93,7 @@ public enum Upgrades
* @param stack machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem( ItemStack stack, int maxSupported )
public void registerItem( final ItemStack stack, final int maxSupported )
{
if( stack != null )
{
@@ -110,7 +110,7 @@ public enum Upgrades
* @deprecated use {@link Upgrades#registerItem(IItemDefinition, int)}
*/
@Deprecated
public void registerItem( AEItemDefinition item, int maxSupported )
public void registerItem( final AEItemDefinition item, final int maxSupported )
{
if( item != null )
{
@@ -40,7 +40,7 @@ public class LocatableEventAnnounce extends Event
public final ILocatable target;
public final LocatableEvent change;
public LocatableEventAnnounce( ILocatable o, LocatableEvent ev )
public LocatableEventAnnounce( final ILocatable o, final LocatableEvent ev )
{
this.target = o;
this.change = ev;
@@ -29,7 +29,7 @@ public class AppEngException extends Exception
private static final long serialVersionUID = -9051434206368465494L;
public AppEngException( String t )
public AppEngException( final String t )
{
super( t );
}
@@ -3,7 +3,7 @@ package appeng.api.exceptions;
public class CoreInaccessibleException extends RuntimeException
{
public CoreInaccessibleException( String message )
public CoreInaccessibleException( final String message )
{
super( message );
}
@@ -3,7 +3,7 @@ package appeng.api.exceptions;
public class MissingDefinition extends RuntimeException
{
public MissingDefinition( String message )
public MissingDefinition( final String message )
{
super( message );
}
@@ -29,7 +29,7 @@ public class MissingIngredientError extends Exception
private static final long serialVersionUID = -998858343831371697L;
public MissingIngredientError( String n )
public MissingIngredientError( final String n )
{
super( n );
}
@@ -29,7 +29,7 @@ public class ModNotInstalled extends Exception
private static final long serialVersionUID = -9052435206368425494L;
public ModNotInstalled( String t )
public ModNotInstalled( final String t )
{
super( t );
}
@@ -29,7 +29,7 @@ public class RecipeError extends Exception
private static final long serialVersionUID = -6602870588617670262L;
public RecipeError( String n )
public RecipeError( final String n )
{
super( n );
}
@@ -29,7 +29,7 @@ public class RegistrationError extends Exception
private static final long serialVersionUID = -6602870588617670263L;
public RegistrationError( String n )
public RegistrationError( final String n )
{
super( n );
}
@@ -33,7 +33,7 @@ public class TransitionResult
public final boolean success;
public final double energyUsage;
public TransitionResult( boolean _success, double power )
public TransitionResult( final boolean _success, final double power )
{
this.success = _success;
this.energyUsage = power;
@@ -36,7 +36,7 @@ public class MENetworkChannelChanged extends MENetworkEvent
public final IGridNode node;
public MENetworkChannelChanged( IGridNode n )
public MENetworkChannelChanged( final IGridNode n )
{
this.node = n;
}
@@ -32,7 +32,7 @@ public class MENetworkCraftingCpuChange extends MENetworkEvent
public final IGridNode node;
public MENetworkCraftingCpuChange( IGridNode n )
public MENetworkCraftingCpuChange( final IGridNode n )
{
this.node = n;
}
@@ -34,7 +34,7 @@ public class MENetworkCraftingPatternChange extends MENetworkEvent
public final ICraftingProvider provider;
public final IGridNode node;
public MENetworkCraftingPatternChange( ICraftingProvider p, IGridNode n )
public MENetworkCraftingPatternChange( final ICraftingProvider p, final IGridNode n )
{
this.provider = p;
this.node = n;
@@ -71,7 +71,7 @@ public class MENetworkEvent
*
* @param v current number of visitors
*/
public void setVisitedObjects( int v )
public void setVisitedObjects( final int v )
{
this.visited = v;
}
@@ -39,7 +39,7 @@ public class MENetworkPowerIdleChange extends MENetworkEvent
public final IGridNode node;
public MENetworkPowerIdleChange( IGridNode nodeThatChanged )
public MENetworkPowerIdleChange( final IGridNode nodeThatChanged )
{
this.node = nodeThatChanged;
}
@@ -42,7 +42,7 @@ public class MENetworkPowerStorage extends MENetworkEvent
public final IAEPowerStorage storage;
public final PowerEventType type;
public MENetworkPowerStorage( IAEPowerStorage t, PowerEventType y )
public MENetworkPowerStorage( final IAEPowerStorage t, final PowerEventType y )
{
this.storage = t;
this.type = y;
@@ -39,7 +39,7 @@ public class MENetworkSpatialEvent extends MENetworkEvent
* @param SpatialIO ( INSTANCE of the SpatialIO block )
* @param EnergyUsage ( the amount of energy that the SpatialIO uses)
*/
public MENetworkSpatialEvent( IGridHost SpatialIO, double EnergyUsage )
public MENetworkSpatialEvent( final IGridHost SpatialIO, final double EnergyUsage )
{
this.host = SpatialIO;
this.spatialEnergyUsage = EnergyUsage;
@@ -42,7 +42,7 @@ public class MENetworkStorageEvent extends MENetworkEvent
public final IMEMonitor monitor;
public final StorageChannel channel;
public MENetworkStorageEvent( IMEMonitor o, StorageChannel chan )
public MENetworkStorageEvent( final IMEMonitor o, final StorageChannel chan )
{
this.monitor = o;
this.channel = chan;
@@ -29,7 +29,7 @@ public class MachineSource extends BaseActionSource
public final IActionHost via;
public MachineSource( IActionHost v )
public MachineSource( final IActionHost v )
{
this.via = v;
}
@@ -33,7 +33,7 @@ public class PlayerSource extends BaseActionSource
public final EntityPlayer player;
public final IActionHost via;
public PlayerSource( EntityPlayer p, IActionHost v )
public PlayerSource( final EntityPlayer p, final IActionHost v )
{
this.player = p;
this.via = v;
@@ -60,7 +60,7 @@ public class TickingRequest
*/
public final boolean canBeAlerted;
public TickingRequest( int min, int max, boolean sleep, boolean alertable )
public TickingRequest( final int min, final int max, final boolean sleep, final boolean alertable )
{
this.minTickRate = min;
this.maxTickRate = max;
@@ -33,7 +33,7 @@ public enum CableRenderMode
public final boolean transparentFacades;
public final boolean opaqueFacades;
CableRenderMode( boolean hideFacades )
CableRenderMode( final boolean hideFacades )
{
this.transparentFacades = hideFacades;
this.opaqueFacades = !hideFacades;
+1 -1
View File
@@ -46,7 +46,7 @@ public abstract class LayerBase extends TileEntity // implements IPartHost
*
* @return the part for the requested side.
*/
public IPart getPart( ForgeDirection side )
public IPart getPart( final ForgeDirection side )
{
return null; // place holder.
}
@@ -55,14 +55,14 @@ public class SelectedPart
this.side = ForgeDirection.UNKNOWN;
}
public SelectedPart( IPart part, ForgeDirection side )
public SelectedPart( final IPart part, final ForgeDirection side )
{
this.part = part;
this.facade = null;
this.side = side;
}
public SelectedPart( IFacadePart facade, ForgeDirection side )
public SelectedPart( final IFacadePart facade, final ForgeDirection side )
{
this.part = null;
this.facade = facade;
@@ -34,14 +34,14 @@ public class ResolverResult
public final int damageValue;
public final NBTTagCompound compound;
public ResolverResult( String name, int damage )
public ResolverResult( final String name, final int damage )
{
this.itemName = name;
this.damageValue = damage;
this.compound = null;
}
public ResolverResult( String name, int damage, NBTTagCompound data )
public ResolverResult( final String name, final int damage, final NBTTagCompound data )
{
this.itemName = name;
this.damageValue = damage;
@@ -36,7 +36,7 @@ public class ResolverResultSet
public final String name;
public final List<ItemStack> results;
public ResolverResultSet( String myName, ItemStack... set )
public ResolverResultSet( final String myName, final ItemStack... set )
{
this.results = Arrays.asList( set );
this.name = myName;
@@ -52,32 +52,32 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
protected boolean hasChanged = true;
public MEMonitorHandler( IMEInventoryHandler<StackType> t )
public MEMonitorHandler( final IMEInventoryHandler<StackType> t )
{
this.internalHandler = t;
this.cachedList = (IItemList<StackType>) t.getChannel().createList();
}
public MEMonitorHandler( IMEInventoryHandler<StackType> t, StorageChannel chan )
public MEMonitorHandler( final IMEInventoryHandler<StackType> t, final StorageChannel chan )
{
this.internalHandler = t;
this.cachedList = (IItemList<StackType>) chan.createList();
}
@Override
public void addListener( IMEMonitorHandlerReceiver<StackType> l, Object verificationToken )
public void addListener( final IMEMonitorHandlerReceiver<StackType> l, final Object verificationToken )
{
this.listeners.put( l, verificationToken );
}
@Override
public void removeListener( IMEMonitorHandlerReceiver<StackType> l )
public void removeListener( final IMEMonitorHandlerReceiver<StackType> l )
{
this.listeners.remove( l );
}
@Override
public StackType injectItems( StackType input, Actionable mode, BaseActionSource src )
public StackType injectItems( final StackType input, final Actionable mode, final BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
@@ -91,9 +91,9 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
return this.internalHandler;
}
private StackType monitorDifference( IAEStack original, StackType leftOvers, boolean extraction, BaseActionSource src )
private StackType monitorDifference( final IAEStack original, final StackType leftOvers, final boolean extraction, final BaseActionSource src )
{
StackType diff = (StackType) original.copy();
final StackType diff = (StackType) original.copy();
if( extraction )
{
@@ -112,19 +112,19 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
return leftOvers;
}
protected void postChangesToListeners( Iterable<StackType> changes, BaseActionSource src )
protected void postChangesToListeners( final Iterable<StackType> changes, final BaseActionSource src )
{
this.notifyListenersOfChange( changes, src );
}
protected void notifyListenersOfChange( Iterable<StackType> diff, BaseActionSource src )
protected void notifyListenersOfChange( final Iterable<StackType> diff, final BaseActionSource src )
{
this.hasChanged = true;// need to update the cache.
Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
final Iterator<Entry<IMEMonitorHandlerReceiver<StackType>, Object>> i = this.getListeners();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<StackType>, Object> o = i.next();
IMEMonitorHandlerReceiver<StackType> receiver = o.getKey();
final Entry<IMEMonitorHandlerReceiver<StackType>, Object> o = i.next();
final IMEMonitorHandlerReceiver<StackType> receiver = o.getKey();
if( receiver.isValid( o.getValue() ) )
{
receiver.postChange( this, diff, src );
@@ -142,7 +142,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
}
@Override
public StackType extractItems( StackType request, Actionable mode, BaseActionSource src )
public StackType extractItems( final StackType request, final Actionable mode, final BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
@@ -175,17 +175,17 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
}
@Override
public boolean isPrioritized( StackType input )
public boolean isPrioritized( final StackType input )
{
return this.getHandler().isPrioritized( input );
}
@Override
public boolean canAccept( StackType input )
public boolean canAccept( final StackType input )
{
return this.getHandler().canAccept( input );
} @Override
public IItemList<StackType> getAvailableItems( IItemList out )
public IItemList<StackType> getAvailableItems( final IItemList out )
{
return this.getHandler().getAvailableItems( out );
}
@@ -203,7 +203,7 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return this.getHandler().validForPass( i );
}
@@ -45,7 +45,7 @@ public enum StorageChannel
public final Class<? extends IAEStack> type;
StorageChannel( Class<? extends IAEStack> t )
StorageChannel( final Class<? extends IAEStack> t )
{
this.type = t;
}
+2 -2
View File
@@ -94,7 +94,7 @@ public enum AEColor
*/
public final int whiteVariant;
AEColor( String unlocalizedName, int blackHex, int medHex, int whiteHex )
AEColor( final String unlocalizedName, final int blackHex, final int medHex, final int whiteHex )
{
this.unlocalizedName = unlocalizedName;
this.blackVariant = blackHex;
@@ -105,7 +105,7 @@ public enum AEColor
/**
* Logic to see which colors match each other.. special handle for Transparent
*/
public boolean matches( AEColor color )
public boolean matches( final AEColor color )
{
return this == Transparent || color == Transparent || this == color;
}
@@ -37,21 +37,21 @@ public class DimensionalCoord extends WorldCoord
private final World w;
private final int dimId;
public DimensionalCoord( DimensionalCoord s )
public DimensionalCoord( final DimensionalCoord s )
{
super( s.x, s.y, s.z );
this.w = s.w;
this.dimId = s.dimId;
}
public DimensionalCoord( TileEntity s )
public DimensionalCoord( final TileEntity s )
{
super( s );
this.w = s.getWorldObj();
this.dimId = this.w.provider.dimensionId;
}
public DimensionalCoord( World _w, int _x, int _y, int _z )
public DimensionalCoord( final World _w, final int _x, final int _y, final int _z )
{
super( _x, _y, _z );
this.w = _w;
@@ -71,12 +71,12 @@ public class DimensionalCoord extends WorldCoord
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
return obj instanceof DimensionalCoord && this.isEqual( (DimensionalCoord) obj );
}
public boolean isEqual( DimensionalCoord c )
public boolean isEqual( final DimensionalCoord c )
{
return this.x == c.x && this.y == c.y && this.z == c.z && c.w == this.w;
}
@@ -87,7 +87,7 @@ public class DimensionalCoord extends WorldCoord
return "dimension=" + this.dimId + ", " + super.toString();
}
public boolean isInWorld( World world )
public boolean isInWorld( final World world )
{
return this.w == world;
}
+17 -17
View File
@@ -39,19 +39,19 @@ public class WorldCoord
public int y;
public int z;
public WorldCoord( TileEntity s )
public WorldCoord( final TileEntity s )
{
this( s.xCoord, s.yCoord, s.zCoord );
}
public WorldCoord( int _x, int _y, int _z )
public WorldCoord( final int _x, final int _y, final int _z )
{
this.x = _x;
this.y = _y;
this.z = _z;
}
public WorldCoord subtract( ForgeDirection direction, int length )
public WorldCoord subtract( final ForgeDirection direction, final int length )
{
this.x -= direction.offsetX * length;
this.y -= direction.offsetY * length;
@@ -59,7 +59,7 @@ public class WorldCoord
return this;
}
public WorldCoord add( int _x, int _y, int _z )
public WorldCoord add( final int _x, final int _y, final int _z )
{
this.x += _x;
this.y += _y;
@@ -67,7 +67,7 @@ public class WorldCoord
return this;
}
public WorldCoord subtract( int _x, int _y, int _z )
public WorldCoord subtract( final int _x, final int _y, final int _z )
{
this.x -= _x;
this.y -= _y;
@@ -75,7 +75,7 @@ public class WorldCoord
return this;
}
public WorldCoord multiple( int _x, int _y, int _z )
public WorldCoord multiple( final int _x, final int _y, final int _z )
{
this.x *= _x;
this.y *= _y;
@@ -83,7 +83,7 @@ public class WorldCoord
return this;
}
public WorldCoord divide( int _x, int _y, int _z )
public WorldCoord divide( final int _x, final int _y, final int _z )
{
this.x /= _x;
this.y /= _y;
@@ -94,15 +94,15 @@ public class WorldCoord
/**
* Will Return NULL if it's at some diagonal!
*/
public ForgeDirection directionTo( WorldCoord loc )
public ForgeDirection directionTo( final WorldCoord loc )
{
int ox = this.x - loc.x;
int oy = this.y - loc.y;
int oz = this.z - loc.z;
final int ox = this.x - loc.x;
final int oy = this.y - loc.y;
final int oz = this.z - loc.z;
int xlen = Math.abs( ox );
int ylen = Math.abs( oy );
int zlen = Math.abs( oz );
final int xlen = Math.abs( ox );
final int ylen = Math.abs( oy );
final int zlen = Math.abs( oz );
if( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) )
{
@@ -137,12 +137,12 @@ public class WorldCoord
return null;
}
public boolean isEqual( WorldCoord c )
public boolean isEqual( final WorldCoord c )
{
return this.x == c.x && this.y == c.y && this.z == c.z;
}
public WorldCoord add( ForgeDirection direction, int length )
public WorldCoord add( final ForgeDirection direction, final int length )
{
this.x += direction.offsetX * length;
this.y += direction.offsetY * length;
@@ -162,7 +162,7 @@ public class WorldCoord
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
return obj instanceof WorldCoord && this.isEqual( (WorldCoord) obj );
}