repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
paymill/paymill-java
src/main/java/com/paymill/services/SubscriptionService.java
SubscriptionService.changeAmountTemporary
public Subscription changeAmountTemporary( String subscriptionId, Integer amount ) { return this.changeAmountTemporary( new Subscription( subscriptionId ), amount ); }
java
public Subscription changeAmountTemporary( String subscriptionId, Integer amount ) { return this.changeAmountTemporary( new Subscription( subscriptionId ), amount ); }
[ "public", "Subscription", "changeAmountTemporary", "(", "String", "subscriptionId", ",", "Integer", "amount", ")", "{", "return", "this", ".", "changeAmountTemporary", "(", "new", "Subscription", "(", "subscriptionId", ")", ",", "amount", ")", ";", "}" ]
Changes the amount of a subscription.<br> <br> The new amount is valid one-time only after which the original subscription amount will be charged again. If you want to permanently change the amount use {@link SubscriptionService#changeAmount(String, Integer)}. @param subscriptionId the Id of the subscription. @param amount the new amount. @return the updated subscription.
[ "Changes", "the", "amount", "of", "a", "subscription", ".", "<br", ">", "<br", ">", "The", "new", "amount", "is", "valid", "one", "-", "time", "only", "after", "which", "the", "original", "subscription", "amount", "will", "be", "charged", "again", ".", "...
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L367-L369
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Maybe.java
Maybe.flatMapCompletable
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Completable flatMapCompletable(final Function<? super T, ? extends CompletableSource> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapCompletable<T>(this, mapper)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Completable flatMapCompletable(final Function<? super T, ? extends CompletableSource> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaPlugins.onAssembly(new MaybeFlatMapCompletable<T>(this, mapper)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Completable", "flatMapCompletable", "(", "final", "Function", "<", "?", "super", "T", ",", "?", "extends", "CompletableSource", ">", "mapper", ")", "...
Returns a {@link Completable} that completes based on applying a specified function to the item emitted by the source {@link Maybe}, where that function returns a {@link Completable}. <p> <img width="640" height="267" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.flatMapCompletable.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code flatMapCompletable} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param mapper a function that, when applied to the item emitted by the source Maybe, returns a Completable @return the Completable returned from {@code mapper} when applied to the item emitted by the source Maybe @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a>
[ "Returns", "a", "{", "@link", "Completable", "}", "that", "completes", "based", "on", "applying", "a", "specified", "function", "to", "the", "item", "emitted", "by", "the", "source", "{", "@link", "Maybe", "}", "where", "that", "function", "returns", "a", ...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L3141-L3146
drewnoakes/metadata-extractor
Source/com/drew/metadata/eps/EpsReader.java
EpsReader.extractPhotoshopData
private static void extractPhotoshopData(@NotNull final Metadata metadata, @NotNull SequentialReader reader) throws IOException { byte[] buffer = decodeHexCommentBlock(reader); if (buffer != null) new PhotoshopReader().extract(new SequentialByteArrayReader(buffer), buffer.length, metadata); }
java
private static void extractPhotoshopData(@NotNull final Metadata metadata, @NotNull SequentialReader reader) throws IOException { byte[] buffer = decodeHexCommentBlock(reader); if (buffer != null) new PhotoshopReader().extract(new SequentialByteArrayReader(buffer), buffer.length, metadata); }
[ "private", "static", "void", "extractPhotoshopData", "(", "@", "NotNull", "final", "Metadata", "metadata", ",", "@", "NotNull", "SequentialReader", "reader", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "decodeHexCommentBlock", "(", "reader"...
Decodes a commented hex section, and uses {@link PhotoshopReader} to decode the resulting data.
[ "Decodes", "a", "commented", "hex", "section", "and", "uses", "{" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/eps/EpsReader.java#L232-L238
nohana/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
CursorUtils.getBoolean
public static boolean getBoolean(Cursor cursor, String columnName) { return cursor != null && cursor.getInt(cursor.getColumnIndex(columnName)) == TRUE; }
java
public static boolean getBoolean(Cursor cursor, String columnName) { return cursor != null && cursor.getInt(cursor.getColumnIndex(columnName)) == TRUE; }
[ "public", "static", "boolean", "getBoolean", "(", "Cursor", "cursor", ",", "String", "columnName", ")", "{", "return", "cursor", "!=", "null", "&&", "cursor", ".", "getInt", "(", "cursor", ".", "getColumnIndex", "(", "columnName", ")", ")", "==", "TRUE", "...
Read the boolean data for the column. @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return the boolean value.
[ "Read", "the", "boolean", "data", "for", "the", "column", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L52-L54
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java
UtilLepetitEPnP.constraintMatrix3x3a
public static void constraintMatrix3x3a( DMatrixRMaj L_3x6 , DMatrixRMaj L_3x3 ) { int index = 0; for( int i = 0; i < 3; i++ ) { L_3x3.data[index++] = L_3x6.get(i,0); L_3x3.data[index++] = L_3x6.get(i,1); L_3x3.data[index++] = L_3x6.get(i,2); } }
java
public static void constraintMatrix3x3a( DMatrixRMaj L_3x6 , DMatrixRMaj L_3x3 ) { int index = 0; for( int i = 0; i < 3; i++ ) { L_3x3.data[index++] = L_3x6.get(i,0); L_3x3.data[index++] = L_3x6.get(i,1); L_3x3.data[index++] = L_3x6.get(i,2); } }
[ "public", "static", "void", "constraintMatrix3x3a", "(", "DMatrixRMaj", "L_3x6", ",", "DMatrixRMaj", "L_3x3", ")", "{", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "L_3x3", ".", "da...
Extracts the linear constraint matrix for case 1 from the full 6x10 constraint matrix.
[ "Extracts", "the", "linear", "constraint", "matrix", "for", "case", "1", "from", "the", "full", "6x10", "constraint", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java#L181-L189
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.beginCreateOrUpdate
public AppServiceEnvironmentResourceInner beginCreateOrUpdate(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).toBlocking().single().body(); }
java
public AppServiceEnvironmentResourceInner beginCreateOrUpdate(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).toBlocking().single().body(); }
[ "public", "AppServiceEnvironmentResourceInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "name", ",", "AppServiceEnvironmentResourceInner", "hostingEnvironmentEnvelope", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resour...
Create or update an App Service Environment. Create or update an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param hostingEnvironmentEnvelope Configuration details of the App Service Environment. @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 AppServiceEnvironmentResourceInner object if successful.
[ "Create", "or", "update", "an", "App", "Service", "Environment", ".", "Create", "or", "update", "an", "App", "Service", "Environment", "." ]
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/AppServiceEnvironmentsInner.java#L767-L769
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.leftOuter
public Table leftOuter(Table table2, boolean allowDuplicateColumnNames, String... col2Names) { return joinInternal(table, table2, true, allowDuplicateColumnNames, col2Names); }
java
public Table leftOuter(Table table2, boolean allowDuplicateColumnNames, String... col2Names) { return joinInternal(table, table2, true, allowDuplicateColumnNames, col2Names); }
[ "public", "Table", "leftOuter", "(", "Table", "table2", ",", "boolean", "allowDuplicateColumnNames", ",", "String", "...", "col2Names", ")", "{", "return", "joinInternal", "(", "table", ",", "table2", ",", "true", ",", "allowDuplicateColumnNames", ",", "col2Names"...
Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "columns", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L540-L542
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java
EventServicesImpl.getDistinctEventLogEventSources
public String[] getDistinctEventLogEventSources() throws DataAccessException, EventException { TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { transaction = edao.startTransaction(); return edao.getDistinctEventLogEventSources(); } catch (SQLException e) { throw new EventException("Failed to notify events", e); } finally { edao.stopTransaction(transaction); } }
java
public String[] getDistinctEventLogEventSources() throws DataAccessException, EventException { TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { transaction = edao.startTransaction(); return edao.getDistinctEventLogEventSources(); } catch (SQLException e) { throw new EventException("Failed to notify events", e); } finally { edao.stopTransaction(transaction); } }
[ "public", "String", "[", "]", "getDistinctEventLogEventSources", "(", ")", "throws", "DataAccessException", ",", "EventException", "{", "TransactionWrapper", "transaction", "=", "null", ";", "EngineDataAccessDB", "edao", "=", "new", "EngineDataAccessDB", "(", ")", ";"...
Method that returns distinct event log sources @return String[]
[ "Method", "that", "returns", "distinct", "event", "log", "sources" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java#L121-L133
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java
ImageMiscOps.fillBand
public static void fillBand(InterleavedF64 input, int band , double value) { final int numBands = input.numBands; for (int y = 0; y < input.height; y++) { int index = input.getStartIndex() + y * input.getStride() + band; int end = index + input.width*numBands - band; for (; index < end; index += numBands ) { input.data[index] = value; } } }
java
public static void fillBand(InterleavedF64 input, int band , double value) { final int numBands = input.numBands; for (int y = 0; y < input.height; y++) { int index = input.getStartIndex() + y * input.getStride() + band; int end = index + input.width*numBands - band; for (; index < end; index += numBands ) { input.data[index] = value; } } }
[ "public", "static", "void", "fillBand", "(", "InterleavedF64", "input", ",", "int", "band", ",", "double", "value", ")", "{", "final", "int", "numBands", "=", "input", ".", "numBands", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "input", "....
Fills one band in the image with the specified value @param input An image. @param band Which band is to be filled with the specified value @param value The value that the image is being filled with.
[ "Fills", "one", "band", "in", "the", "image", "with", "the", "specified", "value" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2847-L2857
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Double> getAt(double[] array, Collection indices) { return primitiveArrayGet(array, indices); }
java
@SuppressWarnings("unchecked") public static List<Double> getAt(double[] array, Collection indices) { return primitiveArrayGet(array, indices); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Double", ">", "getAt", "(", "double", "[", "]", "array", ",", "Collection", "indices", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "indices", ")", ";", "}...
Support the subscript operator with a collection for a double array @param array a double array @param indices a collection of indices for the items to retrieve @return list of the doubles at the given indices @since 1.0
[ "Support", "the", "subscript", "operator", "with", "a", "collection", "for", "a", "double", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14016-L14019
EdwardRaff/JSAT
JSAT/src/jsat/math/optimization/stochastic/SGDMomentum.java
SGDMomentum.setMomentum
public void setMomentum(double momentum) { if(momentum <= 0 || momentum >= 1 || Double.isNaN(momentum)) throw new IllegalArgumentException("Momentum must be in (0,1) not " + momentum); this.momentum = momentum; }
java
public void setMomentum(double momentum) { if(momentum <= 0 || momentum >= 1 || Double.isNaN(momentum)) throw new IllegalArgumentException("Momentum must be in (0,1) not " + momentum); this.momentum = momentum; }
[ "public", "void", "setMomentum", "(", "double", "momentum", ")", "{", "if", "(", "momentum", "<=", "0", "||", "momentum", ">=", "1", "||", "Double", ".", "isNaN", "(", "momentum", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Momentum must be...
Sets the momentum for accumulating gradients. @param momentum the momentum buildup term in (0, 1)
[ "Sets", "the", "momentum", "for", "accumulating", "gradients", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/optimization/stochastic/SGDMomentum.java#L70-L75
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java
FieldTable.doSetHandle
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { String strCurrentOrder = this.getRecord().getKeyName(); this.getRecord().setKeyArea(Constants.PRIMARY_KEY); this.getRecord().getCounterField().setData(bookmark); boolean bSuccess = this.seek(Constants.EQUALS); this.getRecord().setKeyArea(strCurrentOrder); return bSuccess; }
java
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { String strCurrentOrder = this.getRecord().getKeyName(); this.getRecord().setKeyArea(Constants.PRIMARY_KEY); this.getRecord().getCounterField().setData(bookmark); boolean bSuccess = this.seek(Constants.EQUALS); this.getRecord().setKeyArea(strCurrentOrder); return bSuccess; }
[ "public", "boolean", "doSetHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "String", "strCurrentOrder", "=", "this", ".", "getRecord", "(", ")", ".", "getKeyName", "(", ")", ";", "this", ".", "getRecord", "("...
Reposition to this record using this bookmark. @param bookmark The handle to use to position the record. @param iHandleType The type of handle (DATA_SOURCE/OBJECT_ID,OBJECT_SOURCE,BOOKMARK). @return - true - record found/false - record not found @exception FILE_NOT_OPEN. @exception DBException File exception.
[ "Reposition", "to", "this", "record", "using", "this", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java#L492-L502
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowStack.java
PageFlowStack.popUntil
PageFlowController popUntil( HttpServletRequest request, Class stopAt, boolean onlyIfPresent ) { if (onlyIfPresent && lastIndexOf(stopAt) == -1) { return null; } while ( ! isEmpty() ) { PageFlowController popped = pop( request ).getPageFlow(); if ( popped.getClass().equals( stopAt ) ) { // // If we've popped everything from the stack, remove the stack attribute from the session. // if ( isEmpty() ) destroy( request ); return popped; } else { // // We're discarding the popped page flow. Invoke its destroy() callback, unless it's longLived. // if ( ! popped.isLongLived() ) popped.destroy( request.getSession( false ) ); } } destroy( request ); // we're empty -- remove the attribute from the session. return null; }
java
PageFlowController popUntil( HttpServletRequest request, Class stopAt, boolean onlyIfPresent ) { if (onlyIfPresent && lastIndexOf(stopAt) == -1) { return null; } while ( ! isEmpty() ) { PageFlowController popped = pop( request ).getPageFlow(); if ( popped.getClass().equals( stopAt ) ) { // // If we've popped everything from the stack, remove the stack attribute from the session. // if ( isEmpty() ) destroy( request ); return popped; } else { // // We're discarding the popped page flow. Invoke its destroy() callback, unless it's longLived. // if ( ! popped.isLongLived() ) popped.destroy( request.getSession( false ) ); } } destroy( request ); // we're empty -- remove the attribute from the session. return null; }
[ "PageFlowController", "popUntil", "(", "HttpServletRequest", "request", ",", "Class", "stopAt", ",", "boolean", "onlyIfPresent", ")", "{", "if", "(", "onlyIfPresent", "&&", "lastIndexOf", "(", "stopAt", ")", "==", "-", "1", ")", "{", "return", "null", ";", "...
Pop page flows from the nesting stack until one of the given type is found. @return the last popped page flow if one of the given type was found, or <code>null</code> if none was found.
[ "Pop", "page", "flows", "from", "the", "nesting", "stack", "until", "one", "of", "the", "given", "type", "is", "found", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowStack.java#L200-L229
alkacon/opencms-core
src/org/opencms/cache/CmsVfsMemoryObjectCache.java
CmsVfsMemoryObjectCache.getCacheKeyForCurrentProject
private String getCacheKeyForCurrentProject(CmsObject cms, String rootPath) { // check the project boolean project = (cms != null) ? cms.getRequestContext().getCurrentProject().isOnlineProject() : false; return getCacheKey(rootPath, project); }
java
private String getCacheKeyForCurrentProject(CmsObject cms, String rootPath) { // check the project boolean project = (cms != null) ? cms.getRequestContext().getCurrentProject().isOnlineProject() : false; return getCacheKey(rootPath, project); }
[ "private", "String", "getCacheKeyForCurrentProject", "(", "CmsObject", "cms", ",", "String", "rootPath", ")", "{", "// check the project", "boolean", "project", "=", "(", "cms", "!=", "null", ")", "?", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentP...
Returns a cache key for the given root path based on the status of the given CmsObject.<p> @param cms the cms context @param rootPath the filename to get the cache key for @return the cache key for the system id
[ "Returns", "a", "cache", "key", "for", "the", "given", "root", "path", "based", "on", "the", "status", "of", "the", "given", "CmsObject", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsMemoryObjectCache.java#L172-L177
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java
ConfigValueHelper.checkNormalWithColon
protected static void checkNormalWithColon(String configKey, String configValue) throws SofaRpcRuntimeException { checkPattern(configKey, configValue, NORMAL_COLON, "only allow a-zA-Z0-9 '-' '_' '.' ':'"); }
java
protected static void checkNormalWithColon(String configKey, String configValue) throws SofaRpcRuntimeException { checkPattern(configKey, configValue, NORMAL_COLON, "only allow a-zA-Z0-9 '-' '_' '.' ':'"); }
[ "protected", "static", "void", "checkNormalWithColon", "(", "String", "configKey", ",", "String", "configValue", ")", "throws", "SofaRpcRuntimeException", "{", "checkPattern", "(", "configKey", ",", "configValue", ",", "NORMAL_COLON", ",", "\"only allow a-zA-Z0-9 '-' '_' ...
检查字符串是否是正常值(含冒号),不是则抛出异常 @param configKey 配置项 @param configValue 配置值 @throws SofaRpcRuntimeException 非法异常
[ "检查字符串是否是正常值(含冒号),不是则抛出异常" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ConfigValueHelper.java#L119-L121
shrinkwrap/resolver
maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenManagerBuilder.java
MavenManagerBuilder.artifactTypeRegistry
public ArtifactTypeRegistry artifactTypeRegistry() { DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry(); stereotypes.add(new DefaultArtifactType("pom")); stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java")); stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java")); stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java")); stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", "java")); stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", "java")); stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", "java")); stereotypes.add(new DefaultArtifactType("java-source", "jar", "sources", "java", false, false)); stereotypes.add(new DefaultArtifactType("war", "war", "", "java", false, true)); stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true)); stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true)); stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true)); return stereotypes; }
java
public ArtifactTypeRegistry artifactTypeRegistry() { DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry(); stereotypes.add(new DefaultArtifactType("pom")); stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java")); stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java")); stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java")); stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", "java")); stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", "java")); stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", "java")); stereotypes.add(new DefaultArtifactType("java-source", "jar", "sources", "java", false, false)); stereotypes.add(new DefaultArtifactType("war", "war", "", "java", false, true)); stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true)); stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true)); stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true)); return stereotypes; }
[ "public", "ArtifactTypeRegistry", "artifactTypeRegistry", "(", ")", "{", "DefaultArtifactTypeRegistry", "stereotypes", "=", "new", "DefaultArtifactTypeRegistry", "(", ")", ";", "stereotypes", ".", "add", "(", "new", "DefaultArtifactType", "(", "\"pom\"", ")", ")", ";"...
Returns artifact type registry. Defines standard Maven stereotypes. @return
[ "Returns", "artifact", "type", "registry", ".", "Defines", "standard", "Maven", "stereotypes", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenManagerBuilder.java#L223-L238
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.count
public int count(Connection conn, Entity where) throws SQLException { checkConn(conn); final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); PreparedStatement ps = null; try { ps = dialect.psForCount(conn, query); return SqlExecutor.query(ps, new NumberHandler()).intValue(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
java
public int count(Connection conn, Entity where) throws SQLException { checkConn(conn); final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); PreparedStatement ps = null; try { ps = dialect.psForCount(conn, query); return SqlExecutor.query(ps, new NumberHandler()).intValue(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
[ "public", "int", "count", "(", "Connection", "conn", ",", "Entity", "where", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "final", "Query", "query", "=", "new", "Query", "(", "SqlUtil", ".", "buildConditions", "(", "where", ")", ...
结果的条目数 @param conn 数据库连接对象 @param where 查询条件 @return 复合条件的结果数 @throws SQLException SQL执行异常
[ "结果的条目数" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L439-L452
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java
Path3d.quadTo
public void quadTo(double x1, double y1, double z1, double x2, double y2, double z2) { ensureSlots(true, 6); this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(x1); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(y1); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(z1); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(x2); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(y2); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(z2); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.isEmptyProperty = null; this.isPolylineProperty.set(false); this.graphicalBounds = null; this.logicalBounds = null; }
java
public void quadTo(double x1, double y1, double z1, double x2, double y2, double z2) { ensureSlots(true, 6); this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(x1); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(y1); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(z1); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(x2); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(y2); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()].set(z2); this.numCoordsProperty.set(this.numCoordsProperty.get()+1); this.isEmptyProperty = null; this.isPolylineProperty.set(false); this.graphicalBounds = null; this.logicalBounds = null; }
[ "public", "void", "quadTo", "(", "double", "x1", ",", "double", "y1", ",", "double", "z1", ",", "double", "x2", ",", "double", "y2", ",", "double", "z2", ")", "{", "ensureSlots", "(", "true", ",", "6", ")", ";", "this", ".", "types", "[", "this", ...
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current coordinates and the specified coordinates {@code (x2,y2,z2)}, using the specified point {@code (x1,y1,z1)} as a quadratic parametric control point. All coordinates are specified in double precision. @param x1 the X coordinate of the quadratic control point @param y1 the Y coordinate of the quadratic control point @param z1 the Z coordinate of the quadratic control point @param x2 the X coordinate of the final end point @param y2 the Y coordinate of the final end point @param z2 the Z coordinate of the final end point
[ "Adds", "a", "curved", "segment", "defined", "by", "two", "new", "points", "to", "the", "path", "by", "drawing", "a", "Quadratic", "curve", "that", "intersects", "both", "the", "current", "coordinates", "and", "the", "specified", "coordinates", "{", "@code", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2140-L2169
trustathsh/ironcommon
src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java
Properties.getInt
public int getInt(String propertyPath, int defaultValue) { Object o = getValue(propertyPath, defaultValue); return Integer.parseInt(o.toString()); }
java
public int getInt(String propertyPath, int defaultValue) { Object o = getValue(propertyPath, defaultValue); return Integer.parseInt(o.toString()); }
[ "public", "int", "getInt", "(", "String", "propertyPath", ",", "int", "defaultValue", ")", "{", "Object", "o", "=", "getValue", "(", "propertyPath", ",", "defaultValue", ")", ";", "return", "Integer", ".", "parseInt", "(", "o", ".", "toString", "(", ")", ...
Get the int-value from the property path. If the property path does not exist, the default value is returned. @param propertyPath Example: foo.bar.key @param defaultValue is returned when the propertyPath does not exist @return the value for the given propertyPath
[ "Get", "the", "int", "-", "value", "from", "the", "property", "path", ".", "If", "the", "property", "path", "does", "not", "exist", "the", "default", "value", "is", "returned", "." ]
train
https://github.com/trustathsh/ironcommon/blob/fee589a9300ab16744ca12fafae4357dd18c9fcb/src/main/java/de/hshannover/f4/trust/ironcommon/properties/Properties.java#L280-L283
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java
ParamConverterEngine.newInstance
@Override public <T> T newInstance(Context context, Class<T> type) throws IllegalArgumentException { // Retrieve the factory for (ParameterFactory factory : factories) { if (factory.getType().equals(type)) { // Factory found - instantiate //noinspection unchecked return (T) factory.newInstance(context); } } throw new IllegalArgumentException("Unable to find a ParameterFactory able to create instance of " + type.getName()); }
java
@Override public <T> T newInstance(Context context, Class<T> type) throws IllegalArgumentException { // Retrieve the factory for (ParameterFactory factory : factories) { if (factory.getType().equals(type)) { // Factory found - instantiate //noinspection unchecked return (T) factory.newInstance(context); } } throw new IllegalArgumentException("Unable to find a ParameterFactory able to create instance of " + type.getName()); }
[ "@", "Override", "public", "<", "T", ">", "T", "newInstance", "(", "Context", "context", ",", "Class", "<", "T", ">", "type", ")", "throws", "IllegalArgumentException", "{", "// Retrieve the factory", "for", "(", "ParameterFactory", "factory", ":", "factories", ...
Creates an instance of T from the given HTTP content. Unlike converters, it does not handler generics or collections. @param context the HTTP content @param type the class to instantiate @return the created object @throws IllegalArgumentException if there are no {@link org.wisdom.api.content.ParameterFactory} available for the type T, or if the instantiation failed.
[ "Creates", "an", "instance", "of", "T", "from", "the", "given", "HTTP", "content", ".", "Unlike", "converters", "it", "does", "not", "handler", "generics", "or", "collections", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java#L138-L150
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java
ReadAheadQueue.putToFront
public void putToFront(QueueData queueData, short msgBatch) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putToFront", new Object[]{queueData, msgBatch}); _put(queueData, msgBatch, false); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putToFront"); }
java
public void putToFront(QueueData queueData, short msgBatch) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putToFront", new Object[]{queueData, msgBatch}); _put(queueData, msgBatch, false); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putToFront"); }
[ "public", "void", "putToFront", "(", "QueueData", "queueData", ",", "short", "msgBatch", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",",...
Places a message on to the front of the proxy queue so that the next get operation will consume it. @param queueData @param msgBatch
[ "Places", "a", "message", "on", "to", "the", "front", "of", "the", "proxy", "queue", "so", "that", "the", "next", "get", "operation", "will", "consume", "it", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/ReadAheadQueue.java#L267-L275
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java
Organizer.copyToArray
public static void copyToArray(Collection<Object> collection, Object[] objects) { System.arraycopy(collection.toArray(), 0, objects, 0, objects.length); }
java
public static void copyToArray(Collection<Object> collection, Object[] objects) { System.arraycopy(collection.toArray(), 0, objects, 0, objects.length); }
[ "public", "static", "void", "copyToArray", "(", "Collection", "<", "Object", ">", "collection", ",", "Object", "[", "]", "objects", ")", "{", "System", ".", "arraycopy", "(", "collection", ".", "toArray", "(", ")", ",", "0", ",", "objects", ",", "0", "...
Copy collection objects to a given array @param collection the collection source @param objects array destination
[ "Copy", "collection", "objects", "to", "a", "given", "array" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java#L608-L611
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <T1, T2, T3> Func3<T1, T2, T3, Observable<Void>> toAsync(Action3<? super T1, ? super T2, ? super T3> action) { return toAsync(action, Schedulers.computation()); }
java
public static <T1, T2, T3> Func3<T1, T2, T3, Observable<Void>> toAsync(Action3<? super T1, ? super T2, ? super T3> action) { return toAsync(action, Schedulers.computation()); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ">", "Func3", "<", "T1", ",", "T2", ",", "T3", ",", "Observable", "<", "Void", ">", ">", "toAsync", "(", "Action3", "<", "?", "super", "T1", ",", "?", "super", "T2", ",", "?", "super", "T3", ...
Convert a synchronous action call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param action the action to convert @return a function that returns an Observable that executes the {@code action} and emits {@code null} @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh229336.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "action", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", ...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L290-L292
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Entry.java
Entry.changeEndDate
public final void changeEndDate(LocalDate date, boolean keepDuration) { requireNonNull(date); Interval interval = getInterval(); LocalDateTime newEndDateTime = getEndAsLocalDateTime().with(date); LocalDateTime startDateTime = getStartAsLocalDateTime(); if (keepDuration) { startDateTime = newEndDateTime.minus(getDuration()); setInterval(startDateTime, newEndDateTime, getZoneId()); } else { /* * We might have a problem if the new end time is BEFORE the current start time. */ if (newEndDateTime.isBefore(startDateTime)) { interval = interval.withStartDateTime(newEndDateTime.minus(interval.getDuration())); } setInterval(interval.withEndDate(date)); } }
java
public final void changeEndDate(LocalDate date, boolean keepDuration) { requireNonNull(date); Interval interval = getInterval(); LocalDateTime newEndDateTime = getEndAsLocalDateTime().with(date); LocalDateTime startDateTime = getStartAsLocalDateTime(); if (keepDuration) { startDateTime = newEndDateTime.minus(getDuration()); setInterval(startDateTime, newEndDateTime, getZoneId()); } else { /* * We might have a problem if the new end time is BEFORE the current start time. */ if (newEndDateTime.isBefore(startDateTime)) { interval = interval.withStartDateTime(newEndDateTime.minus(interval.getDuration())); } setInterval(interval.withEndDate(date)); } }
[ "public", "final", "void", "changeEndDate", "(", "LocalDate", "date", ",", "boolean", "keepDuration", ")", "{", "requireNonNull", "(", "date", ")", ";", "Interval", "interval", "=", "getInterval", "(", ")", ";", "LocalDateTime", "newEndDateTime", "=", "getEndAsL...
Changes the end date of the entry interval. @param date the new end date @param keepDuration if true then this method will also change the start date and time in such a way that the total duration of the entry will not change. If false then this method will ensure that the entry's interval stays valid, which means that the start time will be before the end time and that the duration of the entry will be at least the duration defined by the {@link #minimumDurationProperty()}.
[ "Changes", "the", "end", "date", "of", "the", "entry", "interval", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L484-L505
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.addAnnotationSafe
private JvmAnnotationReference addAnnotationSafe(JvmAnnotationTarget target, Class<?> annotationType, String... values) { assert target != null; assert annotationType != null; try { final JvmAnnotationReference annotationRef = this._annotationTypesBuilder.annotationRef(annotationType, values); if (annotationRef != null) { if (target.getAnnotations().add(annotationRef)) { return annotationRef; } } } catch (IllegalArgumentException exception) { // Ignore } return null; }
java
private JvmAnnotationReference addAnnotationSafe(JvmAnnotationTarget target, Class<?> annotationType, String... values) { assert target != null; assert annotationType != null; try { final JvmAnnotationReference annotationRef = this._annotationTypesBuilder.annotationRef(annotationType, values); if (annotationRef != null) { if (target.getAnnotations().add(annotationRef)) { return annotationRef; } } } catch (IllegalArgumentException exception) { // Ignore } return null; }
[ "private", "JvmAnnotationReference", "addAnnotationSafe", "(", "JvmAnnotationTarget", "target", ",", "Class", "<", "?", ">", "annotationType", ",", "String", "...", "values", ")", "{", "assert", "target", "!=", "null", ";", "assert", "annotationType", "!=", "null"...
Add annotation safely. <p>This function creates an annotation reference. If the type for the annotation is not found; no annotation is added. @param target the receiver of the annotation. @param annotationType the type of the annotation. @param values the annotations values. @return the annotation reference or <code>null</code> if the annotation cannot be added.
[ "Add", "annotation", "safely", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L377-L391
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java
ImageHeaderReaderAbstract.readInt
protected static int readInt(InputStream input, int bytesNumber, boolean bigEndian) throws IOException { final int oneByte = 8; int ret = 0; int sv; if (bigEndian) { sv = (bytesNumber - 1) * oneByte; } else { sv = 0; } final int cnt; if (bigEndian) { cnt = -oneByte; } else { cnt = oneByte; } for (int i = 0; i < bytesNumber; i++) { ret |= input.read() << sv; sv += cnt; } return ret; }
java
protected static int readInt(InputStream input, int bytesNumber, boolean bigEndian) throws IOException { final int oneByte = 8; int ret = 0; int sv; if (bigEndian) { sv = (bytesNumber - 1) * oneByte; } else { sv = 0; } final int cnt; if (bigEndian) { cnt = -oneByte; } else { cnt = oneByte; } for (int i = 0; i < bytesNumber; i++) { ret |= input.read() << sv; sv += cnt; } return ret; }
[ "protected", "static", "int", "readInt", "(", "InputStream", "input", ",", "int", "bytesNumber", ",", "boolean", "bigEndian", ")", "throws", "IOException", "{", "final", "int", "oneByte", "=", "8", ";", "int", "ret", "=", "0", ";", "int", "sv", ";", "if"...
Read integer in image data. @param input The stream. @param bytesNumber The number of bytes to read. @param bigEndian The big endian flag. @return The integer read. @throws IOException if error on reading.
[ "Read", "integer", "in", "image", "data", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java#L51-L79
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getLogDirectory
static File getLogDirectory(Object newValue, File defaultDirectory) { File newDirectory = defaultDirectory; // If a value was specified, try creating a file with it if (newValue != null && newValue instanceof String) { newDirectory = new File((String) newValue); } if (newDirectory == null) { String value = "."; try { value = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() { @Override public String run() throws Exception { return System.getProperty("user.dir"); } }); } catch (Exception ex) { // do nothing } newDirectory = new File(value); } return LoggingFileUtils.validateDirectory(newDirectory); }
java
static File getLogDirectory(Object newValue, File defaultDirectory) { File newDirectory = defaultDirectory; // If a value was specified, try creating a file with it if (newValue != null && newValue instanceof String) { newDirectory = new File((String) newValue); } if (newDirectory == null) { String value = "."; try { value = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() { @Override public String run() throws Exception { return System.getProperty("user.dir"); } }); } catch (Exception ex) { // do nothing } newDirectory = new File(value); } return LoggingFileUtils.validateDirectory(newDirectory); }
[ "static", "File", "getLogDirectory", "(", "Object", "newValue", ",", "File", "defaultDirectory", ")", "{", "File", "newDirectory", "=", "defaultDirectory", ";", "// If a value was specified, try creating a file with it", "if", "(", "newValue", "!=", "null", "&&", "newVa...
Find, create, and validate the log directory. @param newValue New parameter value to parse/evaluate @param defaultValue Starting/Previous log directory-- this value might *also* be null. @return defaultValue if the newValue is null or is was badly formatted, or the converted new value
[ "Find", "create", "and", "validate", "the", "log", "directory", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L40-L65
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/dsp/FastFourierTransform.java
FastFourierTransform.getMagnitudes
public double[] getMagnitudes(double[] amplitudes, boolean complex) { final int sampleSize = amplitudes.length; final int nrofFrequencyBins = sampleSize / 2; // call the fft and transform the complex numbers if (complex) { DoubleFFT_1D fft = new DoubleFFT_1D(nrofFrequencyBins); fft.complexForward(amplitudes); } else { DoubleFFT_1D fft = new DoubleFFT_1D(sampleSize); fft.realForward(amplitudes); // amplitudes[1] contains re[sampleSize/2] or im[(sampleSize-1) / 2] (depending on whether sampleSize is odd or even) // Discard it as it is useless without the other part // im part dc bin is always 0 for real input amplitudes[1] = 0; } // end call the fft and transform the complex numbers // even indexes (0,2,4,6,...) are real parts // odd indexes (1,3,5,7,...) are img parts double[] mag = new double[nrofFrequencyBins]; for (int i = 0; i < nrofFrequencyBins; i++) { final int f = 2 * i; mag[i] = Math.sqrt(amplitudes[f] * amplitudes[f] + amplitudes[f + 1] * amplitudes[f + 1]); } return mag; }
java
public double[] getMagnitudes(double[] amplitudes, boolean complex) { final int sampleSize = amplitudes.length; final int nrofFrequencyBins = sampleSize / 2; // call the fft and transform the complex numbers if (complex) { DoubleFFT_1D fft = new DoubleFFT_1D(nrofFrequencyBins); fft.complexForward(amplitudes); } else { DoubleFFT_1D fft = new DoubleFFT_1D(sampleSize); fft.realForward(amplitudes); // amplitudes[1] contains re[sampleSize/2] or im[(sampleSize-1) / 2] (depending on whether sampleSize is odd or even) // Discard it as it is useless without the other part // im part dc bin is always 0 for real input amplitudes[1] = 0; } // end call the fft and transform the complex numbers // even indexes (0,2,4,6,...) are real parts // odd indexes (1,3,5,7,...) are img parts double[] mag = new double[nrofFrequencyBins]; for (int i = 0; i < nrofFrequencyBins; i++) { final int f = 2 * i; mag[i] = Math.sqrt(amplitudes[f] * amplitudes[f] + amplitudes[f + 1] * amplitudes[f + 1]); } return mag; }
[ "public", "double", "[", "]", "getMagnitudes", "(", "double", "[", "]", "amplitudes", ",", "boolean", "complex", ")", "{", "final", "int", "sampleSize", "=", "amplitudes", ".", "length", ";", "final", "int", "nrofFrequencyBins", "=", "sampleSize", "/", "2", ...
Get the frequency intensities @param amplitudes amplitudes of the signal. Format depends on value of complex @param complex if true, amplitudes is assumed to be complex interlaced (re = even, im = odd), if false amplitudes are assumed to be real valued. @return intensities of each frequency unit: mag[frequency_unit]=intensity
[ "Get", "the", "frequency", "intensities" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/dsp/FastFourierTransform.java#L36-L65
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java
PHPMethods.arrangeByIndex
public static <T> void arrangeByIndex(T[] array, Integer[] indexes) { if(array.length != indexes.length) { throw new IllegalArgumentException("The length of the two arrays must match."); } //sort the array based on the indexes for(int i=0;i<array.length;i++) { int index = indexes[i]; //swap T tmp = array[i]; array[i] = array[index]; array[index] = tmp; } }
java
public static <T> void arrangeByIndex(T[] array, Integer[] indexes) { if(array.length != indexes.length) { throw new IllegalArgumentException("The length of the two arrays must match."); } //sort the array based on the indexes for(int i=0;i<array.length;i++) { int index = indexes[i]; //swap T tmp = array[i]; array[i] = array[index]; array[index] = tmp; } }
[ "public", "static", "<", "T", ">", "void", "arrangeByIndex", "(", "T", "[", "]", "array", ",", "Integer", "[", "]", "indexes", ")", "{", "if", "(", "array", ".", "length", "!=", "indexes", ".", "length", ")", "{", "throw", "new", "IllegalArgumentExcept...
Rearranges the array based on the order of the provided indexes. @param <T> @param array @param indexes
[ "Rearranges", "the", "array", "based", "on", "the", "order", "of", "the", "provided", "indexes", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L310-L324
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_revision_history.java
ns_conf_revision_history.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_revision_history_responses result = (ns_conf_revision_history_responses) service.get_payload_formatter().string_to_resource(ns_conf_revision_history_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_revision_history_response_array); } ns_conf_revision_history[] result_ns_conf_revision_history = new ns_conf_revision_history[result.ns_conf_revision_history_response_array.length]; for(int i = 0; i < result.ns_conf_revision_history_response_array.length; i++) { result_ns_conf_revision_history[i] = result.ns_conf_revision_history_response_array[i].ns_conf_revision_history[0]; } return result_ns_conf_revision_history; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_revision_history_responses result = (ns_conf_revision_history_responses) service.get_payload_formatter().string_to_resource(ns_conf_revision_history_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_revision_history_response_array); } ns_conf_revision_history[] result_ns_conf_revision_history = new ns_conf_revision_history[result.ns_conf_revision_history_response_array.length]; for(int i = 0; i < result.ns_conf_revision_history_response_array.length; i++) { result_ns_conf_revision_history[i] = result.ns_conf_revision_history_response_array[i].ns_conf_revision_history[0]; } return result_ns_conf_revision_history; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_conf_revision_history_responses", "result", "=", "(", "ns_conf_revision_history_responses", ")", "service", ...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_revision_history.java#L221-L238
fcrepo4/fcrepo4
fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java
ContentExposingResource.ensureValidACLAuthorization
private void ensureValidACLAuthorization(final FedoraResource resource, final Model inputModel) { if (resource.isAcl()) { final Set<Node> uniqueAuthSubjects = new HashSet<>(); inputModel.listStatements().forEachRemaining((final Statement s) -> { LOGGER.debug("statement: s={}, p={}, o={}", s.getSubject(), s.getPredicate(), s.getObject()); final Node subject = s.getSubject().asNode(); // If subject is Authorization Hash Resource, add it to the map with its accessTo/accessToClass status. if (subject.toString().contains("/" + FCR_ACL + "#")) { uniqueAuthSubjects.add(subject); } }); final Graph graph = inputModel.getGraph(); uniqueAuthSubjects.forEach((final Node subject) -> { if (graph.contains(subject, WEBAC_ACCESS_TO_URI, Node.ANY) && graph.contains(subject, WEBAC_ACCESS_TO_CLASS_URI, Node.ANY)) { throw new ACLAuthorizationConstraintViolationException( MessageFormat.format( "Using both accessTo and accessToClass within " + "a single Authorization is not allowed: {0}.", subject.toString().substring(subject.toString().lastIndexOf("#")))); } else if (!(graph.contains(subject, WEBAC_ACCESS_TO_URI, Node.ANY) || graph.contains(subject, WEBAC_ACCESS_TO_CLASS_URI, Node.ANY))) { inputModel.add(createDefaultAccessToStatement(subject.toString())); } }); } }
java
private void ensureValidACLAuthorization(final FedoraResource resource, final Model inputModel) { if (resource.isAcl()) { final Set<Node> uniqueAuthSubjects = new HashSet<>(); inputModel.listStatements().forEachRemaining((final Statement s) -> { LOGGER.debug("statement: s={}, p={}, o={}", s.getSubject(), s.getPredicate(), s.getObject()); final Node subject = s.getSubject().asNode(); // If subject is Authorization Hash Resource, add it to the map with its accessTo/accessToClass status. if (subject.toString().contains("/" + FCR_ACL + "#")) { uniqueAuthSubjects.add(subject); } }); final Graph graph = inputModel.getGraph(); uniqueAuthSubjects.forEach((final Node subject) -> { if (graph.contains(subject, WEBAC_ACCESS_TO_URI, Node.ANY) && graph.contains(subject, WEBAC_ACCESS_TO_CLASS_URI, Node.ANY)) { throw new ACLAuthorizationConstraintViolationException( MessageFormat.format( "Using both accessTo and accessToClass within " + "a single Authorization is not allowed: {0}.", subject.toString().substring(subject.toString().lastIndexOf("#")))); } else if (!(graph.contains(subject, WEBAC_ACCESS_TO_URI, Node.ANY) || graph.contains(subject, WEBAC_ACCESS_TO_CLASS_URI, Node.ANY))) { inputModel.add(createDefaultAccessToStatement(subject.toString())); } }); } }
[ "private", "void", "ensureValidACLAuthorization", "(", "final", "FedoraResource", "resource", ",", "final", "Model", "inputModel", ")", "{", "if", "(", "resource", ".", "isAcl", "(", ")", ")", "{", "final", "Set", "<", "Node", ">", "uniqueAuthSubjects", "=", ...
This method does two things: - Throws an exception if an authorization has both accessTo and accessToClass - Adds a default accessTo target if an authorization has neither accessTo nor accessToClass @param resource the fedora resource @param inputModel to be checked and updated
[ "This", "method", "does", "two", "things", ":", "-", "Throws", "an", "exception", "if", "an", "authorization", "has", "both", "accessTo", "and", "accessToClass", "-", "Adds", "a", "default", "accessTo", "target", "if", "an", "authorization", "has", "neither", ...
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1033-L1059
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/Swagger2MarkupConverter.java
Swagger2MarkupConverter.from
public static Builder from(Path swaggerPath) { Validate.notNull(swaggerPath, "swaggerPath must not be null"); if (Files.notExists(swaggerPath)) { throw new IllegalArgumentException(String.format("swaggerPath does not exist: %s", swaggerPath)); } try { if (Files.isHidden(swaggerPath)) { throw new IllegalArgumentException("swaggerPath must not be a hidden file"); } } catch (IOException e) { throw new RuntimeException("Failed to check if swaggerPath is a hidden file", e); } return new Builder(swaggerPath); }
java
public static Builder from(Path swaggerPath) { Validate.notNull(swaggerPath, "swaggerPath must not be null"); if (Files.notExists(swaggerPath)) { throw new IllegalArgumentException(String.format("swaggerPath does not exist: %s", swaggerPath)); } try { if (Files.isHidden(swaggerPath)) { throw new IllegalArgumentException("swaggerPath must not be a hidden file"); } } catch (IOException e) { throw new RuntimeException("Failed to check if swaggerPath is a hidden file", e); } return new Builder(swaggerPath); }
[ "public", "static", "Builder", "from", "(", "Path", "swaggerPath", ")", "{", "Validate", ".", "notNull", "(", "swaggerPath", ",", "\"swaggerPath must not be null\"", ")", ";", "if", "(", "Files", ".", "notExists", "(", "swaggerPath", ")", ")", "{", "throw", ...
Creates a Swagger2MarkupConverter.Builder using a local Path. @param swaggerPath the local Path @return a Swagger2MarkupConverter
[ "Creates", "a", "Swagger2MarkupConverter", ".", "Builder", "using", "a", "local", "Path", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/Swagger2MarkupConverter.java#L104-L117
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java
ClientPNCounterProxy.invokeAddInternal
private ClientMessage invokeAddInternal(long delta, boolean getBeforeUpdate, List<Address> excludedAddresses, HazelcastException lastException, Address target) { if (target == null) { throw lastException != null ? lastException : new NoDataMemberInClusterException( "Cannot invoke operations on a CRDT because the cluster does not contain any data members"); } try { final ClientMessage request = PNCounterAddCodec.encodeRequest( name, delta, getBeforeUpdate, observedClock.entrySet(), target); return invokeOnAddress(request, target); } catch (HazelcastException e) { logger.fine("Unable to provide session guarantees when sending operations to " + target + ", choosing different target"); if (excludedAddresses == EMPTY_ADDRESS_LIST) { excludedAddresses = new ArrayList<Address>(); } excludedAddresses.add(target); final Address newTarget = getCRDTOperationTarget(excludedAddresses); return invokeAddInternal(delta, getBeforeUpdate, excludedAddresses, e, newTarget); } }
java
private ClientMessage invokeAddInternal(long delta, boolean getBeforeUpdate, List<Address> excludedAddresses, HazelcastException lastException, Address target) { if (target == null) { throw lastException != null ? lastException : new NoDataMemberInClusterException( "Cannot invoke operations on a CRDT because the cluster does not contain any data members"); } try { final ClientMessage request = PNCounterAddCodec.encodeRequest( name, delta, getBeforeUpdate, observedClock.entrySet(), target); return invokeOnAddress(request, target); } catch (HazelcastException e) { logger.fine("Unable to provide session guarantees when sending operations to " + target + ", choosing different target"); if (excludedAddresses == EMPTY_ADDRESS_LIST) { excludedAddresses = new ArrayList<Address>(); } excludedAddresses.add(target); final Address newTarget = getCRDTOperationTarget(excludedAddresses); return invokeAddInternal(delta, getBeforeUpdate, excludedAddresses, e, newTarget); } }
[ "private", "ClientMessage", "invokeAddInternal", "(", "long", "delta", ",", "boolean", "getBeforeUpdate", ",", "List", "<", "Address", ">", "excludedAddresses", ",", "HazelcastException", "lastException", ",", "Address", "target", ")", "{", "if", "(", "target", "=...
Adds the {@code delta} and returns the value of the counter before the update if {@code getBeforeUpdate} is {@code true} or the value after the update if it is {@code false}. It will invoke client messages recursively on viable replica addresses until successful or the list of viable replicas is exhausted. Replicas with addresses contained in the {@code excludedAddresses} are skipped. If there are no viable replicas, this method will throw the {@code lastException} if not {@code null} or a {@link NoDataMemberInClusterException} if the {@code lastException} is {@code null}. @param delta the delta to add to the counter value, can be negative @param getBeforeUpdate {@code true} if the operation should return the counter value before the addition, {@code false} if it should return the value after the addition @param excludedAddresses the addresses to exclude when choosing a replica address, must not be {@code null} @param lastException the exception thrown from the last invocation of the {@code request} on a replica, may be {@code null} @return the result of the request invocation on a replica @throws NoDataMemberInClusterException if there are no replicas and the {@code lastException} is {@code null}
[ "Adds", "the", "{", "@code", "delta", "}", "and", "returns", "the", "value", "of", "the", "counter", "before", "the", "update", "if", "{", "@code", "getBeforeUpdate", "}", "is", "{", "@code", "true", "}", "or", "the", "value", "after", "the", "update", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java#L245-L269
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendText
public DateTimeFormatterBuilder appendText(DateTimeFieldType fieldType) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } return append0(new TextField(fieldType, false)); }
java
public DateTimeFormatterBuilder appendText(DateTimeFieldType fieldType) { if (fieldType == null) { throw new IllegalArgumentException("Field type must not be null"); } return append0(new TextField(fieldType, false)); }
[ "public", "DateTimeFormatterBuilder", "appendText", "(", "DateTimeFieldType", "fieldType", ")", "{", "if", "(", "fieldType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field type must not be null\"", ")", ";", "}", "return", "append0",...
Instructs the printer to emit a field value as text, and the parser to expect text. @param fieldType type of field to append @return this DateTimeFormatterBuilder, for chaining @throws IllegalArgumentException if field type is null
[ "Instructs", "the", "printer", "to", "emit", "a", "field", "value", "as", "text", "and", "the", "parser", "to", "expect", "text", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L534-L539
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onMyWalletEvent
public Closeable onMyWalletEvent(final BiConsumer<BitfinexAccountSymbol,Collection<BitfinexWallet>> listener) { walletConsumers.offer(listener); return () -> walletConsumers.remove(listener); }
java
public Closeable onMyWalletEvent(final BiConsumer<BitfinexAccountSymbol,Collection<BitfinexWallet>> listener) { walletConsumers.offer(listener); return () -> walletConsumers.remove(listener); }
[ "public", "Closeable", "onMyWalletEvent", "(", "final", "BiConsumer", "<", "BitfinexAccountSymbol", ",", "Collection", "<", "BitfinexWallet", ">", ">", "listener", ")", "{", "walletConsumers", ".", "offer", "(", "listener", ")", ";", "return", "(", ")", "->", ...
registers listener for user account related events - wallet change events @param listener of event @return hook of this listener
[ "registers", "listener", "for", "user", "account", "related", "events", "-", "wallet", "change", "events" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L138-L141
urish/gwt-titanium
src/main/java/org/urish/gwtit/client/util/Timers.java
Timers.setTimeout
public static Timer setTimeout(int milliseconds, TimerCallback callback) { TimeoutTimer timeout = new TimeoutTimer(); timeout.setId(nativeSetTimeout(milliseconds, callback, timeout)); return timeout; }
java
public static Timer setTimeout(int milliseconds, TimerCallback callback) { TimeoutTimer timeout = new TimeoutTimer(); timeout.setId(nativeSetTimeout(milliseconds, callback, timeout)); return timeout; }
[ "public", "static", "Timer", "setTimeout", "(", "int", "milliseconds", ",", "TimerCallback", "callback", ")", "{", "TimeoutTimer", "timeout", "=", "new", "TimeoutTimer", "(", ")", ";", "timeout", ".", "setId", "(", "nativeSetTimeout", "(", "milliseconds", ",", ...
Defines a one-shot timer. @param milliseconds Time until the timeout callback fires @param callback Callback to fire @return The new timer object
[ "Defines", "a", "one", "-", "shot", "timer", "." ]
train
https://github.com/urish/gwt-titanium/blob/5b53a312093a84f235366932430f02006a570612/src/main/java/org/urish/gwtit/client/util/Timers.java#L114-L118
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/ISMgr.java
ISMgr.setValue
public void setValue(ReloadableType rtype, Object instance, Object value, String name) throws IllegalAccessException { // System.err.println(">setValue(rtype=" + rtype + ",instance=" + instance + ",value=" + value + ",name=" + name + ")"); // Look up through our reloadable hierarchy to find it FieldMember fieldmember = rtype.findInstanceField(name); if (fieldmember == null) { // If the field is null, there are two possible reasons: // 1. The field does not exist in the hierarchy at all // 2. The field is on a type just above our topmost reloadable type FieldReaderWriter frw = rtype.locateField(name); if (frw == null) { // bad code redeployed? log.info("Unexpectedly unable to locate instance field " + name + " starting from type " + rtype.dottedtypename + ": clinit running late?"); return; } frw.setValue(instance, value, this); } else { if (fieldmember.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + rtype.dottedtypename + "." + fieldmember.getName()); } Map<String, Object> typeValues = values.get(fieldmember.getDeclaringTypeName()); if (typeValues == null) { typeValues = new HashMap<String, Object>(); values.put(fieldmember.getDeclaringTypeName(), typeValues); } typeValues.put(name, value); } }
java
public void setValue(ReloadableType rtype, Object instance, Object value, String name) throws IllegalAccessException { // System.err.println(">setValue(rtype=" + rtype + ",instance=" + instance + ",value=" + value + ",name=" + name + ")"); // Look up through our reloadable hierarchy to find it FieldMember fieldmember = rtype.findInstanceField(name); if (fieldmember == null) { // If the field is null, there are two possible reasons: // 1. The field does not exist in the hierarchy at all // 2. The field is on a type just above our topmost reloadable type FieldReaderWriter frw = rtype.locateField(name); if (frw == null) { // bad code redeployed? log.info("Unexpectedly unable to locate instance field " + name + " starting from type " + rtype.dottedtypename + ": clinit running late?"); return; } frw.setValue(instance, value, this); } else { if (fieldmember.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + rtype.dottedtypename + "." + fieldmember.getName()); } Map<String, Object> typeValues = values.get(fieldmember.getDeclaringTypeName()); if (typeValues == null) { typeValues = new HashMap<String, Object>(); values.put(fieldmember.getDeclaringTypeName(), typeValues); } typeValues.put(name, value); } }
[ "public", "void", "setValue", "(", "ReloadableType", "rtype", ",", "Object", "instance", ",", "Object", "value", ",", "String", "name", ")", "throws", "IllegalAccessException", "{", "//\t\tSystem.err.println(\">setValue(rtype=\" + rtype + \",instance=\" + instance + \",value=\"...
Set the value of a field. @param rtype the reloadabletype @param instance the instance upon which to set the field @param value the value to put into the field @param name the name of the field @throws IllegalAccessException if there is a problem setting the field value
[ "Set", "the", "value", "of", "a", "field", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ISMgr.java#L168-L201
aalmiray/Json-lib
src/main/java/net/sf/json/JSONSerializer.java
JSONSerializer.toJava
public static Object toJava( JSON json, JsonConfig jsonConfig ) { if( JSONUtils.isNull( json ) ){ return null; } Object object = null; if( json instanceof JSONArray ){ if( jsonConfig.getArrayMode() == JsonConfig.MODE_OBJECT_ARRAY ){ object = JSONArray.toArray( (JSONArray) json, jsonConfig ); }else{ object = JSONArray.toCollection( (JSONArray) json, jsonConfig ); } }else{ object = JSONObject.toBean( (JSONObject) json, jsonConfig ); } return object; }
java
public static Object toJava( JSON json, JsonConfig jsonConfig ) { if( JSONUtils.isNull( json ) ){ return null; } Object object = null; if( json instanceof JSONArray ){ if( jsonConfig.getArrayMode() == JsonConfig.MODE_OBJECT_ARRAY ){ object = JSONArray.toArray( (JSONArray) json, jsonConfig ); }else{ object = JSONArray.toCollection( (JSONArray) json, jsonConfig ); } }else{ object = JSONObject.toBean( (JSONObject) json, jsonConfig ); } return object; }
[ "public", "static", "Object", "toJava", "(", "JSON", "json", ",", "JsonConfig", "jsonConfig", ")", "{", "if", "(", "JSONUtils", ".", "isNull", "(", "json", ")", ")", "{", "return", "null", ";", "}", "Object", "object", "=", "null", ";", "if", "(", "j...
Transform a JSON value to a java object.<br> Depending on the configured values for conversion this will return a DynaBean, a bean, a List, or and array. @param json a JSON value @param jsonConfig additional configuration @return depends on the nature of the source object (JSONObject, JSONArray, JSONNull) and the configured rootClass, classMap and arrayMode
[ "Transform", "a", "JSON", "value", "to", "a", "java", "object", ".", "<br", ">", "Depending", "on", "the", "configured", "values", "for", "conversion", "this", "will", "return", "a", "DynaBean", "a", "bean", "a", "List", "or", "and", "array", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONSerializer.java#L55-L73
voldemort/voldemort
src/java/voldemort/client/ClientConfig.java
ClientConfig.setNodeBannagePeriod
@Deprecated public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, TimeUnit unit) { this.failureDetectorBannagePeriod = unit.toMillis(nodeBannagePeriod); return this; }
java
@Deprecated public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, TimeUnit unit) { this.failureDetectorBannagePeriod = unit.toMillis(nodeBannagePeriod); return this; }
[ "@", "Deprecated", "public", "ClientConfig", "setNodeBannagePeriod", "(", "int", "nodeBannagePeriod", ",", "TimeUnit", "unit", ")", "{", "this", ".", "failureDetectorBannagePeriod", "=", "unit", ".", "toMillis", "(", "nodeBannagePeriod", ")", ";", "return", "this", ...
The period of time to ban a node that gives an error on an operation. @param nodeBannagePeriod The period of time to ban the node @param unit The time unit of the given value @deprecated Use {@link #setFailureDetectorBannagePeriod(long)} instead
[ "The", "period", "of", "time", "to", "ban", "a", "node", "that", "gives", "an", "error", "on", "an", "operation", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/ClientConfig.java#L721-L725
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XRTreeFragSelectWrapper.java
XRTreeFragSelectWrapper.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { ((Expression)m_obj).fixupVariables(vars, globalsSize); }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { ((Expression)m_obj).fixupVariables(vars, globalsSize); }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "(", "(", "Expression", ")", "m_obj", ")", ".", "fixupVariables", "(", "vars", ",", "globalsSize", ")", ";", "}" ]
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. @param vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
[ "This", "function", "is", "used", "to", "fixup", "variables", "from", "QNames", "to", "stack", "frame", "indexes", "at", "stylesheet", "build", "time", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XRTreeFragSelectWrapper.java#L51-L54
rythmengine/rythmengine
src/main/java/org/rythmengine/toString/ToStringOption.java
ToStringOption.setAppendTransient
public ToStringOption setAppendTransient(boolean appendTransient) { ToStringOption op = this; if (this == DEFAULT_OPTION) { op = new ToStringOption(this.appendStatic, this.appendTransient); } op.appendTransient = appendTransient; return op; }
java
public ToStringOption setAppendTransient(boolean appendTransient) { ToStringOption op = this; if (this == DEFAULT_OPTION) { op = new ToStringOption(this.appendStatic, this.appendTransient); } op.appendTransient = appendTransient; return op; }
[ "public", "ToStringOption", "setAppendTransient", "(", "boolean", "appendTransient", ")", "{", "ToStringOption", "op", "=", "this", ";", "if", "(", "this", "==", "DEFAULT_OPTION", ")", "{", "op", "=", "new", "ToStringOption", "(", "this", ".", "appendStatic", ...
Return a <code>ToStringOption</code> instance with {@link #appendTransient} option set. if the current instance is not {@link #DEFAULT_OPTION default instance} then set on the current instance and return the current instance. Otherwise, clone the default instance and set on the clone and return the clone @param appendTransient @return this option instance or clone if this is the {@link #DEFAULT_OPTION}
[ "Return", "a", "<code", ">", "ToStringOption<", "/", "code", ">", "instance", "with", "{", "@link", "#appendTransient", "}", "option", "set", ".", "if", "the", "current", "instance", "is", "not", "{", "@link", "#DEFAULT_OPTION", "default", "instance", "}", "...
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringOption.java#L89-L96
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubject.java
MultimapWithProtoValuesSubject.ignoringFieldAbsenceOfFieldsForValues
public MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldsForValues( int firstFieldNumber, int... rest) { return usingConfig(config.ignoringFieldAbsenceOfFields(asList(firstFieldNumber, rest))); }
java
public MultimapWithProtoValuesFluentAssertion<M> ignoringFieldAbsenceOfFieldsForValues( int firstFieldNumber, int... rest) { return usingConfig(config.ignoringFieldAbsenceOfFields(asList(firstFieldNumber, rest))); }
[ "public", "MultimapWithProtoValuesFluentAssertion", "<", "M", ">", "ignoringFieldAbsenceOfFieldsForValues", "(", "int", "firstFieldNumber", ",", "int", "...", "rest", ")", "{", "return", "usingConfig", "(", "config", ".", "ignoringFieldAbsenceOfFields", "(", "asList", "...
Specifies that the 'has' bit of these explicitly specified top-level field numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly (via {@link FieldDescriptor}) if they are to be ignored as well. <p>Use {@link #ignoringFieldAbsenceForValues()} instead to ignore the 'has' bit for all fields. @see #ignoringFieldAbsenceForValues() for details
[ "Specifies", "that", "the", "has", "bit", "of", "these", "explicitly", "specified", "top", "-", "level", "field", "numbers", "should", "be", "ignored", "when", "comparing", "for", "equality", ".", "Sub", "-", "fields", "must", "be", "specified", "explicitly", ...
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MultimapWithProtoValuesSubject.java#L291-L294
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonthDay.java
YearMonthDay.withField
public YearMonthDay withField(DateTimeFieldType fieldType, int value) { int index = indexOfSupported(fieldType); if (value == getValue(index)) { return this; } int[] newValues = getValues(); newValues = getField(index).set(this, index, newValues, value); return new YearMonthDay(this, newValues); }
java
public YearMonthDay withField(DateTimeFieldType fieldType, int value) { int index = indexOfSupported(fieldType); if (value == getValue(index)) { return this; } int[] newValues = getValues(); newValues = getField(index).set(this, index, newValues, value); return new YearMonthDay(this, newValues); }
[ "public", "YearMonthDay", "withField", "(", "DateTimeFieldType", "fieldType", ",", "int", "value", ")", "{", "int", "index", "=", "indexOfSupported", "(", "fieldType", ")", ";", "if", "(", "value", "==", "getValue", "(", "index", ")", ")", "{", "return", "...
Returns a copy of this date with the specified field set to a new value. <p> For example, if the field type is <code>dayOfMonth</code> then the day would be changed in the returned instance. <p> These three lines are equivalent: <pre> YearMonthDay updated = ymd.withField(DateTimeFieldType.dayOfMonth(), 6); YearMonthDay updated = ymd.dayOfMonth().setCopy(6); YearMonthDay updated = ymd.property(DateTimeFieldType.dayOfMonth()).setCopy(6); </pre> @param fieldType the field type to set, not null @param value the value to set @return a copy of this instance with the field set @throws IllegalArgumentException if the value is null or invalid
[ "Returns", "a", "copy", "of", "this", "date", "with", "the", "specified", "field", "set", "to", "a", "new", "value", ".", "<p", ">", "For", "example", "if", "the", "field", "type", "is", "<code", ">", "dayOfMonth<", "/", "code", ">", "then", "the", "...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonthDay.java#L410-L418
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BasicBlock.java
BasicBlock.setExceptionGen
public void setExceptionGen(@Nullable TypeMerger m, CodeExceptionGen exceptionGen) { if (this.exceptionGen != null) { AnalysisContext.logError("Multiple exception handlers"); } this.exceptionGen = exceptionGen; }
java
public void setExceptionGen(@Nullable TypeMerger m, CodeExceptionGen exceptionGen) { if (this.exceptionGen != null) { AnalysisContext.logError("Multiple exception handlers"); } this.exceptionGen = exceptionGen; }
[ "public", "void", "setExceptionGen", "(", "@", "Nullable", "TypeMerger", "m", ",", "CodeExceptionGen", "exceptionGen", ")", "{", "if", "(", "this", ".", "exceptionGen", "!=", "null", ")", "{", "AnalysisContext", ".", "logError", "(", "\"Multiple exception handlers...
Set the CodeExceptionGen object. Marks this basic block as the entry point of an exception handler. @param exceptionGen the CodeExceptionGen object for the block
[ "Set", "the", "CodeExceptionGen", "object", ".", "Marks", "this", "basic", "block", "as", "the", "entry", "point", "of", "an", "exception", "handler", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/BasicBlock.java#L415-L421
kiegroup/jbpm
jbpm-bpmn2-emfextmodel/src/main/java/org/omg/spec/bpmn/non/normative/color/util/ColorValidator.java
ColorValidator.validateHexColor_Pattern
public boolean validateHexColor_Pattern(String hexColor, DiagnosticChain diagnostics, Map<Object, Object> context) { return validatePattern(ColorPackage.Literals.HEX_COLOR, hexColor, HEX_COLOR__PATTERN__VALUES, diagnostics, context); }
java
public boolean validateHexColor_Pattern(String hexColor, DiagnosticChain diagnostics, Map<Object, Object> context) { return validatePattern(ColorPackage.Literals.HEX_COLOR, hexColor, HEX_COLOR__PATTERN__VALUES, diagnostics, context); }
[ "public", "boolean", "validateHexColor_Pattern", "(", "String", "hexColor", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "return", "validatePattern", "(", "ColorPackage", ".", "Literals", ".", "HEX_COLO...
Validates the Pattern constraint of '<em>Hex Color</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Validates", "the", "Pattern", "constraint", "of", "<em", ">", "Hex", "Color<", "/", "em", ">", ".", "<!", "--", "begin", "-", "user", "-", "doc", "--", ">", "<!", "--", "end", "-", "user", "-", "doc", "--", ">" ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2-emfextmodel/src/main/java/org/omg/spec/bpmn/non/normative/color/util/ColorValidator.java#L162-L164
GoogleCloudPlatform/bigdata-interop
bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java
BigQueryFactory.getBigQuery
public Bigquery getBigQuery(Configuration config) throws GeneralSecurityException, IOException { logger.atInfo().log("Creating BigQuery from default credential."); Credential credential = createBigQueryCredential(config); // Use the credential to create an authorized BigQuery client return getBigQueryFromCredential(credential, BQC_ID); }
java
public Bigquery getBigQuery(Configuration config) throws GeneralSecurityException, IOException { logger.atInfo().log("Creating BigQuery from default credential."); Credential credential = createBigQueryCredential(config); // Use the credential to create an authorized BigQuery client return getBigQueryFromCredential(credential, BQC_ID); }
[ "public", "Bigquery", "getBigQuery", "(", "Configuration", "config", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "logger", ".", "atInfo", "(", ")", ".", "log", "(", "\"Creating BigQuery from default credential.\"", ")", ";", "Credential", "cred...
Constructs a BigQuery from the credential constructed from the environment. @throws IOException on IO Error. @throws GeneralSecurityException on General Security Error.
[ "Constructs", "a", "BigQuery", "from", "the", "credential", "constructed", "from", "the", "environment", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryFactory.java#L118-L124
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java
JavadocConverter.setPos
private TreeNode setPos(TreeNode newNode, int pos, int endPos) { return newNode.setPosition(new SourcePosition(pos, endPos - pos, lineNumber(pos))); }
java
private TreeNode setPos(TreeNode newNode, int pos, int endPos) { return newNode.setPosition(new SourcePosition(pos, endPos - pos, lineNumber(pos))); }
[ "private", "TreeNode", "setPos", "(", "TreeNode", "newNode", ",", "int", "pos", ",", "int", "endPos", ")", "{", "return", "newNode", ".", "setPosition", "(", "new", "SourcePosition", "(", "pos", ",", "endPos", "-", "pos", ",", "lineNumber", "(", "pos", "...
Set a TreeNode's position using begin and end source offsets. Its line number is unchanged.
[ "Set", "a", "TreeNode", "s", "position", "using", "begin", "and", "end", "source", "offsets", ".", "Its", "line", "number", "is", "unchanged", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java#L338-L340
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Stage.java
Stage.actorFor
public <T> T actorFor(final Class<T> protocol, final Definition definition) { return actorFor( protocol, definition, definition.parentOr(world.defaultParent()), definition.supervisor(), definition.loggerOr(world.defaultLogger())); }
java
public <T> T actorFor(final Class<T> protocol, final Definition definition) { return actorFor( protocol, definition, definition.parentOr(world.defaultParent()), definition.supervisor(), definition.loggerOr(world.defaultLogger())); }
[ "public", "<", "T", ">", "T", "actorFor", "(", "final", "Class", "<", "T", ">", "protocol", ",", "final", "Definition", "definition", ")", "{", "return", "actorFor", "(", "protocol", ",", "definition", ",", "definition", ".", "parentOr", "(", "world", "....
Answers the {@code T} protocol of the newly created {@code Actor} that implements the {@code protocol}. @param <T> the protocol type @param protocol the {@code Class<T>} protocol @param definition the {@code Definition} used to initialize the newly created {@code Actor} @return T
[ "Answers", "the", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L60-L67
ios-driver/ios-driver
server/src/main/java/org/uiautomation/ios/application/APPIOSApplication.java
APPIOSApplication.setSafariBuiltinFavorites
public void setSafariBuiltinFavorites() { File[] files = app.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith("BuiltinFavorites") && name.endsWith(".plist"); } }); for (File plist : files) { setSafariBuiltinFavories(plist); } }
java
public void setSafariBuiltinFavorites() { File[] files = app.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.startsWith("BuiltinFavorites") && name.endsWith(".plist"); } }); for (File plist : files) { setSafariBuiltinFavories(plist); } }
[ "public", "void", "setSafariBuiltinFavorites", "(", ")", "{", "File", "[", "]", "files", "=", "app", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "name", ...
Modifies the BuiltinFavorites....plist in safariCopies/safari.app to contain only "about:blank"
[ "Modifies", "the", "BuiltinFavorites", "....", "plist", "in", "safariCopies", "/", "safari", ".", "app", "to", "contain", "only", "about", ":", "blank" ]
train
https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/application/APPIOSApplication.java#L385-L395
azkaban/azkaban
az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java
HadoopJobUtils.addAdditionalNamenodesToProps
public static void addAdditionalNamenodesToProps(Props props, String additionalNamenodes) { String otherNamenodes = props.get(OTHER_NAMENODES_PROPERTY); if (otherNamenodes != null && otherNamenodes.length() > 0) { props.put(OTHER_NAMENODES_PROPERTY, otherNamenodes + "," + additionalNamenodes); } else { props.put(OTHER_NAMENODES_PROPERTY, additionalNamenodes); } }
java
public static void addAdditionalNamenodesToProps(Props props, String additionalNamenodes) { String otherNamenodes = props.get(OTHER_NAMENODES_PROPERTY); if (otherNamenodes != null && otherNamenodes.length() > 0) { props.put(OTHER_NAMENODES_PROPERTY, otherNamenodes + "," + additionalNamenodes); } else { props.put(OTHER_NAMENODES_PROPERTY, additionalNamenodes); } }
[ "public", "static", "void", "addAdditionalNamenodesToProps", "(", "Props", "props", ",", "String", "additionalNamenodes", ")", "{", "String", "otherNamenodes", "=", "props", ".", "get", "(", "OTHER_NAMENODES_PROPERTY", ")", ";", "if", "(", "otherNamenodes", "!=", ...
Takes the list of other Namenodes from which to fetch delegation tokens, the {@link #OTHER_NAMENODES_PROPERTY} property, from Props and inserts it back with the addition of the the potentially JobType-specific Namenode URIs from additionalNamenodes. Modifies props in-place. @param props Props to add the new Namenode URIs to. @param additionalNamenodes Comma-separated list of Namenode URIs from which to fetch delegation tokens.
[ "Takes", "the", "list", "of", "other", "Namenodes", "from", "which", "to", "fetch", "delegation", "tokens", "the", "{", "@link", "#OTHER_NAMENODES_PROPERTY", "}", "property", "from", "Props", "and", "inserts", "it", "back", "with", "the", "addition", "of", "th...
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java#L172-L179
apache/flink
flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/functions/PythonCoGroup.java
PythonCoGroup.coGroup
@Override public final void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<OUT> out) throws Exception { streamer.streamBufferWithGroups(first.iterator(), second.iterator(), out); }
java
@Override public final void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<OUT> out) throws Exception { streamer.streamBufferWithGroups(first.iterator(), second.iterator(), out); }
[ "@", "Override", "public", "final", "void", "coGroup", "(", "Iterable", "<", "IN1", ">", "first", ",", "Iterable", "<", "IN2", ">", "second", ",", "Collector", "<", "OUT", ">", "out", ")", "throws", "Exception", "{", "streamer", ".", "streamBufferWithGroup...
Calls the external python function. @param first @param second @param out collector @throws IOException
[ "Calls", "the", "external", "python", "function", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/functions/PythonCoGroup.java#L65-L68
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/registration/ColumnsGroupVariablesRegistrationManager.java
ColumnsGroupVariablesRegistrationManager.registerValueFormatter
protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) { if ( djVariable.getValueFormatter() == null){ return; } JRDesignParameter dparam = new JRDesignParameter(); dparam.setName(variableName + "_vf"); //value formater suffix dparam.setValueClassName(DJValueFormatter.class.getName()); log.debug("Registering value formatter parameter for property " + dparam.getName() ); try { getDjd().addParameter(dparam); } catch (JRException e) { throw new EntitiesRegistrationException(e.getMessage(),e); } getDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter()); }
java
protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) { if ( djVariable.getValueFormatter() == null){ return; } JRDesignParameter dparam = new JRDesignParameter(); dparam.setName(variableName + "_vf"); //value formater suffix dparam.setValueClassName(DJValueFormatter.class.getName()); log.debug("Registering value formatter parameter for property " + dparam.getName() ); try { getDjd().addParameter(dparam); } catch (JRException e) { throw new EntitiesRegistrationException(e.getMessage(),e); } getDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter()); }
[ "protected", "void", "registerValueFormatter", "(", "DJGroupVariable", "djVariable", ",", "String", "variableName", ")", "{", "if", "(", "djVariable", ".", "getValueFormatter", "(", ")", "==", "null", ")", "{", "return", ";", "}", "JRDesignParameter", "dparam", ...
Registers the parameter for the value formatter for the given variable and puts it's implementation in the parameters map. @param djVariable @param variableName
[ "Registers", "the", "parameter", "for", "the", "value", "formatter", "for", "the", "given", "variable", "and", "puts", "it", "s", "implementation", "in", "the", "parameters", "map", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/registration/ColumnsGroupVariablesRegistrationManager.java#L114-L130
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
XMLConfigAdmin.updateJavaCFX
public void updateJavaCFX(String name, ClassDefinition cd) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING); if (!hasAccess) throw new SecurityException("no access to change cfx settings"); if (name == null || name.length() == 0) throw new ExpressionException("class name can't be a empty value"); renameOldstyleCFX(); Element tags = _getRootElement("ext-tags"); // Update Element[] children = XMLConfigWebFactory.getChildren(tags, "ext-tag"); for (int i = 0; i < children.length; i++) { String n = children[i].getAttribute("name"); if (n != null && n.equalsIgnoreCase(name)) { Element el = children[i]; if (!"java".equalsIgnoreCase(el.getAttribute("type"))) throw new ExpressionException("there is already a c++ cfx tag with this name"); setClass(el, CustomTag.class, "", cd); el.setAttribute("type", "java"); return; } } // Insert Element el = doc.createElement("ext-tag"); tags.appendChild(el); setClass(el, CustomTag.class, "", cd); el.setAttribute("name", name); el.setAttribute("type", "java"); }
java
public void updateJavaCFX(String name, ClassDefinition cd) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING); if (!hasAccess) throw new SecurityException("no access to change cfx settings"); if (name == null || name.length() == 0) throw new ExpressionException("class name can't be a empty value"); renameOldstyleCFX(); Element tags = _getRootElement("ext-tags"); // Update Element[] children = XMLConfigWebFactory.getChildren(tags, "ext-tag"); for (int i = 0; i < children.length; i++) { String n = children[i].getAttribute("name"); if (n != null && n.equalsIgnoreCase(name)) { Element el = children[i]; if (!"java".equalsIgnoreCase(el.getAttribute("type"))) throw new ExpressionException("there is already a c++ cfx tag with this name"); setClass(el, CustomTag.class, "", cd); el.setAttribute("type", "java"); return; } } // Insert Element el = doc.createElement("ext-tag"); tags.appendChild(el); setClass(el, CustomTag.class, "", cd); el.setAttribute("name", name); el.setAttribute("type", "java"); }
[ "public", "void", "updateJavaCFX", "(", "String", "name", ",", "ClassDefinition", "cd", ")", "throws", "PageException", "{", "checkWriteAccess", "(", ")", ";", "boolean", "hasAccess", "=", "ConfigWebUtil", ".", "hasAccess", "(", "config", ",", "SecurityManager", ...
insert or update a Java CFX Tag @param name @param strClass @throws PageException
[ "insert", "or", "update", "a", "Java", "CFX", "Tag" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L1134-L1167
alkacon/opencms-core
src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
CmsDefaultXmlContentHandler.initFields
protected void initFields(Element parent, CmsXmlContentDefinition contentDef) throws CmsXmlException { for (Element fieldElem : parent.elements(N_SETTING)) { initField(fieldElem, contentDef); } }
java
protected void initFields(Element parent, CmsXmlContentDefinition contentDef) throws CmsXmlException { for (Element fieldElem : parent.elements(N_SETTING)) { initField(fieldElem, contentDef); } }
[ "protected", "void", "initFields", "(", "Element", "parent", ",", "CmsXmlContentDefinition", "contentDef", ")", "throws", "CmsXmlException", "{", "for", "(", "Element", "fieldElem", ":", "parent", ".", "elements", "(", "N_SETTING", ")", ")", "{", "initField", "(...
Processes all field declarations in the schema.<p> @param parent the parent element @param contentDef the content definition @throws CmsXmlException if something goes wrong
[ "Processes", "all", "field", "declarations", "in", "the", "schema", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L2612-L2617
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setScheduler
protected void setScheduler(CFMLEngine engine, Resource scheduleDirectory) throws PageException { if (scheduleDirectory == null) { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, "<?xml version=\"1.0\"?>\n<schedule></schedule>", this); return; } if (!isDirectory(scheduleDirectory)) throw new ExpressionException("schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory"); try { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, this, scheduleDirectory, SystemUtil.getCharset().name()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
protected void setScheduler(CFMLEngine engine, Resource scheduleDirectory) throws PageException { if (scheduleDirectory == null) { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, "<?xml version=\"1.0\"?>\n<schedule></schedule>", this); return; } if (!isDirectory(scheduleDirectory)) throw new ExpressionException("schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory"); try { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, this, scheduleDirectory, SystemUtil.getCharset().name()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "protected", "void", "setScheduler", "(", "CFMLEngine", "engine", ",", "Resource", "scheduleDirectory", ")", "throws", "PageException", "{", "if", "(", "scheduleDirectory", "==", "null", ")", "{", "if", "(", "this", ".", "scheduler", "==", "null", ")", "this",...
sets the Schedule Directory @param scheduleDirectory sets the schedule Directory @param logger @throws PageException
[ "sets", "the", "Schedule", "Directory" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1654-L1667
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VTimeZone.java
VTimeZone.writeZonePropsByDOW_GEQ_DOM
private static void writeZonePropsByDOW_GEQ_DOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, int dayOfWeek, long startTime, long untilTime) throws IOException { // Check if this rule can be converted to DOW rule if (dayOfMonth%7 == 1) { // Can be represented by DOW rule writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, (dayOfMonth + 6)/7, dayOfWeek, startTime, untilTime); } else if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - dayOfMonth)%7 == 6) { // Can be represented by DOW rule with negative week number writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, -1*((MONTHLENGTH[month] - dayOfMonth + 1)/7), dayOfWeek, startTime, untilTime); } else { // Otherwise, use BYMONTHDAY to include all possible dates beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime); // Check if all days are in the same month int startDay = dayOfMonth; int currentMonthDays = 7; if (dayOfMonth <= 0) { // The start day is in previous month int prevMonthDays = 1 - dayOfMonth; currentMonthDays -= prevMonthDays; int prevMonth = (month - 1) < 0 ? 11 : month - 1; // Note: When a rule is separated into two, UNTIL attribute needs to be // calculated for each of them. For now, we skip this, because we basically use this method // only for final rules, which does not have the UNTIL attribute writeZonePropsByDOW_GEQ_DOM_sub(writer, prevMonth, -prevMonthDays, dayOfWeek, prevMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); // Start from 1 for the rest startDay = 1; } else if (dayOfMonth + 6 > MONTHLENGTH[month]) { // Note: This code does not actually work well in February. For now, days in month in // non-leap year. int nextMonthDays = dayOfMonth + 6 - MONTHLENGTH[month]; currentMonthDays -= nextMonthDays; int nextMonth = (month + 1) > 11 ? 0 : month + 1; writeZonePropsByDOW_GEQ_DOM_sub(writer, nextMonth, 1, dayOfWeek, nextMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); } writeZonePropsByDOW_GEQ_DOM_sub(writer, month, startDay, dayOfWeek, currentMonthDays, untilTime, fromOffset); endZoneProps(writer, isDst); } }
java
private static void writeZonePropsByDOW_GEQ_DOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, int dayOfWeek, long startTime, long untilTime) throws IOException { // Check if this rule can be converted to DOW rule if (dayOfMonth%7 == 1) { // Can be represented by DOW rule writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, (dayOfMonth + 6)/7, dayOfWeek, startTime, untilTime); } else if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - dayOfMonth)%7 == 6) { // Can be represented by DOW rule with negative week number writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, -1*((MONTHLENGTH[month] - dayOfMonth + 1)/7), dayOfWeek, startTime, untilTime); } else { // Otherwise, use BYMONTHDAY to include all possible dates beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime); // Check if all days are in the same month int startDay = dayOfMonth; int currentMonthDays = 7; if (dayOfMonth <= 0) { // The start day is in previous month int prevMonthDays = 1 - dayOfMonth; currentMonthDays -= prevMonthDays; int prevMonth = (month - 1) < 0 ? 11 : month - 1; // Note: When a rule is separated into two, UNTIL attribute needs to be // calculated for each of them. For now, we skip this, because we basically use this method // only for final rules, which does not have the UNTIL attribute writeZonePropsByDOW_GEQ_DOM_sub(writer, prevMonth, -prevMonthDays, dayOfWeek, prevMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); // Start from 1 for the rest startDay = 1; } else if (dayOfMonth + 6 > MONTHLENGTH[month]) { // Note: This code does not actually work well in February. For now, days in month in // non-leap year. int nextMonthDays = dayOfMonth + 6 - MONTHLENGTH[month]; currentMonthDays -= nextMonthDays; int nextMonth = (month + 1) > 11 ? 0 : month + 1; writeZonePropsByDOW_GEQ_DOM_sub(writer, nextMonth, 1, dayOfWeek, nextMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); } writeZonePropsByDOW_GEQ_DOM_sub(writer, month, startDay, dayOfWeek, currentMonthDays, untilTime, fromOffset); endZoneProps(writer, isDst); } }
[ "private", "static", "void", "writeZonePropsByDOW_GEQ_DOM", "(", "Writer", "writer", ",", "boolean", "isDst", ",", "String", "tzname", ",", "int", "fromOffset", ",", "int", "toOffset", ",", "int", "month", ",", "int", "dayOfMonth", ",", "int", "dayOfWeek", ","...
/* Write start times defined by a DOW_GEQ_DOM rule using VTIMEZONE RRULE
[ "/", "*", "Write", "start", "times", "defined", "by", "a", "DOW_GEQ_DOM", "rule", "using", "VTIMEZONE", "RRULE" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VTimeZone.java#L1553-L1599
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java
MonitoringProxyActivator.createDirectoryEntries
public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException { StringBuilder entryName = new StringBuilder(packageName.length()); for (String str : packageName.split("\\.")) { entryName.append(str).append("/"); JarEntry jarEntry = new JarEntry(entryName.toString()); jarStream.putNextEntry(jarEntry); } }
java
public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException { StringBuilder entryName = new StringBuilder(packageName.length()); for (String str : packageName.split("\\.")) { entryName.append(str).append("/"); JarEntry jarEntry = new JarEntry(entryName.toString()); jarStream.putNextEntry(jarEntry); } }
[ "public", "void", "createDirectoryEntries", "(", "JarOutputStream", "jarStream", ",", "String", "packageName", ")", "throws", "IOException", "{", "StringBuilder", "entryName", "=", "new", "StringBuilder", "(", "packageName", ".", "length", "(", ")", ")", ";", "for...
Create the jar directory entries corresponding to the specified package name. @param jarStream the target jar's output stream @param packageName the target package name @throws IOException if an IO exception raised while creating the entries
[ "Create", "the", "jar", "directory", "entries", "corresponding", "to", "the", "specified", "package", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L272-L279
looly/hutool
hutool-db/src/main/java/cn/hutool/db/StatementUtil.java
StatementUtil.prepareCall
public static CallableStatement prepareCall(Connection conn, String sql, Object... params) throws SQLException { Assert.notBlank(sql, "Sql String must be not blank!"); sql = sql.trim(); SqlLog.INSTASNCE.log(sql, params); final CallableStatement call = conn.prepareCall(sql); fillParams(call, params); return call; }
java
public static CallableStatement prepareCall(Connection conn, String sql, Object... params) throws SQLException { Assert.notBlank(sql, "Sql String must be not blank!"); sql = sql.trim(); SqlLog.INSTASNCE.log(sql, params); final CallableStatement call = conn.prepareCall(sql); fillParams(call, params); return call; }
[ "public", "static", "CallableStatement", "prepareCall", "(", "Connection", "conn", ",", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "Assert", ".", "notBlank", "(", "sql", ",", "\"Sql String must be not blank!\"", ")", ";", ...
创建{@link CallableStatement} @param conn 数据库连接 @param sql SQL语句,使用"?"做为占位符 @param params "?"对应参数列表 @return {@link CallableStatement} @throws SQLException SQL异常 @since 4.1.13
[ "创建", "{", "@link", "CallableStatement", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L200-L208
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java
SoundStore.getAIF
public Audio getAIF(String ref) throws IOException { return getAIF(ref, ResourceLoader.getResourceAsStream(ref)); }
java
public Audio getAIF(String ref) throws IOException { return getAIF(ref, ResourceLoader.getResourceAsStream(ref)); }
[ "public", "Audio", "getAIF", "(", "String", "ref", ")", "throws", "IOException", "{", "return", "getAIF", "(", "ref", ",", "ResourceLoader", ".", "getResourceAsStream", "(", "ref", ")", ")", ";", "}" ]
Get the Sound based on a specified AIF file @param ref The reference to the AIF file in the classpath @return The Sound read from the AIF file @throws IOException Indicates a failure to load the AIF
[ "Get", "the", "Sound", "based", "on", "a", "specified", "AIF", "file" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java#L595-L597
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/Link.java
Link.fromSpanContext
public static Link fromSpanContext(SpanContext context, Type type) { return new AutoValue_Link(context.getTraceId(), context.getSpanId(), type, EMPTY_ATTRIBUTES); }
java
public static Link fromSpanContext(SpanContext context, Type type) { return new AutoValue_Link(context.getTraceId(), context.getSpanId(), type, EMPTY_ATTRIBUTES); }
[ "public", "static", "Link", "fromSpanContext", "(", "SpanContext", "context", ",", "Type", "type", ")", "{", "return", "new", "AutoValue_Link", "(", "context", ".", "getTraceId", "(", ")", ",", "context", ".", "getSpanId", "(", ")", ",", "type", ",", "EMPT...
Returns a new {@code Link}. @param context the context of the linked {@code Span}. @param type the type of the relationship with the linked {@code Span}. @return a new {@code Link}. @since 0.5
[ "Returns", "a", "new", "{", "@code", "Link", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/Link.java#L69-L71
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
JavacFileManager.openArchive
protected Archive openArchive(File zipFilename) throws IOException { try { return openArchive(zipFilename, contextUseOptimizedZip); } catch (IOException ioe) { if (ioe instanceof ZipFileIndex.ZipFormatException) { return openArchive(zipFilename, false); } else { throw ioe; } } }
java
protected Archive openArchive(File zipFilename) throws IOException { try { return openArchive(zipFilename, contextUseOptimizedZip); } catch (IOException ioe) { if (ioe instanceof ZipFileIndex.ZipFormatException) { return openArchive(zipFilename, false); } else { throw ioe; } } }
[ "protected", "Archive", "openArchive", "(", "File", "zipFilename", ")", "throws", "IOException", "{", "try", "{", "return", "openArchive", "(", "zipFilename", ",", "contextUseOptimizedZip", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "if", "("...
/* This method looks for a ZipFormatException and takes appropriate evasive action. If there is a failure in the fast mode then we fail over to the platform zip, and allow it to deal with a potentially non compliant zip file.
[ "/", "*", "This", "method", "looks", "for", "a", "ZipFormatException", "and", "takes", "appropriate", "evasive", "action", ".", "If", "there", "is", "a", "failure", "in", "the", "fast", "mode", "then", "we", "fail", "over", "to", "the", "platform", "zip", ...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java#L460-L470
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.unprojectInv
public Vector2d unprojectInv(double winX, double winY, int[] viewport, Vector2d dest) { double ndcX = (winX-viewport[0])/viewport[2]*2.0-1.0; double ndcY = (winY-viewport[1])/viewport[3]*2.0-1.0; dest.x = m00 * ndcX + m10 * ndcY + m20; dest.y = m01 * ndcX + m11 * ndcY + m21; return dest; }
java
public Vector2d unprojectInv(double winX, double winY, int[] viewport, Vector2d dest) { double ndcX = (winX-viewport[0])/viewport[2]*2.0-1.0; double ndcY = (winY-viewport[1])/viewport[3]*2.0-1.0; dest.x = m00 * ndcX + m10 * ndcY + m20; dest.y = m01 * ndcX + m11 * ndcY + m21; return dest; }
[ "public", "Vector2d", "unprojectInv", "(", "double", "winX", ",", "double", "winY", ",", "int", "[", "]", "viewport", ",", "Vector2d", "dest", ")", "{", "double", "ndcX", "=", "(", "winX", "-", "viewport", "[", "0", "]", ")", "/", "viewport", "[", "2...
Unproject the given window coordinates <code>(winX, winY)</code> by <code>this</code> matrix using the specified viewport. <p> This method differs from {@link #unproject(double, double, int[], Vector2d) unproject()} in that it assumes that <code>this</code> is already the inverse matrix of the original projection matrix. It exists to avoid recomputing the matrix inverse with every invocation. @see #unproject(double, double, int[], Vector2d) @param winX the x-coordinate in window coordinates (pixels) @param winY the y-coordinate in window coordinates (pixels) @param viewport the viewport described by <code>[x, y, width, height]</code> @param dest will hold the unprojected position @return dest
[ "Unproject", "the", "given", "window", "coordinates", "<code", ">", "(", "winX", "winY", ")", "<", "/", "code", ">", "by", "<code", ">", "this<", "/", "code", ">", "matrix", "using", "the", "specified", "viewport", ".", "<p", ">", "This", "method", "di...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L2336-L2342
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createGroup
public GitlabGroup createGroup(String name, String path, String ldapCn, GitlabAccessLevel ldapAccess, GitlabUser sudoUser, Integer parentId) throws IOException { Query query = new Query() .append("name", name) .append("path", path) .appendIf("ldap_cn", ldapCn) .appendIf("ldap_access", ldapAccess) .appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null) .appendIf("parent_id", parentId); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
java
public GitlabGroup createGroup(String name, String path, String ldapCn, GitlabAccessLevel ldapAccess, GitlabUser sudoUser, Integer parentId) throws IOException { Query query = new Query() .append("name", name) .append("path", path) .appendIf("ldap_cn", ldapCn) .appendIf("ldap_access", ldapAccess) .appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null) .appendIf("parent_id", parentId); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
[ "public", "GitlabGroup", "createGroup", "(", "String", "name", ",", "String", "path", ",", "String", "ldapCn", ",", "GitlabAccessLevel", "ldapAccess", ",", "GitlabUser", "sudoUser", ",", "Integer", "parentId", ")", "throws", "IOException", "{", "Query", "query", ...
Creates a Group @param name The name of the group @param path The path for the group @param ldapCn LDAP Group Name to sync with, null otherwise @param ldapAccess Access level for LDAP group members, null otherwise @param sudoUser The user to create the group on behalf of @param parentId The id of a parent group; the new group will be its subgroup @return The GitLab Group @throws IOException on gitlab api call error
[ "Creates", "a", "Group" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L636-L649
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupDb.java
CmsSetupDb.updateDatabase
public void updateDatabase(String updateScript, Map<String, String> replacers) { StringReader reader = new StringReader(updateScript); executeSql(reader, replacers, true); }
java
public void updateDatabase(String updateScript, Map<String, String> replacers) { StringReader reader = new StringReader(updateScript); executeSql(reader, replacers, true); }
[ "public", "void", "updateDatabase", "(", "String", "updateScript", ",", "Map", "<", "String", ",", "String", ">", "replacers", ")", "{", "StringReader", "reader", "=", "new", "StringReader", "(", "updateScript", ")", ";", "executeSql", "(", "reader", ",", "r...
Calls an update script.<p> @param updateScript the update script code @param replacers the replacers to use in the script code
[ "Calls", "an", "update", "script", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L540-L544
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/DateUtil.java
DateUtil.parseXmlDate
public static Calendar parseXmlDate(String xsDate) throws ParseException { try { DatatypeFactory df = DatatypeFactory.newInstance(); XMLGregorianCalendar dateTime = df.newXMLGregorianCalendar(xsDate); return dateTime.toGregorianCalendar(); } catch (DatatypeConfigurationException ex) { throw new ParseException("Unable to parse " + xsDate, ex); } }
java
public static Calendar parseXmlDate(String xsDate) throws ParseException { try { DatatypeFactory df = DatatypeFactory.newInstance(); XMLGregorianCalendar dateTime = df.newXMLGregorianCalendar(xsDate); return dateTime.toGregorianCalendar(); } catch (DatatypeConfigurationException ex) { throw new ParseException("Unable to parse " + xsDate, ex); } }
[ "public", "static", "Calendar", "parseXmlDate", "(", "String", "xsDate", ")", "throws", "ParseException", "{", "try", "{", "DatatypeFactory", "df", "=", "DatatypeFactory", ".", "newInstance", "(", ")", ";", "XMLGregorianCalendar", "dateTime", "=", "df", ".", "ne...
Parses an XML xs:date into a calendar object. @param xsDate an xs:date string @return a calendar object @throws ParseException thrown if the date cannot be converted to a calendar
[ "Parses", "an", "XML", "xs", ":", "date", "into", "a", "calendar", "object", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/DateUtil.java#L47-L55
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.clearEvidence
public static void clearEvidence(Network bn, String nodeName) throws ShanksException { int node = bn.getNode(nodeName); if (bn.isEvidence(node)) { bn.clearEvidence(nodeName); bn.updateBeliefs(); } }
java
public static void clearEvidence(Network bn, String nodeName) throws ShanksException { int node = bn.getNode(nodeName); if (bn.isEvidence(node)) { bn.clearEvidence(nodeName); bn.updateBeliefs(); } }
[ "public", "static", "void", "clearEvidence", "(", "Network", "bn", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "int", "node", "=", "bn", ".", "getNode", "(", "nodeName", ")", ";", "if", "(", "bn", ".", "isEvidence", "(", "node", ")"...
Clear a hard evidence fixed in a given node /** @param bn @param nodeName @throws ShanksException
[ "Clear", "a", "hard", "evidence", "fixed", "in", "a", "given", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java#L315-L322
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ShipmentUrl.java
ShipmentUrl.getShipmentUrl
public static MozuUrl getShipmentUrl(String orderId, String responseFields, String shipmentId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/shipments/{shipmentId}?responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("shipmentId", shipmentId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getShipmentUrl(String orderId, String responseFields, String shipmentId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/shipments/{shipmentId}?responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("shipmentId", shipmentId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getShipmentUrl", "(", "String", "orderId", ",", "String", "responseFields", ",", "String", "shipmentId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/shipments/{shipmentId}?response...
Get Resource Url for GetShipment @param orderId Unique identifier of the order. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param shipmentId Unique identifier of the shipment to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetShipment" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ShipmentUrl.java#L23-L30
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java
KryoUtils.applyRegistrations
public static void applyRegistrations(Kryo kryo, Collection<KryoRegistration> resolvedRegistrations) { Serializer<?> serializer; for (KryoRegistration registration : resolvedRegistrations) { serializer = registration.getSerializer(kryo); if (serializer != null) { kryo.register(registration.getRegisteredClass(), serializer, kryo.getNextRegistrationId()); } else { kryo.register(registration.getRegisteredClass(), kryo.getNextRegistrationId()); } } }
java
public static void applyRegistrations(Kryo kryo, Collection<KryoRegistration> resolvedRegistrations) { Serializer<?> serializer; for (KryoRegistration registration : resolvedRegistrations) { serializer = registration.getSerializer(kryo); if (serializer != null) { kryo.register(registration.getRegisteredClass(), serializer, kryo.getNextRegistrationId()); } else { kryo.register(registration.getRegisteredClass(), kryo.getNextRegistrationId()); } } }
[ "public", "static", "void", "applyRegistrations", "(", "Kryo", "kryo", ",", "Collection", "<", "KryoRegistration", ">", "resolvedRegistrations", ")", "{", "Serializer", "<", "?", ">", "serializer", ";", "for", "(", "KryoRegistration", "registration", ":", "resolve...
Apply a list of {@link KryoRegistration} to a Kryo instance. The list of registrations is assumed to already be a final resolution of all possible registration overwrites. <p>The registrations are applied in the given order and always specify the registration id as the next available id in the Kryo instance (providing the id just extra ensures nothing is overwritten, and isn't strictly required); @param kryo the Kryo instance to apply the registrations @param resolvedRegistrations the registrations, which should already be resolved of all possible registration overwrites
[ "Apply", "a", "list", "of", "{", "@link", "KryoRegistration", "}", "to", "a", "Kryo", "instance", ".", "The", "list", "of", "registrations", "is", "assumed", "to", "already", "be", "a", "final", "resolution", "of", "all", "possible", "registration", "overwri...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java#L103-L115
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
AbstractTagLibrary.addUserTag
protected final void addUserTag(String name, URL source) { if (_strictJsf2FaceletsCompatibility == null) { MyfacesConfig config = MyfacesConfig.getCurrentInstance( FacesContext.getCurrentInstance().getExternalContext()); _strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility(); } if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility)) { _factories.put(name, new LegacyUserTagFactory(source)); } else { _factories.put(name, new UserTagFactory(source)); } }
java
protected final void addUserTag(String name, URL source) { if (_strictJsf2FaceletsCompatibility == null) { MyfacesConfig config = MyfacesConfig.getCurrentInstance( FacesContext.getCurrentInstance().getExternalContext()); _strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility(); } if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility)) { _factories.put(name, new LegacyUserTagFactory(source)); } else { _factories.put(name, new UserTagFactory(source)); } }
[ "protected", "final", "void", "addUserTag", "(", "String", "name", ",", "URL", "source", ")", "{", "if", "(", "_strictJsf2FaceletsCompatibility", "==", "null", ")", "{", "MyfacesConfig", "config", "=", "MyfacesConfig", ".", "getCurrentInstance", "(", "FacesContext...
Add a UserTagHandler specified a the URL source. @see UserTagHandler @param name name to use, "foo" would be &lt;my:foo /> @param source source where the Facelet (Tag) source is
[ "Add", "a", "UserTagHandler", "specified", "a", "the", "URL", "source", "." ]
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#L276-L293
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
HawkbitCommonUtil.getSoftwareModuleName
public static String getSoftwareModuleName(final String caption, final String name) { return new StringBuilder() .append(DIV_DESCRIPTION_START + caption + " : " + getBoldHTMLText(getFormattedName(name))) .append(DIV_DESCRIPTION_END).toString(); }
java
public static String getSoftwareModuleName(final String caption, final String name) { return new StringBuilder() .append(DIV_DESCRIPTION_START + caption + " : " + getBoldHTMLText(getFormattedName(name))) .append(DIV_DESCRIPTION_END).toString(); }
[ "public", "static", "String", "getSoftwareModuleName", "(", "final", "String", "caption", ",", "final", "String", "name", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "DIV_DESCRIPTION_START", "+", "caption", "+", "\" : \"", "+", "g...
Get Label for Artifact Details. @param caption as caption of the details @param name as name @return SoftwareModuleName
[ "Get", "Label", "for", "Artifact", "Details", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java#L152-L156
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateNotEmpty
public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException { if (isEmpty(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T> T validateNotEmpty(T value, String errorMsg) throws ValidateException { if (isEmpty(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", ">", "T", "validateNotEmpty", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "isEmpty", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg", ")",...
验证是否为非空,为空时抛出异常<br> 对于String类型判定是否为empty(null 或 "")<br> @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值,验证通过返回此值,非空值 @throws ValidateException 验证异常
[ "验证是否为非空,为空时抛出异常<br", ">", "对于String类型判定是否为empty", "(", "null", "或", ")", "<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L220-L225
davidcarboni-archive/httpino
src/main/java/com/github/davidcarboni/httpino/Http.java
Http.deserialiseResponseMessage
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Type type) throws IOException { T body = null; HttpEntity entity = response.getEntity(); if (entity != null && type != null) { try (InputStream inputStream = entity.getContent()) { try { body = Serialiser.deserialise(inputStream, type); } catch (JsonSyntaxException e) { // This can happen if an error HTTP code is received and the // body of the response doesn't contain the expected object: System.out.println(ExceptionUtils.getStackTrace(e)); body = null; } } } else { EntityUtils.consume(entity); } return body; }
java
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Type type) throws IOException { T body = null; HttpEntity entity = response.getEntity(); if (entity != null && type != null) { try (InputStream inputStream = entity.getContent()) { try { body = Serialiser.deserialise(inputStream, type); } catch (JsonSyntaxException e) { // This can happen if an error HTTP code is received and the // body of the response doesn't contain the expected object: System.out.println(ExceptionUtils.getStackTrace(e)); body = null; } } } else { EntityUtils.consume(entity); } return body; }
[ "protected", "<", "T", ">", "T", "deserialiseResponseMessage", "(", "CloseableHttpResponse", "response", ",", "Type", "type", ")", "throws", "IOException", "{", "T", "body", "=", "null", ";", "HttpEntity", "entity", "=", "response", ".", "getEntity", "(", ")",...
Deserialises the given {@link CloseableHttpResponse} to the specified type. @param response The response. @param type The type to deserialise to. This can be null, in which case {@link EntityUtils#consume(HttpEntity)} will be used to consume the response body (if any). @param <T> The type to deserialise to. @return The deserialised response, or null if the response does not contain an entity. @throws IOException If an error occurs.
[ "Deserialises", "the", "given", "{", "@link", "CloseableHttpResponse", "}", "to", "the", "specified", "type", "." ]
train
https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Http.java#L505-L525
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.tailIterator
public Iterator<T> tailIterator(T key, boolean inclusive) { int point = point(key, inclusive); return subList(point, size()).iterator(); }
java
public Iterator<T> tailIterator(T key, boolean inclusive) { int point = point(key, inclusive); return subList(point, size()).iterator(); }
[ "public", "Iterator", "<", "T", ">", "tailIterator", "(", "T", "key", ",", "boolean", "inclusive", ")", "{", "int", "point", "=", "point", "(", "key", ",", "inclusive", ")", ";", "return", "subList", "(", "point", ",", "size", "(", ")", ")", ".", "...
Returns iterator from key to end @param key @param inclusive @return
[ "Returns", "iterator", "from", "key", "to", "end" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L136-L140
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java
SDVariable.gte
public SDVariable gte(String name, SDVariable other){ return sameDiff.gte(name, this, other); }
java
public SDVariable gte(String name, SDVariable other){ return sameDiff.gte(name, this, other); }
[ "public", "SDVariable", "gte", "(", "String", "name", ",", "SDVariable", "other", ")", "{", "return", "sameDiff", ".", "gte", "(", "name", ",", "this", ",", "other", ")", ";", "}" ]
Greater than or equal to operation: elementwise {@code this >= y}<br> If x and y arrays have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param name Name of the output variable @param other Variable to compare values against @return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied)
[ "Greater", "than", "or", "equal", "to", "operation", ":", "elementwise", "{", "@code", "this", ">", "=", "y", "}", "<br", ">", "If", "x", "and", "y", "arrays", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "the", "inp...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L567-L569
js-lib-com/commons
src/main/java/js/util/Params.java
Params.isFile
public static void isFile(File parameter, String name) throws IllegalArgumentException { if (parameter == null || !parameter.exists() || parameter.isDirectory()) { throw new IllegalArgumentException(String.format("%s |%s| is missing or is a directory.", name, parameter.getAbsolutePath())); } }
java
public static void isFile(File parameter, String name) throws IllegalArgumentException { if (parameter == null || !parameter.exists() || parameter.isDirectory()) { throw new IllegalArgumentException(String.format("%s |%s| is missing or is a directory.", name, parameter.getAbsolutePath())); } }
[ "public", "static", "void", "isFile", "(", "File", "parameter", ",", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parameter", "==", "null", "||", "!", "parameter", ".", "exists", "(", ")", "||", "parameter", ".", "isDirectory...
Check if file parameter is an existing ordinary file, not a directory. This validator throws illegal argument if given file does not exist or is not an ordinary file. @param parameter invocation file parameter, @param name parameter name. @throws IllegalArgumentException if <code>parameter</code> file is null or does not exist or is a directory.
[ "Check", "if", "file", "parameter", "is", "an", "existing", "ordinary", "file", "not", "a", "directory", ".", "This", "validator", "throws", "illegal", "argument", "if", "given", "file", "does", "not", "exist", "or", "is", "not", "an", "ordinary", "file", ...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L176-L180
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java
ResponsiveImageMediaMarkupBuilder.toReponsiveImageSource
@SuppressWarnings("null") protected JSONObject toReponsiveImageSource(Media media, Rendition rendition) { try { JSONObject source = new JSONObject(); MediaFormat mediaFormat = rendition.getMediaFormat(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(PROP_SRC, rendition.getUrl()); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }
java
@SuppressWarnings("null") protected JSONObject toReponsiveImageSource(Media media, Rendition rendition) { try { JSONObject source = new JSONObject(); MediaFormat mediaFormat = rendition.getMediaFormat(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(PROP_SRC, rendition.getUrl()); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }
[ "@", "SuppressWarnings", "(", "\"null\"", ")", "protected", "JSONObject", "toReponsiveImageSource", "(", "Media", "media", ",", "Rendition", "rendition", ")", "{", "try", "{", "JSONObject", "source", "=", "new", "JSONObject", "(", ")", ";", "MediaFormat", "media...
Build JSON metadata for one rendition as image source. @param media Media @param rendition Rendition @return JSON metadata
[ "Build", "JSON", "metadata", "for", "one", "rendition", "as", "image", "source", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java#L131-L143
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/PipelinePool.java
PipelinePool.createPipeline
Pipeline createPipeline(Language lang, Language motherTongue, TextChecker.QueryParams params, UserConfig userConfig) throws Exception { // package-private for mocking Pipeline lt = new Pipeline(lang, params.altLanguages, motherTongue, cache, userConfig); lt.setMaxErrorsPerWordRate(config.getMaxErrorsPerWordRate()); if (config.getLanguageModelDir() != null) { lt.activateLanguageModelRules(config.getLanguageModelDir()); } if (config.getWord2VecModelDir () != null) { lt.activateWord2VecModelRules(config.getWord2VecModelDir()); } if (config.getRulesConfigFile() != null) { configureFromRulesFile(lt, lang); } else { configureFromGUI(lt, lang); } if (params.useQuerySettings) { Tools.selectRules(lt, new HashSet<>(params.disabledCategories), new HashSet<>(params.enabledCategories), new HashSet<>(params.disabledRules), new HashSet<>(params.enabledRules), params.useEnabledOnly); } if (pool != null) { lt.setupFinished(); } return lt; }
java
Pipeline createPipeline(Language lang, Language motherTongue, TextChecker.QueryParams params, UserConfig userConfig) throws Exception { // package-private for mocking Pipeline lt = new Pipeline(lang, params.altLanguages, motherTongue, cache, userConfig); lt.setMaxErrorsPerWordRate(config.getMaxErrorsPerWordRate()); if (config.getLanguageModelDir() != null) { lt.activateLanguageModelRules(config.getLanguageModelDir()); } if (config.getWord2VecModelDir () != null) { lt.activateWord2VecModelRules(config.getWord2VecModelDir()); } if (config.getRulesConfigFile() != null) { configureFromRulesFile(lt, lang); } else { configureFromGUI(lt, lang); } if (params.useQuerySettings) { Tools.selectRules(lt, new HashSet<>(params.disabledCategories), new HashSet<>(params.enabledCategories), new HashSet<>(params.disabledRules), new HashSet<>(params.enabledRules), params.useEnabledOnly); } if (pool != null) { lt.setupFinished(); } return lt; }
[ "Pipeline", "createPipeline", "(", "Language", "lang", ",", "Language", "motherTongue", ",", "TextChecker", ".", "QueryParams", "params", ",", "UserConfig", "userConfig", ")", "throws", "Exception", "{", "// package-private for mocking", "Pipeline", "lt", "=", "new", ...
Create a JLanguageTool instance for a specific language, mother tongue, and rule configuration. Uses Pipeline wrapper to safely share objects @param lang the language to be used @param motherTongue the user's mother tongue or {@code null}
[ "Create", "a", "JLanguageTool", "instance", "for", "a", "specific", "language", "mother", "tongue", "and", "rule", "configuration", ".", "Uses", "Pipeline", "wrapper", "to", "safely", "share", "objects" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/PipelinePool.java#L185-L208
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleTouchRequest
private static BinaryMemcacheRequest handleTouchRequest(final ChannelHandlerContext ctx, final TouchRequest msg) { ByteBuf extras = ctx.alloc().buffer(); extras.writeInt(msg.expiry()); byte[] key = msg.keyBytes(); short keyLength = (short) key.length; byte extrasLength = (byte) extras.readableBytes(); BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key); request.setExtras(extras); request.setOpcode(OP_TOUCH); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + extrasLength); request.setExtrasLength(extrasLength); return request; }
java
private static BinaryMemcacheRequest handleTouchRequest(final ChannelHandlerContext ctx, final TouchRequest msg) { ByteBuf extras = ctx.alloc().buffer(); extras.writeInt(msg.expiry()); byte[] key = msg.keyBytes(); short keyLength = (short) key.length; byte extrasLength = (byte) extras.readableBytes(); BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key); request.setExtras(extras); request.setOpcode(OP_TOUCH); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + extrasLength); request.setExtrasLength(extrasLength); return request; }
[ "private", "static", "BinaryMemcacheRequest", "handleTouchRequest", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "TouchRequest", "msg", ")", "{", "ByteBuf", "extras", "=", "ctx", ".", "alloc", "(", ")", ".", "buffer", "(", ")", ";", "extras", "....
Encodes a {@link TouchRequest} into its lower level representation. @return a ready {@link BinaryMemcacheRequest}.
[ "Encodes", "a", "{", "@link", "TouchRequest", "}", "into", "its", "lower", "level", "representation", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L647-L661
powermock/powermock
powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java
PowerMockito.mockStatic
public static void mockStatic(Class<?> classToMock, MockSettings mockSettings) { DefaultMockCreator.mock(classToMock, true, false, null, mockSettings, (Method[]) null); }
java
public static void mockStatic(Class<?> classToMock, MockSettings mockSettings) { DefaultMockCreator.mock(classToMock, true, false, null, mockSettings, (Method[]) null); }
[ "public", "static", "void", "mockStatic", "(", "Class", "<", "?", ">", "classToMock", ",", "MockSettings", "mockSettings", ")", "{", "DefaultMockCreator", ".", "mock", "(", "classToMock", ",", "true", ",", "false", ",", "null", ",", "mockSettings", ",", "(",...
Creates a class mock with some non-standard settings. <p> The number of configuration points for a mock grows so we need a fluent way to introduce new configuration without adding more and more overloaded PowerMockito.mockStatic() methods. Hence {@link MockSettings}. <p> <pre> mockStatic(Listener.class, withSettings() .name(&quot;firstListner&quot;).defaultBehavior(RETURNS_SMART_NULLS)); ); </pre> <p> <b>Use it carefully and occasionally</b>. What might be reason your test needs non-standard mocks? Is the code under test so complicated that it requires non-standard mocks? Wouldn't you prefer to refactor the code under test so it is testable in a simple way? <p> See also {@link Mockito#withSettings()} @param classToMock class to mock @param mockSettings additional mock settings
[ "Creates", "a", "class", "mock", "with", "some", "non", "-", "standard", "settings", ".", "<p", ">", "The", "number", "of", "configuration", "points", "for", "a", "mock", "grows", "so", "we", "need", "a", "fluent", "way", "to", "introduce", "new", "confi...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L114-L116
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.jobHasScheduledStatus
private boolean jobHasScheduledStatus() { final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true); while (it.hasNext()) { final ExecutionState s = it.next().getExecutionState(); if (s != ExecutionState.CREATED && s != ExecutionState.SCHEDULED && s != ExecutionState.READY) { return false; } } return true; }
java
private boolean jobHasScheduledStatus() { final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true); while (it.hasNext()) { final ExecutionState s = it.next().getExecutionState(); if (s != ExecutionState.CREATED && s != ExecutionState.SCHEDULED && s != ExecutionState.READY) { return false; } } return true; }
[ "private", "boolean", "jobHasScheduledStatus", "(", ")", "{", "final", "Iterator", "<", "ExecutionVertex", ">", "it", "=", "new", "ExecutionGraphIterator", "(", "this", ",", "true", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "final",...
Checks whether the job represented by the execution graph has the status <code>SCHEDULED</code>. @return <code>true</code> if the job has the status <code>SCHEDULED</code>, <code>false</code> otherwise
[ "Checks", "whether", "the", "job", "represented", "by", "the", "execution", "graph", "has", "the", "status", "<code", ">", "SCHEDULED<", "/", "code", ">", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L1060-L1073
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/FieldsInner.java
FieldsInner.listByTypeAsync
public Observable<List<TypeFieldInner>> listByTypeAsync(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { return listByTypeWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, typeName).map(new Func1<ServiceResponse<List<TypeFieldInner>>, List<TypeFieldInner>>() { @Override public List<TypeFieldInner> call(ServiceResponse<List<TypeFieldInner>> response) { return response.body(); } }); }
java
public Observable<List<TypeFieldInner>> listByTypeAsync(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { return listByTypeWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, typeName).map(new Func1<ServiceResponse<List<TypeFieldInner>>, List<TypeFieldInner>>() { @Override public List<TypeFieldInner> call(ServiceResponse<List<TypeFieldInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "TypeFieldInner", ">", ">", "listByTypeAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "moduleName", ",", "String", "typeName", ")", "{", "return", "listByTypeWithServiceRespo...
Retrieve a list of fields of a given type identified by module name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param moduleName The name of module. @param typeName The name of type. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;TypeFieldInner&gt; object
[ "Retrieve", "a", "list", "of", "fields", "of", "a", "given", "type", "identified", "by", "module", "name", "." ]
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/FieldsInner.java#L102-L109
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatter.java
DateTimeFormatter.parseMillis
public long parseMillis(String text) { InternalParser parser = requireParser(); Chronology chrono = selectChronology(iChrono); DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear); return bucket.doParseMillis(parser, text); }
java
public long parseMillis(String text) { InternalParser parser = requireParser(); Chronology chrono = selectChronology(iChrono); DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear); return bucket.doParseMillis(parser, text); }
[ "public", "long", "parseMillis", "(", "String", "text", ")", "{", "InternalParser", "parser", "=", "requireParser", "(", ")", ";", "Chronology", "chrono", "=", "selectChronology", "(", "iChrono", ")", ";", "DateTimeParserBucket", "bucket", "=", "new", "DateTimeP...
Parses a datetime from the given text, returning the number of milliseconds since the epoch, 1970-01-01T00:00:00Z. <p> The parse will use the ISO chronology, and the default time zone. If the text contains a time zone string then that will be taken into account. @param text the text to parse, not null @return parsed value expressed in milliseconds since the epoch @throws UnsupportedOperationException if parsing is not supported @throws IllegalArgumentException if the text to parse is invalid
[ "Parses", "a", "datetime", "from", "the", "given", "text", "returning", "the", "number", "of", "milliseconds", "since", "the", "epoch", "1970", "-", "01", "-", "01T00", ":", "00", ":", "00Z", ".", "<p", ">", "The", "parse", "will", "use", "the", "ISO",...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L822-L827
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/net/Pipe.java
Pipe.designPipe
public void designPipe( double[][] diameters, double tau, double g, double maxd, double c, StringBuilder strWarnings ) { switch( this.pipeSectionType ) { case 1: designCircularPipe(diameters, tau, g, maxd, strWarnings); break; case 2: designRectangularPipe(tau, g, maxd, c, strWarnings); break; case 3: designTrapeziumPipe(tau, g, maxd, c, strWarnings); break; default: designCircularPipe(diameters, tau, g, maxd, strWarnings); break; } }
java
public void designPipe( double[][] diameters, double tau, double g, double maxd, double c, StringBuilder strWarnings ) { switch( this.pipeSectionType ) { case 1: designCircularPipe(diameters, tau, g, maxd, strWarnings); break; case 2: designRectangularPipe(tau, g, maxd, c, strWarnings); break; case 3: designTrapeziumPipe(tau, g, maxd, c, strWarnings); break; default: designCircularPipe(diameters, tau, g, maxd, strWarnings); break; } }
[ "public", "void", "designPipe", "(", "double", "[", "]", "[", "]", "diameters", ",", "double", "tau", ",", "double", "g", ",", "double", "maxd", ",", "double", "c", ",", "StringBuilder", "strWarnings", ")", "{", "switch", "(", "this", ".", "pipeSectionTy...
Calculate the dimension of the pipes. <p> It switch between several section geometry. </p> @param diameters matrix with the commercial diameters. @param tau tangential stress at the bottom of the pipe.. @param g fill degree. @param maxd maximum diameter. @param c is a geometric expression b/h where h is the height and b base (only for rectangular or trapezium shape).
[ "Calculate", "the", "dimension", "of", "the", "pipes", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/net/Pipe.java#L608-L624
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/liquibase/changes/FixInvitations.java
FixInvitations.isPanelUser
private boolean isPanelUser(JdbcConnection connection, Long panelId, String email) throws CustomChangeException { try (PreparedStatement statement = connection.prepareStatement("SELECT id FROM PANELUSER WHERE panel_id = ? AND user_id = (SELECT id FROM USEREMAIL WHERE address = ?)")) { statement.setLong(1, panelId); statement.setString(2, email); try (ResultSet resultSet = statement.executeQuery()) { return resultSet.next(); } } catch (Exception e) { throw new CustomChangeException(e); } }
java
private boolean isPanelUser(JdbcConnection connection, Long panelId, String email) throws CustomChangeException { try (PreparedStatement statement = connection.prepareStatement("SELECT id FROM PANELUSER WHERE panel_id = ? AND user_id = (SELECT id FROM USEREMAIL WHERE address = ?)")) { statement.setLong(1, panelId); statement.setString(2, email); try (ResultSet resultSet = statement.executeQuery()) { return resultSet.next(); } } catch (Exception e) { throw new CustomChangeException(e); } }
[ "private", "boolean", "isPanelUser", "(", "JdbcConnection", "connection", ",", "Long", "panelId", ",", "String", "email", ")", "throws", "CustomChangeException", "{", "try", "(", "PreparedStatement", "statement", "=", "connection", ".", "prepareStatement", "(", "\"S...
Returns whether user by email is a PanelUser or not @param connection connection @param panelId panel id @param email email @return whether user by email is a PanelUser or not @throws CustomChangeException on error
[ "Returns", "whether", "user", "by", "email", "is", "a", "PanelUser", "or", "not" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/liquibase/changes/FixInvitations.java#L48-L59
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/index/SecondaryIndex.java
SecondaryIndex.getIndexComparator
public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cdef) { switch (cdef.getIndexType()) { case KEYS: return new SimpleDenseCellNameType(keyComparator); case COMPOSITES: return CompositesIndex.getIndexComparator(baseMetadata, cdef); case CUSTOM: return null; } throw new AssertionError(); }
java
public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cdef) { switch (cdef.getIndexType()) { case KEYS: return new SimpleDenseCellNameType(keyComparator); case COMPOSITES: return CompositesIndex.getIndexComparator(baseMetadata, cdef); case CUSTOM: return null; } throw new AssertionError(); }
[ "public", "static", "CellNameType", "getIndexComparator", "(", "CFMetaData", "baseMetadata", ",", "ColumnDefinition", "cdef", ")", "{", "switch", "(", "cdef", ".", "getIndexType", "(", ")", ")", "{", "case", "KEYS", ":", "return", "new", "SimpleDenseCellNameType",...
Returns the index comparator for index backed by CFS, or null. Note: it would be cleaner to have this be a member method. However we need this when opening indexes sstables, but by then the CFS won't be fully initiated, so the SecondaryIndex object won't be accessible.
[ "Returns", "the", "index", "comparator", "for", "index", "backed", "by", "CFS", "or", "null", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/index/SecondaryIndex.java#L368-L380
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java
Validator.errorReport
public static Report errorReport(String key, String message) { return buildReport().error(key, message).build(); }
java
public static Report errorReport(String key, String message) { return buildReport().error(key, message).build(); }
[ "public", "static", "Report", "errorReport", "(", "String", "key", ",", "String", "message", ")", "{", "return", "buildReport", "(", ")", ".", "error", "(", "key", ",", "message", ")", ".", "build", "(", ")", ";", "}" ]
Return a report for a single error item @param key key @param message message @return report
[ "Return", "a", "report", "for", "a", "single", "error", "item" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java#L41-L43
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodedGradientsAccumulator.java
EncodedGradientsAccumulator.touch
@Override public void touch() { if (index.get() == null) { // set index int numDevces = Nd4j.getAffinityManager().getNumberOfDevices(); /* if we have > 1 computational device, we assign workers to workspaces "as is", as provided via AffinityManager */ if (numDevces > 1 && parties > 1) { int localIndex = Nd4j.getAffinityManager().getDeviceForCurrentThread(); index.set(localIndex); } else { // if we have only 1 device (like cpu system, or single gpu), just attach consumer via flat index index.set(workersCounter.getAndIncrement()); } } }
java
@Override public void touch() { if (index.get() == null) { // set index int numDevces = Nd4j.getAffinityManager().getNumberOfDevices(); /* if we have > 1 computational device, we assign workers to workspaces "as is", as provided via AffinityManager */ if (numDevces > 1 && parties > 1) { int localIndex = Nd4j.getAffinityManager().getDeviceForCurrentThread(); index.set(localIndex); } else { // if we have only 1 device (like cpu system, or single gpu), just attach consumer via flat index index.set(workersCounter.getAndIncrement()); } } }
[ "@", "Override", "public", "void", "touch", "(", ")", "{", "if", "(", "index", ".", "get", "(", ")", "==", "null", ")", "{", "// set index", "int", "numDevces", "=", "Nd4j", ".", "getAffinityManager", "(", ")", ".", "getNumberOfDevices", "(", ")", ";",...
This method does initialization of given worker wrt Thread-Device Affinity
[ "This", "method", "does", "initialization", "of", "given", "worker", "wrt", "Thread", "-", "Device", "Affinity" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodedGradientsAccumulator.java#L415-L433
structr/structr
structr-ui/src/main/java/org/structr/web/common/FileHelper.java
FileHelper.transformFile
public static <T extends File> T transformFile(final SecurityContext securityContext, final String uuid, final Class<T> fileType) throws FrameworkException, IOException { AbstractFile existingFile = getFileByUuid(securityContext, uuid); if (existingFile != null) { existingFile.unlockSystemPropertiesOnce(); existingFile.setProperties(securityContext, new PropertyMap(AbstractNode.type, fileType == null ? File.class.getSimpleName() : fileType.getSimpleName())); existingFile = getFileByUuid(securityContext, uuid); return (T)(fileType != null ? fileType.cast(existingFile) : (File) existingFile); } return null; }
java
public static <T extends File> T transformFile(final SecurityContext securityContext, final String uuid, final Class<T> fileType) throws FrameworkException, IOException { AbstractFile existingFile = getFileByUuid(securityContext, uuid); if (existingFile != null) { existingFile.unlockSystemPropertiesOnce(); existingFile.setProperties(securityContext, new PropertyMap(AbstractNode.type, fileType == null ? File.class.getSimpleName() : fileType.getSimpleName())); existingFile = getFileByUuid(securityContext, uuid); return (T)(fileType != null ? fileType.cast(existingFile) : (File) existingFile); } return null; }
[ "public", "static", "<", "T", "extends", "File", ">", "T", "transformFile", "(", "final", "SecurityContext", "securityContext", ",", "final", "String", "uuid", ",", "final", "Class", "<", "T", ">", "fileType", ")", "throws", "FrameworkException", ",", "IOExcep...
Transform an existing file into the target class. @param <T> @param securityContext @param uuid @param fileType @return transformed file @throws FrameworkException @throws IOException
[ "Transform", "an", "existing", "file", "into", "the", "target", "class", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L79-L94
openskynetwork/java-adsb
src/main/java/org/opensky/libadsb/PositionDecoder.java
PositionDecoder.decodePosition
public Position decodePosition(double time, Position receiver, SurfacePositionV0Msg msg, Position reference) { Position ret = decodePosition(time, msg, reference); if (ret != null && receiver != null && !withinReasonableRange(receiver, ret)) { ret.setReasonable(false); num_reasonable = 0; } return ret; }
java
public Position decodePosition(double time, Position receiver, SurfacePositionV0Msg msg, Position reference) { Position ret = decodePosition(time, msg, reference); if (ret != null && receiver != null && !withinReasonableRange(receiver, ret)) { ret.setReasonable(false); num_reasonable = 0; } return ret; }
[ "public", "Position", "decodePosition", "(", "double", "time", ",", "Position", "receiver", ",", "SurfacePositionV0Msg", "msg", ",", "Position", "reference", ")", "{", "Position", "ret", "=", "decodePosition", "(", "time", ",", "msg", ",", "reference", ")", ";...
Performs all reasonableness tests. @param time time of applicability/reception of position report (seconds) @param reference position used to decide which position of the four results of the CPR algorithm is the right one @param receiver position to check if received position was more than 700km away and @param msg surface position message @return WGS84 coordinates with latitude and longitude in dec degrees, and altitude in meters. altitude might be null if unavailable On error, the returned position is null. Check the .isReasonable() flag before using the position.
[ "Performs", "all", "reasonableness", "tests", "." ]
train
https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/PositionDecoder.java#L474-L481
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
NodeImpl.isPrefixMappedToUri
boolean isPrefixMappedToUri(String prefix, String uri) { if (prefix == null) { return false; } String actual = lookupNamespaceURI(prefix); return uri.equals(actual); }
java
boolean isPrefixMappedToUri(String prefix, String uri) { if (prefix == null) { return false; } String actual = lookupNamespaceURI(prefix); return uri.equals(actual); }
[ "boolean", "isPrefixMappedToUri", "(", "String", "prefix", ",", "String", "uri", ")", "{", "if", "(", "prefix", "==", "null", ")", "{", "return", "false", ";", "}", "String", "actual", "=", "lookupNamespaceURI", "(", "prefix", ")", ";", "return", "uri", ...
Returns true if the given prefix is mapped to the given URI on this element. Since child elements can redefine prefixes, this check is necessary: {@code <foo xmlns:a="http://good"> <bar xmlns:a="http://evil"> <a:baz /> </bar> </foo>} @param prefix the prefix to find. Nullable. @param uri the URI to match. Non-null.
[ "Returns", "true", "if", "the", "given", "prefix", "is", "mapped", "to", "the", "given", "URI", "on", "this", "element", ".", "Since", "child", "elements", "can", "redefine", "prefixes", "this", "check", "is", "necessary", ":", "{", "@code", "<foo", "xmlns...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java#L543-L550
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_lines_number_dslamPort_logs_GET
public ArrayList<OvhDslamPortLog> serviceName_lines_number_dslamPort_logs_GET(String serviceName, String number, Long limit) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort/logs"; StringBuilder sb = path(qPath, serviceName, number); query(sb, "limit", limit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t13); }
java
public ArrayList<OvhDslamPortLog> serviceName_lines_number_dslamPort_logs_GET(String serviceName, String number, Long limit) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort/logs"; StringBuilder sb = path(qPath, serviceName, number); query(sb, "limit", limit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t13); }
[ "public", "ArrayList", "<", "OvhDslamPortLog", ">", "serviceName_lines_number_dslamPort_logs_GET", "(", "String", "serviceName", ",", "String", "number", ",", "Long", "limit", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/lines/{number}...
Get the logs emitted by the DSLAM for this port REST: GET /xdsl/{serviceName}/lines/{number}/dslamPort/logs @param limit [required] [default=50] @param serviceName [required] The internal name of your XDSL offer @param number [required] The number of the line
[ "Get", "the", "logs", "emitted", "by", "the", "DSLAM", "for", "this", "port" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L522-L528
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/decompose/UtilDecompositons_ZDRM.java
UtilDecompositons_ZDRM.checkZerosLT
public static ZMatrixRMaj checkZerosLT(ZMatrixRMaj A , int numRows , int numCols) { if( A == null ) { return new ZMatrixRMaj(numRows,numCols); } else if( numRows != A.numRows || numCols != A.numCols ) throw new IllegalArgumentException("Input is not "+numRows+" x "+numCols+" matrix"); else { for( int i = 0; i < A.numRows; i++ ) { int index = i*A.numCols*2; int end = index + Math.min(i,A.numCols)*2;; while( index < end ) { A.data[index++] = 0; } } } return A; }
java
public static ZMatrixRMaj checkZerosLT(ZMatrixRMaj A , int numRows , int numCols) { if( A == null ) { return new ZMatrixRMaj(numRows,numCols); } else if( numRows != A.numRows || numCols != A.numCols ) throw new IllegalArgumentException("Input is not "+numRows+" x "+numCols+" matrix"); else { for( int i = 0; i < A.numRows; i++ ) { int index = i*A.numCols*2; int end = index + Math.min(i,A.numCols)*2;; while( index < end ) { A.data[index++] = 0; } } } return A; }
[ "public", "static", "ZMatrixRMaj", "checkZerosLT", "(", "ZMatrixRMaj", "A", ",", "int", "numRows", ",", "int", "numCols", ")", "{", "if", "(", "A", "==", "null", ")", "{", "return", "new", "ZMatrixRMaj", "(", "numRows", ",", "numCols", ")", ";", "}", "...
Creates a zeros matrix only if A does not already exist. If it does exist it will fill the lower triangular portion with zeros.
[ "Creates", "a", "zeros", "matrix", "only", "if", "A", "does", "not", "already", "exist", ".", "If", "it", "does", "exist", "it", "will", "fill", "the", "lower", "triangular", "portion", "with", "zeros", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/UtilDecompositons_ZDRM.java#L55-L70
qos-ch/slf4j
jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java
SLF4JLog.error
public void error(Object message, Throwable t) { logger.error(String.valueOf(message), t); }
java
public void error(Object message, Throwable t) { logger.error(String.valueOf(message), t); }
[ "public", "void", "error", "(", "Object", "message", ",", "Throwable", "t", ")", "{", "logger", ".", "error", "(", "String", ".", "valueOf", "(", "message", ")", ",", "t", ")", ";", "}" ]
Converts the first input parameter to String and then delegates to the wrapped <code>org.slf4j.Logger</code> instance. @param message the message to log. Converted to {@link String} @param t the exception to log
[ "Converts", "the", "first", "input", "parameter", "to", "String", "and", "then", "delegates", "to", "the", "wrapped", "<code", ">", "org", ".", "slf4j", ".", "Logger<", "/", "code", ">", "instance", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java#L212-L214
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java
JavacParser.createEnvironment
private JavacEnvironment createEnvironment(List<File> files, List<JavaFileObject> fileObjects, boolean processAnnotations) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); StandardJavaFileManager fileManager = getFileManager(compiler, diagnostics); List<String> javacOptions = getJavacOptions(processAnnotations); if (fileObjects == null) { fileObjects = new ArrayList<>(); } for (JavaFileObject jfo : fileManager.getJavaFileObjectsFromFiles(files)) { fileObjects.add(filterJavaFileObject(jfo)); } JavacTask task = (JavacTask) compiler.getTask(null, fileManager, diagnostics, javacOptions, null, fileObjects); return new JavacEnvironment(task, fileManager, diagnostics); }
java
private JavacEnvironment createEnvironment(List<File> files, List<JavaFileObject> fileObjects, boolean processAnnotations) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); StandardJavaFileManager fileManager = getFileManager(compiler, diagnostics); List<String> javacOptions = getJavacOptions(processAnnotations); if (fileObjects == null) { fileObjects = new ArrayList<>(); } for (JavaFileObject jfo : fileManager.getJavaFileObjectsFromFiles(files)) { fileObjects.add(filterJavaFileObject(jfo)); } JavacTask task = (JavacTask) compiler.getTask(null, fileManager, diagnostics, javacOptions, null, fileObjects); return new JavacEnvironment(task, fileManager, diagnostics); }
[ "private", "JavacEnvironment", "createEnvironment", "(", "List", "<", "File", ">", "files", ",", "List", "<", "JavaFileObject", ">", "fileObjects", ",", "boolean", "processAnnotations", ")", "throws", "IOException", "{", "JavaCompiler", "compiler", "=", "ToolProvide...
Creates a javac environment from a collection of files and/or file objects.
[ "Creates", "a", "javac", "environment", "from", "a", "collection", "of", "files", "and", "/", "or", "file", "objects", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L252-L267
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/AttributeService.java
AttributeService.readAttributes
@SuppressWarnings("unchecked") public <A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) { AttributeProvider provider = providersByAttributesType.get(type); if (provider != null) { return (A) provider.readAttributes(file); } throw new UnsupportedOperationException("unsupported attributes type: " + type); }
java
@SuppressWarnings("unchecked") public <A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) { AttributeProvider provider = providersByAttributesType.get(type); if (provider != null) { return (A) provider.readAttributes(file); } throw new UnsupportedOperationException("unsupported attributes type: " + type); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "A", "extends", "BasicFileAttributes", ">", "A", "readAttributes", "(", "File", "file", ",", "Class", "<", "A", ">", "type", ")", "{", "AttributeProvider", "provider", "=", "providersByAttributes...
Returns attributes of the given file as an object of the given type. @throws UnsupportedOperationException if the given attributes type is not supported
[ "Returns", "attributes", "of", "the", "given", "file", "as", "an", "object", "of", "the", "given", "type", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java#L356-L364
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/constraintvalidators/hv/ModCheckBase.java
ModCheckBase.isValid
public boolean isValid(final CharSequence value, final ConstraintValidatorContext context) { if (value == null) { return true; } final String valueAsString = value.toString(); String digitsAsString; char checkDigit; try { digitsAsString = this.extractVerificationString(valueAsString); checkDigit = this.extractCheckDigit(valueAsString); } catch (final IndexOutOfBoundsException e) { return false; } digitsAsString = this.stripNonDigitsIfRequired(digitsAsString); List<Integer> digits; try { digits = this.extractDigits(digitsAsString); } catch (final NumberFormatException e) { return false; } return this.isCheckDigitValid(digits, checkDigit); }
java
public boolean isValid(final CharSequence value, final ConstraintValidatorContext context) { if (value == null) { return true; } final String valueAsString = value.toString(); String digitsAsString; char checkDigit; try { digitsAsString = this.extractVerificationString(valueAsString); checkDigit = this.extractCheckDigit(valueAsString); } catch (final IndexOutOfBoundsException e) { return false; } digitsAsString = this.stripNonDigitsIfRequired(digitsAsString); List<Integer> digits; try { digits = this.extractDigits(digitsAsString); } catch (final NumberFormatException e) { return false; } return this.isCheckDigitValid(digits, checkDigit); }
[ "public", "boolean", "isValid", "(", "final", "CharSequence", "value", ",", "final", "ConstraintValidatorContext", "context", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "true", ";", "}", "final", "String", "valueAsString", "=", "value", ...
valid check. @param value value to check. @param context constraint validator context @return true if valid
[ "valid", "check", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/constraintvalidators/hv/ModCheckBase.java#L63-L87
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getTPDeliveryInfo
public void getTPDeliveryInfo(String API, Callback<Delivery> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getTPDeliveryInfo(API).enqueue(callback); }
java
public void getTPDeliveryInfo(String API, Callback<Delivery> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getTPDeliveryInfo(API).enqueue(callback); }
[ "public", "void", "getTPDeliveryInfo", "(", "String", "API", ",", "Callback", "<", "Delivery", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "API", ",", ...
For more info on delivery API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/delivery">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param API API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see Delivery devlivery info
[ "For", "more", "info", "on", "delivery", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "commerce", "/", "delivery", ">", "here<", "/", "a", ">", "<br", "/", ">",...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L906-L909
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/ScopeSupport.java
ScopeSupport.fillDecoded
protected void fillDecoded(URLItem[] raw, String encoding, boolean scriptProteced, boolean sameAsArray) throws UnsupportedEncodingException { clear(); String name, value; // Object curr; for (int i = 0; i < raw.length; i++) { name = raw[i].getName(); value = raw[i].getValue(); if (raw[i].isUrlEncoded()) { name = URLDecoder.decode(name, encoding, true); value = URLDecoder.decode(value, encoding, true); } // MUST valueStruct if (name.indexOf('.') != -1) { StringList list = ListUtil.listToStringListRemoveEmpty(name, '.'); if (list.size() > 0) { Struct parent = this; while (list.hasNextNext()) { parent = _fill(parent, list.next(), new CastableStruct(Struct.TYPE_LINKED), false, scriptProteced, sameAsArray); } _fill(parent, list.next(), value, true, scriptProteced, sameAsArray); } } // else _fill(this, name, value, true, scriptProteced, sameAsArray); } }
java
protected void fillDecoded(URLItem[] raw, String encoding, boolean scriptProteced, boolean sameAsArray) throws UnsupportedEncodingException { clear(); String name, value; // Object curr; for (int i = 0; i < raw.length; i++) { name = raw[i].getName(); value = raw[i].getValue(); if (raw[i].isUrlEncoded()) { name = URLDecoder.decode(name, encoding, true); value = URLDecoder.decode(value, encoding, true); } // MUST valueStruct if (name.indexOf('.') != -1) { StringList list = ListUtil.listToStringListRemoveEmpty(name, '.'); if (list.size() > 0) { Struct parent = this; while (list.hasNextNext()) { parent = _fill(parent, list.next(), new CastableStruct(Struct.TYPE_LINKED), false, scriptProteced, sameAsArray); } _fill(parent, list.next(), value, true, scriptProteced, sameAsArray); } } // else _fill(this, name, value, true, scriptProteced, sameAsArray); } }
[ "protected", "void", "fillDecoded", "(", "URLItem", "[", "]", "raw", ",", "String", "encoding", ",", "boolean", "scriptProteced", ",", "boolean", "sameAsArray", ")", "throws", "UnsupportedEncodingException", "{", "clear", "(", ")", ";", "String", "name", ",", ...
fill th data from given strut and decode it @param raw @param encoding @throws UnsupportedEncodingException
[ "fill", "th", "data", "from", "given", "strut", "and", "decode", "it" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ScopeSupport.java#L172-L198
apache/reef
lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/ScatterEncoder.java
ScatterEncoder.encodeScatterMsgForNode
private byte[] encodeScatterMsgForNode(final TopologySimpleNode node, final Map<String, byte[]> taskIdToBytes) { try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream(); final DataOutputStream dstream = new DataOutputStream(bstream)) { // first write the node's encoded data final String taskId = node.getTaskId(); if (taskIdToBytes.containsKey(taskId)) { dstream.write(taskIdToBytes.get(node.getTaskId())); } else { // in case mapOfTaskToBytes does not contain this node's id, write an empty // message (zero elements) dstream.writeInt(0); } // and then write its children's identifiers and their encoded data for (final TopologySimpleNode child : node.getChildren()) { dstream.writeUTF(child.getTaskId()); final byte[] childData = encodeScatterMsgForNode(child, taskIdToBytes); dstream.writeInt(childData.length); dstream.write(childData); } return bstream.toByteArray(); } catch (final IOException e) { throw new RuntimeException("IOException", e); } }
java
private byte[] encodeScatterMsgForNode(final TopologySimpleNode node, final Map<String, byte[]> taskIdToBytes) { try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream(); final DataOutputStream dstream = new DataOutputStream(bstream)) { // first write the node's encoded data final String taskId = node.getTaskId(); if (taskIdToBytes.containsKey(taskId)) { dstream.write(taskIdToBytes.get(node.getTaskId())); } else { // in case mapOfTaskToBytes does not contain this node's id, write an empty // message (zero elements) dstream.writeInt(0); } // and then write its children's identifiers and their encoded data for (final TopologySimpleNode child : node.getChildren()) { dstream.writeUTF(child.getTaskId()); final byte[] childData = encodeScatterMsgForNode(child, taskIdToBytes); dstream.writeInt(childData.length); dstream.write(childData); } return bstream.toByteArray(); } catch (final IOException e) { throw new RuntimeException("IOException", e); } }
[ "private", "byte", "[", "]", "encodeScatterMsgForNode", "(", "final", "TopologySimpleNode", "node", ",", "final", "Map", "<", "String", ",", "byte", "[", "]", ">", "taskIdToBytes", ")", "{", "try", "(", "final", "ByteArrayOutputStream", "bstream", "=", "new", ...
Compute a single byte array message for a node and its children. Using {@code taskIdToBytes}, we pack all messages for a {@code TopologySimpleNode} and its children into a single byte array. @param node the target TopologySimpleNode to generate a message for @param taskIdToBytes map containing byte array of encoded data for individual Tasks @return single byte array message
[ "Compute", "a", "single", "byte", "array", "message", "for", "a", "node", "and", "its", "children", ".", "Using", "{", "@code", "taskIdToBytes", "}", "we", "pack", "all", "messages", "for", "a", "{", "@code", "TopologySimpleNode", "}", "and", "its", "child...
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/ScatterEncoder.java#L71-L101
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setupTablePopup
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, DBConstants.MAIN_KEY_AREA, iDisplayFieldSeq, bIncludeBlankOption, false); }
java
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, DBConstants.MAIN_KEY_AREA, iDisplayFieldSeq, bIncludeBlankOption, false); }
[ "public", "ScreenComponent", "setupTablePopup", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "int", "iDisplayFieldDesc", ",", "Rec", "record", ",", "int", "iDisplayFieldSeq", ",", "boolean", "bIncludeBlankOption", ")", "{", "return", "...
Add a popup for the table tied to this field. @return Return the component or ScreenField that is created for this field.
[ "Add", "a", "popup", "for", "the", "table", "tied", "to", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1193-L1196