runelite-api: make HashTable a generic

This commit is contained in:
Adam
2018-06-26 15:09:28 -04:00
parent a83e05ddaa
commit 8ad6f466da
4 changed files with 7 additions and 7 deletions

View File

@@ -692,7 +692,7 @@ public interface Client extends GameEngine
* @return the widget node component table * @return the widget node component table
* @see WidgetNode * @see WidgetNode
*/ */
HashTable getComponentTable(); HashTable<WidgetNode> getComponentTable();
/** /**
* Gets an array of current grand exchange offers. * Gets an array of current grand exchange offers.

View File

@@ -30,7 +30,7 @@ import java.util.Collection;
* A data structure that uses a hash function to compute an index into an * A data structure that uses a hash function to compute an index into an
* array of buckets from which node objects can be quickly obtained. * array of buckets from which node objects can be quickly obtained.
*/ */
public interface HashTable public interface HashTable<T extends Node>
{ {
/** /**
* Gets a node by its hash value. * Gets a node by its hash value.
@@ -38,12 +38,12 @@ public interface HashTable
* @param value the node value * @param value the node value
* @return the associated node * @return the associated node
*/ */
Node get(long value); T get(long value);
/** /**
* Gets a collection of all nodes stored in this table. * Gets a collection of all nodes stored in this table.
* *
* @return the nodes stored * @return the nodes stored
*/ */
Collection<Node> getNodes(); Collection<T> getNodes();
} }

View File

@@ -339,10 +339,9 @@ public class ReorderPrayersPlugin extends Plugin
private PrayerTabState getPrayerTabState() private PrayerTabState getPrayerTabState()
{ {
HashTable componentTable = client.getComponentTable(); HashTable<WidgetNode> componentTable = client.getComponentTable();
for (Node node : componentTable.getNodes()) for (WidgetNode widgetNode : componentTable.getNodes())
{ {
WidgetNode widgetNode = (WidgetNode) node;
if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID)
{ {
return PrayerTabState.PRAYERS; return PrayerTabState.PRAYERS;

View File

@@ -30,6 +30,7 @@ import net.runelite.mapping.Import;
public interface RSHashTable extends HashTable public interface RSHashTable extends HashTable
{ {
@Import("get") @Import("get")
@Override
RSNode get(long value); RSNode get(long value);
@Import("size") @Import("size")