Пример #1
0
        internal static void CreateLatestReport(DATA_TYPE fileType, List <PatchData> data)
        {
            string fileName = GetDataTypeFileName(fileType, "LatestSecurity");

            if (!Directory.Exists(m_dataDirectory))
            {
                Directory.CreateDirectory(m_dataDirectory);
            }

            var writer = new ReportWriter(fileName);

            if (fileType == DATA_TYPE.CSV)
            {
                WriteCSVLastestReport(data, writer);
                writer.StartFile();
            }

            if (fileType == DATA_TYPE.XLS)
            {
                WriteCSVLastestReport(data, writer);
                Process.Start(Environment.CurrentDirectory.ToString() + "\\bin\\convertLR.cmd", fileName);
            }

            if (fileType == DATA_TYPE.HTML)
            {
                WriteHTMLLatestReport(data, writer);
                Process.Start(fileName);
            }

            LoaderHelper.LoaderKill();
        }
Пример #2
0
        public List <int> getPartitionKeys(IVector partitionCol)
        {
            if (partitionCol.getDataCategory() != cat)
            {
                throw new Exception("Data category incompatible.");
            }
            if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType())
            {
                DATA_TYPE old = partitionCol.getDataType();
                partitionCol = (IVector)Utils.castDateTime(partitionCol, type);
                if (partitionCol == null)
                {
                    throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString());
                }
            }
            if (type == DATA_TYPE.DT_LONG)
            {
                throw new Exception("Long type value can't be used as a partition column.");
            }

            int        rows = partitionCol.rows();
            List <int> keys = new List <int>(rows);

            for (int i = 0; i < rows; ++i)
            {
                keys.Add(partitionCol.hashBucket(i, 1048576));
            }
            return(keys);
        }
Пример #3
0
        public static void CreateVulnReport(DATA_TYPE fileType, List <PatchCountOfComplianceDto> data)
        {
            string fileName = GetDataTypeFileName(fileType, "VulnReport");

            if (!Directory.Exists(m_dataDirectory))
            {
                Directory.CreateDirectory(m_dataDirectory);
            }
            ReportWriter writer = new ReportWriter(fileName);

            if (fileType == DATA_TYPE.CSV)
            {
                WriteCSVVulnReport(data, writer);
                writer.StartFile();
            }

            if (fileType == DATA_TYPE.XLS)
            {
                WriteCSVVulnReport(data, writer);
                Process.Start(Environment.CurrentDirectory.ToString() + "\\bin\\convertVR.cmd", fileName);
            }

            if (fileType == DATA_TYPE.HTML)
            {
                WriteHTMLVulnReport(data, writer);
                Process.Start(fileName);
            }

            LoaderHelper.LoaderKill();
        }
Пример #4
0
        public ListDomain(IVector list, DATA_TYPE type, DATA_CATEGORY cat)
        {
            this.type = type;
            this.cat  = cat;
            if (list.getDataType() != DATA_TYPE.DT_ANY)
            {
                throw new Exception("The input list must be a tuple.");
            }
            dict = new Dictionary <IScalar, int>();

            BasicAnyVector values     = (BasicAnyVector)list;
            int            partitions = values.rows();

            for (int i = 0; i < partitions; ++i)
            {
                IEntity cur = values.getEntity(i);
                if (cur.isScalar())
                {
                    dict.Add((IScalar)cur, i);
                }
                else
                {
                    IVector vec = (IVector)cur;
                    for (int j = 0; j < vec.rows(); ++j)
                    {
                        dict.Add(vec.get(j), i);
                    }
                }
            }
        }
Пример #5
0
 public static Domain createDomain(PARTITION_TYPE type, DATA_TYPE partitionColType, IEntity partitionSchema)
 {
     if (type == PARTITION_TYPE.HASH)
     {
         DATA_TYPE     dataType = partitionColType;
         DATA_CATEGORY dataCat  = Utils.getCategory(dataType);
         int           buckets  = ((BasicInt)partitionSchema).getValue();
         return(new HashDomain(buckets, dataType, dataCat));
     }
     else if (type == PARTITION_TYPE.VALUE)
     {
         DATA_TYPE     dataType = partitionSchema.getDataType();
         DATA_CATEGORY dataCat  = Utils.getCategory(dataType);
         return(new ValueDomain((IVector)partitionSchema, dataType, dataCat));
     }
     else if (type == PARTITION_TYPE.RANGE)
     {
         DATA_TYPE     dataType = partitionSchema.getDataType();
         DATA_CATEGORY dataCat  = Utils.getCategory(dataType);
         return(new RangeDomain((IVector)partitionSchema, dataType, dataCat));
     }
     else if (type == PARTITION_TYPE.LIST)
     {
         DATA_TYPE     dataType = ((BasicAnyVector)partitionSchema).getEntity(0).getDataType();
         DATA_CATEGORY dataCat  = Utils.getCategory(dataType);
         return(new ListDomain((IVector)partitionSchema, dataType, dataCat));
     }
     throw new Exception("Unsupported partition type " + type.ToString());
 }
