repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java | BitfinexSymbols.ticker | public static BitfinexTickerSymbol ticker(final String currency, final String profitCurrency) {
final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
return ticker(B... | java | public static BitfinexTickerSymbol ticker(final String currency, final String profitCurrency) {
final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
return ticker(B... | [
"public",
"static",
"BitfinexTickerSymbol",
"ticker",
"(",
"final",
"String",
"currency",
",",
"final",
"String",
"profitCurrency",
")",
"{",
"final",
"String",
"currencyNonNull",
"=",
"Objects",
".",
"requireNonNull",
"(",
"currency",
")",
".",
"toUpperCase",
"("... | returns symbol for ticker channel
@param currency of ticker
@param profitCurrency of ticker
@return symbol | [
"returns",
"symbol",
"for",
"ticker",
"channel"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L182-L188 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java | BitfinexSymbols.funding | public static BitfinexFundingSymbol funding(final String bitfinexCurrency) {
final String currencyNonNull = Objects.requireNonNull(bitfinexCurrency).toUpperCase();
final BitfinexFundingCurrency currency = new BitfinexFundingCurrency(currencyNonNull);
return funding(currency);
} | java | public static BitfinexFundingSymbol funding(final String bitfinexCurrency) {
final String currencyNonNull = Objects.requireNonNull(bitfinexCurrency).toUpperCase();
final BitfinexFundingCurrency currency = new BitfinexFundingCurrency(currencyNonNull);
return funding(currency);
} | [
"public",
"static",
"BitfinexFundingSymbol",
"funding",
"(",
"final",
"String",
"bitfinexCurrency",
")",
"{",
"final",
"String",
"currencyNonNull",
"=",
"Objects",
".",
"requireNonNull",
"(",
"bitfinexCurrency",
")",
".",
"toUpperCase",
"(",
")",
";",
"final",
"Bi... | returns symbol for funding
@param bitfinexCurrency
@return | [
"returns",
"symbol",
"for",
"funding"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L206-L212 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.setupCommandCallbacks | private void setupCommandCallbacks() {
commandCallbacks = new HashMap<>();
commandCallbacks.put("info", new DoNothingCommandCallback());
// TODO: hb is not ping:pong
final ConnectionHeartbeatCallback pong = new ConnectionHeartbeatCallback();
pong.onHeartbeatEvent(l -> this.updateConnectionHeartbeat());
com... | java | private void setupCommandCallbacks() {
commandCallbacks = new HashMap<>();
commandCallbacks.put("info", new DoNothingCommandCallback());
// TODO: hb is not ping:pong
final ConnectionHeartbeatCallback pong = new ConnectionHeartbeatCallback();
pong.onHeartbeatEvent(l -> this.updateConnectionHeartbeat());
com... | [
"private",
"void",
"setupCommandCallbacks",
"(",
")",
"{",
"commandCallbacks",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"commandCallbacks",
".",
"put",
"(",
"\"info\"",
",",
"new",
"DoNothingCommandCallback",
"(",
")",
")",
";",
"// TODO: hb is not ping:pong",
... | Setup the command callbacks | [
"Setup",
"the",
"command",
"callbacks"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L215-L279 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.connect | @Override
public void connect() throws BitfinexClientException {
logger.debug("connect() called");
connectionStateChange(BitfinexConnectionStateEnum.CONNECTION_INIT);
try {
sequenceNumberAuditor.reset();
final CountDownLatch connectionReadyLatch = new CountDownLatch(4);
final... | java | @Override
public void connect() throws BitfinexClientException {
logger.debug("connect() called");
connectionStateChange(BitfinexConnectionStateEnum.CONNECTION_INIT);
try {
sequenceNumberAuditor.reset();
final CountDownLatch connectionReadyLatch = new CountDownLatch(4);
final... | [
"@",
"Override",
"public",
"void",
"connect",
"(",
")",
"throws",
"BitfinexClientException",
"{",
"logger",
".",
"debug",
"(",
"\"connect() called\"",
")",
";",
"connectionStateChange",
"(",
"BitfinexConnectionStateEnum",
".",
"CONNECTION_INIT",
")",
";",
"try",
"{"... | Open the connection
@throws BitfinexClientException | [
"Open",
"the",
"connection"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L285-L339 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.setupDefaultAccountInfoHandler | private void setupDefaultAccountInfoHandler() {
final BitfinexAccountSymbol accountSymbol = BitfinexSymbols.account(BitfinexApiKeyPermissions.NO_PERMISSIONS);
final AccountInfoHandler accountInfoHandler = new AccountInfoHandler(ACCCOUNT_INFO_CHANNEL, accountSymbol);
accountInfoHandler.onHeartbeatEvent(timestamp -... | java | private void setupDefaultAccountInfoHandler() {
final BitfinexAccountSymbol accountSymbol = BitfinexSymbols.account(BitfinexApiKeyPermissions.NO_PERMISSIONS);
final AccountInfoHandler accountInfoHandler = new AccountInfoHandler(ACCCOUNT_INFO_CHANNEL, accountSymbol);
accountInfoHandler.onHeartbeatEvent(timestamp -... | [
"private",
"void",
"setupDefaultAccountInfoHandler",
"(",
")",
"{",
"final",
"BitfinexAccountSymbol",
"accountSymbol",
"=",
"BitfinexSymbols",
".",
"account",
"(",
"BitfinexApiKeyPermissions",
".",
"NO_PERMISSIONS",
")",
";",
"final",
"AccountInfoHandler",
"accountInfoHandl... | Setup the default info handler - can be replaced in onAuthenticationSuccessEvent | [
"Setup",
"the",
"default",
"info",
"handler",
"-",
"can",
"be",
"replaced",
"in",
"onAuthenticationSuccessEvent"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L344-L349 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.close | @Override
public void close() {
try {
callbackRegistry.acceptConnectionStateChange(BitfinexConnectionStateEnum.DISCONNECTION_INIT);
logger.debug("close() called");
if (heartbeatThread != null) {
heartbeatThread.interrupt();
heartbeatThread = null;
}
if (websocketEndpoint != null) {
websoc... | java | @Override
public void close() {
try {
callbackRegistry.acceptConnectionStateChange(BitfinexConnectionStateEnum.DISCONNECTION_INIT);
logger.debug("close() called");
if (heartbeatThread != null) {
heartbeatThread.interrupt();
heartbeatThread = null;
}
if (websocketEndpoint != null) {
websoc... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"try",
"{",
"callbackRegistry",
".",
"acceptConnectionStateChange",
"(",
"BitfinexConnectionStateEnum",
".",
"DISCONNECTION_INIT",
")",
";",
"logger",
".",
"debug",
"(",
"\"close() called\"",
")",
";",
"if... | Disconnect the websocket | [
"Disconnect",
"the",
"websocket"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L354-L373 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.sendCommand | @Override
public void sendCommand(final BitfinexCommand command) {
try {
if (command instanceof BitfinexStreamSymbolToChannelIdResolverAware) {
final BitfinexStreamSymbolToChannelIdResolverAware aware = (BitfinexStreamSymbolToChannelIdResolverAware) command;
aware.setResolver(symbol -> {
final Intege... | java | @Override
public void sendCommand(final BitfinexCommand command) {
try {
if (command instanceof BitfinexStreamSymbolToChannelIdResolverAware) {
final BitfinexStreamSymbolToChannelIdResolverAware aware = (BitfinexStreamSymbolToChannelIdResolverAware) command;
aware.setResolver(symbol -> {
final Intege... | [
"@",
"Override",
"public",
"void",
"sendCommand",
"(",
"final",
"BitfinexCommand",
"command",
")",
"{",
"try",
"{",
"if",
"(",
"command",
"instanceof",
"BitfinexStreamSymbolToChannelIdResolverAware",
")",
"{",
"final",
"BitfinexStreamSymbolToChannelIdResolverAware",
"awar... | Send a new API command
@param command | [
"Send",
"a",
"new",
"API",
"command"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L379-L398 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.reconnect | @Override
public synchronized boolean reconnect() {
logger.debug("reconnect() called");
try {
callbackRegistry.acceptConnectionStateChange(BitfinexConnectionStateEnum.RECONNECTION_INIT);
websocketEndpoint.close();
permissions = BitfinexApiKeyPermissions.NO_PERMISSIONS;
authenticated = false;
sequen... | java | @Override
public synchronized boolean reconnect() {
logger.debug("reconnect() called");
try {
callbackRegistry.acceptConnectionStateChange(BitfinexConnectionStateEnum.RECONNECTION_INIT);
websocketEndpoint.close();
permissions = BitfinexApiKeyPermissions.NO_PERMISSIONS;
authenticated = false;
sequen... | [
"@",
"Override",
"public",
"synchronized",
"boolean",
"reconnect",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"reconnect() called\"",
")",
";",
"try",
"{",
"callbackRegistry",
".",
"acceptConnectionStateChange",
"(",
"BitfinexConnectionStateEnum",
".",
"RECONNECTIO... | Perform a reconnect
@return | [
"Perform",
"a",
"reconnect"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L404-L466 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.authenticateAndWait | private void authenticateAndWait(final CountDownLatch latch) throws InterruptedException, BitfinexClientException {
if (authenticated) {
return;
}
sendCommand(new AuthCommand(configuration.getAuthNonceProducer()));
logger.debug("Waiting for connection ready events");
latch.await(10, TimeUnit.SECONDS);
i... | java | private void authenticateAndWait(final CountDownLatch latch) throws InterruptedException, BitfinexClientException {
if (authenticated) {
return;
}
sendCommand(new AuthCommand(configuration.getAuthNonceProducer()));
logger.debug("Waiting for connection ready events");
latch.await(10, TimeUnit.SECONDS);
i... | [
"private",
"void",
"authenticateAndWait",
"(",
"final",
"CountDownLatch",
"latch",
")",
"throws",
"InterruptedException",
",",
"BitfinexClientException",
"{",
"if",
"(",
"authenticated",
")",
"{",
"return",
";",
"}",
"sendCommand",
"(",
"new",
"AuthCommand",
"(",
... | Execute the authentication and wait until the socket is ready
@throws InterruptedException
@throws BitfinexClientException | [
"Execute",
"the",
"authentication",
"and",
"wait",
"until",
"the",
"socket",
"is",
"ready"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L502-L513 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.websocketCallback | private void websocketCallback(final String message) {
logger.debug("Recv: {}", message);
if(message.startsWith("{")) {
handleCommandCallback(message);
} else if(message.startsWith("[")) {
handleChannelCallback(message);
} else {
logger.error("Got unknown callback: {}", message);
}
} | java | private void websocketCallback(final String message) {
logger.debug("Recv: {}", message);
if(message.startsWith("{")) {
handleCommandCallback(message);
} else if(message.startsWith("[")) {
handleChannelCallback(message);
} else {
logger.error("Got unknown callback: {}", message);
}
} | [
"private",
"void",
"websocketCallback",
"(",
"final",
"String",
"message",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Recv: {}\"",
",",
"message",
")",
";",
"if",
"(",
"message",
".",
"startsWith",
"(",
"\"{\"",
")",
")",
"{",
"handleCommandCallback",
"(",
... | We received a websocket callback
@param message | [
"We",
"received",
"a",
"websocket",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L519-L528 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.handleCommandCallback | private void handleCommandCallback(final String message) {
// JSON callback
final JSONObject jsonObject = new JSONObject(message);
final String eventType = jsonObject.getString("event");
final CommandCallbackHandler commandCallbackHandler = commandCallbacks.get(eventType);
if( commandCallbackHandler ==... | java | private void handleCommandCallback(final String message) {
// JSON callback
final JSONObject jsonObject = new JSONObject(message);
final String eventType = jsonObject.getString("event");
final CommandCallbackHandler commandCallbackHandler = commandCallbacks.get(eventType);
if( commandCallbackHandler ==... | [
"private",
"void",
"handleCommandCallback",
"(",
"final",
"String",
"message",
")",
"{",
"// JSON callback",
"final",
"JSONObject",
"jsonObject",
"=",
"new",
"JSONObject",
"(",
"message",
")",
";",
"final",
"String",
"eventType",
"=",
"jsonObject",
".",
"getString... | Handle a command callback | [
"Handle",
"a",
"command",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L533-L548 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.handleChannelCallback | private void handleChannelCallback(final String message) {
// Channel callback
updateConnectionHeartbeat();
// JSON callback
final JSONArray jsonArray = new JSONArray(new JSONTokener(message));
if(connectionFeatureManager.isConnectionFeatureActive(BitfinexConnectionFeature.SEQ_ALL)) {
sequenceNumberAudit... | java | private void handleChannelCallback(final String message) {
// Channel callback
updateConnectionHeartbeat();
// JSON callback
final JSONArray jsonArray = new JSONArray(new JSONTokener(message));
if(connectionFeatureManager.isConnectionFeatureActive(BitfinexConnectionFeature.SEQ_ALL)) {
sequenceNumberAudit... | [
"private",
"void",
"handleChannelCallback",
"(",
"final",
"String",
"message",
")",
"{",
"// Channel callback",
"updateConnectionHeartbeat",
"(",
")",
";",
"// JSON callback",
"final",
"JSONArray",
"jsonArray",
"=",
"new",
"JSONArray",
"(",
"new",
"JSONTokener",
"(",
... | Handle a channel callback
@param message | [
"Handle",
"a",
"channel",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L558-L595 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.getChannelForSymbol | private Integer getChannelForSymbol(final BitfinexStreamSymbol symbol) {
synchronized (channelIdToHandlerMap) {
return channelIdToHandlerMap.values()
.stream()
.filter(v -> Objects.equals(v.getSymbol(), symbol))
.map(ChannelCallbackHandler::getChannelId)
.findFirst().orElse(null);
}
} | java | private Integer getChannelForSymbol(final BitfinexStreamSymbol symbol) {
synchronized (channelIdToHandlerMap) {
return channelIdToHandlerMap.values()
.stream()
.filter(v -> Objects.equals(v.getSymbol(), symbol))
.map(ChannelCallbackHandler::getChannelId)
.findFirst().orElse(null);
}
} | [
"private",
"Integer",
"getChannelForSymbol",
"(",
"final",
"BitfinexStreamSymbol",
"symbol",
")",
"{",
"synchronized",
"(",
"channelIdToHandlerMap",
")",
"{",
"return",
"channelIdToHandlerMap",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
... | Find the channel for the given symbol
@param symbol
@return | [
"Find",
"the",
"channel",
"for",
"the",
"given",
"symbol"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L602-L610 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.resubscribeChannels | private void resubscribeChannels() throws InterruptedException, BitfinexClientException {
final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap = new HashMap<>();
synchronized (channelIdToHandlerMap) {
oldChannelIdSymbolMap.putAll(channelIdToHandlerMap);
channelIdToHandlerMap.clear();
channelId... | java | private void resubscribeChannels() throws InterruptedException, BitfinexClientException {
final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap = new HashMap<>();
synchronized (channelIdToHandlerMap) {
oldChannelIdSymbolMap.putAll(channelIdToHandlerMap);
channelIdToHandlerMap.clear();
channelId... | [
"private",
"void",
"resubscribeChannels",
"(",
")",
"throws",
"InterruptedException",
",",
"BitfinexClientException",
"{",
"final",
"Map",
"<",
"Integer",
",",
"ChannelCallbackHandler",
">",
"oldChannelIdSymbolMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"synch... | Re-subscribe the old ticker
@return
@throws InterruptedException
@throws BitfinexClientException | [
"Re",
"-",
"subscribe",
"the",
"old",
"ticker"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L618-L649 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.waitForChannelResubscription | private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final Stopwatch stopwatch = Stopwatch.createStarted();
final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3);
logger.info("Waiting for st... | java | private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final Stopwatch stopwatch = Stopwatch.createStarted();
final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3);
logger.info("Waiting for st... | [
"private",
"void",
"waitForChannelResubscription",
"(",
"final",
"Map",
"<",
"Integer",
",",
"ChannelCallbackHandler",
">",
"oldChannelIdSymbolMap",
")",
"throws",
"BitfinexClientException",
",",
"InterruptedException",
"{",
"final",
"Stopwatch",
"stopwatch",
"=",
"Stopwa... | Wait for the successful channel re-subscription
@param oldChannelIdSymbolMap
@return
@throws BitfinexClientException
@throws InterruptedException | [
"Wait",
"for",
"the",
"successful",
"channel",
"re",
"-",
"subscription"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L658-L678 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java | SimpleBitfinexApiBroker.handleResubscribeFailed | private void handleResubscribeFailed(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final int requiredSymbols = oldChannelIdSymbolMap.size();
final int subscribedSymbols = channelIdToHandlerMap.size();
// Unsubscribe old channels b... | java | private void handleResubscribeFailed(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final int requiredSymbols = oldChannelIdSymbolMap.size();
final int subscribedSymbols = channelIdToHandlerMap.size();
// Unsubscribe old channels b... | [
"private",
"void",
"handleResubscribeFailed",
"(",
"final",
"Map",
"<",
"Integer",
",",
"ChannelCallbackHandler",
">",
"oldChannelIdSymbolMap",
")",
"throws",
"BitfinexClientException",
",",
"InterruptedException",
"{",
"final",
"int",
"requiredSymbols",
"=",
"oldChannelI... | Handle channel re-subscribe failed
@param oldChannelIdSymbolMap
@throws BitfinexClientException
@throws InterruptedException | [
"Handle",
"channel",
"re",
"-",
"subscribe",
"failed"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L687-L705 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/FutureOperationRegistry.java | FutureOperationRegistry.handleEvent | public void handleEvent(final BitfinexStreamSymbol symbol) {
final List<FutureOperation> futuresToFinish = pendingFutures
.stream()
.filter(f -> f.getSymbol().equals(symbol))
.collect(Collectors.toList());
pendingFutures.removeAll(futuresToFinish);
futuresToFinish.forEach(f -> f.setToDone());
} | java | public void handleEvent(final BitfinexStreamSymbol symbol) {
final List<FutureOperation> futuresToFinish = pendingFutures
.stream()
.filter(f -> f.getSymbol().equals(symbol))
.collect(Collectors.toList());
pendingFutures.removeAll(futuresToFinish);
futuresToFinish.forEach(f -> f.setToDone());
} | [
"public",
"void",
"handleEvent",
"(",
"final",
"BitfinexStreamSymbol",
"symbol",
")",
"{",
"final",
"List",
"<",
"FutureOperation",
">",
"futuresToFinish",
"=",
"pendingFutures",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"f",
"->",
"f",
".",
"getSymbol",
... | Handle a subscribe or unsubscribe event | [
"Handle",
"a",
"subscribe",
"or",
"unsubscribe",
"event"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/FutureOperationRegistry.java#L44-L53 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.registerTickCallback | public void registerTickCallback(final BitfinexTickerSymbol symbol,
final BiConsumer<BitfinexTickerSymbol, BitfinexTick> callback) throws BitfinexClientException {
tickerCallbacks.registerCallback(symbol, callback);
} | java | public void registerTickCallback(final BitfinexTickerSymbol symbol,
final BiConsumer<BitfinexTickerSymbol, BitfinexTick> callback) throws BitfinexClientException {
tickerCallbacks.registerCallback(symbol, callback);
} | [
"public",
"void",
"registerTickCallback",
"(",
"final",
"BitfinexTickerSymbol",
"symbol",
",",
"final",
"BiConsumer",
"<",
"BitfinexTickerSymbol",
",",
"BitfinexTick",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"tickerCallbacks",
".",
"registerCallbac... | Register a new tick callback
@param symbol
@param callback
@throws BitfinexClientException | [
"Register",
"a",
"new",
"tick",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L133-L137 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.removeTickCallback | public boolean removeTickCallback(final BitfinexTickerSymbol symbol,
final BiConsumer<BitfinexTickerSymbol, BitfinexTick> callback) throws BitfinexClientException {
return tickerCallbacks.removeCallback(symbol, callback);
} | java | public boolean removeTickCallback(final BitfinexTickerSymbol symbol,
final BiConsumer<BitfinexTickerSymbol, BitfinexTick> callback) throws BitfinexClientException {
return tickerCallbacks.removeCallback(symbol, callback);
} | [
"public",
"boolean",
"removeTickCallback",
"(",
"final",
"BitfinexTickerSymbol",
"symbol",
",",
"final",
"BiConsumer",
"<",
"BitfinexTickerSymbol",
",",
"BitfinexTick",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"return",
"tickerCallbacks",
".",
"re... | Remove the a tick callback
@param symbol
@param callback
@return
@throws BitfinexClientException | [
"Remove",
"the",
"a",
"tick",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L146-L150 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.handleCandleCollection | public void handleCandleCollection(final BitfinexTickerSymbol symbol, final List<BitfinexTick> candles) {
updateChannelHeartbeat(symbol);
tickerCallbacks.handleEventsCollection(symbol, candles);
} | java | public void handleCandleCollection(final BitfinexTickerSymbol symbol, final List<BitfinexTick> candles) {
updateChannelHeartbeat(symbol);
tickerCallbacks.handleEventsCollection(symbol, candles);
} | [
"public",
"void",
"handleCandleCollection",
"(",
"final",
"BitfinexTickerSymbol",
"symbol",
",",
"final",
"List",
"<",
"BitfinexTick",
">",
"candles",
")",
"{",
"updateChannelHeartbeat",
"(",
"symbol",
")",
";",
"tickerCallbacks",
".",
"handleEventsCollection",
"(",
... | Process a list with candles
@param symbol
@param ticksArray | [
"Process",
"a",
"list",
"with",
"candles"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L157-L160 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.handleNewTick | public void handleNewTick(final BitfinexTickerSymbol currencyPair, final BitfinexTick tick) {
updateChannelHeartbeat(currencyPair);
tickerCallbacks.handleEvent(currencyPair, tick);
} | java | public void handleNewTick(final BitfinexTickerSymbol currencyPair, final BitfinexTick tick) {
updateChannelHeartbeat(currencyPair);
tickerCallbacks.handleEvent(currencyPair, tick);
} | [
"public",
"void",
"handleNewTick",
"(",
"final",
"BitfinexTickerSymbol",
"currencyPair",
",",
"final",
"BitfinexTick",
"tick",
")",
"{",
"updateChannelHeartbeat",
"(",
"currencyPair",
")",
";",
"tickerCallbacks",
".",
"handleEvent",
"(",
"currencyPair",
",",
"tick",
... | Handle a new candle
@param symbol
@param candle | [
"Handle",
"a",
"new",
"candle"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L167-L170 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.subscribeTicker | public FutureOperation subscribeTicker(final BitfinexTickerSymbol tickerSymbol)
throws BitfinexClientException {
final FutureOperation future = new FutureOperation(tickerSymbol);
pendingSubscribes.registerFuture(future);
final SubscribeTickerCommand command = new SubscribeTickerCommand(tickerSymbol);
... | java | public FutureOperation subscribeTicker(final BitfinexTickerSymbol tickerSymbol)
throws BitfinexClientException {
final FutureOperation future = new FutureOperation(tickerSymbol);
pendingSubscribes.registerFuture(future);
final SubscribeTickerCommand command = new SubscribeTickerCommand(tickerSymbol);
... | [
"public",
"FutureOperation",
"subscribeTicker",
"(",
"final",
"BitfinexTickerSymbol",
"tickerSymbol",
")",
"throws",
"BitfinexClientException",
"{",
"final",
"FutureOperation",
"future",
"=",
"new",
"FutureOperation",
"(",
"tickerSymbol",
")",
";",
"pendingSubscribes",
".... | Subscribe a ticker
@param tickerSymbol
@return
@throws BitfinexClientException | [
"Subscribe",
"a",
"ticker"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L178-L188 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.unsubscribeTicker | public FutureOperation unsubscribeTicker(final BitfinexTickerSymbol tickerSymbol) {
final FutureOperation future = new FutureOperation(tickerSymbol);
pendingUnsubscribes.registerFuture(future);
lastTickerActivity.remove(tickerSymbol);
final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(t... | java | public FutureOperation unsubscribeTicker(final BitfinexTickerSymbol tickerSymbol) {
final FutureOperation future = new FutureOperation(tickerSymbol);
pendingUnsubscribes.registerFuture(future);
lastTickerActivity.remove(tickerSymbol);
final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(t... | [
"public",
"FutureOperation",
"unsubscribeTicker",
"(",
"final",
"BitfinexTickerSymbol",
"tickerSymbol",
")",
"{",
"final",
"FutureOperation",
"future",
"=",
"new",
"FutureOperation",
"(",
"tickerSymbol",
")",
";",
"pendingUnsubscribes",
".",
"registerFuture",
"(",
"futu... | Unsubscribe a ticker
@param tickerSymbol
@return | [
"Unsubscribe",
"a",
"ticker"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L195-L205 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.registerCandlestickCallback | public void registerCandlestickCallback(final BitfinexCandlestickSymbol symbol,
final BiConsumer<BitfinexCandlestickSymbol, BitfinexCandle> callback) throws BitfinexClientException {
candleCallbacks.registerCallback(symbol, callback);
} | java | public void registerCandlestickCallback(final BitfinexCandlestickSymbol symbol,
final BiConsumer<BitfinexCandlestickSymbol, BitfinexCandle> callback) throws BitfinexClientException {
candleCallbacks.registerCallback(symbol, callback);
} | [
"public",
"void",
"registerCandlestickCallback",
"(",
"final",
"BitfinexCandlestickSymbol",
"symbol",
",",
"final",
"BiConsumer",
"<",
"BitfinexCandlestickSymbol",
",",
"BitfinexCandle",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"candleCallbacks",
".",... | Register a new candlestick callback
@param symbol
@param callback
@throws BitfinexClientException | [
"Register",
"a",
"new",
"candlestick",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L213-L217 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.removeCandlestickCallback | public boolean removeCandlestickCallback(final BitfinexCandlestickSymbol symbol,
final BiConsumer<BitfinexCandlestickSymbol, BitfinexCandle> callback) throws BitfinexClientException {
return candleCallbacks.removeCallback(symbol, callback);
} | java | public boolean removeCandlestickCallback(final BitfinexCandlestickSymbol symbol,
final BiConsumer<BitfinexCandlestickSymbol, BitfinexCandle> callback) throws BitfinexClientException {
return candleCallbacks.removeCallback(symbol, callback);
} | [
"public",
"boolean",
"removeCandlestickCallback",
"(",
"final",
"BitfinexCandlestickSymbol",
"symbol",
",",
"final",
"BiConsumer",
"<",
"BitfinexCandlestickSymbol",
",",
"BitfinexCandle",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"return",
"candleCallb... | Remove the a candlestick callback
@param symbol
@param callback
@return
@throws BitfinexClientException | [
"Remove",
"the",
"a",
"candlestick",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L226-L230 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.handleCandlestickCollection | public void handleCandlestickCollection(final BitfinexCandlestickSymbol symbol, final Collection<BitfinexCandle> ticksBuffer) {
candleCallbacks.handleEventsCollection(symbol, ticksBuffer);
} | java | public void handleCandlestickCollection(final BitfinexCandlestickSymbol symbol, final Collection<BitfinexCandle> ticksBuffer) {
candleCallbacks.handleEventsCollection(symbol, ticksBuffer);
} | [
"public",
"void",
"handleCandlestickCollection",
"(",
"final",
"BitfinexCandlestickSymbol",
"symbol",
",",
"final",
"Collection",
"<",
"BitfinexCandle",
">",
"ticksBuffer",
")",
"{",
"candleCallbacks",
".",
"handleEventsCollection",
"(",
"symbol",
",",
"ticksBuffer",
")... | Process a list with candlesticks
@param symbol
@param ticksArray | [
"Process",
"a",
"list",
"with",
"candlesticks"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L238-L240 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.handleNewCandlestick | public void handleNewCandlestick(final BitfinexCandlestickSymbol currencyPair, final BitfinexCandle tick) {
updateChannelHeartbeat(currencyPair);
candleCallbacks.handleEvent(currencyPair, tick);
} | java | public void handleNewCandlestick(final BitfinexCandlestickSymbol currencyPair, final BitfinexCandle tick) {
updateChannelHeartbeat(currencyPair);
candleCallbacks.handleEvent(currencyPair, tick);
} | [
"public",
"void",
"handleNewCandlestick",
"(",
"final",
"BitfinexCandlestickSymbol",
"currencyPair",
",",
"final",
"BitfinexCandle",
"tick",
")",
"{",
"updateChannelHeartbeat",
"(",
"currencyPair",
")",
";",
"candleCallbacks",
".",
"handleEvent",
"(",
"currencyPair",
",... | Handle a new candlestick
@param symbol
@param tick | [
"Handle",
"a",
"new",
"candlestick"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L247-L250 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.subscribeCandles | public FutureOperation subscribeCandles(final BitfinexCandlestickSymbol symbol) throws BitfinexClientException {
final FutureOperation future = new FutureOperation(symbol);
pendingSubscribes.registerFuture(future);
final SubscribeCandlesCommand command = new SubscribeCandlesCommand(symbol);
client.sendCom... | java | public FutureOperation subscribeCandles(final BitfinexCandlestickSymbol symbol) throws BitfinexClientException {
final FutureOperation future = new FutureOperation(symbol);
pendingSubscribes.registerFuture(future);
final SubscribeCandlesCommand command = new SubscribeCandlesCommand(symbol);
client.sendCom... | [
"public",
"FutureOperation",
"subscribeCandles",
"(",
"final",
"BitfinexCandlestickSymbol",
"symbol",
")",
"throws",
"BitfinexClientException",
"{",
"final",
"FutureOperation",
"future",
"=",
"new",
"FutureOperation",
"(",
"symbol",
")",
";",
"pendingSubscribes",
".",
"... | Subscribe candles for a symbol
@param currencyPair
@param timeframe
@return
@throws BitfinexClientException | [
"Subscribe",
"candles",
"for",
"a",
"symbol"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L259-L268 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.unsubscribeCandles | public FutureOperation unsubscribeCandles(final BitfinexCandlestickSymbol symbol) {
lastTickerActivity.remove(symbol);
final FutureOperation future = new FutureOperation(symbol);
pendingUnsubscribes.registerFuture(future);
final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(symbol);
... | java | public FutureOperation unsubscribeCandles(final BitfinexCandlestickSymbol symbol) {
lastTickerActivity.remove(symbol);
final FutureOperation future = new FutureOperation(symbol);
pendingUnsubscribes.registerFuture(future);
final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(symbol);
... | [
"public",
"FutureOperation",
"unsubscribeCandles",
"(",
"final",
"BitfinexCandlestickSymbol",
"symbol",
")",
"{",
"lastTickerActivity",
".",
"remove",
"(",
"symbol",
")",
";",
"final",
"FutureOperation",
"future",
"=",
"new",
"FutureOperation",
"(",
"symbol",
")",
"... | Unsubscribe the candles
@param currencyPair
@param timeframe
@return | [
"Unsubscribe",
"the",
"candles"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L276-L285 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.registerExecutedTradeCallback | public void registerExecutedTradeCallback(final BitfinexExecutedTradeSymbol orderbookConfiguration,
final BiConsumer<BitfinexExecutedTradeSymbol, BitfinexExecutedTrade> callback) throws BitfinexClientException {
tradesCallbacks.registerCallback(orderbookConfiguration, callback);
} | java | public void registerExecutedTradeCallback(final BitfinexExecutedTradeSymbol orderbookConfiguration,
final BiConsumer<BitfinexExecutedTradeSymbol, BitfinexExecutedTrade> callback) throws BitfinexClientException {
tradesCallbacks.registerCallback(orderbookConfiguration, callback);
} | [
"public",
"void",
"registerExecutedTradeCallback",
"(",
"final",
"BitfinexExecutedTradeSymbol",
"orderbookConfiguration",
",",
"final",
"BiConsumer",
"<",
"BitfinexExecutedTradeSymbol",
",",
"BitfinexExecutedTrade",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{"... | Register a new executed trade callback
@param symbol
@param callback
@throws BitfinexClientException | [
"Register",
"a",
"new",
"executed",
"trade",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L294-L298 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.removeExecutedTradeCallback | public boolean removeExecutedTradeCallback(final BitfinexExecutedTradeSymbol tradeSymbol,
final BiConsumer<BitfinexExecutedTradeSymbol, BitfinexExecutedTrade> callback) throws BitfinexClientException {
return tradesCallbacks.removeCallback(tradeSymbol, callback);
} | java | public boolean removeExecutedTradeCallback(final BitfinexExecutedTradeSymbol tradeSymbol,
final BiConsumer<BitfinexExecutedTradeSymbol, BitfinexExecutedTrade> callback) throws BitfinexClientException {
return tradesCallbacks.removeCallback(tradeSymbol, callback);
} | [
"public",
"boolean",
"removeExecutedTradeCallback",
"(",
"final",
"BitfinexExecutedTradeSymbol",
"tradeSymbol",
",",
"final",
"BiConsumer",
"<",
"BitfinexExecutedTradeSymbol",
",",
"BitfinexExecutedTrade",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"retur... | Remove a executed trade callback
@param symbol
@param callback
@return
@throws BitfinexClientException | [
"Remove",
"a",
"executed",
"trade",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L307-L311 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.subscribeExecutedTrades | public FutureOperation subscribeExecutedTrades(final BitfinexExecutedTradeSymbol tradeSymbol) {
final FutureOperation future = new FutureOperation(tradeSymbol);
pendingSubscribes.registerFuture(future);
final SubscribeTradesCommand subscribeOrderbookCommand
= new SubscribeTradesCommand(tradeSymbol);
c... | java | public FutureOperation subscribeExecutedTrades(final BitfinexExecutedTradeSymbol tradeSymbol) {
final FutureOperation future = new FutureOperation(tradeSymbol);
pendingSubscribes.registerFuture(future);
final SubscribeTradesCommand subscribeOrderbookCommand
= new SubscribeTradesCommand(tradeSymbol);
c... | [
"public",
"FutureOperation",
"subscribeExecutedTrades",
"(",
"final",
"BitfinexExecutedTradeSymbol",
"tradeSymbol",
")",
"{",
"final",
"FutureOperation",
"future",
"=",
"new",
"FutureOperation",
"(",
"tradeSymbol",
")",
";",
"pendingSubscribes",
".",
"registerFuture",
"("... | Subscribe a executed trade channel
@param currencyPair
@param orderBookPrecision
@param orderBookFrequency
@param pricePoints
@return | [
"Subscribe",
"a",
"executed",
"trade",
"channel"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L321-L332 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.unsubscribeExecutedTrades | public FutureOperation unsubscribeExecutedTrades(final BitfinexExecutedTradeSymbol tradeSymbol) {
final FutureOperation future = new FutureOperation(tradeSymbol);
pendingUnsubscribes.registerFuture(future);
final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(tradeSymbol);
client.sendCommand... | java | public FutureOperation unsubscribeExecutedTrades(final BitfinexExecutedTradeSymbol tradeSymbol) {
final FutureOperation future = new FutureOperation(tradeSymbol);
pendingUnsubscribes.registerFuture(future);
final UnsubscribeChannelCommand command = new UnsubscribeChannelCommand(tradeSymbol);
client.sendCommand... | [
"public",
"FutureOperation",
"unsubscribeExecutedTrades",
"(",
"final",
"BitfinexExecutedTradeSymbol",
"tradeSymbol",
")",
"{",
"final",
"FutureOperation",
"future",
"=",
"new",
"FutureOperation",
"(",
"tradeSymbol",
")",
";",
"pendingUnsubscribes",
".",
"registerFuture",
... | Unsubscribe a executed trades channel
@param currencyPair
@param orderBookPrecision
@param orderBookFrequency
@param pricePoints
@return | [
"Unsubscribe",
"a",
"executed",
"trades",
"channel"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L342-L350 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java | BitfinexCurrencyPair.registerDefaults | public static void registerDefaults() throws BitfinexClientException {
try {
final URL url = new URL(SYMBOL_URL);
final String symbolJson = Resources.toString(url, Charsets.UTF_8);
final JSONArray jsonArray = new JSONArray(symbolJson);
for(int i = 0; i < jsonArray.length(); i++) {
final JSONObject c... | java | public static void registerDefaults() throws BitfinexClientException {
try {
final URL url = new URL(SYMBOL_URL);
final String symbolJson = Resources.toString(url, Charsets.UTF_8);
final JSONArray jsonArray = new JSONArray(symbolJson);
for(int i = 0; i < jsonArray.length(); i++) {
final JSONObject c... | [
"public",
"static",
"void",
"registerDefaults",
"(",
")",
"throws",
"BitfinexClientException",
"{",
"try",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"SYMBOL_URL",
")",
";",
"final",
"String",
"symbolJson",
"=",
"Resources",
".",
"toString",
"(",
"u... | Load and register all known currencies
@throws BitfinexClientException | [
"Load",
"and",
"register",
"all",
"known",
"currencies"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java#L50-L74 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java | BitfinexCurrencyPair.register | public static BitfinexCurrencyPair register(final String currency,
final String profitCurrency, final double minimalOrderSize) {
final String key = buildCacheKey(currency, profitCurrency);
final BitfinexCurrencyPair newCurrency = new BitfinexCurrencyPair(currency, profitCurrency,
minimalOrderSize);
fi... | java | public static BitfinexCurrencyPair register(final String currency,
final String profitCurrency, final double minimalOrderSize) {
final String key = buildCacheKey(currency, profitCurrency);
final BitfinexCurrencyPair newCurrency = new BitfinexCurrencyPair(currency, profitCurrency,
minimalOrderSize);
fi... | [
"public",
"static",
"BitfinexCurrencyPair",
"register",
"(",
"final",
"String",
"currency",
",",
"final",
"String",
"profitCurrency",
",",
"final",
"double",
"minimalOrderSize",
")",
"{",
"final",
"String",
"key",
"=",
"buildCacheKey",
"(",
"currency",
",",
"profi... | Registers currency pair for use within library
@param currency currency (from)
@param profitCurrency currency (to)
@param minimalOrderSize minimal order size
@return registered instance of {@link BitfinexCurrencyPair} | [
"Registers",
"currency",
"pair",
"for",
"use",
"within",
"library"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java#L88-L104 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java | BitfinexCurrencyPair.of | public static BitfinexCurrencyPair of(final String currency, final String profitCurrency) {
final String key = buildCacheKey(currency, profitCurrency);
final BitfinexCurrencyPair bcp = instances.get(key);
if (bcp == null) {
throw new IllegalArgumentException("CurrencyPair is not registered: " + currency + " ... | java | public static BitfinexCurrencyPair of(final String currency, final String profitCurrency) {
final String key = buildCacheKey(currency, profitCurrency);
final BitfinexCurrencyPair bcp = instances.get(key);
if (bcp == null) {
throw new IllegalArgumentException("CurrencyPair is not registered: " + currency + " ... | [
"public",
"static",
"BitfinexCurrencyPair",
"of",
"(",
"final",
"String",
"currency",
",",
"final",
"String",
"profitCurrency",
")",
"{",
"final",
"String",
"key",
"=",
"buildCacheKey",
"(",
"currency",
",",
"profitCurrency",
")",
";",
"final",
"BitfinexCurrencyPa... | Retrieves bitfinex currency pair
@param currency currency (from)
@param profitCurrency currency (to)
@return BitfinexCurrencyPair | [
"Retrieves",
"bitfinex",
"currency",
"pair"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java#L113-L123 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java | BitfinexCurrencyPair.fromSymbolString | public static BitfinexCurrencyPair fromSymbolString(final String symbolString) {
for (final BitfinexCurrencyPair currency : BitfinexCurrencyPair.values()) {
if (currency.toBitfinexString().equalsIgnoreCase(symbolString)) {
return currency;
}
}
throw new IllegalArgumentException("Unable to find currency ... | java | public static BitfinexCurrencyPair fromSymbolString(final String symbolString) {
for (final BitfinexCurrencyPair currency : BitfinexCurrencyPair.values()) {
if (currency.toBitfinexString().equalsIgnoreCase(symbolString)) {
return currency;
}
}
throw new IllegalArgumentException("Unable to find currency ... | [
"public",
"static",
"BitfinexCurrencyPair",
"fromSymbolString",
"(",
"final",
"String",
"symbolString",
")",
"{",
"for",
"(",
"final",
"BitfinexCurrencyPair",
"currency",
":",
"BitfinexCurrencyPair",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"currency",
".",
... | Construct from string
@param symbolString
@return | [
"Construct",
"from",
"string"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/entity/currency/BitfinexCurrencyPair.java#L187-L194 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java | BiConsumerCallbackManager.registerCallback | public void registerCallback(final S symbol, final BiConsumer<S, T> callback) throws BitfinexClientException {
final List<BiConsumer<S, T>> callbackList
= callbacks.computeIfAbsent(symbol, (k) -> new CopyOnWriteArrayList<>());
callbackList.add(callback);
} | java | public void registerCallback(final S symbol, final BiConsumer<S, T> callback) throws BitfinexClientException {
final List<BiConsumer<S, T>> callbackList
= callbacks.computeIfAbsent(symbol, (k) -> new CopyOnWriteArrayList<>());
callbackList.add(callback);
} | [
"public",
"void",
"registerCallback",
"(",
"final",
"S",
"symbol",
",",
"final",
"BiConsumer",
"<",
"S",
",",
"T",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"final",
"List",
"<",
"BiConsumer",
"<",
"S",
",",
"T",
">",
">",
"callbackLi... | Register a new callback
@param symbol
@param callback
@throws BitfinexClientException | [
"Register",
"a",
"new",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java#L51-L55 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java | BiConsumerCallbackManager.removeCallback | public boolean removeCallback(final S symbol, final BiConsumer<S, T> callback) throws BitfinexClientException {
final List<BiConsumer<S, T>> callbackList = callbacks.get(symbol);
if(callbackList == null) {
throw new BitfinexClientException("Unknown ticker string: " + symbol);
}
return callbackList.... | java | public boolean removeCallback(final S symbol, final BiConsumer<S, T> callback) throws BitfinexClientException {
final List<BiConsumer<S, T>> callbackList = callbacks.get(symbol);
if(callbackList == null) {
throw new BitfinexClientException("Unknown ticker string: " + symbol);
}
return callbackList.... | [
"public",
"boolean",
"removeCallback",
"(",
"final",
"S",
"symbol",
",",
"final",
"BiConsumer",
"<",
"S",
",",
"T",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"final",
"List",
"<",
"BiConsumer",
"<",
"S",
",",
"T",
">",
">",
"callbackL... | Remove the a callback
@param symbol
@param callback
@return
@throws BitfinexClientException | [
"Remove",
"the",
"a",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java#L64-L73 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java | BiConsumerCallbackManager.handleEventsCollection | public void handleEventsCollection(final S symbol, final Collection<T> elements) {
final List<BiConsumer<S, T>> callbackList = callbacks.get(symbol);
if(callbackList == null) {
return;
}
if(callbackList.isEmpty()) {
return;
}
// Notify callbacks synchronously, to preserve the order of ev... | java | public void handleEventsCollection(final S symbol, final Collection<T> elements) {
final List<BiConsumer<S, T>> callbackList = callbacks.get(symbol);
if(callbackList == null) {
return;
}
if(callbackList.isEmpty()) {
return;
}
// Notify callbacks synchronously, to preserve the order of ev... | [
"public",
"void",
"handleEventsCollection",
"(",
"final",
"S",
"symbol",
",",
"final",
"Collection",
"<",
"T",
">",
"elements",
")",
"{",
"final",
"List",
"<",
"BiConsumer",
"<",
"S",
",",
"T",
">",
">",
"callbackList",
"=",
"callbacks",
".",
"get",
"(",... | Process a list with event
@param symbol
@param ticksArray | [
"Process",
"a",
"list",
"with",
"event"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/BiConsumerCallbackManager.java#L80-L97 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/util/BitfinexCurrencyFactory.java | BitfinexCurrencyFactory.build | public static BitfinexInstrument build(final String symbolString) {
if(symbolString.startsWith("t")) {
return BitfinexCurrencyPair.fromSymbolString(symbolString);
} else if(symbolString.startsWith("f")) {
return BitfinexFundingCurrency.fromSymbolString(symbolString);
} else {
throw new IllegalArgument... | java | public static BitfinexInstrument build(final String symbolString) {
if(symbolString.startsWith("t")) {
return BitfinexCurrencyPair.fromSymbolString(symbolString);
} else if(symbolString.startsWith("f")) {
return BitfinexFundingCurrency.fromSymbolString(symbolString);
} else {
throw new IllegalArgument... | [
"public",
"static",
"BitfinexInstrument",
"build",
"(",
"final",
"String",
"symbolString",
")",
"{",
"if",
"(",
"symbolString",
".",
"startsWith",
"(",
"\"t\"",
")",
")",
"{",
"return",
"BitfinexCurrencyPair",
".",
"fromSymbolString",
"(",
"symbolString",
")",
"... | Build the bitfinex currency from sybol string
@param symbolString
@return | [
"Build",
"the",
"bitfinex",
"currency",
"from",
"sybol",
"string"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/util/BitfinexCurrencyFactory.java#L31-L40 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/OrderbookManager.java | OrderbookManager.registerOrderbookCallback | public void registerOrderbookCallback(final BitfinexOrderBookSymbol orderbookConfiguration,
final BiConsumer<BitfinexOrderBookSymbol, BitfinexOrderBookEntry> callback) throws BitfinexClientException {
channelCallbacks.registerCallback(orderbookConfiguration, callback);
} | java | public void registerOrderbookCallback(final BitfinexOrderBookSymbol orderbookConfiguration,
final BiConsumer<BitfinexOrderBookSymbol, BitfinexOrderBookEntry> callback) throws BitfinexClientException {
channelCallbacks.registerCallback(orderbookConfiguration, callback);
} | [
"public",
"void",
"registerOrderbookCallback",
"(",
"final",
"BitfinexOrderBookSymbol",
"orderbookConfiguration",
",",
"final",
"BiConsumer",
"<",
"BitfinexOrderBookSymbol",
",",
"BitfinexOrderBookEntry",
">",
"callback",
")",
"throws",
"BitfinexClientException",
"{",
"channe... | Register a new trading orderbook callback
@throws BitfinexClientException | [
"Register",
"a",
"new",
"trading",
"orderbook",
"callback"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/OrderbookManager.java#L49-L53 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/WebsocketClientEndpoint.java | WebsocketClientEndpoint.connect | public void connect() throws DeploymentException, IOException, InterruptedException {
final WebSocketContainer container = ContainerProvider.getWebSocketContainer();
connectLatch = new CountDownLatch(1);
this.userSession = container.connectToServer(this, endpointURI);
connectLatch.await(15, TimeUnit.SECONDS);
... | java | public void connect() throws DeploymentException, IOException, InterruptedException {
final WebSocketContainer container = ContainerProvider.getWebSocketContainer();
connectLatch = new CountDownLatch(1);
this.userSession = container.connectToServer(this, endpointURI);
connectLatch.await(15, TimeUnit.SECONDS);
... | [
"public",
"void",
"connect",
"(",
")",
"throws",
"DeploymentException",
",",
"IOException",
",",
"InterruptedException",
"{",
"final",
"WebSocketContainer",
"container",
"=",
"ContainerProvider",
".",
"getWebSocketContainer",
"(",
")",
";",
"connectLatch",
"=",
"new",... | Open a new connection and wait until connection is ready
@throws DeploymentException
@throws IOException
@throws InterruptedException | [
"Open",
"a",
"new",
"connection",
"and",
"wait",
"until",
"connection",
"is",
"ready"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/WebsocketClientEndpoint.java#L95-L100 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/WebsocketClientEndpoint.java | WebsocketClientEndpoint.sendMessage | public void sendMessage(final String message) {
if(userSession == null) {
logger.error("Unable to send message, user session is null");
return;
}
if(userSession.getAsyncRemote() == null) {
logger.error("Unable to send message, async remote is null");
return;
}
userSession.getAsyncRemote().sendText... | java | public void sendMessage(final String message) {
if(userSession == null) {
logger.error("Unable to send message, user session is null");
return;
}
if(userSession.getAsyncRemote() == null) {
logger.error("Unable to send message, async remote is null");
return;
}
userSession.getAsyncRemote().sendText... | [
"public",
"void",
"sendMessage",
"(",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"userSession",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unable to send message, user session is null\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"userSessi... | Send a new message to the server
@param message | [
"Send",
"a",
"new",
"message",
"to",
"the",
"server"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/WebsocketClientEndpoint.java#L131-L141 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java | SequenceNumberAuditor.auditPackage | public void auditPackage(final JSONArray jsonArray) {
final long channelId = jsonArray.getInt(0);
final boolean isHeartbeat = jsonArray.optString(1, "").equals("hb");
// Channel 0 uses the private and public sequence, other channels use only the public sequence
// An exception is heartbeat of channel 0, in... | java | public void auditPackage(final JSONArray jsonArray) {
final long channelId = jsonArray.getInt(0);
final boolean isHeartbeat = jsonArray.optString(1, "").equals("hb");
// Channel 0 uses the private and public sequence, other channels use only the public sequence
// An exception is heartbeat of channel 0, in... | [
"public",
"void",
"auditPackage",
"(",
"final",
"JSONArray",
"jsonArray",
")",
"{",
"final",
"long",
"channelId",
"=",
"jsonArray",
".",
"getInt",
"(",
"0",
")",
";",
"final",
"boolean",
"isHeartbeat",
"=",
"jsonArray",
".",
"optString",
"(",
"1",
",",
"\"... | Audit the package
@param jsonArray | [
"Audit",
"the",
"package"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java#L75-L90 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java | SequenceNumberAuditor.checkPublicAndPrivateSequence | private void checkPublicAndPrivateSequence(final JSONArray jsonArray) {
final long nextPublicSequnceNumber = jsonArray.getLong(jsonArray.length() - 2);
final long nextPrivateSequnceNumber = jsonArray.getLong(jsonArray.length() - 1);
auditPublicSequence(nextPublicSequnceNumber);
auditPrivateSequence(nextPrivate... | java | private void checkPublicAndPrivateSequence(final JSONArray jsonArray) {
final long nextPublicSequnceNumber = jsonArray.getLong(jsonArray.length() - 2);
final long nextPrivateSequnceNumber = jsonArray.getLong(jsonArray.length() - 1);
auditPublicSequence(nextPublicSequnceNumber);
auditPrivateSequence(nextPrivate... | [
"private",
"void",
"checkPublicAndPrivateSequence",
"(",
"final",
"JSONArray",
"jsonArray",
")",
"{",
"final",
"long",
"nextPublicSequnceNumber",
"=",
"jsonArray",
".",
"getLong",
"(",
"jsonArray",
".",
"length",
"(",
")",
"-",
"2",
")",
";",
"final",
"long",
... | Check the public and the private sequence
@param jsonArray | [
"Check",
"the",
"public",
"and",
"the",
"private",
"sequence"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java#L96-L102 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java | SequenceNumberAuditor.checkPublicSequence | private void checkPublicSequence(final JSONArray jsonArray) {
final long nextPublicSequnceNumber = jsonArray.getLong(jsonArray.length() - 1);
auditPublicSequence(nextPublicSequnceNumber);
} | java | private void checkPublicSequence(final JSONArray jsonArray) {
final long nextPublicSequnceNumber = jsonArray.getLong(jsonArray.length() - 1);
auditPublicSequence(nextPublicSequnceNumber);
} | [
"private",
"void",
"checkPublicSequence",
"(",
"final",
"JSONArray",
"jsonArray",
")",
"{",
"final",
"long",
"nextPublicSequnceNumber",
"=",
"jsonArray",
".",
"getLong",
"(",
"jsonArray",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"auditPublicSequence",
"(",
... | Check the public sequence | [
"Check",
"the",
"public",
"sequence"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java#L107-L111 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java | SequenceNumberAuditor.auditPublicSequence | private void auditPublicSequence(final long nextPublicSequnceNumber) {
if(publicSequence == -1) {
publicSequence = nextPublicSequnceNumber;
return;
}
if(publicSequence + 1 != nextPublicSequnceNumber) {
final String errorMessage = String.format(
"Got %d as next public sequence number, expected %d"... | java | private void auditPublicSequence(final long nextPublicSequnceNumber) {
if(publicSequence == -1) {
publicSequence = nextPublicSequnceNumber;
return;
}
if(publicSequence + 1 != nextPublicSequnceNumber) {
final String errorMessage = String.format(
"Got %d as next public sequence number, expected %d"... | [
"private",
"void",
"auditPublicSequence",
"(",
"final",
"long",
"nextPublicSequnceNumber",
")",
"{",
"if",
"(",
"publicSequence",
"==",
"-",
"1",
")",
"{",
"publicSequence",
"=",
"nextPublicSequnceNumber",
";",
"return",
";",
"}",
"if",
"(",
"publicSequence",
"+... | Audit the public sequence
@param nextPublicSequnceNumber | [
"Audit",
"the",
"public",
"sequence"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java#L118-L134 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java | SequenceNumberAuditor.auditPrivateSequence | private void auditPrivateSequence(final long nextPrivateSequnceNumber) {
if(privateSequence == -1) {
privateSequence = nextPrivateSequnceNumber;
return;
}
if(privateSequence + 1 != nextPrivateSequnceNumber) {
final String errorMessage = String.format(
"Got %d as next private sequence number, expe... | java | private void auditPrivateSequence(final long nextPrivateSequnceNumber) {
if(privateSequence == -1) {
privateSequence = nextPrivateSequnceNumber;
return;
}
if(privateSequence + 1 != nextPrivateSequnceNumber) {
final String errorMessage = String.format(
"Got %d as next private sequence number, expe... | [
"private",
"void",
"auditPrivateSequence",
"(",
"final",
"long",
"nextPrivateSequnceNumber",
")",
"{",
"if",
"(",
"privateSequence",
"==",
"-",
"1",
")",
"{",
"privateSequence",
"=",
"nextPrivateSequnceNumber",
";",
"return",
";",
"}",
"if",
"(",
"privateSequence"... | Audit the private sequence
@param nextPublicSequnceNumber | [
"Audit",
"the",
"private",
"sequence"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java#L141-L157 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java | SequenceNumberAuditor.handleError | private void handleError(final String errorMessage) {
failed = true;
switch (errorPolicy) {
case LOG_ONLY:
logger.error(errorMessage);
break;
case RUNTIME_EXCEPTION:
throw new RuntimeException(errorMessage);
default:
logger.error("Got error {} but unkown error policy {}", errorMessage, ... | java | private void handleError(final String errorMessage) {
failed = true;
switch (errorPolicy) {
case LOG_ONLY:
logger.error(errorMessage);
break;
case RUNTIME_EXCEPTION:
throw new RuntimeException(errorMessage);
default:
logger.error("Got error {} but unkown error policy {}", errorMessage, ... | [
"private",
"void",
"handleError",
"(",
"final",
"String",
"errorMessage",
")",
"{",
"failed",
"=",
"true",
";",
"switch",
"(",
"errorPolicy",
")",
"{",
"case",
"LOG_ONLY",
":",
"logger",
".",
"error",
"(",
"errorMessage",
")",
";",
"break",
";",
"case",
... | Handle the sequence number error
@param errorMessage | [
"Handle",
"the",
"sequence",
"number",
"error"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SequenceNumberAuditor.java#L163-L179 | train |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexOrderBookSymbol.java | BitfinexOrderBookSymbol.fromJSON | public static BitfinexOrderBookSymbol fromJSON(final JSONObject jsonObject) {
BitfinexCurrencyPair symbol = BitfinexCurrencyPair.fromSymbolString(jsonObject.getString("symbol"));
Precision prec = Precision.valueOf(jsonObject.getString("prec"));
Frequency freq = null;
Integer len = null;
if (prec != Precision.... | java | public static BitfinexOrderBookSymbol fromJSON(final JSONObject jsonObject) {
BitfinexCurrencyPair symbol = BitfinexCurrencyPair.fromSymbolString(jsonObject.getString("symbol"));
Precision prec = Precision.valueOf(jsonObject.getString("prec"));
Frequency freq = null;
Integer len = null;
if (prec != Precision.... | [
"public",
"static",
"BitfinexOrderBookSymbol",
"fromJSON",
"(",
"final",
"JSONObject",
"jsonObject",
")",
"{",
"BitfinexCurrencyPair",
"symbol",
"=",
"BitfinexCurrencyPair",
".",
"fromSymbolString",
"(",
"jsonObject",
".",
"getString",
"(",
"\"symbol\"",
")",
")",
";"... | Build from JSON Array
@param jsonObject
@return | [
"Build",
"from",
"JSON",
"Array"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexOrderBookSymbol.java#L130-L140 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/Smbios.java | Smbios.records | public static LocalCall<List<Record>> records(RecordType type) {
Map<String, Object> args = new LinkedHashMap<>();
if (type != null) {
args.put("rec_type", type.getType());
}
args.put("clean", false);
return new LocalCall<>("smbios.records", Optional.empty(), Optional... | java | public static LocalCall<List<Record>> records(RecordType type) {
Map<String, Object> args = new LinkedHashMap<>();
if (type != null) {
args.put("rec_type", type.getType());
}
args.put("clean", false);
return new LocalCall<>("smbios.records", Optional.empty(), Optional... | [
"public",
"static",
"LocalCall",
"<",
"List",
"<",
"Record",
">",
">",
"records",
"(",
"RecordType",
"type",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null"... | smbios.records
@param type the type of the record to get or null to get all records
@return The {@link LocalCall} to use for getting the record(s) | [
"smbios",
".",
"records"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/Smbios.java#L127-L135 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/Config.java | Config.get | public static LocalCall<String> get(String key) {
return new LocalCall<>(
"config.get",
Optional.of(Arrays.asList(key)),
Optional.empty(),
new TypeToken<String>() { });
} | java | public static LocalCall<String> get(String key) {
return new LocalCall<>(
"config.get",
Optional.of(Arrays.asList(key)),
Optional.empty(),
new TypeToken<String>() { });
} | [
"public",
"static",
"LocalCall",
"<",
"String",
">",
"get",
"(",
"String",
"key",
")",
"{",
"return",
"new",
"LocalCall",
"<>",
"(",
"\"config.get\"",
",",
"Optional",
".",
"of",
"(",
"Arrays",
".",
"asList",
"(",
"key",
")",
")",
",",
"Optional",
".",... | Returns a configuration parameter.
@param key the parameter name
@return the {@link LocalCall} object to make the call | [
"Returns",
"a",
"configuration",
"parameter",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/Config.java#L24-L30 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/utils/ClientUtils.java | ClientUtils.parameterizedType | public static ParameterizedType parameterizedType(Type ownerType, Type rawType,
Type... typeArguments) {
return newParameterizedTypeWithOwner(ownerType, rawType, typeArguments);
} | java | public static ParameterizedType parameterizedType(Type ownerType, Type rawType,
Type... typeArguments) {
return newParameterizedTypeWithOwner(ownerType, rawType, typeArguments);
} | [
"public",
"static",
"ParameterizedType",
"parameterizedType",
"(",
"Type",
"ownerType",
",",
"Type",
"rawType",
",",
"Type",
"...",
"typeArguments",
")",
"{",
"return",
"newParameterizedTypeWithOwner",
"(",
"ownerType",
",",
"rawType",
",",
"typeArguments",
")",
";"... | Helper for constructing parameterized types.
@param ownerType the owner type
@param rawType the raw type
@param typeArguments the type arguments
@return the parameterized type object
@see com.google.gson.internal.$Gson$Types#newParameterizedTypeWithOwner | [
"Helper",
"for",
"constructing",
"parameterized",
"types",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/utils/ClientUtils.java#L66-L69 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/WheelCall.java | WheelCall.callAsync | public CompletionStage<WheelAsyncResult<R>> callAsync(final SaltClient client, AuthMethod auth) {
return client.call(
this, Client.WHEEL_ASYNC, Optional.empty(), Collections.emptyMap(),
new TypeToken<Return<List<WheelAsyncResult<R>>>>(){}, auth)
.thenApply(wrapper... | java | public CompletionStage<WheelAsyncResult<R>> callAsync(final SaltClient client, AuthMethod auth) {
return client.call(
this, Client.WHEEL_ASYNC, Optional.empty(), Collections.emptyMap(),
new TypeToken<Return<List<WheelAsyncResult<R>>>>(){}, auth)
.thenApply(wrapper... | [
"public",
"CompletionStage",
"<",
"WheelAsyncResult",
"<",
"R",
">",
">",
"callAsync",
"(",
"final",
"SaltClient",
"client",
",",
"AuthMethod",
"auth",
")",
"{",
"return",
"client",
".",
"call",
"(",
"this",
",",
"Client",
".",
"WHEEL_ASYNC",
",",
"Optional"... | Calls a wheel module function on the master asynchronously and
returns information about the scheduled job that can be used to query the result.
Authentication is done with the token therefore you have to login prior
to using this function.
@param client SaltClient instance
@param auth authentication credentials to us... | [
"Calls",
"a",
"wheel",
"module",
"function",
"on",
"the",
"master",
"asynchronously",
"and",
"returns",
"information",
"about",
"the",
"scheduled",
"job",
"that",
"can",
"be",
"used",
"to",
"query",
"the",
"result",
".",
"Authentication",
"is",
"done",
"with",... | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/WheelCall.java#L55-L64 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/WheelCall.java | WheelCall.callSync | public CompletionStage<WheelResult<Result<R>>> callSync(final SaltClient client, AuthMethod auth) {
Type xor = parameterizedType(null, Result.class, getReturnType().getType());
Type wheelResult = parameterizedType(null, WheelResult.class, xor);
Type listType = parameterizedType(null, List.class,... | java | public CompletionStage<WheelResult<Result<R>>> callSync(final SaltClient client, AuthMethod auth) {
Type xor = parameterizedType(null, Result.class, getReturnType().getType());
Type wheelResult = parameterizedType(null, WheelResult.class, xor);
Type listType = parameterizedType(null, List.class,... | [
"public",
"CompletionStage",
"<",
"WheelResult",
"<",
"Result",
"<",
"R",
">",
">",
">",
"callSync",
"(",
"final",
"SaltClient",
"client",
",",
"AuthMethod",
"auth",
")",
"{",
"Type",
"xor",
"=",
"parameterizedType",
"(",
"null",
",",
"Result",
".",
"class... | Calls a wheel module function on the master and synchronously
waits for the result. Authentication is done with the token therefore you
have to login prior to using this function.
@param client SaltClient instance
@param auth authentication credentials to use
@return the result of the called function | [
"Calls",
"a",
"wheel",
"module",
"function",
"on",
"the",
"master",
"and",
"synchronously",
"waits",
"for",
"the",
"result",
".",
"Authentication",
"is",
"done",
"with",
"the",
"token",
"therefore",
"you",
"have",
"to",
"login",
"prior",
"to",
"using",
"this... | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/WheelCall.java#L75-L88 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/SaltSSHUtils.java | SaltSSHUtils.mapConfigPropsToArgs | public static void mapConfigPropsToArgs(SaltSSHConfig cfg, Map<String, Object> props) {
cfg.getExtraFilerefs().ifPresent(v -> props.put("extra_filerefs", v));
cfg.getIdentitiesOnly().ifPresent(v -> props.put("ssh_identities_only", v));
cfg.getIgnoreHostKeys().ifPresent(v -> props.put("ignore_hos... | java | public static void mapConfigPropsToArgs(SaltSSHConfig cfg, Map<String, Object> props) {
cfg.getExtraFilerefs().ifPresent(v -> props.put("extra_filerefs", v));
cfg.getIdentitiesOnly().ifPresent(v -> props.put("ssh_identities_only", v));
cfg.getIgnoreHostKeys().ifPresent(v -> props.put("ignore_hos... | [
"public",
"static",
"void",
"mapConfigPropsToArgs",
"(",
"SaltSSHConfig",
"cfg",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"cfg",
".",
"getExtraFilerefs",
"(",
")",
".",
"ifPresent",
"(",
"v",
"->",
"props",
".",
"put",
"(",
"\"ex... | Maps config parameters to salt-ssh rest arguments
@param cfg SSH configuration to read values to be converted
@param props properties to be set when rest calling | [
"Maps",
"config",
"parameters",
"to",
"salt",
"-",
"ssh",
"rest",
"arguments"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/SaltSSHUtils.java#L15-L35 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/event/WebSocketEventStream.java | WebSocketEventStream.onMessage | @OnMessage
public void onMessage(String partialMessage, boolean last)
throws MessageTooBigException {
if (partialMessage.length() > maxMessageLength - messageBuffer.length()) {
throw new MessageTooBigException(maxMessageLength);
}
if (last) {
String messa... | java | @OnMessage
public void onMessage(String partialMessage, boolean last)
throws MessageTooBigException {
if (partialMessage.length() > maxMessageLength - messageBuffer.length()) {
throw new MessageTooBigException(maxMessageLength);
}
if (last) {
String messa... | [
"@",
"OnMessage",
"public",
"void",
"onMessage",
"(",
"String",
"partialMessage",
",",
"boolean",
"last",
")",
"throws",
"MessageTooBigException",
"{",
"if",
"(",
"partialMessage",
".",
"length",
"(",
")",
">",
"maxMessageLength",
"-",
"messageBuffer",
".",
"len... | Notify listeners on each event received on the websocket and buffer partial messages.
@param partialMessage partial message received on this websocket
@param last indicate the last part of a message
@throws MessageTooBigException in case the message is longer than maxMessageLength | [
"Notify",
"listeners",
"on",
"each",
"event",
"received",
"on",
"the",
"websocket",
"and",
"buffer",
"partial",
"messages",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/WebSocketEventStream.java#L157-L187 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/event/WebSocketEventStream.java | WebSocketEventStream.onClose | @OnClose
public void onClose(Session session, CloseReason closeReason) {
this.session = session;
clearListeners(closeReason.getCloseCode().getCode(), closeReason.getReasonPhrase());
} | java | @OnClose
public void onClose(Session session, CloseReason closeReason) {
this.session = session;
clearListeners(closeReason.getCloseCode().getCode(), closeReason.getReasonPhrase());
} | [
"@",
"OnClose",
"public",
"void",
"onClose",
"(",
"Session",
"session",
",",
"CloseReason",
"closeReason",
")",
"{",
"this",
".",
"session",
"=",
"session",
";",
"clearListeners",
"(",
"closeReason",
".",
"getCloseCode",
"(",
")",
".",
"getCode",
"(",
")",
... | On closing the websocket, refresh the session and notify all subscribed listeners.
Upon exit from this method, all subscribed listeners will be removed.
@param session the websocket {@link Session}
@param closeReason the {@link CloseReason} for the websocket closure | [
"On",
"closing",
"the",
"websocket",
"refresh",
"the",
"session",
"and",
"notify",
"all",
"subscribed",
"listeners",
".",
"Upon",
"exit",
"from",
"this",
"method",
"all",
"subscribed",
"listeners",
"will",
"be",
"removed",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/WebSocketEventStream.java#L208-L213 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/ArgumentsAdapter.java | ArgumentsAdapter.readObjectArgument | private Map<String, Object> readObjectArgument(JsonReader jsonReader)
throws IOException {
Map<String, Object> arg = new LinkedHashMap<>();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
arg.put(jsonReader.nextName(),
JsonParser.GSON.fromJson... | java | private Map<String, Object> readObjectArgument(JsonReader jsonReader)
throws IOException {
Map<String, Object> arg = new LinkedHashMap<>();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
arg.put(jsonReader.nextName(),
JsonParser.GSON.fromJson... | [
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"readObjectArgument",
"(",
"JsonReader",
"jsonReader",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"arg",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"jsonReader",
... | Reads a generic object argument from the given JsonReader.
@param jsonReader JsonReader expecting an object next
@return Map representing a generic object argument | [
"Reads",
"a",
"generic",
"object",
"argument",
"from",
"the",
"given",
"JsonReader",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/ArgumentsAdapter.java#L58-L68 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/event/BeaconEvent.java | BeaconEvent.getData | public <R> R getData(TypeToken<R> type) {
return GSON.fromJson(data, type.getType());
} | java | public <R> R getData(TypeToken<R> type) {
return GSON.fromJson(data, type.getType());
} | [
"public",
"<",
"R",
">",
"R",
"getData",
"(",
"TypeToken",
"<",
"R",
">",
"type",
")",
"{",
"return",
"GSON",
".",
"fromJson",
"(",
"data",
",",
"type",
".",
"getType",
"(",
")",
")",
";",
"}"
] | Return the event data parsed into the given type.
@param type type token to parse data
@param <R> type to parse the data into
@return the event data | [
"Return",
"the",
"event",
"data",
"parsed",
"into",
"the",
"given",
"type",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/BeaconEvent.java#L76-L78 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/event/BeaconEvent.java | BeaconEvent.getData | public Map<String, Object> getData() {
TypeToken<Map<String, Object>> typeToken = new TypeToken<Map<String, Object>>() {};
return getData(typeToken);
} | java | public Map<String, Object> getData() {
TypeToken<Map<String, Object>> typeToken = new TypeToken<Map<String, Object>>() {};
return getData(typeToken);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getData",
"(",
")",
"{",
"TypeToken",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"typeToken",
"=",
"new",
"TypeToken",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"(",
")",
"{",
... | Return event data as Map
@return event data as map | [
"Return",
"event",
"data",
"as",
"Map"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/BeaconEvent.java#L95-L98 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/Schedule.java | Schedule.add | public static LocalCall<Result> add(String name, LocalCall<?> call,
LocalDateTime once, Map<String, ?> metadata) {
LinkedHashMap<String, Object> args = new LinkedHashMap<>();
Map<String, Object> payload = call.getPayload();
args.put("function", payload.get("fun"));
args.put("... | java | public static LocalCall<Result> add(String name, LocalCall<?> call,
LocalDateTime once, Map<String, ?> metadata) {
LinkedHashMap<String, Object> args = new LinkedHashMap<>();
Map<String, Object> payload = call.getPayload();
args.put("function", payload.get("fun"));
args.put("... | [
"public",
"static",
"LocalCall",
"<",
"Result",
">",
"add",
"(",
"String",
"name",
",",
"LocalCall",
"<",
"?",
">",
"call",
",",
"LocalDateTime",
"once",
",",
"Map",
"<",
"String",
",",
"?",
">",
"metadata",
")",
"{",
"LinkedHashMap",
"<",
"String",
",... | Schedule a salt call for later execution on the minion
@param name job name
@param call salt call schedule
@param once when to execute it once
@param metadata additional metadata
@return call object to execute via the client | [
"Schedule",
"a",
"salt",
"call",
"for",
"later",
"execution",
"on",
"the",
"minion"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/Schedule.java#L77-L90 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/XorTypeAdapterFactory.java | XorTypeAdapterFactory.xorAdapter | private <L, R> TypeAdapter<Xor<L, R>> xorAdapter(TypeAdapter<L> leftAdapter,
TypeAdapter<R> rightAdapter) {
return new TypeAdapter<Xor<L, R>>() {
@Override
public Xor<L, R> read(JsonReader in) throws IOException {
JsonElement json = TypeAdapters.JSON_ELEMENT.r... | java | private <L, R> TypeAdapter<Xor<L, R>> xorAdapter(TypeAdapter<L> leftAdapter,
TypeAdapter<R> rightAdapter) {
return new TypeAdapter<Xor<L, R>>() {
@Override
public Xor<L, R> read(JsonReader in) throws IOException {
JsonElement json = TypeAdapters.JSON_ELEMENT.r... | [
"private",
"<",
"L",
",",
"R",
">",
"TypeAdapter",
"<",
"Xor",
"<",
"L",
",",
"R",
">",
">",
"xorAdapter",
"(",
"TypeAdapter",
"<",
"L",
">",
"leftAdapter",
",",
"TypeAdapter",
"<",
"R",
">",
"rightAdapter",
")",
"{",
"return",
"new",
"TypeAdapter",
... | Creates a generic Xor adapter by combining two other adapters - one for each side of
the Xor type. It will first try to parse incoming JSON data as the right type and, if
that does not succeed, it will try again with the left type.
All exceptions besides the possible parsing Exception of the left type are not
caught.
... | [
"Creates",
"a",
"generic",
"Xor",
"adapter",
"by",
"combining",
"two",
"other",
"adapters",
"-",
"one",
"for",
"each",
"side",
"of",
"the",
"Xor",
"type",
".",
"It",
"will",
"first",
"try",
"to",
"parse",
"incoming",
"JSON",
"data",
"as",
"the",
"right",... | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/XorTypeAdapterFactory.java#L70-L90 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/XorTypeAdapterFactory.java | XorTypeAdapterFactory.errorAdapter | private <R> TypeAdapter<Xor<SaltError, R>> errorAdapter(TypeAdapter<R> innerAdapter) {
return new TypeAdapter<Xor<SaltError, R>>() {
@Override
public Xor<SaltError, R> read(JsonReader in) throws IOException {
JsonElement json = TypeAdapters.JSON_ELEMENT.read(in);
... | java | private <R> TypeAdapter<Xor<SaltError, R>> errorAdapter(TypeAdapter<R> innerAdapter) {
return new TypeAdapter<Xor<SaltError, R>>() {
@Override
public Xor<SaltError, R> read(JsonReader in) throws IOException {
JsonElement json = TypeAdapters.JSON_ELEMENT.read(in);
... | [
"private",
"<",
"R",
">",
"TypeAdapter",
"<",
"Xor",
"<",
"SaltError",
",",
"R",
">",
">",
"errorAdapter",
"(",
"TypeAdapter",
"<",
"R",
">",
"innerAdapter",
")",
"{",
"return",
"new",
"TypeAdapter",
"<",
"Xor",
"<",
"SaltError",
",",
"R",
">",
">",
... | Creates a Xor adapter specifically for the case in which the left side is a
SaltError. This is used to catch any Salt-side or JSON parsing errors.
@param <R> the generic type for the right side of the Xor
@param innerAdapter the inner adapter
@return the Xor type adapter | [
"Creates",
"a",
"Xor",
"adapter",
"specifically",
"for",
"the",
"case",
"in",
"which",
"the",
"left",
"side",
"is",
"a",
"SaltError",
".",
"This",
"is",
"used",
"to",
"catch",
"any",
"Salt",
"-",
"side",
"or",
"JSON",
"parsing",
"errors",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/XorTypeAdapterFactory.java#L100-L127 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java | HttpAsyncClientImpl.request | private <T> CompletionStage<T> request(URI uri, Map<String, String> headers, String data, JsonParser<T> parser) {
return executeRequest(httpClient, prepareRequest(uri, headers, data), parser);
} | java | private <T> CompletionStage<T> request(URI uri, Map<String, String> headers, String data, JsonParser<T> parser) {
return executeRequest(httpClient, prepareRequest(uri, headers, data), parser);
} | [
"private",
"<",
"T",
">",
"CompletionStage",
"<",
"T",
">",
"request",
"(",
"URI",
"uri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"data",
",",
"JsonParser",
"<",
"T",
">",
"parser",
")",
"{",
"return",
"executeRequest",... | Perform HTTP request and parse the result into a given result type.
@param data the data to send with the request
@return CompletionStage holding object of type T | [
"Perform",
"HTTP",
"request",
"and",
"parse",
"the",
"result",
"into",
"a",
"given",
"result",
"type",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java#L63-L65 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java | HttpAsyncClientImpl.prepareRequest | private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) {
HttpUriRequest httpRequest;
if (jsonData != null) {
// POST data
HttpPost httpPost = new HttpPost(uri);
httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICA... | java | private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) {
HttpUriRequest httpRequest;
if (jsonData != null) {
// POST data
HttpPost httpPost = new HttpPost(uri);
httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICA... | [
"private",
"<",
"T",
">",
"HttpUriRequest",
"prepareRequest",
"(",
"URI",
"uri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"jsonData",
")",
"{",
"HttpUriRequest",
"httpRequest",
";",
"if",
"(",
"jsonData",
"!=",
"null",
")",
... | Prepares the HTTP request object creating a POST or GET request depending on if data
is supplied or not.
@param jsonData json POST data, will use GET if null
@return HttpUriRequest object the prepared request | [
"Prepares",
"the",
"HTTP",
"request",
"object",
"creating",
"a",
"POST",
"or",
"GET",
"request",
"depending",
"on",
"if",
"data",
"is",
"supplied",
"or",
"not",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java#L74-L89 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java | HttpAsyncClientImpl.executeRequest | private <T> CompletionStage<T> executeRequest(HttpAsyncClient httpClient,
HttpUriRequest httpRequest, JsonParser<T> parser) {
CompletableFuture<T> future = new CompletableFuture<>();
httpClient.execute(httpRequest, new FutureCallback<HttpResponse>() {
@Override
public... | java | private <T> CompletionStage<T> executeRequest(HttpAsyncClient httpClient,
HttpUriRequest httpRequest, JsonParser<T> parser) {
CompletableFuture<T> future = new CompletableFuture<>();
httpClient.execute(httpRequest, new FutureCallback<HttpResponse>() {
@Override
public... | [
"private",
"<",
"T",
">",
"CompletionStage",
"<",
"T",
">",
"executeRequest",
"(",
"HttpAsyncClient",
"httpClient",
",",
"HttpUriRequest",
"httpRequest",
",",
"JsonParser",
"<",
"T",
">",
"parser",
")",
"{",
"CompletableFuture",
"<",
"T",
">",
"future",
"=",
... | Executes a prepared HTTP request using the given client.
@param httpClient the client to use for the request
@param httpRequest the prepared request to perform
@return CompletionStage holding object of type T | [
"Executes",
"a",
"prepared",
"HTTP",
"request",
"using",
"the",
"given",
"client",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java#L98-L132 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/datatypes/Event.java | Event.getData | public <R> R getData(TypeToken<R> dataType) {
return GSON.fromJson(data, dataType.getType());
} | java | public <R> R getData(TypeToken<R> dataType) {
return GSON.fromJson(data, dataType.getType());
} | [
"public",
"<",
"R",
">",
"R",
"getData",
"(",
"TypeToken",
"<",
"R",
">",
"dataType",
")",
"{",
"return",
"GSON",
".",
"fromJson",
"(",
"data",
",",
"dataType",
".",
"getType",
"(",
")",
")",
";",
"}"
] | Return this event's data.
@param dataType type token to parse data
@param <R> type to parse the data into
@return the data | [
"Return",
"this",
"event",
"s",
"data",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/datatypes/Event.java#L32-L34 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/datatypes/Event.java | Event.getData | public Map<String, Object> getData() {
TypeToken<Map<String, Object>> typeToken = new TypeToken<Map<String, Object>>() {};
return GSON.fromJson(data, typeToken.getType());
} | java | public Map<String, Object> getData() {
TypeToken<Map<String, Object>> typeToken = new TypeToken<Map<String, Object>>() {};
return GSON.fromJson(data, typeToken.getType());
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getData",
"(",
")",
"{",
"TypeToken",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"typeToken",
"=",
"new",
"TypeToken",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"(",
")",
"{",
... | Return this event's data as a Map
@return the data | [
"Return",
"this",
"event",
"s",
"data",
"as",
"a",
"Map"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/datatypes/Event.java#L50-L53 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.chown | public static LocalCall<String> chown(String path, String user, String group) {
Map<String, String> args = new LinkedHashMap<>();
args.put("path", path);
args.put("user", user);
args.put("group", group);
return new LocalCall<>("file.chown", Optional.empty(),
Optio... | java | public static LocalCall<String> chown(String path, String user, String group) {
Map<String, String> args = new LinkedHashMap<>();
args.put("path", path);
args.put("user", user);
args.put("group", group);
return new LocalCall<>("file.chown", Optional.empty(),
Optio... | [
"public",
"static",
"LocalCall",
"<",
"String",
">",
"chown",
"(",
"String",
"path",
",",
"String",
"user",
",",
"String",
"group",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"args",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"args",
... | Chown a file
@param path Path to the file or directory
@param user User owner
@param group Group owner
@return The {@link LocalCall} object to make the call | [
"Chown",
"a",
"file"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L44-L51 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.chmod | public static LocalCall<String> chmod(String path, String mode) {
return new LocalCall<>("file.set_mode", Optional.of(Arrays.asList(path, mode)),
Optional.empty(), new TypeToken<String>(){});
} | java | public static LocalCall<String> chmod(String path, String mode) {
return new LocalCall<>("file.set_mode", Optional.of(Arrays.asList(path, mode)),
Optional.empty(), new TypeToken<String>(){});
} | [
"public",
"static",
"LocalCall",
"<",
"String",
">",
"chmod",
"(",
"String",
"path",
",",
"String",
"mode",
")",
"{",
"return",
"new",
"LocalCall",
"<>",
"(",
"\"file.set_mode\"",
",",
"Optional",
".",
"of",
"(",
"Arrays",
".",
"asList",
"(",
"path",
","... | Set the mode of a file
@param path File or directory of which to set the mode
@param mode Mode to set the path to
@return The {@link LocalCall} object to make the call | [
"Set",
"the",
"mode",
"of",
"a",
"file"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L60-L63 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.copy | public static LocalCall<Boolean> copy(String src, String dst, boolean recurse,
boolean removeExisting) {
Map<String, Object> args = new LinkedHashMap<>();
args.put("src", src);
args.put("dst", dst);
args.put("recurse", recurse);
args.put("remove_existing", removeExist... | java | public static LocalCall<Boolean> copy(String src, String dst, boolean recurse,
boolean removeExisting) {
Map<String, Object> args = new LinkedHashMap<>();
args.put("src", src);
args.put("dst", dst);
args.put("recurse", recurse);
args.put("remove_existing", removeExist... | [
"public",
"static",
"LocalCall",
"<",
"Boolean",
">",
"copy",
"(",
"String",
"src",
",",
"String",
"dst",
",",
"boolean",
"recurse",
",",
"boolean",
"removeExisting",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"LinkedHashMap",
... | Copy a file or directory from src to dst
@param src File or directory to copy
@param dst Destination path
@param recurse Recurse flag
@param removeExisting If true, all files in the target directory are removed,
and then the files are copied from the source
@return ... | [
"Copy",
"a",
"file",
"or",
"directory",
"from",
"src",
"to",
"dst"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L75-L84 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.move | public static LocalCall<Result> move(String src, String dst) {
Map<String, Object> args = new LinkedHashMap<>();
args.put("src", src);
args.put("dst", dst);
return new LocalCall<>("file.move", Optional.empty(), Optional.of(args),
new TypeToken<Result>(){});
} | java | public static LocalCall<Result> move(String src, String dst) {
Map<String, Object> args = new LinkedHashMap<>();
args.put("src", src);
args.put("dst", dst);
return new LocalCall<>("file.move", Optional.empty(), Optional.of(args),
new TypeToken<Result>(){});
} | [
"public",
"static",
"LocalCall",
"<",
"Result",
">",
"move",
"(",
"String",
"src",
",",
"String",
"dst",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"args",
".",
"put",
"(",
"\"src\"",... | Move a file or directory from src to dst
@param src File or directory to copy
@param dst Destination path
@return The {@link LocalCall} object to make the call | [
"Move",
"a",
"file",
"or",
"directory",
"from",
"src",
"to",
"dst"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L93-L99 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.getHash | public static LocalCall<String> getHash(String path, HashType form) {
return getHash(path, Optional.of(form), Optional.empty());
} | java | public static LocalCall<String> getHash(String path, HashType form) {
return getHash(path, Optional.of(form), Optional.empty());
} | [
"public",
"static",
"LocalCall",
"<",
"String",
">",
"getHash",
"(",
"String",
"path",
",",
"HashType",
"form",
")",
"{",
"return",
"getHash",
"(",
"path",
",",
"Optional",
".",
"of",
"(",
"form",
")",
",",
"Optional",
".",
"empty",
"(",
")",
")",
";... | Get the hash sum of a file
@param path Path to the file or directory
@param form Desired sum format
@return The {@link LocalCall} object to make the call | [
"Get",
"the",
"hash",
"sum",
"of",
"a",
"file"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L131-L133 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.getUid | public static LocalCall<String> getUid(String path, boolean followSymlinks) {
Map<String, Object> args = new LinkedHashMap<>();
args.put("path", path);
args.put("follow_symlinks", followSymlinks);
return new LocalCall<>("file.get_uid", Optional.empty(), Optional.of(args),
... | java | public static LocalCall<String> getUid(String path, boolean followSymlinks) {
Map<String, Object> args = new LinkedHashMap<>();
args.put("path", path);
args.put("follow_symlinks", followSymlinks);
return new LocalCall<>("file.get_uid", Optional.empty(), Optional.of(args),
... | [
"public",
"static",
"LocalCall",
"<",
"String",
">",
"getUid",
"(",
"String",
"path",
",",
"boolean",
"followSymlinks",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"args",
".",
"put",
"(... | Return the id of the user that owns a given file
@param path File or directory of which to get the uid owner
@param followSymlinks Indicated if symlinks should be followed
@return The {@link LocalCall} object to make the call | [
"Return",
"the",
"id",
"of",
"the",
"user",
"that",
"owns",
"a",
"given",
"file"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L211-L217 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/File.java | File.readdir | public static LocalCall<List<String>> readdir(String path) {
return new LocalCall<>("file.readdir", Optional.of(Collections.singletonList(path)),
Optional.empty(), new TypeToken<List<String>>(){});
} | java | public static LocalCall<List<String>> readdir(String path) {
return new LocalCall<>("file.readdir", Optional.of(Collections.singletonList(path)),
Optional.empty(), new TypeToken<List<String>>(){});
} | [
"public",
"static",
"LocalCall",
"<",
"List",
"<",
"String",
">",
">",
"readdir",
"(",
"String",
"path",
")",
"{",
"return",
"new",
"LocalCall",
"<>",
"(",
"\"file.readdir\"",
",",
"Optional",
".",
"of",
"(",
"Collections",
".",
"singletonList",
"(",
"path... | Returns a list containing the contents of a directory
@param path Path to directory
@return The {@link LocalCall} object to make the call | [
"Returns",
"a",
"list",
"containing",
"the",
"contents",
"of",
"a",
"directory"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L304-L307 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/Pkg.java | Pkg.listPkgs | public static LocalCall<Map<String, List<Xor<String, Info>>>> listPkgs(
List<String> attributes) {
LinkedHashMap<String, Object> args = new LinkedHashMap<>();
args.put("attr", attributes);
return new LocalCall<>("pkg.list_pkgs", Optional.empty(), Optional.of(args),
ne... | java | public static LocalCall<Map<String, List<Xor<String, Info>>>> listPkgs(
List<String> attributes) {
LinkedHashMap<String, Object> args = new LinkedHashMap<>();
args.put("attr", attributes);
return new LocalCall<>("pkg.list_pkgs", Optional.empty(), Optional.of(args),
ne... | [
"public",
"static",
"LocalCall",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"Xor",
"<",
"String",
",",
"Info",
">",
">",
">",
">",
"listPkgs",
"(",
"List",
"<",
"String",
">",
"attributes",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"Object",
"... | Call 'pkg.list_pkgs'
@param attributes list of attributes that should be included in the result
@return the call. For each package, the map can contain a String (only the version)
or an Info object containing specified attributes depending on Salt version and
minion support | [
"Call",
"pkg",
".",
"list_pkgs"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/Pkg.java#L235-L241 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/modules/Pkg.java | Pkg.infoInstalledAllVersions | public static LocalCall<Map<String, Xor<Info, List<Info>>>> infoInstalledAllVersions(
List<String> attributes, boolean reportErrors, String... packages) {
LinkedHashMap<String, Object> kwargs = new LinkedHashMap<>();
kwargs.put("attr", attributes.stream().collect(Collectors.joining(",")));
... | java | public static LocalCall<Map<String, Xor<Info, List<Info>>>> infoInstalledAllVersions(
List<String> attributes, boolean reportErrors, String... packages) {
LinkedHashMap<String, Object> kwargs = new LinkedHashMap<>();
kwargs.put("attr", attributes.stream().collect(Collectors.joining(",")));
... | [
"public",
"static",
"LocalCall",
"<",
"Map",
"<",
"String",
",",
"Xor",
"<",
"Info",
",",
"List",
"<",
"Info",
">",
">",
">",
">",
"infoInstalledAllVersions",
"(",
"List",
"<",
"String",
">",
"attributes",
",",
"boolean",
"reportErrors",
",",
"String",
"... | Call 'pkg.info_installed' API.
@param attributes list of attributes that should be included in the result
@param reportErrors if true will return an error message instead of corrupted text
@param packages optional give package names, otherwise return info about all packages
@return the call | [
"Call",
"pkg",
".",
"info_installed",
"API",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/Pkg.java#L270-L280 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/JsonParser.java | JsonParser.parse | public T parse(InputStream inputStream) {
Reader inputStreamReader = new InputStreamReader(inputStream);
Reader streamReader = new BufferedReader(inputStreamReader);
// Parse result type from the returned JSON
return gson.fromJson(streamReader, type.getType());
} | java | public T parse(InputStream inputStream) {
Reader inputStreamReader = new InputStreamReader(inputStream);
Reader streamReader = new BufferedReader(inputStreamReader);
// Parse result type from the returned JSON
return gson.fromJson(streamReader, type.getType());
} | [
"public",
"T",
"parse",
"(",
"InputStream",
"inputStream",
")",
"{",
"Reader",
"inputStreamReader",
"=",
"new",
"InputStreamReader",
"(",
"inputStream",
")",
";",
"Reader",
"streamReader",
"=",
"new",
"BufferedReader",
"(",
"inputStreamReader",
")",
";",
"// Parse... | Parses a Json response that has a direct representation as a Java class.
@param inputStream result stream to parse.
@return The parsed value. | [
"Parses",
"a",
"Json",
"response",
"that",
"has",
"a",
"direct",
"representation",
"as",
"a",
"Java",
"class",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/JsonParser.java#L95-L101 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/utils/HttpClientUtils.java | HttpClientUtils.defaultClient | public static CloseableHttpAsyncClient defaultClient() {
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(0)
.setConnectTimeout(10000)
.setSocketTimeout(20000)
.setCookieSpec(CookieSpecs.STANDARD)
.b... | java | public static CloseableHttpAsyncClient defaultClient() {
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(0)
.setConnectTimeout(10000)
.setSocketTimeout(20000)
.setCookieSpec(CookieSpecs.STANDARD)
.b... | [
"public",
"static",
"CloseableHttpAsyncClient",
"defaultClient",
"(",
")",
"{",
"RequestConfig",
"requestConfig",
"=",
"RequestConfig",
".",
"custom",
"(",
")",
".",
"setConnectionRequestTimeout",
"(",
"0",
")",
".",
"setConnectTimeout",
"(",
"10000",
")",
".",
"s... | Creates a simple default http client
@return HttpAsyncClient | [
"Creates",
"a",
"simple",
"default",
"http",
"client"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/utils/HttpClientUtils.java#L18-L31 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/datatypes/SaltVersion.java | SaltVersion.parse | public static Optional<SaltVersion> parse(String versionString) {
Matcher matcher = SALT_VERSION_REGEX.matcher(versionString);
if (matcher.matches()) {
int year = Integer.parseInt(matcher.group(1));
int month = Integer.parseInt(matcher.group(2));
int bugfix = Integer.... | java | public static Optional<SaltVersion> parse(String versionString) {
Matcher matcher = SALT_VERSION_REGEX.matcher(versionString);
if (matcher.matches()) {
int year = Integer.parseInt(matcher.group(1));
int month = Integer.parseInt(matcher.group(2));
int bugfix = Integer.... | [
"public",
"static",
"Optional",
"<",
"SaltVersion",
">",
"parse",
"(",
"String",
"versionString",
")",
"{",
"Matcher",
"matcher",
"=",
"SALT_VERSION_REGEX",
".",
"matcher",
"(",
"versionString",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
... | Parses a salt version string
@param versionString the salt version string
@return SaltVersion if the versionString is valid or empty Optional if not. | [
"Parses",
"a",
"salt",
"version",
"string"
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/datatypes/SaltVersion.java#L25-L37 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/event/AbstractEventStream.java | AbstractEventStream.clearListeners | protected void clearListeners(int code, String phrase) {
listeners.forEach(listener -> listener.eventStreamClosed(code, phrase));
// Clear out the listeners
listeners.clear();
} | java | protected void clearListeners(int code, String phrase) {
listeners.forEach(listener -> listener.eventStreamClosed(code, phrase));
// Clear out the listeners
listeners.clear();
} | [
"protected",
"void",
"clearListeners",
"(",
"int",
"code",
",",
"String",
"phrase",
")",
"{",
"listeners",
".",
"forEach",
"(",
"listener",
"->",
"listener",
".",
"eventStreamClosed",
"(",
"code",
",",
"phrase",
")",
")",
";",
"// Clear out the listeners",
"li... | Removes all listeners.
@param code an integer code to represent the reason for closing
@param phrase a String representation of code | [
"Removes",
"all",
"listeners",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/AbstractEventStream.java#L74-L79 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/results/Change.java | Change.map | public <R> Change<R> map(Function<T, R> fn) {
return new Change<>(
fn.apply(getOldValue()),
fn.apply(getNewValue())
);
} | java | public <R> Change<R> map(Function<T, R> fn) {
return new Change<>(
fn.apply(getOldValue()),
fn.apply(getNewValue())
);
} | [
"public",
"<",
"R",
">",
"Change",
"<",
"R",
">",
"map",
"(",
"Function",
"<",
"T",
",",
"R",
">",
"fn",
")",
"{",
"return",
"new",
"Change",
"<>",
"(",
"fn",
".",
"apply",
"(",
"getOldValue",
"(",
")",
")",
",",
"fn",
".",
"apply",
"(",
"get... | Applies a mapping function to both the old and the new value, wrapping the result
in a new Change.
@param fn the mapping function
@param <R> type returned by the mapping function
@return a new Change with mapped values | [
"Applies",
"a",
"mapping",
"function",
"to",
"both",
"the",
"old",
"and",
"the",
"new",
"value",
"wrapping",
"the",
"result",
"in",
"a",
"new",
"Change",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/results/Change.java#L53-L58 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callSync | public CompletionStage<Map<String, Result<R>>> callSync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callSyncHelperNonBlock(client, target, auth, Optional.empty())
.thenApply(r -> r.get(0));
} | java | public CompletionStage<Map<String, Result<R>>> callSync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callSyncHelperNonBlock(client, target, auth, Optional.empty())
.thenApply(r -> r.get(0));
} | [
"public",
"CompletionStage",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"R",
">",
">",
">",
"callSync",
"(",
"final",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth",
")",
"{",
"return",
"callSyncHelperNonBlock... | Calls a execution module function on the given target and synchronously
waits for the result. Authentication is done with the token therefore you
have to login prior to using this function.
@param client SaltClient instance
@param target the target for the function
@param auth authentication credentials to use
@return... | [
"Calls",
"a",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"and",
"synchronously",
"waits",
"for",
"the",
"result",
".",
"Authentication",
"is",
"done",
"with",
"the",
"token",
"therefore",
"you",
"have",
"to",
"login",
"prior",
"to",
"... | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L332-L336 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callSync | public CompletionStage<List<Map<String, Result<R>>>> callSync(final SaltClient client, Target<?> target,
AuthMethod auth, Optional<Batch> batch) {
return callSyncHelperNonBlock(client, target, auth, batch);
} | java | public CompletionStage<List<Map<String, Result<R>>>> callSync(final SaltClient client, Target<?> target,
AuthMethod auth, Optional<Batch> batch) {
return callSyncHelperNonBlock(client, target, auth, batch);
} | [
"public",
"CompletionStage",
"<",
"List",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"R",
">",
">",
">",
">",
"callSync",
"(",
"final",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth",
",",
"Optional",
"<",... | Calls a execution module function on the given target with batching and
synchronously waits for the result. Authentication is done with the token
therefore you have to login prior to using this function.
@param client SaltClient instance
@param target the target for the function
@param auth authentication credentials ... | [
"Calls",
"a",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"with",
"batching",
"and",
"synchronously",
"waits",
"for",
"the",
"result",
".",
"Authentication",
"is",
"done",
"with",
"the",
"token",
"therefore",
"you",
"have",
"to",
"login"... | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L367-L370 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.handleRetcodeBatchingHack | private List<Map<String, Result<R>>> handleRetcodeBatchingHack(List<Map<String, Result<R>>> list, Type xor) {
return list.stream().map(m -> {
return m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> {
return e.getValue().fold(err -> {
return err... | java | private List<Map<String, Result<R>>> handleRetcodeBatchingHack(List<Map<String, Result<R>>> list, Type xor) {
return list.stream().map(m -> {
return m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> {
return e.getValue().fold(err -> {
return err... | [
"private",
"List",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"R",
">",
">",
">",
"handleRetcodeBatchingHack",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"R",
">",
">",
">",
"list",
",",
"Type",
"xor",
")",
"{",
"return",
"list... | specific to how a function is dispatched. | [
"specific",
"to",
"how",
"a",
"function",
"is",
"dispatched",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L380-L405 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callSyncHelperNonBlock | private CompletionStage<List<Map<String, Result<R>>>> callSyncHelperNonBlock(
final SaltClient client, Target<?> target, AuthMethod auth, Optional<Batch> batch) {
Map<String, Object> customArgs = new HashMap<>();
batch.ifPresent(v -> customArgs.putAll(v.getParams()));
Client clientT... | java | private CompletionStage<List<Map<String, Result<R>>>> callSyncHelperNonBlock(
final SaltClient client, Target<?> target, AuthMethod auth, Optional<Batch> batch) {
Map<String, Object> customArgs = new HashMap<>();
batch.ifPresent(v -> customArgs.putAll(v.getParams()));
Client clientT... | [
"private",
"CompletionStage",
"<",
"List",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"R",
">",
">",
">",
">",
"callSyncHelperNonBlock",
"(",
"final",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth",
",",
"Op... | Helper to call an execution module function on the given target for batched or
unbatched while also providing an option to use the given credentials or to use a
prior created token. Synchronously waits for the result.
@param client SaltClient instance
@param target the target for the function
@param batch the batch pa... | [
"Helper",
"to",
"call",
"an",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"for",
"batched",
"or",
"unbatched",
"while",
"also",
"providing",
"an",
"option",
"to",
"use",
"the",
"given",
"credentials",
"or",
"to",
"use",
"a",
"prior",
... | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L420-L452 | train |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callSyncSSH | public CompletionStage<Map<String, Result<SSHResult<R>>>> callSyncSSH(final SaltClient client,
SSHTarget<?> target, SaltSSHConfig cfg, AuthMethod auth) {
Map<String, Object> args = new HashMap<>();
args.putAll(getPayload());
args.putAll(target.getProps());
SaltSSHUtils.mapCo... | java | public CompletionStage<Map<String, Result<SSHResult<R>>>> callSyncSSH(final SaltClient client,
SSHTarget<?> target, SaltSSHConfig cfg, AuthMethod auth) {
Map<String, Object> args = new HashMap<>();
args.putAll(getPayload());
args.putAll(target.getProps());
SaltSSHUtils.mapCo... | [
"public",
"CompletionStage",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"SSHResult",
"<",
"R",
">",
">",
">",
">",
"callSyncSSH",
"(",
"final",
"SaltClient",
"client",
",",
"SSHTarget",
"<",
"?",
">",
"target",
",",
"SaltSSHConfig",
"cfg",
",",
"Auth... | Call an execution module function on the given target via salt-ssh and synchronously
wait for the result.
@param client SaltClient instance
@param target the target for the function
@param cfg Salt SSH configuration object
@param auth authentication credentials to use
@return a map containing the results with the mini... | [
"Call",
"an",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"via",
"salt",
"-",
"ssh",
"and",
"synchronously",
"wait",
"for",
"the",
"result",
"."
] | a0bdf643c8e34fa4def4b915366594c1491fdad5 | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L464-L485 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMesh.java | NavMesh.getPolyRefBase | public long getPolyRefBase(MeshTile tile) {
if (tile == null) {
return 0;
}
int it = tile.index;
return encodePolyId(tile.salt, it, 0);
} | java | public long getPolyRefBase(MeshTile tile) {
if (tile == null) {
return 0;
}
int it = tile.index;
return encodePolyId(tile.salt, it, 0);
} | [
"public",
"long",
"getPolyRefBase",
"(",
"MeshTile",
"tile",
")",
"{",
"if",
"(",
"tile",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"int",
"it",
"=",
"tile",
".",
"index",
";",
"return",
"encodePolyId",
"(",
"tile",
".",
"salt",
",",
"it",
"... | Gets the polygon reference for the tile's base polygon.
@param tile
The tile.
@return The polygon reference for the base polygon in the specified tile. | [
"Gets",
"the",
"polygon",
"reference",
"for",
"the",
"tile",
"s",
"base",
"polygon",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L104-L110 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMesh.java | NavMesh.encodePolyId | public static long encodePolyId(int salt, int it, int ip) {
return (((long) salt) << (DT_POLY_BITS + DT_TILE_BITS)) | ((long) it << DT_POLY_BITS) | ip;
} | java | public static long encodePolyId(int salt, int it, int ip) {
return (((long) salt) << (DT_POLY_BITS + DT_TILE_BITS)) | ((long) it << DT_POLY_BITS) | ip;
} | [
"public",
"static",
"long",
"encodePolyId",
"(",
"int",
"salt",
",",
"int",
"it",
",",
"int",
"ip",
")",
"{",
"return",
"(",
"(",
"(",
"long",
")",
"salt",
")",
"<<",
"(",
"DT_POLY_BITS",
"+",
"DT_TILE_BITS",
")",
")",
"|",
"(",
"(",
"long",
")",
... | Derives a standard polygon reference.
@note This function is generally meant for internal use only.
@param salt
The tile's salt value.
@param it
The index of the tile.
@param ip
The index of the polygon within the tile.
@return encoded polygon reference | [
"Derives",
"a",
"standard",
"polygon",
"reference",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L124-L126 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMesh.java | NavMesh.calcTileLoc | public int[] calcTileLoc(float[] pos) {
int tx = (int) Math.floor((pos[0] - m_orig[0]) / m_tileWidth);
int ty = (int) Math.floor((pos[2] - m_orig[2]) / m_tileHeight);
return new int[] { tx, ty };
} | java | public int[] calcTileLoc(float[] pos) {
int tx = (int) Math.floor((pos[0] - m_orig[0]) / m_tileWidth);
int ty = (int) Math.floor((pos[2] - m_orig[2]) / m_tileHeight);
return new int[] { tx, ty };
} | [
"public",
"int",
"[",
"]",
"calcTileLoc",
"(",
"float",
"[",
"]",
"pos",
")",
"{",
"int",
"tx",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"(",
"pos",
"[",
"0",
"]",
"-",
"m_orig",
"[",
"0",
"]",
")",
"/",
"m_tileWidth",
")",
";",
"int"... | Calculates the tile grid location for the specified world position.
@param pos
The world position for the query. [(x, y, z)]
@return 2-element int array with (tx,ty) tile location | [
"Calculates",
"the",
"tile",
"grid",
"location",
"for",
"the",
"specified",
"world",
"position",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L200-L204 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMesh.java | NavMesh.baseOffMeshLinks | void baseOffMeshLinks(MeshTile tile) {
if (tile == null) {
return;
}
long base = getPolyRefBase(tile);
// Base off-mesh connection start points.
for (int i = 0; i < tile.data.header.offMeshConCount; ++i) {
OffMeshConnection con = tile.data.offMeshCons[i]... | java | void baseOffMeshLinks(MeshTile tile) {
if (tile == null) {
return;
}
long base = getPolyRefBase(tile);
// Base off-mesh connection start points.
for (int i = 0; i < tile.data.header.offMeshConCount; ++i) {
OffMeshConnection con = tile.data.offMeshCons[i]... | [
"void",
"baseOffMeshLinks",
"(",
"MeshTile",
"tile",
")",
"{",
"if",
"(",
"tile",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"base",
"=",
"getPolyRefBase",
"(",
"tile",
")",
";",
"// Base off-mesh connection start points.",
"for",
"(",
"int",
"i",
... | Builds internal polygons links for a tile.
@param tile | [
"Builds",
"internal",
"polygons",
"links",
"for",
"a",
"tile",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L937-L993 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMesh.java | NavMesh.closestPointOnDetailEdges | float[] closestPointOnDetailEdges(MeshTile tile, Poly poly, float[] pos, boolean onlyBoundary) {
int ANY_BOUNDARY_EDGE = (DT_DETAIL_EDGE_BOUNDARY << 0) | (DT_DETAIL_EDGE_BOUNDARY << 2)
| (DT_DETAIL_EDGE_BOUNDARY << 4);
int ip = poly.index;
PolyDetail pd = tile.data.detailMeshes[i... | java | float[] closestPointOnDetailEdges(MeshTile tile, Poly poly, float[] pos, boolean onlyBoundary) {
int ANY_BOUNDARY_EDGE = (DT_DETAIL_EDGE_BOUNDARY << 0) | (DT_DETAIL_EDGE_BOUNDARY << 2)
| (DT_DETAIL_EDGE_BOUNDARY << 4);
int ip = poly.index;
PolyDetail pd = tile.data.detailMeshes[i... | [
"float",
"[",
"]",
"closestPointOnDetailEdges",
"(",
"MeshTile",
"tile",
",",
"Poly",
"poly",
",",
"float",
"[",
"]",
"pos",
",",
"boolean",
"onlyBoundary",
")",
"{",
"int",
"ANY_BOUNDARY_EDGE",
"=",
"(",
"DT_DETAIL_EDGE_BOUNDARY",
"<<",
"0",
")",
"|",
"(",
... | Returns closest point on polygon.
@param ref
@param pos
@return | [
"Returns",
"closest",
"point",
"on",
"polygon",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L1002-L1054 | train |
ppiastucki/recast4j | recast-demo/src/main/java/org/recast4j/demo/tool/ConvexVolumeTool.java | ConvexVolumeTool.convexhull | List<Integer> convexhull(List<Float> pts) {
int npts = pts.size() / 3;
List<Integer> out = new ArrayList<>();
// Find lower-leftmost point.
int hull = 0;
for (int i = 1; i < npts; ++i) {
float[] a = new float[] { pts.get(i * 3), pts.get(i * 3 + 1), pts.get(i * 3 + 2) ... | java | List<Integer> convexhull(List<Float> pts) {
int npts = pts.size() / 3;
List<Integer> out = new ArrayList<>();
// Find lower-leftmost point.
int hull = 0;
for (int i = 1; i < npts; ++i) {
float[] a = new float[] { pts.get(i * 3), pts.get(i * 3 + 1), pts.get(i * 3 + 2) ... | [
"List",
"<",
"Integer",
">",
"convexhull",
"(",
"List",
"<",
"Float",
">",
"pts",
")",
"{",
"int",
"npts",
"=",
"pts",
".",
"size",
"(",
")",
"/",
"3",
";",
"List",
"<",
"Integer",
">",
"out",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// F... | returns number of points on hull. | [
"returns",
"number",
"of",
"points",
"on",
"hull",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast-demo/src/main/java/org/recast4j/demo/tool/ConvexVolumeTool.java#L59-L88 | train |
ppiastucki/recast4j | recast-demo/src/main/java/org/recast4j/demo/tool/ConvexVolumeTool.java | ConvexVolumeTool.cmppt | boolean cmppt(float[] a, float[] b) {
if (a[0] < b[0]) {
return true;
}
if (a[0] > b[0]) {
return false;
}
if (a[2] < b[2]) {
return true;
}
if (a[2] > b[2]) {
return false;
}
return false;
} | java | boolean cmppt(float[] a, float[] b) {
if (a[0] < b[0]) {
return true;
}
if (a[0] > b[0]) {
return false;
}
if (a[2] < b[2]) {
return true;
}
if (a[2] > b[2]) {
return false;
}
return false;
} | [
"boolean",
"cmppt",
"(",
"float",
"[",
"]",
"a",
",",
"float",
"[",
"]",
"b",
")",
"{",
"if",
"(",
"a",
"[",
"0",
"]",
"<",
"b",
"[",
"0",
"]",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"a",
"[",
"0",
"]",
">",
"b",
"[",
"0",
"... | Returns true if 'a' is more lower-left than 'b'. | [
"Returns",
"true",
"if",
"a",
"is",
"more",
"lower",
"-",
"left",
"than",
"b",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast-demo/src/main/java/org/recast4j/demo/tool/ConvexVolumeTool.java#L91-L105 | train |
ppiastucki/recast4j | recast-demo/src/main/java/org/recast4j/demo/tool/ConvexVolumeTool.java | ConvexVolumeTool.left | boolean left(float[] a, float[] b, float[] c) {
float u1 = b[0] - a[0];
float v1 = b[2] - a[2];
float u2 = c[0] - a[0];
float v2 = c[2] - a[2];
return u1 * v2 - v1 * u2 < 0;
} | java | boolean left(float[] a, float[] b, float[] c) {
float u1 = b[0] - a[0];
float v1 = b[2] - a[2];
float u2 = c[0] - a[0];
float v2 = c[2] - a[2];
return u1 * v2 - v1 * u2 < 0;
} | [
"boolean",
"left",
"(",
"float",
"[",
"]",
"a",
",",
"float",
"[",
"]",
"b",
",",
"float",
"[",
"]",
"c",
")",
"{",
"float",
"u1",
"=",
"b",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
";",
"float",
"v1",
"=",
"b",
"[",
"2",
"]",
"-",
"a",
... | Returns true if 'c' is left of line 'a'-'b'. | [
"Returns",
"true",
"if",
"c",
"is",
"left",
"of",
"line",
"a",
"-",
"b",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast-demo/src/main/java/org/recast4j/demo/tool/ConvexVolumeTool.java#L108-L114 | train |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.reset | public void reset(long ref, float[] pos) {
m_path.clear();
m_path.add(ref);
vCopy(m_pos, pos);
vCopy(m_target, pos);
} | java | public void reset(long ref, float[] pos) {
m_path.clear();
m_path.add(ref);
vCopy(m_pos, pos);
vCopy(m_target, pos);
} | [
"public",
"void",
"reset",
"(",
"long",
"ref",
",",
"float",
"[",
"]",
"pos",
")",
"{",
"m_path",
".",
"clear",
"(",
")",
";",
"m_path",
".",
"add",
"(",
"ref",
")",
";",
"vCopy",
"(",
"m_pos",
",",
"pos",
")",
";",
"vCopy",
"(",
"m_target",
",... | Resets the path corridor to the specified position.
@param ref
The polygon reference containing the position.
@param pos
The new position in the corridor. [(x, y, z)] | [
"Resets",
"the",
"path",
"corridor",
"to",
"the",
"specified",
"position",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L198-L203 | train |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.optimizePathVisibility | public void optimizePathVisibility(float[] next, float pathOptimizationRange, NavMeshQuery navquery,
QueryFilter filter) {
// Clamp the ray to max distance.
float dist = vDist2D(m_pos, next);
// If too close to the goal, do not try to optimize.
if (dist < 0.01f) {
... | java | public void optimizePathVisibility(float[] next, float pathOptimizationRange, NavMeshQuery navquery,
QueryFilter filter) {
// Clamp the ray to max distance.
float dist = vDist2D(m_pos, next);
// If too close to the goal, do not try to optimize.
if (dist < 0.01f) {
... | [
"public",
"void",
"optimizePathVisibility",
"(",
"float",
"[",
"]",
"next",
",",
"float",
"pathOptimizationRange",
",",
"NavMeshQuery",
"navquery",
",",
"QueryFilter",
"filter",
")",
"{",
"// Clamp the ray to max distance.",
"float",
"dist",
"=",
"vDist2D",
"(",
"m_... | Attempts to optimize the path if the specified point is visible from the current position.
Inaccurate locomotion or dynamic obstacle avoidance can force the agent position significantly outside the
original corridor. Over time this can result in the formation of a non-optimal corridor. Non-optimal paths can
also form ... | [
"Attempts",
"to",
"optimize",
"the",
"path",
"if",
"the",
"specified",
"point",
"is",
"visible",
"from",
"the",
"current",
"position",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L269-L293 | train |
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.movePosition | public boolean movePosition(float[] npos, NavMeshQuery navquery, QueryFilter filter) {
// Move along navmesh and update new position.
Result<MoveAlongSurfaceResult> masResult = navquery.moveAlongSurface(m_path.get(0), m_pos, npos, filter);
if (masResult.succeeded()) {
m_path = mergeC... | java | public boolean movePosition(float[] npos, NavMeshQuery navquery, QueryFilter filter) {
// Move along navmesh and update new position.
Result<MoveAlongSurfaceResult> masResult = navquery.moveAlongSurface(m_path.get(0), m_pos, npos, filter);
if (masResult.succeeded()) {
m_path = mergeC... | [
"public",
"boolean",
"movePosition",
"(",
"float",
"[",
"]",
"npos",
",",
"NavMeshQuery",
"navquery",
",",
"QueryFilter",
"filter",
")",
"{",
"// Move along navmesh and update new position.",
"Result",
"<",
"MoveAlongSurfaceResult",
">",
"masResult",
"=",
"navquery",
... | Moves the position from the current location to the desired location, adjusting the corridor as needed to reflect
the change.
Behavior:
- The movement is constrained to the surface of the navigation mesh. - The corridor is automatically adjusted
(shorted or lengthened) in order to remain valid. - The new position wil... | [
"Moves",
"the",
"position",
"from",
"the",
"current",
"location",
"to",
"the",
"desired",
"location",
"adjusting",
"the",
"corridor",
"as",
"needed",
"to",
"reflect",
"the",
"change",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L384-L398 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.