001package com.fs.starfarer.api.campaign.rules; 002 003import java.util.Collection; 004import java.util.Set; 005 006import org.lwjgl.util.vector.Vector2f; 007 008import com.fs.starfarer.api.campaign.CampaignFleetAPI; 009import com.fs.starfarer.api.campaign.SectorEntityToken; 010 011 012public interface MemoryAPI { 013 void unset(String key); 014 void expire(String key, float days); 015 016 boolean contains(String key); 017 boolean is(String key, Object value); 018 boolean is(String key, float value); 019 boolean is(String key, boolean value); 020 /** 021 * Never expires. 022 * @param key 023 * @param value 024 */ 025 void set(String key, Object value); 026 027 /** 028 * With expiration. 029 * @param key 030 * @param value 031 * @param expire 032 */ 033 void set(String key, Object value, float expire); 034 Object get(String key); 035 String getString(String key); 036 float getFloat(String key); 037 boolean getBoolean(String key); 038 long getLong(String key); 039 040 Vector2f getVector2f(String key); 041 SectorEntityToken getEntity(String key); 042 CampaignFleetAPI getFleet(String key); 043 044 /** 045 * Includes both endpoints. 046 * @param key 047 * @param from 048 * @param to 049 * @return 050 */ 051 boolean between(String key, float min, float max); 052 053 054 Collection<String> getKeys(); 055 float getExpire(String key); 056 057 058 void advance(float amount); 059 060 061 /** 062 * Can be called multiple times for a key. 063 * 064 * If this is called, then key will be removed from memory when NONE of the 065 * requiredKeys are left in memory. 066 * 067 * @param key 068 * @param requiredKey 069 */ 070 void addRequired(String key, String requiredKey); 071 void removeRequired(String key, String requiredKey); 072 boolean isEmpty(); 073 Set<String> getRequired(String key); 074 void removeAllRequired(String key); 075 void clear(); 076 int getInt(String key); 077} 078 079 080