private static EModelType _ChooseModel() { ConsoleKeyInfo op; EModelType type = EModelType.Unknow; System.Console.WriteLine("Escolha o tipo de extração"); System.Console.WriteLine("1- KMeans"); System.Console.WriteLine("2- SURF"); op = System.Console.ReadKey(); switch (op.KeyChar) { case '1': type = EModelType.KMeans; break; case '2': type = EModelType.SURF; break; default: break; } return(type); }
public void RemoveListener(EModelType e, MobaMessageFunc msgFunc) { if (this.mDicModel.ContainsKey(e)) { this.mDicModel[e].RemoveModelListner(msgFunc); } }
//=====公开方法 /// <summary> /// 增加一个模型图例 /// </summary> /// <param name="mtype">模型类型</param> /// <returns>返回新增的模型图例描述对象</returns> public LegendUnit addNewModelLegend(EModelType mtype) { LegendUnit l = new LegendUnit(mtype, this); ListModelLegend.Add(l); return(l); }
private static MusicalizationArgs _ReadArguments() { MusicalizationArgs args = new MusicalizationArgs(); EModelType modelType = _ChooseModel(); System.Console.Clear(); switch (modelType) { case EModelType.KMeans: args = _ReadKMeansArguments(); break; case EModelType.SURF: args = _ReadSURFArguments(); break; default: break; } args.TargetType = modelType; return(args); }
public void SetDataInvalid(EModelType e) { if (this.mDicModel.ContainsKey(e)) { this.mDicModel[e].Valid = false; } }
private void AddModel(EModelType e) { if (!this.mDicModel.ContainsKey(e)) { IModel model = this.CreateModel(e); this.AddModel(model); } }
private void RemoveModel(EModelType e) { if (this.mDicModel.ContainsKey(e)) { this.mDicModel[e].UnRegisterMsgHandler(); this.mDicModel.Remove(e); } }
internal CommonModelNotifyParam(IModel model) { this.errorCode = model.LastError; this.data = model.Data; this.modelType = model.ModelType; this.debugMessage = model.DebugMessage; this.typeID = model.LastMsgType; this.msgID = model.LastMsgID; }
public T GetData <T>(EModelType e) { T result = default(T); if (this.mDicModel.ContainsKey(e)) { result = (T)((object)this.mDicModel[e].Data); } return(result); }
private IModel CreateModel(EModelType e) { IModel result = null; Type type = Type.GetType("Assets.Scripts.Model." + e.ToString()); if (type != null) { object obj = Activator.CreateInstance(type); result = (obj as IModel); } return(result); }
/// <summary> /// 是否相同 /// </summary> /// <param name="type"></param> /// <param name="typeStr"></param> /// <returns></returns> public static bool Equals(EModelType type, string typeStr) { if (String.IsNullOrEmpty(typeStr)) { return(false); } if (GetEnum(typeStr) == type) { return(true); } return(false); }
/// <summary> /// 根据枚举类型获取信息 /// </summary> /// <param name="type"></param> /// <returns></returns> public static string GetValue(EModelType type) { switch (type) { case EModelType.Content: return("Content"); case EModelType.Good: return("Good"); default: return("Content"); } }
public void OnAwake() { ModelManager.mInstance = this; this.mDicModel = new Dictionary <EModelType, IModel>(default(EnumEqualityComparer <EModelType>)); EModelType[] array = (EModelType[])Enum.GetValues(typeof(EModelType)); EModelType[] array2 = array; for (int i = 0; i < array2.Length; i++) { EModelType eModelType = array2[i]; if (eModelType > EModelType.Model_null && eModelType < EModelType.Model_max) { this.AddModel(eModelType); } } }
private static EModelType _ConvertToTargetType(string typeDescription) { EModelType type = EModelType.Unknow; foreach (EModelType t in Enum.GetValues(typeof(EModelType))) { if (t != EModelType.Unknow && t.GetDescription().ToLower().Equals(typeDescription.ToLower())) { type = t; break; } } return(type); }
public StatesBuilder(List <IResult> results, EModelType type, Log log = null) { if (results.IsNullOrEmpty()) { throw new ArgumentException(nameof(results)); } if (type == EModelType.Unknow) { throw new ArgumentException(nameof(type)); } Results = results; ModelType = type; Log = log; }
//-------------------Tool Methods------------------------------------- public DataItemUpdate makeDataItemUpdate(ModelUpdate modelUpdate) { EModelType modelType = (EModelType)modelUpdate.modelType; switch (modelType) { case EModelType.modelAssignemt: ModelAssignment assignment = JsonConvert.DeserializeObject <ModelAssignment>(modelUpdate.modelItemAsJson); return(new DataItemUpdate(modelUpdate.dataKey, assignment)); case EModelType.modelClassRoom: ModelClassRoom classRoom = JsonConvert.DeserializeObject <ModelClassRoom>(modelUpdate.modelItemAsJson); return(new DataItemUpdate(modelUpdate.dataKey, classRoom)); case EModelType.modelUser: ModelUser user = JsonConvert.DeserializeObject <ModelUser>(modelUpdate.modelItemAsJson); return(new DataItemUpdate(modelUpdate.dataKey, user)); } return(null); }
public void InvokeModelMem(EModelType e, string methodName, object[] param) { if (string.IsNullOrEmpty(methodName) || !this.mDicModel.ContainsKey(e)) { return; } Type type = this.mDicModel[e].GetType(); if (type == null) { return; } MethodInfo method = type.GetMethod(methodName); if (method == null) { return; } method.Invoke(this.mDicModel[e], param); }
private void _ValidateLog(EModelType type) { string model = type.ToString(); if (this.ModelLog == string.Empty || this.ModelLog == null) { this.ModelLog = string.Format("{0}.log", model); } if (this.StateLog == string.Empty || this.StateLog == null) { this.StateLog = string.Format("{0}State.log", model); } if (this.SequenceLog == string.Empty || this.SequenceLog == null) { this.SequenceLog = string.Format("{0}Sequence.log", model); } if (this.ProbabilityCalculation == string.Empty || this.ProbabilityCalculation == null) { this.ProbabilityCalculation = string.Format("{0}Probability.log", model); } }
/// <summary> /// 根据枚举类型获取展示信息 /// </summary> /// <param name="type"></param> /// <returns></returns> public static string GetText(EModelType type) { return(L(GetValue(type))); }
public LegendUnit(EModelType mtype, Legend3DData Owner) { modelType = mtype; owner = Owner; }
public ModelUpdate(string modelItemAsJson, EModelType modelType, string dataKey) { this.modelItemAsJson = modelItemAsJson; this.modelType = (int)modelType; this.dataKey = dataKey; }
protected void Init(EModelType mt) { this.modelType = mt; }
/// <summary> /// 是否相同 /// </summary> /// <param name="type"></param> /// <param name="typeStr"></param> /// <returns></returns> public static bool Equals(string typeStr, EModelType type) { return(Equals(type, typeStr)); }
public bool ValidData(EModelType e) { return(this.mDicModel.ContainsKey(e) && this.mDicModel[e].Valid); }