CpcClassification extends PatentClassification { public String standardize() { StringBuilder sb = new StringBuilder().append(section).append(mainClass); if (subClass != null) { sb.append(subClass).append("0"); if (mainGroup != null) { sb.append(mainGroup[0]); if (subGroup != null) { sb.append(subGroup[0]); } } if (mainGroup != null && subGroup != null) { if (mainGroup.length == 1 && subGroup.length == 2 && subGroup[1] != null) { sb.append("-").append(subGroup[1]); } else if (mainGroup.length == 2 && subGroup.length == 2 && mainGroup[1] != null) { sb.append("-").append(mainGroup[1]).append(subGroup[1]); } } } String changed = sb.toString(); changed = String.format("%1$-9s", changed); return changed; } CpcClassification(String originalText, boolean mainOrInventive); boolean isParseFailed(); @Override ClassificationType getType(); String getSection(); void setSection(String section); String getMainClass(); void setMainClass(String mainClass); String getSubClass(); void setSubClass(String subClass); String[] getMainGroup(); void setMainGroup(String[] mainGroup); String[] getSubGroup(); void setSubGroup(String[] subGroup); @Override String getTextNormalized(); @Override List<String> getSearchTokens(); String standardize(); @Override Tree getTree(); @Override int getDepth(); @Override boolean isContained(PatentClassification check); @Override boolean equals(Object obj); @Override void parseText(final String classificationStr); @Override boolean validate(); @Override String toString(); static Map<String, List<CpcClassification>> filterCpc(
			Collection<T> classes);  }
@Test public void standardize() throws ParseException { CpcClassification cpcClass = new CpcClassification("D07B2201/2051", false); cpcClass.parseText("D07B2201/2051"); String expect = "D07B022012051"; assertEquals(expect, cpcClass.standardize()); }