1 2 5 14 package org.jacorb.trading.impl; 15 16 import org.omg.CosTrading.*; 17 19 20 23 public class OfferIdIteratorImpl extends OfferIdIteratorPOA 24 { 25 private String [] m_offerIds; 26 private int m_start; 27 28 29 private OfferIdIteratorImpl() 30 { 31 } 32 33 34 public OfferIdIteratorImpl(String [] 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 [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); 65 return result; 66 } 67 68 69 public void destroy() 70 { 71 } 73 } 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | Popular Tags |