BrightSide Workbench Full Report + Source Code
org.turro.alliance.content.AlliancePhaseDefinitions Class Reference
Inheritance diagram for org.turro.alliance.content.AlliancePhaseDefinitions:
Collaboration diagram for org.turro.alliance.content.AlliancePhaseDefinitions:

Public Member Functions

PhaseDefinition get (int index)
 
PhaseDefinition get (String name)
 
int getMapping (int index, String serverId)
 

Static Public Member Functions

static AlliancePhaseDefinitions instance ()
 
static void reset ()
 
static Jsons json ()
 

Static Protected Member Functions

static AlliancePhaseDefinitions load ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 44 of file AlliancePhaseDefinitions.java.

Member Function Documentation

◆ get() [1/2]

PhaseDefinition org.turro.alliance.content.AlliancePhaseDefinitions.get ( int  index)

Definition at line 46 of file AlliancePhaseDefinitions.java.

46  {
47  return stream().filter(pd -> pd.getIndex() == index).findFirst().orElse(null);
48  }
Here is the caller graph for this function:

◆ get() [2/2]

PhaseDefinition org.turro.alliance.content.AlliancePhaseDefinitions.get ( String  name)

Definition at line 50 of file AlliancePhaseDefinitions.java.

50  {
51  return stream().filter(pd -> pd.getName().equals(name)).findFirst().orElse(null);
52  }

◆ getMapping()

int org.turro.alliance.content.AlliancePhaseDefinitions.getMapping ( int  index,
String  serverId 
)

Definition at line 54 of file AlliancePhaseDefinitions.java.

54  {
55  PhaseDefinition pd = get(index);
56  if(pd == null) return index;
57  return pd.getMapping().getOrDefault(serverId, index);
58  }
Here is the call graph for this function:

◆ instance()

static AlliancePhaseDefinitions org.turro.alliance.content.AlliancePhaseDefinitions.instance ( )
static

Definition at line 98 of file AlliancePhaseDefinitions.java.

98  {
99  return INIT.instance(() -> !watch.isNewer(), () -> load());
100  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ json()

static Jsons org.turro.alliance.content.AlliancePhaseDefinitions.json ( )
static

Definition at line 106 of file AlliancePhaseDefinitions.java.

106  {
107  try(FileReader reader = new FileReader(definitionsFile())) {
108  return Jsons.read(reader);
109  } catch (IOException ex) {
110  WebLoggers.severe(AlliancePhaseDefinitions.class).exception(ex).log();
111  }
112  return Jsons.array();
113  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load()

static AlliancePhaseDefinitions org.turro.alliance.content.AlliancePhaseDefinitions.load ( )
staticprotected

Definition at line 117 of file AlliancePhaseDefinitions.java.

117  {
118  AlliancePhaseDefinitions definitions = null;
119  if(watch.exists()) try {
120  watch.reset();
121  JSONSerializer ser = new JSONSerializer(true);
122  definitions = ser.fromJson(FileUtil.getContent(watch.getFile()), AlliancePhaseDefinitions.class);
123  } catch (IOException ex) {
124  Logger.getLogger(AlliancePhaseDefinitions.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
125  }
126  if(definitions == null) {
127  definitions = new AlliancePhaseDefinitions();
128  definitions.setDefaults();
129  save(definitions);
130  }
131  return definitions;
132  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

static void org.turro.alliance.content.AlliancePhaseDefinitions.reset ( )
static

Definition at line 102 of file AlliancePhaseDefinitions.java.

102  {
103  INIT.reset();
104  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: