test_class.declarator: client
test_class.modifier: @Mock
  	@Bind
  	private
test_class.original_string: @Mock
  	@Bind
  	private Client client;
test_class.type: Client
test_class.var_name: client
test_class.declarator: itemManager
test_class.modifier: @Mock
  	@Bind
  	private
test_class.original_string: @Mock
  	@Bind
  	private ItemManager itemManager;
test_class.type: ItemManager
test_class.var_name: itemManager
test_class.declarator: bankConfig
test_class.modifier: @Mock
  	@Bind
  	private
test_class.original_string: @Mock
  	@Bind
  	private BankConfig bankConfig;
test_class.type: BankConfig
test_class.var_name: bankConfig
test_class.declarator: bankPlugin
test_class.modifier: @Inject
  	private
test_class.original_string: @Inject
  	private BankPlugin bankPlugin;
test_class.type: BankPlugin
test_class.var_name: bankPlugin
test_class.file: runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java
test_class.identifier: BankPluginTest
test_case.body: @Test
  	public void testValueSearch()
  	{
  		int itemId = ItemID.ABYSSAL_WHIP;
  
  		ItemContainer itemContainer = mock(ItemContainer.class);
  		when(itemContainer.getItems()).thenReturn(new Item[]{new Item(itemId, 30)});
  		when(client.getItemContainer(InventoryID.BANK)).thenReturn(itemContainer);
  
  		ItemComposition comp = mock(ItemComposition.class);
  
  		// 60k HA price * 30 = 1.8m
  		when(comp.getHaPrice())
  			.thenReturn(60_000);
  
  		// 400k GE Price * 30 = 12m
  		when(itemManager.getItemPrice(itemId))
  			.thenReturn(400_000);
  		when(itemManager.getItemComposition(itemId))
  			.thenReturn(comp);
  
  		assertTrue(bankPlugin.valueSearch(itemId, ">500k"));
  		assertTrue(bankPlugin.valueSearch(itemId, "< 5.5b"));
  		assertTrue(bankPlugin.valueSearch(itemId, "500k - 20.6m"));
  
  		assertTrue(bankPlugin.valueSearch(itemId, "ha=1.8m"));
  		assertTrue(bankPlugin.valueSearch(itemId, "ha 500k - 20.6m"));
  		assertTrue(bankPlugin.valueSearch(itemId, "ha > 940k"));
  
  		assertFalse(bankPlugin.valueSearch(itemId, "<500k"));
  		assertFalse(bankPlugin.valueSearch(itemId, "ha >2m"));
  		assertFalse(bankPlugin.valueSearch(itemId, "ge > 0.02b"));
  
  		assertFalse(bankPlugin.valueSearch(itemId, "1000k"));
  	}
test_case.class_method_signature: BankPluginTest.testValueSearch()
test_case.full_signature: @Test public void testValueSearch()
test_case.identifier: testValueSearch
test_case.invocations: mock thenReturn when getItems thenReturn when getItemContainer mock thenReturn when getHaPrice thenReturn when getItemPrice thenReturn when getItemComposition assertTrue valueSearch assertTrue valueSearch assertTrue valueSearch assertTrue valueSearch assertTrue valueSearch assertTrue valueSearch assertFalse valueSearch assertFalse valueSearch assertFalse valueSearch assertFalse valueSearch
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValueSearch()
focal_class.declarator: DEPOSIT_WORN = "Deposit worn items"
focal_class.modifier: private static final
focal_class.original_string: private static final String DEPOSIT_WORN = "Deposit worn items";
focal_class.type: String
focal_class.var_name: DEPOSIT_WORN
focal_class.declarator: DEPOSIT_INVENTORY = "Deposit inventory"
focal_class.modifier: private static final
focal_class.original_string: private static final String DEPOSIT_INVENTORY = "Deposit inventory";
focal_class.type: String
focal_class.var_name: DEPOSIT_INVENTORY
focal_class.declarator: DEPOSIT_LOOT = "Deposit loot"
focal_class.modifier: private static final
focal_class.original_string: private static final String DEPOSIT_LOOT = "Deposit loot";
focal_class.type: String
focal_class.var_name: DEPOSIT_LOOT
focal_class.declarator: SEED_VAULT_TITLE = "Seed Vault"
focal_class.modifier: private static final
focal_class.original_string: private static final String SEED_VAULT_TITLE = "Seed Vault";
focal_class.type: String
focal_class.var_name: SEED_VAULT_TITLE
focal_class.declarator: NUMBER_REGEX = "[0-9]+(\\.[0-9]+)?[kmb]?"
focal_class.modifier: private static final
focal_class.original_string: private static final String NUMBER_REGEX = "[0-9]+(\\.[0-9]+)?[kmb]?";
focal_class.type: String
focal_class.var_name: NUMBER_REGEX
focal_class.declarator: VALUE_SEARCH_PATTERN = Pattern.compile("^(?<mode>ge|ha|alch)?" +
  		" *(((?<op>[<>=]|>=|<=) *(?<num>" + NUMBER_REGEX + "))|" +
  		"((?<num1>" + NUMBER_REGEX + ") *- *(?<num2>" + NUMBER_REGEX + ")))$", Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern VALUE_SEARCH_PATTERN = Pattern.compile("^(?<mode>ge|ha|alch)?" +
  		" *(((?<op>[<>=]|>=|<=) *(?<num>" + NUMBER_REGEX + "))|" +
  		"((?<num1>" + NUMBER_REGEX + ") *- *(?<num2>" + NUMBER_REGEX + ")))$", Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: VALUE_SEARCH_PATTERN
focal_class.declarator: client
focal_class.modifier: @Inject
  	private
focal_class.original_string: @Inject
  	private Client client;
focal_class.type: Client
focal_class.var_name: client
focal_class.declarator: clientThread
focal_class.modifier: @Inject
  	private
focal_class.original_string: @Inject
  	private ClientThread clientThread;
focal_class.type: ClientThread
focal_class.var_name: clientThread
focal_class.declarator: itemManager
focal_class.modifier: @Inject
  	private
focal_class.original_string: @Inject
  	private ItemManager itemManager;
focal_class.type: ItemManager
focal_class.var_name: itemManager
focal_class.declarator: config
focal_class.modifier: @Inject
  	private
focal_class.original_string: @Inject
  	private BankConfig config;
focal_class.type: BankConfig
focal_class.var_name: config
focal_class.declarator: bankSearch
focal_class.modifier: @Inject
  	private
focal_class.original_string: @Inject
  	private BankSearch bankSearch;
focal_class.type: BankSearch
focal_class.var_name: bankSearch
focal_class.declarator: forceRightClickFlag
focal_class.modifier: private
focal_class.original_string: private boolean forceRightClickFlag;
focal_class.type: boolean
focal_class.var_name: forceRightClickFlag
focal_class.declarator: itemQuantities
focal_class.modifier: private
focal_class.original_string: private Multiset<Integer> itemQuantities;
focal_class.type: Multiset<Integer>
focal_class.var_name: itemQuantities
focal_class.declarator: searchString
focal_class.modifier: private
focal_class.original_string: private String searchString;
focal_class.type: String
focal_class.var_name: searchString
focal_class.file: runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java
focal_class.identifier: BankPlugin
focal_class.class_method_signature: BankPlugin.getConfig(ConfigManager configManager)
focal_class.full_signature: @Provides BankConfig getConfig(ConfigManager configManager)
focal_class.identifier: getConfig
focal_class.modifiers: @Provides
focal_class.parameters: (ConfigManager configManager)
focal_class.return: BankConfig
focal_class.signature: BankConfig getConfig(ConfigManager configManager)
focal_class.class_method_signature: BankPlugin.shutDown()
focal_class.full_signature: @Override protected void shutDown()
focal_class.identifier: shutDown
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void shutDown()
focal_class.class_method_signature: BankPlugin.onMenuShouldLeftClick(MenuShouldLeftClick event)
focal_class.full_signature: @Subscribe public void onMenuShouldLeftClick(MenuShouldLeftClick event)
focal_class.identifier: onMenuShouldLeftClick
focal_class.modifiers: @Subscribe public
focal_class.parameters: (MenuShouldLeftClick event)
focal_class.return: void
focal_class.signature: void onMenuShouldLeftClick(MenuShouldLeftClick event)
focal_class.class_method_signature: BankPlugin.onMenuEntryAdded(MenuEntryAdded event)
focal_class.full_signature: @Subscribe public void onMenuEntryAdded(MenuEntryAdded event)
focal_class.identifier: onMenuEntryAdded
focal_class.modifiers: @Subscribe public
focal_class.parameters: (MenuEntryAdded event)
focal_class.return: void
focal_class.signature: void onMenuEntryAdded(MenuEntryAdded event)
focal_class.class_method_signature: BankPlugin.onScriptCallbackEvent(ScriptCallbackEvent event)
focal_class.full_signature: @Subscribe public void onScriptCallbackEvent(ScriptCallbackEvent event)
focal_class.identifier: onScriptCallbackEvent
focal_class.modifiers: @Subscribe public
focal_class.parameters: (ScriptCallbackEvent event)
focal_class.return: void
focal_class.signature: void onScriptCallbackEvent(ScriptCallbackEvent event)
focal_class.class_method_signature: BankPlugin.onWidgetLoaded(WidgetLoaded event)
focal_class.full_signature: @Subscribe public void onWidgetLoaded(WidgetLoaded event)
focal_class.identifier: onWidgetLoaded
focal_class.modifiers: @Subscribe public
focal_class.parameters: (WidgetLoaded event)
focal_class.return: void
focal_class.signature: void onWidgetLoaded(WidgetLoaded event)
focal_class.class_method_signature: BankPlugin.onScriptPostFired(ScriptPostFired event)
focal_class.full_signature: @Subscribe public void onScriptPostFired(ScriptPostFired event)
focal_class.identifier: onScriptPostFired
focal_class.modifiers: @Subscribe public
focal_class.parameters: (ScriptPostFired event)
focal_class.return: void
focal_class.signature: void onScriptPostFired(ScriptPostFired event)
focal_class.class_method_signature: BankPlugin.onItemContainerChanged(ItemContainerChanged event)
focal_class.full_signature: @Subscribe public void onItemContainerChanged(ItemContainerChanged event)
focal_class.identifier: onItemContainerChanged
focal_class.modifiers: @Subscribe public
focal_class.parameters: (ItemContainerChanged event)
focal_class.return: void
focal_class.signature: void onItemContainerChanged(ItemContainerChanged event)
focal_class.class_method_signature: BankPlugin.createValueText(long gePrice, long haPrice)
focal_class.full_signature: private String createValueText(long gePrice, long haPrice)
focal_class.identifier: createValueText
focal_class.modifiers: private
focal_class.parameters: (long gePrice, long haPrice)
focal_class.return: String
focal_class.signature: String createValueText(long gePrice, long haPrice)
focal_class.class_method_signature: BankPlugin.updateSeedVaultTotal()
focal_class.full_signature: private void updateSeedVaultTotal()
focal_class.identifier: updateSeedVaultTotal
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void updateSeedVaultTotal()
focal_class.class_method_signature: BankPlugin.getSeedVaultItems()
focal_class.full_signature: private Item[] getSeedVaultItems()
focal_class.identifier: getSeedVaultItems
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Item[]
focal_class.signature: Item[] getSeedVaultItems()
focal_class.class_method_signature: BankPlugin.valueSearch(final int itemId, final String str)
focal_class.full_signature: @VisibleForTesting boolean valueSearch(final int itemId, final String str)
focal_class.identifier: valueSearch
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (final int itemId, final String str)
focal_class.return: boolean
focal_class.signature: boolean valueSearch(final int itemId, final String str)
focal_class.class_method_signature: BankPlugin.getBankItemSet()
focal_class.full_signature: private Multiset<Integer> getBankItemSet()
focal_class.identifier: getBankItemSet
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Multiset<Integer>
focal_class.signature: Multiset<Integer> getBankItemSet()
focal_class.class_method_signature: BankPlugin.calculate(@Nullable Item[] items)
focal_class.full_signature: @Nullable ContainerPrices calculate(@Nullable Item[] items)
focal_class.identifier: calculate
focal_class.modifiers: @Nullable
focal_class.parameters: (@Nullable Item[] items)
focal_class.return: ContainerPrices
focal_class.signature: ContainerPrices calculate(@Nullable Item[] items)
focal_class.class_method_signature: BankPlugin.getHaPrice(int itemId)
focal_class.full_signature: private int getHaPrice(int itemId)
focal_class.identifier: getHaPrice
focal_class.modifiers: private
focal_class.parameters: (int itemId)
focal_class.return: int
focal_class.signature: int getHaPrice(int itemId)
focal_class.superclass: extends Plugin
focal_method.body: @VisibleForTesting
  	boolean valueSearch(final int itemId, final String str)
  	{
  		final Matcher matcher = VALUE_SEARCH_PATTERN.matcher(str);
  		if (!matcher.matches())
  		{
  			return false;
  		}
  
  		// Count bank items and remember it for determining item quantity
  		if (itemQuantities == null)
  		{
  			itemQuantities = getBankItemSet();
  		}
  
  		final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
  		final int qty = itemQuantities.count(itemId);
  		final long gePrice = (long) itemManager.getItemPrice(itemId) * qty;
  		final long haPrice = (long) itemComposition.getHaPrice() * qty;
  
  		long value = Math.max(gePrice, haPrice);
  
  		final String mode = matcher.group("mode");
  		if (mode != null)
  		{
  			value = mode.toLowerCase().equals("ge") ? gePrice : haPrice;
  		}
  
  		final String op = matcher.group("op");
  		if (op != null)
  		{
  			long compare;
  			try
  			{
  				compare = QuantityFormatter.parseQuantity(matcher.group("num"));
  			}
  			catch (ParseException e)
  			{
  				return false;
  			}
  
  			switch (op)
  			{
  				case ">":
  					return value > compare;
  				case "<":
  					return value < compare;
  				case "=":
  					return value == compare;
  				case ">=":
  					return value >= compare;
  				case "<=":
  					return value <= compare;
  			}
  		}
  
  		final String num1 = matcher.group("num1");
  		final String num2 = matcher.group("num2");
  		if (num1 != null && num2 != null)
  		{
  			long compare1, compare2;
  			try
  			{
  				compare1 = QuantityFormatter.parseQuantity(num1);
  				compare2 = QuantityFormatter.parseQuantity(num2);
  			}
  			catch (ParseException e)
  			{
  				return false;
  			}
  
  			return compare1 <= value && compare2 >= value;
  		}
  
  		return false;
  	}
focal_method.class_method_signature: BankPlugin.valueSearch(final int itemId, final String str)
focal_method.full_signature: @VisibleForTesting boolean valueSearch(final int itemId, final String str)
focal_method.identifier: valueSearch
focal_method.invocations: matcher matches getBankItemSet getItemComposition count getItemPrice getHaPrice max group equals toLowerCase group parseQuantity group group group parseQuantity parseQuantity
focal_method.modifiers: @VisibleForTesting
focal_method.parameters: (final int itemId, final String str)
focal_method.return: boolean
focal_method.signature: boolean valueSearch(final int itemId, final String str)