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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
OpenLiberty/open-liberty
dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/LibertyFeaturesToMavenRepo.java
LibertyFeaturesToMavenRepo.copyArtifact
private static void copyArtifact(File inputDir, File outputDir, LibertyFeature feature, Constants.ArtifactType type) throws MavenRepoGeneratorException { """ Copy artifact file from inputDir to outputDir. @param inputDir The input directory containing feature files. @param outputDir The root directory of the target Maven repository. @param feature The feature that you want to copy. @param type The type of artifact. @throws MavenRepoGeneratorException If the artifact could not be copied. """ MavenCoordinates artifact = feature.getMavenCoordinates(); File artifactDir = new File(outputDir, Utils.getRepositorySubpath(artifact)); artifactDir.mkdirs(); if (!artifactDir.isDirectory()) { throw new MavenRepoGeneratorException("Artifact directory " + artifactDir + " could not be created."); } File sourceFile = new File(inputDir, feature.getSymbolicName() + type.getLibertyFileExtension()); System.out.println("Source file: " +sourceFile); if (!sourceFile.exists()) { throw new MavenRepoGeneratorException("Artifact source file " + sourceFile + " does not exist."); } File targetFile = new File(artifactDir, Utils.getFileName(artifact, type)); try { Files.copy(sourceFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new MavenRepoGeneratorException("Could not copy artifact from " + sourceFile.getAbsolutePath() + " to " + targetFile.getAbsolutePath(), e); } }
java
private static void copyArtifact(File inputDir, File outputDir, LibertyFeature feature, Constants.ArtifactType type) throws MavenRepoGeneratorException { MavenCoordinates artifact = feature.getMavenCoordinates(); File artifactDir = new File(outputDir, Utils.getRepositorySubpath(artifact)); artifactDir.mkdirs(); if (!artifactDir.isDirectory()) { throw new MavenRepoGeneratorException("Artifact directory " + artifactDir + " could not be created."); } File sourceFile = new File(inputDir, feature.getSymbolicName() + type.getLibertyFileExtension()); System.out.println("Source file: " +sourceFile); if (!sourceFile.exists()) { throw new MavenRepoGeneratorException("Artifact source file " + sourceFile + " does not exist."); } File targetFile = new File(artifactDir, Utils.getFileName(artifact, type)); try { Files.copy(sourceFile.toPath(), targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new MavenRepoGeneratorException("Could not copy artifact from " + sourceFile.getAbsolutePath() + " to " + targetFile.getAbsolutePath(), e); } }
[ "private", "static", "void", "copyArtifact", "(", "File", "inputDir", ",", "File", "outputDir", ",", "LibertyFeature", "feature", ",", "Constants", ".", "ArtifactType", "type", ")", "throws", "MavenRepoGeneratorException", "{", "MavenCoordinates", "artifact", "=", "feature", ".", "getMavenCoordinates", "(", ")", ";", "File", "artifactDir", "=", "new", "File", "(", "outputDir", ",", "Utils", ".", "getRepositorySubpath", "(", "artifact", ")", ")", ";", "artifactDir", ".", "mkdirs", "(", ")", ";", "if", "(", "!", "artifactDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "MavenRepoGeneratorException", "(", "\"Artifact directory \"", "+", "artifactDir", "+", "\" could not be created.\"", ")", ";", "}", "File", "sourceFile", "=", "new", "File", "(", "inputDir", ",", "feature", ".", "getSymbolicName", "(", ")", "+", "type", ".", "getLibertyFileExtension", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Source file: \"", "+", "sourceFile", ")", ";", "if", "(", "!", "sourceFile", ".", "exists", "(", ")", ")", "{", "throw", "new", "MavenRepoGeneratorException", "(", "\"Artifact source file \"", "+", "sourceFile", "+", "\" does not exist.\"", ")", ";", "}", "File", "targetFile", "=", "new", "File", "(", "artifactDir", ",", "Utils", ".", "getFileName", "(", "artifact", ",", "type", ")", ")", ";", "try", "{", "Files", ".", "copy", "(", "sourceFile", ".", "toPath", "(", ")", ",", "targetFile", ".", "toPath", "(", ")", ",", "StandardCopyOption", ".", "REPLACE_EXISTING", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "MavenRepoGeneratorException", "(", "\"Could not copy artifact from \"", "+", "sourceFile", ".", "getAbsolutePath", "(", ")", "+", "\" to \"", "+", "targetFile", ".", "getAbsolutePath", "(", ")", ",", "e", ")", ";", "}", "}" ]
Copy artifact file from inputDir to outputDir. @param inputDir The input directory containing feature files. @param outputDir The root directory of the target Maven repository. @param feature The feature that you want to copy. @param type The type of artifact. @throws MavenRepoGeneratorException If the artifact could not be copied.
[ "Copy", "artifact", "file", "from", "inputDir", "to", "outputDir", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/LibertyFeaturesToMavenRepo.java#L579-L601
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java
ArgumentConvertor.checkStringArgument
void checkStringArgument(Class cls, String arg) throws IOException { """ check if class and argument are string @param cls @param arg @throws IOException """ if (arg.startsWith(Constants.QUOTE)) { // ca ressemble à une string if (!cls.equals(String.class)) { // et on veut pas une string throw new IOException(); } } else // ca ressemble pas à une string if (cls.equals(String.class)) { // mais on veut une string throw new IOException(); } }
java
void checkStringArgument(Class cls, String arg) throws IOException { if (arg.startsWith(Constants.QUOTE)) { // ca ressemble à une string if (!cls.equals(String.class)) { // et on veut pas une string throw new IOException(); } } else // ca ressemble pas à une string if (cls.equals(String.class)) { // mais on veut une string throw new IOException(); } }
[ "void", "checkStringArgument", "(", "Class", "cls", ",", "String", "arg", ")", "throws", "IOException", "{", "if", "(", "arg", ".", "startsWith", "(", "Constants", ".", "QUOTE", ")", ")", "{", "// ca ressemble à une string\r", "if", "(", "!", "cls", ".", "equals", "(", "String", ".", "class", ")", ")", "{", "// et on veut pas une string\r", "throw", "new", "IOException", "(", ")", ";", "}", "}", "else", "// ca ressemble pas à une string\r", "if", "(", "cls", ".", "equals", "(", "String", ".", "class", ")", ")", "{", "// mais on veut une string\r", "throw", "new", "IOException", "(", ")", ";", "}", "}" ]
check if class and argument are string @param cls @param arg @throws IOException
[ "check", "if", "class", "and", "argument", "are", "string" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L157-L166
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryResultItem.java
InventoryResultItem.withContent
public InventoryResultItem withContent(java.util.Map<String, String>... content) { """ <p> Contains all the inventory data of the item type. Results include attribute names and values. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setContent(java.util.Collection)} or {@link #withContent(java.util.Collection)} if you want to override the existing values. </p> @param content Contains all the inventory data of the item type. Results include attribute names and values. @return Returns a reference to this object so that method calls can be chained together. """ if (this.content == null) { setContent(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content.length)); } for (java.util.Map<String, String> ele : content) { this.content.add(ele); } return this; }
java
public InventoryResultItem withContent(java.util.Map<String, String>... content) { if (this.content == null) { setContent(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content.length)); } for (java.util.Map<String, String> ele : content) { this.content.add(ele); } return this; }
[ "public", "InventoryResultItem", "withContent", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "...", "content", ")", "{", "if", "(", "this", ".", "content", "==", "null", ")", "{", "setContent", "(", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "(", "content", ".", "length", ")", ")", ";", "}", "for", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "ele", ":", "content", ")", "{", "this", ".", "content", ".", "add", "(", "ele", ")", ";", "}", "return", "this", ";", "}" ]
<p> Contains all the inventory data of the item type. Results include attribute names and values. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setContent(java.util.Collection)} or {@link #withContent(java.util.Collection)} if you want to override the existing values. </p> @param content Contains all the inventory data of the item type. Results include attribute names and values. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Contains", "all", "the", "inventory", "data", "of", "the", "item", "type", ".", "Results", "include", "attribute", "names", "and", "values", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "This", "method", "appends", "the", "values", "to", "the", "existing", "list", "(", "if", "any", ")", ".", "Use", "{", "@link", "#setContent", "(", "java", ".", "util", ".", "Collection", ")", "}", "or", "{", "@link", "#withContent", "(", "java", ".", "util", ".", "Collection", ")", "}", "if", "you", "want", "to", "override", "the", "existing", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryResultItem.java#L284-L292
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMaxCardinalityImpl_CustomFieldSerializer.java
OWLObjectMaxCardinalityImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectMaxCardinalityImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectMaxCardinalityImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectMaxCardinalityImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMaxCardinalityImpl_CustomFieldSerializer.java#L73-L76
paypal/SeLion
client/src/main/java/com/paypal/selion/internal/platform/grid/AbstractBaseLocalServerComponent.java
AbstractBaseLocalServerComponent.waitForComponentToComeUp
private void waitForComponentToComeUp() { """ Checks component has come up every 3 seconds. Waits for the component for a maximum of 60 seconds. Throws an {@link IllegalStateException} if the component can not be contacted """ LOGGER.entering(); for (int i = 0; i < 60; i++) { try { // Sleep for 3 seconds. Thread.sleep(1000); } catch (InterruptedException e) { throw new IllegalStateException(e.getMessage(), e); } if (getLauncher().isRunning()) { LOGGER.exiting(); return; } } throw new IllegalStateException(String.format("%s can not be contacted.", getLocalServerComponent().getClass() .getSimpleName())); }
java
private void waitForComponentToComeUp() { LOGGER.entering(); for (int i = 0; i < 60; i++) { try { // Sleep for 3 seconds. Thread.sleep(1000); } catch (InterruptedException e) { throw new IllegalStateException(e.getMessage(), e); } if (getLauncher().isRunning()) { LOGGER.exiting(); return; } } throw new IllegalStateException(String.format("%s can not be contacted.", getLocalServerComponent().getClass() .getSimpleName())); }
[ "private", "void", "waitForComponentToComeUp", "(", ")", "{", "LOGGER", ".", "entering", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "60", ";", "i", "++", ")", "{", "try", "{", "// Sleep for 3 seconds.", "Thread", ".", "sleep", "(", "1000", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "if", "(", "getLauncher", "(", ")", ".", "isRunning", "(", ")", ")", "{", "LOGGER", ".", "exiting", "(", ")", ";", "return", ";", "}", "}", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"%s can not be contacted.\"", ",", "getLocalServerComponent", "(", ")", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Checks component has come up every 3 seconds. Waits for the component for a maximum of 60 seconds. Throws an {@link IllegalStateException} if the component can not be contacted
[ "Checks", "component", "has", "come", "up", "every", "3", "seconds", ".", "Waits", "for", "the", "component", "for", "a", "maximum", "of", "60", "seconds", ".", "Throws", "an", "{" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/platform/grid/AbstractBaseLocalServerComponent.java#L157-L173
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java
ResourceAssignmentFactory.processHyperlinkData
private void processHyperlinkData(ResourceAssignment assignment, byte[] data) { """ Extract assignment hyperlink data. @param assignment assignment instance @param data hyperlink data """ if (data != null) { int offset = 12; offset += 12; String hyperlink = MPPUtility.getUnicodeString(data, offset); offset += ((hyperlink.length() + 1) * 2); offset += 12; String address = MPPUtility.getUnicodeString(data, offset); offset += ((address.length() + 1) * 2); offset += 12; String subaddress = MPPUtility.getUnicodeString(data, offset); offset += ((subaddress.length() + 1) * 2); offset += 12; String screentip = MPPUtility.getUnicodeString(data, offset); assignment.setHyperlink(hyperlink); assignment.setHyperlinkAddress(address); assignment.setHyperlinkSubAddress(subaddress); assignment.setHyperlinkScreenTip(screentip); } }
java
private void processHyperlinkData(ResourceAssignment assignment, byte[] data) { if (data != null) { int offset = 12; offset += 12; String hyperlink = MPPUtility.getUnicodeString(data, offset); offset += ((hyperlink.length() + 1) * 2); offset += 12; String address = MPPUtility.getUnicodeString(data, offset); offset += ((address.length() + 1) * 2); offset += 12; String subaddress = MPPUtility.getUnicodeString(data, offset); offset += ((subaddress.length() + 1) * 2); offset += 12; String screentip = MPPUtility.getUnicodeString(data, offset); assignment.setHyperlink(hyperlink); assignment.setHyperlinkAddress(address); assignment.setHyperlinkSubAddress(subaddress); assignment.setHyperlinkScreenTip(screentip); } }
[ "private", "void", "processHyperlinkData", "(", "ResourceAssignment", "assignment", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "int", "offset", "=", "12", ";", "offset", "+=", "12", ";", "String", "hyperlink", "=", "MPPUtility", ".", "getUnicodeString", "(", "data", ",", "offset", ")", ";", "offset", "+=", "(", "(", "hyperlink", ".", "length", "(", ")", "+", "1", ")", "*", "2", ")", ";", "offset", "+=", "12", ";", "String", "address", "=", "MPPUtility", ".", "getUnicodeString", "(", "data", ",", "offset", ")", ";", "offset", "+=", "(", "(", "address", ".", "length", "(", ")", "+", "1", ")", "*", "2", ")", ";", "offset", "+=", "12", ";", "String", "subaddress", "=", "MPPUtility", ".", "getUnicodeString", "(", "data", ",", "offset", ")", ";", "offset", "+=", "(", "(", "subaddress", ".", "length", "(", ")", "+", "1", ")", "*", "2", ")", ";", "offset", "+=", "12", ";", "String", "screentip", "=", "MPPUtility", ".", "getUnicodeString", "(", "data", ",", "offset", ")", ";", "assignment", ".", "setHyperlink", "(", "hyperlink", ")", ";", "assignment", ".", "setHyperlinkAddress", "(", "address", ")", ";", "assignment", ".", "setHyperlinkSubAddress", "(", "subaddress", ")", ";", "assignment", ".", "setHyperlinkScreenTip", "(", "screentip", ")", ";", "}", "}" ]
Extract assignment hyperlink data. @param assignment assignment instance @param data hyperlink data
[ "Extract", "assignment", "hyperlink", "data", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java#L277-L303
alkacon/opencms-core
src/org/opencms/util/CmsRequestUtil.java
CmsRequestUtil.getNotEmptyDecodedParameter
public static String getNotEmptyDecodedParameter(HttpServletRequest request, String paramName) { """ Reads value from the request parameters, will return <code>null</code> if the value is not available or only white space.<p> The value of the request will also be decoded using <code>{@link CmsEncoder#decode(String)}</code> and also trimmed using <code>{@link String#trim()}</code>.<p> @param request the request to read the parameter from @param paramName the parameter name to read @return the request parameter value for the given parameter """ String result = getNotEmptyParameter(request, paramName); if (result != null) { result = CmsEncoder.decode(result.trim()); } return result; }
java
public static String getNotEmptyDecodedParameter(HttpServletRequest request, String paramName) { String result = getNotEmptyParameter(request, paramName); if (result != null) { result = CmsEncoder.decode(result.trim()); } return result; }
[ "public", "static", "String", "getNotEmptyDecodedParameter", "(", "HttpServletRequest", "request", ",", "String", "paramName", ")", "{", "String", "result", "=", "getNotEmptyParameter", "(", "request", ",", "paramName", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "result", "=", "CmsEncoder", ".", "decode", "(", "result", ".", "trim", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Reads value from the request parameters, will return <code>null</code> if the value is not available or only white space.<p> The value of the request will also be decoded using <code>{@link CmsEncoder#decode(String)}</code> and also trimmed using <code>{@link String#trim()}</code>.<p> @param request the request to read the parameter from @param paramName the parameter name to read @return the request parameter value for the given parameter
[ "Reads", "value", "from", "the", "request", "parameters", "will", "return", "<code", ">", "null<", "/", "code", ">", "if", "the", "value", "is", "not", "available", "or", "only", "white", "space", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L608-L615
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.setString
public void setString(Enum<?> key, String value) { """ Equivalent to {@link #setString(String, String) setString}{@code (key.name(), value)}. If {@code key} is null, nothing is done. """ if (key == null) { return; } setString(key.name(), value); }
java
public void setString(Enum<?> key, String value) { if (key == null) { return; } setString(key.name(), value); }
[ "public", "void", "setString", "(", "Enum", "<", "?", ">", "key", ",", "String", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", ";", "}", "setString", "(", "key", ".", "name", "(", ")", ",", "value", ")", ";", "}" ]
Equivalent to {@link #setString(String, String) setString}{@code (key.name(), value)}. If {@code key} is null, nothing is done.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L815-L823
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/math/Fraction.java
Fraction.getFraction
public static Fraction getFraction(final int whole, final int numerator, final int denominator) { """ <p>Creates a <code>Fraction</code> instance with the 3 parts of a fraction X Y/Z.</p> <p>The negative sign must be passed in on the whole number part.</p> @param whole the whole number, for example the one in 'one and three sevenths' @param numerator the numerator, for example the three in 'one and three sevenths' @param denominator the denominator, for example the seven in 'one and three sevenths' @return a new fraction instance @throws ArithmeticException if the denominator is <code>zero</code> @throws ArithmeticException if the denominator is negative @throws ArithmeticException if the numerator is negative @throws ArithmeticException if the resulting numerator exceeds <code>Integer.MAX_VALUE</code> """ if (denominator == 0) { throw new ArithmeticException("The denominator must not be zero"); } if (denominator < 0) { throw new ArithmeticException("The denominator must not be negative"); } if (numerator < 0) { throw new ArithmeticException("The numerator must not be negative"); } long numeratorValue; if (whole < 0) { numeratorValue = whole * (long) denominator - numerator; } else { numeratorValue = whole * (long) denominator + numerator; } if (numeratorValue < Integer.MIN_VALUE || numeratorValue > Integer.MAX_VALUE) { throw new ArithmeticException("Numerator too large to represent as an Integer."); } return new Fraction((int) numeratorValue, denominator); }
java
public static Fraction getFraction(final int whole, final int numerator, final int denominator) { if (denominator == 0) { throw new ArithmeticException("The denominator must not be zero"); } if (denominator < 0) { throw new ArithmeticException("The denominator must not be negative"); } if (numerator < 0) { throw new ArithmeticException("The numerator must not be negative"); } long numeratorValue; if (whole < 0) { numeratorValue = whole * (long) denominator - numerator; } else { numeratorValue = whole * (long) denominator + numerator; } if (numeratorValue < Integer.MIN_VALUE || numeratorValue > Integer.MAX_VALUE) { throw new ArithmeticException("Numerator too large to represent as an Integer."); } return new Fraction((int) numeratorValue, denominator); }
[ "public", "static", "Fraction", "getFraction", "(", "final", "int", "whole", ",", "final", "int", "numerator", ",", "final", "int", "denominator", ")", "{", "if", "(", "denominator", "==", "0", ")", "{", "throw", "new", "ArithmeticException", "(", "\"The denominator must not be zero\"", ")", ";", "}", "if", "(", "denominator", "<", "0", ")", "{", "throw", "new", "ArithmeticException", "(", "\"The denominator must not be negative\"", ")", ";", "}", "if", "(", "numerator", "<", "0", ")", "{", "throw", "new", "ArithmeticException", "(", "\"The numerator must not be negative\"", ")", ";", "}", "long", "numeratorValue", ";", "if", "(", "whole", "<", "0", ")", "{", "numeratorValue", "=", "whole", "*", "(", "long", ")", "denominator", "-", "numerator", ";", "}", "else", "{", "numeratorValue", "=", "whole", "*", "(", "long", ")", "denominator", "+", "numerator", ";", "}", "if", "(", "numeratorValue", "<", "Integer", ".", "MIN_VALUE", "||", "numeratorValue", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", "ArithmeticException", "(", "\"Numerator too large to represent as an Integer.\"", ")", ";", "}", "return", "new", "Fraction", "(", "(", "int", ")", "numeratorValue", ",", "denominator", ")", ";", "}" ]
<p>Creates a <code>Fraction</code> instance with the 3 parts of a fraction X Y/Z.</p> <p>The negative sign must be passed in on the whole number part.</p> @param whole the whole number, for example the one in 'one and three sevenths' @param numerator the numerator, for example the three in 'one and three sevenths' @param denominator the denominator, for example the seven in 'one and three sevenths' @return a new fraction instance @throws ArithmeticException if the denominator is <code>zero</code> @throws ArithmeticException if the denominator is negative @throws ArithmeticException if the numerator is negative @throws ArithmeticException if the resulting numerator exceeds <code>Integer.MAX_VALUE</code>
[ "<p", ">", "Creates", "a", "<code", ">", "Fraction<", "/", "code", ">", "instance", "with", "the", "3", "parts", "of", "a", "fraction", "X", "Y", "/", "Z", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/math/Fraction.java#L172-L192
jroyalty/jglm
src/main/java/com/hackoeur/jglm/support/FastMath.java
FastMath.nextAfter
public static double nextAfter(double d, double direction) { """ Get the next machine representable number after a number, moving in the direction of another number. <p> The ordering is as follows (increasing): <ul> <li>-INFINITY</li> <li>-MAX_VALUE</li> <li>-MIN_VALUE</li> <li>-0.0</li> <li>+0.0</li> <li>+MIN_VALUE</li> <li>+MAX_VALUE</li> <li>+INFINITY</li> <li></li> <p> If arguments compare equal, then the second argument is returned. <p> If {@code direction} is greater than {@code d}, the smallest machine representable number strictly greater than {@code d} is returned; if less, then the largest representable number strictly less than {@code d} is returned.</p> <p> If {@code d} is infinite and direction does not bring it back to finite numbers, it is returned unchanged.</p> @param d base number @param direction (the only important thing is whether {@code direction} is greater or smaller than {@code d}) @return the next machine representable number in the specified direction """ // handling of some important special cases if (Double.isNaN(d) || Double.isNaN(direction)) { return Double.NaN; } else if (d == direction) { return direction; } else if (Double.isInfinite(d)) { return (d < 0) ? -Double.MAX_VALUE : Double.MAX_VALUE; } else if (d == 0) { return (direction < 0) ? -Double.MIN_VALUE : Double.MIN_VALUE; } // special cases MAX_VALUE to infinity and MIN_VALUE to 0 // are handled just as normal numbers final long bits = Double.doubleToLongBits(d); final long sign = bits & 0x8000000000000000L; if ((direction < d) ^ (sign == 0L)) { return Double.longBitsToDouble(sign | ((bits & 0x7fffffffffffffffL) + 1)); } else { return Double.longBitsToDouble(sign | ((bits & 0x7fffffffffffffffL) - 1)); } }
java
public static double nextAfter(double d, double direction) { // handling of some important special cases if (Double.isNaN(d) || Double.isNaN(direction)) { return Double.NaN; } else if (d == direction) { return direction; } else if (Double.isInfinite(d)) { return (d < 0) ? -Double.MAX_VALUE : Double.MAX_VALUE; } else if (d == 0) { return (direction < 0) ? -Double.MIN_VALUE : Double.MIN_VALUE; } // special cases MAX_VALUE to infinity and MIN_VALUE to 0 // are handled just as normal numbers final long bits = Double.doubleToLongBits(d); final long sign = bits & 0x8000000000000000L; if ((direction < d) ^ (sign == 0L)) { return Double.longBitsToDouble(sign | ((bits & 0x7fffffffffffffffL) + 1)); } else { return Double.longBitsToDouble(sign | ((bits & 0x7fffffffffffffffL) - 1)); } }
[ "public", "static", "double", "nextAfter", "(", "double", "d", ",", "double", "direction", ")", "{", "// handling of some important special cases", "if", "(", "Double", ".", "isNaN", "(", "d", ")", "||", "Double", ".", "isNaN", "(", "direction", ")", ")", "{", "return", "Double", ".", "NaN", ";", "}", "else", "if", "(", "d", "==", "direction", ")", "{", "return", "direction", ";", "}", "else", "if", "(", "Double", ".", "isInfinite", "(", "d", ")", ")", "{", "return", "(", "d", "<", "0", ")", "?", "-", "Double", ".", "MAX_VALUE", ":", "Double", ".", "MAX_VALUE", ";", "}", "else", "if", "(", "d", "==", "0", ")", "{", "return", "(", "direction", "<", "0", ")", "?", "-", "Double", ".", "MIN_VALUE", ":", "Double", ".", "MIN_VALUE", ";", "}", "// special cases MAX_VALUE to infinity and MIN_VALUE to 0", "// are handled just as normal numbers", "final", "long", "bits", "=", "Double", ".", "doubleToLongBits", "(", "d", ")", ";", "final", "long", "sign", "=", "bits", "&", "0x8000000000000000", "", "L", ";", "if", "(", "(", "direction", "<", "d", ")", "^", "(", "sign", "==", "0L", ")", ")", "{", "return", "Double", ".", "longBitsToDouble", "(", "sign", "|", "(", "(", "bits", "&", "0x7fffffffffffffff", "L", ")", "+", "1", ")", ")", ";", "}", "else", "{", "return", "Double", ".", "longBitsToDouble", "(", "sign", "|", "(", "(", "bits", "&", "0x7fffffffffffffff", "L", ")", "-", "1", ")", ")", ";", "}", "}" ]
Get the next machine representable number after a number, moving in the direction of another number. <p> The ordering is as follows (increasing): <ul> <li>-INFINITY</li> <li>-MAX_VALUE</li> <li>-MIN_VALUE</li> <li>-0.0</li> <li>+0.0</li> <li>+MIN_VALUE</li> <li>+MAX_VALUE</li> <li>+INFINITY</li> <li></li> <p> If arguments compare equal, then the second argument is returned. <p> If {@code direction} is greater than {@code d}, the smallest machine representable number strictly greater than {@code d} is returned; if less, then the largest representable number strictly less than {@code d} is returned.</p> <p> If {@code d} is infinite and direction does not bring it back to finite numbers, it is returned unchanged.</p> @param d base number @param direction (the only important thing is whether {@code direction} is greater or smaller than {@code d}) @return the next machine representable number in the specified direction
[ "Get", "the", "next", "machine", "representable", "number", "after", "a", "number", "moving", "in", "the", "direction", "of", "another", "number", ".", "<p", ">", "The", "ordering", "is", "as", "follows", "(", "increasing", ")", ":", "<ul", ">", "<li", ">", "-", "INFINITY<", "/", "li", ">", "<li", ">", "-", "MAX_VALUE<", "/", "li", ">", "<li", ">", "-", "MIN_VALUE<", "/", "li", ">", "<li", ">", "-", "0", ".", "0<", "/", "li", ">", "<li", ">", "+", "0", ".", "0<", "/", "li", ">", "<li", ">", "+", "MIN_VALUE<", "/", "li", ">", "<li", ">", "+", "MAX_VALUE<", "/", "li", ">", "<li", ">", "+", "INFINITY<", "/", "li", ">", "<li", ">", "<", "/", "li", ">", "<p", ">", "If", "arguments", "compare", "equal", "then", "the", "second", "argument", "is", "returned", ".", "<p", ">", "If", "{", "@code", "direction", "}", "is", "greater", "than", "{", "@code", "d", "}", "the", "smallest", "machine", "representable", "number", "strictly", "greater", "than", "{", "@code", "d", "}", "is", "returned", ";", "if", "less", "then", "the", "largest", "representable", "number", "strictly", "less", "than", "{", "@code", "d", "}", "is", "returned", ".", "<", "/", "p", ">", "<p", ">", "If", "{", "@code", "d", "}", "is", "infinite", "and", "direction", "does", "not", "bring", "it", "back", "to", "finite", "numbers", "it", "is", "returned", "unchanged", ".", "<", "/", "p", ">" ]
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMath.java#L3283-L3306
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java
AbstractResource.copyProperties
protected void copyProperties(Object dest, Object source) { """ Copies properties. @param dest The object to which the properties will be copied. @param source The object whose properties are copied @throws WebApplicationException Throws exception if beanutils encounter a problem. """ try { BeanUtils.copyProperties(dest, source); } catch (Exception e) { String errorMessage = MessageFormat.format("M:{0};;E:{1}", e.getCause().getMessage(), e.toString()); throw new WebApplicationException(errorMessage, Status.BAD_REQUEST); } }
java
protected void copyProperties(Object dest, Object source) { try { BeanUtils.copyProperties(dest, source); } catch (Exception e) { String errorMessage = MessageFormat.format("M:{0};;E:{1}", e.getCause().getMessage(), e.toString()); throw new WebApplicationException(errorMessage, Status.BAD_REQUEST); } }
[ "protected", "void", "copyProperties", "(", "Object", "dest", ",", "Object", "source", ")", "{", "try", "{", "BeanUtils", ".", "copyProperties", "(", "dest", ",", "source", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "errorMessage", "=", "MessageFormat", ".", "format", "(", "\"M:{0};;E:{1}\"", ",", "e", ".", "getCause", "(", ")", ".", "getMessage", "(", ")", ",", "e", ".", "toString", "(", ")", ")", ";", "throw", "new", "WebApplicationException", "(", "errorMessage", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "}" ]
Copies properties. @param dest The object to which the properties will be copied. @param source The object whose properties are copied @throws WebApplicationException Throws exception if beanutils encounter a problem.
[ "Copies", "properties", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L248-L256
treelogic-swe/aws-mock
src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java
MockEC2QueryHandler.getXmlError
private String getXmlError(final String errorCode, final String errorMessage) { """ Generate error response body in xml and write it with writer. @param errorCode the error code wrapped in the xml response @param errorMessage the error message wrapped in the xml response @return xml body for an error message which can be recognized by AWS clients """ Map<String, Object> data = new HashMap<String, Object>(); data.put("errorCode", StringEscapeUtils.escapeXml(errorCode)); data.put("errorMessage", StringEscapeUtils.escapeXml(errorMessage)); // fake a random UUID as request ID data.put("requestID", UUID.randomUUID().toString()); String ret = null; try { ret = TemplateUtils.get(ERROR_RESPONSE_TEMPLATE, data); } catch (AwsMockException e) { log.error("fatal exception caught: {}", e.getMessage()); e.printStackTrace(); } return ret; }
java
private String getXmlError(final String errorCode, final String errorMessage) { Map<String, Object> data = new HashMap<String, Object>(); data.put("errorCode", StringEscapeUtils.escapeXml(errorCode)); data.put("errorMessage", StringEscapeUtils.escapeXml(errorMessage)); // fake a random UUID as request ID data.put("requestID", UUID.randomUUID().toString()); String ret = null; try { ret = TemplateUtils.get(ERROR_RESPONSE_TEMPLATE, data); } catch (AwsMockException e) { log.error("fatal exception caught: {}", e.getMessage()); e.printStackTrace(); } return ret; }
[ "private", "String", "getXmlError", "(", "final", "String", "errorCode", ",", "final", "String", "errorMessage", ")", "{", "Map", "<", "String", ",", "Object", ">", "data", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "data", ".", "put", "(", "\"errorCode\"", ",", "StringEscapeUtils", ".", "escapeXml", "(", "errorCode", ")", ")", ";", "data", ".", "put", "(", "\"errorMessage\"", ",", "StringEscapeUtils", ".", "escapeXml", "(", "errorMessage", ")", ")", ";", "// fake a random UUID as request ID", "data", ".", "put", "(", "\"requestID\"", ",", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ")", ";", "String", "ret", "=", "null", ";", "try", "{", "ret", "=", "TemplateUtils", ".", "get", "(", "ERROR_RESPONSE_TEMPLATE", ",", "data", ")", ";", "}", "catch", "(", "AwsMockException", "e", ")", "{", "log", ".", "error", "(", "\"fatal exception caught: {}\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "ret", ";", "}" ]
Generate error response body in xml and write it with writer. @param errorCode the error code wrapped in the xml response @param errorMessage the error message wrapped in the xml response @return xml body for an error message which can be recognized by AWS clients
[ "Generate", "error", "response", "body", "in", "xml", "and", "write", "it", "with", "writer", "." ]
train
https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L2014-L2030
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmElements.java
XsdAsmElements.generateMethodsForElement
static void generateMethodsForElement(ClassWriter classWriter, XsdElement child, String classType, String apiName) { """ Generates the methods in a given class for a given child that the class is allowed to have. @param classWriter The {@link ClassWriter} where the method will be written. @param child The child of the element which generated the class. Their name represents a method. @param classType The type of the class which contains the children elements. @param apiName The name of the generated fluent interface. """ generateMethodsForElement(classWriter, child.getName(), classType, apiName, new String[]{}); }
java
static void generateMethodsForElement(ClassWriter classWriter, XsdElement child, String classType, String apiName) { generateMethodsForElement(classWriter, child.getName(), classType, apiName, new String[]{}); }
[ "static", "void", "generateMethodsForElement", "(", "ClassWriter", "classWriter", ",", "XsdElement", "child", ",", "String", "classType", ",", "String", "apiName", ")", "{", "generateMethodsForElement", "(", "classWriter", ",", "child", ".", "getName", "(", ")", ",", "classType", ",", "apiName", ",", "new", "String", "[", "]", "{", "}", ")", ";", "}" ]
Generates the methods in a given class for a given child that the class is allowed to have. @param classWriter The {@link ClassWriter} where the method will be written. @param child The child of the element which generated the class. Their name represents a method. @param classType The type of the class which contains the children elements. @param apiName The name of the generated fluent interface.
[ "Generates", "the", "methods", "in", "a", "given", "class", "for", "a", "given", "child", "that", "the", "class", "is", "allowed", "to", "have", "." ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmElements.java#L263-L265
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.collectOne
public Object collectOne(String json, JsonPath... paths) { """ Collect the first matched value and stop parsing immediately @param json json @param paths JsonPath @return value """ return collectOne(json, Object.class, paths); }
java
public Object collectOne(String json, JsonPath... paths) { return collectOne(json, Object.class, paths); }
[ "public", "Object", "collectOne", "(", "String", "json", ",", "JsonPath", "...", "paths", ")", "{", "return", "collectOne", "(", "json", ",", "Object", ".", "class", ",", "paths", ")", ";", "}" ]
Collect the first matched value and stop parsing immediately @param json json @param paths JsonPath @return value
[ "Collect", "the", "first", "matched", "value", "and", "stop", "parsing", "immediately" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L399-L401
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/notifications/ApptentiveNotificationCenter.java
ApptentiveNotificationCenter.postNotification
public synchronized void postNotification(final String name, Object... args) { """ Creates a notification with a given name and user info and posts it to the receiver. """ postNotification(name, ObjectUtils.toMap(args)); }
java
public synchronized void postNotification(final String name, Object... args) { postNotification(name, ObjectUtils.toMap(args)); }
[ "public", "synchronized", "void", "postNotification", "(", "final", "String", "name", ",", "Object", "...", "args", ")", "{", "postNotification", "(", "name", ",", "ObjectUtils", ".", "toMap", "(", "args", ")", ")", ";", "}" ]
Creates a notification with a given name and user info and posts it to the receiver.
[ "Creates", "a", "notification", "with", "a", "given", "name", "and", "user", "info", "and", "posts", "it", "to", "the", "receiver", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/notifications/ApptentiveNotificationCenter.java#L93-L95
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java
TrajectoryEnvelope.makeFootprint
public Geometry makeFootprint(double x, double y, double theta) { """ Returns a {@link Geometry} representing the footprint of the robot in a given pose. @param x The x coordinate of the pose used to create the footprint. @param y The y coordinate of the pose used to create the footprint. @param theta The orientation of the pose used to create the footprint. @return A {@link Geometry} representing the footprint of the robot in a given pose. """ AffineTransformation at = new AffineTransformation(); at.rotate(theta); at.translate(x,y); Geometry rect = at.transform(footprint); return rect; }
java
public Geometry makeFootprint(double x, double y, double theta) { AffineTransformation at = new AffineTransformation(); at.rotate(theta); at.translate(x,y); Geometry rect = at.transform(footprint); return rect; }
[ "public", "Geometry", "makeFootprint", "(", "double", "x", ",", "double", "y", ",", "double", "theta", ")", "{", "AffineTransformation", "at", "=", "new", "AffineTransformation", "(", ")", ";", "at", ".", "rotate", "(", "theta", ")", ";", "at", ".", "translate", "(", "x", ",", "y", ")", ";", "Geometry", "rect", "=", "at", ".", "transform", "(", "footprint", ")", ";", "return", "rect", ";", "}" ]
Returns a {@link Geometry} representing the footprint of the robot in a given pose. @param x The x coordinate of the pose used to create the footprint. @param y The y coordinate of the pose used to create the footprint. @param theta The orientation of the pose used to create the footprint. @return A {@link Geometry} representing the footprint of the robot in a given pose.
[ "Returns", "a", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L631-L637
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java
Preconditions.checkState
public static void checkState( boolean expression, String messageFormat, Object... messageArgs) { """ Checks the truth of the given expression and throws a customized {@link IllegalStateException} if it is false. Intended for doing validation in methods involving the state of the calling instance, but not involving parameters of the calling method, e.g.: <blockquote><pre> public void unlock() { Preconditions.checkState(locked, "Must be locked to be unlocked. Most recent lock: %s", mostRecentLock); } </pre></blockquote> @param expression the precondition to check involving the state of the calling instance @param messageFormat a {@link Formatter format} string for the detail message to be used in the event that an exception is thrown. @param messageArgs the arguments referenced by the format specifiers in the {@code messageFormat} @throws IllegalStateException if {@code expression} is false """ if (!expression) { throw new IllegalStateException(format(messageFormat, messageArgs)); } }
java
public static void checkState( boolean expression, String messageFormat, Object... messageArgs) { if (!expression) { throw new IllegalStateException(format(messageFormat, messageArgs)); } }
[ "public", "static", "void", "checkState", "(", "boolean", "expression", ",", "String", "messageFormat", ",", "Object", "...", "messageArgs", ")", "{", "if", "(", "!", "expression", ")", "{", "throw", "new", "IllegalStateException", "(", "format", "(", "messageFormat", ",", "messageArgs", ")", ")", ";", "}", "}" ]
Checks the truth of the given expression and throws a customized {@link IllegalStateException} if it is false. Intended for doing validation in methods involving the state of the calling instance, but not involving parameters of the calling method, e.g.: <blockquote><pre> public void unlock() { Preconditions.checkState(locked, "Must be locked to be unlocked. Most recent lock: %s", mostRecentLock); } </pre></blockquote> @param expression the precondition to check involving the state of the calling instance @param messageFormat a {@link Formatter format} string for the detail message to be used in the event that an exception is thrown. @param messageArgs the arguments referenced by the format specifiers in the {@code messageFormat} @throws IllegalStateException if {@code expression} is false
[ "Checks", "the", "truth", "of", "the", "given", "expression", "and", "throws", "a", "customized", "{", "@link", "IllegalStateException", "}", "if", "it", "is", "false", ".", "Intended", "for", "doing", "validation", "in", "methods", "involving", "the", "state", "of", "the", "calling", "instance", "but", "not", "involving", "parameters", "of", "the", "calling", "method", "e", ".", "g", ".", ":", "<blockquote", ">", "<pre", ">", "public", "void", "unlock", "()", "{", "Preconditions", ".", "checkState", "(", "locked", "Must", "be", "locked", "to", "be", "unlocked", ".", "Most", "recent", "lock", ":", "%s", "mostRecentLock", ")", ";", "}", "<", "/", "pre", ">", "<", "/", "blockquote", ">" ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L187-L192
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion10.java
CmsImportVersion10.addResourcePropertyRules
protected void addResourcePropertyRules(Digester digester, String xpath) { """ Adds the XML digester rules for resource properties.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules """ String xp_props = xpath + N_PROPERTIES + "/" + N_PROPERTY; // first rule in case the type is implicit digester.addCallMethod(xp_props, "addProperty"); // second rule in case the type is given digester.addCallMethod(xp_props, "addProperty", 1); digester.addCallParam(xp_props, 0, A_TYPE); digester.addCallMethod(xp_props + "/" + N_NAME, "setPropertyName", 0); digester.addCallMethod(xp_props + "/" + N_VALUE, "setPropertyValue", 0); }
java
protected void addResourcePropertyRules(Digester digester, String xpath) { String xp_props = xpath + N_PROPERTIES + "/" + N_PROPERTY; // first rule in case the type is implicit digester.addCallMethod(xp_props, "addProperty"); // second rule in case the type is given digester.addCallMethod(xp_props, "addProperty", 1); digester.addCallParam(xp_props, 0, A_TYPE); digester.addCallMethod(xp_props + "/" + N_NAME, "setPropertyName", 0); digester.addCallMethod(xp_props + "/" + N_VALUE, "setPropertyValue", 0); }
[ "protected", "void", "addResourcePropertyRules", "(", "Digester", "digester", ",", "String", "xpath", ")", "{", "String", "xp_props", "=", "xpath", "+", "N_PROPERTIES", "+", "\"/\"", "+", "N_PROPERTY", ";", "// first rule in case the type is implicit", "digester", ".", "addCallMethod", "(", "xp_props", ",", "\"addProperty\"", ")", ";", "// second rule in case the type is given", "digester", ".", "addCallMethod", "(", "xp_props", ",", "\"addProperty\"", ",", "1", ")", ";", "digester", ".", "addCallParam", "(", "xp_props", ",", "0", ",", "A_TYPE", ")", ";", "digester", ".", "addCallMethod", "(", "xp_props", "+", "\"/\"", "+", "N_NAME", ",", "\"setPropertyName\"", ",", "0", ")", ";", "digester", ".", "addCallMethod", "(", "xp_props", "+", "\"/\"", "+", "N_VALUE", ",", "\"setPropertyValue\"", ",", "0", ")", ";", "}" ]
Adds the XML digester rules for resource properties.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules
[ "Adds", "the", "XML", "digester", "rules", "for", "resource", "properties", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion10.java#L3317-L3329
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleSystem.java
ParticleSystem.addEmitter
public void addEmitter(ParticleEmitter emitter) { """ Add a particle emitter to be used on this system @param emitter The emitter to be added """ emitters.add(emitter); ParticlePool pool= new ParticlePool( this, maxParticlesPerEmitter ); particlesByEmitter.put( emitter, pool ); }
java
public void addEmitter(ParticleEmitter emitter) { emitters.add(emitter); ParticlePool pool= new ParticlePool( this, maxParticlesPerEmitter ); particlesByEmitter.put( emitter, pool ); }
[ "public", "void", "addEmitter", "(", "ParticleEmitter", "emitter", ")", "{", "emitters", ".", "add", "(", "emitter", ")", ";", "ParticlePool", "pool", "=", "new", "ParticlePool", "(", "this", ",", "maxParticlesPerEmitter", ")", ";", "particlesByEmitter", ".", "put", "(", "emitter", ",", "pool", ")", ";", "}" ]
Add a particle emitter to be used on this system @param emitter The emitter to be added
[ "Add", "a", "particle", "emitter", "to", "be", "used", "on", "this", "system" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleSystem.java#L319-L324
projectodd/wunderboss-release
ruby/src/main/java/org/projectodd/wunderboss/ruby/RubyHelper.java
RubyHelper.requireIfAvailable
public static boolean requireIfAvailable(Ruby ruby, String requirement, boolean logErrors) { """ Calls "require 'requirement'" in the Ruby provided. @return boolean If successful, returns true, otherwise false. """ boolean success = false; try { StringBuilder script = new StringBuilder(); script.append("require %q("); script.append(requirement); script.append(")\n"); evalScriptlet( ruby, script.toString(), false ); success = true; } catch (Throwable t) { success = false; if (logErrors) { log.debug( "Error encountered. Unable to require file: " + requirement, t ); } } return success; }
java
public static boolean requireIfAvailable(Ruby ruby, String requirement, boolean logErrors) { boolean success = false; try { StringBuilder script = new StringBuilder(); script.append("require %q("); script.append(requirement); script.append(")\n"); evalScriptlet( ruby, script.toString(), false ); success = true; } catch (Throwable t) { success = false; if (logErrors) { log.debug( "Error encountered. Unable to require file: " + requirement, t ); } } return success; }
[ "public", "static", "boolean", "requireIfAvailable", "(", "Ruby", "ruby", ",", "String", "requirement", ",", "boolean", "logErrors", ")", "{", "boolean", "success", "=", "false", ";", "try", "{", "StringBuilder", "script", "=", "new", "StringBuilder", "(", ")", ";", "script", ".", "append", "(", "\"require %q(\"", ")", ";", "script", ".", "append", "(", "requirement", ")", ";", "script", ".", "append", "(", "\")\\n\"", ")", ";", "evalScriptlet", "(", "ruby", ",", "script", ".", "toString", "(", ")", ",", "false", ")", ";", "success", "=", "true", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "success", "=", "false", ";", "if", "(", "logErrors", ")", "{", "log", ".", "debug", "(", "\"Error encountered. Unable to require file: \"", "+", "requirement", ",", "t", ")", ";", "}", "}", "return", "success", ";", "}" ]
Calls "require 'requirement'" in the Ruby provided. @return boolean If successful, returns true, otherwise false.
[ "Calls", "require", "requirement", "in", "the", "Ruby", "provided", "." ]
train
https://github.com/projectodd/wunderboss-release/blob/f67c68e80c5798169e3a9b2015e278239dbf005d/ruby/src/main/java/org/projectodd/wunderboss/ruby/RubyHelper.java#L116-L132
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java
Expr.setLogical
public void setLogical(Type type, Expr left, Expr right) { """ Set the logical value of this atom expression. @param type the type of expression @param left the left sub-expression @param right the right sub-expression """ switch (type) { case AND: case OR: this.type = type; this.value = 0; this.left = left; this.right = right; this.query = null; break; case NOT: this.type = type; if (left != null && right == null) this.left = left; else if (left == null && right != null) this.left = right; else if (left != null) throw new IllegalArgumentException("Only one sub-expression" + " should be provided" + " for NOT expressions!"); this.query = null; this.value = 0; break; default: throw new IllegalArgumentException("Left/Right sub expressions " + "supplied for " + " non-logical operator!"); } }
java
public void setLogical(Type type, Expr left, Expr right) { switch (type) { case AND: case OR: this.type = type; this.value = 0; this.left = left; this.right = right; this.query = null; break; case NOT: this.type = type; if (left != null && right == null) this.left = left; else if (left == null && right != null) this.left = right; else if (left != null) throw new IllegalArgumentException("Only one sub-expression" + " should be provided" + " for NOT expressions!"); this.query = null; this.value = 0; break; default: throw new IllegalArgumentException("Left/Right sub expressions " + "supplied for " + " non-logical operator!"); } }
[ "public", "void", "setLogical", "(", "Type", "type", ",", "Expr", "left", ",", "Expr", "right", ")", "{", "switch", "(", "type", ")", "{", "case", "AND", ":", "case", "OR", ":", "this", ".", "type", "=", "type", ";", "this", ".", "value", "=", "0", ";", "this", ".", "left", "=", "left", ";", "this", ".", "right", "=", "right", ";", "this", ".", "query", "=", "null", ";", "break", ";", "case", "NOT", ":", "this", ".", "type", "=", "type", ";", "if", "(", "left", "!=", "null", "&&", "right", "==", "null", ")", "this", ".", "left", "=", "left", ";", "else", "if", "(", "left", "==", "null", "&&", "right", "!=", "null", ")", "this", ".", "left", "=", "right", ";", "else", "if", "(", "left", "!=", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Only one sub-expression\"", "+", "\" should be provided\"", "+", "\" for NOT expressions!\"", ")", ";", "this", ".", "query", "=", "null", ";", "this", ".", "value", "=", "0", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Left/Right sub expressions \"", "+", "\"supplied for \"", "+", "\" non-logical operator!\"", ")", ";", "}", "}" ]
Set the logical value of this atom expression. @param type the type of expression @param left the left sub-expression @param right the right sub-expression
[ "Set", "the", "logical", "value", "of", "this", "atom", "expression", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/Expr.java#L595-L623
diegossilveira/jcors
src/main/java/org/jcors/web/ActualRequestHandler.java
ActualRequestHandler.checkOriginHeader
private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) { """ Checks if the origin is allowed @param request @param config """ String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER); Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header"); String[] origins = originHeader.split(" "); for (String origin : origins) { Constraint.ensureTrue(config.isOriginAllowed(origin), String.format("The specified origin is not allowed: '%s'", origin)); } return originHeader; }
java
private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) { String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER); Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header"); String[] origins = originHeader.split(" "); for (String origin : origins) { Constraint.ensureTrue(config.isOriginAllowed(origin), String.format("The specified origin is not allowed: '%s'", origin)); } return originHeader; }
[ "private", "String", "checkOriginHeader", "(", "HttpServletRequest", "request", ",", "JCorsConfig", "config", ")", "{", "String", "originHeader", "=", "request", ".", "getHeader", "(", "CorsHeaders", ".", "ORIGIN_HEADER", ")", ";", "Constraint", ".", "ensureNotEmpty", "(", "originHeader", ",", "\"Cross-Origin requests must specify an Origin Header\"", ")", ";", "String", "[", "]", "origins", "=", "originHeader", ".", "split", "(", "\" \"", ")", ";", "for", "(", "String", "origin", ":", "origins", ")", "{", "Constraint", ".", "ensureTrue", "(", "config", ".", "isOriginAllowed", "(", "origin", ")", ",", "String", ".", "format", "(", "\"The specified origin is not allowed: '%s'\"", ",", "origin", ")", ")", ";", "}", "return", "originHeader", ";", "}" ]
Checks if the origin is allowed @param request @param config
[ "Checks", "if", "the", "origin", "is", "allowed" ]
train
https://github.com/diegossilveira/jcors/blob/cd56a9e2055d629baa42f93b27dd5615ced9632f/src/main/java/org/jcors/web/ActualRequestHandler.java#L49-L61
borball/weixin-sdk
weixin-qydev/src/main/java/com/riversoft/weixin/qy/media/Medias.java
Medias.upload
public String upload(MediaType type, InputStream inputStream, String fileName) { """ 上传临时图片,语音,视频和普通文件 @param type 临时素材类型:只能是 图片,语音,视频和普通文件 @param inputStream 临时素材流 @param fileName 临时素材文件名 @return 返回临时素材metaId """ if (type == MediaType.mpnews) { throw new com.riversoft.weixin.common.exception.WxRuntimeException(999, "unsupported media type: " + type.name()); } String url = WxEndpoint.get("url.media.upload"); String response = wxClient.post(String.format(url, type.name()), inputStream, fileName); //为什么这个成功返回的response没有error code,和其他的格格不入,临时工弄的? Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("media_id")) { return result.get("media_id").toString(); } else { logger.warn("media upload failed: {}", response); throw new WxRuntimeException(998, response); } }
java
public String upload(MediaType type, InputStream inputStream, String fileName) { if (type == MediaType.mpnews) { throw new com.riversoft.weixin.common.exception.WxRuntimeException(999, "unsupported media type: " + type.name()); } String url = WxEndpoint.get("url.media.upload"); String response = wxClient.post(String.format(url, type.name()), inputStream, fileName); //为什么这个成功返回的response没有error code,和其他的格格不入,临时工弄的? Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response); if (result.containsKey("media_id")) { return result.get("media_id").toString(); } else { logger.warn("media upload failed: {}", response); throw new WxRuntimeException(998, response); } }
[ "public", "String", "upload", "(", "MediaType", "type", ",", "InputStream", "inputStream", ",", "String", "fileName", ")", "{", "if", "(", "type", "==", "MediaType", ".", "mpnews", ")", "{", "throw", "new", "com", ".", "riversoft", ".", "weixin", ".", "common", ".", "exception", ".", "WxRuntimeException", "(", "999", ",", "\"unsupported media type: \"", "+", "type", ".", "name", "(", ")", ")", ";", "}", "String", "url", "=", "WxEndpoint", ".", "get", "(", "\"url.media.upload\"", ")", ";", "String", "response", "=", "wxClient", ".", "post", "(", "String", ".", "format", "(", "url", ",", "type", ".", "name", "(", ")", ")", ",", "inputStream", ",", "fileName", ")", ";", "//为什么这个成功返回的response没有error code,和其他的格格不入,临时工弄的?\r", "Map", "<", "String", ",", "Object", ">", "result", "=", "JsonMapper", ".", "defaultMapper", "(", ")", ".", "json2Map", "(", "response", ")", ";", "if", "(", "result", ".", "containsKey", "(", "\"media_id\"", ")", ")", "{", "return", "result", ".", "get", "(", "\"media_id\"", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "\"media upload failed: {}\"", ",", "response", ")", ";", "throw", "new", "WxRuntimeException", "(", "998", ",", "response", ")", ";", "}", "}" ]
上传临时图片,语音,视频和普通文件 @param type 临时素材类型:只能是 图片,语音,视频和普通文件 @param inputStream 临时素材流 @param fileName 临时素材文件名 @return 返回临时素材metaId
[ "上传临时图片,语音,视频和普通文件" ]
train
https://github.com/borball/weixin-sdk/blob/32bf5e45cdd8d0d28074e83954e1ec62dcf25cb7/weixin-qydev/src/main/java/com/riversoft/weixin/qy/media/Medias.java#L49-L65
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseFloatObj
@Nullable public static Float parseFloatObj (@Nullable final String sStr, @Nullable final Float aDefault) { """ Parse the given {@link String} as {@link Float}. Note: both the locale independent form of a double can be parsed here (e.g. 4.523) as well as a localized form using the comma as the decimal separator (e.g. the German 4,523). @param sStr The string to parse. May be <code>null</code>. @param aDefault The default value to be returned if the parsed string cannot be converted to a float. May be <code>null</code>. @return <code>aDefault</code> if the object does not represent a valid value. """ final float fValue = parseFloat (sStr, Float.NaN); return Float.isNaN (fValue) ? aDefault : Float.valueOf (fValue); }
java
@Nullable public static Float parseFloatObj (@Nullable final String sStr, @Nullable final Float aDefault) { final float fValue = parseFloat (sStr, Float.NaN); return Float.isNaN (fValue) ? aDefault : Float.valueOf (fValue); }
[ "@", "Nullable", "public", "static", "Float", "parseFloatObj", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "Float", "aDefault", ")", "{", "final", "float", "fValue", "=", "parseFloat", "(", "sStr", ",", "Float", ".", "NaN", ")", ";", "return", "Float", ".", "isNaN", "(", "fValue", ")", "?", "aDefault", ":", "Float", ".", "valueOf", "(", "fValue", ")", ";", "}" ]
Parse the given {@link String} as {@link Float}. Note: both the locale independent form of a double can be parsed here (e.g. 4.523) as well as a localized form using the comma as the decimal separator (e.g. the German 4,523). @param sStr The string to parse. May be <code>null</code>. @param aDefault The default value to be returned if the parsed string cannot be converted to a float. May be <code>null</code>. @return <code>aDefault</code> if the object does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "{", "@link", "Float", "}", ".", "Note", ":", "both", "the", "locale", "independent", "form", "of", "a", "double", "can", "be", "parsed", "here", "(", "e", ".", "g", ".", "4", ".", "523", ")", "as", "well", "as", "a", "localized", "form", "using", "the", "comma", "as", "the", "decimal", "separator", "(", "e", ".", "g", ".", "the", "German", "4", "523", ")", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L690-L695
Jasig/uPortal
uPortal-tools/src/main/java/org/apereo/portal/version/VersionUtils.java
VersionUtils.getMostSpecificMatchingField
public static Version.Field getMostSpecificMatchingField(Version v1, Version v2) { """ Determine how much of two versions match. Returns null if the versions do not match at all. @return null for no match or the name of the most specific field that matches. """ if (v1.getMajor() != v2.getMajor()) { return null; } if (v1.getMinor() != v2.getMinor()) { return Version.Field.MAJOR; } if (v1.getPatch() != v2.getPatch()) { return Version.Field.MINOR; } final Integer l1 = v1.getLocal(); final Integer l2 = v2.getLocal(); if (l1 != l2 && (l1 == null || l2 == null || !l1.equals(l2))) { return Version.Field.PATCH; } return Version.Field.LOCAL; }
java
public static Version.Field getMostSpecificMatchingField(Version v1, Version v2) { if (v1.getMajor() != v2.getMajor()) { return null; } if (v1.getMinor() != v2.getMinor()) { return Version.Field.MAJOR; } if (v1.getPatch() != v2.getPatch()) { return Version.Field.MINOR; } final Integer l1 = v1.getLocal(); final Integer l2 = v2.getLocal(); if (l1 != l2 && (l1 == null || l2 == null || !l1.equals(l2))) { return Version.Field.PATCH; } return Version.Field.LOCAL; }
[ "public", "static", "Version", ".", "Field", "getMostSpecificMatchingField", "(", "Version", "v1", ",", "Version", "v2", ")", "{", "if", "(", "v1", ".", "getMajor", "(", ")", "!=", "v2", ".", "getMajor", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "v1", ".", "getMinor", "(", ")", "!=", "v2", ".", "getMinor", "(", ")", ")", "{", "return", "Version", ".", "Field", ".", "MAJOR", ";", "}", "if", "(", "v1", ".", "getPatch", "(", ")", "!=", "v2", ".", "getPatch", "(", ")", ")", "{", "return", "Version", ".", "Field", ".", "MINOR", ";", "}", "final", "Integer", "l1", "=", "v1", ".", "getLocal", "(", ")", ";", "final", "Integer", "l2", "=", "v2", ".", "getLocal", "(", ")", ";", "if", "(", "l1", "!=", "l2", "&&", "(", "l1", "==", "null", "||", "l2", "==", "null", "||", "!", "l1", ".", "equals", "(", "l2", ")", ")", ")", "{", "return", "Version", ".", "Field", ".", "PATCH", ";", "}", "return", "Version", ".", "Field", ".", "LOCAL", ";", "}" ]
Determine how much of two versions match. Returns null if the versions do not match at all. @return null for no match or the name of the most specific field that matches.
[ "Determine", "how", "much", "of", "two", "versions", "match", ".", "Returns", "null", "if", "the", "versions", "do", "not", "match", "at", "all", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-tools/src/main/java/org/apereo/portal/version/VersionUtils.java#L68-L88
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.getDeploymentGroups
@Override public Map<String, DeploymentGroup> getDeploymentGroups() { """ Returns a {@link Map} of deployment group name to {@link DeploymentGroup} objects for all of the deployment groups known. """ log.debug("getting deployment groups"); final String folder = Paths.configDeploymentGroups(); final ZooKeeperClient client = provider.get("getDeploymentGroups"); try { final List<String> names; try { names = client.getChildren(folder); } catch (NoNodeException e) { return Maps.newHashMap(); } final Map<String, DeploymentGroup> descriptors = Maps.newHashMap(); for (final String name : names) { final String path = Paths.configDeploymentGroup(name); try { final byte[] data = client.getData(path); final DeploymentGroup descriptor = parse(data, DeploymentGroup.class); descriptors.put(descriptor.getName(), descriptor); } catch (NoNodeException e) { // Ignore, the deployment group was deleted before we had a chance to read it. log.debug("Ignoring deleted deployment group {}", name); } } return descriptors; } catch (KeeperException | IOException e) { throw new HeliosRuntimeException("getting deployment groups failed", e); } }
java
@Override public Map<String, DeploymentGroup> getDeploymentGroups() { log.debug("getting deployment groups"); final String folder = Paths.configDeploymentGroups(); final ZooKeeperClient client = provider.get("getDeploymentGroups"); try { final List<String> names; try { names = client.getChildren(folder); } catch (NoNodeException e) { return Maps.newHashMap(); } final Map<String, DeploymentGroup> descriptors = Maps.newHashMap(); for (final String name : names) { final String path = Paths.configDeploymentGroup(name); try { final byte[] data = client.getData(path); final DeploymentGroup descriptor = parse(data, DeploymentGroup.class); descriptors.put(descriptor.getName(), descriptor); } catch (NoNodeException e) { // Ignore, the deployment group was deleted before we had a chance to read it. log.debug("Ignoring deleted deployment group {}", name); } } return descriptors; } catch (KeeperException | IOException e) { throw new HeliosRuntimeException("getting deployment groups failed", e); } }
[ "@", "Override", "public", "Map", "<", "String", ",", "DeploymentGroup", ">", "getDeploymentGroups", "(", ")", "{", "log", ".", "debug", "(", "\"getting deployment groups\"", ")", ";", "final", "String", "folder", "=", "Paths", ".", "configDeploymentGroups", "(", ")", ";", "final", "ZooKeeperClient", "client", "=", "provider", ".", "get", "(", "\"getDeploymentGroups\"", ")", ";", "try", "{", "final", "List", "<", "String", ">", "names", ";", "try", "{", "names", "=", "client", ".", "getChildren", "(", "folder", ")", ";", "}", "catch", "(", "NoNodeException", "e", ")", "{", "return", "Maps", ".", "newHashMap", "(", ")", ";", "}", "final", "Map", "<", "String", ",", "DeploymentGroup", ">", "descriptors", "=", "Maps", ".", "newHashMap", "(", ")", ";", "for", "(", "final", "String", "name", ":", "names", ")", "{", "final", "String", "path", "=", "Paths", ".", "configDeploymentGroup", "(", "name", ")", ";", "try", "{", "final", "byte", "[", "]", "data", "=", "client", ".", "getData", "(", "path", ")", ";", "final", "DeploymentGroup", "descriptor", "=", "parse", "(", "data", ",", "DeploymentGroup", ".", "class", ")", ";", "descriptors", ".", "put", "(", "descriptor", ".", "getName", "(", ")", ",", "descriptor", ")", ";", "}", "catch", "(", "NoNodeException", "e", ")", "{", "// Ignore, the deployment group was deleted before we had a chance to read it.", "log", ".", "debug", "(", "\"Ignoring deleted deployment group {}\"", ",", "name", ")", ";", "}", "}", "return", "descriptors", ";", "}", "catch", "(", "KeeperException", "|", "IOException", "e", ")", "{", "throw", "new", "HeliosRuntimeException", "(", "\"getting deployment groups failed\"", ",", "e", ")", ";", "}", "}" ]
Returns a {@link Map} of deployment group name to {@link DeploymentGroup} objects for all of the deployment groups known.
[ "Returns", "a", "{" ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1249-L1277
adamfisk/littleshoot-util
src/main/java/org/littleshoot/util/MapUtils.java
MapUtils.removeFromMapValues
public static Object removeFromMapValues(final Map map, final Object value) { """ Removes the specified reader/writer from the values of the specified reader/writer map. Many times classes will contain maps of some key to reader/writers, and this method simply allows those classes to easily remove those values. @param map The map mapping some key to reader/writers. @param value The reader/writer to remove. @return The key for the object removed, or <code>null</code> if nothing was removed. """ synchronized (map) { final Collection entries = map.entrySet(); for (final Iterator iter = entries.iterator(); iter.hasNext();) { final Map.Entry entry = (Entry) iter.next(); if (entry.getValue().equals(value)) { final Object key = entry.getKey(); iter.remove(); return key; } } return null; } }
java
public static Object removeFromMapValues(final Map map, final Object value) { synchronized (map) { final Collection entries = map.entrySet(); for (final Iterator iter = entries.iterator(); iter.hasNext();) { final Map.Entry entry = (Entry) iter.next(); if (entry.getValue().equals(value)) { final Object key = entry.getKey(); iter.remove(); return key; } } return null; } }
[ "public", "static", "Object", "removeFromMapValues", "(", "final", "Map", "map", ",", "final", "Object", "value", ")", "{", "synchronized", "(", "map", ")", "{", "final", "Collection", "entries", "=", "map", ".", "entrySet", "(", ")", ";", "for", "(", "final", "Iterator", "iter", "=", "entries", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "final", "Map", ".", "Entry", "entry", "=", "(", "Entry", ")", "iter", ".", "next", "(", ")", ";", "if", "(", "entry", ".", "getValue", "(", ")", ".", "equals", "(", "value", ")", ")", "{", "final", "Object", "key", "=", "entry", ".", "getKey", "(", ")", ";", "iter", ".", "remove", "(", ")", ";", "return", "key", ";", "}", "}", "return", "null", ";", "}", "}" ]
Removes the specified reader/writer from the values of the specified reader/writer map. Many times classes will contain maps of some key to reader/writers, and this method simply allows those classes to easily remove those values. @param map The map mapping some key to reader/writers. @param value The reader/writer to remove. @return The key for the object removed, or <code>null</code> if nothing was removed.
[ "Removes", "the", "specified", "reader", "/", "writer", "from", "the", "values", "of", "the", "specified", "reader", "/", "writer", "map", ".", "Many", "times", "classes", "will", "contain", "maps", "of", "some", "key", "to", "reader", "/", "writers", "and", "this", "method", "simply", "allows", "those", "classes", "to", "easily", "remove", "those", "values", "." ]
train
https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/MapUtils.java#L25-L42
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.setDatabase
public void setDatabase(String databaseKey) { """ Sets the database drivers to the given value.<p> @param databaseKey the key of the selected database server (e.g. "mysql", "generic" or "oracle") """ m_databaseKey = databaseKey; String vfsDriver; String userDriver; String projectDriver; String historyDriver; String subscriptionDriver; String sqlManager; vfsDriver = getDbProperty(m_databaseKey + ".vfs.driver"); userDriver = getDbProperty(m_databaseKey + ".user.driver"); projectDriver = getDbProperty(m_databaseKey + ".project.driver"); historyDriver = getDbProperty(m_databaseKey + ".history.driver"); subscriptionDriver = getDbProperty(m_databaseKey + ".subscription.driver"); sqlManager = getDbProperty(m_databaseKey + ".sqlmanager"); // set the db properties setExtProperty("db.name", m_databaseKey); setExtProperty("db.vfs.driver", vfsDriver); setExtProperty("db.vfs.sqlmanager", sqlManager); setExtProperty("db.user.driver", userDriver); setExtProperty("db.user.sqlmanager", sqlManager); setExtProperty("db.project.driver", projectDriver); setExtProperty("db.project.sqlmanager", sqlManager); setExtProperty("db.history.driver", historyDriver); setExtProperty("db.history.sqlmanager", sqlManager); setExtProperty("db.subscription.driver", subscriptionDriver); setExtProperty("db.subscription.sqlmanager", sqlManager); Properties dbProps = getDatabaseProperties().get(databaseKey); String prefix = "additional."; String dbPropBlock = ""; for (Map.Entry<Object, Object> entry : dbProps.entrySet()) { if (entry.getKey() instanceof String) { String key = (String)entry.getKey(); if (key.startsWith(prefix)) { key = key.substring(prefix.length()); String val = (String)(entry.getValue()); setExtProperty(key, val); dbPropBlock += key + "=" + val + "\n"; } } } if (!CmsStringUtil.isEmptyOrWhitespaceOnly(dbPropBlock)) { m_additionalProperties.put("dbprops", dbPropBlock); } }
java
public void setDatabase(String databaseKey) { m_databaseKey = databaseKey; String vfsDriver; String userDriver; String projectDriver; String historyDriver; String subscriptionDriver; String sqlManager; vfsDriver = getDbProperty(m_databaseKey + ".vfs.driver"); userDriver = getDbProperty(m_databaseKey + ".user.driver"); projectDriver = getDbProperty(m_databaseKey + ".project.driver"); historyDriver = getDbProperty(m_databaseKey + ".history.driver"); subscriptionDriver = getDbProperty(m_databaseKey + ".subscription.driver"); sqlManager = getDbProperty(m_databaseKey + ".sqlmanager"); // set the db properties setExtProperty("db.name", m_databaseKey); setExtProperty("db.vfs.driver", vfsDriver); setExtProperty("db.vfs.sqlmanager", sqlManager); setExtProperty("db.user.driver", userDriver); setExtProperty("db.user.sqlmanager", sqlManager); setExtProperty("db.project.driver", projectDriver); setExtProperty("db.project.sqlmanager", sqlManager); setExtProperty("db.history.driver", historyDriver); setExtProperty("db.history.sqlmanager", sqlManager); setExtProperty("db.subscription.driver", subscriptionDriver); setExtProperty("db.subscription.sqlmanager", sqlManager); Properties dbProps = getDatabaseProperties().get(databaseKey); String prefix = "additional."; String dbPropBlock = ""; for (Map.Entry<Object, Object> entry : dbProps.entrySet()) { if (entry.getKey() instanceof String) { String key = (String)entry.getKey(); if (key.startsWith(prefix)) { key = key.substring(prefix.length()); String val = (String)(entry.getValue()); setExtProperty(key, val); dbPropBlock += key + "=" + val + "\n"; } } } if (!CmsStringUtil.isEmptyOrWhitespaceOnly(dbPropBlock)) { m_additionalProperties.put("dbprops", dbPropBlock); } }
[ "public", "void", "setDatabase", "(", "String", "databaseKey", ")", "{", "m_databaseKey", "=", "databaseKey", ";", "String", "vfsDriver", ";", "String", "userDriver", ";", "String", "projectDriver", ";", "String", "historyDriver", ";", "String", "subscriptionDriver", ";", "String", "sqlManager", ";", "vfsDriver", "=", "getDbProperty", "(", "m_databaseKey", "+", "\".vfs.driver\"", ")", ";", "userDriver", "=", "getDbProperty", "(", "m_databaseKey", "+", "\".user.driver\"", ")", ";", "projectDriver", "=", "getDbProperty", "(", "m_databaseKey", "+", "\".project.driver\"", ")", ";", "historyDriver", "=", "getDbProperty", "(", "m_databaseKey", "+", "\".history.driver\"", ")", ";", "subscriptionDriver", "=", "getDbProperty", "(", "m_databaseKey", "+", "\".subscription.driver\"", ")", ";", "sqlManager", "=", "getDbProperty", "(", "m_databaseKey", "+", "\".sqlmanager\"", ")", ";", "// set the db properties", "setExtProperty", "(", "\"db.name\"", ",", "m_databaseKey", ")", ";", "setExtProperty", "(", "\"db.vfs.driver\"", ",", "vfsDriver", ")", ";", "setExtProperty", "(", "\"db.vfs.sqlmanager\"", ",", "sqlManager", ")", ";", "setExtProperty", "(", "\"db.user.driver\"", ",", "userDriver", ")", ";", "setExtProperty", "(", "\"db.user.sqlmanager\"", ",", "sqlManager", ")", ";", "setExtProperty", "(", "\"db.project.driver\"", ",", "projectDriver", ")", ";", "setExtProperty", "(", "\"db.project.sqlmanager\"", ",", "sqlManager", ")", ";", "setExtProperty", "(", "\"db.history.driver\"", ",", "historyDriver", ")", ";", "setExtProperty", "(", "\"db.history.sqlmanager\"", ",", "sqlManager", ")", ";", "setExtProperty", "(", "\"db.subscription.driver\"", ",", "subscriptionDriver", ")", ";", "setExtProperty", "(", "\"db.subscription.sqlmanager\"", ",", "sqlManager", ")", ";", "Properties", "dbProps", "=", "getDatabaseProperties", "(", ")", ".", "get", "(", "databaseKey", ")", ";", "String", "prefix", "=", "\"additional.\"", ";", "String", "dbPropBlock", "=", "\"\"", ";", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "dbProps", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getKey", "(", ")", "instanceof", "String", ")", "{", "String", "key", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "key", ".", "startsWith", "(", "prefix", ")", ")", "{", "key", "=", "key", ".", "substring", "(", "prefix", ".", "length", "(", ")", ")", ";", "String", "val", "=", "(", "String", ")", "(", "entry", ".", "getValue", "(", ")", ")", ";", "setExtProperty", "(", "key", ",", "val", ")", ";", "dbPropBlock", "+=", "key", "+", "\"=\"", "+", "val", "+", "\"\\n\"", ";", "}", "}", "}", "if", "(", "!", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "dbPropBlock", ")", ")", "{", "m_additionalProperties", ".", "put", "(", "\"dbprops\"", ",", "dbPropBlock", ")", ";", "}", "}" ]
Sets the database drivers to the given value.<p> @param databaseKey the key of the selected database server (e.g. "mysql", "generic" or "oracle")
[ "Sets", "the", "database", "drivers", "to", "the", "given", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L1815-L1860
Coolerfall/Android-HttpDownloadManager
library/src/main/java/com/coolerfall/download/DownloadDelivery.java
DownloadDelivery.postStart
void postStart(final DownloadRequest request, final long totalBytes) { """ Post download start event. @param request download request @param totalBytes total bytes """ downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onStart(request.downloadId(), totalBytes); } }); }
java
void postStart(final DownloadRequest request, final long totalBytes) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onStart(request.downloadId(), totalBytes); } }); }
[ "void", "postStart", "(", "final", "DownloadRequest", "request", ",", "final", "long", "totalBytes", ")", "{", "downloadPoster", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "request", ".", "downloadCallback", "(", ")", ".", "onStart", "(", "request", ".", "downloadId", "(", ")", ",", "totalBytes", ")", ";", "}", "}", ")", ";", "}" ]
Post download start event. @param request download request @param totalBytes total bytes
[ "Post", "download", "start", "event", "." ]
train
https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L29-L35
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragmentInDays
@GwtIncompatible("incompatible method") public static long getFragmentInDays(final Calendar calendar, final int fragment) { """ <p>Returns the number of days within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the days of any date will only return the number of days of the current month (resulting in a number between 1 and 31). This method will retrieve the number of days for any fragment. For example, if you want to calculate the number of days past this year, your fragment is Calendar.YEAR. The result will be all days of the past month(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a DAY field will return 0.</p> <ul> <li>January 28, 2008 with Calendar.MONTH as fragment will return 28 (equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li> <li>February 28, 2008 with Calendar.MONTH as fragment will return 28 (equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li> <li>January 28, 2008 with Calendar.YEAR as fragment will return 28 (equivalent to calendar.get(Calendar.DAY_OF_YEAR))</li> <li>February 28, 2008 with Calendar.YEAR as fragment will return 59 (equivalent to calendar.get(Calendar.DAY_OF_YEAR))</li> <li>January 28, 2008 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in days)</li> </ul> @param calendar the calendar to work with, not null @param fragment the {@code Calendar} field part of calendar to calculate @return number of days within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4 """ return getFragment(calendar, fragment, TimeUnit.DAYS); }
java
@GwtIncompatible("incompatible method") public static long getFragmentInDays(final Calendar calendar, final int fragment) { return getFragment(calendar, fragment, TimeUnit.DAYS); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "long", "getFragmentInDays", "(", "final", "Calendar", "calendar", ",", "final", "int", "fragment", ")", "{", "return", "getFragment", "(", "calendar", ",", "fragment", ",", "TimeUnit", ".", "DAYS", ")", ";", "}" ]
<p>Returns the number of days within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the days of any date will only return the number of days of the current month (resulting in a number between 1 and 31). This method will retrieve the number of days for any fragment. For example, if you want to calculate the number of days past this year, your fragment is Calendar.YEAR. The result will be all days of the past month(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a DAY field will return 0.</p> <ul> <li>January 28, 2008 with Calendar.MONTH as fragment will return 28 (equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li> <li>February 28, 2008 with Calendar.MONTH as fragment will return 28 (equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li> <li>January 28, 2008 with Calendar.YEAR as fragment will return 28 (equivalent to calendar.get(Calendar.DAY_OF_YEAR))</li> <li>February 28, 2008 with Calendar.YEAR as fragment will return 59 (equivalent to calendar.get(Calendar.DAY_OF_YEAR))</li> <li>January 28, 2008 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in days)</li> </ul> @param calendar the calendar to work with, not null @param fragment the {@code Calendar} field part of calendar to calculate @return number of days within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4
[ "<p", ">", "Returns", "the", "number", "of", "days", "within", "the", "fragment", ".", "All", "datefields", "greater", "than", "the", "fragment", "will", "be", "ignored", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1648-L1651
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_ip_duration_GET
public OvhOrder dedicated_server_serviceName_ip_duration_GET(String serviceName, String duration, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException { """ Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/ip/{duration} @param blockSize [required] IP block size @param organisationId [required] Your organisation id to add on block informations @param country [required] IP localization @param type [required] The type of IP @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration """ String qPath = "/order/dedicated/server/{serviceName}/ip/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "blockSize", blockSize); query(sb, "country", country); query(sb, "organisationId", organisationId); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicated_server_serviceName_ip_duration_GET(String serviceName, String duration, OvhIpBlockSizeEnum blockSize, OvhIpCountryEnum country, String organisationId, OvhIpTypeOrderableEnum type) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/ip/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "blockSize", blockSize); query(sb, "country", country); query(sb, "organisationId", organisationId); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicated_server_serviceName_ip_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhIpBlockSizeEnum", "blockSize", ",", "OvhIpCountryEnum", "country", ",", "String", "organisationId", ",", "OvhIpTypeOrderableEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/ip/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"blockSize\"", ",", "blockSize", ")", ";", "query", "(", "sb", ",", "\"country\"", ",", "country", ")", ";", "query", "(", "sb", ",", "\"organisationId\"", ",", "organisationId", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/ip/{duration} @param blockSize [required] IP block size @param organisationId [required] Your organisation id to add on block informations @param country [required] IP localization @param type [required] The type of IP @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2410-L2419
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java
Descriptor.replaceAllAcls
public Descriptor replaceAllAcls(PSequence<ServiceAcl> acls) { """ Replace all the ACLs with the given ACL sequence. This will not replace ACLs generated by autoAcl, to disable autoAcl, turn it off. @param acls The ACLs to use. @return A copy of this descriptor. """ return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls); }
java
public Descriptor replaceAllAcls(PSequence<ServiceAcl> acls) { return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls); }
[ "public", "Descriptor", "replaceAllAcls", "(", "PSequence", "<", "ServiceAcl", ">", "acls", ")", "{", "return", "new", "Descriptor", "(", "name", ",", "calls", ",", "pathParamSerializers", ",", "messageSerializers", ",", "serializerFactory", ",", "exceptionSerializer", ",", "autoAcl", ",", "acls", ",", "headerFilter", ",", "locatableService", ",", "circuitBreaker", ",", "topicCalls", ")", ";", "}" ]
Replace all the ACLs with the given ACL sequence. This will not replace ACLs generated by autoAcl, to disable autoAcl, turn it off. @param acls The ACLs to use. @return A copy of this descriptor.
[ "Replace", "all", "the", "ACLs", "with", "the", "given", "ACL", "sequence", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java#L810-L812
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/engine/executor/JavaExecutorImpl.java
JavaExecutorImpl.execute
public Object execute(String qualifiedClassName, String methodName, Object... args) { """ /* @param qualifiedClassName : including package name: e.g. "AddService" @param methodName @param args @return """ try { return findMethod(qualifiedClassName, methodName) .invoke(injector.getInstance(getClass(qualifiedClassName)), args); } catch (Exception e) { LOGGER.error("Exception encountered while executing java method" + e); throw new RuntimeException(e); } }
java
public Object execute(String qualifiedClassName, String methodName, Object... args) { try { return findMethod(qualifiedClassName, methodName) .invoke(injector.getInstance(getClass(qualifiedClassName)), args); } catch (Exception e) { LOGGER.error("Exception encountered while executing java method" + e); throw new RuntimeException(e); } }
[ "public", "Object", "execute", "(", "String", "qualifiedClassName", ",", "String", "methodName", ",", "Object", "...", "args", ")", "{", "try", "{", "return", "findMethod", "(", "qualifiedClassName", ",", "methodName", ")", ".", "invoke", "(", "injector", ".", "getInstance", "(", "getClass", "(", "qualifiedClassName", ")", ")", ",", "args", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Exception encountered while executing java method\"", "+", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
/* @param qualifiedClassName : including package name: e.g. "AddService" @param methodName @param args @return
[ "/", "*" ]
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/engine/executor/JavaExecutorImpl.java#L31-L41
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/aesh/cmd/security/model/ElytronUtil.java
ElytronUtil.getServerfactory
private static ModelNode getServerfactory(CommandContext ctx, String point, String name) throws OperationFormatException, IOException { """ Simplistic for now, the format is something like: /subsystem=elytron/aggregate-sasl-server-factory=* """ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder(); builder.setOperationName(Util.READ_RESOURCE); for (String p : point.split("/")) { if (p.isEmpty()) { continue; } String[] ps = p.split("="); if (ps[1].equals("*")) { ps[1] = name; } builder.addNode(ps[0], ps[1]); } builder.getModelNode().get(Util.INCLUDE_RUNTIME).set(true); ModelNode response = ctx.getModelControllerClient().execute(builder.buildRequest()); if (Util.isSuccess(response)) { return response.get(Util.RESULT); } return null; }
java
private static ModelNode getServerfactory(CommandContext ctx, String point, String name) throws OperationFormatException, IOException { DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder(); builder.setOperationName(Util.READ_RESOURCE); for (String p : point.split("/")) { if (p.isEmpty()) { continue; } String[] ps = p.split("="); if (ps[1].equals("*")) { ps[1] = name; } builder.addNode(ps[0], ps[1]); } builder.getModelNode().get(Util.INCLUDE_RUNTIME).set(true); ModelNode response = ctx.getModelControllerClient().execute(builder.buildRequest()); if (Util.isSuccess(response)) { return response.get(Util.RESULT); } return null; }
[ "private", "static", "ModelNode", "getServerfactory", "(", "CommandContext", "ctx", ",", "String", "point", ",", "String", "name", ")", "throws", "OperationFormatException", ",", "IOException", "{", "DefaultOperationRequestBuilder", "builder", "=", "new", "DefaultOperationRequestBuilder", "(", ")", ";", "builder", ".", "setOperationName", "(", "Util", ".", "READ_RESOURCE", ")", ";", "for", "(", "String", "p", ":", "point", ".", "split", "(", "\"/\"", ")", ")", "{", "if", "(", "p", ".", "isEmpty", "(", ")", ")", "{", "continue", ";", "}", "String", "[", "]", "ps", "=", "p", ".", "split", "(", "\"=\"", ")", ";", "if", "(", "ps", "[", "1", "]", ".", "equals", "(", "\"*\"", ")", ")", "{", "ps", "[", "1", "]", "=", "name", ";", "}", "builder", ".", "addNode", "(", "ps", "[", "0", "]", ",", "ps", "[", "1", "]", ")", ";", "}", "builder", ".", "getModelNode", "(", ")", ".", "get", "(", "Util", ".", "INCLUDE_RUNTIME", ")", ".", "set", "(", "true", ")", ";", "ModelNode", "response", "=", "ctx", ".", "getModelControllerClient", "(", ")", ".", "execute", "(", "builder", ".", "buildRequest", "(", ")", ")", ";", "if", "(", "Util", ".", "isSuccess", "(", "response", ")", ")", "{", "return", "response", ".", "get", "(", "Util", ".", "RESULT", ")", ";", "}", "return", "null", ";", "}" ]
Simplistic for now, the format is something like: /subsystem=elytron/aggregate-sasl-server-factory=*
[ "Simplistic", "for", "now", "the", "format", "is", "something", "like", ":", "/", "subsystem", "=", "elytron", "/", "aggregate", "-", "sasl", "-", "server", "-", "factory", "=", "*" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/aesh/cmd/security/model/ElytronUtil.java#L1103-L1122
undertow-io/undertow
core/src/main/java/io/undertow/server/HttpServerExchange.java
HttpServerExchange.setRequestURI
public HttpServerExchange setRequestURI(final String requestURI, boolean containsHost) { """ Sets the request URI @param requestURI The new request URI @param containsHost If this is true the request URI contains the host part """ this.requestURI = requestURI; if (containsHost) { this.state |= FLAG_URI_CONTAINS_HOST; } else { this.state &= ~FLAG_URI_CONTAINS_HOST; } return this; }
java
public HttpServerExchange setRequestURI(final String requestURI, boolean containsHost) { this.requestURI = requestURI; if (containsHost) { this.state |= FLAG_URI_CONTAINS_HOST; } else { this.state &= ~FLAG_URI_CONTAINS_HOST; } return this; }
[ "public", "HttpServerExchange", "setRequestURI", "(", "final", "String", "requestURI", ",", "boolean", "containsHost", ")", "{", "this", ".", "requestURI", "=", "requestURI", ";", "if", "(", "containsHost", ")", "{", "this", ".", "state", "|=", "FLAG_URI_CONTAINS_HOST", ";", "}", "else", "{", "this", ".", "state", "&=", "~", "FLAG_URI_CONTAINS_HOST", ";", "}", "return", "this", ";", "}" ]
Sets the request URI @param requestURI The new request URI @param containsHost If this is true the request URI contains the host part
[ "Sets", "the", "request", "URI" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L466-L474
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java
MergePolicyValidator.checkMapMergePolicy
static void checkMapMergePolicy(MapConfig mapConfig, MergePolicyProvider mergePolicyProvider) { """ Checks the merge policy configuration of the given {@link MapConfig}. @param mapConfig the {@link MapConfig} @param mergePolicyProvider the {@link MergePolicyProvider} to resolve merge policy classes """ String mergePolicyClassName = mapConfig.getMergePolicyConfig().getPolicy(); Object mergePolicyInstance = getMergePolicyInstance(mergePolicyProvider, mergePolicyClassName); List<Class> requiredMergeTypes = checkMergePolicy(mapConfig, mergePolicyInstance); if (!mapConfig.isStatisticsEnabled() && requiredMergeTypes != null) { checkMapMergePolicyWhenStatisticsAreDisabled(mergePolicyClassName, requiredMergeTypes); } }
java
static void checkMapMergePolicy(MapConfig mapConfig, MergePolicyProvider mergePolicyProvider) { String mergePolicyClassName = mapConfig.getMergePolicyConfig().getPolicy(); Object mergePolicyInstance = getMergePolicyInstance(mergePolicyProvider, mergePolicyClassName); List<Class> requiredMergeTypes = checkMergePolicy(mapConfig, mergePolicyInstance); if (!mapConfig.isStatisticsEnabled() && requiredMergeTypes != null) { checkMapMergePolicyWhenStatisticsAreDisabled(mergePolicyClassName, requiredMergeTypes); } }
[ "static", "void", "checkMapMergePolicy", "(", "MapConfig", "mapConfig", ",", "MergePolicyProvider", "mergePolicyProvider", ")", "{", "String", "mergePolicyClassName", "=", "mapConfig", ".", "getMergePolicyConfig", "(", ")", ".", "getPolicy", "(", ")", ";", "Object", "mergePolicyInstance", "=", "getMergePolicyInstance", "(", "mergePolicyProvider", ",", "mergePolicyClassName", ")", ";", "List", "<", "Class", ">", "requiredMergeTypes", "=", "checkMergePolicy", "(", "mapConfig", ",", "mergePolicyInstance", ")", ";", "if", "(", "!", "mapConfig", ".", "isStatisticsEnabled", "(", ")", "&&", "requiredMergeTypes", "!=", "null", ")", "{", "checkMapMergePolicyWhenStatisticsAreDisabled", "(", "mergePolicyClassName", ",", "requiredMergeTypes", ")", ";", "}", "}" ]
Checks the merge policy configuration of the given {@link MapConfig}. @param mapConfig the {@link MapConfig} @param mergePolicyProvider the {@link MergePolicyProvider} to resolve merge policy classes
[ "Checks", "the", "merge", "policy", "configuration", "of", "the", "given", "{", "@link", "MapConfig", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java#L140-L147
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
L3ToSBGNPDConverter.writeSBGN
public void writeSBGN(Model model, OutputStream stream) { """ Converts the given model to SBGN, and writes in the specified output stream. @param model model to convert @param stream output stream to write """ Sbgn sbgn = createSBGN(model); try { JAXBContext context = JAXBContext.newInstance("org.sbgn.bindings"); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(sbgn, stream); } catch (JAXBException e) { throw new RuntimeException("writeSBGN: JAXB marshalling failed", e); } }
java
public void writeSBGN(Model model, OutputStream stream) { Sbgn sbgn = createSBGN(model); try { JAXBContext context = JAXBContext.newInstance("org.sbgn.bindings"); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(sbgn, stream); } catch (JAXBException e) { throw new RuntimeException("writeSBGN: JAXB marshalling failed", e); } }
[ "public", "void", "writeSBGN", "(", "Model", "model", ",", "OutputStream", "stream", ")", "{", "Sbgn", "sbgn", "=", "createSBGN", "(", "model", ")", ";", "try", "{", "JAXBContext", "context", "=", "JAXBContext", ".", "newInstance", "(", "\"org.sbgn.bindings\"", ")", ";", "Marshaller", "marshaller", "=", "context", ".", "createMarshaller", "(", ")", ";", "marshaller", ".", "setProperty", "(", "Marshaller", ".", "JAXB_FORMATTED_OUTPUT", ",", "Boolean", ".", "TRUE", ")", ";", "marshaller", ".", "marshal", "(", "sbgn", ",", "stream", ")", ";", "}", "catch", "(", "JAXBException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"writeSBGN: JAXB marshalling failed\"", ",", "e", ")", ";", "}", "}" ]
Converts the given model to SBGN, and writes in the specified output stream. @param model model to convert @param stream output stream to write
[ "Converts", "the", "given", "model", "to", "SBGN", "and", "writes", "in", "the", "specified", "output", "stream", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L243-L253
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/builder/AbstractMessageContentBuilder.java
AbstractMessageContentBuilder.buildMessageHeaders
public Map<String, Object> buildMessageHeaders(final TestContext context, final String messageType) { """ Build message headers. @param context The test context of the message @param messageType The message type of the Message @return A Map containing all headers as key value pairs """ try { final Map<String, Object> headers = context.resolveDynamicValuesInMap(messageHeaders); headers.put(MessageHeaders.MESSAGE_TYPE, messageType); for (final Map.Entry<String, Object> entry : headers.entrySet()) { final String value = entry.getValue().toString(); if (MessageHeaderType.isTyped(value)) { final MessageHeaderType type = MessageHeaderType.fromTypedValue(value); final Constructor<?> constr = type.getHeaderClass().getConstructor(String.class); entry.setValue(constr.newInstance(MessageHeaderType.removeTypeDefinition(value))); } } MessageHeaderUtils.checkHeaderTypes(headers); return headers; } catch (final RuntimeException e) { throw e; } catch (final Exception e) { throw new CitrusRuntimeException("Failed to build message content", e); } }
java
public Map<String, Object> buildMessageHeaders(final TestContext context, final String messageType) { try { final Map<String, Object> headers = context.resolveDynamicValuesInMap(messageHeaders); headers.put(MessageHeaders.MESSAGE_TYPE, messageType); for (final Map.Entry<String, Object> entry : headers.entrySet()) { final String value = entry.getValue().toString(); if (MessageHeaderType.isTyped(value)) { final MessageHeaderType type = MessageHeaderType.fromTypedValue(value); final Constructor<?> constr = type.getHeaderClass().getConstructor(String.class); entry.setValue(constr.newInstance(MessageHeaderType.removeTypeDefinition(value))); } } MessageHeaderUtils.checkHeaderTypes(headers); return headers; } catch (final RuntimeException e) { throw e; } catch (final Exception e) { throw new CitrusRuntimeException("Failed to build message content", e); } }
[ "public", "Map", "<", "String", ",", "Object", ">", "buildMessageHeaders", "(", "final", "TestContext", "context", ",", "final", "String", "messageType", ")", "{", "try", "{", "final", "Map", "<", "String", ",", "Object", ">", "headers", "=", "context", ".", "resolveDynamicValuesInMap", "(", "messageHeaders", ")", ";", "headers", ".", "put", "(", "MessageHeaders", ".", "MESSAGE_TYPE", ",", "messageType", ")", ";", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "headers", ".", "entrySet", "(", ")", ")", "{", "final", "String", "value", "=", "entry", ".", "getValue", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "MessageHeaderType", ".", "isTyped", "(", "value", ")", ")", "{", "final", "MessageHeaderType", "type", "=", "MessageHeaderType", ".", "fromTypedValue", "(", "value", ")", ";", "final", "Constructor", "<", "?", ">", "constr", "=", "type", ".", "getHeaderClass", "(", ")", ".", "getConstructor", "(", "String", ".", "class", ")", ";", "entry", ".", "setValue", "(", "constr", ".", "newInstance", "(", "MessageHeaderType", ".", "removeTypeDefinition", "(", "value", ")", ")", ")", ";", "}", "}", "MessageHeaderUtils", ".", "checkHeaderTypes", "(", "headers", ")", ";", "return", "headers", ";", "}", "catch", "(", "final", "RuntimeException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to build message content\"", ",", "e", ")", ";", "}", "}" ]
Build message headers. @param context The test context of the message @param messageType The message type of the Message @return A Map containing all headers as key value pairs
[ "Build", "message", "headers", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/builder/AbstractMessageContentBuilder.java#L126-L149
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.getSerializableObject
@SuppressWarnings("unchecked") protected <T extends IEntity> Object getSerializableObject(T object) throws FMSException { """ Method to get the serializable object for the given entity @param object the entity object @return Object the serializable object """ Class<?> objectClass = object.getClass(); String methodName = "create".concat(objectClass.getSimpleName()); ObjectFactory objectEntity = new ObjectFactory(); Class<?> objectEntityClass = objectEntity.getClass(); Method method = null; try { method = objectEntityClass.getMethod(methodName, Class.forName(objectClass.getName())); } catch (Exception e) { LOG.error("Exception while prepare the method signature using reflection to generate JAXBElement", e); throw new FMSException("Exception while prepare the method signature using reflection to generate JAXBElement", e); } JAXBElement<? extends IEntity> jaxbElement = null; try { jaxbElement = (JAXBElement<? extends IEntity>) method.invoke(objectEntity, object); } catch (Exception e) { LOG.error("Exception while invoking the method using reflection to generate JAXBElement", e); throw new FMSException("Exception while prepare the method signature using reflection to generate JAXBElement", e); } return jaxbElement; }
java
@SuppressWarnings("unchecked") protected <T extends IEntity> Object getSerializableObject(T object) throws FMSException { Class<?> objectClass = object.getClass(); String methodName = "create".concat(objectClass.getSimpleName()); ObjectFactory objectEntity = new ObjectFactory(); Class<?> objectEntityClass = objectEntity.getClass(); Method method = null; try { method = objectEntityClass.getMethod(methodName, Class.forName(objectClass.getName())); } catch (Exception e) { LOG.error("Exception while prepare the method signature using reflection to generate JAXBElement", e); throw new FMSException("Exception while prepare the method signature using reflection to generate JAXBElement", e); } JAXBElement<? extends IEntity> jaxbElement = null; try { jaxbElement = (JAXBElement<? extends IEntity>) method.invoke(objectEntity, object); } catch (Exception e) { LOG.error("Exception while invoking the method using reflection to generate JAXBElement", e); throw new FMSException("Exception while prepare the method signature using reflection to generate JAXBElement", e); } return jaxbElement; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "T", "extends", "IEntity", ">", "Object", "getSerializableObject", "(", "T", "object", ")", "throws", "FMSException", "{", "Class", "<", "?", ">", "objectClass", "=", "object", ".", "getClass", "(", ")", ";", "String", "methodName", "=", "\"create\"", ".", "concat", "(", "objectClass", ".", "getSimpleName", "(", ")", ")", ";", "ObjectFactory", "objectEntity", "=", "new", "ObjectFactory", "(", ")", ";", "Class", "<", "?", ">", "objectEntityClass", "=", "objectEntity", ".", "getClass", "(", ")", ";", "Method", "method", "=", "null", ";", "try", "{", "method", "=", "objectEntityClass", ".", "getMethod", "(", "methodName", ",", "Class", ".", "forName", "(", "objectClass", ".", "getName", "(", ")", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "\"Exception while prepare the method signature using reflection to generate JAXBElement\"", ",", "e", ")", ";", "throw", "new", "FMSException", "(", "\"Exception while prepare the method signature using reflection to generate JAXBElement\"", ",", "e", ")", ";", "}", "JAXBElement", "<", "?", "extends", "IEntity", ">", "jaxbElement", "=", "null", ";", "try", "{", "jaxbElement", "=", "(", "JAXBElement", "<", "?", "extends", "IEntity", ">", ")", "method", ".", "invoke", "(", "objectEntity", ",", "object", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "\"Exception while invoking the method using reflection to generate JAXBElement\"", ",", "e", ")", ";", "throw", "new", "FMSException", "(", "\"Exception while prepare the method signature using reflection to generate JAXBElement\"", ",", "e", ")", ";", "}", "return", "jaxbElement", ";", "}" ]
Method to get the serializable object for the given entity @param object the entity object @return Object the serializable object
[ "Method", "to", "get", "the", "serializable", "object", "for", "the", "given", "entity" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L1540-L1564
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java
PatternsImpl.getPatterns
public List<PatternRuleInfo> getPatterns(UUID appId, String versionId, GetPatternsOptionalParameter getPatternsOptionalParameter) { """ Returns an application version's patterns. @param appId The application ID. @param versionId The version ID. @param getPatternsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;PatternRuleInfo&gt; object if successful. """ return getPatternsWithServiceResponseAsync(appId, versionId, getPatternsOptionalParameter).toBlocking().single().body(); }
java
public List<PatternRuleInfo> getPatterns(UUID appId, String versionId, GetPatternsOptionalParameter getPatternsOptionalParameter) { return getPatternsWithServiceResponseAsync(appId, versionId, getPatternsOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "PatternRuleInfo", ">", "getPatterns", "(", "UUID", "appId", ",", "String", "versionId", ",", "GetPatternsOptionalParameter", "getPatternsOptionalParameter", ")", "{", "return", "getPatternsWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "getPatternsOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Returns an application version's patterns. @param appId The application ID. @param versionId The version ID. @param getPatternsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;PatternRuleInfo&gt; object if successful.
[ "Returns", "an", "application", "version", "s", "patterns", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L207-L209
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java
SharedBufferAccessor.put
public NodeId put( final String stateName, final EventId eventId, @Nullable final NodeId previousNodeId, final DeweyNumber version) { """ Stores given value (value + timestamp) under the given state. It assigns a preceding element relation to the previous entry. @param stateName name of the state that the event should be assigned to @param eventId unique id of event assigned by this SharedBuffer @param previousNodeId id of previous entry (might be null if start of new run) @param version Version of the previous relation @return assigned id of this element """ if (previousNodeId != null) { lockNode(previousNodeId); } NodeId currentNodeId = new NodeId(eventId, getOriginalNameFromInternal(stateName)); Lockable<SharedBufferNode> currentNode = sharedBuffer.getEntry(currentNodeId); if (currentNode == null) { currentNode = new Lockable<>(new SharedBufferNode(), 0); lockEvent(eventId); } currentNode.getElement().addEdge(new SharedBufferEdge( previousNodeId, version)); sharedBuffer.upsertEntry(currentNodeId, currentNode); return currentNodeId; }
java
public NodeId put( final String stateName, final EventId eventId, @Nullable final NodeId previousNodeId, final DeweyNumber version) { if (previousNodeId != null) { lockNode(previousNodeId); } NodeId currentNodeId = new NodeId(eventId, getOriginalNameFromInternal(stateName)); Lockable<SharedBufferNode> currentNode = sharedBuffer.getEntry(currentNodeId); if (currentNode == null) { currentNode = new Lockable<>(new SharedBufferNode(), 0); lockEvent(eventId); } currentNode.getElement().addEdge(new SharedBufferEdge( previousNodeId, version)); sharedBuffer.upsertEntry(currentNodeId, currentNode); return currentNodeId; }
[ "public", "NodeId", "put", "(", "final", "String", "stateName", ",", "final", "EventId", "eventId", ",", "@", "Nullable", "final", "NodeId", "previousNodeId", ",", "final", "DeweyNumber", "version", ")", "{", "if", "(", "previousNodeId", "!=", "null", ")", "{", "lockNode", "(", "previousNodeId", ")", ";", "}", "NodeId", "currentNodeId", "=", "new", "NodeId", "(", "eventId", ",", "getOriginalNameFromInternal", "(", "stateName", ")", ")", ";", "Lockable", "<", "SharedBufferNode", ">", "currentNode", "=", "sharedBuffer", ".", "getEntry", "(", "currentNodeId", ")", ";", "if", "(", "currentNode", "==", "null", ")", "{", "currentNode", "=", "new", "Lockable", "<>", "(", "new", "SharedBufferNode", "(", ")", ",", "0", ")", ";", "lockEvent", "(", "eventId", ")", ";", "}", "currentNode", ".", "getElement", "(", ")", ".", "addEdge", "(", "new", "SharedBufferEdge", "(", "previousNodeId", ",", "version", ")", ")", ";", "sharedBuffer", ".", "upsertEntry", "(", "currentNodeId", ",", "currentNode", ")", ";", "return", "currentNodeId", ";", "}" ]
Stores given value (value + timestamp) under the given state. It assigns a preceding element relation to the previous entry. @param stateName name of the state that the event should be assigned to @param eventId unique id of event assigned by this SharedBuffer @param previousNodeId id of previous entry (might be null if start of new run) @param version Version of the previous relation @return assigned id of this element
[ "Stores", "given", "value", "(", "value", "+", "timestamp", ")", "under", "the", "given", "state", ".", "It", "assigns", "a", "preceding", "element", "relation", "to", "the", "previous", "entry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java#L87-L110
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java
SSLAlpnNegotiator.registerJettyAlpn
protected JettyServerNegotiator registerJettyAlpn(final SSLEngine engine, SSLConnectionLink link) { """ Using jetty-alpn, set up a new JettyServerNotiator to handle ALPN for a given SSLEngine and link @param SSLEngine @param SSLConnectionLink @return JettyServerNegotiator or null if ALPN was not set up """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn entry " + engine); } try { JettyServerNegotiator negotiator = new JettyServerNegotiator(engine, link); // invoke ALPN.put(engine, provider(this)) Method m = jettyAlpn.getMethod("put", SSLEngine.class, jettyProviderInterface); m.invoke(null, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( jettyServerProviderInterface.getClassLoader(), new java.lang.Class[] { jettyServerProviderInterface }, negotiator) }); return negotiator; } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn jetty-alpn exception: " + e); } } return null; }
java
protected JettyServerNegotiator registerJettyAlpn(final SSLEngine engine, SSLConnectionLink link) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn entry " + engine); } try { JettyServerNegotiator negotiator = new JettyServerNegotiator(engine, link); // invoke ALPN.put(engine, provider(this)) Method m = jettyAlpn.getMethod("put", SSLEngine.class, jettyProviderInterface); m.invoke(null, new Object[] { engine, java.lang.reflect.Proxy.newProxyInstance( jettyServerProviderInterface.getClassLoader(), new java.lang.Class[] { jettyServerProviderInterface }, negotiator) }); return negotiator; } catch (InvocationTargetException ie) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn exception: " + ie.getTargetException()); } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "registerJettyAlpn jetty-alpn exception: " + e); } } return null; }
[ "protected", "JettyServerNegotiator", "registerJettyAlpn", "(", "final", "SSLEngine", "engine", ",", "SSLConnectionLink", "link", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerJettyAlpn entry \"", "+", "engine", ")", ";", "}", "try", "{", "JettyServerNegotiator", "negotiator", "=", "new", "JettyServerNegotiator", "(", "engine", ",", "link", ")", ";", "// invoke ALPN.put(engine, provider(this))", "Method", "m", "=", "jettyAlpn", ".", "getMethod", "(", "\"put\"", ",", "SSLEngine", ".", "class", ",", "jettyProviderInterface", ")", ";", "m", ".", "invoke", "(", "null", ",", "new", "Object", "[", "]", "{", "engine", ",", "java", ".", "lang", ".", "reflect", ".", "Proxy", ".", "newProxyInstance", "(", "jettyServerProviderInterface", ".", "getClassLoader", "(", ")", ",", "new", "java", ".", "lang", ".", "Class", "[", "]", "{", "jettyServerProviderInterface", "}", ",", "negotiator", ")", "}", ")", ";", "return", "negotiator", ";", "}", "catch", "(", "InvocationTargetException", "ie", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerJettyAlpn exception: \"", "+", "ie", ".", "getTargetException", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"registerJettyAlpn jetty-alpn exception: \"", "+", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
Using jetty-alpn, set up a new JettyServerNotiator to handle ALPN for a given SSLEngine and link @param SSLEngine @param SSLConnectionLink @return JettyServerNegotiator or null if ALPN was not set up
[ "Using", "jetty", "-", "alpn", "set", "up", "a", "new", "JettyServerNotiator", "to", "handle", "ALPN", "for", "a", "given", "SSLEngine", "and", "link" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLAlpnNegotiator.java#L445-L469
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java
CommerceNotificationAttachmentPersistenceImpl.findByUUID_G
@Override public CommerceNotificationAttachment findByUUID_G(String uuid, long groupId) throws NoSuchNotificationAttachmentException { """ Returns the commerce notification attachment where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchNotificationAttachmentException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce notification attachment @throws NoSuchNotificationAttachmentException if a matching commerce notification attachment could not be found """ CommerceNotificationAttachment commerceNotificationAttachment = fetchByUUID_G(uuid, groupId); if (commerceNotificationAttachment == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchNotificationAttachmentException(msg.toString()); } return commerceNotificationAttachment; }
java
@Override public CommerceNotificationAttachment findByUUID_G(String uuid, long groupId) throws NoSuchNotificationAttachmentException { CommerceNotificationAttachment commerceNotificationAttachment = fetchByUUID_G(uuid, groupId); if (commerceNotificationAttachment == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchNotificationAttachmentException(msg.toString()); } return commerceNotificationAttachment; }
[ "@", "Override", "public", "CommerceNotificationAttachment", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchNotificationAttachmentException", "{", "CommerceNotificationAttachment", "commerceNotificationAttachment", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "commerceNotificationAttachment", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"uuid=\"", ")", ";", "msg", ".", "append", "(", "uuid", ")", ";", "msg", ".", "append", "(", "\", groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchNotificationAttachmentException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "commerceNotificationAttachment", ";", "}" ]
Returns the commerce notification attachment where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchNotificationAttachmentException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce notification attachment @throws NoSuchNotificationAttachmentException if a matching commerce notification attachment could not be found
[ "Returns", "the", "commerce", "notification", "attachment", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchNotificationAttachmentException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L680-L707
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java
JobGraphMouseListener.onTableRightClicked
public void onTableRightClicked(final Table table, final MouseEvent me) { """ Invoked when a {@link Table} is right-clicked @param table @param me """ final JPopupMenu popup = new JPopupMenu(); popup.add(createLinkMenuItem(table)); final JMenuItem previewMenuItem = new JMenuItem("Preview data", ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL)); final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(table); final Datastore datastore = analysisJobBuilder.getDatastore(); final List<MetaModelInputColumn> inputColumns = analysisJobBuilder.getSourceColumnsOfTable(table); previewMenuItem.addActionListener(new PreviewSourceDataActionListener(_windowContext, datastore, inputColumns)); popup.add(previewMenuItem); popup.addSeparator(); popup.add(new RemoveSourceTableMenuItem(analysisJobBuilder, table)); popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
java
public void onTableRightClicked(final Table table, final MouseEvent me) { final JPopupMenu popup = new JPopupMenu(); popup.add(createLinkMenuItem(table)); final JMenuItem previewMenuItem = new JMenuItem("Preview data", ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL)); final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(table); final Datastore datastore = analysisJobBuilder.getDatastore(); final List<MetaModelInputColumn> inputColumns = analysisJobBuilder.getSourceColumnsOfTable(table); previewMenuItem.addActionListener(new PreviewSourceDataActionListener(_windowContext, datastore, inputColumns)); popup.add(previewMenuItem); popup.addSeparator(); popup.add(new RemoveSourceTableMenuItem(analysisJobBuilder, table)); popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
[ "public", "void", "onTableRightClicked", "(", "final", "Table", "table", ",", "final", "MouseEvent", "me", ")", "{", "final", "JPopupMenu", "popup", "=", "new", "JPopupMenu", "(", ")", ";", "popup", ".", "add", "(", "createLinkMenuItem", "(", "table", ")", ")", ";", "final", "JMenuItem", "previewMenuItem", "=", "new", "JMenuItem", "(", "\"Preview data\"", ",", "ImageManager", ".", "get", "(", ")", ".", "getImageIcon", "(", "IconUtils", ".", "ACTION_PREVIEW", ",", "IconUtils", ".", "ICON_SIZE_SMALL", ")", ")", ";", "final", "AnalysisJobBuilder", "analysisJobBuilder", "=", "_graphContext", ".", "getAnalysisJobBuilder", "(", "table", ")", ";", "final", "Datastore", "datastore", "=", "analysisJobBuilder", ".", "getDatastore", "(", ")", ";", "final", "List", "<", "MetaModelInputColumn", ">", "inputColumns", "=", "analysisJobBuilder", ".", "getSourceColumnsOfTable", "(", "table", ")", ";", "previewMenuItem", ".", "addActionListener", "(", "new", "PreviewSourceDataActionListener", "(", "_windowContext", ",", "datastore", ",", "inputColumns", ")", ")", ";", "popup", ".", "add", "(", "previewMenuItem", ")", ";", "popup", ".", "addSeparator", "(", ")", ";", "popup", ".", "add", "(", "new", "RemoveSourceTableMenuItem", "(", "analysisJobBuilder", ",", "table", ")", ")", ";", "popup", ".", "show", "(", "_graphContext", ".", "getVisualizationViewer", "(", ")", ",", "me", ".", "getX", "(", ")", ",", "me", ".", "getY", "(", ")", ")", ";", "}" ]
Invoked when a {@link Table} is right-clicked @param table @param me
[ "Invoked", "when", "a", "{", "@link", "Table", "}", "is", "right", "-", "clicked" ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java#L121-L136
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerProbesInner.java
LoadBalancerProbesInner.listAsync
public Observable<Page<ProbeInner>> listAsync(final String resourceGroupName, final String loadBalancerName) { """ Gets all the load balancer probes. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ProbeInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, loadBalancerName) .map(new Func1<ServiceResponse<Page<ProbeInner>>, Page<ProbeInner>>() { @Override public Page<ProbeInner> call(ServiceResponse<Page<ProbeInner>> response) { return response.body(); } }); }
java
public Observable<Page<ProbeInner>> listAsync(final String resourceGroupName, final String loadBalancerName) { return listWithServiceResponseAsync(resourceGroupName, loadBalancerName) .map(new Func1<ServiceResponse<Page<ProbeInner>>, Page<ProbeInner>>() { @Override public Page<ProbeInner> call(ServiceResponse<Page<ProbeInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ProbeInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "loadBalancerName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBalancerName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ProbeInner", ">", ">", ",", "Page", "<", "ProbeInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ProbeInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ProbeInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets all the load balancer probes. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ProbeInner&gt; object
[ "Gets", "all", "the", "load", "balancer", "probes", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerProbesInner.java#L123-L131
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheObjectUtil.java
CacheObjectUtil.luaScript
public static Object luaScript(String scripts, int keyCount, List<String> params) { """ execute the lua script @param scripts the script to be executed. @param keyCount the key count @param params the parameters @return the result object """ return luaScript(CacheService.CACHE_CONFIG_BEAN, scripts, keyCount, params); }
java
public static Object luaScript(String scripts, int keyCount, List<String> params) { return luaScript(CacheService.CACHE_CONFIG_BEAN, scripts, keyCount, params); }
[ "public", "static", "Object", "luaScript", "(", "String", "scripts", ",", "int", "keyCount", ",", "List", "<", "String", ">", "params", ")", "{", "return", "luaScript", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "scripts", ",", "keyCount", ",", "params", ")", ";", "}" ]
execute the lua script @param scripts the script to be executed. @param keyCount the key count @param params the parameters @return the result object
[ "execute", "the", "lua", "script" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheObjectUtil.java#L35-L37
jayantk/jklol
src/com/jayantkrish/jklol/inference/GibbsSampler.java
GibbsSampler.doSample
private Assignment doSample(FactorGraph factorGraph, Assignment curAssignment, int varNum) { """ /* Resample the specified variable conditioned on all of the other variables. """ // Retain the assignments to all other variables. Assignment otherVarAssignment = curAssignment.removeAll(varNum); // Multiply together all of the factors which define a probability distribution over // variable varNum, conditioned on all other variables. Set<Integer> factorNums = factorGraph.getFactorsWithVariable(varNum); Preconditions.checkState(factorNums.size() > 0, "Variable not in factor: " + varNum + " " + factorNums); List<Factor> factorsToCombine = new ArrayList<Factor>(); for (Integer factorNum : factorNums) { Factor conditional = factorGraph.getFactor(factorNum) .conditional(otherVarAssignment); factorsToCombine.add(conditional.marginalize(otherVarAssignment.getVariableNums())); } Factor toSampleFrom = factorsToCombine.get(0).product(factorsToCombine.subList(1, factorsToCombine.size())); // Draw the sample and update the sampler's current assignment. Assignment subsetValues = toSampleFrom.sample(); return otherVarAssignment.union(subsetValues); }
java
private Assignment doSample(FactorGraph factorGraph, Assignment curAssignment, int varNum) { // Retain the assignments to all other variables. Assignment otherVarAssignment = curAssignment.removeAll(varNum); // Multiply together all of the factors which define a probability distribution over // variable varNum, conditioned on all other variables. Set<Integer> factorNums = factorGraph.getFactorsWithVariable(varNum); Preconditions.checkState(factorNums.size() > 0, "Variable not in factor: " + varNum + " " + factorNums); List<Factor> factorsToCombine = new ArrayList<Factor>(); for (Integer factorNum : factorNums) { Factor conditional = factorGraph.getFactor(factorNum) .conditional(otherVarAssignment); factorsToCombine.add(conditional.marginalize(otherVarAssignment.getVariableNums())); } Factor toSampleFrom = factorsToCombine.get(0).product(factorsToCombine.subList(1, factorsToCombine.size())); // Draw the sample and update the sampler's current assignment. Assignment subsetValues = toSampleFrom.sample(); return otherVarAssignment.union(subsetValues); }
[ "private", "Assignment", "doSample", "(", "FactorGraph", "factorGraph", ",", "Assignment", "curAssignment", ",", "int", "varNum", ")", "{", "// Retain the assignments to all other variables.", "Assignment", "otherVarAssignment", "=", "curAssignment", ".", "removeAll", "(", "varNum", ")", ";", "// Multiply together all of the factors which define a probability distribution over ", "// variable varNum, conditioned on all other variables.", "Set", "<", "Integer", ">", "factorNums", "=", "factorGraph", ".", "getFactorsWithVariable", "(", "varNum", ")", ";", "Preconditions", ".", "checkState", "(", "factorNums", ".", "size", "(", ")", ">", "0", ",", "\"Variable not in factor: \"", "+", "varNum", "+", "\" \"", "+", "factorNums", ")", ";", "List", "<", "Factor", ">", "factorsToCombine", "=", "new", "ArrayList", "<", "Factor", ">", "(", ")", ";", "for", "(", "Integer", "factorNum", ":", "factorNums", ")", "{", "Factor", "conditional", "=", "factorGraph", ".", "getFactor", "(", "factorNum", ")", ".", "conditional", "(", "otherVarAssignment", ")", ";", "factorsToCombine", ".", "add", "(", "conditional", ".", "marginalize", "(", "otherVarAssignment", ".", "getVariableNums", "(", ")", ")", ")", ";", "}", "Factor", "toSampleFrom", "=", "factorsToCombine", ".", "get", "(", "0", ")", ".", "product", "(", "factorsToCombine", ".", "subList", "(", "1", ",", "factorsToCombine", ".", "size", "(", ")", ")", ")", ";", "// Draw the sample and update the sampler's current assignment. ", "Assignment", "subsetValues", "=", "toSampleFrom", ".", "sample", "(", ")", ";", "return", "otherVarAssignment", ".", "union", "(", "subsetValues", ")", ";", "}" ]
/* Resample the specified variable conditioned on all of the other variables.
[ "/", "*", "Resample", "the", "specified", "variable", "conditioned", "on", "all", "of", "the", "other", "variables", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/inference/GibbsSampler.java#L92-L112
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addConstraintsParametersScriptAssertMessage
public FessMessages addConstraintsParametersScriptAssertMessage(String property, String script) { """ Add the created action message for the key 'constraints.ParametersScriptAssert.message' with parameters. <pre> message: script expression "{script}" didn't evaluate to true. </pre> @param property The property name for the message. (NotNull) @param script The parameter script for message. (NotNull) @return this. (NotNull) """ assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_ParametersScriptAssert_MESSAGE, script)); return this; }
java
public FessMessages addConstraintsParametersScriptAssertMessage(String property, String script) { assertPropertyNotNull(property); add(property, new UserMessage(CONSTRAINTS_ParametersScriptAssert_MESSAGE, script)); return this; }
[ "public", "FessMessages", "addConstraintsParametersScriptAssertMessage", "(", "String", "property", ",", "String", "script", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "CONSTRAINTS_ParametersScriptAssert_MESSAGE", ",", "script", ")", ")", ";", "return", "this", ";", "}" ]
Add the created action message for the key 'constraints.ParametersScriptAssert.message' with parameters. <pre> message: script expression "{script}" didn't evaluate to true. </pre> @param property The property name for the message. (NotNull) @param script The parameter script for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "constraints", ".", "ParametersScriptAssert", ".", "message", "with", "parameters", ".", "<pre", ">", "message", ":", "script", "expression", "{", "script", "}", "didn", "t", "evaluate", "to", "true", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L948-L952
phax/ph-css
ph-css/src/main/java/com/helger/css/reader/CSSReaderDeclarationList.java
CSSReaderDeclarationList.isValidCSS
public static boolean isValidCSS (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { """ Check if the passed String can be resembled to valid CSS content. This is accomplished by fully parsing the CSS file each time the method is called. This is similar to calling {@link #readFromString(String, ECSSVersion)} and checking for a non-<code>null</code> result. @param sCSS The CSS string to scan. May not be <code>null</code>. @param eVersion The CSS version to use. May not be <code>null</code>. @return <code>true</code> if the CSS is valid according to the version, <code>false</code> if not """ ValueEnforcer.notNull (sCSS, "CSS"); return isValidCSS (new NonBlockingStringReader (sCSS), eVersion); }
java
public static boolean isValidCSS (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { ValueEnforcer.notNull (sCSS, "CSS"); return isValidCSS (new NonBlockingStringReader (sCSS), eVersion); }
[ "public", "static", "boolean", "isValidCSS", "(", "@", "Nonnull", "final", "String", "sCSS", ",", "@", "Nonnull", "final", "ECSSVersion", "eVersion", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sCSS", ",", "\"CSS\"", ")", ";", "return", "isValidCSS", "(", "new", "NonBlockingStringReader", "(", "sCSS", ")", ",", "eVersion", ")", ";", "}" ]
Check if the passed String can be resembled to valid CSS content. This is accomplished by fully parsing the CSS file each time the method is called. This is similar to calling {@link #readFromString(String, ECSSVersion)} and checking for a non-<code>null</code> result. @param sCSS The CSS string to scan. May not be <code>null</code>. @param eVersion The CSS version to use. May not be <code>null</code>. @return <code>true</code> if the CSS is valid according to the version, <code>false</code> if not
[ "Check", "if", "the", "passed", "String", "can", "be", "resembled", "to", "valid", "CSS", "content", ".", "This", "is", "accomplished", "by", "fully", "parsing", "the", "CSS", "file", "each", "time", "the", "method", "is", "called", ".", "This", "is", "similar", "to", "calling", "{", "@link", "#readFromString", "(", "String", "ECSSVersion", ")", "}", "and", "checking", "for", "a", "non", "-", "<code", ">", "null<", "/", "code", ">", "result", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReaderDeclarationList.java#L311-L316
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/DefaultLocalJSONDataProvider.java
DefaultLocalJSONDataProvider.validateFacetFields
private void validateFacetFields(String[] facetFieldList) { """ Check each facet field is present in schema. @param facetFieldList an array of facet fields """ if(facetFieldList == null || facetFieldList.length == 0){ return; } for (String facetfield : facetFieldList){ if(schema.getColumnIndex(facetfield) < 0){ throw new IllegalArgumentException("Facet field:"+facetfield+", not found in schema"); } } }
java
private void validateFacetFields(String[] facetFieldList) { if(facetFieldList == null || facetFieldList.length == 0){ return; } for (String facetfield : facetFieldList){ if(schema.getColumnIndex(facetfield) < 0){ throw new IllegalArgumentException("Facet field:"+facetfield+", not found in schema"); } } }
[ "private", "void", "validateFacetFields", "(", "String", "[", "]", "facetFieldList", ")", "{", "if", "(", "facetFieldList", "==", "null", "||", "facetFieldList", ".", "length", "==", "0", ")", "{", "return", ";", "}", "for", "(", "String", "facetfield", ":", "facetFieldList", ")", "{", "if", "(", "schema", ".", "getColumnIndex", "(", "facetfield", ")", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Facet field:\"", "+", "facetfield", "+", "\", not found in schema\"", ")", ";", "}", "}", "}" ]
Check each facet field is present in schema. @param facetFieldList an array of facet fields
[ "Check", "each", "facet", "field", "is", "present", "in", "schema", "." ]
train
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/DefaultLocalJSONDataProvider.java#L136-L146
tweea/matrixjavalib-main-common
src/main/java/net/matrix/util/Collections3.java
Collections3.extractToMap
public static Map extractToMap(final Collection collection, final String keyPropertyName, final String valuePropertyName) { """ 提取集合中的对象的两个属性(通过 Getter 方法),组合成 Map。 @param collection 来源集合 @param keyPropertyName 要提取为 Map 中的 Key 值的属性名 @param valuePropertyName 要提取为 Map 中的 Value 值的属性名 @return 属性集合 """ Map map = new HashMap(collection.size()); try { for (Object obj : collection) { map.put(PropertyUtils.getProperty(obj, keyPropertyName), PropertyUtils.getProperty(obj, valuePropertyName)); } } catch (ReflectiveOperationException e) { throw new ReflectionRuntimeException(e); } return map; }
java
public static Map extractToMap(final Collection collection, final String keyPropertyName, final String valuePropertyName) { Map map = new HashMap(collection.size()); try { for (Object obj : collection) { map.put(PropertyUtils.getProperty(obj, keyPropertyName), PropertyUtils.getProperty(obj, valuePropertyName)); } } catch (ReflectiveOperationException e) { throw new ReflectionRuntimeException(e); } return map; }
[ "public", "static", "Map", "extractToMap", "(", "final", "Collection", "collection", ",", "final", "String", "keyPropertyName", ",", "final", "String", "valuePropertyName", ")", "{", "Map", "map", "=", "new", "HashMap", "(", "collection", ".", "size", "(", ")", ")", ";", "try", "{", "for", "(", "Object", "obj", ":", "collection", ")", "{", "map", ".", "put", "(", "PropertyUtils", ".", "getProperty", "(", "obj", ",", "keyPropertyName", ")", ",", "PropertyUtils", ".", "getProperty", "(", "obj", ",", "valuePropertyName", ")", ")", ";", "}", "}", "catch", "(", "ReflectiveOperationException", "e", ")", "{", "throw", "new", "ReflectionRuntimeException", "(", "e", ")", ";", "}", "return", "map", ";", "}" ]
提取集合中的对象的两个属性(通过 Getter 方法),组合成 Map。 @param collection 来源集合 @param keyPropertyName 要提取为 Map 中的 Key 值的属性名 @param valuePropertyName 要提取为 Map 中的 Value 值的属性名 @return 属性集合
[ "提取集合中的对象的两个属性(通过", "Getter", "方法),组合成", "Map。" ]
train
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/util/Collections3.java#L40-L52
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.orNotExists
public final Filter<S> orNotExists(String propertyName, Filter<?> subFilter) { """ Returns a combined filter instance that accepts records which are accepted either by this filter or the "not exists" test applied to a join. @param propertyName one-to-many join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any not existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2 """ ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return or(ExistsFilter.build(prop, subFilter, true)); }
java
public final Filter<S> orNotExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return or(ExistsFilter.build(prop, subFilter, true)); }
[ "public", "final", "Filter", "<", "S", ">", "orNotExists", "(", "String", "propertyName", ",", "Filter", "<", "?", ">", "subFilter", ")", "{", "ChainedProperty", "<", "S", ">", "prop", "=", "new", "FilterParser", "<", "S", ">", "(", "mType", ",", "propertyName", ")", ".", "parseChainedProperty", "(", ")", ";", "return", "or", "(", "ExistsFilter", ".", "build", "(", "prop", ",", "subFilter", ",", "true", ")", ")", ";", "}" ]
Returns a combined filter instance that accepts records which are accepted either by this filter or the "not exists" test applied to a join. @param propertyName one-to-many join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any not existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2
[ "Returns", "a", "combined", "filter", "instance", "that", "accepts", "records", "which", "are", "accepted", "either", "by", "this", "filter", "or", "the", "not", "exists", "test", "applied", "to", "a", "join", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L411-L414
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbCredits.java
TmdbCredits.getCreditInfo
public CreditInfo getCreditInfo(String creditId, String language) throws MovieDbException { """ Get the detailed information about a particular credit record. <p> This is currently only supported with the new credit model found in TV. <br/> These IDs can be found from any TV credit response as well as the TV_credits and combined_credits methods for people. <br/> The episodes object returns a list of episodes and are generally going to be guest stars. <br/> The season array will return a list of season numbers. <br/> Season credits are credits that were marked with the "add to every season" option in the editing interface and are assumed to be "season regulars". @param creditId @param language @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, creditId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.CREDIT).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, CreditInfo.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex); } }
java
public CreditInfo getCreditInfo(String creditId, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, creditId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.CREDIT).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, CreditInfo.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex); } }
[ "public", "CreditInfo", "getCreditInfo", "(", "String", "creditId", ",", "String", "language", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "creditId", ")", ";", "parameters", ".", "add", "(", "Param", ".", "LANGUAGE", ",", "language", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "CREDIT", ")", ".", "buildUrl", "(", "parameters", ")", ";", "String", "webpage", "=", "httpTools", ".", "getRequest", "(", "url", ")", ";", "try", "{", "return", "MAPPER", ".", "readValue", "(", "webpage", ",", "CreditInfo", ".", "class", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "MovieDbException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to get credit info\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
Get the detailed information about a particular credit record. <p> This is currently only supported with the new credit model found in TV. <br/> These IDs can be found from any TV credit response as well as the TV_credits and combined_credits methods for people. <br/> The episodes object returns a list of episodes and are generally going to be guest stars. <br/> The season array will return a list of season numbers. <br/> Season credits are credits that were marked with the "add to every season" option in the editing interface and are assumed to be "season regulars". @param creditId @param language @return @throws MovieDbException
[ "Get", "the", "detailed", "information", "about", "a", "particular", "credit", "record", ".", "<p", ">", "This", "is", "currently", "only", "supported", "with", "the", "new", "credit", "model", "found", "in", "TV", ".", "<br", "/", ">", "These", "IDs", "can", "be", "found", "from", "any", "TV", "credit", "response", "as", "well", "as", "the", "TV_credits", "and", "combined_credits", "methods", "for", "people", ".", "<br", "/", ">", "The", "episodes", "object", "returns", "a", "list", "of", "episodes", "and", "are", "generally", "going", "to", "be", "guest", "stars", ".", "<br", "/", ">", "The", "season", "array", "will", "return", "a", "list", "of", "season", "numbers", ".", "<br", "/", ">", "Season", "credits", "are", "credits", "that", "were", "marked", "with", "the", "add", "to", "every", "season", "option", "in", "the", "editing", "interface", "and", "are", "assumed", "to", "be", "season", "regulars", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbCredits.java#L69-L82
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java
PermissionAwareCrudService.findAllUserPermissionsOfUser
@PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, 'READ')") @Transactional(readOnly = true) public Map<PersistentObject, PermissionCollection> findAllUserPermissionsOfUser(User user) { """ This method returns a {@link Map} that maps {@link PersistentObject}s to PermissionCollections for the passed {@link User}. I.e. the keySet of the map is the collection of all {@link PersistentObject}s where the user has at least one permission and the corresponding value contains the {@link PermissionCollection} for the passed user on the entity. @param user @return """ return dao.findAllUserPermissionsOfUser(user); }
java
@PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, 'READ')") @Transactional(readOnly = true) public Map<PersistentObject, PermissionCollection> findAllUserPermissionsOfUser(User user) { return dao.findAllUserPermissionsOfUser(user); }
[ "@", "PreAuthorize", "(", "\"hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, 'READ')\"", ")", "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "Map", "<", "PersistentObject", ",", "PermissionCollection", ">", "findAllUserPermissionsOfUser", "(", "User", "user", ")", "{", "return", "dao", ".", "findAllUserPermissionsOfUser", "(", "user", ")", ";", "}" ]
This method returns a {@link Map} that maps {@link PersistentObject}s to PermissionCollections for the passed {@link User}. I.e. the keySet of the map is the collection of all {@link PersistentObject}s where the user has at least one permission and the corresponding value contains the {@link PermissionCollection} for the passed user on the entity. @param user @return
[ "This", "method", "returns", "a", "{", "@link", "Map", "}", "that", "maps", "{", "@link", "PersistentObject", "}", "s", "to", "PermissionCollections", "for", "the", "passed", "{", "@link", "User", "}", ".", "I", ".", "e", ".", "the", "keySet", "of", "the", "map", "is", "the", "collection", "of", "all", "{", "@link", "PersistentObject", "}", "s", "where", "the", "user", "has", "at", "least", "one", "permission", "and", "the", "corresponding", "value", "contains", "the", "{", "@link", "PermissionCollection", "}", "for", "the", "passed", "user", "on", "the", "entity", "." ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java#L345-L349
RuedigerMoeller/kontraktor
src/main/java/org/nustaq/kontraktor/remoting/base/RemoteRefPolling.java
RemoteRefPolling.run
public void run() { """ counts active remote refs, if none backoff remoteref polling massively eats cpu """ pollThread = Thread.currentThread(); if ( underway ) return; underway = true; try { int count = 1; while( count > 0 ) { // as long there are messages, keep sending them count = onePoll(); if ( sendJobs.size() > 0 ) { if ( count > 0 ) { int debug =1; } else { if ( remoteRefCounter == 0 ) // no remote actors registered { Actor.current().delayed(100, this); // backoff massively } else { Actor.current().delayed(1, this); // backoff a bit (remoteactors present, no messages) } } } else { // no schedule entries (== no clients) Actor.current().delayed(100, this ); } } } finally { underway = false; } }
java
public void run() { pollThread = Thread.currentThread(); if ( underway ) return; underway = true; try { int count = 1; while( count > 0 ) { // as long there are messages, keep sending them count = onePoll(); if ( sendJobs.size() > 0 ) { if ( count > 0 ) { int debug =1; } else { if ( remoteRefCounter == 0 ) // no remote actors registered { Actor.current().delayed(100, this); // backoff massively } else { Actor.current().delayed(1, this); // backoff a bit (remoteactors present, no messages) } } } else { // no schedule entries (== no clients) Actor.current().delayed(100, this ); } } } finally { underway = false; } }
[ "public", "void", "run", "(", ")", "{", "pollThread", "=", "Thread", ".", "currentThread", "(", ")", ";", "if", "(", "underway", ")", "return", ";", "underway", "=", "true", ";", "try", "{", "int", "count", "=", "1", ";", "while", "(", "count", ">", "0", ")", "{", "// as long there are messages, keep sending them", "count", "=", "onePoll", "(", ")", ";", "if", "(", "sendJobs", ".", "size", "(", ")", ">", "0", ")", "{", "if", "(", "count", ">", "0", ")", "{", "int", "debug", "=", "1", ";", "}", "else", "{", "if", "(", "remoteRefCounter", "==", "0", ")", "// no remote actors registered", "{", "Actor", ".", "current", "(", ")", ".", "delayed", "(", "100", ",", "this", ")", ";", "// backoff massively", "}", "else", "{", "Actor", ".", "current", "(", ")", ".", "delayed", "(", "1", ",", "this", ")", ";", "// backoff a bit (remoteactors present, no messages)", "}", "}", "}", "else", "{", "// no schedule entries (== no clients)", "Actor", ".", "current", "(", ")", ".", "delayed", "(", "100", ",", "this", ")", ";", "}", "}", "}", "finally", "{", "underway", "=", "false", ";", "}", "}" ]
counts active remote refs, if none backoff remoteref polling massively eats cpu
[ "counts", "active", "remote", "refs", "if", "none", "backoff", "remoteref", "polling", "massively", "eats", "cpu" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/src/main/java/org/nustaq/kontraktor/remoting/base/RemoteRefPolling.java#L83-L112
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java
SeleniumDriverSetup.setPropertyValue
public boolean setPropertyValue(String propName, String value) { """ Sets system property (needed by the WebDriver to be set up). @param propName name of property to set. @param value value to set. @return true. """ if (OVERRIDE_ACTIVE) { return true; } System.setProperty(propName, value); return true; }
java
public boolean setPropertyValue(String propName, String value) { if (OVERRIDE_ACTIVE) { return true; } System.setProperty(propName, value); return true; }
[ "public", "boolean", "setPropertyValue", "(", "String", "propName", ",", "String", "value", ")", "{", "if", "(", "OVERRIDE_ACTIVE", ")", "{", "return", "true", ";", "}", "System", ".", "setProperty", "(", "propName", ",", "value", ")", ";", "return", "true", ";", "}" ]
Sets system property (needed by the WebDriver to be set up). @param propName name of property to set. @param value value to set. @return true.
[ "Sets", "system", "property", "(", "needed", "by", "the", "WebDriver", "to", "be", "set", "up", ")", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java#L45-L52
Azure/azure-sdk-for-java
sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java
ManagedInstanceVulnerabilityAssessmentsInner.listByInstanceAsync
public Observable<Page<ManagedInstanceVulnerabilityAssessmentInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { """ Gets the managed instance's vulnerability assessment policies. @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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagedInstanceVulnerabilityAssessmentInner&gt; object """ return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) .map(new Func1<ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>>, Page<ManagedInstanceVulnerabilityAssessmentInner>>() { @Override public Page<ManagedInstanceVulnerabilityAssessmentInner> call(ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>> response) { return response.body(); } }); }
java
public Observable<Page<ManagedInstanceVulnerabilityAssessmentInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) .map(new Func1<ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>>, Page<ManagedInstanceVulnerabilityAssessmentInner>>() { @Override public Page<ManagedInstanceVulnerabilityAssessmentInner> call(ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", ">", "listByInstanceAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "managedInstanceName", ")", "{", "return", "listByInstanceWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", ">", ",", "Page", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ManagedInstanceVulnerabilityAssessmentInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the managed instance's vulnerability assessment policies. @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 managedInstanceName The name of the managed instance for which the vulnerability assessments is defined. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagedInstanceVulnerabilityAssessmentInner&gt; object
[ "Gets", "the", "managed", "instance", "s", "vulnerability", "assessment", "policies", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java#L405-L413
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java
AlignmentTools.deleteHighestDistanceColumn
public static AFPChain deleteHighestDistanceColumn(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException { """ Find the alignment position with the highest atomic distance between the equivalent atomic positions of the arrays and remove it from the alignment. @param afpChain original alignment, will be modified @param ca1 atom array, will not be modified @param ca2 atom array, will not be modified @return the original alignment, with the alignment position at the highest distance removed @throws StructureException """ int[][][] optAln = afpChain.getOptAln(); int maxBlock = 0; int maxPos = 0; double maxDistance = Double.MIN_VALUE; for (int b = 0; b < optAln.length; b++) { for (int p = 0; p < optAln[b][0].length; p++) { Atom ca2clone = ca2[optAln[b][1][p]]; Calc.rotate(ca2clone, afpChain.getBlockRotationMatrix()[b]); Calc.shift(ca2clone, afpChain.getBlockShiftVector()[b]); double distance = Calc.getDistance(ca1[optAln[b][0][p]], ca2clone); if (distance > maxDistance) { maxBlock = b; maxPos = p; maxDistance = distance; } } } return deleteColumn(afpChain, ca1, ca2, maxBlock, maxPos); }
java
public static AFPChain deleteHighestDistanceColumn(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException { int[][][] optAln = afpChain.getOptAln(); int maxBlock = 0; int maxPos = 0; double maxDistance = Double.MIN_VALUE; for (int b = 0; b < optAln.length; b++) { for (int p = 0; p < optAln[b][0].length; p++) { Atom ca2clone = ca2[optAln[b][1][p]]; Calc.rotate(ca2clone, afpChain.getBlockRotationMatrix()[b]); Calc.shift(ca2clone, afpChain.getBlockShiftVector()[b]); double distance = Calc.getDistance(ca1[optAln[b][0][p]], ca2clone); if (distance > maxDistance) { maxBlock = b; maxPos = p; maxDistance = distance; } } } return deleteColumn(afpChain, ca1, ca2, maxBlock, maxPos); }
[ "public", "static", "AFPChain", "deleteHighestDistanceColumn", "(", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "StructureException", "{", "int", "[", "]", "[", "]", "[", "]", "optAln", "=", "afpChain", ".", "getOptAln", "(", ")", ";", "int", "maxBlock", "=", "0", ";", "int", "maxPos", "=", "0", ";", "double", "maxDistance", "=", "Double", ".", "MIN_VALUE", ";", "for", "(", "int", "b", "=", "0", ";", "b", "<", "optAln", ".", "length", ";", "b", "++", ")", "{", "for", "(", "int", "p", "=", "0", ";", "p", "<", "optAln", "[", "b", "]", "[", "0", "]", ".", "length", ";", "p", "++", ")", "{", "Atom", "ca2clone", "=", "ca2", "[", "optAln", "[", "b", "]", "[", "1", "]", "[", "p", "]", "]", ";", "Calc", ".", "rotate", "(", "ca2clone", ",", "afpChain", ".", "getBlockRotationMatrix", "(", ")", "[", "b", "]", ")", ";", "Calc", ".", "shift", "(", "ca2clone", ",", "afpChain", ".", "getBlockShiftVector", "(", ")", "[", "b", "]", ")", ";", "double", "distance", "=", "Calc", ".", "getDistance", "(", "ca1", "[", "optAln", "[", "b", "]", "[", "0", "]", "[", "p", "]", "]", ",", "ca2clone", ")", ";", "if", "(", "distance", ">", "maxDistance", ")", "{", "maxBlock", "=", "b", ";", "maxPos", "=", "p", ";", "maxDistance", "=", "distance", ";", "}", "}", "}", "return", "deleteColumn", "(", "afpChain", ",", "ca1", ",", "ca2", ",", "maxBlock", ",", "maxPos", ")", ";", "}" ]
Find the alignment position with the highest atomic distance between the equivalent atomic positions of the arrays and remove it from the alignment. @param afpChain original alignment, will be modified @param ca1 atom array, will not be modified @param ca2 atom array, will not be modified @return the original alignment, with the alignment position at the highest distance removed @throws StructureException
[ "Find", "the", "alignment", "position", "with", "the", "highest", "atomic", "distance", "between", "the", "equivalent", "atomic", "positions", "of", "the", "arrays", "and", "remove", "it", "from", "the", "alignment", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java#L1417-L1443
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/TimedDirContext.java
TimedDirContext.traceJndiBegin
private void traceJndiBegin(String methodname, Object... objs) { """ Trace a message with "JNDI_CALL' that includes the parameters sent to the JNDI call. @param methodname The name of the method that is requesting the trace. @param objs The parameters to trace. """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String providerURL = "UNKNOWN"; try { providerURL = (String) getEnvironment().get(Context.PROVIDER_URL); } catch (NamingException ne) { /* Ignore. */ } Tr.debug(tc, JNDI_CALL + methodname + " [" + providerURL + "]", objs); } }
java
private void traceJndiBegin(String methodname, Object... objs) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String providerURL = "UNKNOWN"; try { providerURL = (String) getEnvironment().get(Context.PROVIDER_URL); } catch (NamingException ne) { /* Ignore. */ } Tr.debug(tc, JNDI_CALL + methodname + " [" + providerURL + "]", objs); } }
[ "private", "void", "traceJndiBegin", "(", "String", "methodname", ",", "Object", "...", "objs", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "String", "providerURL", "=", "\"UNKNOWN\"", ";", "try", "{", "providerURL", "=", "(", "String", ")", "getEnvironment", "(", ")", ".", "get", "(", "Context", ".", "PROVIDER_URL", ")", ";", "}", "catch", "(", "NamingException", "ne", ")", "{", "/* Ignore. */", "}", "Tr", ".", "debug", "(", "tc", ",", "JNDI_CALL", "+", "methodname", "+", "\" [\"", "+", "providerURL", "+", "\"]\"", ",", "objs", ")", ";", "}", "}" ]
Trace a message with "JNDI_CALL' that includes the parameters sent to the JNDI call. @param methodname The name of the method that is requesting the trace. @param objs The parameters to trace.
[ "Trace", "a", "message", "with", "JNDI_CALL", "that", "includes", "the", "parameters", "sent", "to", "the", "JNDI", "call", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/TimedDirContext.java#L510-L520
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/inputs/InputType.java
InputType.convolutional3D
public static InputType convolutional3D(Convolution3D.DataFormat dataFormat, long depth, long height, long width, long channels) { """ Input type for 3D convolutional (CNN3D) 5d data:<br> If NDHWC format [miniBatchSize, depth, height, width, channels]<br> If NDCWH @param height height of the input @param width Width of the input @param depth Depth of the input @param channels Number of channels of the input @return InputTypeConvolutional3D """ return new InputTypeConvolutional3D(dataFormat, depth, height, width, channels); }
java
public static InputType convolutional3D(Convolution3D.DataFormat dataFormat, long depth, long height, long width, long channels) { return new InputTypeConvolutional3D(dataFormat, depth, height, width, channels); }
[ "public", "static", "InputType", "convolutional3D", "(", "Convolution3D", ".", "DataFormat", "dataFormat", ",", "long", "depth", ",", "long", "height", ",", "long", "width", ",", "long", "channels", ")", "{", "return", "new", "InputTypeConvolutional3D", "(", "dataFormat", ",", "depth", ",", "height", ",", "width", ",", "channels", ")", ";", "}" ]
Input type for 3D convolutional (CNN3D) 5d data:<br> If NDHWC format [miniBatchSize, depth, height, width, channels]<br> If NDCWH @param height height of the input @param width Width of the input @param depth Depth of the input @param channels Number of channels of the input @return InputTypeConvolutional3D
[ "Input", "type", "for", "3D", "convolutional", "(", "CNN3D", ")", "5d", "data", ":", "<br", ">", "If", "NDHWC", "format", "[", "miniBatchSize", "depth", "height", "width", "channels", "]", "<br", ">", "If", "NDCWH" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/inputs/InputType.java#L158-L160
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java
LinkUtil.adjustMappedUrl
protected static String adjustMappedUrl(SlingHttpServletRequest request, String url) { """ in the case of a forwarded SSL request the resource resolver mapping rules must contain the false port (80) to ensure a proper resolving - but in the result this bad port is included in the mapped URL and must be removed - done here """ // build a pattern with the (false) default port Pattern defaultPortPattern = Pattern.compile( URL_PATTERN_STRING.replaceFirst("\\(:\\\\d\\+\\)\\?", ":" + getDefaultPort(request))); Matcher matcher = defaultPortPattern.matcher(url); // remove the port if the URL matches (contains the port nnumber) if (matcher.matches()) { if (null == matcher.group(1)) url = "//" + matcher.group(2); else url = matcher.group(1) + "://" + matcher.group(2); String uri = matcher.group(3); if (StringUtils.isNotBlank(uri)) { url += uri; } else { url += "/"; } } return url; }
java
protected static String adjustMappedUrl(SlingHttpServletRequest request, String url) { // build a pattern with the (false) default port Pattern defaultPortPattern = Pattern.compile( URL_PATTERN_STRING.replaceFirst("\\(:\\\\d\\+\\)\\?", ":" + getDefaultPort(request))); Matcher matcher = defaultPortPattern.matcher(url); // remove the port if the URL matches (contains the port nnumber) if (matcher.matches()) { if (null == matcher.group(1)) url = "//" + matcher.group(2); else url = matcher.group(1) + "://" + matcher.group(2); String uri = matcher.group(3); if (StringUtils.isNotBlank(uri)) { url += uri; } else { url += "/"; } } return url; }
[ "protected", "static", "String", "adjustMappedUrl", "(", "SlingHttpServletRequest", "request", ",", "String", "url", ")", "{", "// build a pattern with the (false) default port", "Pattern", "defaultPortPattern", "=", "Pattern", ".", "compile", "(", "URL_PATTERN_STRING", ".", "replaceFirst", "(", "\"\\\\(:\\\\\\\\d\\\\+\\\\)\\\\?\"", ",", "\":\"", "+", "getDefaultPort", "(", "request", ")", ")", ")", ";", "Matcher", "matcher", "=", "defaultPortPattern", ".", "matcher", "(", "url", ")", ";", "// remove the port if the URL matches (contains the port nnumber)", "if", "(", "matcher", ".", "matches", "(", ")", ")", "{", "if", "(", "null", "==", "matcher", ".", "group", "(", "1", ")", ")", "url", "=", "\"//\"", "+", "matcher", ".", "group", "(", "2", ")", ";", "else", "url", "=", "matcher", ".", "group", "(", "1", ")", "+", "\"://\"", "+", "matcher", ".", "group", "(", "2", ")", ";", "String", "uri", "=", "matcher", ".", "group", "(", "3", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "uri", ")", ")", "{", "url", "+=", "uri", ";", "}", "else", "{", "url", "+=", "\"/\"", ";", "}", "}", "return", "url", ";", "}" ]
in the case of a forwarded SSL request the resource resolver mapping rules must contain the false port (80) to ensure a proper resolving - but in the result this bad port is included in the mapped URL and must be removed - done here
[ "in", "the", "case", "of", "a", "forwarded", "SSL", "request", "the", "resource", "resolver", "mapping", "rules", "must", "contain", "the", "false", "port", "(", "80", ")", "to", "ensure", "a", "proper", "resolving", "-", "but", "in", "the", "result", "this", "bad", "port", "is", "included", "in", "the", "mapped", "URL", "and", "must", "be", "removed", "-", "done", "here" ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java#L218-L235
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withCharSequenceArrayList
public Postcard withCharSequenceArrayList(@Nullable String key, @Nullable ArrayList<CharSequence> value) { """ Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList object, or null @return current """ mBundle.putCharSequenceArrayList(key, value); return this; }
java
public Postcard withCharSequenceArrayList(@Nullable String key, @Nullable ArrayList<CharSequence> value) { mBundle.putCharSequenceArrayList(key, value); return this; }
[ "public", "Postcard", "withCharSequenceArrayList", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "ArrayList", "<", "CharSequence", ">", "value", ")", "{", "mBundle", ".", "putCharSequenceArrayList", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList object, or null @return current
[ "Inserts", "an", "ArrayList", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L455-L458
librato/metrics-librato
src/main/java/com/librato/metrics/reporter/SourceInformation.java
SourceInformation.from
public static SourceInformation from(Pattern sourceRegex, String name) { """ If the pattern is not null, it will attempt to match against the supplied name to pull out the source. """ if (sourceRegex == null) { return new SourceInformation(null, name); } Matcher matcher = sourceRegex.matcher(name); if (matcher.groupCount() != 1) { log.error("Source regex matcher must define a group"); return new SourceInformation(null, name); } if (!matcher.find()) { return new SourceInformation(null, name); } String source = matcher.group(1); int endPos = matcher.toMatchResult().end(); if (endPos >= name.length()) { // the source matched the whole metric name, probably in error. log.error("Source '{}' matched the whole metric name. Metric name cannot be empty"); return new SourceInformation(null, name); } String newName = name.substring(endPos); return new SourceInformation(source, newName); }
java
public static SourceInformation from(Pattern sourceRegex, String name) { if (sourceRegex == null) { return new SourceInformation(null, name); } Matcher matcher = sourceRegex.matcher(name); if (matcher.groupCount() != 1) { log.error("Source regex matcher must define a group"); return new SourceInformation(null, name); } if (!matcher.find()) { return new SourceInformation(null, name); } String source = matcher.group(1); int endPos = matcher.toMatchResult().end(); if (endPos >= name.length()) { // the source matched the whole metric name, probably in error. log.error("Source '{}' matched the whole metric name. Metric name cannot be empty"); return new SourceInformation(null, name); } String newName = name.substring(endPos); return new SourceInformation(source, newName); }
[ "public", "static", "SourceInformation", "from", "(", "Pattern", "sourceRegex", ",", "String", "name", ")", "{", "if", "(", "sourceRegex", "==", "null", ")", "{", "return", "new", "SourceInformation", "(", "null", ",", "name", ")", ";", "}", "Matcher", "matcher", "=", "sourceRegex", ".", "matcher", "(", "name", ")", ";", "if", "(", "matcher", ".", "groupCount", "(", ")", "!=", "1", ")", "{", "log", ".", "error", "(", "\"Source regex matcher must define a group\"", ")", ";", "return", "new", "SourceInformation", "(", "null", ",", "name", ")", ";", "}", "if", "(", "!", "matcher", ".", "find", "(", ")", ")", "{", "return", "new", "SourceInformation", "(", "null", ",", "name", ")", ";", "}", "String", "source", "=", "matcher", ".", "group", "(", "1", ")", ";", "int", "endPos", "=", "matcher", ".", "toMatchResult", "(", ")", ".", "end", "(", ")", ";", "if", "(", "endPos", ">=", "name", ".", "length", "(", ")", ")", "{", "// the source matched the whole metric name, probably in error.", "log", ".", "error", "(", "\"Source '{}' matched the whole metric name. Metric name cannot be empty\"", ")", ";", "return", "new", "SourceInformation", "(", "null", ",", "name", ")", ";", "}", "String", "newName", "=", "name", ".", "substring", "(", "endPos", ")", ";", "return", "new", "SourceInformation", "(", "source", ",", "newName", ")", ";", "}" ]
If the pattern is not null, it will attempt to match against the supplied name to pull out the source.
[ "If", "the", "pattern", "is", "not", "null", "it", "will", "attempt", "to", "match", "against", "the", "supplied", "name", "to", "pull", "out", "the", "source", "." ]
train
https://github.com/librato/metrics-librato/blob/10713643cf7d80e0f9741a7e1e81d1f6d68dc3f6/src/main/java/com/librato/metrics/reporter/SourceInformation.java#L18-L39
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET
public OvhOvhPabxDialplanExtensionConditionTime billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required] @param conditionId [required] """ String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionTime.class); }
java
public OvhOvhPabxDialplanExtensionConditionTime billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionTime.class); }
[ "public", "OvhOvhPabxDialplanExtensionConditionTime", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",", "Long", "conditionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "dialplanId", ",", "extensionId", ",", "conditionId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOvhPabxDialplanExtensionConditionTime", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required] @param conditionId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7121-L7126
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/remote/http/dialect/impl/HttpNeo4jSequenceGenerator.java
HttpNeo4jSequenceGenerator.createSequencesConstraintsStatements
private void createSequencesConstraintsStatements(Statements statements, Iterable<Sequence> sequences) { """ Create the sequence nodes setting the initial value if the node does not exist already. <p> All nodes are created inside the same transaction. """ Statement statement = createUniqueConstraintStatement( SEQUENCE_NAME_PROPERTY, NodeLabel.SEQUENCE.name() ); statements.addStatement( statement ); }
java
private void createSequencesConstraintsStatements(Statements statements, Iterable<Sequence> sequences) { Statement statement = createUniqueConstraintStatement( SEQUENCE_NAME_PROPERTY, NodeLabel.SEQUENCE.name() ); statements.addStatement( statement ); }
[ "private", "void", "createSequencesConstraintsStatements", "(", "Statements", "statements", ",", "Iterable", "<", "Sequence", ">", "sequences", ")", "{", "Statement", "statement", "=", "createUniqueConstraintStatement", "(", "SEQUENCE_NAME_PROPERTY", ",", "NodeLabel", ".", "SEQUENCE", ".", "name", "(", ")", ")", ";", "statements", ".", "addStatement", "(", "statement", ")", ";", "}" ]
Create the sequence nodes setting the initial value if the node does not exist already. <p> All nodes are created inside the same transaction.
[ "Create", "the", "sequence", "nodes", "setting", "the", "initial", "value", "if", "the", "node", "does", "not", "exist", "already", ".", "<p", ">", "All", "nodes", "are", "created", "inside", "the", "same", "transaction", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/remote/http/dialect/impl/HttpNeo4jSequenceGenerator.java#L74-L77
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java
CPDefinitionSpecificationOptionValuePersistenceImpl.findByCPDefinitionId
@Override public List<CPDefinitionSpecificationOptionValue> findByCPDefinitionId( long CPDefinitionId, int start, int end) { """ Returns a range of all the cp definition specification option values where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionSpecificationOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp definition specification option values @param end the upper bound of the range of cp definition specification option values (not inclusive) @return the range of matching cp definition specification option values """ return findByCPDefinitionId(CPDefinitionId, start, end, null); }
java
@Override public List<CPDefinitionSpecificationOptionValue> findByCPDefinitionId( long CPDefinitionId, int start, int end) { return findByCPDefinitionId(CPDefinitionId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionSpecificationOptionValue", ">", "findByCPDefinitionId", "(", "long", "CPDefinitionId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPDefinitionId", "(", "CPDefinitionId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp definition specification option values where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionSpecificationOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp definition specification option values @param end the upper bound of the range of cp definition specification option values (not inclusive) @return the range of matching cp definition specification option values
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "specification", "option", "values", "where", "CPDefinitionId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L2092-L2096
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java
WorkManagerImpl.doFirstChecks
public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException { """ Do first checks for work starting methods @param work to check @param startTimeout to check @param execContext to check @throws WorkException in case of check don't pass """ if (isShutdown()) throw new WorkRejectedException(bundle.workmanagerShutdown()); if (work == null) throw new WorkRejectedException(bundle.workIsNull()); if (startTimeout < 0) throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout)); checkAndVerifyWork(work, execContext); }
java
public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException { if (isShutdown()) throw new WorkRejectedException(bundle.workmanagerShutdown()); if (work == null) throw new WorkRejectedException(bundle.workIsNull()); if (startTimeout < 0) throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout)); checkAndVerifyWork(work, execContext); }
[ "public", "void", "doFirstChecks", "(", "Work", "work", ",", "long", "startTimeout", ",", "ExecutionContext", "execContext", ")", "throws", "WorkException", "{", "if", "(", "isShutdown", "(", ")", ")", "throw", "new", "WorkRejectedException", "(", "bundle", ".", "workmanagerShutdown", "(", ")", ")", ";", "if", "(", "work", "==", "null", ")", "throw", "new", "WorkRejectedException", "(", "bundle", ".", "workIsNull", "(", ")", ")", ";", "if", "(", "startTimeout", "<", "0", ")", "throw", "new", "WorkRejectedException", "(", "bundle", ".", "startTimeoutIsNegative", "(", "startTimeout", ")", ")", ";", "checkAndVerifyWork", "(", "work", ",", "execContext", ")", ";", "}" ]
Do first checks for work starting methods @param work to check @param startTimeout to check @param execContext to check @throws WorkException in case of check don't pass
[ "Do", "first", "checks", "for", "work", "starting", "methods" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java#L811-L823
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/ByteIOUtils.java
ByteIOUtils.writeLong
public static void writeLong(byte[] buf, int pos, long v) { """ Writes a specific long value (8 bytes) to the output byte array at the given offset. @param buf output byte array @param pos offset into the byte buffer to write @param v long value to write """ checkBoundary(buf, pos, 8); buf[pos++] = (byte) (0xff & (v >> 56)); buf[pos++] = (byte) (0xff & (v >> 48)); buf[pos++] = (byte) (0xff & (v >> 40)); buf[pos++] = (byte) (0xff & (v >> 32)); buf[pos++] = (byte) (0xff & (v >> 24)); buf[pos++] = (byte) (0xff & (v >> 16)); buf[pos++] = (byte) (0xff & (v >> 8)); buf[pos] = (byte) (0xff & v); }
java
public static void writeLong(byte[] buf, int pos, long v) { checkBoundary(buf, pos, 8); buf[pos++] = (byte) (0xff & (v >> 56)); buf[pos++] = (byte) (0xff & (v >> 48)); buf[pos++] = (byte) (0xff & (v >> 40)); buf[pos++] = (byte) (0xff & (v >> 32)); buf[pos++] = (byte) (0xff & (v >> 24)); buf[pos++] = (byte) (0xff & (v >> 16)); buf[pos++] = (byte) (0xff & (v >> 8)); buf[pos] = (byte) (0xff & v); }
[ "public", "static", "void", "writeLong", "(", "byte", "[", "]", "buf", ",", "int", "pos", ",", "long", "v", ")", "{", "checkBoundary", "(", "buf", ",", "pos", ",", "8", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "56", ")", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "48", ")", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "40", ")", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "32", ")", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "24", ")", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "16", ")", ")", ";", "buf", "[", "pos", "++", "]", "=", "(", "byte", ")", "(", "0xff", "&", "(", "v", ">>", "8", ")", ")", ";", "buf", "[", "pos", "]", "=", "(", "byte", ")", "(", "0xff", "&", "v", ")", ";", "}" ]
Writes a specific long value (8 bytes) to the output byte array at the given offset. @param buf output byte array @param pos offset into the byte buffer to write @param v long value to write
[ "Writes", "a", "specific", "long", "value", "(", "8", "bytes", ")", "to", "the", "output", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/ByteIOUtils.java#L210-L220
alkacon/opencms-core
src/org/opencms/ui/apps/cacheadmin/CmsImageCacheHelper.java
CmsImageCacheHelper.getSingleSize
private String getSingleSize(CmsObject cms, CmsResource res) { """ Reads the size of a single image.<p> @param cms CmsObejct @param res CmsResource to be read @return a String representation of the dimension of the given image """ try { BufferedImage img = Simapi.read(cms.readFile(res).getContents()); return "" + img.getWidth() + " x " + img.getHeight() + "px"; } catch (CmsException | IOException e) { return ""; } }
java
private String getSingleSize(CmsObject cms, CmsResource res) { try { BufferedImage img = Simapi.read(cms.readFile(res).getContents()); return "" + img.getWidth() + " x " + img.getHeight() + "px"; } catch (CmsException | IOException e) { return ""; } }
[ "private", "String", "getSingleSize", "(", "CmsObject", "cms", ",", "CmsResource", "res", ")", "{", "try", "{", "BufferedImage", "img", "=", "Simapi", ".", "read", "(", "cms", ".", "readFile", "(", "res", ")", ".", "getContents", "(", ")", ")", ";", "return", "\"\"", "+", "img", ".", "getWidth", "(", ")", "+", "\" x \"", "+", "img", ".", "getHeight", "(", ")", "+", "\"px\"", ";", "}", "catch", "(", "CmsException", "|", "IOException", "e", ")", "{", "return", "\"\"", ";", "}", "}" ]
Reads the size of a single image.<p> @param cms CmsObejct @param res CmsResource to be read @return a String representation of the dimension of the given image
[ "Reads", "the", "size", "of", "a", "single", "image", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/cacheadmin/CmsImageCacheHelper.java#L230-L238
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/TableRef.java
TableRef.notEqual
public TableRef notEqual(String attributeName, ItemAttribute value) { """ Applies a filter to the table. When fetched, it will return the items that does not match the filter property value. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); // Retrieve all items that have their "itemProperty" value equal to "theValue" tableRef.notEqual("itemProperty",new ItemAttribute("theValue")).getItems(new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if (itemSnapshot != null) { Log.d("TableRef", "Item retrieved: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer code, String errorMessage) { Log.e("TableRef", "Error retrieving items: " + errorMessage); } }); </pre> @param attributeName The name of the property to filter. @param value The value of the property to filter. @return Current table reference """ filters.add(new Filter(StorageFilter.NOTEQUAL, attributeName, value, null)); return this; }
java
public TableRef notEqual(String attributeName, ItemAttribute value){ filters.add(new Filter(StorageFilter.NOTEQUAL, attributeName, value, null)); return this; }
[ "public", "TableRef", "notEqual", "(", "String", "attributeName", ",", "ItemAttribute", "value", ")", "{", "filters", ".", "add", "(", "new", "Filter", "(", "StorageFilter", ".", "NOTEQUAL", ",", "attributeName", ",", "value", ",", "null", ")", ")", ";", "return", "this", ";", "}" ]
Applies a filter to the table. When fetched, it will return the items that does not match the filter property value. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); // Retrieve all items that have their "itemProperty" value equal to "theValue" tableRef.notEqual("itemProperty",new ItemAttribute("theValue")).getItems(new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if (itemSnapshot != null) { Log.d("TableRef", "Item retrieved: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer code, String errorMessage) { Log.e("TableRef", "Error retrieving items: " + errorMessage); } }); </pre> @param attributeName The name of the property to filter. @param value The value of the property to filter. @return Current table reference
[ "Applies", "a", "filter", "to", "the", "table", ".", "When", "fetched", "it", "will", "return", "the", "items", "that", "does", "not", "match", "the", "filter", "property", "value", "." ]
train
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/TableRef.java#L623-L626
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/rule/string/StringRegexRule.java
StringRegexRule.addPattern
public void addPattern(final String pattern, final int flags) { """ Adds the specified regular expression to be matched against the data to be validated, with the specified pattern flags.<br>Note that if you need the matching to be done strictly on the whole input data, you should surround the patterns with the '^' and '$' characters. @param pattern Regular expression to be added. @param flags Regular expression pattern flags.<br>Refer to {@link Pattern#compile(String, int)}. @see #addPattern(String) @see Matcher#find() """ patterns.put(pattern, Pattern.compile(pattern, flags)); }
java
public void addPattern(final String pattern, final int flags) { patterns.put(pattern, Pattern.compile(pattern, flags)); }
[ "public", "void", "addPattern", "(", "final", "String", "pattern", ",", "final", "int", "flags", ")", "{", "patterns", ".", "put", "(", "pattern", ",", "Pattern", ".", "compile", "(", "pattern", ",", "flags", ")", ")", ";", "}" ]
Adds the specified regular expression to be matched against the data to be validated, with the specified pattern flags.<br>Note that if you need the matching to be done strictly on the whole input data, you should surround the patterns with the '^' and '$' characters. @param pattern Regular expression to be added. @param flags Regular expression pattern flags.<br>Refer to {@link Pattern#compile(String, int)}. @see #addPattern(String) @see Matcher#find()
[ "Adds", "the", "specified", "regular", "expression", "to", "be", "matched", "against", "the", "data", "to", "be", "validated", "with", "the", "specified", "pattern", "flags", ".", "<br", ">", "Note", "that", "if", "you", "need", "the", "matching", "to", "be", "done", "strictly", "on", "the", "whole", "input", "data", "you", "should", "surround", "the", "patterns", "with", "the", "^", "and", "$", "characters", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/rule/string/StringRegexRule.java#L103-L105
VoltDB/voltdb
src/frontend/org/voltdb/dr2/DRIDTrackerHelper.java
DRIDTrackerHelper.dejsonifyClusterTrackers
public static Map<Integer, Map<Integer, DRSiteDrIdTracker>> dejsonifyClusterTrackers(final String jsonData, boolean resetLastReceivedLogIds) throws JSONException { """ Deserialize the trackers retrieved from each consumer partitions. @param jsonData Tracker data retrieved from each consumer partition. @param partitionsMissingTracker @return A map of producer cluster ID to tracker for each producer partition. If no tracker information is found, the map will be empty. @throws JSONException """ Map<Integer, Map<Integer, DRSiteDrIdTracker>> producerTrackers = new HashMap<>(); JSONObject clusterData = new JSONObject(jsonData); final JSONObject trackers = clusterData.getJSONObject("trackers"); Iterator<String> clusterIdKeys = trackers.keys(); while (clusterIdKeys.hasNext()) { final String clusterIdStr = clusterIdKeys.next(); final int clusterId = Integer.parseInt(clusterIdStr); final JSONObject trackerData = trackers.getJSONObject(clusterIdStr); Iterator<String> srcPidKeys = trackerData.keys(); while (srcPidKeys.hasNext()) { final String srcPidStr = srcPidKeys.next(); final int srcPid = Integer.valueOf(srcPidStr); final JSONObject ids = trackerData.getJSONObject(srcPidStr); final DRSiteDrIdTracker tracker = new DRSiteDrIdTracker(ids, resetLastReceivedLogIds); Map<Integer, DRSiteDrIdTracker> clusterTrackers = producerTrackers.computeIfAbsent(clusterId, k -> new HashMap<>()); clusterTrackers.put(srcPid, tracker); } } return producerTrackers; }
java
public static Map<Integer, Map<Integer, DRSiteDrIdTracker>> dejsonifyClusterTrackers(final String jsonData, boolean resetLastReceivedLogIds) throws JSONException { Map<Integer, Map<Integer, DRSiteDrIdTracker>> producerTrackers = new HashMap<>(); JSONObject clusterData = new JSONObject(jsonData); final JSONObject trackers = clusterData.getJSONObject("trackers"); Iterator<String> clusterIdKeys = trackers.keys(); while (clusterIdKeys.hasNext()) { final String clusterIdStr = clusterIdKeys.next(); final int clusterId = Integer.parseInt(clusterIdStr); final JSONObject trackerData = trackers.getJSONObject(clusterIdStr); Iterator<String> srcPidKeys = trackerData.keys(); while (srcPidKeys.hasNext()) { final String srcPidStr = srcPidKeys.next(); final int srcPid = Integer.valueOf(srcPidStr); final JSONObject ids = trackerData.getJSONObject(srcPidStr); final DRSiteDrIdTracker tracker = new DRSiteDrIdTracker(ids, resetLastReceivedLogIds); Map<Integer, DRSiteDrIdTracker> clusterTrackers = producerTrackers.computeIfAbsent(clusterId, k -> new HashMap<>()); clusterTrackers.put(srcPid, tracker); } } return producerTrackers; }
[ "public", "static", "Map", "<", "Integer", ",", "Map", "<", "Integer", ",", "DRSiteDrIdTracker", ">", ">", "dejsonifyClusterTrackers", "(", "final", "String", "jsonData", ",", "boolean", "resetLastReceivedLogIds", ")", "throws", "JSONException", "{", "Map", "<", "Integer", ",", "Map", "<", "Integer", ",", "DRSiteDrIdTracker", ">", ">", "producerTrackers", "=", "new", "HashMap", "<>", "(", ")", ";", "JSONObject", "clusterData", "=", "new", "JSONObject", "(", "jsonData", ")", ";", "final", "JSONObject", "trackers", "=", "clusterData", ".", "getJSONObject", "(", "\"trackers\"", ")", ";", "Iterator", "<", "String", ">", "clusterIdKeys", "=", "trackers", ".", "keys", "(", ")", ";", "while", "(", "clusterIdKeys", ".", "hasNext", "(", ")", ")", "{", "final", "String", "clusterIdStr", "=", "clusterIdKeys", ".", "next", "(", ")", ";", "final", "int", "clusterId", "=", "Integer", ".", "parseInt", "(", "clusterIdStr", ")", ";", "final", "JSONObject", "trackerData", "=", "trackers", ".", "getJSONObject", "(", "clusterIdStr", ")", ";", "Iterator", "<", "String", ">", "srcPidKeys", "=", "trackerData", ".", "keys", "(", ")", ";", "while", "(", "srcPidKeys", ".", "hasNext", "(", ")", ")", "{", "final", "String", "srcPidStr", "=", "srcPidKeys", ".", "next", "(", ")", ";", "final", "int", "srcPid", "=", "Integer", ".", "valueOf", "(", "srcPidStr", ")", ";", "final", "JSONObject", "ids", "=", "trackerData", ".", "getJSONObject", "(", "srcPidStr", ")", ";", "final", "DRSiteDrIdTracker", "tracker", "=", "new", "DRSiteDrIdTracker", "(", "ids", ",", "resetLastReceivedLogIds", ")", ";", "Map", "<", "Integer", ",", "DRSiteDrIdTracker", ">", "clusterTrackers", "=", "producerTrackers", ".", "computeIfAbsent", "(", "clusterId", ",", "k", "->", "new", "HashMap", "<>", "(", ")", ")", ";", "clusterTrackers", ".", "put", "(", "srcPid", ",", "tracker", ")", ";", "}", "}", "return", "producerTrackers", ";", "}" ]
Deserialize the trackers retrieved from each consumer partitions. @param jsonData Tracker data retrieved from each consumer partition. @param partitionsMissingTracker @return A map of producer cluster ID to tracker for each producer partition. If no tracker information is found, the map will be empty. @throws JSONException
[ "Deserialize", "the", "trackers", "retrieved", "from", "each", "consumer", "partitions", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/dr2/DRIDTrackerHelper.java#L79-L104
evernote/android-state
library/src/main/java/com/evernote/android/state/StateSaverImpl.java
StateSaverImpl.saveInstanceState
@NonNull /*package*/ <T extends View> Parcelable saveInstanceState(@NonNull T target, @Nullable Parcelable state) { """ Save the state of the given view and the other state inside of the returned {@link Parcelable}. @param target The view containing fields annotated with {@link State}. @param state The super state of the parent class of the view. Usually it isn't {@code null}. @return A parcelable containing the view's state and its super state. """ Injector.View<T> injector = safeGet(target, Injector.View.DEFAULT); return injector.save(target, state); }
java
@NonNull /*package*/ <T extends View> Parcelable saveInstanceState(@NonNull T target, @Nullable Parcelable state) { Injector.View<T> injector = safeGet(target, Injector.View.DEFAULT); return injector.save(target, state); }
[ "@", "NonNull", "/*package*/", "<", "T", "extends", "View", ">", "Parcelable", "saveInstanceState", "(", "@", "NonNull", "T", "target", ",", "@", "Nullable", "Parcelable", "state", ")", "{", "Injector", ".", "View", "<", "T", ">", "injector", "=", "safeGet", "(", "target", ",", "Injector", ".", "View", ".", "DEFAULT", ")", ";", "return", "injector", ".", "save", "(", "target", ",", "state", ")", ";", "}" ]
Save the state of the given view and the other state inside of the returned {@link Parcelable}. @param target The view containing fields annotated with {@link State}. @param state The super state of the parent class of the view. Usually it isn't {@code null}. @return A parcelable containing the view's state and its super state.
[ "Save", "the", "state", "of", "the", "given", "view", "and", "the", "other", "state", "inside", "of", "the", "returned", "{", "@link", "Parcelable", "}", "." ]
train
https://github.com/evernote/android-state/blob/6d56c0c5709f330324ec23d39c3f70c9d59bf6d3/library/src/main/java/com/evernote/android/state/StateSaverImpl.java#L96-L100
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10AttributeMinimal
public static void escapeXml10AttributeMinimal(final Reader reader, final Writer writer) throws IOException { """ <p> Perform an XML 1.0 level 1 (only markup-significant chars) <strong>escape</strong> operation on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters which are <em>predefined</em> as Character Entity References in XML: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> This method calls {@link #escapeXml10(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.5 """ escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeXml10AttributeMinimal(final Reader reader, final Writer writer) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeXml10AttributeMinimal", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeXml", "(", "reader", ",", "writer", ",", "XmlEscapeSymbols", ".", "XML10_ATTRIBUTE_SYMBOLS", ",", "XmlEscapeType", ".", "CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA", ",", "XmlEscapeLevel", ".", "LEVEL_1_ONLY_MARKUP_SIGNIFICANT", ")", ";", "}" ]
<p> Perform an XML 1.0 level 1 (only markup-significant chars) <strong>escape</strong> operation on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters which are <em>predefined</em> as Character Entity References in XML: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> This method calls {@link #escapeXml10(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.5
[ "<p", ">", "Perform", "an", "XML", "1", ".", "0", "level", "1", "(", "only", "markup", "-", "significant", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "meant", "to", "be", "an", "XML", "attribute", "value", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "1<", "/", "em", ">", "means", "this", "method", "will", "only", "escape", "the", "five", "markup", "-", "significant", "characters", "which", "are", "<em", ">", "predefined<", "/", "em", ">", "as", "Character", "Entity", "References", "in", "XML", ":", "<tt", ">", "&lt", ";", "<", "/", "tt", ">", "<tt", ">", "&gt", ";", "<", "/", "tt", ">", "<tt", ">", "&amp", ";", "<", "/", "tt", ">", "<tt", ">", "&quot", ";", "<", "/", "tt", ">", "and", "<tt", ">", "&#39", ";", "<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "Besides", "being", "an", "attribute", "value", "also", "<tt", ">", "&#92", ";", "t<", "/", "tt", ">", "<tt", ">", "&#92", ";", "n<", "/", "tt", ">", "and", "<tt", ">", "&#92", ";", "r<", "/", "tt", ">", "will", "be", "escaped", "to", "avoid", "white", "-", "space", "normalization", "from", "removing", "line", "feeds", "(", "turning", "them", "into", "white", "spaces", ")", "during", "future", "parsing", "operations", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapeXml10", "(", "Reader", "Writer", "XmlEscapeType", "XmlEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "type<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "xml", ".", "XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA", "}", "<", "/", "li", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "xml", ".", "XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1312-L1317
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/storage/DefaultDOManager.java
DefaultDOManager.populateDC
private static void populateDC(Context ctx, DigitalObject obj, DOWriter w, Date nowUTC) throws IOException, ServerException { """ Adds a minimal DC datastream if one isn't already present. If there is already a DC datastream, ensure one of the dc:identifier values is the PID of the object. """ logger.debug("Adding/Checking default DC datastream"); Datastream dc = w.GetDatastream("DC", null); DCFields dcf; XMLDatastreamProcessor dcxml = null; if (dc == null) { dcxml = new XMLDatastreamProcessor("DC"); dc = dcxml.getDatastream(); //dc.DSMDClass=DatastreamXMLMetadata.DESCRIPTIVE; dc.DatastreamID = "DC"; dc.DSVersionID = "DC1.0"; //dc.DSControlGrp = "X"; set by XMLDatastreamProcessor instead dc.DSCreateDT = nowUTC; dc.DSLabel = "Dublin Core Record for this object"; dc.DSMIME = "text/xml"; dc.DSFormatURI = OAI_DC2_0.uri; dc.DSSize = 0; dc.DSState = "A"; dc.DSVersionable = true; dcf = new DCFields(); if (obj.getLabel() != null && !obj.getLabel().isEmpty()) { dcf.titles().add(new DCField(obj.getLabel())); } w.addDatastream(dc, dc.DSVersionable); } else { dcxml = new XMLDatastreamProcessor(dc); // note: context may be required to get through authz as content // could be filesystem file (or URL) dcf = new DCFields(dc.getContentStream(ctx)); } // set the value of the dc datastream according to what's in the // DCFields object // ensure one of the dc:identifiers is the pid ByteArrayOutputStream bytes = new ByteArrayOutputStream(512); PrintWriter out = new PrintWriter(new OutputStreamWriter(bytes, Charset.forName("UTF-8"))); dcf.getAsXML(obj.getPid(), out); out.close(); dcxml.setXMLContent(bytes.toByteArray()); }
java
private static void populateDC(Context ctx, DigitalObject obj, DOWriter w, Date nowUTC) throws IOException, ServerException { logger.debug("Adding/Checking default DC datastream"); Datastream dc = w.GetDatastream("DC", null); DCFields dcf; XMLDatastreamProcessor dcxml = null; if (dc == null) { dcxml = new XMLDatastreamProcessor("DC"); dc = dcxml.getDatastream(); //dc.DSMDClass=DatastreamXMLMetadata.DESCRIPTIVE; dc.DatastreamID = "DC"; dc.DSVersionID = "DC1.0"; //dc.DSControlGrp = "X"; set by XMLDatastreamProcessor instead dc.DSCreateDT = nowUTC; dc.DSLabel = "Dublin Core Record for this object"; dc.DSMIME = "text/xml"; dc.DSFormatURI = OAI_DC2_0.uri; dc.DSSize = 0; dc.DSState = "A"; dc.DSVersionable = true; dcf = new DCFields(); if (obj.getLabel() != null && !obj.getLabel().isEmpty()) { dcf.titles().add(new DCField(obj.getLabel())); } w.addDatastream(dc, dc.DSVersionable); } else { dcxml = new XMLDatastreamProcessor(dc); // note: context may be required to get through authz as content // could be filesystem file (or URL) dcf = new DCFields(dc.getContentStream(ctx)); } // set the value of the dc datastream according to what's in the // DCFields object // ensure one of the dc:identifiers is the pid ByteArrayOutputStream bytes = new ByteArrayOutputStream(512); PrintWriter out = new PrintWriter(new OutputStreamWriter(bytes, Charset.forName("UTF-8"))); dcf.getAsXML(obj.getPid(), out); out.close(); dcxml.setXMLContent(bytes.toByteArray()); }
[ "private", "static", "void", "populateDC", "(", "Context", "ctx", ",", "DigitalObject", "obj", ",", "DOWriter", "w", ",", "Date", "nowUTC", ")", "throws", "IOException", ",", "ServerException", "{", "logger", ".", "debug", "(", "\"Adding/Checking default DC datastream\"", ")", ";", "Datastream", "dc", "=", "w", ".", "GetDatastream", "(", "\"DC\"", ",", "null", ")", ";", "DCFields", "dcf", ";", "XMLDatastreamProcessor", "dcxml", "=", "null", ";", "if", "(", "dc", "==", "null", ")", "{", "dcxml", "=", "new", "XMLDatastreamProcessor", "(", "\"DC\"", ")", ";", "dc", "=", "dcxml", ".", "getDatastream", "(", ")", ";", "//dc.DSMDClass=DatastreamXMLMetadata.DESCRIPTIVE;", "dc", ".", "DatastreamID", "=", "\"DC\"", ";", "dc", ".", "DSVersionID", "=", "\"DC1.0\"", ";", "//dc.DSControlGrp = \"X\"; set by XMLDatastreamProcessor instead", "dc", ".", "DSCreateDT", "=", "nowUTC", ";", "dc", ".", "DSLabel", "=", "\"Dublin Core Record for this object\"", ";", "dc", ".", "DSMIME", "=", "\"text/xml\"", ";", "dc", ".", "DSFormatURI", "=", "OAI_DC2_0", ".", "uri", ";", "dc", ".", "DSSize", "=", "0", ";", "dc", ".", "DSState", "=", "\"A\"", ";", "dc", ".", "DSVersionable", "=", "true", ";", "dcf", "=", "new", "DCFields", "(", ")", ";", "if", "(", "obj", ".", "getLabel", "(", ")", "!=", "null", "&&", "!", "obj", ".", "getLabel", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "dcf", ".", "titles", "(", ")", ".", "add", "(", "new", "DCField", "(", "obj", ".", "getLabel", "(", ")", ")", ")", ";", "}", "w", ".", "addDatastream", "(", "dc", ",", "dc", ".", "DSVersionable", ")", ";", "}", "else", "{", "dcxml", "=", "new", "XMLDatastreamProcessor", "(", "dc", ")", ";", "// note: context may be required to get through authz as content", "// could be filesystem file (or URL)", "dcf", "=", "new", "DCFields", "(", "dc", ".", "getContentStream", "(", "ctx", ")", ")", ";", "}", "// set the value of the dc datastream according to what's in the", "// DCFields object", "// ensure one of the dc:identifiers is the pid", "ByteArrayOutputStream", "bytes", "=", "new", "ByteArrayOutputStream", "(", "512", ")", ";", "PrintWriter", "out", "=", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "bytes", ",", "Charset", ".", "forName", "(", "\"UTF-8\"", ")", ")", ")", ";", "dcf", ".", "getAsXML", "(", "obj", ".", "getPid", "(", ")", ",", "out", ")", ";", "out", ".", "close", "(", ")", ";", "dcxml", ".", "setXMLContent", "(", "bytes", ".", "toByteArray", "(", ")", ")", ";", "}" ]
Adds a minimal DC datastream if one isn't already present. If there is already a DC datastream, ensure one of the dc:identifier values is the PID of the object.
[ "Adds", "a", "minimal", "DC", "datastream", "if", "one", "isn", "t", "already", "present", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/DefaultDOManager.java#L1060-L1100
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsyncThrowing
public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>> toAsyncThrowing(final ThrowingFunc8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> func, final Scheduler scheduler) { """ Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param <T4> the fourth parameter type @param <T5> the fifth parameter type @param <T6> the sixth parameter type @param <T7> the seventh parameter type @param <T8> the eighth parameter type @param <R> the result type @param func the function to convert @param scheduler the Scheduler used to call the {@code func} @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh228956.aspx">MSDN: Observable.ToAsync</a> """ return new Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>>() { @Override public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) { return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4, t5, t6, t7, t8), scheduler); } }; }
java
public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>> toAsyncThrowing(final ThrowingFunc8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> func, final Scheduler scheduler) { return new Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>>() { @Override public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) { return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4, t5, t6, t7, t8), scheduler); } }; }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "R", ">", "Func8", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "Observable", "<", "R", ">", ">", "toAsyncThrowing", "(", "final", "ThrowingFunc8", "<", "?", "super", "T1", ",", "?", "super", "T2", ",", "?", "super", "T3", ",", "?", "super", "T4", ",", "?", "super", "T5", ",", "?", "super", "T6", ",", "?", "super", "T7", ",", "?", "super", "T8", ",", "?", "extends", "R", ">", "func", ",", "final", "Scheduler", "scheduler", ")", "{", "return", "new", "Func8", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "Observable", "<", "R", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "R", ">", "call", "(", "T1", "t1", ",", "T2", "t2", ",", "T3", "t3", ",", "T4", "t4", ",", "T5", "t5", ",", "T6", "t6", ",", "T7", "t7", ",", "T8", "t8", ")", "{", "return", "startCallable", "(", "ThrowingFunctions", ".", "toCallable", "(", "func", ",", "t1", ",", "t2", ",", "t3", ",", "t4", ",", "t5", ",", "t6", ",", "t7", ",", "t8", ")", ",", "scheduler", ")", ";", "}", "}", ";", "}" ]
Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param <T4> the fourth parameter type @param <T5> the fifth parameter type @param <T6> the sixth parameter type @param <T7> the seventh parameter type @param <T8> the eighth parameter type @param <R> the result type @param func the function to convert @param scheduler the Scheduler used to call the {@code func} @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh228956.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "function", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "toAsync", ".", "s", ".", "png", "alt", "=", ">" ]
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1505-L1512
jirutka/spring-rest-exception-handler
src/main/java/cz/jirutka/spring/exhandler/handlers/AbstractRestExceptionHandler.java
AbstractRestExceptionHandler.logException
protected void logException(E ex, HttpServletRequest req) { """ Logs the exception; on ERROR level when status is 5xx, otherwise on INFO level without stack trace, or DEBUG level with stack trace. The logger name is {@code cz.jirutka.spring.exhandler.handlers.RestExceptionHandler}. @param ex The exception to log. @param req The current web request. """ if (LOG.isErrorEnabled() && getStatus().value() >= 500 || LOG.isInfoEnabled()) { Marker marker = MarkerFactory.getMarker(ex.getClass().getName()); String uri = req.getRequestURI(); if (req.getQueryString() != null) { uri += '?' + req.getQueryString(); } String msg = String.format("%s %s ~> %s", req.getMethod(), uri, getStatus()); if (getStatus().value() >= 500) { LOG.error(marker, msg, ex); } else if (LOG.isDebugEnabled()) { LOG.debug(marker, msg, ex); } else { LOG.info(marker, msg); } } }
java
protected void logException(E ex, HttpServletRequest req) { if (LOG.isErrorEnabled() && getStatus().value() >= 500 || LOG.isInfoEnabled()) { Marker marker = MarkerFactory.getMarker(ex.getClass().getName()); String uri = req.getRequestURI(); if (req.getQueryString() != null) { uri += '?' + req.getQueryString(); } String msg = String.format("%s %s ~> %s", req.getMethod(), uri, getStatus()); if (getStatus().value() >= 500) { LOG.error(marker, msg, ex); } else if (LOG.isDebugEnabled()) { LOG.debug(marker, msg, ex); } else { LOG.info(marker, msg); } } }
[ "protected", "void", "logException", "(", "E", "ex", ",", "HttpServletRequest", "req", ")", "{", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", "&&", "getStatus", "(", ")", ".", "value", "(", ")", ">=", "500", "||", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "Marker", "marker", "=", "MarkerFactory", ".", "getMarker", "(", "ex", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "String", "uri", "=", "req", ".", "getRequestURI", "(", ")", ";", "if", "(", "req", ".", "getQueryString", "(", ")", "!=", "null", ")", "{", "uri", "+=", "'", "'", "+", "req", ".", "getQueryString", "(", ")", ";", "}", "String", "msg", "=", "String", ".", "format", "(", "\"%s %s ~> %s\"", ",", "req", ".", "getMethod", "(", ")", ",", "uri", ",", "getStatus", "(", ")", ")", ";", "if", "(", "getStatus", "(", ")", ".", "value", "(", ")", ">=", "500", ")", "{", "LOG", ".", "error", "(", "marker", ",", "msg", ",", "ex", ")", ";", "}", "else", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "marker", ",", "msg", ",", "ex", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "marker", ",", "msg", ")", ";", "}", "}", "}" ]
Logs the exception; on ERROR level when status is 5xx, otherwise on INFO level without stack trace, or DEBUG level with stack trace. The logger name is {@code cz.jirutka.spring.exhandler.handlers.RestExceptionHandler}. @param ex The exception to log. @param req The current web request.
[ "Logs", "the", "exception", ";", "on", "ERROR", "level", "when", "status", "is", "5xx", "otherwise", "on", "INFO", "level", "without", "stack", "trace", "or", "DEBUG", "level", "with", "stack", "trace", ".", "The", "logger", "name", "is", "{", "@code", "cz", ".", "jirutka", ".", "spring", ".", "exhandler", ".", "handlers", ".", "RestExceptionHandler", "}", "." ]
train
https://github.com/jirutka/spring-rest-exception-handler/blob/f171956e59fe866f1a853c7d38444f136acc7a3b/src/main/java/cz/jirutka/spring/exhandler/handlers/AbstractRestExceptionHandler.java#L96-L117
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentContent.java
DeploymentContent.of
static DeploymentContent of(final InputStream content) { """ Creates new deployment content based on the stream content. The stream content is copied, stored in-memory and closed. @param content the content to deploy @return the deployment content """ final ByteArrayInputStream copiedContent = copy(content); return new DeploymentContent() { @Override void addContentToOperation(final OperationBuilder builder, final ModelNode op) { copiedContent.reset(); final ModelNode contentNode = op.get(CONTENT); final ModelNode contentItem = contentNode.get(0); // The index is 0 based so use the input stream count before adding the input stream contentItem.get(ClientConstants.INPUT_STREAM_INDEX).set(builder.getInputStreamCount()); builder.addInputStream(copiedContent); } @Override public String toString() { return String.format("%s(%s)", DeploymentContent.class.getName(), copiedContent); } }; }
java
static DeploymentContent of(final InputStream content) { final ByteArrayInputStream copiedContent = copy(content); return new DeploymentContent() { @Override void addContentToOperation(final OperationBuilder builder, final ModelNode op) { copiedContent.reset(); final ModelNode contentNode = op.get(CONTENT); final ModelNode contentItem = contentNode.get(0); // The index is 0 based so use the input stream count before adding the input stream contentItem.get(ClientConstants.INPUT_STREAM_INDEX).set(builder.getInputStreamCount()); builder.addInputStream(copiedContent); } @Override public String toString() { return String.format("%s(%s)", DeploymentContent.class.getName(), copiedContent); } }; }
[ "static", "DeploymentContent", "of", "(", "final", "InputStream", "content", ")", "{", "final", "ByteArrayInputStream", "copiedContent", "=", "copy", "(", "content", ")", ";", "return", "new", "DeploymentContent", "(", ")", "{", "@", "Override", "void", "addContentToOperation", "(", "final", "OperationBuilder", "builder", ",", "final", "ModelNode", "op", ")", "{", "copiedContent", ".", "reset", "(", ")", ";", "final", "ModelNode", "contentNode", "=", "op", ".", "get", "(", "CONTENT", ")", ";", "final", "ModelNode", "contentItem", "=", "contentNode", ".", "get", "(", "0", ")", ";", "// The index is 0 based so use the input stream count before adding the input stream", "contentItem", ".", "get", "(", "ClientConstants", ".", "INPUT_STREAM_INDEX", ")", ".", "set", "(", "builder", ".", "getInputStreamCount", "(", ")", ")", ";", "builder", ".", "addInputStream", "(", "copiedContent", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "String", ".", "format", "(", "\"%s(%s)\"", ",", "DeploymentContent", ".", "class", ".", "getName", "(", ")", ",", "copiedContent", ")", ";", "}", "}", ";", "}" ]
Creates new deployment content based on the stream content. The stream content is copied, stored in-memory and closed. @param content the content to deploy @return the deployment content
[ "Creates", "new", "deployment", "content", "based", "on", "the", "stream", "content", ".", "The", "stream", "content", "is", "copied", "stored", "in", "-", "memory", "and", "closed", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentContent.java#L113-L131
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isMethodCall
public static boolean isMethodCall(MethodCallExpression methodCall, String methodObjectPattern, String methodPattern, int numArguments) { """ Return true only if the MethodCallExpression represents a method call for the specified method object (receiver), method name, and with the specified number of arguments. @param methodCall - the AST MethodCallExpression @param methodObjectPattern - the name of the method object (receiver) @param methodPattern - the name of the method being called @param numArguments - the number of arguments passed into the method @return true only if the method call matches the specified criteria """ return (isMethodCall(methodCall, methodObjectPattern, methodPattern) && AstUtil.getMethodArguments(methodCall).size() == numArguments); }
java
public static boolean isMethodCall(MethodCallExpression methodCall, String methodObjectPattern, String methodPattern, int numArguments) { return (isMethodCall(methodCall, methodObjectPattern, methodPattern) && AstUtil.getMethodArguments(methodCall).size() == numArguments); }
[ "public", "static", "boolean", "isMethodCall", "(", "MethodCallExpression", "methodCall", ",", "String", "methodObjectPattern", ",", "String", "methodPattern", ",", "int", "numArguments", ")", "{", "return", "(", "isMethodCall", "(", "methodCall", ",", "methodObjectPattern", ",", "methodPattern", ")", "&&", "AstUtil", ".", "getMethodArguments", "(", "methodCall", ")", ".", "size", "(", ")", "==", "numArguments", ")", ";", "}" ]
Return true only if the MethodCallExpression represents a method call for the specified method object (receiver), method name, and with the specified number of arguments. @param methodCall - the AST MethodCallExpression @param methodObjectPattern - the name of the method object (receiver) @param methodPattern - the name of the method being called @param numArguments - the number of arguments passed into the method @return true only if the method call matches the specified criteria
[ "Return", "true", "only", "if", "the", "MethodCallExpression", "represents", "a", "method", "call", "for", "the", "specified", "method", "object", "(", "receiver", ")", "method", "name", "and", "with", "the", "specified", "number", "of", "arguments", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L311-L313
lamarios/sherdog-parser
src/main/java/com/ftpix/sherdogparser/Sherdog.java
Sherdog.getFighter
public Fighter getFighter(String sherdogUrl) throws IOException, ParseException, SherdogParserException { """ Get a fighter via it;s sherdog URL. @param sherdogUrl the shergod url of the fighter @return a Fighter an all his fights @throws IOException if connecting to sherdog fails @throws ParseException if the page structure has changed @throws SherdogParserException if anythign related to the parser goes wrong """ return new FighterParser(pictureProcessor, zoneId).parse(sherdogUrl); }
java
public Fighter getFighter(String sherdogUrl) throws IOException, ParseException, SherdogParserException { return new FighterParser(pictureProcessor, zoneId).parse(sherdogUrl); }
[ "public", "Fighter", "getFighter", "(", "String", "sherdogUrl", ")", "throws", "IOException", ",", "ParseException", ",", "SherdogParserException", "{", "return", "new", "FighterParser", "(", "pictureProcessor", ",", "zoneId", ")", ".", "parse", "(", "sherdogUrl", ")", ";", "}" ]
Get a fighter via it;s sherdog URL. @param sherdogUrl the shergod url of the fighter @return a Fighter an all his fights @throws IOException if connecting to sherdog fails @throws ParseException if the page structure has changed @throws SherdogParserException if anythign related to the parser goes wrong
[ "Get", "a", "fighter", "via", "it", ";", "s", "sherdog", "URL", "." ]
train
https://github.com/lamarios/sherdog-parser/blob/7cdb36280317caeaaa54db77c04dc4b4e1db053e/src/main/java/com/ftpix/sherdogparser/Sherdog.java#L140-L142
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java
RemoteInputChannel.assignExclusiveSegments
void assignExclusiveSegments(List<MemorySegment> segments) { """ Assigns exclusive buffers to this input channel, and this method should be called only once after this input channel is created. """ checkState(this.initialCredit == 0, "Bug in input channel setup logic: exclusive buffers have " + "already been set for this input channel."); checkNotNull(segments); checkArgument(segments.size() > 0, "The number of exclusive buffers per channel should be larger than 0."); this.initialCredit = segments.size(); this.numRequiredBuffers = segments.size(); synchronized (bufferQueue) { for (MemorySegment segment : segments) { bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers); } } }
java
void assignExclusiveSegments(List<MemorySegment> segments) { checkState(this.initialCredit == 0, "Bug in input channel setup logic: exclusive buffers have " + "already been set for this input channel."); checkNotNull(segments); checkArgument(segments.size() > 0, "The number of exclusive buffers per channel should be larger than 0."); this.initialCredit = segments.size(); this.numRequiredBuffers = segments.size(); synchronized (bufferQueue) { for (MemorySegment segment : segments) { bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers); } } }
[ "void", "assignExclusiveSegments", "(", "List", "<", "MemorySegment", ">", "segments", ")", "{", "checkState", "(", "this", ".", "initialCredit", "==", "0", ",", "\"Bug in input channel setup logic: exclusive buffers have \"", "+", "\"already been set for this input channel.\"", ")", ";", "checkNotNull", "(", "segments", ")", ";", "checkArgument", "(", "segments", ".", "size", "(", ")", ">", "0", ",", "\"The number of exclusive buffers per channel should be larger than 0.\"", ")", ";", "this", ".", "initialCredit", "=", "segments", ".", "size", "(", ")", ";", "this", ".", "numRequiredBuffers", "=", "segments", ".", "size", "(", ")", ";", "synchronized", "(", "bufferQueue", ")", "{", "for", "(", "MemorySegment", "segment", ":", "segments", ")", "{", "bufferQueue", ".", "addExclusiveBuffer", "(", "new", "NetworkBuffer", "(", "segment", ",", "this", ")", ",", "numRequiredBuffers", ")", ";", "}", "}", "}" ]
Assigns exclusive buffers to this input channel, and this method should be called only once after this input channel is created.
[ "Assigns", "exclusive", "buffers", "to", "this", "input", "channel", "and", "this", "method", "should", "be", "called", "only", "once", "after", "this", "input", "channel", "is", "created", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java#L135-L150
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/DOMProcessing.java
DOMProcessing.newElement
final static public Element newElement(QualifiedName elementName, QualifiedName value) { """ Creates a DOM {@link Element} for a {@link QualifiedName} and content given by value @param elementName a {@link QualifiedName} to denote the element name @param value for the created {@link Element} @return a new {@link Element} """ org.w3c.dom.Document doc = builder.newDocument(); Element el = doc.createElementNS(elementName.getNamespaceURI(), qualifiedNameToString(elementName.toQName())); // 1. we add an xsi:type="xsd:QName" attribute // making sure xsi and xsd prefixes are appropriately declared. el.setAttributeNS(NamespacePrefixMapper.XSI_NS, "xsi:type", "xsd:QName"); el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsd", XSD_NS_FOR_XML); // 2. We add the QualifiedName's string representation as child of the element // This representation depends on the extant prefix-namespace mapping String valueAsString=qualifiedNameToString(value.toQName()); el.appendChild(doc.createTextNode(valueAsString)); // 3. We make sure that the QualifiedName's prefix is given the right namespace, or the default namespace is declared if there is no prefix int index=valueAsString.indexOf(":"); if (index!=-1) { String prefix = valueAsString.substring(0, index); el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:"+prefix, convertNsToXml(value.getNamespaceURI())); } else { el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", convertNsToXml(value.getNamespaceURI())); } doc.appendChild(el); return el; }
java
final static public Element newElement(QualifiedName elementName, QualifiedName value) { org.w3c.dom.Document doc = builder.newDocument(); Element el = doc.createElementNS(elementName.getNamespaceURI(), qualifiedNameToString(elementName.toQName())); // 1. we add an xsi:type="xsd:QName" attribute // making sure xsi and xsd prefixes are appropriately declared. el.setAttributeNS(NamespacePrefixMapper.XSI_NS, "xsi:type", "xsd:QName"); el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsd", XSD_NS_FOR_XML); // 2. We add the QualifiedName's string representation as child of the element // This representation depends on the extant prefix-namespace mapping String valueAsString=qualifiedNameToString(value.toQName()); el.appendChild(doc.createTextNode(valueAsString)); // 3. We make sure that the QualifiedName's prefix is given the right namespace, or the default namespace is declared if there is no prefix int index=valueAsString.indexOf(":"); if (index!=-1) { String prefix = valueAsString.substring(0, index); el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:"+prefix, convertNsToXml(value.getNamespaceURI())); } else { el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", convertNsToXml(value.getNamespaceURI())); } doc.appendChild(el); return el; }
[ "final", "static", "public", "Element", "newElement", "(", "QualifiedName", "elementName", ",", "QualifiedName", "value", ")", "{", "org", ".", "w3c", ".", "dom", ".", "Document", "doc", "=", "builder", ".", "newDocument", "(", ")", ";", "Element", "el", "=", "doc", ".", "createElementNS", "(", "elementName", ".", "getNamespaceURI", "(", ")", ",", "qualifiedNameToString", "(", "elementName", ".", "toQName", "(", ")", ")", ")", ";", "// 1. we add an xsi:type=\"xsd:QName\" attribute", "// making sure xsi and xsd prefixes are appropriately declared.", "el", ".", "setAttributeNS", "(", "NamespacePrefixMapper", ".", "XSI_NS", ",", "\"xsi:type\"", ",", "\"xsd:QName\"", ")", ";", "el", ".", "setAttributeNS", "(", "\"http://www.w3.org/2000/xmlns/\"", ",", "\"xmlns:xsd\"", ",", "XSD_NS_FOR_XML", ")", ";", "// 2. We add the QualifiedName's string representation as child of the element", "// This representation depends on the extant prefix-namespace mapping", "String", "valueAsString", "=", "qualifiedNameToString", "(", "value", ".", "toQName", "(", ")", ")", ";", "el", ".", "appendChild", "(", "doc", ".", "createTextNode", "(", "valueAsString", ")", ")", ";", "// 3. We make sure that the QualifiedName's prefix is given the right namespace, or the default namespace is declared if there is no prefix", "int", "index", "=", "valueAsString", ".", "indexOf", "(", "\":\"", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "String", "prefix", "=", "valueAsString", ".", "substring", "(", "0", ",", "index", ")", ";", "el", ".", "setAttributeNS", "(", "\"http://www.w3.org/2000/xmlns/\"", ",", "\"xmlns:\"", "+", "prefix", ",", "convertNsToXml", "(", "value", ".", "getNamespaceURI", "(", ")", ")", ")", ";", "}", "else", "{", "el", ".", "setAttributeNS", "(", "\"http://www.w3.org/2000/xmlns/\"", ",", "\"xmlns\"", ",", "convertNsToXml", "(", "value", ".", "getNamespaceURI", "(", ")", ")", ")", ";", "}", "doc", ".", "appendChild", "(", "el", ")", ";", "return", "el", ";", "}" ]
Creates a DOM {@link Element} for a {@link QualifiedName} and content given by value @param elementName a {@link QualifiedName} to denote the element name @param value for the created {@link Element} @return a new {@link Element}
[ "Creates", "a", "DOM", "{", "@link", "Element", "}", "for", "a", "{", "@link", "QualifiedName", "}", "and", "content", "given", "by", "value" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/DOMProcessing.java#L128-L154
nabedge/mixer2
src/main/java/org/mixer2/xhtml/AbstractJaxb.java
AbstractJaxb.getById
@SuppressWarnings("unchecked") public <T extends AbstractJaxb> T getById(String id, Class<T> tagType) throws TagTypeUnmatchException { """ <p> get tag that has specified id attribute. You don't need to cast() because you can specify the tag type. </p> <pre> // sample: get a Div tag having id=&quot;foo&quot; attribute. html.getById(&quot;foo&quot;, Div.class); </pre> @param id @param tagType @return @throws TagTypeUnmatchException """ Object obj = GetByIdUtil.getById(id, this); if (obj != null && !obj.getClass().isAssignableFrom(tagType)) { throw new TagTypeUnmatchException(tagType.getClass(), obj.getClass()); } return (T) obj; }
java
@SuppressWarnings("unchecked") public <T extends AbstractJaxb> T getById(String id, Class<T> tagType) throws TagTypeUnmatchException { Object obj = GetByIdUtil.getById(id, this); if (obj != null && !obj.getClass().isAssignableFrom(tagType)) { throw new TagTypeUnmatchException(tagType.getClass(), obj.getClass()); } return (T) obj; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "AbstractJaxb", ">", "T", "getById", "(", "String", "id", ",", "Class", "<", "T", ">", "tagType", ")", "throws", "TagTypeUnmatchException", "{", "Object", "obj", "=", "GetByIdUtil", ".", "getById", "(", "id", ",", "this", ")", ";", "if", "(", "obj", "!=", "null", "&&", "!", "obj", ".", "getClass", "(", ")", ".", "isAssignableFrom", "(", "tagType", ")", ")", "{", "throw", "new", "TagTypeUnmatchException", "(", "tagType", ".", "getClass", "(", ")", ",", "obj", ".", "getClass", "(", ")", ")", ";", "}", "return", "(", "T", ")", "obj", ";", "}" ]
<p> get tag that has specified id attribute. You don't need to cast() because you can specify the tag type. </p> <pre> // sample: get a Div tag having id=&quot;foo&quot; attribute. html.getById(&quot;foo&quot;, Div.class); </pre> @param id @param tagType @return @throws TagTypeUnmatchException
[ "<p", ">", "get", "tag", "that", "has", "specified", "id", "attribute", ".", "You", "don", "t", "need", "to", "cast", "()", "because", "you", "can", "specify", "the", "tag", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/AbstractJaxb.java#L77-L86
joniles/mpxj
src/main/java/net/sf/mpxj/merlin/MerlinReader.java
MerlinReader.assignmentDuration
private Duration assignmentDuration(Task task, Duration work) { """ Extract a duration amount from the assignment, converting a percentage into an actual duration. @param task parent task @param work duration from assignment @return Duration instance """ Duration result = work; if (result != null) { if (result.getUnits() == TimeUnit.PERCENT) { Duration taskWork = task.getWork(); if (taskWork != null) { result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits()); } } } return result; }
java
private Duration assignmentDuration(Task task, Duration work) { Duration result = work; if (result != null) { if (result.getUnits() == TimeUnit.PERCENT) { Duration taskWork = task.getWork(); if (taskWork != null) { result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits()); } } } return result; }
[ "private", "Duration", "assignmentDuration", "(", "Task", "task", ",", "Duration", "work", ")", "{", "Duration", "result", "=", "work", ";", "if", "(", "result", "!=", "null", ")", "{", "if", "(", "result", ".", "getUnits", "(", ")", "==", "TimeUnit", ".", "PERCENT", ")", "{", "Duration", "taskWork", "=", "task", ".", "getWork", "(", ")", ";", "if", "(", "taskWork", "!=", "null", ")", "{", "result", "=", "Duration", ".", "getInstance", "(", "taskWork", ".", "getDuration", "(", ")", "*", "result", ".", "getDuration", "(", ")", ",", "taskWork", ".", "getUnits", "(", ")", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Extract a duration amount from the assignment, converting a percentage into an actual duration. @param task parent task @param work duration from assignment @return Duration instance
[ "Extract", "a", "duration", "amount", "from", "the", "assignment", "converting", "a", "percentage", "into", "an", "actual", "duration", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L576-L592
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/transform/description/AttributeTransformationDescription.java
AttributeTransformationDescription.rejectAttributes
void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) { """ Checks attributes for rejection @param rejectedAttributes gathers information about failed attributes @param attributeValue the attribute value """ for (RejectAttributeChecker checker : checks) { rejectedAttributes.checkAttribute(checker, name, attributeValue); } }
java
void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) { for (RejectAttributeChecker checker : checks) { rejectedAttributes.checkAttribute(checker, name, attributeValue); } }
[ "void", "rejectAttributes", "(", "RejectedAttributesLogContext", "rejectedAttributes", ",", "ModelNode", "attributeValue", ")", "{", "for", "(", "RejectAttributeChecker", "checker", ":", "checks", ")", "{", "rejectedAttributes", ".", "checkAttribute", "(", "checker", ",", "name", ",", "attributeValue", ")", ";", "}", "}" ]
Checks attributes for rejection @param rejectedAttributes gathers information about failed attributes @param attributeValue the attribute value
[ "Checks", "attributes", "for", "rejection" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/AttributeTransformationDescription.java#L90-L94
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.updateAsync
public Observable<SignalRResourceInner> updateAsync(String resourceGroupName, String resourceName) { """ Operation to 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. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
java
public Observable<SignalRResourceInner> updateAsync(String resourceGroupName, String resourceName) { return updateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SignalRResourceInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "SignalRResourceInner", ">", ",", "SignalRResourceInner", ">", "(", ")", "{", "@", "Override", "public", "SignalRResourceInner", "call", "(", "ServiceResponse", "<", "SignalRResourceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Operation to 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. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Operation", "to", "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#L1469-L1476
Coveros/selenified
src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java
WaitForEquals.selectOptions
public void selectOptions(String[] expectedOptions, double seconds) { """ Waits for the element's select options equal the provided expected options. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedOptions - the expected input value of the element @param seconds - how many seconds to wait for """ double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!Arrays.toString(element.get().selectOptions()).equals(Arrays.toString(expectedOptions)) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectOptions(expectedOptions, seconds, timeTook); } catch (TimeoutException e) { checkSelectOptions(expectedOptions, seconds, seconds); } }
java
public void selectOptions(String[] expectedOptions, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!Arrays.toString(element.get().selectOptions()).equals(Arrays.toString(expectedOptions)) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectOptions(expectedOptions, seconds, timeTook); } catch (TimeoutException e) { checkSelectOptions(expectedOptions, seconds, seconds); } }
[ "public", "void", "selectOptions", "(", "String", "[", "]", "expectedOptions", ",", "double", "seconds", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "try", "{", "elementPresent", "(", "seconds", ")", ";", "if", "(", "!", "element", ".", "is", "(", ")", ".", "select", "(", ")", ")", "{", "throw", "new", "TimeoutException", "(", "ELEMENT_NOT_SELECT", ")", ";", "}", "while", "(", "!", "Arrays", ".", "toString", "(", "element", ".", "get", "(", ")", ".", "selectOptions", "(", ")", ")", ".", "equals", "(", "Arrays", ".", "toString", "(", "expectedOptions", ")", ")", "&&", "System", ".", "currentTimeMillis", "(", ")", "<", "end", ")", ";", "double", "timeTook", "=", "Math", ".", "min", "(", "(", "seconds", "*", "1000", ")", "-", "(", "end", "-", "System", ".", "currentTimeMillis", "(", ")", ")", ",", "seconds", "*", "1000", ")", "/", "1000", ";", "checkSelectOptions", "(", "expectedOptions", ",", "seconds", ",", "timeTook", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "checkSelectOptions", "(", "expectedOptions", ",", "seconds", ",", "seconds", ")", ";", "}", "}" ]
Waits for the element's select options equal the provided expected options. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedOptions - the expected input value of the element @param seconds - how many seconds to wait for
[ "Waits", "for", "the", "element", "s", "select", "options", "equal", "the", "provided", "expected", "options", ".", "If", "the", "element", "isn", "t", "present", "or", "a", "select", "this", "will", "constitute", "a", "failure", "same", "as", "a", "mismatch", ".", "The", "provided", "wait", "time", "will", "be", "used", "and", "if", "the", "element", "doesn", "t", "have", "the", "desired", "match", "count", "at", "that", "time", "it", "will", "fail", "and", "log", "the", "issue", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java#L486-L499
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java
JavacFiler.checkFileReopening
private void checkFileReopening(FileObject fileObject, boolean forWriting) throws FilerException { """ Check to see if the file has already been opened; if so, throw an exception, otherwise add it to the set of files. """ if (isInFileObjectHistory(fileObject, forWriting)) { if (lint) log.warning("proc.file.reopening", fileObject.getName()); throw new FilerException("Attempt to reopen a file for path " + fileObject.getName()); } if (forWriting) fileObjectHistory.add(fileObject); }
java
private void checkFileReopening(FileObject fileObject, boolean forWriting) throws FilerException { if (isInFileObjectHistory(fileObject, forWriting)) { if (lint) log.warning("proc.file.reopening", fileObject.getName()); throw new FilerException("Attempt to reopen a file for path " + fileObject.getName()); } if (forWriting) fileObjectHistory.add(fileObject); }
[ "private", "void", "checkFileReopening", "(", "FileObject", "fileObject", ",", "boolean", "forWriting", ")", "throws", "FilerException", "{", "if", "(", "isInFileObjectHistory", "(", "fileObject", ",", "forWriting", ")", ")", "{", "if", "(", "lint", ")", "log", ".", "warning", "(", "\"proc.file.reopening\"", ",", "fileObject", ".", "getName", "(", ")", ")", ";", "throw", "new", "FilerException", "(", "\"Attempt to reopen a file for path \"", "+", "fileObject", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "forWriting", ")", "fileObjectHistory", ".", "add", "(", "fileObject", ")", ";", "}" ]
Check to see if the file has already been opened; if so, throw an exception, otherwise add it to the set of files.
[ "Check", "to", "see", "if", "the", "file", "has", "already", "been", "opened", ";", "if", "so", "throw", "an", "exception", "otherwise", "add", "it", "to", "the", "set", "of", "files", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java#L737-L745
Netflix/spectator
spectator-ext-log4j2/src/main/java/com/netflix/spectator/log4j/SpectatorAppender.java
SpectatorAppender.addToRootLogger
public static void addToRootLogger( Registry registry, String name, boolean ignoreExceptions) { """ Add the spectator appender to the root logger. This method is intended to be called once as part of the applications initialization process. @param registry Spectator registry to use for the appender. @param name Name for the appender. @param ignoreExceptions If set to true then the stack trace metrics are disabled. """ final Appender appender = new SpectatorAppender(registry, name, null, null, ignoreExceptions); appender.start(); LoggerContext context = (LoggerContext) LogManager.getContext(false); Configuration config = context.getConfiguration(); addToRootLogger(appender); config.addListener(reconfigurable -> addToRootLogger(appender)); }
java
public static void addToRootLogger( Registry registry, String name, boolean ignoreExceptions) { final Appender appender = new SpectatorAppender(registry, name, null, null, ignoreExceptions); appender.start(); LoggerContext context = (LoggerContext) LogManager.getContext(false); Configuration config = context.getConfiguration(); addToRootLogger(appender); config.addListener(reconfigurable -> addToRootLogger(appender)); }
[ "public", "static", "void", "addToRootLogger", "(", "Registry", "registry", ",", "String", "name", ",", "boolean", "ignoreExceptions", ")", "{", "final", "Appender", "appender", "=", "new", "SpectatorAppender", "(", "registry", ",", "name", ",", "null", ",", "null", ",", "ignoreExceptions", ")", ";", "appender", ".", "start", "(", ")", ";", "LoggerContext", "context", "=", "(", "LoggerContext", ")", "LogManager", ".", "getContext", "(", "false", ")", ";", "Configuration", "config", "=", "context", ".", "getConfiguration", "(", ")", ";", "addToRootLogger", "(", "appender", ")", ";", "config", ".", "addListener", "(", "reconfigurable", "->", "addToRootLogger", "(", "appender", ")", ")", ";", "}" ]
Add the spectator appender to the root logger. This method is intended to be called once as part of the applications initialization process. @param registry Spectator registry to use for the appender. @param name Name for the appender. @param ignoreExceptions If set to true then the stack trace metrics are disabled.
[ "Add", "the", "spectator", "appender", "to", "the", "root", "logger", ".", "This", "method", "is", "intended", "to", "be", "called", "once", "as", "part", "of", "the", "applications", "initialization", "process", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-log4j2/src/main/java/com/netflix/spectator/log4j/SpectatorAppender.java#L65-L77
palatable/lambda
src/main/java/com/jnape/palatable/lambda/functor/builtin/State.java
State.gets
public static <S, A> State<S, A> gets(Fn1<? super S, ? extends A> fn) { """ Create a {@link State} that maps its initial state into its result, but leaves the initial state unchanged. @param fn the mapping function @param <S> the state type @param <A> the result type @return the new {@link State} instance """ return state(both(fn, id())); }
java
public static <S, A> State<S, A> gets(Fn1<? super S, ? extends A> fn) { return state(both(fn, id())); }
[ "public", "static", "<", "S", ",", "A", ">", "State", "<", "S", ",", "A", ">", "gets", "(", "Fn1", "<", "?", "super", "S", ",", "?", "extends", "A", ">", "fn", ")", "{", "return", "state", "(", "both", "(", "fn", ",", "id", "(", ")", ")", ")", ";", "}" ]
Create a {@link State} that maps its initial state into its result, but leaves the initial state unchanged. @param fn the mapping function @param <S> the state type @param <A> the result type @return the new {@link State} instance
[ "Create", "a", "{", "@link", "State", "}", "that", "maps", "its", "initial", "state", "into", "its", "result", "but", "leaves", "the", "initial", "state", "unchanged", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/functor/builtin/State.java#L176-L178
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.getElementValue
public static String getElementValue(Element parent, String tagName) { """ Gets the value of the child element by tag name under the given parent element. If there is more than one child element, return the value of the first one. @param parent the parent element @param tagName the tag name of the child element @return value of the first child element, NULL if tag not exists """ Element element = getChildElement(parent, tagName); if (element != null) { NodeList nodes = element.getChildNodes(); if (nodes != null && nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node instanceof Text) { return ((Text) node).getData(); } } } } return null; }
java
public static String getElementValue(Element parent, String tagName) { Element element = getChildElement(parent, tagName); if (element != null) { NodeList nodes = element.getChildNodes(); if (nodes != null && nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node instanceof Text) { return ((Text) node).getData(); } } } } return null; }
[ "public", "static", "String", "getElementValue", "(", "Element", "parent", ",", "String", "tagName", ")", "{", "Element", "element", "=", "getChildElement", "(", "parent", ",", "tagName", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "NodeList", "nodes", "=", "element", ".", "getChildNodes", "(", ")", ";", "if", "(", "nodes", "!=", "null", "&&", "nodes", ".", "getLength", "(", ")", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Node", "node", "=", "nodes", ".", "item", "(", "i", ")", ";", "if", "(", "node", "instanceof", "Text", ")", "{", "return", "(", "(", "Text", ")", "node", ")", ".", "getData", "(", ")", ";", "}", "}", "}", "}", "return", "null", ";", "}" ]
Gets the value of the child element by tag name under the given parent element. If there is more than one child element, return the value of the first one. @param parent the parent element @param tagName the tag name of the child element @return value of the first child element, NULL if tag not exists
[ "Gets", "the", "value", "of", "the", "child", "element", "by", "tag", "name", "under", "the", "given", "parent", "element", ".", "If", "there", "is", "more", "than", "one", "child", "element", "return", "the", "value", "of", "the", "first", "one", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L303-L318
JodaOrg/joda-time
src/main/java/org/joda/time/TimeOfDay.java
TimeOfDay.getField
protected DateTimeField getField(int index, Chronology chrono) { """ Gets the field for a specific index in the chronology specified. <p> This method must not use any instance variables. @param index the index to retrieve @param chrono the chronology to use @return the field """ switch (index) { case HOUR_OF_DAY: return chrono.hourOfDay(); case MINUTE_OF_HOUR: return chrono.minuteOfHour(); case SECOND_OF_MINUTE: return chrono.secondOfMinute(); case MILLIS_OF_SECOND: return chrono.millisOfSecond(); default: throw new IndexOutOfBoundsException("Invalid index: " + index); } }
java
protected DateTimeField getField(int index, Chronology chrono) { switch (index) { case HOUR_OF_DAY: return chrono.hourOfDay(); case MINUTE_OF_HOUR: return chrono.minuteOfHour(); case SECOND_OF_MINUTE: return chrono.secondOfMinute(); case MILLIS_OF_SECOND: return chrono.millisOfSecond(); default: throw new IndexOutOfBoundsException("Invalid index: " + index); } }
[ "protected", "DateTimeField", "getField", "(", "int", "index", ",", "Chronology", "chrono", ")", "{", "switch", "(", "index", ")", "{", "case", "HOUR_OF_DAY", ":", "return", "chrono", ".", "hourOfDay", "(", ")", ";", "case", "MINUTE_OF_HOUR", ":", "return", "chrono", ".", "minuteOfHour", "(", ")", ";", "case", "SECOND_OF_MINUTE", ":", "return", "chrono", ".", "secondOfMinute", "(", ")", ";", "case", "MILLIS_OF_SECOND", ":", "return", "chrono", ".", "millisOfSecond", "(", ")", ";", "default", ":", "throw", "new", "IndexOutOfBoundsException", "(", "\"Invalid index: \"", "+", "index", ")", ";", "}", "}" ]
Gets the field for a specific index in the chronology specified. <p> This method must not use any instance variables. @param index the index to retrieve @param chrono the chronology to use @return the field
[ "Gets", "the", "field", "for", "a", "specific", "index", "in", "the", "chronology", "specified", ".", "<p", ">", "This", "method", "must", "not", "use", "any", "instance", "variables", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/TimeOfDay.java#L441-L454
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/Jimfs.java
Jimfs.newFileSystem
public static FileSystem newFileSystem(String name, Configuration configuration) { """ Creates a new in-memory file system with the given configuration. <p>The returned file system uses the given name as the host part of its URI and the URIs of paths in the file system. For example, given the name {@code my-file-system}, the file system's URI will be {@code jimfs://my-file-system} and the URI of the path {@code /foo/bar} will be {@code jimfs://my-file-system/foo/bar}. """ try { URI uri = new URI(URI_SCHEME, name, null, null); return newFileSystem(uri, configuration); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
java
public static FileSystem newFileSystem(String name, Configuration configuration) { try { URI uri = new URI(URI_SCHEME, name, null, null); return newFileSystem(uri, configuration); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
[ "public", "static", "FileSystem", "newFileSystem", "(", "String", "name", ",", "Configuration", "configuration", ")", "{", "try", "{", "URI", "uri", "=", "new", "URI", "(", "URI_SCHEME", ",", "name", ",", "null", ",", "null", ")", ";", "return", "newFileSystem", "(", "uri", ",", "configuration", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "}" ]
Creates a new in-memory file system with the given configuration. <p>The returned file system uses the given name as the host part of its URI and the URIs of paths in the file system. For example, given the name {@code my-file-system}, the file system's URI will be {@code jimfs://my-file-system} and the URI of the path {@code /foo/bar} will be {@code jimfs://my-file-system/foo/bar}.
[ "Creates", "a", "new", "in", "-", "memory", "file", "system", "with", "the", "given", "configuration", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/Jimfs.java#L130-L137
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java
DatatypeConverter.getString
public static final String getString(InputStream is) throws IOException { """ Read a Synchro string from an input stream. @param is input stream @return String instance """ int type = is.read(); if (type != 1) { throw new IllegalArgumentException("Unexpected string format"); } Charset charset = CharsetHelper.UTF8; int length = is.read(); if (length == 0xFF) { length = getShort(is); if (length == 0xFFFE) { charset = CharsetHelper.UTF16LE; length = (is.read() * 2); } } String result; if (length == 0) { result = null; } else { byte[] stringData = new byte[length]; is.read(stringData); result = new String(stringData, charset); } return result; }
java
public static final String getString(InputStream is) throws IOException { int type = is.read(); if (type != 1) { throw new IllegalArgumentException("Unexpected string format"); } Charset charset = CharsetHelper.UTF8; int length = is.read(); if (length == 0xFF) { length = getShort(is); if (length == 0xFFFE) { charset = CharsetHelper.UTF16LE; length = (is.read() * 2); } } String result; if (length == 0) { result = null; } else { byte[] stringData = new byte[length]; is.read(stringData); result = new String(stringData, charset); } return result; }
[ "public", "static", "final", "String", "getString", "(", "InputStream", "is", ")", "throws", "IOException", "{", "int", "type", "=", "is", ".", "read", "(", ")", ";", "if", "(", "type", "!=", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected string format\"", ")", ";", "}", "Charset", "charset", "=", "CharsetHelper", ".", "UTF8", ";", "int", "length", "=", "is", ".", "read", "(", ")", ";", "if", "(", "length", "==", "0xFF", ")", "{", "length", "=", "getShort", "(", "is", ")", ";", "if", "(", "length", "==", "0xFFFE", ")", "{", "charset", "=", "CharsetHelper", ".", "UTF16LE", ";", "length", "=", "(", "is", ".", "read", "(", ")", "*", "2", ")", ";", "}", "}", "String", "result", ";", "if", "(", "length", "==", "0", ")", "{", "result", "=", "null", ";", "}", "else", "{", "byte", "[", "]", "stringData", "=", "new", "byte", "[", "length", "]", ";", "is", ".", "read", "(", "stringData", ")", ";", "result", "=", "new", "String", "(", "stringData", ",", "charset", ")", ";", "}", "return", "result", ";", "}" ]
Read a Synchro string from an input stream. @param is input stream @return String instance
[ "Read", "a", "Synchro", "string", "from", "an", "input", "stream", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L182-L215
buschmais/jqa-javaee6-plugin
src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java
WebXmlScannerPlugin.createParamValue
private ParamValueDescriptor createParamValue(ParamValueType paramValueType, Store store) { """ Create a param value descriptor. @param paramValueType The XML param value type. @param store The store. @return The param value descriptor. """ ParamValueDescriptor paramValueDescriptor = store.create(ParamValueDescriptor.class); for (DescriptionType descriptionType : paramValueType.getDescription()) { DescriptionDescriptor descriptionDescriptor = XmlDescriptorHelper.createDescription(descriptionType, store); paramValueDescriptor.getDescriptions().add(descriptionDescriptor); } paramValueDescriptor.setName(paramValueType.getParamName().getValue()); XsdStringType paramValue = paramValueType.getParamValue(); if (paramValue != null) { paramValueDescriptor.setValue(paramValue.getValue()); } return paramValueDescriptor; }
java
private ParamValueDescriptor createParamValue(ParamValueType paramValueType, Store store) { ParamValueDescriptor paramValueDescriptor = store.create(ParamValueDescriptor.class); for (DescriptionType descriptionType : paramValueType.getDescription()) { DescriptionDescriptor descriptionDescriptor = XmlDescriptorHelper.createDescription(descriptionType, store); paramValueDescriptor.getDescriptions().add(descriptionDescriptor); } paramValueDescriptor.setName(paramValueType.getParamName().getValue()); XsdStringType paramValue = paramValueType.getParamValue(); if (paramValue != null) { paramValueDescriptor.setValue(paramValue.getValue()); } return paramValueDescriptor; }
[ "private", "ParamValueDescriptor", "createParamValue", "(", "ParamValueType", "paramValueType", ",", "Store", "store", ")", "{", "ParamValueDescriptor", "paramValueDescriptor", "=", "store", ".", "create", "(", "ParamValueDescriptor", ".", "class", ")", ";", "for", "(", "DescriptionType", "descriptionType", ":", "paramValueType", ".", "getDescription", "(", ")", ")", "{", "DescriptionDescriptor", "descriptionDescriptor", "=", "XmlDescriptorHelper", ".", "createDescription", "(", "descriptionType", ",", "store", ")", ";", "paramValueDescriptor", ".", "getDescriptions", "(", ")", ".", "add", "(", "descriptionDescriptor", ")", ";", "}", "paramValueDescriptor", ".", "setName", "(", "paramValueType", ".", "getParamName", "(", ")", ".", "getValue", "(", ")", ")", ";", "XsdStringType", "paramValue", "=", "paramValueType", ".", "getParamValue", "(", ")", ";", "if", "(", "paramValue", "!=", "null", ")", "{", "paramValueDescriptor", ".", "setValue", "(", "paramValue", ".", "getValue", "(", ")", ")", ";", "}", "return", "paramValueDescriptor", ";", "}" ]
Create a param value descriptor. @param paramValueType The XML param value type. @param store The store. @return The param value descriptor.
[ "Create", "a", "param", "value", "descriptor", "." ]
train
https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java#L458-L470
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java
ApplicationSession.getAttribute
public Object getAttribute(String key, Object defaultValue) { """ Get a value from the user OR session attributes map. @param key name of the attribute @param defaultValue a default value to return if no value is found. @return the attribute value """ Object attributeValue = getUserAttribute(key, null); if (attributeValue != null) return attributeValue; attributeValue = getSessionAttribute(key, null); if (attributeValue != null) return attributeValue; return defaultValue; }
java
public Object getAttribute(String key, Object defaultValue) { Object attributeValue = getUserAttribute(key, null); if (attributeValue != null) return attributeValue; attributeValue = getSessionAttribute(key, null); if (attributeValue != null) return attributeValue; return defaultValue; }
[ "public", "Object", "getAttribute", "(", "String", "key", ",", "Object", "defaultValue", ")", "{", "Object", "attributeValue", "=", "getUserAttribute", "(", "key", ",", "null", ")", ";", "if", "(", "attributeValue", "!=", "null", ")", "return", "attributeValue", ";", "attributeValue", "=", "getSessionAttribute", "(", "key", ",", "null", ")", ";", "if", "(", "attributeValue", "!=", "null", ")", "return", "attributeValue", ";", "return", "defaultValue", ";", "}" ]
Get a value from the user OR session attributes map. @param key name of the attribute @param defaultValue a default value to return if no value is found. @return the attribute value
[ "Get", "a", "value", "from", "the", "user", "OR", "session", "attributes", "map", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java#L329-L338
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryType.java
RepositoryType.registerClassForEnvironment
public void registerClassForEnvironment(String className, EnvironmentType envType) { """ <p>registerClassForEnvironment.</p> @param className a {@link java.lang.String} object. @param envType a {@link com.greenpepper.server.domain.EnvironmentType} object. """ RepositoryTypeClass repoTypeClass = RepositoryTypeClass.newInstance(this, envType, className); repositoryTypeClasses.add(repoTypeClass); }
java
public void registerClassForEnvironment(String className, EnvironmentType envType) { RepositoryTypeClass repoTypeClass = RepositoryTypeClass.newInstance(this, envType, className); repositoryTypeClasses.add(repoTypeClass); }
[ "public", "void", "registerClassForEnvironment", "(", "String", "className", ",", "EnvironmentType", "envType", ")", "{", "RepositoryTypeClass", "repoTypeClass", "=", "RepositoryTypeClass", ".", "newInstance", "(", "this", ",", "envType", ",", "className", ")", ";", "repositoryTypeClasses", ".", "add", "(", "repoTypeClass", ")", ";", "}" ]
<p>registerClassForEnvironment.</p> @param className a {@link java.lang.String} object. @param envType a {@link com.greenpepper.server.domain.EnvironmentType} object.
[ "<p", ">", "registerClassForEnvironment", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryType.java#L191-L195
csc19601128/Phynixx
phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/TimeoutCondition.java
TimeoutCondition.checkCondition
public boolean checkCondition() { """ /* Not synchronized as to be meant for the watch dog exclusively Do not call it unsynchronized (non-Javadoc) @see de.csc.xaresource.sample.watchdog.ITimeoutCondition#checkCondition() """ long timeElapsed = System.currentTimeMillis() - start.get(); if (timeElapsed > this.timeout.get()) { if (LOG.isDebugEnabled()) { //LOG.info("Current Thread="+Thread.currentThread()+" Condition="+this+" Checkpoint "+ System.currentTimeMillis() +" timeout="+(System.currentTimeMillis() - start)); String logString = " violated at " + System.currentTimeMillis() + " (elapsed time=" + timeElapsed + ")"; LOG.debug(new CheckConditionFailedLog(this, logString).toString()); } return false; } return true; }
java
public boolean checkCondition() { long timeElapsed = System.currentTimeMillis() - start.get(); if (timeElapsed > this.timeout.get()) { if (LOG.isDebugEnabled()) { //LOG.info("Current Thread="+Thread.currentThread()+" Condition="+this+" Checkpoint "+ System.currentTimeMillis() +" timeout="+(System.currentTimeMillis() - start)); String logString = " violated at " + System.currentTimeMillis() + " (elapsed time=" + timeElapsed + ")"; LOG.debug(new CheckConditionFailedLog(this, logString).toString()); } return false; } return true; }
[ "public", "boolean", "checkCondition", "(", ")", "{", "long", "timeElapsed", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ".", "get", "(", ")", ";", "if", "(", "timeElapsed", ">", "this", ".", "timeout", ".", "get", "(", ")", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "//LOG.info(\"Current Thread=\"+Thread.currentThread()+\" Condition=\"+this+\" Checkpoint \"+ System.currentTimeMillis() +\" timeout=\"+(System.currentTimeMillis() - start));", "String", "logString", "=", "\" violated at \"", "+", "System", ".", "currentTimeMillis", "(", ")", "+", "\" (elapsed time=\"", "+", "timeElapsed", "+", "\")\"", ";", "LOG", ".", "debug", "(", "new", "CheckConditionFailedLog", "(", "this", ",", "logString", ")", ".", "toString", "(", ")", ")", ";", "}", "return", "false", ";", "}", "return", "true", ";", "}" ]
/* Not synchronized as to be meant for the watch dog exclusively Do not call it unsynchronized (non-Javadoc) @see de.csc.xaresource.sample.watchdog.ITimeoutCondition#checkCondition()
[ "/", "*", "Not", "synchronized", "as", "to", "be", "meant", "for", "the", "watch", "dog", "exclusively" ]
train
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/TimeoutCondition.java#L93-L106
google/auto
value/src/main/java/com/google/auto/value/processor/AutoAnnotationProcessor.java
AutoAnnotationProcessor.abortWithError
private AbortProcessingException abortWithError(String msg, Element e) { """ Issue a compilation error and return an exception that, when thrown, will cause the processing of this class to be abandoned. This does not prevent the processing of other classes. """ reportError(e, msg); return new AbortProcessingException(); }
java
private AbortProcessingException abortWithError(String msg, Element e) { reportError(e, msg); return new AbortProcessingException(); }
[ "private", "AbortProcessingException", "abortWithError", "(", "String", "msg", ",", "Element", "e", ")", "{", "reportError", "(", "e", ",", "msg", ")", ";", "return", "new", "AbortProcessingException", "(", ")", ";", "}" ]
Issue a compilation error and return an exception that, when thrown, will cause the processing of this class to be abandoned. This does not prevent the processing of other classes.
[ "Issue", "a", "compilation", "error", "and", "return", "an", "exception", "that", "when", "thrown", "will", "cause", "the", "processing", "of", "this", "class", "to", "be", "abandoned", ".", "This", "does", "not", "prevent", "the", "processing", "of", "other", "classes", "." ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AutoAnnotationProcessor.java#L94-L97
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
ClientProxyProvider.createClientProxy
private <T> T createClientProxy(Bean<T> bean) throws RuntimeException { """ Creates a Javassist scope adaptor (client proxy) for a bean <p/> Creates a Javassist proxy factory. Gets the type info. Sets the interfaces and superclass to the factory. Hooks in the MethodHandler and creates the proxy. @param bean The bean to proxy @param beanIndex The index to the bean in the manager bean list @return A Javassist proxy @throws InstantiationException When the proxy couldn't be created @throws IllegalAccessException When the proxy couldn't be created """ return createClientProxy(bean, bean.getTypes()); }
java
private <T> T createClientProxy(Bean<T> bean) throws RuntimeException { return createClientProxy(bean, bean.getTypes()); }
[ "private", "<", "T", ">", "T", "createClientProxy", "(", "Bean", "<", "T", ">", "bean", ")", "throws", "RuntimeException", "{", "return", "createClientProxy", "(", "bean", ",", "bean", ".", "getTypes", "(", ")", ")", ";", "}" ]
Creates a Javassist scope adaptor (client proxy) for a bean <p/> Creates a Javassist proxy factory. Gets the type info. Sets the interfaces and superclass to the factory. Hooks in the MethodHandler and creates the proxy. @param bean The bean to proxy @param beanIndex The index to the bean in the manager bean list @return A Javassist proxy @throws InstantiationException When the proxy couldn't be created @throws IllegalAccessException When the proxy couldn't be created
[ "Creates", "a", "Javassist", "scope", "adaptor", "(", "client", "proxy", ")", "for", "a", "bean", "<p", "/", ">", "Creates", "a", "Javassist", "proxy", "factory", ".", "Gets", "the", "type", "info", ".", "Sets", "the", "interfaces", "and", "superclass", "to", "the", "factory", ".", "Hooks", "in", "the", "MethodHandler", "and", "creates", "the", "proxy", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java#L194-L196