public static Object readBuffer(StringType buffer, StringType attribute) { OptionalDesc _description = new OptionalDesc(); // For Quantity StringType _quantity = (StringType)StringType.readBuffer(buffer, new StringType("Quantity")); _description.quantity = StringType.stringToInt(_quantity); // For Constrains ConstraintOnModel _constrs = (ConstraintOnModel)ConstraintOnModel.readBuffer(buffer, new StringType("Constraints")); _description.constrs = _constrs; // For Tag StringType _tag = (StringType)StringType.readBuffer(buffer, new StringType("Tag")); _description.tag = (Tag)_tag; // For StoreOption StringType _storeOption = StringType.createBuffer(buffer, new StringType("StoreOption")); _description.storeOption = StringType.stringToInt(_storeOption); // For Name StringType _name = (StringType)StringType.readBuffer(buffer, new StringType("Name")); _description.name = StringType.stringByAppend(buffer, _storeOption); return(_description); }
//Clone OptionalDesc public static OptionalDesc cloneOptionalDescription(OptionalDesc _desc) { OptionalDesc descCloned = new OptionalDesc(); //Clone properties of OptionalDesc return(descCloned); }
public static Boolean areDescriptionSame(OptionalDesc _desc1, OptionalDesc _desc2) { bool result = true; if (_desc1.quantity != _desc2.quantity) { result = false; } if (_desc1.storeOption != _desc2.storeOption) { result = false; } if (!StringType.areStringSame(_desc1.tag, _desc2.tag)) { result = false; } if (!StringType.areStringSame(_desc1.name, _desc2.name)) { result = false; } if (!ConstraintOnModel.areSameConstraints(_desc1.constrs, _desc2.constrs)) { result = false; } return(result); }
public StringType createBuffer(StringType obj, StringType attribute) { OptionalDesc description = new OptionalDesc(); // For Quantity StringType _quantity = StringType.createBuffer(Quantative.toString(this.quantity), new StringType("Quantity")); obj = StringType.stringByAppend(obj, _quantity); // For Constrains StringType _constrs = this.constrs.createBuffer(ConstraintOnModel.toString(constrs), new StringType("Constraints")); obj = StringType.stringByAppend(obj, _constrs); // For Tag StringType _tag = StringType.createBuffer(tag, new StringType("Tag")); obj = StringType.stringByAppend(obj, _tag); // For StoreOption StringType _storeOption = StringType.createBuffer(StoreOptional.toString(storeOption), new StringType("StoreOption")); obj = StringType.stringByAppend(obj, _storeOption); // For Name StringType _name = StringType.createBuffer(name, new StringType("Name")); obj = StringType.stringByAppend(obj, _name); obj = base.createBuffer(obj, attribute); return(obj); }
public static Object readBuffer(StringType buffer, StringType attribute) { Model _model = new Model(); _model.description = (OptionalDesc)OptionalDesc.readBuffer(buffer, new StringType("OptionalDescription")); _model.receivedString = StringType.readBuffer(buffer, new StringType("ReceivedString")); _model.subModel = readSubModelBuffer(buffer, new StringType("SubModels")); return(_model); }
public static Model cloneModel(Model origin) { if (origin == null) { return(null); } Model clonedModel = new Model(); //clone OptionalDesc clonedModel.description = OptionalDesc.clonedDescription(origin.description); //clone returnedString clonedModel.returnString = StringType.clonedString(origin.returnString); //clone receivedString clonedModel.receivedString = StringType.clonedString(origin.receivedString); //clone subModels if (origin.subModel != null) { clonedModel.subModel = new List <Model>(); for (int i = 0; i < origin.subModel.Count; i++) { Object _subMod = origin.subModel.ElementAt(i); if (_subMod.GetType() == typeof(StringType)) { clonedModel.subModel.Add(StringType.clonedString((StringType)_subMod)); } else if (_subMod.GetType() == typeof(Model)) { clonedModel.subModel.Add(Model.cloneModel((Model)_subMod)); } } } return(clonedModel); }
public static OptionalDesc clonedDescription(OptionalDesc origin) { if (origin == null) { return(null); } OptionalDesc clonedDesc = new OptionalDesc(); clonedDesc.quantity = origin.quantity; //clone ConstraintOnModel clonedDesc.constrs = ConstraintOnModel.clonedConstraints(origin.constrs); //clone Tag clonedDesc.tag = (Tag)StringType.clonedString(origin.tag); clonedDesc.storeOption = origin.storeOption; //clone Name clonedDesc.name = StringType.clonedString(origin.name); return(clonedDesc); }
public Model1D(OptionalDesc _description) : base(_description) { base.description = _description; }
//Clone StoreOptional //Clone Quantative //Clone Model/SubModel public static Model cloneModel(Model _model) { Model modelCloned = new Model(new OptionalDesc(), new List <Model>()); //Clone OptionalDescription modelCloned.description = OptionalDesc.clonedDescription(_model.description); //Clone ConstraintOnModel //Clone Tag if (_model.description.tag != null) { modelCloned.description.tag = (Tag)CloneModel.cloneString(_model.description.tag); } //Clone Name if (_model.description.name != null) { modelCloned.description.name = CloneModel.cloneString(_model.description.name); } //CLone ... others //Clone receivedString if (_model.receivedString != null) { modelCloned.receivedString = CloneModel.cloneString(_model.receivedString); } //Clone returnedString; if (_model.returnString != null) { modelCloned.returnString = CloneModel.cloneString(_model.returnString); } //Clone subModel list if (_model.subModel == null) { return(modelCloned); } int subModelSize = _model.subModel.Count; if (subModelSize == 0) { modelCloned.subModel = new List <Model>(); } else if (subModelSize > 0) { for (int i = 0; i < subModelSize; i++) { if (_model.subModel.ElementAt(i).GetType() == typeof(StringType)) { modelCloned.subModel.Add(CloneModel.cloneString((StringType)_model.subModel.ElementAt(i))); } else { modelCloned.subModel.Add(CloneModel.cloneModel((Model)_model.subModel.ElementAt(i))); } } } return(modelCloned); }
public Model(OptionalDesc _description, List <Model> _subModel) { description = _description; subModel = _subModel; }
public Model(OptionalDesc _description) { description = _description; }
public static Boolean areModelsSame(Model modl1, Model modl2) { //Compare OptionalDesc if (!OptionalDesc.areDescriptionSame(modl1.description, modl2.description)) { return(false); } //Compare receivedString if (!StringType.areStringSame(modl1.receivedString, modl2.receivedString)) { return(false); } //Compare returnedString if (!StringType.areStringSame(modl1.returnString, modl2.returnString)) { return(false); } if (((modl1.subModel == null) && (modl2.subModel != null)) || ((modl2.subModel == null) && (modl1.subModel != null))) { if (((modl2.subModel != null) && (modl2.subModel.Count == 0)) || ((modl1.subModel != null) && (modl1.subModel.Count == 0))) { return(true); } else { return(false); } } else if ((modl1.subModel == null) && (modl2.subModel == null)) { return(true); } else { int model1Size = modl1.subModel.Count(); int model2Size = modl2.subModel.Count(); if (model1Size != model2Size) { return(false); } //else if ((model1Size == model2Size) && (model1Size == 0)) //{ // return true; //} //else //{ for (int i = 0; i < model1Size; i++) { Object suModeli1 = modl1.subModel.ElementAt(i); Object suModeli2 = modl2.subModel.ElementAt(i); if ((suModeli1.GetType() == typeof(StringType)) && (suModeli1.GetType() == typeof(StringType))) { if (!StringType.areStringSame((StringType)suModeli1, (StringType)suModeli2)) { return(false); } } else if (((suModeli1.GetType() == typeof(StringType)) && (suModeli2.GetType() != typeof(StringType))) || ((suModeli1.GetType() != typeof(StringType)) && (suModeli2.GetType() == typeof(StringType)))) { return(false); } // else if ((suModeli1.GetType() != typeof(StringType)) && (suModeli2.GetType() != typeof(StringType))) else { if (!areModelsSame((Model)suModeli1, (Model)suModeli2)) { return(false); } } } //} } return(true); }