001package edu.wpi.first.wpilibj.networktables2.util; 002 003 004/** 005 * A queue designed to have things appended to it and then to be read directly from the backing array 006 * 007 * @author mwills 008 * 009 */ 010public class HalfQueue { 011 public final Object[] array; 012 private int size = 0; 013 public HalfQueue(int maxSize){ 014 array = new Object[maxSize]; 015 } 016 017 018 /** 019 * Push an element onto the stack 020 * @param element 021 */ 022 public void queue(final Object element){ 023 array[size++] = element; 024 } 025 public boolean isFull(){ 026 return size==array.length; 027 } 028 public int size(){ 029 return size; 030 } 031 032 public void clear(){ 033 size = 0; 034 } 035}