List of usage examples for java.util ArrayDeque ArrayDeque
public ArrayDeque()
From source file:com.amazon.sqs.javamessaging.SQSSessionCallbackScheduler.java
SQSSessionCallbackScheduler(SQSSession session, AcknowledgeMode acknowledgeMode, Acknowledger acknowledger) { this.session = session; this.acknowledgeMode = acknowledgeMode; callbackQueue = new ArrayDeque<CallbackEntry>(); negativeAcknowledger = new NegativeAcknowledger( this.session.getParentConnection().getWrappedAmazonSQSClient(), changeMessageVisibilityIdGenerator); this.acknowledger = acknowledger; }
From source file:com.google.uzaygezen.core.MapNode.java
/** * For testing purposes only.//from ww w . j a v a 2 s.c o m * * @return the full preorder list of nodes of this subtree */ public List<MapNode<K, V>> preorder() { List<MapNode<K, V>> list = Lists.newArrayList(); Deque<MapNode<K, V>> stack = new ArrayDeque<MapNode<K, V>>(); stack.push(this); MapNode<K, V> node; while ((node = stack.poll()) != null) { list.add(node); for (MapNode<K, V> child : node.children.values()) { stack.push(child); } } return list; }
From source file:org.apache.calcite.adapter.csv.CsvStreamReader.java
/** * Creates a CsvStreamReader with supplied separator and quote char. * * @param source The file to an underlying CSV source * @param separator The delimiter to use for separating entries * @param quoteChar The character to use for quoted elements * @param escape The character to use for escaping a separator or quote * @param line The line number to skip for start reading * @param strictQuotes Sets if characters outside the quotes are ignored * @param ignoreLeadingWhiteSpace If true, parser should ignore * white space before a quote in a field *///from w ww. j av a2s. c om private CsvStreamReader(Source source, char separator, char quoteChar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) { super(new StringReader("")); // dummy call to base constructor contentQueue = new ArrayDeque<>(); TailerListener listener = new CsvContentListener(contentQueue); tailer = Tailer.create(source.file(), listener, DEFAULT_MONITOR_DELAY, false, true, 4096); this.parser = new CSVParser(separator, quoteChar, escape, strictQuotes, ignoreLeadingWhiteSpace); this.skipLines = line; try { // wait for tailer to capture data Thread.sleep(DEFAULT_MONITOR_DELAY); } catch (InterruptedException e) { throw new RuntimeException(e); } }
From source file:com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck.java
@Override public void beginTree(DetailAST rootAST) { classes = new ArrayDeque<>(); packageName = ""; }
From source file:com.espertech.esper.epl.property.PropertyEvaluatorAccumulative.java
/** * Returns the accumulative events for the input event. * @param theEvent is the input event/*from ww w .ja v a2 s . c o m*/ * @param exprEvaluatorContext expression evaluation context * @return events per stream for each row */ public ArrayDeque<EventBean[]> getAccumulative(EventBean theEvent, ExprEvaluatorContext exprEvaluatorContext) { ArrayDeque<EventBean[]> resultEvents = new ArrayDeque<EventBean[]>(); eventsPerStream[0] = theEvent; populateEvents(theEvent, 0, resultEvents, exprEvaluatorContext); if (resultEvents.isEmpty()) { return null; } return resultEvents; }
From source file:stroom.xml.converter.ds3.ConfigFilter.java
public ConfigFilter(final RootFactory factory) { parentDeque = new ArrayDeque<>(); parentDeque.push(factory); }
From source file:com.proofpoint.event.client.EventFieldMetadata.java
public void writeField(JsonGenerator jsonGenerator, Object event) throws IOException { writeField(jsonGenerator, event, new ArrayDeque<>()); }
From source file:de.skuzzle.polly.http.internal.HttpServerImpl.java
public HttpServerImpl(ServerFactory factory) { this.traffic = new TrafficInformationImpl(null); this.sessionHistory = new ArrayDeque<>(); this.handlers = new URLMap<>(); this.ipToSession = new HashMap<>(); this.idToSession = new HashMap<>(); this.pending = new HashMap<>(); this.handler = new AnswerHandlerMap(); this.factory = factory; this.sessionType = SESSION_TYPE_COOKIE; this.httpListeners = new ArrayList<>(); this.encoding = Charset.defaultCharset().name(); // default handler this.setAnswerHandler(HttpBinaryAnswer.class, new BinaryAnswerHandler()); this.setAnswerHandler(HttpTemplateAnswer.class, new TemplateAnswerHandler()); }
From source file:com.google.gwt.emultest.java.util.ArrayDequeTest.java
public void testAddFirst() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); ArrayDeque<Object> deque = new ArrayDeque<>(); deque.addFirst(o1);/*from www. jav a 2 s .c om*/ checkDequeSizeAndContent(deque, o1); deque.addFirst(o2); checkDequeSizeAndContent(deque, o2, o1); deque.addFirst(o3); checkDequeSizeAndContent(deque, o3, o2, o1); try { deque.addFirst(null); fail(); } catch (NullPointerException expected) { } }
From source file:io.cloudslang.lang.tools.build.verifier.SlangContentVerifier.java
public PreCompileResult createModelsAndValidate(String directoryPath, boolean shouldValidateDescription, boolean shouldValidateCheckstyle) { Validate.notEmpty(directoryPath, "You must specify a path"); Validate.isTrue(new File(directoryPath).isDirectory(), "Directory path argument \'" + directoryPath + "\' does not lead to a directory"); Map<String, Executable> slangModels = new HashMap<>(); Collection<File> slangFiles = slangCompilationService.listSlangFiles(new File(directoryPath), true); loggingService.logEvent(Level.INFO, "Start compiling all slang files under: " + directoryPath); loggingService.logEvent(Level.INFO, slangFiles.size() + " .sl files were found"); loggingService.logEvent(Level.INFO, ""); Queue<RuntimeException> exceptions = new ArrayDeque<>(); String errorMessagePrefixMetadata = ""; for (File slangFile : slangFiles) { Executable sourceModel = null; try {/* w w w. j a v a2s . co m*/ errorMessagePrefixMetadata = "Failed to extract metadata for file: \'" + slangFile.getAbsoluteFile() + "\'.\n"; String errorMessagePrefixCompilation = "Failed to compile file: \'" + slangFile.getAbsoluteFile() + "\'.\n"; Validate.isTrue(slangFile.isFile(), "file path \'" + slangFile.getAbsolutePath() + "\' must lead to a file"); SlangSource slangSource = SlangSource.fromFile(slangFile); ExecutableModellingResult preCompileResult = slangCompiler.preCompileSource(slangSource); sourceModel = preCompileResult.getExecutable(); exceptions.addAll(prependPrefix(preCompileResult.getErrors(), errorMessagePrefixCompilation)); MetadataModellingResult metadataResult = metadataExtractor .extractMetadataModellingResult(slangSource, shouldValidateCheckstyle); Metadata sourceMetadata = metadataResult.getMetadata(); exceptions.addAll(prependPrefix(metadataResult.getErrors(), errorMessagePrefixMetadata)); if (sourceModel != null) { int size = exceptions.size(); staticValidator.validateSlangFile(slangFile, sourceModel, sourceMetadata, shouldValidateDescription, exceptions); if (size == exceptions.size()) { slangModels.put(getUniqueName(sourceModel), sourceModel); } } } catch (Exception e) { String errorMessage = errorMessagePrefixMetadata + e.getMessage(); loggingService.logEvent(Level.ERROR, errorMessage); exceptions.add(new RuntimeException(errorMessage, e)); if (e instanceof MetadataMissingException && sourceModel != null) { slangModels.put(getUniqueName(sourceModel), sourceModel); } } } if (slangFiles.size() != slangModels.size()) { exceptions.add(new RuntimeException("Some Slang files were not pre-compiled.\nFound: " + slangFiles.size() + " executable files in path: \'" + directoryPath + "\' But managed to create slang models for only: " + slangModels.size())); } PreCompileResult preCompileResult = new PreCompileResult(); preCompileResult.addExceptions(exceptions); preCompileResult.addResults(slangModels); return preCompileResult; }