Esempio n. 1
0
 void Start()
 {
     Head         = new BufferEmpty();
     restartTimer = false;
     timerGoing   = false;
     length       = 0;
 }
 public CircularBuffer()
 {
     CurrentPosition = new BufferNode()
     {
         Value = 0
     };
     CurrentPosition.Next = CurrentPosition;
 }
            public BufferNode InsertAfter(int newValue)
            {
                var newNode = new BufferNode {
                    Value = newValue, Next = Next
                };

                this.Next = newNode;
                return(newNode);
            }
Esempio n. 4
0
        public FarmDataRoot()
        {
            Guid = Guid.NewGuid();

            Block = new BlockNode();

            Buffer = new BufferNode();

            TempValueNode = new ValueNode();
        }
Esempio n. 5
0
        public FarmDataRoot(BlockNode.BLOCK_NAME block_name, BufferNode.BUFFER_NAME buffer_name)
        {
            Guid = Guid.NewGuid();

            Block = new BlockNode(block_name);

            Buffer = new BufferNode(buffer_name);

            TempValueNode = new ValueNode();
        }
Esempio n. 6
0
 public void AddCons(char val)
 {
     /*if (val == Head.Val) {
      *      return;
      * }*/
     Head    = new BufferCons(val, Head);
     length += 1;
     if (timerGoing)
     {
         restartTimer = true;
     }
     else
     {
         StartCoroutine(ClearNext());
     }
 }
Esempio n. 7
0
    public void ShowCurrentBuffer(BufferNode head)
    {
        BufferNode current = head;
        string     readout = "";

//		while(!current.IsEmpty()) {
        Debug.Log(Buffer.length);
        for (int i = 0; i < Buffer.length; i++)
        {
            if (readout != "")
            {
                readout += ", ";
            }
            readout += current.Val;
            current  = head.GetNext();
        }
        TM.text = readout;
    }
Esempio n. 8
0
 private IEnumerator ClearNext()
 {
     timerGoing = true;
     for (float i = 0; i < LIFESPAN; i += Time.deltaTime)
     {
         if (restartTimer)
         {
             restartTimer = false;
             StartCoroutine(ClearNext());
             yield break;
         }
         yield return(null);
     }
     if (!Head.IsEmpty())
     {
         Head    = Head.GetNext();
         length -= 1;
         StartCoroutine(ClearNext());
     }
     else
     {
         timerGoing = false;
     }
 }
Esempio n. 9
0
 public BufferCons(char val, BufferNode next)
 {
     Val  = val;
     Next = next;
 }
 public void StepForward()
 {
     CurrentPosition = CurrentPosition.Next;
 }
Esempio n. 11
0
 // Use this for initialization
 protected void Start()
 {
     Val  = '\0';
     Next = null;
 }
Esempio n. 12
0
 /// <summary>
 /// Adds a new Buffer to the system.
 /// </summary>
 /// <param name="node"></param>
 public void AddBuffer(BufferNode node)
 {
     this.buffers.Add(nextBuffer, node);
     nextBuffer++;
 }