Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace WindowsFormsApplication13
- {
- class Linebuffer
- {
- // Attribute und Properties
- private int[] bufData;
- public int this[int a]
- {
- get
- {
- return bufData[a];
- }
- }
- private int head;
- private bool bufFull;
- // Methoden
- public Linebuffer()
- {
- bufData = new int[12];
- head = -1;
- bufFull = false;
- }
- public Linebuffer(int size)
- {
- bufData = new int[size];
- head = -1;
- bufFull = false;
- }
- public int BufSize()
- {
- return bufData.Length;
- }
- public int BufDataLen()
- {
- int rw = 0;
- for (int a = 0; a <= head ; a++)
- {
- rw++;
- }
- return rw;
- }
- public bool BufFull()
- {
- return bufFull;
- }
- public void Add(int val)
- {
- if (head == bufData.Length - 1)
- {
- head = -1;
- bufFull = true;
- }
- head++;
- bufData[head] = val;
- }
- public void Clear()
- {
- head = -1;
- for (int a = 0; a < bufData.Length; a++)
- {
- bufData[a] = 0;
- }
- bufFull = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement