Typo Iteratable
This commit is contained in:
parent
d979ae8ffd
commit
03e376c428
2 changed files with 58 additions and 58 deletions
|
@ -156,7 +156,7 @@ public class Grid implements IGrid
|
||||||
@Override
|
@Override
|
||||||
public IReadOnlyCollection<IGridNode> getNodes()
|
public IReadOnlyCollection<IGridNode> getNodes()
|
||||||
{
|
{
|
||||||
return new NodeIteratable( Machines );
|
return new NodeIterable( Machines );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
package appeng.me;
|
package appeng.me;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
|
|
||||||
public class NodeIteratable<T> implements IReadOnlyCollection<T>
|
public class NodeIterable<T> implements IReadOnlyCollection<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
final private HashMap<Class, Set<IGridNode>> Machines;
|
final private HashMap<Class, Set<IGridNode>> Machines;
|
||||||
|
|
||||||
public NodeIteratable(HashMap<Class, Set<IGridNode>> Machines) {
|
public NodeIterable(HashMap<Class, Set<IGridNode>> Machines) {
|
||||||
this.Machines = Machines;
|
this.Machines = Machines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<T> iterator()
|
public Iterator<T> iterator()
|
||||||
{
|
{
|
||||||
return new NodeIterator( Machines );
|
return new NodeIterator( Machines );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size()
|
public int size()
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
for (Set<IGridNode> o : Machines.values())
|
for (Set<IGridNode> o : Machines.values())
|
||||||
size += o.size();
|
size += o.size();
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
for (Set<IGridNode> o : Machines.values())
|
for (Set<IGridNode> o : Machines.values())
|
||||||
if ( !o.isEmpty() )
|
if ( !o.isEmpty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object node)
|
public boolean contains(Object node)
|
||||||
{
|
{
|
||||||
Class c = ((IGridNode) node).getMachine().getClass();
|
Class c = ((IGridNode) node).getMachine().getClass();
|
||||||
|
|
||||||
Set<IGridNode> p = Machines.get( c );
|
Set<IGridNode> p = Machines.get( c );
|
||||||
if ( p != null )
|
if ( p != null )
|
||||||
return p.contains( node );
|
return p.contains( node );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue