Relocate Source to proper directory.

This commit is contained in:
AlgorithmX2
2014-09-23 19:26:27 -05:00
parent fe927ce65d
commit 386d18a059
785 changed files with 35585 additions and 35580 deletions
@@ -0,0 +1,30 @@
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 nullList = new ArrayList();
public boolean isListed(T input)
{
return false;
}
@Override
public boolean isEmpty()
{
return true;
}
@Override
public Iterable<T> getItems()
{
return (Iterable<T>) nullList;
}
}
@@ -0,0 +1,38 @@
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) {
list = in;
this.mode = mode;
}
public boolean isListed(T input)
{
Collection<T> out = list.findFuzzy( input, mode );
return out != null && !out.isEmpty();
}
@Override
public boolean isEmpty()
{
return list.isEmpty();
}
@Override
public Iterable<T> getItems()
{
return list;
}
}
@@ -0,0 +1,14 @@
package appeng.util.prioitylist;
import appeng.api.storage.data.IAEStack;
public interface IPartitionList<T extends IAEStack<T>>
{
boolean isListed(T input);
boolean isEmpty();
Iterable<T> getItems();
}
@@ -0,0 +1,52 @@
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();
final List<IPartitionList<T>> negative = new ArrayList();
public void addNewList(IPartitionList<T> list, boolean isWhitelist)
{
if ( isWhitelist )
positive.add( list );
else
negative.add( list );
}
public boolean isListed(T input)
{
for (IPartitionList<T> l : negative)
if ( l.isListed( input ) )
return false;
if ( !positive.isEmpty() )
{
for (IPartitionList<T> l : positive)
if ( l.isListed( input ) )
return true;
return false;
}
return true;
}
@Override
public boolean isEmpty()
{
return positive.isEmpty() && negative.isEmpty();
}
@Override
public Iterable<T> getItems()
{
throw new RuntimeException( "Not Implemented" );
}
}
@@ -0,0 +1,32 @@
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) {
list = in;
}
public boolean isListed(T input)
{
return list.findPrecise( input ) != null;
}
@Override
public boolean isEmpty()
{
return list.isEmpty();
}
@Override
public Iterable<T> getItems()
{
return list;
}
}