Exemplo n.º 1
0
 public static TableRecord.Record getRecord(int BlockID, int BlockSubID)
 {
     try { // Read from Array (Double check if it should be reading from File)
         TableRecord.Record r = BlockManager.ActiveBlocks[BlockID - 1].RecordArray[BlockSubID, 1];
         return(r);
     }
     catch (Exception e) {
         Console.WriteLine("Error! unable to Retrieve Data Block" + e + "\n");
         return(null);
     }
 }
Exemplo n.º 2
0
        /**
         * Inserts a record into a block.
         * A single block can hold 5 records.
         * A new block will be programmatically created when the block becomes full.
         *
         * @param Record record - the new record to be added
         * @param int BlockFactor - the amount of records that can be stored per block
         *
         * @return void
         **/
        public static void insertIntoBlock(TableRecord.Record record, int BlockingFactor)
        {
            // Look at current Block for available location

            // if Location Unavailable seache for available Block Addresses in existing blocks
            for (int i = 0; i < ActiveBlocks.Count; i++)
            {
                if (ActiveBlocks[i].RecordArray.Length < BlockingFactor)
                {
                    ActiveBlocks[i].RecordArray[1, 1] = record; // Dummy Method
                }
            }
            BlockManager.createNewBlock();
        }