protected String[] computeFileNames( FileName file ) { final FastStack stack = new FastStack(); while ( file != null ) { final String name = file.getBaseName(); stack.push( name ); file = file.getParent(); } final int size = stack.size(); final String[] result = new String[ size ]; for ( int i = 0; i < result.length; i++ ) { result[ i ] = (String) stack.pop(); } return result; }
/** * Clones the function. * <P> * Be aware, this does not create a deep copy. If you have complex strucures contained in objects, you have to * override this function. * * @return a clone of this function. * @throws CloneNotSupportedException * this should never happen. */ public final Object clone() throws CloneNotSupportedException { final DefaultOutputFunction sl = (DefaultOutputFunction) super.clone(); sl.repeatingFooterValidator = repeatingFooterValidator.clone(); sl.currentEvent = null; sl.inlineSubreports = (ArrayList<InlineSubreportMarker>) inlineSubreports.clone(); sl.outputHandlers = outputHandlers.clone(); sl.renderedCrosstabLayouts = renderedCrosstabLayouts.clone(); sl.renderedCrosstabLayouts.clear(); final int rSize = renderedCrosstabLayouts.size(); for ( int i = 0; i < rSize; i++ ) { final RenderedCrosstabLayout o = renderedCrosstabLayouts.get( i ); sl.renderedCrosstabLayouts.push( (RenderedCrosstabLayout) o.clone() ); } return sl; }
/** * Starts processing a document. * * @throws SAXException not in this implementation. */ public void startDocument() throws SAXException { this.outerScopes = new FastStack<FastStack<XmlReadHandler>>(); this.currentHandlers = new FastStack<XmlReadHandler>(); if ( rootHandler != null ) { // When dealing with the multiplexing beast, we cant define a // root handler unless we've seen the first element and all its // namespace declarations ... this.currentHandlers.push( this.rootHandler ); } }
private void findNonAuto() { while ( result != null ) { if ( result.getNodeType() != LayoutNodeTypes.TYPE_BOX_AUTOLAYOUT ) { break; } final RenderBox box = (RenderBox) result; final RenderNode firstChild = box.getFirstChild(); if ( firstChild != null ) { if ( boxes == null ) { boxes = new FastStack<RenderBox>(); } boxes.push( box ); result = firstChild; } else { result = result.getNext(); if ( result == null && boxes != null ) { while ( boxes.isEmpty() == false ) { final RenderBox parent = boxes.pop(); result = parent.getNext(); if ( result != null ) { break; } } // at this point, result is only null if the stack is empty and we reached the end of the search. } } } }
private FormulaFunctionElement getFunction( final int offset ) { FormulaFunctionElement function = null; final FastStack functionsStack = new FastStack(); final int count = rootElement.getElementCount(); boolean haveCloseParentheses = false; if ( functionsStack.isEmpty() == false ) { functionsStack.pop(); if ( functionsStack.isEmpty() ) { function = null; } else { function = (FormulaFunctionElement) functionsStack.peek(); functionsStack.push( function ); if ( functionsStack.isEmpty() == false ) { final FormulaElement lastElement = ( count >= 1 ) ? (FormulaElement) rootElement.getElement( count - 1 ) : null; if ( ( lastElement != null ) && ( lastElement.getEndOffset() >= offset ) ) { return (FormulaFunctionElement) functionsStack.get( 0 ); } else { return (FormulaFunctionElement) functionsStack.peek();
contexts.clear(); RenderBox firstBox = null; RenderBox box = null; final InlineSequenceElement element = sequenceElements[i]; if ( element instanceof EndSequenceElement ) { contexts.pop(); final long boxX2 = ( elementPositions[i] + elementDimensions[i] ); box.setCachedWidth( boxX2 - box.getCachedX() ); if ( contexts.isEmpty() ) { box = null; } else { final RenderNode tmpnode = box; box = contexts.peek(); box.addGeneratedChild( tmpnode ); box = (RenderBox) node.derive( false ); box.setCachedX( elementPositions[i] ); contexts.push( box ); if ( firstBox == null ) { firstBox = box; final int openContexts = contexts.size(); for ( int i = 0; i < openContexts; i++ ) { final RenderBox renderBox = contexts.get( i ); final long cachedWidth = getEndOfLine() - renderBox.getCachedX(); renderBox.setCachedWidth( cachedWidth );
/** */ public MajorAxisParagraphBreakState() { this.contexts = new FastStack<BoxAlignContext>( 50 ); }
private void performBreak() { if ( breakState instanceof FullLinebreaker == false ) { final FullLinebreaker fullBreaker = breakState.startComplexLayout(); paragraphNesting.pop(); paragraphNesting.push( fullBreaker ); breakState = fullBreaker; fullBreaker.performBreak(); } else { final FullLinebreaker fullBreaker = (FullLinebreaker) breakState; fullBreaker.performBreak(); } }
/** * Updates the current default namespace. * * @param nsuri the uri of the current namespace. */ protected final void pushDefaultNamespace( final String nsuri ) { namespaces.push( nsuri ); }
public void summaryRowSelection( final ReportEvent event ) { clearPendingPageStart( event ); setCurrentEvent( event ); try { if ( ( event.getType() & ReportEvent.SUMMARY_ROW_START ) == ReportEvent.SUMMARY_ROW_START ) { final GroupOutputHandler handler = new CrosstabRowOutputHandler(); outputHandlers.push( handler ); handler.summaryRowStart( this, event ); } else if ( ( event.getType() & ReportEvent.SUMMARY_ROW_END ) == ReportEvent.SUMMARY_ROW_END ) { final GroupOutputHandler handler = outputHandlers.pop(); handler.summaryRowEnd( this, event ); } else { final GroupOutputHandler handler = outputHandlers.peek(); handler.summaryRow( this, event ); } } catch ( final InvalidReportStateException fe ) { throw fe; } catch ( final Exception e ) { throw new InvalidReportStateException( "Summary Row Selection event failed", e ); } finally { clearCurrentEvent(); } }
/** * Indent the line. Called for proper indenting in various places. * * @param writer the writer which should receive the indentention. * @throws java.io.IOException if writing the stream failed. */ public void indent( final Writer writer ) throws IOException { if ( openTags.isEmpty() ) { for ( int i = 0; i < additionalIndent; i++ ) { writer.write( indentString ); } return; } final ElementLevel level = (ElementLevel) openTags.peek(); if ( getTagDescription().hasCData( level.getNamespace(), level.getTagName() ) == false ) { doEndOfLine( writer ); for ( int i = 0; i < openTags.size(); i++ ) { writer.write( indentString ); } for ( int i = 0; i < additionalIndent; i++ ) { writer.write( indentString ); } } }
private RepositoryFileTreeDto searchTreeNode( FastStack<String> fullName, RepositoryFileTreeDto treeNode ) { // no more name parts to search, found file in subtree if ( fullName.size() == 0 ) { return treeNode; } // search recursively for each name part in subtree final String fileOrDirName = fullName.peek(); final List<RepositoryFileTreeDto> children = treeNode.getChildren(); for ( final RepositoryFileTreeDto child : children ) { final String childName = child.getFile().getName(); if ( fileOrDirName.equals( childName ) ) { fullName.pop(); return searchTreeNode( fullName, child ); } } // didn't find file return null; }
/** * Receive notification of the end of a font face statement. * * @throws CSSException Any CSS exception, possibly wrapping another exception. */ public void endFontFace() throws CSSException { parentRules.pop(); }
/** * Returns the current handler. * * @return The current handler. */ protected XmlReadHandler getCurrentHandler() { return this.currentHandlers.peek(); }
public DefaultFlowController deactivateExpressions() { final Integer counter = this.expressionsStack.peek(); final int counterRaw = counter.intValue(); if ( counterRaw == 0 ) { final DefaultFlowController fc = new DefaultFlowController( this, dataRow ); fc.expressionsStack.pop(); return fc; } final MasterDataRow dataRow = this.dataRow.derive(); final ExpressionDataRow edr = dataRow.getExpressionDataRow(); final DefaultFlowController fc = new DefaultFlowController( this, dataRow ); fc.expressionsStack.pop(); edr.popExpressions( counterRaw ); dataRow.resetDataSchema(); return fc; }