String existingValue = getCapability( name );
	public void addCapability( String name, String value ) {		//System.out.println("adding capability " + name + " with value " + value );		// when the capability starts with "SoftwarePlatform." or similiar, 		// make it also accessible without it:		if (name.startsWith("SoftwarePlatform.")) {			name = name.substring( 17 );		} else if (name.startsWith("HardwarePlatform.")) {			name = name.substring( 17 );		}		name = name.toLowerCase();		if (!name.startsWith("polish.")) {			name = "polish." + name;		}		//boolean debug = (name.indexOf("javapackage") != -1);		if (this.capabilityManager != null) {			Capability capability = this.capabilityManager.getCapability( name );            //TODO: this is the vision.//            capability.set(name,value,this.);			if ( capability != null ) {				if ( capability.appendExtensions() ) {					String existingValue = getCapability( name );					//value = value.toLowerCase();					//if (debug) {					//	System.out.println( this.identifier + ": " + name + ": value = [" + value + "], existingValue = [" + existingValue + "]");					//}					if (existingValue != null) {						String[] singleValues = StringUtil.splitAndTrim( value, ',' );						boolean valueAdded = false;						for (int i = 0; i < singleValues.length; i++) {							String singleValue = singleValues[i];							//TODO what happens if I add "mmapi" to a "mmaapi1.1" device?							int existingValueIndex = existingValue.indexOf( singleValue ); 							if ( existingValueIndex != -1 ) {								// this is a value that seems to be present already,								// double check it:								int commaIndex = existingValue.indexOf(',', existingValueIndex );								String checkValue;								if (commaIndex == -1) {									checkValue = existingValue.substring( existingValueIndex ).trim();								} else {									checkValue = existingValue.substring( existingValueIndex, commaIndex ).trim();								}								if ( !checkValue.equals( singleValue ) ) {									// this was just a similar value...									//System.out.println( this.identifier + ": Adding value " + singleValue + " to " + name );									existingValueIndex = -1;								//} else {								//	System.out.println( this.identifier + ": Duplicate value " + singleValue + " of " + name );								}							}							if ( existingValueIndex == -1) {								existingValue += ", " + singleValue;								valueAdded = true;							}						}						if (valueAdded) {							value = existingValue;						} else {							return;						}					}				}                if(capability.appendZeroDelimitedExtension()) {                    String existingValue = getCapability(name);                    if(existingValue != null) {                        String temp = existingValue + '\1' + value;                        value = temp;                    }                }				String group = capability.getImplicitGroup();				if ( group != null ) {					addImplicitGroups( value );				}			}		}		//if (debug) {		//	System.out.println(this.identifier + ": " + name + "=" + value);		//}		/*		if ( (Device.JAVA_PACKAGE.equals(name) ) 				|| (Device.JAVA_PROTOCOL.equals(name)) 				|| (Device.VIDEO_FORMAT.equals(name))				|| (Device.SOUND_FORMAT.equals(name)) ) {			value = value.toLowerCase();			String existingValue = getCapability( name );			if (existingValue != null) {				value += "," + existingValue;			}		}		*/		addSingleCapability( name, value );				// when the capability is a size, then also add a height and a width:		if (name.endsWith("size") && value.indexOf('x') > 0) {			String[] values = StringUtil.splitAndTrim( value, 'x' );			String nameStart = name.substring(0, name.length() - 4);			String width = nameStart + "width";			addSingleCapability( width, values[0]);			String height = nameStart + "height";			addSingleCapability( height, values[1]);			if (values.length == 3) {				String depth = nameStart + "depth";				addSingleCapability( depth, values[2]);			}		}				// add all capability-values as symbols/features:		String[] values = StringUtil.splitAndTrim( value, ',' );		for (int i = 0; i < values.length; i++) {			addFeature( name + "." + values[i] );		}	}