Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,18 +18,20 @@
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public class DefaultPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
|
||||
{
|
||||
|
||||
final static List NULL_LIST = new ArrayList();
|
||||
|
||||
@Override
|
||||
public boolean isListed(T input)
|
||||
public boolean isListed( T input )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -45,5 +47,4 @@ public class DefaultPriorityList<T extends IAEStack<T>> implements IPartitionLis
|
||||
{
|
||||
return NULL_LIST;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,25 +18,28 @@
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public class FuzzyPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
|
||||
{
|
||||
|
||||
final IItemList<T> list;
|
||||
final FuzzyMode mode;
|
||||
|
||||
public FuzzyPriorityList(IItemList<T> in, FuzzyMode mode) {
|
||||
public FuzzyPriorityList( IItemList<T> in, FuzzyMode mode )
|
||||
{
|
||||
this.list = in;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListed(T input)
|
||||
public boolean isListed( T input )
|
||||
{
|
||||
Collection<T> out = this.list.findFuzzy( input, this.mode );
|
||||
return out != null && !out.isEmpty();
|
||||
@@ -53,5 +56,4 @@ public class FuzzyPriorityList<T extends IAEStack<T>> implements IPartitionList<
|
||||
{
|
||||
return this.list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,15 +18,16 @@
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public interface IPartitionList<T extends IAEStack<T>>
|
||||
{
|
||||
|
||||
boolean isListed(T input);
|
||||
boolean isListed( T input );
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
Iterable<T> getItems();
|
||||
|
||||
}
|
||||
|
||||
@@ -18,36 +18,38 @@
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
|
||||
public class MergedPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
|
||||
{
|
||||
|
||||
final List<IPartitionList<T>> positive = new ArrayList<IPartitionList<T>>();
|
||||
final List<IPartitionList<T>> negative = new ArrayList<IPartitionList<T>>();
|
||||
|
||||
public void addNewList(IPartitionList<T> list, boolean isWhitelist)
|
||||
public void addNewList( IPartitionList<T> list, boolean isWhitelist )
|
||||
{
|
||||
if ( isWhitelist )
|
||||
if( isWhitelist )
|
||||
this.positive.add( list );
|
||||
else
|
||||
this.negative.add( list );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListed(T input)
|
||||
public boolean isListed( T input )
|
||||
{
|
||||
for (IPartitionList<T> l : this.negative)
|
||||
if ( l.isListed( input ) )
|
||||
for( IPartitionList<T> l : this.negative )
|
||||
if( l.isListed( input ) )
|
||||
return false;
|
||||
|
||||
if ( !this.positive.isEmpty() )
|
||||
if( !this.positive.isEmpty() )
|
||||
{
|
||||
for (IPartitionList<T> l : this.positive)
|
||||
if ( l.isListed( input ) )
|
||||
for( IPartitionList<T> l : this.positive )
|
||||
if( l.isListed( input ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -67,5 +69,4 @@ public class MergedPriorityList<T extends IAEStack<T>> implements IPartitionList
|
||||
{
|
||||
throw new RuntimeException( "Not Implemented" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,20 +18,23 @@
|
||||
|
||||
package appeng.util.prioitylist;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
|
||||
|
||||
public class PrecisePriorityList<T extends IAEStack<T>> implements IPartitionList<T>
|
||||
{
|
||||
|
||||
final IItemList<T> list;
|
||||
|
||||
public PrecisePriorityList(IItemList<T> in) {
|
||||
public PrecisePriorityList( IItemList<T> in )
|
||||
{
|
||||
this.list = in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListed(T input)
|
||||
public boolean isListed( T input )
|
||||
{
|
||||
return this.list.findPrecise( input ) != null;
|
||||
}
|
||||
@@ -47,5 +50,4 @@ public class PrecisePriorityList<T extends IAEStack<T>> implements IPartitionLis
|
||||
{
|
||||
return this.list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user