Пример #6
0
        public static string GetFormat(DATA_TYPE dtype)
        {
            switch (dtype)
            {
            case DATA_TYPE.DT_DATE:
                return("yyyy/m/d");

            case DATA_TYPE.DT_MONTH:
                return("yyyy/m");

            case DATA_TYPE.DT_TIME:
                return("hh:mm:ss");

            case DATA_TYPE.DT_MINUTE:
                return("hh:mm");

            case DATA_TYPE.DT_SECOND:
            case DATA_TYPE.DT_NANOTIME:
                return("hh:mm:ss");

            case DATA_TYPE.DT_DATETIME:
            case DATA_TYPE.DT_TIMESTAMP:
            case DATA_TYPE.DT_NANOTIMESTAMP:
                return("yyyy/m/d hh:mm:ss");

            case DATA_TYPE.DT_ANY:
                return("@");
            }
            return("General");
        }
Пример #7
0
    public DataFactory addFactory(Type classType, DATA_TYPE type)
    {
        DataFactory factory = DataFactory.createFactory(classType, type);

        mFactoryList.Add(factory.getType(), factory);
        return(factory);
    }
Пример #8
0
        internal static void CreateComplianceStatusReport(DATA_TYPE fileType, List <ComputerOpenClosedStatDto> data)
        {
            string fileName = GetDataTypeFileName(fileType, "ComplianceStatusReport");

            if (!Directory.Exists(m_dataDirectory))
            {
                Directory.CreateDirectory(m_dataDirectory);
            }
            ReportWriter writer = new ReportWriter(fileName);

            if (fileType == DATA_TYPE.CSV)
            {
                WriteCSVFixedInPercent(data, writer);
                writer.StartFile();
            }

            if (fileType == DATA_TYPE.XLS)
            {
                WriteCSVFixedInPercent(data, writer);
                Process.Start(Environment.CurrentDirectory.ToString() + "\\bin\\convertFPercR.cmd", fileName);
            }

            if (fileType == DATA_TYPE.HTML)
            {
                WriteHTMLFixedInPercent(data, writer);
                Process.Start(fileName);
            }

            LoaderHelper.LoaderKill();
        }
Пример #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public BasicSet(Entity_DATA_TYPE keyType, com.xxdb.io.ExtendedDataInput in) throws java.io.IOException
        public BasicSet(DATA_TYPE keyType, ExtendedDataInput @in)
        {
            this.keyType = keyType;

            BasicEntityFactory factory = new BasicEntityFactory();

            DATA_TYPE[] types = Enum.GetValues(typeof(DATA_TYPE));

            //read key vector
            short flag = @in.readShort();
            int   form = flag >> 8;
            int   type = flag & 0xff;

            if (form != (int)DATA_FORM.DF_VECTOR)
            {
                throw new IOException("The form of set keys must be vector");
            }
            if (type < 0 || type >= types.Length)
            {
                throw new IOException("Invalid key type: " + type);
            }

            Vector keys = (Vector)factory.createEntity(DATA_FORM.DF_VECTOR, types[type], @in);

            int size     = keys.rows();
            int capacity = (int)(size / 0.75);

            set = new HashSet <Scalar>(capacity);
            for (int i = 0; i < size; ++i)
            {
                set.Add(keys.get(i));
            }
        }
Пример #10
0
        public static int GetDataTypeSize(DATA_TYPE type)
        {
            switch (type)
            {
            case DATA_TYPE.BOOLEAN:
                return(sizeof(bool));

            case DATA_TYPE.SHORT:
                return(sizeof(short));

            case DATA_TYPE.INT:
                return(sizeof(int));

            case DATA_TYPE.FLOAT:
                return(sizeof(float));

            case DATA_TYPE.DOUBLE:
                return(sizeof(double));

            case DATA_TYPE.STRING:
                return(10);

            default:
                return(0);
            }
        }
