{@inheritDoc}

@see org.jline.reader.Completer#complete(org.jline.reader.LineReader, org.jline.reader.ParsedLine, java.util.List)
519994
@Override
	public void complete(final LineReader reader, final ParsedLine line, final List<Candidate> candidates) {
		String buffer = line.line().substring(0, line.cursor());
		String[] parts = getLineParts(buffer);
		int len = parts.length;

		// コード補完する引数の番号を特定。
		int startArgNo = getStartArgNo(line);

		// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない
		if (!accept(startArgNo, buffer, len)) {
			return;
		}

		String key = null;

		boolean isBlank = buffer.endsWith(" ");
		if (len == startArgNo && isBlank) {
			key = null;
		} else if (len == startArgNo + 1 && !isBlank) {
			key = parts[len - 1];
		} else {
			return;
		}

		final String keyword = key;

		Stream.of(SqlKeyword.values()).filter(k -> k.match(keyword))
				.forEach(k -> candidates.add(new Candidate(k.toString().toLowerCase())));
	}
564599
public static List<String> readLines(File file) throws IOException {
        List<String> lines = new ArrayList<String>();
        InputStreamReader reader = null;
        BufferedReader bufferedReader = null;
        try {
            reader = new FileReader(file);
            bufferedReader = new BufferedReader(reader);
            String lineText = null;
            while ((lineText = bufferedReader.readLine()) != null) {
                lines.add(lineText);
            }
            return lines;
        } finally {
            if (bufferedReader != null) {
                bufferedReader.close();
            }
            if (reader != null) {
                reader.close();
            }
        }
    }
876513
def complete_run(self, text, line, b, e):
        '''  '''
        # Don't break on path separators.
        text = line.split()[-1]

        # Try to find files with a forth file ending, .fs.
        forth_files = glob.glob(text + '*.fs')

        # Failing that, just try and complete something.
        if len(forth_files) == 0:
            return [f.split(os.path.sep)[-1] for f in glob.glob(text + '*')]

        forth_files = [f.split(os.path.sep)[-1] for f in forth_files]
        return forth_files
396588
void complete()
    {
        _file=_stack[_top].getFileName()+":"+_stack[_top].getLineNumber();
        _method=_stack[_top].getClassName()+"."+_stack[_top].getMethodName();
        _depth=_stack.length-_top;
        _thread = Thread.currentThread().getName();
    }
135687
def complete_use(self, text, *_):
        
        return [t + " " for t in REGIONS if t.startswith(text)]
373372
public List<WsByteBuffer> finish() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "finish");
        }
        List<WsByteBuffer> list = new LinkedList<WsByteBuffer>();
        if (isFinished()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                Tr.exit(tc, "finish, previously finished");
            }
            return list;
        }
        WsByteBuffer buffer = null;
        this.deflater.finish();
        while (!this.deflater.finished()) {
            int num = this.deflater.deflate(this.buf, 0, this.buf.length);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Compressed amount=" + num + " read=" + this.deflater.getBytesRead() + " written=" + this.deflater.getBytesWritten());
            }
            if (0 < num) {
                buffer = makeBuffer(num);
                list.add(buffer);
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "finish, return list of size " + list.size());
        }
        return list;
    }
355569
private static void parse(final Reader r) throws IOException {
		final BufferedReader br = new BufferedReader(r);
		String line;
		final ArrayList<String> sequence = new ArrayList<String>();

		line = br.readLine();
		while (true) {
			if (line == null) {
				break;
			}
			line = line.trim();
			if (line.length() == 0 || line.charAt(0) == '#') {
				line = br.readLine();
				continue;
			}
			sequence.add(line);

			// read the following lines until a line does not begin with '>' or
			// EOF
			while (true) {
				line = br.readLine();
				if (line == null) {
					addEntry(sequence);
					sequence.clear();
					break;
				}
				line = line.trim();
				if (line.length() == 0 || line.charAt(0) == '#') {
					continue;
				}
				if (line.charAt(0) != '>') {
					addEntry(sequence);
					sequence.clear();
					break;
				}
				sequence.add(line);
			}
		}
		if (!sequence.isEmpty()) {
			addEntry(sequence);
		}
	}
