@Override public String evaluate(Context context) { if (instance == null) { if (context.get(Context.KEY_CUSTOM_PLACEHOLDERS).containsKey(id)) { instance = context.get(Context.KEY_CUSTOM_PLACEHOLDERS).get(id).instantiate(parameters); } else { return ""; } } return instance.evaluate(context); }
protected Instance(Context context) { super(context); columns = new Component.Instance[TableComponent.this.columns.size()]; start = new int[TableComponent.this.columns.size()]; width = new int[TableComponent.this.columns.size()]; int j = 0; for (Map.Entry<String, Component> s : TableComponent.this.columns.entrySet()) { if (s.getKey().contains("-")) { String[] tokens = s.getKey().split("-"); int start = Integer.valueOf(tokens[0]); int end = Integer.valueOf(tokens[1]); this.start[j] = start; width[j] = end - start + 1; } else { int i = Integer.valueOf(s.getKey()); start[j] = i; width[j] = 1; } columns[j] = s.getValue().toInstance(context.derived().put(Context.KEY_COLUMNS, width[j])); j += 1; } }
@Override public String evaluate(Context context) { Integer n; return null != (n = context.get(Context.KEY_SERVER_PLAYER_COUNT)) ? n.toString() : ""; }