Пример #11
0
        decimal GetTrackVal(DATA_TYPE data)
        {
            decimal temp = 0;

            switch (data)
            {
            case DATA_TYPE.FOSC:
                temp = Convert.ToDecimal(Math.Pow(2, Convert.ToDouble(FOSCTRB.Value))) * ProgramData.mega;
                break;

            case DATA_TYPE.CLOCK_DIVIDER:
                temp = Convert.ToDecimal(Math.Pow(2, Convert.ToDouble(ClockDividerTRB.Value)));
                break;

            case DATA_TYPE.PRESCALER:
                temp = Convert.ToDecimal(Math.Pow(2, Convert.ToDouble(PrescalerTRB.Value)));
                break;

            case DATA_TYPE.REGISTER_SIZE:
                temp = Convert.ToDecimal(Math.Pow(2, Convert.ToDouble(RegisterSizeTRB.Value)));
                break;
            }

            return(temp);
        }
Пример #12
0
        public IVector createVectorWithDefaultValue(DATA_TYPE type, int size)
        {
            int index = (int)type;

            if ((int)type > ARRARY_BASE)
            {
                if (size != 0)
                {
                    throw new Exception("If there is no value, an empty ArrayVector can only be created. ");
                }
                else
                {
                    return(new BasicArrayVector(type));
                }
            }
            else
            {
                if (factories[index] == null)
                {
                    return(null);
                }
                else
                {
                    return(factories[index].createVectorWithDefaultValue(size));
                }
            }
        }
        public async Task <IdentityResult> CreateNewEntryAsync(
            User user,
            long dataModelId,
            MODIFICATION modificationType,
            MODEL_TYPE modelType,
            DATA_TYPE dataType,
            string oldValue    = "",
            string actualValue = "",
            int extensionIndex = -1)
        {
            ModificationEntry entry = new ModificationEntry()
            {
                DataModelId      = dataModelId,
                DateTime         = DateTime.Now,
                DataModelType    = modelType,
                ModificationType = modificationType,
                User             = user,
                ActualValue      = actualValue,
                DataType         = dataType,
                ExtensionIndex   = extensionIndex,
                OldValue         = oldValue
            };

            if (await CreateAsync(entry) != null)
            {
                return(IdentityResult.Success);
            }
            else
            {
                return(IdentityResult.Failed());
            }
        }
        bool suitableType(ErrorCodeInfo errorCodeInfo, List <IEntity> args)
        {
            if (args.Count != colTypes_.Count)
            {
                errorCodeInfo.set(ErrorCodeInfo.Code.EC_InvalidObject, string.Format("Column counts don't match {0}.", colTypes_.Count));
                return(false);
            }
            int cols = args.Count();

            for (int i = 0; i < cols; ++i)
            {
                DATA_TYPE argsType;
                if (args[i] is IVector)
                {
                    argsType = ((IVector)args[i]).getDataType();
                }
                else
                {
                    argsType = args[i].getDataType();
                }
                DATA_TYPE colType = args[i] is IVector ? colTypes_[i] - 64 : colTypes_[i];
                if ((int)argsType != (int)colType)
                {
                    if (!((argsType == DATA_TYPE.DT_STRING && (int)colType == (int)DATA_TYPE.DT_SYMBOL) || (argsType == DATA_TYPE.DT_STRING && (int)colType == (int)DATA_TYPE.DT_BLOB)))
                    {
                        errorCodeInfo.set(ErrorCodeInfo.Code.EC_InvalidObject, "Failed to insert data, the type of argument does not match the type of column at column: " + i.ToString());
                        return(false);
                    }
                }
            }
            return(true);
        }
Пример #15
0
        /// <summary>
        /// Returns the dataset descriptor of the dynamic dataset produced by the Gym.
        /// </summary>
        /// <param name="dt">Specifies the data-type to use.</param>
        /// <param name="log">Optionally, specifies the output log to use (default = <i>null</i>).</param>
        /// <returns>The dataset descriptor is returned.</returns>
        public DatasetDescriptor GetDataset(DATA_TYPE dt, Log log = null)
        {
            int nH = 1;
            int nW = 1;
            int nC = 4;

            if (dt == DATA_TYPE.DEFAULT)
            {
                dt = DATA_TYPE.VALUES;
            }

            if (dt == DATA_TYPE.BLOB)
            {
                nH = 156;
                nW = 156;
                nC = 3;
            }

            SourceDescriptor  srcTrain = new SourceDescriptor((int)GYM_DS_ID.CARTPOLE, Name + ".training", nW, nH, nC, false, false);
            SourceDescriptor  srcTest  = new SourceDescriptor((int)GYM_SRC_TEST_ID.CARTPOLE, Name + ".testing", nW, nH, nC, false, false);
            DatasetDescriptor ds       = new DatasetDescriptor((int)GYM_SRC_TRAIN_ID.CARTPOLE, Name, null, null, srcTrain, srcTest, "CartPoleGym", "CartPole Gym", null, GYM_TYPE.DYNAMIC);

            m_dt = dt;

            return(ds);
        }
