KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > trading > impl > OfferIdIteratorImpl


1
2 // Copyright (C) 1998-1999
3
// Object Oriented Concepts, Inc.
4

5 // **********************************************************************
6
//
7
// Copyright (c) 1997
8
// Mark Spruiell (mark@intellisoft.com)
9
//
10
// See the COPYING file for more information
11
//
12
// **********************************************************************
13

14 package org.jacorb.trading.impl;
15
16 import org.omg.CosTrading.*;
17 //import jtport.ORBLayer;
18

19
20 /**
21  * Implementation of CosTrading::OfferIdIterator
22  */

23 public class OfferIdIteratorImpl extends OfferIdIteratorPOA
24 {
25   private String JavaDoc[] m_offerIds;
26   private int m_start;
27
28
29   private OfferIdIteratorImpl()
30   {
31   }
32
33
34   public OfferIdIteratorImpl(String JavaDoc[] offerIds)
35   {
36     m_offerIds = offerIds;
37     m_start = 0;
38   }
39
40
41   public int max_left()
42     throws UnknownMaxLeft
43   {
44     return (m_offerIds.length - m_start);
45   }
46
47
48   public boolean next_n(int n, OfferIdSeqHolder offers)
49   {
50     boolean result;
51
52     int count;
53     if (n > (m_offerIds.length - m_start))
54       count = m_offerIds.length - m_start;
55     else
56       count = n;
57
58     offers.value = new String JavaDoc[count];
59     for (int i = 0; i < count; i++)
60       offers.value[i] = m_offerIds[m_start + i];
61
62     m_start += count;
63     result = (m_offerIds.length - m_start > 0); // any left?
64

65     return result;
66   }
67
68
69   public void destroy()
70   {
71       // GB: ORBLayer.instance().getORB().disconnect(this);
72
}
73 }
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Popular Tags