id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
116,700 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java | DiscordApiImpl.updateActivity | private void updateActivity(ActivityType type, String name, String streamingUrl) {
if (name == null) {
activity = null;
} else if (streamingUrl == null) {
activity = new ActivityImpl(type, name, null);
} else {
activity = new ActivityImpl(type, name, streaming... | java | private void updateActivity(ActivityType type, String name, String streamingUrl) {
if (name == null) {
activity = null;
} else if (streamingUrl == null) {
activity = new ActivityImpl(type, name, null);
} else {
activity = new ActivityImpl(type, name, streaming... | [
"private",
"void",
"updateActivity",
"(",
"ActivityType",
"type",
",",
"String",
"name",
",",
"String",
"streamingUrl",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"activity",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"streamingUrl",
"==",
"null... | Sets the current activity, along with type and streaming Url.
@param type The activity's type.
@param name The name of the activity.
@param streamingUrl The Url used for streaming. | [
"Sets",
"the",
"current",
"activity",
"along",
"with",
"type",
"and",
"streaming",
"Url",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L1227-L1236 |
116,701 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java | DiscordApiImpl.getCachedMessagesWhere | public MessageSet getCachedMessagesWhere(Predicate<Message> filter) {
synchronized (messages) {
return messages.values().stream()
.map(Reference::get)
.filter(Objects::nonNull)
.filter(filter)
.collect(Collectors.toColle... | java | public MessageSet getCachedMessagesWhere(Predicate<Message> filter) {
synchronized (messages) {
return messages.values().stream()
.map(Reference::get)
.filter(Objects::nonNull)
.filter(filter)
.collect(Collectors.toColle... | [
"public",
"MessageSet",
"getCachedMessagesWhere",
"(",
"Predicate",
"<",
"Message",
">",
"filter",
")",
"{",
"synchronized",
"(",
"messages",
")",
"{",
"return",
"messages",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Reference",
":... | Get messages from the cache that satisfy a given condition.
@param filter The filter for messages to be included.
@return A set of cached messages satisfying the condition. | [
"Get",
"messages",
"from",
"the",
"cache",
"that",
"satisfy",
"a",
"given",
"condition",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L1393-L1401 |
116,702 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java | DiscordApiImpl.forEachCachedMessageWhere | public void forEachCachedMessageWhere(Predicate<Message> filter, Consumer<Message> action) {
synchronized (messages) {
messages.values().stream()
.map(Reference::get)
.filter(Objects::nonNull)
.filter(filter)
.forEach(ac... | java | public void forEachCachedMessageWhere(Predicate<Message> filter, Consumer<Message> action) {
synchronized (messages) {
messages.values().stream()
.map(Reference::get)
.filter(Objects::nonNull)
.filter(filter)
.forEach(ac... | [
"public",
"void",
"forEachCachedMessageWhere",
"(",
"Predicate",
"<",
"Message",
">",
"filter",
",",
"Consumer",
"<",
"Message",
">",
"action",
")",
"{",
"synchronized",
"(",
"messages",
")",
"{",
"messages",
".",
"values",
"(",
")",
".",
"stream",
"(",
")... | Execute a task for every message in cache that satisfied a given condition.
@param filter The condition on which to execute the code.
@param action The action to be applied to the messages. | [
"Execute",
"a",
"task",
"for",
"every",
"message",
"in",
"cache",
"that",
"satisfied",
"a",
"given",
"condition",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L1409-L1417 |
116,703 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/ratelimit/RatelimitBucket.java | RatelimitBucket.getTimeTillSpaceGetsAvailable | public int getTimeTillSpaceGetsAvailable() {
long globalRatelimitResetTimestamp =
RatelimitBucket.globalRatelimitResetTimestamp.getOrDefault(api.getToken(), 0L);
long timestamp = System.currentTimeMillis() + (api.getTimeOffset() == null ? 0 : api.getTimeOffset());
if (ratelimitRe... | java | public int getTimeTillSpaceGetsAvailable() {
long globalRatelimitResetTimestamp =
RatelimitBucket.globalRatelimitResetTimestamp.getOrDefault(api.getToken(), 0L);
long timestamp = System.currentTimeMillis() + (api.getTimeOffset() == null ? 0 : api.getTimeOffset());
if (ratelimitRe... | [
"public",
"int",
"getTimeTillSpaceGetsAvailable",
"(",
")",
"{",
"long",
"globalRatelimitResetTimestamp",
"=",
"RatelimitBucket",
".",
"globalRatelimitResetTimestamp",
".",
"getOrDefault",
"(",
"api",
".",
"getToken",
"(",
")",
",",
"0L",
")",
";",
"long",
"timestam... | Gets the time in seconds how long you have to wait till there's space in the bucket again.
@return The time in seconds how long you have to wait till there's space in the bucket again. | [
"Gets",
"the",
"time",
"in",
"seconds",
"how",
"long",
"you",
"have",
"to",
"wait",
"till",
"there",
"s",
"space",
"in",
"the",
"bucket",
"again",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/ratelimit/RatelimitBucket.java#L113-L121 |
116,704 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java | ChannelCreateHandler.handleChannelCategory | private void handleChannelCategory(JsonNode channel) {
long serverId = channel.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
ChannelCategory channelCategory = ((ServerImpl) server).getOrCreateChannelCategory(channel);
ServerChannelCrea... | java | private void handleChannelCategory(JsonNode channel) {
long serverId = channel.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
ChannelCategory channelCategory = ((ServerImpl) server).getOrCreateChannelCategory(channel);
ServerChannelCrea... | [
"private",
"void",
"handleChannelCategory",
"(",
"JsonNode",
"channel",
")",
"{",
"long",
"serverId",
"=",
"channel",
".",
"get",
"(",
"\"guild_id\"",
")",
".",
"asLong",
"(",
")",
";",
"api",
".",
"getPossiblyUnreadyServerById",
"(",
"serverId",
")",
".",
"... | Handles channel category creation.
@param channel The channel data. | [
"Handles",
"channel",
"category",
"creation",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java#L80-L87 |
116,705 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java | ChannelCreateHandler.handleServerTextChannel | private void handleServerTextChannel(JsonNode channel) {
long serverId = channel.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
ServerTextChannel textChannel = ((ServerImpl) server).getOrCreateServerTextChannel(channel);
ServerChannelCr... | java | private void handleServerTextChannel(JsonNode channel) {
long serverId = channel.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
ServerTextChannel textChannel = ((ServerImpl) server).getOrCreateServerTextChannel(channel);
ServerChannelCr... | [
"private",
"void",
"handleServerTextChannel",
"(",
"JsonNode",
"channel",
")",
"{",
"long",
"serverId",
"=",
"channel",
".",
"get",
"(",
"\"guild_id\"",
")",
".",
"asLong",
"(",
")",
";",
"api",
".",
"getPossiblyUnreadyServerById",
"(",
"serverId",
")",
".",
... | Handles server text channel creation.
@param channel The channel data. | [
"Handles",
"server",
"text",
"channel",
"creation",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java#L94-L102 |
116,706 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java | ChannelCreateHandler.handleServerVoiceChannel | private void handleServerVoiceChannel(JsonNode channel) {
long serverId = channel.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
ServerVoiceChannel voiceChannel = ((ServerImpl) server).getOrCreateServerVoiceChannel(channel);
ServerChann... | java | private void handleServerVoiceChannel(JsonNode channel) {
long serverId = channel.get("guild_id").asLong();
api.getPossiblyUnreadyServerById(serverId).ifPresent(server -> {
ServerVoiceChannel voiceChannel = ((ServerImpl) server).getOrCreateServerVoiceChannel(channel);
ServerChann... | [
"private",
"void",
"handleServerVoiceChannel",
"(",
"JsonNode",
"channel",
")",
"{",
"long",
"serverId",
"=",
"channel",
".",
"get",
"(",
"\"guild_id\"",
")",
".",
"asLong",
"(",
")",
";",
"api",
".",
"getPossiblyUnreadyServerById",
"(",
"serverId",
")",
".",
... | Handles server voice channel creation.
@param channel The channel data. | [
"Handles",
"server",
"voice",
"channel",
"creation",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java#L109-L117 |
116,707 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java | ChannelCreateHandler.handlePrivateChannel | private void handlePrivateChannel(JsonNode channel) {
// A CHANNEL_CREATE packet is sent every time a bot account receives a message, see
// https://github.com/hammerandchisel/discord-api-docs/issues/184
UserImpl recipient = (UserImpl) api.getOrCreateUser(channel.get("recipients").get(0));
... | java | private void handlePrivateChannel(JsonNode channel) {
// A CHANNEL_CREATE packet is sent every time a bot account receives a message, see
// https://github.com/hammerandchisel/discord-api-docs/issues/184
UserImpl recipient = (UserImpl) api.getOrCreateUser(channel.get("recipients").get(0));
... | [
"private",
"void",
"handlePrivateChannel",
"(",
"JsonNode",
"channel",
")",
"{",
"// A CHANNEL_CREATE packet is sent every time a bot account receives a message, see",
"// https://github.com/hammerandchisel/discord-api-docs/issues/184",
"UserImpl",
"recipient",
"=",
"(",
"UserImpl",
")... | Handles a private channel creation.
@param channel The channel data. | [
"Handles",
"a",
"private",
"channel",
"creation",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java#L124-L134 |
116,708 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java | ChannelCreateHandler.handleGroupChannel | private void handleGroupChannel(JsonNode channel) {
long channelId = channel.get("id").asLong();
if (!api.getGroupChannelById(channelId).isPresent()) {
GroupChannel groupChannel = new GroupChannelImpl(api, channel);
GroupChannelCreateEvent event = new GroupChannelCreateEventImpl(... | java | private void handleGroupChannel(JsonNode channel) {
long channelId = channel.get("id").asLong();
if (!api.getGroupChannelById(channelId).isPresent()) {
GroupChannel groupChannel = new GroupChannelImpl(api, channel);
GroupChannelCreateEvent event = new GroupChannelCreateEventImpl(... | [
"private",
"void",
"handleGroupChannel",
"(",
"JsonNode",
"channel",
")",
"{",
"long",
"channelId",
"=",
"channel",
".",
"get",
"(",
"\"id\"",
")",
".",
"asLong",
"(",
")",
";",
"if",
"(",
"!",
"api",
".",
"getGroupChannelById",
"(",
"channelId",
")",
".... | Handles a group channel creation.
@param channel The channel data. | [
"Handles",
"a",
"group",
"channel",
"creation",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java#L141-L149 |
116,709 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.addServerReadyConsumer | public void addServerReadyConsumer(Consumer<Server> consumer) {
synchronized (readyConsumers) {
if (ready) {
consumer.accept(this);
} else {
readyConsumers.add(consumer);
}
}
} | java | public void addServerReadyConsumer(Consumer<Server> consumer) {
synchronized (readyConsumers) {
if (ready) {
consumer.accept(this);
} else {
readyConsumers.add(consumer);
}
}
} | [
"public",
"void",
"addServerReadyConsumer",
"(",
"Consumer",
"<",
"Server",
">",
"consumer",
")",
"{",
"synchronized",
"(",
"readyConsumers",
")",
"{",
"if",
"(",
"ready",
")",
"{",
"consumer",
".",
"accept",
"(",
"this",
")",
";",
"}",
"else",
"{",
"rea... | Adds a consumer which will be informed once the server is ready.
If the server is already ready, it will immediately call the consumer, otherwise it will be called from the
websocket reading thread.
@param consumer The consumer which should be called. | [
"Adds",
"a",
"consumer",
"which",
"will",
"be",
"informed",
"once",
"the",
"server",
"is",
"ready",
".",
"If",
"the",
"server",
"is",
"already",
"ready",
"it",
"will",
"immediately",
"call",
"the",
"consumer",
"otherwise",
"it",
"will",
"be",
"called",
"fr... | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L388-L396 |
116,710 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.getOrCreateRole | public Role getOrCreateRole(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
synchronized (this) {
return getRoleById(id).orElseGet(() -> {
Role role = new RoleImpl(api, this, data);
this.roles.put(role.getId(), role);
return... | java | public Role getOrCreateRole(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
synchronized (this) {
return getRoleById(id).orElseGet(() -> {
Role role = new RoleImpl(api, this, data);
this.roles.put(role.getId(), role);
return... | [
"public",
"Role",
"getOrCreateRole",
"(",
"JsonNode",
"data",
")",
"{",
"long",
"id",
"=",
"Long",
".",
"parseLong",
"(",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"asText",
"(",
")",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"return",
"get... | Gets or create a new role.
@param data The json data of the role.
@return The role. | [
"Gets",
"or",
"create",
"a",
"new",
"role",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L583-L592 |
116,711 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.getOrCreateChannelCategory | public ChannelCategory getOrCreateChannelCategory(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
if (type == ChannelType.CHANNEL_CATEGORY) {
return getChannelCa... | java | public ChannelCategory getOrCreateChannelCategory(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
if (type == ChannelType.CHANNEL_CATEGORY) {
return getChannelCa... | [
"public",
"ChannelCategory",
"getOrCreateChannelCategory",
"(",
"JsonNode",
"data",
")",
"{",
"long",
"id",
"=",
"Long",
".",
"parseLong",
"(",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"asText",
"(",
")",
")",
";",
"ChannelType",
"type",
"=",
"ChannelT... | Gets or creates a channel category.
@param data The json data of the channel.
@return The server text channel. | [
"Gets",
"or",
"creates",
"a",
"channel",
"category",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L600-L610 |
116,712 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.getOrCreateServerTextChannel | public ServerTextChannel getOrCreateServerTextChannel(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
// TODO Treat news channels differently
if (type == ChannelType... | java | public ServerTextChannel getOrCreateServerTextChannel(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
// TODO Treat news channels differently
if (type == ChannelType... | [
"public",
"ServerTextChannel",
"getOrCreateServerTextChannel",
"(",
"JsonNode",
"data",
")",
"{",
"long",
"id",
"=",
"Long",
".",
"parseLong",
"(",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"asText",
"(",
")",
")",
";",
"ChannelType",
"type",
"=",
"Chan... | Gets or creates a server text channel.
@param data The json data of the channel.
@return The server text channel. | [
"Gets",
"or",
"creates",
"a",
"server",
"text",
"channel",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L618-L629 |
116,713 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.getOrCreateServerVoiceChannel | public ServerVoiceChannel getOrCreateServerVoiceChannel(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
if (type == ChannelType.SERVER_VOICE_CHANNEL) {
return ge... | java | public ServerVoiceChannel getOrCreateServerVoiceChannel(JsonNode data) {
long id = Long.parseLong(data.get("id").asText());
ChannelType type = ChannelType.fromId(data.get("type").asInt());
synchronized (this) {
if (type == ChannelType.SERVER_VOICE_CHANNEL) {
return ge... | [
"public",
"ServerVoiceChannel",
"getOrCreateServerVoiceChannel",
"(",
"JsonNode",
"data",
")",
"{",
"long",
"id",
"=",
"Long",
".",
"parseLong",
"(",
"data",
".",
"get",
"(",
"\"id\"",
")",
".",
"asText",
"(",
")",
")",
";",
"ChannelType",
"type",
"=",
"Ch... | Gets or creates a server voice channel.
@param data The json data of the channel.
@return The server voice channel. | [
"Gets",
"or",
"creates",
"a",
"server",
"voice",
"channel",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L637-L647 |
116,714 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.removeMember | public void removeMember(User user) {
long userId = user.getId();
members.remove(userId);
nicknames.remove(userId);
selfMuted.remove(userId);
selfDeafened.remove(userId);
muted.remove(userId);
deafened.remove(userId);
getRoles().forEach(role -> ((RoleImpl)... | java | public void removeMember(User user) {
long userId = user.getId();
members.remove(userId);
nicknames.remove(userId);
selfMuted.remove(userId);
selfDeafened.remove(userId);
muted.remove(userId);
deafened.remove(userId);
getRoles().forEach(role -> ((RoleImpl)... | [
"public",
"void",
"removeMember",
"(",
"User",
"user",
")",
"{",
"long",
"userId",
"=",
"user",
".",
"getId",
"(",
")",
";",
"members",
".",
"remove",
"(",
"userId",
")",
";",
"nicknames",
".",
"remove",
"(",
"userId",
")",
";",
"selfMuted",
".",
"re... | Removes a member from the server.
@param user The user to remove. | [
"Removes",
"a",
"member",
"from",
"the",
"server",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L654-L664 |
116,715 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.addMember | public void addMember(JsonNode member) {
User user = api.getOrCreateUser(member.get("user"));
members.put(user.getId(), user);
if (member.hasNonNull("nick")) {
nicknames.put(user.getId(), member.get("nick").asText());
}
if (member.hasNonNull("mute")) {
set... | java | public void addMember(JsonNode member) {
User user = api.getOrCreateUser(member.get("user"));
members.put(user.getId(), user);
if (member.hasNonNull("nick")) {
nicknames.put(user.getId(), member.get("nick").asText());
}
if (member.hasNonNull("mute")) {
set... | [
"public",
"void",
"addMember",
"(",
"JsonNode",
"member",
")",
"{",
"User",
"user",
"=",
"api",
".",
"getOrCreateUser",
"(",
"member",
".",
"get",
"(",
"\"user\"",
")",
")",
";",
"members",
".",
"put",
"(",
"user",
".",
"getId",
"(",
")",
",",
"user"... | Adds a member to the server.
@param member The user to add. | [
"Adds",
"a",
"member",
"to",
"the",
"server",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L678-L705 |
116,716 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.setNickname | public void setNickname(User user, String nickname) {
nicknames.compute(user.getId(), (key, value) -> nickname);
} | java | public void setNickname(User user, String nickname) {
nicknames.compute(user.getId(), (key, value) -> nickname);
} | [
"public",
"void",
"setNickname",
"(",
"User",
"user",
",",
"String",
"nickname",
")",
"{",
"nicknames",
".",
"compute",
"(",
"user",
".",
"getId",
"(",
")",
",",
"(",
"key",
",",
"value",
")",
"->",
"nickname",
")",
";",
"}"
] | Sets the nickname of the user.
@param user The user.
@param nickname The nickname to set. | [
"Sets",
"the",
"nickname",
"of",
"the",
"user",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L720-L722 |
116,717 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.setSelfMuted | public void setSelfMuted(long userId, boolean muted) {
if (muted) {
selfMuted.add(userId);
} else {
selfMuted.remove(userId);
}
} | java | public void setSelfMuted(long userId, boolean muted) {
if (muted) {
selfMuted.add(userId);
} else {
selfMuted.remove(userId);
}
} | [
"public",
"void",
"setSelfMuted",
"(",
"long",
"userId",
",",
"boolean",
"muted",
")",
"{",
"if",
"(",
"muted",
")",
"{",
"selfMuted",
".",
"add",
"(",
"userId",
")",
";",
"}",
"else",
"{",
"selfMuted",
".",
"remove",
"(",
"userId",
")",
";",
"}",
... | Sets the self-muted state of the user with the given id.
@param userId The id of the user.
@param muted Whether the user with the given id is self-muted or not. | [
"Sets",
"the",
"self",
"-",
"muted",
"state",
"of",
"the",
"user",
"with",
"the",
"given",
"id",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L730-L736 |
116,718 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.setSelfDeafened | public void setSelfDeafened(long userId, boolean deafened) {
if (deafened) {
selfDeafened.add(userId);
} else {
selfDeafened.remove(userId);
}
} | java | public void setSelfDeafened(long userId, boolean deafened) {
if (deafened) {
selfDeafened.add(userId);
} else {
selfDeafened.remove(userId);
}
} | [
"public",
"void",
"setSelfDeafened",
"(",
"long",
"userId",
",",
"boolean",
"deafened",
")",
"{",
"if",
"(",
"deafened",
")",
"{",
"selfDeafened",
".",
"add",
"(",
"userId",
")",
";",
"}",
"else",
"{",
"selfDeafened",
".",
"remove",
"(",
"userId",
")",
... | Sets the self-deafened state of the user with the given id.
@param userId The id of the user.
@param deafened Whether the user with the given id is self-deafened or not. | [
"Sets",
"the",
"self",
"-",
"deafened",
"state",
"of",
"the",
"user",
"with",
"the",
"given",
"id",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L744-L750 |
116,719 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.setMuted | public void setMuted(long userId, boolean muted) {
if (muted) {
this.muted.add(userId);
} else {
this.muted.remove(userId);
}
} | java | public void setMuted(long userId, boolean muted) {
if (muted) {
this.muted.add(userId);
} else {
this.muted.remove(userId);
}
} | [
"public",
"void",
"setMuted",
"(",
"long",
"userId",
",",
"boolean",
"muted",
")",
"{",
"if",
"(",
"muted",
")",
"{",
"this",
".",
"muted",
".",
"add",
"(",
"userId",
")",
";",
"}",
"else",
"{",
"this",
".",
"muted",
".",
"remove",
"(",
"userId",
... | Sets the muted state of the user with the given id.
@param userId The id of the user.
@param muted Whether the user with the given id is muted or not. | [
"Sets",
"the",
"muted",
"state",
"of",
"the",
"user",
"with",
"the",
"given",
"id",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L758-L764 |
116,720 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java | ServerImpl.setDeafened | public void setDeafened(long userId, boolean deafened) {
if (deafened) {
this.deafened.add(userId);
} else {
this.deafened.remove(userId);
}
} | java | public void setDeafened(long userId, boolean deafened) {
if (deafened) {
this.deafened.add(userId);
} else {
this.deafened.remove(userId);
}
} | [
"public",
"void",
"setDeafened",
"(",
"long",
"userId",
",",
"boolean",
"deafened",
")",
"{",
"if",
"(",
"deafened",
")",
"{",
"this",
".",
"deafened",
".",
"add",
"(",
"userId",
")",
";",
"}",
"else",
"{",
"this",
".",
"deafened",
".",
"remove",
"("... | Sets the deafened state of the user with the given id.
@param userId The id of the user.
@param deafened Whether the user with the given id is deafened or not. | [
"Sets",
"the",
"deafened",
"state",
"of",
"the",
"user",
"with",
"the",
"given",
"id",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/server/ServerImpl.java#L772-L778 |
116,721 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/message/MessageUpdateHandler.java | MessageUpdateHandler.dispatchEditEvent | private void dispatchEditEvent(MessageEditEvent event) {
Optional<Server> optionalServer =
event.getChannel().asServerChannel().map(ServerChannel::getServer);
api.getEventDispatcher().dispatchMessageEditEvent(
optionalServer.map(DispatchQueueSelector.class::cast).orElse(a... | java | private void dispatchEditEvent(MessageEditEvent event) {
Optional<Server> optionalServer =
event.getChannel().asServerChannel().map(ServerChannel::getServer);
api.getEventDispatcher().dispatchMessageEditEvent(
optionalServer.map(DispatchQueueSelector.class::cast).orElse(a... | [
"private",
"void",
"dispatchEditEvent",
"(",
"MessageEditEvent",
"event",
")",
"{",
"Optional",
"<",
"Server",
">",
"optionalServer",
"=",
"event",
".",
"getChannel",
"(",
")",
".",
"asServerChannel",
"(",
")",
".",
"map",
"(",
"ServerChannel",
"::",
"getServe... | Dispatches an edit event.
@param event The event to dispatch. | [
"Dispatches",
"an",
"edit",
"event",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/message/MessageUpdateHandler.java#L180-L189 |
116,722 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/entity/auditlog/AuditLogImpl.java | AuditLogImpl.addEntries | public void addEntries(JsonNode data) {
for (JsonNode webhookJson : data.get("webhooks")) {
boolean alreadyAdded = involvedWebhooks.stream()
.anyMatch(webhook -> webhook.getId() == webhookJson.get("id").asLong());
if (!alreadyAdded) {
involvedWebhooks.... | java | public void addEntries(JsonNode data) {
for (JsonNode webhookJson : data.get("webhooks")) {
boolean alreadyAdded = involvedWebhooks.stream()
.anyMatch(webhook -> webhook.getId() == webhookJson.get("id").asLong());
if (!alreadyAdded) {
involvedWebhooks.... | [
"public",
"void",
"addEntries",
"(",
"JsonNode",
"data",
")",
"{",
"for",
"(",
"JsonNode",
"webhookJson",
":",
"data",
".",
"get",
"(",
"\"webhooks\"",
")",
")",
"{",
"boolean",
"alreadyAdded",
"=",
"involvedWebhooks",
".",
"stream",
"(",
")",
".",
"anyMat... | Adds entries to the audit log.
@param data The json data of the audit log. | [
"Adds",
"entries",
"to",
"the",
"audit",
"log",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/auditlog/AuditLogImpl.java#L63-L81 |
116,723 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/PacketHandler.java | PacketHandler.handlePacket | public void handlePacket(final JsonNode packet) {
if (async) {
executorService.submit(() -> {
try {
handle(packet);
} catch (Throwable t) {
logger.warn("Couldn't handle packet of type {}. Please contact the developer! (packet: {... | java | public void handlePacket(final JsonNode packet) {
if (async) {
executorService.submit(() -> {
try {
handle(packet);
} catch (Throwable t) {
logger.warn("Couldn't handle packet of type {}. Please contact the developer! (packet: {... | [
"public",
"void",
"handlePacket",
"(",
"final",
"JsonNode",
"packet",
")",
"{",
"if",
"(",
"async",
")",
"{",
"executorService",
".",
"submit",
"(",
"(",
")",
"->",
"{",
"try",
"{",
"handle",
"(",
"packet",
")",
";",
"}",
"catch",
"(",
"Throwable",
"... | Handles the packet.
@param packet The packet (the "d"-object). | [
"Handles",
"the",
"packet",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/PacketHandler.java#L47-L65 |
116,724 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.getGateway | private static String getGateway(DiscordApiImpl api) {
gatewayReadLock.lock();
if (gateway == null) {
gatewayReadLock.unlock();
gatewayWriteLock.lock();
try {
if (gateway == null) {
gateway = new RestRequest<String>(api, RestMethod.... | java | private static String getGateway(DiscordApiImpl api) {
gatewayReadLock.lock();
if (gateway == null) {
gatewayReadLock.unlock();
gatewayWriteLock.lock();
try {
if (gateway == null) {
gateway = new RestRequest<String>(api, RestMethod.... | [
"private",
"static",
"String",
"getGateway",
"(",
"DiscordApiImpl",
"api",
")",
"{",
"gatewayReadLock",
".",
"lock",
"(",
")",
";",
"if",
"(",
"gateway",
"==",
"null",
")",
"{",
"gatewayReadLock",
".",
"unlock",
"(",
")",
";",
"gatewayWriteLock",
".",
"loc... | Gets the gateway used to connect.
If no gateway was requested or set so far, it will request one from Discord.
@param api The api used to make the rest call.
@return The gateway url as string. | [
"Gets",
"the",
"gateway",
"used",
"to",
"connect",
".",
"If",
"no",
"gateway",
"was",
"requested",
"or",
"set",
"so",
"far",
"it",
"will",
"request",
"one",
"from",
"Discord",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L250-L273 |
116,725 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.setGateway | public static void setGateway(String gateway) {
gatewayWriteLock.lock();
try {
DiscordWebSocketAdapter.gateway = gateway;
} finally {
gatewayWriteLock.unlock();
}
} | java | public static void setGateway(String gateway) {
gatewayWriteLock.lock();
try {
DiscordWebSocketAdapter.gateway = gateway;
} finally {
gatewayWriteLock.unlock();
}
} | [
"public",
"static",
"void",
"setGateway",
"(",
"String",
"gateway",
")",
"{",
"gatewayWriteLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"DiscordWebSocketAdapter",
".",
"gateway",
"=",
"gateway",
";",
"}",
"finally",
"{",
"gatewayWriteLock",
".",
"unlock",
... | Sets the gateway used to connect.
@param gateway The gateway to set. | [
"Sets",
"the",
"gateway",
"used",
"to",
"connect",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L280-L287 |
116,726 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.disconnect | public void disconnect() {
reconnect = false;
websocket.get().sendClose(WebSocketCloseReason.DISCONNECT.getNumericCloseCode());
// cancel heartbeat timer if within one minute no disconnect event was dispatched
api.getThreadPool().getDaemonScheduler().schedule(() -> heartbeatTimer.updateA... | java | public void disconnect() {
reconnect = false;
websocket.get().sendClose(WebSocketCloseReason.DISCONNECT.getNumericCloseCode());
// cancel heartbeat timer if within one minute no disconnect event was dispatched
api.getThreadPool().getDaemonScheduler().schedule(() -> heartbeatTimer.updateA... | [
"public",
"void",
"disconnect",
"(",
")",
"{",
"reconnect",
"=",
"false",
";",
"websocket",
".",
"get",
"(",
")",
".",
"sendClose",
"(",
"WebSocketCloseReason",
".",
"DISCONNECT",
".",
"getNumericCloseCode",
"(",
")",
")",
";",
"// cancel heartbeat timer if with... | Disconnects from the websocket. | [
"Disconnects",
"from",
"the",
"websocket",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L292-L302 |
116,727 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.waitForIdentifyRateLimit | private void waitForIdentifyRateLimit() {
String token = api.getPrefixedToken();
connectionDelaySemaphorePerAccount.computeIfAbsent(token, key -> new Semaphore(1)).acquireUninterruptibly();
for (long delay = 5100 - (System.currentTimeMillis() - lastIdentificationPerAccount.getOrDefault(token, 0L... | java | private void waitForIdentifyRateLimit() {
String token = api.getPrefixedToken();
connectionDelaySemaphorePerAccount.computeIfAbsent(token, key -> new Semaphore(1)).acquireUninterruptibly();
for (long delay = 5100 - (System.currentTimeMillis() - lastIdentificationPerAccount.getOrDefault(token, 0L... | [
"private",
"void",
"waitForIdentifyRateLimit",
"(",
")",
"{",
"String",
"token",
"=",
"api",
".",
"getPrefixedToken",
"(",
")",
";",
"connectionDelaySemaphorePerAccount",
".",
"computeIfAbsent",
"(",
"token",
",",
"key",
"->",
"new",
"Semaphore",
"(",
"1",
")",
... | Identification is rate limited to once every 5 seconds,
so don't try to more often per account, even in different instances.
This method waits for the identification rate limit to be over, then returns. | [
"Identification",
"is",
"rate",
"limited",
"to",
"once",
"every",
"5",
"seconds",
"so",
"don",
"t",
"try",
"to",
"more",
"often",
"per",
"account",
"even",
"in",
"different",
"instances",
".",
"This",
"method",
"waits",
"for",
"the",
"identification",
"rate"... | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L418-L429 |
116,728 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.startHeartbeat | private Future<?> startHeartbeat(final WebSocket websocket, final int heartbeatInterval) {
// first heartbeat should assume last heartbeat was answered properly
heartbeatAckReceived.set(true);
return api.getThreadPool().getScheduler().scheduleWithFixedDelay(() -> {
try {
... | java | private Future<?> startHeartbeat(final WebSocket websocket, final int heartbeatInterval) {
// first heartbeat should assume last heartbeat was answered properly
heartbeatAckReceived.set(true);
return api.getThreadPool().getScheduler().scheduleWithFixedDelay(() -> {
try {
... | [
"private",
"Future",
"<",
"?",
">",
"startHeartbeat",
"(",
"final",
"WebSocket",
"websocket",
",",
"final",
"int",
"heartbeatInterval",
")",
"{",
"// first heartbeat should assume last heartbeat was answered properly",
"heartbeatAckReceived",
".",
"set",
"(",
"true",
")",... | Starts the heartbeat.
@param websocket The websocket the heartbeat should be sent to.
@param heartbeatInterval The heartbeat interval.
@return The timer used for the heartbeat. | [
"Starts",
"the",
"heartbeat",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L639-L655 |
116,729 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.sendHeartbeat | private void sendHeartbeat(WebSocket websocket) {
ObjectNode heartbeatPacket = JsonNodeFactory.instance.objectNode();
heartbeatPacket.put("op", GatewayOpcode.HEARTBEAT.getCode());
heartbeatPacket.put("d", lastSeq);
WebSocketFrame heartbeatFrame = WebSocketFrame.createTextFrame(heartbeatP... | java | private void sendHeartbeat(WebSocket websocket) {
ObjectNode heartbeatPacket = JsonNodeFactory.instance.objectNode();
heartbeatPacket.put("op", GatewayOpcode.HEARTBEAT.getCode());
heartbeatPacket.put("d", lastSeq);
WebSocketFrame heartbeatFrame = WebSocketFrame.createTextFrame(heartbeatP... | [
"private",
"void",
"sendHeartbeat",
"(",
"WebSocket",
"websocket",
")",
"{",
"ObjectNode",
"heartbeatPacket",
"=",
"JsonNodeFactory",
".",
"instance",
".",
"objectNode",
"(",
")",
";",
"heartbeatPacket",
".",
"put",
"(",
"\"op\"",
",",
"GatewayOpcode",
".",
"HEA... | Sends the heartbeat.
@param websocket The websocket the heartbeat should be sent to. | [
"Sends",
"the",
"heartbeat",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L662-L669 |
116,730 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.sendResume | private void sendResume(WebSocket websocket) {
ObjectNode resumePacket = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.RESUME.getCode());
resumePacket.putObject("d")
.put("token", api.getPrefixedToken())
.put("session_id", sessionId)
... | java | private void sendResume(WebSocket websocket) {
ObjectNode resumePacket = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.RESUME.getCode());
resumePacket.putObject("d")
.put("token", api.getPrefixedToken())
.put("session_id", sessionId)
... | [
"private",
"void",
"sendResume",
"(",
"WebSocket",
"websocket",
")",
"{",
"ObjectNode",
"resumePacket",
"=",
"JsonNodeFactory",
".",
"instance",
".",
"objectNode",
"(",
")",
".",
"put",
"(",
"\"op\"",
",",
"GatewayOpcode",
".",
"RESUME",
".",
"getCode",
"(",
... | Sends the resume packet.
@param websocket The websocket the resume packet should be sent to. | [
"Sends",
"the",
"resume",
"packet",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L676-L685 |
116,731 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.sendIdentify | private void sendIdentify(WebSocket websocket) {
ObjectNode identifyPacket = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.IDENTIFY.getCode());
ObjectNode data = identifyPacket.putObject("d");
String token = api.getPrefixedToken();
data.put("token", token... | java | private void sendIdentify(WebSocket websocket) {
ObjectNode identifyPacket = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.IDENTIFY.getCode());
ObjectNode data = identifyPacket.putObject("d");
String token = api.getPrefixedToken();
data.put("token", token... | [
"private",
"void",
"sendIdentify",
"(",
"WebSocket",
"websocket",
")",
"{",
"ObjectNode",
"identifyPacket",
"=",
"JsonNodeFactory",
".",
"instance",
".",
"objectNode",
"(",
")",
".",
"put",
"(",
"\"op\"",
",",
"GatewayOpcode",
".",
"IDENTIFY",
".",
"getCode",
... | Sends the identify packet.
@param websocket The websocket the identify packet should be sent to. | [
"Sends",
"the",
"identify",
"packet",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L692-L739 |
116,732 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.sendVoiceStateUpdate | public void sendVoiceStateUpdate(
Server server, ServerVoiceChannel channel, Boolean selfMuted, Boolean selfDeafened) {
ObjectNode updateVoiceStatePacket = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.VOICE_STATE_UPDATE.getCode());
if (server == null) {
... | java | public void sendVoiceStateUpdate(
Server server, ServerVoiceChannel channel, Boolean selfMuted, Boolean selfDeafened) {
ObjectNode updateVoiceStatePacket = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.VOICE_STATE_UPDATE.getCode());
if (server == null) {
... | [
"public",
"void",
"sendVoiceStateUpdate",
"(",
"Server",
"server",
",",
"ServerVoiceChannel",
"channel",
",",
"Boolean",
"selfMuted",
",",
"Boolean",
"selfDeafened",
")",
"{",
"ObjectNode",
"updateVoiceStatePacket",
"=",
"JsonNodeFactory",
".",
"instance",
".",
"objec... | Sends the voice state update packet.
@param server The server to send the voice state update for. Can be {@code null} if {@code channel} is given.
@param channel The channel to connect to or {@code null} to disconnect from voice.
@param selfMuted Whether to self-mute on the given server. If {@code null}, current state... | [
"Sends",
"the",
"voice",
"state",
"update",
"packet",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L749-L767 |
116,733 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.registerHandlers | private void registerHandlers() {
// general
addHandler(new ReadyHandler(api));
addHandler(new ResumedHandler(api));
// server
addHandler(new GuildBanAddHandler(api));
addHandler(new GuildBanRemoveHandler(api));
addHandler(new GuildCreateHandler(api));
ad... | java | private void registerHandlers() {
// general
addHandler(new ReadyHandler(api));
addHandler(new ResumedHandler(api));
// server
addHandler(new GuildBanAddHandler(api));
addHandler(new GuildBanRemoveHandler(api));
addHandler(new GuildCreateHandler(api));
ad... | [
"private",
"void",
"registerHandlers",
"(",
")",
"{",
"// general",
"addHandler",
"(",
"new",
"ReadyHandler",
"(",
"api",
")",
")",
";",
"addHandler",
"(",
"new",
"ResumedHandler",
"(",
"api",
")",
")",
";",
"// server",
"addHandler",
"(",
"new",
"GuildBanAd... | Registers all handlers. | [
"Registers",
"all",
"handlers",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L772-L820 |
116,734 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.updateStatus | public void updateStatus() {
Optional<Activity> activity = api.getActivity();
ObjectNode updateStatus = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.STATUS_UPDATE.getCode());
ObjectNode data = updateStatus.putObject("d")
.put("status", api.getSta... | java | public void updateStatus() {
Optional<Activity> activity = api.getActivity();
ObjectNode updateStatus = JsonNodeFactory.instance.objectNode()
.put("op", GatewayOpcode.STATUS_UPDATE.getCode());
ObjectNode data = updateStatus.putObject("d")
.put("status", api.getSta... | [
"public",
"void",
"updateStatus",
"(",
")",
"{",
"Optional",
"<",
"Activity",
">",
"activity",
"=",
"api",
".",
"getActivity",
"(",
")",
";",
"ObjectNode",
"updateStatus",
"=",
"JsonNodeFactory",
".",
"instance",
".",
"objectNode",
"(",
")",
".",
"put",
"(... | Sends the update status packet. | [
"Sends",
"the",
"update",
"status",
"packet",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L852-L866 |
116,735 | Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java | DiscordWebSocketAdapter.queueRequestGuildMembers | public void queueRequestGuildMembers(Server server) {
logger.debug("Queued {} for request guild members packet", server);
requestGuildMembersQueue.add(server.getId());
} | java | public void queueRequestGuildMembers(Server server) {
logger.debug("Queued {} for request guild members packet", server);
requestGuildMembersQueue.add(server.getId());
} | [
"public",
"void",
"queueRequestGuildMembers",
"(",
"Server",
"server",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Queued {} for request guild members packet\"",
",",
"server",
")",
";",
"requestGuildMembersQueue",
".",
"add",
"(",
"server",
".",
"getId",
"(",
")",
... | Adds a server id to be queued for the "request guild members" packet.
@param server The server. | [
"Adds",
"a",
"server",
"id",
"to",
"be",
"queued",
"for",
"the",
"request",
"guild",
"members",
"packet",
"."
] | 915aad084dc5e863284267529d0dccd625fc6886 | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/gateway/DiscordWebSocketAdapter.java#L873-L876 |
116,736 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/Indexed.java | Indexed.index | public static <T> Indexed<T> index(long index, T value) {
return new Indexed<>(index, value);
} | java | public static <T> Indexed<T> index(long index, T value) {
return new Indexed<>(index, value);
} | [
"public",
"static",
"<",
"T",
">",
"Indexed",
"<",
"T",
">",
"index",
"(",
"long",
"index",
",",
"T",
"value",
")",
"{",
"return",
"new",
"Indexed",
"<>",
"(",
"index",
",",
"value",
")",
";",
"}"
] | Combine an index and a value into an indexed value.
@param index The index of the value.
@param value The value indexed.
@param <T> The type of the value.
@return The indexed value. | [
"Combine",
"an",
"index",
"and",
"a",
"value",
"into",
"an",
"indexed",
"value",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/Indexed.java#L19-L21 |
116,737 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/stateful/Transition.java | Transition.to | @SafeVarargs
public static <S, O> Transition<S, O> to(S newState, O...outputs) {
return to(newState, Stream.of(outputs));
} | java | @SafeVarargs
public static <S, O> Transition<S, O> to(S newState, O...outputs) {
return to(newState, Stream.of(outputs));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"S",
",",
"O",
">",
"Transition",
"<",
"S",
",",
"O",
">",
"to",
"(",
"S",
"newState",
",",
"O",
"...",
"outputs",
")",
"{",
"return",
"to",
"(",
"newState",
",",
"Stream",
".",
"of",
"(",
"outputs",
"... | Create a transition to a new state with zero or more outputs.
@param newState The state to transition to.
@param outputs The outputs from the transition.
@param <S> The type of the state to transition to.
@param <O> The type of the outputs from the transition.
@return The constructed transition. | [
"Create",
"a",
"transition",
"to",
"a",
"new",
"state",
"with",
"zero",
"or",
"more",
"outputs",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/stateful/Transition.java#L20-L23 |
116,738 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/stateful/Transition.java | Transition.to | public static <S, O> Transition<S, O> to(S newState, Stream<O> outputs) {
return new Transition<>(newState, outputs);
} | java | public static <S, O> Transition<S, O> to(S newState, Stream<O> outputs) {
return new Transition<>(newState, outputs);
} | [
"public",
"static",
"<",
"S",
",",
"O",
">",
"Transition",
"<",
"S",
",",
"O",
">",
"to",
"(",
"S",
"newState",
",",
"Stream",
"<",
"O",
">",
"outputs",
")",
"{",
"return",
"new",
"Transition",
"<>",
"(",
"newState",
",",
"outputs",
")",
";",
"}"... | Create a transition to a new state with the given outputs.
@param newState The state to transition to.
@param outputs The outputs from the transition.
@param <S> The type of the state to transition to.
@param <O> The type of the outputs.
@return The constructed transition. | [
"Create",
"a",
"transition",
"to",
"a",
"new",
"state",
"with",
"the",
"given",
"outputs",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/stateful/Transition.java#L33-L35 |
116,739 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java | CollectorUtils.maxBy | public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> maxBy(Function<T, Y> projection) {
return maxBy(projection, Comparable::compareTo);
} | java | public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> maxBy(Function<T, Y> projection) {
return maxBy(projection, Comparable::compareTo);
} | [
"public",
"static",
"<",
"T",
",",
"Y",
"extends",
"Comparable",
"<",
"Y",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"T",
">",
">",
"maxBy",
"(",
"Function",
"<",
"T",
",",
"Y",
">",
"projection",
")",
"{",
"return",
"maxBy... | Find the item for which the supplied projection returns the maximum value.
@param projection The projection to apply to each item.
@param <T> The type of each item.
@param <Y> The type of the projected value to compare on.
@return The collector. | [
"Find",
"the",
"item",
"for",
"which",
"the",
"supplied",
"projection",
"returns",
"the",
"maximum",
"value",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java#L26-L28 |
116,740 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.zip | public static <L, R, O> Stream<O> zip(Stream<L> lefts, Stream<R> rights, BiFunction<L, R, O> combiner) {
return StreamSupport.stream(ZippingSpliterator.zipping(lefts.spliterator(), rights.spliterator(), combiner), false)
.onClose(closerFor(lefts, rights));
} | java | public static <L, R, O> Stream<O> zip(Stream<L> lefts, Stream<R> rights, BiFunction<L, R, O> combiner) {
return StreamSupport.stream(ZippingSpliterator.zipping(lefts.spliterator(), rights.spliterator(), combiner), false)
.onClose(closerFor(lefts, rights));
} | [
"public",
"static",
"<",
"L",
",",
"R",
",",
"O",
">",
"Stream",
"<",
"O",
">",
"zip",
"(",
"Stream",
"<",
"L",
">",
"lefts",
",",
"Stream",
"<",
"R",
">",
"rights",
",",
"BiFunction",
"<",
"L",
",",
"R",
",",
"O",
">",
"combiner",
")",
"{",
... | Zip together the "left" and "right" streams until either runs out of values.
Each pair of values is combined into a single value using the supplied combiner function.
@param lefts The "left" stream to zip.
@param rights The "right" stream to zip.
@param combiner The function to combine "left" and "right" values.
@param... | [
"Zip",
"together",
"the",
"left",
"and",
"right",
"streams",
"until",
"either",
"runs",
"out",
"of",
"values",
".",
"Each",
"pair",
"of",
"values",
"is",
"combined",
"into",
"a",
"single",
"value",
"using",
"the",
"supplied",
"combiner",
"function",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L73-L76 |
116,741 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.zip | public static <L, M, R, O> Stream<O> zip(Stream<L> lefts, Stream<M> middles, Stream<R> rights, TriFunction<L, M, R, O> combiner) {
return StreamSupport.stream(TriZippingSpliterator.zipping(
lefts.spliterator(),
middles.spliterator(),
rights.spliterator(),
... | java | public static <L, M, R, O> Stream<O> zip(Stream<L> lefts, Stream<M> middles, Stream<R> rights, TriFunction<L, M, R, O> combiner) {
return StreamSupport.stream(TriZippingSpliterator.zipping(
lefts.spliterator(),
middles.spliterator(),
rights.spliterator(),
... | [
"public",
"static",
"<",
"L",
",",
"M",
",",
"R",
",",
"O",
">",
"Stream",
"<",
"O",
">",
"zip",
"(",
"Stream",
"<",
"L",
">",
"lefts",
",",
"Stream",
"<",
"M",
">",
"middles",
",",
"Stream",
"<",
"R",
">",
"rights",
",",
"TriFunction",
"<",
... | Zip together the "left", "middle" and "right" streams until any stream runs out of values.
Each triple of values is combined into a single value using the supplied combiner function.
@param lefts The "left" stream to zip.
@param middles The "middle" stream to zip.
@param rights The "right" stream to zip.
@param combine... | [
"Zip",
"together",
"the",
"left",
"middle",
"and",
"right",
"streams",
"until",
"any",
"stream",
"runs",
"out",
"of",
"values",
".",
"Each",
"triple",
"of",
"values",
"is",
"combined",
"into",
"a",
"single",
"value",
"using",
"the",
"supplied",
"combiner",
... | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L92-L99 |
116,742 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.zip | public static <T, O> Stream<O> zip(List<Stream<T>> streams, Function<List<T>, O> combiner) {
List<Spliterator<T>> spliterators = streams.stream().map(Stream::spliterator).collect(Collectors.toList());
return StreamSupport.stream(ListZippingSpliterator.zipping(spliterators, combiner), false)
... | java | public static <T, O> Stream<O> zip(List<Stream<T>> streams, Function<List<T>, O> combiner) {
List<Spliterator<T>> spliterators = streams.stream().map(Stream::spliterator).collect(Collectors.toList());
return StreamSupport.stream(ListZippingSpliterator.zipping(spliterators, combiner), false)
... | [
"public",
"static",
"<",
"T",
",",
"O",
">",
"Stream",
"<",
"O",
">",
"zip",
"(",
"List",
"<",
"Stream",
"<",
"T",
">",
">",
"streams",
",",
"Function",
"<",
"List",
"<",
"T",
">",
",",
"O",
">",
"combiner",
")",
"{",
"List",
"<",
"Spliterator"... | Zip together a list of streams until one of them runs out of values.
Each tuple of values is combined into a single value using the supplied combiner function.
@param streams The streams to zip.
@param combiner The function to combine the values.
@param <T> The type over which the streams stream.
@param <O> The type cr... | [
"Zip",
"together",
"a",
"list",
"of",
"streams",
"until",
"one",
"of",
"them",
"runs",
"out",
"of",
"values",
".",
"Each",
"tuple",
"of",
"values",
"is",
"combined",
"into",
"a",
"single",
"value",
"using",
"the",
"supplied",
"combiner",
"function",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L111-L115 |
116,743 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.takeWhile | public static <T> Stream<T> takeWhile(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(TakeWhileSpliterator.over(source.spliterator(), condition), false)
.onClose(source::close);
} | java | public static <T> Stream<T> takeWhile(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(TakeWhileSpliterator.over(source.spliterator(), condition), false)
.onClose(source::close);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"takeWhile",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"TakeWhileSpliterator",
".",
"over",
... | Construct a stream which takes values from the source stream for as long as they meet the supplied condition, and stops
as soon as a value is encountered which does not meet the condition.
@param source The source stream.
@param condition The condition to apply to elements of the source stream.
@param <T> The type over... | [
"Construct",
"a",
"stream",
"which",
"takes",
"values",
"from",
"the",
"source",
"stream",
"for",
"as",
"long",
"as",
"they",
"meet",
"the",
"supplied",
"condition",
"and",
"stops",
"as",
"soon",
"as",
"a",
"value",
"is",
"encountered",
"which",
"does",
"n... | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L129-L132 |
116,744 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.takeWhileInclusive | public static <T> Stream<T> takeWhileInclusive(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(TakeWhileSpliterator.overInclusive(source.spliterator(), condition), false)
.onClose(source::close);
} | java | public static <T> Stream<T> takeWhileInclusive(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(TakeWhileSpliterator.overInclusive(source.spliterator(), condition), false)
.onClose(source::close);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"takeWhileInclusive",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"TakeWhileSpliterator",
".",
... | Construct a stream which takes values from the source stream until but including the first value that is
encountered which does not meet the condition.
@param source The source stream.
@param condition The condition to apply to elements of the source stream.
@param <T> The type over which the stream streams.
@return A ... | [
"Construct",
"a",
"stream",
"which",
"takes",
"values",
"from",
"the",
"source",
"stream",
"until",
"but",
"including",
"the",
"first",
"value",
"that",
"is",
"encountered",
"which",
"does",
"not",
"meet",
"the",
"condition",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L142-L145 |
116,745 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.takeUntil | public static <T> Stream<T> takeUntil(Stream<T> source, Predicate<T> condition) {
return takeWhile(source, condition.negate());
} | java | public static <T> Stream<T> takeUntil(Stream<T> source, Predicate<T> condition) {
return takeWhile(source, condition.negate());
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"takeUntil",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"takeWhile",
"(",
"source",
",",
"condition",
".",
"negate",
"(",
")",
... | Construct a stream which takes values from the source stream until one of them meets the supplied condition,
and then stops.
@param source The source stream.
@param condition The condition to apply to elements of the source stream.
@param <T> The type over which the stream streams.
@return A condition-bounded stream. | [
"Construct",
"a",
"stream",
"which",
"takes",
"values",
"from",
"the",
"source",
"stream",
"until",
"one",
"of",
"them",
"meets",
"the",
"supplied",
"condition",
"and",
"then",
"stops",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L155-L157 |
116,746 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.takeUntilInclusive | public static <T> Stream<T> takeUntilInclusive(Stream<T> source, Predicate<T> condition) {
return takeWhileInclusive(source, condition.negate());
} | java | public static <T> Stream<T> takeUntilInclusive(Stream<T> source, Predicate<T> condition) {
return takeWhileInclusive(source, condition.negate());
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"takeUntilInclusive",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"takeWhileInclusive",
"(",
"source",
",",
"condition",
".",
"negat... | Construct a stream which takes values from the source stream until but including the first value that is
encountered which meets the supplied condition.
@param source The source stream.
@param condition The condition to apply to elements of the source stream.
@param <T> The type over which the stream streams.
@return A... | [
"Construct",
"a",
"stream",
"which",
"takes",
"values",
"from",
"the",
"source",
"stream",
"until",
"but",
"including",
"the",
"first",
"value",
"that",
"is",
"encountered",
"which",
"meets",
"the",
"supplied",
"condition",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L167-L169 |
116,747 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.skipWhile | public static <T> Stream<T> skipWhile(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(SkipUntilSpliterator.over(source.spliterator(), condition.negate()), false)
.onClose(source::close);
} | java | public static <T> Stream<T> skipWhile(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(SkipUntilSpliterator.over(source.spliterator(), condition.negate()), false)
.onClose(source::close);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"skipWhile",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"SkipUntilSpliterator",
".",
"over",
... | Construct a stream which skips values from the source stream for as long as they meet the supplied condition,
then streams every remaining value as soon as the first value is found which does not meet the condition.
@param source The source stream.
@param condition The condition to apply to elements of the source strea... | [
"Construct",
"a",
"stream",
"which",
"skips",
"values",
"from",
"the",
"source",
"stream",
"for",
"as",
"long",
"as",
"they",
"meet",
"the",
"supplied",
"condition",
"then",
"streams",
"every",
"remaining",
"value",
"as",
"soon",
"as",
"the",
"first",
"value... | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L179-L182 |
116,748 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.skipWhileInclusive | public static <T> Stream<T> skipWhileInclusive(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(SkipUntilSpliterator.overInclusive(source.spliterator(), condition.negate()), false)
.onClose(source::close);
} | java | public static <T> Stream<T> skipWhileInclusive(Stream<T> source, Predicate<T> condition) {
return StreamSupport.stream(SkipUntilSpliterator.overInclusive(source.spliterator(), condition.negate()), false)
.onClose(source::close);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"skipWhileInclusive",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"SkipUntilSpliterator",
".",
... | Construct a stream which skips values from the source stream up until but including the first value is found that
does not meet the given condition.
@param source The source stream.
@param condition The condition to apply to elements of the source stream.
@param <T> The type over which the stream streams.
@return An el... | [
"Construct",
"a",
"stream",
"which",
"skips",
"values",
"from",
"the",
"source",
"stream",
"up",
"until",
"but",
"including",
"the",
"first",
"value",
"is",
"found",
"that",
"does",
"not",
"meet",
"the",
"given",
"condition",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L192-L195 |
116,749 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.windowed | public static <T> Stream<List<T>> windowed(Stream<T> source, int windowSize){
return windowed(source, windowSize, 1);
} | java | public static <T> Stream<List<T>> windowed(Stream<T> source, int windowSize){
return windowed(source, windowSize, 1);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"List",
"<",
"T",
">",
">",
"windowed",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"int",
"windowSize",
")",
"{",
"return",
"windowed",
"(",
"source",
",",
"windowSize",
",",
"1",
")",
";",
"}"
] | Constructs a stream that is a windowed view of the source stream of the size window size
with a default overlap of one item
@param source The source stream
@param windowSize The window size
@param <T> The type over which to stream
@return A stream of lists representing the window | [
"Constructs",
"a",
"stream",
"that",
"is",
"a",
"windowed",
"view",
"of",
"the",
"source",
"stream",
"of",
"the",
"size",
"window",
"size",
"with",
"a",
"default",
"overlap",
"of",
"one",
"item"
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L245-L247 |
116,750 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.interleave | @SafeVarargs
public static <T> Stream<T> interleave(Function<T[], Integer> selector, Stream<T>... streams) {
Spliterator<T>[] spliterators = (Spliterator<T>[]) Stream.of(streams).map(BaseStream::spliterator).toArray(Spliterator[]::new);
return StreamSupport.stream(InterleavingSpliterator.interleavin... | java | @SafeVarargs
public static <T> Stream<T> interleave(Function<T[], Integer> selector, Stream<T>... streams) {
Spliterator<T>[] spliterators = (Spliterator<T>[]) Stream.of(streams).map(BaseStream::spliterator).toArray(Spliterator[]::new);
return StreamSupport.stream(InterleavingSpliterator.interleavin... | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"interleave",
"(",
"Function",
"<",
"T",
"[",
"]",
",",
"Integer",
">",
"selector",
",",
"Stream",
"<",
"T",
">",
"...",
"streams",
")",
"{",
"Spliterator",
"<",
"T",
"... | Construct a stream which interleaves the supplied streams, picking items using the supplied selector function.
The selector function will be passed an array containing one value from each stream, or null if that stream
has no more values, and must return the integer index of the value to accept. That value will become... | [
"Construct",
"a",
"stream",
"which",
"interleaves",
"the",
"supplied",
"streams",
"picking",
"items",
"using",
"the",
"supplied",
"selector",
"function",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L338-L343 |
116,751 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.reject | public static <T> Stream<T> reject(Stream<T> source, Predicate<? super T> predicate) {
return source.filter(predicate.negate());
} | java | public static <T> Stream<T> reject(Stream<T> source, Predicate<? super T> predicate) {
return source.filter(predicate.negate());
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"reject",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"return",
"source",
".",
"filter",
"(",
"predicate",
".",
"negate",
... | Filter with the condition negated. Will throw away any members of the source stream that match the condition.
@param source The source stream.
@param predicate The filter condition.
@param <T> The type over which the stream streams.
@return A rejecting stream. | [
"Filter",
"with",
"the",
"condition",
"negated",
".",
"Will",
"throw",
"away",
"any",
"members",
"of",
"the",
"source",
"stream",
"that",
"match",
"the",
"condition",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L410-L412 |
116,752 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.aggregate | public static <T> Stream<List<T>> aggregate(Stream<T> source, BiPredicate<T, T> predicate) {
return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(),
(a, e) -> a.isEmpty() || predicate.test(a.get(a.size() - 1), e)), false)
.onClose(source::close);
} | java | public static <T> Stream<List<T>> aggregate(Stream<T> source, BiPredicate<T, T> predicate) {
return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(),
(a, e) -> a.isEmpty() || predicate.test(a.get(a.size() - 1), e)), false)
.onClose(source::close);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"List",
"<",
"T",
">",
">",
"aggregate",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"BiPredicate",
"<",
"T",
",",
"T",
">",
"predicate",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"n... | Aggregates items from source stream into list of items while supplied predicate is true when evaluated on previous and current item.
Can by seen as streaming alternative to Collectors.groupingBy when source stream is sorted by key.
@param source - source stream
@param predicate - predicate specifying boundary between g... | [
"Aggregates",
"items",
"from",
"source",
"stream",
"into",
"list",
"of",
"items",
"while",
"supplied",
"predicate",
"is",
"true",
"when",
"evaluated",
"on",
"previous",
"and",
"current",
"item",
".",
"Can",
"by",
"seen",
"as",
"streaming",
"alternative",
"to",... | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L422-L426 |
116,753 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.aggregate | public static <T> Stream<List<T>> aggregate(Stream<T> source, int size) {
if (size <= 0) throw new IllegalArgumentException("Positive size expected, was: "+size);
return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(), (a, e) -> a.size() < size), false)
.onClose(so... | java | public static <T> Stream<List<T>> aggregate(Stream<T> source, int size) {
if (size <= 0) throw new IllegalArgumentException("Positive size expected, was: "+size);
return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(), (a, e) -> a.size() < size), false)
.onClose(so... | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"List",
"<",
"T",
">",
">",
"aggregate",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"... | Aggregates items from source stream into list of items with fixed size
@param source - source stream
@param size - size of the aggregated list
@param <T> The type over which the stream streams.
@return Stream of List<T> with all list of size @size with possible exception of last List<T> | [
"Aggregates",
"items",
"from",
"source",
"stream",
"into",
"list",
"of",
"items",
"with",
"fixed",
"size"
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L435-L439 |
116,754 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.aggregateOnListCondition | public static <T> Stream<List<T>> aggregateOnListCondition(Stream<T> source, BiPredicate<List<T>, T> predicate) {
return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(), predicate), false)
.onClose(source::close);
} | java | public static <T> Stream<List<T>> aggregateOnListCondition(Stream<T> source, BiPredicate<List<T>, T> predicate) {
return StreamSupport.stream(new AggregatingSpliterator<>(source.spliterator(), predicate), false)
.onClose(source::close);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"List",
"<",
"T",
">",
">",
"aggregateOnListCondition",
"(",
"Stream",
"<",
"T",
">",
"source",
",",
"BiPredicate",
"<",
"List",
"<",
"T",
">",
",",
"T",
">",
"predicate",
")",
"{",
"return",
"StreamS... | Aggregates items from source stream. Similar to @aggregate, but uses different predicate, evaluated on all items aggregated so far
and next item from source stream.
@param source - source stream
@param predicate - predicate specifying boundary between groups of items
@param <T> The type over which the stream streams.
@... | [
"Aggregates",
"items",
"from",
"source",
"stream",
".",
"Similar",
"to"
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L449-L452 |
116,755 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.ofSingleNullable | public static <T> Stream<T> ofSingleNullable(T nullable) {
return null == nullable ? Stream.empty() : Stream.of(nullable);
} | java | public static <T> Stream<T> ofSingleNullable(T nullable) {
return null == nullable ? Stream.empty() : Stream.of(nullable);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"ofSingleNullable",
"(",
"T",
"nullable",
")",
"{",
"return",
"null",
"==",
"nullable",
"?",
"Stream",
".",
"empty",
"(",
")",
":",
"Stream",
".",
"of",
"(",
"nullable",
")",
";",
"}"
] | Converts nulls into an empty stream, and non-null values into a stream with one element.
@param nullable The nullable value to convert.
@param <T> The type of the value.
@return A stream of zero or one values. | [
"Converts",
"nulls",
"into",
"an",
"empty",
"stream",
"and",
"non",
"-",
"null",
"values",
"into",
"a",
"stream",
"with",
"one",
"element",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L472-L474 |
116,756 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.ofNullable | public static <T> Stream<T> ofNullable(Iterable<T> iterable) {
return null == iterable ? Stream.empty() : stream(iterable);
} | java | public static <T> Stream<T> ofNullable(Iterable<T> iterable) {
return null == iterable ? Stream.empty() : stream(iterable);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"ofNullable",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"return",
"null",
"==",
"iterable",
"?",
"Stream",
".",
"empty",
"(",
")",
":",
"stream",
"(",
"iterable",
")",
";",
"}"... | Converts a nullable Iterable into a Stream.
@param iterable The iterable to stream.
@param <T> The type of the iterable
@return Stream of the values returned by the iterable, or an empty stream if the iterable is null | [
"Converts",
"a",
"nullable",
"Iterable",
"into",
"a",
"Stream",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L502-L504 |
116,757 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.ofNullable | public static IntStream ofNullable(int[] nullable) {
return null == nullable ? IntStream.empty() : Arrays.stream(nullable);
} | java | public static IntStream ofNullable(int[] nullable) {
return null == nullable ? IntStream.empty() : Arrays.stream(nullable);
} | [
"public",
"static",
"IntStream",
"ofNullable",
"(",
"int",
"[",
"]",
"nullable",
")",
"{",
"return",
"null",
"==",
"nullable",
"?",
"IntStream",
".",
"empty",
"(",
")",
":",
"Arrays",
".",
"stream",
"(",
"nullable",
")",
";",
"}"
] | Converts nullable int array into an empty stream, and non-null array into a stream.
@param nullable The nullable array to convert.
@return A stream of zero or more values. | [
"Converts",
"nullable",
"int",
"array",
"into",
"an",
"empty",
"stream",
"and",
"non",
"-",
"null",
"array",
"into",
"a",
"stream",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L511-L513 |
116,758 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.ofNullable | public static LongStream ofNullable(long[] nullable) {
return null == nullable ? LongStream.empty() : Arrays.stream(nullable);
} | java | public static LongStream ofNullable(long[] nullable) {
return null == nullable ? LongStream.empty() : Arrays.stream(nullable);
} | [
"public",
"static",
"LongStream",
"ofNullable",
"(",
"long",
"[",
"]",
"nullable",
")",
"{",
"return",
"null",
"==",
"nullable",
"?",
"LongStream",
".",
"empty",
"(",
")",
":",
"Arrays",
".",
"stream",
"(",
"nullable",
")",
";",
"}"
] | Converts nullable long array into an empty stream, and non-null array into a stream.
@param nullable The nullable array to convert.
@return A stream of zero or more values. | [
"Converts",
"nullable",
"long",
"array",
"into",
"an",
"empty",
"stream",
"and",
"non",
"-",
"null",
"array",
"into",
"a",
"stream",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L520-L522 |
116,759 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.ofNullable | public static DoubleStream ofNullable(double[] nullable) {
return null == nullable ? DoubleStream.empty() : Arrays.stream(nullable);
} | java | public static DoubleStream ofNullable(double[] nullable) {
return null == nullable ? DoubleStream.empty() : Arrays.stream(nullable);
} | [
"public",
"static",
"DoubleStream",
"ofNullable",
"(",
"double",
"[",
"]",
"nullable",
")",
"{",
"return",
"null",
"==",
"nullable",
"?",
"DoubleStream",
".",
"empty",
"(",
")",
":",
"Arrays",
".",
"stream",
"(",
"nullable",
")",
";",
"}"
] | Converts nullable float array into an empty stream, and non-null array into a stream.
@param nullable The nullable array to convert.
@return A stream of zero or more values. | [
"Converts",
"nullable",
"float",
"array",
"into",
"an",
"empty",
"stream",
"and",
"non",
"-",
"null",
"array",
"into",
"a",
"stream",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L529-L531 |
116,760 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.ofNullable | public static <T> Stream<T> ofNullable(T[] nullable) {
return null == nullable ? Stream.empty() : Stream.of(nullable);
} | java | public static <T> Stream<T> ofNullable(T[] nullable) {
return null == nullable ? Stream.empty() : Stream.of(nullable);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"ofNullable",
"(",
"T",
"[",
"]",
"nullable",
")",
"{",
"return",
"null",
"==",
"nullable",
"?",
"Stream",
".",
"empty",
"(",
")",
":",
"Stream",
".",
"of",
"(",
"nullable",
")",
";",
"}... | Converts nullable array into an empty stream, and non-null array into a stream.
@param nullable The nullable array to convert.
@param <T> The type of the value.
@return A stream of zero or more values. | [
"Converts",
"nullable",
"array",
"into",
"an",
"empty",
"stream",
"and",
"non",
"-",
"null",
"array",
"into",
"a",
"stream",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L539-L541 |
116,761 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.cycle | public static <T> Stream<T> cycle(T...items) {
return IntStream.iterate(0, i -> i == items.length - 1 ? 0 : i + 1).mapToObj(i -> items[i]);
} | java | public static <T> Stream<T> cycle(T...items) {
return IntStream.iterate(0, i -> i == items.length - 1 ? 0 : i + 1).mapToObj(i -> items[i]);
} | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"cycle",
"(",
"T",
"...",
"items",
")",
"{",
"return",
"IntStream",
".",
"iterate",
"(",
"0",
",",
"i",
"->",
"i",
"==",
"items",
".",
"length",
"-",
"1",
"?",
"0",
":",
"i",
"+",
"1... | Cycles through a set of items indefinitely.
@param items The items to cycle through.
@param <T> The type of the items.
@return An infinite stream cycling through the supplied items. | [
"Cycles",
"through",
"a",
"set",
"of",
"items",
"indefinitely",
"."
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L549-L551 |
116,762 | poetix/protonpack | src/main/java/com/codepoetics/protonpack/collectors/CompletableFutures.java | CompletableFutures.toFutureList | public static <T> Collector<CompletableFuture<T>, ?, CompletableFuture<List<T>>> toFutureList() {
return Collectors.collectingAndThen(
Collectors.<CompletableFuture<T>>toList(),
futures -> {
AtomicLong resultsRemaining = new AtomicLong(futures.size());
... | java | public static <T> Collector<CompletableFuture<T>, ?, CompletableFuture<List<T>>> toFutureList() {
return Collectors.collectingAndThen(
Collectors.<CompletableFuture<T>>toList(),
futures -> {
AtomicLong resultsRemaining = new AtomicLong(futures.size());
... | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"CompletableFuture",
"<",
"T",
">",
",",
"?",
",",
"CompletableFuture",
"<",
"List",
"<",
"T",
">",
">",
">",
"toFutureList",
"(",
")",
"{",
"return",
"Collectors",
".",
"collectingAndThen",
"(",
"Coll... | Collector which converts a stream of CompletableFuture<T> into a CompletableFuture<List<T>>
@param <T> The type of value returned by each {@link CompletableFuture} in the stream.
@return A {@link CompletableFuture} which completes with a list of all the values returned by futures in the
stream, once t... | [
"Collector",
"which",
"converts",
"a",
"stream",
"of",
"CompletableFuture<",
";",
"T>",
";",
"into",
"a",
"CompletableFuture<",
";",
"List<",
";",
"T>",
";",
">",
";"
] | 00c55a05a4779926d02d5f4e6c820560a773f9f1 | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/collectors/CompletableFutures.java#L28-L52 |
116,763 | cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/JsonBasedPropertiesProvider.java | JsonBasedPropertiesProvider.convertToMap | @SuppressWarnings("unchecked")
private Map<String, Object> convertToMap(Object jsonDocument) {
Map<String, Object> jsonMap = new LinkedHashMap<>();
// Document is a text block
if (!(jsonDocument instanceof JSONObject)) {
jsonMap.put("content", jsonDocument);
return jsonMap;
}
JSONObj... | java | @SuppressWarnings("unchecked")
private Map<String, Object> convertToMap(Object jsonDocument) {
Map<String, Object> jsonMap = new LinkedHashMap<>();
// Document is a text block
if (!(jsonDocument instanceof JSONObject)) {
jsonMap.put("content", jsonDocument);
return jsonMap;
}
JSONObj... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"convertToMap",
"(",
"Object",
"jsonDocument",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"jsonMap",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"... | Convert given Json document to a multi-level map. | [
"Convert",
"given",
"Json",
"document",
"to",
"a",
"multi",
"-",
"level",
"map",
"."
] | 47d4f63e5fc820c62631e557adc34a29d8ab396d | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/JsonBasedPropertiesProvider.java#L76-L106 |
116,764 | cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/system/EnvironmentVariablesConfigurationSource.java | EnvironmentVariablesConfigurationSource.convertToPropertiesKey | private static String convertToPropertiesKey(String environmentVariableKey, String environmentContext) {
return environmentVariableKey.substring(environmentContext.length()).replace(ENV_DELIMITER, PROPERTIES_DELIMITER);
} | java | private static String convertToPropertiesKey(String environmentVariableKey, String environmentContext) {
return environmentVariableKey.substring(environmentContext.length()).replace(ENV_DELIMITER, PROPERTIES_DELIMITER);
} | [
"private",
"static",
"String",
"convertToPropertiesKey",
"(",
"String",
"environmentVariableKey",
",",
"String",
"environmentContext",
")",
"{",
"return",
"environmentVariableKey",
".",
"substring",
"(",
"environmentContext",
".",
"length",
"(",
")",
")",
".",
"replac... | Convert the Environment Variable Name to the expected Properties Key formatting
@param environmentVariableKey The Env Variable Name, possibly prefixed with the {@link Environment} which
in this context serves as a way to namespace variables
@param environmentContext The Environment context in format: ENVIRONMENTNA... | [
"Convert",
"the",
"Environment",
"Variable",
"Name",
"to",
"the",
"expected",
"Properties",
"Key",
"formatting"
] | 47d4f63e5fc820c62631e557adc34a29d8ab396d | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/system/EnvironmentVariablesConfigurationSource.java#L81-L83 |
116,765 | cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/FormatBasedPropertiesProvider.java | FormatBasedPropertiesProvider.flatten | @SuppressWarnings("unchecked")
Map<String, Object> flatten(Map<String, Object> source) {
Map<String, Object> result = new LinkedHashMap<>();
for (String key : source.keySet()) {
Object value = source.get(key);
if (value instanceof Map) {
Map<String, Object> subMap = flatten((Map<String, ... | java | @SuppressWarnings("unchecked")
Map<String, Object> flatten(Map<String, Object> source) {
Map<String, Object> result = new LinkedHashMap<>();
for (String key : source.keySet()) {
Object value = source.get(key);
if (value instanceof Map) {
Map<String, Object> subMap = flatten((Map<String, ... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"String",
",",
"Object",
">",
"flatten",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"new",
"LinkedHashMap",
... | Flatten multi-level map. | [
"Flatten",
"multi",
"-",
"level",
"map",
"."
] | 47d4f63e5fc820c62631e557adc34a29d8ab396d | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/FormatBasedPropertiesProvider.java#L29-L62 |
116,766 | cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/YamlBasedPropertiesProvider.java | YamlBasedPropertiesProvider.convertToMap | @SuppressWarnings("unchecked")
private Map<String, Object> convertToMap(Object yamlDocument) {
Map<String, Object> yamlMap = new LinkedHashMap<>();
// Document is a text block
if (!(yamlDocument instanceof Map)) {
yamlMap.put("content", yamlDocument);
return yamlMap;
}
for (Map.Entr... | java | @SuppressWarnings("unchecked")
private Map<String, Object> convertToMap(Object yamlDocument) {
Map<String, Object> yamlMap = new LinkedHashMap<>();
// Document is a text block
if (!(yamlDocument instanceof Map)) {
yamlMap.put("content", yamlDocument);
return yamlMap;
}
for (Map.Entr... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"convertToMap",
"(",
"Object",
"yamlDocument",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"yamlMap",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"... | Convert given Yaml document to a multi-level map. | [
"Convert",
"given",
"Yaml",
"document",
"to",
"a",
"multi",
"-",
"level",
"map",
"."
] | 47d4f63e5fc820c62631e557adc34a29d8ab396d | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/context/propertiesprovider/YamlBasedPropertiesProvider.java#L73-L102 |
116,767 | cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/classpath/ClasspathConfigurationSource.java | ClasspathConfigurationSource.getConfiguration | @Override
public Properties getConfiguration(Environment environment) {
Properties properties = new Properties();
Path pathPrefix = Paths.get(environment.getName());
URL url = getClass().getClassLoader().getResource(pathPrefix.toString());
if (url == null && !environment.getName().isEmpty()) {
... | java | @Override
public Properties getConfiguration(Environment environment) {
Properties properties = new Properties();
Path pathPrefix = Paths.get(environment.getName());
URL url = getClass().getClassLoader().getResource(pathPrefix.toString());
if (url == null && !environment.getName().isEmpty()) {
... | [
"@",
"Override",
"public",
"Properties",
"getConfiguration",
"(",
"Environment",
"environment",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"Path",
"pathPrefix",
"=",
"Paths",
".",
"get",
"(",
"environment",
".",
"getName",
"... | Get configuration from classpath. See the class-level javadoc for detail on environment resolution.
@param environment environment to fetch configuration for
@return configuration set for {@code environment}
@throws MissingEnvironmentException when requested environment couldn't be found
@throws IllegalStateException ... | [
"Get",
"configuration",
"from",
"classpath",
".",
"See",
"the",
"class",
"-",
"level",
"javadoc",
"for",
"detail",
"on",
"environment",
"resolution",
"."
] | 47d4f63e5fc820c62631e557adc34a29d8ab396d | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/classpath/ClasspathConfigurationSource.java#L99-L131 |
116,768 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnectionReader.java | NatsConnectionReader.gatherOp | void gatherOp(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {
if (b == NatsConnection.LF) { // Got CRLF, jump to par... | java | void gatherOp(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {
if (b == NatsConnection.LF) { // Got CRLF, jump to par... | [
"void",
"gatherOp",
"(",
"int",
"maxPos",
")",
"throws",
"IOException",
"{",
"try",
"{",
"while",
"(",
"this",
".",
"bufferPosition",
"<",
"maxPos",
")",
"{",
"byte",
"b",
"=",
"this",
".",
"buffer",
"[",
"this",
".",
"bufferPosition",
"]",
";",
"this"... | Gather the op, either up to the first space or the first carraige return. | [
"Gather",
"the",
"op",
"either",
"up",
"to",
"the",
"first",
"space",
"or",
"the",
"first",
"carraige",
"return",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnectionReader.java#L155-L191 |
116,769 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnectionReader.java | NatsConnectionReader.gatherMessageProtocol | void gatherMessageProtocol(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {
if (b == NatsConnection.LF) {
... | java | void gatherMessageProtocol(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {
if (b == NatsConnection.LF) {
... | [
"void",
"gatherMessageProtocol",
"(",
"int",
"maxPos",
")",
"throws",
"IOException",
"{",
"try",
"{",
"while",
"(",
"this",
".",
"bufferPosition",
"<",
"maxPos",
")",
"{",
"byte",
"b",
"=",
"this",
".",
"buffer",
"[",
"this",
".",
"bufferPosition",
"]",
... | Stores the message protocol line in a char buffer that will be grepped for subject, reply | [
"Stores",
"the",
"message",
"protocol",
"line",
"in",
"a",
"char",
"buffer",
"that",
"will",
"be",
"grepped",
"for",
"subject",
"reply"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnectionReader.java#L194-L221 |
116,770 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnectionReader.java | NatsConnectionReader.gatherProtocol | void gatherProtocol(int maxPos) throws IOException {
// protocol buffer has max capacity, shouldn't need resizing
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {... | java | void gatherProtocol(int maxPos) throws IOException {
// protocol buffer has max capacity, shouldn't need resizing
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {... | [
"void",
"gatherProtocol",
"(",
"int",
"maxPos",
")",
"throws",
"IOException",
"{",
"// protocol buffer has max capacity, shouldn't need resizing\r",
"try",
"{",
"while",
"(",
"this",
".",
"bufferPosition",
"<",
"maxPos",
")",
"{",
"byte",
"b",
"=",
"this",
".",
"b... | Gather bytes for a protocol line | [
"Gather",
"bytes",
"for",
"a",
"protocol",
"line"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnectionReader.java#L224-L252 |
116,771 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnectionReader.java | NatsConnectionReader.gatherMessageData | void gatherMessageData(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
int possible = maxPos - this.bufferPosition;
int want = msgData.length - msgDataPosition;
// Grab all we can, until we get to the CR/LF
... | java | void gatherMessageData(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
int possible = maxPos - this.bufferPosition;
int want = msgData.length - msgDataPosition;
// Grab all we can, until we get to the CR/LF
... | [
"void",
"gatherMessageData",
"(",
"int",
"maxPos",
")",
"throws",
"IOException",
"{",
"try",
"{",
"while",
"(",
"this",
".",
"bufferPosition",
"<",
"maxPos",
")",
"{",
"int",
"possible",
"=",
"maxPos",
"-",
"this",
".",
"bufferPosition",
";",
"int",
"want"... | given to the message object | [
"given",
"to",
"the",
"message",
"object"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnectionReader.java#L256-L301 |
116,772 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnectionWriter.java | NatsConnectionWriter.stop | Future<Boolean> stop() {
this.startStopLock.lock();
try {
this.running.set(false);
this.outgoing.pause();
this.reconnectOutgoing.pause();
// Clear old ping/pong requests
byte[] pingRequest = NatsConnection.OP_PING.getBytes(Standard... | java | Future<Boolean> stop() {
this.startStopLock.lock();
try {
this.running.set(false);
this.outgoing.pause();
this.reconnectOutgoing.pause();
// Clear old ping/pong requests
byte[] pingRequest = NatsConnection.OP_PING.getBytes(Standard... | [
"Future",
"<",
"Boolean",
">",
"stop",
"(",
")",
"{",
"this",
".",
"startStopLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"this",
".",
"running",
".",
"set",
"(",
"false",
")",
";",
"this",
".",
"outgoing",
".",
"pause",
"(",
")",
";",
"this",
... | method does. | [
"method",
"does",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnectionWriter.java#L77-L94 |
116,773 | nats-io/java-nats | src/main/java/io/nats/client/impl/MessageQueue.java | MessageQueue.accumulate | NatsMessage accumulate(long maxSize, long maxMessages, Duration timeout)
throws InterruptedException {
if (!this.singleThreadedReader) {
throw new IllegalStateException("Accumulate is only supported in single reader mode.");
}
if (!this.isRunning()) {
... | java | NatsMessage accumulate(long maxSize, long maxMessages, Duration timeout)
throws InterruptedException {
if (!this.singleThreadedReader) {
throw new IllegalStateException("Accumulate is only supported in single reader mode.");
}
if (!this.isRunning()) {
... | [
"NatsMessage",
"accumulate",
"(",
"long",
"maxSize",
",",
"long",
"maxMessages",
",",
"Duration",
"timeout",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"!",
"this",
".",
"singleThreadedReader",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
... | readers are present, you could get out of order message delivery. | [
"readers",
"are",
"present",
"you",
"could",
"get",
"out",
"of",
"order",
"message",
"delivery",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/MessageQueue.java#L210-L271 |
116,774 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/Benchmark.java | Benchmark.close | public final void close() {
while (subChannel.size() > 0) {
subs.addSample(subChannel.poll());
}
while (pubChannel.size() > 0) {
pubs.addSample(pubChannel.poll());
}
if (subs.hasSamples()) {
start = subs.getStart();
end = subs.getE... | java | public final void close() {
while (subChannel.size() > 0) {
subs.addSample(subChannel.poll());
}
while (pubChannel.size() > 0) {
pubs.addSample(pubChannel.poll());
}
if (subs.hasSamples()) {
start = subs.getStart();
end = subs.getE... | [
"public",
"final",
"void",
"close",
"(",
")",
"{",
"while",
"(",
"subChannel",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"subs",
".",
"addSample",
"(",
"subChannel",
".",
"poll",
"(",
")",
")",
";",
"}",
"while",
"(",
"pubChannel",
".",
"size",
... | Closes this benchmark and calculates totals and times. | [
"Closes",
"this",
"benchmark",
"and",
"calculates",
"totals",
"and",
"times",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/Benchmark.java#L62-L86 |
116,775 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/Benchmark.java | Benchmark.report | public final String report() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("%s stats: %s\n", name, this));
if (pubs.hasSamples()) {
String indent = " ";
if (subs.hasSamples()) {
sb.append(String.format("%sPub stats: %s\n", ind... | java | public final String report() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("%s stats: %s\n", name, this));
if (pubs.hasSamples()) {
String indent = " ";
if (subs.hasSamples()) {
sb.append(String.format("%sPub stats: %s\n", ind... | [
"public",
"final",
"String",
"report",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%s stats: %s\\n\"",
",",
"name",
",",
"this",
")",
")",
";",
"if",
"(",
... | Creates the output report.
@return the report as a String. | [
"Creates",
"the",
"output",
"report",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/Benchmark.java#L93-L125 |
116,776 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/Benchmark.java | Benchmark.csv | public final String csv() {
StringBuilder sb = new StringBuilder();
String header =
"#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs";
sb.append(String.format("%s stats: %s\n", name, this));
sb.append(header); sb.append("\n");
sb.appen... | java | public final String csv() {
StringBuilder sb = new StringBuilder();
String header =
"#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs";
sb.append(String.format("%s stats: %s\n", name, this));
sb.append(header); sb.append("\n");
sb.appen... | [
"public",
"final",
"String",
"csv",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"header",
"=",
"\"#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs\"",
";",
"sb",
".",
"append",
"(",
"String",
... | Returns a string containing the report as series of CSV lines.
@return a string with multiple lines | [
"Returns",
"a",
"string",
"containing",
"the",
"report",
"as",
"series",
"of",
"CSV",
"lines",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/Benchmark.java#L132-L142 |
116,777 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createAccount | public static NKey createAccount(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.ACCOUNT, random);
} | java | public static NKey createAccount(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.ACCOUNT, random);
} | [
"public",
"static",
"NKey",
"createAccount",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"ACCOUNT",
",",
"random",
")",
";",
"}"
] | Create an Account NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws I... | [
"Create",
"an",
"Account",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L479-L482 |
116,778 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createCluster | public static NKey createCluster(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.CLUSTER, random);
} | java | public static NKey createCluster(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.CLUSTER, random);
} | [
"public",
"static",
"NKey",
"createCluster",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"CLUSTER",
",",
"random",
")",
";",
"}"
] | Create an Cluster NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws I... | [
"Create",
"an",
"Cluster",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L497-L500 |
116,779 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createOperator | public static NKey createOperator(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.OPERATOR, random);
} | java | public static NKey createOperator(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.OPERATOR, random);
} | [
"public",
"static",
"NKey",
"createOperator",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"OPERATOR",
",",
"random",
")",
";",
"}"
] | Create an Operator NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws ... | [
"Create",
"an",
"Operator",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L515-L518 |
116,780 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createServer | public static NKey createServer(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.SERVER, random);
} | java | public static NKey createServer(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.SERVER, random);
} | [
"public",
"static",
"NKey",
"createServer",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"SERVER",
",",
"random",
")",
";",
"}"
] | Create a Server NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws IOE... | [
"Create",
"a",
"Server",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L533-L536 |
116,781 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createUser | public static NKey createUser(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.USER, random);
} | java | public static NKey createUser(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.USER, random);
} | [
"public",
"static",
"NKey",
"createUser",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"USER",
",",
"random",
")",
";",
"}"
] | Create a User NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws IOExc... | [
"Create",
"a",
"User",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L551-L554 |
116,782 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.fromPublicKey | public static NKey fromPublicKey(char[] publicKey) {
byte[] raw = decode(publicKey);
int prefix = raw[0] & 0xFF;
if (!checkValidPublicPrefixByte(prefix)) {
throw new IllegalArgumentException("Not a valid public NKey");
}
Type type = NKey.Type.fromPrefix(prefix);
... | java | public static NKey fromPublicKey(char[] publicKey) {
byte[] raw = decode(publicKey);
int prefix = raw[0] & 0xFF;
if (!checkValidPublicPrefixByte(prefix)) {
throw new IllegalArgumentException("Not a valid public NKey");
}
Type type = NKey.Type.fromPrefix(prefix);
... | [
"public",
"static",
"NKey",
"fromPublicKey",
"(",
"char",
"[",
"]",
"publicKey",
")",
"{",
"byte",
"[",
"]",
"raw",
"=",
"decode",
"(",
"publicKey",
")",
";",
"int",
"prefix",
"=",
"raw",
"[",
"0",
"]",
"&",
"0xFF",
";",
"if",
"(",
"!",
"checkValid... | Create an NKey object from the encoded public key. This NKey can be used for verification but not for signing.
@param publicKey the string encoded public key
@return the new Nkey | [
"Create",
"an",
"NKey",
"object",
"from",
"the",
"encoded",
"public",
"key",
".",
"This",
"NKey",
"can",
"be",
"used",
"for",
"verification",
"but",
"not",
"for",
"signing",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L562-L572 |
116,783 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.fromSeed | public static NKey fromSeed(char[] seed) {
DecodedSeed decoded = decodeSeed(seed); // Should throw on bad seed
if (decoded.bytes.length == ED25519_PRIVATE_KEYSIZE) {
return new NKey(Type.fromPrefix(decoded.prefix), null, seed);
} else {
try {
return creat... | java | public static NKey fromSeed(char[] seed) {
DecodedSeed decoded = decodeSeed(seed); // Should throw on bad seed
if (decoded.bytes.length == ED25519_PRIVATE_KEYSIZE) {
return new NKey(Type.fromPrefix(decoded.prefix), null, seed);
} else {
try {
return creat... | [
"public",
"static",
"NKey",
"fromSeed",
"(",
"char",
"[",
"]",
"seed",
")",
"{",
"DecodedSeed",
"decoded",
"=",
"decodeSeed",
"(",
"seed",
")",
";",
"// Should throw on bad seed",
"if",
"(",
"decoded",
".",
"bytes",
".",
"length",
"==",
"ED25519_PRIVATE_KEYSIZ... | Creates an NKey object from a string encoded seed. This NKey can be used to sign or verify.
@param seed the string encoded seed, see {@link NKey#getSeed() getSeed()}
@return the Nkey | [
"Creates",
"an",
"NKey",
"object",
"from",
"a",
"string",
"encoded",
"seed",
".",
"This",
"NKey",
"can",
"be",
"used",
"to",
"sign",
"or",
"verify",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L580-L592 |
116,784 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.clear | public void clear() {
Random r = new Random();
if (privateKeyAsSeed != null) {
for (int i=0; i< privateKeyAsSeed.length ; i++) {
privateKeyAsSeed[i] = (char)(r.nextInt(26) + 'a');
}
Arrays.fill(privateKeyAsSeed, '\0');
}
if (publicKey !... | java | public void clear() {
Random r = new Random();
if (privateKeyAsSeed != null) {
for (int i=0; i< privateKeyAsSeed.length ; i++) {
privateKeyAsSeed[i] = (char)(r.nextInt(26) + 'a');
}
Arrays.fill(privateKeyAsSeed, '\0');
}
if (publicKey !... | [
"public",
"void",
"clear",
"(",
")",
"{",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"if",
"(",
"privateKeyAsSeed",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"privateKeyAsSeed",
".",
"length",
";",
"i",
"++... | Clear the seed and public key char arrays by filling them
with random bytes then zero-ing them out.
The nkey is unusable after this operation. | [
"Clear",
"the",
"seed",
"and",
"public",
"key",
"char",
"arrays",
"by",
"filling",
"them",
"with",
"random",
"bytes",
"then",
"zero",
"-",
"ing",
"them",
"out",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L658-L672 |
116,785 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.sign | public byte[] sign(byte[] input) throws GeneralSecurityException, IOException {
Signature sgr = new EdDSAEngine(MessageDigest.getInstance(NKey.ed25519.getHashAlgorithm()));
PrivateKey sKey = getKeyPair().getPrivate();
sgr.initSign(sKey);
sgr.update(input);
return sgr.sign();
... | java | public byte[] sign(byte[] input) throws GeneralSecurityException, IOException {
Signature sgr = new EdDSAEngine(MessageDigest.getInstance(NKey.ed25519.getHashAlgorithm()));
PrivateKey sKey = getKeyPair().getPrivate();
sgr.initSign(sKey);
sgr.update(input);
return sgr.sign();
... | [
"public",
"byte",
"[",
"]",
"sign",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"Signature",
"sgr",
"=",
"new",
"EdDSAEngine",
"(",
"MessageDigest",
".",
"getInstance",
"(",
"NKey",
".",
"ed25519",
".",... | Sign aribitrary binary input.
@param input the bytes to sign
@return the signature for the input from the NKey
@throws GeneralSecurityException if there is an encryption problem
@throws IOException if there is a problem reading the data | [
"Sign",
"aribitrary",
"binary",
"input",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L768-L776 |
116,786 | nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.verify | public boolean verify(byte[] input, byte[] signature) throws GeneralSecurityException, IOException {
Signature sgr = new EdDSAEngine(MessageDigest.getInstance(NKey.ed25519.getHashAlgorithm()));
PublicKey sKey = null;
if (privateKeyAsSeed != null) {
sKey = getKeyPair().getPublic();
... | java | public boolean verify(byte[] input, byte[] signature) throws GeneralSecurityException, IOException {
Signature sgr = new EdDSAEngine(MessageDigest.getInstance(NKey.ed25519.getHashAlgorithm()));
PublicKey sKey = null;
if (privateKeyAsSeed != null) {
sKey = getKeyPair().getPublic();
... | [
"public",
"boolean",
"verify",
"(",
"byte",
"[",
"]",
"input",
",",
"byte",
"[",
"]",
"signature",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"Signature",
"sgr",
"=",
"new",
"EdDSAEngine",
"(",
"MessageDigest",
".",
"getInstance",
"(",... | Verify a signature.
@param input the bytes that were signed
@param signature the bytes for the signature
@return true if the signature matches this keys signature for the input.
@throws GeneralSecurityException if there is an encryption problem
@throws IOException if there is a problem reading the da... | [
"Verify",
"a",
"signature",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L788-L805 |
116,787 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsServerInfo.java | NatsServerInfo.unescapeString | String unescapeString(String st) {
StringBuilder sb = new StringBuilder(st.length());
for (int i = 0; i < st.length(); i++) {
char ch = st.charAt(i);
if (ch == '\\') {
char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1);
swit... | java | String unescapeString(String st) {
StringBuilder sb = new StringBuilder(st.length());
for (int i = 0; i < st.length(); i++) {
char ch = st.charAt(i);
if (ch == '\\') {
char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1);
swit... | [
"String",
"unescapeString",
"(",
"String",
"st",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"st",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"st",
".",
"length",
"(",
")",
";",
"i",... | Removed octal support | [
"Removed",
"octal",
"support"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsServerInfo.java#L206-L256 |
116,788 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/SampleGroup.java | SampleGroup.addSample | public void addSample(Sample stat) {
samples.add(stat);
if (samples.size() == 1) {
start = stat.start;
end = stat.end;
}
this.ioBytes += stat.ioBytes;
this.jobMsgCnt += stat.jobMsgCnt;
this.msgCnt += stat.msgCnt;
this.msgBytes += stat.msgBy... | java | public void addSample(Sample stat) {
samples.add(stat);
if (samples.size() == 1) {
start = stat.start;
end = stat.end;
}
this.ioBytes += stat.ioBytes;
this.jobMsgCnt += stat.jobMsgCnt;
this.msgCnt += stat.msgCnt;
this.msgBytes += stat.msgBy... | [
"public",
"void",
"addSample",
"(",
"Sample",
"stat",
")",
"{",
"samples",
".",
"add",
"(",
"stat",
")",
";",
"if",
"(",
"samples",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"start",
"=",
"stat",
".",
"start",
";",
"end",
"=",
"stat",
".",
"e... | Adds a sample to the group.
@param stat the sample to add | [
"Adds",
"a",
"sample",
"to",
"the",
"group",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/SampleGroup.java#L42-L54 |
116,789 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/SampleGroup.java | SampleGroup.minRate | public long minRate() {
long min = (samples.isEmpty() ? 0L : samples.get(0).rate());
for (Sample s : samples) {
min = Math.min(min, s.rate());
}
return min;
} | java | public long minRate() {
long min = (samples.isEmpty() ? 0L : samples.get(0).rate());
for (Sample s : samples) {
min = Math.min(min, s.rate());
}
return min;
} | [
"public",
"long",
"minRate",
"(",
")",
"{",
"long",
"min",
"=",
"(",
"samples",
".",
"isEmpty",
"(",
")",
"?",
"0L",
":",
"samples",
".",
"get",
"(",
"0",
")",
".",
"rate",
"(",
")",
")",
";",
"for",
"(",
"Sample",
"s",
":",
"samples",
")",
"... | Returns the minimum of the message rates in the SampleGroup.
@return the minimum of the message rates in the SampleGroup | [
"Returns",
"the",
"minimum",
"of",
"the",
"message",
"rates",
"in",
"the",
"SampleGroup",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/SampleGroup.java#L61-L67 |
116,790 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/SampleGroup.java | SampleGroup.maxRate | public long maxRate() {
long max = (samples.isEmpty() ? 0L : samples.get(0).rate());
for (Sample s : samples) {
max = Math.max(max, s.rate());
}
return max;
} | java | public long maxRate() {
long max = (samples.isEmpty() ? 0L : samples.get(0).rate());
for (Sample s : samples) {
max = Math.max(max, s.rate());
}
return max;
} | [
"public",
"long",
"maxRate",
"(",
")",
"{",
"long",
"max",
"=",
"(",
"samples",
".",
"isEmpty",
"(",
")",
"?",
"0L",
":",
"samples",
".",
"get",
"(",
"0",
")",
".",
"rate",
"(",
")",
")",
";",
"for",
"(",
"Sample",
"s",
":",
"samples",
")",
"... | Returns the maximum of the message rates in the SampleGroup.
@return the maximum of the message rates in the SampleGroup | [
"Returns",
"the",
"maximum",
"of",
"the",
"message",
"rates",
"in",
"the",
"SampleGroup",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/SampleGroup.java#L74-L80 |
116,791 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/SampleGroup.java | SampleGroup.avgRate | public long avgRate() {
long sum = 0L;
for (Sample s : samples) {
sum += s.rate();
}
return sum / (long) samples.size();
} | java | public long avgRate() {
long sum = 0L;
for (Sample s : samples) {
sum += s.rate();
}
return sum / (long) samples.size();
} | [
"public",
"long",
"avgRate",
"(",
")",
"{",
"long",
"sum",
"=",
"0L",
";",
"for",
"(",
"Sample",
"s",
":",
"samples",
")",
"{",
"sum",
"+=",
"s",
".",
"rate",
"(",
")",
";",
"}",
"return",
"sum",
"/",
"(",
"long",
")",
"samples",
".",
"size",
... | Returns the average of the message rates in the SampleGroup.
@return the average of the message rates in the SampleGroup | [
"Returns",
"the",
"average",
"of",
"the",
"message",
"rates",
"in",
"the",
"SampleGroup",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/SampleGroup.java#L87-L93 |
116,792 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/SampleGroup.java | SampleGroup.stdDev | public double stdDev() {
double avg = avgRate();
double sum = 0.0;
for (Sample s : samples) {
sum += Math.pow((double) s.rate() - avg, 2);
}
double variance = sum / (double) samples.size();
return Math.sqrt(variance);
} | java | public double stdDev() {
double avg = avgRate();
double sum = 0.0;
for (Sample s : samples) {
sum += Math.pow((double) s.rate() - avg, 2);
}
double variance = sum / (double) samples.size();
return Math.sqrt(variance);
} | [
"public",
"double",
"stdDev",
"(",
")",
"{",
"double",
"avg",
"=",
"avgRate",
"(",
")",
";",
"double",
"sum",
"=",
"0.0",
";",
"for",
"(",
"Sample",
"s",
":",
"samples",
")",
"{",
"sum",
"+=",
"Math",
".",
"pow",
"(",
"(",
"double",
")",
"s",
"... | Returns the standard deviation of the message rates in the SampleGroup.
@return the standard deviation of the message rates in the SampleGroup | [
"Returns",
"the",
"standard",
"deviation",
"of",
"the",
"message",
"rates",
"in",
"the",
"SampleGroup",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/SampleGroup.java#L100-L108 |
116,793 | nats-io/java-nats | src/examples/java/io/nats/examples/benchmark/SampleGroup.java | SampleGroup.statistics | public String statistics() {
DecimalFormat formatter = new DecimalFormat("#,###");
DecimalFormat floatFormatter = new DecimalFormat("#,###.00");
return String.format("min %s | avg %s | max %s | stddev %s msgs",
formatter.format(minRate()), formatter.format(avgRate()),
... | java | public String statistics() {
DecimalFormat formatter = new DecimalFormat("#,###");
DecimalFormat floatFormatter = new DecimalFormat("#,###.00");
return String.format("min %s | avg %s | max %s | stddev %s msgs",
formatter.format(minRate()), formatter.format(avgRate()),
... | [
"public",
"String",
"statistics",
"(",
")",
"{",
"DecimalFormat",
"formatter",
"=",
"new",
"DecimalFormat",
"(",
"\"#,###\"",
")",
";",
"DecimalFormat",
"floatFormatter",
"=",
"new",
"DecimalFormat",
"(",
"\"#,###.00\"",
")",
";",
"return",
"String",
".",
"forma... | Formats the statistics for this group in a human-readable format.
@return the statistics for this group in a human-readable format (string) | [
"Formats",
"the",
"statistics",
"for",
"this",
"group",
"in",
"a",
"human",
"-",
"readable",
"format",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/examples/java/io/nats/examples/benchmark/SampleGroup.java#L115-L121 |
116,794 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnection.java | NatsConnection.connect | void connect(boolean reconnectOnConnect) throws InterruptedException, IOException {
if (options.getServers().size() == 0) {
throw new IllegalArgumentException("No servers provided in options");
}
for (String serverURI : getServers()) {
if (isClosed()) {
... | java | void connect(boolean reconnectOnConnect) throws InterruptedException, IOException {
if (options.getServers().size() == 0) {
throw new IllegalArgumentException("No servers provided in options");
}
for (String serverURI : getServers()) {
if (isClosed()) {
... | [
"void",
"connect",
"(",
"boolean",
"reconnectOnConnect",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
"if",
"(",
"options",
".",
"getServers",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Connect is only called after creation | [
"Connect",
"is",
"only",
"called",
"after",
"creation"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnection.java#L162-L192 |
116,795 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnection.java | NatsConnection.reconnect | void reconnect() throws InterruptedException {
long maxTries = options.getMaxReconnect();
long tries = 0;
String lastServer = null;
if (isClosed()) {
return;
}
if (maxTries == 0) {
this.close();
return;
}
... | java | void reconnect() throws InterruptedException {
long maxTries = options.getMaxReconnect();
long tries = 0;
String lastServer = null;
if (isClosed()) {
return;
}
if (maxTries == 0) {
this.close();
return;
}
... | [
"void",
"reconnect",
"(",
")",
"throws",
"InterruptedException",
"{",
"long",
"maxTries",
"=",
"options",
".",
"getMaxReconnect",
"(",
")",
";",
"long",
"tries",
"=",
"0",
";",
"String",
"lastServer",
"=",
"null",
";",
"if",
"(",
"isClosed",
"(",
")",
")... | Reconnect can only be called when the connection is disconnected | [
"Reconnect",
"can",
"only",
"be",
"called",
"when",
"the",
"connection",
"is",
"disconnected"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnection.java#L195-L275 |
116,796 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnection.java | NatsConnection.closeSocket | void closeSocket(boolean tryReconnectIfConnected) throws InterruptedException {
boolean wasConnected = false;
statusLock.lock();
try {
if (isDisconnectingOrClosed()) {
waitForDisconnectOrClose(this.options.getConnectionTimeout());
return;
... | java | void closeSocket(boolean tryReconnectIfConnected) throws InterruptedException {
boolean wasConnected = false;
statusLock.lock();
try {
if (isDisconnectingOrClosed()) {
waitForDisconnectOrClose(this.options.getConnectionTimeout());
return;
... | [
"void",
"closeSocket",
"(",
"boolean",
"tryReconnectIfConnected",
")",
"throws",
"InterruptedException",
"{",
"boolean",
"wasConnected",
"=",
"false",
";",
"statusLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"isDisconnectingOrClosed",
"(",
")",
")",... | Close is called when the connection should shutdown, period | [
"Close",
"is",
"called",
"when",
"the",
"connection",
"should",
"shutdown",
"period"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnection.java#L454-L490 |
116,797 | nats-io/java-nats | src/main/java/io/nats/client/impl/NatsConnection.java | NatsConnection.closeSocketImpl | void closeSocketImpl() {
this.currentServerURI = null;
// Signal the reader and writer
this.reader.stop();
this.writer.stop();
// Close the current socket and cancel anyone waiting for it
this.dataPortFuture.cancel(true);
try {
if (this.d... | java | void closeSocketImpl() {
this.currentServerURI = null;
// Signal the reader and writer
this.reader.stop();
this.writer.stop();
// Close the current socket and cancel anyone waiting for it
this.dataPortFuture.cancel(true);
try {
if (this.d... | [
"void",
"closeSocketImpl",
"(",
")",
"{",
"this",
".",
"currentServerURI",
"=",
"null",
";",
"// Signal the reader and writer\r",
"this",
".",
"reader",
".",
"stop",
"(",
")",
";",
"this",
".",
"writer",
".",
"stop",
"(",
")",
";",
"// Close the current socket... | Should only be called from closeSocket or close | [
"Should",
"only",
"be",
"called",
"from",
"closeSocket",
"or",
"close"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/impl/NatsConnection.java#L581-L612 |
116,798 | nats-io/java-nats | src/main/java/io/nats/client/NUID.java | NUID.next | public final synchronized String next() {
// Increment and capture.
seq += inc;
if (seq >= maxSeq) {
randomizePrefix();
resetSequential();
}
// Copy prefix
char[] b = new char[totalLen];
System.arraycopy(pre, 0, b, 0, preLen);
// ... | java | public final synchronized String next() {
// Increment and capture.
seq += inc;
if (seq >= maxSeq) {
randomizePrefix();
resetSequential();
}
// Copy prefix
char[] b = new char[totalLen];
System.arraycopy(pre, 0, b, 0, preLen);
// ... | [
"public",
"final",
"synchronized",
"String",
"next",
"(",
")",
"{",
"// Increment and capture.",
"seq",
"+=",
"inc",
";",
"if",
"(",
"seq",
">=",
"maxSeq",
")",
"{",
"randomizePrefix",
"(",
")",
";",
"resetSequential",
"(",
")",
";",
"}",
"// Copy prefix",
... | Generate the next NUID string from this instance.
@return the next NUID string from this instance. | [
"Generate",
"the",
"next",
"NUID",
"string",
"from",
"this",
"instance",
"."
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NUID.java#L109-L128 |
116,799 | nats-io/java-nats | src/main/java/io/nats/client/NUID.java | NUID.resetSequential | void resetSequential() {
seq = nextLong(prand, maxSeq);
inc = minInc + nextLong(prand, maxInc - minInc);
} | java | void resetSequential() {
seq = nextLong(prand, maxSeq);
inc = minInc + nextLong(prand, maxInc - minInc);
} | [
"void",
"resetSequential",
"(",
")",
"{",
"seq",
"=",
"nextLong",
"(",
"prand",
",",
"maxSeq",
")",
";",
"inc",
"=",
"minInc",
"+",
"nextLong",
"(",
"prand",
",",
"maxInc",
"-",
"minInc",
")",
";",
"}"
] | Resets the sequntial portion of the NUID | [
"Resets",
"the",
"sequntial",
"portion",
"of",
"the",
"NUID"
] | 5f291048fd30192ba39b3fe2925ecd60aaad6b48 | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NUID.java#L131-L134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.