Exemplo n.º 1
0
    public void CreateIndex(string inIndexName, IndexTypes inIndexType)
    {
        StockIndex stockIndex;

        if (IndexExists(inIndexName))
        {
            throw new StockExchangeException("Index with that name already exist!");
        }

        switch (inIndexType)
        {
        case (IndexTypes.AVERAGE):
            stockIndex = new AverageStockIndex(inIndexName);
            break;

        case (IndexTypes.WEIGHTED):
            stockIndex = new WeightedStockIndex(inIndexName);
            break;

        default:
            throw new StockExchangeException("Index Type doeesn't exist!");
        }

        this.stockIndexes.Add(inIndexName, stockIndex);
    }
Exemplo n.º 2
0
 /// <summary>
 /// 创建索引
 /// </summary>
 /// <returns></returns>
 public virtual void FromDocument(Document document)
 {
     this.Index       = document.Get(nameof(IIndexModel.Index));
     this.Description = document.Get(nameof(IIndexModel.Description));
     this.Path        = document.Get(nameof(IIndexModel.Path));
     this.IndexType   = Enum.TryParse <IndexTypes>(document.Get(nameof(IIndexModel.IndexType)), out var result) ? result : IndexTypes.Common;
 }
Exemplo n.º 3
0
 public void closeFile()
 {
     setText("");
     filename = "";
     type     = IndexTypes.Folder;
     label    = "";
 }
Exemplo n.º 4
0
 public TreeIndex(IndexTypes _type, String _label, List <TreeIndex> _content, TreeIter _iter, TreeIndex _parent, String _path, String _tree_path)
 {
     type      = _type;
     label     = _label;
     content   = _content;
     iter      = _iter;
     parent    = _parent;
     path      = _path;
     tree_path = _tree_path;
 }
Exemplo n.º 5
0
 public override string GetIndexType(IndexTypes indexTypes)
 {
     switch (indexTypes)
     {
         case IndexTypes.UniqueNonClustered:
             return "UNIQUE";
         default:
             return string.Empty;
     }
 }
Exemplo n.º 6
0
        public void addIndex(string name, IndexTypes type)
        {
            if (checkIfIndexExists(name))
            {
                throw new StockExchangeException("Index with name " + name + " already exists");
            }

            indexes.Add(
                new Index(name, type)
                );
        }
        public void CreateIndex(string inIndexName, IndexTypes inIndexType)
        {
            if (IndexExists(inIndexName))
            {
                throw new StockExchangeException("Index s tim imenom već postoji!");
            }
            if (inIndexType != IndexTypes.AVERAGE && inIndexType != IndexTypes.WEIGHTED)
            {
                throw new StockExchangeException("Nedopušteni tip indeksa!");
            }
            Index newIndex = new Index(inIndexName, inIndexType);

            listIndices.Add(inIndexName.ToLower(), newIndex);
        }
Exemplo n.º 8
0
        public TreeIndex addNode(String path, String name, IndexTypes type, String filename)
        {
            String fname = "";

            switch (type)
            {
            case IndexTypes.Page: {
                fname = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "SmallPage.png";
                break;
            }

            case IndexTypes.Module: {
                fname = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "SmallModule.png";
                break;
            }

            case IndexTypes.Function: {
                fname = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "SmallFunction.png";
                break;
            }

            case IndexTypes.Class: {
                fname = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "SmallClass.png";
                break;
            }

            case IndexTypes.Folder: {
                fname = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "SmallFolder.png";
                break;
            }
            }
            log.info($"Adding node at path {filename}");
            TreeIndex parent = getIndexAtPath(path);

            if (!active)
            {
                TreeIndex ndex = new TreeIndex(type, name, new List <TreeIndex>(), new TreeIter(), parent, filename, path + "/" + name);
                log.info($"Node path from TreeIndex: {ndex.path}");
                parent.content.Add(ndex);
                return(ndex);
            }
            Gdk.Pixbuf icon = new Gdk.Pixbuf(System.IO.File.ReadAllBytes(fname));
            icon = icon.ScaleSimple(26, 26, Gdk.InterpType.Bilinear);
            TreeIter  iter  = fileTree.AppendValues(parent.iter, icon, name);
            TreeIndex index = new TreeIndex(type, name, new List <TreeIndex>(), iter, parent, filename, path + "/" + name);

            log.info($"Node path from TreeIndex: {index.path}");
            parent.content.Add(index);
            return(index);
        }
        public virtual string GetIndexType(IndexTypes indexTypes)
        {
            string indexType;

            if (indexTypes == IndexTypes.Clustered)
            {
                indexType = "CLUSTERED";
            }
            else
            {
                indexType = indexTypes == IndexTypes.NonClustered
                    ? "NONCLUSTERED"
                    : "UNIQUE NONCLUSTERED";
            }
            return(indexType);
        }
