Skip to content

Commit

Permalink
fix javadocs of classes ConsoleEngine, JrtJavaBasePackages and Widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Mar 2, 2023
1 parent c6a476e commit 3e872d8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 39 deletions.
7 changes: 4 additions & 3 deletions console/src/main/java/org/jline/console/ConsoleEngine.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2021, the original author or authors.
* Copyright (c) 2002-2023, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -198,6 +198,7 @@ default Object execute(File script) throws Exception {
ExecutionResult postProcess(Object result);

/**
* Print object if trace is enabled
* @param object object to print
*/
void trace(Object object);
Expand Down Expand Up @@ -242,8 +243,8 @@ default Object execute(File script) throws Exception {
boolean executeWidget(Object function);

/**
*
* @return true if consoleEngine is executing script
* Checks if consoleEngine is executing script
* @return true when executing script
*/
boolean isExecuting();

Expand Down
67 changes: 34 additions & 33 deletions console/src/main/java/org/jline/widget/Widgets.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
* Copyright (c) 2002-2023, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -105,7 +105,8 @@ public void aliasWidget(String orig, String alias) {
}

/**
*
* Resolve widget name if its alias is given as method parameter.
* i.e. both method calls getWidget("yank") and getWidget(".yank") will return string ".yank"
* @param name widget name or alias
* @return widget name
*/
Expand All @@ -114,8 +115,8 @@ public String getWidget(String name) {
}

/**
*
* @param name widget name or alias
* Test if widget exists
* @param name widget name or its alias
* @return true if widget exists
*/
public boolean existsWidget(String name) {
Expand All @@ -142,127 +143,127 @@ private Widget widget(String name) {
}

/**
*
* @return The LineRearer Parser
* Get lineReader's parser
* @return The parser
*/
public Parser parser() {
return reader.getParser();
}

/**
*
* @return The LineReader Main KeyMap
* Get lineReader's Main KeyMap
* @return The KeyMap
*/
public KeyMap<Binding> getKeyMap() {
return reader.getKeyMaps().get(LineReader.MAIN);
}

/**
*
* @return The LineReader Buffer
* Get lineReader's buffer
* @return The buffer
*/
public Buffer buffer() {
return reader.getBuffer();
}

/**
*
* Replace lineReader buffer
* @param buffer buffer that will be copied to the LineReader Buffer
*/
public void replaceBuffer(Buffer buffer) {
reader.getBuffer().copyFrom(buffer);
}

/**
*
* Parse lineReader buffer and returns its arguments
* @return command line arguments
*/
public List<String> args() {
return reader.getParser().parse(buffer().toString(), 0, ParseContext.COMPLETE).words();
}

/**
*
* @return Buffer's previous character
* Access lineReader buffer and return its previous character
* @return previous character
*/
public String prevChar() {
return String.valueOf((char)reader.getBuffer().prevChar());
}

/**
*
* @return Buffer's current character
* Access lineReader's buffer and return its current character
* @return current character
*/
public String currChar() {
return String.valueOf((char)reader.getBuffer().currChar());
}

/**
*
* @return LineReader's last binding
* Get lineReader's last binding
* @return last binding
*/
public String lastBinding() {
return reader.getLastBinding();
}

/**
*
* @param string string to be written into LineReader Buffer
* Write the string parameter to the lineReader's buffer
* @param string string to be written
*/
public void putString(String string) {
reader.getBuffer().write(string);
}

/**
*
* @return Command line tail tip.
* Get lineReader's command hint
* @return Command hint.
*/
public String tailTip() {
return reader.getTailTip();
}

/**
*
* @param tailTip tail tip to be added to the command line
* Set lineReader's command hint to be added in the command line
* @param tailTip command hint
*/
public void setTailTip(String tailTip) {
reader.setTailTip(tailTip);
}

/**
*
* @param errorPattern error pattern to be set LineReader Highlighter
* Set errorPattern to the lineReader's highlighter
* @param errorPattern error pattern
*/
public void setErrorPattern(Pattern errorPattern) {
reader.getHighlighter().setErrorPattern(errorPattern);
}

/**
*
* @param errorIndex error index to be set LineReader Highlighter
* Set errorIndex to the lineReader's highlighter
* @param errorIndex error index
*/
public void setErrorIndex(int errorIndex) {
reader.getHighlighter().setErrorIndex(errorIndex);
}

/**
* Clears command line tail tip
* Clears command line command hint
*/
public void clearTailTip() {
reader.setTailTip("");
}

/**
*
* @param type type to be set to the LineReader autosuggestion
* Set lineReader's autosuggestion type
* @param type autosuggestion type
*/
public void setSuggestionType(SuggestionType type) {
reader.setAutosuggestion(type);
}

/**
*
* @param desc Text to be displayed on terminal status bar
* Add description text to the terminal status bar
* @param desc description text
*/
public void addDescription(List<AttributedString> desc) {
Status.getStatus(reader.getTerminal()).update(desc);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2021, the original author or authors.
* Copyright (c) 2002-2023, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -22,7 +22,7 @@
import static java.nio.file.FileVisitResult.CONTINUE;

/**
*
* Helper class to resolve java.base module classes
* @author <a href="mailto:matti.rintanikkola@gmail.com">Matti Rinta-Nikkola</a>
*/
public class JrtJavaBasePackages {
Expand Down Expand Up @@ -92,4 +92,4 @@ private List<Object> getClasses() {
return classes;
}
}
}
}

0 comments on commit 3e872d8

Please sign in to comment.