mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-24 05:44:27 +00:00
Sorting buttons now work
Got the sorting buttons to work. Clicking on the arrow buttons on a filter panel will now move that filter up or down in the filter list. Without having made any changed to how filters are processed, filters higher in the list will naturally be processed before later filters, thereby making it like a priority system. For example, if an item matches two filters, the higher priority filter will take that item before the lower filter, in that way seperating a specific item from a broader (wildcard) specified filter.
This commit is contained in:
1 parent
50e72bc381
commit
293b8c08f1
3 files changed
+48
-4
No files matched your search
@@ -3,6 +3,8 @@ package mekanism.common;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mekanism.common.content.transporter.TransporterFilter;
|
||||
|
||||
public class HashList<T> implements Iterable<T>
|
||||
{
|
||||
private ArrayList<T> list = new ArrayList<T>(256);
|
||||
@@ -90,6 +92,19 @@ public class HashList<T> implements Iterable<T>
|
||||
{
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void swap( int source, int target )
|
||||
{
|
||||
// Make sure both source and target ar legal values
|
||||
if( source == target ) return;
|
||||
if( source < 0 || target < 0 ) return;
|
||||
if( source >= list.size() || target >= list.size() ) return;
|
||||
|
||||
// Perform swap
|
||||
T temp = list.get( source );
|
||||
list.set( source, list.get( target ) );
|
||||
list.set( target, temp );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
|
||||
Reference in new issue
Block a user