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
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.setDrawableTint
public static void setDrawableTint(@NonNull Drawable drawable, @ColorInt int color) { """ Specifies a tint for {@code drawable}. @param drawable drawable target, mutate. @param color color. """ DrawableCompat.setTint(DrawableCompat.wrap(drawable.mutate()), color); }
java
public static void setDrawableTint(@NonNull Drawable drawable, @ColorInt int color) { DrawableCompat.setTint(DrawableCompat.wrap(drawable.mutate()), color); }
[ "public", "static", "void", "setDrawableTint", "(", "@", "NonNull", "Drawable", "drawable", ",", "@", "ColorInt", "int", "color", ")", "{", "DrawableCompat", ".", "setTint", "(", "DrawableCompat", ".", "wrap", "(", "drawable", ".", "mutate", "(", ")", ")", ...
Specifies a tint for {@code drawable}. @param drawable drawable target, mutate. @param color color.
[ "Specifies", "a", "tint", "for", "{", "@code", "drawable", "}", "." ]
train
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L305-L307
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java
S3RequestEndpointResolver.convertToVirtualHostEndpoint
private static URI convertToVirtualHostEndpoint(URI endpoint, String bucketName) { """ Converts the current endpoint set for this client into virtual addressing style, by placing the name of the specified bucket before the S3 service endpoint. @param bucketName The name of the bucket to use in the virtual addressing style of the returned URI. @return A new URI, creating from the current service endpoint URI and the specified bucket. """ try { return new URI(String.format("%s://%s.%s", endpoint.getScheme(), bucketName, endpoint.getAuthority())); } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid bucket name: " + bucketName, e); } }
java
private static URI convertToVirtualHostEndpoint(URI endpoint, String bucketName) { try { return new URI(String.format("%s://%s.%s", endpoint.getScheme(), bucketName, endpoint.getAuthority())); } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid bucket name: " + bucketName, e); } }
[ "private", "static", "URI", "convertToVirtualHostEndpoint", "(", "URI", "endpoint", ",", "String", "bucketName", ")", "{", "try", "{", "return", "new", "URI", "(", "String", ".", "format", "(", "\"%s://%s.%s\"", ",", "endpoint", ".", "getScheme", "(", ")", "...
Converts the current endpoint set for this client into virtual addressing style, by placing the name of the specified bucket before the S3 service endpoint. @param bucketName The name of the bucket to use in the virtual addressing style of the returned URI. @return A new URI, creating from the current service endpoint URI and the specified bucket.
[ "Converts", "the", "current", "endpoint", "set", "for", "this", "client", "into", "virtual", "addressing", "style", "by", "placing", "the", "name", "of", "the", "specified", "bucket", "before", "the", "S3", "service", "endpoint", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java#L73-L79
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/TaskClient.java
TaskClient.getPollData
public List<PollData> getPollData(String taskType) { """ Get last poll data for a given task type @param taskType the task type for which poll data is to be fetched @return returns the list of poll data for the task type """ Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Object[] params = new Object[]{"taskType", taskType}; return getForEntity("tasks/queue/polldata", params, pollDataList); }
java
public List<PollData> getPollData(String taskType) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Object[] params = new Object[]{"taskType", taskType}; return getForEntity("tasks/queue/polldata", params, pollDataList); }
[ "public", "List", "<", "PollData", ">", "getPollData", "(", "String", "taskType", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskType", ")", ",", "\"Task type cannot be blank\"", ")", ";", "Object", "[", "]", ...
Get last poll data for a given task type @param taskType the task type for which poll data is to be fetched @return returns the list of poll data for the task type
[ "Get", "last", "poll", "data", "for", "a", "given", "task", "type" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L343-L348
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java
BytecodeHelper.doCastToWrappedType
public static void doCastToWrappedType(MethodVisitor mv, ClassNode sourceType, ClassNode targetType) { """ Given a primitive number type (byte, integer, short, ...), generates bytecode to convert it to a wrapped number (Integer, Long, Double) using calls to [WrappedType].valueOf @param mv method visitor @param sourceType the primitive number type @param targetType the wrapped target type """ mv.visitMethodInsn(INVOKESTATIC, getClassInternalName(targetType), "valueOf", "(" + getTypeDescription(sourceType) + ")" + getTypeDescription(targetType), false); }
java
public static void doCastToWrappedType(MethodVisitor mv, ClassNode sourceType, ClassNode targetType) { mv.visitMethodInsn(INVOKESTATIC, getClassInternalName(targetType), "valueOf", "(" + getTypeDescription(sourceType) + ")" + getTypeDescription(targetType), false); }
[ "public", "static", "void", "doCastToWrappedType", "(", "MethodVisitor", "mv", ",", "ClassNode", "sourceType", ",", "ClassNode", "targetType", ")", "{", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "getClassInternalName", "(", "targetType", ")", ",", "\...
Given a primitive number type (byte, integer, short, ...), generates bytecode to convert it to a wrapped number (Integer, Long, Double) using calls to [WrappedType].valueOf @param mv method visitor @param sourceType the primitive number type @param targetType the wrapped target type
[ "Given", "a", "primitive", "number", "type", "(", "byte", "integer", "short", "...", ")", "generates", "bytecode", "to", "convert", "it", "to", "a", "wrapped", "number", "(", "Integer", "Long", "Double", ")", "using", "calls", "to", "[", "WrappedType", "]"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java#L472-L474
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.syntaxError
protected JCErroneous syntaxError(String key, TokenKind arg) { """ Generate a syntax error at current position unless one was already reported at the same position. """ return syntaxError(token.pos, key, arg); }
java
protected JCErroneous syntaxError(String key, TokenKind arg) { return syntaxError(token.pos, key, arg); }
[ "protected", "JCErroneous", "syntaxError", "(", "String", "key", ",", "TokenKind", "arg", ")", "{", "return", "syntaxError", "(", "token", ".", "pos", ",", "key", ",", "arg", ")", ";", "}" ]
Generate a syntax error at current position unless one was already reported at the same position.
[ "Generate", "a", "syntax", "error", "at", "current", "position", "unless", "one", "was", "already", "reported", "at", "the", "same", "position", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L499-L501
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getTargetProfilePackageLink
public Content getTargetProfilePackageLink(PackageDoc pd, String target, Content label, String profileName) { """ Get Profile Package link, with target frame. @param pd the packageDoc object @param target name of the target frame @param label tag for the link @param profileName the name of the profile being documented @return a content for the target profile packages link """ return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)), label, "", target); }
java
public Content getTargetProfilePackageLink(PackageDoc pd, String target, Content label, String profileName) { return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)), label, "", target); }
[ "public", "Content", "getTargetProfilePackageLink", "(", "PackageDoc", "pd", ",", "String", "target", ",", "Content", "label", ",", "String", "profileName", ")", "{", "return", "getHyperLink", "(", "pathString", "(", "pd", ",", "DocPaths", ".", "profilePackageSumm...
Get Profile Package link, with target frame. @param pd the packageDoc object @param target name of the target frame @param label tag for the link @param profileName the name of the profile being documented @return a content for the target profile packages link
[ "Get", "Profile", "Package", "link", "with", "target", "frame", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L291-L295
lucee/Lucee
core/src/main/java/lucee/commons/management/MemoryInfo.java
MemoryInfo.deepMemoryUsageOfAll
public static long deepMemoryUsageOfAll(Instrumentation inst, final Collection<? extends java.lang.Object> objs) throws IOException { """ Returns an estimation, in bytes, of the memory usage of the given objects plus (recursively) objects referenced via non-static references from any of those objects via non-public fields. If two or more of the given objects reference the same Object X, then the memory used by Object X will only be counted once. However, the method guarantees that the memory for a given object (either in the passed-in collection or found while traversing the object graphs from those objects) will not be counted more than once. The estimate for each individual object is provided by the running JVM and is likely to be as accurate a measure as can be reasonably made by the running Java program. It will generally include memory taken up for "housekeeping" of that object. @param objs The collection of objects whose memory usage is to be totalled. @return An estimate, in bytes, of the total heap memory taken up by the obejcts in objs and, recursively, objects referenced by private or protected (non-static) fields. @throws IOException """ return deepMemoryUsageOfAll(inst, objs, NON_PUBLIC); }
java
public static long deepMemoryUsageOfAll(Instrumentation inst, final Collection<? extends java.lang.Object> objs) throws IOException { return deepMemoryUsageOfAll(inst, objs, NON_PUBLIC); }
[ "public", "static", "long", "deepMemoryUsageOfAll", "(", "Instrumentation", "inst", ",", "final", "Collection", "<", "?", "extends", "java", ".", "lang", ".", "Object", ">", "objs", ")", "throws", "IOException", "{", "return", "deepMemoryUsageOfAll", "(", "inst"...
Returns an estimation, in bytes, of the memory usage of the given objects plus (recursively) objects referenced via non-static references from any of those objects via non-public fields. If two or more of the given objects reference the same Object X, then the memory used by Object X will only be counted once. However, the method guarantees that the memory for a given object (either in the passed-in collection or found while traversing the object graphs from those objects) will not be counted more than once. The estimate for each individual object is provided by the running JVM and is likely to be as accurate a measure as can be reasonably made by the running Java program. It will generally include memory taken up for "housekeeping" of that object. @param objs The collection of objects whose memory usage is to be totalled. @return An estimate, in bytes, of the total heap memory taken up by the obejcts in objs and, recursively, objects referenced by private or protected (non-static) fields. @throws IOException
[ "Returns", "an", "estimation", "in", "bytes", "of", "the", "memory", "usage", "of", "the", "given", "objects", "plus", "(", "recursively", ")", "objects", "referenced", "via", "non", "-", "static", "references", "from", "any", "of", "those", "objects", "via"...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/management/MemoryInfo.java#L106-L108
jamesagnew/hapi-fhir
hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java
IniFile.timeToStr
private String timeToStr(Timestamp pobjTS, String pstrFmt) { """ Converts the given sql timestamp object to a string representation. The format to be used is to be obtained from the configuration file. @param pobjTS the sql timestamp object to be converted. @param pblnGMT If true formats the string using GMT timezone otherwise using local timezone. @return the formatted string representation of the timestamp. """ String strRet = null; SimpleDateFormat dtFmt = null; try { dtFmt = new SimpleDateFormat(pstrFmt); strRet = dtFmt.format(pobjTS); } catch (IllegalArgumentException iae) { strRet = ""; } catch (NullPointerException npe) { strRet = ""; } finally { if (dtFmt != null) dtFmt = null; } return strRet; }
java
private String timeToStr(Timestamp pobjTS, String pstrFmt) { String strRet = null; SimpleDateFormat dtFmt = null; try { dtFmt = new SimpleDateFormat(pstrFmt); strRet = dtFmt.format(pobjTS); } catch (IllegalArgumentException iae) { strRet = ""; } catch (NullPointerException npe) { strRet = ""; } finally { if (dtFmt != null) dtFmt = null; } return strRet; }
[ "private", "String", "timeToStr", "(", "Timestamp", "pobjTS", ",", "String", "pstrFmt", ")", "{", "String", "strRet", "=", "null", ";", "SimpleDateFormat", "dtFmt", "=", "null", ";", "try", "{", "dtFmt", "=", "new", "SimpleDateFormat", "(", "pstrFmt", ")", ...
Converts the given sql timestamp object to a string representation. The format to be used is to be obtained from the configuration file. @param pobjTS the sql timestamp object to be converted. @param pblnGMT If true formats the string using GMT timezone otherwise using local timezone. @return the formatted string representation of the timestamp.
[ "Converts", "the", "given", "sql", "timestamp", "object", "to", "a", "string", "representation", ".", "The", "format", "to", "be", "used", "is", "to", "be", "obtained", "from", "the", "configuration", "file", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L1129-L1152
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getArgumentSet
public BitSet getArgumentSet(InvokeInstruction invokeInstruction, ConstantPoolGen cpg, DataflowValueChooser<ValueType> chooser) throws DataflowAnalysisException { """ Get set of arguments passed to a method invocation which match given predicate. @param invokeInstruction the InvokeInstruction @param cpg the ConstantPoolGen @param chooser predicate to choose which argument values should be in the returned set @return BitSet specifying which arguments match the predicate, indexed by argument number (starting from 0) @throws DataflowAnalysisException """ BitSet chosenArgSet = new BitSet(); SignatureParser sigParser = new SignatureParser(invokeInstruction.getSignature(cpg)); for (int i = 0; i < sigParser.getNumParameters(); ++i) { ValueType value = getArgument(invokeInstruction, cpg, i, sigParser); if (chooser.choose(value)) { chosenArgSet.set(i); } } return chosenArgSet; }
java
public BitSet getArgumentSet(InvokeInstruction invokeInstruction, ConstantPoolGen cpg, DataflowValueChooser<ValueType> chooser) throws DataflowAnalysisException { BitSet chosenArgSet = new BitSet(); SignatureParser sigParser = new SignatureParser(invokeInstruction.getSignature(cpg)); for (int i = 0; i < sigParser.getNumParameters(); ++i) { ValueType value = getArgument(invokeInstruction, cpg, i, sigParser); if (chooser.choose(value)) { chosenArgSet.set(i); } } return chosenArgSet; }
[ "public", "BitSet", "getArgumentSet", "(", "InvokeInstruction", "invokeInstruction", ",", "ConstantPoolGen", "cpg", ",", "DataflowValueChooser", "<", "ValueType", ">", "chooser", ")", "throws", "DataflowAnalysisException", "{", "BitSet", "chosenArgSet", "=", "new", "Bit...
Get set of arguments passed to a method invocation which match given predicate. @param invokeInstruction the InvokeInstruction @param cpg the ConstantPoolGen @param chooser predicate to choose which argument values should be in the returned set @return BitSet specifying which arguments match the predicate, indexed by argument number (starting from 0) @throws DataflowAnalysisException
[ "Get", "set", "of", "arguments", "passed", "to", "a", "method", "invocation", "which", "match", "given", "predicate", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L468-L481
fuinorg/objects4j
src/main/java/org/fuin/objects4j/vo/HourRanges.java
HourRanges.isValid
public static boolean isValid(@Nullable final String hourRanges) { """ Verifies if the string is valid and could be converted into an object. @param hourRanges Hour ranges string to test. @return {@literal true} if the string is a valid string, else {@literal false}. """ if (hourRanges == null) { return true; } final StringTokenizer tok = new StringTokenizer(hourRanges, "+"); if (tok.countTokens() == 0) { return false; } while (tok.hasMoreTokens()) { final String rangeStr = tok.nextToken(); if (!HourRange.isValid(rangeStr)) { return false; } } return true; }
java
public static boolean isValid(@Nullable final String hourRanges) { if (hourRanges == null) { return true; } final StringTokenizer tok = new StringTokenizer(hourRanges, "+"); if (tok.countTokens() == 0) { return false; } while (tok.hasMoreTokens()) { final String rangeStr = tok.nextToken(); if (!HourRange.isValid(rangeStr)) { return false; } } return true; }
[ "public", "static", "boolean", "isValid", "(", "@", "Nullable", "final", "String", "hourRanges", ")", "{", "if", "(", "hourRanges", "==", "null", ")", "{", "return", "true", ";", "}", "final", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "...
Verifies if the string is valid and could be converted into an object. @param hourRanges Hour ranges string to test. @return {@literal true} if the string is a valid string, else {@literal false}.
[ "Verifies", "if", "the", "string", "is", "valid", "and", "could", "be", "converted", "into", "an", "object", "." ]
train
https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/vo/HourRanges.java#L401-L416
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/AbstractAdvancedAction.java
AbstractAdvancedAction.onError
public void onError(Exception parentException, Context context) throws AdvancedActionException { """ Simple implementation of onError() method. It reverts all pending changes of the current JCR session for any kind of event corresponding to a write operation. Then in case the provided parentException is an instance of type AdvancedActionException, it will throw it otherwise it will log simply it. An AdvancedActionException will be thrown in case the changes could not be reverted. @see org.exoplatform.services.jcr.impl.ext.action.AdvancedAction#onError(java.lang.Exception, org.apache.commons.chain.Context) """ int eventId = (Integer)context.get(InvocationContext.EVENT); if (eventId != ExtendedEvent.READ) { Item item = (Item)context.get(InvocationContext.CURRENT_ITEM); try { item.getSession().refresh(false); } catch (RepositoryException e) { e.initCause(parentException); throw new AdvancedActionException(this.getClass().getName() + " changes rollback failed:", e); } } if (parentException instanceof AdvancedActionException) { throw (AdvancedActionException)parentException; } else { LOG.error(this.getClass().getName() + " throwed an exception:", parentException); } }
java
public void onError(Exception parentException, Context context) throws AdvancedActionException { int eventId = (Integer)context.get(InvocationContext.EVENT); if (eventId != ExtendedEvent.READ) { Item item = (Item)context.get(InvocationContext.CURRENT_ITEM); try { item.getSession().refresh(false); } catch (RepositoryException e) { e.initCause(parentException); throw new AdvancedActionException(this.getClass().getName() + " changes rollback failed:", e); } } if (parentException instanceof AdvancedActionException) { throw (AdvancedActionException)parentException; } else { LOG.error(this.getClass().getName() + " throwed an exception:", parentException); } }
[ "public", "void", "onError", "(", "Exception", "parentException", ",", "Context", "context", ")", "throws", "AdvancedActionException", "{", "int", "eventId", "=", "(", "Integer", ")", "context", ".", "get", "(", "InvocationContext", ".", "EVENT", ")", ";", "if...
Simple implementation of onError() method. It reverts all pending changes of the current JCR session for any kind of event corresponding to a write operation. Then in case the provided parentException is an instance of type AdvancedActionException, it will throw it otherwise it will log simply it. An AdvancedActionException will be thrown in case the changes could not be reverted. @see org.exoplatform.services.jcr.impl.ext.action.AdvancedAction#onError(java.lang.Exception, org.apache.commons.chain.Context)
[ "Simple", "implementation", "of", "onError", "()", "method", ".", "It", "reverts", "all", "pending", "changes", "of", "the", "current", "JCR", "session", "for", "any", "kind", "of", "event", "corresponding", "to", "a", "write", "operation", ".", "Then", "in"...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/AbstractAdvancedAction.java#L45-L69
realexpayments/rxp-hpp-java
src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java
RealexHpp.requestFromJson
public HppRequest requestFromJson(String json, boolean encoded) { """ <p> Method produces <code>HppRequest</code> object from JSON. Carries out the following actions: <ul> <li>Deserialises JSON to request object</li> <li>Decodes Base64 inputs</li> <li>Validates inputs</li> </ul> </p> @param json @param encoded <code>true</code> if the JSON values have been encoded. @return HppRequest """ LOGGER.info("Converting JSON to HppRequest."); //convert to HppRequest from JSON HppRequest hppRequest = JsonUtils.fromJsonHppRequest(json); //decode if necessary if (encoded) { LOGGER.debug("Decoding object."); try { hppRequest = hppRequest.decode(ENCODING_CHARSET); } catch (UnsupportedEncodingException ex) { LOGGER.error("Exception encoding HPP request.", ex); throw new RealexException("Exception decoding HPP request.", ex); } } //validate HPP request LOGGER.debug("Validating request."); ValidationUtils.validate(hppRequest); return hppRequest; }
java
public HppRequest requestFromJson(String json, boolean encoded) { LOGGER.info("Converting JSON to HppRequest."); //convert to HppRequest from JSON HppRequest hppRequest = JsonUtils.fromJsonHppRequest(json); //decode if necessary if (encoded) { LOGGER.debug("Decoding object."); try { hppRequest = hppRequest.decode(ENCODING_CHARSET); } catch (UnsupportedEncodingException ex) { LOGGER.error("Exception encoding HPP request.", ex); throw new RealexException("Exception decoding HPP request.", ex); } } //validate HPP request LOGGER.debug("Validating request."); ValidationUtils.validate(hppRequest); return hppRequest; }
[ "public", "HppRequest", "requestFromJson", "(", "String", "json", ",", "boolean", "encoded", ")", "{", "LOGGER", ".", "info", "(", "\"Converting JSON to HppRequest.\"", ")", ";", "//convert to HppRequest from JSON", "HppRequest", "hppRequest", "=", "JsonUtils", ".", "...
<p> Method produces <code>HppRequest</code> object from JSON. Carries out the following actions: <ul> <li>Deserialises JSON to request object</li> <li>Decodes Base64 inputs</li> <li>Validates inputs</li> </ul> </p> @param json @param encoded <code>true</code> if the JSON values have been encoded. @return HppRequest
[ "<p", ">", "Method", "produces", "<code", ">", "HppRequest<", "/", "code", ">", "object", "from", "JSON", ".", "Carries", "out", "the", "following", "actions", ":", "<ul", ">", "<li", ">", "Deserialises", "JSON", "to", "request", "object<", "/", "li", ">...
train
https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java#L147-L170
amaembo/streamex
src/main/java/one/util/streamex/DoubleStreamEx.java
DoubleStreamEx.zip
public static DoubleStreamEx zip(double[] first, double[] second, DoubleBinaryOperator mapper) { """ Returns a sequential {@code DoubleStreamEx} containing the results of applying the given function to the corresponding pairs of values in given two arrays. @param first the first array @param second the second array @param mapper a non-interfering, stateless function to apply to each pair of the corresponding array elements. @return a new {@code DoubleStreamEx} @throws IllegalArgumentException if length of the arrays differs. @since 0.2.1 """ return of(new RangeBasedSpliterator.ZipDouble(0, checkLength(first.length, second.length), mapper, first, second)); }
java
public static DoubleStreamEx zip(double[] first, double[] second, DoubleBinaryOperator mapper) { return of(new RangeBasedSpliterator.ZipDouble(0, checkLength(first.length, second.length), mapper, first, second)); }
[ "public", "static", "DoubleStreamEx", "zip", "(", "double", "[", "]", "first", ",", "double", "[", "]", "second", ",", "DoubleBinaryOperator", "mapper", ")", "{", "return", "of", "(", "new", "RangeBasedSpliterator", ".", "ZipDouble", "(", "0", ",", "checkLen...
Returns a sequential {@code DoubleStreamEx} containing the results of applying the given function to the corresponding pairs of values in given two arrays. @param first the first array @param second the second array @param mapper a non-interfering, stateless function to apply to each pair of the corresponding array elements. @return a new {@code DoubleStreamEx} @throws IllegalArgumentException if length of the arrays differs. @since 0.2.1
[ "Returns", "a", "sequential", "{", "@code", "DoubleStreamEx", "}", "containing", "the", "results", "of", "applying", "the", "given", "function", "to", "the", "corresponding", "pairs", "of", "values", "in", "given", "two", "arrays", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L1904-L1907
michel-kraemer/citeproc-java
citeproc-java-tool/src/main/java/de/undercouch/citeproc/tool/BibliographyCommand.java
BibliographyCommand.generateCSL
private int generateCSL(String style, String locale, String format, List<String> citationIds, ItemDataProvider provider, PrintWriter out) throws IOException { """ Performs CSL conversion and generates a bibliography @param style the CSL style @param locale the CSL locale @param format the output format @param citationIds the citation ids given on the command line @param provider a provider containing all citation item data @param out the print stream to write the output to @return the exit code @throws IOException if the CSL processor could not be initialized """ if (!checkStyle(style)) { return 1; } //initialize citation processor try (CSL citeproc = new CSL(provider, style, locale)) { //set output format citeproc.setOutputFormat(format); //register citation items String[] citationIdsArr = new String[citationIds.size()]; citationIdsArr = citationIds.toArray(citationIdsArr); if (citationIds.isEmpty()) { citationIdsArr = provider.getIds(); } citeproc.registerCitationItems(citationIdsArr); //generate bibliography doGenerateCSL(citeproc, citationIdsArr, out); } catch (FileNotFoundException e) { error(e.getMessage()); return 1; } return 0; }
java
private int generateCSL(String style, String locale, String format, List<String> citationIds, ItemDataProvider provider, PrintWriter out) throws IOException { if (!checkStyle(style)) { return 1; } //initialize citation processor try (CSL citeproc = new CSL(provider, style, locale)) { //set output format citeproc.setOutputFormat(format); //register citation items String[] citationIdsArr = new String[citationIds.size()]; citationIdsArr = citationIds.toArray(citationIdsArr); if (citationIds.isEmpty()) { citationIdsArr = provider.getIds(); } citeproc.registerCitationItems(citationIdsArr); //generate bibliography doGenerateCSL(citeproc, citationIdsArr, out); } catch (FileNotFoundException e) { error(e.getMessage()); return 1; } return 0; }
[ "private", "int", "generateCSL", "(", "String", "style", ",", "String", "locale", ",", "String", "format", ",", "List", "<", "String", ">", "citationIds", ",", "ItemDataProvider", "provider", ",", "PrintWriter", "out", ")", "throws", "IOException", "{", "if", ...
Performs CSL conversion and generates a bibliography @param style the CSL style @param locale the CSL locale @param format the output format @param citationIds the citation ids given on the command line @param provider a provider containing all citation item data @param out the print stream to write the output to @return the exit code @throws IOException if the CSL processor could not be initialized
[ "Performs", "CSL", "conversion", "and", "generates", "a", "bibliography" ]
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java-tool/src/main/java/de/undercouch/citeproc/tool/BibliographyCommand.java#L152-L180
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendDecimal
public DateTimeFormatterBuilder appendDecimal( DateTimeFieldType fieldType, int minDigits, int maxDigits) { """ Instructs the printer to emit a field value as a decimal number, and the parser to expect an unsigned decimal number. @param fieldType type of field to append @param minDigits minimum number of digits to <i>print</i> @param maxDigits maximum number of digits to <i>parse</i>, or the estimated maximum number of digits to print @return this DateTimeFormatterBuilder, for chaining @throws IllegalArgumentException if field type is null """ if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } if (maxDigits < minDigits) { maxDigits = minDigits; } if (minDigits < 0 || maxDigits <= 0) { throw new IllegalArgumentException(); } if (minDigits <= 1) { return append0(new UnpaddedNumber(fieldType, maxDigits, false)); } else { return append0(new PaddedNumber(fieldType, maxDigits, false, minDigits)); } }
java
public DateTimeFormatterBuilder appendDecimal( DateTimeFieldType fieldType, int minDigits, int maxDigits) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } if (maxDigits < minDigits) { maxDigits = minDigits; } if (minDigits < 0 || maxDigits <= 0) { throw new IllegalArgumentException(); } if (minDigits <= 1) { return append0(new UnpaddedNumber(fieldType, maxDigits, false)); } else { return append0(new PaddedNumber(fieldType, maxDigits, false, minDigits)); } }
[ "public", "DateTimeFormatterBuilder", "appendDecimal", "(", "DateTimeFieldType", "fieldType", ",", "int", "minDigits", ",", "int", "maxDigits", ")", "{", "if", "(", "fieldType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field type m...
Instructs the printer to emit a field value as a decimal number, and the parser to expect an unsigned decimal number. @param fieldType type of field to append @param minDigits minimum number of digits to <i>print</i> @param maxDigits maximum number of digits to <i>parse</i>, or the estimated maximum number of digits to print @return this DateTimeFormatterBuilder, for chaining @throws IllegalArgumentException if field type is null
[ "Instructs", "the", "printer", "to", "emit", "a", "field", "value", "as", "a", "decimal", "number", "and", "the", "parser", "to", "expect", "an", "unsigned", "decimal", "number", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L433-L449
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/CopticDate.java
CopticDate.ofEpochDay
static CopticDate ofEpochDay(final long epochDay) { """ Obtains a {@code CopticDate} representing a date in the Coptic calendar system from the epoch-day. @param epochDay the epoch day to convert based on 1970-01-01 (ISO) @return the date in Coptic calendar system, not null @throws DateTimeException if the epoch-day is out of range """ EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds long copticED = epochDay + EPOCH_DAY_DIFFERENCE; int adjustment = 0; if (copticED < 0) { copticED = copticED + (1461L * (1_000_000L / 4)); adjustment = -1_000_000; } int prolepticYear = (int) (((copticED * 4) + 1463) / 1461); int startYearEpochDay = (prolepticYear - 1) * 365 + (prolepticYear / 4); int doy0 = (int) (copticED - startYearEpochDay); int month = doy0 / 30 + 1; int dom = doy0 % 30 + 1; return new CopticDate(prolepticYear + adjustment, month, dom); }
java
static CopticDate ofEpochDay(final long epochDay) { EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds long copticED = epochDay + EPOCH_DAY_DIFFERENCE; int adjustment = 0; if (copticED < 0) { copticED = copticED + (1461L * (1_000_000L / 4)); adjustment = -1_000_000; } int prolepticYear = (int) (((copticED * 4) + 1463) / 1461); int startYearEpochDay = (prolepticYear - 1) * 365 + (prolepticYear / 4); int doy0 = (int) (copticED - startYearEpochDay); int month = doy0 / 30 + 1; int dom = doy0 % 30 + 1; return new CopticDate(prolepticYear + adjustment, month, dom); }
[ "static", "CopticDate", "ofEpochDay", "(", "final", "long", "epochDay", ")", "{", "EPOCH_DAY", ".", "range", "(", ")", ".", "checkValidValue", "(", "epochDay", ",", "EPOCH_DAY", ")", ";", "// validate outer bounds", "long", "copticED", "=", "epochDay", "+", "E...
Obtains a {@code CopticDate} representing a date in the Coptic calendar system from the epoch-day. @param epochDay the epoch day to convert based on 1970-01-01 (ISO) @return the date in Coptic calendar system, not null @throws DateTimeException if the epoch-day is out of range
[ "Obtains", "a", "{", "@code", "CopticDate", "}", "representing", "a", "date", "in", "the", "Coptic", "calendar", "system", "from", "the", "epoch", "-", "day", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/CopticDate.java#L218-L232
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java
ClassUtils.newInstance
public static <T> T newInstance(Class<T> clazz) { """ Create a new instance of a resource using a default constructor @param clazz new instance class @param <T> new instance class @return new instance """ try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz)); } }
java
public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz)); } }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "return", "clazz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "e", ")",...
Create a new instance of a resource using a default constructor @param clazz new instance class @param <T> new instance class @return new instance
[ "Create", "a", "new", "instance", "of", "a", "resource", "using", "a", "default", "constructor" ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java#L216-L223
buschmais/jqa-core-framework
rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/writer/XmlRuleSetWriter.java
XmlRuleSetWriter.getSeverity
private SeverityEnumType getSeverity(Severity severity, Severity defaultSeverity) { """ Converts {@link Severity} to {@link SeverityEnumType} @param severity {@link Severity}, can be <code>null</code> @param defaultSeverity default severity level, can be <code>null</code> @return {@link SeverityEnumType} """ if (severity == null) { severity = defaultSeverity; } return defaultSeverity != null ? SeverityEnumType.fromValue(severity.getValue()) : null; }
java
private SeverityEnumType getSeverity(Severity severity, Severity defaultSeverity) { if (severity == null) { severity = defaultSeverity; } return defaultSeverity != null ? SeverityEnumType.fromValue(severity.getValue()) : null; }
[ "private", "SeverityEnumType", "getSeverity", "(", "Severity", "severity", ",", "Severity", "defaultSeverity", ")", "{", "if", "(", "severity", "==", "null", ")", "{", "severity", "=", "defaultSeverity", ";", "}", "return", "defaultSeverity", "!=", "null", "?", ...
Converts {@link Severity} to {@link SeverityEnumType} @param severity {@link Severity}, can be <code>null</code> @param defaultSeverity default severity level, can be <code>null</code> @return {@link SeverityEnumType}
[ "Converts", "{", "@link", "Severity", "}", "to", "{", "@link", "SeverityEnumType", "}" ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/writer/XmlRuleSetWriter.java#L152-L157
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.codePointBeforeImpl
static int codePointBeforeImpl(char[] a, int index, int start) { """ throws ArrayIndexOutOfBoundsException if index-1 out of bounds """ char c2 = a[--index]; if (isLowSurrogate(c2) && index > start) { char c1 = a[--index]; if (isHighSurrogate(c1)) { return toCodePoint(c1, c2); } } return c2; }
java
static int codePointBeforeImpl(char[] a, int index, int start) { char c2 = a[--index]; if (isLowSurrogate(c2) && index > start) { char c1 = a[--index]; if (isHighSurrogate(c1)) { return toCodePoint(c1, c2); } } return c2; }
[ "static", "int", "codePointBeforeImpl", "(", "char", "[", "]", "a", ",", "int", "index", ",", "int", "start", ")", "{", "char", "c2", "=", "a", "[", "--", "index", "]", ";", "if", "(", "isLowSurrogate", "(", "c2", ")", "&&", "index", ">", "start", ...
throws ArrayIndexOutOfBoundsException if index-1 out of bounds
[ "throws", "ArrayIndexOutOfBoundsException", "if", "index", "-", "1", "out", "of", "bounds" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5098-L5107
alkacon/opencms-core
src/org/opencms/i18n/CmsEncoder.java
CmsEncoder.adjustHtmlEncoding
public static String adjustHtmlEncoding(String input, String encoding) { """ Adjusts the given String by making sure all characters that can be displayed in the given charset are contained as chars, whereas all other non-displayable characters are converted to HTML entities.<p> Just calls {@link #decodeHtmlEntities(String, String)} first and feeds the result to {@link #encodeHtmlEntities(String, String)}. <p> @param input the input to adjust the HTML encoding for @param encoding the charset to encode the result with\ @return the input with the decoded/encoded HTML entities """ return encodeHtmlEntities(decodeHtmlEntities(input, encoding), encoding); }
java
public static String adjustHtmlEncoding(String input, String encoding) { return encodeHtmlEntities(decodeHtmlEntities(input, encoding), encoding); }
[ "public", "static", "String", "adjustHtmlEncoding", "(", "String", "input", ",", "String", "encoding", ")", "{", "return", "encodeHtmlEntities", "(", "decodeHtmlEntities", "(", "input", ",", "encoding", ")", ",", "encoding", ")", ";", "}" ]
Adjusts the given String by making sure all characters that can be displayed in the given charset are contained as chars, whereas all other non-displayable characters are converted to HTML entities.<p> Just calls {@link #decodeHtmlEntities(String, String)} first and feeds the result to {@link #encodeHtmlEntities(String, String)}. <p> @param input the input to adjust the HTML encoding for @param encoding the charset to encode the result with\ @return the input with the decoded/encoded HTML entities
[ "Adjusts", "the", "given", "String", "by", "making", "sure", "all", "characters", "that", "can", "be", "displayed", "in", "the", "given", "charset", "are", "contained", "as", "chars", "whereas", "all", "other", "non", "-", "displayable", "characters", "are", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L136-L139
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addUnknownSourceLine
@Nonnull public BugInstance addUnknownSourceLine(String className, String sourceFile) { """ Add a non-specific source line annotation. This will result in the entire source file being displayed. @param className the class name @param sourceFile the source file name @return this object """ SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.createUnknown(className, sourceFile); if (sourceLineAnnotation != null) { add(sourceLineAnnotation); } return this; }
java
@Nonnull public BugInstance addUnknownSourceLine(String className, String sourceFile) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.createUnknown(className, sourceFile); if (sourceLineAnnotation != null) { add(sourceLineAnnotation); } return this; }
[ "@", "Nonnull", "public", "BugInstance", "addUnknownSourceLine", "(", "String", "className", ",", "String", "sourceFile", ")", "{", "SourceLineAnnotation", "sourceLineAnnotation", "=", "SourceLineAnnotation", ".", "createUnknown", "(", "className", ",", "sourceFile", ")...
Add a non-specific source line annotation. This will result in the entire source file being displayed. @param className the class name @param sourceFile the source file name @return this object
[ "Add", "a", "non", "-", "specific", "source", "line", "annotation", ".", "This", "will", "result", "in", "the", "entire", "source", "file", "being", "displayed", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1834-L1841
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForSubscriptionAsync
public Observable<SummarizeResultsInner> summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { """ Summarizes policy states for the resources under the subscription. @param subscriptionId Microsoft Azure subscription ID. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object """ return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
java
public Observable<SummarizeResultsInner> summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) { return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SummarizeResultsInner", ">", "summarizeForSubscriptionAsync", "(", "String", "subscriptionId", ",", "QueryOptions", "queryOptions", ")", "{", "return", "summarizeForSubscriptionWithServiceResponseAsync", "(", "subscriptionId", ",", "queryOptions", ...
Summarizes policy states for the resources under the subscription. @param subscriptionId Microsoft Azure subscription ID. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object
[ "Summarizes", "policy", "states", "for", "the", "resources", "under", "the", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L816-L823
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/socks/Proxy.java
Proxy.exchange
protected ProxyMessage exchange(ProxyMessage request) throws SocksException { """ Sends the request reads reply and returns it throws exception if something wrong with IO or the reply code is not zero """ ProxyMessage reply; try{ request.write(out); reply = formMessage(in); }catch(SocksException s_ex){ throw s_ex; }catch(IOException ioe){ throw(new SocksException(SOCKS_PROXY_IO_ERROR,""+ioe)); } return reply; }
java
protected ProxyMessage exchange(ProxyMessage request) throws SocksException{ ProxyMessage reply; try{ request.write(out); reply = formMessage(in); }catch(SocksException s_ex){ throw s_ex; }catch(IOException ioe){ throw(new SocksException(SOCKS_PROXY_IO_ERROR,""+ioe)); } return reply; }
[ "protected", "ProxyMessage", "exchange", "(", "ProxyMessage", "request", ")", "throws", "SocksException", "{", "ProxyMessage", "reply", ";", "try", "{", "request", ".", "write", "(", "out", ")", ";", "reply", "=", "formMessage", "(", "in", ")", ";", "}", "...
Sends the request reads reply and returns it throws exception if something wrong with IO or the reply code is not zero
[ "Sends", "the", "request", "reads", "reply", "and", "returns", "it", "throws", "exception", "if", "something", "wrong", "with", "IO", "or", "the", "reply", "code", "is", "not", "zero" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/Proxy.java#L471-L483
Alluxio/alluxio
core/common/src/main/java/alluxio/concurrent/jsr/CountedCompleter.java
CountedCompleter.firstComplete
public final CountedCompleter<?> firstComplete() { """ If this task's pending count is zero, returns this task; otherwise decrements its pending count and returns {@code null}. This method is designed to be used with {@link #nextComplete} in completion traversal loops. @return this task, if pending count was zero, else {@code null} """ for (int c;;) { if ((c = pending) == 0) return this; else if (U.compareAndSwapInt(this, PENDING, c, c - 1)) return null; } }
java
public final CountedCompleter<?> firstComplete() { for (int c;;) { if ((c = pending) == 0) return this; else if (U.compareAndSwapInt(this, PENDING, c, c - 1)) return null; } }
[ "public", "final", "CountedCompleter", "<", "?", ">", "firstComplete", "(", ")", "{", "for", "(", "int", "c", ";", ";", ")", "{", "if", "(", "(", "c", "=", "pending", ")", "==", "0", ")", "return", "this", ";", "else", "if", "(", "U", ".", "com...
If this task's pending count is zero, returns this task; otherwise decrements its pending count and returns {@code null}. This method is designed to be used with {@link #nextComplete} in completion traversal loops. @return this task, if pending count was zero, else {@code null}
[ "If", "this", "task", "s", "pending", "count", "is", "zero", "returns", "this", "task", ";", "otherwise", "decrements", "its", "pending", "count", "and", "returns", "{", "@code", "null", "}", ".", "This", "method", "is", "designed", "to", "be", "used", "...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CountedCompleter.java#L613-L620
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java
ProxyHandler.customizeConnection
protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection) throws IOException { """ Customize proxy URL connection. Method to allow derived handlers to customize the connection. """ }
java
protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection) throws IOException { }
[ "protected", "void", "customizeConnection", "(", "String", "pathInContext", ",", "String", "pathParams", ",", "HttpRequest", "request", ",", "URLConnection", "connection", ")", "throws", "IOException", "{", "}" ]
Customize proxy URL connection. Method to allow derived handlers to customize the connection.
[ "Customize", "proxy", "URL", "connection", ".", "Method", "to", "allow", "derived", "handlers", "to", "customize", "the", "connection", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java#L539-L541
fuinorg/event-store-commons
jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java
AbstractJpaEventStore.setJpqlParameters
protected final void setJpqlParameters(final Query query, final StreamId streamId) { """ Sets parameters in a query. @param query Query to set parameters for. @param streamId Unique stream identifier that has the parameter values. """ final List<KeyValue> params = new ArrayList<>(streamId.getParameters()); if (params.size() == 0) { params.add(new KeyValue("streamName", streamId.getName())); } for (int i = 0; i < params.size(); i++) { final KeyValue param = params.get(i); query.setParameter(param.getKey(), param.getValue()); } }
java
protected final void setJpqlParameters(final Query query, final StreamId streamId) { final List<KeyValue> params = new ArrayList<>(streamId.getParameters()); if (params.size() == 0) { params.add(new KeyValue("streamName", streamId.getName())); } for (int i = 0; i < params.size(); i++) { final KeyValue param = params.get(i); query.setParameter(param.getKey(), param.getValue()); } }
[ "protected", "final", "void", "setJpqlParameters", "(", "final", "Query", "query", ",", "final", "StreamId", "streamId", ")", "{", "final", "List", "<", "KeyValue", ">", "params", "=", "new", "ArrayList", "<>", "(", "streamId", ".", "getParameters", "(", ")"...
Sets parameters in a query. @param query Query to set parameters for. @param streamId Unique stream identifier that has the parameter values.
[ "Sets", "parameters", "in", "a", "query", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java#L451-L460
softindex/datakernel
global-common/src/main/java/io/global/util/Utils.java
Utils.nSuccessesOrLess
public static <T> Promise<List<T>> nSuccessesOrLess(int n, Iterator<Promise<T>> promises) { """ Returns a {@code List} of successfully completed {@code Promise}s. Length of returned {@code List} can't be greater than {@code n}. """ return reduceEx(promises, a -> n - a.size(), new ArrayList<T>(), (a, v) -> { if (v.isSuccess()) { a.add(v.get()); if (a.size() == n) { return Try.of(a); } } return null; }, Try::of, Cancellable::tryCancel); }
java
public static <T> Promise<List<T>> nSuccessesOrLess(int n, Iterator<Promise<T>> promises) { return reduceEx(promises, a -> n - a.size(), new ArrayList<T>(), (a, v) -> { if (v.isSuccess()) { a.add(v.get()); if (a.size() == n) { return Try.of(a); } } return null; }, Try::of, Cancellable::tryCancel); }
[ "public", "static", "<", "T", ">", "Promise", "<", "List", "<", "T", ">", ">", "nSuccessesOrLess", "(", "int", "n", ",", "Iterator", "<", "Promise", "<", "T", ">", ">", "promises", ")", "{", "return", "reduceEx", "(", "promises", ",", "a", "->", "n...
Returns a {@code List} of successfully completed {@code Promise}s. Length of returned {@code List} can't be greater than {@code n}.
[ "Returns", "a", "{" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/global-common/src/main/java/io/global/util/Utils.java#L31-L45
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java
DefaultRule.getDefaultSet
private JExpression getDefaultSet(JType fieldType, JsonNode node) { """ Creates a default value for a set property by: <ol> <li>Creating a new {@link LinkedHashSet} with the correct generic type <li>Using {@link Arrays#asList(Object...)} to initialize the set with the correct default values </ol> @param fieldType the java type that applies for this field ({@link Set} with some generic type argument) @param node the node containing default values for this set @return an expression that creates a default value that can be assigned to this field """ JClass setGenericType = ((JClass) fieldType).getTypeParameters().get(0); JClass setImplClass = fieldType.owner().ref(LinkedHashSet.class); setImplClass = setImplClass.narrow(setGenericType); JInvocation newSetImpl = JExpr._new(setImplClass); if (node instanceof ArrayNode && node.size() > 0) { JInvocation invokeAsList = fieldType.owner().ref(Arrays.class).staticInvoke("asList"); for (JsonNode defaultValue : node) { invokeAsList.arg(getDefaultValue(setGenericType, defaultValue)); } newSetImpl.arg(invokeAsList); } else if (!ruleFactory.getGenerationConfig().isInitializeCollections()) { return JExpr._null(); } return newSetImpl; }
java
private JExpression getDefaultSet(JType fieldType, JsonNode node) { JClass setGenericType = ((JClass) fieldType).getTypeParameters().get(0); JClass setImplClass = fieldType.owner().ref(LinkedHashSet.class); setImplClass = setImplClass.narrow(setGenericType); JInvocation newSetImpl = JExpr._new(setImplClass); if (node instanceof ArrayNode && node.size() > 0) { JInvocation invokeAsList = fieldType.owner().ref(Arrays.class).staticInvoke("asList"); for (JsonNode defaultValue : node) { invokeAsList.arg(getDefaultValue(setGenericType, defaultValue)); } newSetImpl.arg(invokeAsList); } else if (!ruleFactory.getGenerationConfig().isInitializeCollections()) { return JExpr._null(); } return newSetImpl; }
[ "private", "JExpression", "getDefaultSet", "(", "JType", "fieldType", ",", "JsonNode", "node", ")", "{", "JClass", "setGenericType", "=", "(", "(", "JClass", ")", "fieldType", ")", ".", "getTypeParameters", "(", ")", ".", "get", "(", "0", ")", ";", "JClass...
Creates a default value for a set property by: <ol> <li>Creating a new {@link LinkedHashSet} with the correct generic type <li>Using {@link Arrays#asList(Object...)} to initialize the set with the correct default values </ol> @param fieldType the java type that applies for this field ({@link Set} with some generic type argument) @param node the node containing default values for this set @return an expression that creates a default value that can be assigned to this field
[ "Creates", "a", "default", "value", "for", "a", "set", "property", "by", ":", "<ol", ">", "<li", ">", "Creating", "a", "new", "{", "@link", "LinkedHashSet", "}", "with", "the", "correct", "generic", "type", "<li", ">", "Using", "{", "@link", "Arrays#asLi...
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java#L221-L242
sdl/Testy
src/main/java/com/sdl/selenium/extjs3/grid/GridPanel.java
GridPanel.getRow
public String[] getRow(String searchText) { """ returns all text elements from a grid @param searchText searchText @return all text elements from a grid """ String[] rowElements = null; GridRow row = new GridRow(this, searchText, getSearchColumnId(), SearchType.CONTAINS); String text = row.getText(); if (text != null) { rowElements = text.split("\n"); } return rowElements; }
java
public String[] getRow(String searchText) { String[] rowElements = null; GridRow row = new GridRow(this, searchText, getSearchColumnId(), SearchType.CONTAINS); String text = row.getText(); if (text != null) { rowElements = text.split("\n"); } return rowElements; }
[ "public", "String", "[", "]", "getRow", "(", "String", "searchText", ")", "{", "String", "[", "]", "rowElements", "=", "null", ";", "GridRow", "row", "=", "new", "GridRow", "(", "this", ",", "searchText", ",", "getSearchColumnId", "(", ")", ",", "SearchT...
returns all text elements from a grid @param searchText searchText @return all text elements from a grid
[ "returns", "all", "text", "elements", "from", "a", "grid" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs3/grid/GridPanel.java#L523-L531
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionScopedRepetitionsInner.java
WorkflowRunActionScopedRepetitionsInner.listAsync
public Observable<WorkflowRunActionRepetitionDefinitionCollectionInner> listAsync(String resourceGroupName, String workflowName, String runName, String actionName) { """ List the workflow run action scoped repetitions. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param runName The workflow run name. @param actionName The workflow action name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowRunActionRepetitionDefinitionCollectionInner object """ return listWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName).map(new Func1<ServiceResponse<WorkflowRunActionRepetitionDefinitionCollectionInner>, WorkflowRunActionRepetitionDefinitionCollectionInner>() { @Override public WorkflowRunActionRepetitionDefinitionCollectionInner call(ServiceResponse<WorkflowRunActionRepetitionDefinitionCollectionInner> response) { return response.body(); } }); }
java
public Observable<WorkflowRunActionRepetitionDefinitionCollectionInner> listAsync(String resourceGroupName, String workflowName, String runName, String actionName) { return listWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName).map(new Func1<ServiceResponse<WorkflowRunActionRepetitionDefinitionCollectionInner>, WorkflowRunActionRepetitionDefinitionCollectionInner>() { @Override public WorkflowRunActionRepetitionDefinitionCollectionInner call(ServiceResponse<WorkflowRunActionRepetitionDefinitionCollectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowRunActionRepetitionDefinitionCollectionInner", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "runName", ",", "String", "actionName", ")", "{", "return", "listWithServiceResponseAsync...
List the workflow run action scoped repetitions. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param runName The workflow run name. @param actionName The workflow action name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowRunActionRepetitionDefinitionCollectionInner object
[ "List", "the", "workflow", "run", "action", "scoped", "repetitions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionScopedRepetitionsInner.java#L105-L112
b3log/latke
latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java
AbstractPlugin.getViewContent
private String getViewContent(final Map<String, Object> dataModel) { """ Gets view content of a plugin. The content is processed with the specified data model by template engine. @param dataModel the specified data model @return plugin view content """ if (null == configuration) { initTemplateEngineCfg(); } try { final Template template = configuration.getTemplate("plugin.ftl"); final StringWriter sw = new StringWriter(); template.process(dataModel, sw); return sw.toString(); } catch (final Exception e) { // This plugin has no view return ""; } }
java
private String getViewContent(final Map<String, Object> dataModel) { if (null == configuration) { initTemplateEngineCfg(); } try { final Template template = configuration.getTemplate("plugin.ftl"); final StringWriter sw = new StringWriter(); template.process(dataModel, sw); return sw.toString(); } catch (final Exception e) { // This plugin has no view return ""; } }
[ "private", "String", "getViewContent", "(", "final", "Map", "<", "String", ",", "Object", ">", "dataModel", ")", "{", "if", "(", "null", "==", "configuration", ")", "{", "initTemplateEngineCfg", "(", ")", ";", "}", "try", "{", "final", "Template", "templat...
Gets view content of a plugin. The content is processed with the specified data model by template engine. @param dataModel the specified data model @return plugin view content
[ "Gets", "view", "content", "of", "a", "plugin", ".", "The", "content", "is", "processed", "with", "the", "specified", "data", "model", "by", "template", "engine", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L356-L373
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/cloning/BasicCloner.java
BasicCloner.setImplementors
public void setImplementors(Map<Class<?>, CloneImplementor> implementors) { """ Sets CloneImplementors to be used. @param implementors The implementors """ // this.implementors = implementors; this.allImplementors = new HashMap<Class<?>, CloneImplementor>(); allImplementors.putAll(builtInImplementors); allImplementors.putAll(implementors); }
java
public void setImplementors(Map<Class<?>, CloneImplementor> implementors) { // this.implementors = implementors; this.allImplementors = new HashMap<Class<?>, CloneImplementor>(); allImplementors.putAll(builtInImplementors); allImplementors.putAll(implementors); }
[ "public", "void", "setImplementors", "(", "Map", "<", "Class", "<", "?", ">", ",", "CloneImplementor", ">", "implementors", ")", "{", "// this.implementors = implementors;", "this", ".", "allImplementors", "=", "new", "HashMap", "<", "Class", "<", "?", ">", ",...
Sets CloneImplementors to be used. @param implementors The implementors
[ "Sets", "CloneImplementors", "to", "be", "used", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/cloning/BasicCloner.java#L248-L254
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRQuatAnimation.java
GVRQuatAnimation.getKey
public void getKey(int keyIndex, Quaternionf q) { """ Returns the scaling factor as vector.<p> @param keyIndex the index of the scale key @return the scaling factor as vector """ int index = keyIndex * mFloatsPerKey; q.x = mKeys[index + 1]; q.y = mKeys[index + 2]; q.z = mKeys[index + 3]; q.w = mKeys[index + 4]; }
java
public void getKey(int keyIndex, Quaternionf q) { int index = keyIndex * mFloatsPerKey; q.x = mKeys[index + 1]; q.y = mKeys[index + 2]; q.z = mKeys[index + 3]; q.w = mKeys[index + 4]; }
[ "public", "void", "getKey", "(", "int", "keyIndex", ",", "Quaternionf", "q", ")", "{", "int", "index", "=", "keyIndex", "*", "mFloatsPerKey", ";", "q", ".", "x", "=", "mKeys", "[", "index", "+", "1", "]", ";", "q", ".", "y", "=", "mKeys", "[", "i...
Returns the scaling factor as vector.<p> @param keyIndex the index of the scale key @return the scaling factor as vector
[ "Returns", "the", "scaling", "factor", "as", "vector", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRQuatAnimation.java#L83-L90
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/ObjectsApi.java
ObjectsApi.getPermissions
public GetPermissionsSuccessResponse getPermissions(String objectType, String dbids, String dnType, String folderType) throws ApiException { """ Get permissions for a list of objects. Get permissions from Configuration Server for objects identified by their type and DBIDs. @param objectType The type of object. Any type supported by the Config server (folders, business-attributes etc). (required) @param dbids Comma-separated list of object DBIDs to query permissions. (required) @param dnType If the object_type is &#39;dns&#39;, then you may specify the DN type (for example, CFGRoutingPoint). This parameter does not affect request results but may increase performance For possible values, see [CfgDNType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDNType) in the Platform SDK documentation. (optional) @param folderType If the object_type is &#39;folders&#39;, then you may specify the object type of the folders (for example, CFGPerson). This parameter does not affect request results but may increase performance For possible values, see [CfgObjectType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgObjectType) in the Platform SDK documentation. (optional) @return GetPermissionsSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<GetPermissionsSuccessResponse> resp = getPermissionsWithHttpInfo(objectType, dbids, dnType, folderType); return resp.getData(); }
java
public GetPermissionsSuccessResponse getPermissions(String objectType, String dbids, String dnType, String folderType) throws ApiException { ApiResponse<GetPermissionsSuccessResponse> resp = getPermissionsWithHttpInfo(objectType, dbids, dnType, folderType); return resp.getData(); }
[ "public", "GetPermissionsSuccessResponse", "getPermissions", "(", "String", "objectType", ",", "String", "dbids", ",", "String", "dnType", ",", "String", "folderType", ")", "throws", "ApiException", "{", "ApiResponse", "<", "GetPermissionsSuccessResponse", ">", "resp", ...
Get permissions for a list of objects. Get permissions from Configuration Server for objects identified by their type and DBIDs. @param objectType The type of object. Any type supported by the Config server (folders, business-attributes etc). (required) @param dbids Comma-separated list of object DBIDs to query permissions. (required) @param dnType If the object_type is &#39;dns&#39;, then you may specify the DN type (for example, CFGRoutingPoint). This parameter does not affect request results but may increase performance For possible values, see [CfgDNType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDNType) in the Platform SDK documentation. (optional) @param folderType If the object_type is &#39;folders&#39;, then you may specify the object type of the folders (for example, CFGPerson). This parameter does not affect request results but may increase performance For possible values, see [CfgObjectType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgObjectType) in the Platform SDK documentation. (optional) @return GetPermissionsSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "permissions", "for", "a", "list", "of", "objects", ".", "Get", "permissions", "from", "Configuration", "Server", "for", "objects", "identified", "by", "their", "type", "and", "DBIDs", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/ObjectsApi.java#L349-L352
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.countUsers
long countUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException { """ Counts the total number of users which fit the given criteria.<p> @param dbc the database context @param searchParams the user search criteria @return the total number of users matching the criteria @throws CmsDataAccessException if something goes wrong """ return getUserDriver(dbc).countUsers(dbc, searchParams); }
java
long countUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException { return getUserDriver(dbc).countUsers(dbc, searchParams); }
[ "long", "countUsers", "(", "CmsDbContext", "dbc", ",", "CmsUserSearchParameters", "searchParams", ")", "throws", "CmsDataAccessException", "{", "return", "getUserDriver", "(", "dbc", ")", ".", "countUsers", "(", "dbc", ",", "searchParams", ")", ";", "}" ]
Counts the total number of users which fit the given criteria.<p> @param dbc the database context @param searchParams the user search criteria @return the total number of users matching the criteria @throws CmsDataAccessException if something goes wrong
[ "Counts", "the", "total", "number", "of", "users", "which", "fit", "the", "given", "criteria", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10637-L10640
jenkinsci/jenkins
core/src/main/java/hudson/Util.java
Util.ensureEndsWith
@Nullable public static String ensureEndsWith(@CheckForNull String subject, @CheckForNull String suffix) { """ Ensure string ends with suffix @param subject Examined string @param suffix Desired suffix @return Original subject in case it already ends with suffix, null in case subject was null and subject + suffix otherwise. @since 1.505 """ if (subject == null) return null; if (subject.endsWith(suffix)) return subject; return subject + suffix; }
java
@Nullable public static String ensureEndsWith(@CheckForNull String subject, @CheckForNull String suffix) { if (subject == null) return null; if (subject.endsWith(suffix)) return subject; return subject + suffix; }
[ "@", "Nullable", "public", "static", "String", "ensureEndsWith", "(", "@", "CheckForNull", "String", "subject", ",", "@", "CheckForNull", "String", "suffix", ")", "{", "if", "(", "subject", "==", "null", ")", "return", "null", ";", "if", "(", "subject", "....
Ensure string ends with suffix @param subject Examined string @param suffix Desired suffix @return Original subject in case it already ends with suffix, null in case subject was null and subject + suffix otherwise. @since 1.505
[ "Ensure", "string", "ends", "with", "suffix" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L578-L586
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java
AbstractEntityReader.onParseRelation
private void onParseRelation(Object entity, final PersistenceDelegator pd, EntityMetadata targetEntityMetadata, Object relationEntity, Relation relation, boolean lazilyloaded, Map<Object, Object> relationStack) { """ Invokes parseRelations for relation entity and set relational entity within entity @param entity @param pd @param targetEntityMetadata @param relationEntity @param relation @param lazilyloaded @param relationStack """ parseRelations(entity, getEntity(relationEntity), getPersistedRelations(relationEntity), pd, targetEntityMetadata, lazilyloaded, relationStack); // if relation ship is unary, no problem else we need to add setRelationToEntity(entity, relationEntity, relation); }
java
private void onParseRelation(Object entity, final PersistenceDelegator pd, EntityMetadata targetEntityMetadata, Object relationEntity, Relation relation, boolean lazilyloaded, Map<Object, Object> relationStack) { parseRelations(entity, getEntity(relationEntity), getPersistedRelations(relationEntity), pd, targetEntityMetadata, lazilyloaded, relationStack); // if relation ship is unary, no problem else we need to add setRelationToEntity(entity, relationEntity, relation); }
[ "private", "void", "onParseRelation", "(", "Object", "entity", ",", "final", "PersistenceDelegator", "pd", ",", "EntityMetadata", "targetEntityMetadata", ",", "Object", "relationEntity", ",", "Relation", "relation", ",", "boolean", "lazilyloaded", ",", "Map", "<", "...
Invokes parseRelations for relation entity and set relational entity within entity @param entity @param pd @param targetEntityMetadata @param relationEntity @param relation @param lazilyloaded @param relationStack
[ "Invokes", "parseRelations", "for", "relation", "entity", "and", "set", "relational", "entity", "within", "entity" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java#L258-L266
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.collectNested
public static List collectNested(Collection self, Closure transform) { """ Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer. Returns a potentially nested list of transformed values. <pre class="groovyTestCase"> assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 } </pre> @param self a collection @param transform the closure used to transform each item of the collection @return the resultant collection @since 1.8.1 """ return (List) collectNested((Iterable) self, new ArrayList(self.size()), transform); }
java
public static List collectNested(Collection self, Closure transform) { return (List) collectNested((Iterable) self, new ArrayList(self.size()), transform); }
[ "public", "static", "List", "collectNested", "(", "Collection", "self", ",", "Closure", "transform", ")", "{", "return", "(", "List", ")", "collectNested", "(", "(", "Iterable", ")", "self", ",", "new", "ArrayList", "(", "self", ".", "size", "(", ")", ")...
Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer. Returns a potentially nested list of transformed values. <pre class="groovyTestCase"> assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 } </pre> @param self a collection @param transform the closure used to transform each item of the collection @return the resultant collection @since 1.8.1
[ "Recursively", "iterates", "through", "this", "collection", "transforming", "each", "non", "-", "Collection", "value", "into", "a", "new", "value", "using", "the", "closure", "as", "a", "transformer", ".", "Returns", "a", "potentially", "nested", "list", "of", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3686-L3688
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateNotEmptyAndEqual
public static void validateNotEmptyAndEqual(Object t1, Object t2, String errorMsg) throws ValidateException { """ 验证是否非空且与指定值相等<br> 当数据为空时抛出验证异常<br> 当两值不等时抛出异常 @param t1 对象1 @param t2 对象2 @param errorMsg 错误信息 @throws ValidateException 验证异常 """ validateNotEmpty(t1, errorMsg); validateEqual(t1, t2, errorMsg); }
java
public static void validateNotEmptyAndEqual(Object t1, Object t2, String errorMsg) throws ValidateException { validateNotEmpty(t1, errorMsg); validateEqual(t1, t2, errorMsg); }
[ "public", "static", "void", "validateNotEmptyAndEqual", "(", "Object", "t1", ",", "Object", "t2", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "validateNotEmpty", "(", "t1", ",", "errorMsg", ")", ";", "validateEqual", "(", "t1", ",", "t2...
验证是否非空且与指定值相等<br> 当数据为空时抛出验证异常<br> 当两值不等时抛出异常 @param t1 对象1 @param t2 对象2 @param errorMsg 错误信息 @throws ValidateException 验证异常
[ "验证是否非空且与指定值相等<br", ">", "当数据为空时抛出验证异常<br", ">", "当两值不等时抛出异常" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L279-L282
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicylabel.java
appflowpolicylabel.get
public static appflowpolicylabel get(nitro_service service, String labelname) throws Exception { """ Use this API to fetch appflowpolicylabel resource of given name . """ appflowpolicylabel obj = new appflowpolicylabel(); obj.set_labelname(labelname); appflowpolicylabel response = (appflowpolicylabel) obj.get_resource(service); return response; }
java
public static appflowpolicylabel get(nitro_service service, String labelname) throws Exception{ appflowpolicylabel obj = new appflowpolicylabel(); obj.set_labelname(labelname); appflowpolicylabel response = (appflowpolicylabel) obj.get_resource(service); return response; }
[ "public", "static", "appflowpolicylabel", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "appflowpolicylabel", "obj", "=", "new", "appflowpolicylabel", "(", ")", ";", "obj", ".", "set_labelname", "(", "labelnam...
Use this API to fetch appflowpolicylabel resource of given name .
[ "Use", "this", "API", "to", "fetch", "appflowpolicylabel", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicylabel.java#L349-L354
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.toTimestamp
public static Long toTimestamp(String dateStr, TimeZone tz) { """ Parse date time string to timestamp based on the given time zone and "yyyy-MM-dd HH:mm:ss" format. Returns null if parsing failed. @param dateStr the date time string @param tz the time zone """ int length = dateStr.length(); String format; if (length == 21) { format = DEFAULT_DATETIME_FORMATS[1]; } else if (length == 22) { format = DEFAULT_DATETIME_FORMATS[2]; } else if (length == 23) { format = DEFAULT_DATETIME_FORMATS[3]; } else { // otherwise fall back to the default format = DEFAULT_DATETIME_FORMATS[0]; } return toTimestamp(dateStr, format, tz); }
java
public static Long toTimestamp(String dateStr, TimeZone tz) { int length = dateStr.length(); String format; if (length == 21) { format = DEFAULT_DATETIME_FORMATS[1]; } else if (length == 22) { format = DEFAULT_DATETIME_FORMATS[2]; } else if (length == 23) { format = DEFAULT_DATETIME_FORMATS[3]; } else { // otherwise fall back to the default format = DEFAULT_DATETIME_FORMATS[0]; } return toTimestamp(dateStr, format, tz); }
[ "public", "static", "Long", "toTimestamp", "(", "String", "dateStr", ",", "TimeZone", "tz", ")", "{", "int", "length", "=", "dateStr", ".", "length", "(", ")", ";", "String", "format", ";", "if", "(", "length", "==", "21", ")", "{", "format", "=", "D...
Parse date time string to timestamp based on the given time zone and "yyyy-MM-dd HH:mm:ss" format. Returns null if parsing failed. @param dateStr the date time string @param tz the time zone
[ "Parse", "date", "time", "string", "to", "timestamp", "based", "on", "the", "given", "time", "zone", "and", "yyyy", "-", "MM", "-", "dd", "HH", ":", "mm", ":", "ss", "format", ".", "Returns", "null", "if", "parsing", "failed", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L247-L261
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java
CPDisplayLayoutPersistenceImpl.removeByC_C
@Override public CPDisplayLayout removeByC_C(long classNameId, long classPK) throws NoSuchCPDisplayLayoutException { """ Removes the cp display layout where classNameId = &#63; and classPK = &#63; from the database. @param classNameId the class name ID @param classPK the class pk @return the cp display layout that was removed """ CPDisplayLayout cpDisplayLayout = findByC_C(classNameId, classPK); return remove(cpDisplayLayout); }
java
@Override public CPDisplayLayout removeByC_C(long classNameId, long classPK) throws NoSuchCPDisplayLayoutException { CPDisplayLayout cpDisplayLayout = findByC_C(classNameId, classPK); return remove(cpDisplayLayout); }
[ "@", "Override", "public", "CPDisplayLayout", "removeByC_C", "(", "long", "classNameId", ",", "long", "classPK", ")", "throws", "NoSuchCPDisplayLayoutException", "{", "CPDisplayLayout", "cpDisplayLayout", "=", "findByC_C", "(", "classNameId", ",", "classPK", ")", ";",...
Removes the cp display layout where classNameId = &#63; and classPK = &#63; from the database. @param classNameId the class name ID @param classPK the class pk @return the cp display layout that was removed
[ "Removes", "the", "cp", "display", "layout", "where", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L1633-L1639
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java
CmsColor.setHSV
public void setHSV(int hue, int sat, int val) throws Exception { """ Set the Hue, Saturation and Value (Brightness) variables.<p> @param hue hue - valid range is 0-359 @param sat saturation - valid range is 0-100 @param val brightness - valid range is 0-100 @throws java.lang.Exception if something goes wrong """ if ((hue < 0) || (hue > 360)) { throw new Exception(); } if ((sat < 0) || (sat > 100)) { throw new Exception(); } if ((val < 0) || (val > 100)) { throw new Exception(); } m_hue = hue; m_sat = (float)sat / 100; m_bri = (float)val / 100; HSVtoRGB(m_hue, m_sat, m_bri); setHex(); }
java
public void setHSV(int hue, int sat, int val) throws Exception { if ((hue < 0) || (hue > 360)) { throw new Exception(); } if ((sat < 0) || (sat > 100)) { throw new Exception(); } if ((val < 0) || (val > 100)) { throw new Exception(); } m_hue = hue; m_sat = (float)sat / 100; m_bri = (float)val / 100; HSVtoRGB(m_hue, m_sat, m_bri); setHex(); }
[ "public", "void", "setHSV", "(", "int", "hue", ",", "int", "sat", ",", "int", "val", ")", "throws", "Exception", "{", "if", "(", "(", "hue", "<", "0", ")", "||", "(", "hue", ">", "360", ")", ")", "{", "throw", "new", "Exception", "(", ")", ";",...
Set the Hue, Saturation and Value (Brightness) variables.<p> @param hue hue - valid range is 0-359 @param sat saturation - valid range is 0-100 @param val brightness - valid range is 0-100 @throws java.lang.Exception if something goes wrong
[ "Set", "the", "Hue", "Saturation", "and", "Value", "(", "Brightness", ")", "variables", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java#L143-L162
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java
PersistenceController.updateStoreForSentError
public Observable<Boolean> updateStoreForSentError(String conversationId, String tempId, String profileId) { """ Insert 'error' message status if sending message failed. @param conversationId Unique conversation id. @param tempId Id of an temporary message for which @param profileId Profile id from current session data. @return Observable emitting result. """ return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); boolean isSuccess = store.update(ChatMessageStatus.builder().populate(conversationId, tempId, profileId, LocalMessageStatus.error, System.currentTimeMillis(), null).build()); store.endTransaction(); emitter.onNext(isSuccess); emitter.onCompleted(); } }); }
java
public Observable<Boolean> updateStoreForSentError(String conversationId, String tempId, String profileId) { return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); boolean isSuccess = store.update(ChatMessageStatus.builder().populate(conversationId, tempId, profileId, LocalMessageStatus.error, System.currentTimeMillis(), null).build()); store.endTransaction(); emitter.onNext(isSuccess); emitter.onCompleted(); } }); }
[ "public", "Observable", "<", "Boolean", ">", "updateStoreForSentError", "(", "String", "conversationId", ",", "String", "tempId", ",", "String", "profileId", ")", "{", "return", "asObservable", "(", "new", "Executor", "<", "Boolean", ">", "(", ")", "{", "@", ...
Insert 'error' message status if sending message failed. @param conversationId Unique conversation id. @param tempId Id of an temporary message for which @param profileId Profile id from current session data. @return Observable emitting result.
[ "Insert", "error", "message", "status", "if", "sending", "message", "failed", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L305-L317
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addMemberDesc
protected void addMemberDesc(MemberDoc member, Content contentTree) { """ Add description about the Static Varible/Method/Constructor for a member. @param member MemberDoc for the member within the Class Kind @param contentTree the content tree to which the member description will be added """ ClassDoc containing = member.containingClass(); String classdesc = utils.getTypeName( configuration, containing, true) + " "; if (member.isField()) { if (member.isStatic()) { contentTree.addContent( getResource("doclet.Static_variable_in", classdesc)); } else { contentTree.addContent( getResource("doclet.Variable_in", classdesc)); } } else if (member.isConstructor()) { contentTree.addContent( getResource("doclet.Constructor_for", classdesc)); } else if (member.isMethod()) { if (member.isStatic()) { contentTree.addContent( getResource("doclet.Static_method_in", classdesc)); } else { contentTree.addContent( getResource("doclet.Method_in", classdesc)); } } addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing, false, contentTree); }
java
protected void addMemberDesc(MemberDoc member, Content contentTree) { ClassDoc containing = member.containingClass(); String classdesc = utils.getTypeName( configuration, containing, true) + " "; if (member.isField()) { if (member.isStatic()) { contentTree.addContent( getResource("doclet.Static_variable_in", classdesc)); } else { contentTree.addContent( getResource("doclet.Variable_in", classdesc)); } } else if (member.isConstructor()) { contentTree.addContent( getResource("doclet.Constructor_for", classdesc)); } else if (member.isMethod()) { if (member.isStatic()) { contentTree.addContent( getResource("doclet.Static_method_in", classdesc)); } else { contentTree.addContent( getResource("doclet.Method_in", classdesc)); } } addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing, false, contentTree); }
[ "protected", "void", "addMemberDesc", "(", "MemberDoc", "member", ",", "Content", "contentTree", ")", "{", "ClassDoc", "containing", "=", "member", ".", "containingClass", "(", ")", ";", "String", "classdesc", "=", "utils", ".", "getTypeName", "(", "configuratio...
Add description about the Static Varible/Method/Constructor for a member. @param member MemberDoc for the member within the Class Kind @param contentTree the content tree to which the member description will be added
[ "Add", "description", "about", "the", "Static", "Varible", "/", "Method", "/", "Constructor", "for", "a", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L327-L353
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/Type.java
Type.getTypeArgument
protected static Type getTypeArgument(GenericType type, int index) { """ Get the associated type of the generic type based on the generic type parameters. If the type is not generic or has no resolvable type params, then {@link Type#OBJECT_TYPE} is returned. @param type The generic type @param index The index of the type argument @return The element type """ GenericType arg = type.getTypeArgument(index); if (arg != null) { return new Type(arg); } // unknown type, so return object return Type.OBJECT_TYPE; }
java
protected static Type getTypeArgument(GenericType type, int index) { GenericType arg = type.getTypeArgument(index); if (arg != null) { return new Type(arg); } // unknown type, so return object return Type.OBJECT_TYPE; }
[ "protected", "static", "Type", "getTypeArgument", "(", "GenericType", "type", ",", "int", "index", ")", "{", "GenericType", "arg", "=", "type", ".", "getTypeArgument", "(", "index", ")", ";", "if", "(", "arg", "!=", "null", ")", "{", "return", "new", "Ty...
Get the associated type of the generic type based on the generic type parameters. If the type is not generic or has no resolvable type params, then {@link Type#OBJECT_TYPE} is returned. @param type The generic type @param index The index of the type argument @return The element type
[ "Get", "the", "associated", "type", "of", "the", "generic", "type", "based", "on", "the", "generic", "type", "parameters", ".", "If", "the", "type", "is", "not", "generic", "or", "has", "no", "resolvable", "type", "params", "then", "{", "@link", "Type#OBJE...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Type.java#L789-L797
galan/commons
src/main/java/de/galan/commons/util/MessageBox.java
MessageBox.printBox
public static void printBox(String title, String message) { """ Prints a box with the given title and message to the logger, the title can be omitted. """ printBox(title, Splitter.on(LINEBREAK).splitToList(message)); }
java
public static void printBox(String title, String message) { printBox(title, Splitter.on(LINEBREAK).splitToList(message)); }
[ "public", "static", "void", "printBox", "(", "String", "title", ",", "String", "message", ")", "{", "printBox", "(", "title", ",", "Splitter", ".", "on", "(", "LINEBREAK", ")", ".", "splitToList", "(", "message", ")", ")", ";", "}" ]
Prints a box with the given title and message to the logger, the title can be omitted.
[ "Prints", "a", "box", "with", "the", "given", "title", "and", "message", "to", "the", "logger", "the", "title", "can", "be", "omitted", "." ]
train
https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/util/MessageBox.java#L26-L28
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.setRGB_fromDouble_preserveAlpha
public Pixel setRGB_fromDouble_preserveAlpha(double r, double g, double b) { """ Sets an RGB value at the position currently referenced by this Pixel. The present alpha value will not be altered by this operation. <br> Each channel value is assumed to be within [0.0 .. 1.0]. Channel values outside these bounds will be clamped to them. @param r normalized red @param g normalized green @param b normalized blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setRGB_preserveAlpha(int, int, int) @since 1.2 """ return setValue((getValue() & 0xff000000) | (0x00ffffff & Pixel.rgb_fromNormalized(r, g, b))); }
java
public Pixel setRGB_fromDouble_preserveAlpha(double r, double g, double b){ return setValue((getValue() & 0xff000000) | (0x00ffffff & Pixel.rgb_fromNormalized(r, g, b))); }
[ "public", "Pixel", "setRGB_fromDouble_preserveAlpha", "(", "double", "r", ",", "double", "g", ",", "double", "b", ")", "{", "return", "setValue", "(", "(", "getValue", "(", ")", "&", "0xff000000", ")", "|", "(", "0x00ffffff", "&", "Pixel", ".", "rgb_fromNo...
Sets an RGB value at the position currently referenced by this Pixel. The present alpha value will not be altered by this operation. <br> Each channel value is assumed to be within [0.0 .. 1.0]. Channel values outside these bounds will be clamped to them. @param r normalized red @param g normalized green @param b normalized blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setRGB_preserveAlpha(int, int, int) @since 1.2
[ "Sets", "an", "RGB", "value", "at", "the", "position", "currently", "referenced", "by", "this", "Pixel", ".", "The", "present", "alpha", "value", "will", "not", "be", "altered", "by", "this", "operation", ".", "<br", ">", "Each", "channel", "value", "is", ...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L447-L449
weld/core
environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/Listener.java
Listener.using
public static Listener using(ContainerInstance container) { """ Creates a new Listener that uses the given {@link ContainerInstance} (e.g. {@link org.jboss.weld.environment.se.WeldContainer}) instead of initializing a new Weld container instance. The listener does not take over the responsibility for container instance lifecycle management. It is the caller's responsibility to shut down the container instance properly. The listener will not shut down the container instance when the Servlet context is destroyed. @param container the container instance to be used @return a new Listener instance """ return new Listener(Collections.singletonList(initAction(CONTAINER_ATTRIBUTE_NAME, container))); }
java
public static Listener using(ContainerInstance container) { return new Listener(Collections.singletonList(initAction(CONTAINER_ATTRIBUTE_NAME, container))); }
[ "public", "static", "Listener", "using", "(", "ContainerInstance", "container", ")", "{", "return", "new", "Listener", "(", "Collections", ".", "singletonList", "(", "initAction", "(", "CONTAINER_ATTRIBUTE_NAME", ",", "container", ")", ")", ")", ";", "}" ]
Creates a new Listener that uses the given {@link ContainerInstance} (e.g. {@link org.jboss.weld.environment.se.WeldContainer}) instead of initializing a new Weld container instance. The listener does not take over the responsibility for container instance lifecycle management. It is the caller's responsibility to shut down the container instance properly. The listener will not shut down the container instance when the Servlet context is destroyed. @param container the container instance to be used @return a new Listener instance
[ "Creates", "a", "new", "Listener", "that", "uses", "the", "given", "{", "@link", "ContainerInstance", "}", "(", "e", ".", "g", ".", "{", "@link", "org", ".", "jboss", ".", "weld", ".", "environment", ".", "se", ".", "WeldContainer", "}", ")", "instead"...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/Listener.java#L74-L76
pravega/pravega
common/src/main/java/io/pravega/common/concurrent/Futures.java
Futures.exceptionListener
public static <T> void exceptionListener(CompletableFuture<T> completableFuture, Consumer<Throwable> exceptionListener) { """ Registers an exception listener to the given CompletableFuture. @param completableFuture The Future to register to. @param exceptionListener The Listener to register. @param <T> The Type of the future's result. """ completableFuture.whenComplete((r, ex) -> { if (ex != null) { Callbacks.invokeSafely(exceptionListener, ex, null); } }); }
java
public static <T> void exceptionListener(CompletableFuture<T> completableFuture, Consumer<Throwable> exceptionListener) { completableFuture.whenComplete((r, ex) -> { if (ex != null) { Callbacks.invokeSafely(exceptionListener, ex, null); } }); }
[ "public", "static", "<", "T", ">", "void", "exceptionListener", "(", "CompletableFuture", "<", "T", ">", "completableFuture", ",", "Consumer", "<", "Throwable", ">", "exceptionListener", ")", "{", "completableFuture", ".", "whenComplete", "(", "(", "r", ",", "...
Registers an exception listener to the given CompletableFuture. @param completableFuture The Future to register to. @param exceptionListener The Listener to register. @param <T> The Type of the future's result.
[ "Registers", "an", "exception", "listener", "to", "the", "given", "CompletableFuture", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Futures.java#L237-L243
Chorus-bdd/Chorus
interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java
HandlerManager.processStartOfScope
public void processStartOfScope(Scope scopeStarting, Iterable<Object> handlerInstances) throws Exception { """ Scope is starting, perform the required processing on the supplied handlers. """ for (Object handler : handlerInstances) { Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class); Scope handlerScope = handlerAnnotation.scope(); injectResourceFieldsForScope(scopeStarting, handler, handlerScope, handlerInstances); runLifecycleMethods(handler, handlerScope, scopeStarting, false); } }
java
public void processStartOfScope(Scope scopeStarting, Iterable<Object> handlerInstances) throws Exception { for (Object handler : handlerInstances) { Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class); Scope handlerScope = handlerAnnotation.scope(); injectResourceFieldsForScope(scopeStarting, handler, handlerScope, handlerInstances); runLifecycleMethods(handler, handlerScope, scopeStarting, false); } }
[ "public", "void", "processStartOfScope", "(", "Scope", "scopeStarting", ",", "Iterable", "<", "Object", ">", "handlerInstances", ")", "throws", "Exception", "{", "for", "(", "Object", "handler", ":", "handlerInstances", ")", "{", "Handler", "handlerAnnotation", "=...
Scope is starting, perform the required processing on the supplied handlers.
[ "Scope", "is", "starting", "perform", "the", "required", "processing", "on", "the", "supplied", "handlers", "." ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java#L117-L125
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPdfWriter.java
MPdfWriter.renderList
protected void renderList(final MBasicTable table, final Table datatable) throws BadElementException { """ Effectue le rendu de la liste. @param table MBasicTable @param datatable Table @throws BadElementException e """ final int columnCount = table.getColumnCount(); final int rowCount = table.getRowCount(); // data rows final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL); datatable.getDefaultCell().setBorderWidth(1); datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // datatable.setDefaultCellGrayFill(0); Object value; String text; int horizontalAlignment; for (int k = 0; k < rowCount; k++) { for (int i = 0; i < columnCount; i++) { value = getValueAt(table, k, i); if (value instanceof Number || value instanceof Date) { horizontalAlignment = Element.ALIGN_RIGHT; } else if (value instanceof Boolean) { horizontalAlignment = Element.ALIGN_CENTER; } else { horizontalAlignment = Element.ALIGN_LEFT; } datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignment); text = getTextAt(table, k, i); datatable.addCell(new Phrase(8, text != null ? text : "", font)); } } }
java
protected void renderList(final MBasicTable table, final Table datatable) throws BadElementException { final int columnCount = table.getColumnCount(); final int rowCount = table.getRowCount(); // data rows final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL); datatable.getDefaultCell().setBorderWidth(1); datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // datatable.setDefaultCellGrayFill(0); Object value; String text; int horizontalAlignment; for (int k = 0; k < rowCount; k++) { for (int i = 0; i < columnCount; i++) { value = getValueAt(table, k, i); if (value instanceof Number || value instanceof Date) { horizontalAlignment = Element.ALIGN_RIGHT; } else if (value instanceof Boolean) { horizontalAlignment = Element.ALIGN_CENTER; } else { horizontalAlignment = Element.ALIGN_LEFT; } datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignment); text = getTextAt(table, k, i); datatable.addCell(new Phrase(8, text != null ? text : "", font)); } } }
[ "protected", "void", "renderList", "(", "final", "MBasicTable", "table", ",", "final", "Table", "datatable", ")", "throws", "BadElementException", "{", "final", "int", "columnCount", "=", "table", ".", "getColumnCount", "(", ")", ";", "final", "int", "rowCount",...
Effectue le rendu de la liste. @param table MBasicTable @param datatable Table @throws BadElementException e
[ "Effectue", "le", "rendu", "de", "la", "liste", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPdfWriter.java#L289-L316
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java
TasksInner.getDetailsAsync
public Observable<TaskInner> getDetailsAsync(String resourceGroupName, String registryName, String taskName) { """ Returns a task with extended information that includes all secrets. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TaskInner object """ return getDetailsWithServiceResponseAsync(resourceGroupName, registryName, taskName).map(new Func1<ServiceResponse<TaskInner>, TaskInner>() { @Override public TaskInner call(ServiceResponse<TaskInner> response) { return response.body(); } }); }
java
public Observable<TaskInner> getDetailsAsync(String resourceGroupName, String registryName, String taskName) { return getDetailsWithServiceResponseAsync(resourceGroupName, registryName, taskName).map(new Func1<ServiceResponse<TaskInner>, TaskInner>() { @Override public TaskInner call(ServiceResponse<TaskInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TaskInner", ">", "getDetailsAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "taskName", ")", "{", "return", "getDetailsWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", ...
Returns a task with extended information that includes all secrets. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TaskInner object
[ "Returns", "a", "task", "with", "extended", "information", "that", "includes", "all", "secrets", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java#L888-L895
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java
DiscoverInfo.hasIdentity
public boolean hasIdentity(String category, String type) { """ Returns true if this DiscoverInfo contains at least one Identity of the given category and type. @param category the category to look for. @param type the type to look for. @return true if this DiscoverInfo contains a Identity of the given category and type. """ String key = XmppStringUtils.generateKey(category, type); return identitiesSet.contains(key); }
java
public boolean hasIdentity(String category, String type) { String key = XmppStringUtils.generateKey(category, type); return identitiesSet.contains(key); }
[ "public", "boolean", "hasIdentity", "(", "String", "category", ",", "String", "type", ")", "{", "String", "key", "=", "XmppStringUtils", ".", "generateKey", "(", "category", ",", "type", ")", ";", "return", "identitiesSet", ".", "contains", "(", "key", ")", ...
Returns true if this DiscoverInfo contains at least one Identity of the given category and type. @param category the category to look for. @param type the type to look for. @return true if this DiscoverInfo contains a Identity of the given category and type.
[ "Returns", "true", "if", "this", "DiscoverInfo", "contains", "at", "least", "one", "Identity", "of", "the", "given", "category", "and", "type", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/packet/DiscoverInfo.java#L159-L162
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemLinkMap.java
ItemLinkMap.put
public final void put(long key, AbstractItemLink link) { """ Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced. @param key key with which the specified value is to be associated. @param link link to be associated with the specified key. """ // 666212 starts // we do not want to contest the monitor. If the lockObject is null we // will lazily initialize it. if (null == _entry) { // we need to synchronize on the monitor to ensure that we are not // in a race to lazily initialize synchronized ( _entryCreationLock ) { if ( null == _entry ){ _entry = new AbstractItemLink[_linkCapacity.intValue()]; } } } // 666212 ends synchronized (_getLock(key)) { // NOTE: this pushes the new entry onto the front of the list. Means we // will retrieve in lifo order. This may not be optimal int i = _indexOfKey(key); AbstractItemLink nextEntry = _entry[i]; _entry[i] = link; link.setNextMappedLink(nextEntry); _size.incrementAndGet(); // Defect 597160 } }
java
public final void put(long key, AbstractItemLink link) { // 666212 starts // we do not want to contest the monitor. If the lockObject is null we // will lazily initialize it. if (null == _entry) { // we need to synchronize on the monitor to ensure that we are not // in a race to lazily initialize synchronized ( _entryCreationLock ) { if ( null == _entry ){ _entry = new AbstractItemLink[_linkCapacity.intValue()]; } } } // 666212 ends synchronized (_getLock(key)) { // NOTE: this pushes the new entry onto the front of the list. Means we // will retrieve in lifo order. This may not be optimal int i = _indexOfKey(key); AbstractItemLink nextEntry = _entry[i]; _entry[i] = link; link.setNextMappedLink(nextEntry); _size.incrementAndGet(); // Defect 597160 } }
[ "public", "final", "void", "put", "(", "long", "key", ",", "AbstractItemLink", "link", ")", "{", "// 666212 starts", "// we do not want to contest the monitor. If the lockObject is null we", "// will lazily initialize it.", "if", "(", "null", "==", "_entry", ")", "{", "//...
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced. @param key key with which the specified value is to be associated. @param link link to be associated with the specified key.
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "this", "map", ".", "If", "the", "map", "previously", "contained", "a", "mapping", "for", "this", "key", "the", "old", "value", "is", "replaced", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemLinkMap.java#L256-L285
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopFactory.java
ScopFactory.getSCOP
public static ScopDatabase getSCOP(String version, boolean forceLocalData) { """ Gets an instance of the specified scop version. <p> The particular implementation returned is influenced by the <tt>forceLocalData</tt> parameter. When false, the instance returned will generally be a {@link RemoteScopInstallation}, although this may be influenced by previous calls to this class. When true, the result is guaranteed to implement {@link LocalScopDatabase} (generally a {@link BerkeleyScopInstallation}). <p> Note that @param version A version number, such as {@link #VERSION_1_75A} @param forceLocalData Whether to use a local installation or a remote installation @return an """ if( version == null ) { version = defaultVersion; } ScopDatabase scop = versionedScopDBs.get(version); if ( forceLocalData) { // Use a local installation if( scop == null || !(scop instanceof LocalScopDatabase) ) { logger.info("Creating new {}, version {}", BerkeleyScopInstallation.class.getSimpleName(), version); BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation(); berkeley.setScopVersion(version); versionedScopDBs.put(version,berkeley); return berkeley; } return scop; } else { // Use a remote installation if( scop == null ) { logger.info("Creating new {}, version {}", RemoteScopInstallation.class.getSimpleName(), version); scop = new RemoteScopInstallation(); scop.setScopVersion(version); versionedScopDBs.put(version,scop); } return scop; } }
java
public static ScopDatabase getSCOP(String version, boolean forceLocalData){ if( version == null ) { version = defaultVersion; } ScopDatabase scop = versionedScopDBs.get(version); if ( forceLocalData) { // Use a local installation if( scop == null || !(scop instanceof LocalScopDatabase) ) { logger.info("Creating new {}, version {}", BerkeleyScopInstallation.class.getSimpleName(), version); BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation(); berkeley.setScopVersion(version); versionedScopDBs.put(version,berkeley); return berkeley; } return scop; } else { // Use a remote installation if( scop == null ) { logger.info("Creating new {}, version {}", RemoteScopInstallation.class.getSimpleName(), version); scop = new RemoteScopInstallation(); scop.setScopVersion(version); versionedScopDBs.put(version,scop); } return scop; } }
[ "public", "static", "ScopDatabase", "getSCOP", "(", "String", "version", ",", "boolean", "forceLocalData", ")", "{", "if", "(", "version", "==", "null", ")", "{", "version", "=", "defaultVersion", ";", "}", "ScopDatabase", "scop", "=", "versionedScopDBs", ".",...
Gets an instance of the specified scop version. <p> The particular implementation returned is influenced by the <tt>forceLocalData</tt> parameter. When false, the instance returned will generally be a {@link RemoteScopInstallation}, although this may be influenced by previous calls to this class. When true, the result is guaranteed to implement {@link LocalScopDatabase} (generally a {@link BerkeleyScopInstallation}). <p> Note that @param version A version number, such as {@link #VERSION_1_75A} @param forceLocalData Whether to use a local installation or a remote installation @return an
[ "Gets", "an", "instance", "of", "the", "specified", "scop", "version", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopFactory.java#L136-L161
xqbase/util
util/src/main/java/com/xqbase/util/Bytes.java
Bytes.toInt
public static int toInt(byte[] b, int off, boolean littleEndian) { """ Retrieve an <b>int</b> from a byte array in a given byte order """ if (littleEndian) { return (b[off] & 0xFF) | ((b[off + 1] & 0xFF) << 8) | ((b[off + 2] & 0xFF) << 16) | ((b[off + 3] & 0xFF) << 24); } return ((b[off] & 0xFF) << 24) | ((b[off + 1] & 0xFF) << 16) | ((b[off + 2] & 0xFF) << 8) | (b[off + 3] & 0xFF); }
java
public static int toInt(byte[] b, int off, boolean littleEndian) { if (littleEndian) { return (b[off] & 0xFF) | ((b[off + 1] & 0xFF) << 8) | ((b[off + 2] & 0xFF) << 16) | ((b[off + 3] & 0xFF) << 24); } return ((b[off] & 0xFF) << 24) | ((b[off + 1] & 0xFF) << 16) | ((b[off + 2] & 0xFF) << 8) | (b[off + 3] & 0xFF); }
[ "public", "static", "int", "toInt", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "boolean", "littleEndian", ")", "{", "if", "(", "littleEndian", ")", "{", "return", "(", "b", "[", "off", "]", "&", "0xFF", ")", "|", "(", "(", "b", "[", "o...
Retrieve an <b>int</b> from a byte array in a given byte order
[ "Retrieve", "an", "<b", ">", "int<", "/", "b", ">", "from", "a", "byte", "array", "in", "a", "given", "byte", "order" ]
train
https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L217-L224
aws/aws-sdk-java
aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/RunInstancesRequest.java
RunInstancesRequest.getElasticGpuSpecification
public java.util.List<ElasticGpuSpecification> getElasticGpuSpecification() { """ <p> An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html"> Amazon EC2 Elastic GPUs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. </p> @return An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html"> Amazon EC2 Elastic GPUs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. """ if (elasticGpuSpecification == null) { elasticGpuSpecification = new com.amazonaws.internal.SdkInternalList<ElasticGpuSpecification>(); } return elasticGpuSpecification; }
java
public java.util.List<ElasticGpuSpecification> getElasticGpuSpecification() { if (elasticGpuSpecification == null) { elasticGpuSpecification = new com.amazonaws.internal.SdkInternalList<ElasticGpuSpecification>(); } return elasticGpuSpecification; }
[ "public", "java", ".", "util", ".", "List", "<", "ElasticGpuSpecification", ">", "getElasticGpuSpecification", "(", ")", "{", "if", "(", "elasticGpuSpecification", "==", "null", ")", "{", "elasticGpuSpecification", "=", "new", "com", ".", "amazonaws", ".", "inte...
<p> An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html"> Amazon EC2 Elastic GPUs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. </p> @return An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html"> Amazon EC2 Elastic GPUs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
[ "<p", ">", "An", "elastic", "GPU", "to", "associate", "with", "the", "instance", ".", "An", "Elastic", "GPU", "is", "a", "GPU", "resource", "that", "you", "can", "attach", "to", "your", "Windows", "instance", "to", "accelerate", "the", "graphics", "perform...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/RunInstancesRequest.java#L2326-L2331
elki-project/elki
elki-core/src/main/java/de/lmu/ifi/dbs/elki/result/ResultUtil.java
ResultUtil.findDatabase
public static Database findDatabase(ResultHierarchy hier, Result baseResult) { """ Find the first database result in the tree. @param baseResult Result tree base. @return Database """ final List<Database> dbs = filterResults(hier, baseResult, Database.class); return (!dbs.isEmpty()) ? dbs.get(0) : null; }
java
public static Database findDatabase(ResultHierarchy hier, Result baseResult) { final List<Database> dbs = filterResults(hier, baseResult, Database.class); return (!dbs.isEmpty()) ? dbs.get(0) : null; }
[ "public", "static", "Database", "findDatabase", "(", "ResultHierarchy", "hier", ",", "Result", "baseResult", ")", "{", "final", "List", "<", "Database", ">", "dbs", "=", "filterResults", "(", "hier", ",", "baseResult", ",", "Database", ".", "class", ")", ";"...
Find the first database result in the tree. @param baseResult Result tree base. @return Database
[ "Find", "the", "first", "database", "result", "in", "the", "tree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/result/ResultUtil.java#L166-L169
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/core/OrderComparator.java
OrderComparator.withSourceProvider
public Comparator<Object> withSourceProvider(final OrderSourceProvider sourceProvider) { """ Build an adapted order comparator with the given soruce provider. @param sourceProvider the order source provider to use @return the adapted comparator @since 4.1 """ return new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { return doCompare(o1, o2, sourceProvider); } }; }
java
public Comparator<Object> withSourceProvider(final OrderSourceProvider sourceProvider) { return new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { return doCompare(o1, o2, sourceProvider); } }; }
[ "public", "Comparator", "<", "Object", ">", "withSourceProvider", "(", "final", "OrderSourceProvider", "sourceProvider", ")", "{", "return", "new", "Comparator", "<", "Object", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Object", "o1...
Build an adapted order comparator with the given soruce provider. @param sourceProvider the order source provider to use @return the adapted comparator @since 4.1
[ "Build", "an", "adapted", "order", "comparator", "with", "the", "given", "soruce", "provider", "." ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/core/OrderComparator.java#L52-L59
ops4j/org.ops4j.pax.web
pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ServerControllerImpl.java
ServerControllerImpl.configureIdentityManager
private void configureIdentityManager(URL undertowResource) { """ Loads additional properties and configure {@link ServerControllerImpl#identityManager} @param undertowResource """ try { Properties props = new Properties(); try (InputStream is = undertowResource.openStream()) { props.load(is); } Map<String, String> config = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { config.put(entry.getKey().toString(), entry.getValue().toString()); } identityManager = (IdentityManager)createConfigurationObject(config, "identityManager"); // String listeners = config.get("listeners"); // if (listeners != null) { // String[] names = listeners.split("(, )+"); // for (String name : names) { // String type = config.get("listeners." + name + ".type"); // String address = config.get("listeners." + name + ".address"); // String port = config.get("listeners." + name + ".port"); // if ("http".equals(type)) { // builder.addHttpListener(Integer.parseInt(port), address); // } // } // } } catch (Exception e) { LOG.error("Exception while starting Undertow", e); throw new RuntimeException("Exception while starting Undertow", e); } }
java
private void configureIdentityManager(URL undertowResource) { try { Properties props = new Properties(); try (InputStream is = undertowResource.openStream()) { props.load(is); } Map<String, String> config = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { config.put(entry.getKey().toString(), entry.getValue().toString()); } identityManager = (IdentityManager)createConfigurationObject(config, "identityManager"); // String listeners = config.get("listeners"); // if (listeners != null) { // String[] names = listeners.split("(, )+"); // for (String name : names) { // String type = config.get("listeners." + name + ".type"); // String address = config.get("listeners." + name + ".address"); // String port = config.get("listeners." + name + ".port"); // if ("http".equals(type)) { // builder.addHttpListener(Integer.parseInt(port), address); // } // } // } } catch (Exception e) { LOG.error("Exception while starting Undertow", e); throw new RuntimeException("Exception while starting Undertow", e); } }
[ "private", "void", "configureIdentityManager", "(", "URL", "undertowResource", ")", "{", "try", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "(", "InputStream", "is", "=", "undertowResource", ".", "openStream", "(", ")", ")", "...
Loads additional properties and configure {@link ServerControllerImpl#identityManager} @param undertowResource
[ "Loads", "additional", "properties", "and", "configure", "{" ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ServerControllerImpl.java#L312-L340
b3log/latke
latke-core/src/main/java/org/json/JSONArray.java
JSONArray.optFloat
public float optFloat(int index, float defaultValue) { """ Get the optional float value associated with an index. The defaultValue is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number. @param index subscript @param defaultValue The default value. @return The value. """ final Number val = this.optNumber(index, null); if (val == null) { return defaultValue; } final float floatValue = val.floatValue(); // if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) { // return floatValue; // } return floatValue; }
java
public float optFloat(int index, float defaultValue) { final Number val = this.optNumber(index, null); if (val == null) { return defaultValue; } final float floatValue = val.floatValue(); // if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) { // return floatValue; // } return floatValue; }
[ "public", "float", "optFloat", "(", "int", "index", ",", "float", "defaultValue", ")", "{", "final", "Number", "val", "=", "this", ".", "optNumber", "(", "index", ",", "null", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "defaultValue"...
Get the optional float value associated with an index. The defaultValue is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number. @param index subscript @param defaultValue The default value. @return The value.
[ "Get", "the", "optional", "float", "value", "associated", "with", "an", "index", ".", "The", "defaultValue", "is", "returned", "if", "there", "is", "no", "value", "for", "the", "index", "or", "if", "the", "value", "is", "not", "a", "number", "and", "cann...
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L605-L615
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java
CSVParser.setSeparatorChar
@Nonnull public CSVParser setSeparatorChar (final char cSeparator) { """ Sets the delimiter to use for separating entries. @param cSeparator the delimiter to use for separating entries @return this """ if (cSeparator == CCSV.NULL_CHARACTER) throw new UnsupportedOperationException ("The separator character must be defined!"); m_cSeparatorChar = cSeparator; if (_anyCharactersAreTheSame ()) throw new UnsupportedOperationException ("The separator, quote, and escape characters must be different!"); return this; }
java
@Nonnull public CSVParser setSeparatorChar (final char cSeparator) { if (cSeparator == CCSV.NULL_CHARACTER) throw new UnsupportedOperationException ("The separator character must be defined!"); m_cSeparatorChar = cSeparator; if (_anyCharactersAreTheSame ()) throw new UnsupportedOperationException ("The separator, quote, and escape characters must be different!"); return this; }
[ "@", "Nonnull", "public", "CSVParser", "setSeparatorChar", "(", "final", "char", "cSeparator", ")", "{", "if", "(", "cSeparator", "==", "CCSV", ".", "NULL_CHARACTER", ")", "throw", "new", "UnsupportedOperationException", "(", "\"The separator character must be defined!\...
Sets the delimiter to use for separating entries. @param cSeparator the delimiter to use for separating entries @return this
[ "Sets", "the", "delimiter", "to", "use", "for", "separating", "entries", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java#L108-L117
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.oneHot
public SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off) { """ Convert the array to a one-hot array with walues {@code on} and {@code off} for each entry<br> If input has shape [ a, ..., n] then output has shape [ a, ..., n, depth], with {@code out[i, ..., j, in[i,...,j]] = on} with other values being set to {@code off} @param name Output variable name @param indices Indices - value 0 to depth-1 @param depth Number of classes @return Output variable """ return oneHot(name, indices, depth, axis, on, off, OneHot.DEFAULT_DTYPE); }
java
public SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off) { return oneHot(name, indices, depth, axis, on, off, OneHot.DEFAULT_DTYPE); }
[ "public", "SDVariable", "oneHot", "(", "String", "name", ",", "SDVariable", "indices", ",", "int", "depth", ",", "int", "axis", ",", "double", "on", ",", "double", "off", ")", "{", "return", "oneHot", "(", "name", ",", "indices", ",", "depth", ",", "ax...
Convert the array to a one-hot array with walues {@code on} and {@code off} for each entry<br> If input has shape [ a, ..., n] then output has shape [ a, ..., n, depth], with {@code out[i, ..., j, in[i,...,j]] = on} with other values being set to {@code off} @param name Output variable name @param indices Indices - value 0 to depth-1 @param depth Number of classes @return Output variable
[ "Convert", "the", "array", "to", "a", "one", "-", "hot", "array", "with", "walues", "{", "@code", "on", "}", "and", "{", "@code", "off", "}", "for", "each", "entry<br", ">", "If", "input", "has", "shape", "[", "a", "...", "n", "]", "then", "output"...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1467-L1469
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/AuthUtils.java
AuthUtils.purgeOAuthAccessTokens
public static void purgeOAuthAccessTokens(RequestContext requestContext, String provider) { """ Purges all OAuth tokens from given provider @param requestContext request context @param provider provider """ String key = String.format(PROVIDER_ACCESS_TOKENS, provider); HttpSession session = requestContext.getRequest().getSession(); OAuthAccessToken[] accessTokens = (OAuthAccessToken[]) session.getAttribute(key); if (accessTokens != null) { session.removeAttribute(key); } }
java
public static void purgeOAuthAccessTokens(RequestContext requestContext, String provider) { String key = String.format(PROVIDER_ACCESS_TOKENS, provider); HttpSession session = requestContext.getRequest().getSession(); OAuthAccessToken[] accessTokens = (OAuthAccessToken[]) session.getAttribute(key); if (accessTokens != null) { session.removeAttribute(key); } }
[ "public", "static", "void", "purgeOAuthAccessTokens", "(", "RequestContext", "requestContext", ",", "String", "provider", ")", "{", "String", "key", "=", "String", ".", "format", "(", "PROVIDER_ACCESS_TOKENS", ",", "provider", ")", ";", "HttpSession", "session", "...
Purges all OAuth tokens from given provider @param requestContext request context @param provider provider
[ "Purges", "all", "OAuth", "tokens", "from", "given", "provider" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/AuthUtils.java#L138-L145
logic-ng/LogicNG
src/main/java/org/logicng/datastructures/EncodingResult.java
EncodingResult.newVariable
public Variable newVariable() { """ Returns a new auxiliary variable. @return a new auxiliary variable """ if (this.miniSat == null && this.cleaneLing == null) return this.f.newCCVariable(); else if (this.miniSat != null) { final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true); final String name = FormulaFactory.CC_PREFIX + "MINISAT_" + index; this.miniSat.underlyingSolver().addName(name, index); return new EncodingAuxiliaryVariable(name, false); } else return new EncodingAuxiliaryVariable(this.cleaneLing.createNewVariableOnSolver(FormulaFactory.CC_PREFIX + "CLEANELING"), false); }
java
public Variable newVariable() { if (this.miniSat == null && this.cleaneLing == null) return this.f.newCCVariable(); else if (this.miniSat != null) { final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true); final String name = FormulaFactory.CC_PREFIX + "MINISAT_" + index; this.miniSat.underlyingSolver().addName(name, index); return new EncodingAuxiliaryVariable(name, false); } else return new EncodingAuxiliaryVariable(this.cleaneLing.createNewVariableOnSolver(FormulaFactory.CC_PREFIX + "CLEANELING"), false); }
[ "public", "Variable", "newVariable", "(", ")", "{", "if", "(", "this", ".", "miniSat", "==", "null", "&&", "this", ".", "cleaneLing", "==", "null", ")", "return", "this", ".", "f", ".", "newCCVariable", "(", ")", ";", "else", "if", "(", "this", ".", ...
Returns a new auxiliary variable. @return a new auxiliary variable
[ "Returns", "a", "new", "auxiliary", "variable", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L192-L202
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java
EntityTypeValidator.validateBackend
void validateBackend(EntityType entityType) { """ Validate that the entity meta data backend exists @param entityType entity meta data @throws MolgenisValidationException if the entity meta data backend does not exist """ // Validate backend exists String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } }
java
void validateBackend(EntityType entityType) { // Validate backend exists String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } }
[ "void", "validateBackend", "(", "EntityType", "entityType", ")", "{", "// Validate backend exists", "String", "backendName", "=", "entityType", ".", "getBackend", "(", ")", ";", "if", "(", "!", "dataService", ".", "getMeta", "(", ")", ".", "hasBackend", "(", "...
Validate that the entity meta data backend exists @param entityType entity meta data @throws MolgenisValidationException if the entity meta data backend does not exist
[ "Validate", "that", "the", "entity", "meta", "data", "backend", "exists" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L95-L102
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java
FindBugsWorker.collectClassFiles
private void collectClassFiles(List<WorkItem> resources, Map<IPath, IPath> outLocations, Project fbProject) { """ Updates given outputFiles map with class name patterns matching given java source names @param resources java sources @param outLocations key is src root, value is output location this directory @param fbProject """ for (WorkItem workItem : resources) { workItem.addFilesToProject(fbProject, outLocations); } }
java
private void collectClassFiles(List<WorkItem> resources, Map<IPath, IPath> outLocations, Project fbProject) { for (WorkItem workItem : resources) { workItem.addFilesToProject(fbProject, outLocations); } }
[ "private", "void", "collectClassFiles", "(", "List", "<", "WorkItem", ">", "resources", ",", "Map", "<", "IPath", ",", "IPath", ">", "outLocations", ",", "Project", "fbProject", ")", "{", "for", "(", "WorkItem", "workItem", ":", "resources", ")", "{", "wor...
Updates given outputFiles map with class name patterns matching given java source names @param resources java sources @param outLocations key is src root, value is output location this directory @param fbProject
[ "Updates", "given", "outputFiles", "map", "with", "class", "name", "patterns", "matching", "given", "java", "source", "names" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsWorker.java#L293-L297
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayReplace
public static Expression arrayReplace(Expression expression, Expression value1, Expression value2, long n) { """ Returned expression results in new array with at most n occurrences of value1 replaced with value2. """ return x("ARRAY_REPLACE(" + expression.toString() + ", " + value1 + ", " + value2 + ", " + n + ")"); }
java
public static Expression arrayReplace(Expression expression, Expression value1, Expression value2, long n) { return x("ARRAY_REPLACE(" + expression.toString() + ", " + value1 + ", " + value2 + ", " + n + ")"); }
[ "public", "static", "Expression", "arrayReplace", "(", "Expression", "expression", ",", "Expression", "value1", ",", "Expression", "value2", ",", "long", "n", ")", "{", "return", "x", "(", "\"ARRAY_REPLACE(\"", "+", "expression", ".", "toString", "(", ")", "+"...
Returned expression results in new array with at most n occurrences of value1 replaced with value2.
[ "Returned", "expression", "results", "in", "new", "array", "with", "at", "most", "n", "occurrences", "of", "value1", "replaced", "with", "value2", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L417-L419
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
DescriptorRepository.removeExtent
void removeExtent(String classname) { """ Remove a pair of extent/classdescriptor from the extentTable. @param classname the name of the extent itself """ synchronized (extentTable) { // returns the super class for given extent class name ClassDescriptor cld = (ClassDescriptor) extentTable.remove(classname); if(cld != null && m_topLevelClassTable != null) { Class extClass = null; try { extClass = ClassHelper.getClass(classname); } catch (ClassNotFoundException e) { // Should not happen throw new MetadataException("Can't instantiate class object for needed extent remove", e); } // remove extent from super class descriptor cld.removeExtentClass(classname); m_topLevelClassTable.remove(extClass); // clear map with first concrete classes, because the removed // extent could be such a first found concrete class m_firstConcreteClassMap = null; } } }
java
void removeExtent(String classname) { synchronized (extentTable) { // returns the super class for given extent class name ClassDescriptor cld = (ClassDescriptor) extentTable.remove(classname); if(cld != null && m_topLevelClassTable != null) { Class extClass = null; try { extClass = ClassHelper.getClass(classname); } catch (ClassNotFoundException e) { // Should not happen throw new MetadataException("Can't instantiate class object for needed extent remove", e); } // remove extent from super class descriptor cld.removeExtentClass(classname); m_topLevelClassTable.remove(extClass); // clear map with first concrete classes, because the removed // extent could be such a first found concrete class m_firstConcreteClassMap = null; } } }
[ "void", "removeExtent", "(", "String", "classname", ")", "{", "synchronized", "(", "extentTable", ")", "{", "// returns the super class for given extent class name\r", "ClassDescriptor", "cld", "=", "(", "ClassDescriptor", ")", "extentTable", ".", "remove", "(", "classn...
Remove a pair of extent/classdescriptor from the extentTable. @param classname the name of the extent itself
[ "Remove", "a", "pair", "of", "extent", "/", "classdescriptor", "from", "the", "extentTable", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java#L110-L136
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generatePrimitiveTypes
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) { """ Generate the keywords for the primitive types. @param it the receiver of the generated elements. @param types the primitive types. """ final Iterator<String> iterator = types.iterator(); if (iterator.hasNext()) { appendComment(it, "primitive types."); //$NON-NLS-1$ appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NLS-2$ it.append("syn keyword sarlPrimitiveType"); //$NON-NLS-1$ do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); it.append(" nextgroup=sarlArrayDeclaration").newLine(); //$NON-NLS-1$ appendCluster(it, "sarlPrimitiveType"); //$NON-NLS-1$ hilight("sarlPrimitiveType", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ hilight("sarlArrayDeclaration", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ it.newLine(); } }
java
protected void generatePrimitiveTypes(IStyleAppendable it, Iterable<String> types) { final Iterator<String> iterator = types.iterator(); if (iterator.hasNext()) { appendComment(it, "primitive types."); //$NON-NLS-1$ appendMatch(it, "sarlArrayDeclaration", "\\(\\s*\\[\\s*\\]\\)*", true); //$NON-NLS-1$//$NON-NLS-2$ it.append("syn keyword sarlPrimitiveType"); //$NON-NLS-1$ do { it.append(" "); //$NON-NLS-1$ it.append(iterator.next()); } while (iterator.hasNext()); it.append(" nextgroup=sarlArrayDeclaration").newLine(); //$NON-NLS-1$ appendCluster(it, "sarlPrimitiveType"); //$NON-NLS-1$ hilight("sarlPrimitiveType", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ hilight("sarlArrayDeclaration", VimSyntaxGroup.SPECIAL); //$NON-NLS-1$ it.newLine(); } }
[ "protected", "void", "generatePrimitiveTypes", "(", "IStyleAppendable", "it", ",", "Iterable", "<", "String", ">", "types", ")", "{", "final", "Iterator", "<", "String", ">", "iterator", "=", "types", ".", "iterator", "(", ")", ";", "if", "(", "iterator", ...
Generate the keywords for the primitive types. @param it the receiver of the generated elements. @param types the primitive types.
[ "Generate", "the", "keywords", "for", "the", "primitive", "types", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L222-L238
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectUnionOfImpl_CustomFieldSerializer.java
OWLObjectUnionOfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectUnionOfImpl 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, OWLObjectUnionOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectUnionOfImpl", "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/OWLObjectUnionOfImpl_CustomFieldSerializer.java#L69-L72
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlMessageImpl.java
ControlMessageImpl.appendArray
protected static void appendArray(StringBuilder buff, String name, String[] values) { """ Helper method to append a string array to a summary string method """ buff.append(','); buff.append(name); buff.append("=["); if (values != null) { for (int i = 0; i < values.length; i++) { if (i != 0) buff.append(','); buff.append(values[i]); } } buff.append(']'); }
java
protected static void appendArray(StringBuilder buff, String name, String[] values) { buff.append(','); buff.append(name); buff.append("=["); if (values != null) { for (int i = 0; i < values.length; i++) { if (i != 0) buff.append(','); buff.append(values[i]); } } buff.append(']'); }
[ "protected", "static", "void", "appendArray", "(", "StringBuilder", "buff", ",", "String", "name", ",", "String", "[", "]", "values", ")", "{", "buff", ".", "append", "(", "'", "'", ")", ";", "buff", ".", "append", "(", "name", ")", ";", "buff", ".",...
Helper method to append a string array to a summary string method
[ "Helper", "method", "to", "append", "a", "string", "array", "to", "a", "summary", "string", "method" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/ControlMessageImpl.java#L622-L633
alkacon/opencms-core
src/org/opencms/loader/CmsImageScaler.java
CmsImageScaler.setCropArea
public void setCropArea(int x, int y, int width, int height) { """ Sets the image crop area.<p> @param x the x coordinate for the crop @param y the y coordinate for the crop @param width the crop width @param height the crop height """ m_cropX = x; m_cropY = y; m_cropWidth = width; m_cropHeight = height; }
java
public void setCropArea(int x, int y, int width, int height) { m_cropX = x; m_cropY = y; m_cropWidth = width; m_cropHeight = height; }
[ "public", "void", "setCropArea", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "m_cropX", "=", "x", ";", "m_cropY", "=", "y", ";", "m_cropWidth", "=", "width", ";", "m_cropHeight", "=", "height", ";", "}" ]
Sets the image crop area.<p> @param x the x coordinate for the crop @param y the y coordinate for the crop @param width the crop width @param height the crop height
[ "Sets", "the", "image", "crop", "area", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsImageScaler.java#L1328-L1334
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.setDebugConfigs
public static void setDebugConfigs(OneProperties debugConfigsObj, String debugConfigAbsoluteClassPath) { """ <p>Set self define debug configs.</p> Can use self debug configs path or self class extends {@link OneProperties}. @param debugConfigsObj self class extends {@link OneProperties}. If null means not use self class. @param debugConfigAbsoluteClassPath self system configs path. If null means use default path "{@value #DEFAULT_DEBUG_CONFIG_ABSOLUTE_CLASS_PATH}" @see OneProperties """ if (debugConfigsObj != null) { Configs.debugConfigs = debugConfigsObj; } if (debugConfigAbsoluteClassPath != null) { Configs.debugConfigAbsoluteClassPath = debugConfigAbsoluteClassPath; Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); } else if (debugConfigs != null) { // use new systemConfigs, need initConfigs. Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); } }
java
public static void setDebugConfigs(OneProperties debugConfigsObj, String debugConfigAbsoluteClassPath) { if (debugConfigsObj != null) { Configs.debugConfigs = debugConfigsObj; } if (debugConfigAbsoluteClassPath != null) { Configs.debugConfigAbsoluteClassPath = debugConfigAbsoluteClassPath; Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); } else if (debugConfigs != null) { // use new systemConfigs, need initConfigs. Configs.debugConfigs.initConfigs(Configs.debugConfigAbsoluteClassPath); } }
[ "public", "static", "void", "setDebugConfigs", "(", "OneProperties", "debugConfigsObj", ",", "String", "debugConfigAbsoluteClassPath", ")", "{", "if", "(", "debugConfigsObj", "!=", "null", ")", "{", "Configs", ".", "debugConfigs", "=", "debugConfigsObj", ";", "}", ...
<p>Set self define debug configs.</p> Can use self debug configs path or self class extends {@link OneProperties}. @param debugConfigsObj self class extends {@link OneProperties}. If null means not use self class. @param debugConfigAbsoluteClassPath self system configs path. If null means use default path "{@value #DEFAULT_DEBUG_CONFIG_ABSOLUTE_CLASS_PATH}" @see OneProperties
[ "<p", ">", "Set", "self", "define", "debug", "configs", ".", "<", "/", "p", ">", "Can", "use", "self", "debug", "configs", "path", "or", "self", "class", "extends", "{", "@link", "OneProperties", "}", "." ]
train
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L641-L651
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PhoneNumberValidator.java
PhoneNumberValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { """ {@inheritDoc} check if given string is a valid gln. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext) """ final String valueAsString = Objects.toString(pvalue, null); if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } return allowDin5008 && valueAsString.matches(PHONE_NUMBER_DIN5008) // || allowE123 && valueAsString.matches(PHONE_NUMBER_E123) // || allowUri && valueAsString.matches(PHONE_NUMBER_URI) // || allowMs && valueAsString.matches(PHONE_NUMBER_MS) // || allowCommon && valueAsString.matches(PHONE_NUMBER_COMMON); }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString = Objects.toString(pvalue, null); if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } return allowDin5008 && valueAsString.matches(PHONE_NUMBER_DIN5008) // || allowE123 && valueAsString.matches(PHONE_NUMBER_E123) // || allowUri && valueAsString.matches(PHONE_NUMBER_URI) // || allowMs && valueAsString.matches(PHONE_NUMBER_MS) // || allowCommon && valueAsString.matches(PHONE_NUMBER_COMMON); }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "final", "String", "valueAsString", "=", "Objects", ".", "toString", "(", "pvalue", ",", "null", ")", ...
{@inheritDoc} check if given string is a valid gln. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "string", "is", "a", "valid", "gln", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PhoneNumberValidator.java#L107-L120
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/model/JavacTypes.java
JavacTypes.asMemberOf
public TypeMirror asMemberOf(DeclaredType containing, Element element) { """ Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type. For example, when viewed as a member of the parameterized type {@code Set<String>}, the {@code Set.add} method is an {@code ExecutableType} whose parameter is of type {@code String}. @param containing the containing type @param element the element @return the type of the element as viewed from the containing type @throws IllegalArgumentException if the element is not a valid one for the given type """ Type site = (Type)containing; Symbol sym = (Symbol)element; if (types.asSuper(site, sym.getEnclosingElement()) == null) throw new IllegalArgumentException(sym + "@" + site); return types.memberType(site, sym); }
java
public TypeMirror asMemberOf(DeclaredType containing, Element element) { Type site = (Type)containing; Symbol sym = (Symbol)element; if (types.asSuper(site, sym.getEnclosingElement()) == null) throw new IllegalArgumentException(sym + "@" + site); return types.memberType(site, sym); }
[ "public", "TypeMirror", "asMemberOf", "(", "DeclaredType", "containing", ",", "Element", "element", ")", "{", "Type", "site", "=", "(", "Type", ")", "containing", ";", "Symbol", "sym", "=", "(", "Symbol", ")", "element", ";", "if", "(", "types", ".", "as...
Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type. For example, when viewed as a member of the parameterized type {@code Set<String>}, the {@code Set.add} method is an {@code ExecutableType} whose parameter is of type {@code String}. @param containing the containing type @param element the element @return the type of the element as viewed from the containing type @throws IllegalArgumentException if the element is not a valid one for the given type
[ "Returns", "the", "type", "of", "an", "element", "when", "that", "element", "is", "viewed", "as", "a", "member", "of", "or", "otherwise", "directly", "contained", "by", "a", "given", "type", ".", "For", "example", "when", "viewed", "as", "a", "member", "...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/model/JavacTypes.java#L274-L280
icode/ameba-utils
src/main/java/ameba/util/MimeType.java
MimeType.put
public static void put(String extension, String contentType) { """ <p> Associates the specified extension and content type </p> @param extension the extension @param contentType the content type associated with the extension """ if (extension != null && extension.length() != 0 && contentType != null && contentType.length() != 0) { contentTypes.put(extension, contentType); } }
java
public static void put(String extension, String contentType) { if (extension != null && extension.length() != 0 && contentType != null && contentType.length() != 0) { contentTypes.put(extension, contentType); } }
[ "public", "static", "void", "put", "(", "String", "extension", ",", "String", "contentType", ")", "{", "if", "(", "extension", "!=", "null", "&&", "extension", ".", "length", "(", ")", "!=", "0", "&&", "contentType", "!=", "null", "&&", "contentType", "....
<p> Associates the specified extension and content type </p> @param extension the extension @param contentType the content type associated with the extension
[ "<p", ">", "Associates", "the", "specified", "extension", "and", "content", "type", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/MimeType.java#L62-L68
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/apt/AptUtils.java
AptUtils.areSameByClass
public static boolean areSameByClass(AnnotationMirror am, Class<? extends Annotation> anno) { """ Checks that the annotation {@code am} has the name of {@code anno}. Values are ignored. """ return areSameByName(am, anno.getCanonicalName().intern()); }
java
public static boolean areSameByClass(AnnotationMirror am, Class<? extends Annotation> anno) { return areSameByName(am, anno.getCanonicalName().intern()); }
[ "public", "static", "boolean", "areSameByClass", "(", "AnnotationMirror", "am", ",", "Class", "<", "?", "extends", "Annotation", ">", "anno", ")", "{", "return", "areSameByName", "(", "am", ",", "anno", ".", "getCanonicalName", "(", ")", ".", "intern", "(", ...
Checks that the annotation {@code am} has the name of {@code anno}. Values are ignored.
[ "Checks", "that", "the", "annotation", "{" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/apt/AptUtils.java#L185-L187
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.checkConnectivityAsync
public Observable<ConnectivityInformationInner> checkConnectivityAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) { """ Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that determine how the connectivity check will be performed. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return checkConnectivityWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<ConnectivityInformationInner>, ConnectivityInformationInner>() { @Override public ConnectivityInformationInner call(ServiceResponse<ConnectivityInformationInner> response) { return response.body(); } }); }
java
public Observable<ConnectivityInformationInner> checkConnectivityAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) { return checkConnectivityWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<ConnectivityInformationInner>, ConnectivityInformationInner>() { @Override public ConnectivityInformationInner call(ServiceResponse<ConnectivityInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectivityInformationInner", ">", "checkConnectivityAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "ConnectivityParameters", "parameters", ")", "{", "return", "checkConnectivityWithServiceResponseAsync", "("...
Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that determine how the connectivity check will be performed. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Verifies", "the", "possibility", "of", "establishing", "a", "direct", "TCP", "connection", "from", "a", "virtual", "machine", "to", "a", "given", "endpoint", "including", "another", "VM", "or", "an", "arbitrary", "remote", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2167-L2174
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java
Main.execute
public static int execute(ClassLoader docletParentClassLoader, String... args) { """ Programmatic interface. @param args The command line parameters. @param docletParentClassLoader The parent class loader used when creating the doclet classloader. If null, the class loader used to instantiate doclets will be created without specifying a parent class loader. @return The return code. @since 1.7 """ Start jdoc = new Start(docletParentClassLoader); return jdoc.begin(args); }
java
public static int execute(ClassLoader docletParentClassLoader, String... args) { Start jdoc = new Start(docletParentClassLoader); return jdoc.begin(args); }
[ "public", "static", "int", "execute", "(", "ClassLoader", "docletParentClassLoader", ",", "String", "...", "args", ")", "{", "Start", "jdoc", "=", "new", "Start", "(", "docletParentClassLoader", ")", ";", "return", "jdoc", ".", "begin", "(", "args", ")", ";"...
Programmatic interface. @param args The command line parameters. @param docletParentClassLoader The parent class loader used when creating the doclet classloader. If null, the class loader used to instantiate doclets will be created without specifying a parent class loader. @return The return code. @since 1.7
[ "Programmatic", "interface", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java#L88-L91
alkacon/opencms-core
src/org/opencms/ui/login/CmsLoginUI.java
CmsLoginUI.generateLoginHtmlFragment
public static String generateLoginHtmlFragment(CmsObject cms, VaadinRequest request) throws IOException { """ Returns the bootstrap html fragment required to display the login dialog.<p> @param cms the cms context @param request the request @return the html fragment @throws IOException in case reading the html template fails """ LoginParameters parameters = CmsLoginHelper.getLoginParameters(cms, (HttpServletRequest)request, true); request.getWrappedSession().setAttribute(CmsLoginUI.INIT_DATA_SESSION_ATTR, parameters); byte[] pageBytes; pageBytes = CmsFileUtil.readFully( Thread.currentThread().getContextClassLoader().getResourceAsStream( "org/opencms/ui/login/login-fragment.html")); String html = new String(pageBytes, "UTF-8"); String autocomplete = ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) ? "on" : "off"; CmsMacroResolver resolver = new CmsMacroResolver(); resolver.addMacro("autocompplete", autocomplete); if ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) { resolver.addMacro( "hiddenPasswordField", " <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >"); } if (parameters.getUsername() != null) { resolver.addMacro("predefUser", "value=\"" + CmsEncoder.escapeXml(parameters.getUsername()) + "\""); } html = resolver.resolveMacros(html); return html; }
java
public static String generateLoginHtmlFragment(CmsObject cms, VaadinRequest request) throws IOException { LoginParameters parameters = CmsLoginHelper.getLoginParameters(cms, (HttpServletRequest)request, true); request.getWrappedSession().setAttribute(CmsLoginUI.INIT_DATA_SESSION_ATTR, parameters); byte[] pageBytes; pageBytes = CmsFileUtil.readFully( Thread.currentThread().getContextClassLoader().getResourceAsStream( "org/opencms/ui/login/login-fragment.html")); String html = new String(pageBytes, "UTF-8"); String autocomplete = ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) ? "on" : "off"; CmsMacroResolver resolver = new CmsMacroResolver(); resolver.addMacro("autocompplete", autocomplete); if ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) { resolver.addMacro( "hiddenPasswordField", " <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >"); } if (parameters.getUsername() != null) { resolver.addMacro("predefUser", "value=\"" + CmsEncoder.escapeXml(parameters.getUsername()) + "\""); } html = resolver.resolveMacros(html); return html; }
[ "public", "static", "String", "generateLoginHtmlFragment", "(", "CmsObject", "cms", ",", "VaadinRequest", "request", ")", "throws", "IOException", "{", "LoginParameters", "parameters", "=", "CmsLoginHelper", ".", "getLoginParameters", "(", "cms", ",", "(", "HttpServle...
Returns the bootstrap html fragment required to display the login dialog.<p> @param cms the cms context @param request the request @return the html fragment @throws IOException in case reading the html template fails
[ "Returns", "the", "bootstrap", "html", "fragment", "required", "to", "display", "the", "login", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginUI.java#L308-L333
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/cors/CorsFilter.java
CorsFilter.filter
@Override public ContainerResponse filter(ContainerRequest cres, ContainerResponse response) { """ We return Access-* headers only in case allowedOrigin is present and equals to the 'Origin' header. """ initLazily(servletRequest); String requestOrigin = cres.getHeaderValue("Origin"); if (requestOrigin != null) { // is this is a cors request (ajax request that targets a different domain than the one the page was loaded from) if (allowedOrigin != null && allowedOrigin.startsWith(requestOrigin)) { // no cors allowances make are applied if allowedOrigins == null // only return the origin the client informed response.getHttpHeaders().add("Access-Control-Allow-Origin", requestOrigin); response.getHttpHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization"); response.getHttpHeaders().add("Access-Control-Allow-Credentials", "true"); response.getHttpHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD"); response.getHttpHeaders().add("Access-Control-Max-Age", "1209600"); } } return response; }
java
@Override public ContainerResponse filter(ContainerRequest cres, ContainerResponse response) { initLazily(servletRequest); String requestOrigin = cres.getHeaderValue("Origin"); if (requestOrigin != null) { // is this is a cors request (ajax request that targets a different domain than the one the page was loaded from) if (allowedOrigin != null && allowedOrigin.startsWith(requestOrigin)) { // no cors allowances make are applied if allowedOrigins == null // only return the origin the client informed response.getHttpHeaders().add("Access-Control-Allow-Origin", requestOrigin); response.getHttpHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization"); response.getHttpHeaders().add("Access-Control-Allow-Credentials", "true"); response.getHttpHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD"); response.getHttpHeaders().add("Access-Control-Max-Age", "1209600"); } } return response; }
[ "@", "Override", "public", "ContainerResponse", "filter", "(", "ContainerRequest", "cres", ",", "ContainerResponse", "response", ")", "{", "initLazily", "(", "servletRequest", ")", ";", "String", "requestOrigin", "=", "cres", ".", "getHeaderValue", "(", "\"Origin\""...
We return Access-* headers only in case allowedOrigin is present and equals to the 'Origin' header.
[ "We", "return", "Access", "-", "*", "headers", "only", "in", "case", "allowedOrigin", "is", "present", "and", "equals", "to", "the", "Origin", "header", "." ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/cors/CorsFilter.java#L58-L73
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java
BigDecimal.createAndStripZerosToMatchScale
private static BigDecimal createAndStripZerosToMatchScale(long compactVal, int scale, long preferredScale) { """ Remove insignificant trailing zeros from this {@code long} value until the preferred scale is reached or no more zeros can be removed. If the preferred scale is less than Integer.MIN_VALUE, all the trailing zeros will be removed. @return new {@code BigDecimal} with a scale possibly reduced to be closed to the preferred scale. """ while (Math.abs(compactVal) >= 10L && scale > preferredScale) { if ((compactVal & 1L) != 0L) break; // odd number cannot end in 0 long r = compactVal % 10L; if (r != 0L) break; // non-0 remainder compactVal /= 10; scale = checkScale(compactVal, (long) scale - 1); // could Overflow } return valueOf(compactVal, scale); }
java
private static BigDecimal createAndStripZerosToMatchScale(long compactVal, int scale, long preferredScale) { while (Math.abs(compactVal) >= 10L && scale > preferredScale) { if ((compactVal & 1L) != 0L) break; // odd number cannot end in 0 long r = compactVal % 10L; if (r != 0L) break; // non-0 remainder compactVal /= 10; scale = checkScale(compactVal, (long) scale - 1); // could Overflow } return valueOf(compactVal, scale); }
[ "private", "static", "BigDecimal", "createAndStripZerosToMatchScale", "(", "long", "compactVal", ",", "int", "scale", ",", "long", "preferredScale", ")", "{", "while", "(", "Math", ".", "abs", "(", "compactVal", ")", ">=", "10L", "&&", "scale", ">", "preferred...
Remove insignificant trailing zeros from this {@code long} value until the preferred scale is reached or no more zeros can be removed. If the preferred scale is less than Integer.MIN_VALUE, all the trailing zeros will be removed. @return new {@code BigDecimal} with a scale possibly reduced to be closed to the preferred scale.
[ "Remove", "insignificant", "trailing", "zeros", "from", "this", "{", "@code", "long", "}", "value", "until", "the", "preferred", "scale", "is", "reached", "or", "no", "more", "zeros", "can", "be", "removed", ".", "If", "the", "preferred", "scale", "is", "l...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4393-L4404
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java
Swagger2MarkupProperties.getRequiredURI
public URI getRequiredURI(String key) { """ Return the URI property value associated with the given key (never {@code null}). @return The URI property @throws IllegalStateException if the key cannot be resolved """ Optional<String> property = getString(key); if (property.isPresent()) { return URIUtils.create(property.get()); } else { throw new IllegalStateException(String.format("required key [%s] not found", key)); } }
java
public URI getRequiredURI(String key) { Optional<String> property = getString(key); if (property.isPresent()) { return URIUtils.create(property.get()); } else { throw new IllegalStateException(String.format("required key [%s] not found", key)); } }
[ "public", "URI", "getRequiredURI", "(", "String", "key", ")", "{", "Optional", "<", "String", ">", "property", "=", "getString", "(", "key", ")", ";", "if", "(", "property", ".", "isPresent", "(", ")", ")", "{", "return", "URIUtils", ".", "create", "("...
Return the URI property value associated with the given key (never {@code null}). @return The URI property @throws IllegalStateException if the key cannot be resolved
[ "Return", "the", "URI", "property", "value", "associated", "with", "the", "given", "key", "(", "never", "{", "@code", "null", "}", ")", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java#L201-L208
windup/windup
rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/FileContent.java
FileContent.allInput
private void allInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store) { """ Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute specified in specific order. This method generates all the vertices if there is no other way how to handle the input. """ if (StringUtils.isBlank(getInputVariablesName()) && this.filenamePattern == null) { FileService fileModelService = new FileService(event.getGraphContext()); for (FileModel fileModel : fileModelService.findAll()) { vertices.add(fileModel); } } }
java
private void allInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store) { if (StringUtils.isBlank(getInputVariablesName()) && this.filenamePattern == null) { FileService fileModelService = new FileService(event.getGraphContext()); for (FileModel fileModel : fileModelService.findAll()) { vertices.add(fileModel); } } }
[ "private", "void", "allInput", "(", "List", "<", "FileModel", ">", "vertices", ",", "GraphRewrite", "event", ",", "ParameterStore", "store", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "getInputVariablesName", "(", ")", ")", "&&", "this", ".", ...
Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute specified in specific order. This method generates all the vertices if there is no other way how to handle the input.
[ "Generating", "the", "input", "vertices", "is", "quite", "complex", ".", "Therefore", "there", "are", "multiple", "methods", "that", "handles", "the", "input", "vertices", "based", "on", "the", "attribute", "specified", "in", "specific", "order", ".", "This", ...
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/FileContent.java#L330-L340
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java
RoadAStar.solve
public RoadPath solve(RoadConnection startPoint, Point2D<?, ?> endPoint, RoadNetwork network) { """ Run the A* algorithm from the nearest segment to <var>startPoint</var> to the nearest segment to <var>endPoint</var>. @param startPoint is the starting point. @param endPoint is the point to reach. @param network is the road network to explore. @return the found path, or <code>null</code> if none found. """ assert network != null && startPoint != null && endPoint != null; final RoadSegment endSegment = network.getNearestSegment(endPoint); if (endSegment != null) { final VirtualPoint end = new VirtualPoint(endPoint, endSegment); return solve(startPoint, end); } return null; }
java
public RoadPath solve(RoadConnection startPoint, Point2D<?, ?> endPoint, RoadNetwork network) { assert network != null && startPoint != null && endPoint != null; final RoadSegment endSegment = network.getNearestSegment(endPoint); if (endSegment != null) { final VirtualPoint end = new VirtualPoint(endPoint, endSegment); return solve(startPoint, end); } return null; }
[ "public", "RoadPath", "solve", "(", "RoadConnection", "startPoint", ",", "Point2D", "<", "?", ",", "?", ">", "endPoint", ",", "RoadNetwork", "network", ")", "{", "assert", "network", "!=", "null", "&&", "startPoint", "!=", "null", "&&", "endPoint", "!=", "...
Run the A* algorithm from the nearest segment to <var>startPoint</var> to the nearest segment to <var>endPoint</var>. @param startPoint is the starting point. @param endPoint is the point to reach. @param network is the road network to explore. @return the found path, or <code>null</code> if none found.
[ "Run", "the", "A", "*", "algorithm", "from", "the", "nearest", "segment", "to", "<var", ">", "startPoint<", "/", "var", ">", "to", "the", "nearest", "segment", "to", "<var", ">", "endPoint<", "/", "var", ">", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java#L183-L191
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java
PageInBrowserStats.addLoadTime
public void addLoadTime(final long domLoadTime, final long windowLoadTime) { """ Adds DOM load time and page load time to the stats. @param domLoadTime DOM load time @param windowLoadTime web page load time """ totalDomLoadTime.increaseByLong(domLoadTime); domMinLoadTime.setValueIfLesserThanCurrentAsLong(domLoadTime); domMaxLoadTime.setValueIfGreaterThanCurrentAsLong(domLoadTime); domLastLoadTime.setValueAsLong(domLoadTime); totalWindowLoadTime.increaseByLong(windowLoadTime); windowMinLoadTime.setValueIfLesserThanCurrentAsLong(windowLoadTime); windowMaxLoadTime.setValueIfGreaterThanCurrentAsLong(windowLoadTime); windowLastLoadTime.setValueAsLong(windowLoadTime); numberOfLoads.increase(); }
java
public void addLoadTime(final long domLoadTime, final long windowLoadTime) { totalDomLoadTime.increaseByLong(domLoadTime); domMinLoadTime.setValueIfLesserThanCurrentAsLong(domLoadTime); domMaxLoadTime.setValueIfGreaterThanCurrentAsLong(domLoadTime); domLastLoadTime.setValueAsLong(domLoadTime); totalWindowLoadTime.increaseByLong(windowLoadTime); windowMinLoadTime.setValueIfLesserThanCurrentAsLong(windowLoadTime); windowMaxLoadTime.setValueIfGreaterThanCurrentAsLong(windowLoadTime); windowLastLoadTime.setValueAsLong(windowLoadTime); numberOfLoads.increase(); }
[ "public", "void", "addLoadTime", "(", "final", "long", "domLoadTime", ",", "final", "long", "windowLoadTime", ")", "{", "totalDomLoadTime", ".", "increaseByLong", "(", "domLoadTime", ")", ";", "domMinLoadTime", ".", "setValueIfLesserThanCurrentAsLong", "(", "domLoadTi...
Adds DOM load time and page load time to the stats. @param domLoadTime DOM load time @param windowLoadTime web page load time
[ "Adds", "DOM", "load", "time", "and", "page", "load", "time", "to", "the", "stats", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L105-L115
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java
GlobalTransformerRegistry.discardOperation
public void discardOperation(final PathAddress address, int major, int minor, final String operationName) { """ Discard an operation. @param address the operation handler address @param major the major version @param minor the minor version @param operationName the operation name """ registerTransformer(address.iterator(), ModelVersion.create(major, minor), operationName, OperationTransformerRegistry.DISCARD); }
java
public void discardOperation(final PathAddress address, int major, int minor, final String operationName) { registerTransformer(address.iterator(), ModelVersion.create(major, minor), operationName, OperationTransformerRegistry.DISCARD); }
[ "public", "void", "discardOperation", "(", "final", "PathAddress", "address", ",", "int", "major", ",", "int", "minor", ",", "final", "String", "operationName", ")", "{", "registerTransformer", "(", "address", ".", "iterator", "(", ")", ",", "ModelVersion", "....
Discard an operation. @param address the operation handler address @param major the major version @param minor the minor version @param operationName the operation name
[ "Discard", "an", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java#L64-L66
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/action/ActionableHelper.java
ActionableHelper.getPublisher
public static <T extends Publisher> T getPublisher(AbstractProject<?, ?> project, Class<T> type) { """ Search for a publisher of the given type in a project and return it, or null if it is not found. @return The publisher """ // Search for a publisher of the given type in the project and return it if found: T publisher = new PublisherFindImpl<T>().find(project, type); if (publisher != null) { return publisher; } // If not found, the publisher might be wrapped by a "Flexible Publish" publisher. The below searches for it inside the // Flexible Publisher: publisher = new PublisherFlexible<T>().find(project, type); return publisher; }
java
public static <T extends Publisher> T getPublisher(AbstractProject<?, ?> project, Class<T> type) { // Search for a publisher of the given type in the project and return it if found: T publisher = new PublisherFindImpl<T>().find(project, type); if (publisher != null) { return publisher; } // If not found, the publisher might be wrapped by a "Flexible Publish" publisher. The below searches for it inside the // Flexible Publisher: publisher = new PublisherFlexible<T>().find(project, type); return publisher; }
[ "public", "static", "<", "T", "extends", "Publisher", ">", "T", "getPublisher", "(", "AbstractProject", "<", "?", ",", "?", ">", "project", ",", "Class", "<", "T", ">", "type", ")", "{", "// Search for a publisher of the given type in the project and return it if fo...
Search for a publisher of the given type in a project and return it, or null if it is not found. @return The publisher
[ "Search", "for", "a", "publisher", "of", "the", "given", "type", "in", "a", "project", "and", "return", "it", "or", "null", "if", "it", "is", "not", "found", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L80-L90
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java
CertificateOperations.listCertificates
public PagedList<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException { """ Lists the {@link Certificate certificates} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link Certificate} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ return listCertificates(detailLevel, null); }
java
public PagedList<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException { return listCertificates(detailLevel, null); }
[ "public", "PagedList", "<", "Certificate", ">", "listCertificates", "(", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listCertificates", "(", "detailLevel", ",", "null", ")", ";", "}" ]
Lists the {@link Certificate certificates} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link Certificate} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Lists", "the", "{", "@link", "Certificate", "certificates", "}", "in", "the", "Batch", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L301-L303
james-hu/jabb-core
src/main/java/net/sf/jabb/util/perf/RunTime.java
RunTime.addDetail
public void addDetail(String desc, long milliStartTime, long nanoDurationTime) { """ Add one run time to a specified detail record.<br> 给指定的详细记录增加一次RunTime。 @param desc Description of the detail record.<br> 详细记录的Description @param milliStartTime Start time in milliseconds (usually from System.currentTimeMillis()) @param nanoDurationTime Run time duration in nanoseconds. """ this.getDetail(desc).add(milliStartTime, nanoDurationTime); }
java
public void addDetail(String desc, long milliStartTime, long nanoDurationTime){ this.getDetail(desc).add(milliStartTime, nanoDurationTime); }
[ "public", "void", "addDetail", "(", "String", "desc", ",", "long", "milliStartTime", ",", "long", "nanoDurationTime", ")", "{", "this", ".", "getDetail", "(", "desc", ")", ".", "add", "(", "milliStartTime", ",", "nanoDurationTime", ")", ";", "}" ]
Add one run time to a specified detail record.<br> 给指定的详细记录增加一次RunTime。 @param desc Description of the detail record.<br> 详细记录的Description @param milliStartTime Start time in milliseconds (usually from System.currentTimeMillis()) @param nanoDurationTime Run time duration in nanoseconds.
[ "Add", "one", "run", "time", "to", "a", "specified", "detail", "record", ".", "<br", ">", "给指定的详细记录增加一次RunTime。" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/perf/RunTime.java#L197-L199
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomYearMonth
public static YearMonth randomYearMonth(YearMonth startInclusive, YearMonth endExclusive) { """ Returns a random {@link YearMonth} within the specified range. @param startInclusive the earliest {@link YearMonth} that can be returned @param endExclusive the upper bound (not included) @return the random {@link YearMonth} @throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive is earlier than startInclusive """ checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); LocalDate start = startInclusive.atDay(1); LocalDate end = endExclusive.atDay(1); LocalDate localDate = randomLocalDate(start, end); return YearMonth.of(localDate.getYear(), localDate.getMonth()); }
java
public static YearMonth randomYearMonth(YearMonth startInclusive, YearMonth endExclusive) { checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); LocalDate start = startInclusive.atDay(1); LocalDate end = endExclusive.atDay(1); LocalDate localDate = randomLocalDate(start, end); return YearMonth.of(localDate.getYear(), localDate.getMonth()); }
[ "public", "static", "YearMonth", "randomYearMonth", "(", "YearMonth", "startInclusive", ",", "YearMonth", "endExclusive", ")", "{", "checkArgument", "(", "startInclusive", "!=", "null", ",", "\"Start must be non-null\"", ")", ";", "checkArgument", "(", "endExclusive", ...
Returns a random {@link YearMonth} within the specified range. @param startInclusive the earliest {@link YearMonth} that can be returned @param endExclusive the upper bound (not included) @return the random {@link YearMonth} @throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive is earlier than startInclusive
[ "Returns", "a", "random", "{", "@link", "YearMonth", "}", "within", "the", "specified", "range", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L802-L809
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.events_get
public T events_get(Integer userId, Collection<Long> eventIds, Long startTime, Long endTime) throws FacebookException, IOException { """ Returns all visible events according to the filters specified. This may be used to find all events of a user, or to query specific eids. @param eventIds filter by these event ID's (optional) @param userId filter by this user only (optional) @param startTime UTC lower bound (optional) @param endTime UTC upper bound (optional) @return T of events """ ArrayList<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>(FacebookMethod.EVENTS_GET.numParams()); boolean hasUserId = null != userId && 0 != userId; boolean hasEventIds = null != eventIds && !eventIds.isEmpty(); boolean hasStart = null != startTime && 0 != startTime; boolean hasEnd = null != endTime && 0 != endTime; if (hasUserId) params.add(new Pair<String, CharSequence>("uid", Integer.toString(userId))); if (hasEventIds) params.add(new Pair<String, CharSequence>("eids", delimit(eventIds))); if (hasStart) params.add(new Pair<String, CharSequence>("start_time", startTime.toString())); if (hasEnd) params.add(new Pair<String, CharSequence>("end_time", endTime.toString())); return this.callMethod(FacebookMethod.EVENTS_GET, params); }
java
public T events_get(Integer userId, Collection<Long> eventIds, Long startTime, Long endTime) throws FacebookException, IOException { ArrayList<Pair<String, CharSequence>> params = new ArrayList<Pair<String, CharSequence>>(FacebookMethod.EVENTS_GET.numParams()); boolean hasUserId = null != userId && 0 != userId; boolean hasEventIds = null != eventIds && !eventIds.isEmpty(); boolean hasStart = null != startTime && 0 != startTime; boolean hasEnd = null != endTime && 0 != endTime; if (hasUserId) params.add(new Pair<String, CharSequence>("uid", Integer.toString(userId))); if (hasEventIds) params.add(new Pair<String, CharSequence>("eids", delimit(eventIds))); if (hasStart) params.add(new Pair<String, CharSequence>("start_time", startTime.toString())); if (hasEnd) params.add(new Pair<String, CharSequence>("end_time", endTime.toString())); return this.callMethod(FacebookMethod.EVENTS_GET, params); }
[ "public", "T", "events_get", "(", "Integer", "userId", ",", "Collection", "<", "Long", ">", "eventIds", ",", "Long", "startTime", ",", "Long", "endTime", ")", "throws", "FacebookException", ",", "IOException", "{", "ArrayList", "<", "Pair", "<", "String", ",...
Returns all visible events according to the filters specified. This may be used to find all events of a user, or to query specific eids. @param eventIds filter by these event ID's (optional) @param userId filter by this user only (optional) @param startTime UTC lower bound (optional) @param endTime UTC upper bound (optional) @return T of events
[ "Returns", "all", "visible", "events", "according", "to", "the", "filters", "specified", ".", "This", "may", "be", "used", "to", "find", "all", "events", "of", "a", "user", "or", "to", "query", "specific", "eids", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1391-L1410
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/IDOS.java
IDOS.computeIDs
protected DoubleDataStore computeIDs(DBIDs ids, KNNQuery<O> knnQ) { """ Computes all IDs @param ids the DBIDs to process @param knnQ the KNN query @return The computed intrinsic dimensionalities. """ WritableDoubleDataStore intDims = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Intrinsic dimensionality", ids.size(), LOG) : null; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double id = 0.; try { id = estimator.estimate(knnQ, iter, k_c + 1); } catch(ArithmeticException e) { id = 0; // Too many duplicates, etc. } intDims.putDouble(iter, id); LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); return intDims; }
java
protected DoubleDataStore computeIDs(DBIDs ids, KNNQuery<O> knnQ) { WritableDoubleDataStore intDims = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Intrinsic dimensionality", ids.size(), LOG) : null; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double id = 0.; try { id = estimator.estimate(knnQ, iter, k_c + 1); } catch(ArithmeticException e) { id = 0; // Too many duplicates, etc. } intDims.putDouble(iter, id); LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); return intDims; }
[ "protected", "DoubleDataStore", "computeIDs", "(", "DBIDs", "ids", ",", "KNNQuery", "<", "O", ">", "knnQ", ")", "{", "WritableDoubleDataStore", "intDims", "=", "DataStoreUtil", ".", "makeDoubleStorage", "(", "ids", ",", "DataStoreFactory", ".", "HINT_HOT", "|", ...
Computes all IDs @param ids the DBIDs to process @param knnQ the KNN query @return The computed intrinsic dimensionalities.
[ "Computes", "all", "IDs" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/IDOS.java#L153-L169
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java
ExecutorsUtils.newThreadFactory
public static ThreadFactory newThreadFactory(Optional<Logger> logger, Optional<String> nameFormat) { """ Get a new {@link java.util.concurrent.ThreadFactory} that uses a {@link LoggingUncaughtExceptionHandler} to handle uncaught exceptions and the given thread name format. @param logger an {@link com.google.common.base.Optional} wrapping the {@link org.slf4j.Logger} that the {@link LoggingUncaughtExceptionHandler} uses to log uncaught exceptions thrown in threads @param nameFormat an {@link com.google.common.base.Optional} wrapping a thread naming format @return a new {@link java.util.concurrent.ThreadFactory} """ return newThreadFactory(new ThreadFactoryBuilder(), logger, nameFormat); }
java
public static ThreadFactory newThreadFactory(Optional<Logger> logger, Optional<String> nameFormat) { return newThreadFactory(new ThreadFactoryBuilder(), logger, nameFormat); }
[ "public", "static", "ThreadFactory", "newThreadFactory", "(", "Optional", "<", "Logger", ">", "logger", ",", "Optional", "<", "String", ">", "nameFormat", ")", "{", "return", "newThreadFactory", "(", "new", "ThreadFactoryBuilder", "(", ")", ",", "logger", ",", ...
Get a new {@link java.util.concurrent.ThreadFactory} that uses a {@link LoggingUncaughtExceptionHandler} to handle uncaught exceptions and the given thread name format. @param logger an {@link com.google.common.base.Optional} wrapping the {@link org.slf4j.Logger} that the {@link LoggingUncaughtExceptionHandler} uses to log uncaught exceptions thrown in threads @param nameFormat an {@link com.google.common.base.Optional} wrapping a thread naming format @return a new {@link java.util.concurrent.ThreadFactory}
[ "Get", "a", "new", "{", "@link", "java", ".", "util", ".", "concurrent", ".", "ThreadFactory", "}", "that", "uses", "a", "{", "@link", "LoggingUncaughtExceptionHandler", "}", "to", "handle", "uncaught", "exceptions", "and", "the", "given", "thread", "name", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java#L89-L91
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java
ReferenceIndividualGroupService.primGetEntity
protected IEntity primGetEntity(String key, Class type) throws GroupsException { """ Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that the underlying entity actually exists. """ return entityFactory.newInstance(key, type); }
java
protected IEntity primGetEntity(String key, Class type) throws GroupsException { return entityFactory.newInstance(key, type); }
[ "protected", "IEntity", "primGetEntity", "(", "String", "key", ",", "Class", "type", ")", "throws", "GroupsException", "{", "return", "entityFactory", ".", "newInstance", "(", "key", ",", "type", ")", ";", "}" ]
Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that the underlying entity actually exists.
[ "Returns", "an", "<code", ">", "IEntity<", "/", "code", ">", "representing", "a", "portal", "entity", ".", "This", "does", "not", "guarantee", "that", "the", "underlying", "entity", "actually", "exists", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java#L693-L695
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java
ImageUtils.getSubimage
public static BufferedImage getSubimage( BufferedImage image, int x, int y, int w, int h ) { """ Returns a *copy* of a subimage of image. This avoids the performance problems associated with BufferedImage.getSubimage. @param image the image @param x the x position @param y the y position @param w the width @param h the height @return the subimage """ BufferedImage newImage = new BufferedImage( w, h, BufferedImage.TYPE_INT_ARGB ); Graphics2D g = newImage.createGraphics(); g.drawRenderedImage( image, AffineTransform.getTranslateInstance(-x, -y) ); g.dispose(); return newImage; }
java
public static BufferedImage getSubimage( BufferedImage image, int x, int y, int w, int h ) { BufferedImage newImage = new BufferedImage( w, h, BufferedImage.TYPE_INT_ARGB ); Graphics2D g = newImage.createGraphics(); g.drawRenderedImage( image, AffineTransform.getTranslateInstance(-x, -y) ); g.dispose(); return newImage; }
[ "public", "static", "BufferedImage", "getSubimage", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "BufferedImage", "newImage", "=", "new", "BufferedImage", "(", "w", ",", "h", ",", "BufferedI...
Returns a *copy* of a subimage of image. This avoids the performance problems associated with BufferedImage.getSubimage. @param image the image @param x the x position @param y the y position @param w the width @param h the height @return the subimage
[ "Returns", "a", "*", "copy", "*", "of", "a", "subimage", "of", "image", ".", "This", "avoids", "the", "performance", "problems", "associated", "with", "BufferedImage", ".", "getSubimage", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageUtils.java#L75-L81
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/Console.java
Console.changeWorkspaceInURL
public void changeWorkspaceInURL(String name, boolean changeHistory) { """ Changes workspace in the URL displayed by browser. @param name the name of the repository. @param changeHistory if true store URL changes in browser's history. """ jcrURL.setWorkspace(name); if (changeHistory) { htmlHistory.newItem(jcrURL.toString(), false); } }
java
public void changeWorkspaceInURL(String name, boolean changeHistory) { jcrURL.setWorkspace(name); if (changeHistory) { htmlHistory.newItem(jcrURL.toString(), false); } }
[ "public", "void", "changeWorkspaceInURL", "(", "String", "name", ",", "boolean", "changeHistory", ")", "{", "jcrURL", ".", "setWorkspace", "(", "name", ")", ";", "if", "(", "changeHistory", ")", "{", "htmlHistory", ".", "newItem", "(", "jcrURL", ".", "toStri...
Changes workspace in the URL displayed by browser. @param name the name of the repository. @param changeHistory if true store URL changes in browser's history.
[ "Changes", "workspace", "in", "the", "URL", "displayed", "by", "browser", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/Console.java#L263-L268
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeGitCommandReturn
private String executeGitCommandReturn(final String... args) throws CommandLineException, MojoFailureException { """ Executes Git command and returns output. @param args Git command line arguments. @return Command output. @throws CommandLineException @throws MojoFailureException """ return executeCommand(cmdGit, true, null, args).getOut(); }
java
private String executeGitCommandReturn(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, true, null, args).getOut(); }
[ "private", "String", "executeGitCommandReturn", "(", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{", "return", "executeCommand", "(", "cmdGit", ",", "true", ",", "null", ",", "args", ")", ".", "getOut", ...
Executes Git command and returns output. @param args Git command line arguments. @return Command output. @throws CommandLineException @throws MojoFailureException
[ "Executes", "Git", "command", "and", "returns", "output", "." ]
train
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1008-L1011