List of usage examples for org.apache.commons.collections.list CursorableLinkedList cursor
public CursorableLinkedList.Cursor cursor()
From source file:org.apache.cocoon.forms.formmodel.Form.java
/** * Fire the events that have been queued. * Note that event handling can fire new events. *//* w w w . j a va2s.c o m*/ private void fireEvents() { if (this.events != null) { CursorableLinkedList.Cursor cursor = this.events.cursor(); while (cursor.hasNext()) { WidgetEvent event = (WidgetEvent) cursor.next(); event.getSourceWidget().broadcastEvent(event); if (formHandler != null) formHandler.handleEvent(event); } cursor.close(); this.events.clear(); } }
From source file:org.apache.cocoon.woody.formmodel.Form.java
/** * Fire the widget events that have been queued. Note that event handling can fire new * events.// w w w . j a v a 2s .c om */ private void fireWidgetEvents() { if (this.events != null) { CursorableLinkedList.Cursor cursor = this.events.cursor(); while (cursor.hasNext()) { WidgetEvent event = (WidgetEvent) cursor.next(); event.getSourceWidget().broadcastEvent(event); if (formHandler != null) formHandler.handleEvent(event); } cursor.close(); this.events.clear(); } }
From source file:org.unbunt.ella.compiler.antlr.LazyTokenStream.java
protected int skipOffChannelTokens(CursorableLinkedList.Cursor cursor) { int i = 0;/*from w w w . j a va2 s . c o m*/ while (cursor.hasNext() || read(cursor)) { Token token = (Token) cursor.next(); int tokenChannel = token.getChannel(); if (tokenChannel == channel) { if (cursor.hasPrevious()) { cursor.previous(); } break; } i++; } return i; }
From source file:org.unbunt.ella.compiler.antlr.LazyTokenStream.java
protected int skipOffChannelTokensReverse(CursorableLinkedList.Cursor cursor) { int i = 0;// w w w .j av a 2s . c o m while (cursor.hasPrevious()) { Token token = (Token) cursor.previous(); if (token.getChannel() == channel) { if (cursor.hasNext()) { cursor.next(); } break; } i--; } return i; }
From source file:org.unbunt.ella.compiler.antlr.LazyTokenStream.java
protected boolean read(CursorableLinkedList.Cursor cursor) { return readTo(cursor, 1); }
From source file:org.unbunt.ella.compiler.antlr.LazyTokenStream.java
protected boolean readTo(CursorableLinkedList.Cursor cursor, int i) { // FIXME: works for i == 1 only - fix or check if support for i > 1 is nessessary while (i > 0) { i--;//from ww w. jav a 2 s . c o m if (cursor.hasNext()) { continue; } int bufOffs = -1; if (inputStream != null) { try { bufOffs = ((LazyInputStream) inputStream).buffer(); } catch (ClassCastException ignored) { } } Token token = tokenSource.nextToken(); try { int tokOffs = ((CommonToken) token).getStartIndex(); if (trace) { logger.trace("read token: bufOffs=" + bufOffs + " tokOffs=" + tokOffs); } } catch (ClassCastException ignored) { } int tokenType = token.getType(); if (tokenType == CharStream.EOF) { return false; } read++; Integer overrideChannel = channelOverride.get(tokenType); if (overrideChannel != null) { token.setChannel(overrideChannel); } if (discardTypes.contains(tokenType) || (discardOffChannelTokens && token.getChannel() != channel)) { continue; } token.setTokenIndex(read); tokens.add(token); } return true; }