2014년 7월 27일 일요일

[오라클자바커뮤니티,자바교육강좌,자바학원,JAVA]자바큐,JAVA QUEUE,자바 배열로 만든 큐(Java Array Queue), 자바배열큐,JAVA ARRAY QUEUE

[오라클자바커뮤니티,자바교육강좌,자바학원,JAVA]자바큐,JAVA QUEUE,자바 배열로 만든 큐(Java Array Queue), 자바배열큐,JAVA ARRAY QUEUE
 
import java.io.*;
interface Queue1  {  
           public boolean isEmpty();
     public boolean isFull();
           public Object getFrontEelement();
           public Object getRearEelement();
           public void put(Object theObject);
           public Object remove();
}
class QueueManager implements Queue1 {
 final static int MAXQUEUE=100;
 private Object[] queue;
 private int front;
 private int rear;
 public QueueManager() {
  queue = new Object[MAXQUEUE];
  front = 0;
  rear = -1;
 }
 public boolean isEmpty() {
  return front > rear;
 }
 public boolean isFull() {
  return rear == MAXQUEUE-1;
 }
 public void put(Object theObject) {
  if (isFull()) {
   System.out.println("Queue가 꽉 찼습니다...");
   return;
  }
  queue[++rear] = theObject;
 }
 public Object remove() {
  if (isEmpty()) {
   System.out.println("Queue가 공백 입니다...");
   return null;
  }
  Object item = queue[front];
  front++;
  return item;
 }
 public Object getFrontEelement() {
  return queue[front];
 }
 public Object getRearEelement() {
  return queue[rear];
 }
 public void pointerPrint() {
  System.out.println("F : " + front + " , R: " + rear);
 }
}
public class QueueTest {
 public static void main(String[] args) {
  QueueManager q = new QueueManager();
  q.put(new String("aaaa"));
  q.put(new String("bbbb"));
  q.put(new String("cccc"));
  System.out.println("a,b,c 삽입후...");
  q.pointerPrint();
  q.remove();
  System.out.println("aaaa 삭제후...");
  System.out.println("front : " + q.getFrontEelement());
  System.out.println("rear  : " + q.getRearEelement());
  q.pointerPrint();
 }
}
 
 
 
 
평일주간[100%환급과정]
(8/04)C#4.0,WinForm,ADO.NET
(8/04)자바기초JDBC,Servlet/JSP까지
(8/04)Spring,MyBatis,Hibernate실무과정
(8/11)PL/SQL,ORACLE HINT,TUNING
(8/11)SQL기초에서 Schema Object까지
(8/11)안드로이드개발자과정
(8/11)채용예정교육
평일야간[개인80%환급]
(7/29)안드로이드개발자과정
(7/29)Spring3.X, MyBatis, Hibernate
(8/04)웹퍼블리싱 마스터
(8/05)JSP,jQUERY,Spring,MyBatis
(8/08)C#,Network,ADO.NET,ASP.NET
(8/11)SQL기초에서실무까지
(8/28)자바JSP,jQuery,Spring,MyBatis
주말주간[개인80%환급]
(8/02)Spring3.X, MyBatis, Hibernate
(8/02)C#,ASP.NET마스터
(8/02)웹퍼블리싱 마스터
(8/02)SQL초보에서 Schema Object까지
(8/09)SQL기초에서실무까지
(8/09)안드로이드개발자과정
(8/09)자바JSP,Ajax,jQuery,Spring,MyBatis
(8/23)JAVA,Network&WEB&Framework
주말야간[개인80%환급](18:30~22:20)
(8/02)JAVA,Network&WEB&Framework
(8/09)SQL기초에서실무까지

댓글 없음:

댓글 쓰기