private static int getTokenCount(IGenome genome) { IAlleleSpecies species1 = genome.getPrimary(); IAlleleSpecies species2 = genome.getSecondary(); int tokenCount = species1.getComplexity() + species2.getComplexity(); if (tokenCount % 2 != 0) { tokenCount = Math.round((float) tokenCount / 2) * 2; } if (tokenCount > TOKEN_COUNT_MAX) { tokenCount = TOKEN_COUNT_MAX; } else if (tokenCount < TOKEN_COUNT_MIN) { tokenCount = TOKEN_COUNT_MIN; } return tokenCount; }
if (allele instanceof IAlleleSpecies) { IAlleleSpecies species = (IAlleleSpecies) allele; if (species.getComplexity() <= maxComplexity) { potentialSpecies.add(species);
data.put("authority", species.getAuthority()); data.put("binomial", species.getBinomial()); data.put("complexity", species.getComplexity()); data.put("humidity", species.getHumidity().getName()); data.put("temperature", species.getTemperature().getName());
@Override public void onValueChanged(final IAlleleSpecies species) { this.controlInd1.setSpecies(species, EnumDiscoveryState.SHOW); this.controlInd2.setSpecies(species, EnumDiscoveryState.SHOW); final String branchBinomial = species.getBranch().getScientific(); this.controlName.setValue(TextFormatting.UNDERLINE + species.getAlleleName()); this.controlScientific.setValue(TextFormatting.ITALIC + branchBinomial + ' ' + species.getBinomial()); this.controlAuthority.setValue(I18N.localise(DatabaseConstants.KEY + ".discovered") + ": " + TextFormatting.BOLD + species.getAuthority()); this.controlComplexity.setValue(I18N.localise(DatabaseConstants.KEY + ".overview.complexity") + ": " + species.getComplexity()); final String desc = species.getDescription(); StringBuilder descBody = new StringBuilder(TextFormatting.ITALIC.toString()); String descSig = ""; if (desc == null || Objects.equals(desc, "") || desc.contains("for.description") || desc.contains(".desc")) { descBody.append(I18N.localise(DatabaseConstants.KEY + ".no.description")); } else { final String[] descStrings = desc.split("\\|"); descBody.append(descStrings[0]); for (int i = 1; i < descStrings.length - 1; ++i) { descBody.append(' ').append(descStrings[i]); } if (descStrings.length > 1) { descSig += descStrings[descStrings.length - 1]; } } this.controlDescription.setValue(descBody.toString() + TextFormatting.RESET); this.controlSignature.setValue(descSig); final int descHeight = CraftGUI.RENDER.textHeight(this.controlDescription.getValue(), this.controlDescription.getSize().xPos()); this.controlSignature.setPosition(new Point(controlSignature.getPosition().xPos(), this.controlDescription.getPosition().yPos() + descHeight + 10)); } }
new ControlTextCentered(this, y, discovered).setColor(getColor()); y += (int) (3.0f + CraftGUI.RENDER.textHeight(discovered, getWidth())); new ControlTextCentered(this, y, I18N.localise(AnalystConstants.DESCRIPTION_KEY + ".complexity") + ": " + species.getComplexity()).setColor(getColor()); y += 26; ControlText descText = new ControlText(this, new Area(8, y, getWidth() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER);