/// /// <summary> * get a hashmap that uses ModuleCap/@ID as a key and has the ModuleCap as a /// * value /// * </summary> /// * <returns> the hashmap, null if no modulecaps exist </returns> /// public virtual IDictionary getModuleMap() { Hashtable hashMap = null; VElement v = getChildElementVector(ElementName.MODULECAP, null, null, true, 0, true); if (v != null) { int siz = v.Count; hashMap = new Hashtable(); for (int i = 0; i < siz; i++) { JDFModuleCap mc = (JDFModuleCap)v[i]; string id = mc.getID(); if (!isWildCard(id)) { hashMap.Add(id, mc); } } hashMap = hashMap.Count == 0 ? null : hashMap; } return(hashMap); }
/// /// <summary> * get the minimum availability /// * </summary> /// * <param name="vModuleRefs"> /// * the list of module ids that are evaluated </param> /// * <returns> the minimum availability, null in case of an error, for instance /// * if no modulerefs are specified </returns> /// public virtual EnumAvailability getMinAvailability(VString vModuleRefs) { IDictionary m = getModuleMap(); if (vModuleRefs == null || m == null || vModuleRefs.Count == 0) { return(null); // error exit } JDFDeviceCap.EnumAvailability minAvail = JDFDeviceCap.EnumAvailability.Installed; for (int i = 0; i < vModuleRefs.Count; i++) { JDFModuleCap mc = (JDFModuleCap)m[vModuleRefs.stringAt(i)]; if (mc == null) { return(null); } EnumAvailability a = mc.getAvailability(); if (a == null || EnumAvailability.Module.Equals(a)) // module is not // valid // recursively { return(null); } if (minAvail.CompareTo(a) > 0) { minAvail = a; } } return(minAvail); }
/// /// <summary> * get a modulecap with a given id, create it if it does not exist /// * </summary> /// * <param name="id"> /// * the modulecap id </param> /// * <returns> the modulecap </returns> /// public virtual JDFModuleCap getCreateModuleCap(string id) { JDFModuleCap mc = getModuleCap(id); if (mc == null) { mc = appendModuleCap(); mc.setID(id); } return(mc); }