202391
@SuppressWarnings("unchecked")
  protected <T> Completes<T> completes() {
    if (completes == null) {
      throw new IllegalStateException("Completes is not available for this protocol behavior.");
    }
    return (Completes<T>) completes;
  }
665866
protected void completeExtends(EObject model, ContentAssistContext context,
			ICompletionProposalAcceptor acceptor) {
		if (isSarlProposalEnabled()) {
			if (model instanceof SarlAgent) {
				completeSarlAgents(false, true, context, acceptor);
			} else if (model instanceof SarlBehavior) {
				completeSarlBehaviors(false, true, context, acceptor);
			} else if (model instanceof SarlCapacity) {
				completeSarlCapacities(false, true, context, acceptor);
			} else if (model instanceof SarlSkill) {
				completeSarlSkills(false, true, context, acceptor);
			} else if (model instanceof SarlEvent) {
				completeSarlEvents(false, true, context, acceptor);
			} else if (model instanceof SarlClass) {
				completeJavaTypes(
						context,
						createExtensionFilter(context, IJavaSearchConstants.CLASS),
						acceptor);
			} else if (model instanceof SarlInterface) {
				completeJavaTypes(
						context,
						createExtensionFilter(context, IJavaSearchConstants.INTERFACE),
						acceptor);
			}
		}
	}
519288
@Override
    public List<Queue> parse(String text) throws ParseException {
        final List<Queue> queues;
        if (StringUtils.isNotBlank(text)) {
            queues = new LinkedList<Queue>();
            String separator = "\n";
            if (text.indexOf("\r\n") > 0) {
                separator = "\r\n";
            }
            final String[] lines = text.split(separator);
            Queue queue = null;
            for (final String line : lines) {
                Matcher matcher = PATTERN_QUEUE.matcher(line);
                if (matcher.matches()) {
                    if (queue != null) {
                        queues.add(queue);
                    }
                    queue = new Queue();
                    final String name = matcher.group(1);
                    queue.setName(name);
                } else if (StringUtils.isNotBlank(line)) {
                    String[] temp = Utils.splitFirst(line, CHAR_EQUALS);
                    if (temp.length == 2) {
                        final String key = temp[0].trim().toLowerCase();
                        final String value = temp[1].trim();
                        if ("queue_type".equals(key)) {
                            queue.setQueueType(value);
                        } else if ("priority".equals(key)) {
                            try {
                                queue.setPriority(Integer.parseInt(value));
                            } catch (NumberFormatException nfe) {
                                LOGGER.log(Level.WARNING, "Failed parsing queue priority: " + nfe.getMessage(), nfe);
                                queue.setPriority(-1);
                            }
                        } else if ("total_jobs".equals(key)) {
                            try {
                                queue.setTotalJobs(Integer.parseInt(value));
                            } catch (NumberFormatException nfe) {
                                LOGGER.log(Level.WARNING, "Failed parsing queue total jobs: " + nfe.getMessage(), nfe);
                                queue.setPriority(-1);
                            }
                        } else if ("state_count".equals(key)) {
                            queue.setStateCount(value);
                        } else if ("mtime".equals(key)) {
                            queue.setMtime(value);
                        } else if ("max_user_run".equals(key)) {
                            try {
                                queue.setMaxUserRun(Integer.parseInt(value));
                            } catch (NumberFormatException nfe) {
                                LOGGER.log(Level.WARNING, "Failed parsing queue max user run: " + nfe.getMessage(),
                                        nfe);
                                queue.setPriority(-1);
                            }
                        } else if ("enabled".equals(key)) {
                            queue.setEnabled(Boolean.parseBoolean(value));
                        } else if ("started".equals(key)) {
                            queue.setStarted(Boolean.parseBoolean(value));
                        } else if (key.startsWith("resources_max.")) {
                            queue.getResourcesMax().put(key, value);
                        } else if (key.startsWith("resources_min.")) {
                            queue.getResourcesMin().put(key, value);
                        } else if (key.startsWith("resources_assigned.")) {
                            queue.getResourcesAssigned().put(key, value);
                        } else if (key.startsWith("resources_default.")) {
                            queue.getResourcesDefault().put(key, value);
                        } else {
                            LOGGER.info("Unmmaped key, value: " + key + ", " + value);
                        }
                    }
                }
            }
            if (queue != null) {
                queues.add(queue);
            }
            return queues;
        } else {
            return Collections.emptyList();
        }
    }
