Example #1
0
 public void addItomToTable(string value, TableItemType type)
 {
     if (type == TableItemType.DATA_TABLE_ITEM)
     {
         MessageBox.Show("You cant add item to data table without value type!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (type == TableItemType.LABEL_TABLE_ITEM)
     {
         if (!LabelTable.full)
         {
             LabelTable.values[LabelTable.lastAvailableIndex] = value;
             LabelTable.lastAvailableIndex++;
             if (LabelTable.lastAvailableIndex >= LabelTable.values.Length)
             {
                 LabelTable.full = true;
             }
         }
         else
         {
             MessageBox.Show("Label table is full!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else if (type == TableItemType.INSTRUCTION_TABLE_ITEM)
     {
         MessageBox.Show("You cant add item to instruction table without value type!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (type == TableItemType.STACK_TABLE_ITEM)
     {
         MessageBox.Show("You cant add item to stack table without value type!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
 public LabelClickedEventArgs(TableItem tableItem)
 {
     if (tableItem.GetType() == typeof(TableItem_Context))
     {
         Type = TableItemType.Context;
     }
     else
     {
         Type = TableItemType.Title;
     }
 }
Example #3
0
 //tableItem - то, куда извлечём данные из хеш-таблицы
 public TableItemType TableRetrieve(long searchKey)
 {
     TableItemType tableItem = null;
     int key = this.HashIndex(searchKey);
     ChainNode p = this.table[key];
     while (p!=null && p.GetItem().GetKey() != searchKey)
     {
         p = p.GetNext();
     }
     if(p == null)
     {
         Console.WriteLine("Error, no such Item");
     }else
     {
         tableItem = p.GetItem();
     }
     return tableItem;
 } 
Example #4
0
     //public bool TableIsEmpty() { }
 
     public bool TableInsert(TableItemType _newItem)
     {
        
             ChainNode node = new ChainNode(_newItem);
             int key = this.HashIndex(_newItem.GetKey());
             if (this.table[key] != null)
             {
                 ChainNode tmp = this.table[key];
                 node.SetNextChainNode(tmp);
                 this.table[key] = node;
             }
             else
             {
                 this.table[key] = node;
             }
             this.NumberOfElements++;
             return true;
         
     }
Example #5
0
        /// <summary>
        /// Prints the table item.
        /// </summary>
        /// <param name="tableItemType">Type of the table item.</param>
        /// <param name="isHeader">if set to <c>true</c> this is the header row.</param>
        /// <returns>The formatting for the cell.</returns>
        protected virtual string PrintTableItem(TableItemType tableItemType, bool isHeader)
        {
            switch (tableItemType)
            {
            case TableItemType.RowStart:
                return(isHeader ? string.Empty : Environment.NewLine);

            case TableItemType.RowEnd:
                return("|");

            case TableItemType.CellStart:
                return("| ");

            case TableItemType.CellEnd:
                return(" ");

            default:
                return(string.Empty);
            }
        }