Пример #16
0
        public int getPartitionKey(IScalar partitionCol)
        {
            if (partitionCol.getDataCategory() != cat)
            {
                throw new Exception("Data category incompatible.");
            }
            if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType())
            {
                DATA_TYPE old = partitionCol.getDataType();
                partitionCol = (IScalar)Utils.castDateTime(partitionCol, type);
                if (partitionCol == null)
                {
                    throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString());
                }
            }
            int index = 0;

            if (dict.ContainsKey(partitionCol))
            {
                index = (int)dict[partitionCol];
            }
            else
            {
                index = -1;
            }
            return(index);
        }
Пример #17
0
        internal static void CreateMasterStatusReport(DATA_TYPE fileType, List <DateOpenClosedStatDto> openclosed, List <PatchCountOfComplianceDto> issues, List <PatchData> patches)
        {
            string fileName = GetDataTypeFileName(fileType, "MasterReport");

            if (!Directory.Exists(m_dataDirectory))
            {
                Directory.CreateDirectory(m_dataDirectory);
            }
            ReportWriter writer = new ReportWriter(fileName);

            if (fileType == DATA_TYPE.CSV)
            {
                //WriteCSVFixedInPercent(data, writer);
                //writer.StartFile();
            }

            if (fileType == DATA_TYPE.XLS)
            {
                //WriteCSVFixedInPercent(data, writer);
                //Process.Start(Environment.CurrentDirectory.ToString() + "\\bin\\convertFPercR.cmd", fileName);
            }

            if (fileType == DATA_TYPE.HTML)
            {
                WriteHTMLMasterReport(openclosed, issues, patches, writer);
                Process.Start(fileName);
            }

            LoaderHelper.LoaderKill();
        }
Пример #18
0
        public void setCompressedMethod(int method)
        {
            DATA_TYPE type = this.getDataType();

            checkCompressedMethod(type, method);
            this.compressedMethod = method;
        }
Пример #19
0
    public static string GetDataTypeName(DATA_TYPE type)
    {
        switch (type)
        {
        case DATA_TYPE.Food:
            return("食物");

        case DataConfig.DATA_TYPE.Oil:
            return("石油");

        case DataConfig.DATA_TYPE.Metal:
            return("矿产");

        case DataConfig.DATA_TYPE.Rare:
            return("稀土");

        case DataConfig.DATA_TYPE.Cash:
            return("金币");

        case DataConfig.DATA_TYPE.Exp:
            return("经验");

        case DataConfig.DATA_TYPE.Energy:
            return("体力");

        case DataConfig.DATA_TYPE.Honor:
            return("功勋");

        case DataConfig.DATA_TYPE.Combat:
            return("战绩");
        }

        return("");
    }
Пример #20
0
 public DataTypeKey(string typeName, int indexP, bool isArrayArg, DATA_TYPE dataTypeArg)
 {
     this.typeName = typeName;
     index         = indexP;
     isArray       = isArrayArg;
     dataType      = dataTypeArg;
 }
Пример #21
0
        public static string GetDefault(this DATA_TYPE type)
        {
            switch (type)
            {
            case DATA_TYPE.MYSQL_blob:
            case DATA_TYPE.MYSQL_char:
            case DATA_TYPE.MYSQL_longblob:
            case DATA_TYPE.MYSQL_longtext:
            case DATA_TYPE.MYSQL_mediumblob:
            case DATA_TYPE.MYSQL_mediumtext:
            case DATA_TYPE.MYSQL_text:
            case DATA_TYPE.MYSQL_varchar:
                return("''");

            case DATA_TYPE.MYSQL_datetime:
            case DATA_TYPE.MYSQL_time:
            case DATA_TYPE.MYSQL_timestamp:
                return("now()");

            case DATA_TYPE.MYSQL_year:
                return(DateTime.Now.Year.ToString());

            default:
                return("0");
            }
        }
