repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/graphdb/query/vertex/SimpleVertexQueryProcessor.java
SimpleVertexQueryProcessor.vertexIds
public VertexList vertexIds() { LongArrayList list = new LongArrayList(); long previousId = 0; for (Long id : Iterables.transform(this,new Function<Entry, Long>() { @Nullable @Override public Long apply(@Nullable Entry entry) { return edgeSerializer.readRelation(entry,true,tx).getOtherVertexId(); } })) { list.add(id); if (id>=previousId && previousId>=0) previousId=id; else previousId=-1; } return new VertexLongList(tx,list,previousId>=0); }
java
public VertexList vertexIds() { LongArrayList list = new LongArrayList(); long previousId = 0; for (Long id : Iterables.transform(this,new Function<Entry, Long>() { @Nullable @Override public Long apply(@Nullable Entry entry) { return edgeSerializer.readRelation(entry,true,tx).getOtherVertexId(); } })) { list.add(id); if (id>=previousId && previousId>=0) previousId=id; else previousId=-1; } return new VertexLongList(tx,list,previousId>=0); }
[ "public", "VertexList", "vertexIds", "(", ")", "{", "LongArrayList", "list", "=", "new", "LongArrayList", "(", ")", ";", "long", "previousId", "=", "0", ";", "for", "(", "Long", "id", ":", "Iterables", ".", "transform", "(", "this", ",", "new", "Function...
Returns the list of adjacent vertex ids for this query. By reading those ids from the entries directly (without creating objects) we get much better performance. @return
[ "Returns", "the", "list", "of", "adjacent", "vertex", "ids", "for", "this", "query", ".", "By", "reading", "those", "ids", "from", "the", "entries", "directly", "(", "without", "creating", "objects", ")", "we", "get", "much", "better", "performance", "." ]
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/query/vertex/SimpleVertexQueryProcessor.java#L88-L103
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java
ObjectOutputStream.writeNewClass
private int writeNewClass(Class<?> object, boolean unshared) throws IOException { output.writeByte(TC_CLASS); // Instances of java.lang.Class are always Serializable, even if their // instances aren't (e.g. java.lang.Object.class). // We cannot call lookup because it returns null if the parameter // represents instances that cannot be serialized, and that is not what // we want. ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(object); // The handle for the classDesc is NOT the handle for the class object // being dumped. We must allocate a new handle and return it. if (clDesc.isEnum()) { writeEnumDesc(clDesc, unshared); } else { writeClassDesc(clDesc, unshared); } int handle = nextHandle(); if (!unshared) { objectsWritten.put(object, handle); } return handle; }
java
private int writeNewClass(Class<?> object, boolean unshared) throws IOException { output.writeByte(TC_CLASS); // Instances of java.lang.Class are always Serializable, even if their // instances aren't (e.g. java.lang.Object.class). // We cannot call lookup because it returns null if the parameter // represents instances that cannot be serialized, and that is not what // we want. ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(object); // The handle for the classDesc is NOT the handle for the class object // being dumped. We must allocate a new handle and return it. if (clDesc.isEnum()) { writeEnumDesc(clDesc, unshared); } else { writeClassDesc(clDesc, unshared); } int handle = nextHandle(); if (!unshared) { objectsWritten.put(object, handle); } return handle; }
[ "private", "int", "writeNewClass", "(", "Class", "<", "?", ">", "object", ",", "boolean", "unshared", ")", "throws", "IOException", "{", "output", ".", "writeByte", "(", "TC_CLASS", ")", ";", "// Instances of java.lang.Class are always Serializable, even if their", "/...
Write class {@code object} into the receiver. It is assumed the class has not been dumped yet. Classes are not really dumped, but a class descriptor ({@code ObjectStreamClass}) that corresponds to them. Returns the handle for this object (class) which is dumped here. @param object The {@code java.lang.Class} object to dump @return the handle assigned to the class being dumped @throws IOException If an IO exception happened when writing the class.
[ "Write", "class", "{", "@code", "object", "}", "into", "the", "receiver", ".", "It", "is", "assumed", "the", "class", "has", "not", "been", "dumped", "yet", ".", "Classes", "are", "not", "really", "dumped", "but", "a", "class", "descriptor", "(", "{", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L1202-L1226
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/AdminInitiateAuthResult.java
AdminInitiateAuthResult.withChallengeParameters
public AdminInitiateAuthResult withChallengeParameters(java.util.Map<String, String> challengeParameters) { setChallengeParameters(challengeParameters); return this; }
java
public AdminInitiateAuthResult withChallengeParameters(java.util.Map<String, String> challengeParameters) { setChallengeParameters(challengeParameters); return this; }
[ "public", "AdminInitiateAuthResult", "withChallengeParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "challengeParameters", ")", "{", "setChallengeParameters", "(", "challengeParameters", ")", ";", "return", "this", ";", "}" ]
<p> The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you need to pass another challenge. The responses in this parameter should be used to compute inputs to the next call ( <code>AdminRespondToAuthChallenge</code>). </p> <p> All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable). </p> <p> The value of the <code>USER_ID_FOR_SRP</code> attribute will be the user's actual username, not an alias (such as email address or phone number), even if you specified an alias in your call to <code>AdminInitiateAuth</code>. This is because, in the <code>AdminRespondToAuthChallenge</code> API <code>ChallengeResponses</code>, the <code>USERNAME</code> attribute cannot be an alias. </p> @param challengeParameters The challenge parameters. These are returned to you in the <code>AdminInitiateAuth</code> response if you need to pass another challenge. The responses in this parameter should be used to compute inputs to the next call (<code>AdminRespondToAuthChallenge</code>).</p> <p> All challenges require <code>USERNAME</code> and <code>SECRET_HASH</code> (if applicable). </p> <p> The value of the <code>USER_ID_FOR_SRP</code> attribute will be the user's actual username, not an alias (such as email address or phone number), even if you specified an alias in your call to <code>AdminInitiateAuth</code>. This is because, in the <code>AdminRespondToAuthChallenge</code> API <code>ChallengeResponses</code>, the <code>USERNAME</code> attribute cannot be an alias. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "challenge", "parameters", ".", "These", "are", "returned", "to", "you", "in", "the", "<code", ">", "AdminInitiateAuth<", "/", "code", ">", "response", "if", "you", "need", "to", "pass", "another", "challenge", ".", "The", "responses", "i...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/AdminInitiateAuthResult.java#L920-L923
jbossas/jboss-invocation
src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java
MethodIdentifier.getIdentifier
public static MethodIdentifier getIdentifier(final String returnType, final String name, final String... parameterTypes) { return new MethodIdentifier(returnType, name, parameterTypes); }
java
public static MethodIdentifier getIdentifier(final String returnType, final String name, final String... parameterTypes) { return new MethodIdentifier(returnType, name, parameterTypes); }
[ "public", "static", "MethodIdentifier", "getIdentifier", "(", "final", "String", "returnType", ",", "final", "String", "name", ",", "final", "String", "...", "parameterTypes", ")", "{", "return", "new", "MethodIdentifier", "(", "returnType", ",", "name", ",", "p...
Construct a new instance using string names for the return and parameter types. @param returnType the return type name @param name the method name @param parameterTypes the method parameter type names @return the identifier
[ "Construct", "a", "new", "instance", "using", "string", "names", "for", "the", "return", "and", "parameter", "types", "." ]
train
https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/MethodIdentifier.java#L231-L233
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/expression/CustomFunctions.java
CustomFunctions.join
@SuppressWarnings({"rawtypes", "unchecked"}) public static String join(final Object[] array, final String delimiter, final TextPrinter printer) { Objects.requireNonNull(printer); if(array == null || array.length == 0) { return ""; } String value = Arrays.stream(array) .map(v -> printer.print(v)) .collect(Collectors.joining(defaultString(delimiter))); return value; }
java
@SuppressWarnings({"rawtypes", "unchecked"}) public static String join(final Object[] array, final String delimiter, final TextPrinter printer) { Objects.requireNonNull(printer); if(array == null || array.length == 0) { return ""; } String value = Arrays.stream(array) .map(v -> printer.print(v)) .collect(Collectors.joining(defaultString(delimiter))); return value; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "String", "join", "(", "final", "Object", "[", "]", "array", ",", "final", "String", "delimiter", ",", "final", "TextPrinter", "printer", ")", "{", "Object...
้…ๅˆ—ใฎๅ€คใ‚’็ตๅˆใ™ใ‚‹ใ€‚ @param array ็ตๅˆๅฏพ่ฑกใฎ้…ๅˆ— @param delimiter ๅŒบๅˆ‡ใ‚Šๆ–‡ๅญ— @param printer ้…ๅˆ—ใฎ่ฆ็ด ใฎๅ€คใฎใƒ•ใ‚ฉใƒผใƒžใƒƒใ‚ฟ @return ็ตๅˆใ—ใŸๆ–‡ๅญ—ๅˆ—ใ‚’่ฟ”ใ™ใ€‚็ตๅˆใฎๅฏพ่ฑกใฎ้…ๅˆ—ใŒnulใฎๅ ดๅˆใ€็ฉบๆ–‡ๅญ—ใ‚’่ฟ”ใ™ใ€‚ @throws NullPointerException {@literal printer is null.}
[ "้…ๅˆ—ใฎๅ€คใ‚’็ตๅˆใ™ใ‚‹ใ€‚" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/expression/CustomFunctions.java#L85-L99
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java
ComponentFactory.newEmailTextField
public static EmailTextField newEmailTextField(final String id, final IModel<String> model) { final EmailTextField emailTextField = new EmailTextField(id, model); emailTextField.setOutputMarkupId(true); return emailTextField; }
java
public static EmailTextField newEmailTextField(final String id, final IModel<String> model) { final EmailTextField emailTextField = new EmailTextField(id, model); emailTextField.setOutputMarkupId(true); return emailTextField; }
[ "public", "static", "EmailTextField", "newEmailTextField", "(", "final", "String", "id", ",", "final", "IModel", "<", "String", ">", "model", ")", "{", "final", "EmailTextField", "emailTextField", "=", "new", "EmailTextField", "(", "id", ",", "model", ")", ";"...
Factory method for create a new {@link EmailTextField}. @param id the id @param model the model @return the new {@link EmailTextField}.
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "EmailTextField", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L219-L224
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.zip
public static File zip(File srcFile, Charset charset) throws UtilException { final File zipFile = FileUtil.file(srcFile.getParentFile(), FileUtil.mainName(srcFile) + ".zip"); zip(zipFile, charset, false, srcFile); return zipFile; }
java
public static File zip(File srcFile, Charset charset) throws UtilException { final File zipFile = FileUtil.file(srcFile.getParentFile(), FileUtil.mainName(srcFile) + ".zip"); zip(zipFile, charset, false, srcFile); return zipFile; }
[ "public", "static", "File", "zip", "(", "File", "srcFile", ",", "Charset", "charset", ")", "throws", "UtilException", "{", "final", "File", "zipFile", "=", "FileUtil", ".", "file", "(", "srcFile", ".", "getParentFile", "(", ")", ",", "FileUtil", ".", "main...
ๆ‰“ๅŒ…ๅˆฐๅฝ“ๅ‰็›ฎๅฝ• @param srcFile ๆบๆ–‡ไปถๆˆ–็›ฎๅฝ• @param charset ็ผ–็  @return ๆ‰“ๅŒ…ๅฅฝ็š„ๅŽ‹็ผฉๆ–‡ไปถ @throws UtilException IOๅผ‚ๅธธ
[ "ๆ‰“ๅŒ…ๅˆฐๅฝ“ๅ‰็›ฎๅฝ•" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L83-L87
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VentoFoggia.java
VentoFoggia.findIdentical
public static Pattern findIdentical(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher) { return new VentoFoggia(query, atomMatcher, bondMatcher, false); }
java
public static Pattern findIdentical(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher) { return new VentoFoggia(query, atomMatcher, bondMatcher, false); }
[ "public", "static", "Pattern", "findIdentical", "(", "IAtomContainer", "query", ",", "AtomMatcher", "atomMatcher", ",", "BondMatcher", "bondMatcher", ")", "{", "return", "new", "VentoFoggia", "(", "query", ",", "atomMatcher", ",", "bondMatcher", ",", "false", ")",...
Create a pattern which can be used to find molecules which are the same as the {@code query} structure. @param query the substructure to find @param atomMatcher how atoms are matched @param bondMatcher how bonds are matched @return a pattern for finding the {@code query}
[ "Create", "a", "pattern", "which", "can", "be", "used", "to", "find", "molecules", "which", "are", "the", "same", "as", "the", "{", "@code", "query", "}", "structure", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VentoFoggia.java#L197-L199
vkostyukov/la4j
src/main/java/org/la4j/Vectors.java
Vectors.asAccumulatorProcedure
public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) { return new VectorProcedure() { @Override public void apply(int i, double value) { accumulator.update(i, value); } }; }
java
public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) { return new VectorProcedure() { @Override public void apply(int i, double value) { accumulator.update(i, value); } }; }
[ "public", "static", "VectorProcedure", "asAccumulatorProcedure", "(", "final", "VectorAccumulator", "accumulator", ")", "{", "return", "new", "VectorProcedure", "(", ")", "{", "@", "Override", "public", "void", "apply", "(", "int", "i", ",", "double", "value", "...
Creates an accumulator procedure that adapts a vector accumulator for procedure interface. This is useful for reusing a single accumulator for multiple fold operations in multiple vectors. @param accumulator the vector accumulator @return an accumulator procedure
[ "Creates", "an", "accumulator", "procedure", "that", "adapts", "a", "vector", "accumulator", "for", "procedure", "interface", ".", "This", "is", "useful", "for", "reusing", "a", "single", "accumulator", "for", "multiple", "fold", "operations", "in", "multiple", ...
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L457-L464
cojen/Cojen
src/main/java/org/cojen/util/ThrowUnchecked.java
ThrowUnchecked.fireDeclaredCause
public static void fireDeclaredCause(Throwable t, Class... declaredTypes) { if (t != null) { Throwable cause = t.getCause(); if (cause == null) { cause = t; } fireDeclared(cause, declaredTypes); } }
java
public static void fireDeclaredCause(Throwable t, Class... declaredTypes) { if (t != null) { Throwable cause = t.getCause(); if (cause == null) { cause = t; } fireDeclared(cause, declaredTypes); } }
[ "public", "static", "void", "fireDeclaredCause", "(", "Throwable", "t", ",", "Class", "...", "declaredTypes", ")", "{", "if", "(", "t", "!=", "null", ")", "{", "Throwable", "cause", "=", "t", ".", "getCause", "(", ")", ";", "if", "(", "cause", "==", ...
Throws the cause of the given exception if it is unchecked or an instance of any of the given declared types. Otherwise, it is thrown as an UndeclaredThrowableException. If the cause is null, then the original exception is thrown. This method only returns normally if the exception is null. @param t exception whose cause is to be thrown @param declaredTypes if exception is checked and is not an instance of any of these types, then it is thrown as an UndeclaredThrowableException.
[ "Throws", "the", "cause", "of", "the", "given", "exception", "if", "it", "is", "unchecked", "or", "an", "instance", "of", "any", "of", "the", "given", "declared", "types", ".", "Otherwise", "it", "is", "thrown", "as", "an", "UndeclaredThrowableException", "....
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/util/ThrowUnchecked.java#L206-L214
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.listByDatabase
public List<EventHubConnectionInner> listByDatabase(String resourceGroupName, String clusterName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); }
java
public List<EventHubConnectionInner> listByDatabase(String resourceGroupName, String clusterName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); }
[ "public", "List", "<", "EventHubConnectionInner", ">", "listByDatabase", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ")", "{", "return", "listByDatabaseWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterN...
Returns the list of Event Hub connections of the given Kusto database. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EventHubConnectionInner&gt; object if successful.
[ "Returns", "the", "list", "of", "Event", "Hub", "connections", "of", "the", "given", "Kusto", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L112-L114
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/AbstractTypeComputer.java
AbstractTypeComputer.findDeclaredType
protected <Type extends JvmType> Type findDeclaredType(String clazzName, ITypeReferenceOwner owner) { @SuppressWarnings("unchecked") Type result = (Type) services.getTypeReferences().findDeclaredType(clazzName, owner.getContextResourceSet()); return result; }
java
protected <Type extends JvmType> Type findDeclaredType(String clazzName, ITypeReferenceOwner owner) { @SuppressWarnings("unchecked") Type result = (Type) services.getTypeReferences().findDeclaredType(clazzName, owner.getContextResourceSet()); return result; }
[ "protected", "<", "Type", "extends", "JvmType", ">", "Type", "findDeclaredType", "(", "String", "clazzName", ",", "ITypeReferenceOwner", "owner", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Type", "result", "=", "(", "Type", ")", "services", ...
@param clazzName FQN of the type to find. see {@link org.eclipse.xtext.common.types.access.IJvmTypeProvider#findTypeByName(String)}. @param owner the reference owner @since 2.14
[ "@param", "clazzName", "FQN", "of", "the", "type", "to", "find", ".", "see", "{", "@link", "org", ".", "eclipse", ".", "xtext", ".", "common", ".", "types", ".", "access", ".", "IJvmTypeProvider#findTypeByName", "(", "String", ")", "}", ".", "@param", "o...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/AbstractTypeComputer.java#L111-L115
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/URLField.java
URLField.setupDefaultView
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { if (converter.getMaxLength() > ScreenConstants.MAX_SINGLE_CHARS) converter = new FieldLengthConverter((Converter)converter, ScreenConstants.MAX_SINGLE_CHARS); // Show as a single line. ScreenComponent sScreenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.URL); properties.put(ScreenModel.IMAGE, ScreenModel.URL); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return sScreenField; }
java
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { if (converter.getMaxLength() > ScreenConstants.MAX_SINGLE_CHARS) converter = new FieldLengthConverter((Converter)converter, ScreenConstants.MAX_SINGLE_CHARS); // Show as a single line. ScreenComponent sScreenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.URL); properties.put(ScreenModel.IMAGE, ScreenModel.URL); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return sScreenField; }
[ "public", "ScreenComponent", "setupDefaultView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "("...
Set up the default screen control for this field. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @return Return the component or ScreenField that is created for this field.
[ "Set", "up", "the", "default", "screen", "control", "for", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/URLField.java#L94-L106
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java
InodeTreePersistentState.updateLastModifiedAndChildCount
private void updateLastModifiedAndChildCount(long id, long opTimeMs, long deltaChildCount) { try (LockResource lr = mInodeLockManager.lockUpdate(id)) { MutableInodeDirectory inode = mInodeStore.getMutable(id).get().asDirectory(); boolean madeUpdate = false; if (inode.getLastModificationTimeMs() < opTimeMs) { inode.setLastModificationTimeMs(opTimeMs); madeUpdate = true; } if (deltaChildCount != 0) { inode.setChildCount(inode.getChildCount() + deltaChildCount); madeUpdate = true; } if (madeUpdate) { mInodeStore.writeInode(inode); } } }
java
private void updateLastModifiedAndChildCount(long id, long opTimeMs, long deltaChildCount) { try (LockResource lr = mInodeLockManager.lockUpdate(id)) { MutableInodeDirectory inode = mInodeStore.getMutable(id).get().asDirectory(); boolean madeUpdate = false; if (inode.getLastModificationTimeMs() < opTimeMs) { inode.setLastModificationTimeMs(opTimeMs); madeUpdate = true; } if (deltaChildCount != 0) { inode.setChildCount(inode.getChildCount() + deltaChildCount); madeUpdate = true; } if (madeUpdate) { mInodeStore.writeInode(inode); } } }
[ "private", "void", "updateLastModifiedAndChildCount", "(", "long", "id", ",", "long", "opTimeMs", ",", "long", "deltaChildCount", ")", "{", "try", "(", "LockResource", "lr", "=", "mInodeLockManager", ".", "lockUpdate", "(", "id", ")", ")", "{", "MutableInodeDire...
Updates the last modified time (LMT) for the indicated inode directory, and updates its child count. If the inode's LMT is already greater than the specified time, the inode's LMT will not be changed. @param id the inode to update @param opTimeMs the time of the operation that modified the inode @param deltaChildCount the change in inode directory child count
[ "Updates", "the", "last", "modified", "time", "(", "LMT", ")", "for", "the", "indicated", "inode", "directory", "and", "updates", "its", "child", "count", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java#L573-L589
javagl/CommonUI
src/main/java/de/javagl/common/ui/text/SearchableTextComponent.java
SearchableTextComponent.addHighlights
private void addHighlights(Collection<? extends Point> points, Color color) { removeHighlights(points); Map<Point, Object> newHighlights = JTextComponents.addHighlights(textComponent, points, color); highlights.putAll(newHighlights); }
java
private void addHighlights(Collection<? extends Point> points, Color color) { removeHighlights(points); Map<Point, Object> newHighlights = JTextComponents.addHighlights(textComponent, points, color); highlights.putAll(newHighlights); }
[ "private", "void", "addHighlights", "(", "Collection", "<", "?", "extends", "Point", ">", "points", ",", "Color", "color", ")", "{", "removeHighlights", "(", "points", ")", ";", "Map", "<", "Point", ",", "Object", ">", "newHighlights", "=", "JTextComponents"...
Add highlights with the given color to the text component for all the given points @param points The points, containing start and end indices @param color The color
[ "Add", "highlights", "with", "the", "given", "color", "to", "the", "text", "component", "for", "all", "the", "given", "points" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/text/SearchableTextComponent.java#L375-L381
windup/windup
config-xml/addon/src/main/java/org/jboss/windup/config/parser/ParserContext.java
ParserContext.processElement
@SuppressWarnings("unchecked") public <T> T processElement(Element element) throws ConfigurationException { String namespace = $(element).namespaceURI(); String tagName = $(element).tag(); ElementHandler<?> handler = handlers.get(new HandlerId(namespace, tagName)); if (handler != null) { Object o = handler.processElement(this, element); return (T) o; } throw new ConfigurationException("No Handler registered for element named [" + tagName + "] in namespace: [" + namespace + "]"); }
java
@SuppressWarnings("unchecked") public <T> T processElement(Element element) throws ConfigurationException { String namespace = $(element).namespaceURI(); String tagName = $(element).tag(); ElementHandler<?> handler = handlers.get(new HandlerId(namespace, tagName)); if (handler != null) { Object o = handler.processElement(this, element); return (T) o; } throw new ConfigurationException("No Handler registered for element named [" + tagName + "] in namespace: [" + namespace + "]"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "processElement", "(", "Element", "element", ")", "throws", "ConfigurationException", "{", "String", "namespace", "=", "$", "(", "element", ")", ".", "namespaceURI", "(", ")", ...
Process the provided {@link Element} with the appropriate handler for it's namespace and tag name.
[ "Process", "the", "provided", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config-xml/addon/src/main/java/org/jboss/windup/config/parser/ParserContext.java#L90-L103
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java
DateUtil.roundToDay
public static long roundToDay(final long pTime, final TimeZone pTimeZone) { int offset = pTimeZone.getOffset(pTime); return (((pTime + offset) / DAY) * DAY) - offset; }
java
public static long roundToDay(final long pTime, final TimeZone pTimeZone) { int offset = pTimeZone.getOffset(pTime); return (((pTime + offset) / DAY) * DAY) - offset; }
[ "public", "static", "long", "roundToDay", "(", "final", "long", "pTime", ",", "final", "TimeZone", "pTimeZone", ")", "{", "int", "offset", "=", "pTimeZone", ".", "getOffset", "(", "pTime", ")", ";", "return", "(", "(", "(", "pTime", "+", "offset", ")", ...
Rounds the given time down to the closest day, using the given timezone. @param pTime time @param pTimeZone the timezone to use when rounding @return the time rounded to the closest day.
[ "Rounds", "the", "given", "time", "down", "to", "the", "closest", "day", "using", "the", "given", "timezone", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java#L200-L203
Netflix/conductor
es6-persistence/src/main/java/com/netflix/conductor/dao/es6/index/ElasticSearchRestDAOV6.java
ElasticSearchRestDAOV6.initIndexTemplate
private void initIndexTemplate(String type) { String template = "template_" + type; try { if (doesResourceNotExist("/_template/" + template)) { logger.info("Creating the index template '" + template + "'"); InputStream stream = ElasticSearchDAOV6.class.getResourceAsStream("/" + template + ".json"); byte[] templateSource = IOUtils.toByteArray(stream); HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON); elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/" + template, Collections.emptyMap(), entity); } } catch (Exception e) { logger.error("Failed to init " + template, e); } }
java
private void initIndexTemplate(String type) { String template = "template_" + type; try { if (doesResourceNotExist("/_template/" + template)) { logger.info("Creating the index template '" + template + "'"); InputStream stream = ElasticSearchDAOV6.class.getResourceAsStream("/" + template + ".json"); byte[] templateSource = IOUtils.toByteArray(stream); HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON); elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/" + template, Collections.emptyMap(), entity); } } catch (Exception e) { logger.error("Failed to init " + template, e); } }
[ "private", "void", "initIndexTemplate", "(", "String", "type", ")", "{", "String", "template", "=", "\"template_\"", "+", "type", ";", "try", "{", "if", "(", "doesResourceNotExist", "(", "\"/_template/\"", "+", "template", ")", ")", "{", "logger", ".", "info...
Initializes the index with the required templates and mappings.
[ "Initializes", "the", "index", "with", "the", "required", "templates", "and", "mappings", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/es6-persistence/src/main/java/com/netflix/conductor/dao/es6/index/ElasticSearchRestDAOV6.java#L188-L202
paymill/paymill-java
src/main/java/com/paymill/services/TransactionService.java
TransactionService.createWithTokenAndFee
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, Fee fee ) { return this.createWithTokenAndFee( token, amount, currency, null, fee ); }
java
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, Fee fee ) { return this.createWithTokenAndFee( token, amount, currency, null, fee ); }
[ "public", "Transaction", "createWithTokenAndFee", "(", "String", "token", ",", "Integer", "amount", ",", "String", "currency", ",", "Fee", "fee", ")", "{", "return", "this", ".", "createWithTokenAndFee", "(", "token", ",", "amount", ",", "currency", ",", "null...
Executes a {@link Transaction} with token for the given amount in the given currency. @param token Token generated by PAYMILL Bridge, which represents a credit card or direct debit. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @param fee A {@link Fee}. @return {@link Transaction} object indicating whether a the call was successful or not.
[ "Executes", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L143-L145
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java
RespokeClient.setConversationsRead
public void setConversationsRead(final List<RespokeConversationReadStatus> updates, final Respoke.TaskCompletionListener completionListener) { if (!isConnected()) { Respoke.postTaskError(completionListener, "Can't complete request when not connected, " + "Please reconnect!"); return; } if ((updates == null) || (updates.size() == 0)) { Respoke.postTaskError(completionListener, "At least 1 conversation must be specified"); return; } JSONObject body = new JSONObject(); JSONArray groupsJsonArray = new JSONArray(); try { // Add each status object to the array. for (RespokeConversationReadStatus status : updates) { JSONObject jsonStatus = new JSONObject(); jsonStatus.put("groupId", status.groupId); jsonStatus.put("timestamp", status.timestamp.toString()); groupsJsonArray.put(jsonStatus); } // Set the array to the 'groups' property. body.put("groups", groupsJsonArray); } catch(JSONException e) { Respoke.postTaskError(completionListener, "Error forming JSON body to send."); return; } String urlEndpoint = "/v1/endpoints/" + localEndpointID + "/conversations"; signalingChannel.sendRESTMessage("put", urlEndpoint, body, new RespokeSignalingChannel.RESTListener() { @Override public void onSuccess(Object response) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (completionListener != null) { completionListener.onSuccess(); } } }); } @Override public void onError(final String errorMessage) { Respoke.postTaskError(completionListener, errorMessage); } }); }
java
public void setConversationsRead(final List<RespokeConversationReadStatus> updates, final Respoke.TaskCompletionListener completionListener) { if (!isConnected()) { Respoke.postTaskError(completionListener, "Can't complete request when not connected, " + "Please reconnect!"); return; } if ((updates == null) || (updates.size() == 0)) { Respoke.postTaskError(completionListener, "At least 1 conversation must be specified"); return; } JSONObject body = new JSONObject(); JSONArray groupsJsonArray = new JSONArray(); try { // Add each status object to the array. for (RespokeConversationReadStatus status : updates) { JSONObject jsonStatus = new JSONObject(); jsonStatus.put("groupId", status.groupId); jsonStatus.put("timestamp", status.timestamp.toString()); groupsJsonArray.put(jsonStatus); } // Set the array to the 'groups' property. body.put("groups", groupsJsonArray); } catch(JSONException e) { Respoke.postTaskError(completionListener, "Error forming JSON body to send."); return; } String urlEndpoint = "/v1/endpoints/" + localEndpointID + "/conversations"; signalingChannel.sendRESTMessage("put", urlEndpoint, body, new RespokeSignalingChannel.RESTListener() { @Override public void onSuccess(Object response) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (completionListener != null) { completionListener.onSuccess(); } } }); } @Override public void onError(final String errorMessage) { Respoke.postTaskError(completionListener, errorMessage); } }); }
[ "public", "void", "setConversationsRead", "(", "final", "List", "<", "RespokeConversationReadStatus", ">", "updates", ",", "final", "Respoke", ".", "TaskCompletionListener", "completionListener", ")", "{", "if", "(", "!", "isConnected", "(", ")", ")", "{", "Respok...
Mark messages in a conversation as having been read, up to the given timestamp @param updates An array of records, each of which indicates a groupId and timestamp of the the most recent message the client has "read". @param completionListener The callback called when this async operation has completed.
[ "Mark", "messages", "in", "a", "conversation", "as", "having", "been", "read", "up", "to", "the", "given", "timestamp" ]
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L735-L787
cycorp/api-suite
core-api/src/main/java/com/cyc/session/exception/SessionCommandException.java
SessionCommandException.fromThrowable
public static SessionCommandException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionCommandException && Objects.equals(message, cause.getMessage())) ? (SessionCommandException) cause : new SessionCommandException(message, cause); }
java
public static SessionCommandException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionCommandException && Objects.equals(message, cause.getMessage())) ? (SessionCommandException) cause : new SessionCommandException(message, cause); }
[ "public", "static", "SessionCommandException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "SessionCommandException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getM...
Converts a Throwable to a SessionCommandException with the specified detail message. If the Throwable is a SessionCommandException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionCommandException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionCommandException
[ "Converts", "a", "Throwable", "to", "a", "SessionCommandException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "SessionCommandException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "t...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommandException.java#L63-L67
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/remote/session/RemoteMessageProducer.java
RemoteMessageProducer.sendToDestination
@Override protected final void sendToDestination(Destination destination, boolean destinationOverride, Message srcMessage, int deliveryMode, int priority, long timeToLive) throws JMSException { externalAccessLock.readLock().lock(); try { checkNotClosed(); ((RemoteSession)session).dispatch(srcMessage); } finally { externalAccessLock.readLock().unlock(); } }
java
@Override protected final void sendToDestination(Destination destination, boolean destinationOverride, Message srcMessage, int deliveryMode, int priority, long timeToLive) throws JMSException { externalAccessLock.readLock().lock(); try { checkNotClosed(); ((RemoteSession)session).dispatch(srcMessage); } finally { externalAccessLock.readLock().unlock(); } }
[ "@", "Override", "protected", "final", "void", "sendToDestination", "(", "Destination", "destination", ",", "boolean", "destinationOverride", ",", "Message", "srcMessage", ",", "int", "deliveryMode", ",", "int", "priority", ",", "long", "timeToLive", ")", "throws", ...
/* (non-Javadoc) @see net.timewalker.ffmq4.common.session.AbstractMessageProducer#sendToDestination(javax.jms.Destination, boolean, javax.jms.Message, int, int, long)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/remote/session/RemoteMessageProducer.java#L45-L59
mscharhag/oleaster
oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcher.java
ExceptionMatcher.toThrow
public <T extends Exception> void toThrow(Class<T> expectedExceptionClass, String expectedMessage) { Arguments.ensureNotNull(expectedMessage, "expectedMessage cannot be null"); this.toThrow(expectedExceptionClass); String exceptionMessage = this.exception.getMessage(); Expectations.expectTrue(expectedMessage.equals(exceptionMessage), "Expected exception message '%s' but was '%s'", expectedMessage, exceptionMessage); }
java
public <T extends Exception> void toThrow(Class<T> expectedExceptionClass, String expectedMessage) { Arguments.ensureNotNull(expectedMessage, "expectedMessage cannot be null"); this.toThrow(expectedExceptionClass); String exceptionMessage = this.exception.getMessage(); Expectations.expectTrue(expectedMessage.equals(exceptionMessage), "Expected exception message '%s' but was '%s'", expectedMessage, exceptionMessage); }
[ "public", "<", "T", "extends", "Exception", ">", "void", "toThrow", "(", "Class", "<", "T", ">", "expectedExceptionClass", ",", "String", "expectedMessage", ")", "{", "Arguments", ".", "ensureNotNull", "(", "expectedMessage", ",", "\"expectedMessage cannot be null\"...
Checks if an exception of type {@code expectedExceptionClass} with message {@code expectedMessage} was thrown. <p>This method throws an {@code AssertionError} if: <ul> <li>no exception was thrown.</li> <li>the thrown exception is not an instance of {@code expectedExceptionClass}</li> <li>the message of the thrown exception is not equal {@code expectedMessage}</li> </ul> @param expectedExceptionClass the expected exception @param expectedMessage the expected message
[ "Checks", "if", "an", "exception", "of", "type", "{" ]
train
https://github.com/mscharhag/oleaster/blob/ce8c6fe2346cd0c0cf5f641417ff85019d1d09ac/oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcher.java#L67-L73
the-fascinator/plugin-authentication-internal
src/main/java/com/googlecode/fascinator/authentication/internal/InternalAuthentication.java
InternalAuthentication.logIn
@Override public User logIn(String username, String password) throws AuthenticationException { // Find our user String uPwd = file_store.getProperty(username); if (uPwd == null) { throw new AuthenticationException("User '" + username + "' not found."); } // Encrypt the password given by the user String ePwd = encryptPassword(password); // Compare them if (ePwd.equals(uPwd)) { return getUser(username); } else { throw new AuthenticationException("Invalid password."); } }
java
@Override public User logIn(String username, String password) throws AuthenticationException { // Find our user String uPwd = file_store.getProperty(username); if (uPwd == null) { throw new AuthenticationException("User '" + username + "' not found."); } // Encrypt the password given by the user String ePwd = encryptPassword(password); // Compare them if (ePwd.equals(uPwd)) { return getUser(username); } else { throw new AuthenticationException("Invalid password."); } }
[ "@", "Override", "public", "User", "logIn", "(", "String", "username", ",", "String", "password", ")", "throws", "AuthenticationException", "{", "// Find our user", "String", "uPwd", "=", "file_store", ".", "getProperty", "(", "username", ")", ";", "if", "(", ...
Tests the user's username/password validity. @param username The username of the user logging in. @param password The password of the user logging in. @return A user object for the newly logged in user. @throws AuthenticationException if there was an error logging in.
[ "Tests", "the", "user", "s", "username", "/", "password", "validity", "." ]
train
https://github.com/the-fascinator/plugin-authentication-internal/blob/a2b9a0eda9b43bf20583036a406c83c938be3042/src/main/java/com/googlecode/fascinator/authentication/internal/InternalAuthentication.java#L257-L274
glyptodon/guacamole-client
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
RestrictedGuacamoleTunnelService.tryAdd
private <T> boolean tryAdd(ConcurrentHashMultiset<T> multiset, T value, int max) { // Repeatedly attempt to add a new value to the given multiset until we // explicitly succeed or explicitly fail while (true) { // Get current number of values int count = multiset.count(value); // Bail out if the maximum has already been reached if (count >= max && max != 0) return false; // Attempt to add one more value if (multiset.setCount(value, count, count+1)) return true; // Try again if unsuccessful } }
java
private <T> boolean tryAdd(ConcurrentHashMultiset<T> multiset, T value, int max) { // Repeatedly attempt to add a new value to the given multiset until we // explicitly succeed or explicitly fail while (true) { // Get current number of values int count = multiset.count(value); // Bail out if the maximum has already been reached if (count >= max && max != 0) return false; // Attempt to add one more value if (multiset.setCount(value, count, count+1)) return true; // Try again if unsuccessful } }
[ "private", "<", "T", ">", "boolean", "tryAdd", "(", "ConcurrentHashMultiset", "<", "T", ">", "multiset", ",", "T", "value", ",", "int", "max", ")", "{", "// Repeatedly attempt to add a new value to the given multiset until we", "// explicitly succeed or explicitly fail", ...
Attempts to add a single instance of the given value to the given multiset without exceeding the specified maximum number of values. If the value cannot be added without exceeding the maximum, false is returned. @param <T> The type of values contained within the multiset. @param multiset The multiset to attempt to add a value to. @param value The value to attempt to add. @param max The maximum number of each distinct value that the given multiset should hold, or zero if no limit applies. @return true if the value was successfully added without exceeding the specified maximum, false if the value could not be added.
[ "Attempts", "to", "add", "a", "single", "instance", "of", "the", "given", "value", "to", "the", "given", "multiset", "without", "exceeding", "the", "specified", "maximum", "number", "of", "values", ".", "If", "the", "value", "cannot", "be", "added", "without...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java#L109-L130
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.acceptLanguage
public static ULocale acceptLanguage(String acceptLanguageList, ULocale[] availableLocales, boolean[] fallback) { if (acceptLanguageList == null) { throw new NullPointerException(); } ULocale acceptList[] = null; try { acceptList = parseAcceptLanguage(acceptLanguageList, true); } catch (ParseException pe) { acceptList = null; } if (acceptList == null) { return null; } return acceptLanguage(acceptList, availableLocales, fallback); }
java
public static ULocale acceptLanguage(String acceptLanguageList, ULocale[] availableLocales, boolean[] fallback) { if (acceptLanguageList == null) { throw new NullPointerException(); } ULocale acceptList[] = null; try { acceptList = parseAcceptLanguage(acceptLanguageList, true); } catch (ParseException pe) { acceptList = null; } if (acceptList == null) { return null; } return acceptLanguage(acceptList, availableLocales, fallback); }
[ "public", "static", "ULocale", "acceptLanguage", "(", "String", "acceptLanguageList", ",", "ULocale", "[", "]", "availableLocales", ",", "boolean", "[", "]", "fallback", ")", "{", "if", "(", "acceptLanguageList", "==", "null", ")", "{", "throw", "new", "NullPo...
<strong>[icu]</strong> Based on a HTTP formatted list of acceptable locales, determine an available locale for the user. NullPointerException is thrown if acceptLanguageList or availableLocales is null. If fallback is non-null, it will contain true if a fallback locale (one not in the acceptLanguageList) was returned. The value on entry is ignored. ULocale will be one of the locales in availableLocales, or the ROOT ULocale if if a ROOT locale was used as a fallback (because nothing else in availableLocales matched). No ULocale array element should be null; behavior is undefined if this is the case. @param acceptLanguageList list in HTTP "Accept-Language:" format of acceptable locales @param availableLocales list of available locales. One of these will be returned. @param fallback if non-null, a 1-element array containing a boolean to be set with the fallback status @return one of the locales from the availableLocales list, or null if none match
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Based", "on", "a", "HTTP", "formatted", "list", "of", "acceptable", "locales", "determine", "an", "available", "locale", "for", "the", "user", ".", "NullPointerException", "is", "thrown", "if", "ac...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1922-L1937
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java
StringUtilities.skipLws
private static int skipLws(byte[] buf, int start) { int i; for (i = start; i < buf.length; i++) { if (!isLws(buf[i])) { return i; } } return i; }
java
private static int skipLws(byte[] buf, int start) { int i; for (i = start; i < buf.length; i++) { if (!isLws(buf[i])) { return i; } } return i; }
[ "private", "static", "int", "skipLws", "(", "byte", "[", "]", "buf", ",", "int", "start", ")", "{", "int", "i", ";", "for", "(", "i", "=", "start", ";", "i", "<", "buf", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "isLws", "(", ...
Skip all linear white spaces @param buf the buf which is being scanned for lws @param start the offset to start at @return the next position in buf which isn't a lws character
[ "Skip", "all", "linear", "white", "spaces" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java#L270-L280
konmik/nucleus
nucleus/src/main/java/nucleus/presenter/RxPresenter.java
RxPresenter.restartableFirst
public <T> void restartableFirst(int restartableId, final Func0<Observable<T>> observableFactory, final Action2<View, T> onNext) { restartableFirst(restartableId, observableFactory, onNext, null); }
java
public <T> void restartableFirst(int restartableId, final Func0<Observable<T>> observableFactory, final Action2<View, T> onNext) { restartableFirst(restartableId, observableFactory, onNext, null); }
[ "public", "<", "T", ">", "void", "restartableFirst", "(", "int", "restartableId", ",", "final", "Func0", "<", "Observable", "<", "T", ">", ">", "observableFactory", ",", "final", "Action2", "<", "View", ",", "T", ">", "onNext", ")", "{", "restartableFirst"...
This is a shortcut for calling {@link #restartableFirst(int, Func0, Action2, Action2)} with the last parameter = null.
[ "This", "is", "a", "shortcut", "for", "calling", "{" ]
train
https://github.com/konmik/nucleus/blob/b161484a2bbf66a7896a8c1f61fa7187856ca5f7/nucleus/src/main/java/nucleus/presenter/RxPresenter.java#L147-L149
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_GET
public ArrayList<String> domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_GET(String domain, String accountName, String destinationServiceName, Long quota) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress"; StringBuilder sb = path(qPath, domain, accountName, destinationServiceName); query(sb, "quota", quota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_GET(String domain, String accountName, String destinationServiceName, Long quota) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress"; StringBuilder sb = path(qPath, domain, accountName, destinationServiceName); query(sb, "quota", quota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_GET", "(", "String", "domain", ",", "String", "accountName", ",", "String", "destinationServiceName", ",", "Long", "quota", ")", "throws", "IOExceptio...
List of email address available for migration REST: GET /email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress @param quota [required] Account maximum size @param domain [required] Name of your domain name @param accountName [required] Name of account @param destinationServiceName [required] Service name allowed as migration destination API beta
[ "List", "of", "email", "address", "available", "for", "migration" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L467-L473
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseSdense2hyb
public static int cusparseSdense2hyb( cusparseHandle handle, int m, int n, cusparseMatDescr descrA, Pointer A, int lda, Pointer nnzPerRow, cusparseHybMat hybA, int userEllWidth, int partitionType) { return checkResult(cusparseSdense2hybNative(handle, m, n, descrA, A, lda, nnzPerRow, hybA, userEllWidth, partitionType)); }
java
public static int cusparseSdense2hyb( cusparseHandle handle, int m, int n, cusparseMatDescr descrA, Pointer A, int lda, Pointer nnzPerRow, cusparseHybMat hybA, int userEllWidth, int partitionType) { return checkResult(cusparseSdense2hybNative(handle, m, n, descrA, A, lda, nnzPerRow, hybA, userEllWidth, partitionType)); }
[ "public", "static", "int", "cusparseSdense2hyb", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "int", "n", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "A", ",", "int", "lda", ",", "Pointer", "nnzPerRow", ",", "cusparseHybMat", "hybA", ",", "i...
Description: This routine converts a dense matrix to a sparse matrix in HYB storage format.
[ "Description", ":", "This", "routine", "converts", "a", "dense", "matrix", "to", "a", "sparse", "matrix", "in", "HYB", "storage", "format", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L11807-L11820
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.sendMessage
@ObjectiveCName("sendMessageWithPeer:withText:withMarkdownText:") public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable String markDownText) { sendMessage(peer, text, markDownText, null, false); }
java
@ObjectiveCName("sendMessageWithPeer:withText:withMarkdownText:") public void sendMessage(@NotNull Peer peer, @NotNull String text, @Nullable String markDownText) { sendMessage(peer, text, markDownText, null, false); }
[ "@", "ObjectiveCName", "(", "\"sendMessageWithPeer:withText:withMarkdownText:\"", ")", "public", "void", "sendMessage", "(", "@", "NotNull", "Peer", "peer", ",", "@", "NotNull", "String", "text", ",", "@", "Nullable", "String", "markDownText", ")", "{", "sendMessage...
Send Markdown Message @param peer destination peer @param text message text @param markDownText message markdown text
[ "Send", "Markdown", "Message" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L794-L797
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java
DscNodeConfigurationsInner.get
public DscNodeConfigurationInner get(String resourceGroupName, String automationAccountName, String nodeConfigurationName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName).toBlocking().single().body(); }
java
public DscNodeConfigurationInner get(String resourceGroupName, String automationAccountName, String nodeConfigurationName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName).toBlocking().single().body(); }
[ "public", "DscNodeConfigurationInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "nodeConfigurationName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", ...
Retrieve the Dsc node configurations by node configuration. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeConfigurationName The Dsc node configuration name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DscNodeConfigurationInner object if successful.
[ "Retrieve", "the", "Dsc", "node", "configurations", "by", "node", "configuration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java#L188-L190
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.datacenter_availabilities_GET
public ArrayList<OvhDatacenterAvailability> datacenter_availabilities_GET(String datacenters, Boolean excludeDatacenters, String memory, String planCode, String server, String storage) throws IOException { String qPath = "/dedicated/server/datacenter/availabilities"; StringBuilder sb = path(qPath); query(sb, "datacenters", datacenters); query(sb, "excludeDatacenters", excludeDatacenters); query(sb, "memory", memory); query(sb, "planCode", planCode); query(sb, "server", server); query(sb, "storage", storage); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
java
public ArrayList<OvhDatacenterAvailability> datacenter_availabilities_GET(String datacenters, Boolean excludeDatacenters, String memory, String planCode, String server, String storage) throws IOException { String qPath = "/dedicated/server/datacenter/availabilities"; StringBuilder sb = path(qPath); query(sb, "datacenters", datacenters); query(sb, "excludeDatacenters", excludeDatacenters); query(sb, "memory", memory); query(sb, "planCode", planCode); query(sb, "server", server); query(sb, "storage", storage); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
[ "public", "ArrayList", "<", "OvhDatacenterAvailability", ">", "datacenter_availabilities_GET", "(", "String", "datacenters", ",", "Boolean", "excludeDatacenters", ",", "String", "memory", ",", "String", "planCode", ",", "String", "server", ",", "String", "storage", ")...
List the availability of dedicated server REST: GET /dedicated/server/datacenter/availabilities @param planCode [required] The plan code in which the hardware is involved @param server [required] The name of the base hardware @param memory [required] The name of the memory hardware part @param storage [required] The name of the storage hardware part @param datacenters [required] The names of datacenters separated by commas @param excludeDatacenters [required] If true, all datacenters are returned except those listed in datacenters parameter API beta
[ "List", "the", "availability", "of", "dedicated", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2341-L2352
google/gwtmockito
gwtmockito/src/main/java/com/google/gwtmockito/GwtMockito.java
GwtMockito.useProviderForType
public static void useProviderForType(Class<?> type, FakeProvider<?> provider) { if (bridge == null) { throw new IllegalStateException("Must call initMocks() before calling useProviderForType()"); } if (bridge.registeredMocks.containsKey(type)) { throw new IllegalArgumentException( "Can't use a provider for a type that already has a @GwtMock declared"); } bridge.registeredProviders.put(type, provider); }
java
public static void useProviderForType(Class<?> type, FakeProvider<?> provider) { if (bridge == null) { throw new IllegalStateException("Must call initMocks() before calling useProviderForType()"); } if (bridge.registeredMocks.containsKey(type)) { throw new IllegalArgumentException( "Can't use a provider for a type that already has a @GwtMock declared"); } bridge.registeredProviders.put(type, provider); }
[ "public", "static", "void", "useProviderForType", "(", "Class", "<", "?", ">", "type", ",", "FakeProvider", "<", "?", ">", "provider", ")", "{", "if", "(", "bridge", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Must call initMocks...
Specifies that the given provider should be used to GWT.create instances of the given type and its subclasses. If multiple providers could produce a given class (for example, if a provide is registered for a type and its supertype), the provider for the more specific type is chosen. An exception is thrown if this type is ambiguous. Note that if you just want to return a Mockito mock from GWT.create, it's probably easier to use {@link GwtMock} instead.
[ "Specifies", "that", "the", "given", "provider", "should", "be", "used", "to", "GWT", ".", "create", "instances", "of", "the", "given", "type", "and", "its", "subclasses", ".", "If", "multiple", "providers", "could", "produce", "a", "given", "class", "(", ...
train
https://github.com/google/gwtmockito/blob/e886a9b9d290169b5f83582dd89b7545c5f198a2/gwtmockito/src/main/java/com/google/gwtmockito/GwtMockito.java#L162-L171
CloudSlang/cs-actions
cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java
AwsSignatureHelper.getAmazonCredentialScope
public String getAmazonCredentialScope(String dateStamp, String awsRegion, String awsService) { return dateStamp + SCOPE_SEPARATOR + awsRegion + SCOPE_SEPARATOR + awsService + SCOPE_SEPARATOR + AWS_REQUEST_VERSION; }
java
public String getAmazonCredentialScope(String dateStamp, String awsRegion, String awsService) { return dateStamp + SCOPE_SEPARATOR + awsRegion + SCOPE_SEPARATOR + awsService + SCOPE_SEPARATOR + AWS_REQUEST_VERSION; }
[ "public", "String", "getAmazonCredentialScope", "(", "String", "dateStamp", ",", "String", "awsRegion", ",", "String", "awsService", ")", "{", "return", "dateStamp", "+", "SCOPE_SEPARATOR", "+", "awsRegion", "+", "SCOPE_SEPARATOR", "+", "awsService", "+", "SCOPE_SEP...
Crates the amazon AWS credential scope (is represented by a slash-separated string of dimensions). @param dateStamp Request date stamp. (Format: "yyyyMMdd") @param awsRegion AWS region to which the request is sent. @param awsService AWS service to which the request is sent. @return A string representing the AWS credential scope.
[ "Crates", "the", "amazon", "AWS", "credential", "scope", "(", "is", "represented", "by", "a", "slash", "-", "separated", "string", "of", "dimensions", ")", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java#L146-L148
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.createGetBootstrapProfileNameIntent
public static Intent createGetBootstrapProfileNameIntent(Context context, EvernoteSession evernoteSession) { if (evernoteSession.isForceAuthenticationInThirdPartyApp()) { // we don't want to use the main app, return null return null; } EvernoteUtil.EvernoteInstallStatus installStatus = EvernoteUtil.getEvernoteInstallStatus(context, EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME); if (!EvernoteUtil.EvernoteInstallStatus.INSTALLED.equals(installStatus)) { return null; } return new Intent(EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME).setPackage(PACKAGE_NAME); }
java
public static Intent createGetBootstrapProfileNameIntent(Context context, EvernoteSession evernoteSession) { if (evernoteSession.isForceAuthenticationInThirdPartyApp()) { // we don't want to use the main app, return null return null; } EvernoteUtil.EvernoteInstallStatus installStatus = EvernoteUtil.getEvernoteInstallStatus(context, EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME); if (!EvernoteUtil.EvernoteInstallStatus.INSTALLED.equals(installStatus)) { return null; } return new Intent(EvernoteUtil.ACTION_GET_BOOTSTRAP_PROFILE_NAME).setPackage(PACKAGE_NAME); }
[ "public", "static", "Intent", "createGetBootstrapProfileNameIntent", "(", "Context", "context", ",", "EvernoteSession", "evernoteSession", ")", "{", "if", "(", "evernoteSession", ".", "isForceAuthenticationInThirdPartyApp", "(", ")", ")", "{", "// we don't want to use the m...
Returns an Intent to query the bootstrap profile name from the main Evernote app. This is useful if you want to use the main app to authenticate the user and he is already signed in. @param context The {@link Context} starting the {@link Intent}. @param evernoteSession The current session. @return An Intent to query the bootstrap profile name. Returns {@code null}, if the main app is not installed, not up to date or you do not want to use the main app to authenticate the user.
[ "Returns", "an", "Intent", "to", "query", "the", "bootstrap", "profile", "name", "from", "the", "main", "Evernote", "app", ".", "This", "is", "useful", "if", "you", "want", "to", "use", "the", "main", "app", "to", "authenticate", "the", "user", "and", "h...
train
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L338-L350
milaboratory/milib
src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java
BandedLinearAligner.alignSemiLocalLeft
public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2, int offset1, int length1, int offset2, int length2, int width, int stopPenalty) { try { int minLength = Math.min(length1, length2) + width + 1; length1 = Math.min(length1, minLength); length2 = Math.min(length2, minLength); MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET); BandedSemiLocalResult result = alignSemiLocalLeft0(scoring, seq1, seq2, offset1, length1, offset2, length2, width, stopPenalty, mutations, AlignmentCache.get()); return new Alignment<>(seq1, mutations.createAndDestroy(), new Range(offset1, result.sequence1Stop + 1), new Range(offset2, result.sequence2Stop + 1), result.score); } finally { AlignmentCache.release(); } }
java
public static Alignment<NucleotideSequence> alignSemiLocalLeft(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2, int offset1, int length1, int offset2, int length2, int width, int stopPenalty) { try { int minLength = Math.min(length1, length2) + width + 1; length1 = Math.min(length1, minLength); length2 = Math.min(length2, minLength); MutationsBuilder<NucleotideSequence> mutations = new MutationsBuilder<>(NucleotideSequence.ALPHABET); BandedSemiLocalResult result = alignSemiLocalLeft0(scoring, seq1, seq2, offset1, length1, offset2, length2, width, stopPenalty, mutations, AlignmentCache.get()); return new Alignment<>(seq1, mutations.createAndDestroy(), new Range(offset1, result.sequence1Stop + 1), new Range(offset2, result.sequence2Stop + 1), result.score); } finally { AlignmentCache.release(); } }
[ "public", "static", "Alignment", "<", "NucleotideSequence", ">", "alignSemiLocalLeft", "(", "LinearGapAlignmentScoring", "scoring", ",", "NucleotideSequence", "seq1", ",", "NucleotideSequence", "seq2", ",", "int", "offset1", ",", "int", "length1", ",", "int", "offset2...
Alignment which identifies what is the highly similar part of the both sequences. <p/> <p>Alignment is done in the way that beginning of second sequences is aligned to beginning of first sequence.</p> <p/> <p>Alignment terminates when score in banded alignment matrix reaches {@code stopPenalty} value.</p> <p/> <p>In other words, only left part of second sequence is to be aligned</p> @param scoring scoring system @param seq1 first sequence @param seq2 second sequence @param offset1 offset in first sequence @param length1 length of first sequence's part to be aligned @param offset2 offset in second sequence @param length2 length of second sequence's part to be aligned@param width @param stopPenalty alignment score value in banded alignment matrix at which alignment terminates @return object which contains positions at which alignment terminated and array of mutations
[ "Alignment", "which", "identifies", "what", "is", "the", "highly", "similar", "part", "of", "the", "both", "sequences", ".", "<p", "/", ">", "<p", ">", "Alignment", "is", "done", "in", "the", "way", "that", "beginning", "of", "second", "sequences", "is", ...
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/BandedLinearAligner.java#L665-L681
motown-io/motown
ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/service/AuthorizationService.java
AuthorizationService.updateLastSynchronizationDate
private void updateLastSynchronizationDate(Date syncDate, Integer subscriptionId) { TokenSyncDate tokenSyncDate = ocpiRepository.getTokenSyncDate(subscriptionId); if (tokenSyncDate == null) { tokenSyncDate = new TokenSyncDate(); tokenSyncDate.setSubscriptionId(subscriptionId); } tokenSyncDate.setSyncDate(syncDate); ocpiRepository.insertOrUpdate(tokenSyncDate); }
java
private void updateLastSynchronizationDate(Date syncDate, Integer subscriptionId) { TokenSyncDate tokenSyncDate = ocpiRepository.getTokenSyncDate(subscriptionId); if (tokenSyncDate == null) { tokenSyncDate = new TokenSyncDate(); tokenSyncDate.setSubscriptionId(subscriptionId); } tokenSyncDate.setSyncDate(syncDate); ocpiRepository.insertOrUpdate(tokenSyncDate); }
[ "private", "void", "updateLastSynchronizationDate", "(", "Date", "syncDate", ",", "Integer", "subscriptionId", ")", "{", "TokenSyncDate", "tokenSyncDate", "=", "ocpiRepository", ".", "getTokenSyncDate", "(", "subscriptionId", ")", ";", "if", "(", "tokenSyncDate", "=="...
Updates the last sync date for the passed subscription. @param syncDate date of the last sync @param subscriptionId the subscription that should be updated
[ "Updates", "the", "last", "sync", "date", "for", "the", "passed", "subscription", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpi/ocpi-identification-authorization-plugin/src/main/java/io/motown/ocpi/service/AuthorizationService.java#L109-L119
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.addBlock
Block addBlock(String path, INode[] inodes, Block block) throws IOException { waitForReady(); writeLock(); try { INodeFile fileNode = (INodeFile) inodes[inodes.length-1]; INode.enforceRegularStorageINode(fileNode, "addBlock only works for regular file, not " + path); // check quota limits and updated space consumed updateCount(inodes, inodes.length-1, 0, fileNode.getPreferredBlockSize()*fileNode.getReplication(), true); // associate the new list of blocks with this file BlockInfo blockInfo = getFSNamesystem().blocksMap.addINode(block, fileNode, fileNode.getReplication()); fileNode.getStorage().addBlock(blockInfo); if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: " + path + " with " + block + " block is added to the in-memory " + "file system"); } } finally { writeUnlock(); } return block; }
java
Block addBlock(String path, INode[] inodes, Block block) throws IOException { waitForReady(); writeLock(); try { INodeFile fileNode = (INodeFile) inodes[inodes.length-1]; INode.enforceRegularStorageINode(fileNode, "addBlock only works for regular file, not " + path); // check quota limits and updated space consumed updateCount(inodes, inodes.length-1, 0, fileNode.getPreferredBlockSize()*fileNode.getReplication(), true); // associate the new list of blocks with this file BlockInfo blockInfo = getFSNamesystem().blocksMap.addINode(block, fileNode, fileNode.getReplication()); fileNode.getStorage().addBlock(blockInfo); if (NameNode.stateChangeLog.isDebugEnabled()) { NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: " + path + " with " + block + " block is added to the in-memory " + "file system"); } } finally { writeUnlock(); } return block; }
[ "Block", "addBlock", "(", "String", "path", ",", "INode", "[", "]", "inodes", ",", "Block", "block", ")", "throws", "IOException", "{", "waitForReady", "(", ")", ";", "writeLock", "(", ")", ";", "try", "{", "INodeFile", "fileNode", "=", "(", "INodeFile",...
Add a block to the file. Returns a reference to the added block.
[ "Add", "a", "block", "to", "the", "file", ".", "Returns", "a", "reference", "to", "the", "added", "block", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L444-L473
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java
ST_GeometryShadow.computeShadow
public static Geometry computeShadow(Geometry geometry, double azimuth, double altitude, double height, boolean doUnion) { if (geometry == null) { return null; } if (height <= 0) { throw new IllegalArgumentException("The height of the geometry must be greater than 0."); } //Compute the shadow offset double[] shadowOffSet = shadowOffset(azimuth, altitude, height); if (geometry instanceof Polygon) { return shadowPolygon((Polygon) geometry, shadowOffSet, geometry.getFactory(), doUnion); } else if (geometry instanceof LineString) { return shadowLine((LineString) geometry, shadowOffSet, geometry.getFactory(), doUnion); } else if (geometry instanceof Point) { return shadowPoint((Point) geometry, shadowOffSet, geometry.getFactory()); } else { throw new IllegalArgumentException("The shadow function supports only single geometry POINT, LINE or POLYGON."); } }
java
public static Geometry computeShadow(Geometry geometry, double azimuth, double altitude, double height, boolean doUnion) { if (geometry == null) { return null; } if (height <= 0) { throw new IllegalArgumentException("The height of the geometry must be greater than 0."); } //Compute the shadow offset double[] shadowOffSet = shadowOffset(azimuth, altitude, height); if (geometry instanceof Polygon) { return shadowPolygon((Polygon) geometry, shadowOffSet, geometry.getFactory(), doUnion); } else if (geometry instanceof LineString) { return shadowLine((LineString) geometry, shadowOffSet, geometry.getFactory(), doUnion); } else if (geometry instanceof Point) { return shadowPoint((Point) geometry, shadowOffSet, geometry.getFactory()); } else { throw new IllegalArgumentException("The shadow function supports only single geometry POINT, LINE or POLYGON."); } }
[ "public", "static", "Geometry", "computeShadow", "(", "Geometry", "geometry", ",", "double", "azimuth", ",", "double", "altitude", ",", "double", "height", ",", "boolean", "doUnion", ")", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "null", ...
Compute the shadow footprint based on @param geometry input geometry @param azimuth of the sun in radians @param altitude of the sun in radians @param height of the geometry @param doUnion unified or not the polygon shadows @return
[ "Compute", "the", "shadow", "footprint", "based", "on" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L105-L123
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XMLStringFactoryImpl.java
XMLStringFactoryImpl.newstr
public XMLString newstr(FastStringBuffer fsb, int start, int length) { return new XStringForFSB(fsb, start, length); }
java
public XMLString newstr(FastStringBuffer fsb, int start, int length) { return new XStringForFSB(fsb, start, length); }
[ "public", "XMLString", "newstr", "(", "FastStringBuffer", "fsb", ",", "int", "start", ",", "int", "length", ")", "{", "return", "new", "XStringForFSB", "(", "fsb", ",", "start", ",", "length", ")", ";", "}" ]
Create a XMLString from a FastStringBuffer. @param fsb FastStringBuffer reference, which must be non-null. @param start The start position in the array. @param length The number of characters to read from the array. @return An XMLString object that wraps the FastStringBuffer reference.
[ "Create", "a", "XMLString", "from", "a", "FastStringBuffer", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XMLStringFactoryImpl.java#L71-L74
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java
InputRecordCountHelper.writeRecordCount
@Deprecated public static void writeRecordCount (FileSystem fs, Path dir, long count) throws IOException { State state = loadState(fs, dir); state.setProp(CompactionSlaEventHelper.RECORD_COUNT_TOTAL, count); saveState(fs, dir, state); }
java
@Deprecated public static void writeRecordCount (FileSystem fs, Path dir, long count) throws IOException { State state = loadState(fs, dir); state.setProp(CompactionSlaEventHelper.RECORD_COUNT_TOTAL, count); saveState(fs, dir, state); }
[ "@", "Deprecated", "public", "static", "void", "writeRecordCount", "(", "FileSystem", "fs", ",", "Path", "dir", ",", "long", "count", ")", "throws", "IOException", "{", "State", "state", "=", "loadState", "(", "fs", ",", "dir", ")", ";", "state", ".", "s...
Write record count to a specific directory. File name is {@link InputRecordCountHelper#RECORD_COUNT_FILE} @param fs file system in use @param dir directory where a record file is located
[ "Write", "record", "count", "to", "a", "specific", "directory", ".", "File", "name", "is", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java#L185-L190
eyp/serfj
src/main/java/net/sf/serfj/client/Client.java
Client.putRequest
public Object putRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException { return this.postRequest(HttpMethod.PUT, restUrl, params); }
java
public Object putRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException { return this.postRequest(HttpMethod.PUT, restUrl, params); }
[ "public", "Object", "putRequest", "(", "String", "restUrl", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", ",", "WebServiceException", "{", "return", "this", ".", "postRequest", "(", "HttpMethod", ".", "PUT", ",", "res...
Do a PUT HTTP request to the given REST-URL. @param restUrl REST URL. @param params Parameters for adding to the query string. @throws IOException if the request go bad.
[ "Do", "a", "PUT", "HTTP", "request", "to", "the", "given", "REST", "-", "URL", "." ]
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/client/Client.java#L144-L146
JoeKerouac/utils
src/main/java/com/joe/utils/common/Algorithm.java
Algorithm.lcs
public static <T> List<T> lcs(List<T> arg0, List<T> arg1, Comparator<T> comparator) { if (arg0 == null || arg1 == null) { return Collections.emptyList(); } return lcs(arg0, arg1, comparator, 0, 0); }
java
public static <T> List<T> lcs(List<T> arg0, List<T> arg1, Comparator<T> comparator) { if (arg0 == null || arg1 == null) { return Collections.emptyList(); } return lcs(arg0, arg1, comparator, 0, 0); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "lcs", "(", "List", "<", "T", ">", "arg0", ",", "List", "<", "T", ">", "arg1", ",", "Comparator", "<", "T", ">", "comparator", ")", "{", "if", "(", "arg0", "==", "null", "||", "arg1", ...
ๆฑ‚ๆœ€้•ฟๅ…ฌๅ…ฑๅญๅบๅˆ—๏ผˆๆœ‰ๅฏ่ƒฝๆœ‰ๅคš็ง่งฃ๏ผŒ่ฏฅๆ–นๆณ•ๅช่ฟ”ๅ›žๅ…ถไธญไธ€็ง๏ผ‰ @param arg0 ็ฌฌไธ€ไธชๅบๅˆ— @param arg1 ็ฌฌไบŒไธชๅบๅˆ— @param comparator ๆฏ”่พƒๅ™จ @param <T> ๆ•ฐ็ป„ไธญๆ•ฐๆฎ็š„ๅฎž้™…็ฑปๅž‹ @return ไธคไธชๅบๅˆ—็š„ๅ…ฌๅ…ฑๅญๅบๅˆ—๏ผˆ่ฟ”ๅ›ž็š„ๆ˜ฏๅŽŸ้˜Ÿๅˆ—ไธญ็š„ๅ€’ๅบ๏ผ‰ ๏ผˆ้›†ๅˆ{1 ๏ผŒ 2 ๏ผŒ 3 ๏ผŒ 4}ๅ’Œ้›†ๅˆ{2 ๏ผŒ 3 ๏ผŒ 4 ๏ผŒ 1}็š„ๅ…ฌๅ…ฑๅญๅบๅˆ—่ฟ”ๅ›žๅ€ผไธบ{4 ๏ผŒ 3 ๏ผŒ 2}๏ผ‰
[ "ๆฑ‚ๆœ€้•ฟๅ…ฌๅ…ฑๅญๅบๅˆ—๏ผˆๆœ‰ๅฏ่ƒฝๆœ‰ๅคš็ง่งฃ๏ผŒ่ฏฅๆ–นๆณ•ๅช่ฟ”ๅ›žๅ…ถไธญไธ€็ง๏ผ‰" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/Algorithm.java#L24-L29
forge/furnace
container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java
Annotations.getAnnotation
public static <A extends Annotation> A getAnnotation(final Annotation a, final Class<A> type) { Set<Annotation> seen = new HashSet<>(); return getAnnotation(seen, a, type); }
java
public static <A extends Annotation> A getAnnotation(final Annotation a, final Class<A> type) { Set<Annotation> seen = new HashSet<>(); return getAnnotation(seen, a, type); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "final", "Annotation", "a", ",", "final", "Class", "<", "A", ">", "type", ")", "{", "Set", "<", "Annotation", ">", "seen", "=", "new", "HashSet", "<>", "(", ")", "...
Inspect annotation <b>a</b> for a specific <b>type</b> of annotation. This also discovers annotations defined through a @ {@link Stereotype}. @param m The method to inspect. @param type The targeted annotation class @return The annotation instance found on this method or enclosing class, or null if no matching annotation was found.
[ "Inspect", "annotation", "<b", ">", "a<", "/", "b", ">", "for", "a", "specific", "<b", ">", "type<", "/", "b", ">", "of", "annotation", ".", "This", "also", "discovers", "annotations", "defined", "through", "a", "@", "{", "@link", "Stereotype", "}", "....
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java#L131-L135
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_sshkey_keyId_GET
public OvhSshKeyDetail project_serviceName_sshkey_keyId_GET(String serviceName, String keyId) throws IOException { String qPath = "/cloud/project/{serviceName}/sshkey/{keyId}"; StringBuilder sb = path(qPath, serviceName, keyId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSshKeyDetail.class); }
java
public OvhSshKeyDetail project_serviceName_sshkey_keyId_GET(String serviceName, String keyId) throws IOException { String qPath = "/cloud/project/{serviceName}/sshkey/{keyId}"; StringBuilder sb = path(qPath, serviceName, keyId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSshKeyDetail.class); }
[ "public", "OvhSshKeyDetail", "project_serviceName_sshkey_keyId_GET", "(", "String", "serviceName", ",", "String", "keyId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/sshkey/{keyId}\"", ";", "StringBuilder", "sb", "=", "path", ...
Get SSH key REST: GET /cloud/project/{serviceName}/sshkey/{keyId} @param keyId [required] SSH key id @param serviceName [required] Project name
[ "Get", "SSH", "key" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1526-L1531
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java
UtilMath.getDistance
public static double getDistance(double x1, double y1, double x2, double y2, int w2, int h2) { final double maxX = x2 + w2; final double maxY = y2 + h2; double min = getDistance(x1, y1, x2, y2); for (double x = x2; Double.compare(x, maxX) <= 0; x++) { for (double y = y2; Double.compare(y, maxY) <= 0; y++) { final double dist = getDistance(x1, y1, x, y); if (dist < min) { min = dist; } } } return min; }
java
public static double getDistance(double x1, double y1, double x2, double y2, int w2, int h2) { final double maxX = x2 + w2; final double maxY = y2 + h2; double min = getDistance(x1, y1, x2, y2); for (double x = x2; Double.compare(x, maxX) <= 0; x++) { for (double y = y2; Double.compare(y, maxY) <= 0; y++) { final double dist = getDistance(x1, y1, x, y); if (dist < min) { min = dist; } } } return min; }
[ "public", "static", "double", "getDistance", "(", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ",", "int", "w2", ",", "int", "h2", ")", "{", "final", "double", "maxX", "=", "x2", "+", "w2", ";", "final", "double", ...
Get distance from point to area. @param x1 The first area x. @param y1 The first area y. @param x2 The second area x. @param y2 The second area y. @param w2 The second area width. @param h2 The second area height. @return The distance between them.
[ "Get", "distance", "from", "point", "to", "area", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L214-L232
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java
Transform2D.getScaleRotate2x2
@SuppressWarnings("checkstyle:magicnumber") protected void getScaleRotate2x2(double[] scales, double[] rots) { final double[] tmp = new double[9]; tmp[0] = this.m00; tmp[1] = this.m01; tmp[2] = 0; tmp[3] = this.m10; tmp[4] = this.m11; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; tmp[8] = 0; computeSVD(tmp, scales, rots); }
java
@SuppressWarnings("checkstyle:magicnumber") protected void getScaleRotate2x2(double[] scales, double[] rots) { final double[] tmp = new double[9]; tmp[0] = this.m00; tmp[1] = this.m01; tmp[2] = 0; tmp[3] = this.m10; tmp[4] = this.m11; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; tmp[8] = 0; computeSVD(tmp, scales, rots); }
[ "@", "SuppressWarnings", "(", "\"checkstyle:magicnumber\"", ")", "protected", "void", "getScaleRotate2x2", "(", "double", "[", "]", "scales", ",", "double", "[", "]", "rots", ")", "{", "final", "double", "[", "]", "tmp", "=", "new", "double", "[", "9", "]"...
Perform SVD on the 2x2 matrix containing the rotation and scaling factors. @param scales the scaling factors. @param rots the rotation factors.
[ "Perform", "SVD", "on", "the", "2x2", "matrix", "containing", "the", "rotation", "and", "scaling", "factors", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java#L287-L304
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_task_taskId_GET
public OvhLoadBalancingTask loadBalancing_serviceName_task_taskId_GET(String serviceName, Long taskId) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/task/{taskId}"; StringBuilder sb = path(qPath, serviceName, taskId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLoadBalancingTask.class); }
java
public OvhLoadBalancingTask loadBalancing_serviceName_task_taskId_GET(String serviceName, Long taskId) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/task/{taskId}"; StringBuilder sb = path(qPath, serviceName, taskId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLoadBalancingTask.class); }
[ "public", "OvhLoadBalancingTask", "loadBalancing_serviceName_task_taskId_GET", "(", "String", "serviceName", ",", "Long", "taskId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/loadBalancing/{serviceName}/task/{taskId}\"", ";", "StringBuilder", "sb", "=",...
Get this object properties REST: GET /ip/loadBalancing/{serviceName}/task/{taskId} @param serviceName [required] The internal name of your IP load balancing @param taskId [required] Identifier of your task
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1307-L1312
deephacks/confit
api-model/src/main/java/org/deephacks/confit/serialization/Reflections.java
Reflections.computeClassHierarchy
private static void computeClassHierarchy(Class<?> clazz, List<Class<?>> classes) { for (Class<?> current = clazz; current != null; current = current.getSuperclass()) { if (classes.contains(current)) { return; } classes.add(current); for (Class<?> currentInterface : current.getInterfaces()) { computeClassHierarchy(currentInterface, classes); } } }
java
private static void computeClassHierarchy(Class<?> clazz, List<Class<?>> classes) { for (Class<?> current = clazz; current != null; current = current.getSuperclass()) { if (classes.contains(current)) { return; } classes.add(current); for (Class<?> currentInterface : current.getInterfaces()) { computeClassHierarchy(currentInterface, classes); } } }
[ "private", "static", "void", "computeClassHierarchy", "(", "Class", "<", "?", ">", "clazz", ",", "List", "<", "Class", "<", "?", ">", ">", "classes", ")", "{", "for", "(", "Class", "<", "?", ">", "current", "=", "clazz", ";", "current", "!=", "null",...
Get list superclasses and interfaces recursively. @param clazz The class to start the search with. @param classes List of classes to which to add list found super classes and interfaces.
[ "Get", "list", "superclasses", "and", "interfaces", "recursively", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/serialization/Reflections.java#L79-L89
whitesource/agents
wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java
ZipUtils.decompressString
public static void decompressString(InputStream inputStream, OutputStream outputStream) throws IOException { try (InputStream bufferedInputStream = new BufferedInputStream(inputStream); PrintWriter printWriter = new PrintWriter(outputStream);) { byte[] buffer = new byte[BYTES_BUFFER_SIZE]; int len; while ((len = bufferedInputStream.read(buffer)) > 0) { String val = new String(buffer, StandardCharsets.UTF_8); String str = decompressString(val); printWriter.write(str); } } }
java
public static void decompressString(InputStream inputStream, OutputStream outputStream) throws IOException { try (InputStream bufferedInputStream = new BufferedInputStream(inputStream); PrintWriter printWriter = new PrintWriter(outputStream);) { byte[] buffer = new byte[BYTES_BUFFER_SIZE]; int len; while ((len = bufferedInputStream.read(buffer)) > 0) { String val = new String(buffer, StandardCharsets.UTF_8); String str = decompressString(val); printWriter.write(str); } } }
[ "public", "static", "void", "decompressString", "(", "InputStream", "inputStream", ",", "OutputStream", "outputStream", ")", "throws", "IOException", "{", "try", "(", "InputStream", "bufferedInputStream", "=", "new", "BufferedInputStream", "(", "inputStream", ")", ";"...
The method decompresses the big strings using gzip - low memory via Streams @param inputStream @param outputStream @throws IOException
[ "The", "method", "decompresses", "the", "big", "strings", "using", "gzip", "-", "low", "memory", "via", "Streams" ]
train
https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L205-L216
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/multithreading/AbstractDataBinder.java
AbstractDataBinder.loadData
@Nullable private DataType loadData(@NonNull final Task<DataType, KeyType, ViewType, ParamType> task) { try { DataType data = doInBackground(task.key, task.params); if (data != null) { cacheData(task.key, data); } logger.logInfo(getClass(), "Loaded data with key " + task.key); return data; } catch (Exception e) { logger.logError(getClass(), "An error occurred while loading data with key " + task.key, e); return null; } }
java
@Nullable private DataType loadData(@NonNull final Task<DataType, KeyType, ViewType, ParamType> task) { try { DataType data = doInBackground(task.key, task.params); if (data != null) { cacheData(task.key, data); } logger.logInfo(getClass(), "Loaded data with key " + task.key); return data; } catch (Exception e) { logger.logError(getClass(), "An error occurred while loading data with key " + task.key, e); return null; } }
[ "@", "Nullable", "private", "DataType", "loadData", "(", "@", "NonNull", "final", "Task", "<", "DataType", ",", "KeyType", ",", "ViewType", ",", "ParamType", ">", "task", ")", "{", "try", "{", "DataType", "data", "=", "doInBackground", "(", "task", ".", ...
Executes a specific task in order to load data. @param task The task, which should be executed, as an instance of the class {@link Task}. The task may not be null @return The data, which has been loaded, as an instance of the generic type DataType or null, if no data has been loaded
[ "Executes", "a", "specific", "task", "in", "order", "to", "load", "data", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/multithreading/AbstractDataBinder.java#L383-L399
xwiki/xwiki-commons
xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/XARMojo.java
XARMojo.performArchive
private void performArchive() throws Exception { // The source dir points to the target/classes directory where the Maven resources plugin // has copied the XAR files during the process-resources phase. // For package.xml, however, we look in the resources directory (i.e. src/main/resources). File sourceDir = new File(this.project.getBuild().getOutputDirectory()); // Check that there are files in the source dir if (sourceDir.listFiles() == null) { throw new Exception( String.format("No XAR XML files found in [%s]. Has the Maven Resource plugin be called?", sourceDir)); } File xarFile = new File(this.project.getBuild().getDirectory(), this.project.getArtifactId() + "-" + this.project.getVersion() + ".xar"); ZipArchiver archiver = new ZipArchiver(); archiver.setEncoding(this.encoding); archiver.setDestFile(xarFile); archiver.setIncludeEmptyDirs(false); archiver.setCompress(true); if (this.includeDependencies) { // Unzip dependent XARs on top of this project's XML documents but without overwriting // existing files since we want this project's files to be used if they override a file // present in a XAR dependency. unpackDependentXARs(); } // Perform XML transformations performTransformations(); // If no package.xml can be found at the top level of the current project, generate one // otherwise, try to use the existing one File resourcesDir = getResourcesDirectory(); if (!hasPackageXmlFile(resourcesDir)) { // Add files and generate the package.xml file addFilesToArchive(archiver, sourceDir); } else { File packageXml = new File(resourcesDir, PACKAGE_XML); addFilesToArchive(archiver, sourceDir, packageXml); } archiver.createArchive(); this.project.getArtifact().setFile(xarFile); }
java
private void performArchive() throws Exception { // The source dir points to the target/classes directory where the Maven resources plugin // has copied the XAR files during the process-resources phase. // For package.xml, however, we look in the resources directory (i.e. src/main/resources). File sourceDir = new File(this.project.getBuild().getOutputDirectory()); // Check that there are files in the source dir if (sourceDir.listFiles() == null) { throw new Exception( String.format("No XAR XML files found in [%s]. Has the Maven Resource plugin be called?", sourceDir)); } File xarFile = new File(this.project.getBuild().getDirectory(), this.project.getArtifactId() + "-" + this.project.getVersion() + ".xar"); ZipArchiver archiver = new ZipArchiver(); archiver.setEncoding(this.encoding); archiver.setDestFile(xarFile); archiver.setIncludeEmptyDirs(false); archiver.setCompress(true); if (this.includeDependencies) { // Unzip dependent XARs on top of this project's XML documents but without overwriting // existing files since we want this project's files to be used if they override a file // present in a XAR dependency. unpackDependentXARs(); } // Perform XML transformations performTransformations(); // If no package.xml can be found at the top level of the current project, generate one // otherwise, try to use the existing one File resourcesDir = getResourcesDirectory(); if (!hasPackageXmlFile(resourcesDir)) { // Add files and generate the package.xml file addFilesToArchive(archiver, sourceDir); } else { File packageXml = new File(resourcesDir, PACKAGE_XML); addFilesToArchive(archiver, sourceDir, packageXml); } archiver.createArchive(); this.project.getArtifact().setFile(xarFile); }
[ "private", "void", "performArchive", "(", ")", "throws", "Exception", "{", "// The source dir points to the target/classes directory where the Maven resources plugin", "// has copied the XAR files during the process-resources phase.", "// For package.xml, however, we look in the resources direct...
Create the XAR by zipping the resource files. @throws Exception if the zipping failed for some reason
[ "Create", "the", "XAR", "by", "zipping", "the", "resource", "files", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/XARMojo.java#L95-L140
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonWriter.java
JsonWriter.writeFeed
public String writeFeed(List<?> entities, String contextUrl, Map<String, Object> meta) throws ODataRenderException { this.contextURL = checkNotNull(contextUrl); try { return writeJson(entities, meta); } catch (IOException | IllegalAccessException | NoSuchFieldException | ODataEdmException | ODataRenderException e) { LOG.error("Not possible to marshall feed stream JSON"); throw new ODataRenderException("Not possible to marshall feed stream JSON: ", e); } }
java
public String writeFeed(List<?> entities, String contextUrl, Map<String, Object> meta) throws ODataRenderException { this.contextURL = checkNotNull(contextUrl); try { return writeJson(entities, meta); } catch (IOException | IllegalAccessException | NoSuchFieldException | ODataEdmException | ODataRenderException e) { LOG.error("Not possible to marshall feed stream JSON"); throw new ODataRenderException("Not possible to marshall feed stream JSON: ", e); } }
[ "public", "String", "writeFeed", "(", "List", "<", "?", ">", "entities", ",", "String", "contextUrl", ",", "Map", "<", "String", ",", "Object", ">", "meta", ")", "throws", "ODataRenderException", "{", "this", ".", "contextURL", "=", "checkNotNull", "(", "c...
Write a list of entities (feed) to the JSON stream. @param entities The list of entities to fill in the JSON stream. @param contextUrl The 'Context URL' to write. @param meta Additional metadata for the writer. @return the rendered feed. @throws ODataRenderException In case it is not possible to write to the JSON stream.
[ "Write", "a", "list", "of", "entities", "(", "feed", ")", "to", "the", "JSON", "stream", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonWriter.java#L104-L115
apache/incubator-gobblin
gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java
BaseJdbcBufferedInserter.executeBatchInsert
protected void executeBatchInsert(final PreparedStatement pstmt) { try { // Need a Callable interface to be wrapped by Retryer. this.retryer.wrap(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return insertBatch(pstmt); } }).call(); } catch (Exception e) { throw new RuntimeException("Failed to insert.", e); } resetBatch(); }
java
protected void executeBatchInsert(final PreparedStatement pstmt) { try { // Need a Callable interface to be wrapped by Retryer. this.retryer.wrap(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return insertBatch(pstmt); } }).call(); } catch (Exception e) { throw new RuntimeException("Failed to insert.", e); } resetBatch(); }
[ "protected", "void", "executeBatchInsert", "(", "final", "PreparedStatement", "pstmt", ")", "{", "try", "{", "// Need a Callable interface to be wrapped by Retryer.", "this", ".", "retryer", ".", "wrap", "(", "new", "Callable", "<", "Boolean", ">", "(", ")", "{", ...
Submits the user defined {@link #insertBatch(PreparedStatement)} call to the {@link Retryer} which takes care of resubmitting the records according to {@link #WRITER_JDBC_INSERT_RETRY_TIMEOUT} and {@link #WRITER_JDBC_INSERT_RETRY_MAX_ATTEMPT} when failure happens. @param pstmt PreparedStatement object
[ "Submits", "the", "user", "defined", "{", "@link", "#insertBatch", "(", "PreparedStatement", ")", "}", "call", "to", "the", "{", "@link", "Retryer", "}", "which", "takes", "care", "of", "resubmitting", "the", "records", "according", "to", "{", "@link", "#WRI...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java#L147-L160
code4everything/util
src/main/java/com/zhazhapan/util/dialog/Dialogs.java
Dialogs.showInputDialog
public static String showInputDialog(String title, String header, String content, String defaultValue) { TextInputDialog dialog = new TextInputDialog(defaultValue); dialog.setTitle(title); dialog.setHeaderText(header); dialog.setContentText(content); Optional<String> result = dialog.showAndWait(); return result.orElse(null); }
java
public static String showInputDialog(String title, String header, String content, String defaultValue) { TextInputDialog dialog = new TextInputDialog(defaultValue); dialog.setTitle(title); dialog.setHeaderText(header); dialog.setContentText(content); Optional<String> result = dialog.showAndWait(); return result.orElse(null); }
[ "public", "static", "String", "showInputDialog", "(", "String", "title", ",", "String", "header", ",", "String", "content", ",", "String", "defaultValue", ")", "{", "TextInputDialog", "dialog", "=", "new", "TextInputDialog", "(", "defaultValue", ")", ";", "dialo...
ๅผนๅ‡บ่พ“ๅ…ฅๆก† @param title ๆ ‡้ข˜ @param header ไฟกๆฏๅคด @param content ๅ†…ๅฎน @param defaultValue ่พ“ๅ…ฅๆก†้ป˜่ฎคๅ€ผ @return ่พ“ๅ…ฅ็š„ๅ†…ๅฎน
[ "ๅผนๅ‡บ่พ“ๅ…ฅๆก†" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Dialogs.java#L32-L40
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/FileUtils.java
FileUtils.sizeFromBytes
public static String sizeFromBytes(final long aByteCount, final boolean aAbbreviatedLabel) { long count; if ((count = aByteCount / 1073741824) > 0) { return count + (aAbbreviatedLabel ? " GB" : " gigabytes"); } else if ((count = aByteCount / 1048576) > 0) { return count + (aAbbreviatedLabel ? " MB" : " megabytes"); } else if ((count = aByteCount / 1024) > 0) { return count + (aAbbreviatedLabel ? " KB" : " kilobytes"); } return count + (aAbbreviatedLabel ? " B" : " bytes"); }
java
public static String sizeFromBytes(final long aByteCount, final boolean aAbbreviatedLabel) { long count; if ((count = aByteCount / 1073741824) > 0) { return count + (aAbbreviatedLabel ? " GB" : " gigabytes"); } else if ((count = aByteCount / 1048576) > 0) { return count + (aAbbreviatedLabel ? " MB" : " megabytes"); } else if ((count = aByteCount / 1024) > 0) { return count + (aAbbreviatedLabel ? " KB" : " kilobytes"); } return count + (aAbbreviatedLabel ? " B" : " bytes"); }
[ "public", "static", "String", "sizeFromBytes", "(", "final", "long", "aByteCount", ",", "final", "boolean", "aAbbreviatedLabel", ")", "{", "long", "count", ";", "if", "(", "(", "count", "=", "aByteCount", "/", "1073741824", ")", ">", "0", ")", "{", "return...
Returns a human readable size from a large number of bytes. You can specify that the human readable size use an abbreviated label (e.g., GB or MB). @param aByteCount A large number of bytes @param aAbbreviatedLabel Whether the label should be abbreviated @return A human readable size
[ "Returns", "a", "human", "readable", "size", "from", "a", "large", "number", "of", "bytes", ".", "You", "can", "specify", "that", "the", "human", "readable", "size", "use", "an", "abbreviated", "label", "(", "e", ".", "g", ".", "GB", "or", "MB", ")", ...
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L553-L565
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java
TxConfidenceTable.getOrCreate
public TransactionConfidence getOrCreate(Sha256Hash hash) { checkNotNull(hash); lock.lock(); try { WeakConfidenceReference reference = table.get(hash); if (reference != null) { TransactionConfidence confidence = reference.get(); if (confidence != null) return confidence; } TransactionConfidence newConfidence = confidenceFactory.createConfidence(hash); table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); return newConfidence; } finally { lock.unlock(); } }
java
public TransactionConfidence getOrCreate(Sha256Hash hash) { checkNotNull(hash); lock.lock(); try { WeakConfidenceReference reference = table.get(hash); if (reference != null) { TransactionConfidence confidence = reference.get(); if (confidence != null) return confidence; } TransactionConfidence newConfidence = confidenceFactory.createConfidence(hash); table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); return newConfidence; } finally { lock.unlock(); } }
[ "public", "TransactionConfidence", "getOrCreate", "(", "Sha256Hash", "hash", ")", "{", "checkNotNull", "(", "hash", ")", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "WeakConfidenceReference", "reference", "=", "table", ".", "get", "(", "hash", ")", ...
Returns the {@link TransactionConfidence} for the given hash if we have downloaded it, or null if that tx hash is unknown to the system at this time.
[ "Returns", "the", "{" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java#L164-L180
apache/incubator-zipkin
zipkin-server/src/main/java/zipkin2/server/internal/ZipkinHttpCollector.java
ZipkinHttpCollector.validateAndStoreSpans
HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, byte[] serializedSpans) { // logging already handled upstream in UnzippingBytesRequestConverter where request context exists if (serializedSpans.length == 0) return HttpResponse.of(HttpStatus.ACCEPTED); try { SpanBytesDecoderDetector.decoderForListMessage(serializedSpans); } catch (IllegalArgumentException e) { metrics.incrementMessagesDropped(); return HttpResponse.of( BAD_REQUEST, MediaType.PLAIN_TEXT_UTF_8, "Expected a " + decoder + " encoded list\n"); } SpanBytesDecoder unexpectedDecoder = testForUnexpectedFormat(decoder, serializedSpans); if (unexpectedDecoder != null) { metrics.incrementMessagesDropped(); return HttpResponse.of( BAD_REQUEST, MediaType.PLAIN_TEXT_UTF_8, "Expected a " + decoder + " encoded list, but received: " + unexpectedDecoder + "\n"); } CompletableCallback result = new CompletableCallback(); List<Span> spans = new ArrayList<>(); if (!decoder.decodeList(serializedSpans, spans)) { throw new IllegalArgumentException("Empty " + decoder.name() + " message"); } collector.accept(spans, result); return HttpResponse.from(result); }
java
HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, byte[] serializedSpans) { // logging already handled upstream in UnzippingBytesRequestConverter where request context exists if (serializedSpans.length == 0) return HttpResponse.of(HttpStatus.ACCEPTED); try { SpanBytesDecoderDetector.decoderForListMessage(serializedSpans); } catch (IllegalArgumentException e) { metrics.incrementMessagesDropped(); return HttpResponse.of( BAD_REQUEST, MediaType.PLAIN_TEXT_UTF_8, "Expected a " + decoder + " encoded list\n"); } SpanBytesDecoder unexpectedDecoder = testForUnexpectedFormat(decoder, serializedSpans); if (unexpectedDecoder != null) { metrics.incrementMessagesDropped(); return HttpResponse.of( BAD_REQUEST, MediaType.PLAIN_TEXT_UTF_8, "Expected a " + decoder + " encoded list, but received: " + unexpectedDecoder + "\n"); } CompletableCallback result = new CompletableCallback(); List<Span> spans = new ArrayList<>(); if (!decoder.decodeList(serializedSpans, spans)) { throw new IllegalArgumentException("Empty " + decoder.name() + " message"); } collector.accept(spans, result); return HttpResponse.from(result); }
[ "HttpResponse", "validateAndStoreSpans", "(", "SpanBytesDecoder", "decoder", ",", "byte", "[", "]", "serializedSpans", ")", "{", "// logging already handled upstream in UnzippingBytesRequestConverter where request context exists", "if", "(", "serializedSpans", ".", "length", "=="...
This synchronously decodes the message so that users can see data errors.
[ "This", "synchronously", "decodes", "the", "message", "so", "that", "users", "can", "see", "data", "errors", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-server/src/main/java/zipkin2/server/internal/ZipkinHttpCollector.java#L111-L137
looly/hutool
hutool-core/src/main/java/cn/hutool/core/builder/CompareToBuilder.java
CompareToBuilder.reflectionCompare
public static int reflectionCompare(final Object lhs, final Object rhs) { return reflectionCompare(lhs, rhs, false, null); }
java
public static int reflectionCompare(final Object lhs, final Object rhs) { return reflectionCompare(lhs, rhs, false, null); }
[ "public", "static", "int", "reflectionCompare", "(", "final", "Object", "lhs", ",", "final", "Object", "rhs", ")", "{", "return", "reflectionCompare", "(", "lhs", ",", "rhs", ",", "false", ",", "null", ")", ";", "}" ]
้€š่ฟ‡ๅๅฐ„ๆฏ”่พƒไธคไธชBeanๅฏน่ฑก๏ผŒๅฏน่ฑกๅญ—ๆฎตๅฏไปฅไธบprivateใ€‚ๆฏ”่พƒ่ง„ๅˆ™ๅฆ‚ไธ‹๏ผš <ul> <li>staticๅญ—ๆฎตไธๆฏ”่พƒ</li> <li>Transientๅญ—ๆฎตไธๅ‚ไธŽๆฏ”่พƒ</li> <li>็ˆถ็ฑปๅญ—ๆฎตๅ‚ไธŽๆฏ”่พƒ</li> </ul> <p> ๅฆ‚ๆžœ่ขซๆฏ”่พƒ็š„ไธคไธชๅฏน่ฑก้ƒฝไธบ<code>null</code>๏ผŒ่ขซ่ฎคไธบ็›ธๅŒใ€‚ @param lhs ็ฌฌไธ€ไธชๅฏน่ฑก @param rhs ็ฌฌไบŒไธชๅฏน่ฑก @return a negative integer, zero, or a positive integer as <code>lhs</code> is less than, equal to, or greater than <code>rhs</code> @throws NullPointerException if either (but not both) parameters are <code>null</code> @throws ClassCastException if <code>rhs</code> is not assignment-compatible with <code>lhs</code>
[ "้€š่ฟ‡ๅๅฐ„ๆฏ”่พƒไธคไธชBeanๅฏน่ฑก๏ผŒๅฏน่ฑกๅญ—ๆฎตๅฏไปฅไธบprivateใ€‚ๆฏ”่พƒ่ง„ๅˆ™ๅฆ‚ไธ‹๏ผš" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/CompareToBuilder.java#L88-L90
RestComm/media-core
ice/src/main/java/org/restcomm/media/core/ice/harvest/HostCandidateHarvester.java
HostCandidateHarvester.getNetworkInterfaces
private Enumeration<NetworkInterface> getNetworkInterfaces() throws HarvestException { try { return NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { throw new HarvestException("Could not retrieve list of available Network Interfaces.", e); } }
java
private Enumeration<NetworkInterface> getNetworkInterfaces() throws HarvestException { try { return NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { throw new HarvestException("Could not retrieve list of available Network Interfaces.", e); } }
[ "private", "Enumeration", "<", "NetworkInterface", ">", "getNetworkInterfaces", "(", ")", "throws", "HarvestException", "{", "try", "{", "return", "NetworkInterface", ".", "getNetworkInterfaces", "(", ")", ";", "}", "catch", "(", "SocketException", "e", ")", "{", ...
Finds all Network interfaces available on this server. @return The list of available network interfaces. @throws HarvestException When an error occurs while retrieving the network interfaces
[ "Finds", "all", "Network", "interfaces", "available", "on", "this", "server", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/ice/src/main/java/org/restcomm/media/core/ice/harvest/HostCandidateHarvester.java#L71-L77
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.setRowHeight
public ExcelWriter setRowHeight(int rownum, int height) { if (rownum < 0) { this.sheet.setDefaultRowHeightInPoints(height); } else { this.sheet.getRow(rownum).setHeightInPoints(height); } return this; }
java
public ExcelWriter setRowHeight(int rownum, int height) { if (rownum < 0) { this.sheet.setDefaultRowHeightInPoints(height); } else { this.sheet.getRow(rownum).setHeightInPoints(height); } return this; }
[ "public", "ExcelWriter", "setRowHeight", "(", "int", "rownum", ",", "int", "height", ")", "{", "if", "(", "rownum", "<", "0", ")", "{", "this", ".", "sheet", ".", "setDefaultRowHeightInPoints", "(", "height", ")", ";", "}", "else", "{", "this", ".", "s...
่ฎพ็ฝฎ่กŒ้ซ˜๏ผŒๅ€ผไธบไธ€ไธช็‚น็š„้ซ˜ๅบฆ @param rownum ่กŒๅท๏ผˆไปŽ0ๅผ€ๅง‹่ฎกๆ•ฐ๏ผŒ-1่กจ็คบๆ‰€ๆœ‰่กŒ็š„้ป˜่ฎค้ซ˜ๅบฆ๏ผ‰ @param height ้ซ˜ๅบฆ @return this @since 4.0.8
[ "่ฎพ็ฝฎ่กŒ้ซ˜๏ผŒๅ€ผไธบไธ€ไธช็‚น็š„้ซ˜ๅบฆ" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L447-L454
verhas/License3j
src/main/java/javax0/license3j/License.java
License.isOK
public boolean isOK(byte[] key) { try { return isOK(LicenseKeyPair.Create.from(key, Modifier.PUBLIC).getPair().getPublic()); } catch (Exception e) { return false; } }
java
public boolean isOK(byte[] key) { try { return isOK(LicenseKeyPair.Create.from(key, Modifier.PUBLIC).getPair().getPublic()); } catch (Exception e) { return false; } }
[ "public", "boolean", "isOK", "(", "byte", "[", "]", "key", ")", "{", "try", "{", "return", "isOK", "(", "LicenseKeyPair", ".", "Create", ".", "from", "(", "key", ",", "Modifier", ".", "PUBLIC", ")", ".", "getPair", "(", ")", ".", "getPublic", "(", ...
See {@link #isOK(PublicKey)}. @param key serialized encryption key to check the authenticity of the license signature @return see {@link #isOK(PublicKey)}
[ "See", "{", "@link", "#isOK", "(", "PublicKey", ")", "}", "." ]
train
https://github.com/verhas/License3j/blob/f44c6e81b3eb59ab591cc757792749d3556b4afb/src/main/java/javax0/license3j/License.java#L119-L125
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/math/NumberUtils.java
NumberUtils.toByte
public static byte toByte(final String str, final byte defaultValue) { if(str == null) { return defaultValue; } try { return Byte.parseByte(str); } catch (final NumberFormatException nfe) { return defaultValue; } }
java
public static byte toByte(final String str, final byte defaultValue) { if(str == null) { return defaultValue; } try { return Byte.parseByte(str); } catch (final NumberFormatException nfe) { return defaultValue; } }
[ "public", "static", "byte", "toByte", "(", "final", "String", "str", ",", "final", "byte", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", "{", "return", "Byte", ".", "parseByte", "(", "str...
<p>Convert a <code>String</code> to a <code>byte</code>, returning a default value if the conversion fails.</p> <p>If the string is <code>null</code>, the default value is returned.</p> <pre> NumberUtils.toByte(null, 1) = 1 NumberUtils.toByte("", 1) = 1 NumberUtils.toByte("1", 0) = 1 </pre> @param str the string to convert, may be null @param defaultValue the default value @return the byte represented by the string, or the default if conversion fails @since 2.5
[ "<p", ">", "Convert", "a", "<code", ">", "String<", "/", "code", ">", "to", "a", "<code", ">", "byte<", "/", "code", ">", "returning", "a", "default", "value", "if", "the", "conversion", "fails", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/math/NumberUtils.java#L323-L332
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/MessageRouterImpl.java
MessageRouterImpl.routeTo
protected void routeTo(String msg, LogRecord logRecord, String logHandlerId) { LogHandler logHandler = logHandlerServices.get(logHandlerId); if (logHandler != null) { logHandler.publish(msg, logRecord); } }
java
protected void routeTo(String msg, LogRecord logRecord, String logHandlerId) { LogHandler logHandler = logHandlerServices.get(logHandlerId); if (logHandler != null) { logHandler.publish(msg, logRecord); } }
[ "protected", "void", "routeTo", "(", "String", "msg", ",", "LogRecord", "logRecord", ",", "String", "logHandlerId", ")", "{", "LogHandler", "logHandler", "=", "logHandlerServices", ".", "get", "(", "logHandlerId", ")", ";", "if", "(", "logHandler", "!=", "null...
Route the message to the LogHandler identified by the given logHandlerId. @param msg The fully formatted message. @param logRecord The associated LogRecord, in case the LogHandler needs it. @param logHandlerId The LogHandler ID in which to route.
[ "Route", "the", "message", "to", "the", "LogHandler", "identified", "by", "the", "given", "logHandlerId", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/MessageRouterImpl.java#L279-L284
forge/furnace
container/src/main/java/org/jboss/forge/furnace/impl/addons/AddonStateManager.java
AddonStateManager.getAddonForView
public Addon getAddonForView(final AddonView view, final AddonId id) { return lock.performLocked(LockMode.READ, new Callable<Addon>() { @Override public Addon call() throws Exception { for (AddonVertex vertex : getCurrentGraph().getGraph().vertexSet()) { if (vertex.getAddonId().equals(id) && vertex.getViews().contains(view)) { return vertex.getAddon(); } } return null; } }); }
java
public Addon getAddonForView(final AddonView view, final AddonId id) { return lock.performLocked(LockMode.READ, new Callable<Addon>() { @Override public Addon call() throws Exception { for (AddonVertex vertex : getCurrentGraph().getGraph().vertexSet()) { if (vertex.getAddonId().equals(id) && vertex.getViews().contains(view)) { return vertex.getAddon(); } } return null; } }); }
[ "public", "Addon", "getAddonForView", "(", "final", "AddonView", "view", ",", "final", "AddonId", "id", ")", "{", "return", "lock", ".", "performLocked", "(", "LockMode", ".", "READ", ",", "new", "Callable", "<", "Addon", ">", "(", ")", "{", "@", "Overri...
Return an {@link Addon} compatible with the given {@link AddonView}, if it is already registered (this occurs when {@link AddonView} instances share {@link Addon} sub-graphs.
[ "Return", "an", "{" ]
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container/src/main/java/org/jboss/forge/furnace/impl/addons/AddonStateManager.java#L113-L130
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java
DoubleIntIndex.setValue
public synchronized void setValue(int i, int value) { if (i < 0 || i >= count) { throw new IndexOutOfBoundsException(); } if (sortOnValues) { sorted = false; } values[i] = value; }
java
public synchronized void setValue(int i, int value) { if (i < 0 || i >= count) { throw new IndexOutOfBoundsException(); } if (sortOnValues) { sorted = false; } values[i] = value; }
[ "public", "synchronized", "void", "setValue", "(", "int", "i", ",", "int", "value", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "count", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "if", "(", "sortOnValues", ")...
Modifies an existing pair. @param i the index @param value the value
[ "Modifies", "an", "existing", "pair", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/DoubleIntIndex.java#L117-L128
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java
WPartialDateField.handleRequestValue
protected void handleRequestValue(final String value, final boolean valid, final String text) { // As setData() clears the text value (if valid), this must be called first so it can be set after setData(value); PartialDateFieldModel model = getOrCreateComponentModel(); model.validDate = valid; model.text = text; }
java
protected void handleRequestValue(final String value, final boolean valid, final String text) { // As setData() clears the text value (if valid), this must be called first so it can be set after setData(value); PartialDateFieldModel model = getOrCreateComponentModel(); model.validDate = valid; model.text = text; }
[ "protected", "void", "handleRequestValue", "(", "final", "String", "value", ",", "final", "boolean", "valid", ",", "final", "String", "text", ")", "{", "// As setData() clears the text value (if valid), this must be called first so it can be set after", "setData", "(", "value...
Set the request value. @param value the date value @param valid true if valid value @param text the user text
[ "Set", "the", "request", "value", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java#L334-L340
aws/aws-sdk-java
aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java
StepFunctionBuilder.lt
public static TimestampLessThanCondition.Builder lt(String variable, Date expectedValue) { return TimestampLessThanCondition.builder().variable(variable).expectedValue(expectedValue); }
java
public static TimestampLessThanCondition.Builder lt(String variable, Date expectedValue) { return TimestampLessThanCondition.builder().variable(variable).expectedValue(expectedValue); }
[ "public", "static", "TimestampLessThanCondition", ".", "Builder", "lt", "(", "String", "variable", ",", "Date", "expectedValue", ")", "{", "return", "TimestampLessThanCondition", ".", "builder", "(", ")", ".", "variable", "(", "variable", ")", ".", "expectedValue"...
Binary condition for Timestamp less than comparison. Dates are converted to ISO8601 UTC timestamps. @param variable The JSONPath expression that determines which piece of the input document is used for the comparison. @param expectedValue The expected value for this condition. @see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a> @see com.amazonaws.services.stepfunctions.builder.states.Choice
[ "Binary", "condition", "for", "Timestamp", "less", "than", "comparison", ".", "Dates", "are", "converted", "to", "ISO8601", "UTC", "timestamps", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java#L404-L406
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java
FileUtilsV2_2.copyFileToDirectory
public static void copyFileToDirectory(File srcFile, File destDir) throws IOException { copyFileToDirectory(srcFile, destDir, true); }
java
public static void copyFileToDirectory(File srcFile, File destDir) throws IOException { copyFileToDirectory(srcFile, destDir, true); }
[ "public", "static", "void", "copyFileToDirectory", "(", "File", "srcFile", ",", "File", "destDir", ")", "throws", "IOException", "{", "copyFileToDirectory", "(", "srcFile", ",", "destDir", ",", "true", ")", ";", "}" ]
Copies a file to a directory preserving the file date. <p> This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it. <p> <strong>Note:</strong> This method tries to preserve the file's last modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided. @param srcFile an existing file to copy, must not be <code>null</code> @param destDir the directory to place the copy in, must not be <code>null</code> @throws NullPointerException if source or destination is null @throws IOException if source or destination is invalid @throws IOException if an IO error occurs during copying @see #copyFile(File, File, boolean)
[ "Copies", "a", "file", "to", "a", "directory", "preserving", "the", "file", "date", ".", "<p", ">", "This", "method", "copies", "the", "contents", "of", "the", "specified", "source", "file", "to", "a", "file", "of", "the", "same", "name", "in", "the", ...
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java#L291-L293
deeplearning4j/deeplearning4j
datavec/datavec-perf/src/main/java/org/datavec/perf/timing/IOTiming.java
IOTiming.averageFileRead
public static TimingStatistics averageFileRead(long nTimes, RecordReader recordReader, File file, INDArrayCreationFunction function) throws Exception { TimingStatistics timingStatistics = null; for(int i = 0; i < nTimes; i++) { TimingStatistics timingStatistics1 = timeNDArrayCreation(recordReader,new BufferedInputStream(new FileInputStream(file)),function); if(timingStatistics == null) timingStatistics = timingStatistics1; else { timingStatistics = timingStatistics.add(timingStatistics1); } } return timingStatistics.average(nTimes); }
java
public static TimingStatistics averageFileRead(long nTimes, RecordReader recordReader, File file, INDArrayCreationFunction function) throws Exception { TimingStatistics timingStatistics = null; for(int i = 0; i < nTimes; i++) { TimingStatistics timingStatistics1 = timeNDArrayCreation(recordReader,new BufferedInputStream(new FileInputStream(file)),function); if(timingStatistics == null) timingStatistics = timingStatistics1; else { timingStatistics = timingStatistics.add(timingStatistics1); } } return timingStatistics.average(nTimes); }
[ "public", "static", "TimingStatistics", "averageFileRead", "(", "long", "nTimes", ",", "RecordReader", "recordReader", ",", "File", "file", ",", "INDArrayCreationFunction", "function", ")", "throws", "Exception", "{", "TimingStatistics", "timingStatistics", "=", "null",...
Returns statistics for components of a datavec pipeline averaged over the specified number of times @param nTimes the number of times to run the pipeline for averaging @param recordReader the record reader @param file the file to read @param function the function @return the averaged {@link TimingStatistics} for input/output on a record reader and ndarray creation (based on the given function @throws Exception
[ "Returns", "statistics", "for", "components", "of", "a", "datavec", "pipeline", "averaged", "over", "the", "specified", "number", "of", "times" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-perf/src/main/java/org/datavec/perf/timing/IOTiming.java#L59-L72
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java
SipNetworkInterfaceManagerImpl.checkPortRange
public static int checkPortRange(int port, String transport) { if(port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { if((ListeningPoint.TLS).equalsIgnoreCase(transport)) { return ListeningPoint.PORT_5061; } else { return ListeningPoint.PORT_5060; } } else { return port; } }
java
public static int checkPortRange(int port, String transport) { if(port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { if((ListeningPoint.TLS).equalsIgnoreCase(transport)) { return ListeningPoint.PORT_5061; } else { return ListeningPoint.PORT_5060; } } else { return port; } }
[ "public", "static", "int", "checkPortRange", "(", "int", "port", ",", "String", "transport", ")", "{", "if", "(", "port", "<", "MIN_PORT_NUMBER", "||", "port", ">", "MAX_PORT_NUMBER", ")", "{", "if", "(", "(", "ListeningPoint", ".", "TLS", ")", ".", "equ...
Checks if the port is in the UDP-TCP port numbers (0-65355) range otherwise defaulting to 5060 if UDP, TCP or SCTP or to 5061 if TLS @param port port to check @return the smae port number if in range, otherwise 5060 if UDP, TCP or SCTP or to 5061 if TLS
[ "Checks", "if", "the", "port", "is", "in", "the", "UDP", "-", "TCP", "port", "numbers", "(", "0", "-", "65355", ")", "range", "otherwise", "defaulting", "to", "5060", "if", "UDP", "TCP", "or", "SCTP", "or", "to", "5061", "if", "TLS" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java#L412-L423
cdk/cdk
base/data/src/main/java/org/openscience/cdk/formula/AdductFormula.java
AdductFormula.isTheSame
private boolean isTheSame(IIsotope isotopeOne, IIsotope isotopeTwo) { // XXX: floating point comparision! if (!Objects.equals(isotopeOne.getSymbol(), isotopeTwo.getSymbol())) return false; if (!Objects.equals(isotopeOne.getNaturalAbundance(), isotopeTwo.getNaturalAbundance())) return false; if (!Objects.equals(isotopeOne.getExactMass(), isotopeTwo.getExactMass())) return false; return true; }
java
private boolean isTheSame(IIsotope isotopeOne, IIsotope isotopeTwo) { // XXX: floating point comparision! if (!Objects.equals(isotopeOne.getSymbol(), isotopeTwo.getSymbol())) return false; if (!Objects.equals(isotopeOne.getNaturalAbundance(), isotopeTwo.getNaturalAbundance())) return false; if (!Objects.equals(isotopeOne.getExactMass(), isotopeTwo.getExactMass())) return false; return true; }
[ "private", "boolean", "isTheSame", "(", "IIsotope", "isotopeOne", ",", "IIsotope", "isotopeTwo", ")", "{", "// XXX: floating point comparision!", "if", "(", "!", "Objects", ".", "equals", "(", "isotopeOne", ".", "getSymbol", "(", ")", ",", "isotopeTwo", ".", "ge...
Compare to IIsotope. The method doesn't compare instance but if they have the same symbol, natural abundance and exact mass. @param isotopeOne The first Isotope to compare @param isotopeTwo The second Isotope to compare @return True, if both isotope are the same
[ "Compare", "to", "IIsotope", ".", "The", "method", "doesn", "t", "compare", "instance", "but", "if", "they", "have", "the", "same", "symbol", "natural", "abundance", "and", "exact", "mass", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/data/src/main/java/org/openscience/cdk/formula/AdductFormula.java#L345-L352
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableExtendedScan.java
BigtableExtendedScan.addRange
public void addRange(byte[] startRow, byte[] stopRow) { addRange(RowRange.newBuilder() .setStartKeyClosed(ByteStringer.wrap(startRow)) .setEndKeyOpen(ByteStringer.wrap(stopRow)) .build()); }
java
public void addRange(byte[] startRow, byte[] stopRow) { addRange(RowRange.newBuilder() .setStartKeyClosed(ByteStringer.wrap(startRow)) .setEndKeyOpen(ByteStringer.wrap(stopRow)) .build()); }
[ "public", "void", "addRange", "(", "byte", "[", "]", "startRow", ",", "byte", "[", "]", "stopRow", ")", "{", "addRange", "(", "RowRange", ".", "newBuilder", "(", ")", ".", "setStartKeyClosed", "(", "ByteStringer", ".", "wrap", "(", "startRow", ")", ")", ...
Adds a range to scan. This is similar to calling a combination of {@link Scan#setStartRow(byte[])} and {@link Scan#setStopRow(byte[])}. Other ranges can be constructed by creating a {@link RowRange} and calling {@link #addRange(RowRange)} @param startRow a byte array. @param stopRow a byte array.
[ "Adds", "a", "range", "to", "scan", ".", "This", "is", "similar", "to", "calling", "a", "combination", "of", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableExtendedScan.java#L73-L78
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.getJobXml
public String getJobXml(FolderJob folder, String jobName) throws IOException { return client.get(UrlUtils.toJobBaseUrl(folder, jobName) + "/config.xml"); }
java
public String getJobXml(FolderJob folder, String jobName) throws IOException { return client.get(UrlUtils.toJobBaseUrl(folder, jobName) + "/config.xml"); }
[ "public", "String", "getJobXml", "(", "FolderJob", "folder", ",", "String", "jobName", ")", "throws", "IOException", "{", "return", "client", ".", "get", "(", "UrlUtils", ".", "toJobBaseUrl", "(", "folder", ",", "jobName", ")", "+", "\"/config.xml\"", ")", "...
Get the xml description of an existing job. @param jobName name of the job. @param folder {@link FolderJob} @return the new job object @throws IOException in case of an error.
[ "Get", "the", "xml", "description", "of", "an", "existing", "job", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L523-L525
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listWebAppsByHybridConnectionAsync
public Observable<Page<String>> listWebAppsByHybridConnectionAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { return listWebAppsByHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName) .map(new Func1<ServiceResponse<Page<String>>, Page<String>>() { @Override public Page<String> call(ServiceResponse<Page<String>> response) { return response.body(); } }); }
java
public Observable<Page<String>> listWebAppsByHybridConnectionAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { return listWebAppsByHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName) .map(new Func1<ServiceResponse<Page<String>>, Page<String>>() { @Override public Page<String> call(ServiceResponse<Page<String>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "String", ">", ">", "listWebAppsByHybridConnectionAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "namespaceName", ",", "final", "String", "relayName", ")", "{",...
Get all apps that use a Hybrid Connection in an App Service Plan. Get all apps that use a Hybrid Connection in an App Service Plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Hybrid Connection namespace. @param relayName Name of the Hybrid Connection relay. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;String&gt; object
[ "Get", "all", "apps", "that", "use", "a", "Hybrid", "Connection", "in", "an", "App", "Service", "Plan", ".", "Get", "all", "apps", "that", "use", "a", "Hybrid", "Connection", "in", "an", "App", "Service", "Plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1492-L1500
hal/core
gui/src/main/java/org/jboss/as/console/client/domain/model/impl/ServerGroupDAOImpl.java
ServerGroupDAOImpl.model2ServerGroup
private ServerGroupRecord model2ServerGroup(String groupName, ModelNode model) { ServerGroupRecord record = factory.serverGroup().as(); record.setName(groupName); record.setProfileName(model.get("profile").asString()); record.setSocketBinding(model.get("socket-binding-group").asString()); Jvm jvm = ModelAdapter.model2JVM(factory, model); if(jvm!=null) jvm.setInherited(false); // on this level they can't inherit from anyone record.setJvm(jvm); List<PropertyRecord> propertyRecords = ModelAdapter.model2Property(factory, model); record.setProperties(propertyRecords); return record; }
java
private ServerGroupRecord model2ServerGroup(String groupName, ModelNode model) { ServerGroupRecord record = factory.serverGroup().as(); record.setName(groupName); record.setProfileName(model.get("profile").asString()); record.setSocketBinding(model.get("socket-binding-group").asString()); Jvm jvm = ModelAdapter.model2JVM(factory, model); if(jvm!=null) jvm.setInherited(false); // on this level they can't inherit from anyone record.setJvm(jvm); List<PropertyRecord> propertyRecords = ModelAdapter.model2Property(factory, model); record.setProperties(propertyRecords); return record; }
[ "private", "ServerGroupRecord", "model2ServerGroup", "(", "String", "groupName", ",", "ModelNode", "model", ")", "{", "ServerGroupRecord", "record", "=", "factory", ".", "serverGroup", "(", ")", ".", "as", "(", ")", ";", "record", ".", "setName", "(", "groupNa...
Turns a server group DMR model into a strongly typed entity @param groupName @param model @return
[ "Turns", "a", "server", "group", "DMR", "model", "into", "a", "strongly", "typed", "entity" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/domain/model/impl/ServerGroupDAOImpl.java#L217-L235
skuzzle/jeve
jeve/src/main/java/de/skuzzle/jeve/stores/DefaultListenerStoreImpl.java
DefaultListenerStoreImpl.removeInternal
@Deprecated protected <T extends Listener> void removeInternal(Class<T> listenerClass, Iterator<Object> it) { final Object next = it.next(); final T listener = listenerClass.cast(next); it.remove(); final RegistrationEvent e = new RegistrationEvent(this, listenerClass); listener.onUnregister(e); }
java
@Deprecated protected <T extends Listener> void removeInternal(Class<T> listenerClass, Iterator<Object> it) { final Object next = it.next(); final T listener = listenerClass.cast(next); it.remove(); final RegistrationEvent e = new RegistrationEvent(this, listenerClass); listener.onUnregister(e); }
[ "@", "Deprecated", "protected", "<", "T", "extends", "Listener", ">", "void", "removeInternal", "(", "Class", "<", "T", ">", "listenerClass", ",", "Iterator", "<", "Object", ">", "it", ")", "{", "final", "Object", "next", "=", "it", ".", "next", "(", "...
Internal method for removing a single listener and notifying it about the removal. Prior to calling this method, the passed iterators {@link Iterator#hasNext() hasNext} method must hold <code>true</code>. @param <T> Type of the listener to remove @param listenerClass The class of the listener to remove. @param it Iterator which provides the next listener to remove. @deprecated Since 3.0.0 - Method not used anymore. Replaced by {@link #clearAll(Class, List, boolean)}.
[ "Internal", "method", "for", "removing", "a", "single", "listener", "and", "notifying", "it", "about", "the", "removal", ".", "Prior", "to", "calling", "this", "method", "the", "passed", "iterators", "{", "@link", "Iterator#hasNext", "()", "hasNext", "}", "met...
train
https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/stores/DefaultListenerStoreImpl.java#L142-L150
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/ConvertBitmap.java
ConvertBitmap.grayToBitmap
public static void grayToBitmap( GrayU8 input , Bitmap output , byte[] storage) { if( output.getWidth() != input.getWidth() || output.getHeight() != input.getHeight() ) { throw new IllegalArgumentException("Image shapes are not the same"); } if( storage == null ) storage = declareStorage(output,null); ImplConvertBitmap.grayToArray(input, storage,output.getConfig()); output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
java
public static void grayToBitmap( GrayU8 input , Bitmap output , byte[] storage) { if( output.getWidth() != input.getWidth() || output.getHeight() != input.getHeight() ) { throw new IllegalArgumentException("Image shapes are not the same"); } if( storage == null ) storage = declareStorage(output,null); ImplConvertBitmap.grayToArray(input, storage,output.getConfig()); output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
[ "public", "static", "void", "grayToBitmap", "(", "GrayU8", "input", ",", "Bitmap", "output", ",", "byte", "[", "]", "storage", ")", "{", "if", "(", "output", ".", "getWidth", "(", ")", "!=", "input", ".", "getWidth", "(", ")", "||", "output", ".", "g...
Converts ImageGray into Bitmap. @see #declareStorage(android.graphics.Bitmap, byte[]) @param input Input gray scale image. @param output Output Bitmap image. @param storage Byte array used for internal storage. If null it will be declared internally.
[ "Converts", "ImageGray", "into", "Bitmap", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/ConvertBitmap.java#L269-L279
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/ArrayUtils.java
ArrayUtils.nullSafeArray
@NullSafe public static <T> T[] nullSafeArray(T[] array) { return nullSafeArray(array, componentType(array)); }
java
@NullSafe public static <T> T[] nullSafeArray(T[] array) { return nullSafeArray(array, componentType(array)); }
[ "@", "NullSafe", "public", "static", "<", "T", ">", "T", "[", "]", "nullSafeArray", "(", "T", "[", "]", "array", ")", "{", "return", "nullSafeArray", "(", "array", ",", "componentType", "(", "array", ")", ")", ";", "}" ]
Null-safe method returning the array if not null otherwise returns an empty array. @param <T> Class type of the elements in the array. @param array array to evaluate. @return the array if not null otherwise an empty array. @see #nullSafeArray(Object[], Class) @see #componentType(Object[])
[ "Null", "-", "safe", "method", "returning", "the", "array", "if", "not", "null", "otherwise", "returns", "an", "empty", "array", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L610-L613
yanzhenjie/AndServer
api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java
CollectionUtils.mergePropertiesIntoMap
@SuppressWarnings("unchecked") public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) { if (map == null) { throw new IllegalArgumentException("Map must not be null"); } if (props != null) { for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); Object value = props.get(key); if (value == null) { // Allow for defaults fallback or potentially overridden accessor... value = props.getProperty(key); } map.put((K)key, (V)value); } } }
java
@SuppressWarnings("unchecked") public static <K, V> void mergePropertiesIntoMap(Properties props, Map<K, V> map) { if (map == null) { throw new IllegalArgumentException("Map must not be null"); } if (props != null) { for (Enumeration<?> en = props.propertyNames(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); Object value = props.get(key); if (value == null) { // Allow for defaults fallback or potentially overridden accessor... value = props.getProperty(key); } map.put((K)key, (V)value); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "K", ",", "V", ">", "void", "mergePropertiesIntoMap", "(", "Properties", "props", ",", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "if", "(", "map", "==", "null", ")", ...
Merge the given Properties instance into the given Map, copying all properties (key-value pairs) over. <p>Uses {@code Properties.propertyNames()} to even catch default properties linked into the original Properties instance. @param props the Properties instance to merge (may be {@code null}). @param map the target Map to merge the properties into.
[ "Merge", "the", "given", "Properties", "instance", "into", "the", "given", "Map", "copying", "all", "properties", "(", "key", "-", "value", "pairs", ")", "over", ".", "<p", ">", "Uses", "{", "@code", "Properties", ".", "propertyNames", "()", "}", "to", "...
train
https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L102-L118
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java
ClassContext.getMethodAnalysisNoException
private <Analysis> Analysis getMethodAnalysisNoException(Class<Analysis> analysisClass, Method method) { try { return getMethodAnalysis(analysisClass, method); } catch (CheckedAnalysisException e) { IllegalStateException ise = new IllegalStateException("should not happen"); ise.initCause(e); throw ise; } }
java
private <Analysis> Analysis getMethodAnalysisNoException(Class<Analysis> analysisClass, Method method) { try { return getMethodAnalysis(analysisClass, method); } catch (CheckedAnalysisException e) { IllegalStateException ise = new IllegalStateException("should not happen"); ise.initCause(e); throw ise; } }
[ "private", "<", "Analysis", ">", "Analysis", "getMethodAnalysisNoException", "(", "Class", "<", "Analysis", ">", "analysisClass", ",", "Method", "method", ")", "{", "try", "{", "return", "getMethodAnalysis", "(", "analysisClass", ",", "method", ")", ";", "}", ...
/* ---------------------------------------------------------------------- Helper methods for getting an analysis object from the analysis cache. ----------------------------------------------------------------------
[ "/", "*", "----------------------------------------------------------------------", "Helper", "methods", "for", "getting", "an", "analysis", "object", "from", "the", "analysis", "cache", ".", "----------------------------------------------------------------------" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/ClassContext.java#L971-L979
apache/incubator-gobblin
gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java
HttpUtils.buildURI
public static URI buildURI(String urlTemplate, Map<String, String> keys, Map<String, String> queryParams) { // Compute base url String url = urlTemplate; if (keys != null && keys.size() != 0) { url = StrSubstitutor.replace(urlTemplate, keys); } try { URIBuilder uriBuilder = new URIBuilder(url); // Append query parameters if (queryParams != null && queryParams.size() != 0) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { uriBuilder.addParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); } catch (URISyntaxException e) { throw new RuntimeException("Fail to build uri", e); } }
java
public static URI buildURI(String urlTemplate, Map<String, String> keys, Map<String, String> queryParams) { // Compute base url String url = urlTemplate; if (keys != null && keys.size() != 0) { url = StrSubstitutor.replace(urlTemplate, keys); } try { URIBuilder uriBuilder = new URIBuilder(url); // Append query parameters if (queryParams != null && queryParams.size() != 0) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { uriBuilder.addParameter(entry.getKey(), entry.getValue()); } } return uriBuilder.build(); } catch (URISyntaxException e) { throw new RuntimeException("Fail to build uri", e); } }
[ "public", "static", "URI", "buildURI", "(", "String", "urlTemplate", ",", "Map", "<", "String", ",", "String", ">", "keys", ",", "Map", "<", "String", ",", "String", ">", "queryParams", ")", "{", "// Compute base url", "String", "url", "=", "urlTemplate", ...
Given a url template, interpolate with keys and build the URI after adding query parameters <p> With url template: http://test.com/resource/(urn:${resourceId})/entities/(entity:${entityId}), keys: { "resourceId": 123, "entityId": 456 }, queryParams: { "locale": "en_US" }, the outpuT URI is: http://test.com/resource/(urn:123)/entities/(entity:456)?locale=en_US </p> @param urlTemplate url template @param keys data map to interpolate url template @param queryParams query parameters added to the url @return a uri
[ "Given", "a", "url", "template", "interpolate", "with", "keys", "and", "build", "the", "URI", "after", "adding", "query", "parameters" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/utils/HttpUtils.java#L101-L120
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java
QrCodeAlignmentPatternLocator.localize
boolean localize(QrCode.Alignment pattern, float guessY, float guessX) { // sample along the middle. Try to not sample the outside edges which could confuse it for (int i = 0; i < arrayY.length; i++) { float x = guessX - 1.5f + i*3f/12.0f; float y = guessY - 1.5f + i*3f/12.0f; arrayX[i] = reader.read(guessY,x); arrayY[i] = reader.read(y,guessX); } // TODO turn this into an exhaustive search of the array for best up and down point? int downX = greatestDown(arrayX); if( downX == -1) return false; int upX = greatestUp(arrayX,downX); if( upX == -1) return false; int downY = greatestDown(arrayY); if( downY == -1 ) return false; int upY = greatestUp(arrayY,downY); if( upY == -1 ) return false; pattern.moduleFound.x = guessX - 1.5f + (downX+upX)*3f/24.0f; pattern.moduleFound.y = guessY - 1.5f + (downY+upY)*3f/24.0f; reader.gridToImage((float)pattern.moduleFound.y,(float)pattern.moduleFound.x,pattern.pixel); return true; }
java
boolean localize(QrCode.Alignment pattern, float guessY, float guessX) { // sample along the middle. Try to not sample the outside edges which could confuse it for (int i = 0; i < arrayY.length; i++) { float x = guessX - 1.5f + i*3f/12.0f; float y = guessY - 1.5f + i*3f/12.0f; arrayX[i] = reader.read(guessY,x); arrayY[i] = reader.read(y,guessX); } // TODO turn this into an exhaustive search of the array for best up and down point? int downX = greatestDown(arrayX); if( downX == -1) return false; int upX = greatestUp(arrayX,downX); if( upX == -1) return false; int downY = greatestDown(arrayY); if( downY == -1 ) return false; int upY = greatestUp(arrayY,downY); if( upY == -1 ) return false; pattern.moduleFound.x = guessX - 1.5f + (downX+upX)*3f/24.0f; pattern.moduleFound.y = guessY - 1.5f + (downY+upY)*3f/24.0f; reader.gridToImage((float)pattern.moduleFound.y,(float)pattern.moduleFound.x,pattern.pixel); return true; }
[ "boolean", "localize", "(", "QrCode", ".", "Alignment", "pattern", ",", "float", "guessY", ",", "float", "guessX", ")", "{", "// sample along the middle. Try to not sample the outside edges which could confuse it", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a...
Localizizes the alignment pattern crudely by searching for the black box in the center by looking for its edges in the gray scale image @return true if success or false if it doesn't resemble an alignment pattern
[ "Localizizes", "the", "alignment", "pattern", "crudely", "by", "searching", "for", "the", "black", "box", "in", "the", "center", "by", "looking", "for", "its", "edges", "in", "the", "gray", "scale", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L206-L234
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.eachFileRecurse
public static void eachFileRecurse(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException { eachFileRecurse(self, FileType.ANY, closure); }
java
public static void eachFileRecurse(Path self, @ClosureParams(value = SimpleType.class, options = "java.nio.file.Path") Closure closure) throws IOException { // throws FileNotFoundException, IllegalArgumentException { eachFileRecurse(self, FileType.ANY, closure); }
[ "public", "static", "void", "eachFileRecurse", "(", "Path", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.nio.file.Path\"", ")", "Closure", "closure", ")", "throws", "IOException", "{", "// throws ...
Processes each descendant file in this directory and any sub-directories. Processing consists of calling <code>closure</code> passing it the current file (which may be a normal file or subdirectory) and then if a subdirectory was encountered, recursively processing the subdirectory. @param self a Path (that happens to be a folder/directory) @param closure a Closure @throws java.io.FileNotFoundException if the given directory does not exist @throws IllegalArgumentException if the provided Path object does not represent a directory @see #eachFileRecurse(Path, groovy.io.FileType, groovy.lang.Closure) @since 2.3.0
[ "Processes", "each", "descendant", "file", "in", "this", "directory", "and", "any", "sub", "-", "directories", ".", "Processing", "consists", "of", "calling", "<code", ">", "closure<", "/", "code", ">", "passing", "it", "the", "current", "file", "(", "which"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1169-L1171
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/ZigZagEncoding.java
ZigZagEncoding.putInt
static void putInt(ByteBuffer buffer, int value) { value = (value << 1) ^ (value >> 31); if (value >>> 7 == 0) { buffer.put((byte) value); } else { buffer.put((byte) ((value & 0x7F) | 0x80)); if (value >>> 14 == 0) { buffer.put((byte) (value >>> 7)); } else { buffer.put((byte) (value >>> 7 | 0x80)); if (value >>> 21 == 0) { buffer.put((byte) (value >>> 14)); } else { buffer.put((byte) (value >>> 14 | 0x80)); if (value >>> 28 == 0) { buffer.put((byte) (value >>> 21)); } else { buffer.put((byte) (value >>> 21 | 0x80)); buffer.put((byte) (value >>> 28)); } } } } }
java
static void putInt(ByteBuffer buffer, int value) { value = (value << 1) ^ (value >> 31); if (value >>> 7 == 0) { buffer.put((byte) value); } else { buffer.put((byte) ((value & 0x7F) | 0x80)); if (value >>> 14 == 0) { buffer.put((byte) (value >>> 7)); } else { buffer.put((byte) (value >>> 7 | 0x80)); if (value >>> 21 == 0) { buffer.put((byte) (value >>> 14)); } else { buffer.put((byte) (value >>> 14 | 0x80)); if (value >>> 28 == 0) { buffer.put((byte) (value >>> 21)); } else { buffer.put((byte) (value >>> 21 | 0x80)); buffer.put((byte) (value >>> 28)); } } } } }
[ "static", "void", "putInt", "(", "ByteBuffer", "buffer", ",", "int", "value", ")", "{", "value", "=", "(", "value", "<<", "1", ")", "^", "(", "value", ">>", "31", ")", ";", "if", "(", "value", ">>>", "7", "==", "0", ")", "{", "buffer", ".", "pu...
Writes an int value to the given buffer in LEB128-64b9B ZigZag encoded format @param buffer the buffer to write to @param value the value to write to the buffer
[ "Writes", "an", "int", "value", "to", "the", "given", "buffer", "in", "LEB128", "-", "64b9B", "ZigZag", "encoded", "format" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/ZigZagEncoding.java#L85-L108
authlete/authlete-java-common
src/main/java/com/authlete/common/api/AuthleteApiImpl.java
AuthleteApiImpl.callServiceOwnerGetApi
private <TResponse> TResponse callServiceOwnerGetApi( String path, Class<TResponse> responseClass) throws AuthleteApiException { return callServiceOwnerGetApi(path, (Map<String, String>)null, responseClass); }
java
private <TResponse> TResponse callServiceOwnerGetApi( String path, Class<TResponse> responseClass) throws AuthleteApiException { return callServiceOwnerGetApi(path, (Map<String, String>)null, responseClass); }
[ "private", "<", "TResponse", ">", "TResponse", "callServiceOwnerGetApi", "(", "String", "path", ",", "Class", "<", "TResponse", ">", "responseClass", ")", "throws", "AuthleteApiException", "{", "return", "callServiceOwnerGetApi", "(", "path", ",", "(", "Map", "<",...
Call an API with HTTP GET method and Service Owner credentials (without query parameters).
[ "Call", "an", "API", "with", "HTTP", "GET", "method", "and", "Service", "Owner", "credentials", "(", "without", "query", "parameters", ")", "." ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L252-L256
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java
SSLSocketChannel.open
public static SSLSocketChannel open(String peer, int port) throws IOException { try { return open(peer, port, SSLContext.getDefault()); } catch (NoSuchAlgorithmException ex) { throw new IOException(ex); } }
java
public static SSLSocketChannel open(String peer, int port) throws IOException { try { return open(peer, port, SSLContext.getDefault()); } catch (NoSuchAlgorithmException ex) { throw new IOException(ex); } }
[ "public", "static", "SSLSocketChannel", "open", "(", "String", "peer", ",", "int", "port", ")", "throws", "IOException", "{", "try", "{", "return", "open", "(", "peer", ",", "port", ",", "SSLContext", ".", "getDefault", "(", ")", ")", ";", "}", "catch", ...
Creates connection to a named peer using default SSLContext. Connection is in client mode but can be changed before read/write. @param peer @param port @return @throws IOException
[ "Creates", "connection", "to", "a", "named", "peer", "using", "default", "SSLContext", ".", "Connection", "is", "in", "client", "mode", "but", "can", "be", "changed", "before", "read", "/", "write", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java#L61-L71
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BaseTransform.java
BaseTransform.writeAttribute
protected void writeAttribute(OutputStream outputStream, String name, String value) { if (value != null) { write(outputStream, " " + name + "=\"" + value + "\""); } }
java
protected void writeAttribute(OutputStream outputStream, String name, String value) { if (value != null) { write(outputStream, " " + name + "=\"" + value + "\""); } }
[ "protected", "void", "writeAttribute", "(", "OutputStream", "outputStream", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "write", "(", "outputStream", ",", "\" \"", "+", "name", "+", "\"=\\\"\"", "+",...
Write the attribute's name/value pair to the output stream. @param outputStream The output stream. @param name The attribute name. @param value The attribute value.
[ "Write", "the", "attribute", "s", "name", "/", "value", "pair", "to", "the", "output", "stream", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BaseTransform.java#L98-L102
KyoriPowered/lunar
src/main/java/net/kyori/lunar/Optionals.java
Optionals.isInstance
public static boolean isInstance(final @NonNull Optional<?> optional, final @NonNull Class<?> type) { return optional.isPresent() && type.isInstance(optional.get()); }
java
public static boolean isInstance(final @NonNull Optional<?> optional, final @NonNull Class<?> type) { return optional.isPresent() && type.isInstance(optional.get()); }
[ "public", "static", "boolean", "isInstance", "(", "final", "@", "NonNull", "Optional", "<", "?", ">", "optional", ",", "final", "@", "NonNull", "Class", "<", "?", ">", "type", ")", "{", "return", "optional", ".", "isPresent", "(", ")", "&&", "type", "....
Tests if the value held by {@code optional} is an instance of {@code type}. @param optional the optional @param type the type @return {@code true} if the value held by {@code optional} is an instance of {@code type}, {@code false} otherwise
[ "Tests", "if", "the", "value", "held", "by", "{", "@code", "optional", "}", "is", "an", "instance", "of", "{", "@code", "type", "}", "." ]
train
https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Optionals.java#L87-L89
google/closure-compiler
src/com/google/javascript/jscomp/PureFunctionIdentifier.java
ExternFunctionAnnotationAnalyzer.isLocalValueType
private boolean isLocalValueType(JSType typei, AbstractCompiler compiler) { checkNotNull(typei); JSType nativeObj = compiler.getTypeRegistry().getNativeType(JSTypeNative.OBJECT_TYPE); JSType subtype = typei.meetWith(nativeObj); // If the type includes anything related to a object type, don't assume // anything about the locality of the value. return subtype.isEmptyType(); }
java
private boolean isLocalValueType(JSType typei, AbstractCompiler compiler) { checkNotNull(typei); JSType nativeObj = compiler.getTypeRegistry().getNativeType(JSTypeNative.OBJECT_TYPE); JSType subtype = typei.meetWith(nativeObj); // If the type includes anything related to a object type, don't assume // anything about the locality of the value. return subtype.isEmptyType(); }
[ "private", "boolean", "isLocalValueType", "(", "JSType", "typei", ",", "AbstractCompiler", "compiler", ")", "{", "checkNotNull", "(", "typei", ")", ";", "JSType", "nativeObj", "=", "compiler", ".", "getTypeRegistry", "(", ")", ".", "getNativeType", "(", "JSTypeN...
Return whether {@code type} is guaranteed to be a that of a "local value". <p>For the purposes of purity analysis we really only care whether a return value is immutable and identity-less; such values can't contribute to side-effects. Therefore, this method is implemented to check if {@code type} is that of a primitive, since primitives exhibit both relevant behaviours.
[ "Return", "whether", "{", "@code", "type", "}", "is", "guaranteed", "to", "be", "a", "that", "of", "a", "local", "value", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L615-L622
apereo/cas
core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java
AbstractCentralAuthenticationService.getTicket
@Transactional(transactionManager = "ticketTransactionManager", noRollbackFor = InvalidTicketException.class) @Override public <T extends Ticket> T getTicket(final @NonNull String ticketId, final Class<T> clazz) throws InvalidTicketException { val ticket = this.ticketRegistry.getTicket(ticketId, clazz); verifyTicketState(ticket, ticketId, clazz); return (T) ticket; }
java
@Transactional(transactionManager = "ticketTransactionManager", noRollbackFor = InvalidTicketException.class) @Override public <T extends Ticket> T getTicket(final @NonNull String ticketId, final Class<T> clazz) throws InvalidTicketException { val ticket = this.ticketRegistry.getTicket(ticketId, clazz); verifyTicketState(ticket, ticketId, clazz); return (T) ticket; }
[ "@", "Transactional", "(", "transactionManager", "=", "\"ticketTransactionManager\"", ",", "noRollbackFor", "=", "InvalidTicketException", ".", "class", ")", "@", "Override", "public", "<", "T", "extends", "Ticket", ">", "T", "getTicket", "(", "final", "@", "NonNu...
{@inheritDoc} <p> Note: Synchronization on ticket object in case of cache based registry doesn't serialize access to critical section. The reason is that cache pulls serialized data and builds new object, most likely for each pull. Is this synchronization needed here?
[ "{" ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java#L134-L140
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/LifecycleChaincodePackage.java
LifecycleChaincodePackage.toFile
public void toFile(Path path, OpenOption... options) throws IOException { Files.write(path, pBytes, options); }
java
public void toFile(Path path, OpenOption... options) throws IOException { Files.write(path, pBytes, options); }
[ "public", "void", "toFile", "(", "Path", "path", ",", "OpenOption", "...", "options", ")", "throws", "IOException", "{", "Files", ".", "write", "(", "path", ",", "pBytes", ",", "options", ")", ";", "}" ]
Write Lifecycle chaincode package bytes to file. @param path of the file to write to. @param options Options on creating file. @throws IOException
[ "Write", "Lifecycle", "chaincode", "package", "bytes", "to", "file", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/LifecycleChaincodePackage.java#L138-L141
citiususc/hipster
hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java
FibonacciHeap.decreaseKey
public void decreaseKey(Entry<T> entry, double newPriority) { checkPriority(newPriority); if (newPriority > entry.mPriority) throw new IllegalArgumentException("New priority exceeds old."); /* Forward this to a helper function. */ decreaseKeyUnchecked(entry, newPriority); }
java
public void decreaseKey(Entry<T> entry, double newPriority) { checkPriority(newPriority); if (newPriority > entry.mPriority) throw new IllegalArgumentException("New priority exceeds old."); /* Forward this to a helper function. */ decreaseKeyUnchecked(entry, newPriority); }
[ "public", "void", "decreaseKey", "(", "Entry", "<", "T", ">", "entry", ",", "double", "newPriority", ")", "{", "checkPriority", "(", "newPriority", ")", ";", "if", "(", "newPriority", ">", "entry", ".", "mPriority", ")", "throw", "new", "IllegalArgumentExcep...
Decreases the key of the specified element to the new priority. If the new priority is greater than the old priority, this function throws an IllegalArgumentException. The new priority must be a finite double, so you cannot set the priority to be NaN, or +/- infinity. Doing so also throws an IllegalArgumentException. <p/> It is assumed that the entry belongs in this heap. For efficiency reasons, this is not checked at runtime. @param entry The element whose priority should be decreased. @param newPriority The new priority to associate with this entry. @throws IllegalArgumentException If the new priority exceeds the old priority, or if the argument is not a finite double.
[ "Decreases", "the", "key", "of", "the", "specified", "element", "to", "the", "new", "priority", ".", "If", "the", "new", "priority", "is", "greater", "than", "the", "old", "priority", "this", "function", "throws", "an", "IllegalArgumentException", ".", "The", ...
train
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L405-L412
killbill/killbill
entitlement/src/main/java/org/killbill/billing/entitlement/engine/core/DefaultEventsStream.java
DefaultEventsStream.computeAddonsBlockingStatesForFutureSubscriptionBaseEvents
@Override public Collection<BlockingState> computeAddonsBlockingStatesForFutureSubscriptionBaseEvents() { if (!ProductCategory.BASE.equals(subscription.getCategory())) { // Only base subscriptions have add-ons return ImmutableList.of(); } // We need to find the first "trigger" transition, from which we will create the add-ons cancellation events. // This can either be a future entitlement cancel... if (isEntitlementFutureCancelled()) { // Note that in theory we could always only look subscription base as we assume entitlement cancel means subscription base cancel // but we want to use the effective date of the entitlement cancel event to create the add-on cancel event final BlockingState futureEntitlementCancelEvent = getEntitlementCancellationEvent(subscription.getId()); return computeAddonsBlockingStatesForNextSubscriptionBaseEvent(futureEntitlementCancelEvent.getEffectiveDate(), false); } else if (isEntitlementFutureChanged()) { // ...or a subscription change (i.e. a change plan where the new plan has an impact on the existing add-on). // We need to go back to subscription base as entitlement doesn't know about these return computeAddonsBlockingStatesForNextSubscriptionBaseEvent(utcNow, true); } else { return ImmutableList.of(); } }
java
@Override public Collection<BlockingState> computeAddonsBlockingStatesForFutureSubscriptionBaseEvents() { if (!ProductCategory.BASE.equals(subscription.getCategory())) { // Only base subscriptions have add-ons return ImmutableList.of(); } // We need to find the first "trigger" transition, from which we will create the add-ons cancellation events. // This can either be a future entitlement cancel... if (isEntitlementFutureCancelled()) { // Note that in theory we could always only look subscription base as we assume entitlement cancel means subscription base cancel // but we want to use the effective date of the entitlement cancel event to create the add-on cancel event final BlockingState futureEntitlementCancelEvent = getEntitlementCancellationEvent(subscription.getId()); return computeAddonsBlockingStatesForNextSubscriptionBaseEvent(futureEntitlementCancelEvent.getEffectiveDate(), false); } else if (isEntitlementFutureChanged()) { // ...or a subscription change (i.e. a change plan where the new plan has an impact on the existing add-on). // We need to go back to subscription base as entitlement doesn't know about these return computeAddonsBlockingStatesForNextSubscriptionBaseEvent(utcNow, true); } else { return ImmutableList.of(); } }
[ "@", "Override", "public", "Collection", "<", "BlockingState", ">", "computeAddonsBlockingStatesForFutureSubscriptionBaseEvents", "(", ")", "{", "if", "(", "!", "ProductCategory", ".", "BASE", ".", "equals", "(", "subscription", ".", "getCategory", "(", ")", ")", ...
Compute future blocking states not on disk for add-ons associated to this (base) events stream
[ "Compute", "future", "blocking", "states", "not", "on", "disk", "for", "add", "-", "ons", "associated", "to", "this", "(", "base", ")", "events", "stream" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/entitlement/src/main/java/org/killbill/billing/entitlement/engine/core/DefaultEventsStream.java#L300-L321
Microsoft/azure-maven-plugins
azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/auth/AzureAuthHelper.java
AzureAuthHelper.getAuthObjFromServerId
protected Authenticated getAuthObjFromServerId(final Settings settings, final String serverId) { if (StringUtils.isEmpty(serverId)) { getLog().debug(SERVER_ID_NOT_CONFIG); return null; } final Server server = Utils.getServer(settings, serverId); try { assureServerExist(server, serverId); } catch (MojoExecutionException ex) { getLog().error(ex.getMessage()); return null; } final ApplicationTokenCredentials credential = getAppTokenCredentialsFromServer(server); if (credential == null) { getLog().error(AZURE_AUTH_INVALID + serverId); return null; } final Authenticated auth = azureConfigure().authenticate(credential); if (auth != null) { getLog().info(AUTH_WITH_SERVER_ID + serverId); } return auth; }
java
protected Authenticated getAuthObjFromServerId(final Settings settings, final String serverId) { if (StringUtils.isEmpty(serverId)) { getLog().debug(SERVER_ID_NOT_CONFIG); return null; } final Server server = Utils.getServer(settings, serverId); try { assureServerExist(server, serverId); } catch (MojoExecutionException ex) { getLog().error(ex.getMessage()); return null; } final ApplicationTokenCredentials credential = getAppTokenCredentialsFromServer(server); if (credential == null) { getLog().error(AZURE_AUTH_INVALID + serverId); return null; } final Authenticated auth = azureConfigure().authenticate(credential); if (auth != null) { getLog().info(AUTH_WITH_SERVER_ID + serverId); } return auth; }
[ "protected", "Authenticated", "getAuthObjFromServerId", "(", "final", "Settings", "settings", ",", "final", "String", "serverId", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "serverId", ")", ")", "{", "getLog", "(", ")", ".", "debug", "(", "SERV...
Get Authenticated object by referencing server definition in Maven settings.xml @param settings Settings object @param serverId Server Id to search in settings.xml @return Authenticated object if configurations are correct; otherwise return null.
[ "Get", "Authenticated", "object", "by", "referencing", "server", "definition", "in", "Maven", "settings", ".", "xml" ]
train
https://github.com/Microsoft/azure-maven-plugins/blob/a254902e820185df1823b1d692c7c1d119490b1e/azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/auth/AzureAuthHelper.java#L154-L179
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
AbstractTagLibrary.addComponent
protected final void addComponent(String name, String componentType, String rendererType, Class<? extends TagHandler> handlerType) { _factories.put(name, new UserComponentHandlerFactory(componentType, rendererType, handlerType)); }
java
protected final void addComponent(String name, String componentType, String rendererType, Class<? extends TagHandler> handlerType) { _factories.put(name, new UserComponentHandlerFactory(componentType, rendererType, handlerType)); }
[ "protected", "final", "void", "addComponent", "(", "String", "name", ",", "String", "componentType", ",", "String", "rendererType", ",", "Class", "<", "?", "extends", "TagHandler", ">", "handlerType", ")", "{", "_factories", ".", "put", "(", "name", ",", "ne...
Add a ComponentHandler with the specified componentType and rendererType, aliased by the tag name. The Facelet will be compiled with the specified HandlerType (which must extend AbstractComponentHandler). @see AbstractComponentHandler @param name name to use, "foo" would be &lt;my:foo /> @param componentType componentType to use @param rendererType rendererType to use @param handlerType a Class that extends AbstractComponentHandler
[ "Add", "a", "ComponentHandler", "with", "the", "specified", "componentType", "and", "rendererType", "aliased", "by", "the", "tag", "name", ".", "The", "Facelet", "will", "be", "compiled", "with", "the", "specified", "HandlerType", "(", "which", "must", "extend",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L176-L180
EdwardRaff/JSAT
JSAT/src/jsat/math/DescriptiveStatistics.java
DescriptiveStatistics.sampleCorCoeff
public static double sampleCorCoeff(Vec xData, Vec yData) { if(yData.length() != xData.length()) throw new ArithmeticException("X and Y data sets must have the same length"); double xMean = xData.mean(); double yMean = yData.mean(); double topSum = 0; for(int i = 0; i < xData.length(); i++) { topSum += (xData.get(i)-xMean)*(yData.get(i)-yMean); } return topSum/((xData.length()-1)*xData.standardDeviation()*yData.standardDeviation()); }
java
public static double sampleCorCoeff(Vec xData, Vec yData) { if(yData.length() != xData.length()) throw new ArithmeticException("X and Y data sets must have the same length"); double xMean = xData.mean(); double yMean = yData.mean(); double topSum = 0; for(int i = 0; i < xData.length(); i++) { topSum += (xData.get(i)-xMean)*(yData.get(i)-yMean); } return topSum/((xData.length()-1)*xData.standardDeviation()*yData.standardDeviation()); }
[ "public", "static", "double", "sampleCorCoeff", "(", "Vec", "xData", ",", "Vec", "yData", ")", "{", "if", "(", "yData", ".", "length", "(", ")", "!=", "xData", ".", "length", "(", ")", ")", "throw", "new", "ArithmeticException", "(", "\"X and Y data sets m...
Computes the sample correlation coefficient for two data sets X and Y. The lengths of X and Y must be the same, and each element in X should correspond to the element in Y. @param yData the Y data set @param xData the X data set @return the sample correlation coefficient
[ "Computes", "the", "sample", "correlation", "coefficient", "for", "two", "data", "sets", "X", "and", "Y", ".", "The", "lengths", "of", "X", "and", "Y", "must", "be", "the", "same", "and", "each", "element", "in", "X", "should", "correspond", "to", "the",...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/DescriptiveStatistics.java#L20-L37
threerings/narya
core/src/main/java/com/threerings/crowd/client/LocationDirector.java
LocationDirector.mayMoveTo
public boolean mayMoveTo (final int placeId, ResultListener<PlaceConfig> rl) { final boolean[] vetoed = new boolean[1]; _observers.apply(new ObserverOp<LocationObserver>() { public boolean apply (LocationObserver obs) { vetoed[0] = (vetoed[0] || !obs.locationMayChange(placeId)); return true; } }); // if we're actually going somewhere, let the controller know that we might be leaving mayLeavePlace(); // if we have a result listener, let it know if we failed or keep it for later if we're // still going if (rl != null) { if (vetoed[0]) { rl.requestFailed(new MoveVetoedException()); } else { _moveListener = rl; } } // and return the result return !vetoed[0]; }
java
public boolean mayMoveTo (final int placeId, ResultListener<PlaceConfig> rl) { final boolean[] vetoed = new boolean[1]; _observers.apply(new ObserverOp<LocationObserver>() { public boolean apply (LocationObserver obs) { vetoed[0] = (vetoed[0] || !obs.locationMayChange(placeId)); return true; } }); // if we're actually going somewhere, let the controller know that we might be leaving mayLeavePlace(); // if we have a result listener, let it know if we failed or keep it for later if we're // still going if (rl != null) { if (vetoed[0]) { rl.requestFailed(new MoveVetoedException()); } else { _moveListener = rl; } } // and return the result return !vetoed[0]; }
[ "public", "boolean", "mayMoveTo", "(", "final", "int", "placeId", ",", "ResultListener", "<", "PlaceConfig", ">", "rl", ")", "{", "final", "boolean", "[", "]", "vetoed", "=", "new", "boolean", "[", "1", "]", ";", "_observers", ".", "apply", "(", "new", ...
This can be called by cooperating directors that need to coopt the moving process to extend it in some way or other. In such situations, they should call this method before moving to a new location to check to be sure that all of the registered location observers are amenable to a location change. @param placeId the place oid of our tentative new location. @return true if everyone is happy with the move, false if it was vetoed by one of the location observers.
[ "This", "can", "be", "called", "by", "cooperating", "directors", "that", "need", "to", "coopt", "the", "moving", "process", "to", "extend", "it", "in", "some", "way", "or", "other", ".", "In", "such", "situations", "they", "should", "call", "this", "method...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/client/LocationDirector.java#L233-L257
oasp/oasp4j
modules/logging/src/main/java/io/oasp/module/logging/common/impl/PerformanceLogFilter.java
PerformanceLogFilter.logPerformance
private void logPerformance(ServletResponse response, long startTime, String url, Throwable error) { long endTime, duration; int statusCode = ((HttpServletResponse) response).getStatus(); endTime = System.nanoTime(); duration = TimeUnit.MILLISECONDS.convert(endTime - startTime, TimeUnit.NANOSECONDS); String errorClass = ""; String errorMessage = ""; if (error != null) { statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; errorClass = error.getClass().getName(); errorMessage = error.getMessage(); } String message = createMessage(url, Long.toString(duration), Integer.toString(statusCode), errorClass, errorMessage); LOG.info(message); }
java
private void logPerformance(ServletResponse response, long startTime, String url, Throwable error) { long endTime, duration; int statusCode = ((HttpServletResponse) response).getStatus(); endTime = System.nanoTime(); duration = TimeUnit.MILLISECONDS.convert(endTime - startTime, TimeUnit.NANOSECONDS); String errorClass = ""; String errorMessage = ""; if (error != null) { statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; errorClass = error.getClass().getName(); errorMessage = error.getMessage(); } String message = createMessage(url, Long.toString(duration), Integer.toString(statusCode), errorClass, errorMessage); LOG.info(message); }
[ "private", "void", "logPerformance", "(", "ServletResponse", "response", ",", "long", "startTime", ",", "String", "url", ",", "Throwable", "error", ")", "{", "long", "endTime", ",", "duration", ";", "int", "statusCode", "=", "(", "(", "HttpServletResponse", ")...
Logs the request URL, execution time and {@link HttpStatus}. In case of an error also logs class name and error message. @param response - the {@link ServletResponse} @param startTime - start time of the {@link #doFilter(ServletRequest, ServletResponse, FilterChain)} function @param url - requested URL @param error - error thrown by the requested servlet, {@code null} if execution did not cause an error
[ "Logs", "the", "request", "URL", "execution", "time", "and", "{", "@link", "HttpStatus", "}", ".", "In", "case", "of", "an", "error", "also", "logs", "class", "name", "and", "error", "message", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/logging/src/main/java/io/oasp/module/logging/common/impl/PerformanceLogFilter.java#L78-L95