Exemplo n.º 10
0
        public override string GetIndexType(IndexTypes indexTypes)
        {
            string indexType;

            //NOTE Sql Ce doesn't support clustered indexes
            if (indexTypes == IndexTypes.Clustered)
            {
                indexType = "NONCLUSTERED";
            }
            else
            {
                indexType = indexTypes == IndexTypes.NonClustered
                    ? "NONCLUSTERED"
                    : "UNIQUE NONCLUSTERED";
            }
            return(indexType);
        }
Exemplo n.º 11
0
        public void openFile(String _filename, String _label, IndexTypes _type)
        {
            saveFile();
            setText("");
            filename = _filename;
            type     = _type;
            label    = _label;

            switch (type)
            {
            case IndexTypes.Page:
            {
                String content = File.ReadAllText(filename);
                setText(content);
                break;
            }

            case IndexTypes.Module:
            {
                parser = new FuncParser(filename);
                setText(parser.head);
                break;
            }

            case IndexTypes.Class:
            {
                parser = new FuncParser(filename);
                setText(parser.head);
                break;
            }

            case IndexTypes.Function:
            {
                parser = new FuncParser(filename);
                setText(parser.functions[label]);
                break;
            }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 创建索引模型
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public static IIndexModel CreateIndexModel(Document document)
        {
            var         field     = document.Get(nameof(IIndexModel.IndexType));
            IndexTypes  indexType = Enum.TryParse(field, out indexType) ? indexType : IndexTypes.Common;
            IIndexModel indexModel;

            switch (indexType)
            {
            case IndexTypes.Exe:
            {
                indexModel = new EXEIndexModel();
                break;
            }

            case IndexTypes.Dll:
            {
                indexModel = new DLLIndexModel();
                break;
            }

            case IndexTypes.Image:
            {
                indexModel = new ImageIndexModel();
                break;
            }

            case IndexTypes.Common:
            default:
            {
                indexModel = new CommonIndexModel();
                break;
            }
            }

            indexModel.FromDocument(document);
            return(indexModel);
        }
 public Index(string inIndexName, IndexTypes inIndexType)
 {
     this.type            = inIndexType;
     this.name            = inIndexName;
     this.listIndexStocks = new Dictionary <string, Stock>();
 }
Exemplo n.º 14
0
 public Index(string name, IndexTypes type)
 {
     this.name   = name;
     this.type   = type;
     this.stocks = new List <Stock>();
 }
Exemplo n.º 15
0
 public bool IsIndexType(IndexTypes index)
 {
     return((IndexType & index) == index);
 }
Exemplo n.º 16
0
 public IndexAttribute(IndexTypes indexType)
 {
     IndexType = indexType;
 }
Exemplo n.º 17
0
 public void CreateIndex(string inIndexName, IndexTypes inIndexType)
 {
     currentIndexes.addIndex(inIndexName, inIndexType);
 }
Exemplo n.º 18
0
 public IndexAttribute(IndexTypes indexType) => IndexType = indexType;
Exemplo n.º 19
0
 public void CreateIndex(string inIndexName, IndexTypes inIndexType)
 {
     throw new NotImplementedException();
 }