Пример #22
0
    static public DataFactory createFactory(Type classType, DATA_TYPE type)
    {
        object[]    param   = new object[] { type, classType };     //构造器参数
        DataFactory factory = UnityUtility.createInstance <DataFactory>(typeof(DataFactory), param);

        return(factory);
    }
Пример #23
0
 public void destroyData(DATA_TYPE type)
 {
     if (mDataStructList.ContainsKey(type))
     {
         mDataStructList.Remove(type);
     }
 }
Пример #24
0
        public List <int> getPartitionKeys(IVector partitionCol)
        {
            if (partitionCol.getDataCategory() != cat)
            {
                throw new Exception("Data category incompatible.");
            }
            if (cat == DATA_CATEGORY.TEMPORAL && type != partitionCol.getDataType())
            {
                DATA_TYPE old = partitionCol.getDataType();
                partitionCol = (IVector)Utils.castDateTime(partitionCol, type);
                if (partitionCol == null)
                {
                    throw new Exception("Can't convert type from " + old.ToString() + " to " + type.ToString());
                }
            }
            int        partitions = range.rows() - 1;
            int        rows       = partitionCol.rows();
            List <int> keys       = new List <int>(rows);

            for (int i = 0; i < rows; ++i)
            {
                int index = range.asof(partitionCol.get(i));
                if (index >= partitions)
                {
                    keys.Add(-1);
                }
                else
                {
                    keys.Add(index);
                }
            }
            return(keys);
        }
Пример #25
0
 // 根据数据名得到数据定义
 public string getDataNameByDataType(DATA_TYPE type)
 {
     if (mDataDefineFile.ContainsKey(type))
     {
         return(mDataDefineFile[type]);
     }
     return("");
 }
Пример #26
0
 public DataFactory getFactory(DATA_TYPE type)
 {
     if (mFactoryList.ContainsKey(type))
     {
         return(mFactoryList[type]);
     }
     return(null);
 }
Пример #27
0
 public int getDataSize(DATA_TYPE type)
 {
     if (mDataSizeMap.ContainsKey(type))
     {
         return(mDataSizeMap[type]);
     }
     return(0);
 }
Пример #28
0
 // 查询数据
 public Data queryData(DATA_TYPE type, int index)
 {
     if (mDataStructList.ContainsKey(type))
     {
         return(mDataStructList[type][index]);
     }
     return(null);
 }
Пример #29
0
 public List <Data> getAllData(DATA_TYPE type)
 {
     if (mDataStructList.ContainsKey(type))
     {
         return(mDataStructList[type]);
     }
     return(null);
 }
Пример #30
0
 // 得到数据数量
 public int getDataCount(DATA_TYPE type)
 {
     if (mDataStructList.ContainsKey(type))
     {
         return(mDataStructList[type].Count);
     }
     return(0);
 }
Пример #31
0
      public void Copy(DataBlock db)
      {
         this.m_channelsBitField = db.m_channelsBitField;
         this.m_channels = db.m_channels;
         this.m_sample = db.m_sample;
         this.m_start = db.m_start;
         this.m_stop = db.m_stop;
         this.m_min = db.m_min;
         this.m_max = db.m_max;
         this.m_sampleRate = db.m_sampleRate;
         this.m_samplesPerChannel = db.m_samplesPerChannel;
         this.m_triggerVoltage = db.m_triggerVoltage;
         this.m_triggerPos = db.m_triggerPos;
         this.m_result = db.m_result;
         this.m_dataType = db.m_dataType;
         this.m_Annotations = db.m_Annotations;
         this.m_index = db.m_index;

         Alloc();

         System.Array.Copy(db.m_Buffer, 0, m_Buffer, 0, db.m_Buffer.Length);
      }
Пример #32
0
 public IClassIdentifier GetPrimitiveClass(DATA_TYPE type)
 {
     return primitives
     .Where(el => el.DataType == type)
     .Select(c => c.Identifier).FirstOrDefault();
 }
Пример #33
0
        S101 s101; // S-101 바인딩 데이터 타입 변수

        #endregion Fields

        #region Constructors

        // 빌더 생성자(초기화) 함수
        public Builder(ENCODING_TYPE type, DATA_TYPE dataType)
        {
            this.dataType = dataType;
            this.EncodingType = type;
            iSO_8211 = new ISO_8211();
        }
Пример #34
0
 public ClassPrimitive(ClassIdentifier classIdentifier, string name, DATA_TYPE dataType)
     : base(classIdentifier, name)
 {
     DataType = dataType;
       AddConstructor(new List<IArgument>() { new Argument(classIdentifier) });
 }