Project

General

Profile

Revision e434b808

IDe434b8087fb9cdcade5f8219c078d38e1530027c
Parent 7e2ee71e
Child 6d2d9cf5

Added by Andreas Müller about 2 years ago

ref #8469 better handling of empty or null CategoricalData

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/generate/PolytomousKeyGenerator.java
549 549
        featuresLeft.remove(winnerFeature);
550 550
        if (config.isDebug()){System.out.println("   ScoreMap: " + scoreMap);}
551 551
        if (config.isDebug()){System.out.println("   quantitativeThreshold: " + quantitativeFeaturesThresholds);}
552
        if (config.isDebug()){System.out.println("   winner: " + winnerFeature);}
552 553
        return winnerFeature;
553 554
    }
554 555

  
......
1168 1169
	 */
1169 1170
	private float defaultCategoricalPower(DescriptionElementBase deb1, DescriptionElementBase deb2){
1170 1171
		if (deb1==null || deb2==null) {
1171
			return -1; //what if the two taxa don't have this feature in common ?
1172
			return 0; //TODO what if the two taxa don't have this feature in common ?
1172 1173
		}
1173 1174
		if ((deb1.isInstanceOf(CategoricalData.class))&&(deb2.isInstanceOf(CategoricalData.class))) {
1174 1175
			return defaultCategoricalPower((CategoricalData)deb1, (CategoricalData)deb2);
......
1207 1208
        Set<State> states = getStates(cd1, cd2);
1208 1209
        if (states.size() == 0){
1209 1210
            return 0;
1211
        }else if (cd1.getStateData().isEmpty() || cd2.getStateData().isEmpty()){
1212
            return 0;
1210 1213
        }
1211 1214

  
1212 1215
	    int nDiscriminative = 0;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)