proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/gui2/menu/Menu.java
Menu
onActivated
class Menu extends MenuItem { private final List<MenuItem> subItems; /** * Creates a menu with the specified label * @param label Label to use for the menu item that will trigger this menu to pop up */ public Menu(String label) { super(label); this.subItems = new ArrayList<>(...
boolean result = true; if (subItems.isEmpty()) { return result; } final MenuPopupWindow popupMenu = new MenuPopupWindow(this); final AtomicBoolean popupCancelled = new AtomicBoolean(false); for (MenuItem menuItem : subItems) { popupMenu.addMenuIte...
215
551
766
<methods>public void <init>(java.lang.String) ,public void <init>(java.lang.String, java.lang.Runnable) ,public java.lang.String getLabel() <variables>private final non-sealed java.lang.Runnable action,private java.lang.String label
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/gui2/menu/MenuBar.java
MenuBar
previousFocus
class MenuBar extends AbstractComponent<MenuBar> implements Container { private static final int EXTRA_PADDING = 0; private final List<Menu> menus; /** * Creates a new menu bar */ public MenuBar() { this.menus = new CopyOnWriteArrayList<>(); } /** * Adds a new drop-down ...
if (menus.isEmpty()) { return null; } else if (fromThis == null) { return menus.get(menus.size() - 1); } else if (!menus.contains(fromThis) || menus.indexOf(fromThis) == 0) { return null; } else { return menus.get(m...
1,336
113
1,449
<methods>public void <init>() ,public synchronized com.googlecode.lanterna.gui2.menu.MenuBar addTo(com.googlecode.lanterna.gui2.Panel) ,public final synchronized void draw(com.googlecode.lanterna.gui2.TextGUIGraphics) ,public com.googlecode.lanterna.gui2.BasePane getBasePane() ,public com.googlecode.lanterna.TerminalPo...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/gui2/menu/MenuItem.java
DefaultMenuItemRenderer
getPreferredSize
class DefaultMenuItemRenderer extends MenuItemRenderer { @Override public TerminalPosition getCursorLocation(MenuItem component) { return null; } @Override public TerminalSize getPreferredSize(MenuItem component) {<FILL_FUNCTION_BODY>} @Override publ...
int preferredWidth = TerminalTextUtils.getColumnWidth(component.getLabel()) + 2; if (component instanceof Menu && !(component.getParent() instanceof MenuBar)) { preferredWidth += 2; } return TerminalSize.ONE.withColumns(preferredWidth);
366
70
436
<methods>public com.googlecode.lanterna.TerminalPosition getCursorLocation() ,public com.googlecode.lanterna.gui2.InputFilter getInputFilter() ,public InteractableRenderer<com.googlecode.lanterna.gui2.menu.MenuItem> getRenderer() ,public final synchronized com.googlecode.lanterna.gui2.Interactable.Result handleInput(co...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/gui2/table/DefaultTableCellRenderer.java
DefaultTableCellRenderer
getPreferredSize
class DefaultTableCellRenderer<V> implements TableCellRenderer<V> { @Override public TerminalSize getPreferredSize(Table<V> table, V cell, int columnIndex, int rowIndex) {<FILL_FUNCTION_BODY>} @Override public void drawCell(Table<V> table, V cell, int columnIndex, int rowIndex, TextGUIGraphics textGUIG...
String[] lines = getContent(cell); int maxWidth = 0; for(String line: lines) { int length = TerminalTextUtils.getColumnWidth(line); if(maxWidth < length) { maxWidth = length; } } return new TerminalSize(maxWidth, lines.length);...
1,621
84
1,705
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/gui2/table/DefaultTableHeaderRenderer.java
DefaultTableHeaderRenderer
drawHeader
class DefaultTableHeaderRenderer<V> implements TableHeaderRenderer<V> { @Override public TerminalSize getPreferredSize(Table<V> table, String label, int columnIndex) { if(label == null) { return TerminalSize.ZERO; } return new TerminalSize(TerminalTextUtils.getColumnWidth(lab...
ThemeDefinition themeDefinition = table.getThemeDefinition(); textGUIGraphics.applyThemeStyle(themeDefinition.getCustom("HEADER", themeDefinition.getNormal())); textGUIGraphics.putString(0, 0, label);
141
62
203
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/AltAndCharacterPattern.java
AltAndCharacterPattern
match
class AltAndCharacterPattern implements CharacterPattern { @Override public Matching match(List<Character> seq) {<FILL_FUNCTION_BODY>} }
int size = seq.size(); if (size > 2 || seq.get(0) != KeyDecodingProfile.ESC_CODE) { return null; // nope } if (size == 1) { return Matching.NOT_YET; // maybe later } if ( Character.isISOControl(seq.get(1)) ) { return null; // nope ...
44
143
187
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/BasicCharacterPattern.java
BasicCharacterPattern
match
class BasicCharacterPattern implements CharacterPattern { private final KeyStroke result; private final char[] pattern; /** * Creates a new BasicCharacterPattern that matches a particular sequence of characters into a {@code KeyStroke} * @param result {@code KeyStroke} that this pattern will tran...
int size = seq.size(); if(size > pattern.length) { return null; // nope } for (int i = 0; i < size; i++) { if (pattern[i] != seq.get(i)) { return null; // nope } } if (size == pattern.length) { retu...
408
133
541
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/CtrlAltAndCharacterPattern.java
CtrlAltAndCharacterPattern
match
class CtrlAltAndCharacterPattern implements CharacterPattern { @Override public Matching match(List<Character> seq) {<FILL_FUNCTION_BODY>} }
int size = seq.size(); if (size > 2 || seq.get(0) != KeyDecodingProfile.ESC_CODE) { return null; // nope } if (size == 1) { return Matching.NOT_YET; // maybe later } char ch = seq.get(1); if (ch < 32 && ch != 0x08) { // Control...
45
397
442
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/CtrlAndCharacterPattern.java
CtrlAndCharacterPattern
match
class CtrlAndCharacterPattern implements CharacterPattern { @Override public Matching match(List<Character> seq) {<FILL_FUNCTION_BODY>} }
int size = seq.size(); char ch = seq.get(0); if (size != 1) { return null; // nope } if (ch < 32) { // Control-chars: exclude lf,cr,Tab,Esc(^[), but still include ^\, ^], ^^ and ^_ char ctrlCode; switch (ch) { case '\n': case '...
43
313
356
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/InputDecoder.java
InputDecoder
getNextCharacter
class InputDecoder { private final Reader source; private final List<CharacterPattern> bytePatterns; private final List<Character> currentMatching; private boolean seenEOF; private int timeoutUnits; /** * Creates a new input decoder using a specified Reader as the source to read characters...
KeyStroke bestMatch = null; int bestLen = 0; int curLen = 0; while(true) { if ( curLen < currentMatching.size() ) { // (re-)consume characters previously read: curLen++; } else { // If we already have...
991
847
1,838
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/MouseAction.java
MouseAction
toString
class MouseAction extends KeyStroke { private final MouseActionType actionType; private final int button; private final TerminalPosition position; /** * Constructs a MouseAction based on an action type, a button and a location on the screen * @param actionType The kind of mouse event * @...
return "MouseAction{actionType=" + actionType + ", button=" + button + ", position=" + position + '}';
644
35
679
<methods>public void <init>(com.googlecode.lanterna.input.KeyType) ,public void <init>(com.googlecode.lanterna.input.KeyType, boolean, boolean) ,public void <init>(com.googlecode.lanterna.input.KeyType, boolean, boolean, boolean) ,public void <init>(java.lang.Character, boolean, boolean) ,public void <init>(java.lang.C...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/MouseCharacterPattern.java
MouseCharacterPattern
match
class MouseCharacterPattern implements CharacterPattern { private static final char[] PATTERN = { KeyDecodingProfile.ESC_CODE, '[', 'M' }; // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // some terminals, for example XTerm, issue mouse down when it // should be mouse move, after firs...
int size = seq.size(); if (size > 6) { return null; // nope } // check first 3 chars: for (int i = 0; i < 3; i++) { if ( i >= size ) { return Matching.NOT_YET; // maybe later } if ( seq.get(i) != PATTERN[i] ) { ...
170
699
869
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/NormalCharacterPattern.java
NormalCharacterPattern
match
class NormalCharacterPattern implements CharacterPattern { @Override public Matching match(List<Character> seq) {<FILL_FUNCTION_BODY>} /** * From http://stackoverflow.com/questions/220547/printable-char-in-java * @param c character to test * @return True if this is a 'normal', printable char...
if (seq.size() != 1) { return null; // nope } char ch = seq.get(0); if (isPrintableChar(ch)) { KeyStroke ks = new KeyStroke(ch, false, false); return new Matching( ks ); } else { return null; // nope }
181
96
277
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/input/ScreenInfoCharacterPattern.java
ScreenInfoCharacterPattern
tryToAdopt
class ScreenInfoCharacterPattern extends EscapeSequenceCharacterPattern { public ScreenInfoCharacterPattern() { useEscEsc = false; // stdMap and finMap don't matter here. } protected KeyStroke getKeyStrokeRaw(char first,int num1,int num2,char last,boolean bEsc) { if (first != '[' || last != ...
if(ks == null) { return null; } switch (ks.getKeyType()) { case CURSOR_LOCATION: return (ScreenInfoAction)ks; case F3: // reconstruct position from F3's modifiers. if (ks instanceof KeyStroke.RealF3) { return null; } int col = 1 + (ks.isAltDow...
225
180
405
<methods>public void <init>() ,public com.googlecode.lanterna.input.CharacterPattern.Matching match(List<java.lang.Character>) <variables>public static final int ALT,public static final int CTRL,public static final int SHIFT,protected final Map<java.lang.Character,com.googlecode.lanterna.input.KeyType> finMap,protected...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/screen/AbstractScreen.java
AbstractScreen
setCursorPosition
class AbstractScreen implements Screen { private TerminalPosition cursorPosition; private ScreenBuffer backBuffer; private ScreenBuffer frontBuffer; private final TextCharacter defaultCharacter; //How to deal with \t characters private TabBehaviour tabBehaviour; //Current size of the scree...
if(position == null) { //Skip any validation checks if we just want to hide the cursor this.cursorPosition = null; return; } if(position.getColumn() < 0) { position = position.withColumn(0); } if(position.getRow() < 0) { ...
1,805
184
1,989
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/screen/ScreenBuffer.java
ScreenBuffer
isVeryDifferent
class ScreenBuffer implements TextImage { private final BasicTextImage backend; /** * Creates a new ScreenBuffer with a given size and a TextCharacter to initially fill it with * @param size Size of the buffer * @param filler What character to set as the initial content of the buffer ...
if(!getSize().equals(other.getSize())) { throw new IllegalArgumentException("Can only call isVeryDifferent comparing two ScreenBuffers of the same size!" + " This is probably a bug in Lanterna."); } int differences = 0; for(int y = 0; y < getSize().getRow...
974
166
1,140
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/screen/ScreenTextGraphics.java
ScreenTextGraphics
setCharacter
class ScreenTextGraphics extends AbstractTextGraphics { private final Screen screen; /** * Creates a new {@code ScreenTextGraphics} targeting the specified screen * @param screen Screen we are targeting */ ScreenTextGraphics(Screen screen) { super(); this.screen = screen; ...
//Let the screen do culling screen.setCharacter(columnIndex, rowIndex, textCharacter); return this;
182
34
216
<methods>public com.googlecode.lanterna.graphics.TextGraphics clearModifiers() ,public transient com.googlecode.lanterna.graphics.TextGraphics disableModifiers(com.googlecode.lanterna.SGR[]) ,public com.googlecode.lanterna.graphics.TextGraphics drawImage(com.googlecode.lanterna.TerminalPosition, com.googlecode.lanterna...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/AbstractTerminal.java
AbstractTerminal
onResized
class AbstractTerminal implements Terminal { private final List<TerminalResizeListener> resizeListeners; private TerminalSize lastKnownSize; protected AbstractTerminal() { this.resizeListeners = new ArrayList<>(); this.lastKnownSize = null; } @Override public void addResizeLis...
if (lastKnownSize == null || !lastKnownSize.equals(newSize)) { lastKnownSize = newSize; for (TerminalResizeListener resizeListener : resizeListeners) { resizeListener.onResized(this, lastKnownSize); } }
410
75
485
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/SimpleTerminalResizeListener.java
SimpleTerminalResizeListener
isTerminalResized
class SimpleTerminalResizeListener implements TerminalResizeListener { boolean wasResized; TerminalSize lastKnownSize; /** * Creates a new SimpleTerminalResizeListener * @param initialSize Before any resize event, this listener doesn't know the size of the terminal. By supplying a * value h...
if(wasResized) { wasResized = false; return true; } else { return false; }
381
40
421
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/TerminalTextGraphics.java
TerminalTextGraphics
fillTriangle
class TerminalTextGraphics extends AbstractTextGraphics { private final Terminal terminal; private final TerminalSize terminalSize; private final Map<TerminalPosition, TextCharacter> writeHistory; private AtomicInteger manageCallStackSize; private TextCharacter lastCharacter; private Terminal...
try { enterAtomic(); super.fillTriangle(p1, p2, p3, character); return this; } finally { leaveAtomic(); }
1,412
53
1,465
<methods>public com.googlecode.lanterna.graphics.TextGraphics clearModifiers() ,public transient com.googlecode.lanterna.graphics.TextGraphics disableModifiers(com.googlecode.lanterna.SGR[]) ,public com.googlecode.lanterna.graphics.TextGraphics drawImage(com.googlecode.lanterna.TerminalPosition, com.googlecode.lanterna...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/ansi/CygwinTerminal.java
CygwinTerminal
getPseudoTerminalDevice
class CygwinTerminal extends UnixLikeTTYTerminal { private static final String STTY_LOCATION = findProgram("stty.exe"); private static final Pattern STTY_SIZE_PATTERN = Pattern.compile(".*rows ([0-9]+);.*columns ([0-9]+);.*"); private static final String JAVA_LIBRARY_PATH_PROPERTY = "java.library.path"; ...
//This will only work if you only have one terminal window open, otherwise we'll need to figure out somehow //which pty to use, which could be very tricky... return "/dev/pty0";
843
52
895
<methods><variables>private java.lang.String sttyStatusToRestore,private final non-sealed java.io.File ttyDev
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetProtocol.java
TelnetProtocol
createName2CodeMap
class TelnetProtocol { public static final byte COMMAND_SUBNEGOTIATION_END = (byte)0xf0; //SE public static final byte COMMAND_NO_OPERATION = (byte)0xf1; //NOP public static final byte COMMAND_DATA_MARK = (byte)0xf2; //DM public static final byte COMMAND_BREAK = (byte)0xf3; //BRK public ...
Map<String, Byte> result = new HashMap<>(); for(Field field: TelnetProtocol.class.getDeclaredFields()) { if(field.getType() != byte.class || (!field.getName().startsWith("COMMAND_") && !field.getName().startsWith("OPTION_"))) { continue; } try { ...
1,049
170
1,219
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetTerminal.java
TelnetClientIACFilterer
parseCommand
class TelnetClientIACFilterer extends InputStream { private final NegotiationState negotiationState; private final InputStream inputStream; private final byte[] buffer; private final byte[] workingBuffer; private int bytesInBuffer; private TelnetClientEventListener eventL...
if(position + 1 >= max) { throw new IllegalStateException("State error, we got a command signal from the remote telnet client but " + "not enough characters available in the stream"); } byte command = buffer[position]; byte value =...
1,453
465
1,918
<methods>public void clearScreen() throws java.io.IOException,public void close() throws java.io.IOException,public void deiconify() throws java.io.IOException,public void disableSGR(com.googlecode.lanterna.SGR) throws java.io.IOException,public void enableSGR(com.googlecode.lanterna.SGR) throws java.io.IOException,pub...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetTerminalServer.java
TelnetTerminalServer
acceptConnection
class TelnetTerminalServer { private final Charset charset; private final ServerSocket serverSocket; /** * Creates a new TelnetTerminalServer on a specific port * @param port Port to listen for incoming telnet connections * @throws IOException If there was an underlying I/O exception */...
Socket clientSocket = serverSocket.accept(); clientSocket.setTcpNoDelay(true); return new TelnetTerminal(clientSocket, charset);
731
42
773
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/ansi/UnixLikeTTYTerminal.java
UnixLikeTTYTerminal
keyStrokeSignalsEnabled
class UnixLikeTTYTerminal extends UnixLikeTerminal { private final File ttyDev; private String sttyStatusToRestore; /** * Creates a UnixTerminal using a specified input stream, output stream and character set, with a custom size * querier instead of using the default one. This way you can overri...
if(enabled) { runSTTYCommand("intr", "^C"); } else { runSTTYCommand("intr", "undef"); }
1,372
48
1,420
<methods>public void close() throws java.io.IOException,public com.googlecode.lanterna.input.KeyStroke pollInput() throws java.io.IOException,public com.googlecode.lanterna.input.KeyStroke readInput() throws java.io.IOException<variables>private boolean acquired,private final non-sealed boolean catchSpecialCharacters,p...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/ansi/UnixLikeTerminal.java
UnixLikeTerminal
exitPrivateModeAndRestoreState
class UnixLikeTerminal extends ANSITerminal { /** * This enum lets you control how Lanterna will handle a ctrl+c keystroke from the user. */ public enum CtrlCBehaviour { /** * Pressing ctrl+c doesn't kill the application, it will be added to the input queue as any other key stroke ...
if(!acquired) { return; } try { if (isInPrivateMode()) { exitPrivateMode(); } } catch(IOException | IllegalStateException ignored) {} try { restoreTerminalSettingsAndKeyStrokeSignals(); } ca...
1,924
85
2,009
<methods>public void clearScreen() throws java.io.IOException,public void close() throws java.io.IOException,public void deiconify() throws java.io.IOException,public void disableSGR(com.googlecode.lanterna.SGR) throws java.io.IOException,public void enableSGR(com.googlecode.lanterna.SGR) throws java.io.IOException,pub...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/swing/AWTTerminalImplementation.java
AWTTerminalImplementation
readInput
class AWTTerminalImplementation extends GraphicalTerminalImplementation { private final Component component; private final AWTTerminalFontConfiguration fontConfiguration; /** * Creates a new {@code AWTTerminalImplementation} * @param component Component that is the AWT terminal surface * @pa...
if(EventQueue.isDispatchThread()) { throw new UnsupportedOperationException("Cannot call SwingTerminal.readInput() on the AWT thread"); } return super.readInput();
813
53
866
<methods>public void addResizeListener(com.googlecode.lanterna.terminal.TerminalResizeListener) ,public void bell() ,public synchronized void clearScreen() ,public void close() ,public void disableSGR(com.googlecode.lanterna.SGR) ,public void enableSGR(com.googlecode.lanterna.SGR) ,public byte[] enquireTerminal(int, ja...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/swing/ScrollingAWTTerminal.java
ScrollController
updateModel
class ScrollController implements TerminalScrollController { private int scrollValue; @Override public void updateModel(final int totalSize, final int screenHeight) {<FILL_FUNCTION_BODY>} @Override public int getScrollingOffset() { return scrollValue; } ...
if(!EventQueue.isDispatchThread()) { EventQueue.invokeLater(() -> updateModel(totalSize, screenHeight)); return; } try { scrollModelUpdateBySystem = true; int value = scrollBar.getValue(); int maximum = ...
79
412
491
<methods>public void <init>() ,public java.awt.Component add(java.awt.Component) ,public java.awt.Component add(java.lang.String, java.awt.Component) ,public java.awt.Component add(java.awt.Component, int) ,public void add(java.awt.Component, java.lang.Object) ,public void add(java.awt.Component, java.lang.Object, int)...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/swing/ScrollingSwingTerminal.java
ScrollController
updateModel
class ScrollController implements TerminalScrollController { private int scrollValue; @Override public void updateModel(final int totalSize, final int screenHeight) {<FILL_FUNCTION_BODY>} @Override public int getScrollingOffset() { return scrollValue; } ...
if(!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(() -> updateModel(totalSize, screenHeight)); return; } try { scrollModelUpdateBySystem = true; int value = scrollBar.getValue(); i...
79
417
496
<methods>public void <init>() ,public void addAncestorListener(javax.swing.event.AncestorListener) ,public void addNotify() ,public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener) ,public void computeVisibleRect(java.awt.Rectangle) ,public boolean contains(int, int) ,public javax.swing.JT...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/swing/SwingTerminalImplementation.java
SwingTerminalImplementation
readInput
class SwingTerminalImplementation extends GraphicalTerminalImplementation { private final JComponent component; private final SwingTerminalFontConfiguration fontConfiguration; /** * Creates a new {@code SwingTerminalImplementation} * @param component JComponent that is the Swing terminal surface...
if(SwingUtilities.isEventDispatchThread()) { throw new UnsupportedOperationException("Cannot call SwingTerminal.readInput() on the AWT thread"); } return super.readInput();
895
56
951
<methods>public void addResizeListener(com.googlecode.lanterna.terminal.TerminalResizeListener) ,public void bell() ,public synchronized void clearScreen() ,public void close() ,public void disableSGR(com.googlecode.lanterna.SGR) ,public void enableSGR(com.googlecode.lanterna.SGR) ,public byte[] enquireTerminal(int, ja...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/swing/TerminalEmulatorColorConfiguration.java
TerminalEmulatorColorConfiguration
toAWTColor
class TerminalEmulatorColorConfiguration { /** * This is the default settings that is used when you create a new SwingTerminal without specifying any color * configuration. It will use classic VGA colors for the ANSI palette and bright colors on bold text. * @return A terminal emulator color configu...
if(color instanceof TextColor.ANSI) { return colorPalette.get((TextColor.ANSI)color, isForeground, inBoldContext && useBrightColorsOnBold); } return color.toColor();
550
62
612
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/swing/TerminalInputMethodRequests.java
TerminalInputMethodRequests
getTextLocation
class TerminalInputMethodRequests implements InputMethodRequests { private Component owner; private GraphicalTerminalImplementation terminalImplementation; public TerminalInputMethodRequests(Component owner, GraphicalTerminalImplementation terminalImplementation) { this.owner = owner; ...
Point location = owner.getLocationOnScreen(); TerminalPosition cursorPosition = terminalImplementation.getCursorPosition(); int offsetX = cursorPosition.getColumn() * terminalImplementation.getFontWidth(); int offsetY = cursorPosition.getRow() * terminalImplementation.getFontHeight() +...
310
111
421
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/virtual/TextBuffer.java
TextBuffer
setCharacter
class TextBuffer { private static final TextCharacter DOUBLE_WIDTH_CHAR_PADDING = new TextCharacter(' '); private final LinkedList<List<TextCharacter>> lines; TextBuffer() { this.lines = new LinkedList<>(); newLine(); } synchronized void newLine() { lines.add(new ArrayList...
if(lineNumber < 0 || columnIndex < 0) { throw new IllegalArgumentException("Illegal argument to TextBuffer.setCharacter(..), lineNumber = " + lineNumber + ", columnIndex = " + columnIndex); } if(textCharacter == null) { textCharacter = TextCharacter.D...
590
404
994
<no_super_class>
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/virtual/VirtualTerminalTextGraphics.java
VirtualTerminalTextGraphics
setCharacter
class VirtualTerminalTextGraphics extends AbstractTextGraphics { private final DefaultVirtualTerminal virtualTerminal; VirtualTerminalTextGraphics(DefaultVirtualTerminal virtualTerminal) { this.virtualTerminal = virtualTerminal; } @Override public TextGraphics setCharacter(int columnIndex,...
TerminalSize size = getSize(); if(columnIndex < 0 || columnIndex >= size.getColumns() || rowIndex < 0 || rowIndex >= size.getRows()) { return this; } synchronized(virtualTerminal) { virtualTerminal.setCursorPosition(new TerminalPosition(columnInde...
198
104
302
<methods>public com.googlecode.lanterna.graphics.TextGraphics clearModifiers() ,public transient com.googlecode.lanterna.graphics.TextGraphics disableModifiers(com.googlecode.lanterna.SGR[]) ,public com.googlecode.lanterna.graphics.TextGraphics drawImage(com.googlecode.lanterna.TerminalPosition, com.googlecode.lanterna...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/win32/WindowsConsoleInputStream.java
WindowsConsoleInputStream
available
class WindowsConsoleInputStream extends InputStream { private final HANDLE hConsoleInput; private final Charset encoderCharset; private ByteBuffer buffer = ByteBuffer.allocate(0); public WindowsConsoleInputStream(Charset encoderCharset) { this(Wincon.INSTANCE.GetStdHandle(Wincon.STD_INPUT_HANDLE), encoderCharse...
if (buffer.hasRemaining()) { return buffer.remaining(); } buffer = readKeyEvents(false); return buffer.remaining();
1,196
45
1,241
<methods>public void <init>() ,public int available() throws java.io.IOException,public void close() throws java.io.IOException,public synchronized void mark(int) ,public boolean markSupported() ,public static java.io.InputStream nullInputStream() ,public abstract int read() throws java.io.IOException,public int read(b...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/win32/WindowsConsoleOutputStream.java
WindowsConsoleOutputStream
flush
class WindowsConsoleOutputStream extends OutputStream { private final HANDLE hConsoleOutput; private final Charset decoderCharset; private final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); public WindowsConsoleOutputStream(Charset decoder) { this(Wincon.INSTANCE.GetStdHandle(Wincon.STD_OUTPUT_HA...
String characters = buffer.toString(decoderCharset.name()); buffer.reset(); IntByReference lpNumberOfCharsWritten = new IntByReference(); while (!characters.isEmpty()) { if (!Wincon.INSTANCE.WriteConsole(hConsoleOutput, characters, characters.length(), lpNumberOfCharsWritten, null)) { throw new EOFExce...
273
129
402
<methods>public void <init>() ,public void close() throws java.io.IOException,public void flush() throws java.io.IOException,public static java.io.OutputStream nullOutputStream() ,public abstract void write(int) throws java.io.IOException,public void write(byte[]) throws java.io.IOException,public void write(byte[], in...
mabe02_lanterna
lanterna/src/main/java/com/googlecode/lanterna/terminal/win32/WindowsTerminal.java
WindowsTerminal
canonicalMode
class WindowsTerminal extends UnixLikeTerminal { private static final Charset CONSOLE_CHARSET = StandardCharsets.UTF_8; private static final WindowsConsoleInputStream CONSOLE_INPUT = new WindowsConsoleInputStream(CONSOLE_CHARSET); private static final WindowsConsoleOutputStream CONSOLE_OUTPUT = new WindowsConsoleOu...
int mode = getConsoleInputMode(); if (enabled) { mode |= Wincon.ENABLE_LINE_INPUT; } else { mode &= ~Wincon.ENABLE_LINE_INPUT; } Wincon.INSTANCE.SetConsoleMode(CONSOLE_INPUT.getHandle(), mode);
1,402
85
1,487
<methods>public void close() throws java.io.IOException,public com.googlecode.lanterna.input.KeyStroke pollInput() throws java.io.IOException,public com.googlecode.lanterna.input.KeyStroke readInput() throws java.io.IOException<variables>private boolean acquired,private final non-sealed boolean catchSpecialCharacters,p...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/AclSetuserArgs.java
AddCommand
build
class AddCommand implements Argument { private final CommandSubcommandPair command; AddCommand(CommandSubcommandPair command) { this.command = command; } @Override public <K, V> void build(CommandArgs<K, V> args) {<FILL_FUNCTION_BODY>} }
if (command.getSubCommand() == null) { args.add("+" + command.getCommand().name()); } else { args.add("+" + command.getCommand().name() + "|" + command.getSubCommand().name()); }
85
70
155
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ChannelGroupListener.java
ChannelGroupListener
getRedisUri
class ChannelGroupListener extends ChannelInboundHandlerAdapter { private final ChannelGroup channels; private final EventBus eventBus; public ChannelGroupListener(ChannelGroup channels, EventBus eventBus) { this.channels = channels; this.eventBus = eventBus; } @Override publ...
String redisUri = null; if (channel.hasAttr(ConnectionBuilder.REDIS_URI)) { redisUri = channel.attr(ConnectionBuilder.REDIS_URI).get(); } return redisUri;
359
62
421
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ClientListArgs.java
Builder
type
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link ClientListArgs} setting {@literal client-id}. * * @param id client ids. * @return new {@link ClientListArgs} with {@literal client-id} set....
LettuceAssert.notNull(type, "Type must not be null"); this.type = type; return this;
764
37
801
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/CommandListenerWriter.java
CommandListenerWriter
write
class CommandListenerWriter implements RedisChannelWriter { private final RedisChannelWriter delegate; private final CommandListener listener; private final Clock clock = Clock.systemDefaultZone(); public CommandListenerWriter(RedisChannelWriter delegate, List<CommandListener> listeners) { t...
List<RedisCommandListenerCommand<K, V, ?>> listenedCommands = new ArrayList<>(); long now = clock.millis(); for (RedisCommand<K, V, ?> redisCommand : redisCommands) { CommandStartedEvent startedEvent = new CommandStartedEvent((RedisCommand<Object, Object, Object>) redisCommand, ...
1,303
178
1,481
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ConcurrentLruCache.java
ConcurrentLruCache
get
class ConcurrentLruCache<K, V> { private final int sizeLimit; private final Function<K, V> generator; private final ConcurrentHashMap<K, V> cache = new ConcurrentHashMap<>(); private final ConcurrentLinkedDeque<K> queue = new ConcurrentLinkedDeque<>(); private final ReadWriteLock lock = new Ree...
if (this.sizeLimit == 0) { return this.generator.apply(key); } V cached = this.cache.get(key); if (cached != null) { if (this.size < this.sizeLimit) { return cached; } this.lock.readLock().lock(); try { ...
789
384
1,173
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ConnectionEventTrigger.java
ConnectionEventTrigger
local
class ConnectionEventTrigger extends ChannelInboundHandlerAdapter { private final ConnectionEvents connectionEvents; private final RedisChannelHandler<?, ?> connection; private final EventBus eventBus; ConnectionEventTrigger(ConnectionEvents connectionEvents, RedisChannelHandler<?, ?> connection, Ev...
Channel channel = ctx.channel(); if (channel != null && channel.localAddress() != null) { return channel.localAddress(); } return LocalAddress.ANY;
617
51
668
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ConnectionEvents.java
ConnectionEvents
fireEventRedisConnected
class ConnectionEvents { private final Set<RedisConnectionStateListener> listeners = ConcurrentHashMap.newKeySet(); void fireEventRedisConnected(RedisChannelHandler<?, ?> connection, SocketAddress socketAddress) {<FILL_FUNCTION_BODY>} void fireEventRedisDisconnected(RedisChannelHandler<?, ?> connection) ...
for (RedisConnectionStateListener listener : listeners) { listener.onRedisConnected(connection, socketAddress); }
715
35
750
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ConnectionState.java
ConnectionState
setUserNamePassword
class ConnectionState { private volatile HandshakeResponse handshakeResponse; private volatile RedisCredentialsProvider credentialsProvider; private volatile int db; private volatile boolean readOnly; private volatile ConnectionMetadata connectionMetadata = new ConnectionMetadata(); /** ...
if (args.isEmpty()) { return; } if (args.size() > 1) { this.credentialsProvider = new StaticCredentialsProvider(new String(args.get(0)), args.get(1)); } else { this.credentialsProvider = new StaticCredentialsProvider(null, args.get(0)); } ...
1,179
94
1,273
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/Consumer.java
Consumer
from
class Consumer<K> { final K group; final K name; private Consumer(K group, K name) { this.group = group; this.name = name; } /** * Create a new consumer. * * @param group name of the consumer group, must not be {@code null} or empty. * @param name name of the...
LettuceAssert.notNull(group, "Group must not be null"); LettuceAssert.notNull(name, "Name must not be null"); return new Consumer<>(group, name);
382
55
437
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/CopyArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link CopyArgs} and sets {@literal DB}. * * @return new {@link CopyArgs} with {@literal DB} set. */ public static CopyArgs destinationDb(long destinationDb) { return new CopyArgs().destinationDb(desti...
if (destinationDb != null) { args.add(CommandKeyword.DB).add(destinationDb); } if (replace) { args.add(CommandKeyword.REPLACE); }
386
64
450
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ExpireArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link ExpireArgs} and sets {@literal NX}. * * @return new {@link ExpireArgs} with {@literal NX} set. */ public static ExpireArgs nx() { ...
if (xx) { args.add(CommandKeyword.XX); } else if (nx) { args.add(CommandKeyword.NX); } if (lt) { args.add("LT"); } else if (gt) { args.add("GT"); }
614
85
699
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/FutureSyncInvocationHandler.java
FutureSyncInvocationHandler
handleInvocation
class FutureSyncInvocationHandler extends AbstractInvocationHandler { private final StatefulConnection<?, ?> connection; private final TimeoutProvider timeoutProvider; private final Object asyncApi; private final MethodTranslator translator; FutureSyncInvocationHandler(StatefulConnection<?, ?> ...
try { Method targetMethod = this.translator.get(method); Object result = targetMethod.invoke(asyncApi, args); if (result instanceof RedisFuture<?>) { RedisFuture<?> command = (RedisFuture<?>) result; if (!isTxControlMethod(method.getName(...
507
180
687
<methods>public non-sealed void <init>() ,public boolean equals(java.lang.Object) ,public int hashCode() ,public final java.lang.Object invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) throws java.lang.Throwable,public java.lang.String toString() <variables>private static final java.lang.Object[] ...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoAddArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link GeoAddArgs} and enabling {@literal NX}. * * @return new {@link GeoAddArgs} with {@literal NX} enabled. * @see GeoAddArgs#nx() */ ...
if (nx) { args.add(NX); } if (xx) { args.add(XX); } if (ch) { args.add(CH); }
526
62
588
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link GeoArgs} with {@literal WITHDIST} enabled. * * @return new {@link GeoArgs} with {@literal WITHDIST} enabled. * @see GeoArgs#withDistance() ...
if (withdistance) { args.add("WITHDIST"); } if (withhash) { args.add("WITHHASH"); } if (withcoordinates) { args.add("WITHCOORD"); } if (sort != null && sort != Sort.none) { args.add(sort.name()); } ...
1,484
151
1,635
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoCoordinates.java
GeoCoordinates
equals
class GeoCoordinates { private final Number x; private final Number y; /** * Creates new {@link GeoCoordinates}. * * @param x the longitude, must not be {@code null}. * @param y the latitude, must not be {@code null}. */ public GeoCoordinates(Number x, Number y) { Le...
if (this == o) return true; if (!(o instanceof GeoCoordinates)) return false; GeoCoordinates geoCoords = (GeoCoordinates) o; if (x != null ? !x.equals(geoCoords.x) : geoCoords.x != null) return false; return !(y != null ? !y.equals(geoCoords...
449
120
569
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoRadiusStoreArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link GeoRadiusStoreArgs} with {@literal STORE} enabled. * * @param key must not be {@code null}. * @return new {@link GeoRadiusStoreArgs} with {...
if (sort != null && sort != Sort.none) { args.add(sort.name()); } if (count != null) { args.add(CommandKeyword.COUNT).add(count); } if (storeKey != null) { args.add("STORE").addKey((K) storeKey); } if (storeDistKey != null)...
1,106
133
1,239
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoSearch.java
GeoSearch
fromMember
class GeoSearch { // TODO: Should be V /** * Create a {@link GeoRef} from a Geo set {@code member}. * * @param member the Geo set member to use as search reference starting point. * @return the {@link GeoRef}. */ public static <K> GeoRef<K> fromMember(K member) {<FILL_FUNCTION_BODY...
LettuceAssert.notNull(member, "Reference member must not be null"); return new FromMember<>(member);
1,034
33
1,067
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoValue.java
GeoValue
getLatitude
class GeoValue<V> extends Value<V> { private final GeoCoordinates coordinates; /** * Serializable constructor. */ protected GeoValue() { super(null); this.coordinates = null; } private GeoValue(GeoCoordinates coordinates, V value) { super(value); this.coo...
if (coordinates == null) { throw new NoSuchElementException(); } return coordinates.getY().doubleValue();
1,556
38
1,594
<methods>public static Value<V> empty() ,public boolean equals(java.lang.Object) ,public static Value<V> from(Optional<T>) ,public static Value<V> fromNullable(T) ,public V getValue() ,public V getValueOrElse(V) ,public V getValueOrElseGet(Supplier<V>) ,public V getValueOrElseThrow(Supplier<? extends X>) throws X,publi...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GeoWithin.java
GeoWithin
equals
class GeoWithin<V> { private final V member; private final Double distance; private final Long geohash; private final GeoCoordinates coordinates; /** * Creates a new {@link GeoWithin}. * * @param member the member. * @param distance the distance, may be {@code null}. * ...
if (this == o) return true; if (!(o instanceof GeoWithin)) return false; GeoWithin<?> geoWithin = (GeoWithin<?>) o; if (member != null ? !member.equals(geoWithin.member) : geoWithin.member != null) return false; if (distance != null ? !dista...
670
210
880
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/GetExArgs.java
Builder
exAt
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link GetExArgs} and enable {@literal EX}. * * @param timeout expire time in seconds. * @return new {@link GetExArgs} with {@literal EX} enabled....
LettuceAssert.notNull(timestamp, "Timestamp must not be null"); return exAt(timestamp.getTime() / 1000);
1,653
42
1,695
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/KeyValue.java
KeyValue
from
class KeyValue<K, V> extends Value<V> { private final K key; /** * Serializable constructor. */ protected KeyValue() { super(null); this.key = null; } private KeyValue(K key, V value) { super(value); LettuceAssert.notNull(key, "Key must not be null"); ...
LettuceAssert.notNull(optional, "Optional must not be null"); if (optional.isPresent()) { return new KeyValue<K, V>(key, optional.get()); } return empty(key);
1,153
63
1,216
<methods>public static Value<V> empty() ,public boolean equals(java.lang.Object) ,public static Value<V> from(Optional<T>) ,public static Value<V> fromNullable(T) ,public V getValue() ,public V getValueOrElse(V) ,public V getValueOrElseGet(Supplier<V>) ,public V getValueOrElseThrow(Supplier<? extends X>) throws X,publi...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/KillArgs.java
Builder
laddr
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link KillArgs} and enabling {@literal SKIPME YES}. * * @return new {@link KillArgs} with {@literal SKIPME YES} enabled. * @see KillArgs#skipme()...
LettuceAssert.notNull(laddr, "Local client address must not be null"); this.laddr = laddr; return this;
1,336
42
1,378
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/LMPopArgs.java
Builder
count
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link LMPopArgs} setting with {@code LEFT} direction. * * @return new {@link LMPopArgs} with args set. */ public static LMPopArgs left() ...
LettuceAssert.isTrue(count > 0, "Count must be greater 0"); this.count = count; return this;
260
40
300
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/LPosArgs.java
Builder
maxlen
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new empty {@link LPosArgs}. * * @return new {@link LPosArgs}. * @see LPosArgs#maxlen(long) */ public static LPosArgs empty() { ...
LettuceAssert.isTrue(maxlen > 0, "Maxlen must be greater 0"); this.maxlen = maxlen; return this;
362
44
406
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/Limit.java
Limit
toString
class Limit { private static final Limit UNLIMITED = new Limit(null, null); private final Long offset; private final Long count; protected Limit(Long offset, Long count) { this.offset = offset; this.count = count; } /** * * @return an unlimited limit. */ p...
StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); if (isLimited()) { return sb.append(" [offset=").append(getOffset()).append(", count=").append(getCount()).append("]").toString(); } return sb.append(" [unlimited]").toString();
493
88
581
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/Operators.java
Operators
onOperatorError
class Operators { private static final InternalLogger LOG = InternalLoggerFactory.getInstance(Operators.class); /** * A key that can be used to store a sequence-specific {@link Hooks#onOperatorError(BiFunction)} hook in a {@link Context}, * as a {@link BiFunction BiFunction&lt;Throwable, Object, Thr...
Exceptions.throwIfFatal(error); if (subscription != null) { subscription.cancel(); } Throwable t = Exceptions.unwrap(error); BiFunction<? super Throwable, Object, ? extends Throwable> hook = context.getOrDefault(KEY_ON_OPERATOR_ERROR, null); if (hook == nul...
1,662
235
1,897
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/Range.java
Boundary
equals
class Boundary<T> { private static final Boundary<?> UNBOUNDED = new Boundary<>(null, true); private final T value; private final boolean including; private Boundary(T value, boolean including) { this.value = value; this.including = including; } ...
if (this == o) return true; if (!(o instanceof Boundary)) return false; Boundary<?> boundary = (Boundary<?>) o; return including == boundary.including && Objects.equals(value, boundary.value);
829
71
900
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ReadFromImpl.java
OrderedPredicateReadFromAdapter
select
class OrderedPredicateReadFromAdapter extends ReadFrom { private final Predicate<RedisNodeDescription> predicates[]; @SafeVarargs OrderedPredicateReadFromAdapter(Predicate<RedisNodeDescription>... predicates) { this.predicates = predicates; } @Override publ...
List<RedisNodeDescription> result = new ArrayList<>(nodes.getNodes().size()); for (Predicate<RedisNodeDescription> predicate : predicates) { for (RedisNodeDescription node : nodes) { if (predicate.test(node)) { result.add(node); ...
137
95
232
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/RedisConnectionException.java
RedisConnectionException
create
class RedisConnectionException extends RedisException { /** * Create a {@code RedisConnectionException} with the specified detail message. * * @param msg the detail message. */ public RedisConnectionException(String msg) { super(msg); } /** * Create a {@code RedisConne...
if (remoteAddress == null) { if (cause instanceof RedisConnectionException) { return new RedisConnectionException(cause.getMessage(), cause.getCause()); } return new RedisConnectionException(null, cause); } return new RedisConnectionExcept...
608
93
701
<methods>public void <init>(java.lang.String) ,public void <init>(java.lang.String, java.lang.Throwable) ,public void <init>(java.lang.Throwable) <variables>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/RedisHandshake.java
RedisVersion
equals
class RedisVersion { private static final Pattern DECIMALS = Pattern.compile("(\\d+)"); private final static RedisVersion UNKNOWN = new RedisVersion("0.0.0"); private final static RedisVersion UNSTABLE = new RedisVersion("255.255.255"); private final int major; private final...
if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RedisVersion that = (RedisVersion) o; return major == that.major && minor == that.minor && bugfix == that.bugfix; ...
743
85
828
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/RedisPublisher.java
SubscriptionCommand
doOnComplete
class SubscriptionCommand<K, V, T> extends CommandWrapper<K, V, T> implements DemandAware.Sink { private final boolean dissolve; private final RedisSubscription<T> subscription; private volatile DemandAware.Source source; public SubscriptionCommand(RedisCommand<K, V, T> command, Redi...
if (getOutput() != null) { Object result = getOutput().get(); if (getOutput().hasError()) { onError(ExceptionFactory.createExecutionException(getOutput().getError())); return; } if (!(getOutput() ins...
343
191
534
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/RestoreArgs.java
Builder
ttl
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link RestoreArgs} and set the TTL. * * @return new {@link RestoreArgs} with min idle time set. * @see RestoreArgs#ttl(long) */ ...
LettuceAssert.notNull(ttl, "Time to live must not be null"); return ttl(ttl.toMillis());
399
40
439
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ScanArgs.java
Builder
match
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link ScanArgs} with {@literal LIMIT} set. * * @param count number of elements to scan * @return new {@link ScanArgs} with {@literal LIMIT} set. ...
LettuceAssert.notNull(match, "Match must not be null"); LettuceAssert.notNull(charset, "Charset must not be null"); return match(match.getBytes(charset));
545
58
603
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ScoredValue.java
ScoredValue
map
class ScoredValue<V> extends Value<V> { private static final ScoredValue<Object> EMPTY = new ScoredValue<>(0, null); private final double score; /** * Serializable constructor. */ protected ScoredValue() { super(null); this.score = 0; } private ScoredValue(double sc...
LettuceAssert.notNull(mapper, "Mapper function must not be null"); if (hasValue()) { return new ScoredValue<>(score, mapper.apply(getValue())); } return (ScoredValue<R>) this;
1,278
69
1,347
<methods>public static Value<V> empty() ,public boolean equals(java.lang.Object) ,public static Value<V> from(Optional<T>) ,public static Value<V> fromNullable(T) ,public V getValue() ,public V getValueOrElse(V) ,public V getValueOrElseGet(Supplier<V>) ,public V getValueOrElseThrow(Supplier<? extends X>) throws X,publi...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/SetArgs.java
Builder
ex
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link SetArgs} and enable {@literal EX}. * * @param timeout expire time in seconds. * @return new {@link SetArgs} with {@literal EX} enabled. ...
LettuceAssert.notNull(timeout, "Timeout must not be null"); this.ex = timeout.toMillis() / 1000; return this;
1,543
48
1,591
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ShutdownArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link ShutdownArgs} and setting {@literal SAVE}. * * @return new {@link ShutdownArgs} with {@literal SAVE} set. * @see ShutdownArgs#save(boolean)...
if (save) { args.add(CommandKeyword.SAVE); } else { args.add(CommandKeyword.NOSAVE); } if (now) { args.add("NOW"); } if (force) { args.add(CommandKeyword.FORCE); } if (abort) { args.add("ABORT"...
693
109
802
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/SocketOptions.java
Builder
interval
class Builder { private int count = DEFAULT_COUNT; private boolean enabled = DEFAULT_SO_KEEPALIVE; private Duration idle = DEFAULT_IDLE; private Duration interval = DEFAULT_INTERVAL; private Builder() { } /** * Set th...
LettuceAssert.notNull(interval, "Idle time must not be null"); LettuceAssert.isTrue(!interval.isNegative(), "Idle time must not be begative"); this.interval = interval; return this;
900
65
965
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/SortArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link SortArgs} setting {@literal PATTERN}. * * @param pattern must not be {@code null}. * @return new {@link SortArgs} with {@literal PATTERN} s...
if (by != null) { args.add(BY); args.add(by); } if (get != null) { for (String pattern : get) { args.add(GET); args.add(pattern); } } if (limit != null && limit.isLimited()) { args.add...
1,205
172
1,377
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/SslConnectionBuilder.java
SslConnectionBuilder
toHostAndPort
class SslConnectionBuilder extends ConnectionBuilder { private RedisURI redisURI; public SslConnectionBuilder ssl(RedisURI redisURI) { this.redisURI = redisURI; return this; } public static SslConnectionBuilder sslConnectionBuilder() { return new SslConnectionBuilder(); } ...
if (socketAddress instanceof InetSocketAddress) { InetSocketAddress isa = (InetSocketAddress) socketAddress; return HostAndPort.of(isa.getHostString(), isa.getPort()); } return null;
1,305
67
1,372
<methods>public non-sealed void <init>() ,public void apply(io.lettuce.core.RedisURI) ,public io.lettuce.core.ConnectionBuilder bootstrap(Bootstrap) ,public Bootstrap bootstrap() ,public ChannelInitializer<Channel> build(java.net.SocketAddress) ,public io.lettuce.core.ConnectionBuilder channelGroup(ChannelGroup) ,publi...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/StaticRedisCredentials.java
StaticRedisCredentials
equals
class StaticRedisCredentials implements RedisCredentials { private final String username; private final char[] password; StaticRedisCredentials(String username, char[] password) { this.username = username; this.password = password != null ? Arrays.copyOf(password, password.length) : null;...
if (this == o) { return true; } if (!(o instanceof RedisCredentials)) { return false; } RedisCredentials that = (RedisCredentials) o; if (username != null ? !username.equals(that.getUsername()) : that.getUsername() != null) { return ...
283
114
397
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/StrAlgoArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link StrAlgoArgs} by keys. * * @return new {@link StrAlgoArgs} with {@literal By KEYS} set. */ public static StrAlgoArgs keys(String... ...
args.add("LCS"); args.add(by.name()); for (String key : keys) { if (by == By.STRINGS) { args.add(key.getBytes(charset)); } else { args.add(key); } } if (justLen) { args.add("LEN"); } ...
783
181
964
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/StreamMessage.java
StreamMessage
equals
class StreamMessage<K, V> { private final K stream; private final String id; private final Map<K, V> body; /** * Create a new {@link StreamMessage}. * * @param stream the stream. * @param id the message id. * @param body map containing the message body. */ public St...
if (this == o) return true; if (!(o instanceof StreamMessage)) return false; StreamMessage<?, ?> that = (StreamMessage<?, ?>) o; return Objects.equals(stream, that.stream) && Objects.equals(id, that.id) && Objects.equals(body, that.body);
328
89
417
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/TimeoutOptions.java
Builder
fixedTimeout
class Builder { private boolean timeoutCommands = DEFAULT_TIMEOUT_COMMANDS; private boolean applyConnectionTimeout = false; private TimeoutSource source; /** * Enable command timeouts. Disabled by default, see {@link #DEFAULT_TIMEOUT_COMMANDS}. * * @return ...
LettuceAssert.notNull(duration, "Duration must not be null"); return timeoutSource(new FixedTimeoutSource(duration.toNanos(), TimeUnit.NANOSECONDS));
586
52
638
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/TrackingArgs.java
Builder
prefixes
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link TrackingArgs} with {@literal CLIENT TRACKING ON}. * * @return new {@link TrackingArgs}. * @see TrackingArgs#enabled(boolean) */ ...
LettuceAssert.notNull(charset, "Charset must not be null"); this.prefixCharset = charset; this.prefixes = prefixes; return this;
911
49
960
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XAddArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link XAddArgs} and setting {@literal MAXLEN}. * * @return new {@link XAddArgs} with {@literal MAXLEN} set. * @see XAddArgs#maxlen(long) ...
if (maxlen != null) { args.add(CommandKeyword.MAXLEN); if (approximateTrimming) { args.add("~"); } else if (exactTrimming) { args.add("="); } args.add(maxlen); } if (minid != null) { arg...
1,360
268
1,628
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XAutoClaimArgs.java
Builder
minIdleTime
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link XAutoClaimArgs} and set the {@code JUSTID} flag to return just the message id and do not increment * the retry counter. The message body is not returned when...
LettuceAssert.notNull(minIdleTime, "Min idle time must not be null"); return minIdleTime(minIdleTime.toMillis());
1,234
46
1,280
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XClaimArgs.java
Builder
minIdleTime
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link XClaimArgs} and set the {@code JUSTID} flag to return just the message id and do not increment the * retry counter. The message body is not returned when cal...
LettuceAssert.notNull(minIdleTime, "Min idle time must not be null"); return minIdleTime(minIdleTime.toMillis());
302
46
348
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XGroupCreateArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link XGroupCreateArgs} and set {@literal MKSTREAM}. * * @return new {@link XGroupCreateArgs} with {@literal MKSTREAM} set. * @see XGroupCreateAr...
if (mkstream) { args.add("MKSTREAM"); } if (entriesRead != null) { args.add("ENTRIESREAD").add(entriesRead); }
601
60
661
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XPendingArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Create a new {@link XPendingArgs} . * * @param consumer the consumer * @param range the range of message Id's * @param limit limit {@code COUNT} ...
args.addKey((K) group); if (idle != null) { args.add(CommandKeyword.IDLE).add(idle); } if (range.getLower().equals(Range.Boundary.unbounded())) { args.add("-"); } else { args.add(range.getLower().getValue()); } if (range.ge...
799
203
1,002
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XReadArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Create a new {@link XReadArgs} and set {@literal BLOCK}. * * @param milliseconds time to block. * @return new {@link XReadArgs} with {@literal BLOCK} set. ...
if (block != null) { args.add(CommandKeyword.BLOCK).add(block); } if (count != null) { args.add(CommandKeyword.COUNT).add(count); } if (noack) { args.add(CommandKeyword.NOACK); }
926
89
1,015
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/XTrimArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link XTrimArgs} and setting {@literal MAXLEN}. * * @return new {@link XTrimArgs} with {@literal MAXLEN} set. * @see XTrimArgs#maxlen(long) ...
if (maxlen != null) { args.add(CommandKeyword.MAXLEN); if (approximateTrimming) { args.add("~"); } else if (exactTrimming) { args.add("="); } args.add(maxlen); } else if (minId != null) { args.ad...
968
201
1,169
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ZAddArgs.java
Builder
build
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link ZAddArgs} and enabling {@literal NX}. * * @return new {@link ZAddArgs} with {@literal NX} enabled. * @see ZAddArgs#nx() */ ...
if (nx) { args.add(NX); } if (xx) { args.add(XX); } if (gt) { args.add("GT"); } if (lt) { args.add("LT"); } if (ch) { args.add(CH); }
918
100
1,018
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ZAggregateArgs.java
Builder
weights
class Builder { /** * Utility constructor. */ Builder() { } /** * Creates new {@link ZAggregateArgs} setting {@literal WEIGHTS}. * * @return new {@link ZAddArgs} with {@literal WEIGHTS} set. * @see ZAggregateArgs#weights(double...) ...
LettuceAssert.notNull(weights, "Weights must not be null"); this.weights = new ArrayList<>(weights.length); for (double weight : weights) { this.weights.add(weight); } return this;
490
72
562
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/ZStoreArgs.java
Builder
weights
class Builder { /** * Utility constructor. */ private Builder() { } /** * Creates new {@link ZStoreArgs} setting {@literal WEIGHTS} using long. * * @return new {@link ZAddArgs} with {@literal WEIGHTS} set. * @see ZStoreArgs#weights(...
LettuceAssert.notNull(weights, "Weights must not be null"); return new ZStoreArgs().weights(toDoubleArray(weights));
619
44
663
<methods>public non-sealed void <init>() ,public void build(CommandArgs<K,V>) ,public io.lettuce.core.ZAggregateArgs max() ,public io.lettuce.core.ZAggregateArgs min() ,public io.lettuce.core.ZAggregateArgs sum() ,public transient io.lettuce.core.ZAggregateArgs weights(double[]) <variables>private io.lettuce.core.ZAggr...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/AbstractClusterNodeConnectionFactory.java
AbstractClusterNodeConnectionFactory
getSocketAddress
class AbstractClusterNodeConnectionFactory<K, V> implements ClusterNodeConnectionFactory<K, V> { private static final InternalLogger logger = InternalLoggerFactory .getInstance(PooledClusterConnectionProvider.DefaultClusterNodeConnectionFactory.class); private final ClientResources clientResources...
for (RedisClusterNode partition : partitions) { if (partition.getNodeId().equals(nodeId)) { return resolve(partition.getUri()); } } throw new IllegalArgumentException(String.format("Cannot resolve a RedisClusterNode for nodeId %s", nodeId));
610
77
687
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/AbstractNodeSelection.java
AbstractNodeSelection
asMap
class AbstractNodeSelection<API, CMD, K, V> implements NodeSelectionSupport<API, CMD> { @Override public Map<RedisClusterNode, API> asMap() {<FILL_FUNCTION_BODY>} @Override public int size() { return nodes().size(); } @Override public RedisClusterNode node(int index) { ret...
List<RedisClusterNode> list = new ArrayList<>(nodes()); Map<RedisClusterNode, API> map = new HashMap<>(list.size(), 1); list.forEach((key) -> map.put(key, getApi(key).join())); return map;
485
76
561
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/ClusterClientOptions.java
Builder
mutate
class Builder extends ClientOptions.Builder { private boolean closeStaleConnections = DEFAULT_CLOSE_STALE_CONNECTIONS; private int maxRedirects = DEFAULT_MAX_REDIRECTS; private boolean validateClusterNodeMembership = DEFAULT_VALIDATE_CLUSTER_MEMBERSHIP; private Predicate<RedisCluster...
Builder builder = new Builder(); builder.autoReconnect(isAutoReconnect()) .cancelCommandsOnReconnectFailure(isCancelCommandsOnReconnectFailure()) .decodeBufferPolicy(getDecodeBufferPolicy()) .disconnectedBehavior(getDisconnectedBehavior()).maxRedirects(...
1,691
249
1,940
<methods>public static io.lettuce.core.ClientOptions.Builder builder() ,public static io.lettuce.core.ClientOptions copyOf(io.lettuce.core.ClientOptions) ,public static io.lettuce.core.ClientOptions create() ,public int getBufferUsageRatio() ,public io.lettuce.core.protocol.ProtocolVersion getConfiguredProtocolVersion(...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/ClusterCommand.java
ClusterCommand
getError
class ClusterCommand<K, V, T> extends CommandWrapper<K, V, T> implements RedisCommand<K, V, T> { private int redirections; private final int maxRedirections; private final RedisChannelWriter retry; private boolean completed; /** * * @param command * @param retry * @param max...
if (command.getOutput() != null) { return command.getOutput().getError(); } return null;
702
36
738
<methods>public void <init>(RedisCommand<K,V,T>) ,public void cancel() ,public void complete() ,public boolean completeExceptionally(java.lang.Throwable) ,public void encode(ByteBuf) ,public boolean equals(java.lang.Object) ,public CommandArgs<K,V> getArgs() ,public RedisCommand<K,V,T> getDelegate() ,public CommandOutp...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/ClusterFutureSyncInvocationHandler.java
ClusterFutureSyncInvocationHandler
handleInvocation
class ClusterFutureSyncInvocationHandler<K, V> extends AbstractInvocationHandler { private final StatefulConnection<K, V> connection; private final TimeoutProvider timeoutProvider; private final Class<?> asyncCommandsInterface; private final Class<?> nodeSelectionInterface; private final Class<...
try { if (method.isDefault()) { return methodHandleCache.computeIfAbsent(method, ClusterFutureSyncInvocationHandler::lookupDefaultMethod) .bindTo(proxy).invokeWithArguments(args); } if (method.getName().equals("getConnection") && ar...
1,205
501
1,706
<methods>public non-sealed void <init>() ,public boolean equals(java.lang.Object) ,public int hashCode() ,public final java.lang.Object invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) throws java.lang.Throwable,public java.lang.String toString() <variables>private static final java.lang.Object[] ...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/ClusterNodeEndpoint.java
ClusterNodeEndpoint
retriggerCommands
class ClusterNodeEndpoint extends DefaultEndpoint { private static final InternalLogger logger = InternalLoggerFactory.getInstance(ClusterNodeEndpoint.class); private final RedisChannelWriter clusterChannelWriter; /** * Initialize a new instance that handles commands from the supplied queue. * ...
for (RedisCommand<?, ?, ?> queuedCommand : commands) { if (queuedCommand == null || queuedCommand.isCancelled()) { continue; } try { clusterChannelWriter.write(queuedCommand); } catch (RedisException e) { queuedCo...
386
97
483
<methods>public void <init>(io.lettuce.core.ClientOptions, io.lettuce.core.resource.ClientResources) ,public void addListener(io.lettuce.core.api.push.PushListener) ,public void close() ,public CompletableFuture<java.lang.Void> closeAsync() ,public void disconnect() ,public void flushCommands() ,public io.lettuce.core....
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java
PubSubNodeConnectionFactory
apply
class PubSubNodeConnectionFactory extends AbstractClusterNodeConnectionFactory<K, V> { PubSubNodeConnectionFactory(ClientResources clientResources) { super(clientResources); } @Override public ConnectionFuture<StatefulRedisConnection<K, V>> apply(ConnectionKey key) {<FILL_F...
if (key.nodeId != null) { // NodeId connections do not provide command recovery due to cluster reconfiguration return redisClusterClient.connectPubSubToNodeAsync((RedisCodec) redisCodec, key.nodeId, getSocketAddressSupplier(key)); } ...
88
140
228
<methods>public void <init>(io.lettuce.core.cluster.RedisClusterClient, io.lettuce.core.RedisChannelWriter, RedisCodec<K,V>, io.lettuce.core.cluster.ClusterEventListener) ,public void addListener(io.lettuce.core.cluster.api.push.RedisClusterPushListener) ,public void close() ,public CompletableFuture<java.lang.Void> cl...
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/CommandSet.java
CommandSet
hasCommand
class CommandSet { private final Map<String, CommandDetail> commands; private final EnumSet<CommandType> availableCommands = EnumSet.noneOf(CommandType.class); public CommandSet(Collection<CommandDetail> commands) { Map<String, CommandDetail> map = new HashMap<>(); for (CommandDetail co...
if (commandName instanceof CommandType) { return availableCommands.contains(commandName); } return commands.containsKey(commandName.name().toLowerCase());
351
48
399
<no_super_class>
redis_lettuce
lettuce/src/main/java/io/lettuce/core/cluster/DynamicNodeSelection.java
DynamicNodeSelection
getConnection
class DynamicNodeSelection<API, CMD, K, V> extends AbstractNodeSelection<API, CMD, K, V> { private final ClusterDistributionChannelWriter writer; private final Predicate<RedisClusterNode> selector; private final ConnectionIntent connectionIntent; private final Function<StatefulRedisConnection<K, V>,...
RedisURI uri = redisClusterNode.getUri(); AsyncClusterConnectionProvider async = (AsyncClusterConnectionProvider) writer.getClusterConnectionProvider(); return async.getConnectionAsync(connectionIntent, uri.getHost(), uri.getPort());
330
64
394
<methods>public Map<io.lettuce.core.cluster.models.partitions.RedisClusterNode,API> asMap() ,public CMD commands() ,public API commands(int) ,public io.lettuce.core.cluster.models.partitions.RedisClusterNode node(int) ,public int size() <variables>