735028
private static List<String> readAllLines(File f) throws IOException {
        BufferedReader r = new BufferedReader(new FileReader(f));
        try {
            List<String> result = new ArrayList<String>();
            String line;
            while ((line = r.readLine()) != null) {
                result.add(line);
            }
            return result;
        }  finally {
            r.close();
        }
    }
1313047
@Action(
            semantics = SemanticsOf.SAFE
    )
    @MemberOrder(sequence = "3")
    public List<Gmap3ToDoItem> complete() {
        final List<Gmap3ToDoItem> items = completeNoUi();
        if(items.isEmpty()) {
            messageService.informUser("No to-do items have yet been completed :-(");
        }
        return items;
    }
547771
private void complete() throws IOException
    {
    if( source_ != null)
      {
      try
        {
        thread_.join();
        }
      catch( Exception e)
        {
        logger_.error( "Thread=" + thread_ + " not completed", e);
        }

      IOException failure =
        failure_ == null
        ? null
        : new IOException( "Can't write filter output", failure_);
      
      failure_      = null;
      filterInput_  = null;
      source_       = null;
      target_       = null;
      thread_       = null;

      if( failure != null)
        {
        throw failure;
        }
      }
    }
499559
@Action(
            semantics = SemanticsOf.SAFE
    )
    @ActionLayout(
            bookmarking = BookmarkPolicy.AS_ROOT
    )
    @MemberOrder(sequence = "1")
    public List<FullCalendar2WicketToDoItem> notYetComplete() {
        final List<FullCalendar2WicketToDoItem> items = notYetCompleteNoUi();
        if(items.isEmpty()) {
            container.informUser("All to-do items have been completed :-)");
        }
        return items;
    }
1278142
static void parse(final Readable readable, final ParseListener listener)
		throws IOException
	{
		if (readable == null)
		{
			throw new IllegalArgumentException("readable must not be null");
		}
		FastqParserLineProcessor lineProcessor = new FastqParserLineProcessor(listener);
		CharStreams.readLines(readable, lineProcessor);
		if (lineProcessor.getState() == State.COMPLETE)
		{
			listener.complete();
			lineProcessor.setState(State.DESCRIPTION);
		}
		if (lineProcessor.getState() != State.DESCRIPTION)
		{
			throw new IOException("truncated sequence"); // at line " + lineNumber);
		}
	}
140583
@Override
    public int complete(CommandContext ctx, String buffer, int cursor, List<String> candidates) {

        int nextCharIndex = 0;
        while (nextCharIndex < buffer.length()) {
            if (!Character.isWhitespace(buffer.charAt(nextCharIndex))) {
                break;
            }
            ++nextCharIndex;
        }

        final Collection<String> all = candidatesProvider.getAllCandidates(ctx);
        if (all.isEmpty()) {
            return -1;
        }

        String opBuffer = buffer.substring(nextCharIndex).trim();
        if (opBuffer.isEmpty()) {
            candidates.addAll(all);
        } else {
            for (String name : all) {
                if (name.startsWith(opBuffer)) {
                    candidates.add(name);
                }
            }
            Collections.sort(candidates);
        }
        return nextCharIndex;
    }
434200
@Override
    public int complete(CommandContext ctx, String buffer, int cursor, List<String> candidates) {

        final Collection<String> all = getAllCandidates(ctx);
        if (all.isEmpty()) {
            return -1;
        }

        candidates.addAll(all);
        if(buffer.isEmpty()) {
            return 0;
        }
        final String[] specified = buffer.split(",+");
        candidates.removeAll(Arrays.asList(specified));
        if(buffer.charAt(buffer.length() - 1) == ',') {
            return buffer.length();
        }
        final String chunk = specified[specified.length - 1];
        final Iterator<String> iterator = candidates.iterator();
        while(iterator.hasNext()) {
            if(!iterator.next().startsWith(chunk)) {
                iterator.remove();
            }
        }
        return buffer.length() - chunk.length();
    }