repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerListener.java | PaymentChannelServerListener.bindAndStart | public void bindAndStart(int port) throws Exception {
"""
Binds to the given port and starts accepting new client connections.
@throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports)
"""
server = new NioServer(new StreamConnectionFactory() {
@Override
public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler;
}
}, new InetSocketAddress(port));
server.startAsync();
server.awaitRunning();
} | java | public void bindAndStart(int port) throws Exception {
server = new NioServer(new StreamConnectionFactory() {
@Override
public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler;
}
}, new InetSocketAddress(port));
server.startAsync();
server.awaitRunning();
} | [
"public",
"void",
"bindAndStart",
"(",
"int",
"port",
")",
"throws",
"Exception",
"{",
"server",
"=",
"new",
"NioServer",
"(",
"new",
"StreamConnectionFactory",
"(",
")",
"{",
"@",
"Override",
"public",
"ProtobufConnection",
"<",
"Protos",
".",
"TwoWayChannelMessage",
">",
"getNewConnection",
"(",
"InetAddress",
"inetAddress",
",",
"int",
"port",
")",
"{",
"return",
"new",
"ServerHandler",
"(",
"new",
"InetSocketAddress",
"(",
"inetAddress",
",",
"port",
")",
",",
"timeoutSeconds",
")",
".",
"socketProtobufHandler",
";",
"}",
"}",
",",
"new",
"InetSocketAddress",
"(",
"port",
")",
")",
";",
"server",
".",
"startAsync",
"(",
")",
";",
"server",
".",
"awaitRunning",
"(",
")",
";",
"}"
] | Binds to the given port and starts accepting new client connections.
@throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports) | [
"Binds",
"to",
"the",
"given",
"port",
"and",
"starts",
"accepting",
"new",
"client",
"connections",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerListener.java#L152-L161 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java | SeaGlassStyle.compileDefaults | private void compileDefaults(Map<String, TreeMap<String, Object>> compiledDefaults, UIDefaults d) {
"""
Iterates over all the keys in the specified UIDefaults and compiles those
keys into the comiledDefaults data structure. It relies on parsing the
"prefix" out of the key. If the key is not a String or is null then it is
ignored. In all other cases a prefix is parsed out (even if that prefix
is the empty String or is a "fake" prefix. That is, suppose you had a key
Foo~~MySpecial.KeyThing~~. In this case this is not a SeaGlass formatted
key, but we don't care, we treat it as if it is. This doesn't pose any
harm, it will simply never be used).
@param compiledDefaults the compiled defaults data structure.
@param d the UIDefaults to be parsed.
"""
for (Map.Entry<Object, Object> entry : d.entrySet()) {
if (entry.getKey() instanceof String) {
String key = (String) entry.getKey();
String kp = parsePrefix(key);
if (kp == null)
continue;
TreeMap<String, Object> map = compiledDefaults.get(kp);
if (map == null) {
map = new TreeMap<String, Object>();
compiledDefaults.put(kp, map);
}
map.put(key, entry.getValue());
}
}
} | java | private void compileDefaults(Map<String, TreeMap<String, Object>> compiledDefaults, UIDefaults d) {
for (Map.Entry<Object, Object> entry : d.entrySet()) {
if (entry.getKey() instanceof String) {
String key = (String) entry.getKey();
String kp = parsePrefix(key);
if (kp == null)
continue;
TreeMap<String, Object> map = compiledDefaults.get(kp);
if (map == null) {
map = new TreeMap<String, Object>();
compiledDefaults.put(kp, map);
}
map.put(key, entry.getValue());
}
}
} | [
"private",
"void",
"compileDefaults",
"(",
"Map",
"<",
"String",
",",
"TreeMap",
"<",
"String",
",",
"Object",
">",
">",
"compiledDefaults",
",",
"UIDefaults",
"d",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"d",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getKey",
"(",
")",
"instanceof",
"String",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"kp",
"=",
"parsePrefix",
"(",
"key",
")",
";",
"if",
"(",
"kp",
"==",
"null",
")",
"continue",
";",
"TreeMap",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"compiledDefaults",
".",
"get",
"(",
"kp",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"compiledDefaults",
".",
"put",
"(",
"kp",
",",
"map",
")",
";",
"}",
"map",
".",
"put",
"(",
"key",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Iterates over all the keys in the specified UIDefaults and compiles those
keys into the comiledDefaults data structure. It relies on parsing the
"prefix" out of the key. If the key is not a String or is null then it is
ignored. In all other cases a prefix is parsed out (even if that prefix
is the empty String or is a "fake" prefix. That is, suppose you had a key
Foo~~MySpecial.KeyThing~~. In this case this is not a SeaGlass formatted
key, but we don't care, we treat it as if it is. This doesn't pose any
harm, it will simply never be used).
@param compiledDefaults the compiled defaults data structure.
@param d the UIDefaults to be parsed. | [
"Iterates",
"over",
"all",
"the",
"keys",
"in",
"the",
"specified",
"UIDefaults",
"and",
"compiles",
"those",
"keys",
"into",
"the",
"comiledDefaults",
"data",
"structure",
".",
"It",
"relies",
"on",
"parsing",
"the",
"prefix",
"out",
"of",
"the",
"key",
".",
"If",
"the",
"key",
"is",
"not",
"a",
"String",
"or",
"is",
"null",
"then",
"it",
"is",
"ignored",
".",
"In",
"all",
"other",
"cases",
"a",
"prefix",
"is",
"parsed",
"out",
"(",
"even",
"if",
"that",
"prefix",
"is",
"the",
"empty",
"String",
"or",
"is",
"a",
"fake",
"prefix",
".",
"That",
"is",
"suppose",
"you",
"had",
"a",
"key",
"Foo~~MySpecial",
".",
"KeyThing~~",
".",
"In",
"this",
"case",
"this",
"is",
"not",
"a",
"SeaGlass",
"formatted",
"key",
"but",
"we",
"don",
"t",
"care",
"we",
"treat",
"it",
"as",
"if",
"it",
"is",
".",
"This",
"doesn",
"t",
"pose",
"any",
"harm",
"it",
"will",
"simply",
"never",
"be",
"used",
")",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L502-L522 |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.removeAStarListener | public void removeAStarListener(AStarListener<ST, PT> listener) {
"""
Remove listener on A* algorithm events.
@param listener the listener.
"""
if (this.listeners != null) {
this.listeners.remove(listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | java | public void removeAStarListener(AStarListener<ST, PT> listener) {
if (this.listeners != null) {
this.listeners.remove(listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | [
"public",
"void",
"removeAStarListener",
"(",
"AStarListener",
"<",
"ST",
",",
"PT",
">",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
")",
"{",
"this",
".",
"listeners",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"this",
".",
"listeners",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"listeners",
"=",
"null",
";",
"}",
"}",
"}"
] | Remove listener on A* algorithm events.
@param listener the listener. | [
"Remove",
"listener",
"on",
"A",
"*",
"algorithm",
"events",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L102-L109 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GitLabApi.java | GitLabApi.oauth2Login | public static GitLabApi oauth2Login(String url, String username, CharSequence password) throws GitLabApiException {
"""
<p>Logs into GitLab using OAuth2 with the provided {@code username} and {@code password},
and creates a new {@code GitLabApi} instance using returned access token.</p>
@param url GitLab URL
@param username user name for which private token should be obtained
@param password a CharSequence containing the password for a given {@code username}
@return new {@code GitLabApi} instance configured for a user-specific token
@throws GitLabApiException GitLabApiException if any exception occurs during execution
"""
return (GitLabApi.oauth2Login(ApiVersion.V4, url, username, password, null, null, false));
} | java | public static GitLabApi oauth2Login(String url, String username, CharSequence password) throws GitLabApiException {
return (GitLabApi.oauth2Login(ApiVersion.V4, url, username, password, null, null, false));
} | [
"public",
"static",
"GitLabApi",
"oauth2Login",
"(",
"String",
"url",
",",
"String",
"username",
",",
"CharSequence",
"password",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"GitLabApi",
".",
"oauth2Login",
"(",
"ApiVersion",
".",
"V4",
",",
"url",
",",
"username",
",",
"password",
",",
"null",
",",
"null",
",",
"false",
")",
")",
";",
"}"
] | <p>Logs into GitLab using OAuth2 with the provided {@code username} and {@code password},
and creates a new {@code GitLabApi} instance using returned access token.</p>
@param url GitLab URL
@param username user name for which private token should be obtained
@param password a CharSequence containing the password for a given {@code username}
@return new {@code GitLabApi} instance configured for a user-specific token
@throws GitLabApiException GitLabApiException if any exception occurs during execution | [
"<p",
">",
"Logs",
"into",
"GitLab",
"using",
"OAuth2",
"with",
"the",
"provided",
"{",
"@code",
"username",
"}",
"and",
"{",
"@code",
"password",
"}",
"and",
"creates",
"a",
"new",
"{",
"@code",
"GitLabApi",
"}",
"instance",
"using",
"returned",
"access",
"token",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApi.java#L129-L131 |
belaban/JGroups | src/org/jgroups/protocols/pbcast/Merger.java | Merger.fetchDigestsFromAllMembersInSubPartition | protected Digest fetchDigestsFromAllMembersInSubPartition(final View view, MergeId merge_id) {
"""
Multicasts a GET_DIGEST_REQ to all members of this sub partition and waits for all responses
(GET_DIGEST_RSP) or N ms.
"""
final List<Address> current_mbrs=view.getMembers();
// Optimization: if we're the only member, we don't need to multicast the get-digest message
if(current_mbrs == null || current_mbrs.size() == 1 && current_mbrs.get(0).equals(gms.local_addr))
return new MutableDigest(view.getMembersRaw())
.set((Digest)gms.getDownProtocol().down(new Event(Event.GET_DIGEST, gms.local_addr)));
Message get_digest_req=new Message().setFlag(Message.Flag.OOB, Message.Flag.INTERNAL)
.putHeader(gms.getId(), new GMS.GmsHeader(GMS.GmsHeader.GET_DIGEST_REQ).mergeId(merge_id));
long max_wait_time=gms.merge_timeout / 2; // gms.merge_timeout is guaranteed to be > 0, verified in init()
digest_collector.reset(current_mbrs);
gms.getDownProtocol().down(get_digest_req);
// add my own digest first - the get_digest_req needs to be sent first *before* getting our own digest, so
// we have that message in our digest !
Digest digest=(Digest)gms.getDownProtocol().down(new Event(Event.GET_DIGEST, gms.local_addr));
digest_collector.add(gms.local_addr, digest);
digest_collector.waitForAllResponses(max_wait_time);
if(log.isTraceEnabled()) {
if(digest_collector.hasAllResponses())
log.trace("%s: fetched all digests for %s", gms.local_addr, current_mbrs);
else
log.trace("%s: fetched incomplete digests (after timeout of %d) ms for %s",
gms.local_addr, max_wait_time, current_mbrs);
}
List<Address> valid_rsps=new ArrayList<>(current_mbrs);
valid_rsps.removeAll(digest_collector.getMissing());
Address[] tmp=new Address[valid_rsps.size()];
valid_rsps.toArray(tmp);
MutableDigest retval=new MutableDigest(tmp);
Map<Address,Digest> responses=new HashMap<>(digest_collector.getResults());
responses.values().forEach(retval::set);
return retval;
} | java | protected Digest fetchDigestsFromAllMembersInSubPartition(final View view, MergeId merge_id) {
final List<Address> current_mbrs=view.getMembers();
// Optimization: if we're the only member, we don't need to multicast the get-digest message
if(current_mbrs == null || current_mbrs.size() == 1 && current_mbrs.get(0).equals(gms.local_addr))
return new MutableDigest(view.getMembersRaw())
.set((Digest)gms.getDownProtocol().down(new Event(Event.GET_DIGEST, gms.local_addr)));
Message get_digest_req=new Message().setFlag(Message.Flag.OOB, Message.Flag.INTERNAL)
.putHeader(gms.getId(), new GMS.GmsHeader(GMS.GmsHeader.GET_DIGEST_REQ).mergeId(merge_id));
long max_wait_time=gms.merge_timeout / 2; // gms.merge_timeout is guaranteed to be > 0, verified in init()
digest_collector.reset(current_mbrs);
gms.getDownProtocol().down(get_digest_req);
// add my own digest first - the get_digest_req needs to be sent first *before* getting our own digest, so
// we have that message in our digest !
Digest digest=(Digest)gms.getDownProtocol().down(new Event(Event.GET_DIGEST, gms.local_addr));
digest_collector.add(gms.local_addr, digest);
digest_collector.waitForAllResponses(max_wait_time);
if(log.isTraceEnabled()) {
if(digest_collector.hasAllResponses())
log.trace("%s: fetched all digests for %s", gms.local_addr, current_mbrs);
else
log.trace("%s: fetched incomplete digests (after timeout of %d) ms for %s",
gms.local_addr, max_wait_time, current_mbrs);
}
List<Address> valid_rsps=new ArrayList<>(current_mbrs);
valid_rsps.removeAll(digest_collector.getMissing());
Address[] tmp=new Address[valid_rsps.size()];
valid_rsps.toArray(tmp);
MutableDigest retval=new MutableDigest(tmp);
Map<Address,Digest> responses=new HashMap<>(digest_collector.getResults());
responses.values().forEach(retval::set);
return retval;
} | [
"protected",
"Digest",
"fetchDigestsFromAllMembersInSubPartition",
"(",
"final",
"View",
"view",
",",
"MergeId",
"merge_id",
")",
"{",
"final",
"List",
"<",
"Address",
">",
"current_mbrs",
"=",
"view",
".",
"getMembers",
"(",
")",
";",
"// Optimization: if we're the only member, we don't need to multicast the get-digest message",
"if",
"(",
"current_mbrs",
"==",
"null",
"||",
"current_mbrs",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"current_mbrs",
".",
"get",
"(",
"0",
")",
".",
"equals",
"(",
"gms",
".",
"local_addr",
")",
")",
"return",
"new",
"MutableDigest",
"(",
"view",
".",
"getMembersRaw",
"(",
")",
")",
".",
"set",
"(",
"(",
"Digest",
")",
"gms",
".",
"getDownProtocol",
"(",
")",
".",
"down",
"(",
"new",
"Event",
"(",
"Event",
".",
"GET_DIGEST",
",",
"gms",
".",
"local_addr",
")",
")",
")",
";",
"Message",
"get_digest_req",
"=",
"new",
"Message",
"(",
")",
".",
"setFlag",
"(",
"Message",
".",
"Flag",
".",
"OOB",
",",
"Message",
".",
"Flag",
".",
"INTERNAL",
")",
".",
"putHeader",
"(",
"gms",
".",
"getId",
"(",
")",
",",
"new",
"GMS",
".",
"GmsHeader",
"(",
"GMS",
".",
"GmsHeader",
".",
"GET_DIGEST_REQ",
")",
".",
"mergeId",
"(",
"merge_id",
")",
")",
";",
"long",
"max_wait_time",
"=",
"gms",
".",
"merge_timeout",
"/",
"2",
";",
"// gms.merge_timeout is guaranteed to be > 0, verified in init()",
"digest_collector",
".",
"reset",
"(",
"current_mbrs",
")",
";",
"gms",
".",
"getDownProtocol",
"(",
")",
".",
"down",
"(",
"get_digest_req",
")",
";",
"// add my own digest first - the get_digest_req needs to be sent first *before* getting our own digest, so",
"// we have that message in our digest !",
"Digest",
"digest",
"=",
"(",
"Digest",
")",
"gms",
".",
"getDownProtocol",
"(",
")",
".",
"down",
"(",
"new",
"Event",
"(",
"Event",
".",
"GET_DIGEST",
",",
"gms",
".",
"local_addr",
")",
")",
";",
"digest_collector",
".",
"add",
"(",
"gms",
".",
"local_addr",
",",
"digest",
")",
";",
"digest_collector",
".",
"waitForAllResponses",
"(",
"max_wait_time",
")",
";",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"if",
"(",
"digest_collector",
".",
"hasAllResponses",
"(",
")",
")",
"log",
".",
"trace",
"(",
"\"%s: fetched all digests for %s\"",
",",
"gms",
".",
"local_addr",
",",
"current_mbrs",
")",
";",
"else",
"log",
".",
"trace",
"(",
"\"%s: fetched incomplete digests (after timeout of %d) ms for %s\"",
",",
"gms",
".",
"local_addr",
",",
"max_wait_time",
",",
"current_mbrs",
")",
";",
"}",
"List",
"<",
"Address",
">",
"valid_rsps",
"=",
"new",
"ArrayList",
"<>",
"(",
"current_mbrs",
")",
";",
"valid_rsps",
".",
"removeAll",
"(",
"digest_collector",
".",
"getMissing",
"(",
")",
")",
";",
"Address",
"[",
"]",
"tmp",
"=",
"new",
"Address",
"[",
"valid_rsps",
".",
"size",
"(",
")",
"]",
";",
"valid_rsps",
".",
"toArray",
"(",
"tmp",
")",
";",
"MutableDigest",
"retval",
"=",
"new",
"MutableDigest",
"(",
"tmp",
")",
";",
"Map",
"<",
"Address",
",",
"Digest",
">",
"responses",
"=",
"new",
"HashMap",
"<>",
"(",
"digest_collector",
".",
"getResults",
"(",
")",
")",
";",
"responses",
".",
"values",
"(",
")",
".",
"forEach",
"(",
"retval",
"::",
"set",
")",
";",
"return",
"retval",
";",
"}"
] | Multicasts a GET_DIGEST_REQ to all members of this sub partition and waits for all responses
(GET_DIGEST_RSP) or N ms. | [
"Multicasts",
"a",
"GET_DIGEST_REQ",
"to",
"all",
"members",
"of",
"this",
"sub",
"partition",
"and",
"waits",
"for",
"all",
"responses",
"(",
"GET_DIGEST_RSP",
")",
"or",
"N",
"ms",
"."
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/Merger.java#L372-L410 |
ivanceras/orm | src/main/java/com/ivanceras/db/server/util/DAOGenerator.java | DAOGenerator.startUncurated | public void startUncurated(Configuration conf) throws Exception {
"""
Curated will correct The ModelDef
@param curated
@throws Exception
"""
IDatabaseDev db = (IDatabaseDev) em.getDB();//TODO make sure DB platform can be used for development
ModelDefinitionProvider provider = new ModelDefinitionProvider(db, conf.dbUser, null, conf.includeSchema);
ModelDef[] origModelList = provider.getTableDefinitions();
//TODO: proper support for explicit ModelDefinitions
ModelDef[] withExplecitList = overrideModelDefFromExplicit(origModelList, explicitMeta);
ModelDef[] modelList = withExplecitList;
ModelDef[] modelListOwned = setModelOwners(modelList, tableGroups);
ModelDef[] modelListChilded = setDirectChildren(modelListOwned);
new ModelMetaDataGenerator().start(modelListChilded, conf);
} | java | public void startUncurated(Configuration conf) throws Exception{
IDatabaseDev db = (IDatabaseDev) em.getDB();//TODO make sure DB platform can be used for development
ModelDefinitionProvider provider = new ModelDefinitionProvider(db, conf.dbUser, null, conf.includeSchema);
ModelDef[] origModelList = provider.getTableDefinitions();
//TODO: proper support for explicit ModelDefinitions
ModelDef[] withExplecitList = overrideModelDefFromExplicit(origModelList, explicitMeta);
ModelDef[] modelList = withExplecitList;
ModelDef[] modelListOwned = setModelOwners(modelList, tableGroups);
ModelDef[] modelListChilded = setDirectChildren(modelListOwned);
new ModelMetaDataGenerator().start(modelListChilded, conf);
} | [
"public",
"void",
"startUncurated",
"(",
"Configuration",
"conf",
")",
"throws",
"Exception",
"{",
"IDatabaseDev",
"db",
"=",
"(",
"IDatabaseDev",
")",
"em",
".",
"getDB",
"(",
")",
";",
"//TODO make sure DB platform can be used for development",
"ModelDefinitionProvider",
"provider",
"=",
"new",
"ModelDefinitionProvider",
"(",
"db",
",",
"conf",
".",
"dbUser",
",",
"null",
",",
"conf",
".",
"includeSchema",
")",
";",
"ModelDef",
"[",
"]",
"origModelList",
"=",
"provider",
".",
"getTableDefinitions",
"(",
")",
";",
"//TODO: proper support for explicit ModelDefinitions",
"ModelDef",
"[",
"]",
"withExplecitList",
"=",
"overrideModelDefFromExplicit",
"(",
"origModelList",
",",
"explicitMeta",
")",
";",
"ModelDef",
"[",
"]",
"modelList",
"=",
"withExplecitList",
";",
"ModelDef",
"[",
"]",
"modelListOwned",
"=",
"setModelOwners",
"(",
"modelList",
",",
"tableGroups",
")",
";",
"ModelDef",
"[",
"]",
"modelListChilded",
"=",
"setDirectChildren",
"(",
"modelListOwned",
")",
";",
"new",
"ModelMetaDataGenerator",
"(",
")",
".",
"start",
"(",
"modelListChilded",
",",
"conf",
")",
";",
"}"
] | Curated will correct The ModelDef
@param curated
@throws Exception | [
"Curated",
"will",
"correct",
"The",
"ModelDef"
] | train | https://github.com/ivanceras/orm/blob/e63213cb8abefd11df0e2d34b1c95477788e600e/src/main/java/com/ivanceras/db/server/util/DAOGenerator.java#L59-L72 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/DBSCAN.java | DBSCAN.runDBSCAN | protected void runDBSCAN(Relation<O> relation, RangeQuery<O> rangeQuery) {
"""
Run the DBSCAN algorithm
@param relation Data relation
@param rangeQuery Range query class
"""
final int size = relation.size();
FiniteProgress objprog = LOG.isVerbose() ? new FiniteProgress("Processing objects", size, LOG) : null;
IndefiniteProgress clusprog = LOG.isVerbose() ? new IndefiniteProgress("Number of clusters", LOG) : null;
processedIDs = DBIDUtil.newHashSet(size);
ArrayModifiableDBIDs seeds = DBIDUtil.newArray();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
if(!processedIDs.contains(iditer)) {
expandCluster(relation, rangeQuery, iditer, seeds, objprog, clusprog);
}
if(objprog != null && clusprog != null) {
objprog.setProcessed(processedIDs.size(), LOG);
clusprog.setProcessed(resultList.size(), LOG);
}
if(processedIDs.size() == size) {
break;
}
}
// Finish progress logging
LOG.ensureCompleted(objprog);
LOG.setCompleted(clusprog);
} | java | protected void runDBSCAN(Relation<O> relation, RangeQuery<O> rangeQuery) {
final int size = relation.size();
FiniteProgress objprog = LOG.isVerbose() ? new FiniteProgress("Processing objects", size, LOG) : null;
IndefiniteProgress clusprog = LOG.isVerbose() ? new IndefiniteProgress("Number of clusters", LOG) : null;
processedIDs = DBIDUtil.newHashSet(size);
ArrayModifiableDBIDs seeds = DBIDUtil.newArray();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
if(!processedIDs.contains(iditer)) {
expandCluster(relation, rangeQuery, iditer, seeds, objprog, clusprog);
}
if(objprog != null && clusprog != null) {
objprog.setProcessed(processedIDs.size(), LOG);
clusprog.setProcessed(resultList.size(), LOG);
}
if(processedIDs.size() == size) {
break;
}
}
// Finish progress logging
LOG.ensureCompleted(objprog);
LOG.setCompleted(clusprog);
} | [
"protected",
"void",
"runDBSCAN",
"(",
"Relation",
"<",
"O",
">",
"relation",
",",
"RangeQuery",
"<",
"O",
">",
"rangeQuery",
")",
"{",
"final",
"int",
"size",
"=",
"relation",
".",
"size",
"(",
")",
";",
"FiniteProgress",
"objprog",
"=",
"LOG",
".",
"isVerbose",
"(",
")",
"?",
"new",
"FiniteProgress",
"(",
"\"Processing objects\"",
",",
"size",
",",
"LOG",
")",
":",
"null",
";",
"IndefiniteProgress",
"clusprog",
"=",
"LOG",
".",
"isVerbose",
"(",
")",
"?",
"new",
"IndefiniteProgress",
"(",
"\"Number of clusters\"",
",",
"LOG",
")",
":",
"null",
";",
"processedIDs",
"=",
"DBIDUtil",
".",
"newHashSet",
"(",
"size",
")",
";",
"ArrayModifiableDBIDs",
"seeds",
"=",
"DBIDUtil",
".",
"newArray",
"(",
")",
";",
"for",
"(",
"DBIDIter",
"iditer",
"=",
"relation",
".",
"iterDBIDs",
"(",
")",
";",
"iditer",
".",
"valid",
"(",
")",
";",
"iditer",
".",
"advance",
"(",
")",
")",
"{",
"if",
"(",
"!",
"processedIDs",
".",
"contains",
"(",
"iditer",
")",
")",
"{",
"expandCluster",
"(",
"relation",
",",
"rangeQuery",
",",
"iditer",
",",
"seeds",
",",
"objprog",
",",
"clusprog",
")",
";",
"}",
"if",
"(",
"objprog",
"!=",
"null",
"&&",
"clusprog",
"!=",
"null",
")",
"{",
"objprog",
".",
"setProcessed",
"(",
"processedIDs",
".",
"size",
"(",
")",
",",
"LOG",
")",
";",
"clusprog",
".",
"setProcessed",
"(",
"resultList",
".",
"size",
"(",
")",
",",
"LOG",
")",
";",
"}",
"if",
"(",
"processedIDs",
".",
"size",
"(",
")",
"==",
"size",
")",
"{",
"break",
";",
"}",
"}",
"// Finish progress logging",
"LOG",
".",
"ensureCompleted",
"(",
"objprog",
")",
";",
"LOG",
".",
"setCompleted",
"(",
"clusprog",
")",
";",
"}"
] | Run the DBSCAN algorithm
@param relation Data relation
@param rangeQuery Range query class | [
"Run",
"the",
"DBSCAN",
"algorithm"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/DBSCAN.java#L175-L197 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableChecker.java | ImmutableChecker.matchMethodInvocation | @Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
"""
check instantiations of `@ImmutableTypeParameter`s in method invocations
"""
return checkInvocation(
tree, ASTHelpers.getType(tree.getMethodSelect()), state, ASTHelpers.getSymbol(tree));
} | java | @Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
return checkInvocation(
tree, ASTHelpers.getType(tree.getMethodSelect()), state, ASTHelpers.getSymbol(tree));
} | [
"@",
"Override",
"public",
"Description",
"matchMethodInvocation",
"(",
"MethodInvocationTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"return",
"checkInvocation",
"(",
"tree",
",",
"ASTHelpers",
".",
"getType",
"(",
"tree",
".",
"getMethodSelect",
"(",
")",
")",
",",
"state",
",",
"ASTHelpers",
".",
"getSymbol",
"(",
"tree",
")",
")",
";",
"}"
] | check instantiations of `@ImmutableTypeParameter`s in method invocations | [
"check",
"instantiations",
"of"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableChecker.java#L105-L109 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/resolver/impl/AbstractCasWebflowEventResolver.java | AbstractCasWebflowEventResolver.putResolvedEventsAsAttribute | protected void putResolvedEventsAsAttribute(final RequestContext context, final Set<Event> resolvedEvents) {
"""
Put resolved events as attribute.
@param context the context
@param resolvedEvents the resolved events
"""
context.getAttributes().put(RESOLVED_AUTHENTICATION_EVENTS, resolvedEvents);
} | java | protected void putResolvedEventsAsAttribute(final RequestContext context, final Set<Event> resolvedEvents) {
context.getAttributes().put(RESOLVED_AUTHENTICATION_EVENTS, resolvedEvents);
} | [
"protected",
"void",
"putResolvedEventsAsAttribute",
"(",
"final",
"RequestContext",
"context",
",",
"final",
"Set",
"<",
"Event",
">",
"resolvedEvents",
")",
"{",
"context",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"RESOLVED_AUTHENTICATION_EVENTS",
",",
"resolvedEvents",
")",
";",
"}"
] | Put resolved events as attribute.
@param context the context
@param resolvedEvents the resolved events | [
"Put",
"resolved",
"events",
"as",
"attribute",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/resolver/impl/AbstractCasWebflowEventResolver.java#L127-L129 |
jaxio/javaee-lab | javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java | GenericRepository.findPropertyCount | @Transactional
public int findPropertyCount(E entity, SearchParameters sp, String path) {
"""
Count the number of E instances.
@param entity a sample entity whose non-null properties may be used as search hint
@param sp carries additional search information
@param path the path to the property
@return the number of entities matching the search.
"""
return findPropertyCount(entity, sp, metamodelUtil.toAttributes(path, type));
} | java | @Transactional
public int findPropertyCount(E entity, SearchParameters sp, String path) {
return findPropertyCount(entity, sp, metamodelUtil.toAttributes(path, type));
} | [
"@",
"Transactional",
"public",
"int",
"findPropertyCount",
"(",
"E",
"entity",
",",
"SearchParameters",
"sp",
",",
"String",
"path",
")",
"{",
"return",
"findPropertyCount",
"(",
"entity",
",",
"sp",
",",
"metamodelUtil",
".",
"toAttributes",
"(",
"path",
",",
"type",
")",
")",
";",
"}"
] | Count the number of E instances.
@param entity a sample entity whose non-null properties may be used as search hint
@param sp carries additional search information
@param path the path to the property
@return the number of entities matching the search. | [
"Count",
"the",
"number",
"of",
"E",
"instances",
"."
] | train | https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L379-L382 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForResourceGroupAsync | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) {
"""
Queries policy events for the resources under the resource group.
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyEventsQueryResultsInner object
"""
return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForResourceGroupAsync(String subscriptionId, String resourceGroupName) {
return listQueryResultsForResourceGroupWithServiceResponseAsync(subscriptionId, resourceGroupName).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyEventsQueryResultsInner",
">",
"listQueryResultsForResourceGroupAsync",
"(",
"String",
"subscriptionId",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"listQueryResultsForResourceGroupWithServiceResponseAsync",
"(",
"subscriptionId",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"PolicyEventsQueryResultsInner",
">",
",",
"PolicyEventsQueryResultsInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"PolicyEventsQueryResultsInner",
"call",
"(",
"ServiceResponse",
"<",
"PolicyEventsQueryResultsInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Queries policy events for the resources under the resource group.
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyEventsQueryResultsInner object | [
"Queries",
"policy",
"events",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L509-L516 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java | PreConditionException.validateLesserThan | public static void validateLesserThan( Number value, Number limit, String identifier )
throws PreConditionException {
"""
Validates that the value is lesser than a limit.
<p/>
This method ensures that <code>value < limit</code>.
@param identifier The name of the object.
@param limit The limit that the value must be smaller than.
@param value The value to be tested.
@throws PreConditionException if the condition is not met.
"""
if( value.doubleValue() < limit.doubleValue() )
{
return;
}
throw new PreConditionException( identifier + " was not lesser than " + limit + ". Was: " + value );
} | java | public static void validateLesserThan( Number value, Number limit, String identifier )
throws PreConditionException
{
if( value.doubleValue() < limit.doubleValue() )
{
return;
}
throw new PreConditionException( identifier + " was not lesser than " + limit + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateLesserThan",
"(",
"Number",
"value",
",",
"Number",
"limit",
",",
"String",
"identifier",
")",
"throws",
"PreConditionException",
"{",
"if",
"(",
"value",
".",
"doubleValue",
"(",
")",
"<",
"limit",
".",
"doubleValue",
"(",
")",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"PreConditionException",
"(",
"identifier",
"+",
"\" was not lesser than \"",
"+",
"limit",
"+",
"\". Was: \"",
"+",
"value",
")",
";",
"}"
] | Validates that the value is lesser than a limit.
<p/>
This method ensures that <code>value < limit</code>.
@param identifier The name of the object.
@param limit The limit that the value must be smaller than.
@param value The value to be tested.
@throws PreConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"is",
"lesser",
"than",
"a",
"limit",
".",
"<p",
"/",
">",
"This",
"method",
"ensures",
"that",
"<code",
">",
"value",
"<",
"limit<",
"/",
"code",
">",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java#L190-L198 |
kiegroup/drools | drools-templates/src/main/java/org/drools/template/DataProviderCompiler.java | DataProviderCompiler.compile | public String compile(final DataProvider dataProvider,
final InputStream templateStream,
boolean replaceOptionals) {
"""
Generates DRL from a data provider for the spreadsheet data and templates.
@param dataProvider the data provider for the spreadsheet data
@param templateStream the InputStream for reading the templates
@return the generated DRL text as a String
"""
DefaultTemplateContainer tc = new DefaultTemplateContainer(templateStream, replaceOptionals);
closeStream(templateStream);
return compile(dataProvider,
new TemplateDataListener(tc));
} | java | public String compile(final DataProvider dataProvider,
final InputStream templateStream,
boolean replaceOptionals) {
DefaultTemplateContainer tc = new DefaultTemplateContainer(templateStream, replaceOptionals);
closeStream(templateStream);
return compile(dataProvider,
new TemplateDataListener(tc));
} | [
"public",
"String",
"compile",
"(",
"final",
"DataProvider",
"dataProvider",
",",
"final",
"InputStream",
"templateStream",
",",
"boolean",
"replaceOptionals",
")",
"{",
"DefaultTemplateContainer",
"tc",
"=",
"new",
"DefaultTemplateContainer",
"(",
"templateStream",
",",
"replaceOptionals",
")",
";",
"closeStream",
"(",
"templateStream",
")",
";",
"return",
"compile",
"(",
"dataProvider",
",",
"new",
"TemplateDataListener",
"(",
"tc",
")",
")",
";",
"}"
] | Generates DRL from a data provider for the spreadsheet data and templates.
@param dataProvider the data provider for the spreadsheet data
@param templateStream the InputStream for reading the templates
@return the generated DRL text as a String | [
"Generates",
"DRL",
"from",
"a",
"data",
"provider",
"for",
"the",
"spreadsheet",
"data",
"and",
"templates",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-templates/src/main/java/org/drools/template/DataProviderCompiler.java#L94-L101 |
zaproxy/zaproxy | src/org/apache/commons/httpclient/HttpConnection.java | HttpConnection.getRequestOutputStream | public OutputStream getRequestOutputStream()
throws IOException, IllegalStateException {
"""
Returns an {@link OutputStream} suitable for writing the request.
@throws IllegalStateException if the connection is not open
@throws IOException if an I/O problem occurs
@return a stream to write the request to
"""
LOG.trace("enter HttpConnection.getRequestOutputStream()");
assertOpen();
OutputStream out = this.outputStream;
if (Wire.CONTENT_WIRE.enabled()) {
out = new WireLogOutputStream(out, Wire.CONTENT_WIRE);
}
return out;
} | java | public OutputStream getRequestOutputStream()
throws IOException, IllegalStateException {
LOG.trace("enter HttpConnection.getRequestOutputStream()");
assertOpen();
OutputStream out = this.outputStream;
if (Wire.CONTENT_WIRE.enabled()) {
out = new WireLogOutputStream(out, Wire.CONTENT_WIRE);
}
return out;
} | [
"public",
"OutputStream",
"getRequestOutputStream",
"(",
")",
"throws",
"IOException",
",",
"IllegalStateException",
"{",
"LOG",
".",
"trace",
"(",
"\"enter HttpConnection.getRequestOutputStream()\"",
")",
";",
"assertOpen",
"(",
")",
";",
"OutputStream",
"out",
"=",
"this",
".",
"outputStream",
";",
"if",
"(",
"Wire",
".",
"CONTENT_WIRE",
".",
"enabled",
"(",
")",
")",
"{",
"out",
"=",
"new",
"WireLogOutputStream",
"(",
"out",
",",
"Wire",
".",
"CONTENT_WIRE",
")",
";",
"}",
"return",
"out",
";",
"}"
] | Returns an {@link OutputStream} suitable for writing the request.
@throws IllegalStateException if the connection is not open
@throws IOException if an I/O problem occurs
@return a stream to write the request to | [
"Returns",
"an",
"{",
"@link",
"OutputStream",
"}",
"suitable",
"for",
"writing",
"the",
"request",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpConnection.java#L870-L879 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsEditorBase.java | CmsEditorBase.loadContentDefinition | public void loadContentDefinition(final String entityId, final Command callback) {
"""
Loads the content definition for the given entity and executes the callback on success.<p>
@param entityId the entity id
@param callback the callback
"""
AsyncCallback<CmsContentDefinition> asyncCallback = new AsyncCallback<CmsContentDefinition>() {
public void onFailure(Throwable caught) {
onRpcError(caught);
}
public void onSuccess(CmsContentDefinition result) {
registerContentDefinition(result);
callback.execute();
}
};
getService().loadContentDefinition(entityId, asyncCallback);
} | java | public void loadContentDefinition(final String entityId, final Command callback) {
AsyncCallback<CmsContentDefinition> asyncCallback = new AsyncCallback<CmsContentDefinition>() {
public void onFailure(Throwable caught) {
onRpcError(caught);
}
public void onSuccess(CmsContentDefinition result) {
registerContentDefinition(result);
callback.execute();
}
};
getService().loadContentDefinition(entityId, asyncCallback);
} | [
"public",
"void",
"loadContentDefinition",
"(",
"final",
"String",
"entityId",
",",
"final",
"Command",
"callback",
")",
"{",
"AsyncCallback",
"<",
"CmsContentDefinition",
">",
"asyncCallback",
"=",
"new",
"AsyncCallback",
"<",
"CmsContentDefinition",
">",
"(",
")",
"{",
"public",
"void",
"onFailure",
"(",
"Throwable",
"caught",
")",
"{",
"onRpcError",
"(",
"caught",
")",
";",
"}",
"public",
"void",
"onSuccess",
"(",
"CmsContentDefinition",
"result",
")",
"{",
"registerContentDefinition",
"(",
"result",
")",
";",
"callback",
".",
"execute",
"(",
")",
";",
"}",
"}",
";",
"getService",
"(",
")",
".",
"loadContentDefinition",
"(",
"entityId",
",",
"asyncCallback",
")",
";",
"}"
] | Loads the content definition for the given entity and executes the callback on success.<p>
@param entityId the entity id
@param callback the callback | [
"Loads",
"the",
"content",
"definition",
"for",
"the",
"given",
"entity",
"and",
"executes",
"the",
"callback",
"on",
"success",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L336-L352 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/ProxyFactory.java | ProxyFactory.getInvocationHandler | public InvocationHandler getInvocationHandler(Object proxy) {
"""
Returns the invocation handler for a proxy created from this factory.
@param proxy the proxy
@return the invocation handler
"""
Field field = getInvocationHandlerField();
try {
return (InvocationHandler) field.get(proxy);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Object is not a proxy of correct type", e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | public InvocationHandler getInvocationHandler(Object proxy) {
Field field = getInvocationHandlerField();
try {
return (InvocationHandler) field.get(proxy);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Object is not a proxy of correct type", e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"public",
"InvocationHandler",
"getInvocationHandler",
"(",
"Object",
"proxy",
")",
"{",
"Field",
"field",
"=",
"getInvocationHandlerField",
"(",
")",
";",
"try",
"{",
"return",
"(",
"InvocationHandler",
")",
"field",
".",
"get",
"(",
"proxy",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Object is not a proxy of correct type\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | Returns the invocation handler for a proxy created from this factory.
@param proxy the proxy
@return the invocation handler | [
"Returns",
"the",
"invocation",
"handler",
"for",
"a",
"proxy",
"created",
"from",
"this",
"factory",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyFactory.java#L375-L384 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicatedCloud_serviceName_upgradeRessource_GET | public ArrayList<String> dedicatedCloud_serviceName_upgradeRessource_GET(String serviceName, OvhUpgradeTypeEnum upgradeType, Long upgradedRessourceId, OvhUpgradeRessourceTypeEnum upgradedRessourceType) throws IOException {
"""
Get allowed durations for 'upgradeRessource' option
REST: GET /order/dedicatedCloud/{serviceName}/upgradeRessource
@param upgradedRessourceType [required] The type of ressource you want to upgrade.
@param upgradedRessourceId [required] The id of a particular ressource you want to upgrade in your Private Cloud (useless for "all" UpgradeRessourceTypeEnum)
@param upgradeType [required] The type of upgrade you want to process on the ressource(s)
@param serviceName [required]
"""
String qPath = "/order/dedicatedCloud/{serviceName}/upgradeRessource";
StringBuilder sb = path(qPath, serviceName);
query(sb, "upgradeType", upgradeType);
query(sb, "upgradedRessourceId", upgradedRessourceId);
query(sb, "upgradedRessourceType", upgradedRessourceType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> dedicatedCloud_serviceName_upgradeRessource_GET(String serviceName, OvhUpgradeTypeEnum upgradeType, Long upgradedRessourceId, OvhUpgradeRessourceTypeEnum upgradedRessourceType) throws IOException {
String qPath = "/order/dedicatedCloud/{serviceName}/upgradeRessource";
StringBuilder sb = path(qPath, serviceName);
query(sb, "upgradeType", upgradeType);
query(sb, "upgradedRessourceId", upgradedRessourceId);
query(sb, "upgradedRessourceType", upgradedRessourceType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"dedicatedCloud_serviceName_upgradeRessource_GET",
"(",
"String",
"serviceName",
",",
"OvhUpgradeTypeEnum",
"upgradeType",
",",
"Long",
"upgradedRessourceId",
",",
"OvhUpgradeRessourceTypeEnum",
"upgradedRessourceType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicatedCloud/{serviceName}/upgradeRessource\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"upgradeType\"",
",",
"upgradeType",
")",
";",
"query",
"(",
"sb",
",",
"\"upgradedRessourceId\"",
",",
"upgradedRessourceId",
")",
";",
"query",
"(",
"sb",
",",
"\"upgradedRessourceType\"",
",",
"upgradedRessourceType",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Get allowed durations for 'upgradeRessource' option
REST: GET /order/dedicatedCloud/{serviceName}/upgradeRessource
@param upgradedRessourceType [required] The type of ressource you want to upgrade.
@param upgradedRessourceId [required] The id of a particular ressource you want to upgrade in your Private Cloud (useless for "all" UpgradeRessourceTypeEnum)
@param upgradeType [required] The type of upgrade you want to process on the ressource(s)
@param serviceName [required] | [
"Get",
"allowed",
"durations",
"for",
"upgradeRessource",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5735-L5743 |
VueGWT/vue-gwt | processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java | TemplateParser.processVForValue | private String processVForValue(String vForValue) {
"""
Process a v-for value. It will register the loop variables as a local variable in the context
stack.
@param vForValue The value of the v-for attribute
@return A processed v-for value, should be placed in the HTML in place of the original v-for
value
"""
VForDefinition vForDef = new VForDefinition(vForValue, context, logger);
// Set return of the "in" expression
currentExpressionReturnType = vForDef.getInExpressionType();
String inExpression = this.processExpression(vForDef.getInExpression());
// And return the newly built definition
return vForDef.getVariableDefinition() + " in " + inExpression;
} | java | private String processVForValue(String vForValue) {
VForDefinition vForDef = new VForDefinition(vForValue, context, logger);
// Set return of the "in" expression
currentExpressionReturnType = vForDef.getInExpressionType();
String inExpression = this.processExpression(vForDef.getInExpression());
// And return the newly built definition
return vForDef.getVariableDefinition() + " in " + inExpression;
} | [
"private",
"String",
"processVForValue",
"(",
"String",
"vForValue",
")",
"{",
"VForDefinition",
"vForDef",
"=",
"new",
"VForDefinition",
"(",
"vForValue",
",",
"context",
",",
"logger",
")",
";",
"// Set return of the \"in\" expression",
"currentExpressionReturnType",
"=",
"vForDef",
".",
"getInExpressionType",
"(",
")",
";",
"String",
"inExpression",
"=",
"this",
".",
"processExpression",
"(",
"vForDef",
".",
"getInExpression",
"(",
")",
")",
";",
"// And return the newly built definition",
"return",
"vForDef",
".",
"getVariableDefinition",
"(",
")",
"+",
"\" in \"",
"+",
"inExpression",
";",
"}"
] | Process a v-for value. It will register the loop variables as a local variable in the context
stack.
@param vForValue The value of the v-for attribute
@return A processed v-for value, should be placed in the HTML in place of the original v-for
value | [
"Process",
"a",
"v",
"-",
"for",
"value",
".",
"It",
"will",
"register",
"the",
"loop",
"variables",
"as",
"a",
"local",
"variable",
"in",
"the",
"context",
"stack",
"."
] | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L524-L534 |
alkacon/opencms-core | src/org/opencms/loader/CmsResourceManager.java | CmsResourceManager.getTemplateLoaderFacade | public CmsTemplateLoaderFacade getTemplateLoaderFacade(CmsObject cms, CmsResource resource, String templateProperty)
throws CmsException {
"""
Returns a template loader facade for the given file.<p>
@param cms the current OpenCms user context
@param resource the requested file
@param templateProperty the property to read for the template
@return a resource loader facade for the given file
@throws CmsException if something goes wrong
"""
return getTemplateLoaderFacade(cms, null, resource, templateProperty);
} | java | public CmsTemplateLoaderFacade getTemplateLoaderFacade(CmsObject cms, CmsResource resource, String templateProperty)
throws CmsException {
return getTemplateLoaderFacade(cms, null, resource, templateProperty);
} | [
"public",
"CmsTemplateLoaderFacade",
"getTemplateLoaderFacade",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"String",
"templateProperty",
")",
"throws",
"CmsException",
"{",
"return",
"getTemplateLoaderFacade",
"(",
"cms",
",",
"null",
",",
"resource",
",",
"templateProperty",
")",
";",
"}"
] | Returns a template loader facade for the given file.<p>
@param cms the current OpenCms user context
@param resource the requested file
@param templateProperty the property to read for the template
@return a resource loader facade for the given file
@throws CmsException if something goes wrong | [
"Returns",
"a",
"template",
"loader",
"facade",
"for",
"the",
"given",
"file",
".",
"<p",
">",
"@param",
"cms",
"the",
"current",
"OpenCms",
"user",
"context",
"@param",
"resource",
"the",
"requested",
"file",
"@param",
"templateProperty",
"the",
"property",
"to",
"read",
"for",
"the",
"template"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L998-L1002 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.disableAutoScaleAsync | public Observable<Void> disableAutoScaleAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) {
"""
Disables automatic scaling for a pool.
@param poolId The ID of the pool on which to disable automatic scaling.
@param poolDisableAutoScaleOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful.
"""
return disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolDisableAutoScaleHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolDisableAutoScaleHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> disableAutoScaleAsync(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) {
return disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolDisableAutoScaleHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolDisableAutoScaleHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"disableAutoScaleAsync",
"(",
"String",
"poolId",
",",
"PoolDisableAutoScaleOptions",
"poolDisableAutoScaleOptions",
")",
"{",
"return",
"disableAutoScaleWithServiceResponseAsync",
"(",
"poolId",
",",
"poolDisableAutoScaleOptions",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"PoolDisableAutoScaleHeaders",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"PoolDisableAutoScaleHeaders",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Disables automatic scaling for a pool.
@param poolId The ID of the pool on which to disable automatic scaling.
@param poolDisableAutoScaleOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Disables",
"automatic",
"scaling",
"for",
"a",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2183-L2190 |
alkacon/opencms-core | src/org/opencms/configuration/CmsVfsConfiguration.java | CmsVfsConfiguration.getFolderTranslator | public CmsResourceTranslator getFolderTranslator() {
"""
Returns the folder resource translator that has been initialized
with the configured folder translation rules.<p>
@return the folder resource translator
"""
String[] array = new String[0];
if (m_folderTranslationEnabled) {
array = new String[m_folderTranslations.size()];
for (int i = 0; i < m_folderTranslations.size(); i++) {
array[i] = m_folderTranslations.get(i);
}
}
return new CmsResourceTranslator(array, false);
} | java | public CmsResourceTranslator getFolderTranslator() {
String[] array = new String[0];
if (m_folderTranslationEnabled) {
array = new String[m_folderTranslations.size()];
for (int i = 0; i < m_folderTranslations.size(); i++) {
array[i] = m_folderTranslations.get(i);
}
}
return new CmsResourceTranslator(array, false);
} | [
"public",
"CmsResourceTranslator",
"getFolderTranslator",
"(",
")",
"{",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"0",
"]",
";",
"if",
"(",
"m_folderTranslationEnabled",
")",
"{",
"array",
"=",
"new",
"String",
"[",
"m_folderTranslations",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_folderTranslations",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"array",
"[",
"i",
"]",
"=",
"m_folderTranslations",
".",
"get",
"(",
"i",
")",
";",
"}",
"}",
"return",
"new",
"CmsResourceTranslator",
"(",
"array",
",",
"false",
")",
";",
"}"
] | Returns the folder resource translator that has been initialized
with the configured folder translation rules.<p>
@return the folder resource translator | [
"Returns",
"the",
"folder",
"resource",
"translator",
"that",
"has",
"been",
"initialized",
"with",
"the",
"configured",
"folder",
"translation",
"rules",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsVfsConfiguration.java#L826-L836 |
MGunlogson/CuckooFilter4J | src/main/java/com/github/mgunlogson/cuckoofilter4j/IndexTagCalc.java | IndexTagCalc.isHashConfigurationIsSupported | private static boolean isHashConfigurationIsSupported(long numBuckets, int tagBits, int hashSize) {
"""
Determines if the chosen hash function is long enough for the table
configuration used.
"""
int hashBitsNeeded = getTotalBitsNeeded(numBuckets, tagBits);
switch (hashSize) {
case 32:
case 64:
return hashBitsNeeded <= hashSize;
default:
}
if (hashSize >= 128)
return tagBits <= 64 && getIndexBitsUsed(numBuckets) <= 64;
return false;
} | java | private static boolean isHashConfigurationIsSupported(long numBuckets, int tagBits, int hashSize) {
int hashBitsNeeded = getTotalBitsNeeded(numBuckets, tagBits);
switch (hashSize) {
case 32:
case 64:
return hashBitsNeeded <= hashSize;
default:
}
if (hashSize >= 128)
return tagBits <= 64 && getIndexBitsUsed(numBuckets) <= 64;
return false;
} | [
"private",
"static",
"boolean",
"isHashConfigurationIsSupported",
"(",
"long",
"numBuckets",
",",
"int",
"tagBits",
",",
"int",
"hashSize",
")",
"{",
"int",
"hashBitsNeeded",
"=",
"getTotalBitsNeeded",
"(",
"numBuckets",
",",
"tagBits",
")",
";",
"switch",
"(",
"hashSize",
")",
"{",
"case",
"32",
":",
"case",
"64",
":",
"return",
"hashBitsNeeded",
"<=",
"hashSize",
";",
"default",
":",
"}",
"if",
"(",
"hashSize",
">=",
"128",
")",
"return",
"tagBits",
"<=",
"64",
"&&",
"getIndexBitsUsed",
"(",
"numBuckets",
")",
"<=",
"64",
";",
"return",
"false",
";",
"}"
] | Determines if the chosen hash function is long enough for the table
configuration used. | [
"Determines",
"if",
"the",
"chosen",
"hash",
"function",
"is",
"long",
"enough",
"for",
"the",
"table",
"configuration",
"used",
"."
] | train | https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/IndexTagCalc.java#L111-L122 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java | BaseJdbcBufferedInserter.initializeBatch | protected void initializeBatch(String databaseName, String table)
throws SQLException {
"""
Initializes variables for batch insert and pre-compute PreparedStatement based on requested batch size and parameter size.
@param databaseName
@param table
@throws SQLException
"""
this.insertStmtPrefix = createInsertStatementStr(databaseName, table);
this.insertPstmtForFixedBatch =
this.conn.prepareStatement(createPrepareStatementStr(this.batchSize));
LOG.info(String.format("Initialized for %s insert " + this, (this.batchSize > 1) ? "batch" : ""));
} | java | protected void initializeBatch(String databaseName, String table)
throws SQLException {
this.insertStmtPrefix = createInsertStatementStr(databaseName, table);
this.insertPstmtForFixedBatch =
this.conn.prepareStatement(createPrepareStatementStr(this.batchSize));
LOG.info(String.format("Initialized for %s insert " + this, (this.batchSize > 1) ? "batch" : ""));
} | [
"protected",
"void",
"initializeBatch",
"(",
"String",
"databaseName",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"this",
".",
"insertStmtPrefix",
"=",
"createInsertStatementStr",
"(",
"databaseName",
",",
"table",
")",
";",
"this",
".",
"insertPstmtForFixedBatch",
"=",
"this",
".",
"conn",
".",
"prepareStatement",
"(",
"createPrepareStatementStr",
"(",
"this",
".",
"batchSize",
")",
")",
";",
"LOG",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"Initialized for %s insert \"",
"+",
"this",
",",
"(",
"this",
".",
"batchSize",
">",
"1",
")",
"?",
"\"batch\"",
":",
"\"\"",
")",
")",
";",
"}"
] | Initializes variables for batch insert and pre-compute PreparedStatement based on requested batch size and parameter size.
@param databaseName
@param table
@throws SQLException | [
"Initializes",
"variables",
"for",
"batch",
"insert",
"and",
"pre",
"-",
"compute",
"PreparedStatement",
"based",
"on",
"requested",
"batch",
"size",
"and",
"parameter",
"size",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java#L132-L138 |
pravega/pravega | common/src/main/java/io/pravega/common/util/TypedProperties.java | TypedProperties.getEnum | public <T extends Enum<T>> T getEnum(Property<T> property, Class<T> enumClass) throws ConfigurationException {
"""
Gets the value of an Enumeration property.
@param property The Property to get.
@param enumClass Class defining return type.
@param <T> Type of Enumeration.
@return The property value or default value, if no such is defined in the base Properties.
@throws ConfigurationException When the given property name does not exist within the current component and the property
does not have a default value set, or when the property cannot be parsed as the given Enum.
"""
return tryGet(property, s -> Enum.valueOf(enumClass, s));
} | java | public <T extends Enum<T>> T getEnum(Property<T> property, Class<T> enumClass) throws ConfigurationException {
return tryGet(property, s -> Enum.valueOf(enumClass, s));
} | [
"public",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnum",
"(",
"Property",
"<",
"T",
">",
"property",
",",
"Class",
"<",
"T",
">",
"enumClass",
")",
"throws",
"ConfigurationException",
"{",
"return",
"tryGet",
"(",
"property",
",",
"s",
"->",
"Enum",
".",
"valueOf",
"(",
"enumClass",
",",
"s",
")",
")",
";",
"}"
] | Gets the value of an Enumeration property.
@param property The Property to get.
@param enumClass Class defining return type.
@param <T> Type of Enumeration.
@return The property value or default value, if no such is defined in the base Properties.
@throws ConfigurationException When the given property name does not exist within the current component and the property
does not have a default value set, or when the property cannot be parsed as the given Enum. | [
"Gets",
"the",
"value",
"of",
"an",
"Enumeration",
"property",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/TypedProperties.java#L105-L107 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Streams.java | Streams.composedClose | static Runnable composedClose(BaseStream<?, ?> a, BaseStream<?, ?> b) {
"""
Given two streams, return a Runnable that
executes both of their {@link BaseStream#close} methods in sequence,
even if the first throws an exception, and if both throw exceptions, add
any exceptions thrown by the second as suppressed exceptions of the first.
"""
return new Runnable() {
@Override
public void run() {
try {
a.close();
}
catch (Throwable e1) {
try {
b.close();
}
catch (Throwable e2) {
try {
e1.addSuppressed(e2);
} catch (Throwable ignore) {}
}
throw e1;
}
b.close();
}
};
} | java | static Runnable composedClose(BaseStream<?, ?> a, BaseStream<?, ?> b) {
return new Runnable() {
@Override
public void run() {
try {
a.close();
}
catch (Throwable e1) {
try {
b.close();
}
catch (Throwable e2) {
try {
e1.addSuppressed(e2);
} catch (Throwable ignore) {}
}
throw e1;
}
b.close();
}
};
} | [
"static",
"Runnable",
"composedClose",
"(",
"BaseStream",
"<",
"?",
",",
"?",
">",
"a",
",",
"BaseStream",
"<",
"?",
",",
"?",
">",
"b",
")",
"{",
"return",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"a",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e1",
")",
"{",
"try",
"{",
"b",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e2",
")",
"{",
"try",
"{",
"e1",
".",
"addSuppressed",
"(",
"e2",
")",
";",
"}",
"catch",
"(",
"Throwable",
"ignore",
")",
"{",
"}",
"}",
"throw",
"e1",
";",
"}",
"b",
".",
"close",
"(",
")",
";",
"}",
"}",
";",
"}"
] | Given two streams, return a Runnable that
executes both of their {@link BaseStream#close} methods in sequence,
even if the first throws an exception, and if both throw exceptions, add
any exceptions thrown by the second as suppressed exceptions of the first. | [
"Given",
"two",
"streams",
"return",
"a",
"Runnable",
"that",
"executes",
"both",
"of",
"their",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Streams.java#L874-L895 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Strings.java | Strings.removeWord | public static String removeWord(final String host, final String word) {
"""
<p>
removeWord.
</p>
@param host
a {@link java.lang.String} object.
@param word
a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
"""
return removeWord(host, word, DELIMITER);
} | java | public static String removeWord(final String host, final String word) {
return removeWord(host, word, DELIMITER);
} | [
"public",
"static",
"String",
"removeWord",
"(",
"final",
"String",
"host",
",",
"final",
"String",
"word",
")",
"{",
"return",
"removeWord",
"(",
"host",
",",
"word",
",",
"DELIMITER",
")",
";",
"}"
] | <p>
removeWord.
</p>
@param host
a {@link java.lang.String} object.
@param word
a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"removeWord",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L630-L633 |
kiegroup/drools | drools-model/drools-constraint-parser/src/main/java/org/drools/constraint/parser/Providers.java | Providers.resourceProvider | public static Provider resourceProvider(String pathToResource, Charset encoding) throws IOException {
"""
Provide a Provider from the resource found in the current class loader with the provided encoding.<br/> As
resource is accessed through a class loader, a leading "/" is not allowed in pathToResource
"""
ClassLoader classLoader = Provider.class.getClassLoader();
return resourceProvider(classLoader, pathToResource, encoding);
} | java | public static Provider resourceProvider(String pathToResource, Charset encoding) throws IOException {
ClassLoader classLoader = Provider.class.getClassLoader();
return resourceProvider(classLoader, pathToResource, encoding);
} | [
"public",
"static",
"Provider",
"resourceProvider",
"(",
"String",
"pathToResource",
",",
"Charset",
"encoding",
")",
"throws",
"IOException",
"{",
"ClassLoader",
"classLoader",
"=",
"Provider",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"return",
"resourceProvider",
"(",
"classLoader",
",",
"pathToResource",
",",
"encoding",
")",
";",
"}"
] | Provide a Provider from the resource found in the current class loader with the provided encoding.<br/> As
resource is accessed through a class loader, a leading "/" is not allowed in pathToResource | [
"Provide",
"a",
"Provider",
"from",
"the",
"resource",
"found",
"in",
"the",
"current",
"class",
"loader",
"with",
"the",
"provided",
"encoding",
".",
"<br",
"/",
">",
"As",
"resource",
"is",
"accessed",
"through",
"a",
"class",
"loader",
"a",
"leading",
"/",
"is",
"not",
"allowed",
"in",
"pathToResource"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-constraint-parser/src/main/java/org/drools/constraint/parser/Providers.java#L106-L109 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/CopyToModule.java | CopyToModule.copyFileWithPIReplaced | private void copyFileWithPIReplaced(final URI src, final URI target, final URI copytoTargetFilename, final URI inputMapInTemp) {
"""
Copy files and replace workdir PI contents.
@param src source URI in temporary directory
@param target target URI in temporary directory
@param copytoTargetFilename target URI relative to temporary directory
@param inputMapInTemp input map URI in temporary directory
"""
assert src.isAbsolute();
assert target.isAbsolute();
assert !copytoTargetFilename.isAbsolute();
assert inputMapInTemp.isAbsolute();
final File workdir = new File(target).getParentFile();
if (!workdir.exists() && !workdir.mkdirs()) {
logger.error("Failed to create copy-to target directory " + workdir.toURI());
return;
}
final File path2project = getPathtoProject(copytoTargetFilename, target, inputMapInTemp, job);
final File path2rootmap = getPathtoRootmap(target, inputMapInTemp);
XMLFilter filter = new CopyToFilter(workdir, path2project, path2rootmap, src, target);
logger.info("Processing " + src + " to " + target);
try {
xmlUtils.transform(src, target, Collections.singletonList(filter));
} catch (final DITAOTException e) {
logger.error("Failed to write copy-to file: " + e.getMessage(), e);
}
} | java | private void copyFileWithPIReplaced(final URI src, final URI target, final URI copytoTargetFilename, final URI inputMapInTemp) {
assert src.isAbsolute();
assert target.isAbsolute();
assert !copytoTargetFilename.isAbsolute();
assert inputMapInTemp.isAbsolute();
final File workdir = new File(target).getParentFile();
if (!workdir.exists() && !workdir.mkdirs()) {
logger.error("Failed to create copy-to target directory " + workdir.toURI());
return;
}
final File path2project = getPathtoProject(copytoTargetFilename, target, inputMapInTemp, job);
final File path2rootmap = getPathtoRootmap(target, inputMapInTemp);
XMLFilter filter = new CopyToFilter(workdir, path2project, path2rootmap, src, target);
logger.info("Processing " + src + " to " + target);
try {
xmlUtils.transform(src, target, Collections.singletonList(filter));
} catch (final DITAOTException e) {
logger.error("Failed to write copy-to file: " + e.getMessage(), e);
}
} | [
"private",
"void",
"copyFileWithPIReplaced",
"(",
"final",
"URI",
"src",
",",
"final",
"URI",
"target",
",",
"final",
"URI",
"copytoTargetFilename",
",",
"final",
"URI",
"inputMapInTemp",
")",
"{",
"assert",
"src",
".",
"isAbsolute",
"(",
")",
";",
"assert",
"target",
".",
"isAbsolute",
"(",
")",
";",
"assert",
"!",
"copytoTargetFilename",
".",
"isAbsolute",
"(",
")",
";",
"assert",
"inputMapInTemp",
".",
"isAbsolute",
"(",
")",
";",
"final",
"File",
"workdir",
"=",
"new",
"File",
"(",
"target",
")",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"!",
"workdir",
".",
"exists",
"(",
")",
"&&",
"!",
"workdir",
".",
"mkdirs",
"(",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"Failed to create copy-to target directory \"",
"+",
"workdir",
".",
"toURI",
"(",
")",
")",
";",
"return",
";",
"}",
"final",
"File",
"path2project",
"=",
"getPathtoProject",
"(",
"copytoTargetFilename",
",",
"target",
",",
"inputMapInTemp",
",",
"job",
")",
";",
"final",
"File",
"path2rootmap",
"=",
"getPathtoRootmap",
"(",
"target",
",",
"inputMapInTemp",
")",
";",
"XMLFilter",
"filter",
"=",
"new",
"CopyToFilter",
"(",
"workdir",
",",
"path2project",
",",
"path2rootmap",
",",
"src",
",",
"target",
")",
";",
"logger",
".",
"info",
"(",
"\"Processing \"",
"+",
"src",
"+",
"\" to \"",
"+",
"target",
")",
";",
"try",
"{",
"xmlUtils",
".",
"transform",
"(",
"src",
",",
"target",
",",
"Collections",
".",
"singletonList",
"(",
"filter",
")",
")",
";",
"}",
"catch",
"(",
"final",
"DITAOTException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Failed to write copy-to file: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Copy files and replace workdir PI contents.
@param src source URI in temporary directory
@param target target URI in temporary directory
@param copytoTargetFilename target URI relative to temporary directory
@param inputMapInTemp input map URI in temporary directory | [
"Copy",
"files",
"and",
"replace",
"workdir",
"PI",
"contents",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L198-L218 |
pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java | StreamMetrics.reportActiveSegments | public static void reportActiveSegments(String scope, String streamName, int numSegments) {
"""
Reports the number of active segments for a Stream.
@param scope Scope.
@param streamName Name of the Stream.
@param numSegments Number of active segments in this Stream.
"""
DYNAMIC_LOGGER.reportGaugeValue(SEGMENTS_COUNT, numSegments, streamTags(scope, streamName));
} | java | public static void reportActiveSegments(String scope, String streamName, int numSegments) {
DYNAMIC_LOGGER.reportGaugeValue(SEGMENTS_COUNT, numSegments, streamTags(scope, streamName));
} | [
"public",
"static",
"void",
"reportActiveSegments",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"int",
"numSegments",
")",
"{",
"DYNAMIC_LOGGER",
".",
"reportGaugeValue",
"(",
"SEGMENTS_COUNT",
",",
"numSegments",
",",
"streamTags",
"(",
"scope",
",",
"streamName",
")",
")",
";",
"}"
] | Reports the number of active segments for a Stream.
@param scope Scope.
@param streamName Name of the Stream.
@param numSegments Number of active segments in this Stream. | [
"Reports",
"the",
"number",
"of",
"active",
"segments",
"for",
"a",
"Stream",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L200-L202 |
gwt-maven-plugin/gwt-maven-plugin | src/main/java/org/codehaus/mojo/gwt/ClasspathBuilder.java | ClasspathBuilder.addSources | private void addSources( final Collection<File> items, final Collection<String> sourceRoots ) {
"""
Add source path and resource paths of the project to the list of classpath items.
@param items Classpath items.
@param sourceRoots
"""
for ( String path : sourceRoots )
{
items.add( new File( path ) );
}
} | java | private void addSources( final Collection<File> items, final Collection<String> sourceRoots )
{
for ( String path : sourceRoots )
{
items.add( new File( path ) );
}
} | [
"private",
"void",
"addSources",
"(",
"final",
"Collection",
"<",
"File",
">",
"items",
",",
"final",
"Collection",
"<",
"String",
">",
"sourceRoots",
")",
"{",
"for",
"(",
"String",
"path",
":",
"sourceRoots",
")",
"{",
"items",
".",
"add",
"(",
"new",
"File",
"(",
"path",
")",
")",
";",
"}",
"}"
] | Add source path and resource paths of the project to the list of classpath items.
@param items Classpath items.
@param sourceRoots | [
"Add",
"source",
"path",
"and",
"resource",
"paths",
"of",
"the",
"project",
"to",
"the",
"list",
"of",
"classpath",
"items",
"."
] | train | https://github.com/gwt-maven-plugin/gwt-maven-plugin/blob/0cdd5054b43f182cc22a8acf61ec79ac42b0dfdc/src/main/java/org/codehaus/mojo/gwt/ClasspathBuilder.java#L273-L279 |
thelinmichael/spotify-web-api-java | src/main/java/com/wrapper/spotify/SpotifyApi.java | SpotifyApi.unfollowPlaylist | public UnfollowPlaylistRequest.Builder unfollowPlaylist(String owner_id, String playlist_id) {
"""
Remove the current user as a follower of a playlist.
@param owner_id The owners username.
@param playlist_id The playlist's ID.
@return An {@link UnfollowPlaylistRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a>
"""
return new UnfollowPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.owner_id(owner_id)
.playlist_id(playlist_id);
} | java | public UnfollowPlaylistRequest.Builder unfollowPlaylist(String owner_id, String playlist_id) {
return new UnfollowPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.owner_id(owner_id)
.playlist_id(playlist_id);
} | [
"public",
"UnfollowPlaylistRequest",
".",
"Builder",
"unfollowPlaylist",
"(",
"String",
"owner_id",
",",
"String",
"playlist_id",
")",
"{",
"return",
"new",
"UnfollowPlaylistRequest",
".",
"Builder",
"(",
"accessToken",
")",
".",
"setDefaults",
"(",
"httpManager",
",",
"scheme",
",",
"host",
",",
"port",
")",
".",
"owner_id",
"(",
"owner_id",
")",
".",
"playlist_id",
"(",
"playlist_id",
")",
";",
"}"
] | Remove the current user as a follower of a playlist.
@param owner_id The owners username.
@param playlist_id The playlist's ID.
@return An {@link UnfollowPlaylistRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a> | [
"Remove",
"the",
"current",
"user",
"as",
"a",
"follower",
"of",
"a",
"playlist",
"."
] | train | https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L725-L730 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java | BondTools.giveAngleBothMethods | public static double giveAngleBothMethods(IAtom from, IAtom to1, IAtom to2, boolean bool) {
"""
Gives the angle between two lines starting at atom from and going to to1
and to2. If bool=false the angle starts from the middle line and goes from
0 to PI or 0 to -PI if the to2 is on the left or right side of the line. If
bool=true the angle goes from 0 to 2PI.
@param from the atom to view from.
@param to1 first direction to look in.
@param to2 second direction to look in.
@param bool true=angle is 0 to 2PI, false=angel is -PI to PI.
@return The angle in rad.
"""
return giveAngleBothMethods(from.getPoint2d(), to1.getPoint2d(), to2.getPoint2d(), bool);
} | java | public static double giveAngleBothMethods(IAtom from, IAtom to1, IAtom to2, boolean bool) {
return giveAngleBothMethods(from.getPoint2d(), to1.getPoint2d(), to2.getPoint2d(), bool);
} | [
"public",
"static",
"double",
"giveAngleBothMethods",
"(",
"IAtom",
"from",
",",
"IAtom",
"to1",
",",
"IAtom",
"to2",
",",
"boolean",
"bool",
")",
"{",
"return",
"giveAngleBothMethods",
"(",
"from",
".",
"getPoint2d",
"(",
")",
",",
"to1",
".",
"getPoint2d",
"(",
")",
",",
"to2",
".",
"getPoint2d",
"(",
")",
",",
"bool",
")",
";",
"}"
] | Gives the angle between two lines starting at atom from and going to to1
and to2. If bool=false the angle starts from the middle line and goes from
0 to PI or 0 to -PI if the to2 is on the left or right side of the line. If
bool=true the angle goes from 0 to 2PI.
@param from the atom to view from.
@param to1 first direction to look in.
@param to2 second direction to look in.
@param bool true=angle is 0 to 2PI, false=angel is -PI to PI.
@return The angle in rad. | [
"Gives",
"the",
"angle",
"between",
"two",
"lines",
"starting",
"at",
"atom",
"from",
"and",
"going",
"to",
"to1",
"and",
"to2",
".",
"If",
"bool",
"=",
"false",
"the",
"angle",
"starts",
"from",
"the",
"middle",
"line",
"and",
"goes",
"from",
"0",
"to",
"PI",
"or",
"0",
"to",
"-",
"PI",
"if",
"the",
"to2",
"is",
"on",
"the",
"left",
"or",
"right",
"side",
"of",
"the",
"line",
".",
"If",
"bool",
"=",
"true",
"the",
"angle",
"goes",
"from",
"0",
"to",
"2PI",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java#L157-L159 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java | WebhookMessage.embeds | public static WebhookMessage embeds(MessageEmbed first, MessageEmbed... embeds) {
"""
forcing first embed as we expect at least one entry (Effective Java 3rd. Edition - Item 53)
"""
Checks.notNull(first, "Embeds");
Checks.noneNull(embeds, "Embeds");
List<MessageEmbed> list = new ArrayList<>(1 + embeds.length);
list.add(first);
Collections.addAll(list, embeds);
return new WebhookMessage(null, null, null, list, false, null);
} | java | public static WebhookMessage embeds(MessageEmbed first, MessageEmbed... embeds)
{
Checks.notNull(first, "Embeds");
Checks.noneNull(embeds, "Embeds");
List<MessageEmbed> list = new ArrayList<>(1 + embeds.length);
list.add(first);
Collections.addAll(list, embeds);
return new WebhookMessage(null, null, null, list, false, null);
} | [
"public",
"static",
"WebhookMessage",
"embeds",
"(",
"MessageEmbed",
"first",
",",
"MessageEmbed",
"...",
"embeds",
")",
"{",
"Checks",
".",
"notNull",
"(",
"first",
",",
"\"Embeds\"",
")",
";",
"Checks",
".",
"noneNull",
"(",
"embeds",
",",
"\"Embeds\"",
")",
";",
"List",
"<",
"MessageEmbed",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
"+",
"embeds",
".",
"length",
")",
";",
"list",
".",
"add",
"(",
"first",
")",
";",
"Collections",
".",
"addAll",
"(",
"list",
",",
"embeds",
")",
";",
"return",
"new",
"WebhookMessage",
"(",
"null",
",",
"null",
",",
"null",
",",
"list",
",",
"false",
",",
"null",
")",
";",
"}"
] | forcing first embed as we expect at least one entry (Effective Java 3rd. Edition - Item 53) | [
"forcing",
"first",
"embed",
"as",
"we",
"expect",
"at",
"least",
"one",
"entry",
"(",
"Effective",
"Java",
"3rd",
".",
"Edition",
"-",
"Item",
"53",
")"
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java#L77-L85 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/oauth/OAuth2SessionManager.java | OAuth2SessionManager.fetchUserCredentials | UserCredentials fetchUserCredentials( String code ) {
"""
Fetches user credentials
@param code oauth2 OTP code
@return The user credentials (without userId)
"""
HttpPost post = new HttpPost( accessTokenUrl );
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_ID, appInfo.getAppId() ) );
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_SECRET, appInfo.getAppSecret() ) );
parameters.add( new BasicNameValuePair( OAuth2.CODE, code ) );
parameters.add( new BasicNameValuePair( OAuth2.GRANT_TYPE, OAuth2.AUTHORIZATION_CODE ) );
if ( appInfo.getRedirectUrl() != null ) {
parameters.add( new BasicNameValuePair( OAuth2.REDIRECT_URI, appInfo.getRedirectUrl() ) );
}
try {
post.setEntity( new UrlEncodedFormEntity( parameters, PcsUtils.UTF8.name() ) );
} catch ( UnsupportedEncodingException ex ) {
throw new CStorageException( "Can't encode parameters", ex );
}
HttpResponse response;
try {
response = httpClient.execute( post );
} catch ( IOException e ) {
throw new CStorageException( "HTTP request while fetching token has failed", e );
}
// FIXME check status code here
final String json;
try {
json = EntityUtils.toString( response.getEntity(), PcsUtils.UTF8.name() );
} catch ( IOException e ) {
throw new CStorageException( "Can't retrieve json string in HTTP response entity", e );
}
LOGGER.debug( "fetchUserCredentials - json: {}", json );
Credentials credentials = Credentials.createFromJson( json );
userCredentials = new UserCredentials( appInfo,
null, // userId is unknown yet
credentials );
return userCredentials;
} | java | UserCredentials fetchUserCredentials( String code )
{
HttpPost post = new HttpPost( accessTokenUrl );
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_ID, appInfo.getAppId() ) );
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_SECRET, appInfo.getAppSecret() ) );
parameters.add( new BasicNameValuePair( OAuth2.CODE, code ) );
parameters.add( new BasicNameValuePair( OAuth2.GRANT_TYPE, OAuth2.AUTHORIZATION_CODE ) );
if ( appInfo.getRedirectUrl() != null ) {
parameters.add( new BasicNameValuePair( OAuth2.REDIRECT_URI, appInfo.getRedirectUrl() ) );
}
try {
post.setEntity( new UrlEncodedFormEntity( parameters, PcsUtils.UTF8.name() ) );
} catch ( UnsupportedEncodingException ex ) {
throw new CStorageException( "Can't encode parameters", ex );
}
HttpResponse response;
try {
response = httpClient.execute( post );
} catch ( IOException e ) {
throw new CStorageException( "HTTP request while fetching token has failed", e );
}
// FIXME check status code here
final String json;
try {
json = EntityUtils.toString( response.getEntity(), PcsUtils.UTF8.name() );
} catch ( IOException e ) {
throw new CStorageException( "Can't retrieve json string in HTTP response entity", e );
}
LOGGER.debug( "fetchUserCredentials - json: {}", json );
Credentials credentials = Credentials.createFromJson( json );
userCredentials = new UserCredentials( appInfo,
null, // userId is unknown yet
credentials );
return userCredentials;
} | [
"UserCredentials",
"fetchUserCredentials",
"(",
"String",
"code",
")",
"{",
"HttpPost",
"post",
"=",
"new",
"HttpPost",
"(",
"accessTokenUrl",
")",
";",
"List",
"<",
"NameValuePair",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"CLIENT_ID",
",",
"appInfo",
".",
"getAppId",
"(",
")",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"CLIENT_SECRET",
",",
"appInfo",
".",
"getAppSecret",
"(",
")",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"CODE",
",",
"code",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"GRANT_TYPE",
",",
"OAuth2",
".",
"AUTHORIZATION_CODE",
")",
")",
";",
"if",
"(",
"appInfo",
".",
"getRedirectUrl",
"(",
")",
"!=",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"REDIRECT_URI",
",",
"appInfo",
".",
"getRedirectUrl",
"(",
")",
")",
")",
";",
"}",
"try",
"{",
"post",
".",
"setEntity",
"(",
"new",
"UrlEncodedFormEntity",
"(",
"parameters",
",",
"PcsUtils",
".",
"UTF8",
".",
"name",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"ex",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Can't encode parameters\"",
",",
"ex",
")",
";",
"}",
"HttpResponse",
"response",
";",
"try",
"{",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"post",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"HTTP request while fetching token has failed\"",
",",
"e",
")",
";",
"}",
"// FIXME check status code here",
"final",
"String",
"json",
";",
"try",
"{",
"json",
"=",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
",",
"PcsUtils",
".",
"UTF8",
".",
"name",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Can't retrieve json string in HTTP response entity\"",
",",
"e",
")",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"fetchUserCredentials - json: {}\"",
",",
"json",
")",
";",
"Credentials",
"credentials",
"=",
"Credentials",
".",
"createFromJson",
"(",
"json",
")",
";",
"userCredentials",
"=",
"new",
"UserCredentials",
"(",
"appInfo",
",",
"null",
",",
"// userId is unknown yet",
"credentials",
")",
";",
"return",
"userCredentials",
";",
"}"
] | Fetches user credentials
@param code oauth2 OTP code
@return The user credentials (without userId) | [
"Fetches",
"user",
"credentials"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/oauth/OAuth2SessionManager.java#L198-L242 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.addAll | public static <T> boolean addAll(Collection<T> self, Iterable<T> items) {
"""
Adds all items from the iterable to the Collection.
@param self the collection
@param items the items to add
@return true if the collection changed
"""
boolean changed = false;
for (T next : items) {
if (self.add(next)) changed = true;
}
return changed;
} | java | public static <T> boolean addAll(Collection<T> self, Iterable<T> items) {
boolean changed = false;
for (T next : items) {
if (self.add(next)) changed = true;
}
return changed;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"self",
",",
"Iterable",
"<",
"T",
">",
"items",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
"T",
"next",
":",
"items",
")",
"{",
"if",
"(",
"self",
".",
"add",
"(",
"next",
")",
")",
"changed",
"=",
"true",
";",
"}",
"return",
"changed",
";",
"}"
] | Adds all items from the iterable to the Collection.
@param self the collection
@param items the items to add
@return true if the collection changed | [
"Adds",
"all",
"items",
"from",
"the",
"iterable",
"to",
"the",
"Collection",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9387-L9393 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/imageprocessing/ExamplePlanarImages.java | ExamplePlanarImages.pixelAccess | public static void pixelAccess( BufferedImage input ) {
"""
Values of pixels can be read and modified by accessing the internal {@link ImageGray}.
"""
// convert the BufferedImage into a Planar
Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);
int x = 10, y = 10;
// to access a pixel you first access the gray image for the each band
for( int i = 0; i < image.getNumBands(); i++ )
System.out.println("Original "+i+" = "+image.getBand(i).get(x,y));
// change the value in each band
for( int i = 0; i < image.getNumBands(); i++ )
image.getBand(i).set(x, y, 100 + i);
// to access a pixel you first access the gray image for the each band
for( int i = 0; i < image.getNumBands(); i++ )
System.out.println("Result "+i+" = "+image.getBand(i).get(x,y));
}
/**
* There is no real perfect way that everyone agrees on for converting color images into gray scale
* images. Two examples of how to convert a Planar image into a gray scale image are shown
* in this example.
*/
public static void convertToGray( BufferedImage input ) {
// convert the BufferedImage into a Planar
Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);
GrayU8 gray = new GrayU8( image.width,image.height);
// creates a gray scale image by averaging intensity value across pixels
ConvertImage.average(image, gray);
BufferedImage outputAve = ConvertBufferedImage.convertTo(gray,null);
// convert to gray scale but weigh each color band based on how human vision works
ColorRgb.rgbToGray_Weighted(image, gray);
BufferedImage outputWeighted = ConvertBufferedImage.convertTo(gray,null);
// create an output image just from the first band
BufferedImage outputBand0 = ConvertBufferedImage.convertTo(image.getBand(0),null);
gui.addImage(outputAve,"Gray Averaged");
gui.addImage(outputWeighted,"Gray Weighted");
gui.addImage(outputBand0,"Band 0");
}
public static void main( String args[] ) {
BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("apartment_building_02.jpg"));
// Uncomment lines below to run each example
ExamplePlanarImages.independent(input);
ExamplePlanarImages.pixelAccess(input);
ExamplePlanarImages.convertToGray(input);
ShowImages.showWindow(gui,"Color Planar Image Examples",true);
}
} | java | public static void pixelAccess( BufferedImage input ) {
// convert the BufferedImage into a Planar
Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);
int x = 10, y = 10;
// to access a pixel you first access the gray image for the each band
for( int i = 0; i < image.getNumBands(); i++ )
System.out.println("Original "+i+" = "+image.getBand(i).get(x,y));
// change the value in each band
for( int i = 0; i < image.getNumBands(); i++ )
image.getBand(i).set(x, y, 100 + i);
// to access a pixel you first access the gray image for the each band
for( int i = 0; i < image.getNumBands(); i++ )
System.out.println("Result "+i+" = "+image.getBand(i).get(x,y));
}
/**
* There is no real perfect way that everyone agrees on for converting color images into gray scale
* images. Two examples of how to convert a Planar image into a gray scale image are shown
* in this example.
*/
public static void convertToGray( BufferedImage input ) {
// convert the BufferedImage into a Planar
Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);
GrayU8 gray = new GrayU8( image.width,image.height);
// creates a gray scale image by averaging intensity value across pixels
ConvertImage.average(image, gray);
BufferedImage outputAve = ConvertBufferedImage.convertTo(gray,null);
// convert to gray scale but weigh each color band based on how human vision works
ColorRgb.rgbToGray_Weighted(image, gray);
BufferedImage outputWeighted = ConvertBufferedImage.convertTo(gray,null);
// create an output image just from the first band
BufferedImage outputBand0 = ConvertBufferedImage.convertTo(image.getBand(0),null);
gui.addImage(outputAve,"Gray Averaged");
gui.addImage(outputWeighted,"Gray Weighted");
gui.addImage(outputBand0,"Band 0");
}
public static void main( String args[] ) {
BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("apartment_building_02.jpg"));
// Uncomment lines below to run each example
ExamplePlanarImages.independent(input);
ExamplePlanarImages.pixelAccess(input);
ExamplePlanarImages.convertToGray(input);
ShowImages.showWindow(gui,"Color Planar Image Examples",true);
}
} | [
"public",
"static",
"void",
"pixelAccess",
"(",
"BufferedImage",
"input",
")",
"{",
"// convert the BufferedImage into a Planar",
"Planar",
"<",
"GrayU8",
">",
"image",
"=",
"ConvertBufferedImage",
".",
"convertFromPlanar",
"(",
"input",
",",
"null",
",",
"true",
",",
"GrayU8",
".",
"class",
")",
";",
"int",
"x",
"=",
"10",
",",
"y",
"=",
"10",
";",
"// to access a pixel you first access the gray image for the each band",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"image",
".",
"getNumBands",
"(",
")",
";",
"i",
"++",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"Original \"",
"+",
"i",
"+",
"\" = \"",
"+",
"image",
".",
"getBand",
"(",
"i",
")",
".",
"get",
"(",
"x",
",",
"y",
")",
")",
";",
"// change the value in each band",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"image",
".",
"getNumBands",
"(",
")",
";",
"i",
"++",
")",
"image",
".",
"getBand",
"(",
"i",
")",
".",
"set",
"(",
"x",
",",
"y",
",",
"100",
"+",
"i",
")",
";",
"// to access a pixel you first access the gray image for the each band",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"image",
".",
"getNumBands",
"(",
")",
";",
"i",
"++",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"Result \"",
"+",
"i",
"+",
"\" = \"",
"+",
"image",
".",
"getBand",
"(",
"i",
")",
".",
"get",
"(",
"x",
",",
"y",
")",
")",
";",
"}",
"/**\n\t * There is no real perfect way that everyone agrees on for converting color images into gray scale\n\t * images. Two examples of how to convert a Planar image into a gray scale image are shown\n\t * in this example.\n\t */",
"public",
"static",
"void",
"convertToGray",
"(",
"BufferedImage",
"input",
")",
"{",
"// convert the BufferedImage into a Planar",
"Planar",
"<",
"GrayU8",
">",
"image",
"=",
"ConvertBufferedImage",
".",
"convertFromPlanar",
"(",
"input",
",",
"null",
",",
"true",
",",
"GrayU8",
".",
"class",
")",
";",
"GrayU8",
"gray",
"=",
"new",
"GrayU8",
"(",
"image",
".",
"width",
",",
"image",
".",
"height",
")",
";",
"// creates a gray scale image by averaging intensity value across pixels",
"ConvertImage",
".",
"average",
"(",
"image",
",",
"gray",
")",
";",
"BufferedImage",
"outputAve",
"=",
"ConvertBufferedImage",
".",
"convertTo",
"(",
"gray",
",",
"null",
")",
";",
"// convert to gray scale but weigh each color band based on how human vision works",
"ColorRgb",
".",
"rgbToGray_Weighted",
"(",
"image",
",",
"gray",
")",
";",
"BufferedImage",
"outputWeighted",
"=",
"ConvertBufferedImage",
".",
"convertTo",
"(",
"gray",
",",
"null",
")",
";",
"// create an output image just from the first band",
"BufferedImage",
"outputBand0",
"=",
"ConvertBufferedImage",
".",
"convertTo",
"(",
"image",
".",
"getBand",
"(",
"0",
")",
",",
"null",
")",
";",
"gui",
".",
"addImage",
"(",
"outputAve",
",",
"\"Gray Averaged\"",
")",
";",
"gui",
".",
"addImage",
"(",
"outputWeighted",
",",
"\"Gray Weighted\"",
")",
";",
"gui",
".",
"addImage",
"(",
"outputBand0",
",",
"\"Band 0\"",
")",
";",
"}",
"public",
"static",
"void",
"main",
"",
"(",
"String",
"args",
"[",
"]",
")",
"{",
"BufferedImage",
"input",
"=",
"UtilImageIO",
".",
"loadImage",
"(",
"UtilIO",
".",
"pathExample",
"(",
"\"apartment_building_02.jpg\"",
")",
")",
";",
"// Uncomment lines below to run each example",
"ExamplePlanarImages",
".",
"independent",
"(",
"input",
")",
";",
"ExamplePlanarImages",
".",
"pixelAccess",
"(",
"input",
")",
";",
"ExamplePlanarImages",
".",
"convertToGray",
"(",
"input",
")",
";",
"ShowImages",
".",
"showWindow",
"(",
"gui",
",",
"\"Color Planar Image Examples\"",
",",
"true",
")",
";",
"}",
"}"
] | Values of pixels can be read and modified by accessing the internal {@link ImageGray}. | [
"Values",
"of",
"pixels",
"can",
"be",
"read",
"and",
"modified",
"by",
"accessing",
"the",
"internal",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExamplePlanarImages.java#L86-L143 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java | CommonsAssert.assertEquals | public static <T> void assertEquals (@Nullable final String sUserMsg, @Nullable final T x, @Nullable final T y) {
"""
Like JUnit assertEquals but using {@link EqualsHelper}.
@param sUserMsg
Optional user message. May be <code>null</code>.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>.
"""
if (!EqualsHelper.equals (x, y))
fail ("<" +
x +
"> is not equal to <" +
y +
">" +
(sUserMsg != null && sUserMsg.length () > 0 ? ": " + sUserMsg : ""));
} | java | public static <T> void assertEquals (@Nullable final String sUserMsg, @Nullable final T x, @Nullable final T y)
{
if (!EqualsHelper.equals (x, y))
fail ("<" +
x +
"> is not equal to <" +
y +
">" +
(sUserMsg != null && sUserMsg.length () > 0 ? ": " + sUserMsg : ""));
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertEquals",
"(",
"@",
"Nullable",
"final",
"String",
"sUserMsg",
",",
"@",
"Nullable",
"final",
"T",
"x",
",",
"@",
"Nullable",
"final",
"T",
"y",
")",
"{",
"if",
"(",
"!",
"EqualsHelper",
".",
"equals",
"(",
"x",
",",
"y",
")",
")",
"fail",
"(",
"\"<\"",
"+",
"x",
"+",
"\"> is not equal to <\"",
"+",
"y",
"+",
"\">\"",
"+",
"(",
"sUserMsg",
"!=",
"null",
"&&",
"sUserMsg",
".",
"length",
"(",
")",
">",
"0",
"?",
"\": \"",
"+",
"sUserMsg",
":",
"\"\"",
")",
")",
";",
"}"
] | Like JUnit assertEquals but using {@link EqualsHelper}.
@param sUserMsg
Optional user message. May be <code>null</code>.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>. | [
"Like",
"JUnit",
"assertEquals",
"but",
"using",
"{",
"@link",
"EqualsHelper",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java#L185-L194 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/JwtFatActions.java | JwtFatActions.logInAndObtainJwtCookie | public Cookie logInAndObtainJwtCookie(String testName, String protectedUrl, String username, String password) throws Exception {
"""
Accesses the protected resource and logs in successfully, ensuring that a JWT SSO cookie is included in the result.
"""
return logInAndObtainJwtCookie(testName, new WebClient(), protectedUrl, username, password);
} | java | public Cookie logInAndObtainJwtCookie(String testName, String protectedUrl, String username, String password) throws Exception {
return logInAndObtainJwtCookie(testName, new WebClient(), protectedUrl, username, password);
} | [
"public",
"Cookie",
"logInAndObtainJwtCookie",
"(",
"String",
"testName",
",",
"String",
"protectedUrl",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"Exception",
"{",
"return",
"logInAndObtainJwtCookie",
"(",
"testName",
",",
"new",
"WebClient",
"(",
")",
",",
"protectedUrl",
",",
"username",
",",
"password",
")",
";",
"}"
] | Accesses the protected resource and logs in successfully, ensuring that a JWT SSO cookie is included in the result. | [
"Accesses",
"the",
"protected",
"resource",
"and",
"logs",
"in",
"successfully",
"ensuring",
"that",
"a",
"JWT",
"SSO",
"cookie",
"is",
"included",
"in",
"the",
"result",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/JwtFatActions.java#L29-L31 |
apache/incubator-atlas | addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java | HiveMetaStoreBridge.getTableQualifiedName | public static String getTableQualifiedName(String clusterName, String dbName, String tableName, boolean isTemporaryTable) {
"""
Construct the qualified name used to uniquely identify a Table instance in Atlas.
@param clusterName Name of the cluster to which the Hive component belongs
@param dbName Name of the Hive database to which the Table belongs
@param tableName Name of the Hive table
@return Unique qualified name to identify the Table instance in Atlas.
"""
String tableTempName = tableName;
if (isTemporaryTable) {
if (SessionState.get() != null && SessionState.get().getSessionId() != null) {
tableTempName = tableName + TEMP_TABLE_PREFIX + SessionState.get().getSessionId();
} else {
tableTempName = tableName + TEMP_TABLE_PREFIX + RandomStringUtils.random(10);
}
}
return String.format("%s.%s@%s", dbName.toLowerCase(), tableTempName.toLowerCase(), clusterName);
} | java | public static String getTableQualifiedName(String clusterName, String dbName, String tableName, boolean isTemporaryTable) {
String tableTempName = tableName;
if (isTemporaryTable) {
if (SessionState.get() != null && SessionState.get().getSessionId() != null) {
tableTempName = tableName + TEMP_TABLE_PREFIX + SessionState.get().getSessionId();
} else {
tableTempName = tableName + TEMP_TABLE_PREFIX + RandomStringUtils.random(10);
}
}
return String.format("%s.%s@%s", dbName.toLowerCase(), tableTempName.toLowerCase(), clusterName);
} | [
"public",
"static",
"String",
"getTableQualifiedName",
"(",
"String",
"clusterName",
",",
"String",
"dbName",
",",
"String",
"tableName",
",",
"boolean",
"isTemporaryTable",
")",
"{",
"String",
"tableTempName",
"=",
"tableName",
";",
"if",
"(",
"isTemporaryTable",
")",
"{",
"if",
"(",
"SessionState",
".",
"get",
"(",
")",
"!=",
"null",
"&&",
"SessionState",
".",
"get",
"(",
")",
".",
"getSessionId",
"(",
")",
"!=",
"null",
")",
"{",
"tableTempName",
"=",
"tableName",
"+",
"TEMP_TABLE_PREFIX",
"+",
"SessionState",
".",
"get",
"(",
")",
".",
"getSessionId",
"(",
")",
";",
"}",
"else",
"{",
"tableTempName",
"=",
"tableName",
"+",
"TEMP_TABLE_PREFIX",
"+",
"RandomStringUtils",
".",
"random",
"(",
"10",
")",
";",
"}",
"}",
"return",
"String",
".",
"format",
"(",
"\"%s.%s@%s\"",
",",
"dbName",
".",
"toLowerCase",
"(",
")",
",",
"tableTempName",
".",
"toLowerCase",
"(",
")",
",",
"clusterName",
")",
";",
"}"
] | Construct the qualified name used to uniquely identify a Table instance in Atlas.
@param clusterName Name of the cluster to which the Hive component belongs
@param dbName Name of the Hive database to which the Table belongs
@param tableName Name of the Hive table
@return Unique qualified name to identify the Table instance in Atlas. | [
"Construct",
"the",
"qualified",
"name",
"used",
"to",
"uniquely",
"identify",
"a",
"Table",
"instance",
"in",
"Atlas",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java#L374-L384 |
petergeneric/stdlib | guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/resteasy/GuicedResteasy.java | GuicedResteasy.configure | protected void configure(ServletContainerDispatcher dispatcher) throws ServletException {
"""
Try to initialise a ServletContainerDispatcher with the connection to the Guice REST services
"""
// Make sure we are registered with the Guice registry
registry.register(this, true);
// Configure the dispatcher
final Registry resteasyRegistry;
final ResteasyProviderFactory providerFactory;
{
final ResteasyRequestResponseFactory converter = new ResteasyRequestResponseFactory(dispatcher);
dispatcher.init(context, bootstrap, converter, converter);
if (filterConfig != null)
dispatcher.getDispatcher().getDefaultContextObjects().put(FilterConfig.class, filterConfig);
if (servletConfig != null)
dispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);
resteasyRegistry = dispatcher.getDispatcher().getRegistry();
providerFactory = dispatcher.getDispatcher().getProviderFactory();
}
// Register the REST provider classes
for (Class<?> providerClass : ResteasyProviderRegistry.getClasses())
{
log.debug("Registering REST providers: " + providerClass.getName());
providerFactory.registerProvider(providerClass);
}
// Register the REST provider singletons
for (Object provider : ResteasyProviderRegistry.getSingletons())
{
log.debug("Registering REST provider singleton: " + provider);
providerFactory.registerProviderInstance(provider);
}
providerFactory.registerProviderInstance(new LogReportMessageBodyReader());
// Register the JAXBContext provider
providerFactory.registerProviderInstance(jaxbContextResolver);
// Register the exception mapper
{
// Register the ExceptionMapper for ApplicationException
providerFactory.register(this.exceptionMapper);
log.trace("ExceptionMapper registered for ApplicationException");
}
// Register the REST resources
for (RestResource resource : RestResourceRegistry.getResources())
{
log.debug("Registering REST resource: " + resource.getResourceClass().getName());
resteasyRegistry.addResourceFactory(new ResteasyGuiceResource(injector, resource.getResourceClass()));
}
} | java | protected void configure(ServletContainerDispatcher dispatcher) throws ServletException
{
// Make sure we are registered with the Guice registry
registry.register(this, true);
// Configure the dispatcher
final Registry resteasyRegistry;
final ResteasyProviderFactory providerFactory;
{
final ResteasyRequestResponseFactory converter = new ResteasyRequestResponseFactory(dispatcher);
dispatcher.init(context, bootstrap, converter, converter);
if (filterConfig != null)
dispatcher.getDispatcher().getDefaultContextObjects().put(FilterConfig.class, filterConfig);
if (servletConfig != null)
dispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);
resteasyRegistry = dispatcher.getDispatcher().getRegistry();
providerFactory = dispatcher.getDispatcher().getProviderFactory();
}
// Register the REST provider classes
for (Class<?> providerClass : ResteasyProviderRegistry.getClasses())
{
log.debug("Registering REST providers: " + providerClass.getName());
providerFactory.registerProvider(providerClass);
}
// Register the REST provider singletons
for (Object provider : ResteasyProviderRegistry.getSingletons())
{
log.debug("Registering REST provider singleton: " + provider);
providerFactory.registerProviderInstance(provider);
}
providerFactory.registerProviderInstance(new LogReportMessageBodyReader());
// Register the JAXBContext provider
providerFactory.registerProviderInstance(jaxbContextResolver);
// Register the exception mapper
{
// Register the ExceptionMapper for ApplicationException
providerFactory.register(this.exceptionMapper);
log.trace("ExceptionMapper registered for ApplicationException");
}
// Register the REST resources
for (RestResource resource : RestResourceRegistry.getResources())
{
log.debug("Registering REST resource: " + resource.getResourceClass().getName());
resteasyRegistry.addResourceFactory(new ResteasyGuiceResource(injector, resource.getResourceClass()));
}
} | [
"protected",
"void",
"configure",
"(",
"ServletContainerDispatcher",
"dispatcher",
")",
"throws",
"ServletException",
"{",
"// Make sure we are registered with the Guice registry",
"registry",
".",
"register",
"(",
"this",
",",
"true",
")",
";",
"// Configure the dispatcher",
"final",
"Registry",
"resteasyRegistry",
";",
"final",
"ResteasyProviderFactory",
"providerFactory",
";",
"{",
"final",
"ResteasyRequestResponseFactory",
"converter",
"=",
"new",
"ResteasyRequestResponseFactory",
"(",
"dispatcher",
")",
";",
"dispatcher",
".",
"init",
"(",
"context",
",",
"bootstrap",
",",
"converter",
",",
"converter",
")",
";",
"if",
"(",
"filterConfig",
"!=",
"null",
")",
"dispatcher",
".",
"getDispatcher",
"(",
")",
".",
"getDefaultContextObjects",
"(",
")",
".",
"put",
"(",
"FilterConfig",
".",
"class",
",",
"filterConfig",
")",
";",
"if",
"(",
"servletConfig",
"!=",
"null",
")",
"dispatcher",
".",
"getDispatcher",
"(",
")",
".",
"getDefaultContextObjects",
"(",
")",
".",
"put",
"(",
"ServletConfig",
".",
"class",
",",
"servletConfig",
")",
";",
"resteasyRegistry",
"=",
"dispatcher",
".",
"getDispatcher",
"(",
")",
".",
"getRegistry",
"(",
")",
";",
"providerFactory",
"=",
"dispatcher",
".",
"getDispatcher",
"(",
")",
".",
"getProviderFactory",
"(",
")",
";",
"}",
"// Register the REST provider classes",
"for",
"(",
"Class",
"<",
"?",
">",
"providerClass",
":",
"ResteasyProviderRegistry",
".",
"getClasses",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Registering REST providers: \"",
"+",
"providerClass",
".",
"getName",
"(",
")",
")",
";",
"providerFactory",
".",
"registerProvider",
"(",
"providerClass",
")",
";",
"}",
"// Register the REST provider singletons",
"for",
"(",
"Object",
"provider",
":",
"ResteasyProviderRegistry",
".",
"getSingletons",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Registering REST provider singleton: \"",
"+",
"provider",
")",
";",
"providerFactory",
".",
"registerProviderInstance",
"(",
"provider",
")",
";",
"}",
"providerFactory",
".",
"registerProviderInstance",
"(",
"new",
"LogReportMessageBodyReader",
"(",
")",
")",
";",
"// Register the JAXBContext provider",
"providerFactory",
".",
"registerProviderInstance",
"(",
"jaxbContextResolver",
")",
";",
"// Register the exception mapper",
"{",
"// Register the ExceptionMapper for ApplicationException",
"providerFactory",
".",
"register",
"(",
"this",
".",
"exceptionMapper",
")",
";",
"log",
".",
"trace",
"(",
"\"ExceptionMapper registered for ApplicationException\"",
")",
";",
"}",
"// Register the REST resources",
"for",
"(",
"RestResource",
"resource",
":",
"RestResourceRegistry",
".",
"getResources",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Registering REST resource: \"",
"+",
"resource",
".",
"getResourceClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"resteasyRegistry",
".",
"addResourceFactory",
"(",
"new",
"ResteasyGuiceResource",
"(",
"injector",
",",
"resource",
".",
"getResourceClass",
"(",
")",
")",
")",
";",
"}",
"}"
] | Try to initialise a ServletContainerDispatcher with the connection to the Guice REST services | [
"Try",
"to",
"initialise",
"a",
"ServletContainerDispatcher",
"with",
"the",
"connection",
"to",
"the",
"Guice",
"REST",
"services"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/resteasy/GuicedResteasy.java#L330-L386 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/FaultManager.java | FaultManager.addNode | public void addNode(String name, Set<ResourceType> resourceTypes) {
"""
Notify the fault manager of a new node.
@param name The node name.
@param resourceTypes The types of resource on this node.
"""
List<FaultStatsForType> faultStats = new ArrayList<FaultStatsForType>(
resourceTypes.size());
for (ResourceType type : resourceTypes) {
faultStats.add(new FaultStatsForType(type));
}
nodeToFaultStats.put(name, faultStats);
} | java | public void addNode(String name, Set<ResourceType> resourceTypes) {
List<FaultStatsForType> faultStats = new ArrayList<FaultStatsForType>(
resourceTypes.size());
for (ResourceType type : resourceTypes) {
faultStats.add(new FaultStatsForType(type));
}
nodeToFaultStats.put(name, faultStats);
} | [
"public",
"void",
"addNode",
"(",
"String",
"name",
",",
"Set",
"<",
"ResourceType",
">",
"resourceTypes",
")",
"{",
"List",
"<",
"FaultStatsForType",
">",
"faultStats",
"=",
"new",
"ArrayList",
"<",
"FaultStatsForType",
">",
"(",
"resourceTypes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"ResourceType",
"type",
":",
"resourceTypes",
")",
"{",
"faultStats",
".",
"add",
"(",
"new",
"FaultStatsForType",
"(",
"type",
")",
")",
";",
"}",
"nodeToFaultStats",
".",
"put",
"(",
"name",
",",
"faultStats",
")",
";",
"}"
] | Notify the fault manager of a new node.
@param name The node name.
@param resourceTypes The types of resource on this node. | [
"Notify",
"the",
"fault",
"manager",
"of",
"a",
"new",
"node",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/FaultManager.java#L115-L122 |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.cancelDelegationToken | private void cancelDelegationToken() throws HiveSQLException {
"""
If the session has a delegation token obtained from the metastore, then cancel it
"""
if (delegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
// close the metastore connection created with this delegation token
Hive.closeCurrent();
}
} | java | private void cancelDelegationToken() throws HiveSQLException {
if (delegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
// close the metastore connection created with this delegation token
Hive.closeCurrent();
}
} | [
"private",
"void",
"cancelDelegationToken",
"(",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"delegationTokenStr",
"!=",
"null",
")",
"{",
"try",
"{",
"Hive",
".",
"get",
"(",
"getHiveConf",
"(",
")",
")",
".",
"cancelDelegationToken",
"(",
"delegationTokenStr",
")",
";",
"}",
"catch",
"(",
"HiveException",
"e",
")",
"{",
"throw",
"new",
"HiveSQLException",
"(",
"\"Couldn't cancel delegation token\"",
",",
"e",
")",
";",
"}",
"// close the metastore connection created with this delegation token",
"Hive",
".",
"closeCurrent",
"(",
")",
";",
"}",
"}"
] | If the session has a delegation token obtained from the metastore, then cancel it | [
"If",
"the",
"session",
"has",
"a",
"delegation",
"token",
"obtained",
"from",
"the",
"metastore",
"then",
"cancel",
"it"
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L141-L151 |
ReactiveX/RxJavaFX | src/main/java/io/reactivex/rxjavafx/transformers/FxObservableTransformers.java | FxObservableTransformers.doOnNextCount | public static <T> ObservableTransformer<T,T> doOnNextCount(Consumer<Integer> onNext) {
"""
Performs an action on onNext with the provided emission count
@param onNext
@param <T>
"""
return obs -> obs.lift(new OperatorEmissionCounter<>(new CountObserver(onNext,null,null)));
} | java | public static <T> ObservableTransformer<T,T> doOnNextCount(Consumer<Integer> onNext) {
return obs -> obs.lift(new OperatorEmissionCounter<>(new CountObserver(onNext,null,null)));
} | [
"public",
"static",
"<",
"T",
">",
"ObservableTransformer",
"<",
"T",
",",
"T",
">",
"doOnNextCount",
"(",
"Consumer",
"<",
"Integer",
">",
"onNext",
")",
"{",
"return",
"obs",
"->",
"obs",
".",
"lift",
"(",
"new",
"OperatorEmissionCounter",
"<>",
"(",
"new",
"CountObserver",
"(",
"onNext",
",",
"null",
",",
"null",
")",
")",
")",
";",
"}"
] | Performs an action on onNext with the provided emission count
@param onNext
@param <T> | [
"Performs",
"an",
"action",
"on",
"onNext",
"with",
"the",
"provided",
"emission",
"count"
] | train | https://github.com/ReactiveX/RxJavaFX/blob/8f44d4cc1caba9a8919f01cb1897aaea5514c7e5/src/main/java/io/reactivex/rxjavafx/transformers/FxObservableTransformers.java#L113-L115 |
spotify/styx | styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java | ShardedCounter.updateLimit | public void updateLimit(StorageTransaction tx, String counterId, long limit) throws IOException {
"""
Must be called within a TransactionCallable. (?)
<p>Augments the transaction with operations to persist the given limit in Datastore. So long as
there has been no preceding successful updateLimit operation, no limit is applied in
updateCounter operations on this counter.
"""
tx.updateLimitForCounter(counterId, limit);
} | java | public void updateLimit(StorageTransaction tx, String counterId, long limit) throws IOException {
tx.updateLimitForCounter(counterId, limit);
} | [
"public",
"void",
"updateLimit",
"(",
"StorageTransaction",
"tx",
",",
"String",
"counterId",
",",
"long",
"limit",
")",
"throws",
"IOException",
"{",
"tx",
".",
"updateLimitForCounter",
"(",
"counterId",
",",
"limit",
")",
";",
"}"
] | Must be called within a TransactionCallable. (?)
<p>Augments the transaction with operations to persist the given limit in Datastore. So long as
there has been no preceding successful updateLimit operation, no limit is applied in
updateCounter operations on this counter. | [
"Must",
"be",
"called",
"within",
"a",
"TransactionCallable",
".",
"(",
"?",
")"
] | train | https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-service-common/src/main/java/com/spotify/styx/util/ShardedCounter.java#L229-L231 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForResource | public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId, QueryOptions queryOptions) {
"""
Queries policy events for the resource.
@param resourceId Resource ID.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyEventsQueryResultsInner object if successful.
"""
return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body();
} | java | public PolicyEventsQueryResultsInner listQueryResultsForResource(String resourceId, QueryOptions queryOptions) {
return listQueryResultsForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyEventsQueryResultsInner",
"listQueryResultsForResource",
"(",
"String",
"resourceId",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForResourceWithServiceResponseAsync",
"(",
"resourceId",
",",
"queryOptions",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Queries policy events for the resource.
@param resourceId Resource ID.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyEventsQueryResultsInner object if successful. | [
"Queries",
"policy",
"events",
"for",
"the",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L764-L766 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/CommandExecutor.java | CommandExecutor.doCommand | public synchronized ModelNode doCommand(String command) throws CommandFormatException, IOException {
"""
Submit a command to the server.
@param command The CLI command
@return The DMR response as a ModelNode
@throws CommandFormatException
@throws IOException
"""
ModelNode request = cmdCtx.buildRequest(command);
return execute(request, isSlowCommand(command)).getResponseNode();
} | java | public synchronized ModelNode doCommand(String command) throws CommandFormatException, IOException {
ModelNode request = cmdCtx.buildRequest(command);
return execute(request, isSlowCommand(command)).getResponseNode();
} | [
"public",
"synchronized",
"ModelNode",
"doCommand",
"(",
"String",
"command",
")",
"throws",
"CommandFormatException",
",",
"IOException",
"{",
"ModelNode",
"request",
"=",
"cmdCtx",
".",
"buildRequest",
"(",
"command",
")",
";",
"return",
"execute",
"(",
"request",
",",
"isSlowCommand",
"(",
"command",
")",
")",
".",
"getResponseNode",
"(",
")",
";",
"}"
] | Submit a command to the server.
@param command The CLI command
@return The DMR response as a ModelNode
@throws CommandFormatException
@throws IOException | [
"Submit",
"a",
"command",
"to",
"the",
"server",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/CommandExecutor.java#L75-L78 |
kirgor/enklib | ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java | Bean.afterInvoke | protected void afterInvoke(Method method, Object[] params) throws Exception {
"""
Called by interceptor after bean method has been invoked.
<p/>
It's important to call base method in override-method, since it closes SQL session.
@param method Method, which has just been invoked.
@param params Method params.
@throws Exception
"""
// Close the session
if (session != null) {
session.close();
}
} | java | protected void afterInvoke(Method method, Object[] params) throws Exception {
// Close the session
if (session != null) {
session.close();
}
} | [
"protected",
"void",
"afterInvoke",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"Exception",
"{",
"// Close the session",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"session",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Called by interceptor after bean method has been invoked.
<p/>
It's important to call base method in override-method, since it closes SQL session.
@param method Method, which has just been invoked.
@param params Method params.
@throws Exception | [
"Called",
"by",
"interceptor",
"after",
"bean",
"method",
"has",
"been",
"invoked",
".",
"<p",
"/",
">",
"It",
"s",
"important",
"to",
"call",
"base",
"method",
"in",
"override",
"-",
"method",
"since",
"it",
"closes",
"SQL",
"session",
"."
] | train | https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L143-L148 |
Netflix/netflix-graph | src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java | NFBuildGraph.addConnection | public void addConnection(String nodeType, int fromOrdinal, String viaProperty, int toOrdinal) {
"""
Add a connection to this graph. The connection will be from the node identified by the given <code>nodeType</code> and <code>fromOrdinal</code>.
The connection will be via the specified <code>viaProperty</code> in the {@link NFNodeSpec} for the given <code>nodeType</code>.
The connection will be to the node identified by the given <code>toOrdinal</code>. The type of the to node is implied by the <code>viaProperty</code>.
"""
addConnection(CONNECTION_MODEL_GLOBAL, nodeType, fromOrdinal, viaProperty, toOrdinal);
} | java | public void addConnection(String nodeType, int fromOrdinal, String viaProperty, int toOrdinal) {
addConnection(CONNECTION_MODEL_GLOBAL, nodeType, fromOrdinal, viaProperty, toOrdinal);
} | [
"public",
"void",
"addConnection",
"(",
"String",
"nodeType",
",",
"int",
"fromOrdinal",
",",
"String",
"viaProperty",
",",
"int",
"toOrdinal",
")",
"{",
"addConnection",
"(",
"CONNECTION_MODEL_GLOBAL",
",",
"nodeType",
",",
"fromOrdinal",
",",
"viaProperty",
",",
"toOrdinal",
")",
";",
"}"
] | Add a connection to this graph. The connection will be from the node identified by the given <code>nodeType</code> and <code>fromOrdinal</code>.
The connection will be via the specified <code>viaProperty</code> in the {@link NFNodeSpec} for the given <code>nodeType</code>.
The connection will be to the node identified by the given <code>toOrdinal</code>. The type of the to node is implied by the <code>viaProperty</code>. | [
"Add",
"a",
"connection",
"to",
"this",
"graph",
".",
"The",
"connection",
"will",
"be",
"from",
"the",
"node",
"identified",
"by",
"the",
"given",
"<code",
">",
"nodeType<",
"/",
"code",
">",
"and",
"<code",
">",
"fromOrdinal<",
"/",
"code",
">",
".",
"The",
"connection",
"will",
"be",
"via",
"the",
"specified",
"<code",
">",
"viaProperty<",
"/",
"code",
">",
"in",
"the",
"{"
] | train | https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java#L78-L80 |
upwork/java-upwork | src/com/Upwork/api/Routers/Activities/Engagement.java | Engagement.assignToEngagement | public JSONObject assignToEngagement(String engagement_ref, HashMap<String, String> params) throws JSONException {
"""
Assign engagements to the list of activities
@param engagement_ref Engagement reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
"""
return oClient.put("/tasks/v2/tasks/contracts/" + engagement_ref, params);
} | java | public JSONObject assignToEngagement(String engagement_ref, HashMap<String, String> params) throws JSONException {
return oClient.put("/tasks/v2/tasks/contracts/" + engagement_ref, params);
} | [
"public",
"JSONObject",
"assignToEngagement",
"(",
"String",
"engagement_ref",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
"\"/tasks/v2/tasks/contracts/\"",
"+",
"engagement_ref",
",",
"params",
")",
";",
"}"
] | Assign engagements to the list of activities
@param engagement_ref Engagement reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Assign",
"engagements",
"to",
"the",
"list",
"of",
"activities"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Activities/Engagement.java#L79-L81 |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKDefaultTableModel.java | JKDefaultTableModel.addColumn | public void addColumn(final Object columnName, final Vector columnData) {
"""
Adds a column to the model. The new column will have the identifier
<code>columnName</code>, which may be null. <code>columnData</code> is the
optional vector of data for the column. If it is <code>null</code> the column
is filled with <code>null</code> values. Otherwise, the new data will be
added to model starting with the first element going to row 0, etc. This
method will send a <code>tableChanged</code> notification message to all the
listeners.
@param columnName the identifier of the column being added
@param columnData optional data of the column being added
"""
this.columnIdentifiers.addElement(columnName);
if (columnData != null) {
final int columnSize = columnData.size();
if (columnSize > getRowCount()) {
this.dataVector.setSize(columnSize);
}
justifyRows(0, getRowCount());
final int newColumn = getColumnCount() - 1;
for (int i = 0; i < columnSize; i++) {
final Vector row = (Vector) this.dataVector.elementAt(i);
row.setElementAt(columnData.elementAt(i), newColumn);
}
} else {
justifyRows(0, getRowCount());
}
fireTableStructureChanged();
} | java | public void addColumn(final Object columnName, final Vector columnData) {
this.columnIdentifiers.addElement(columnName);
if (columnData != null) {
final int columnSize = columnData.size();
if (columnSize > getRowCount()) {
this.dataVector.setSize(columnSize);
}
justifyRows(0, getRowCount());
final int newColumn = getColumnCount() - 1;
for (int i = 0; i < columnSize; i++) {
final Vector row = (Vector) this.dataVector.elementAt(i);
row.setElementAt(columnData.elementAt(i), newColumn);
}
} else {
justifyRows(0, getRowCount());
}
fireTableStructureChanged();
} | [
"public",
"void",
"addColumn",
"(",
"final",
"Object",
"columnName",
",",
"final",
"Vector",
"columnData",
")",
"{",
"this",
".",
"columnIdentifiers",
".",
"addElement",
"(",
"columnName",
")",
";",
"if",
"(",
"columnData",
"!=",
"null",
")",
"{",
"final",
"int",
"columnSize",
"=",
"columnData",
".",
"size",
"(",
")",
";",
"if",
"(",
"columnSize",
">",
"getRowCount",
"(",
")",
")",
"{",
"this",
".",
"dataVector",
".",
"setSize",
"(",
"columnSize",
")",
";",
"}",
"justifyRows",
"(",
"0",
",",
"getRowCount",
"(",
")",
")",
";",
"final",
"int",
"newColumn",
"=",
"getColumnCount",
"(",
")",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columnSize",
";",
"i",
"++",
")",
"{",
"final",
"Vector",
"row",
"=",
"(",
"Vector",
")",
"this",
".",
"dataVector",
".",
"elementAt",
"(",
"i",
")",
";",
"row",
".",
"setElementAt",
"(",
"columnData",
".",
"elementAt",
"(",
"i",
")",
",",
"newColumn",
")",
";",
"}",
"}",
"else",
"{",
"justifyRows",
"(",
"0",
",",
"getRowCount",
"(",
")",
")",
";",
"}",
"fireTableStructureChanged",
"(",
")",
";",
"}"
] | Adds a column to the model. The new column will have the identifier
<code>columnName</code>, which may be null. <code>columnData</code> is the
optional vector of data for the column. If it is <code>null</code> the column
is filled with <code>null</code> values. Otherwise, the new data will be
added to model starting with the first element going to row 0, etc. This
method will send a <code>tableChanged</code> notification message to all the
listeners.
@param columnName the identifier of the column being added
@param columnData optional data of the column being added | [
"Adds",
"a",
"column",
"to",
"the",
"model",
".",
"The",
"new",
"column",
"will",
"have",
"the",
"identifier",
"<code",
">",
"columnName<",
"/",
"code",
">",
"which",
"may",
"be",
"null",
".",
"<code",
">",
"columnData<",
"/",
"code",
">",
"is",
"the",
"optional",
"vector",
"of",
"data",
"for",
"the",
"column",
".",
"If",
"it",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"the",
"column",
"is",
"filled",
"with",
"<code",
">",
"null<",
"/",
"code",
">",
"values",
".",
"Otherwise",
"the",
"new",
"data",
"will",
"be",
"added",
"to",
"model",
"starting",
"with",
"the",
"first",
"element",
"going",
"to",
"row",
"0",
"etc",
".",
"This",
"method",
"will",
"send",
"a",
"<code",
">",
"tableChanged<",
"/",
"code",
">",
"notification",
"message",
"to",
"all",
"the",
"listeners",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L298-L316 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/eip/EipClient.java | EipClient.purchaseReservedEipInMonth | public void purchaseReservedEipInMonth(String eip, int reservationLength) {
"""
PurchaseReserved eip with specified duration in month
@param eip
@param reservationLength
"""
Billing billing = new Billing();
billing.setReservation(new Billing.Reservation().withReservationLength(reservationLength));
this.purchaseReservedEip(new PurchaseReservedEipRequest().withEip(eip).withBilling(billing));
} | java | public void purchaseReservedEipInMonth(String eip, int reservationLength) {
Billing billing = new Billing();
billing.setReservation(new Billing.Reservation().withReservationLength(reservationLength));
this.purchaseReservedEip(new PurchaseReservedEipRequest().withEip(eip).withBilling(billing));
} | [
"public",
"void",
"purchaseReservedEipInMonth",
"(",
"String",
"eip",
",",
"int",
"reservationLength",
")",
"{",
"Billing",
"billing",
"=",
"new",
"Billing",
"(",
")",
";",
"billing",
".",
"setReservation",
"(",
"new",
"Billing",
".",
"Reservation",
"(",
")",
".",
"withReservationLength",
"(",
"reservationLength",
")",
")",
";",
"this",
".",
"purchaseReservedEip",
"(",
"new",
"PurchaseReservedEipRequest",
"(",
")",
".",
"withEip",
"(",
"eip",
")",
".",
"withBilling",
"(",
"billing",
")",
")",
";",
"}"
] | PurchaseReserved eip with specified duration in month
@param eip
@param reservationLength | [
"PurchaseReserved",
"eip",
"with",
"specified",
"duration",
"in",
"month"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/eip/EipClient.java#L153-L157 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/raw/TypedQuery.java | TypedQuery.withResultSetAsyncListeners | public TypedQuery<ENTITY> withResultSetAsyncListeners(List<Function<ResultSet, ResultSet>> resultSetAsyncListeners) {
"""
Add the given list of async listeners on the {@link com.datastax.driver.core.ResultSet} object.
Example of usage:
<pre class="code"><code class="java">
.withResultSetAsyncListeners(Arrays.asList(resultSet -> {
//Do something with the resultSet object here
}))
</code></pre>
Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong>
"""
this.options.setResultSetAsyncListeners(Optional.of(resultSetAsyncListeners));
return this;
} | java | public TypedQuery<ENTITY> withResultSetAsyncListeners(List<Function<ResultSet, ResultSet>> resultSetAsyncListeners) {
this.options.setResultSetAsyncListeners(Optional.of(resultSetAsyncListeners));
return this;
} | [
"public",
"TypedQuery",
"<",
"ENTITY",
">",
"withResultSetAsyncListeners",
"(",
"List",
"<",
"Function",
"<",
"ResultSet",
",",
"ResultSet",
">",
">",
"resultSetAsyncListeners",
")",
"{",
"this",
".",
"options",
".",
"setResultSetAsyncListeners",
"(",
"Optional",
".",
"of",
"(",
"resultSetAsyncListeners",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add the given list of async listeners on the {@link com.datastax.driver.core.ResultSet} object.
Example of usage:
<pre class="code"><code class="java">
.withResultSetAsyncListeners(Arrays.asList(resultSet -> {
//Do something with the resultSet object here
}))
</code></pre>
Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong> | [
"Add",
"the",
"given",
"list",
"of",
"async",
"listeners",
"on",
"the",
"{",
"@link",
"com",
".",
"datastax",
".",
"driver",
".",
"core",
".",
"ResultSet",
"}",
"object",
".",
"Example",
"of",
"usage",
":",
"<pre",
"class",
"=",
"code",
">",
"<code",
"class",
"=",
"java",
">"
] | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/raw/TypedQuery.java#L83-L86 |
j256/ormlite-core | src/main/java/com/j256/ormlite/table/TableUtils.java | TableUtils.dropTable | public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors)
throws SQLException {
"""
Issue the database statements to drop the table associated with a class.
<p>
<b>WARNING:</b> This is [obviously] very destructive and is unrecoverable.
</p>
@param connectionSource
Associated connection source.
@param dataClass
The class for which a table will be dropped.
@param ignoreErrors
If set to true then try each statement regardless of {@link SQLException} thrown previously.
@return The number of statements executed to do so.
"""
Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass);
return dropTable(dao, ignoreErrors);
} | java | public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors)
throws SQLException {
Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass);
return dropTable(dao, ignoreErrors);
} | [
"public",
"static",
"<",
"T",
",",
"ID",
">",
"int",
"dropTable",
"(",
"ConnectionSource",
"connectionSource",
",",
"Class",
"<",
"T",
">",
"dataClass",
",",
"boolean",
"ignoreErrors",
")",
"throws",
"SQLException",
"{",
"Dao",
"<",
"T",
",",
"ID",
">",
"dao",
"=",
"DaoManager",
".",
"createDao",
"(",
"connectionSource",
",",
"dataClass",
")",
";",
"return",
"dropTable",
"(",
"dao",
",",
"ignoreErrors",
")",
";",
"}"
] | Issue the database statements to drop the table associated with a class.
<p>
<b>WARNING:</b> This is [obviously] very destructive and is unrecoverable.
</p>
@param connectionSource
Associated connection source.
@param dataClass
The class for which a table will be dropped.
@param ignoreErrors
If set to true then try each statement regardless of {@link SQLException} thrown previously.
@return The number of statements executed to do so. | [
"Issue",
"the",
"database",
"statements",
"to",
"drop",
"the",
"table",
"associated",
"with",
"a",
"class",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/TableUtils.java#L170-L174 |
alkacon/opencms-core | src/org/opencms/importexport/CmsExport.java | CmsExport.exportUsers | protected void exportUsers(Element parent, CmsOrganizationalUnit orgunit)
throws CmsImportExportException, SAXException {
"""
Exports all users of the given organizational unit.<p>
@param parent the parent node to add the users to
@param orgunit the organizational unit to write the groups for
@throws CmsImportExportException if something goes wrong
@throws SAXException if something goes wrong processing the manifest.xml
"""
try {
I_CmsReport report = getReport();
List<CmsUser> allUsers = OpenCms.getOrgUnitManager().getUsers(getCms(), orgunit.getName(), false);
for (int i = 0, l = allUsers.size(); i < l; i++) {
CmsUser user = allUsers.get(i);
report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(i + 1),
String.valueOf(l)),
I_CmsReport.FORMAT_NOTE);
report.print(Messages.get().container(Messages.RPT_EXPORT_USER_0), I_CmsReport.FORMAT_NOTE);
report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
user.getName()));
report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
exportUser(parent, user);
report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
} catch (CmsImportExportException e) {
throw e;
} catch (CmsException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e);
}
throw new CmsImportExportException(e.getMessageContainer(), e);
}
} | java | protected void exportUsers(Element parent, CmsOrganizationalUnit orgunit)
throws CmsImportExportException, SAXException {
try {
I_CmsReport report = getReport();
List<CmsUser> allUsers = OpenCms.getOrgUnitManager().getUsers(getCms(), orgunit.getName(), false);
for (int i = 0, l = allUsers.size(); i < l; i++) {
CmsUser user = allUsers.get(i);
report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(i + 1),
String.valueOf(l)),
I_CmsReport.FORMAT_NOTE);
report.print(Messages.get().container(Messages.RPT_EXPORT_USER_0), I_CmsReport.FORMAT_NOTE);
report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
user.getName()));
report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
exportUser(parent, user);
report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
} catch (CmsImportExportException e) {
throw e;
} catch (CmsException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e);
}
throw new CmsImportExportException(e.getMessageContainer(), e);
}
} | [
"protected",
"void",
"exportUsers",
"(",
"Element",
"parent",
",",
"CmsOrganizationalUnit",
"orgunit",
")",
"throws",
"CmsImportExportException",
",",
"SAXException",
"{",
"try",
"{",
"I_CmsReport",
"report",
"=",
"getReport",
"(",
")",
";",
"List",
"<",
"CmsUser",
">",
"allUsers",
"=",
"OpenCms",
".",
"getOrgUnitManager",
"(",
")",
".",
"getUsers",
"(",
"getCms",
"(",
")",
",",
"orgunit",
".",
"getName",
"(",
")",
",",
"false",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"allUsers",
".",
"size",
"(",
")",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"CmsUser",
"user",
"=",
"allUsers",
".",
"get",
"(",
"i",
")",
";",
"report",
".",
"print",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"RPT_SUCCESSION_2",
",",
"String",
".",
"valueOf",
"(",
"i",
"+",
"1",
")",
",",
"String",
".",
"valueOf",
"(",
"l",
")",
")",
",",
"I_CmsReport",
".",
"FORMAT_NOTE",
")",
";",
"report",
".",
"print",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"RPT_EXPORT_USER_0",
")",
",",
"I_CmsReport",
".",
"FORMAT_NOTE",
")",
";",
"report",
".",
"print",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"RPT_ARGUMENT_1",
",",
"user",
".",
"getName",
"(",
")",
")",
")",
";",
"report",
".",
"print",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"RPT_DOTS_0",
")",
")",
";",
"exportUser",
"(",
"parent",
",",
"user",
")",
";",
"report",
".",
"println",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"org",
".",
"opencms",
".",
"report",
".",
"Messages",
".",
"RPT_OK_0",
")",
",",
"I_CmsReport",
".",
"FORMAT_OK",
")",
";",
"}",
"}",
"catch",
"(",
"CmsImportExportException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"throw",
"new",
"CmsImportExportException",
"(",
"e",
".",
"getMessageContainer",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Exports all users of the given organizational unit.<p>
@param parent the parent node to add the users to
@param orgunit the organizational unit to write the groups for
@throws CmsImportExportException if something goes wrong
@throws SAXException if something goes wrong processing the manifest.xml | [
"Exports",
"all",
"users",
"of",
"the",
"given",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L1321-L1354 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java | UserSearchManager.getSearchResults | public ReportedData getSearchResults(Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Submits a search form to the server and returns the resulting information
in the form of <code>ReportedData</code>.
@param searchForm the <code>Form</code> to submit for searching.
@param searchService the name of the search service to use.
@return the ReportedData returned by the server.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
return userSearch.sendSearchForm(con, searchForm, searchService);
} | java | public ReportedData getSearchResults(Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return userSearch.sendSearchForm(con, searchForm, searchService);
} | [
"public",
"ReportedData",
"getSearchResults",
"(",
"Form",
"searchForm",
",",
"DomainBareJid",
"searchService",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"userSearch",
".",
"sendSearchForm",
"(",
"con",
",",
"searchForm",
",",
"searchService",
")",
";",
"}"
] | Submits a search form to the server and returns the resulting information
in the form of <code>ReportedData</code>.
@param searchForm the <code>Form</code> to submit for searching.
@param searchService the name of the search service to use.
@return the ReportedData returned by the server.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Submits",
"a",
"search",
"form",
"to",
"the",
"server",
"and",
"returns",
"the",
"resulting",
"information",
"in",
"the",
"form",
"of",
"<code",
">",
"ReportedData<",
"/",
"code",
">",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearchManager.java#L90-L92 |
kaazing/gateway | security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java | DefaultLoginContextFactory.createLoginContext | protected LoginContext createLoginContext(CallbackHandler handler, final DefaultLoginResult loginResult)
throws LoginException {
"""
For login context providers that can abstract their tokens into a CallbackHandler
that understands their token, this is a utility method that can be called to construct a create login.
@param handler the callback handler that can understand
@return a login context
@throws LoginException when a login context cannot be created
"""
return createLoginContext(null, handler, loginResult);
} | java | protected LoginContext createLoginContext(CallbackHandler handler, final DefaultLoginResult loginResult)
throws LoginException {
return createLoginContext(null, handler, loginResult);
} | [
"protected",
"LoginContext",
"createLoginContext",
"(",
"CallbackHandler",
"handler",
",",
"final",
"DefaultLoginResult",
"loginResult",
")",
"throws",
"LoginException",
"{",
"return",
"createLoginContext",
"(",
"null",
",",
"handler",
",",
"loginResult",
")",
";",
"}"
] | For login context providers that can abstract their tokens into a CallbackHandler
that understands their token, this is a utility method that can be called to construct a create login.
@param handler the callback handler that can understand
@return a login context
@throws LoginException when a login context cannot be created | [
"For",
"login",
"context",
"providers",
"that",
"can",
"abstract",
"their",
"tokens",
"into",
"a",
"CallbackHandler",
"that",
"understands",
"their",
"token",
"this",
"is",
"a",
"utility",
"method",
"that",
"can",
"be",
"called",
"to",
"construct",
"a",
"create",
"login",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/security/src/main/java/org/kaazing/gateway/security/auth/context/DefaultLoginContextFactory.java#L205-L208 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleSubdocumentResponseMessages | private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) {
"""
Helper method to decode all simple subdocument response messages.
@param request the current request.
@param msg the current response message.
@param ctx the handler context.
@param status the response status code.
@return the decoded response or null if none did match.
"""
if (!(request instanceof BinarySubdocRequest))
return null;
BinarySubdocRequest subdocRequest = (BinarySubdocRequest) request;
long cas = msg.getCAS();
short statusCode = msg.getStatus();
String bucket = request.bucket();
MutationToken mutationToken = null;
if (msg.getExtrasLength() > 0) {
mutationToken = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition());
}
ByteBuf fragment;
if (msg.content() != null && msg.content().readableBytes() > 0) {
fragment = msg.content();
} else if (msg.content() != null) {
msg.content().release();
fragment = Unpooled.EMPTY_BUFFER;
} else {
fragment = Unpooled.EMPTY_BUFFER;
}
return new SimpleSubdocResponse(status, statusCode, bucket, fragment, subdocRequest, cas, mutationToken);
} | java | private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) {
if (!(request instanceof BinarySubdocRequest))
return null;
BinarySubdocRequest subdocRequest = (BinarySubdocRequest) request;
long cas = msg.getCAS();
short statusCode = msg.getStatus();
String bucket = request.bucket();
MutationToken mutationToken = null;
if (msg.getExtrasLength() > 0) {
mutationToken = extractToken(bucket, seqOnMutation, status.isSuccess(), msg.getExtras(), request.partition());
}
ByteBuf fragment;
if (msg.content() != null && msg.content().readableBytes() > 0) {
fragment = msg.content();
} else if (msg.content() != null) {
msg.content().release();
fragment = Unpooled.EMPTY_BUFFER;
} else {
fragment = Unpooled.EMPTY_BUFFER;
}
return new SimpleSubdocResponse(status, statusCode, bucket, fragment, subdocRequest, cas, mutationToken);
} | [
"private",
"static",
"CouchbaseResponse",
"handleSubdocumentResponseMessages",
"(",
"BinaryRequest",
"request",
",",
"FullBinaryMemcacheResponse",
"msg",
",",
"ChannelHandlerContext",
"ctx",
",",
"ResponseStatus",
"status",
",",
"boolean",
"seqOnMutation",
")",
"{",
"if",
"(",
"!",
"(",
"request",
"instanceof",
"BinarySubdocRequest",
")",
")",
"return",
"null",
";",
"BinarySubdocRequest",
"subdocRequest",
"=",
"(",
"BinarySubdocRequest",
")",
"request",
";",
"long",
"cas",
"=",
"msg",
".",
"getCAS",
"(",
")",
";",
"short",
"statusCode",
"=",
"msg",
".",
"getStatus",
"(",
")",
";",
"String",
"bucket",
"=",
"request",
".",
"bucket",
"(",
")",
";",
"MutationToken",
"mutationToken",
"=",
"null",
";",
"if",
"(",
"msg",
".",
"getExtrasLength",
"(",
")",
">",
"0",
")",
"{",
"mutationToken",
"=",
"extractToken",
"(",
"bucket",
",",
"seqOnMutation",
",",
"status",
".",
"isSuccess",
"(",
")",
",",
"msg",
".",
"getExtras",
"(",
")",
",",
"request",
".",
"partition",
"(",
")",
")",
";",
"}",
"ByteBuf",
"fragment",
";",
"if",
"(",
"msg",
".",
"content",
"(",
")",
"!=",
"null",
"&&",
"msg",
".",
"content",
"(",
")",
".",
"readableBytes",
"(",
")",
">",
"0",
")",
"{",
"fragment",
"=",
"msg",
".",
"content",
"(",
")",
";",
"}",
"else",
"if",
"(",
"msg",
".",
"content",
"(",
")",
"!=",
"null",
")",
"{",
"msg",
".",
"content",
"(",
")",
".",
"release",
"(",
")",
";",
"fragment",
"=",
"Unpooled",
".",
"EMPTY_BUFFER",
";",
"}",
"else",
"{",
"fragment",
"=",
"Unpooled",
".",
"EMPTY_BUFFER",
";",
"}",
"return",
"new",
"SimpleSubdocResponse",
"(",
"status",
",",
"statusCode",
",",
"bucket",
",",
"fragment",
",",
"subdocRequest",
",",
"cas",
",",
"mutationToken",
")",
";",
"}"
] | Helper method to decode all simple subdocument response messages.
@param request the current request.
@param msg the current response message.
@param ctx the handler context.
@param status the response status code.
@return the decoded response or null if none did match. | [
"Helper",
"method",
"to",
"decode",
"all",
"simple",
"subdocument",
"response",
"messages",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1154-L1179 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java | KickflipApiClient.getStreamsByKeyword | public void getStreamsByKeyword(String keyword, int pageNumber, int itemsPerPage, final KickflipCallback cb) {
"""
Get a List of {@link io.kickflip.sdk.api.json.Stream}s containing a keyword.
<p/>
This method searches all public recordings made by Users of your Kickflip app.
@param keyword The String keyword to query
@param cb A callback to receive the resulting List of Streams
"""
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
addPaginationData(pageNumber, itemsPerPage, data);
data.put("uuid", getActiveUser().getUUID());
if (keyword != null) {
data.put("keyword", keyword);
}
post(SEARCH_KEYWORD, new UrlEncodedContent(data), StreamList.class, cb);
} | java | public void getStreamsByKeyword(String keyword, int pageNumber, int itemsPerPage, final KickflipCallback cb) {
if (!assertActiveUserAvailable(cb)) return;
GenericData data = new GenericData();
addPaginationData(pageNumber, itemsPerPage, data);
data.put("uuid", getActiveUser().getUUID());
if (keyword != null) {
data.put("keyword", keyword);
}
post(SEARCH_KEYWORD, new UrlEncodedContent(data), StreamList.class, cb);
} | [
"public",
"void",
"getStreamsByKeyword",
"(",
"String",
"keyword",
",",
"int",
"pageNumber",
",",
"int",
"itemsPerPage",
",",
"final",
"KickflipCallback",
"cb",
")",
"{",
"if",
"(",
"!",
"assertActiveUserAvailable",
"(",
"cb",
")",
")",
"return",
";",
"GenericData",
"data",
"=",
"new",
"GenericData",
"(",
")",
";",
"addPaginationData",
"(",
"pageNumber",
",",
"itemsPerPage",
",",
"data",
")",
";",
"data",
".",
"put",
"(",
"\"uuid\"",
",",
"getActiveUser",
"(",
")",
".",
"getUUID",
"(",
")",
")",
";",
"if",
"(",
"keyword",
"!=",
"null",
")",
"{",
"data",
".",
"put",
"(",
"\"keyword\"",
",",
"keyword",
")",
";",
"}",
"post",
"(",
"SEARCH_KEYWORD",
",",
"new",
"UrlEncodedContent",
"(",
"data",
")",
",",
"StreamList",
".",
"class",
",",
"cb",
")",
";",
"}"
] | Get a List of {@link io.kickflip.sdk.api.json.Stream}s containing a keyword.
<p/>
This method searches all public recordings made by Users of your Kickflip app.
@param keyword The String keyword to query
@param cb A callback to receive the resulting List of Streams | [
"Get",
"a",
"List",
"of",
"{",
"@link",
"io",
".",
"kickflip",
".",
"sdk",
".",
"api",
".",
"json",
".",
"Stream",
"}",
"s",
"containing",
"a",
"keyword",
".",
"<p",
"/",
">",
"This",
"method",
"searches",
"all",
"public",
"recordings",
"made",
"by",
"Users",
"of",
"your",
"Kickflip",
"app",
"."
] | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L506-L515 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphAddMemcpyNode | public static int cuGraphAddMemcpyNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies, CUDA_MEMCPY3D copyParams, CUcontext ctx) {
"""
Creates a memcpy node and adds it to a graph.<br>
<br>
Creates a new memcpy node and adds it to \p hGraph with \p numDependencies
dependencies specified via \p dependencies.
It is possible for \p numDependencies to be 0, in which case the node will be placed
at the root of the graph. \p dependencies may not have any duplicate entries.
A handle to the new node will be returned in \p phGraphNode.<br>
<br>
When the graph is launched, the node will perform the memcpy described by \p copyParams.
See ::cuMemcpy3D() for a description of the structure and its restrictions.<br>
<br>
Memcpy nodes have some additional restrictions with regards to managed memory, if the
system contains at least one device which has a zero value for the device attribute
::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. If one or more of the operands refer
to managed memory, then using the memory type ::CU_MEMORYTYPE_UNIFIED is disallowed
for those operand(s). The managed memory will be treated as residing on either the
host or the device, depending on which memory type is specified.
@param phGraphNode - Returns newly created node
@param hGraph - Graph to which to add the node
@param dependencies - Dependencies of the node
@param numDependencies - Number of dependencies
@param copyParams - Parameters for the memory copy
@param ctx - Context on which to run the node
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuMemcpy3D
JCudaDriver#cuGraphMemcpyNodeGetParams
JCudaDriver#cuGraphMemcpyNodeSetParams
JCudaDriver#cuGraphCreate
JCudaDriver#cuGraphDestroyNode
JCudaDriver#cuGraphAddChildGraphNode
JCudaDriver#cuGraphAddEmptyNode
JCudaDriver#cuGraphAddKernelNode
JCudaDriver#cuGraphAddHostNode
JCudaDriver#cuGraphAddMemsetNode
"""
return checkResult(cuGraphAddMemcpyNodeNative(phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx));
} | java | public static int cuGraphAddMemcpyNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies, CUDA_MEMCPY3D copyParams, CUcontext ctx)
{
return checkResult(cuGraphAddMemcpyNodeNative(phGraphNode, hGraph, dependencies, numDependencies, copyParams, ctx));
} | [
"public",
"static",
"int",
"cuGraphAddMemcpyNode",
"(",
"CUgraphNode",
"phGraphNode",
",",
"CUgraph",
"hGraph",
",",
"CUgraphNode",
"dependencies",
"[",
"]",
",",
"long",
"numDependencies",
",",
"CUDA_MEMCPY3D",
"copyParams",
",",
"CUcontext",
"ctx",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphAddMemcpyNodeNative",
"(",
"phGraphNode",
",",
"hGraph",
",",
"dependencies",
",",
"numDependencies",
",",
"copyParams",
",",
"ctx",
")",
")",
";",
"}"
] | Creates a memcpy node and adds it to a graph.<br>
<br>
Creates a new memcpy node and adds it to \p hGraph with \p numDependencies
dependencies specified via \p dependencies.
It is possible for \p numDependencies to be 0, in which case the node will be placed
at the root of the graph. \p dependencies may not have any duplicate entries.
A handle to the new node will be returned in \p phGraphNode.<br>
<br>
When the graph is launched, the node will perform the memcpy described by \p copyParams.
See ::cuMemcpy3D() for a description of the structure and its restrictions.<br>
<br>
Memcpy nodes have some additional restrictions with regards to managed memory, if the
system contains at least one device which has a zero value for the device attribute
::CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS. If one or more of the operands refer
to managed memory, then using the memory type ::CU_MEMORYTYPE_UNIFIED is disallowed
for those operand(s). The managed memory will be treated as residing on either the
host or the device, depending on which memory type is specified.
@param phGraphNode - Returns newly created node
@param hGraph - Graph to which to add the node
@param dependencies - Dependencies of the node
@param numDependencies - Number of dependencies
@param copyParams - Parameters for the memory copy
@param ctx - Context on which to run the node
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuMemcpy3D
JCudaDriver#cuGraphMemcpyNodeGetParams
JCudaDriver#cuGraphMemcpyNodeSetParams
JCudaDriver#cuGraphCreate
JCudaDriver#cuGraphDestroyNode
JCudaDriver#cuGraphAddChildGraphNode
JCudaDriver#cuGraphAddEmptyNode
JCudaDriver#cuGraphAddKernelNode
JCudaDriver#cuGraphAddHostNode
JCudaDriver#cuGraphAddMemsetNode | [
"Creates",
"a",
"memcpy",
"node",
"and",
"adds",
"it",
"to",
"a",
"graph",
".",
"<br",
">",
"<br",
">",
"Creates",
"a",
"new",
"memcpy",
"node",
"and",
"adds",
"it",
"to",
"\\",
"p",
"hGraph",
"with",
"\\",
"p",
"numDependencies",
"dependencies",
"specified",
"via",
"\\",
"p",
"dependencies",
".",
"It",
"is",
"possible",
"for",
"\\",
"p",
"numDependencies",
"to",
"be",
"0",
"in",
"which",
"case",
"the",
"node",
"will",
"be",
"placed",
"at",
"the",
"root",
"of",
"the",
"graph",
".",
"\\",
"p",
"dependencies",
"may",
"not",
"have",
"any",
"duplicate",
"entries",
".",
"A",
"handle",
"to",
"the",
"new",
"node",
"will",
"be",
"returned",
"in",
"\\",
"p",
"phGraphNode",
".",
"<br",
">",
"<br",
">",
"When",
"the",
"graph",
"is",
"launched",
"the",
"node",
"will",
"perform",
"the",
"memcpy",
"described",
"by",
"\\",
"p",
"copyParams",
".",
"See",
"::",
"cuMemcpy3D",
"()",
"for",
"a",
"description",
"of",
"the",
"structure",
"and",
"its",
"restrictions",
".",
"<br",
">",
"<br",
">",
"Memcpy",
"nodes",
"have",
"some",
"additional",
"restrictions",
"with",
"regards",
"to",
"managed",
"memory",
"if",
"the",
"system",
"contains",
"at",
"least",
"one",
"device",
"which",
"has",
"a",
"zero",
"value",
"for",
"the",
"device",
"attribute",
"::",
"CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS",
".",
"If",
"one",
"or",
"more",
"of",
"the",
"operands",
"refer",
"to",
"managed",
"memory",
"then",
"using",
"the",
"memory",
"type",
"::",
"CU_MEMORYTYPE_UNIFIED",
"is",
"disallowed",
"for",
"those",
"operand",
"(",
"s",
")",
".",
"The",
"managed",
"memory",
"will",
"be",
"treated",
"as",
"residing",
"on",
"either",
"the",
"host",
"or",
"the",
"device",
"depending",
"on",
"which",
"memory",
"type",
"is",
"specified",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12199-L12202 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.if_tcmplt | public void if_tcmplt(TypeMirror type, String target) throws IOException {
"""
lt succeeds if and only if value1 < value2
<p>Stack: ..., value1, value2 => ...
@param type
@param target
@throws IOException
"""
pushType(type);
if_tcmplt(target);
popType();
} | java | public void if_tcmplt(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmplt(target);
popType();
} | [
"public",
"void",
"if_tcmplt",
"(",
"TypeMirror",
"type",
",",
"String",
"target",
")",
"throws",
"IOException",
"{",
"pushType",
"(",
"type",
")",
";",
"if_tcmplt",
"(",
"target",
")",
";",
"popType",
"(",
")",
";",
"}"
] | lt succeeds if and only if value1 < value2
<p>Stack: ..., value1, value2 => ...
@param type
@param target
@throws IOException | [
"lt",
"succeeds",
"if",
"and",
"only",
"if",
"value1",
"<",
";",
"value2",
"<p",
">",
"Stack",
":",
"...",
"value1",
"value2",
"=",
">",
";",
"..."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L593-L598 |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java | NtlmPasswordAuthentication.getPreNTLMResponse | static public byte[] getPreNTLMResponse( String password, byte[] challenge ) {
"""
Generate the ANSI DES hash for the password associated with these credentials.
"""
byte[] p14 = new byte[14];
byte[] p21 = new byte[21];
byte[] p24 = new byte[24];
byte[] passwordBytes;
try {
passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING );
} catch( UnsupportedEncodingException uee ) {
throw new RuntimeException("Try setting jcifs.smb1.encoding=US-ASCII", uee);
}
int passwordLength = passwordBytes.length;
// Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM
if( passwordLength > 14) {
passwordLength = 14;
}
System.arraycopy( passwordBytes, 0, p14, 0, passwordLength );
E( p14, S8, p21);
E( p21, challenge, p24);
return p24;
} | java | static public byte[] getPreNTLMResponse( String password, byte[] challenge ) {
byte[] p14 = new byte[14];
byte[] p21 = new byte[21];
byte[] p24 = new byte[24];
byte[] passwordBytes;
try {
passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING );
} catch( UnsupportedEncodingException uee ) {
throw new RuntimeException("Try setting jcifs.smb1.encoding=US-ASCII", uee);
}
int passwordLength = passwordBytes.length;
// Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM
if( passwordLength > 14) {
passwordLength = 14;
}
System.arraycopy( passwordBytes, 0, p14, 0, passwordLength );
E( p14, S8, p21);
E( p21, challenge, p24);
return p24;
} | [
"static",
"public",
"byte",
"[",
"]",
"getPreNTLMResponse",
"(",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
")",
"{",
"byte",
"[",
"]",
"p14",
"=",
"new",
"byte",
"[",
"14",
"]",
";",
"byte",
"[",
"]",
"p21",
"=",
"new",
"byte",
"[",
"21",
"]",
";",
"byte",
"[",
"]",
"p24",
"=",
"new",
"byte",
"[",
"24",
"]",
";",
"byte",
"[",
"]",
"passwordBytes",
";",
"try",
"{",
"passwordBytes",
"=",
"password",
".",
"toUpperCase",
"(",
")",
".",
"getBytes",
"(",
"ServerMessageBlock",
".",
"OEM_ENCODING",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"uee",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Try setting jcifs.smb1.encoding=US-ASCII\"",
",",
"uee",
")",
";",
"}",
"int",
"passwordLength",
"=",
"passwordBytes",
".",
"length",
";",
"// Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM",
"if",
"(",
"passwordLength",
">",
"14",
")",
"{",
"passwordLength",
"=",
"14",
";",
"}",
"System",
".",
"arraycopy",
"(",
"passwordBytes",
",",
"0",
",",
"p14",
",",
"0",
",",
"passwordLength",
")",
";",
"E",
"(",
"p14",
",",
"S8",
",",
"p21",
")",
";",
"E",
"(",
"p21",
",",
"challenge",
",",
"p24",
")",
";",
"return",
"p24",
";",
"}"
] | Generate the ANSI DES hash for the password associated with these credentials. | [
"Generate",
"the",
"ANSI",
"DES",
"hash",
"for",
"the",
"password",
"associated",
"with",
"these",
"credentials",
"."
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java#L91-L111 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java | FXMLProcessor.loadFxmlPaneAndControllerPair | public static Pair<Pane, AbstractFXController> loadFxmlPaneAndControllerPair(final String fxmlFileUri, final Class clazz) throws CouldNotPerformException {
"""
Method load the pane and controller of the given fxml file.
@param fxmlFileUri the uri pointing to the fxml file within the classpath.
@param clazz the responsible class which is used for class path resolution.
@return an pair of the pane and its controller.
@throws CouldNotPerformException is thrown if something went wrong like for example the fxml file does not exist.
"""
return loadFxmlPaneAndControllerPair(fxmlFileUri, clazz, DEFAULT_CONTROLLER_FACTORY);
} | java | public static Pair<Pane, AbstractFXController> loadFxmlPaneAndControllerPair(final String fxmlFileUri, final Class clazz) throws CouldNotPerformException {
return loadFxmlPaneAndControllerPair(fxmlFileUri, clazz, DEFAULT_CONTROLLER_FACTORY);
} | [
"public",
"static",
"Pair",
"<",
"Pane",
",",
"AbstractFXController",
">",
"loadFxmlPaneAndControllerPair",
"(",
"final",
"String",
"fxmlFileUri",
",",
"final",
"Class",
"clazz",
")",
"throws",
"CouldNotPerformException",
"{",
"return",
"loadFxmlPaneAndControllerPair",
"(",
"fxmlFileUri",
",",
"clazz",
",",
"DEFAULT_CONTROLLER_FACTORY",
")",
";",
"}"
] | Method load the pane and controller of the given fxml file.
@param fxmlFileUri the uri pointing to the fxml file within the classpath.
@param clazz the responsible class which is used for class path resolution.
@return an pair of the pane and its controller.
@throws CouldNotPerformException is thrown if something went wrong like for example the fxml file does not exist. | [
"Method",
"load",
"the",
"pane",
"and",
"controller",
"of",
"the",
"given",
"fxml",
"file",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java#L121-L123 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.greaterThan | @ArgumentsChecked
@Throws(IllegalNotGreaterThanException.class)
public static byte greaterThan(final byte expected, final byte check) {
"""
Ensures that a passed {@code byte} is greater to another {@code byte}.
@param expected
Expected value
@param check
Comparable to be checked
@return the passed {@code Comparable} argument {@code check}
@throws IllegalNotGreaterThanException
if the argument value {@code check} is not greater than value {@code expected}
"""
if (expected >= check) {
throw new IllegalNotGreaterThanException(check);
}
return check;
} | java | @ArgumentsChecked
@Throws(IllegalNotGreaterThanException.class)
public static byte greaterThan(final byte expected, final byte check) {
if (expected >= check) {
throw new IllegalNotGreaterThanException(check);
}
return check;
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNotGreaterThanException",
".",
"class",
")",
"public",
"static",
"byte",
"greaterThan",
"(",
"final",
"byte",
"expected",
",",
"final",
"byte",
"check",
")",
"{",
"if",
"(",
"expected",
">=",
"check",
")",
"{",
"throw",
"new",
"IllegalNotGreaterThanException",
"(",
"check",
")",
";",
"}",
"return",
"check",
";",
"}"
] | Ensures that a passed {@code byte} is greater to another {@code byte}.
@param expected
Expected value
@param check
Comparable to be checked
@return the passed {@code Comparable} argument {@code check}
@throws IllegalNotGreaterThanException
if the argument value {@code check} is not greater than value {@code expected} | [
"Ensures",
"that",
"a",
"passed",
"{",
"@code",
"byte",
"}",
"is",
"greater",
"to",
"another",
"{",
"@code",
"byte",
"}",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L731-L739 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java | SqlFragmentContainer.getPreparedStatementText | String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
"""
builds the text of the prepared statement
@param context A ControlBeanContext instance.
@param m The annotated method.
@param args The method's parameters.
@return The PreparedStatement text generated by this fragment and its children.
"""
StringBuilder sb = new StringBuilder();
for (SqlFragment sf : _children) {
sb.append(sf.getPreparedStatementText(context, m, args));
}
return sb.toString();
} | java | String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
StringBuilder sb = new StringBuilder();
for (SqlFragment sf : _children) {
sb.append(sf.getPreparedStatementText(context, m, args));
}
return sb.toString();
} | [
"String",
"getPreparedStatementText",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"m",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"SqlFragment",
"sf",
":",
"_children",
")",
"{",
"sb",
".",
"append",
"(",
"sf",
".",
"getPreparedStatementText",
"(",
"context",
",",
"m",
",",
"args",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | builds the text of the prepared statement
@param context A ControlBeanContext instance.
@param m The annotated method.
@param args The method's parameters.
@return The PreparedStatement text generated by this fragment and its children. | [
"builds",
"the",
"text",
"of",
"the",
"prepared",
"statement"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java#L92-L98 |
rundeck/rundeck | core/src/main/java/com/dtolabs/shared/resources/ResourceXMLGenerator.java | ResourceXMLGenerator.serializeDocToStream | private static void serializeDocToStream(final OutputStream output, final Document doc) throws IOException {
"""
Write Document to a file
@param output stream
@param doc document
@throws IOException on error
"""
final OutputFormat format = OutputFormat.createPrettyPrint();
final XMLWriter writer = new XMLWriter(output, format);
writer.write(doc);
writer.flush();
} | java | private static void serializeDocToStream(final OutputStream output, final Document doc) throws IOException {
final OutputFormat format = OutputFormat.createPrettyPrint();
final XMLWriter writer = new XMLWriter(output, format);
writer.write(doc);
writer.flush();
} | [
"private",
"static",
"void",
"serializeDocToStream",
"(",
"final",
"OutputStream",
"output",
",",
"final",
"Document",
"doc",
")",
"throws",
"IOException",
"{",
"final",
"OutputFormat",
"format",
"=",
"OutputFormat",
".",
"createPrettyPrint",
"(",
")",
";",
"final",
"XMLWriter",
"writer",
"=",
"new",
"XMLWriter",
"(",
"output",
",",
"format",
")",
";",
"writer",
".",
"write",
"(",
"doc",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] | Write Document to a file
@param output stream
@param doc document
@throws IOException on error | [
"Write",
"Document",
"to",
"a",
"file"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/shared/resources/ResourceXMLGenerator.java#L300-L305 |
primefaces/primefaces | src/main/java/org/primefaces/util/ComponentTraversalUtils.java | ComponentTraversalUtils.firstWithId | public static UIComponent firstWithId(String id, UIComponent base) {
"""
Finds the first component with the given id (NOT clientId!).
@param id The id.
@param base The base component to start the traversal.
@return The component or null.
"""
if (id.equals(base.getId())) {
return base;
}
UIComponent result = null;
Iterator<UIComponent> kids = base.getFacetsAndChildren();
while (kids.hasNext() && (result == null)) {
UIComponent kid = kids.next();
if (id.equals(kid.getId())) {
result = kid;
break;
}
result = firstWithId(id, kid);
if (result != null) {
break;
}
}
return result;
} | java | public static UIComponent firstWithId(String id, UIComponent base) {
if (id.equals(base.getId())) {
return base;
}
UIComponent result = null;
Iterator<UIComponent> kids = base.getFacetsAndChildren();
while (kids.hasNext() && (result == null)) {
UIComponent kid = kids.next();
if (id.equals(kid.getId())) {
result = kid;
break;
}
result = firstWithId(id, kid);
if (result != null) {
break;
}
}
return result;
} | [
"public",
"static",
"UIComponent",
"firstWithId",
"(",
"String",
"id",
",",
"UIComponent",
"base",
")",
"{",
"if",
"(",
"id",
".",
"equals",
"(",
"base",
".",
"getId",
"(",
")",
")",
")",
"{",
"return",
"base",
";",
"}",
"UIComponent",
"result",
"=",
"null",
";",
"Iterator",
"<",
"UIComponent",
">",
"kids",
"=",
"base",
".",
"getFacetsAndChildren",
"(",
")",
";",
"while",
"(",
"kids",
".",
"hasNext",
"(",
")",
"&&",
"(",
"result",
"==",
"null",
")",
")",
"{",
"UIComponent",
"kid",
"=",
"kids",
".",
"next",
"(",
")",
";",
"if",
"(",
"id",
".",
"equals",
"(",
"kid",
".",
"getId",
"(",
")",
")",
")",
"{",
"result",
"=",
"kid",
";",
"break",
";",
"}",
"result",
"=",
"firstWithId",
"(",
"id",
",",
"kid",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Finds the first component with the given id (NOT clientId!).
@param id The id.
@param base The base component to start the traversal.
@return The component or null. | [
"Finds",
"the",
"first",
"component",
"with",
"the",
"given",
"id",
"(",
"NOT",
"clientId!",
")",
"."
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/ComponentTraversalUtils.java#L117-L137 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.infov | public void infov(String format, Object param1) {
"""
Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param param1 the sole parameter
"""
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1 }, null);
}
} | java | public void infov(String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1 }, null);
}
} | [
"public",
"void",
"infov",
"(",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"INFO",
")",
")",
"{",
"doLog",
"(",
"Level",
".",
"INFO",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
"]",
"{",
"param1",
"}",
",",
"null",
")",
";",
"}",
"}"
] | Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param param1 the sole parameter | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"INFO",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1032-L1036 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/com/digitalpebble/rasp/Clause.java | Clause.setSubclauses | public void setSubclauses(int i, Annotation v) {
"""
indexed setter for subclauses - sets an indexed value - array of subelements. contains WordForms or Clauses
@generated
@param i index in the array to set
@param v value to set into the array
"""
if (Clause_Type.featOkTst && ((Clause_Type)jcasType).casFeat_subclauses == null)
jcasType.jcas.throwFeatMissing("subclauses", "com.digitalpebble.rasp.Clause");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Clause_Type)jcasType).casFeatCode_subclauses), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Clause_Type)jcasType).casFeatCode_subclauses), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setSubclauses(int i, Annotation v) {
if (Clause_Type.featOkTst && ((Clause_Type)jcasType).casFeat_subclauses == null)
jcasType.jcas.throwFeatMissing("subclauses", "com.digitalpebble.rasp.Clause");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Clause_Type)jcasType).casFeatCode_subclauses), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Clause_Type)jcasType).casFeatCode_subclauses), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setSubclauses",
"(",
"int",
"i",
",",
"Annotation",
"v",
")",
"{",
"if",
"(",
"Clause_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Clause_Type",
")",
"jcasType",
")",
".",
"casFeat_subclauses",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"subclauses\"",
",",
"\"com.digitalpebble.rasp.Clause\"",
")",
";",
"jcasType",
".",
"jcas",
".",
"checkArrayBounds",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"Clause_Type",
")",
"jcasType",
")",
".",
"casFeatCode_subclauses",
")",
",",
"i",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setRefArrayValue",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"Clause_Type",
")",
"jcasType",
")",
".",
"casFeatCode_subclauses",
")",
",",
"i",
",",
"jcasType",
".",
"ll_cas",
".",
"ll_getFSRef",
"(",
"v",
")",
")",
";",
"}"
] | indexed setter for subclauses - sets an indexed value - array of subelements. contains WordForms or Clauses
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"subclauses",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"array",
"of",
"subelements",
".",
"contains",
"WordForms",
"or",
"Clauses"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/com/digitalpebble/rasp/Clause.java#L139-L143 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/writer/svg/geometry/LineStringWriter.java | LineStringWriter.writeObject | public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
"""
Writes a {@link LineString} object. LineStrings are encoded into SVG
path elements. This function writes: "<path d=".
@param o The {@link LineString} to be encoded.
"""
document.writeElement("path", asChild);
document.writeAttributeStart("d");
document.writePathContent(((LineString) o).getCoordinates());
document.writeAttributeEnd();
} | java | public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
document.writeElement("path", asChild);
document.writeAttributeStart("d");
document.writePathContent(((LineString) o).getCoordinates());
document.writeAttributeEnd();
} | [
"public",
"void",
"writeObject",
"(",
"Object",
"o",
",",
"GraphicsDocument",
"document",
",",
"boolean",
"asChild",
")",
"throws",
"RenderException",
"{",
"document",
".",
"writeElement",
"(",
"\"path\"",
",",
"asChild",
")",
";",
"document",
".",
"writeAttributeStart",
"(",
"\"d\"",
")",
";",
"document",
".",
"writePathContent",
"(",
"(",
"(",
"LineString",
")",
"o",
")",
".",
"getCoordinates",
"(",
")",
")",
";",
"document",
".",
"writeAttributeEnd",
"(",
")",
";",
"}"
] | Writes a {@link LineString} object. LineStrings are encoded into SVG
path elements. This function writes: "<path d=".
@param o The {@link LineString} to be encoded. | [
"Writes",
"a",
"{",
"@link",
"LineString",
"}",
"object",
".",
"LineStrings",
"are",
"encoded",
"into",
"SVG",
"path",
"elements",
".",
"This",
"function",
"writes",
":",
"<",
";",
"path",
"d",
"=",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/writer/svg/geometry/LineStringWriter.java#L35-L40 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakeEnvelope.java | ST_MakeEnvelope.makeEnvelope | public static Polygon makeEnvelope(double xmin, double ymin, double xmax, double ymax, int srid) {
"""
Creates a rectangular Polygon formed from the minima and maxima by the
given shell.
The user can set a srid.
@param xmin X min
@param ymin Y min
@param xmax X max
@param ymax Y max
@param srid SRID
@return Envelope as a POLYGON
"""
Polygon geom = makeEnvelope(xmin, ymin, xmax, ymax);
geom.setSRID(srid);
return geom;
} | java | public static Polygon makeEnvelope(double xmin, double ymin, double xmax, double ymax, int srid) {
Polygon geom = makeEnvelope(xmin, ymin, xmax, ymax);
geom.setSRID(srid);
return geom;
} | [
"public",
"static",
"Polygon",
"makeEnvelope",
"(",
"double",
"xmin",
",",
"double",
"ymin",
",",
"double",
"xmax",
",",
"double",
"ymax",
",",
"int",
"srid",
")",
"{",
"Polygon",
"geom",
"=",
"makeEnvelope",
"(",
"xmin",
",",
"ymin",
",",
"xmax",
",",
"ymax",
")",
";",
"geom",
".",
"setSRID",
"(",
"srid",
")",
";",
"return",
"geom",
";",
"}"
] | Creates a rectangular Polygon formed from the minima and maxima by the
given shell.
The user can set a srid.
@param xmin X min
@param ymin Y min
@param xmax X max
@param ymax Y max
@param srid SRID
@return Envelope as a POLYGON | [
"Creates",
"a",
"rectangular",
"Polygon",
"formed",
"from",
"the",
"minima",
"and",
"maxima",
"by",
"the",
"given",
"shell",
".",
"The",
"user",
"can",
"set",
"a",
"srid",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakeEnvelope.java#L81-L85 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setWaveform | public void setWaveform(WaveformDetail waveform, TrackMetadata metadata, BeatGrid beatGrid) {
"""
Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param waveform the waveform detail to display
@param metadata information about the track whose waveform we are drawing, so we can draw cue and memory points
@param beatGrid the locations of the beats, so they can be drawn
"""
this.waveform.set(waveform);
if (metadata != null) {
cueList.set(metadata.getCueList());
} else {
cueList.set(null);
}
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} | java | public void setWaveform(WaveformDetail waveform, TrackMetadata metadata, BeatGrid beatGrid) {
this.waveform.set(waveform);
if (metadata != null) {
cueList.set(metadata.getCueList());
} else {
cueList.set(null);
}
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} | [
"public",
"void",
"setWaveform",
"(",
"WaveformDetail",
"waveform",
",",
"TrackMetadata",
"metadata",
",",
"BeatGrid",
"beatGrid",
")",
"{",
"this",
".",
"waveform",
".",
"set",
"(",
"waveform",
")",
";",
"if",
"(",
"metadata",
"!=",
"null",
")",
"{",
"cueList",
".",
"set",
"(",
"metadata",
".",
"getCueList",
"(",
")",
")",
";",
"}",
"else",
"{",
"cueList",
".",
"set",
"(",
"null",
")",
";",
"}",
"this",
".",
"beatGrid",
".",
"set",
"(",
"beatGrid",
")",
";",
"clearPlaybackState",
"(",
")",
";",
"repaint",
"(",
")",
";",
"if",
"(",
"!",
"autoScroll",
".",
"get",
"(",
")",
")",
"{",
"invalidate",
"(",
")",
";",
"}",
"}"
] | Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param waveform the waveform detail to display
@param metadata information about the track whose waveform we are drawing, so we can draw cue and memory points
@param beatGrid the locations of the beats, so they can be drawn | [
"Change",
"the",
"waveform",
"preview",
"being",
"drawn",
".",
"This",
"will",
"be",
"quickly",
"overruled",
"if",
"a",
"player",
"is",
"being",
"monitored",
"but",
"can",
"be",
"used",
"in",
"other",
"contexts",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L341-L354 |
logic-ng/LogicNG | src/main/java/org/logicng/bdds/orderings/ForceOrdering.java | ForceOrdering.orderingFromTentativeNewLocations | private LinkedHashMap<HypergraphNode<Variable>, Integer> orderingFromTentativeNewLocations(final LinkedHashMap<HypergraphNode<Variable>, Double> newLocations) {
"""
Generates a new integer ordering from tentative new locations of nodes with the double weighting.
@param newLocations the tentative new locations
@return the new integer ordering
"""
final LinkedHashMap<HypergraphNode<Variable>, Integer> ordering = new LinkedHashMap<>();
final List<Map.Entry<HypergraphNode<Variable>, Double>> list = new ArrayList<>(newLocations.entrySet());
Collections.sort(list, COMPARATOR);
int count = 0;
for (final Map.Entry<HypergraphNode<Variable>, Double> entry : list)
ordering.put(entry.getKey(), count++);
return ordering;
}
/**
* The abortion criteria for the FORCE algorithm.
* @param lastOrdering the ordering of the last step
* @param currentOrdering the ordering of the current step
* @return {@code true} if the algorithm should proceed, {@code false} if it should stop
*/
private boolean shouldProceed(final Map<HypergraphNode<Variable>, Integer> lastOrdering, final Map<HypergraphNode<Variable>, Integer> currentOrdering) {
return !lastOrdering.equals(currentOrdering);
} | java | private LinkedHashMap<HypergraphNode<Variable>, Integer> orderingFromTentativeNewLocations(final LinkedHashMap<HypergraphNode<Variable>, Double> newLocations) {
final LinkedHashMap<HypergraphNode<Variable>, Integer> ordering = new LinkedHashMap<>();
final List<Map.Entry<HypergraphNode<Variable>, Double>> list = new ArrayList<>(newLocations.entrySet());
Collections.sort(list, COMPARATOR);
int count = 0;
for (final Map.Entry<HypergraphNode<Variable>, Double> entry : list)
ordering.put(entry.getKey(), count++);
return ordering;
}
/**
* The abortion criteria for the FORCE algorithm.
* @param lastOrdering the ordering of the last step
* @param currentOrdering the ordering of the current step
* @return {@code true} if the algorithm should proceed, {@code false} if it should stop
*/
private boolean shouldProceed(final Map<HypergraphNode<Variable>, Integer> lastOrdering, final Map<HypergraphNode<Variable>, Integer> currentOrdering) {
return !lastOrdering.equals(currentOrdering);
} | [
"private",
"LinkedHashMap",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Integer",
">",
"orderingFromTentativeNewLocations",
"(",
"final",
"LinkedHashMap",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Double",
">",
"newLocations",
")",
"{",
"final",
"LinkedHashMap",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Integer",
">",
"ordering",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"final",
"List",
"<",
"Map",
".",
"Entry",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Double",
">",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"newLocations",
".",
"entrySet",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
",",
"COMPARATOR",
")",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Double",
">",
"entry",
":",
"list",
")",
"ordering",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"count",
"++",
")",
";",
"return",
"ordering",
";",
"}",
"/**\n * The abortion criteria for the FORCE algorithm.\n * @param lastOrdering the ordering of the last step\n * @param currentOrdering the ordering of the current step\n * @return {@code true} if the algorithm should proceed, {@code false} if it should stop\n */",
"private",
"boolean",
"shouldProceed",
"(",
"final",
"Map",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Integer",
">",
"lastOrdering",
",",
"final",
"Map",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Integer",
">",
"currentOrdering",
")",
"{",
"return",
"!",
"lastOrdering",
".",
"equals",
"(",
"currentOrdering",
")",
";",
"}"
] | Generates a new integer ordering from tentative new locations of nodes with the double weighting.
@param newLocations the tentative new locations
@return the new integer ordering | [
"Generates",
"a",
"new",
"integer",
"ordering",
"from",
"tentative",
"new",
"locations",
"of",
"nodes",
"with",
"the",
"double",
"weighting",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/orderings/ForceOrdering.java#L120-L138 |
hyperledger/fabric-chaincode-java | fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java | Handler.markIsTransaction | private synchronized boolean markIsTransaction(String channelId, String uuid, boolean isTransaction) {
"""
Marks a CHANNELID+UUID as either a transaction or a query
@param uuid ID to be marked
@param isTransaction true for transaction, false for query
@return whether or not the UUID was successfully marked
"""
if (this.isTransaction == null) {
return false;
}
String key = getTxKey(channelId, uuid);
this.isTransaction.put(key, isTransaction);
return true;
} | java | private synchronized boolean markIsTransaction(String channelId, String uuid, boolean isTransaction) {
if (this.isTransaction == null) {
return false;
}
String key = getTxKey(channelId, uuid);
this.isTransaction.put(key, isTransaction);
return true;
} | [
"private",
"synchronized",
"boolean",
"markIsTransaction",
"(",
"String",
"channelId",
",",
"String",
"uuid",
",",
"boolean",
"isTransaction",
")",
"{",
"if",
"(",
"this",
".",
"isTransaction",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"key",
"=",
"getTxKey",
"(",
"channelId",
",",
"uuid",
")",
";",
"this",
".",
"isTransaction",
".",
"put",
"(",
"key",
",",
"isTransaction",
")",
";",
"return",
"true",
";",
"}"
] | Marks a CHANNELID+UUID as either a transaction or a query
@param uuid ID to be marked
@param isTransaction true for transaction, false for query
@return whether or not the UUID was successfully marked | [
"Marks",
"a",
"CHANNELID",
"+",
"UUID",
"as",
"either",
"a",
"transaction",
"or",
"a",
"query"
] | train | https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java#L216-L224 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/XlsWorkbook.java | XlsWorkbook.createSheet | @Override
public XlsWorksheet createSheet(FileColumn[] columns, List<String[]> lines, String sheetName)
throws IOException {
"""
Creates a sheet in the workbook with the given name and lines of data.
@param columns The column definitions for the worksheet
@param lines The list of lines to be added to the worksheet
@param sheetName The name of the worksheet to be added
@return The worksheet created
@throws IOException if the sheet cannot be created
"""
// Create the worksheet and add the cells
WritableSheet sheet = writableWorkbook.createSheet(sheetName, 9999); // Append sheet
try
{
appendRows(sheet, columns, lines, sheetName);
}
catch(WriteException e)
{
throw new IOException(e);
}
// Set the column to autosize
int numColumns = sheet.getColumns();
for(int i = 0; i < numColumns; i++)
{
CellView column = sheet.getColumnView(i);
column.setAutosize(true);
if(columns != null && i < columns.length)
{
CellFormat format = columns[i].getCellFormat();
if(format != null)
column.setFormat(format);
}
sheet.setColumnView(i, column);
}
return new XlsWorksheet(sheet);
} | java | @Override
public XlsWorksheet createSheet(FileColumn[] columns, List<String[]> lines, String sheetName)
throws IOException
{
// Create the worksheet and add the cells
WritableSheet sheet = writableWorkbook.createSheet(sheetName, 9999); // Append sheet
try
{
appendRows(sheet, columns, lines, sheetName);
}
catch(WriteException e)
{
throw new IOException(e);
}
// Set the column to autosize
int numColumns = sheet.getColumns();
for(int i = 0; i < numColumns; i++)
{
CellView column = sheet.getColumnView(i);
column.setAutosize(true);
if(columns != null && i < columns.length)
{
CellFormat format = columns[i].getCellFormat();
if(format != null)
column.setFormat(format);
}
sheet.setColumnView(i, column);
}
return new XlsWorksheet(sheet);
} | [
"@",
"Override",
"public",
"XlsWorksheet",
"createSheet",
"(",
"FileColumn",
"[",
"]",
"columns",
",",
"List",
"<",
"String",
"[",
"]",
">",
"lines",
",",
"String",
"sheetName",
")",
"throws",
"IOException",
"{",
"// Create the worksheet and add the cells",
"WritableSheet",
"sheet",
"=",
"writableWorkbook",
".",
"createSheet",
"(",
"sheetName",
",",
"9999",
")",
";",
"// Append sheet",
"try",
"{",
"appendRows",
"(",
"sheet",
",",
"columns",
",",
"lines",
",",
"sheetName",
")",
";",
"}",
"catch",
"(",
"WriteException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"// Set the column to autosize",
"int",
"numColumns",
"=",
"sheet",
".",
"getColumns",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numColumns",
";",
"i",
"++",
")",
"{",
"CellView",
"column",
"=",
"sheet",
".",
"getColumnView",
"(",
"i",
")",
";",
"column",
".",
"setAutosize",
"(",
"true",
")",
";",
"if",
"(",
"columns",
"!=",
"null",
"&&",
"i",
"<",
"columns",
".",
"length",
")",
"{",
"CellFormat",
"format",
"=",
"columns",
"[",
"i",
"]",
".",
"getCellFormat",
"(",
")",
";",
"if",
"(",
"format",
"!=",
"null",
")",
"column",
".",
"setFormat",
"(",
"format",
")",
";",
"}",
"sheet",
".",
"setColumnView",
"(",
"i",
",",
"column",
")",
";",
"}",
"return",
"new",
"XlsWorksheet",
"(",
"sheet",
")",
";",
"}"
] | Creates a sheet in the workbook with the given name and lines of data.
@param columns The column definitions for the worksheet
@param lines The list of lines to be added to the worksheet
@param sheetName The name of the worksheet to be added
@return The worksheet created
@throws IOException if the sheet cannot be created | [
"Creates",
"a",
"sheet",
"in",
"the",
"workbook",
"with",
"the",
"given",
"name",
"and",
"lines",
"of",
"data",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/XlsWorkbook.java#L238-L270 |
alkacon/opencms-core | src/org/opencms/db/CmsLoginManager.java | CmsLoginManager.removeInvalidLogins | protected void removeInvalidLogins(String userName, String remoteAddress) {
"""
Removes all invalid attempts to login for the given user / IP.<p>
@param userName the name of the user
@param remoteAddress the remore address (IP) from which the login attempt was made
"""
if (m_maxBadAttempts < 0) {
// invalid login storage is disabled
return;
}
String key = createStorageKey(userName, remoteAddress);
// just remove the user from the storage
m_storage.remove(key);
} | java | protected void removeInvalidLogins(String userName, String remoteAddress) {
if (m_maxBadAttempts < 0) {
// invalid login storage is disabled
return;
}
String key = createStorageKey(userName, remoteAddress);
// just remove the user from the storage
m_storage.remove(key);
} | [
"protected",
"void",
"removeInvalidLogins",
"(",
"String",
"userName",
",",
"String",
"remoteAddress",
")",
"{",
"if",
"(",
"m_maxBadAttempts",
"<",
"0",
")",
"{",
"// invalid login storage is disabled",
"return",
";",
"}",
"String",
"key",
"=",
"createStorageKey",
"(",
"userName",
",",
"remoteAddress",
")",
";",
"// just remove the user from the storage",
"m_storage",
".",
"remove",
"(",
"key",
")",
";",
"}"
] | Removes all invalid attempts to login for the given user / IP.<p>
@param userName the name of the user
@param remoteAddress the remore address (IP) from which the login attempt was made | [
"Removes",
"all",
"invalid",
"attempts",
"to",
"login",
"for",
"the",
"given",
"user",
"/",
"IP",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L743-L753 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java | BaseBuffer.getNextField | public int getNextField(FieldInfo field, boolean bDisplayOption, int iMoveMode) // Must be to call right Get calls {
"""
Get the next field and fill it with data from this buffer.
You must override this method.
@param field The field to set.
@param bDisplayOption The display option for setting the field.
@param iMoveMove The move mode for setting the field.
@return The error code.
"""
Object objNext = this.getNextData();
if (DATA_ERROR.equals(objNext))
return Constants.ERROR_RETURN; // EOF
if (DATA_EOF.equals(objNext))
return Constants.ERROR_RETURN; // EOF
if (DATA_SKIP.equals(objNext))
return Constants.NORMAL_RETURN; // Don't set this field
return field.setData(objNext, bDisplayOption, iMoveMode);
} | java | public int getNextField(FieldInfo field, boolean bDisplayOption, int iMoveMode) // Must be to call right Get calls
{
Object objNext = this.getNextData();
if (DATA_ERROR.equals(objNext))
return Constants.ERROR_RETURN; // EOF
if (DATA_EOF.equals(objNext))
return Constants.ERROR_RETURN; // EOF
if (DATA_SKIP.equals(objNext))
return Constants.NORMAL_RETURN; // Don't set this field
return field.setData(objNext, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"getNextField",
"(",
"FieldInfo",
"field",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// Must be to call right Get calls",
"{",
"Object",
"objNext",
"=",
"this",
".",
"getNextData",
"(",
")",
";",
"if",
"(",
"DATA_ERROR",
".",
"equals",
"(",
"objNext",
")",
")",
"return",
"Constants",
".",
"ERROR_RETURN",
";",
"// EOF",
"if",
"(",
"DATA_EOF",
".",
"equals",
"(",
"objNext",
")",
")",
"return",
"Constants",
".",
"ERROR_RETURN",
";",
"// EOF",
"if",
"(",
"DATA_SKIP",
".",
"equals",
"(",
"objNext",
")",
")",
"return",
"Constants",
".",
"NORMAL_RETURN",
";",
"// Don't set this field",
"return",
"field",
".",
"setData",
"(",
"objNext",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] | Get the next field and fill it with data from this buffer.
You must override this method.
@param field The field to set.
@param bDisplayOption The display option for setting the field.
@param iMoveMove The move mode for setting the field.
@return The error code. | [
"Get",
"the",
"next",
"field",
"and",
"fill",
"it",
"with",
"data",
"from",
"this",
"buffer",
".",
"You",
"must",
"override",
"this",
"method",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java#L336-L346 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java | DecimalStyle.withZeroDigit | public DecimalStyle withZeroDigit(char zeroDigit) {
"""
Returns a copy of the info with a new character that represents zero.
<p>
The character used to represent digits may vary by culture.
This method specifies the zero character to use, which implies the characters for one to nine.
@param zeroDigit the character for zero
@return a copy with a new character that represents zero, not null
"""
if (zeroDigit == this.zeroDigit) {
return this;
}
return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator);
} | java | public DecimalStyle withZeroDigit(char zeroDigit) {
if (zeroDigit == this.zeroDigit) {
return this;
}
return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator);
} | [
"public",
"DecimalStyle",
"withZeroDigit",
"(",
"char",
"zeroDigit",
")",
"{",
"if",
"(",
"zeroDigit",
"==",
"this",
".",
"zeroDigit",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"DecimalStyle",
"(",
"zeroDigit",
",",
"positiveSign",
",",
"negativeSign",
",",
"decimalSeparator",
")",
";",
"}"
] | Returns a copy of the info with a new character that represents zero.
<p>
The character used to represent digits may vary by culture.
This method specifies the zero character to use, which implies the characters for one to nine.
@param zeroDigit the character for zero
@return a copy with a new character that represents zero, not null | [
"Returns",
"a",
"copy",
"of",
"the",
"info",
"with",
"a",
"new",
"character",
"that",
"represents",
"zero",
".",
"<p",
">",
"The",
"character",
"used",
"to",
"represent",
"digits",
"may",
"vary",
"by",
"culture",
".",
"This",
"method",
"specifies",
"the",
"zero",
"character",
"to",
"use",
"which",
"implies",
"the",
"characters",
"for",
"one",
"to",
"nine",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java#L216-L221 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java | AbstractFrameModelingVisitor.analyzeInstruction | public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException {
"""
Analyze the given Instruction.
@param ins
the Instruction
@throws DataflowAnalysisException
if an error occurs analyzing the instruction; in most cases,
this indicates that the bytecode for the method being
analyzed is invalid
"""
if (frame.isValid()) {
try {
ins.accept(this);
} catch (InvalidBytecodeException e) {
String message = "Invalid bytecode: could not analyze instr. " + ins + " at frame " + frame;
throw new DataflowAnalysisException(message, e);
}
}
} | java | public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException {
if (frame.isValid()) {
try {
ins.accept(this);
} catch (InvalidBytecodeException e) {
String message = "Invalid bytecode: could not analyze instr. " + ins + " at frame " + frame;
throw new DataflowAnalysisException(message, e);
}
}
} | [
"public",
"void",
"analyzeInstruction",
"(",
"Instruction",
"ins",
")",
"throws",
"DataflowAnalysisException",
"{",
"if",
"(",
"frame",
".",
"isValid",
"(",
")",
")",
"{",
"try",
"{",
"ins",
".",
"accept",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"InvalidBytecodeException",
"e",
")",
"{",
"String",
"message",
"=",
"\"Invalid bytecode: could not analyze instr. \"",
"+",
"ins",
"+",
"\" at frame \"",
"+",
"frame",
";",
"throw",
"new",
"DataflowAnalysisException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Analyze the given Instruction.
@param ins
the Instruction
@throws DataflowAnalysisException
if an error occurs analyzing the instruction; in most cases,
this indicates that the bytecode for the method being
analyzed is invalid | [
"Analyze",
"the",
"given",
"Instruction",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L81-L90 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listIntentsWithServiceResponseAsync | public Observable<ServiceResponse<List<IntentClassifier>>> listIntentsWithServiceResponseAsync(UUID appId, String versionId, ListIntentsOptionalParameter listIntentsOptionalParameter) {
"""
Gets information about the intent models.
@param appId The application ID.
@param versionId The version ID.
@param listIntentsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<IntentClassifier> object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listIntentsOptionalParameter != null ? listIntentsOptionalParameter.skip() : null;
final Integer take = listIntentsOptionalParameter != null ? listIntentsOptionalParameter.take() : null;
return listIntentsWithServiceResponseAsync(appId, versionId, skip, take);
} | java | public Observable<ServiceResponse<List<IntentClassifier>>> listIntentsWithServiceResponseAsync(UUID appId, String versionId, ListIntentsOptionalParameter listIntentsOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listIntentsOptionalParameter != null ? listIntentsOptionalParameter.skip() : null;
final Integer take = listIntentsOptionalParameter != null ? listIntentsOptionalParameter.take() : null;
return listIntentsWithServiceResponseAsync(appId, versionId, skip, take);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"IntentClassifier",
">",
">",
">",
"listIntentsWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListIntentsOptionalParameter",
"listIntentsOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"appId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter appId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"versionId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter versionId is required and cannot be null.\"",
")",
";",
"}",
"final",
"Integer",
"skip",
"=",
"listIntentsOptionalParameter",
"!=",
"null",
"?",
"listIntentsOptionalParameter",
".",
"skip",
"(",
")",
":",
"null",
";",
"final",
"Integer",
"take",
"=",
"listIntentsOptionalParameter",
"!=",
"null",
"?",
"listIntentsOptionalParameter",
".",
"take",
"(",
")",
":",
"null",
";",
"return",
"listIntentsWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"skip",
",",
"take",
")",
";",
"}"
] | Gets information about the intent models.
@param appId The application ID.
@param versionId The version ID.
@param listIntentsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<IntentClassifier> object | [
"Gets",
"information",
"about",
"the",
"intent",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L799-L813 |
ontop/ontop | engine/system/core/src/main/java/it/unibz/inf/ontop/answering/connection/impl/QuestStatement.java | QuestStatement.executeInThread | private <R extends OBDAResultSet, Q extends InputQuery<R>> R executeInThread(Q inputQuery, Evaluator<R, Q> evaluator)
throws OntopReformulationException, OntopQueryEvaluationException {
"""
Internal method to start a new query execution thread type defines the
query type SELECT, ASK, CONSTRUCT, or DESCRIBE
"""
log.debug("Executing SPARQL query: \n{}", inputQuery);
CountDownLatch monitor = new CountDownLatch(1);
ExecutableQuery executableQuery = engine.reformulateIntoNativeQuery(inputQuery);
QueryExecutionThread<R, Q> executionthread = new QueryExecutionThread<>(inputQuery, executableQuery, evaluator,
monitor);
this.executionThread = executionthread;
executionthread.start();
try {
monitor.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (executionthread.errorStatus()) {
Exception ex = executionthread.getException();
if (ex instanceof OntopReformulationException) {
throw (OntopReformulationException) ex;
}
else if (ex instanceof OntopQueryEvaluationException) {
throw (OntopQueryEvaluationException) ex;
}
else {
throw new OntopQueryEvaluationException(ex);
}
}
if (canceled) {
canceled = false;
throw new OntopQueryEvaluationException("Query execution was cancelled");
}
return executionthread.getResultSet();
} | java | private <R extends OBDAResultSet, Q extends InputQuery<R>> R executeInThread(Q inputQuery, Evaluator<R, Q> evaluator)
throws OntopReformulationException, OntopQueryEvaluationException {
log.debug("Executing SPARQL query: \n{}", inputQuery);
CountDownLatch monitor = new CountDownLatch(1);
ExecutableQuery executableQuery = engine.reformulateIntoNativeQuery(inputQuery);
QueryExecutionThread<R, Q> executionthread = new QueryExecutionThread<>(inputQuery, executableQuery, evaluator,
monitor);
this.executionThread = executionthread;
executionthread.start();
try {
monitor.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (executionthread.errorStatus()) {
Exception ex = executionthread.getException();
if (ex instanceof OntopReformulationException) {
throw (OntopReformulationException) ex;
}
else if (ex instanceof OntopQueryEvaluationException) {
throw (OntopQueryEvaluationException) ex;
}
else {
throw new OntopQueryEvaluationException(ex);
}
}
if (canceled) {
canceled = false;
throw new OntopQueryEvaluationException("Query execution was cancelled");
}
return executionthread.getResultSet();
} | [
"private",
"<",
"R",
"extends",
"OBDAResultSet",
",",
"Q",
"extends",
"InputQuery",
"<",
"R",
">",
">",
"R",
"executeInThread",
"(",
"Q",
"inputQuery",
",",
"Evaluator",
"<",
"R",
",",
"Q",
">",
"evaluator",
")",
"throws",
"OntopReformulationException",
",",
"OntopQueryEvaluationException",
"{",
"log",
".",
"debug",
"(",
"\"Executing SPARQL query: \\n{}\"",
",",
"inputQuery",
")",
";",
"CountDownLatch",
"monitor",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"ExecutableQuery",
"executableQuery",
"=",
"engine",
".",
"reformulateIntoNativeQuery",
"(",
"inputQuery",
")",
";",
"QueryExecutionThread",
"<",
"R",
",",
"Q",
">",
"executionthread",
"=",
"new",
"QueryExecutionThread",
"<>",
"(",
"inputQuery",
",",
"executableQuery",
",",
"evaluator",
",",
"monitor",
")",
";",
"this",
".",
"executionThread",
"=",
"executionthread",
";",
"executionthread",
".",
"start",
"(",
")",
";",
"try",
"{",
"monitor",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"if",
"(",
"executionthread",
".",
"errorStatus",
"(",
")",
")",
"{",
"Exception",
"ex",
"=",
"executionthread",
".",
"getException",
"(",
")",
";",
"if",
"(",
"ex",
"instanceof",
"OntopReformulationException",
")",
"{",
"throw",
"(",
"OntopReformulationException",
")",
"ex",
";",
"}",
"else",
"if",
"(",
"ex",
"instanceof",
"OntopQueryEvaluationException",
")",
"{",
"throw",
"(",
"OntopQueryEvaluationException",
")",
"ex",
";",
"}",
"else",
"{",
"throw",
"new",
"OntopQueryEvaluationException",
"(",
"ex",
")",
";",
"}",
"}",
"if",
"(",
"canceled",
")",
"{",
"canceled",
"=",
"false",
";",
"throw",
"new",
"OntopQueryEvaluationException",
"(",
"\"Query execution was cancelled\"",
")",
";",
"}",
"return",
"executionthread",
".",
"getResultSet",
"(",
")",
";",
"}"
] | Internal method to start a new query execution thread type defines the
query type SELECT, ASK, CONSTRUCT, or DESCRIBE | [
"Internal",
"method",
"to",
"start",
"a",
"new",
"query",
"execution",
"thread",
"type",
"defines",
"the",
"query",
"type",
"SELECT",
"ASK",
"CONSTRUCT",
"or",
"DESCRIBE"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/system/core/src/main/java/it/unibz/inf/ontop/answering/connection/impl/QuestStatement.java#L307-L343 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/alg/VpTree.java | VpTree.buildFromPoints | private Node buildFromPoints(int lower, int upper) {
"""
Builds the tree from a set of points by recursively partitioning
them according to a random pivot.
@param lower start of range
@param upper end of range (exclusive)
@return root of the tree or null if lower == upper
"""
if (upper == lower) {
return null;
}
final Node node = new Node();
node.index = lower;
if (upper - lower > 1) {
// choose an arbitrary vantage point and move it to the start
int i = random.nextInt(upper - lower - 1) + lower;
listSwap(items, lower, i);
listSwap(indexes, lower, i);
int median = (upper + lower + 1) / 2;
// partition around the median distance
// TODO: use the QuickSelect class?
nthElement(lower + 1, upper, median, items[lower]);
// what was the median?
node.threshold = distance(items[lower], items[median]);
node.index = lower;
node.left = buildFromPoints(lower + 1, median);
node.right = buildFromPoints(median, upper);
}
return node;
} | java | private Node buildFromPoints(int lower, int upper) {
if (upper == lower) {
return null;
}
final Node node = new Node();
node.index = lower;
if (upper - lower > 1) {
// choose an arbitrary vantage point and move it to the start
int i = random.nextInt(upper - lower - 1) + lower;
listSwap(items, lower, i);
listSwap(indexes, lower, i);
int median = (upper + lower + 1) / 2;
// partition around the median distance
// TODO: use the QuickSelect class?
nthElement(lower + 1, upper, median, items[lower]);
// what was the median?
node.threshold = distance(items[lower], items[median]);
node.index = lower;
node.left = buildFromPoints(lower + 1, median);
node.right = buildFromPoints(median, upper);
}
return node;
} | [
"private",
"Node",
"buildFromPoints",
"(",
"int",
"lower",
",",
"int",
"upper",
")",
"{",
"if",
"(",
"upper",
"==",
"lower",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Node",
"node",
"=",
"new",
"Node",
"(",
")",
";",
"node",
".",
"index",
"=",
"lower",
";",
"if",
"(",
"upper",
"-",
"lower",
">",
"1",
")",
"{",
"// choose an arbitrary vantage point and move it to the start\r",
"int",
"i",
"=",
"random",
".",
"nextInt",
"(",
"upper",
"-",
"lower",
"-",
"1",
")",
"+",
"lower",
";",
"listSwap",
"(",
"items",
",",
"lower",
",",
"i",
")",
";",
"listSwap",
"(",
"indexes",
",",
"lower",
",",
"i",
")",
";",
"int",
"median",
"=",
"(",
"upper",
"+",
"lower",
"+",
"1",
")",
"/",
"2",
";",
"// partition around the median distance\r",
"// TODO: use the QuickSelect class?\r",
"nthElement",
"(",
"lower",
"+",
"1",
",",
"upper",
",",
"median",
",",
"items",
"[",
"lower",
"]",
")",
";",
"// what was the median?\r",
"node",
".",
"threshold",
"=",
"distance",
"(",
"items",
"[",
"lower",
"]",
",",
"items",
"[",
"median",
"]",
")",
";",
"node",
".",
"index",
"=",
"lower",
";",
"node",
".",
"left",
"=",
"buildFromPoints",
"(",
"lower",
"+",
"1",
",",
"median",
")",
";",
"node",
".",
"right",
"=",
"buildFromPoints",
"(",
"median",
",",
"upper",
")",
";",
"}",
"return",
"node",
";",
"}"
] | Builds the tree from a set of points by recursively partitioning
them according to a random pivot.
@param lower start of range
@param upper end of range (exclusive)
@return root of the tree or null if lower == upper | [
"Builds",
"the",
"tree",
"from",
"a",
"set",
"of",
"points",
"by",
"recursively",
"partitioning",
"them",
"according",
"to",
"a",
"random",
"pivot",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L93-L123 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchy.java | GenericDraweeHierarchy.setPlaceholderImage | public void setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType) {
"""
Sets a new placeholder drawable with scale type.
@param resourceId an identifier of an Android drawable or color resource.
@param ScalingUtils.ScaleType a new scale type.
"""
setPlaceholderImage(mResources.getDrawable(resourceId), scaleType);
} | java | public void setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType) {
setPlaceholderImage(mResources.getDrawable(resourceId), scaleType);
} | [
"public",
"void",
"setPlaceholderImage",
"(",
"int",
"resourceId",
",",
"ScalingUtils",
".",
"ScaleType",
"scaleType",
")",
"{",
"setPlaceholderImage",
"(",
"mResources",
".",
"getDrawable",
"(",
"resourceId",
")",
",",
"scaleType",
")",
";",
"}"
] | Sets a new placeholder drawable with scale type.
@param resourceId an identifier of an Android drawable or color resource.
@param ScalingUtils.ScaleType a new scale type. | [
"Sets",
"a",
"new",
"placeholder",
"drawable",
"with",
"scale",
"type",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchy.java#L453-L455 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/io/Files.java | Files.newWriter | public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
"""
Returns a buffered writer that writes to a file using the given character set.
@param file the file to write to
@param charset the charset used to encode the output stream; see {@link StandardCharsets} for
helpful predefined constants
@return the buffered writer
"""
checkNotNull(file);
checkNotNull(charset);
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
} | java | public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
} | [
"public",
"static",
"BufferedWriter",
"newWriter",
"(",
"File",
"file",
",",
"Charset",
"charset",
")",
"throws",
"FileNotFoundException",
"{",
"checkNotNull",
"(",
"file",
")",
";",
"checkNotNull",
"(",
"charset",
")",
";",
"return",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
",",
"charset",
")",
")",
";",
"}"
] | Returns a buffered writer that writes to a file using the given character set.
@param file the file to write to
@param charset the charset used to encode the output stream; see {@link StandardCharsets} for
helpful predefined constants
@return the buffered writer | [
"Returns",
"a",
"buffered",
"writer",
"that",
"writes",
"to",
"a",
"file",
"using",
"the",
"given",
"character",
"set",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L95-L99 |
spring-projects/spring-session-data-mongodb | src/main/java/org/springframework/session/data/mongo/ReactiveMongoOperationsSessionRepository.java | ReactiveMongoOperationsSessionRepository.createSession | @Override
public Mono<MongoSession> createSession() {
"""
Creates a new {@link MongoSession} that is capable of being persisted by this {@link ReactiveSessionRepository}.
<p>
This allows optimizations and customizations in how the {@link MongoSession} is persisted. For example, the
implementation returned might keep track of the changes ensuring that only the delta needs to be persisted on a
save.
</p>
@return a new {@link MongoSession} that is capable of being persisted by this {@link ReactiveSessionRepository}
"""
return Mono.justOrEmpty(this.maxInactiveIntervalInSeconds) //
.map(MongoSession::new) //
.doOnNext(mongoSession -> publishEvent(new SessionCreatedEvent(this, mongoSession))) //
.switchIfEmpty(Mono.just(new MongoSession()));
} | java | @Override
public Mono<MongoSession> createSession() {
return Mono.justOrEmpty(this.maxInactiveIntervalInSeconds) //
.map(MongoSession::new) //
.doOnNext(mongoSession -> publishEvent(new SessionCreatedEvent(this, mongoSession))) //
.switchIfEmpty(Mono.just(new MongoSession()));
} | [
"@",
"Override",
"public",
"Mono",
"<",
"MongoSession",
">",
"createSession",
"(",
")",
"{",
"return",
"Mono",
".",
"justOrEmpty",
"(",
"this",
".",
"maxInactiveIntervalInSeconds",
")",
"//",
".",
"map",
"(",
"MongoSession",
"::",
"new",
")",
"//",
".",
"doOnNext",
"(",
"mongoSession",
"->",
"publishEvent",
"(",
"new",
"SessionCreatedEvent",
"(",
"this",
",",
"mongoSession",
")",
")",
")",
"//",
".",
"switchIfEmpty",
"(",
"Mono",
".",
"just",
"(",
"new",
"MongoSession",
"(",
")",
")",
")",
";",
"}"
] | Creates a new {@link MongoSession} that is capable of being persisted by this {@link ReactiveSessionRepository}.
<p>
This allows optimizations and customizations in how the {@link MongoSession} is persisted. For example, the
implementation returned might keep track of the changes ensuring that only the delta needs to be persisted on a
save.
</p>
@return a new {@link MongoSession} that is capable of being persisted by this {@link ReactiveSessionRepository} | [
"Creates",
"a",
"new",
"{",
"@link",
"MongoSession",
"}",
"that",
"is",
"capable",
"of",
"being",
"persisted",
"by",
"this",
"{",
"@link",
"ReactiveSessionRepository",
"}",
".",
"<p",
">",
"This",
"allows",
"optimizations",
"and",
"customizations",
"in",
"how",
"the",
"{",
"@link",
"MongoSession",
"}",
"is",
"persisted",
".",
"For",
"example",
"the",
"implementation",
"returned",
"might",
"keep",
"track",
"of",
"the",
"changes",
"ensuring",
"that",
"only",
"the",
"delta",
"needs",
"to",
"be",
"persisted",
"on",
"a",
"save",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/spring-projects/spring-session-data-mongodb/blob/c507bb2d2a9b52ea9846ffaf1ac7c71cb0e6690e/src/main/java/org/springframework/session/data/mongo/ReactiveMongoOperationsSessionRepository.java#L84-L91 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getPositiveBigInteger | public BigInteger getPositiveBigInteger() throws IOException {
"""
Returns an ASN.1 INTEGER value as a positive BigInteger.
This is just to deal with implementations that incorrectly encode
some values as negative.
@return the integer held in this DER value as a BigInteger.
"""
if (buffer.read() != DerValue.tag_Integer) {
throw new IOException("DER input, Integer tag error");
}
return buffer.getBigInteger(getLength(buffer), true);
} | java | public BigInteger getPositiveBigInteger() throws IOException {
if (buffer.read() != DerValue.tag_Integer) {
throw new IOException("DER input, Integer tag error");
}
return buffer.getBigInteger(getLength(buffer), true);
} | [
"public",
"BigInteger",
"getPositiveBigInteger",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_Integer",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DER input, Integer tag error\"",
")",
";",
"}",
"return",
"buffer",
".",
"getBigInteger",
"(",
"getLength",
"(",
"buffer",
")",
",",
"true",
")",
";",
"}"
] | Returns an ASN.1 INTEGER value as a positive BigInteger.
This is just to deal with implementations that incorrectly encode
some values as negative.
@return the integer held in this DER value as a BigInteger. | [
"Returns",
"an",
"ASN",
".",
"1",
"INTEGER",
"value",
"as",
"a",
"positive",
"BigInteger",
".",
"This",
"is",
"just",
"to",
"deal",
"with",
"implementations",
"that",
"incorrectly",
"encode",
"some",
"values",
"as",
"negative",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L192-L197 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java | ForwardCurveInterpolation.addForward | private void addForward(AnalyticModel model, double fixingTime, RandomVariable forward, boolean isParameter) {
"""
Add a forward to this curve.
@param model An analytic model providing a context. The discount curve (if needed) is obtained from this model.
@param fixingTime The given fixing time.
@param forward The given forward.
@param isParameter If true, then this point is server via {@link #getParameter()} and changed via {@link #setParameter(RandomVariable[])} and {@link #getCloneForParameter(RandomVariable[])}, i.e., it can be calibrated.
"""
double interpolationEntitiyTime;
RandomVariable interpolationEntityForwardValue;
switch(interpolationEntityForward) {
case FORWARD:
default:
interpolationEntitiyTime = fixingTime;
interpolationEntityForwardValue = forward;
break;
case FORWARD_TIMES_DISCOUNTFACTOR:
interpolationEntitiyTime = fixingTime;
interpolationEntityForwardValue = forward.mult(model.getDiscountCurve(getDiscountCurveName()).getValue(model, fixingTime+getPaymentOffset(fixingTime)));
break;
case ZERO:
{
double paymentOffset = getPaymentOffset(fixingTime);
interpolationEntitiyTime = fixingTime+paymentOffset;
interpolationEntityForwardValue = forward.mult(paymentOffset).add(1.0).log().div(paymentOffset);
break;
}
case DISCOUNTFACTOR:
{
double paymentOffset = getPaymentOffset(fixingTime);
interpolationEntitiyTime = fixingTime+paymentOffset;
interpolationEntityForwardValue = getValue(fixingTime).div(forward.mult(paymentOffset).add(1.0));
break;
}
}
super.addPoint(interpolationEntitiyTime, interpolationEntityForwardValue, isParameter);
} | java | private void addForward(AnalyticModel model, double fixingTime, RandomVariable forward, boolean isParameter) {
double interpolationEntitiyTime;
RandomVariable interpolationEntityForwardValue;
switch(interpolationEntityForward) {
case FORWARD:
default:
interpolationEntitiyTime = fixingTime;
interpolationEntityForwardValue = forward;
break;
case FORWARD_TIMES_DISCOUNTFACTOR:
interpolationEntitiyTime = fixingTime;
interpolationEntityForwardValue = forward.mult(model.getDiscountCurve(getDiscountCurveName()).getValue(model, fixingTime+getPaymentOffset(fixingTime)));
break;
case ZERO:
{
double paymentOffset = getPaymentOffset(fixingTime);
interpolationEntitiyTime = fixingTime+paymentOffset;
interpolationEntityForwardValue = forward.mult(paymentOffset).add(1.0).log().div(paymentOffset);
break;
}
case DISCOUNTFACTOR:
{
double paymentOffset = getPaymentOffset(fixingTime);
interpolationEntitiyTime = fixingTime+paymentOffset;
interpolationEntityForwardValue = getValue(fixingTime).div(forward.mult(paymentOffset).add(1.0));
break;
}
}
super.addPoint(interpolationEntitiyTime, interpolationEntityForwardValue, isParameter);
} | [
"private",
"void",
"addForward",
"(",
"AnalyticModel",
"model",
",",
"double",
"fixingTime",
",",
"RandomVariable",
"forward",
",",
"boolean",
"isParameter",
")",
"{",
"double",
"interpolationEntitiyTime",
";",
"RandomVariable",
"interpolationEntityForwardValue",
";",
"switch",
"(",
"interpolationEntityForward",
")",
"{",
"case",
"FORWARD",
":",
"default",
":",
"interpolationEntitiyTime",
"=",
"fixingTime",
";",
"interpolationEntityForwardValue",
"=",
"forward",
";",
"break",
";",
"case",
"FORWARD_TIMES_DISCOUNTFACTOR",
":",
"interpolationEntitiyTime",
"=",
"fixingTime",
";",
"interpolationEntityForwardValue",
"=",
"forward",
".",
"mult",
"(",
"model",
".",
"getDiscountCurve",
"(",
"getDiscountCurveName",
"(",
")",
")",
".",
"getValue",
"(",
"model",
",",
"fixingTime",
"+",
"getPaymentOffset",
"(",
"fixingTime",
")",
")",
")",
";",
"break",
";",
"case",
"ZERO",
":",
"{",
"double",
"paymentOffset",
"=",
"getPaymentOffset",
"(",
"fixingTime",
")",
";",
"interpolationEntitiyTime",
"=",
"fixingTime",
"+",
"paymentOffset",
";",
"interpolationEntityForwardValue",
"=",
"forward",
".",
"mult",
"(",
"paymentOffset",
")",
".",
"add",
"(",
"1.0",
")",
".",
"log",
"(",
")",
".",
"div",
"(",
"paymentOffset",
")",
";",
"break",
";",
"}",
"case",
"DISCOUNTFACTOR",
":",
"{",
"double",
"paymentOffset",
"=",
"getPaymentOffset",
"(",
"fixingTime",
")",
";",
"interpolationEntitiyTime",
"=",
"fixingTime",
"+",
"paymentOffset",
";",
"interpolationEntityForwardValue",
"=",
"getValue",
"(",
"fixingTime",
")",
".",
"div",
"(",
"forward",
".",
"mult",
"(",
"paymentOffset",
")",
".",
"add",
"(",
"1.0",
")",
")",
";",
"break",
";",
"}",
"}",
"super",
".",
"addPoint",
"(",
"interpolationEntitiyTime",
",",
"interpolationEntityForwardValue",
",",
"isParameter",
")",
";",
"}"
] | Add a forward to this curve.
@param model An analytic model providing a context. The discount curve (if needed) is obtained from this model.
@param fixingTime The given fixing time.
@param forward The given forward.
@param isParameter If true, then this point is server via {@link #getParameter()} and changed via {@link #setParameter(RandomVariable[])} and {@link #getCloneForParameter(RandomVariable[])}, i.e., it can be calibrated. | [
"Add",
"a",
"forward",
"to",
"this",
"curve",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java#L416-L445 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/PaymentSession.java | PaymentSession.presentShippingFlow | public void presentShippingFlow() {
"""
Launch the {@link PaymentFlowActivity} to allow the user to fill in payment details.
"""
final Intent intent = new Intent(mHostActivity, PaymentFlowActivity.class)
.putExtra(PAYMENT_SESSION_CONFIG, mPaymentSessionConfig)
.putExtra(PAYMENT_SESSION_DATA_KEY, mPaymentSessionData)
.putExtra(EXTRA_PAYMENT_SESSION_ACTIVE, true);
mHostActivity.startActivityForResult(intent, PAYMENT_SHIPPING_DETAILS_REQUEST);
} | java | public void presentShippingFlow() {
final Intent intent = new Intent(mHostActivity, PaymentFlowActivity.class)
.putExtra(PAYMENT_SESSION_CONFIG, mPaymentSessionConfig)
.putExtra(PAYMENT_SESSION_DATA_KEY, mPaymentSessionData)
.putExtra(EXTRA_PAYMENT_SESSION_ACTIVE, true);
mHostActivity.startActivityForResult(intent, PAYMENT_SHIPPING_DETAILS_REQUEST);
} | [
"public",
"void",
"presentShippingFlow",
"(",
")",
"{",
"final",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"mHostActivity",
",",
"PaymentFlowActivity",
".",
"class",
")",
".",
"putExtra",
"(",
"PAYMENT_SESSION_CONFIG",
",",
"mPaymentSessionConfig",
")",
".",
"putExtra",
"(",
"PAYMENT_SESSION_DATA_KEY",
",",
"mPaymentSessionData",
")",
".",
"putExtra",
"(",
"EXTRA_PAYMENT_SESSION_ACTIVE",
",",
"true",
")",
";",
"mHostActivity",
".",
"startActivityForResult",
"(",
"intent",
",",
"PAYMENT_SHIPPING_DETAILS_REQUEST",
")",
";",
"}"
] | Launch the {@link PaymentFlowActivity} to allow the user to fill in payment details. | [
"Launch",
"the",
"{"
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/PaymentSession.java#L204-L210 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/JavascriptHTMLBundleLinkRenderer.java | JavascriptHTMLBundleLinkRenderer.performGlobalBundleLinksRendering | @Override
protected void performGlobalBundleLinksRendering(BundleRendererContext ctx, Writer out, boolean debugOn)
throws IOException {
"""
Performs the global bundle rendering
@param ctx
the context
@param out
the writer
@param debugOn
the flag indicating if we are in debug mode or not
@throws IOException
if an IO exception occurs
"""
renderGlobalLinks = true;
super.performGlobalBundleLinksRendering(ctx, out, debugOn);
renderGlobalLinks = false;
} | java | @Override
protected void performGlobalBundleLinksRendering(BundleRendererContext ctx, Writer out, boolean debugOn)
throws IOException {
renderGlobalLinks = true;
super.performGlobalBundleLinksRendering(ctx, out, debugOn);
renderGlobalLinks = false;
} | [
"@",
"Override",
"protected",
"void",
"performGlobalBundleLinksRendering",
"(",
"BundleRendererContext",
"ctx",
",",
"Writer",
"out",
",",
"boolean",
"debugOn",
")",
"throws",
"IOException",
"{",
"renderGlobalLinks",
"=",
"true",
";",
"super",
".",
"performGlobalBundleLinksRendering",
"(",
"ctx",
",",
"out",
",",
"debugOn",
")",
";",
"renderGlobalLinks",
"=",
"false",
";",
"}"
] | Performs the global bundle rendering
@param ctx
the context
@param out
the writer
@param debugOn
the flag indicating if we are in debug mode or not
@throws IOException
if an IO exception occurs | [
"Performs",
"the",
"global",
"bundle",
"rendering"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/JavascriptHTMLBundleLinkRenderer.java#L141-L148 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dnsrecords_stats.java | dnsrecords_stats.get | public static dnsrecords_stats get(nitro_service service, String dnsrecordtype) throws Exception {
"""
Use this API to fetch statistics of dnsrecords_stats resource of given name .
"""
dnsrecords_stats obj = new dnsrecords_stats();
obj.set_dnsrecordtype(dnsrecordtype);
dnsrecords_stats response = (dnsrecords_stats) obj.stat_resource(service);
return response;
} | java | public static dnsrecords_stats get(nitro_service service, String dnsrecordtype) throws Exception{
dnsrecords_stats obj = new dnsrecords_stats();
obj.set_dnsrecordtype(dnsrecordtype);
dnsrecords_stats response = (dnsrecords_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"dnsrecords_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"dnsrecordtype",
")",
"throws",
"Exception",
"{",
"dnsrecords_stats",
"obj",
"=",
"new",
"dnsrecords_stats",
"(",
")",
";",
"obj",
".",
"set_dnsrecordtype",
"(",
"dnsrecordtype",
")",
";",
"dnsrecords_stats",
"response",
"=",
"(",
"dnsrecords_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of dnsrecords_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"dnsrecords_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dnsrecords_stats.java#L226-L231 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.deallocateAsync | public Observable<OperationStatusResponseInner> deallocateAsync(String resourceGroupName, String vmScaleSetName) {
"""
Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return deallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> deallocateAsync(String resourceGroupName, String vmScaleSetName) {
return deallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"deallocateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"deallocateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
",",
"OperationStatusResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OperationStatusResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Deallocates",
"specific",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Shuts",
"down",
"the",
"virtual",
"machines",
"and",
"releases",
"the",
"compute",
"resources",
".",
"You",
"are",
"not",
"billed",
"for",
"the",
"compute",
"resources",
"that",
"this",
"virtual",
"machine",
"scale",
"set",
"deallocates",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L815-L822 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkConditions | public Environment checkConditions(Tuple<Expr> conditions, boolean sign, Environment environment) {
"""
Type check a sequence of zero or more conditions, such as the requires clause
of a function or method. The environment from each condition is fed into the
following. This means that, in principle, type tests influence both
subsequent conditions and the remainder. The following illustrates:
<pre>
function f(int|null x) -> (int r)
requires x is int
requires x >= 0:
//
return x
</pre>
This type checks because of the initial type test <code>x is int</code>.
Observe that, if the order of <code>requires</code> clauses was reversed,
this would not type check. Finally, it is an interesting question as to why
the above ever make sense. In general, it's better to simply declare
<code>x</code> as type <code>int</code>. However, in some cases we may be
unable to do this (for example, to preserve binary compatibility with a
previous interface).
@param conditions
@param sign
@param environment
@return
"""
for (Expr e : conditions) {
// Thread environment through from before
environment = checkCondition(e, sign, environment);
}
return environment;
} | java | public Environment checkConditions(Tuple<Expr> conditions, boolean sign, Environment environment) {
for (Expr e : conditions) {
// Thread environment through from before
environment = checkCondition(e, sign, environment);
}
return environment;
} | [
"public",
"Environment",
"checkConditions",
"(",
"Tuple",
"<",
"Expr",
">",
"conditions",
",",
"boolean",
"sign",
",",
"Environment",
"environment",
")",
"{",
"for",
"(",
"Expr",
"e",
":",
"conditions",
")",
"{",
"// Thread environment through from before",
"environment",
"=",
"checkCondition",
"(",
"e",
",",
"sign",
",",
"environment",
")",
";",
"}",
"return",
"environment",
";",
"}"
] | Type check a sequence of zero or more conditions, such as the requires clause
of a function or method. The environment from each condition is fed into the
following. This means that, in principle, type tests influence both
subsequent conditions and the remainder. The following illustrates:
<pre>
function f(int|null x) -> (int r)
requires x is int
requires x >= 0:
//
return x
</pre>
This type checks because of the initial type test <code>x is int</code>.
Observe that, if the order of <code>requires</code> clauses was reversed,
this would not type check. Finally, it is an interesting question as to why
the above ever make sense. In general, it's better to simply declare
<code>x</code> as type <code>int</code>. However, in some cases we may be
unable to do this (for example, to preserve binary compatibility with a
previous interface).
@param conditions
@param sign
@param environment
@return | [
"Type",
"check",
"a",
"sequence",
"of",
"zero",
"or",
"more",
"conditions",
"such",
"as",
"the",
"requires",
"clause",
"of",
"a",
"function",
"or",
"method",
".",
"The",
"environment",
"from",
"each",
"condition",
"is",
"fed",
"into",
"the",
"following",
".",
"This",
"means",
"that",
"in",
"principle",
"type",
"tests",
"influence",
"both",
"subsequent",
"conditions",
"and",
"the",
"remainder",
".",
"The",
"following",
"illustrates",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L808-L814 |
alkacon/opencms-core | src/org/opencms/db/CmsSubscriptionManager.java | CmsSubscriptionManager.getDateLastVisitedBy | public long getDateLastVisitedBy(CmsObject cms, CmsUser user, CmsResource resource) throws CmsException {
"""
Returns the date when the resource was last visited by the user.<p>
@param cms the current users context
@param user the user to check the date
@param resource the resource to check the date
@return the date when the resource was last visited by the user
@throws CmsException if something goes wrong
"""
return m_securityManager.getDateLastVisitedBy(cms.getRequestContext(), getPoolName(), user, resource);
} | java | public long getDateLastVisitedBy(CmsObject cms, CmsUser user, CmsResource resource) throws CmsException {
return m_securityManager.getDateLastVisitedBy(cms.getRequestContext(), getPoolName(), user, resource);
} | [
"public",
"long",
"getDateLastVisitedBy",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"getDateLastVisitedBy",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
",",
"getPoolName",
"(",
")",
",",
"user",
",",
"resource",
")",
";",
"}"
] | Returns the date when the resource was last visited by the user.<p>
@param cms the current users context
@param user the user to check the date
@param resource the resource to check the date
@return the date when the resource was last visited by the user
@throws CmsException if something goes wrong | [
"Returns",
"the",
"date",
"when",
"the",
"resource",
"was",
"last",
"visited",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L90-L93 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java | ReflectionUtils.invokeJdbcMethod | public static Object invokeJdbcMethod(Method method, Object target, Object... args) throws SQLException {
"""
Invoke the specified JDBC API {@link Method} against the supplied target
object with the supplied arguments.
@param method the method to invoke
@param target the target object to invoke the method on
@param args the invocation arguments (may be {@code null})
@return the invocation result, if any
@throws SQLException the JDBC API SQLException to rethrow (if any)
@see #invokeMethod(java.lang.reflect.Method, Object, Object[])
"""
try {
return method.invoke(target, args);
}
catch (IllegalAccessException ex) {
handleReflectionException(ex);
}
catch (InvocationTargetException ex) {
if (ex.getTargetException() instanceof SQLException) {
throw (SQLException) ex.getTargetException();
}
handleInvocationTargetException(ex);
}
throw new IllegalStateException("Should never get here");
} | java | public static Object invokeJdbcMethod(Method method, Object target, Object... args) throws SQLException {
try {
return method.invoke(target, args);
}
catch (IllegalAccessException ex) {
handleReflectionException(ex);
}
catch (InvocationTargetException ex) {
if (ex.getTargetException() instanceof SQLException) {
throw (SQLException) ex.getTargetException();
}
handleInvocationTargetException(ex);
}
throw new IllegalStateException("Should never get here");
} | [
"public",
"static",
"Object",
"invokeJdbcMethod",
"(",
"Method",
"method",
",",
"Object",
"target",
",",
"Object",
"...",
"args",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"method",
".",
"invoke",
"(",
"target",
",",
"args",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"ex",
")",
"{",
"handleReflectionException",
"(",
"ex",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"ex",
")",
"{",
"if",
"(",
"ex",
".",
"getTargetException",
"(",
")",
"instanceof",
"SQLException",
")",
"{",
"throw",
"(",
"SQLException",
")",
"ex",
".",
"getTargetException",
"(",
")",
";",
"}",
"handleInvocationTargetException",
"(",
"ex",
")",
";",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"Should never get here\"",
")",
";",
"}"
] | Invoke the specified JDBC API {@link Method} against the supplied target
object with the supplied arguments.
@param method the method to invoke
@param target the target object to invoke the method on
@param args the invocation arguments (may be {@code null})
@return the invocation result, if any
@throws SQLException the JDBC API SQLException to rethrow (if any)
@see #invokeMethod(java.lang.reflect.Method, Object, Object[]) | [
"Invoke",
"the",
"specified",
"JDBC",
"API",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java#L228-L242 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getCurrentActionResolver | public static ActionResolver getCurrentActionResolver( HttpServletRequest request, ServletContext servletContext ) {
"""
Get the current ActionResolver.
@deprecated Use {@link #getCurrentPageFlow(HttpServletRequest, ServletContext)} instead.
@param request the current HttpServletRequest.
@param servletContext the current ServletContext.
@return the current ActionResolver from the user session, or <code>null</code> if there is none.
"""
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
//
// First see if the current page flow is a long-lived, which is stored in its own attribute.
//
String currentLongLivedAttrName =
ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
String currentLongLivedModulePath = ( String ) sh.getAttribute( rc, currentLongLivedAttrName );
if ( currentLongLivedModulePath != null )
{
return getLongLivedPageFlow( currentLongLivedModulePath, unwrappedRequest );
}
else
{
String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
return ( ActionResolver ) sh.getAttribute( rc, currentJpfAttrName );
}
} | java | public static ActionResolver getCurrentActionResolver( HttpServletRequest request, ServletContext servletContext )
{
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
//
// First see if the current page flow is a long-lived, which is stored in its own attribute.
//
String currentLongLivedAttrName =
ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
String currentLongLivedModulePath = ( String ) sh.getAttribute( rc, currentLongLivedAttrName );
if ( currentLongLivedModulePath != null )
{
return getLongLivedPageFlow( currentLongLivedModulePath, unwrappedRequest );
}
else
{
String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
return ( ActionResolver ) sh.getAttribute( rc, currentJpfAttrName );
}
} | [
"public",
"static",
"ActionResolver",
"getCurrentActionResolver",
"(",
"HttpServletRequest",
"request",
",",
"ServletContext",
"servletContext",
")",
"{",
"StorageHandler",
"sh",
"=",
"Handlers",
".",
"get",
"(",
"servletContext",
")",
".",
"getStorageHandler",
"(",
")",
";",
"HttpServletRequest",
"unwrappedRequest",
"=",
"unwrapMultipart",
"(",
"request",
")",
";",
"RequestContext",
"rc",
"=",
"new",
"RequestContext",
"(",
"unwrappedRequest",
",",
"null",
")",
";",
"//",
"// First see if the current page flow is a long-lived, which is stored in its own attribute.",
"//",
"String",
"currentLongLivedAttrName",
"=",
"ScopedServletUtils",
".",
"getScopedSessionAttrName",
"(",
"CURRENT_LONGLIVED_ATTR",
",",
"unwrappedRequest",
")",
";",
"String",
"currentLongLivedModulePath",
"=",
"(",
"String",
")",
"sh",
".",
"getAttribute",
"(",
"rc",
",",
"currentLongLivedAttrName",
")",
";",
"if",
"(",
"currentLongLivedModulePath",
"!=",
"null",
")",
"{",
"return",
"getLongLivedPageFlow",
"(",
"currentLongLivedModulePath",
",",
"unwrappedRequest",
")",
";",
"}",
"else",
"{",
"String",
"currentJpfAttrName",
"=",
"ScopedServletUtils",
".",
"getScopedSessionAttrName",
"(",
"CURRENT_JPF_ATTR",
",",
"unwrappedRequest",
")",
";",
"return",
"(",
"ActionResolver",
")",
"sh",
".",
"getAttribute",
"(",
"rc",
",",
"currentJpfAttrName",
")",
";",
"}",
"}"
] | Get the current ActionResolver.
@deprecated Use {@link #getCurrentPageFlow(HttpServletRequest, ServletContext)} instead.
@param request the current HttpServletRequest.
@param servletContext the current ServletContext.
@return the current ActionResolver from the user session, or <code>null</code> if there is none. | [
"Get",
"the",
"current",
"ActionResolver",
".",
"@deprecated",
"Use",
"{",
"@link",
"#getCurrentPageFlow",
"(",
"HttpServletRequest",
"ServletContext",
")",
"}",
"instead",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L300-L322 |
ACRA/acra | acra-core/src/main/java/org/acra/collector/LogCatCollector.java | LogCatCollector.collectLogCat | private String collectLogCat(@NonNull CoreConfiguration config, @Nullable String bufferName) throws IOException {
"""
Executes the logcat command with arguments taken from {@link org.acra.annotation.AcraCore#logcatArguments()}
@param bufferName The name of the buffer to be read: "main" (default), "radio" or "events".
@return A string containing the latest lines of the output.
Default is 100 lines, use "-t", "300" in {@link org.acra.annotation.AcraCore#logcatArguments()} if you want 300 lines.
You should be aware that increasing this value causes a longer report generation time and a bigger footprint on the device data plan consumption.
"""
final int myPid = android.os.Process.myPid();
// no need to filter on jellybean onwards, android does that anyway
final String myPidStr = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN && config.logcatFilterByPid() && myPid > 0 ? Integer.toString(myPid) + "):" : null;
final List<String> commandLine = new ArrayList<>();
commandLine.add("logcat");
if (bufferName != null) {
commandLine.add("-b");
commandLine.add(bufferName);
}
final int tailCount;
final List<String> logcatArgumentsList = config.logcatArguments();
final int tailIndex = logcatArgumentsList.indexOf("-t");
if (tailIndex > -1 && tailIndex < logcatArgumentsList.size()) {
tailCount = Integer.parseInt(logcatArgumentsList.get(tailIndex + 1));
} else {
tailCount = -1;
}
commandLine.addAll(logcatArgumentsList);
final Process process = new ProcessBuilder().command(commandLine).redirectErrorStream(true).start();
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Retrieving logcat output (buffer:" + (bufferName == null ? "default" : bufferName) + ")...");
try {
return streamToString(config, process.getInputStream(), myPidStr == null ? null : s -> s.contains(myPidStr), tailCount);
} finally {
process.destroy();
}
} | java | private String collectLogCat(@NonNull CoreConfiguration config, @Nullable String bufferName) throws IOException {
final int myPid = android.os.Process.myPid();
// no need to filter on jellybean onwards, android does that anyway
final String myPidStr = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN && config.logcatFilterByPid() && myPid > 0 ? Integer.toString(myPid) + "):" : null;
final List<String> commandLine = new ArrayList<>();
commandLine.add("logcat");
if (bufferName != null) {
commandLine.add("-b");
commandLine.add(bufferName);
}
final int tailCount;
final List<String> logcatArgumentsList = config.logcatArguments();
final int tailIndex = logcatArgumentsList.indexOf("-t");
if (tailIndex > -1 && tailIndex < logcatArgumentsList.size()) {
tailCount = Integer.parseInt(logcatArgumentsList.get(tailIndex + 1));
} else {
tailCount = -1;
}
commandLine.addAll(logcatArgumentsList);
final Process process = new ProcessBuilder().command(commandLine).redirectErrorStream(true).start();
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Retrieving logcat output (buffer:" + (bufferName == null ? "default" : bufferName) + ")...");
try {
return streamToString(config, process.getInputStream(), myPidStr == null ? null : s -> s.contains(myPidStr), tailCount);
} finally {
process.destroy();
}
} | [
"private",
"String",
"collectLogCat",
"(",
"@",
"NonNull",
"CoreConfiguration",
"config",
",",
"@",
"Nullable",
"String",
"bufferName",
")",
"throws",
"IOException",
"{",
"final",
"int",
"myPid",
"=",
"android",
".",
"os",
".",
"Process",
".",
"myPid",
"(",
")",
";",
"// no need to filter on jellybean onwards, android does that anyway",
"final",
"String",
"myPidStr",
"=",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN",
"&&",
"config",
".",
"logcatFilterByPid",
"(",
")",
"&&",
"myPid",
">",
"0",
"?",
"Integer",
".",
"toString",
"(",
"myPid",
")",
"+",
"\"):\"",
":",
"null",
";",
"final",
"List",
"<",
"String",
">",
"commandLine",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"commandLine",
".",
"add",
"(",
"\"logcat\"",
")",
";",
"if",
"(",
"bufferName",
"!=",
"null",
")",
"{",
"commandLine",
".",
"add",
"(",
"\"-b\"",
")",
";",
"commandLine",
".",
"add",
"(",
"bufferName",
")",
";",
"}",
"final",
"int",
"tailCount",
";",
"final",
"List",
"<",
"String",
">",
"logcatArgumentsList",
"=",
"config",
".",
"logcatArguments",
"(",
")",
";",
"final",
"int",
"tailIndex",
"=",
"logcatArgumentsList",
".",
"indexOf",
"(",
"\"-t\"",
")",
";",
"if",
"(",
"tailIndex",
">",
"-",
"1",
"&&",
"tailIndex",
"<",
"logcatArgumentsList",
".",
"size",
"(",
")",
")",
"{",
"tailCount",
"=",
"Integer",
".",
"parseInt",
"(",
"logcatArgumentsList",
".",
"get",
"(",
"tailIndex",
"+",
"1",
")",
")",
";",
"}",
"else",
"{",
"tailCount",
"=",
"-",
"1",
";",
"}",
"commandLine",
".",
"addAll",
"(",
"logcatArgumentsList",
")",
";",
"final",
"Process",
"process",
"=",
"new",
"ProcessBuilder",
"(",
")",
".",
"command",
"(",
"commandLine",
")",
".",
"redirectErrorStream",
"(",
"true",
")",
".",
"start",
"(",
")",
";",
"if",
"(",
"ACRA",
".",
"DEV_LOGGING",
")",
"ACRA",
".",
"log",
".",
"d",
"(",
"LOG_TAG",
",",
"\"Retrieving logcat output (buffer:\"",
"+",
"(",
"bufferName",
"==",
"null",
"?",
"\"default\"",
":",
"bufferName",
")",
"+",
"\")...\"",
")",
";",
"try",
"{",
"return",
"streamToString",
"(",
"config",
",",
"process",
".",
"getInputStream",
"(",
")",
",",
"myPidStr",
"==",
"null",
"?",
"null",
":",
"s",
"->",
"s",
".",
"contains",
"(",
"myPidStr",
")",
",",
"tailCount",
")",
";",
"}",
"finally",
"{",
"process",
".",
"destroy",
"(",
")",
";",
"}",
"}"
] | Executes the logcat command with arguments taken from {@link org.acra.annotation.AcraCore#logcatArguments()}
@param bufferName The name of the buffer to be read: "main" (default), "radio" or "events".
@return A string containing the latest lines of the output.
Default is 100 lines, use "-t", "300" in {@link org.acra.annotation.AcraCore#logcatArguments()} if you want 300 lines.
You should be aware that increasing this value causes a longer report generation time and a bigger footprint on the device data plan consumption. | [
"Executes",
"the",
"logcat",
"command",
"with",
"arguments",
"taken",
"from",
"{",
"@link",
"org",
".",
"acra",
".",
"annotation",
".",
"AcraCore#logcatArguments",
"()",
"}"
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/collector/LogCatCollector.java#L69-L100 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java | RemoteWebDriverBuilder.oneOf | public RemoteWebDriverBuilder oneOf(Capabilities maybeThis, Capabilities... orOneOfThese) {
"""
Clears the current set of alternative browsers and instead sets the list of possible choices to
the arguments given to this method.
"""
options.clear();
addAlternative(maybeThis);
for (Capabilities anOrOneOfThese : orOneOfThese) {
addAlternative(anOrOneOfThese);
}
return this;
} | java | public RemoteWebDriverBuilder oneOf(Capabilities maybeThis, Capabilities... orOneOfThese) {
options.clear();
addAlternative(maybeThis);
for (Capabilities anOrOneOfThese : orOneOfThese) {
addAlternative(anOrOneOfThese);
}
return this;
} | [
"public",
"RemoteWebDriverBuilder",
"oneOf",
"(",
"Capabilities",
"maybeThis",
",",
"Capabilities",
"...",
"orOneOfThese",
")",
"{",
"options",
".",
"clear",
"(",
")",
";",
"addAlternative",
"(",
"maybeThis",
")",
";",
"for",
"(",
"Capabilities",
"anOrOneOfThese",
":",
"orOneOfThese",
")",
"{",
"addAlternative",
"(",
"anOrOneOfThese",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Clears the current set of alternative browsers and instead sets the list of possible choices to
the arguments given to this method. | [
"Clears",
"the",
"current",
"set",
"of",
"alternative",
"browsers",
"and",
"instead",
"sets",
"the",
"list",
"of",
"possible",
"choices",
"to",
"the",
"arguments",
"given",
"to",
"this",
"method",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java#L106-L113 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.padNext | public DateTimeFormatterBuilder padNext(int padWidth, char padChar) {
"""
Causes the next added printer/parser to pad to a fixed width.
<p>
This padding is intended for padding other than zero-padding.
Zero-padding should be achieved using the appendValue methods.
<p>
During formatting, the decorated element will be output and then padded
to the specified width. An exception will be thrown during printing if
the pad width is exceeded.
<p>
During parsing, the padding and decorated element are parsed.
If parsing is lenient, then the pad width is treated as a maximum.
If parsing is case insensitive, then the pad character is matched ignoring case.
The padding is parsed greedily. Thus, if the decorated element starts with
the pad character, it will not be parsed.
@param padWidth the pad width, 1 or greater
@param padChar the pad character
@return this, for chaining, not null
@throws IllegalArgumentException if pad width is too small
"""
if (padWidth < 1) {
throw new IllegalArgumentException("The pad width must be at least one but was " + padWidth);
}
active.padNextWidth = padWidth;
active.padNextChar = padChar;
active.valueParserIndex = -1;
return this;
} | java | public DateTimeFormatterBuilder padNext(int padWidth, char padChar) {
if (padWidth < 1) {
throw new IllegalArgumentException("The pad width must be at least one but was " + padWidth);
}
active.padNextWidth = padWidth;
active.padNextChar = padChar;
active.valueParserIndex = -1;
return this;
} | [
"public",
"DateTimeFormatterBuilder",
"padNext",
"(",
"int",
"padWidth",
",",
"char",
"padChar",
")",
"{",
"if",
"(",
"padWidth",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The pad width must be at least one but was \"",
"+",
"padWidth",
")",
";",
"}",
"active",
".",
"padNextWidth",
"=",
"padWidth",
";",
"active",
".",
"padNextChar",
"=",
"padChar",
";",
"active",
".",
"valueParserIndex",
"=",
"-",
"1",
";",
"return",
"this",
";",
"}"
] | Causes the next added printer/parser to pad to a fixed width.
<p>
This padding is intended for padding other than zero-padding.
Zero-padding should be achieved using the appendValue methods.
<p>
During formatting, the decorated element will be output and then padded
to the specified width. An exception will be thrown during printing if
the pad width is exceeded.
<p>
During parsing, the padding and decorated element are parsed.
If parsing is lenient, then the pad width is treated as a maximum.
If parsing is case insensitive, then the pad character is matched ignoring case.
The padding is parsed greedily. Thus, if the decorated element starts with
the pad character, it will not be parsed.
@param padWidth the pad width, 1 or greater
@param padChar the pad character
@return this, for chaining, not null
@throws IllegalArgumentException if pad width is too small | [
"Causes",
"the",
"next",
"added",
"printer",
"/",
"parser",
"to",
"pad",
"to",
"a",
"fixed",
"width",
".",
"<p",
">",
"This",
"padding",
"is",
"intended",
"for",
"padding",
"other",
"than",
"zero",
"-",
"padding",
".",
"Zero",
"-",
"padding",
"should",
"be",
"achieved",
"using",
"the",
"appendValue",
"methods",
".",
"<p",
">",
"During",
"formatting",
"the",
"decorated",
"element",
"will",
"be",
"output",
"and",
"then",
"padded",
"to",
"the",
"specified",
"width",
".",
"An",
"exception",
"will",
"be",
"thrown",
"during",
"printing",
"if",
"the",
"pad",
"width",
"is",
"exceeded",
".",
"<p",
">",
"During",
"parsing",
"the",
"padding",
"and",
"decorated",
"element",
"are",
"parsed",
".",
"If",
"parsing",
"is",
"lenient",
"then",
"the",
"pad",
"width",
"is",
"treated",
"as",
"a",
"maximum",
".",
"If",
"parsing",
"is",
"case",
"insensitive",
"then",
"the",
"pad",
"character",
"is",
"matched",
"ignoring",
"case",
".",
"The",
"padding",
"is",
"parsed",
"greedily",
".",
"Thus",
"if",
"the",
"decorated",
"element",
"starts",
"with",
"the",
"pad",
"character",
"it",
"will",
"not",
"be",
"parsed",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L1751-L1759 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/injection/WebServiceRefBindingBuilder.java | WebServiceRefBindingBuilder.createWebServiceRefFromResource | static WebServiceRef createWebServiceRefFromResource(Resource resource, Class<?> typeClass, String jndiName) throws InjectionException {
"""
This creates an @WebServiceRef instance based on data from an @Resource annotation.
The type class and JNDI name are separately passed in because the @Resource annotation
may have the default values for these attributes.
"""
// notice we send in 'Service.class' for the 'value' attribute, this is
// because only service type injections are possible with the @Resource
// annotation, so we'll use the default value for the 'value' attribute.
return new WebServiceRefSimulator(resource.mappedName(), jndiName, typeClass, Service.class, null, "");
} | java | static WebServiceRef createWebServiceRefFromResource(Resource resource, Class<?> typeClass, String jndiName) throws InjectionException {
// notice we send in 'Service.class' for the 'value' attribute, this is
// because only service type injections are possible with the @Resource
// annotation, so we'll use the default value for the 'value' attribute.
return new WebServiceRefSimulator(resource.mappedName(), jndiName, typeClass, Service.class, null, "");
} | [
"static",
"WebServiceRef",
"createWebServiceRefFromResource",
"(",
"Resource",
"resource",
",",
"Class",
"<",
"?",
">",
"typeClass",
",",
"String",
"jndiName",
")",
"throws",
"InjectionException",
"{",
"// notice we send in 'Service.class' for the 'value' attribute, this is",
"// because only service type injections are possible with the @Resource",
"// annotation, so we'll use the default value for the 'value' attribute.",
"return",
"new",
"WebServiceRefSimulator",
"(",
"resource",
".",
"mappedName",
"(",
")",
",",
"jndiName",
",",
"typeClass",
",",
"Service",
".",
"class",
",",
"null",
",",
"\"\"",
")",
";",
"}"
] | This creates an @WebServiceRef instance based on data from an @Resource annotation.
The type class and JNDI name are separately passed in because the @Resource annotation
may have the default values for these attributes. | [
"This",
"creates",
"an"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/injection/WebServiceRefBindingBuilder.java#L190-L195 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java | ServerSICoreConnectionListener.asynchronousException | @Override
public void asynchronousException(ConsumerSession session, Throwable e) {
"""
This event is generated if an exception is thrown during the processing of
an asynchronous callback. In practise this should never occur as we should
ensure that we catch all the errors in the place they occur as no state
is available here.
@param session
@param e
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "asynchronousException",
new Object[]
{
session,
e
});
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Caught an async exception:", e);
try {
sendMeNotificationEvent(CommsConstants.EVENTID_ASYNC_EXCEPTION, null, session, e);
} catch (SIException e2) {
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2018", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "asynchronousException");
} | java | @Override
public void asynchronousException(ConsumerSession session, Throwable e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "asynchronousException",
new Object[]
{
session,
e
});
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Caught an async exception:", e);
try {
sendMeNotificationEvent(CommsConstants.EVENTID_ASYNC_EXCEPTION, null, session, e);
} catch (SIException e2) {
FFDCFilter.processException(e,
CLASS_NAME + ".asynchronousException",
CommsConstants.SERVERSICORECONNECTIONLISTENER_ASYNC_02,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2018", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "asynchronousException");
} | [
"@",
"Override",
"public",
"void",
"asynchronousException",
"(",
"ConsumerSession",
"session",
",",
"Throwable",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"asynchronousException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"session",
",",
"e",
"}",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".asynchronousException\"",
",",
"CommsConstants",
".",
"SERVERSICORECONNECTIONLISTENER_ASYNC_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Caught an async exception:\"",
",",
"e",
")",
";",
"try",
"{",
"sendMeNotificationEvent",
"(",
"CommsConstants",
".",
"EVENTID_ASYNC_EXCEPTION",
",",
"null",
",",
"session",
",",
"e",
")",
";",
"}",
"catch",
"(",
"SIException",
"e2",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".asynchronousException\"",
",",
"CommsConstants",
".",
"SERVERSICORECONNECTIONLISTENER_ASYNC_02",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2018\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"asynchronousException\"",
")",
";",
"}"
] | This event is generated if an exception is thrown during the processing of
an asynchronous callback. In practise this should never occur as we should
ensure that we catch all the errors in the place they occur as no state
is available here.
@param session
@param e | [
"This",
"event",
"is",
"generated",
"if",
"an",
"exception",
"is",
"thrown",
"during",
"the",
"processing",
"of",
"an",
"asynchronous",
"callback",
".",
"In",
"practise",
"this",
"should",
"never",
"occur",
"as",
"we",
"should",
"ensure",
"that",
"we",
"catch",
"all",
"the",
"errors",
"in",
"the",
"place",
"they",
"occur",
"as",
"no",
"state",
"is",
"available",
"here",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerSICoreConnectionListener.java#L145-L179 |
agmip/dome | src/main/java/org/agmip/dome/DomeFunctions.java | DomeFunctions.dateOffset | public static HashMap<String, ArrayList<String>> dateOffset(HashMap m, String var, String base, String offset) {
"""
Wrapper around the {@code dateOffset()} method of {@code org.agmip.common.Functions}.
@param m AgMIP simulation description
@param var Variable to output
@param base Base date to offset
@param offset number of days to offset
@return dome compatable modification
"""
return offset(m, var, base, offset, true);
} | java | public static HashMap<String, ArrayList<String>> dateOffset(HashMap m, String var, String base, String offset) {
return offset(m, var, base, offset, true);
} | [
"public",
"static",
"HashMap",
"<",
"String",
",",
"ArrayList",
"<",
"String",
">",
">",
"dateOffset",
"(",
"HashMap",
"m",
",",
"String",
"var",
",",
"String",
"base",
",",
"String",
"offset",
")",
"{",
"return",
"offset",
"(",
"m",
",",
"var",
",",
"base",
",",
"offset",
",",
"true",
")",
";",
"}"
] | Wrapper around the {@code dateOffset()} method of {@code org.agmip.common.Functions}.
@param m AgMIP simulation description
@param var Variable to output
@param base Base date to offset
@param offset number of days to offset
@return dome compatable modification | [
"Wrapper",
"around",
"the",
"{",
"@code",
"dateOffset",
"()",
"}",
"method",
"of",
"{",
"@code",
"org",
".",
"agmip",
".",
"common",
".",
"Functions",
"}",
"."
] | train | https://github.com/agmip/dome/blob/ca7c15bf2bae09bb7e8d51160e77592bbda9343d/src/main/java/org/agmip/dome/DomeFunctions.java#L37-L39 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.