public String getPreviousStage(String currStage) { if (currStage == null) { return null; } int ind = currStage.indexOf(":"); Version v = new Version(currStage.substring(0, ind)); int lind = Integer.parseInt(currStage.substring(ind + 1)); java.util.List<WhatsNewItem> its = this.items.get(v); if (its == null) { return null; } lind--; if (lind > -1) { return v.getVersion() + ":" + lind; } Version p = this.items.lowerKey(v); if (p == null) { return null; } java.util.List<WhatsNewItem> pits = this.items.get(p); if (pits != null) { return p.getVersion() + ":" + (pits.size() - 1); } return null; }
public String getNextStage(String currStage) { if (currStage == null) { return this.getStartStage(); } int ind = currStage.indexOf(":"); Version v = new Version(currStage.substring(0, ind)); int lind = Integer.parseInt(currStage.substring(ind + 1)); java.util.List<WhatsNewItem> its = this.items.get(v); if (its == null) { return null; } lind++; if (lind <= (its.size() - 1)) { return v.getVersion() + ":" + lind; } Version n = this.items.higherKey(v); if (n == null) { return null; } java.util.List<WhatsNewItem> nits = this.items.get(n); if (nits != null) { return n.getVersion() + ":0"; } return null; }