コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    eventList = EventFactory.generateDiverseEventList();
    iterator = new EventIterator(eventList);

    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    progressBar.setMax(iterator.getSize() - 1);
    myText = (TextView) findViewById(R.id.m_description);
    myTitle = (TextView) findViewById(R.id.title);
    displayEvent(iterator.current());
  }
コード例 #2
0
ファイル: EventStackIterator.java プロジェクト: orbeon/saxon
 /**
  * Get the next event in the sequence. This will never be an EventIterator.
  *
  * @return the next event, or null when the sequence is exhausted
  * @throws org.orbeon.saxon.trans.XPathException if a dynamic evaluation error occurs
  */
 public PullEvent next() throws XPathException {
   if (eventStack.isEmpty()) {
     return null;
   }
   EventIterator iter = (EventIterator) eventStack.peek();
   PullEvent next = iter.next();
   if (next == null) {
     eventStack.pop();
     return next();
   } else if (next instanceof EventIterator) {
     eventStack.push(next);
     return next();
   } else {
     return next;
   }
 }
コード例 #3
0
ファイル: EventStackIterator.java プロジェクト: orbeon/saxon
 /**
  * Factory method to create an iterator that flattens the sequence of PullEvents received from a
  * base iterator, that is, it returns an EventIterator that will never return any nested
  * iterators.
  *
  * @param base the base iterator. Any nested EventIterator returned by the base iterator will be
  *     flattened, recursively.
  */
 public static EventIterator flatten(EventIterator base) {
   if (base.isFlatSequence()) {
     return base;
   }
   return new EventStackIterator(base);
 }
コード例 #4
0
 public void updateProgressBar() {
   if (progressBar.getMax() > (iterator.getSize() - 1)) {
     progressBar.setMax(iterator.getSize() - 1);
   }
   progressBar.setProgress(iterator.getIndexNum());
 }
コード例 #5
0
 public void displayEvent(Event event) {
   String titleString = event.getEventName();
   String displayString = event.toString();
   myText.setText(displayString.toString() + iterator.getIndexNum());
   myTitle.setText(titleString.toString());
 }
コード例 #6
0
 public void updateDisplay() {
   updateProgressBar();
   displayEvent(iterator.current());
 }
コード例 #7
0
 public void nextOnClick(View v) {
   iterator.advance();
   updateDisplay();
 }
コード例 #8
0
 public void likeOnClick(View v) {
   likedEventList.add(iterator.remove());
   updateDisplay();
 }
コード例 #9
0
 public void hateOnClick(View v) {
   iterator.delete();
   updateDisplay();
 }