//QueueUsage.java

public class QueueUsage implements Usage {
    private int count;
    private int capacity;
    private int capacityIncrement;
    String [] itemList;
    
    public QueueUsage() {
        count    = 0;
        capacity = 5;
        capacityIncrement = 2;
        itemList = new String[capacity];
    }
    
    public QueueUsage(String [] list) {
        count = list.length;
        capacity = list.length;
        capacityIncrement = 5;
        itemList = list;
    }
    
    public void push (String obj) {
        if(count == capacity) {
            capacity += capacityIncrement;
            String [] tempList =new String[capacity];
            for (int i = 0; i < count; i++) {
                tempList[i] = itemList[i];
            }
            itemList = tempList;
        }
        
        itemList[count] = obj;
        count++;
    }

    public String shift() {
               
        if (count == 0) {
            return null;
        }
        else {
            String temps = itemList[0];
            int y = 0;
            for(int i = 1; i < count; i++) {
                itemList[y] = itemList[i];
                y++;
            }
            count--;
            return temps;
        }
    }
    
    public void printItems() {
        for(int i = 0; i < count; i++) {
            System.out.print(itemList[i] + ",");
        }
        System.out.println(" ");
    }

    
    public void usage() {
        System.out.println( "¥­¥å¡¼¤ò¹Ô¤¦¥¯¥é¥¹" );
    }

    public void methods() {
        System.out.println( "void push(String obj) ¥­¥å¡¼¤ËÃÍ¤òÆþ¤ì¤ë" );
        System.out.println( "String shift() ¥×¥Ã¥·¥å¤µ¤ì¤¿¤é°ì¸ÄÁ°¤Ë¤º¤é¤¹¡£ÍÆÎÌ¤ò±Û¤¨¤¿¤éÀèÆ¬¤ÎÃÍ¤òÊÖ¤¹" );
        System.out.println( "void printItems() ¥­¥å¡¼¤ÎÆâÍÆ¤òÉ½¼¨" );
    }   

    public void fields() {
        System.out.println( "private int count: ¥­¥å¡¼¤Î¥¢¥¤¥Æ¥à¿ô" );
        System.out.println( "private int capacity: ¥­¥å¡¼¤ÎÇÛÎó¤Î¿ôÎÌ" );
        System.out.println( "private int capacityIncrement: ÇÛÎó¤Î¿ôÎÌ¤òÁý¤ä¤¹" );
        System.out.println( "String [] itemList: ¥­¥å¡¼¤ÎÇÛÎó" );

    }   
}