public DataType(EnumDataType type, string guidOfType) : this() { this.DataTypeEnum = type; this.ObjectGuid = guidOfType; this.ListObjectGuids = new ObservableCollection <string>(); }
public EnumDataType CreateEnumDataType(string Name) { EnumDataType datatype = new EnumDataType(); datatype.Name = Name; return datatype; }
public EnumDataType GetDataType(int width, int height, string file) { FileInfo fileInfo = new FileInfo(file); try { EnumDataType dtype = EnumDataType.Unkown; int dlen = (width * 18 + 10) * height; int zlen = width * height * 16; int slen = width * height * 18; if (fileInfo.Length == dlen) { return(EnumDataType.Dat); } if (fileInfo.Length == zlen) { return(EnumDataType.Zdat); } if (fileInfo.Length == slen) { return(EnumDataType.Sdat); } return(dtype); } finally { fileInfo = null; } }
/// <summary> /// Resolves the specified type into its type reference. /// </summary> /// <param name="dataType">The data type.</param> /// <returns>CodeTypeReference that should be used in code to refer to the type.</returns> public CodeTypeReference Visit(PrimitiveDataType dataType) { EnumDataType enumDataType = dataType as EnumDataType; if (enumDataType != null) { if (dataType.IsNullable) { return(Code.GenericType(typeof(System.Nullable <>).FullName, new CodeTypeReference(enumDataType.Definition.FullName))); } return(new CodeTypeReference(enumDataType.Definition.FullName)); } else { Type type = dataType.GetFacet <PrimitiveClrTypeFacet>().Value; if (dataType.IsNullable && type.IsValueType()) { type = typeof(Nullable <>).MakeGenericType(type); } return(new CodeTypeReference(type)); } }
/// <summary> /// Constructor /// </summary> /// <param name="prefix">prefix name</param> /// <param name="belongsTo">current process name</param> /// <param name="isComputable">true if computable</param> /// <param name="type">data type</param> public Variable(string prefix, string belongsTo, bool isComputable, EnumDataType type) { this.name = ""; this.prefixes = new Dictionary <EnumDataType, PrefixInfo>(); this.Set(prefix, belongsTo, "0", isComputable, type); this.UseThis(type); }
/// <inheritdoc /> public async Task SaveData(int id, string data, EnumDataType enumDataType) { if (string.IsNullOrEmpty(data)) { throw new ArgumentException(_options.Messages.EmptyError, nameof(data)); } byte[] byteConvert; try { byteConvert = Convert.FromBase64String(data); } catch (Exception ex) { throw new ArgumentException($"{_options.Messages.ErrorOnConverting} {ex.Message}"); } var dataEntity = new DataEntity { Id = id, Data = data, DataBase64 = byteConvert, EnumDataType = enumDataType }; await _dataRepository.Save(dataEntity); }
public void WriteEnumDataType(StreamWriter writer, EnumDataType datatype) { writer.WriteLine("/* Enum Datatype : " + datatype.Name + " */"); /* Write datatype */ writer.WriteLine("typedef enum "); writer.WriteLine("{"); /* Write values */ for (int i = 0; i < datatype.Fields.Count; i++) { writer.Write(RteFunctionsGenerator.CreateEnumValue(datatype.Fields[i])); writer.WriteLine(","); } /* Write elements count */ //writer.WriteLine(" " + datatype.Name + "_ELEMENTS_COUNT"); writer.WriteLine("} " + datatype.Name + ";"); writer.WriteLine(""); int minLimit = datatype.GetLimit(LimitType.ltLowerLimit); String defineMin = RteFunctionsGenerator.CreateDefine(datatype.Name + "_LOWER_LIMIT", minLimit.ToString()); writer.WriteLine(defineMin); int upperLimit = datatype.GetLimit(LimitType.ltUpperLimit); String defineMax = RteFunctionsGenerator.CreateDefine(datatype.Name + "_UPPER_LIMIT", upperLimit.ToString()); writer.WriteLine(defineMax); writer.WriteLine(""); /* Generate an array if it existis*/ ArrayDataTypeGenerator.GenerateArrayForDataType(writer, datatype); }
protected void TestEnum(EnumDataType enumDt) { bool withoutErrors = true; for (int i = 0; i < enumDt.Fields.Count - 1; i++) { for (int j = i + 1; j < enumDt.Fields.Count; j++) { if (enumDt.Fields[i].Value == enumDt.Fields[j].Value) { withoutErrors = false; AppendText(enumDt.Name + " field value " + enumDt.Fields[i].Name + "equals to " + enumDt.Fields[j].Name + " (" + enumDt.Fields[i].Value + ")", Error: true); } if (enumDt.Fields[i].Name == enumDt.Fields[j].Name) { withoutErrors = false; AppendText(enumDt.Name + " has similar names (" + enumDt.Fields[i].Name + ") of fields for " + i.ToString() + " and " + j.ToString() + " indexes", Error: true); } } } if (withoutErrors) { AppendText(enumDt.Name); } }
public FilterEntity(decimal orderNo, string paramLabel, string paramName, EnumDataType dataType, EnumControlType control) { OrderNo = orderNo; ParamName = paramName; ParamLabel = paramLabel; DataType = dataType; ControlType = control; }
private IDataGenerator ResolveNonCollectionDataGenerator(DataType dataType, bool isUnique, IList <DataGenerationHint> dataGenHints) { ComplexDataType complexDataType = dataType as ComplexDataType; if (complexDataType != null) { var complexGenerator = this.GetOrCreateAndRegisterStructuralDataGeneratorForComplexType(complexDataType.Definition); if (dataType.IsNullable) { return(new NullableNamedValuesGeneratorProxy(complexGenerator, this.Random, dataGenHints)); } return(complexGenerator); } EnumDataType enumDataType = dataType as EnumDataType; if (enumDataType != null) { return(this.GetOrCreateAndRegisterNonCollectionDataGeneratorForEnumType(enumDataType, isUnique, dataGenHints)); } PrimitiveDataType primitiveDataType = dataType as PrimitiveDataType; SpatialDataType spatialType = dataType as SpatialDataType; if (primitiveDataType == null) { throw new TaupoNotSupportedException( string.Format(CultureInfo.InvariantCulture, "Data generator creation is not supported for this data type: '{0}'.", dataType.ToString())); } else if (spatialType != null) { ExceptionUtilities.CheckObjectNotNull( this.SpatialDataGeneratorResolver, "Cannot generate value for spatial data type '{0}' without SpatialDataGeneratorResolver being set", dataType); var isUniqueHint = dataGenHints.OfType <AllUniqueHint>().SingleOrDefault(); if (isUniqueHint != null) { isUnique = true; } return(this.SpatialDataGeneratorResolver.GetDataGenerator(spatialType, isUnique, this.Random, dataGenHints.ToArray())); } else { Type clrType = null; bool isNullable = true; clrType = primitiveDataType.GetFacetValue <PrimitiveClrTypeFacet, Type>(null); ExceptionUtilities.CheckObjectNotNull(clrType, "Facet of type '{0}' not defined on a property type '{1}'.", typeof(PrimitiveClrTypeFacet).Name, dataType); isNullable = primitiveDataType.IsNullable; return(this.ResolvePrimitiveDataGeneratorBasedOnClrType(clrType, isUnique, isNullable, dataGenHints)); } }
private byte[] GetCalibrationData(int width, int height, EnumDataType enumDataType, string file) { byte[] data = null; if (!CalibrationProcessLib.CalibrationReader.Read(file, width, height, out data)) { return(null); } return(data); }
public Reference(IScope innerScope, string belongsTo) { this.scopeRef = innerScope; this.name = ""; this.value = "0"; this.belongsTo = belongsTo; this.type = EnumDataType.E_ANY; this.isDirty = false; }
private EnumDataType GetCalibrationDataType(string file) { CalibrationProcess process = new CalibrationProcess(); CalibrationProcessLib.CalibrationProcess calProcess = new CalibrationProcessLib.CalibrationProcess(); EnumDataType dataType = process.GetDataType(_width, _height, file); return(dataType); }
public IDataType GetDataType(EnumDataType enumDataType, uint length, bool isPositive) { DataType dt = new DataType(); dt.DataTypeEnum = enumDataType; dt.Length = length; dt.IsPositive = isPositive; return(dt); }
/// <summary> /// Use this data type as the current data type value /// </summary> /// <param name="dataType">current data type</param> public void UseThis(EnumDataType dataType) { if (this.prefixes.ContainsKey(dataType)) { this.type = dataType; } else { throw new ArgumentException("Le type de données '" + dataType.ToString() + "' demandé n'existe pas pour la variable '" + this.Name + "'"); } }
/// <summary> /// Gets the complete infos of this variable, given a data type /// </summary> /// <param name="dataType">data type to get infos</param> /// <returns>prefix info</returns> public PrefixInfo PrefixInfo(EnumDataType dataType) { if (this.prefixes.ContainsKey(dataType)) { return(this.prefixes[dataType]); } else { throw new ArgumentException("Le type de données '" + dataType.ToString() + "' demandé n'existe pas pour la variable '" + this.Name + "'"); } }
public Unit oDataUnit; //数据单位 public DataModel() { strDataCode = string.Empty; m_emDataSourceType = EnumDataSourceType.OTHER; m_emDataType = EnumDataType.OTHER; strDataName = string.Empty; strDataCNName = string.Empty; strDataValue = string.Empty; oDataCondtion = new Condition(); oDataUnit = new Unit(); }
public async Task TestController_Show_should_be_redirected(EnumDataType type) { var manageApi = new Mock <IManageApi>(); var frontendUrlMock = new Mock <IFrontendUrlService>(); frontendUrlMock.Setup(x => x.RedirectToFrontend("/organisations/" + TestHelper.ProviderCode + "/courses/" + TestHelper.TargetedProviderCode)).Returns(new RedirectResult("frontend")); var controller = new CourseController(manageApi.Object, new SearchAndCompareUrlService("http://www.example.com"), frontendUrlMock.Object); var result = await controller.Show(TestHelper.ProviderCode, TestHelper.AccreditingProviderCode, TestHelper.TargetedProviderCode); Assert.IsTrue(result is RedirectResult); }
public bool Delete(EnumDataType enumDataType) { if (isEnumDataTypeUsed(enumDataType) == false) { Enums.Remove(enumDataType); return(true); } else { /* datatype is used and we cannot delete it */ return(false); } }
public Property AddProperty(string name, EnumDataType type, uint length, uint accuracy) { var node = new Property(this.GroupProperties) { Name = name, DataType = new DataType() { DataTypeEnum = type, Length = length, Accuracy = accuracy } }; this.GroupProperties.NodeAddNewSubNode(node); return(node); }
/// <summary> /// Visits the specified primitive type. /// </summary> /// <param name="dataType">Data type.</param> /// <returns>A clone of the specified <see cref="DataType"/>.</returns> public DataType Visit(PrimitiveDataType dataType) { EnumDataType enumDataType = dataType as EnumDataType; if (enumDataType != null) { return(enumDataType.WithDefinition(new EnumTypeReference(enumDataType.Definition.NamespaceName, enumDataType.Definition.Name))); } else { return(dataType.Clone <PrimitiveDataType>()); } }
/// <summary> /// Visits the specified primitive type. /// </summary> /// <param name="dataType">Data type.</param> /// <returns>the data type with all references resolved</returns> public DataType Visit(PrimitiveDataType dataType) { EnumDataType enumDataType = dataType as EnumDataType; if (enumDataType != null) { EnumType resolved = this.parent.ResolveEnumTypeReference(this.model, enumDataType.Definition); return(enumDataType.WithDefinition(resolved)); } else { return(dataType); } }
/// <summary> /// Resolves the specified data type. /// </summary> /// <param name="dataType">Data type specification.</param> /// <returns>Resolved EDM Type.</returns> PrimitiveDataType IPrimitiveDataTypeVisitor <PrimitiveDataType> .Visit(EnumDataType dataType) { // Notes: // 1. Do not add facets for Edm namespace/type name because: // - enum types are defined by user and are not Edm built-in types // - we should not have namespace/type name in multiple places (i.e. facets and in EnumDataType.Definition) as it can get out of sync // Use EdmDataTypes.GetEdmFullName/GetEdmName/GetEdmNamespace to get full name for any data type including enums // 2. Do not add facet for Clr primitive type because it's not clear which type we should put: underlying type or actual Clr enum type: // - actual Clr enum type makes sense only in the object layer, while in the conceptual layer underlying type is used // - at this point we don't have actual Clr type // 3. Do we need to clear facets for primitive Clr type, Edm namespace and Emd type name? // For now we leave whatever facets user specified explicitly return(dataType); }
/// <summary> /// Gets the short qualified Edm name /// </summary> /// <param name="dataType">The data type.</param> /// <returns>short qualified Edm name</returns> public string Visit(PrimitiveDataType dataType) { EnumDataType enumDataType = dataType as EnumDataType; if (enumDataType != null) { return(enumDataType.Definition.Name); } bool isValid = dataType.HasFacet <EdmNamespaceFacet>() && dataType.HasFacet <EdmTypeNameFacet>(); ExceptionUtilities.Assert(isValid, "{0} is not a valid Edm primitive data type. No required facets.", dataType); string name = dataType.GetFacet <EdmTypeNameFacet>().Value; return(name); }
/// <summary> /// Dans le cas où la variable n'est pas ou plus calculable /// Enregistre une expression dans une variable incalculable permettant d'utiliser l'expression /// dans la conversion d'une variable assignée dont le type est défini par l'inférence de l'expression /// </summary> /// <param name="comp">compilateur</param> /// <param name="proc">process</param> /// <param name="converter">langage de conversion</param> /// <param name="expression">expression</param> /// <param name="varName">variable</param> /// <returns>l'objet variable utilisé</returns> private static IData ConvertExpression(ICompilateur comp, IProcessInstance proc, ICodeConverter converter, string expression, string varName) { EnumDataType fixedDataType = converter.CurrentFunction.DataTypeResult; // store the result in the scope with the varName parameter if (proc.CurrentScope.Exists(varName)) { // get the variable infos IData myVar = proc.CurrentScope.GetVariable(varName); // the variable exists in the scope, assumed infer the data type from expression // include additional statements for converting expression o2Mate.Expression.Convert(converter, expression, proc.CurrentScope, true, fixedDataType, true); if (myVar.TypeExists(fixedDataType)) { proc.CurrentScope.Update(varName, converter.CurrentFunction.CacheSource, myVar.PrefixInfo(fixedDataType).BelongsTo, false, fixedDataType); } else { // le nouveau type de données de cette variable doit appartenir au processus // qui a initialisé la variable proc.CurrentScope.Update(varName, converter.CurrentFunction.CacheSource, myVar.BelongsTo, false, fixedDataType); } // on met à jour les paramètres en indiquant que cette variable est mutable comp.UpdateParameters(converter, proc, varName, true); return(myVar); } else { // convert expression including variable name o2Mate.Expression.Convert(converter, expression, proc.CurrentScope, true, fixedDataType, true); // create variable, don't use value and assumes to be non-computable and infer data type by the expression IData added = proc.CurrentScope.Add(varName, converter.CurrentFunction.CacheSource, proc.Name, false, fixedDataType); Helper.AddIntoLocal(converter, added); return(added); } }
private void AddEnumDataTypeMenu_Click(object sender, RoutedEventArgs e) { string EnumDataTypeTemplateName = "dtEnumDataType"; if (autosarApp.Enums.FindObject(EnumDataTypeTemplateName) != null) { int index = 0; while (autosarApp.Enums.FindObject(EnumDataTypeTemplateName) != null) { index++; EnumDataTypeTemplateName = "dtEnumDataType" + index.ToString(); } } EnumDataType datatype = DataTypeFabric.Instance().CreateEnumDataType(EnumDataTypeTemplateName); autosarApp.Enums.Add(datatype); AutosarTree.UpdateAutosarTreeView(datatype); AutosarTree.Focus(); }
/// <summary> /// Initializes static members of the DataTypes class. /// </summary> static DataTypes() { Integer = new IntegerDataType(); Stream = new StreamDataType(); String = new StringDataType(); Boolean = new BooleanDataType(); FixedPoint = new FixedPointDataType(); FloatingPoint = new FloatingPointDataType(); DateTime = new DateTimeDataType(); Binary = new BinaryDataType(); Guid = new GuidDataType(); TimeOfDay = new TimeOfDayDataType(); ComplexType = new ComplexDataType(); EntityType = new EntityDataType(); CollectionType = new CollectionDataType(); ReferenceType = new ReferenceDataType(); RowType = new RowDataType(); EnumType = new EnumDataType(); Spatial = new SpatialDataType(); }
/// <summary> /// Creates the course details list /// </summary> /// <param name="type">The type of test data that needs to be generated</param> /// <returns></returns> private static List <Course> GenerateCourseDetails(EnumDataType type) { var listToReturn = new List <Course>(); int variantCount; bool happyPath; switch (type) { case EnumDataType.SingleVariantOneMatch: happyPath = true; variantCount = 1; break; case EnumDataType.MultiVariantOneMatch: happyPath = true; variantCount = 3; break; case EnumDataType.MultiVariantNoMatch: happyPath = false; variantCount = 1; break; case EnumDataType.SingleVariantNoMatch: happyPath = false; variantCount = 3; break; default: happyPath = false; variantCount = 1; break; } foreach (var courseTitle in _courseTitles.Split(",")) { listToReturn.AddRange(GenerateCourseVariants(variantCount, (courseTitle == TargetedCourseTitle && happyPath), courseTitle)); } return(listToReturn); }
/// <summary> /// Visits a primitive data type /// </summary> /// <param name="dataType">The data type to visit</param> /// <returns>The backing type for the data type</returns> public CodeTypeReference Visit(PrimitiveDataType dataType) { EnumDataType enumDataType = dataType as EnumDataType; if (enumDataType != null) { throw new TaupoNotSupportedException("Not supported"); } else { var facet = dataType.GetFacet <PrimitiveClrTypeFacet>(); ExceptionUtilities.CheckObjectNotNull(facet, "Type did not have a primitive clr type facet: {0}", dataType); var type = Code.TypeRef(facet.Value); if (dataType.IsNullable && !facet.Value.IsClass()) { type = Code.GenericType("Nullable", type); } return(type); } }
public IGUID GetDataType(Guid GUID) { BaseDataType baseDatatype = BaseDataTypes.FindObject(GUID); if (baseDatatype != null) { return(baseDatatype); } SimpleDataType simpleDataType = SimpleDataTypes.FindObject(GUID); if (simpleDataType != null) { return(simpleDataType); } ComplexDataType complexDataType = ComplexDataTypes.FindObject(GUID); if (complexDataType != null) { return(complexDataType); } EnumDataType enumDataType = Enums.FindObject(GUID); if (enumDataType != null) { return(enumDataType); } ArrayDataType arrayDataType = ArrayDataTypes.FindObject(GUID); if (arrayDataType != null) { return(arrayDataType); } return(null); }
public String GetDataTypeName(Guid GUID) { ArrayDataType arrayDatatype = ArrayDataTypes.FindObject(GUID); if (arrayDatatype != null) { return(arrayDatatype.Name); } BaseDataType baseDatatype = BaseDataTypes.FindObject(GUID); if (baseDatatype != null) { return(baseDatatype.Name); } SimpleDataType simpleDataType = SimpleDataTypes.FindObject(GUID); if (simpleDataType != null) { return(simpleDataType.Name); } ComplexDataType complexDataType = ComplexDataTypes.FindObject(GUID); if (complexDataType != null) { return(complexDataType.Name); } EnumDataType enumDataType = Enums.FindObject(GUID); if (enumDataType != null) { return(enumDataType.Name); } return(ErrorDataType); }
public string strDataValue; //数据值 #endregion Fields #region Constructors public DataModel() { strDataCode = string.Empty; m_emDataSourceType = EnumDataSourceType.OTHER; m_emDataType = EnumDataType.OTHER; strDataName = string.Empty; strDataCNName = string.Empty; strDataValue = string.Empty; oDataCondtion = new Condition(); oDataUnit = new Unit(); }