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
Omertron/api-thetvdb
src/main/java/com/omertron/thetvdbapi/tools/DOMHelper.java
DOMHelper.appendChild
public static void appendChild(Document doc, Element parentElement, String elementName, String elementValue) { """ Add a child element to a parent element @param doc @param parentElement @param elementName @param elementValue """ Element child = doc.createElement(elementName); Text text = doc.createTextNode(elementValue); child.appendChild(text); parentElement.appendChild(child); }
java
public static void appendChild(Document doc, Element parentElement, String elementName, String elementValue) { Element child = doc.createElement(elementName); Text text = doc.createTextNode(elementValue); child.appendChild(text); parentElement.appendChild(child); }
[ "public", "static", "void", "appendChild", "(", "Document", "doc", ",", "Element", "parentElement", ",", "String", "elementName", ",", "String", "elementValue", ")", "{", "Element", "child", "=", "doc", ".", "createElement", "(", "elementName", ")", ";", "Text", "text", "=", "doc", ".", "createTextNode", "(", "elementValue", ")", ";", "child", ".", "appendChild", "(", "text", ")", ";", "parentElement", ".", "appendChild", "(", "child", ")", ";", "}" ]
Add a child element to a parent element @param doc @param parentElement @param elementName @param elementValue
[ "Add", "a", "child", "element", "to", "a", "parent", "element" ]
train
https://github.com/Omertron/api-thetvdb/blob/2ff9f9580e76043f19d2fc3234d87e16a95fa485/src/main/java/com/omertron/thetvdbapi/tools/DOMHelper.java#L229-L234
glyptodon/guacamole-client
extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java
AuthenticationProviderService.getRadiusChallenge
private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) { """ Returns the expected credentials from a RADIUS challenge. @param challengePacket The AccessChallenge RadiusPacket received from the RADIUS server. @return A CredentialsInfo object that represents fields that need to be presented to the user in order to complete authentication. One of these must be the RADIUS state. """ // Try to get the state attribute - if it's not there, we have a problem RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE); if (stateAttr == null) { logger.error("Something went wrong, state attribute not present."); logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge."); return null; } // We need to get the reply message so we know what to ask the user RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE); if (replyAttr == null) { logger.error("No reply message received from the server."); logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one."); return null; } // We have the required attributes - convert to strings and then generate the additional login box/field String replyMsg = replyAttr.toString(); String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes()); Field radiusResponseField = new RadiusChallengeResponseField(replyMsg); Field radiusStateField = new RadiusStateField(radiusState); // Return the CredentialsInfo object that has the state and the expected response. return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField)); }
java
private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) { // Try to get the state attribute - if it's not there, we have a problem RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE); if (stateAttr == null) { logger.error("Something went wrong, state attribute not present."); logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge."); return null; } // We need to get the reply message so we know what to ask the user RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE); if (replyAttr == null) { logger.error("No reply message received from the server."); logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one."); return null; } // We have the required attributes - convert to strings and then generate the additional login box/field String replyMsg = replyAttr.toString(); String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes()); Field radiusResponseField = new RadiusChallengeResponseField(replyMsg); Field radiusStateField = new RadiusStateField(radiusState); // Return the CredentialsInfo object that has the state and the expected response. return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField)); }
[ "private", "CredentialsInfo", "getRadiusChallenge", "(", "RadiusPacket", "challengePacket", ")", "{", "// Try to get the state attribute - if it's not there, we have a problem", "RadiusAttribute", "stateAttr", "=", "challengePacket", ".", "findAttribute", "(", "Attr_State", ".", "TYPE", ")", ";", "if", "(", "stateAttr", "==", "null", ")", "{", "logger", ".", "error", "(", "\"Something went wrong, state attribute not present.\"", ")", ";", "logger", ".", "debug", "(", "\"State Attribute turned up null, which shouldn't happen in AccessChallenge.\"", ")", ";", "return", "null", ";", "}", "// We need to get the reply message so we know what to ask the user", "RadiusAttribute", "replyAttr", "=", "challengePacket", ".", "findAttribute", "(", "Attr_ReplyMessage", ".", "TYPE", ")", ";", "if", "(", "replyAttr", "==", "null", ")", "{", "logger", ".", "error", "(", "\"No reply message received from the server.\"", ")", ";", "logger", ".", "debug", "(", "\"Expecting a Attr_ReplyMessage attribute on this packet, and did not get one.\"", ")", ";", "return", "null", ";", "}", "// We have the required attributes - convert to strings and then generate the additional login box/field", "String", "replyMsg", "=", "replyAttr", ".", "toString", "(", ")", ";", "String", "radiusState", "=", "BaseEncoding", ".", "base16", "(", ")", ".", "encode", "(", "stateAttr", ".", "getValue", "(", ")", ".", "getBytes", "(", ")", ")", ";", "Field", "radiusResponseField", "=", "new", "RadiusChallengeResponseField", "(", "replyMsg", ")", ";", "Field", "radiusStateField", "=", "new", "RadiusStateField", "(", "radiusState", ")", ";", "// Return the CredentialsInfo object that has the state and the expected response.", "return", "new", "CredentialsInfo", "(", "Arrays", ".", "asList", "(", "radiusResponseField", ",", "radiusStateField", ")", ")", ";", "}" ]
Returns the expected credentials from a RADIUS challenge. @param challengePacket The AccessChallenge RadiusPacket received from the RADIUS server. @return A CredentialsInfo object that represents fields that need to be presented to the user in order to complete authentication. One of these must be the RADIUS state.
[ "Returns", "the", "expected", "credentials", "from", "a", "RADIUS", "challenge", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java#L81-L107
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java
SwapFile.get
public static SwapFile get(final File parent, final String child) throws IOException { """ Obtain SwapFile by parent file and name. @param parent - parent File @param child - String with file name @return SwapFile swap file @throws IOException I/O error """ return get(parent, child, SpoolConfig.getDefaultSpoolConfig().fileCleaner); }
java
public static SwapFile get(final File parent, final String child) throws IOException { return get(parent, child, SpoolConfig.getDefaultSpoolConfig().fileCleaner); }
[ "public", "static", "SwapFile", "get", "(", "final", "File", "parent", ",", "final", "String", "child", ")", "throws", "IOException", "{", "return", "get", "(", "parent", ",", "child", ",", "SpoolConfig", ".", "getDefaultSpoolConfig", "(", ")", ".", "fileCleaner", ")", ";", "}" ]
Obtain SwapFile by parent file and name. @param parent - parent File @param child - String with file name @return SwapFile swap file @throws IOException I/O error
[ "Obtain", "SwapFile", "by", "parent", "file", "and", "name", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java#L109-L113
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/api/core/data/CqlDuration.java
CqlDuration.from
public static CqlDuration from(@NonNull String input) { """ Converts a <code>String</code> into a duration. <p>The accepted formats are: <ul> <li>multiple digits followed by a time unit like: 12h30m where the time unit can be: <ul> <li>{@code y}: years <li>{@code m}: months <li>{@code w}: weeks <li>{@code d}: days <li>{@code h}: hours <li>{@code m}: minutes <li>{@code s}: seconds <li>{@code ms}: milliseconds <li>{@code us} or {@code µs}: microseconds <li>{@code ns}: nanoseconds </ul> <li>ISO 8601 format: P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W <li>ISO 8601 alternative format: P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss] </ul> @param input the <code>String</code> to convert """ boolean isNegative = input.startsWith("-"); String source = isNegative ? input.substring(1) : input; if (source.startsWith("P")) { if (source.endsWith("W")) { return parseIso8601WeekFormat(isNegative, source); } if (source.contains("-")) { return parseIso8601AlternativeFormat(isNegative, source); } return parseIso8601Format(isNegative, source); } return parseStandardFormat(isNegative, source); }
java
public static CqlDuration from(@NonNull String input) { boolean isNegative = input.startsWith("-"); String source = isNegative ? input.substring(1) : input; if (source.startsWith("P")) { if (source.endsWith("W")) { return parseIso8601WeekFormat(isNegative, source); } if (source.contains("-")) { return parseIso8601AlternativeFormat(isNegative, source); } return parseIso8601Format(isNegative, source); } return parseStandardFormat(isNegative, source); }
[ "public", "static", "CqlDuration", "from", "(", "@", "NonNull", "String", "input", ")", "{", "boolean", "isNegative", "=", "input", ".", "startsWith", "(", "\"-\"", ")", ";", "String", "source", "=", "isNegative", "?", "input", ".", "substring", "(", "1", ")", ":", "input", ";", "if", "(", "source", ".", "startsWith", "(", "\"P\"", ")", ")", "{", "if", "(", "source", ".", "endsWith", "(", "\"W\"", ")", ")", "{", "return", "parseIso8601WeekFormat", "(", "isNegative", ",", "source", ")", ";", "}", "if", "(", "source", ".", "contains", "(", "\"-\"", ")", ")", "{", "return", "parseIso8601AlternativeFormat", "(", "isNegative", ",", "source", ")", ";", "}", "return", "parseIso8601Format", "(", "isNegative", ",", "source", ")", ";", "}", "return", "parseStandardFormat", "(", "isNegative", ",", "source", ")", ";", "}" ]
Converts a <code>String</code> into a duration. <p>The accepted formats are: <ul> <li>multiple digits followed by a time unit like: 12h30m where the time unit can be: <ul> <li>{@code y}: years <li>{@code m}: months <li>{@code w}: weeks <li>{@code d}: days <li>{@code h}: hours <li>{@code m}: minutes <li>{@code s}: seconds <li>{@code ms}: milliseconds <li>{@code us} or {@code µs}: microseconds <li>{@code ns}: nanoseconds </ul> <li>ISO 8601 format: P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W <li>ISO 8601 alternative format: P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss] </ul> @param input the <code>String</code> to convert
[ "Converts", "a", "<code", ">", "String<", "/", "code", ">", "into", "a", "duration", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/api/core/data/CqlDuration.java#L134-L148
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java
CliDirectory.autoCompleteCommand
public AutoComplete autoCompleteCommand(String prefix) { """ Auto complete the given prefix with child command possibilities. @param prefix Prefix to offer auto complete for. @return Auto complete for the child {@link CliCommand}s that starts with the given prefix. Case insensitive. """ final Trie<CliValueType> possibilities = childCommands.subTrie(prefix).mapValues(CliValueType.COMMAND.<CliCommand>getMapper()); return new AutoComplete(prefix, possibilities); }
java
public AutoComplete autoCompleteCommand(String prefix) { final Trie<CliValueType> possibilities = childCommands.subTrie(prefix).mapValues(CliValueType.COMMAND.<CliCommand>getMapper()); return new AutoComplete(prefix, possibilities); }
[ "public", "AutoComplete", "autoCompleteCommand", "(", "String", "prefix", ")", "{", "final", "Trie", "<", "CliValueType", ">", "possibilities", "=", "childCommands", ".", "subTrie", "(", "prefix", ")", ".", "mapValues", "(", "CliValueType", ".", "COMMAND", ".", "<", "CliCommand", ">", "getMapper", "(", ")", ")", ";", "return", "new", "AutoComplete", "(", "prefix", ",", "possibilities", ")", ";", "}" ]
Auto complete the given prefix with child command possibilities. @param prefix Prefix to offer auto complete for. @return Auto complete for the child {@link CliCommand}s that starts with the given prefix. Case insensitive.
[ "Auto", "complete", "the", "given", "prefix", "with", "child", "command", "possibilities", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java#L133-L136
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java
FailOverExecutionControlProvider.generate
@Override public ExecutionControl generate(ExecutionEnv env, Map<String, String> parameters) throws Throwable { """ Create and return a locally executing {@code ExecutionControl} instance. At least one parameter should have a spec. @param env the execution environment, provided by JShell @param parameters the modified parameter map. @return the execution engine @throws Throwable if all the given providers fail, the exception that occurred on the first attempt to create the execution engine. """ Throwable thrown = null; for (int i = 0; i <= 9; ++i) { String param = parameters.get("" + i); if (param != null && !param.isEmpty()) { try { ExecutionControl ec = ExecutionControl.generate(env, param); logger().finest( String.format("FailOverExecutionControlProvider: Success %s -- %d = %s\n", name(), i, param)); return ec; } catch (Throwable ex) { logger().warning( String.format("FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\n", name(), i, param, ex.toString())); StringWriter writer = new StringWriter(); PrintWriter log = new PrintWriter(writer); log.println("FailOverExecutionControlProvider:"); ex.printStackTrace(log); log.flush(); logger().fine(writer.toString()); // only care about the first, and only if they all fail if (thrown == null) { thrown = ex; } } } } logger().severe("FailOverExecutionControlProvider: Terminating, failovers exhausted"); if (thrown == null) { throw new IllegalArgumentException("All least one parameter must be set to a provider."); } throw thrown; }
java
@Override public ExecutionControl generate(ExecutionEnv env, Map<String, String> parameters) throws Throwable { Throwable thrown = null; for (int i = 0; i <= 9; ++i) { String param = parameters.get("" + i); if (param != null && !param.isEmpty()) { try { ExecutionControl ec = ExecutionControl.generate(env, param); logger().finest( String.format("FailOverExecutionControlProvider: Success %s -- %d = %s\n", name(), i, param)); return ec; } catch (Throwable ex) { logger().warning( String.format("FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\n", name(), i, param, ex.toString())); StringWriter writer = new StringWriter(); PrintWriter log = new PrintWriter(writer); log.println("FailOverExecutionControlProvider:"); ex.printStackTrace(log); log.flush(); logger().fine(writer.toString()); // only care about the first, and only if they all fail if (thrown == null) { thrown = ex; } } } } logger().severe("FailOverExecutionControlProvider: Terminating, failovers exhausted"); if (thrown == null) { throw new IllegalArgumentException("All least one parameter must be set to a provider."); } throw thrown; }
[ "@", "Override", "public", "ExecutionControl", "generate", "(", "ExecutionEnv", "env", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "Throwable", "{", "Throwable", "thrown", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "9", ";", "++", "i", ")", "{", "String", "param", "=", "parameters", ".", "get", "(", "\"\"", "+", "i", ")", ";", "if", "(", "param", "!=", "null", "&&", "!", "param", ".", "isEmpty", "(", ")", ")", "{", "try", "{", "ExecutionControl", "ec", "=", "ExecutionControl", ".", "generate", "(", "env", ",", "param", ")", ";", "logger", "(", ")", ".", "finest", "(", "String", ".", "format", "(", "\"FailOverExecutionControlProvider: Success %s -- %d = %s\\n\"", ",", "name", "(", ")", ",", "i", ",", "param", ")", ")", ";", "return", "ec", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "logger", "(", ")", ".", "warning", "(", "String", ".", "format", "(", "\"FailOverExecutionControlProvider: Failure %s -- %d = %s -- %s\\n\"", ",", "name", "(", ")", ",", "i", ",", "param", ",", "ex", ".", "toString", "(", ")", ")", ")", ";", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "log", "=", "new", "PrintWriter", "(", "writer", ")", ";", "log", ".", "println", "(", "\"FailOverExecutionControlProvider:\"", ")", ";", "ex", ".", "printStackTrace", "(", "log", ")", ";", "log", ".", "flush", "(", ")", ";", "logger", "(", ")", ".", "fine", "(", "writer", ".", "toString", "(", ")", ")", ";", "// only care about the first, and only if they all fail", "if", "(", "thrown", "==", "null", ")", "{", "thrown", "=", "ex", ";", "}", "}", "}", "}", "logger", "(", ")", ".", "severe", "(", "\"FailOverExecutionControlProvider: Terminating, failovers exhausted\"", ")", ";", "if", "(", "thrown", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All least one parameter must be set to a provider.\"", ")", ";", "}", "throw", "thrown", ";", "}" ]
Create and return a locally executing {@code ExecutionControl} instance. At least one parameter should have a spec. @param env the execution environment, provided by JShell @param parameters the modified parameter map. @return the execution engine @throws Throwable if all the given providers fail, the exception that occurred on the first attempt to create the execution engine.
[ "Create", "and", "return", "a", "locally", "executing", "{", "@code", "ExecutionControl", "}", "instance", ".", "At", "least", "one", "parameter", "should", "have", "a", "spec", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java#L95-L131
dnsjava/dnsjava
org/xbill/DNS/TSIG.java
TSIG.apply
public void apply(Message m, TSIGRecord old) { """ Generates a TSIG record for a message and adds it to the message @param m The message @param old If this message is a response, the TSIG from the request """ apply(m, Rcode.NOERROR, old); }
java
public void apply(Message m, TSIGRecord old) { apply(m, Rcode.NOERROR, old); }
[ "public", "void", "apply", "(", "Message", "m", ",", "TSIGRecord", "old", ")", "{", "apply", "(", "m", ",", "Rcode", ".", "NOERROR", ",", "old", ")", ";", "}" ]
Generates a TSIG record for a message and adds it to the message @param m The message @param old If this message is a response, the TSIG from the request
[ "Generates", "a", "TSIG", "record", "for", "a", "message", "and", "adds", "it", "to", "the", "message" ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TSIG.java#L362-L365
ZieIony/Carbon
carbon/src/main/java/carbon/shadow/ShapePath.java
ShapePath.addConnectingShadowIfNecessary
private void addConnectingShadowIfNecessary(float nextShadowAngle) { """ Create an {@link ArcShadowOperation} to fill in a shadow between the currently drawn shadow and the next shadow angle, if there would be a gap. """ if (currentShadowAngle == nextShadowAngle) { // Previously drawn shadow lines up with the next shadow, so don't draw anything. return; } float shadowSweep = (nextShadowAngle - currentShadowAngle + 360) % 360; if (shadowSweep > 180) { // Shadows are actually overlapping, so don't draw anything. return; } PathArcOperation pathArcOperation = new PathArcOperation(endX, endY, endX, endY); pathArcOperation.startAngle = currentShadowAngle; pathArcOperation.sweepAngle = shadowSweep; shadowCompatOperations.add(new ArcShadowOperation(pathArcOperation)); currentShadowAngle = nextShadowAngle; }
java
private void addConnectingShadowIfNecessary(float nextShadowAngle) { if (currentShadowAngle == nextShadowAngle) { // Previously drawn shadow lines up with the next shadow, so don't draw anything. return; } float shadowSweep = (nextShadowAngle - currentShadowAngle + 360) % 360; if (shadowSweep > 180) { // Shadows are actually overlapping, so don't draw anything. return; } PathArcOperation pathArcOperation = new PathArcOperation(endX, endY, endX, endY); pathArcOperation.startAngle = currentShadowAngle; pathArcOperation.sweepAngle = shadowSweep; shadowCompatOperations.add(new ArcShadowOperation(pathArcOperation)); currentShadowAngle = nextShadowAngle; }
[ "private", "void", "addConnectingShadowIfNecessary", "(", "float", "nextShadowAngle", ")", "{", "if", "(", "currentShadowAngle", "==", "nextShadowAngle", ")", "{", "// Previously drawn shadow lines up with the next shadow, so don't draw anything.", "return", ";", "}", "float", "shadowSweep", "=", "(", "nextShadowAngle", "-", "currentShadowAngle", "+", "360", ")", "%", "360", ";", "if", "(", "shadowSweep", ">", "180", ")", "{", "// Shadows are actually overlapping, so don't draw anything.", "return", ";", "}", "PathArcOperation", "pathArcOperation", "=", "new", "PathArcOperation", "(", "endX", ",", "endY", ",", "endX", ",", "endY", ")", ";", "pathArcOperation", ".", "startAngle", "=", "currentShadowAngle", ";", "pathArcOperation", ".", "sweepAngle", "=", "shadowSweep", ";", "shadowCompatOperations", ".", "add", "(", "new", "ArcShadowOperation", "(", "pathArcOperation", ")", ")", ";", "currentShadowAngle", "=", "nextShadowAngle", ";", "}" ]
Create an {@link ArcShadowOperation} to fill in a shadow between the currently drawn shadow and the next shadow angle, if there would be a gap.
[ "Create", "an", "{" ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/shadow/ShapePath.java#L200-L215
line/armeria
core/src/main/java/com/linecorp/armeria/client/endpoint/EndpointGroupRegistry.java
EndpointGroupRegistry.selectNode
public static Endpoint selectNode(ClientRequestContext ctx, String groupName) { """ Selects an {@link Endpoint} from the {@link EndpointGroup} associated with the specified {@link ClientRequestContext} and case-insensitive {@code groupName}. """ groupName = normalizeGroupName(groupName); final EndpointSelector endpointSelector = getNodeSelector(groupName); if (endpointSelector == null) { throw new EndpointGroupException("non-existent EndpointGroup: " + groupName); } return endpointSelector.select(ctx); }
java
public static Endpoint selectNode(ClientRequestContext ctx, String groupName) { groupName = normalizeGroupName(groupName); final EndpointSelector endpointSelector = getNodeSelector(groupName); if (endpointSelector == null) { throw new EndpointGroupException("non-existent EndpointGroup: " + groupName); } return endpointSelector.select(ctx); }
[ "public", "static", "Endpoint", "selectNode", "(", "ClientRequestContext", "ctx", ",", "String", "groupName", ")", "{", "groupName", "=", "normalizeGroupName", "(", "groupName", ")", ";", "final", "EndpointSelector", "endpointSelector", "=", "getNodeSelector", "(", "groupName", ")", ";", "if", "(", "endpointSelector", "==", "null", ")", "{", "throw", "new", "EndpointGroupException", "(", "\"non-existent EndpointGroup: \"", "+", "groupName", ")", ";", "}", "return", "endpointSelector", ".", "select", "(", "ctx", ")", ";", "}" ]
Selects an {@link Endpoint} from the {@link EndpointGroup} associated with the specified {@link ClientRequestContext} and case-insensitive {@code groupName}.
[ "Selects", "an", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/endpoint/EndpointGroupRegistry.java#L113-L121
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/BaseLexicon.java
BaseLexicon.ruleIteratorByWord
public Iterator<IntTaggedWord> ruleIteratorByWord(String word, int loc) { """ Returns the possible POS taggings for a word. @param word The word, represented as an integer in wordIndex @param loc The position of the word in the sentence (counting from 0). <i>Implementation note: The BaseLexicon class doesn't actually make use of this position information.</i> @return An Iterator over a List ofIntTaggedWords, which pair the word with possible taggings as integer pairs. (Each can be thought of as a <code>tag -&gt; word<code> rule.) """ return ruleIteratorByWord(wordIndex.indexOf(word, true), loc, null); }
java
public Iterator<IntTaggedWord> ruleIteratorByWord(String word, int loc) { return ruleIteratorByWord(wordIndex.indexOf(word, true), loc, null); }
[ "public", "Iterator", "<", "IntTaggedWord", ">", "ruleIteratorByWord", "(", "String", "word", ",", "int", "loc", ")", "{", "return", "ruleIteratorByWord", "(", "wordIndex", ".", "indexOf", "(", "word", ",", "true", ")", ",", "loc", ",", "null", ")", ";", "}" ]
Returns the possible POS taggings for a word. @param word The word, represented as an integer in wordIndex @param loc The position of the word in the sentence (counting from 0). <i>Implementation note: The BaseLexicon class doesn't actually make use of this position information.</i> @return An Iterator over a List ofIntTaggedWords, which pair the word with possible taggings as integer pairs. (Each can be thought of as a <code>tag -&gt; word<code> rule.)
[ "Returns", "the", "possible", "POS", "taggings", "for", "a", "word", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/BaseLexicon.java#L184-L186
dihedron/dihedron-commons
src/main/java/org/dihedron/patterns/cache/CacheHelper.java
CacheHelper.getIntoByteArray
public static byte[] getIntoByteArray(Cache cache, String resource, CacheMissHandler ... handlers) throws CacheException { """ Retrieves the given resource from the cache and translate it to a byte array; if missing tries to retrieve it using the (optional) provided set of handlers. @param cache the cache that stores the resource. @param resource the name of the resource to be retrieved. @param handlers the (optional) set of handlers that will attempt to retrieve the resource if missing from the cache. @return the resource as an array of bytes, or {@code null} if it cannot be retrieved. @throws CacheException """ if(cache == null) { logger.error("cache reference must not be null"); throw new CacheException("invalid cache"); } InputStream input = null; ByteArrayOutputStream output = null; try { input = cache.get(resource, handlers); if(input != null) { output = new ByteArrayOutputStream(); long copied = Streams.copy(input, output); logger.trace("copied {} bytes from cache", copied); return output.toByteArray(); } } catch (IOException e) { logger.error("error copying data from cache to byte array", e); throw new CacheException("error copying data from cache to byte array", e); } finally { Streams.safelyClose(input); Streams.safelyClose(output); } return null; }
java
public static byte[] getIntoByteArray(Cache cache, String resource, CacheMissHandler ... handlers) throws CacheException { if(cache == null) { logger.error("cache reference must not be null"); throw new CacheException("invalid cache"); } InputStream input = null; ByteArrayOutputStream output = null; try { input = cache.get(resource, handlers); if(input != null) { output = new ByteArrayOutputStream(); long copied = Streams.copy(input, output); logger.trace("copied {} bytes from cache", copied); return output.toByteArray(); } } catch (IOException e) { logger.error("error copying data from cache to byte array", e); throw new CacheException("error copying data from cache to byte array", e); } finally { Streams.safelyClose(input); Streams.safelyClose(output); } return null; }
[ "public", "static", "byte", "[", "]", "getIntoByteArray", "(", "Cache", "cache", ",", "String", "resource", ",", "CacheMissHandler", "...", "handlers", ")", "throws", "CacheException", "{", "if", "(", "cache", "==", "null", ")", "{", "logger", ".", "error", "(", "\"cache reference must not be null\"", ")", ";", "throw", "new", "CacheException", "(", "\"invalid cache\"", ")", ";", "}", "InputStream", "input", "=", "null", ";", "ByteArrayOutputStream", "output", "=", "null", ";", "try", "{", "input", "=", "cache", ".", "get", "(", "resource", ",", "handlers", ")", ";", "if", "(", "input", "!=", "null", ")", "{", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "long", "copied", "=", "Streams", ".", "copy", "(", "input", ",", "output", ")", ";", "logger", ".", "trace", "(", "\"copied {} bytes from cache\"", ",", "copied", ")", ";", "return", "output", ".", "toByteArray", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"error copying data from cache to byte array\"", ",", "e", ")", ";", "throw", "new", "CacheException", "(", "\"error copying data from cache to byte array\"", ",", "e", ")", ";", "}", "finally", "{", "Streams", ".", "safelyClose", "(", "input", ")", ";", "Streams", ".", "safelyClose", "(", "output", ")", ";", "}", "return", "null", ";", "}" ]
Retrieves the given resource from the cache and translate it to a byte array; if missing tries to retrieve it using the (optional) provided set of handlers. @param cache the cache that stores the resource. @param resource the name of the resource to be retrieved. @param handlers the (optional) set of handlers that will attempt to retrieve the resource if missing from the cache. @return the resource as an array of bytes, or {@code null} if it cannot be retrieved. @throws CacheException
[ "Retrieves", "the", "given", "resource", "from", "the", "cache", "and", "translate", "it", "to", "a", "byte", "array", ";", "if", "missing", "tries", "to", "retrieve", "it", "using", "the", "(", "optional", ")", "provided", "set", "of", "handlers", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/CacheHelper.java#L45-L68
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/progress/ProgressionConsoleMonitor.java
ProgressionConsoleMonitor.setModel
public void setModel(Progression model) { """ Change the task progression model. @param model - the task progression model. """ this.model.removeProgressionListener(new WeakListener(this, this.model)); if (model == null) { this.model = new DefaultProgression(); } else { this.model = model; } this.previousValue = this.model.getValue(); this.model.addProgressionListener(new WeakListener(this, this.model)); }
java
public void setModel(Progression model) { this.model.removeProgressionListener(new WeakListener(this, this.model)); if (model == null) { this.model = new DefaultProgression(); } else { this.model = model; } this.previousValue = this.model.getValue(); this.model.addProgressionListener(new WeakListener(this, this.model)); }
[ "public", "void", "setModel", "(", "Progression", "model", ")", "{", "this", ".", "model", ".", "removeProgressionListener", "(", "new", "WeakListener", "(", "this", ",", "this", ".", "model", ")", ")", ";", "if", "(", "model", "==", "null", ")", "{", "this", ".", "model", "=", "new", "DefaultProgression", "(", ")", ";", "}", "else", "{", "this", ".", "model", "=", "model", ";", "}", "this", ".", "previousValue", "=", "this", ".", "model", ".", "getValue", "(", ")", ";", "this", ".", "model", ".", "addProgressionListener", "(", "new", "WeakListener", "(", "this", ",", "this", ".", "model", ")", ")", ";", "}" ]
Change the task progression model. @param model - the task progression model.
[ "Change", "the", "task", "progression", "model", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/ProgressionConsoleMonitor.java#L69-L78
JDBDT/jdbdt
src/main/java/org/jdbdt/JDBDT.java
JDBDT.assertTableDoesNotExist
@SafeVarargs public static void assertTableDoesNotExist(String message, DB db, String... tableNames) throws DBAssertionError { """ Assert that tables do not exist in a database (error message variant). @param message Error message. @param db Database. @param tableNames Table names. @throws DBAssertionError If the assertion fails. @see #assertTableExists(String, DB, String...) @see #drop(Table...) @since 1.2 """ multipleTableExistenceAssertions(CallInfo.create(message), db, tableNames, false); }
java
@SafeVarargs public static void assertTableDoesNotExist(String message, DB db, String... tableNames) throws DBAssertionError { multipleTableExistenceAssertions(CallInfo.create(message), db, tableNames, false); }
[ "@", "SafeVarargs", "public", "static", "void", "assertTableDoesNotExist", "(", "String", "message", ",", "DB", "db", ",", "String", "...", "tableNames", ")", "throws", "DBAssertionError", "{", "multipleTableExistenceAssertions", "(", "CallInfo", ".", "create", "(", "message", ")", ",", "db", ",", "tableNames", ",", "false", ")", ";", "}" ]
Assert that tables do not exist in a database (error message variant). @param message Error message. @param db Database. @param tableNames Table names. @throws DBAssertionError If the assertion fails. @see #assertTableExists(String, DB, String...) @see #drop(Table...) @since 1.2
[ "Assert", "that", "tables", "do", "not", "exist", "in", "a", "database", "(", "error", "message", "variant", ")", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L842-L845
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.notEmpty
public <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) { """ <p>Validate that the specified argument character sequence is neither {@code null} nor a length of zero (no characters); otherwise throwing an exception with the specified message. </p> <pre>Validate.notEmpty(myString, "The string must not be empty");</pre> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated character sequence (never {@code null} method for chaining) @throws NullPointerValidationException if the character sequence is {@code null} @throws IllegalArgumentException if the character sequence is empty @see #notEmpty(CharSequence) """ if (chars == null) { failNull(String.format(message, values)); } if (chars.length() == 0) { fail(String.format(message, values)); } return chars; }
java
public <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); } if (chars.length() == 0) { fail(String.format(message, values)); } return chars; }
[ "public", "<", "T", "extends", "CharSequence", ">", "T", "notEmpty", "(", "final", "T", "chars", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "chars", "==", "null", ")", "{", "failNull", "(", "String", ".", "format", "(", "message", ",", "values", ")", ")", ";", "}", "if", "(", "chars", ".", "length", "(", ")", "==", "0", ")", "{", "fail", "(", "String", ".", "format", "(", "message", ",", "values", ")", ")", ";", "}", "return", "chars", ";", "}" ]
<p>Validate that the specified argument character sequence is neither {@code null} nor a length of zero (no characters); otherwise throwing an exception with the specified message. </p> <pre>Validate.notEmpty(myString, "The string must not be empty");</pre> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated character sequence (never {@code null} method for chaining) @throws NullPointerValidationException if the character sequence is {@code null} @throws IllegalArgumentException if the character sequence is empty @see #notEmpty(CharSequence)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "is", "neither", "{", "@code", "null", "}", "nor", "a", "length", "of", "zero", "(", "no", "characters", ")", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p", ">", "<pre", ">", "Validate", ".", "notEmpty", "(", "myString", "The", "string", "must", "not", "be", "empty", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L719-L727
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java
ModelSaveAction.makeModel
protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler) throws Exception { """ create a Model from the jdonframework.xml @param actionMapping @param actionForm @param request @return Model @throws java.lang.Exception """ Object model = null; try { String formName = actionMapping.getName(); if (formName == null) throw new Exception("no define the FormName in struts_config.xml"); ModelMapping modelMapping = modelHandler.getModelMapping(); String keyName = modelMapping.getKeyName(); String keyValue = request.getParameter(keyName); if (keyValue == null) { Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module); } modelManager.removeCache(keyValue); Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module); model = modelManager.getModelObject(formName); } catch (Exception e) { Debug.logError("[JdonFramework] makeModel error: " + e); throw new Exception(e); } return model; }
java
protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler) throws Exception { Object model = null; try { String formName = actionMapping.getName(); if (formName == null) throw new Exception("no define the FormName in struts_config.xml"); ModelMapping modelMapping = modelHandler.getModelMapping(); String keyName = modelMapping.getKeyName(); String keyValue = request.getParameter(keyName); if (keyValue == null) { Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module); } modelManager.removeCache(keyValue); Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module); model = modelManager.getModelObject(formName); } catch (Exception e) { Debug.logError("[JdonFramework] makeModel error: " + e); throw new Exception(e); } return model; }
[ "protected", "Object", "makeModel", "(", "ActionMapping", "actionMapping", ",", "ActionForm", "actionForm", ",", "HttpServletRequest", "request", ",", "ModelHandler", "modelHandler", ")", "throws", "Exception", "{", "Object", "model", "=", "null", ";", "try", "{", "String", "formName", "=", "actionMapping", ".", "getName", "(", ")", ";", "if", "(", "formName", "==", "null", ")", "throw", "new", "Exception", "(", "\"no define the FormName in struts_config.xml\"", ")", ";", "ModelMapping", "modelMapping", "=", "modelHandler", ".", "getModelMapping", "(", ")", ";", "String", "keyName", "=", "modelMapping", ".", "getKeyName", "(", ")", ";", "String", "keyValue", "=", "request", ".", "getParameter", "(", "keyName", ")", ";", "if", "(", "keyValue", "==", "null", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! \"", ",", "module", ")", ";", "}", "modelManager", ".", "removeCache", "(", "keyValue", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] no model cache, keyName is \"", "+", "keyName", ",", "module", ")", ";", "model", "=", "modelManager", ".", "getModelObject", "(", "formName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework] makeModel error: \"", "+", "e", ")", ";", "throw", "new", "Exception", "(", "e", ")", ";", "}", "return", "model", ";", "}" ]
create a Model from the jdonframework.xml @param actionMapping @param actionForm @param request @return Model @throws java.lang.Exception
[ "create", "a", "Model", "from", "the", "jdonframework", ".", "xml" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java#L142-L166
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java
Instrumented.getMetricContext
public static MetricContext getMetricContext(State state, Class<?> klazz) { """ Gets metric context with no additional tags. See {@link #getMetricContext(State, Class, List)} """ return getMetricContext(state, klazz, new ArrayList<Tag<?>>()); }
java
public static MetricContext getMetricContext(State state, Class<?> klazz) { return getMetricContext(state, klazz, new ArrayList<Tag<?>>()); }
[ "public", "static", "MetricContext", "getMetricContext", "(", "State", "state", ",", "Class", "<", "?", ">", "klazz", ")", "{", "return", "getMetricContext", "(", "state", ",", "klazz", ",", "new", "ArrayList", "<", "Tag", "<", "?", ">", ">", "(", ")", ")", ";", "}" ]
Gets metric context with no additional tags. See {@link #getMetricContext(State, Class, List)}
[ "Gets", "metric", "context", "with", "no", "additional", "tags", ".", "See", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java#L90-L92
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/resources/uac/RoleResource1.java
RoleResource1.updateRoleFromUpdateRequest
@PUT @Path(" { """ Alternate endpoint for updating a role. Although not REST compliant it provides a more flexible interface for specifying role attributes, such as by supporting partial updates. """group}/{id}") @Consumes("application/x.json-update-role") public SuccessResponse updateRoleFromUpdateRequest(@PathParam("group") String group, @PathParam("id") String id, UpdateEmoRoleRequest request, @Authenticated Subject subject) { _uac.updateRole(subject, request.setRoleKey(new EmoRoleKey(group, id))); return SuccessResponse.instance(); }
java
@PUT @Path("{group}/{id}") @Consumes("application/x.json-update-role") public SuccessResponse updateRoleFromUpdateRequest(@PathParam("group") String group, @PathParam("id") String id, UpdateEmoRoleRequest request, @Authenticated Subject subject) { _uac.updateRole(subject, request.setRoleKey(new EmoRoleKey(group, id))); return SuccessResponse.instance(); }
[ "@", "PUT", "@", "Path", "(", "\"{group}/{id}\"", ")", "@", "Consumes", "(", "\"application/x.json-update-role\"", ")", "public", "SuccessResponse", "updateRoleFromUpdateRequest", "(", "@", "PathParam", "(", "\"group\"", ")", "String", "group", ",", "@", "PathParam", "(", "\"id\"", ")", "String", "id", ",", "UpdateEmoRoleRequest", "request", ",", "@", "Authenticated", "Subject", "subject", ")", "{", "_uac", ".", "updateRole", "(", "subject", ",", "request", ".", "setRoleKey", "(", "new", "EmoRoleKey", "(", "group", ",", "id", ")", ")", ")", ";", "return", "SuccessResponse", ".", "instance", "(", ")", ";", "}" ]
Alternate endpoint for updating a role. Although not REST compliant it provides a more flexible interface for specifying role attributes, such as by supporting partial updates.
[ "Alternate", "endpoint", "for", "updating", "a", "role", ".", "Although", "not", "REST", "compliant", "it", "provides", "a", "more", "flexible", "interface", "for", "specifying", "role", "attributes", "such", "as", "by", "supporting", "partial", "updates", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/resources/uac/RoleResource1.java#L137-L144
podio/podio-java
src/main/java/com/podio/rating/RatingAPI.java
RatingAPI.createRating
public int createRating(Reference reference, RatingType type, int value) { """ Add a new rating of the user to the object. The rating can be one of many different types. For more details see the area. Ratings can be changed by posting a new rating, and deleted by doing a DELETE. @param reference The reference to the object the rating should be created on @param type The type of the rating @param value The value for the rating @return The id of the newly created rating @see RatingValue """ return getResourceFactory() .getApiResource("/rating/" + reference.toURLFragment() + type) .entity(Collections.singletonMap("value", value), MediaType.APPLICATION_JSON_TYPE) .post(RatingCreateResponse.class).getId(); }
java
public int createRating(Reference reference, RatingType type, int value) { return getResourceFactory() .getApiResource("/rating/" + reference.toURLFragment() + type) .entity(Collections.singletonMap("value", value), MediaType.APPLICATION_JSON_TYPE) .post(RatingCreateResponse.class).getId(); }
[ "public", "int", "createRating", "(", "Reference", "reference", ",", "RatingType", "type", ",", "int", "value", ")", "{", "return", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/rating/\"", "+", "reference", ".", "toURLFragment", "(", ")", "+", "type", ")", ".", "entity", "(", "Collections", ".", "singletonMap", "(", "\"value\"", ",", "value", ")", ",", "MediaType", ".", "APPLICATION_JSON_TYPE", ")", ".", "post", "(", "RatingCreateResponse", ".", "class", ")", ".", "getId", "(", ")", ";", "}" ]
Add a new rating of the user to the object. The rating can be one of many different types. For more details see the area. Ratings can be changed by posting a new rating, and deleted by doing a DELETE. @param reference The reference to the object the rating should be created on @param type The type of the rating @param value The value for the rating @return The id of the newly created rating @see RatingValue
[ "Add", "a", "new", "rating", "of", "the", "user", "to", "the", "object", ".", "The", "rating", "can", "be", "one", "of", "many", "different", "types", ".", "For", "more", "details", "see", "the", "area", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/rating/RatingAPI.java#L41-L47
j256/simplejmx
src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java
ObjectNameUtil.makeObjectName
public static ObjectName makeObjectName(Object obj) { """ Constructs an object-name from an object that is detected either having the {@link JmxResource} annotation or implementing {@link JmxSelfNaming}. @param obj Object for which we are creating our ObjectName @throws IllegalArgumentException If we had problems building the name """ JmxResource jmxResource = obj.getClass().getAnnotation(JmxResource.class); if (obj instanceof JmxSelfNaming) { return makeObjectName(jmxResource, (JmxSelfNaming) obj); } else { if (jmxResource == null) { throw new IllegalArgumentException( "Registered class must either implement JmxSelfNaming or have JmxResource annotation"); } return makeObjectName(jmxResource, obj); } }
java
public static ObjectName makeObjectName(Object obj) { JmxResource jmxResource = obj.getClass().getAnnotation(JmxResource.class); if (obj instanceof JmxSelfNaming) { return makeObjectName(jmxResource, (JmxSelfNaming) obj); } else { if (jmxResource == null) { throw new IllegalArgumentException( "Registered class must either implement JmxSelfNaming or have JmxResource annotation"); } return makeObjectName(jmxResource, obj); } }
[ "public", "static", "ObjectName", "makeObjectName", "(", "Object", "obj", ")", "{", "JmxResource", "jmxResource", "=", "obj", ".", "getClass", "(", ")", ".", "getAnnotation", "(", "JmxResource", ".", "class", ")", ";", "if", "(", "obj", "instanceof", "JmxSelfNaming", ")", "{", "return", "makeObjectName", "(", "jmxResource", ",", "(", "JmxSelfNaming", ")", "obj", ")", ";", "}", "else", "{", "if", "(", "jmxResource", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Registered class must either implement JmxSelfNaming or have JmxResource annotation\"", ")", ";", "}", "return", "makeObjectName", "(", "jmxResource", ",", "obj", ")", ";", "}", "}" ]
Constructs an object-name from an object that is detected either having the {@link JmxResource} annotation or implementing {@link JmxSelfNaming}. @param obj Object for which we are creating our ObjectName @throws IllegalArgumentException If we had problems building the name
[ "Constructs", "an", "object", "-", "name", "from", "an", "object", "that", "is", "detected", "either", "having", "the", "{", "@link", "JmxResource", "}", "annotation", "or", "implementing", "{", "@link", "JmxSelfNaming", "}", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/common/ObjectNameUtil.java#L148-L159
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/knxnetip/util/CRD.java
CRD.createResponse
public static CRD createResponse(byte[] data, int offset) throws KNXFormatException { """ Creates a new CRD out of a byte array. <p> If possible, a matching, more specific, CRD subtype is returned. Note, that CRD for specific communication types might expect certain characteristics on <code>data</code> (regarding contained data).<br> @param data byte array containing the CRD structure @param offset start offset of CRD in <code>data</code> @return the new CRD object @throws KNXFormatException if no CRD found or invalid structure """ return (CRD) create(false, data, offset); }
java
public static CRD createResponse(byte[] data, int offset) throws KNXFormatException { return (CRD) create(false, data, offset); }
[ "public", "static", "CRD", "createResponse", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "throws", "KNXFormatException", "{", "return", "(", "CRD", ")", "create", "(", "false", ",", "data", ",", "offset", ")", ";", "}" ]
Creates a new CRD out of a byte array. <p> If possible, a matching, more specific, CRD subtype is returned. Note, that CRD for specific communication types might expect certain characteristics on <code>data</code> (regarding contained data).<br> @param data byte array containing the CRD structure @param offset start offset of CRD in <code>data</code> @return the new CRD object @throws KNXFormatException if no CRD found or invalid structure
[ "Creates", "a", "new", "CRD", "out", "of", "a", "byte", "array", ".", "<p", ">", "If", "possible", "a", "matching", "more", "specific", "CRD", "subtype", "is", "returned", ".", "Note", "that", "CRD", "for", "specific", "communication", "types", "might", "expect", "certain", "characteristics", "on", "<code", ">", "data<", "/", "code", ">", "(", "regarding", "contained", "data", ")", ".", "<br", ">" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/knxnetip/util/CRD.java#L120-L123
wcm-io/wcm-io-handler
richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java
RichTextUtil.parseText
public static @NotNull Element parseText(@NotNull String text, boolean xhtmlEntities) throws JDOMException { """ Parses XHTML text string. Adds a wrapping "root" element before parsing and returns this root element. @param text XHTML text string (root element not needed) @param xhtmlEntities If set to true, Resolving of XHtml entities in XHtml fragment is supported. @return Root element with parsed xhtml content @throws JDOMException Is thrown if the text could not be parsed as XHTML """ // add root element String xhtmlString = (xhtmlEntities ? "<!DOCTYPE root [" + XHTML_ENTITY_DEF + "]>" : "") + "<root>" + text + "</root>"; try { SAXBuilder saxBuilder = new SAXBuilder(); if (xhtmlEntities) { saxBuilder.setEntityResolver(XHtmlEntityResolver.getInstance()); } Document doc = saxBuilder.build(new StringReader(xhtmlString)); return doc.getRootElement(); } catch (IOException ex) { throw new RuntimeException("Error parsing XHTML fragment.", ex); } }
java
public static @NotNull Element parseText(@NotNull String text, boolean xhtmlEntities) throws JDOMException { // add root element String xhtmlString = (xhtmlEntities ? "<!DOCTYPE root [" + XHTML_ENTITY_DEF + "]>" : "") + "<root>" + text + "</root>"; try { SAXBuilder saxBuilder = new SAXBuilder(); if (xhtmlEntities) { saxBuilder.setEntityResolver(XHtmlEntityResolver.getInstance()); } Document doc = saxBuilder.build(new StringReader(xhtmlString)); return doc.getRootElement(); } catch (IOException ex) { throw new RuntimeException("Error parsing XHTML fragment.", ex); } }
[ "public", "static", "@", "NotNull", "Element", "parseText", "(", "@", "NotNull", "String", "text", ",", "boolean", "xhtmlEntities", ")", "throws", "JDOMException", "{", "// add root element", "String", "xhtmlString", "=", "(", "xhtmlEntities", "?", "\"<!DOCTYPE root [\"", "+", "XHTML_ENTITY_DEF", "+", "\"]>\"", ":", "\"\"", ")", "+", "\"<root>\"", "+", "text", "+", "\"</root>\"", ";", "try", "{", "SAXBuilder", "saxBuilder", "=", "new", "SAXBuilder", "(", ")", ";", "if", "(", "xhtmlEntities", ")", "{", "saxBuilder", ".", "setEntityResolver", "(", "XHtmlEntityResolver", ".", "getInstance", "(", ")", ")", ";", "}", "Document", "doc", "=", "saxBuilder", ".", "build", "(", "new", "StringReader", "(", "xhtmlString", ")", ")", ";", "return", "doc", ".", "getRootElement", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error parsing XHTML fragment.\"", ",", "ex", ")", ";", "}", "}" ]
Parses XHTML text string. Adds a wrapping "root" element before parsing and returns this root element. @param text XHTML text string (root element not needed) @param xhtmlEntities If set to true, Resolving of XHtml entities in XHtml fragment is supported. @return Root element with parsed xhtml content @throws JDOMException Is thrown if the text could not be parsed as XHTML
[ "Parses", "XHTML", "text", "string", ".", "Adds", "a", "wrapping", "root", "element", "before", "parsing", "and", "returns", "this", "root", "element", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java#L141-L162
js-lib-com/dom
src/main/java/js/dom/w3c/DocumentImpl.java
DocumentImpl.evaluateXPathNodeList
EList evaluateXPathNodeList(Node contextNode, String expression, Object... args) { """ Evaluate XPath expression expected to return nodes list. Evaluate expression and return result nodes as elements list. @param contextNode evaluation context node, @param expression XPath expression, formatting tags supported, @param args optional formatting arguments. @return list of result elements, possible empty. """ return evaluateXPathNodeListNS(contextNode, null, expression, args); }
java
EList evaluateXPathNodeList(Node contextNode, String expression, Object... args) { return evaluateXPathNodeListNS(contextNode, null, expression, args); }
[ "EList", "evaluateXPathNodeList", "(", "Node", "contextNode", ",", "String", "expression", ",", "Object", "...", "args", ")", "{", "return", "evaluateXPathNodeListNS", "(", "contextNode", ",", "null", ",", "expression", ",", "args", ")", ";", "}" ]
Evaluate XPath expression expected to return nodes list. Evaluate expression and return result nodes as elements list. @param contextNode evaluation context node, @param expression XPath expression, formatting tags supported, @param args optional formatting arguments. @return list of result elements, possible empty.
[ "Evaluate", "XPath", "expression", "expected", "to", "return", "nodes", "list", ".", "Evaluate", "expression", "and", "return", "result", "nodes", "as", "elements", "list", "." ]
train
https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L337-L339
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java
ExtensionRegistry.initializeParsers
public final void initializeParsers(final Extension extension, final String moduleName, final XMLMapper xmlMapper) { """ Ask the given {@code extension} to {@link Extension#initializeParsers(ExtensionParsingContext) initialize its parsers}. Should be used in preference to calling {@link #getExtensionParsingContext(String, XMLMapper)} and passing the returned value to {@code Extension#initializeParsers(context)} as this method allows the registry to take additional action when the extension is done. @param extension the extension. Cannot be {@code null} @param moduleName the name of the extension's module. Cannot be {@code null} @param xmlMapper the {@link XMLMapper} handling the extension parsing. Can be {@code null} if there won't be any actual parsing (e.g. in a slave Host Controller or in a server in a managed domain) """ ExtensionParsingContextImpl parsingContext = new ExtensionParsingContextImpl(moduleName, xmlMapper); extension.initializeParsers(parsingContext); parsingContext.attemptCurrentParserInitialization(); }
java
public final void initializeParsers(final Extension extension, final String moduleName, final XMLMapper xmlMapper) { ExtensionParsingContextImpl parsingContext = new ExtensionParsingContextImpl(moduleName, xmlMapper); extension.initializeParsers(parsingContext); parsingContext.attemptCurrentParserInitialization(); }
[ "public", "final", "void", "initializeParsers", "(", "final", "Extension", "extension", ",", "final", "String", "moduleName", ",", "final", "XMLMapper", "xmlMapper", ")", "{", "ExtensionParsingContextImpl", "parsingContext", "=", "new", "ExtensionParsingContextImpl", "(", "moduleName", ",", "xmlMapper", ")", ";", "extension", ".", "initializeParsers", "(", "parsingContext", ")", ";", "parsingContext", ".", "attemptCurrentParserInitialization", "(", ")", ";", "}" ]
Ask the given {@code extension} to {@link Extension#initializeParsers(ExtensionParsingContext) initialize its parsers}. Should be used in preference to calling {@link #getExtensionParsingContext(String, XMLMapper)} and passing the returned value to {@code Extension#initializeParsers(context)} as this method allows the registry to take additional action when the extension is done. @param extension the extension. Cannot be {@code null} @param moduleName the name of the extension's module. Cannot be {@code null} @param xmlMapper the {@link XMLMapper} handling the extension parsing. Can be {@code null} if there won't be any actual parsing (e.g. in a slave Host Controller or in a server in a managed domain)
[ "Ask", "the", "given", "{", "@code", "extension", "}", "to", "{", "@link", "Extension#initializeParsers", "(", "ExtensionParsingContext", ")", "initialize", "its", "parsers", "}", ".", "Should", "be", "used", "in", "preference", "to", "calling", "{", "@link", "#getExtensionParsingContext", "(", "String", "XMLMapper", ")", "}", "and", "passing", "the", "returned", "value", "to", "{", "@code", "Extension#initializeParsers", "(", "context", ")", "}", "as", "this", "method", "allows", "the", "registry", "to", "take", "additional", "action", "when", "the", "extension", "is", "done", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java#L246-L250
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpRequestBuilder.java
FoxHttpRequestBuilder.registerFoxHttpInterceptor
public FoxHttpRequestBuilder registerFoxHttpInterceptor(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException { """ Register an interceptor @param interceptorType Type of the interceptor @param foxHttpInterceptor Interceptor instance @return FoxHttpClientBuilder (this) @throws FoxHttpException Throws an exception if the interceptor does not match the type """ foxHttpRequest.getFoxHttpClient().register(interceptorType, foxHttpInterceptor); return this; }
java
public FoxHttpRequestBuilder registerFoxHttpInterceptor(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException { foxHttpRequest.getFoxHttpClient().register(interceptorType, foxHttpInterceptor); return this; }
[ "public", "FoxHttpRequestBuilder", "registerFoxHttpInterceptor", "(", "FoxHttpInterceptorType", "interceptorType", ",", "FoxHttpInterceptor", "foxHttpInterceptor", ")", "throws", "FoxHttpException", "{", "foxHttpRequest", ".", "getFoxHttpClient", "(", ")", ".", "register", "(", "interceptorType", ",", "foxHttpInterceptor", ")", ";", "return", "this", ";", "}" ]
Register an interceptor @param interceptorType Type of the interceptor @param foxHttpInterceptor Interceptor instance @return FoxHttpClientBuilder (this) @throws FoxHttpException Throws an exception if the interceptor does not match the type
[ "Register", "an", "interceptor" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpRequestBuilder.java#L239-L242
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/ByteIOUtils.java
ByteIOUtils.writeShort
public static void writeShort(byte[] buf, int pos, short v) { """ Writes a specific short value (2 bytes) to the output byte buffer at the given offset. @param buf output byte buffer @param pos offset into the byte buffer to write @param v short value to write """ checkBoundary(buf, pos, 2); buf[pos++] = (byte) (0xff & (v >> 8)); buf[pos] = (byte) (0xff & v); }
java
public static void writeShort(byte[] buf, int pos, short v) { checkBoundary(buf, pos, 2); buf[pos++] = (byte) (0xff & (v >> 8)); buf[pos] = (byte) (0xff & v); }
[ "public", "static", "void", "writeShort", "(", "byte", "[", "]", "buf", ",", "int", "pos", ",", "short", "v", ")", "{", "checkBoundary", "(", "buf", ",", "pos", ",", "2", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "8", ")", ")", ";", "buf", "[", "pos", "]", "=", "(", "byte", ")", "(", "0xff", "&", "v", ")", ";", "}" ]
Writes a specific short value (2 bytes) to the output byte buffer at the given offset. @param buf output byte buffer @param pos offset into the byte buffer to write @param v short value to write
[ "Writes", "a", "specific", "short", "value", "(", "2", "bytes", ")", "to", "the", "output", "byte", "buffer", "at", "the", "given", "offset", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/ByteIOUtils.java#L144-L148
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.eraseJob
public GitlabJob eraseJob(Integer projectId, Integer jobId) throws IOException { """ Erase a single job of a project (remove job artifacts and a job trace) @param projectId @param jobId @return @throws IOException on gitlab api call error """ String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + sanitizeId(jobId, "JobID") + "/erase"; return dispatch().to(tailUrl, GitlabJob.class); }
java
public GitlabJob eraseJob(Integer projectId, Integer jobId) throws IOException { String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabJob.URL + "/" + sanitizeId(jobId, "JobID") + "/erase"; return dispatch().to(tailUrl, GitlabJob.class); }
[ "public", "GitlabJob", "eraseJob", "(", "Integer", "projectId", ",", "Integer", "jobId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "sanitizeProjectId", "(", "projectId", ")", "+", "GitlabJob", ".", "URL", "+", "\"/\"", "+", "sanitizeId", "(", "jobId", ",", "\"JobID\"", ")", "+", "\"/erase\"", ";", "return", "dispatch", "(", ")", ".", "to", "(", "tailUrl", ",", "GitlabJob", ".", "class", ")", ";", "}" ]
Erase a single job of a project (remove job artifacts and a job trace) @param projectId @param jobId @return @throws IOException on gitlab api call error
[ "Erase", "a", "single", "job", "of", "a", "project", "(", "remove", "job", "artifacts", "and", "a", "job", "trace", ")" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L1059-L1062
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java
JsonUtil.getBoolean
public static boolean getBoolean(JsonObject object, String field) { """ Returns a field in a Json object as a boolean. Throws IllegalArgumentException if the field value is null. @param object the Json Object @param field the field in the Json object to return @return the Json field value as a boolean """ final JsonValue value = object.get(field); throwExceptionIfNull(value, field); return value.asBoolean(); }
java
public static boolean getBoolean(JsonObject object, String field) { final JsonValue value = object.get(field); throwExceptionIfNull(value, field); return value.asBoolean(); }
[ "public", "static", "boolean", "getBoolean", "(", "JsonObject", "object", ",", "String", "field", ")", "{", "final", "JsonValue", "value", "=", "object", ".", "get", "(", "field", ")", ";", "throwExceptionIfNull", "(", "value", ",", "field", ")", ";", "return", "value", ".", "asBoolean", "(", ")", ";", "}" ]
Returns a field in a Json object as a boolean. Throws IllegalArgumentException if the field value is null. @param object the Json Object @param field the field in the Json object to return @return the Json field value as a boolean
[ "Returns", "a", "field", "in", "a", "Json", "object", "as", "a", "boolean", ".", "Throws", "IllegalArgumentException", "if", "the", "field", "value", "is", "null", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L199-L203
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/auth/AuthInterface.java
AuthInterface.constructToken
private OAuth1RequestToken constructToken(Response response) { """ Construct a Access Token from a Flickr Response. @param response """ Element authElement = response.getPayload(); String oauthToken = XMLUtilities.getChildValue(authElement, "oauth_token"); String oauthTokenSecret = XMLUtilities.getChildValue(authElement, "oauth_token_secret"); OAuth1RequestToken token = new OAuth1RequestToken(oauthToken, oauthTokenSecret); return token; }
java
private OAuth1RequestToken constructToken(Response response) { Element authElement = response.getPayload(); String oauthToken = XMLUtilities.getChildValue(authElement, "oauth_token"); String oauthTokenSecret = XMLUtilities.getChildValue(authElement, "oauth_token_secret"); OAuth1RequestToken token = new OAuth1RequestToken(oauthToken, oauthTokenSecret); return token; }
[ "private", "OAuth1RequestToken", "constructToken", "(", "Response", "response", ")", "{", "Element", "authElement", "=", "response", ".", "getPayload", "(", ")", ";", "String", "oauthToken", "=", "XMLUtilities", ".", "getChildValue", "(", "authElement", ",", "\"oauth_token\"", ")", ";", "String", "oauthTokenSecret", "=", "XMLUtilities", ".", "getChildValue", "(", "authElement", ",", "\"oauth_token_secret\"", ")", ";", "OAuth1RequestToken", "token", "=", "new", "OAuth1RequestToken", "(", "oauthToken", ",", "oauthTokenSecret", ")", ";", "return", "token", ";", "}" ]
Construct a Access Token from a Flickr Response. @param response
[ "Construct", "a", "Access", "Token", "from", "a", "Flickr", "Response", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/auth/AuthInterface.java#L251-L258
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java
WSConnectionRequestInfoImpl.match
private static final boolean match(Object obj1, Object obj2) { """ Determine if two objects, either of which may be null, are equal. @param obj1 one object. @param obj2 another object. @return true if the objects are equal or are both null, otherwise false. """ return obj1 == obj2 || (obj1 != null && obj1.equals(obj2)); }
java
private static final boolean match(Object obj1, Object obj2) { return obj1 == obj2 || (obj1 != null && obj1.equals(obj2)); }
[ "private", "static", "final", "boolean", "match", "(", "Object", "obj1", ",", "Object", "obj2", ")", "{", "return", "obj1", "==", "obj2", "||", "(", "obj1", "!=", "null", "&&", "obj1", ".", "equals", "(", "obj2", ")", ")", ";", "}" ]
Determine if two objects, either of which may be null, are equal. @param obj1 one object. @param obj2 another object. @return true if the objects are equal or are both null, otherwise false.
[ "Determine", "if", "two", "objects", "either", "of", "which", "may", "be", "null", "are", "equal", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L562-L564
qiniu/java-sdk
src/main/java/com/qiniu/util/Auth.java
Auth.uploadToken
public String uploadToken(String bucket, String key) { """ scope = bucket:key 同名文件覆盖操作、只能上传指定key的文件可以可通过此方法获取token @param bucket 空间名 @param key key,可为 null @return 生成的上传token """ return uploadToken(bucket, key, 3600, null, true); }
java
public String uploadToken(String bucket, String key) { return uploadToken(bucket, key, 3600, null, true); }
[ "public", "String", "uploadToken", "(", "String", "bucket", ",", "String", "key", ")", "{", "return", "uploadToken", "(", "bucket", ",", "key", ",", "3600", ",", "null", ",", "true", ")", ";", "}" ]
scope = bucket:key 同名文件覆盖操作、只能上传指定key的文件可以可通过此方法获取token @param bucket 空间名 @param key key,可为 null @return 生成的上传token
[ "scope", "=", "bucket", ":", "key", "同名文件覆盖操作、只能上传指定key的文件可以可通过此方法获取token" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/util/Auth.java#L218-L220
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java
DiskTypeId.of
public static DiskTypeId of(String project, String zone, String type) { """ Returns a disk type identity given project disk, zone and disk type names. """ return of(ZoneId.of(project, zone), type); }
java
public static DiskTypeId of(String project, String zone, String type) { return of(ZoneId.of(project, zone), type); }
[ "public", "static", "DiskTypeId", "of", "(", "String", "project", ",", "String", "zone", ",", "String", "type", ")", "{", "return", "of", "(", "ZoneId", ".", "of", "(", "project", ",", "zone", ")", ",", "type", ")", ";", "}" ]
Returns a disk type identity given project disk, zone and disk type names.
[ "Returns", "a", "disk", "type", "identity", "given", "project", "disk", "zone", "and", "disk", "type", "names", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java#L121-L123
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkProcessor.java
CmsLinkProcessor.replaceLinks
public String replaceLinks(String content) throws ParserException { """ Starts link processing for the given content in replacement mode.<p> Links are replaced by macros.<p> @param content the content to process @return the processed content with replaced links @throws ParserException if something goes wrong """ m_mode = REPLACE_LINKS; return process(content, m_encoding); }
java
public String replaceLinks(String content) throws ParserException { m_mode = REPLACE_LINKS; return process(content, m_encoding); }
[ "public", "String", "replaceLinks", "(", "String", "content", ")", "throws", "ParserException", "{", "m_mode", "=", "REPLACE_LINKS", ";", "return", "process", "(", "content", ",", "m_encoding", ")", ";", "}" ]
Starts link processing for the given content in replacement mode.<p> Links are replaced by macros.<p> @param content the content to process @return the processed content with replaced links @throws ParserException if something goes wrong
[ "Starts", "link", "processing", "for", "the", "given", "content", "in", "replacement", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkProcessor.java#L232-L236
DataArt/CalculationEngine
calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java
DependencyExtractors.toDataModel
static IDataModel toDataModel(final IDataModel book, final ICellAddress address) { """ Invokes {@link #toDataModel(Workbook, ICellAddress)} with {@link IDataModel} converted to {@link Workbook}. """ return toDataModel(DataModelConverters.toWorkbook(book), address); }
java
static IDataModel toDataModel(final IDataModel book, final ICellAddress address) { return toDataModel(DataModelConverters.toWorkbook(book), address); }
[ "static", "IDataModel", "toDataModel", "(", "final", "IDataModel", "book", ",", "final", "ICellAddress", "address", ")", "{", "return", "toDataModel", "(", "DataModelConverters", ".", "toWorkbook", "(", "book", ")", ",", "address", ")", ";", "}" ]
Invokes {@link #toDataModel(Workbook, ICellAddress)} with {@link IDataModel} converted to {@link Workbook}.
[ "Invokes", "{" ]
train
https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java#L62-L64
moparisthebest/beehive
beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/DomUtils.java
DomUtils.getAttributeValue
static String getAttributeValue(Element element, String name) { """ <p>Retutns the value of the named attribute of the given element. If there is no such attribute, returns null.</p> @param element element @param name name @return value """ Attr attribute = element.getAttributeNode(name); if (attribute == null) { return null; } else { return attribute.getValue(); } }
java
static String getAttributeValue(Element element, String name) { Attr attribute = element.getAttributeNode(name); if (attribute == null) { return null; } else { return attribute.getValue(); } }
[ "static", "String", "getAttributeValue", "(", "Element", "element", ",", "String", "name", ")", "{", "Attr", "attribute", "=", "element", ".", "getAttributeNode", "(", "name", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "attribute", ".", "getValue", "(", ")", ";", "}", "}" ]
<p>Retutns the value of the named attribute of the given element. If there is no such attribute, returns null.</p> @param element element @param name name @return value
[ "<p", ">", "Retutns", "the", "value", "of", "the", "named", "attribute", "of", "the", "given", "element", ".", "If", "there", "is", "no", "such", "attribute", "returns", "null", ".", "<", "/", "p", ">" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/DomUtils.java#L185-L192
alkacon/opencms-core
src/org/opencms/db/CmsSubscriptionManager.java
CmsSubscriptionManager.markResourceAsVisitedBy
public void markResourceAsVisitedBy(CmsObject cms, String resourcePath, CmsUser user) throws CmsException { """ Mark the given resource as visited by the user.<p> @param cms the current users context @param resourcePath the name of the resource to mark as visited @param user the user that visited the resource @throws CmsException if something goes wrong """ CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL); markResourceAsVisitedBy(cms, resource, user); }
java
public void markResourceAsVisitedBy(CmsObject cms, String resourcePath, CmsUser user) throws CmsException { CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL); markResourceAsVisitedBy(cms, resource, user); }
[ "public", "void", "markResourceAsVisitedBy", "(", "CmsObject", "cms", ",", "String", "resourcePath", ",", "CmsUser", "user", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "resourcePath", ",", "CmsResourceFilter", ".", "ALL", ")", ";", "markResourceAsVisitedBy", "(", "cms", ",", "resource", ",", "user", ")", ";", "}" ]
Mark the given resource as visited by the user.<p> @param cms the current users context @param resourcePath the name of the resource to mark as visited @param user the user that visited the resource @throws CmsException if something goes wrong
[ "Mark", "the", "given", "resource", "as", "visited", "by", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L188-L192
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTree.java
MkMaxTree.kNNdistanceAdjustment
@Override protected void kNNdistanceAdjustment(MkMaxEntry entry, Map<DBID, KNNList> knnLists) { """ Adjusts the knn distance in the subtree of the specified root entry. """ MkMaxTreeNode<O> node = getNode(entry); double knnDist_node = 0.; if (node.isLeaf()) { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry leafEntry = node.getEntry(i); leafEntry.setKnnDistance(knnLists.get(leafEntry.getRoutingObjectID()).getKNNDistance()); knnDist_node = Math.max(knnDist_node, leafEntry.getKnnDistance()); } } else { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry dirEntry = node.getEntry(i); kNNdistanceAdjustment(dirEntry, knnLists); knnDist_node = Math.max(knnDist_node, dirEntry.getKnnDistance()); } } entry.setKnnDistance(knnDist_node); }
java
@Override protected void kNNdistanceAdjustment(MkMaxEntry entry, Map<DBID, KNNList> knnLists) { MkMaxTreeNode<O> node = getNode(entry); double knnDist_node = 0.; if (node.isLeaf()) { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry leafEntry = node.getEntry(i); leafEntry.setKnnDistance(knnLists.get(leafEntry.getRoutingObjectID()).getKNNDistance()); knnDist_node = Math.max(knnDist_node, leafEntry.getKnnDistance()); } } else { for (int i = 0; i < node.getNumEntries(); i++) { MkMaxEntry dirEntry = node.getEntry(i); kNNdistanceAdjustment(dirEntry, knnLists); knnDist_node = Math.max(knnDist_node, dirEntry.getKnnDistance()); } } entry.setKnnDistance(knnDist_node); }
[ "@", "Override", "protected", "void", "kNNdistanceAdjustment", "(", "MkMaxEntry", "entry", ",", "Map", "<", "DBID", ",", "KNNList", ">", "knnLists", ")", "{", "MkMaxTreeNode", "<", "O", ">", "node", "=", "getNode", "(", "entry", ")", ";", "double", "knnDist_node", "=", "0.", ";", "if", "(", "node", ".", "isLeaf", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkMaxEntry", "leafEntry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "leafEntry", ".", "setKnnDistance", "(", "knnLists", ".", "get", "(", "leafEntry", ".", "getRoutingObjectID", "(", ")", ")", ".", "getKNNDistance", "(", ")", ")", ";", "knnDist_node", "=", "Math", ".", "max", "(", "knnDist_node", ",", "leafEntry", ".", "getKnnDistance", "(", ")", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkMaxEntry", "dirEntry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "kNNdistanceAdjustment", "(", "dirEntry", ",", "knnLists", ")", ";", "knnDist_node", "=", "Math", ".", "max", "(", "knnDist_node", ",", "dirEntry", ".", "getKnnDistance", "(", ")", ")", ";", "}", "}", "entry", ".", "setKnnDistance", "(", "knnDist_node", ")", ";", "}" ]
Adjusts the knn distance in the subtree of the specified root entry.
[ "Adjusts", "the", "knn", "distance", "in", "the", "subtree", "of", "the", "specified", "root", "entry", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkmax/MkMaxTree.java#L137-L155
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.longSupplier
public static LongSupplier longSupplier(CheckedLongSupplier supplier, Consumer<Throwable> handler) { """ Wrap a {@link CheckedLongSupplier} in a {@link LongSupplier} with a custom handler for checked exceptions. <p> Example: <code><pre> ResultSet rs = statement.executeQuery(); Stream.generate(Unchecked.longSupplier( () -> rs.getLong(1), e -> { throw new IllegalStateException(e); } )); </pre></code> """ return () -> { try { return supplier.getAsLong(); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static LongSupplier longSupplier(CheckedLongSupplier supplier, Consumer<Throwable> handler) { return () -> { try { return supplier.getAsLong(); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "LongSupplier", "longSupplier", "(", "CheckedLongSupplier", "supplier", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", ")", "->", "{", "try", "{", "return", "supplier", ".", "getAsLong", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "handler", ".", "accept", "(", "e", ")", ";", "throw", "new", "IllegalStateException", "(", "\"Exception handler must throw a RuntimeException\"", ",", "e", ")", ";", "}", "}", ";", "}" ]
Wrap a {@link CheckedLongSupplier} in a {@link LongSupplier} with a custom handler for checked exceptions. <p> Example: <code><pre> ResultSet rs = statement.executeQuery(); Stream.generate(Unchecked.longSupplier( () -> rs.getLong(1), e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedLongSupplier", "}", "in", "a", "{", "@link", "LongSupplier", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "ResultSet", "rs", "=", "statement", ".", "executeQuery", "()", ";" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1774-L1785
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java
XBaseGridScreen.printStartRecordData
public void printStartRecordData(Rec record, PrintWriter out, int iPrintOptions) { """ Display the start record in input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception. """ String strRecordName = record.getTableNames(false); if ((strRecordName == null) || (strRecordName.length() == 0)) strRecordName = "Record"; String strID = DBConstants.BLANK; if (record.getCounterField() != null) strID = " id=\"" + record.getCounterField().toString() + "\" "; out.println(Utility.startTag(strRecordName + strID)); }
java
public void printStartRecordData(Rec record, PrintWriter out, int iPrintOptions) { String strRecordName = record.getTableNames(false); if ((strRecordName == null) || (strRecordName.length() == 0)) strRecordName = "Record"; String strID = DBConstants.BLANK; if (record.getCounterField() != null) strID = " id=\"" + record.getCounterField().toString() + "\" "; out.println(Utility.startTag(strRecordName + strID)); }
[ "public", "void", "printStartRecordData", "(", "Rec", "record", ",", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "String", "strRecordName", "=", "record", ".", "getTableNames", "(", "false", ")", ";", "if", "(", "(", "strRecordName", "==", "null", ")", "||", "(", "strRecordName", ".", "length", "(", ")", "==", "0", ")", ")", "strRecordName", "=", "\"Record\"", ";", "String", "strID", "=", "DBConstants", ".", "BLANK", ";", "if", "(", "record", ".", "getCounterField", "(", ")", "!=", "null", ")", "strID", "=", "\" id=\\\"\"", "+", "record", ".", "getCounterField", "(", ")", ".", "toString", "(", ")", "+", "\"\\\" \"", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "strRecordName", "+", "strID", ")", ")", ";", "}" ]
Display the start record in input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception.
[ "Display", "the", "start", "record", "in", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseGridScreen.java#L207-L216
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newUploadStagingResourceWithImageRequest
public static Request newUploadStagingResourceWithImageRequest(Session session, File file, Callback callback) throws FileNotFoundException { """ Creates a new Request configured to upload an image to create a staging resource. Staging resources allow you to post binary data such as images, in preparation for a post of an Open Graph object or action which references the image. The URI returned when uploading a staging resource may be passed as the image property for an Open Graph object or action. @param session the Session to use, or null; if non-null, the session must be in an opened state @param file the file containing the image to upload @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute """ ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); ParcelFileDescriptorWithMimeType descriptorWithMimeType = new ParcelFileDescriptorWithMimeType(descriptor, "image/png"); Bundle parameters = new Bundle(1); parameters.putParcelable(STAGING_PARAM, descriptorWithMimeType); return new Request(session, MY_STAGING_RESOURCES, parameters, HttpMethod.POST, callback); }
java
public static Request newUploadStagingResourceWithImageRequest(Session session, File file, Callback callback) throws FileNotFoundException { ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); ParcelFileDescriptorWithMimeType descriptorWithMimeType = new ParcelFileDescriptorWithMimeType(descriptor, "image/png"); Bundle parameters = new Bundle(1); parameters.putParcelable(STAGING_PARAM, descriptorWithMimeType); return new Request(session, MY_STAGING_RESOURCES, parameters, HttpMethod.POST, callback); }
[ "public", "static", "Request", "newUploadStagingResourceWithImageRequest", "(", "Session", "session", ",", "File", "file", ",", "Callback", "callback", ")", "throws", "FileNotFoundException", "{", "ParcelFileDescriptor", "descriptor", "=", "ParcelFileDescriptor", ".", "open", "(", "file", ",", "ParcelFileDescriptor", ".", "MODE_READ_ONLY", ")", ";", "ParcelFileDescriptorWithMimeType", "descriptorWithMimeType", "=", "new", "ParcelFileDescriptorWithMimeType", "(", "descriptor", ",", "\"image/png\"", ")", ";", "Bundle", "parameters", "=", "new", "Bundle", "(", "1", ")", ";", "parameters", ".", "putParcelable", "(", "STAGING_PARAM", ",", "descriptorWithMimeType", ")", ";", "return", "new", "Request", "(", "session", ",", "MY_STAGING_RESOURCES", ",", "parameters", ",", "HttpMethod", ".", "POST", ",", "callback", ")", ";", "}" ]
Creates a new Request configured to upload an image to create a staging resource. Staging resources allow you to post binary data such as images, in preparation for a post of an Open Graph object or action which references the image. The URI returned when uploading a staging resource may be passed as the image property for an Open Graph object or action. @param session the Session to use, or null; if non-null, the session must be in an opened state @param file the file containing the image to upload @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "upload", "an", "image", "to", "create", "a", "staging", "resource", ".", "Staging", "resources", "allow", "you", "to", "post", "binary", "data", "such", "as", "images", "in", "preparation", "for", "a", "post", "of", "an", "Open", "Graph", "object", "or", "action", "which", "references", "the", "image", ".", "The", "URI", "returned", "when", "uploading", "a", "staging", "resource", "may", "be", "passed", "as", "the", "image", "property", "for", "an", "Open", "Graph", "object", "or", "action", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L659-L667
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putString
public WrappedByteBuffer putString(String v, Charset cs) { """ Puts a string into the buffer at the current position, using the character set to encode the string as bytes. @param v the string @param cs the character set @return the buffer """ java.nio.ByteBuffer strBuf = cs.encode(v); _autoExpand(strBuf.limit()); _buf.put(strBuf); return this; }
java
public WrappedByteBuffer putString(String v, Charset cs) { java.nio.ByteBuffer strBuf = cs.encode(v); _autoExpand(strBuf.limit()); _buf.put(strBuf); return this; }
[ "public", "WrappedByteBuffer", "putString", "(", "String", "v", ",", "Charset", "cs", ")", "{", "java", ".", "nio", ".", "ByteBuffer", "strBuf", "=", "cs", ".", "encode", "(", "v", ")", ";", "_autoExpand", "(", "strBuf", ".", "limit", "(", ")", ")", ";", "_buf", ".", "put", "(", "strBuf", ")", ";", "return", "this", ";", "}" ]
Puts a string into the buffer at the current position, using the character set to encode the string as bytes. @param v the string @param cs the character set @return the buffer
[ "Puts", "a", "string", "into", "the", "buffer", "at", "the", "current", "position", "using", "the", "character", "set", "to", "encode", "the", "string", "as", "bytes", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L562-L567
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/metric/undirected/EdgeMetrics.java
EdgeMetrics.run
@Override public EdgeMetrics<K, VV, EV> run(Graph<K, VV, EV> input) throws Exception { """ /* Implementation notes: <p>Use aggregator to replace SumEdgeStats when aggregators are rewritten to use a hash-combineable hashed-reduce. """ super.run(input); // s, t, (d(s), d(t)) DataSet<Edge<K, Tuple3<EV, LongValue, LongValue>>> edgeDegreePair = input .run(new EdgeDegreePair<K, VV, EV>() .setReduceOnTargetId(reduceOnTargetId) .setParallelism(parallelism)); // s, d(s), count of (u, v) where deg(u) < deg(v) or (deg(u) == deg(v) and u < v) DataSet<Tuple3<K, LongValue, LongValue>> edgeStats = edgeDegreePair .map(new EdgeStats<>()) .setParallelism(parallelism) .name("Edge stats") .groupBy(0) .reduce(new SumEdgeStats<>()) .setCombineHint(CombineHint.HASH) .setParallelism(parallelism) .name("Sum edge stats"); edgeMetricsHelper = new EdgeMetricsHelper<>(); edgeStats .output(edgeMetricsHelper) .setParallelism(parallelism) .name("Edge metrics"); return this; }
java
@Override public EdgeMetrics<K, VV, EV> run(Graph<K, VV, EV> input) throws Exception { super.run(input); // s, t, (d(s), d(t)) DataSet<Edge<K, Tuple3<EV, LongValue, LongValue>>> edgeDegreePair = input .run(new EdgeDegreePair<K, VV, EV>() .setReduceOnTargetId(reduceOnTargetId) .setParallelism(parallelism)); // s, d(s), count of (u, v) where deg(u) < deg(v) or (deg(u) == deg(v) and u < v) DataSet<Tuple3<K, LongValue, LongValue>> edgeStats = edgeDegreePair .map(new EdgeStats<>()) .setParallelism(parallelism) .name("Edge stats") .groupBy(0) .reduce(new SumEdgeStats<>()) .setCombineHint(CombineHint.HASH) .setParallelism(parallelism) .name("Sum edge stats"); edgeMetricsHelper = new EdgeMetricsHelper<>(); edgeStats .output(edgeMetricsHelper) .setParallelism(parallelism) .name("Edge metrics"); return this; }
[ "@", "Override", "public", "EdgeMetrics", "<", "K", ",", "VV", ",", "EV", ">", "run", "(", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "input", ")", "throws", "Exception", "{", "super", ".", "run", "(", "input", ")", ";", "// s, t, (d(s), d(t))", "DataSet", "<", "Edge", "<", "K", ",", "Tuple3", "<", "EV", ",", "LongValue", ",", "LongValue", ">", ">", ">", "edgeDegreePair", "=", "input", ".", "run", "(", "new", "EdgeDegreePair", "<", "K", ",", "VV", ",", "EV", ">", "(", ")", ".", "setReduceOnTargetId", "(", "reduceOnTargetId", ")", ".", "setParallelism", "(", "parallelism", ")", ")", ";", "// s, d(s), count of (u, v) where deg(u) < deg(v) or (deg(u) == deg(v) and u < v)", "DataSet", "<", "Tuple3", "<", "K", ",", "LongValue", ",", "LongValue", ">", ">", "edgeStats", "=", "edgeDegreePair", ".", "map", "(", "new", "EdgeStats", "<>", "(", ")", ")", ".", "setParallelism", "(", "parallelism", ")", ".", "name", "(", "\"Edge stats\"", ")", ".", "groupBy", "(", "0", ")", ".", "reduce", "(", "new", "SumEdgeStats", "<>", "(", ")", ")", ".", "setCombineHint", "(", "CombineHint", ".", "HASH", ")", ".", "setParallelism", "(", "parallelism", ")", ".", "name", "(", "\"Sum edge stats\"", ")", ";", "edgeMetricsHelper", "=", "new", "EdgeMetricsHelper", "<>", "(", ")", ";", "edgeStats", ".", "output", "(", "edgeMetricsHelper", ")", ".", "setParallelism", "(", "parallelism", ")", ".", "name", "(", "\"Edge metrics\"", ")", ";", "return", "this", ";", "}" ]
/* Implementation notes: <p>Use aggregator to replace SumEdgeStats when aggregators are rewritten to use a hash-combineable hashed-reduce.
[ "/", "*", "Implementation", "notes", ":" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/metric/undirected/EdgeMetrics.java#L93-L123
avast/syringe
src/main/java/com/avast/syringe/config/internal/Injection.java
Injection.apply
public void apply(Object instance, Map<String, Property> properties, ContextualPropertyResolver resolver) throws Exception { """ Takes the property from the {@code properties} map, converts it to the correct value and sets it to the {@code instance}'s property. """ if (property.isContextual() || property.isReference()) { applyContextual(instance, properties, resolver); } else { applyNonContextual(instance, properties, resolver); } }
java
public void apply(Object instance, Map<String, Property> properties, ContextualPropertyResolver resolver) throws Exception { if (property.isContextual() || property.isReference()) { applyContextual(instance, properties, resolver); } else { applyNonContextual(instance, properties, resolver); } }
[ "public", "void", "apply", "(", "Object", "instance", ",", "Map", "<", "String", ",", "Property", ">", "properties", ",", "ContextualPropertyResolver", "resolver", ")", "throws", "Exception", "{", "if", "(", "property", ".", "isContextual", "(", ")", "||", "property", ".", "isReference", "(", ")", ")", "{", "applyContextual", "(", "instance", ",", "properties", ",", "resolver", ")", ";", "}", "else", "{", "applyNonContextual", "(", "instance", ",", "properties", ",", "resolver", ")", ";", "}", "}" ]
Takes the property from the {@code properties} map, converts it to the correct value and sets it to the {@code instance}'s property.
[ "Takes", "the", "property", "from", "the", "{" ]
train
https://github.com/avast/syringe/blob/762da5e50776f2bc028e0cf17eac9bd09b5b6aab/src/main/java/com/avast/syringe/config/internal/Injection.java#L35-L42
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java
VNode.setBounds
public void setBounds(float w, float h) { """ Sets the bound of this VNode by given width and height @param w new width @param h new height """ this.glyph.getBbox().setW(w); this.glyph.getBbox().setH(h); }
java
public void setBounds(float w, float h) { this.glyph.getBbox().setW(w); this.glyph.getBbox().setH(h); }
[ "public", "void", "setBounds", "(", "float", "w", ",", "float", "h", ")", "{", "this", ".", "glyph", ".", "getBbox", "(", ")", ".", "setW", "(", "w", ")", ";", "this", ".", "glyph", ".", "getBbox", "(", ")", ".", "setH", "(", "h", ")", ";", "}" ]
Sets the bound of this VNode by given width and height @param w new width @param h new height
[ "Sets", "the", "bound", "of", "this", "VNode", "by", "given", "width", "and", "height" ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/VNode.java#L142-L146
knowm/XChange
xchange-bitso/src/main/java/org/knowm/xchange/bitso/service/BitsoAccountService.java
BitsoAccountService.requestDepositAddress
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { """ This returns the currently set deposit address. It will not generate a new address (ie. repeated calls will return the same address). """ final BitsoDepositAddress response = getBitsoBitcoinDepositAddress(); return response.getDepositAddress(); }
java
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { final BitsoDepositAddress response = getBitsoBitcoinDepositAddress(); return response.getDepositAddress(); }
[ "@", "Override", "public", "String", "requestDepositAddress", "(", "Currency", "currency", ",", "String", "...", "arguments", ")", "throws", "IOException", "{", "final", "BitsoDepositAddress", "response", "=", "getBitsoBitcoinDepositAddress", "(", ")", ";", "return", "response", ".", "getDepositAddress", "(", ")", ";", "}" ]
This returns the currently set deposit address. It will not generate a new address (ie. repeated calls will return the same address).
[ "This", "returns", "the", "currently", "set", "deposit", "address", ".", "It", "will", "not", "generate", "a", "new", "address", "(", "ie", ".", "repeated", "calls", "will", "return", "the", "same", "address", ")", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitso/src/main/java/org/knowm/xchange/bitso/service/BitsoAccountService.java#L53-L58
google/closure-templates
java/src/com/google/template/soy/types/SoyTypeRegistry.java
SoyTypeRegistry.getOrCreateLegacyObjectMapType
public LegacyObjectMapType getOrCreateLegacyObjectMapType(SoyType keyType, SoyType valueType) { """ Factory function which creates a legacy object map type, given a key and value type. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param keyType The key type of the map. @param valueType The value type of the map. @return The map type. """ return legacyObjectMapTypes.intern(LegacyObjectMapType.of(keyType, valueType)); }
java
public LegacyObjectMapType getOrCreateLegacyObjectMapType(SoyType keyType, SoyType valueType) { return legacyObjectMapTypes.intern(LegacyObjectMapType.of(keyType, valueType)); }
[ "public", "LegacyObjectMapType", "getOrCreateLegacyObjectMapType", "(", "SoyType", "keyType", ",", "SoyType", "valueType", ")", "{", "return", "legacyObjectMapTypes", ".", "intern", "(", "LegacyObjectMapType", ".", "of", "(", "keyType", ",", "valueType", ")", ")", ";", "}" ]
Factory function which creates a legacy object map type, given a key and value type. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param keyType The key type of the map. @param valueType The value type of the map. @return The map type.
[ "Factory", "function", "which", "creates", "a", "legacy", "object", "map", "type", "given", "a", "key", "and", "value", "type", ".", "This", "folds", "map", "types", "with", "identical", "key", "/", "value", "types", "together", "so", "asking", "for", "the", "same", "key", "/", "value", "type", "twice", "will", "return", "a", "pointer", "to", "the", "same", "type", "object", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypeRegistry.java#L246-L248
molgenis/molgenis
molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java
JsMagmaScriptEvaluator.createBindings
private Bindings createBindings(Entity entity, int depth) { """ Creates magmascript bindings for a given Entity. @param entity the entity to bind to the magmascript $ function @param depth maximum depth to follow references when creating the entity value map @return Bindings with $ function bound to the entity """ Bindings bindings = new SimpleBindings(); JSObject global = (JSObject) magmaBindings.get("nashorn.global"); JSObject magmaScript = (JSObject) global.getMember(KEY_MAGMA_SCRIPT); JSObject dollarFunction = (JSObject) magmaScript.getMember(KEY_DOLLAR); JSObject bindFunction = (JSObject) dollarFunction.getMember(BIND); Object boundDollar = bindFunction.call(dollarFunction, toScriptEngineValueMap(entity, depth)); bindings.put(KEY_DOLLAR, boundDollar); bindings.put(KEY_NEW_VALUE, magmaScript.getMember(KEY_NEW_VALUE)); bindings.put(KEY_IS_NULL, magmaScript.getMember(KEY_IS_NULL)); return bindings; }
java
private Bindings createBindings(Entity entity, int depth) { Bindings bindings = new SimpleBindings(); JSObject global = (JSObject) magmaBindings.get("nashorn.global"); JSObject magmaScript = (JSObject) global.getMember(KEY_MAGMA_SCRIPT); JSObject dollarFunction = (JSObject) magmaScript.getMember(KEY_DOLLAR); JSObject bindFunction = (JSObject) dollarFunction.getMember(BIND); Object boundDollar = bindFunction.call(dollarFunction, toScriptEngineValueMap(entity, depth)); bindings.put(KEY_DOLLAR, boundDollar); bindings.put(KEY_NEW_VALUE, magmaScript.getMember(KEY_NEW_VALUE)); bindings.put(KEY_IS_NULL, magmaScript.getMember(KEY_IS_NULL)); return bindings; }
[ "private", "Bindings", "createBindings", "(", "Entity", "entity", ",", "int", "depth", ")", "{", "Bindings", "bindings", "=", "new", "SimpleBindings", "(", ")", ";", "JSObject", "global", "=", "(", "JSObject", ")", "magmaBindings", ".", "get", "(", "\"nashorn.global\"", ")", ";", "JSObject", "magmaScript", "=", "(", "JSObject", ")", "global", ".", "getMember", "(", "KEY_MAGMA_SCRIPT", ")", ";", "JSObject", "dollarFunction", "=", "(", "JSObject", ")", "magmaScript", ".", "getMember", "(", "KEY_DOLLAR", ")", ";", "JSObject", "bindFunction", "=", "(", "JSObject", ")", "dollarFunction", ".", "getMember", "(", "BIND", ")", ";", "Object", "boundDollar", "=", "bindFunction", ".", "call", "(", "dollarFunction", ",", "toScriptEngineValueMap", "(", "entity", ",", "depth", ")", ")", ";", "bindings", ".", "put", "(", "KEY_DOLLAR", ",", "boundDollar", ")", ";", "bindings", ".", "put", "(", "KEY_NEW_VALUE", ",", "magmaScript", ".", "getMember", "(", "KEY_NEW_VALUE", ")", ")", ";", "bindings", ".", "put", "(", "KEY_IS_NULL", ",", "magmaScript", ".", "getMember", "(", "KEY_IS_NULL", ")", ")", ";", "return", "bindings", ";", "}" ]
Creates magmascript bindings for a given Entity. @param entity the entity to bind to the magmascript $ function @param depth maximum depth to follow references when creating the entity value map @return Bindings with $ function bound to the entity
[ "Creates", "magmascript", "bindings", "for", "a", "given", "Entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptEvaluator.java#L128-L139
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java
IndexWriter.generateBackpointerUpdates
private void generateBackpointerUpdates(BucketUpdate update, UpdateInstructions updateInstructions) { """ Generates the necessary Backpointer updates for the given {@link BucketUpdate}. @param update The BucketUpdate to generate Backpointers for. @param updateInstructions A {@link UpdateInstructions} object to collect updates into. """ // Keep track of the previous, non-deleted Key's offset. The first one points to nothing. AtomicLong previousOffset = new AtomicLong(Attributes.NULL_ATTRIBUTE_VALUE); // Keep track of whether the previous Key has been replaced. AtomicBoolean previousReplaced = new AtomicBoolean(false); // Process all existing Keys, in order of Offsets, and either unlink them (if replaced) or update pointers as needed. AtomicBoolean first = new AtomicBoolean(true); update.getExistingKeys().stream() .sorted(Comparator.comparingLong(BucketUpdate.KeyInfo::getOffset)) .forEach(keyInfo -> { boolean replaced = update.isKeyUpdated(keyInfo.getKey()); if (replaced) { // This one has been replaced or removed; delete any backpointer originating from it. if (!first.get()) { // ... except if this is the first one in the list, which means it doesn't have a backpointer. updateInstructions.withAttribute(generateBackpointerRemoval(keyInfo.getOffset())); } // Record that this has been replaced. updateInstructions.entryRemoved(); previousReplaced.set(true); } else { if (previousReplaced.get()) { // This one hasn't been replaced or removed, however its previous one has been. // Repoint it to whatever key is now ahead of it, or remove it (if previousOffset is nothing). updateInstructions.withAttribute(generateBackpointerUpdate(keyInfo.getOffset(), previousOffset.get())); previousReplaced.set(false); } previousOffset.set(keyInfo.getOffset()); // Record the last valid offset. } first.set(false); }); // Process all the new Keys, in order of offsets, and add any backpointers as needed, making sure to also link them // to whatever surviving existing Keys we might still have. update.getKeyUpdates().stream() .filter(keyUpdate -> !keyUpdate.isDeleted()) .sorted(Comparator.comparingLong(BucketUpdate.KeyUpdate::getOffset)) .forEach(keyUpdate -> { if (previousOffset.get() != Attributes.NULL_ATTRIBUTE_VALUE) { // Only add a backpointer if we have another Key ahead of it. updateInstructions.withAttribute(generateBackpointerUpdate(keyUpdate.getOffset(), previousOffset.get())); } updateInstructions.entryAdded(); previousOffset.set(keyUpdate.getOffset()); }); }
java
private void generateBackpointerUpdates(BucketUpdate update, UpdateInstructions updateInstructions) { // Keep track of the previous, non-deleted Key's offset. The first one points to nothing. AtomicLong previousOffset = new AtomicLong(Attributes.NULL_ATTRIBUTE_VALUE); // Keep track of whether the previous Key has been replaced. AtomicBoolean previousReplaced = new AtomicBoolean(false); // Process all existing Keys, in order of Offsets, and either unlink them (if replaced) or update pointers as needed. AtomicBoolean first = new AtomicBoolean(true); update.getExistingKeys().stream() .sorted(Comparator.comparingLong(BucketUpdate.KeyInfo::getOffset)) .forEach(keyInfo -> { boolean replaced = update.isKeyUpdated(keyInfo.getKey()); if (replaced) { // This one has been replaced or removed; delete any backpointer originating from it. if (!first.get()) { // ... except if this is the first one in the list, which means it doesn't have a backpointer. updateInstructions.withAttribute(generateBackpointerRemoval(keyInfo.getOffset())); } // Record that this has been replaced. updateInstructions.entryRemoved(); previousReplaced.set(true); } else { if (previousReplaced.get()) { // This one hasn't been replaced or removed, however its previous one has been. // Repoint it to whatever key is now ahead of it, or remove it (if previousOffset is nothing). updateInstructions.withAttribute(generateBackpointerUpdate(keyInfo.getOffset(), previousOffset.get())); previousReplaced.set(false); } previousOffset.set(keyInfo.getOffset()); // Record the last valid offset. } first.set(false); }); // Process all the new Keys, in order of offsets, and add any backpointers as needed, making sure to also link them // to whatever surviving existing Keys we might still have. update.getKeyUpdates().stream() .filter(keyUpdate -> !keyUpdate.isDeleted()) .sorted(Comparator.comparingLong(BucketUpdate.KeyUpdate::getOffset)) .forEach(keyUpdate -> { if (previousOffset.get() != Attributes.NULL_ATTRIBUTE_VALUE) { // Only add a backpointer if we have another Key ahead of it. updateInstructions.withAttribute(generateBackpointerUpdate(keyUpdate.getOffset(), previousOffset.get())); } updateInstructions.entryAdded(); previousOffset.set(keyUpdate.getOffset()); }); }
[ "private", "void", "generateBackpointerUpdates", "(", "BucketUpdate", "update", ",", "UpdateInstructions", "updateInstructions", ")", "{", "// Keep track of the previous, non-deleted Key's offset. The first one points to nothing.", "AtomicLong", "previousOffset", "=", "new", "AtomicLong", "(", "Attributes", ".", "NULL_ATTRIBUTE_VALUE", ")", ";", "// Keep track of whether the previous Key has been replaced.", "AtomicBoolean", "previousReplaced", "=", "new", "AtomicBoolean", "(", "false", ")", ";", "// Process all existing Keys, in order of Offsets, and either unlink them (if replaced) or update pointers as needed.", "AtomicBoolean", "first", "=", "new", "AtomicBoolean", "(", "true", ")", ";", "update", ".", "getExistingKeys", "(", ")", ".", "stream", "(", ")", ".", "sorted", "(", "Comparator", ".", "comparingLong", "(", "BucketUpdate", ".", "KeyInfo", "::", "getOffset", ")", ")", ".", "forEach", "(", "keyInfo", "->", "{", "boolean", "replaced", "=", "update", ".", "isKeyUpdated", "(", "keyInfo", ".", "getKey", "(", ")", ")", ";", "if", "(", "replaced", ")", "{", "// This one has been replaced or removed; delete any backpointer originating from it.", "if", "(", "!", "first", ".", "get", "(", ")", ")", "{", "// ... except if this is the first one in the list, which means it doesn't have a backpointer.", "updateInstructions", ".", "withAttribute", "(", "generateBackpointerRemoval", "(", "keyInfo", ".", "getOffset", "(", ")", ")", ")", ";", "}", "// Record that this has been replaced.", "updateInstructions", ".", "entryRemoved", "(", ")", ";", "previousReplaced", ".", "set", "(", "true", ")", ";", "}", "else", "{", "if", "(", "previousReplaced", ".", "get", "(", ")", ")", "{", "// This one hasn't been replaced or removed, however its previous one has been.", "// Repoint it to whatever key is now ahead of it, or remove it (if previousOffset is nothing).", "updateInstructions", ".", "withAttribute", "(", "generateBackpointerUpdate", "(", "keyInfo", ".", "getOffset", "(", ")", ",", "previousOffset", ".", "get", "(", ")", ")", ")", ";", "previousReplaced", ".", "set", "(", "false", ")", ";", "}", "previousOffset", ".", "set", "(", "keyInfo", ".", "getOffset", "(", ")", ")", ";", "// Record the last valid offset.", "}", "first", ".", "set", "(", "false", ")", ";", "}", ")", ";", "// Process all the new Keys, in order of offsets, and add any backpointers as needed, making sure to also link them", "// to whatever surviving existing Keys we might still have.", "update", ".", "getKeyUpdates", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "keyUpdate", "->", "!", "keyUpdate", ".", "isDeleted", "(", ")", ")", ".", "sorted", "(", "Comparator", ".", "comparingLong", "(", "BucketUpdate", ".", "KeyUpdate", "::", "getOffset", ")", ")", ".", "forEach", "(", "keyUpdate", "->", "{", "if", "(", "previousOffset", ".", "get", "(", ")", "!=", "Attributes", ".", "NULL_ATTRIBUTE_VALUE", ")", "{", "// Only add a backpointer if we have another Key ahead of it.", "updateInstructions", ".", "withAttribute", "(", "generateBackpointerUpdate", "(", "keyUpdate", ".", "getOffset", "(", ")", ",", "previousOffset", ".", "get", "(", ")", ")", ")", ";", "}", "updateInstructions", ".", "entryAdded", "(", ")", ";", "previousOffset", ".", "set", "(", "keyUpdate", ".", "getOffset", "(", ")", ")", ";", "}", ")", ";", "}" ]
Generates the necessary Backpointer updates for the given {@link BucketUpdate}. @param update The BucketUpdate to generate Backpointers for. @param updateInstructions A {@link UpdateInstructions} object to collect updates into.
[ "Generates", "the", "necessary", "Backpointer", "updates", "for", "the", "given", "{", "@link", "BucketUpdate", "}", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexWriter.java#L256-L307
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_PUT
public void serviceName_modem_PUT(String serviceName, OvhModem body) throws IOException { """ Alter this object properties REST: PUT /xdsl/{serviceName}/modem @param body [required] New object properties @param serviceName [required] The internal name of your XDSL offer """ String qPath = "/xdsl/{serviceName}/modem"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_modem_PUT(String serviceName, OvhModem body) throws IOException { String qPath = "/xdsl/{serviceName}/modem"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_modem_PUT", "(", "String", "serviceName", ",", "OvhModem", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /xdsl/{serviceName}/modem @param body [required] New object properties @param serviceName [required] The internal name of your XDSL offer
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1244-L1248
threerings/playn
core/src/playn/core/gl/GLContext.java
GLContext.setSize
public final void setSize(int pixelWidth, int pixelHeight) { """ Sets the frame buffer to the specified width and height (in pixels). The view will potentially be smaller than this size if a HiDPI scale factor is in effect. """ viewWidth = scale.invScaledFloor(pixelWidth); viewHeight = scale.invScaledFloor(pixelHeight); curFbufWidth = defaultFbufWidth = pixelWidth; curFbufHeight = defaultFbufHeight = pixelHeight; viewConfigChanged(); }
java
public final void setSize(int pixelWidth, int pixelHeight) { viewWidth = scale.invScaledFloor(pixelWidth); viewHeight = scale.invScaledFloor(pixelHeight); curFbufWidth = defaultFbufWidth = pixelWidth; curFbufHeight = defaultFbufHeight = pixelHeight; viewConfigChanged(); }
[ "public", "final", "void", "setSize", "(", "int", "pixelWidth", ",", "int", "pixelHeight", ")", "{", "viewWidth", "=", "scale", ".", "invScaledFloor", "(", "pixelWidth", ")", ";", "viewHeight", "=", "scale", ".", "invScaledFloor", "(", "pixelHeight", ")", ";", "curFbufWidth", "=", "defaultFbufWidth", "=", "pixelWidth", ";", "curFbufHeight", "=", "defaultFbufHeight", "=", "pixelHeight", ";", "viewConfigChanged", "(", ")", ";", "}" ]
Sets the frame buffer to the specified width and height (in pixels). The view will potentially be smaller than this size if a HiDPI scale factor is in effect.
[ "Sets", "the", "frame", "buffer", "to", "the", "specified", "width", "and", "height", "(", "in", "pixels", ")", ".", "The", "view", "will", "potentially", "be", "smaller", "than", "this", "size", "if", "a", "HiDPI", "scale", "factor", "is", "in", "effect", "." ]
train
https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/core/src/playn/core/gl/GLContext.java#L93-L99
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.getDefaultDocument
public static synchronized Document getDefaultDocument() { """ Returns a default XML document @return The default XML document """ if (defaultDocument == null) { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { // Can not happen, since it's the default configuration throw new XmlException("Could not create default document", e); } defaultDocument = documentBuilder.newDocument(); } return defaultDocument; }
java
public static synchronized Document getDefaultDocument() { if (defaultDocument == null) { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { // Can not happen, since it's the default configuration throw new XmlException("Could not create default document", e); } defaultDocument = documentBuilder.newDocument(); } return defaultDocument; }
[ "public", "static", "synchronized", "Document", "getDefaultDocument", "(", ")", "{", "if", "(", "defaultDocument", "==", "null", ")", "{", "DocumentBuilderFactory", "documentBuilderFactory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "DocumentBuilder", "documentBuilder", "=", "null", ";", "try", "{", "documentBuilder", "=", "documentBuilderFactory", ".", "newDocumentBuilder", "(", ")", ";", "}", "catch", "(", "ParserConfigurationException", "e", ")", "{", "// Can not happen, since it's the default configuration\r", "throw", "new", "XmlException", "(", "\"Could not create default document\"", ",", "e", ")", ";", "}", "defaultDocument", "=", "documentBuilder", ".", "newDocument", "(", ")", ";", "}", "return", "defaultDocument", ";", "}" ]
Returns a default XML document @return The default XML document
[ "Returns", "a", "default", "XML", "document" ]
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L72-L91
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.fillBeanWithMapIgnoreCase
public static <T> T fillBeanWithMapIgnoreCase(Map<?, ?> map, T bean, boolean isIgnoreError) { """ 使用Map填充Bean对象,忽略大小写 @param <T> Bean类型 @param map Map @param bean Bean @param isIgnoreError 是否忽略注入错误 @return Bean """ return fillBeanWithMap(map, bean, CopyOptions.create().setIgnoreCase(true).setIgnoreError(isIgnoreError)); }
java
public static <T> T fillBeanWithMapIgnoreCase(Map<?, ?> map, T bean, boolean isIgnoreError) { return fillBeanWithMap(map, bean, CopyOptions.create().setIgnoreCase(true).setIgnoreError(isIgnoreError)); }
[ "public", "static", "<", "T", ">", "T", "fillBeanWithMapIgnoreCase", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "T", "bean", ",", "boolean", "isIgnoreError", ")", "{", "return", "fillBeanWithMap", "(", "map", ",", "bean", ",", "CopyOptions", ".", "create", "(", ")", ".", "setIgnoreCase", "(", "true", ")", ".", "setIgnoreError", "(", "isIgnoreError", ")", ")", ";", "}" ]
使用Map填充Bean对象,忽略大小写 @param <T> Bean类型 @param map Map @param bean Bean @param isIgnoreError 是否忽略注入错误 @return Bean
[ "使用Map填充Bean对象,忽略大小写" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L395-L397
voldemort/voldemort
contrib/collections/src/java/voldemort/collections/VStack.java
VStack.setById
public E setById(final int id, final E element) { """ Put the given value to the appropriate id in the stack, using the version of the current list node identified by that id. @param id @param element element to set @return element that was replaced by the new element @throws ObsoleteVersionException when an update fails """ VListKey<K> key = new VListKey<K>(_key, id); UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element); if(!_storeClient.applyUpdate(updateElementAction)) throw new ObsoleteVersionException("update failed"); return updateElementAction.getResult(); }
java
public E setById(final int id, final E element) { VListKey<K> key = new VListKey<K>(_key, id); UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element); if(!_storeClient.applyUpdate(updateElementAction)) throw new ObsoleteVersionException("update failed"); return updateElementAction.getResult(); }
[ "public", "E", "setById", "(", "final", "int", "id", ",", "final", "E", "element", ")", "{", "VListKey", "<", "K", ">", "key", "=", "new", "VListKey", "<", "K", ">", "(", "_key", ",", "id", ")", ";", "UpdateElementById", "<", "K", ",", "E", ">", "updateElementAction", "=", "new", "UpdateElementById", "<", "K", ",", "E", ">", "(", "key", ",", "element", ")", ";", "if", "(", "!", "_storeClient", ".", "applyUpdate", "(", "updateElementAction", ")", ")", "throw", "new", "ObsoleteVersionException", "(", "\"update failed\"", ")", ";", "return", "updateElementAction", ".", "getResult", "(", ")", ";", "}" ]
Put the given value to the appropriate id in the stack, using the version of the current list node identified by that id. @param id @param element element to set @return element that was replaced by the new element @throws ObsoleteVersionException when an update fails
[ "Put", "the", "given", "value", "to", "the", "appropriate", "id", "in", "the", "stack", "using", "the", "version", "of", "the", "current", "list", "node", "identified", "by", "that", "id", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/collections/src/java/voldemort/collections/VStack.java#L300-L308
nohana/Amalgam
amalgam/src/main/java/com/amalgam/app/FragmentManagerUtils.java
FragmentManagerUtils.findFragmentById
@SuppressWarnings("unchecked") // we know that the returning fragment is child of fragment. @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static <F extends android.app.Fragment> F findFragmentById(android.app.FragmentManager manager, int id) { """ Find a fragment that is under {@link android.app.FragmentManager}'s control by the id. @param manager the fragment manager. @param id the fragment id. @param <F> the concrete fragment class parameter. @return the fragment. """ return (F) manager.findFragmentById(id); }
java
@SuppressWarnings("unchecked") // we know that the returning fragment is child of fragment. @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static <F extends android.app.Fragment> F findFragmentById(android.app.FragmentManager manager, int id) { return (F) manager.findFragmentById(id); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// we know that the returning fragment is child of fragment.", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "static", "<", "F", "extends", "android", ".", "app", ".", "Fragment", ">", "F", "findFragmentById", "(", "android", ".", "app", ".", "FragmentManager", "manager", ",", "int", "id", ")", "{", "return", "(", "F", ")", "manager", ".", "findFragmentById", "(", "id", ")", ";", "}" ]
Find a fragment that is under {@link android.app.FragmentManager}'s control by the id. @param manager the fragment manager. @param id the fragment id. @param <F> the concrete fragment class parameter. @return the fragment.
[ "Find", "a", "fragment", "that", "is", "under", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/FragmentManagerUtils.java#L23-L27
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_dsRecord_GET
public ArrayList<Long> serviceName_dsRecord_GET(String serviceName, OvhKeyFlagEnum flags, OvhKeyStatusEnum status) throws IOException { """ List of domain's DS Records REST: GET /domain/{serviceName}/dsRecord @param status [required] Filter the value of status property (=) @param flags [required] Filter the value of flags property (=) @param serviceName [required] The internal name of your domain """ String qPath = "/domain/{serviceName}/dsRecord"; StringBuilder sb = path(qPath, serviceName); query(sb, "flags", flags); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<Long> serviceName_dsRecord_GET(String serviceName, OvhKeyFlagEnum flags, OvhKeyStatusEnum status) throws IOException { String qPath = "/domain/{serviceName}/dsRecord"; StringBuilder sb = path(qPath, serviceName); query(sb, "flags", flags); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_dsRecord_GET", "(", "String", "serviceName", ",", "OvhKeyFlagEnum", "flags", ",", "OvhKeyStatusEnum", "status", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/dsRecord\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"flags\"", ",", "flags", ")", ";", "query", "(", "sb", ",", "\"status\"", ",", "status", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
List of domain's DS Records REST: GET /domain/{serviceName}/dsRecord @param status [required] Filter the value of status property (=) @param flags [required] Filter the value of flags property (=) @param serviceName [required] The internal name of your domain
[ "List", "of", "domain", "s", "DS", "Records" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1420-L1427
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.parseJUDate
public static java.util.Date parseJUDate(final String date, final String format, final TimeZone timeZone) { """ Converts the specified <code>date</code> with the specified {@code format} to a new instance of java.util.Date. <code>null</code> is returned if the specified <code>date</code> is null or empty. @param date @param format @throws IllegalArgumentException if the date given can't be parsed with specified format. """ if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) { return null; } return createJUDate(parse(date, format, timeZone)); }
java
public static java.util.Date parseJUDate(final String date, final String format, final TimeZone timeZone) { if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) { return null; } return createJUDate(parse(date, format, timeZone)); }
[ "public", "static", "java", ".", "util", ".", "Date", "parseJUDate", "(", "final", "String", "date", ",", "final", "String", "format", ",", "final", "TimeZone", "timeZone", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "date", ")", "||", "(", "date", ".", "length", "(", ")", "==", "4", "&&", "\"null\"", ".", "equalsIgnoreCase", "(", "date", ")", ")", ")", "{", "return", "null", ";", "}", "return", "createJUDate", "(", "parse", "(", "date", ",", "format", ",", "timeZone", ")", ")", ";", "}" ]
Converts the specified <code>date</code> with the specified {@code format} to a new instance of java.util.Date. <code>null</code> is returned if the specified <code>date</code> is null or empty. @param date @param format @throws IllegalArgumentException if the date given can't be parsed with specified format.
[ "Converts", "the", "specified", "<code", ">", "date<", "/", "code", ">", "with", "the", "specified", "{", "@code", "format", "}", "to", "a", "new", "instance", "of", "java", ".", "util", ".", "Date", ".", "<code", ">", "null<", "/", "code", ">", "is", "returned", "if", "the", "specified", "<code", ">", "date<", "/", "code", ">", "is", "null", "or", "empty", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L383-L389
FXMisc/Flowless
src/main/java/org/fxmisc/flowless/CellPositioner.java
CellPositioner.placeStartFromEnd
public C placeStartFromEnd(int itemIndex, double startOffEnd) { """ Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by {@code endOffStart}, so that the node's <em>bottom</em> edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. See {@link OrientationHelper}'s javadoc for more explanation on what quoted terms mean. <pre><code> --------- bottom of cell's node if startOffStart is negative __________ "top edge" of viewport / bottom of cell's node if startOffStart = 0 | | |--------- bottom of cell's node if startOffStart is positive | </code></pre> @param itemIndex the index of the item in the list of all (not currently visible) cells @param startOffEnd the amount by which to offset the "layoutY" value of the cell's node """ C cell = getSizedCell(itemIndex); double y = sizeTracker.getViewportLength() + startOffEnd; relocate(cell, 0, y); cell.getNode().setVisible(true); return cell; }
java
public C placeStartFromEnd(int itemIndex, double startOffEnd) { C cell = getSizedCell(itemIndex); double y = sizeTracker.getViewportLength() + startOffEnd; relocate(cell, 0, y); cell.getNode().setVisible(true); return cell; }
[ "public", "C", "placeStartFromEnd", "(", "int", "itemIndex", ",", "double", "startOffEnd", ")", "{", "C", "cell", "=", "getSizedCell", "(", "itemIndex", ")", ";", "double", "y", "=", "sizeTracker", ".", "getViewportLength", "(", ")", "+", "startOffEnd", ";", "relocate", "(", "cell", ",", "0", ",", "y", ")", ";", "cell", ".", "getNode", "(", ")", ".", "setVisible", "(", "true", ")", ";", "return", "cell", ";", "}" ]
Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by {@code endOffStart}, so that the node's <em>bottom</em> edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. See {@link OrientationHelper}'s javadoc for more explanation on what quoted terms mean. <pre><code> --------- bottom of cell's node if startOffStart is negative __________ "top edge" of viewport / bottom of cell's node if startOffStart = 0 | | |--------- bottom of cell's node if startOffStart is positive | </code></pre> @param itemIndex the index of the item in the list of all (not currently visible) cells @param startOffEnd the amount by which to offset the "layoutY" value of the cell's node
[ "Properly", "resizes", "the", "cell", "s", "node", "and", "sets", "its", "layoutY", "value", "so", "that", "is", "the", "last", "visible", "node", "in", "the", "viewport", "and", "further", "offsets", "this", "value", "by", "{", "@code", "endOffStart", "}", "so", "that", "the", "node", "s", "<em", ">", "bottom<", "/", "em", ">", "edge", "appears", "(", "if", "negative", ")", "above", "(", "if", "0", ")", "at", "or", "(", "if", "negative", ")", "below", "the", "viewport", "s", "top", "edge", ".", "See", "{", "@link", "OrientationHelper", "}", "s", "javadoc", "for", "more", "explanation", "on", "what", "quoted", "terms", "mean", "." ]
train
https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellPositioner.java#L204-L210
box/box-java-sdk
src/main/java/com/box/sdk/BoxCollaboration.java
BoxCollaboration.getInfo
public Info getInfo() { """ Gets information about this collaboration. @return info about this collaboration. """ BoxAPIConnection api = this.getAPI(); URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonObject = JsonObject.readFrom(response.getJSON()); return new Info(jsonObject); }
java
public Info getInfo() { BoxAPIConnection api = this.getAPI(); URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonObject = JsonObject.readFrom(response.getJSON()); return new Info(jsonObject); }
[ "public", "Info", "getInfo", "(", ")", "{", "BoxAPIConnection", "api", "=", "this", ".", "getAPI", "(", ")", ";", "URL", "url", "=", "COLLABORATION_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", "(", ")", ",", "this", ".", "getID", "(", ")", ")", ";", "BoxAPIRequest", "request", "=", "new", "BoxAPIRequest", "(", "api", ",", "url", ",", "\"GET\"", ")", ";", "BoxJSONResponse", "response", "=", "(", "BoxJSONResponse", ")", "request", ".", "send", "(", ")", ";", "JsonObject", "jsonObject", "=", "JsonObject", ".", "readFrom", "(", "response", ".", "getJSON", "(", ")", ")", ";", "return", "new", "Info", "(", "jsonObject", ")", ";", "}" ]
Gets information about this collaboration. @return info about this collaboration.
[ "Gets", "information", "about", "this", "collaboration", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxCollaboration.java#L132-L140
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.readInt
public static int readInt(DataInput in) throws IOException { """ Reads an int from an input stream @param in the input stream @return the int read from the input stream """ byte len=in.readByte(); if(len == 0) return 0; return makeInt(in, len); }
java
public static int readInt(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return 0; return makeInt(in, len); }
[ "public", "static", "int", "readInt", "(", "DataInput", "in", ")", "throws", "IOException", "{", "byte", "len", "=", "in", ".", "readByte", "(", ")", ";", "if", "(", "len", "==", "0", ")", "return", "0", ";", "return", "makeInt", "(", "in", ",", "len", ")", ";", "}" ]
Reads an int from an input stream @param in the input stream @return the int read from the input stream
[ "Reads", "an", "int", "from", "an", "input", "stream" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L149-L154
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/StrReplace.java
StrReplace.checkPreconditions
private static void checkPreconditions(final String regex, final String replacement) { """ Checks the preconditions for creating a new StrRegExReplace processor. @param regex the supplied regular expression @param replacement the supplied replacement text @throws IllegalArgumentException if regex is empty @throws NullPointerException if regex or replacement is null """ if( regex == null ) { throw new NullPointerException("regex should not be null"); } else if( regex.length() == 0 ) { throw new IllegalArgumentException("regex should not be empty"); } if( replacement == null ) { throw new NullPointerException("replacement should not be null"); } }
java
private static void checkPreconditions(final String regex, final String replacement) { if( regex == null ) { throw new NullPointerException("regex should not be null"); } else if( regex.length() == 0 ) { throw new IllegalArgumentException("regex should not be empty"); } if( replacement == null ) { throw new NullPointerException("replacement should not be null"); } }
[ "private", "static", "void", "checkPreconditions", "(", "final", "String", "regex", ",", "final", "String", "replacement", ")", "{", "if", "(", "regex", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"regex should not be null\"", ")", ";", "}", "else", "if", "(", "regex", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"regex should not be empty\"", ")", ";", "}", "if", "(", "replacement", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"replacement should not be null\"", ")", ";", "}", "}" ]
Checks the preconditions for creating a new StrRegExReplace processor. @param regex the supplied regular expression @param replacement the supplied replacement text @throws IllegalArgumentException if regex is empty @throws NullPointerException if regex or replacement is null
[ "Checks", "the", "preconditions", "for", "creating", "a", "new", "StrRegExReplace", "processor", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/StrReplace.java#L101-L111
xwiki/xwiki-rendering
xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/xwiki/xwiki20/XWikiReferenceParser.java
XWikiReferenceParser.parseReference
private void parseReference(char[] array, int i, StringBuffer reference, StringBuffer parameters) { """ Extract the link and the parameters. @param array the array to extract information from @param i the current position in the array @param reference the link buffer to fill @param parameters the parameters buffer to fill """ int nb; for (boolean escaped = false; i < array.length; ++i) { char c = array[i]; if (!escaped) { if (array[i] == '~' && !escaped) { escaped = true; } else if ((nb = countFirstChar(array, i, '|')) >= 2) { for (; nb > 2; --nb) { reference.append(array[i++]); } i += 2; parameters.append(array, i, array.length - i); break; } else { reference.append(c); } } else { reference.append(c); escaped = false; } } }
java
private void parseReference(char[] array, int i, StringBuffer reference, StringBuffer parameters) { int nb; for (boolean escaped = false; i < array.length; ++i) { char c = array[i]; if (!escaped) { if (array[i] == '~' && !escaped) { escaped = true; } else if ((nb = countFirstChar(array, i, '|')) >= 2) { for (; nb > 2; --nb) { reference.append(array[i++]); } i += 2; parameters.append(array, i, array.length - i); break; } else { reference.append(c); } } else { reference.append(c); escaped = false; } } }
[ "private", "void", "parseReference", "(", "char", "[", "]", "array", ",", "int", "i", ",", "StringBuffer", "reference", ",", "StringBuffer", "parameters", ")", "{", "int", "nb", ";", "for", "(", "boolean", "escaped", "=", "false", ";", "i", "<", "array", ".", "length", ";", "++", "i", ")", "{", "char", "c", "=", "array", "[", "i", "]", ";", "if", "(", "!", "escaped", ")", "{", "if", "(", "array", "[", "i", "]", "==", "'", "'", "&&", "!", "escaped", ")", "{", "escaped", "=", "true", ";", "}", "else", "if", "(", "(", "nb", "=", "countFirstChar", "(", "array", ",", "i", ",", "'", "'", ")", ")", ">=", "2", ")", "{", "for", "(", ";", "nb", ">", "2", ";", "--", "nb", ")", "{", "reference", ".", "append", "(", "array", "[", "i", "++", "]", ")", ";", "}", "i", "+=", "2", ";", "parameters", ".", "append", "(", "array", ",", "i", ",", "array", ".", "length", "-", "i", ")", ";", "break", ";", "}", "else", "{", "reference", ".", "append", "(", "c", ")", ";", "}", "}", "else", "{", "reference", ".", "append", "(", "c", ")", ";", "escaped", "=", "false", ";", "}", "}", "}" ]
Extract the link and the parameters. @param array the array to extract information from @param i the current position in the array @param reference the link buffer to fill @param parameters the parameters buffer to fill
[ "Extract", "the", "link", "and", "the", "parameters", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/xwiki/xwiki20/XWikiReferenceParser.java#L161-L187
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java
SheetBindingErrors.createFieldError
public InternalFieldErrorBuilder createFieldError(final String field, final String[] errorCodes) { """ フィールドエラーのビルダーを作成します。 @param field フィールドパス。 @param errorCodes エラーコード。先頭の要素が優先されます。 @return {@link FieldError}のインスタンスを組み立てるビルダクラス。 """ final String fieldPath = buildFieldPath(field); final Class<?> fieldType = getFieldType(field); final Object fieldValue = getFieldValue(field); String[] codes = new String[0]; for(String errorCode : errorCodes) { codes = Utils.concat(codes, generateMessageCodes(errorCode, fieldPath, fieldType)); } return new InternalFieldErrorBuilder(this, getObjectName(), fieldPath, codes) .sheetName(getSheetName()) .rejectedValue(fieldValue); }
java
public InternalFieldErrorBuilder createFieldError(final String field, final String[] errorCodes) { final String fieldPath = buildFieldPath(field); final Class<?> fieldType = getFieldType(field); final Object fieldValue = getFieldValue(field); String[] codes = new String[0]; for(String errorCode : errorCodes) { codes = Utils.concat(codes, generateMessageCodes(errorCode, fieldPath, fieldType)); } return new InternalFieldErrorBuilder(this, getObjectName(), fieldPath, codes) .sheetName(getSheetName()) .rejectedValue(fieldValue); }
[ "public", "InternalFieldErrorBuilder", "createFieldError", "(", "final", "String", "field", ",", "final", "String", "[", "]", "errorCodes", ")", "{", "final", "String", "fieldPath", "=", "buildFieldPath", "(", "field", ")", ";", "final", "Class", "<", "?", ">", "fieldType", "=", "getFieldType", "(", "field", ")", ";", "final", "Object", "fieldValue", "=", "getFieldValue", "(", "field", ")", ";", "String", "[", "]", "codes", "=", "new", "String", "[", "0", "]", ";", "for", "(", "String", "errorCode", ":", "errorCodes", ")", "{", "codes", "=", "Utils", ".", "concat", "(", "codes", ",", "generateMessageCodes", "(", "errorCode", ",", "fieldPath", ",", "fieldType", ")", ")", ";", "}", "return", "new", "InternalFieldErrorBuilder", "(", "this", ",", "getObjectName", "(", ")", ",", "fieldPath", ",", "codes", ")", ".", "sheetName", "(", "getSheetName", "(", ")", ")", ".", "rejectedValue", "(", "fieldValue", ")", ";", "}" ]
フィールドエラーのビルダーを作成します。 @param field フィールドパス。 @param errorCodes エラーコード。先頭の要素が優先されます。 @return {@link FieldError}のインスタンスを組み立てるビルダクラス。
[ "フィールドエラーのビルダーを作成します。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java#L619-L634
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java
SlingApi.postNodeAsync
public com.squareup.okhttp.Call postNodeAsync(String path, String name, String operation, String deleteAuthorizable, File file, final ApiCallback<Void> callback) throws ApiException { """ (asynchronously) @param path (required) @param name (required) @param operation (optional) @param deleteAuthorizable (optional) @param file (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postNodeValidateBeforeCall(path, name, operation, deleteAuthorizable, file, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; }
java
public com.squareup.okhttp.Call postNodeAsync(String path, String name, String operation, String deleteAuthorizable, File file, final ApiCallback<Void> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postNodeValidateBeforeCall(path, name, operation, deleteAuthorizable, file, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postNodeAsync", "(", "String", "path", ",", "String", "name", ",", "String", "operation", ",", "String", "deleteAuthorizable", ",", "File", "file", ",", "final", "ApiCallback", "<", "Void", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "postNodeValidateBeforeCall", "(", "path", ",", "name", ",", "operation", ",", "deleteAuthorizable", ",", "file", ",", "progressListener", ",", "progressRequestListener", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "callback", ")", ";", "return", "call", ";", "}" ]
(asynchronously) @param path (required) @param name (required) @param operation (optional) @param deleteAuthorizable (optional) @param file (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java#L3752-L3776
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.createOrUpdateAsync
public Observable<DataMigrationServiceInner> createOrUpdateAsync(String groupName, String serviceName, DataMigrationServiceInner parameters) { """ Create or update DMS Instance. The services resource is the top-level resource that represents the Data Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. @param groupName Name of the resource group @param serviceName Name of the service @param parameters Information about the service @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(groupName, serviceName, parameters).map(new Func1<ServiceResponse<DataMigrationServiceInner>, DataMigrationServiceInner>() { @Override public DataMigrationServiceInner call(ServiceResponse<DataMigrationServiceInner> response) { return response.body(); } }); }
java
public Observable<DataMigrationServiceInner> createOrUpdateAsync(String groupName, String serviceName, DataMigrationServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(groupName, serviceName, parameters).map(new Func1<ServiceResponse<DataMigrationServiceInner>, DataMigrationServiceInner>() { @Override public DataMigrationServiceInner call(ServiceResponse<DataMigrationServiceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataMigrationServiceInner", ">", "createOrUpdateAsync", "(", "String", "groupName", ",", "String", "serviceName", ",", "DataMigrationServiceInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DataMigrationServiceInner", ">", ",", "DataMigrationServiceInner", ">", "(", ")", "{", "@", "Override", "public", "DataMigrationServiceInner", "call", "(", "ServiceResponse", "<", "DataMigrationServiceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update DMS Instance. The services resource is the top-level resource that represents the Data Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property. @param groupName Name of the resource group @param serviceName Name of the service @param parameters Information about the service @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "update", "DMS", "Instance", ".", "The", "services", "resource", "is", "the", "top", "-", "level", "resource", "that", "represents", "the", "Data", "Migration", "Service", ".", "The", "PUT", "method", "creates", "a", "new", "service", "or", "updates", "an", "existing", "one", ".", "When", "a", "service", "is", "updated", "existing", "child", "resources", "(", "i", ".", "e", ".", "tasks", ")", "are", "unaffected", ".", "Services", "currently", "support", "a", "single", "kind", "vm", "which", "refers", "to", "a", "VM", "-", "based", "service", "although", "other", "kinds", "may", "be", "added", "in", "the", "future", ".", "This", "method", "can", "change", "the", "kind", "SKU", "and", "network", "of", "the", "service", "but", "if", "tasks", "are", "currently", "running", "(", "i", ".", "e", ".", "the", "service", "is", "busy", ")", "this", "will", "fail", "with", "400", "Bad", "Request", "(", "ServiceIsBusy", ")", ".", "The", "provider", "will", "reply", "when", "successful", "with", "200", "OK", "or", "201", "Created", ".", "Long", "-", "running", "operations", "use", "the", "provisioningState", "property", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L193-L200
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java
StructureDiagramGenerator.countAlignedBonds
private static int countAlignedBonds(IAtomContainer mol) { """ Count the number of bonds aligned to 30 degrees. @param mol molecule @return number of aligned bonds """ final double ref = Math.toRadians(30); final double diff = Math.toRadians(1); int count = 0; for (IBond bond : mol.bonds()) { Point2d beg = bond.getBegin().getPoint2d(); Point2d end = bond.getEnd().getPoint2d(); if (beg.x > end.x) { Point2d tmp = beg; beg = end; end = tmp; } Vector2d vec = new Vector2d(end.x - beg.x, end.y - beg.y); double angle = Math.atan2(vec.y, vec.x); if (Math.abs(angle) - ref < diff) { count++; } } return count; }
java
private static int countAlignedBonds(IAtomContainer mol) { final double ref = Math.toRadians(30); final double diff = Math.toRadians(1); int count = 0; for (IBond bond : mol.bonds()) { Point2d beg = bond.getBegin().getPoint2d(); Point2d end = bond.getEnd().getPoint2d(); if (beg.x > end.x) { Point2d tmp = beg; beg = end; end = tmp; } Vector2d vec = new Vector2d(end.x - beg.x, end.y - beg.y); double angle = Math.atan2(vec.y, vec.x); if (Math.abs(angle) - ref < diff) { count++; } } return count; }
[ "private", "static", "int", "countAlignedBonds", "(", "IAtomContainer", "mol", ")", "{", "final", "double", "ref", "=", "Math", ".", "toRadians", "(", "30", ")", ";", "final", "double", "diff", "=", "Math", ".", "toRadians", "(", "1", ")", ";", "int", "count", "=", "0", ";", "for", "(", "IBond", "bond", ":", "mol", ".", "bonds", "(", ")", ")", "{", "Point2d", "beg", "=", "bond", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ";", "Point2d", "end", "=", "bond", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ";", "if", "(", "beg", ".", "x", ">", "end", ".", "x", ")", "{", "Point2d", "tmp", "=", "beg", ";", "beg", "=", "end", ";", "end", "=", "tmp", ";", "}", "Vector2d", "vec", "=", "new", "Vector2d", "(", "end", ".", "x", "-", "beg", ".", "x", ",", "end", ".", "y", "-", "beg", ".", "y", ")", ";", "double", "angle", "=", "Math", ".", "atan2", "(", "vec", ".", "y", ",", "vec", ".", "x", ")", ";", "if", "(", "Math", ".", "abs", "(", "angle", ")", "-", "ref", "<", "diff", ")", "{", "count", "++", ";", "}", "}", "return", "count", ";", "}" ]
Count the number of bonds aligned to 30 degrees. @param mol molecule @return number of aligned bonds
[ "Count", "the", "number", "of", "bonds", "aligned", "to", "30", "degrees", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java#L1010-L1030
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java
NodeSet.addNode
public void addNode(Node n) { """ Add a node to the NodeSet. Not all types of NodeSets support this operation @param n Node to be added @throws RuntimeException thrown if this NodeSet is not of a mutable type. """ if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.addElement(n); }
java
public void addNode(Node n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); this.addElement(n); }
[ "public", "void", "addNode", "(", "Node", "n", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESET_NOT_MUTABLE", ",", "null", ")", ")", ";", "//\"This NodeSet is not mutable!\");", "this", ".", "addElement", "(", "n", ")", ";", "}" ]
Add a node to the NodeSet. Not all types of NodeSets support this operation @param n Node to be added @throws RuntimeException thrown if this NodeSet is not of a mutable type.
[ "Add", "a", "node", "to", "the", "NodeSet", ".", "Not", "all", "types", "of", "NodeSets", "support", "this", "operation" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L379-L386
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.Chebyshev
public static double Chebyshev(double x1, double y1, double x2, double y2) { """ Gets the Chebyshev distance between two points. @param x1 X1 axis coordinate. @param y1 Y1 axis coordinate. @param x2 X2 axis coordinate. @param y2 Y2 axis coordinate. @return The Chebyshev distance between x and y. """ double max = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)); return max; }
java
public static double Chebyshev(double x1, double y1, double x2, double y2) { double max = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)); return max; }
[ "public", "static", "double", "Chebyshev", "(", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ")", "{", "double", "max", "=", "Math", ".", "max", "(", "Math", ".", "abs", "(", "x1", "-", "x2", ")", ",", "Math", ".", "abs", "(", "y1", "-", "y2", ")", ")", ";", "return", "max", ";", "}" ]
Gets the Chebyshev distance between two points. @param x1 X1 axis coordinate. @param y1 Y1 axis coordinate. @param x2 X2 axis coordinate. @param y2 Y2 axis coordinate. @return The Chebyshev distance between x and y.
[ "Gets", "the", "Chebyshev", "distance", "between", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L198-L201
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addEntries
public Jar addEntries(String path, Path dirOrZip, Filter filter) throws IOException { """ Adds a directory (with all its subdirectories) or the contents of a zip/JAR to this JAR. @param path the path within the JAR where the root of the directory/zip will be placed, or {@code null} for the JAR's root @param dirOrZip the directory to add as an entry or a zip/JAR file whose contents will be extracted and added as entries @param filter a filter to select particular classes @return {@code this} """ return addEntries(path != null ? Paths.get(path) : null, dirOrZip, filter); }
java
public Jar addEntries(String path, Path dirOrZip, Filter filter) throws IOException { return addEntries(path != null ? Paths.get(path) : null, dirOrZip, filter); }
[ "public", "Jar", "addEntries", "(", "String", "path", ",", "Path", "dirOrZip", ",", "Filter", "filter", ")", "throws", "IOException", "{", "return", "addEntries", "(", "path", "!=", "null", "?", "Paths", ".", "get", "(", "path", ")", ":", "null", ",", "dirOrZip", ",", "filter", ")", ";", "}" ]
Adds a directory (with all its subdirectories) or the contents of a zip/JAR to this JAR. @param path the path within the JAR where the root of the directory/zip will be placed, or {@code null} for the JAR's root @param dirOrZip the directory to add as an entry or a zip/JAR file whose contents will be extracted and added as entries @param filter a filter to select particular classes @return {@code this}
[ "Adds", "a", "directory", "(", "with", "all", "its", "subdirectories", ")", "or", "the", "contents", "of", "a", "zip", "/", "JAR", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L422-L424
sarl/sarl
main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/SREutils.java
SREutils.setSreSpecificData
public static void setSreSpecificData(SRESpecificDataContainer container, Object data) { """ Change the data associated to the given container by the SRE. @param container the container. @param data the SRE-specific data. """ assert container != null; container.$setSreSpecificData(data); }
java
public static void setSreSpecificData(SRESpecificDataContainer container, Object data) { assert container != null; container.$setSreSpecificData(data); }
[ "public", "static", "void", "setSreSpecificData", "(", "SRESpecificDataContainer", "container", ",", "Object", "data", ")", "{", "assert", "container", "!=", "null", ";", "container", ".", "$", "setSreSpecificData", "(", "data", ")", ";", "}" ]
Change the data associated to the given container by the SRE. @param container the container. @param data the SRE-specific data.
[ "Change", "the", "data", "associated", "to", "the", "given", "container", "by", "the", "SRE", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/SREutils.java#L80-L83
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/avro/JsonIntermediateToAvroConverter.java
JsonIntermediateToAvroConverter.generateSchemaWithNullifiedField
protected Schema generateSchemaWithNullifiedField(WorkUnitState workUnitState, Schema currentAvroSchema) { """ Generate new avro schema by nullifying fields that previously existed but not in the current schema. @param workUnitState work unit state @param currentAvroSchema current schema @return merged schema with previous fields nullified. @throws SchemaConversionException """ Configuration conf = new Configuration(); for (String key : workUnitState.getPropertyNames()) { conf.set(key, workUnitState.getProp(key)); } // Get the original schema for merging. Path originalSchemaPath = null; if (workUnitState.contains(CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH)) { originalSchemaPath = new Path(workUnitState.getProp(CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH)); } else { // If the path to get the original schema is not specified in the configuration, // adopt the best-try policy to search adjacent output folders. LOG.info("Property " + CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH + "is not specified. Trying to get the orignal schema from previous avro files."); originalSchemaPath = WriterUtils .getDataPublisherFinalDir(workUnitState, workUnitState.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1), workUnitState.getPropAsInt(ConfigurationKeys.FORK_BRANCH_ID_KEY, 0)).getParent(); } try { Schema prevSchema = AvroUtils.getDirectorySchema(originalSchemaPath, conf, false); Schema mergedSchema = AvroUtils.nullifyFieldsForSchemaMerge(prevSchema, currentAvroSchema); return mergedSchema; } catch (IOException ioe) { LOG.error("Unable to nullify fields. Will retain the current avro schema.", ioe); return currentAvroSchema; } }
java
protected Schema generateSchemaWithNullifiedField(WorkUnitState workUnitState, Schema currentAvroSchema) { Configuration conf = new Configuration(); for (String key : workUnitState.getPropertyNames()) { conf.set(key, workUnitState.getProp(key)); } // Get the original schema for merging. Path originalSchemaPath = null; if (workUnitState.contains(CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH)) { originalSchemaPath = new Path(workUnitState.getProp(CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH)); } else { // If the path to get the original schema is not specified in the configuration, // adopt the best-try policy to search adjacent output folders. LOG.info("Property " + CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH + "is not specified. Trying to get the orignal schema from previous avro files."); originalSchemaPath = WriterUtils .getDataPublisherFinalDir(workUnitState, workUnitState.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1), workUnitState.getPropAsInt(ConfigurationKeys.FORK_BRANCH_ID_KEY, 0)).getParent(); } try { Schema prevSchema = AvroUtils.getDirectorySchema(originalSchemaPath, conf, false); Schema mergedSchema = AvroUtils.nullifyFieldsForSchemaMerge(prevSchema, currentAvroSchema); return mergedSchema; } catch (IOException ioe) { LOG.error("Unable to nullify fields. Will retain the current avro schema.", ioe); return currentAvroSchema; } }
[ "protected", "Schema", "generateSchemaWithNullifiedField", "(", "WorkUnitState", "workUnitState", ",", "Schema", "currentAvroSchema", ")", "{", "Configuration", "conf", "=", "new", "Configuration", "(", ")", ";", "for", "(", "String", "key", ":", "workUnitState", ".", "getPropertyNames", "(", ")", ")", "{", "conf", ".", "set", "(", "key", ",", "workUnitState", ".", "getProp", "(", "key", ")", ")", ";", "}", "// Get the original schema for merging.", "Path", "originalSchemaPath", "=", "null", ";", "if", "(", "workUnitState", ".", "contains", "(", "CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH", ")", ")", "{", "originalSchemaPath", "=", "new", "Path", "(", "workUnitState", ".", "getProp", "(", "CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH", ")", ")", ";", "}", "else", "{", "// If the path to get the original schema is not specified in the configuration,", "// adopt the best-try policy to search adjacent output folders.", "LOG", ".", "info", "(", "\"Property \"", "+", "CONVERTER_AVRO_NULLIFY_FIELDS_ORIGINAL_SCHEMA_PATH", "+", "\"is not specified. Trying to get the orignal schema from previous avro files.\"", ")", ";", "originalSchemaPath", "=", "WriterUtils", ".", "getDataPublisherFinalDir", "(", "workUnitState", ",", "workUnitState", ".", "getPropAsInt", "(", "ConfigurationKeys", ".", "FORK_BRANCHES_KEY", ",", "1", ")", ",", "workUnitState", ".", "getPropAsInt", "(", "ConfigurationKeys", ".", "FORK_BRANCH_ID_KEY", ",", "0", ")", ")", ".", "getParent", "(", ")", ";", "}", "try", "{", "Schema", "prevSchema", "=", "AvroUtils", ".", "getDirectorySchema", "(", "originalSchemaPath", ",", "conf", ",", "false", ")", ";", "Schema", "mergedSchema", "=", "AvroUtils", ".", "nullifyFieldsForSchemaMerge", "(", "prevSchema", ",", "currentAvroSchema", ")", ";", "return", "mergedSchema", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "LOG", ".", "error", "(", "\"Unable to nullify fields. Will retain the current avro schema.\"", ",", "ioe", ")", ";", "return", "currentAvroSchema", ";", "}", "}" ]
Generate new avro schema by nullifying fields that previously existed but not in the current schema. @param workUnitState work unit state @param currentAvroSchema current schema @return merged schema with previous fields nullified. @throws SchemaConversionException
[ "Generate", "new", "avro", "schema", "by", "nullifying", "fields", "that", "previously", "existed", "but", "not", "in", "the", "current", "schema", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/avro/JsonIntermediateToAvroConverter.java#L96-L122
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_portability_id_relaunch_POST
public void billingAccount_portability_id_relaunch_POST(String billingAccount, Long id, OvhSafeKeyValue<String>[] parameters) throws IOException { """ Fix error and relaunch portability REST: POST /telephony/{billingAccount}/portability/{id}/relaunch @param parameters [required] List of parameters to use to fix error @param billingAccount [required] The name of your billingAccount @param id [required] The ID of the portability """ String qPath = "/telephony/{billingAccount}/portability/{id}/relaunch"; StringBuilder sb = path(qPath, billingAccount, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "parameters", parameters); exec(qPath, "POST", sb.toString(), o); }
java
public void billingAccount_portability_id_relaunch_POST(String billingAccount, Long id, OvhSafeKeyValue<String>[] parameters) throws IOException { String qPath = "/telephony/{billingAccount}/portability/{id}/relaunch"; StringBuilder sb = path(qPath, billingAccount, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "parameters", parameters); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "billingAccount_portability_id_relaunch_POST", "(", "String", "billingAccount", ",", "Long", "id", ",", "OvhSafeKeyValue", "<", "String", ">", "[", "]", "parameters", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/portability/{id}/relaunch\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "id", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"parameters\"", ",", "parameters", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Fix error and relaunch portability REST: POST /telephony/{billingAccount}/portability/{id}/relaunch @param parameters [required] List of parameters to use to fix error @param billingAccount [required] The name of your billingAccount @param id [required] The ID of the portability
[ "Fix", "error", "and", "relaunch", "portability" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L315-L321
rubenlagus/TelegramBots
telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java
SendDocument.setDocument
public SendDocument setDocument(File file) { """ Use this method to set the document to a new file @param file New document file """ Objects.requireNonNull(file, "documentName cannot be null!"); this.document = new InputFile(file, file.getName()); return this; }
java
public SendDocument setDocument(File file) { Objects.requireNonNull(file, "documentName cannot be null!"); this.document = new InputFile(file, file.getName()); return this; }
[ "public", "SendDocument", "setDocument", "(", "File", "file", ")", "{", "Objects", ".", "requireNonNull", "(", "file", ",", "\"documentName cannot be null!\"", ")", ";", "this", ".", "document", "=", "new", "InputFile", "(", "file", ",", "file", ".", "getName", "(", ")", ")", ";", "return", "this", ";", "}" ]
Use this method to set the document to a new file @param file New document file
[ "Use", "this", "method", "to", "set", "the", "document", "to", "a", "new", "file" ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java#L89-L93
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.setBitmapRange
public static void setBitmapRange(long[] bitmap, int start, int end) { """ set bits at start, start+1,..., end-1 @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive) """ if (start == end) { return; } int firstword = start / 64; int endword = (end - 1) / 64; if (firstword == endword) { bitmap[firstword] |= (~0L << start) & (~0L >>> -end); return; } bitmap[firstword] |= ~0L << start; for (int i = firstword + 1; i < endword; i++) { bitmap[i] = ~0L; } bitmap[endword] |= ~0L >>> -end; }
java
public static void setBitmapRange(long[] bitmap, int start, int end) { if (start == end) { return; } int firstword = start / 64; int endword = (end - 1) / 64; if (firstword == endword) { bitmap[firstword] |= (~0L << start) & (~0L >>> -end); return; } bitmap[firstword] |= ~0L << start; for (int i = firstword + 1; i < endword; i++) { bitmap[i] = ~0L; } bitmap[endword] |= ~0L >>> -end; }
[ "public", "static", "void", "setBitmapRange", "(", "long", "[", "]", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", "==", "end", ")", "{", "return", ";", "}", "int", "firstword", "=", "start", "/", "64", ";", "int", "endword", "=", "(", "end", "-", "1", ")", "/", "64", ";", "if", "(", "firstword", "==", "endword", ")", "{", "bitmap", "[", "firstword", "]", "|=", "(", "~", "0L", "<<", "start", ")", "&", "(", "~", "0L", ">>>", "-", "end", ")", ";", "return", ";", "}", "bitmap", "[", "firstword", "]", "|=", "~", "0L", "<<", "start", ";", "for", "(", "int", "i", "=", "firstword", "+", "1", ";", "i", "<", "endword", ";", "i", "++", ")", "{", "bitmap", "[", "i", "]", "=", "~", "0L", ";", "}", "bitmap", "[", "endword", "]", "|=", "~", "0L", ">>>", "-", "end", ";", "}" ]
set bits at start, start+1,..., end-1 @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive)
[ "set", "bits", "at", "start", "start", "+", "1", "...", "end", "-", "1" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L501-L516
Hygieia/Hygieia
api/src/main/java/com/capitalone/dashboard/service/UserInfoServiceImpl.java
UserInfoServiceImpl.isUserValid
@Override public boolean isUserValid(String userId, AuthType authType) { """ Can be called to check validity of userId when creating a dashboard remotely via api @param userId @param authType @return """ if (userInfoRepository.findByUsernameAndAuthType(userId, authType) != null) { return true; } else { if (authType == AuthType.LDAP) { try { return searchLdapUser(userId); } catch (NamingException ne) { LOGGER.error("Failed to query ldap for " + userId, ne); return false; } } else { return false; } } }
java
@Override public boolean isUserValid(String userId, AuthType authType) { if (userInfoRepository.findByUsernameAndAuthType(userId, authType) != null) { return true; } else { if (authType == AuthType.LDAP) { try { return searchLdapUser(userId); } catch (NamingException ne) { LOGGER.error("Failed to query ldap for " + userId, ne); return false; } } else { return false; } } }
[ "@", "Override", "public", "boolean", "isUserValid", "(", "String", "userId", ",", "AuthType", "authType", ")", "{", "if", "(", "userInfoRepository", ".", "findByUsernameAndAuthType", "(", "userId", ",", "authType", ")", "!=", "null", ")", "{", "return", "true", ";", "}", "else", "{", "if", "(", "authType", "==", "AuthType", ".", "LDAP", ")", "{", "try", "{", "return", "searchLdapUser", "(", "userId", ")", ";", "}", "catch", "(", "NamingException", "ne", ")", "{", "LOGGER", ".", "error", "(", "\"Failed to query ldap for \"", "+", "userId", ",", "ne", ")", ";", "return", "false", ";", "}", "}", "else", "{", "return", "false", ";", "}", "}", "}" ]
Can be called to check validity of userId when creating a dashboard remotely via api @param userId @param authType @return
[ "Can", "be", "called", "to", "check", "validity", "of", "userId", "when", "creating", "a", "dashboard", "remotely", "via", "api" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/UserInfoServiceImpl.java#L134-L150
Hygieia/Hygieia
collectors/feature/jira/src/main/java/com/capitalone/dashboard/collector/DefaultJiraClient.java
DefaultJiraClient.processEpicData
protected static void processEpicData(Feature feature, Epic epic) { """ Process Epic data for a feature, updating the passed in feature @param feature @param epic """ feature.setsEpicID(epic.getId()); feature.setsEpicIsDeleted("false"); feature.setsEpicName(epic.getName()); feature.setsEpicNumber(epic.getNumber()); feature.setsEpicType(""); feature.setsEpicAssetState(epic.getStatus()); feature.setsEpicBeginDate(epic.getBeginDate()); feature.setsEpicChangeDate(epic.getChangeDate()); feature.setsEpicEndDate(epic.getEndDate()); feature.setsEpicUrl(epic.getUrl()); }
java
protected static void processEpicData(Feature feature, Epic epic) { feature.setsEpicID(epic.getId()); feature.setsEpicIsDeleted("false"); feature.setsEpicName(epic.getName()); feature.setsEpicNumber(epic.getNumber()); feature.setsEpicType(""); feature.setsEpicAssetState(epic.getStatus()); feature.setsEpicBeginDate(epic.getBeginDate()); feature.setsEpicChangeDate(epic.getChangeDate()); feature.setsEpicEndDate(epic.getEndDate()); feature.setsEpicUrl(epic.getUrl()); }
[ "protected", "static", "void", "processEpicData", "(", "Feature", "feature", ",", "Epic", "epic", ")", "{", "feature", ".", "setsEpicID", "(", "epic", ".", "getId", "(", ")", ")", ";", "feature", ".", "setsEpicIsDeleted", "(", "\"false\"", ")", ";", "feature", ".", "setsEpicName", "(", "epic", ".", "getName", "(", ")", ")", ";", "feature", ".", "setsEpicNumber", "(", "epic", ".", "getNumber", "(", ")", ")", ";", "feature", ".", "setsEpicType", "(", "\"\"", ")", ";", "feature", ".", "setsEpicAssetState", "(", "epic", ".", "getStatus", "(", ")", ")", ";", "feature", ".", "setsEpicBeginDate", "(", "epic", ".", "getBeginDate", "(", ")", ")", ";", "feature", ".", "setsEpicChangeDate", "(", "epic", ".", "getChangeDate", "(", ")", ")", ";", "feature", ".", "setsEpicEndDate", "(", "epic", ".", "getEndDate", "(", ")", ")", ";", "feature", ".", "setsEpicUrl", "(", "epic", ".", "getUrl", "(", ")", ")", ";", "}" ]
Process Epic data for a feature, updating the passed in feature @param feature @param epic
[ "Process", "Epic", "data", "for", "a", "feature", "updating", "the", "passed", "in", "feature" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/jira/src/main/java/com/capitalone/dashboard/collector/DefaultJiraClient.java#L538-L549
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.getNode
public static int getNode(Network bn, String nodeName) throws ShanksException { """ Return the complete node @param bn @param nodeName @return the ProbabilisticNode object @throws UnknownNodeException """ int node = bn.getNode(nodeName); return node; }
java
public static int getNode(Network bn, String nodeName) throws ShanksException { int node = bn.getNode(nodeName); return node; }
[ "public", "static", "int", "getNode", "(", "Network", "bn", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "int", "node", "=", "bn", ".", "getNode", "(", "nodeName", ")", ";", "return", "node", ";", "}" ]
Return the complete node @param bn @param nodeName @return the ProbabilisticNode object @throws UnknownNodeException
[ "Return", "the", "complete", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java#L384-L388
lkwg82/enforcer-rules
src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
EnforcerRuleUtils.checkIfModelMatches
protected boolean checkIfModelMatches ( String groupId, String artifactId, String version, Model model ) { """ Make sure the model is the one I'm expecting. @param groupId the group id @param artifactId the artifact id @param version the version @param model Model being checked. @return true, if check if model matches """ // try these first. String modelGroup = model.getGroupId(); String modelArtifactId = model.getArtifactId(); String modelVersion = model.getVersion(); try { if ( StringUtils.isEmpty( modelGroup ) ) { modelGroup = model.getParent().getGroupId(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId} modelGroup = (String) helper.evaluate( modelGroup ); } if ( StringUtils.isEmpty( modelVersion ) ) { modelVersion = model.getParent().getVersion(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.version} modelVersion = (String) helper.evaluate( modelVersion ); } // Is this only required for Maven2? modelArtifactId = (String) helper.evaluate( modelArtifactId ); } catch ( NullPointerException e ) { // this is probably bad. I don't have a valid // group or version and I can't find a // parent???? // lets see if it's what we're looking for // anyway. } catch ( ExpressionEvaluationException e ) { // as above } return ( StringUtils.equals( groupId, modelGroup ) && StringUtils.equals( version, modelVersion ) && StringUtils .equals( artifactId, modelArtifactId ) ); }
java
protected boolean checkIfModelMatches ( String groupId, String artifactId, String version, Model model ) { // try these first. String modelGroup = model.getGroupId(); String modelArtifactId = model.getArtifactId(); String modelVersion = model.getVersion(); try { if ( StringUtils.isEmpty( modelGroup ) ) { modelGroup = model.getParent().getGroupId(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId} modelGroup = (String) helper.evaluate( modelGroup ); } if ( StringUtils.isEmpty( modelVersion ) ) { modelVersion = model.getParent().getVersion(); } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.version} modelVersion = (String) helper.evaluate( modelVersion ); } // Is this only required for Maven2? modelArtifactId = (String) helper.evaluate( modelArtifactId ); } catch ( NullPointerException e ) { // this is probably bad. I don't have a valid // group or version and I can't find a // parent???? // lets see if it's what we're looking for // anyway. } catch ( ExpressionEvaluationException e ) { // as above } return ( StringUtils.equals( groupId, modelGroup ) && StringUtils.equals( version, modelVersion ) && StringUtils .equals( artifactId, modelArtifactId ) ); }
[ "protected", "boolean", "checkIfModelMatches", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "Model", "model", ")", "{", "// try these first.", "String", "modelGroup", "=", "model", ".", "getGroupId", "(", ")", ";", "String", "modelArtifactId", "=", "model", ".", "getArtifactId", "(", ")", ";", "String", "modelVersion", "=", "model", ".", "getVersion", "(", ")", ";", "try", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "modelGroup", ")", ")", "{", "modelGroup", "=", "model", ".", "getParent", "(", ")", ".", "getGroupId", "(", ")", ";", "}", "else", "{", "// MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId}", "modelGroup", "=", "(", "String", ")", "helper", ".", "evaluate", "(", "modelGroup", ")", ";", "}", "if", "(", "StringUtils", ".", "isEmpty", "(", "modelVersion", ")", ")", "{", "modelVersion", "=", "model", ".", "getParent", "(", ")", ".", "getVersion", "(", ")", ";", "}", "else", "{", "// MENFORCER-30, handle cases where the value is a property like ${project.parent.version}", "modelVersion", "=", "(", "String", ")", "helper", ".", "evaluate", "(", "modelVersion", ")", ";", "}", "// Is this only required for Maven2?", "modelArtifactId", "=", "(", "String", ")", "helper", ".", "evaluate", "(", "modelArtifactId", ")", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "// this is probably bad. I don't have a valid", "// group or version and I can't find a", "// parent????", "// lets see if it's what we're looking for", "// anyway.", "}", "catch", "(", "ExpressionEvaluationException", "e", ")", "{", "// as above", "}", "return", "(", "StringUtils", ".", "equals", "(", "groupId", ",", "modelGroup", ")", "&&", "StringUtils", ".", "equals", "(", "version", ",", "modelVersion", ")", "&&", "StringUtils", ".", "equals", "(", "artifactId", ",", "modelArtifactId", ")", ")", ";", "}" ]
Make sure the model is the one I'm expecting. @param groupId the group id @param artifactId the artifact id @param version the version @param model Model being checked. @return true, if check if model matches
[ "Make", "sure", "the", "model", "is", "the", "one", "I", "m", "expecting", "." ]
train
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java#L285-L331
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java
SpiderTransaction.addIDValueColumn
public void addIDValueColumn(TableDefinition tableDef, String objID) { """ Similar to {@link #addScalarValueColumn(DBObject, String, String)} but specialized for the _ID field. Adds the _ID column for the object's primary store. @param tableDef {@link TableDefinition} of owning table. @param objID ID of object whose _ID value to set. @see #addScalarValueColumn(DBObject, String, String) """ addColumn(SpiderService.objectsStoreName(tableDef), objID, CommonDefs.ID_FIELD, Utils.toBytes(objID)); }
java
public void addIDValueColumn(TableDefinition tableDef, String objID) { addColumn(SpiderService.objectsStoreName(tableDef), objID, CommonDefs.ID_FIELD, Utils.toBytes(objID)); }
[ "public", "void", "addIDValueColumn", "(", "TableDefinition", "tableDef", ",", "String", "objID", ")", "{", "addColumn", "(", "SpiderService", ".", "objectsStoreName", "(", "tableDef", ")", ",", "objID", ",", "CommonDefs", ".", "ID_FIELD", ",", "Utils", ".", "toBytes", "(", "objID", ")", ")", ";", "}" ]
Similar to {@link #addScalarValueColumn(DBObject, String, String)} but specialized for the _ID field. Adds the _ID column for the object's primary store. @param tableDef {@link TableDefinition} of owning table. @param objID ID of object whose _ID value to set. @see #addScalarValueColumn(DBObject, String, String)
[ "Similar", "to", "{", "@link", "#addScalarValueColumn", "(", "DBObject", "String", "String", ")", "}", "but", "specialized", "for", "the", "_ID", "field", ".", "Adds", "the", "_ID", "column", "for", "the", "object", "s", "primary", "store", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L223-L225
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/util/SourceWriteUtil.java
SourceWriteUtil.writeBindingContext
public void writeBindingContext(SourceWriter writer, Context context) { """ Writes out a binding context, followed by a newline. <p>Binding contexts may contain newlines; this routine translates those for the SourceWriter to ensure that indents, Javadoc comments, etc are handled properly. """ // Avoid a trailing \n -- the GWT class source file composer will output an // ugly extra newline if we do that. String text = context.toString(); boolean first = true; for (String line : text.split("\n")) { if (first) { first = false; } else { writer.println(); } // Indent the line relative to its current location. writer.indent() // won't work, since it does the wrong thing in Javadoc. writer.print(" "); writer.print(line); } }
java
public void writeBindingContext(SourceWriter writer, Context context) { // Avoid a trailing \n -- the GWT class source file composer will output an // ugly extra newline if we do that. String text = context.toString(); boolean first = true; for (String line : text.split("\n")) { if (first) { first = false; } else { writer.println(); } // Indent the line relative to its current location. writer.indent() // won't work, since it does the wrong thing in Javadoc. writer.print(" "); writer.print(line); } }
[ "public", "void", "writeBindingContext", "(", "SourceWriter", "writer", ",", "Context", "context", ")", "{", "// Avoid a trailing \\n -- the GWT class source file composer will output an", "// ugly extra newline if we do that.", "String", "text", "=", "context", ".", "toString", "(", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "String", "line", ":", "text", ".", "split", "(", "\"\\n\"", ")", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";", "}", "else", "{", "writer", ".", "println", "(", ")", ";", "}", "// Indent the line relative to its current location. writer.indent()", "// won't work, since it does the wrong thing in Javadoc.", "writer", ".", "print", "(", "\" \"", ")", ";", "writer", ".", "print", "(", "line", ")", ";", "}", "}" ]
Writes out a binding context, followed by a newline. <p>Binding contexts may contain newlines; this routine translates those for the SourceWriter to ensure that indents, Javadoc comments, etc are handled properly.
[ "Writes", "out", "a", "binding", "context", "followed", "by", "a", "newline", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/SourceWriteUtil.java#L205-L221
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java
JimfsFileStore.readAttributes
<A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) { """ Returns attributes of the given file as an object of the given type. @throws UnsupportedOperationException if the given attributes type is not supported """ state.checkOpen(); return attributes.readAttributes(file, type); }
java
<A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) { state.checkOpen(); return attributes.readAttributes(file, type); }
[ "<", "A", "extends", "BasicFileAttributes", ">", "A", "readAttributes", "(", "File", "file", ",", "Class", "<", "A", ">", "type", ")", "{", "state", ".", "checkOpen", "(", ")", ";", "return", "attributes", ".", "readAttributes", "(", "file", ",", "type", ")", ";", "}" ]
Returns attributes of the given file as an object of the given type. @throws UnsupportedOperationException if the given attributes type is not supported
[ "Returns", "attributes", "of", "the", "given", "file", "as", "an", "object", "of", "the", "given", "type", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java#L192-L195
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/AbstractPromotionOperation.java
AbstractPromotionOperation.sendMigrationEvent
void sendMigrationEvent(final MigrationStatus status) { """ Sends a {@link MigrationEvent} to registered listeners with status {@code status}. """ final int partitionId = getPartitionId(); final NodeEngine nodeEngine = getNodeEngine(); final Member localMember = nodeEngine.getLocalMember(); final MigrationEvent event = new MigrationEvent(partitionId, null, localMember, status); final EventService eventService = nodeEngine.getEventService(); final Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, MIGRATION_EVENT_TOPIC); eventService.publishEvent(SERVICE_NAME, registrations, event, partitionId); }
java
void sendMigrationEvent(final MigrationStatus status) { final int partitionId = getPartitionId(); final NodeEngine nodeEngine = getNodeEngine(); final Member localMember = nodeEngine.getLocalMember(); final MigrationEvent event = new MigrationEvent(partitionId, null, localMember, status); final EventService eventService = nodeEngine.getEventService(); final Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, MIGRATION_EVENT_TOPIC); eventService.publishEvent(SERVICE_NAME, registrations, event, partitionId); }
[ "void", "sendMigrationEvent", "(", "final", "MigrationStatus", "status", ")", "{", "final", "int", "partitionId", "=", "getPartitionId", "(", ")", ";", "final", "NodeEngine", "nodeEngine", "=", "getNodeEngine", "(", ")", ";", "final", "Member", "localMember", "=", "nodeEngine", ".", "getLocalMember", "(", ")", ";", "final", "MigrationEvent", "event", "=", "new", "MigrationEvent", "(", "partitionId", ",", "null", ",", "localMember", ",", "status", ")", ";", "final", "EventService", "eventService", "=", "nodeEngine", ".", "getEventService", "(", ")", ";", "final", "Collection", "<", "EventRegistration", ">", "registrations", "=", "eventService", ".", "getRegistrations", "(", "SERVICE_NAME", ",", "MIGRATION_EVENT_TOPIC", ")", ";", "eventService", ".", "publishEvent", "(", "SERVICE_NAME", ",", "registrations", ",", "event", ",", "partitionId", ")", ";", "}" ]
Sends a {@link MigrationEvent} to registered listeners with status {@code status}.
[ "Sends", "a", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/AbstractPromotionOperation.java#L51-L60
Azure/azure-sdk-for-java
signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java
SignalRsInner.beginCreateOrUpdate
public SignalRResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { """ Create a new SignalR service and update an exiting SignalR service. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param resourceName The name of the SignalR resource. @param parameters Parameters for the create or update operation @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SignalRResourceInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); }
java
public SignalRResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); }
[ "public", "SignalRResourceInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "SignalRCreateParameters", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create a new SignalR service and update an exiting SignalR service. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param resourceName The name of the SignalR resource. @param parameters Parameters for the create or update operation @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SignalRResourceInner object if successful.
[ "Create", "a", "new", "SignalR", "service", "and", "update", "an", "exiting", "SignalR", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1208-L1210
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/metadata/table/ShardingTableMetaData.java
ShardingTableMetaData.containsColumn
public boolean containsColumn(final String tableName, final String column) { """ Judge contains column from table meta data or not. @param tableName table name @param column column @return contains column from table meta data or not """ return containsTable(tableName) && tables.get(tableName).getColumns().keySet().contains(column.toLowerCase()); }
java
public boolean containsColumn(final String tableName, final String column) { return containsTable(tableName) && tables.get(tableName).getColumns().keySet().contains(column.toLowerCase()); }
[ "public", "boolean", "containsColumn", "(", "final", "String", "tableName", ",", "final", "String", "column", ")", "{", "return", "containsTable", "(", "tableName", ")", "&&", "tables", ".", "get", "(", "tableName", ")", ".", "getColumns", "(", ")", ".", "keySet", "(", ")", ".", "contains", "(", "column", ".", "toLowerCase", "(", ")", ")", ";", "}" ]
Judge contains column from table meta data or not. @param tableName table name @param column column @return contains column from table meta data or not
[ "Judge", "contains", "column", "from", "table", "meta", "data", "or", "not", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/metadata/table/ShardingTableMetaData.java#L85-L87
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java
RowTypeInfo.projectFields
public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping) { """ Creates a {@link RowTypeInfo} with projected fields. @param rowType The original RowTypeInfo whose fields are projected @param fieldMapping The field mapping of the projection @return A RowTypeInfo with projected fields. """ TypeInformation[] fieldTypes = new TypeInformation[fieldMapping.length]; String[] fieldNames = new String[fieldMapping.length]; for (int i = 0; i < fieldMapping.length; i++) { fieldTypes[i] = rowType.getTypeAt(fieldMapping[i]); fieldNames[i] = rowType.getFieldNames()[fieldMapping[i]]; } return new RowTypeInfo(fieldTypes, fieldNames); }
java
public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping) { TypeInformation[] fieldTypes = new TypeInformation[fieldMapping.length]; String[] fieldNames = new String[fieldMapping.length]; for (int i = 0; i < fieldMapping.length; i++) { fieldTypes[i] = rowType.getTypeAt(fieldMapping[i]); fieldNames[i] = rowType.getFieldNames()[fieldMapping[i]]; } return new RowTypeInfo(fieldTypes, fieldNames); }
[ "public", "static", "RowTypeInfo", "projectFields", "(", "RowTypeInfo", "rowType", ",", "int", "[", "]", "fieldMapping", ")", "{", "TypeInformation", "[", "]", "fieldTypes", "=", "new", "TypeInformation", "[", "fieldMapping", ".", "length", "]", ";", "String", "[", "]", "fieldNames", "=", "new", "String", "[", "fieldMapping", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fieldMapping", ".", "length", ";", "i", "++", ")", "{", "fieldTypes", "[", "i", "]", "=", "rowType", ".", "getTypeAt", "(", "fieldMapping", "[", "i", "]", ")", ";", "fieldNames", "[", "i", "]", "=", "rowType", ".", "getFieldNames", "(", ")", "[", "fieldMapping", "[", "i", "]", "]", ";", "}", "return", "new", "RowTypeInfo", "(", "fieldTypes", ",", "fieldNames", ")", ";", "}" ]
Creates a {@link RowTypeInfo} with projected fields. @param rowType The original RowTypeInfo whose fields are projected @param fieldMapping The field mapping of the projection @return A RowTypeInfo with projected fields.
[ "Creates", "a", "{", "@link", "RowTypeInfo", "}", "with", "projected", "fields", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java#L388-L396
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.toleranceDistance
public static double toleranceDistance(int zoom, int pixels) { """ Get the tolerance distance in meters for the zoom level and pixels length @param zoom zoom level @param pixels pixel length @return tolerance distance in meters @since 2.0.0 """ double tileSize = tileSizeWithZoom(zoom); double tolerance = tileSize / pixels; return tolerance; }
java
public static double toleranceDistance(int zoom, int pixels) { double tileSize = tileSizeWithZoom(zoom); double tolerance = tileSize / pixels; return tolerance; }
[ "public", "static", "double", "toleranceDistance", "(", "int", "zoom", ",", "int", "pixels", ")", "{", "double", "tileSize", "=", "tileSizeWithZoom", "(", "zoom", ")", ";", "double", "tolerance", "=", "tileSize", "/", "pixels", ";", "return", "tolerance", ";", "}" ]
Get the tolerance distance in meters for the zoom level and pixels length @param zoom zoom level @param pixels pixel length @return tolerance distance in meters @since 2.0.0
[ "Get", "the", "tolerance", "distance", "in", "meters", "for", "the", "zoom", "level", "and", "pixels", "length" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L735-L739
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/BaseAsset.java
BaseAsset.createConversation
public Conversation createConversation(Member author, String content) { """ Creates conversation with an expression which mentioned this asset. @param author Author of conversation expression. @param content Content of conversation expression. @return Created conversation """ Conversation conversation = getInstance().create().conversation(author, content); Iterator<Expression> iterator = conversation.getContainedExpressions().iterator(); iterator.next().getMentions().add(this); conversation.save(); return conversation; }
java
public Conversation createConversation(Member author, String content) { Conversation conversation = getInstance().create().conversation(author, content); Iterator<Expression> iterator = conversation.getContainedExpressions().iterator(); iterator.next().getMentions().add(this); conversation.save(); return conversation; }
[ "public", "Conversation", "createConversation", "(", "Member", "author", ",", "String", "content", ")", "{", "Conversation", "conversation", "=", "getInstance", "(", ")", ".", "create", "(", ")", ".", "conversation", "(", "author", ",", "content", ")", ";", "Iterator", "<", "Expression", ">", "iterator", "=", "conversation", ".", "getContainedExpressions", "(", ")", ".", "iterator", "(", ")", ";", "iterator", ".", "next", "(", ")", ".", "getMentions", "(", ")", ".", "add", "(", "this", ")", ";", "conversation", ".", "save", "(", ")", ";", "return", "conversation", ";", "}" ]
Creates conversation with an expression which mentioned this asset. @param author Author of conversation expression. @param content Content of conversation expression. @return Created conversation
[ "Creates", "conversation", "with", "an", "expression", "which", "mentioned", "this", "asset", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/BaseAsset.java#L304-L310
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.createOccurrence
public final Occurrence createOccurrence(String parent, Occurrence occurrence) { """ Creates a new occurrence. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); Occurrence occurrence = Occurrence.newBuilder().build(); Occurrence response = grafeasV1Beta1Client.createOccurrence(parent.toString(), occurrence); } </code></pre> @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created. @param occurrence The occurrence to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder().setParent(parent).setOccurrence(occurrence).build(); return createOccurrence(request); }
java
public final Occurrence createOccurrence(String parent, Occurrence occurrence) { CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder().setParent(parent).setOccurrence(occurrence).build(); return createOccurrence(request); }
[ "public", "final", "Occurrence", "createOccurrence", "(", "String", "parent", ",", "Occurrence", "occurrence", ")", "{", "CreateOccurrenceRequest", "request", "=", "CreateOccurrenceRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setOccurrence", "(", "occurrence", ")", ".", "build", "(", ")", ";", "return", "createOccurrence", "(", "request", ")", ";", "}" ]
Creates a new occurrence. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); Occurrence occurrence = Occurrence.newBuilder().build(); Occurrence response = grafeasV1Beta1Client.createOccurrence(parent.toString(), occurrence); } </code></pre> @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created. @param occurrence The occurrence to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "occurrence", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L571-L576
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java
MavenReleaseWrapper.getMavenModules
private List<String> getMavenModules(MavenModuleSetBuild mavenBuild) throws IOException, InterruptedException { """ Retrieve from the parent pom the path to the modules of the project """ FilePath pathToModuleRoot = mavenBuild.getModuleRoot(); FilePath pathToPom = new FilePath(pathToModuleRoot, mavenBuild.getProject().getRootPOM(null)); return pathToPom.act(new MavenModulesExtractor()); }
java
private List<String> getMavenModules(MavenModuleSetBuild mavenBuild) throws IOException, InterruptedException { FilePath pathToModuleRoot = mavenBuild.getModuleRoot(); FilePath pathToPom = new FilePath(pathToModuleRoot, mavenBuild.getProject().getRootPOM(null)); return pathToPom.act(new MavenModulesExtractor()); }
[ "private", "List", "<", "String", ">", "getMavenModules", "(", "MavenModuleSetBuild", "mavenBuild", ")", "throws", "IOException", ",", "InterruptedException", "{", "FilePath", "pathToModuleRoot", "=", "mavenBuild", ".", "getModuleRoot", "(", ")", ";", "FilePath", "pathToPom", "=", "new", "FilePath", "(", "pathToModuleRoot", ",", "mavenBuild", ".", "getProject", "(", ")", ".", "getRootPOM", "(", "null", ")", ")", ";", "return", "pathToPom", ".", "act", "(", "new", "MavenModulesExtractor", "(", ")", ")", ";", "}" ]
Retrieve from the parent pom the path to the modules of the project
[ "Retrieve", "from", "the", "parent", "pom", "the", "path", "to", "the", "modules", "of", "the", "project" ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/MavenReleaseWrapper.java#L238-L242
hypercube1024/firefly
firefly-db/src/main/java/com/firefly/db/init/ScriptStatementFailedException.java
ScriptStatementFailedException.buildErrorMessage
public static String buildErrorMessage(String stmt, int stmtNumber, EncodedResource encodedResource) { """ Build an error message for an SQL script execution failure, based on the supplied arguments. @param stmt the actual SQL statement that failed @param stmtNumber the statement number in the SQL script (i.e., the n<sup>th</sup> statement present in the resource) @param encodedResource the resource from which the SQL statement was read @return an error message suitable for an exception's <em>detail message</em> or logging @since 4.2 """ return String.format("Failed to execute SQL script statement #%s of %s: %s", stmtNumber, encodedResource, stmt); }
java
public static String buildErrorMessage(String stmt, int stmtNumber, EncodedResource encodedResource) { return String.format("Failed to execute SQL script statement #%s of %s: %s", stmtNumber, encodedResource, stmt); }
[ "public", "static", "String", "buildErrorMessage", "(", "String", "stmt", ",", "int", "stmtNumber", ",", "EncodedResource", "encodedResource", ")", "{", "return", "String", ".", "format", "(", "\"Failed to execute SQL script statement #%s of %s: %s\"", ",", "stmtNumber", ",", "encodedResource", ",", "stmt", ")", ";", "}" ]
Build an error message for an SQL script execution failure, based on the supplied arguments. @param stmt the actual SQL statement that failed @param stmtNumber the statement number in the SQL script (i.e., the n<sup>th</sup> statement present in the resource) @param encodedResource the resource from which the SQL statement was read @return an error message suitable for an exception's <em>detail message</em> or logging @since 4.2
[ "Build", "an", "error", "message", "for", "an", "SQL", "script", "execution", "failure", "based", "on", "the", "supplied", "arguments", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptStatementFailedException.java#L38-L40
JM-Lab/utils-java9
src/main/java/kr/jm/utils/HttpRequester.java
HttpRequester.getResponseAsString
public static String getResponseAsString(URI uri, Header header) { """ Gets response as string. @param uri the uri @param header the header @return the response as string """ return getResponseAsString(uri.toString(), header); }
java
public static String getResponseAsString(URI uri, Header header) { return getResponseAsString(uri.toString(), header); }
[ "public", "static", "String", "getResponseAsString", "(", "URI", "uri", ",", "Header", "header", ")", "{", "return", "getResponseAsString", "(", "uri", ".", "toString", "(", ")", ",", "header", ")", ";", "}" ]
Gets response as string. @param uri the uri @param header the header @return the response as string
[ "Gets", "response", "as", "string", "." ]
train
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/HttpRequester.java#L88-L90
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/AddressInfo.java
AddressInfo.of
public static AddressInfo of(String region, String name) { """ Returns an {@code AddressInfo} object for the provided region and address names. The object corresponds to a region address. """ return of(RegionAddressId.of(region, name)); }
java
public static AddressInfo of(String region, String name) { return of(RegionAddressId.of(region, name)); }
[ "public", "static", "AddressInfo", "of", "(", "String", "region", ",", "String", "name", ")", "{", "return", "of", "(", "RegionAddressId", ".", "of", "(", "region", ",", "name", ")", ")", ";", "}" ]
Returns an {@code AddressInfo} object for the provided region and address names. The object corresponds to a region address.
[ "Returns", "an", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/AddressInfo.java#L541-L543
forge/core
facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java
FacetInspector.getAllOptionalFacets
public static <FACETEDTYPE extends Faceted<FACETTYPE>, FACETTYPE extends Facet<FACETEDTYPE>> Set<Class<FACETTYPE>> getAllOptionalFacets( final Class<FACETTYPE> inspectedType) { """ Inspect the given {@link Class} for all {@link FacetConstraintType#OPTIONAL} dependency {@link Facet} types. This method inspects the entire constraint tree. """ Set<Class<FACETTYPE>> seen = new LinkedHashSet<Class<FACETTYPE>>(); return getAllRelatedFacets(seen, inspectedType, FacetConstraintType.OPTIONAL); }
java
public static <FACETEDTYPE extends Faceted<FACETTYPE>, FACETTYPE extends Facet<FACETEDTYPE>> Set<Class<FACETTYPE>> getAllOptionalFacets( final Class<FACETTYPE> inspectedType) { Set<Class<FACETTYPE>> seen = new LinkedHashSet<Class<FACETTYPE>>(); return getAllRelatedFacets(seen, inspectedType, FacetConstraintType.OPTIONAL); }
[ "public", "static", "<", "FACETEDTYPE", "extends", "Faceted", "<", "FACETTYPE", ">", ",", "FACETTYPE", "extends", "Facet", "<", "FACETEDTYPE", ">", ">", "Set", "<", "Class", "<", "FACETTYPE", ">", ">", "getAllOptionalFacets", "(", "final", "Class", "<", "FACETTYPE", ">", "inspectedType", ")", "{", "Set", "<", "Class", "<", "FACETTYPE", ">>", "seen", "=", "new", "LinkedHashSet", "<", "Class", "<", "FACETTYPE", ">", ">", "(", ")", ";", "return", "getAllRelatedFacets", "(", "seen", ",", "inspectedType", ",", "FacetConstraintType", ".", "OPTIONAL", ")", ";", "}" ]
Inspect the given {@link Class} for all {@link FacetConstraintType#OPTIONAL} dependency {@link Facet} types. This method inspects the entire constraint tree.
[ "Inspect", "the", "given", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java#L135-L140
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getCurrency
public static CurrencyUnit getCurrency(CurrencyQuery query) { """ Query all currencies matching the given query. @param query The {@link javax.money.CurrencyQuery}, not null. @return the list of known currencies, never null. """ return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow( () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup.")) .getCurrency(query); }
java
public static CurrencyUnit getCurrency(CurrencyQuery query) { return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow( () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup.")) .getCurrency(query); }
[ "public", "static", "CurrencyUnit", "getCurrency", "(", "CurrencyQuery", "query", ")", "{", "return", "Optional", ".", "ofNullable", "(", "MONETARY_CURRENCIES_SINGLETON_SPI", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "MonetaryException", "(", "\"No MonetaryCurrenciesSingletonSpi loaded, check your system setup.\"", ")", ")", ".", "getCurrency", "(", "query", ")", ";", "}" ]
Query all currencies matching the given query. @param query The {@link javax.money.CurrencyQuery}, not null. @return the list of known currencies, never null.
[ "Query", "all", "currencies", "matching", "the", "given", "query", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L470-L474
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java
CalendarCodeGenerator.addSkeletonClassifierMethod
private void addSkeletonClassifierMethod(TypeSpec.Builder type, List<DateTimeData> dataList) { """ Create a helper class to classify skeletons as either DATE or TIME. """ Set<String> dates = new LinkedHashSet<>(); Set<String> times = new LinkedHashSet<>(); for (DateTimeData data : dataList) { for (Skeleton skeleton : data.dateTimeSkeletons) { if (isDateSkeleton(skeleton.skeleton)) { dates.add(skeleton.skeleton); } else { times.add(skeleton.skeleton); } } } MethodSpec.Builder method = buildSkeletonType(dates, times); type.addMethod(method.build()); }
java
private void addSkeletonClassifierMethod(TypeSpec.Builder type, List<DateTimeData> dataList) { Set<String> dates = new LinkedHashSet<>(); Set<String> times = new LinkedHashSet<>(); for (DateTimeData data : dataList) { for (Skeleton skeleton : data.dateTimeSkeletons) { if (isDateSkeleton(skeleton.skeleton)) { dates.add(skeleton.skeleton); } else { times.add(skeleton.skeleton); } } } MethodSpec.Builder method = buildSkeletonType(dates, times); type.addMethod(method.build()); }
[ "private", "void", "addSkeletonClassifierMethod", "(", "TypeSpec", ".", "Builder", "type", ",", "List", "<", "DateTimeData", ">", "dataList", ")", "{", "Set", "<", "String", ">", "dates", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "Set", "<", "String", ">", "times", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "for", "(", "DateTimeData", "data", ":", "dataList", ")", "{", "for", "(", "Skeleton", "skeleton", ":", "data", ".", "dateTimeSkeletons", ")", "{", "if", "(", "isDateSkeleton", "(", "skeleton", ".", "skeleton", ")", ")", "{", "dates", ".", "add", "(", "skeleton", ".", "skeleton", ")", ";", "}", "else", "{", "times", ".", "add", "(", "skeleton", ".", "skeleton", ")", ";", "}", "}", "}", "MethodSpec", ".", "Builder", "method", "=", "buildSkeletonType", "(", "dates", ",", "times", ")", ";", "type", ".", "addMethod", "(", "method", ".", "build", "(", ")", ")", ";", "}" ]
Create a helper class to classify skeletons as either DATE or TIME.
[ "Create", "a", "helper", "class", "to", "classify", "skeletons", "as", "either", "DATE", "or", "TIME", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L113-L128
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.buildErrorSummary
public void buildErrorSummary(XMLNode node, Content summaryContentTree) { """ Build the summary for the errors in this package. @param node the XML element that specifies which components to document @param summaryContentTree the summary tree to which the error summary will be added """ String errorTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Error_Summary"), configuration.getText("doclet.errors")); List<String> errorTableHeader = Arrays.asList(configuration.getText("doclet.Error"), configuration.getText("doclet.Description")); Set<TypeElement> ierrors = utils.isSpecified(packageElement) ? utils.getTypeElementsAsSortedSet(utils.getErrors(packageElement)) : configuration.typeElementCatalog.errors(packageElement); SortedSet<TypeElement> errors = utils.filterOutPrivateClasses(ierrors, configuration.javafx); if (!errors.isEmpty()) { packageWriter.addClassesSummary(errors, configuration.getText("doclet.Error_Summary"), errorTableSummary, errorTableHeader, summaryContentTree); } }
java
public void buildErrorSummary(XMLNode node, Content summaryContentTree) { String errorTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Error_Summary"), configuration.getText("doclet.errors")); List<String> errorTableHeader = Arrays.asList(configuration.getText("doclet.Error"), configuration.getText("doclet.Description")); Set<TypeElement> ierrors = utils.isSpecified(packageElement) ? utils.getTypeElementsAsSortedSet(utils.getErrors(packageElement)) : configuration.typeElementCatalog.errors(packageElement); SortedSet<TypeElement> errors = utils.filterOutPrivateClasses(ierrors, configuration.javafx); if (!errors.isEmpty()) { packageWriter.addClassesSummary(errors, configuration.getText("doclet.Error_Summary"), errorTableSummary, errorTableHeader, summaryContentTree); } }
[ "public", "void", "buildErrorSummary", "(", "XMLNode", "node", ",", "Content", "summaryContentTree", ")", "{", "String", "errorTableSummary", "=", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Error_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.errors\"", ")", ")", ";", "List", "<", "String", ">", "errorTableHeader", "=", "Arrays", ".", "asList", "(", "configuration", ".", "getText", "(", "\"doclet.Error\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.Description\"", ")", ")", ";", "Set", "<", "TypeElement", ">", "ierrors", "=", "utils", ".", "isSpecified", "(", "packageElement", ")", "?", "utils", ".", "getTypeElementsAsSortedSet", "(", "utils", ".", "getErrors", "(", "packageElement", ")", ")", ":", "configuration", ".", "typeElementCatalog", ".", "errors", "(", "packageElement", ")", ";", "SortedSet", "<", "TypeElement", ">", "errors", "=", "utils", ".", "filterOutPrivateClasses", "(", "ierrors", ",", "configuration", ".", "javafx", ")", ";", "if", "(", "!", "errors", ".", "isEmpty", "(", ")", ")", "{", "packageWriter", ".", "addClassesSummary", "(", "errors", ",", "configuration", ".", "getText", "(", "\"doclet.Error_Summary\"", ")", ",", "errorTableSummary", ",", "errorTableHeader", ",", "summaryContentTree", ")", ";", "}", "}" ]
Build the summary for the errors in this package. @param node the XML element that specifies which components to document @param summaryContentTree the summary tree to which the error summary will be added
[ "Build", "the", "summary", "for", "the", "errors", "in", "this", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L279-L296
JavaMoney/jsr354-api
src/main/java/javax/money/convert/ProviderContextBuilder.java
ProviderContextBuilder.of
public static ProviderContextBuilder of(String provider, RateType rateType, RateType... rateTypes) { """ Create a new ProviderContextBuilder instance. @param provider the provider name, not {@code null}. @param rateType the required {@link RateType}, not null @param rateTypes the rate types, not null and not empty. @return a new {@link javax.money.convert.ProviderContextBuilder} instance, never null. """ return new ProviderContextBuilder(provider, rateType, rateTypes); }
java
public static ProviderContextBuilder of(String provider, RateType rateType, RateType... rateTypes) { return new ProviderContextBuilder(provider, rateType, rateTypes); }
[ "public", "static", "ProviderContextBuilder", "of", "(", "String", "provider", ",", "RateType", "rateType", ",", "RateType", "...", "rateTypes", ")", "{", "return", "new", "ProviderContextBuilder", "(", "provider", ",", "rateType", ",", "rateTypes", ")", ";", "}" ]
Create a new ProviderContextBuilder instance. @param provider the provider name, not {@code null}. @param rateType the required {@link RateType}, not null @param rateTypes the rate types, not null and not empty. @return a new {@link javax.money.convert.ProviderContextBuilder} instance, never null.
[ "Create", "a", "new", "ProviderContextBuilder", "instance", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ProviderContextBuilder.java#L133-L135
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/filter/AvroFieldsPickConverter.java
AvroFieldsPickConverter.createSchema
private static Schema createSchema(Schema schema, String fieldsStr) { """ Creates Schema containing only specified fields. Traversing via either fully qualified names or input Schema is quite inefficient as it's hard to align each other. Also, as Schema's fields is immutable, all the fields need to be collected before updating field in Schema. Figuring out all required field in just input Schema and fully qualified names is also not efficient as well. This is where Trie comes into picture. Having fully qualified names in Trie means, it is aligned with input schema and also it can provides all children on specific prefix. This solves two problems mentioned above. 1. Based on fully qualified field name, build a Trie to present dependencies. 2. Traverse the Trie. If it's leaf, add field. If it's not a leaf, recurse with child schema. @param schema @param fieldsStr @return """ List<String> fields = SPLITTER_ON_COMMA.splitToList(fieldsStr); TrieNode root = buildTrie(fields); return createSchemaHelper(schema, root); }
java
private static Schema createSchema(Schema schema, String fieldsStr) { List<String> fields = SPLITTER_ON_COMMA.splitToList(fieldsStr); TrieNode root = buildTrie(fields); return createSchemaHelper(schema, root); }
[ "private", "static", "Schema", "createSchema", "(", "Schema", "schema", ",", "String", "fieldsStr", ")", "{", "List", "<", "String", ">", "fields", "=", "SPLITTER_ON_COMMA", ".", "splitToList", "(", "fieldsStr", ")", ";", "TrieNode", "root", "=", "buildTrie", "(", "fields", ")", ";", "return", "createSchemaHelper", "(", "schema", ",", "root", ")", ";", "}" ]
Creates Schema containing only specified fields. Traversing via either fully qualified names or input Schema is quite inefficient as it's hard to align each other. Also, as Schema's fields is immutable, all the fields need to be collected before updating field in Schema. Figuring out all required field in just input Schema and fully qualified names is also not efficient as well. This is where Trie comes into picture. Having fully qualified names in Trie means, it is aligned with input schema and also it can provides all children on specific prefix. This solves two problems mentioned above. 1. Based on fully qualified field name, build a Trie to present dependencies. 2. Traverse the Trie. If it's leaf, add field. If it's not a leaf, recurse with child schema. @param schema @param fieldsStr @return
[ "Creates", "Schema", "containing", "only", "specified", "fields", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/filter/AvroFieldsPickConverter.java#L133-L137
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/DataFactory.java
DataFactory.getString
private static String getString(final AnnotationData pAnnotation, final BitUtils pBit) { """ This method get a string (Hexa or ASCII) from a bit table @param pAnnotation annotation data @param pBit bit table @return A string """ String obj = null; if (pAnnotation.isReadHexa()) { obj = pBit.getNextHexaString(pAnnotation.getSize()); } else { obj = pBit.getNextString(pAnnotation.getSize()).trim(); } return obj; }
java
private static String getString(final AnnotationData pAnnotation, final BitUtils pBit) { String obj = null; if (pAnnotation.isReadHexa()) { obj = pBit.getNextHexaString(pAnnotation.getSize()); } else { obj = pBit.getNextString(pAnnotation.getSize()).trim(); } return obj; }
[ "private", "static", "String", "getString", "(", "final", "AnnotationData", "pAnnotation", ",", "final", "BitUtils", "pBit", ")", "{", "String", "obj", "=", "null", ";", "if", "(", "pAnnotation", ".", "isReadHexa", "(", ")", ")", "{", "obj", "=", "pBit", ".", "getNextHexaString", "(", "pAnnotation", ".", "getSize", "(", ")", ")", ";", "}", "else", "{", "obj", "=", "pBit", ".", "getNextString", "(", "pAnnotation", ".", "getSize", "(", ")", ")", ".", "trim", "(", ")", ";", "}", "return", "obj", ";", "}" ]
This method get a string (Hexa or ASCII) from a bit table @param pAnnotation annotation data @param pBit bit table @return A string
[ "This", "method", "get", "a", "string", "(", "Hexa", "or", "ASCII", ")", "from", "a", "bit", "table" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/DataFactory.java#L212-L222
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/SwaptionFromSwapSchedules.java
SwaptionFromSwapSchedules.getValueOfLegAnalytic
public static RandomVariable getValueOfLegAnalytic(double evaluationTime, LIBORModelMonteCarloSimulationModel model, Schedule schedule, boolean paysFloatingRate, double fixRate, double notional) throws CalculationException { """ Determines the time \( t \)-measurable value of a swap leg (can handle fix or float). @param evaluationTime The time \( t \) conditional to which the value is calculated. @param model The model implmeneting LIBORModelMonteCarloSimulationModel. @param schedule The schedule of the leg. @param paysFloatingRate If true, the leg will pay {@link LIBORModelMonteCarloSimulationModel#getLIBOR(double, double, double)} @param fixRate The fixed rate (if any) @param notional The notional @return The time \( t \)-measurable value @throws CalculationException Thrown is model failed to provide the required quantities. """ LocalDate modelReferenceDate = null; try { modelReferenceDate = model.getReferenceDate().toLocalDate(); if(modelReferenceDate == null) { modelReferenceDate = schedule.getReferenceDate(); } } catch(UnsupportedOperationException e) {} RandomVariable discountedCashflowFloatingLeg = model.getRandomVariableForConstant(0.0); for(int peridIndex = schedule.getNumberOfPeriods() - 1; peridIndex >= 0; peridIndex--) { Period period = schedule.getPeriod(peridIndex); double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(modelReferenceDate, period.getPayment()); double fixingTime = FloatingpointDate.getFloatingPointDateFromDate(modelReferenceDate, period.getFixing()); double periodLength = schedule.getPeriodLength(peridIndex); /* * Note that it is important that getForwardDiscountBond and getLIBOR are called with evaluationTime = exerciseTime. */ RandomVariable discountBond = model.getModel().getForwardDiscountBond(evaluationTime, paymentTime); if(paysFloatingRate) { RandomVariable libor = model.getLIBOR(evaluationTime, fixingTime, paymentTime); RandomVariable periodCashFlow = libor.mult(periodLength).mult(notional); discountedCashflowFloatingLeg = discountedCashflowFloatingLeg.add(periodCashFlow.mult(discountBond)); } if(fixRate != 0) { RandomVariable periodCashFlow = model.getRandomVariableForConstant(fixRate * periodLength * notional); discountedCashflowFloatingLeg = discountedCashflowFloatingLeg.add(periodCashFlow.mult(discountBond)); } } return discountedCashflowFloatingLeg; }
java
public static RandomVariable getValueOfLegAnalytic(double evaluationTime, LIBORModelMonteCarloSimulationModel model, Schedule schedule, boolean paysFloatingRate, double fixRate, double notional) throws CalculationException { LocalDate modelReferenceDate = null; try { modelReferenceDate = model.getReferenceDate().toLocalDate(); if(modelReferenceDate == null) { modelReferenceDate = schedule.getReferenceDate(); } } catch(UnsupportedOperationException e) {} RandomVariable discountedCashflowFloatingLeg = model.getRandomVariableForConstant(0.0); for(int peridIndex = schedule.getNumberOfPeriods() - 1; peridIndex >= 0; peridIndex--) { Period period = schedule.getPeriod(peridIndex); double paymentTime = FloatingpointDate.getFloatingPointDateFromDate(modelReferenceDate, period.getPayment()); double fixingTime = FloatingpointDate.getFloatingPointDateFromDate(modelReferenceDate, period.getFixing()); double periodLength = schedule.getPeriodLength(peridIndex); /* * Note that it is important that getForwardDiscountBond and getLIBOR are called with evaluationTime = exerciseTime. */ RandomVariable discountBond = model.getModel().getForwardDiscountBond(evaluationTime, paymentTime); if(paysFloatingRate) { RandomVariable libor = model.getLIBOR(evaluationTime, fixingTime, paymentTime); RandomVariable periodCashFlow = libor.mult(periodLength).mult(notional); discountedCashflowFloatingLeg = discountedCashflowFloatingLeg.add(periodCashFlow.mult(discountBond)); } if(fixRate != 0) { RandomVariable periodCashFlow = model.getRandomVariableForConstant(fixRate * periodLength * notional); discountedCashflowFloatingLeg = discountedCashflowFloatingLeg.add(periodCashFlow.mult(discountBond)); } } return discountedCashflowFloatingLeg; }
[ "public", "static", "RandomVariable", "getValueOfLegAnalytic", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationModel", "model", ",", "Schedule", "schedule", ",", "boolean", "paysFloatingRate", ",", "double", "fixRate", ",", "double", "notional", ")", "throws", "CalculationException", "{", "LocalDate", "modelReferenceDate", "=", "null", ";", "try", "{", "modelReferenceDate", "=", "model", ".", "getReferenceDate", "(", ")", ".", "toLocalDate", "(", ")", ";", "if", "(", "modelReferenceDate", "==", "null", ")", "{", "modelReferenceDate", "=", "schedule", ".", "getReferenceDate", "(", ")", ";", "}", "}", "catch", "(", "UnsupportedOperationException", "e", ")", "{", "}", "RandomVariable", "discountedCashflowFloatingLeg", "=", "model", ".", "getRandomVariableForConstant", "(", "0.0", ")", ";", "for", "(", "int", "peridIndex", "=", "schedule", ".", "getNumberOfPeriods", "(", ")", "-", "1", ";", "peridIndex", ">=", "0", ";", "peridIndex", "--", ")", "{", "Period", "period", "=", "schedule", ".", "getPeriod", "(", "peridIndex", ")", ";", "double", "paymentTime", "=", "FloatingpointDate", ".", "getFloatingPointDateFromDate", "(", "modelReferenceDate", ",", "period", ".", "getPayment", "(", ")", ")", ";", "double", "fixingTime", "=", "FloatingpointDate", ".", "getFloatingPointDateFromDate", "(", "modelReferenceDate", ",", "period", ".", "getFixing", "(", ")", ")", ";", "double", "periodLength", "=", "schedule", ".", "getPeriodLength", "(", "peridIndex", ")", ";", "/*\r\n\t\t\t * Note that it is important that getForwardDiscountBond and getLIBOR are called with evaluationTime = exerciseTime.\r\n\t\t\t */", "RandomVariable", "discountBond", "=", "model", ".", "getModel", "(", ")", ".", "getForwardDiscountBond", "(", "evaluationTime", ",", "paymentTime", ")", ";", "if", "(", "paysFloatingRate", ")", "{", "RandomVariable", "libor", "=", "model", ".", "getLIBOR", "(", "evaluationTime", ",", "fixingTime", ",", "paymentTime", ")", ";", "RandomVariable", "periodCashFlow", "=", "libor", ".", "mult", "(", "periodLength", ")", ".", "mult", "(", "notional", ")", ";", "discountedCashflowFloatingLeg", "=", "discountedCashflowFloatingLeg", ".", "add", "(", "periodCashFlow", ".", "mult", "(", "discountBond", ")", ")", ";", "}", "if", "(", "fixRate", "!=", "0", ")", "{", "RandomVariable", "periodCashFlow", "=", "model", ".", "getRandomVariableForConstant", "(", "fixRate", "*", "periodLength", "*", "notional", ")", ";", "discountedCashflowFloatingLeg", "=", "discountedCashflowFloatingLeg", ".", "add", "(", "periodCashFlow", ".", "mult", "(", "discountBond", ")", ")", ";", "}", "}", "return", "discountedCashflowFloatingLeg", ";", "}" ]
Determines the time \( t \)-measurable value of a swap leg (can handle fix or float). @param evaluationTime The time \( t \) conditional to which the value is calculated. @param model The model implmeneting LIBORModelMonteCarloSimulationModel. @param schedule The schedule of the leg. @param paysFloatingRate If true, the leg will pay {@link LIBORModelMonteCarloSimulationModel#getLIBOR(double, double, double)} @param fixRate The fixed rate (if any) @param notional The notional @return The time \( t \)-measurable value @throws CalculationException Thrown is model failed to provide the required quantities.
[ "Determines", "the", "time", "\\", "(", "t", "\\", ")", "-", "measurable", "value", "of", "a", "swap", "leg", "(", "can", "handle", "fix", "or", "float", ")", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/SwaptionFromSwapSchedules.java#L184-L218
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getSubscriptions
public Subscriptions getSubscriptions(final SubscriptionState state, final QueryParams params) { """ Get all the subscriptions on the site given some sort and filter params. <p> Returns all the subscriptions on the site @param state {@link SubscriptionState} @param params {@link QueryParams} @return Subscriptions on the site """ if (state != null) { params.put("state", state.getType()); } return doGET(Subscriptions.SUBSCRIPTIONS_RESOURCE, Subscriptions.class, params); }
java
public Subscriptions getSubscriptions(final SubscriptionState state, final QueryParams params) { if (state != null) { params.put("state", state.getType()); } return doGET(Subscriptions.SUBSCRIPTIONS_RESOURCE, Subscriptions.class, params); }
[ "public", "Subscriptions", "getSubscriptions", "(", "final", "SubscriptionState", "state", ",", "final", "QueryParams", "params", ")", "{", "if", "(", "state", "!=", "null", ")", "{", "params", ".", "put", "(", "\"state\"", ",", "state", ".", "getType", "(", ")", ")", ";", "}", "return", "doGET", "(", "Subscriptions", ".", "SUBSCRIPTIONS_RESOURCE", ",", "Subscriptions", ".", "class", ",", "params", ")", ";", "}" ]
Get all the subscriptions on the site given some sort and filter params. <p> Returns all the subscriptions on the site @param state {@link SubscriptionState} @param params {@link QueryParams} @return Subscriptions on the site
[ "Get", "all", "the", "subscriptions", "on", "the", "site", "given", "some", "sort", "and", "filter", "params", ".", "<p", ">", "Returns", "all", "the", "subscriptions", "on", "the", "site" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L662-L667
qiniu/java-sdk
src/main/java/com/qiniu/util/Auth.java
Auth.isValidCallback
public boolean isValidCallback(String originAuthorization, String url, byte[] body, String contentType) { """ 验证回调签名是否正确 @param originAuthorization 待验证签名字符串,以 "QBox "作为起始字符 @param url 回调地址 @param body 回调请求体。原始请求体,不要解析后再封装成新的请求体--可能导致签名不一致。 @param contentType 回调ContentType @return """ String authorization = "QBox " + signRequest(url, body, contentType); return authorization.equals(originAuthorization); }
java
public boolean isValidCallback(String originAuthorization, String url, byte[] body, String contentType) { String authorization = "QBox " + signRequest(url, body, contentType); return authorization.equals(originAuthorization); }
[ "public", "boolean", "isValidCallback", "(", "String", "originAuthorization", ",", "String", "url", ",", "byte", "[", "]", "body", ",", "String", "contentType", ")", "{", "String", "authorization", "=", "\"QBox \"", "+", "signRequest", "(", "url", ",", "body", ",", "contentType", ")", ";", "return", "authorization", ".", "equals", "(", "originAuthorization", ")", ";", "}" ]
验证回调签名是否正确 @param originAuthorization 待验证签名字符串,以 "QBox "作为起始字符 @param url 回调地址 @param body 回调请求体。原始请求体,不要解析后再封装成新的请求体--可能导致签名不一致。 @param contentType 回调ContentType @return
[ "验证回调签名是否正确" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/util/Auth.java#L154-L157