src/main/java/com/findupon/commons/utilities/AutomobileAttributeMatcher.java
// 328i should match from 328 i
328i should match from 328 i
328i should match from 328 i
static List<String> compute(String attribute) {
		final List<String> variants = new ArrayList<>();
		variants.add(attribute);
		if(bmwXVariants.contains(attribute)) {
			variants.add(StringUtils.replace(attribute, "xi", "ix"));
			variants.add(StringUtils.replace(attribute, "xi", "xiT"));
			variants.add(StringUtils.replace(attribute, "xi", "xiC"));
		} else if(bmwCVariants.contains(attribute)) {
			variants.add(StringUtils.replace(attribute, "Ci", "ic"));
			variants.add(StringUtils.replace(attribute, "Ci", "CiT"));
			variants.add(StringUtils.replace(attribute, "Ci", "CiC"));
		} else if(bmwIVariants.contains(attribute)) {
			variants.add(StringUtils.replace(attribute, "i", "iAT"));
			variants.add(StringUtils.replace(attribute, "i", "iA"));
			variants.add(StringUtils.replace(attribute, "i", "iT"));
		} else if(bmwXDriveVariants.contains(attribute)) {
			variants.add(StringUtils.replace(attribute, "i xDrive", "xi"));
		} else if(bmwEVariants.contains(attribute)) {
			variants.add(StringUtils.replace(attribute, "e xDrive", "xe"));
		} else if(volvoCCVariants.contains(attribute)) {
			variants.add(StringUtils.replace(attribute, " Cross Country", "CC"));
		} else if(ferrariFVariants.contains(attribute)) {
			variants.add(StringUtils.remove(attribute, "F"));
		} else if(StringUtils.contains(attribute, " AMG")) {
			variants.add("AMG " + StringUtils.remove(attribute, " AMG"));
		} else if(StringUtils.equals(attribute, "Mercedes-Benz")) {
			variants.add("Mercedes");
		} else if(StringUtils.contains(attribute, "&")) {
			variants.add(StringUtils.replace(attribute, "&", "and"));
		} else if(StringUtils.contains(attribute, "and")) {
			variants.add(StringUtils.replace(attribute, "and", "&"));
		}
		if(attribute != null) {
			Matcher m = tresNumberLetterPattern.matcher(attribute);
			if(m.find()) {
				int position = m.start() + 3;
				variants.add(attribute.substring(0, position) + " " + attribute.substring(position));
			}
		}
		return AttributeOperations.buildSpaceDashSimilarity(variants);
	}
static List < String > compute ( String attribute ) { final List < String > variants = new ArrayList < > ( ) ; variants . add ( attribute ) ; if ( bmwXVariants . contains ( attribute ) ) { variants . add ( StringUtils . replace ( attribute , "xi" , "ix" ) ) ; variants . add ( StringUtils . replace ( attribute , "xi" , "xiT" ) ) ; variants . add ( StringUtils . replace ( attribute , "xi" , "xiC" ) ) ; } else if ( bmwCVariants . contains ( attribute ) ) { variants . add ( StringUtils . replace ( attribute , "Ci" , "ic" ) ) ; variants . add ( StringUtils . replace ( attribute , "Ci" , "CiT" ) ) ; variants . add ( StringUtils . replace ( attribute , "Ci" , "CiC" ) ) ; } else if ( bmwIVariants . contains ( attribute ) ) { variants . add ( StringUtils . replace ( attribute , "i" , "iAT" ) ) ; variants . add ( StringUtils . replace ( attribute , "i" , "iA" ) ) ; variants . add ( StringUtils . replace ( attribute , "i" , "iT" ) ) ; } else if ( bmwXDriveVariants . contains ( attribute ) ) { variants . add ( StringUtils . replace ( attribute , "i xDrive" , "xi" ) ) ; } else if ( bmwEVariants . contains ( attribute ) ) { variants . add ( StringUtils . replace ( attribute , "e xDrive" , "xe" ) ) ; } else if ( volvoCCVariants . contains ( attribute ) ) { variants . add ( StringUtils . replace ( attribute , " Cross Country" , "CC" ) ) ; } else if ( ferrariFVariants . contains ( attribute ) ) { variants . add ( StringUtils . remove ( attribute , "F" ) ) ; } else if ( StringUtils . contains ( attribute , " AMG" ) ) { variants . add ( "AMG " + StringUtils . remove ( attribute , " AMG" ) ) ; } else if ( StringUtils . equals ( attribute , "Mercedes-Benz" ) ) { variants . add ( "Mercedes" ) ; } else if ( StringUtils . contains ( attribute , "&" ) ) { variants . add ( StringUtils . replace ( attribute , "&" , "and" ) ) ; } else if ( StringUtils . contains ( attribute , "and" ) ) { variants . add ( StringUtils . replace ( attribute , "and" , "&" ) ) ; } if ( attribute != null ) { Matcher m = tresNumberLetterPattern . matcher ( attribute ) ; if ( m . find ( ) ) { int position = m . start ( ) + 3 ; variants . add ( attribute . substring ( 0 , position ) + " " + attribute . substring ( position ) ) ; } } return AttributeOperations . buildSpaceDashSimilarity ( variants ) ; }
328i should match from 328 i
328i should match from 328 i