public PropertyBoxModuleFactoryI(string propertyClassIceId, string[] propertyFunctionsIceIds, BoxModuleFactoryCreatorPrx myFactoryCreatorProxy, string[] localePrefs, PropertyValue defaultValue, PropertyBoxModuleFactoryCreatorI.ValueFromPrx valueFromPrx, Ice.ObjectAdapter adapter, string settingModuleIdentifier) { this.propertyClassIceId = propertyClassIceId; this.propertyFunctionsIceIds = propertyFunctionsIceIds; //this.localePrefs = localePrefs; this.myFactoryCreatorProxy = myFactoryCreatorProxy; this.defaultValue = defaultValue; this.valueFromPrx = valueFromPrx; this.myProxy = BoxModuleFactoryPrxHelper.uncheckedCast(adapter.addWithUUID(this)); this.settingModuleIdentifier = settingModuleIdentifier; }
///<summary> /// Constructor /// </summary> /// <param name="propertyClassIceId">A string</param> /// <param name="propertyFunctionsIceIds">A string[]</param> /// <param name="identifier">A string</param> public PropertyBoxModuleFactoryCreatorI(string propertyClassIceId, string[] propertyFunctionsIceIds, string identifier, PropertyValue defaultValue, ValueFromPrx valueFromPrx, PropertyReapThread reaper, Ice.ObjectAdapter adapter, string settingModuleIdentifier) { this.propertyClassIceId = propertyClassIceId; this.propertyFunctionsIceIds = propertyFunctionsIceIds; this.identifier = identifier; this.valueFromPrx = valueFromPrx; this.reaper = reaper; this.defaultValue = defaultValue; this.myProxy = PropertyBoxModuleFactoryCreatorPrxHelper.uncheckedCast(adapter.add(this,Ice.Util.stringToIdentity(identifier))); this.settingModuleIdentifier = settingModuleIdentifier; }
//private ModulesManager.OutputPrx output; /// <summary> /// Initializes a new instance of the <see cref="T:Ferda.Modules.BoxModuleFactoryI"/> class. /// </summary> /// <param name="boxInfo">The box info.</param> /// <param name="myFactoryCreatorProxy">The proxy of this factory`s creator.</param> /// <param name="localePrefs">The localization preferences.</param> /// <param name="manager">The modules manager engine.</param> public BoxModuleFactoryI(IBoxInfo boxInfo, BoxModuleFactoryCreatorPrx myFactoryCreatorProxy, string[] localePrefs, ModulesManager.ManagersEnginePrx manager) { this.boxInfo = boxInfo; this.localePrefs = localePrefs; this.myFactoryCreatorProxy = myFactoryCreatorProxy; this.manager = manager; //this.output = this.manager.getOutputInterface(); }
public override ModuleForInteractionPrx[] findAllModulesForInteraction(BoxModuleFactoryCreatorPrx creator, Current __current) { List<ModuleForInteractionPrx> result = new List<ModuleForInteractionPrx>(); foreach (BoxType acceptedBoxType in modulesForInteractionByBoxType.Keys) { if (HasBoxType(acceptedBoxType, creator)) result.AddRange(modulesForInteractionByBoxType[acceptedBoxType]); } return result.ToArray(); }
public override ModuleForInteractionPrx findModuleForInteraction(BoxModuleFactoryCreatorPrx creator, Current __current) { List<ModuleForInteractionPrx> result = new List<ModuleForInteractionPrx>(); foreach (BoxType acceptedBoxType in modulesForInteractionByBoxType.Keys) { if (HasBoxType(acceptedBoxType, creator)) return modulesForInteractionByBoxType[acceptedBoxType][0]; } return null; }
/// <summary> /// Says if boxes created by factory created by creator <paramref name="creator"/> /// has boxType <paramref name="boxType"/>. /// </summary> /// <param name="boxType">type of box</param> /// <param name="creator">creator of factory of box</param> /// <returns>true if <paramref name="creator"/> creates factory for box with box type <paramref name="boxType"/></returns> public bool HasBoxType(BoxType boxType, BoxModuleFactoryCreatorPrx creator) { return this.IsWithIceId(boxType.functionIceId, creator) && this.hasSockets(boxType.neededSockets, creator); }
private bool hasSockets(NeededSocket[] neededSockets, BoxModuleFactoryCreatorPrx creator) { Dictionary<string,SocketInfo> socketsDict = new Dictionary<string,SocketInfo>(); BoxModuleFactoryPrx factory = creator.createBoxModuleFactory( helper.LocalePrefs, helper.ManagersEnginePrx); SocketInfo[] sockets = factory.getSockets(); factory.destroy(); foreach (SocketInfo socket in sockets) { socketsDict[socket.name] = socket; } foreach (NeededSocket socketNeeded in neededSockets) { SocketInfo sockNfo; if (!socketsDict.TryGetValue(socketNeeded.socketName, out sockNfo)) return false; BoxType[] boxTypeSeq = sockNfo.socketType; bool finded = false; foreach (BoxType boxType in boxTypeSeq) { if (boxType.functionIceId == socketNeeded.functionIceId) { finded = true; break; } } if (!finded) return false; } return true; }
/// <summary> /// Says if some creator has function with specified ice identifier /// </summary> /// <param name="iceId">Ice identifier</param> /// <param name="creator">Proxy of box module factory creator</param> /// <returns></returns> public bool IsWithIceId(string iceId, BoxModuleFactoryCreatorPrx creator) { System.Collections.Specialized.StringCollection _functionsIceIds = new System.Collections.Specialized.StringCollection(); _functionsIceIds.AddRange( creator.getBoxModuleFunctionsIceIds()); return _functionsIceIds.Contains(iceId); }