repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
voldemort/voldemort
src/java/voldemort/store/stats/ClientSocketStats.java
ClientSocketStats.recordCheckoutTimeUs
public void recordCheckoutTimeUs(SocketDestination dest, long checkoutTimeUs) { if(dest != null) { getOrCreateNodeStats(dest).recordCheckoutTimeUs(null, checkoutTimeUs); recordCheckoutTimeUs(null, checkoutTimeUs); } else { this.checkoutTimeRequestCounter.addRequest(checkoutTimeUs * Time.NS_PER_US); } }
java
public void recordCheckoutTimeUs(SocketDestination dest, long checkoutTimeUs) { if(dest != null) { getOrCreateNodeStats(dest).recordCheckoutTimeUs(null, checkoutTimeUs); recordCheckoutTimeUs(null, checkoutTimeUs); } else { this.checkoutTimeRequestCounter.addRequest(checkoutTimeUs * Time.NS_PER_US); } }
[ "public", "void", "recordCheckoutTimeUs", "(", "SocketDestination", "dest", ",", "long", "checkoutTimeUs", ")", "{", "if", "(", "dest", "!=", "null", ")", "{", "getOrCreateNodeStats", "(", "dest", ")", ".", "recordCheckoutTimeUs", "(", "null", ",", "checkoutTime...
Record the checkout wait time in us @param dest Destination of the socket to checkout. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param checkoutTimeUs The number of us to wait before getting a socket
[ "Record", "the", "checkout", "wait", "time", "in", "us" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/ClientSocketStats.java#L265-L272
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.rotateAround
public Matrix4x3f rotateAround(Quaternionfc quat, float ox, float oy, float oz, Matrix4x3f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return rotationAround(quat, ox, oy, oz); return rotateAroundAffine(quat, ox, oy, oz, dest); }
java
public Matrix4x3f rotateAround(Quaternionfc quat, float ox, float oy, float oz, Matrix4x3f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return rotationAround(quat, ox, oy, oz); return rotateAroundAffine(quat, ox, oy, oz, dest); }
[ "public", "Matrix4x3f", "rotateAround", "(", "Quaternionfc", "quat", ",", "float", "ox", ",", "float", "oy", ",", "float", "oz", ",", "Matrix4x3f", "dest", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "!=", "0", ")", "return", "...
/* (non-Javadoc) @see org.joml.Matrix4x3fc#rotateAround(org.joml.Quaternionfc, float, float, float, org.joml.Matrix4x3f)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4055-L4059
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatioTemporal/paths/PoseSteering.java
PoseSteering.interpolate
public PoseSteering interpolate(PoseSteering p2, double ratio) { Pose interp = this.getPose().interpolate(p2.getPose(), ratio); return new PoseSteering(interp, Pose.lerpDegrees(getSteering(),p2.getSteering(),ratio)); }
java
public PoseSteering interpolate(PoseSteering p2, double ratio) { Pose interp = this.getPose().interpolate(p2.getPose(), ratio); return new PoseSteering(interp, Pose.lerpDegrees(getSteering(),p2.getSteering(),ratio)); }
[ "public", "PoseSteering", "interpolate", "(", "PoseSteering", "p2", ",", "double", "ratio", ")", "{", "Pose", "interp", "=", "this", ".", "getPose", "(", ")", ".", "interpolate", "(", "p2", ".", "getPose", "(", ")", ",", "ratio", ")", ";", "return", "n...
Computes the {@link PoseSteering} between this {@link PoseSteering} and a given {@link PoseSteering} via bilinear interpolation. @param p2 The second {@link PoseSteering} used for interpolation. @param ratio Parameter in [0,1] used for bilinear interpolation. @return The {@link PoseSteering} between this {@link PoseSteering} and a given {@link PoseSteering} via bilinear interpolation.
[ "Computes", "the", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/PoseSteering.java#L135-L138
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.findByUserId
@Override public List<CommerceOrder> findByUserId(long userId) { return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceOrder> findByUserId(long userId) { return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrder", ">", "findByUserId", "(", "long", "userId", ")", "{", "return", "findByUserId", "(", "userId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce orders where userId = &#63;. @param userId the user ID @return the matching commerce orders
[ "Returns", "all", "the", "commerce", "orders", "where", "userId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L2015-L2018
petergeneric/stdlib
guice/common/src/main/java/com/peterphi/std/guice/common/ClassScanner.java
ClassScanner.getClasses
public List<Class<?>> getClasses(final String pkg, boolean recursive) { return getClasses(pkg, recursive, null); }
java
public List<Class<?>> getClasses(final String pkg, boolean recursive) { return getClasses(pkg, recursive, null); }
[ "public", "List", "<", "Class", "<", "?", ">", ">", "getClasses", "(", "final", "String", "pkg", ",", "boolean", "recursive", ")", "{", "return", "getClasses", "(", "pkg", ",", "recursive", ",", "null", ")", ";", "}" ]
Find all the classes in a package @param pkg @param recursive @return
[ "Find", "all", "the", "classes", "in", "a", "package" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/common/ClassScanner.java#L95-L98
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/ChangeEvents.java
ChangeEvents.changeEventForLocalReplace
static ChangeEvent<BsonDocument> changeEventForLocalReplace( final MongoNamespace namespace, final BsonValue documentId, final BsonDocument document, final boolean writePending ) { return new ChangeEvent<>( new BsonDocument(), OperationType.REPLACE, document, namespace, new BsonDocument("_id", documentId), null, writePending); }
java
static ChangeEvent<BsonDocument> changeEventForLocalReplace( final MongoNamespace namespace, final BsonValue documentId, final BsonDocument document, final boolean writePending ) { return new ChangeEvent<>( new BsonDocument(), OperationType.REPLACE, document, namespace, new BsonDocument("_id", documentId), null, writePending); }
[ "static", "ChangeEvent", "<", "BsonDocument", ">", "changeEventForLocalReplace", "(", "final", "MongoNamespace", "namespace", ",", "final", "BsonValue", "documentId", ",", "final", "BsonDocument", "document", ",", "final", "boolean", "writePending", ")", "{", "return"...
Generates a change event for a local replacement of a document in the given namespace referring to the given document _id. @param namespace the namespace where the document was inserted. @param documentId the _id of the document that was updated. @param document the replacement document. @return a change event for a local replacement of a document in the given namespace referring to the given document _id.
[ "Generates", "a", "change", "event", "for", "a", "local", "replacement", "of", "a", "document", "in", "the", "given", "namespace", "referring", "to", "the", "given", "document", "_id", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/ChangeEvents.java#L93-L107
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java
PathHelper.getOutputStream
@Nullable public static OutputStream getOutputStream (@Nonnull final Path aFile) { return getOutputStream (aFile, EAppend.DEFAULT); }
java
@Nullable public static OutputStream getOutputStream (@Nonnull final Path aFile) { return getOutputStream (aFile, EAppend.DEFAULT); }
[ "@", "Nullable", "public", "static", "OutputStream", "getOutputStream", "(", "@", "Nonnull", "final", "Path", "aFile", ")", "{", "return", "getOutputStream", "(", "aFile", ",", "EAppend", ".", "DEFAULT", ")", ";", "}" ]
Get an output stream for writing to a file. @param aFile The file to write to. May not be <code>null</code>. @return <code>null</code> if the file could not be opened
[ "Get", "an", "output", "stream", "for", "writing", "to", "a", "file", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java#L330-L334
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/BeanUtil.java
BeanUtil.getGetterMethod
public static Method getGetterMethod(Class<?> beanClass, String property, Class propertyType){ try{ try{ if(propertyType==boolean.class) return beanClass.getMethod(IS+getMethodSuffix(property)); }catch(NoSuchMethodException ignore){ // ignore } return beanClass.getMethod(GET+getMethodSuffix(property)); }catch(NoSuchMethodException ex){ return null; } }
java
public static Method getGetterMethod(Class<?> beanClass, String property, Class propertyType){ try{ try{ if(propertyType==boolean.class) return beanClass.getMethod(IS+getMethodSuffix(property)); }catch(NoSuchMethodException ignore){ // ignore } return beanClass.getMethod(GET+getMethodSuffix(property)); }catch(NoSuchMethodException ex){ return null; } }
[ "public", "static", "Method", "getGetterMethod", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "property", ",", "Class", "propertyType", ")", "{", "try", "{", "try", "{", "if", "(", "propertyType", "==", "boolean", ".", "class", ")", "return", ...
Returns getter method for <code>property</code> in specified <code>beanClass</code> @param beanClass bean class @param property name of the property @param propertyType type of the property. This is used to compute getter method name. @return getter method. null if <code>property</code> is not found @see #getGetterMethod(Class, String)
[ "Returns", "getter", "method", "for", "<code", ">", "property<", "/", "code", ">", "in", "specified", "<code", ">", "beanClass<", "/", "code", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/BeanUtil.java#L120-L132
apache/flink
flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java
Utils.deleteApplicationFiles
public static void deleteApplicationFiles(final Map<String, String> env) { final String applicationFilesDir = env.get(YarnConfigKeys.FLINK_YARN_FILES); if (!StringUtils.isNullOrWhitespaceOnly(applicationFilesDir)) { final org.apache.flink.core.fs.Path path = new org.apache.flink.core.fs.Path(applicationFilesDir); try { final org.apache.flink.core.fs.FileSystem fileSystem = path.getFileSystem(); if (!fileSystem.delete(path, true)) { LOG.error("Deleting yarn application files under {} was unsuccessful.", applicationFilesDir); } } catch (final IOException e) { LOG.error("Could not properly delete yarn application files directory {}.", applicationFilesDir, e); } } else { LOG.debug("No yarn application files directory set. Therefore, cannot clean up the data."); } }
java
public static void deleteApplicationFiles(final Map<String, String> env) { final String applicationFilesDir = env.get(YarnConfigKeys.FLINK_YARN_FILES); if (!StringUtils.isNullOrWhitespaceOnly(applicationFilesDir)) { final org.apache.flink.core.fs.Path path = new org.apache.flink.core.fs.Path(applicationFilesDir); try { final org.apache.flink.core.fs.FileSystem fileSystem = path.getFileSystem(); if (!fileSystem.delete(path, true)) { LOG.error("Deleting yarn application files under {} was unsuccessful.", applicationFilesDir); } } catch (final IOException e) { LOG.error("Could not properly delete yarn application files directory {}.", applicationFilesDir, e); } } else { LOG.debug("No yarn application files directory set. Therefore, cannot clean up the data."); } }
[ "public", "static", "void", "deleteApplicationFiles", "(", "final", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "final", "String", "applicationFilesDir", "=", "env", ".", "get", "(", "YarnConfigKeys", ".", "FLINK_YARN_FILES", ")", ";", "if", "...
Deletes the YARN application files, e.g., Flink binaries, libraries, etc., from the remote filesystem. @param env The environment variables.
[ "Deletes", "the", "YARN", "application", "files", "e", ".", "g", ".", "Flink", "binaries", "libraries", "etc", ".", "from", "the", "remote", "filesystem", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java#L182-L197
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java
ColorPixel.convertRange
public ColorPixel convertRange(double lowerLimitNow, double upperLimitNow, double lowerLimitAfter, double upperLimitAfter){ // double currentRange = upperLimitNow-lowerLimitNow; // double newRange = upperLimitAfter-lowerLimitAfter; // double scaling = newRange/currentRange; double scaling = (upperLimitAfter-lowerLimitAfter)/(upperLimitNow-lowerLimitNow); setRGB_fromDouble_preserveAlpha( lowerLimitAfter+(r_asDouble()-lowerLimitNow)*scaling, lowerLimitAfter+(g_asDouble()-lowerLimitNow)*scaling, lowerLimitAfter+(b_asDouble()-lowerLimitNow)*scaling); return this; }
java
public ColorPixel convertRange(double lowerLimitNow, double upperLimitNow, double lowerLimitAfter, double upperLimitAfter){ // double currentRange = upperLimitNow-lowerLimitNow; // double newRange = upperLimitAfter-lowerLimitAfter; // double scaling = newRange/currentRange; double scaling = (upperLimitAfter-lowerLimitAfter)/(upperLimitNow-lowerLimitNow); setRGB_fromDouble_preserveAlpha( lowerLimitAfter+(r_asDouble()-lowerLimitNow)*scaling, lowerLimitAfter+(g_asDouble()-lowerLimitNow)*scaling, lowerLimitAfter+(b_asDouble()-lowerLimitNow)*scaling); return this; }
[ "public", "ColorPixel", "convertRange", "(", "double", "lowerLimitNow", ",", "double", "upperLimitNow", ",", "double", "lowerLimitAfter", ",", "double", "upperLimitAfter", ")", "{", "//\t\tdouble currentRange = upperLimitNow-lowerLimitNow;", "//\t\tdouble newRange = upperLimitAft...
Converts the pixels RGB channel values from one value range to another. Alpha is preserved. <p> Suppose we know the pixels value range is currently from -10 to 10, and we want to change that value range to 0.0 to 1.0, then the call would look like this:<br> {@code convertRange(-10,10, 0,1)}.<br> A channel value of -10 would then be 0, a channel value of 0 would then be 0.5, a channel value 20 would then be 1.5 (even though it is out of range). @param lowerLimitNow the lower limit of the currently assumed value range @param upperLimitNow the upper limit of the currently assumed value range @param lowerLimitAfter the lower limit of the desired value range @param upperLimitAfter the upper limit of the desired value range @return this pixel for chaining. @see #scale(double)
[ "Converts", "the", "pixels", "RGB", "channel", "values", "from", "one", "value", "range", "to", "another", ".", "Alpha", "is", "preserved", ".", "<p", ">", "Suppose", "we", "know", "the", "pixels", "value", "range", "is", "currently", "from", "-", "10", ...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java#L277-L287
box/box-java-sdk
src/main/java/com/box/sdk/BoxTransactionalAPIConnection.java
BoxTransactionalAPIConnection.getTransactionConnection
public static BoxAPIConnection getTransactionConnection(String accessToken, String scope, String resource) { BoxAPIConnection apiConnection = new BoxAPIConnection(accessToken); URL url; try { url = new URL(apiConnection.getTokenURL()); } catch (MalformedURLException e) { assert false : "An invalid token URL indicates a bug in the SDK."; throw new RuntimeException("An invalid token URL indicates a bug in the SDK.", e); } String urlParameters; try { urlParameters = String.format("grant_type=%s&subject_token=%s&subject_token_type=%s&scope=%s", GRANT_TYPE, URLEncoder.encode(accessToken, "UTF-8"), SUBJECT_TOKEN_TYPE, URLEncoder.encode(scope, "UTF-8")); if (resource != null) { urlParameters += "&resource=" + URLEncoder.encode(resource, "UTF-8"); } } catch (UnsupportedEncodingException e) { throw new BoxAPIException( "An error occurred while attempting to encode url parameters for a transactional token request" ); } BoxAPIRequest request = new BoxAPIRequest(apiConnection, url, "POST"); request.shouldAuthenticate(false); request.setBody(urlParameters); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); final String fileToken = responseJSON.get("access_token").asString(); BoxTransactionalAPIConnection transactionConnection = new BoxTransactionalAPIConnection(fileToken); transactionConnection.setExpires(responseJSON.get("expires_in").asLong() * 1000); return transactionConnection; }
java
public static BoxAPIConnection getTransactionConnection(String accessToken, String scope, String resource) { BoxAPIConnection apiConnection = new BoxAPIConnection(accessToken); URL url; try { url = new URL(apiConnection.getTokenURL()); } catch (MalformedURLException e) { assert false : "An invalid token URL indicates a bug in the SDK."; throw new RuntimeException("An invalid token URL indicates a bug in the SDK.", e); } String urlParameters; try { urlParameters = String.format("grant_type=%s&subject_token=%s&subject_token_type=%s&scope=%s", GRANT_TYPE, URLEncoder.encode(accessToken, "UTF-8"), SUBJECT_TOKEN_TYPE, URLEncoder.encode(scope, "UTF-8")); if (resource != null) { urlParameters += "&resource=" + URLEncoder.encode(resource, "UTF-8"); } } catch (UnsupportedEncodingException e) { throw new BoxAPIException( "An error occurred while attempting to encode url parameters for a transactional token request" ); } BoxAPIRequest request = new BoxAPIRequest(apiConnection, url, "POST"); request.shouldAuthenticate(false); request.setBody(urlParameters); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); final String fileToken = responseJSON.get("access_token").asString(); BoxTransactionalAPIConnection transactionConnection = new BoxTransactionalAPIConnection(fileToken); transactionConnection.setExpires(responseJSON.get("expires_in").asLong() * 1000); return transactionConnection; }
[ "public", "static", "BoxAPIConnection", "getTransactionConnection", "(", "String", "accessToken", ",", "String", "scope", ",", "String", "resource", ")", "{", "BoxAPIConnection", "apiConnection", "=", "new", "BoxAPIConnection", "(", "accessToken", ")", ";", "URL", "...
Request a scoped transactional token for a particular resource. @param accessToken application access token. @param scope scope of transactional token. @param resource resource transactional token has access to. @return a BoxAPIConnection which can be used to perform transactional requests.
[ "Request", "a", "scoped", "transactional", "token", "for", "a", "particular", "resource", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTransactionalAPIConnection.java#L46-L83
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/TaskClient.java
TaskClient.removeTaskFromQueue
public void removeTaskFromQueue(String taskType, String taskId) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); delete("tasks/queue/{taskType}/{taskId}", taskType, taskId); }
java
public void removeTaskFromQueue(String taskType, String taskId) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(taskId), "Task id cannot be blank"); delete("tasks/queue/{taskType}/{taskId}", taskType, taskId); }
[ "public", "void", "removeTaskFromQueue", "(", "String", "taskType", ",", "String", "taskId", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskType", ")", ",", "\"Task type cannot be blank\"", ")", ";", "Preconditions"...
Removes a task from a taskType queue @param taskType the taskType to identify the queue @param taskId the id of the task to be removed
[ "Removes", "a", "task", "from", "a", "taskType", "queue" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L320-L325
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java
ChargingStationEventListener.updateChargingStationOpeningTimes
private boolean updateChargingStationOpeningTimes(ChargingStationOpeningTimesChangedEvent event, boolean clear) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { if (!event.getOpeningTimes().isEmpty()) { if (clear) { chargingStation.getOpeningTimes().clear(); } for (OpeningTime coreOpeningTime : event.getOpeningTimes()) { Day dayOfWeek = coreOpeningTime.getDay(); String timeStart = String.format(TIME_FORMAT, coreOpeningTime.getTimeStart().getHourOfDay(), coreOpeningTime.getTimeStart().getMinutesInHour()); String timeStop = String.format(TIME_FORMAT, coreOpeningTime.getTimeStop().getHourOfDay(), coreOpeningTime.getTimeStop().getMinutesInHour()); io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime openingTime = new io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime(dayOfWeek, timeStart, timeStop); chargingStation.getOpeningTimes().add(openingTime); } repository.createOrUpdate(chargingStation); } } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and update its opening times", event.getChargingStationId()); } return chargingStation != null; }
java
private boolean updateChargingStationOpeningTimes(ChargingStationOpeningTimesChangedEvent event, boolean clear) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { if (!event.getOpeningTimes().isEmpty()) { if (clear) { chargingStation.getOpeningTimes().clear(); } for (OpeningTime coreOpeningTime : event.getOpeningTimes()) { Day dayOfWeek = coreOpeningTime.getDay(); String timeStart = String.format(TIME_FORMAT, coreOpeningTime.getTimeStart().getHourOfDay(), coreOpeningTime.getTimeStart().getMinutesInHour()); String timeStop = String.format(TIME_FORMAT, coreOpeningTime.getTimeStop().getHourOfDay(), coreOpeningTime.getTimeStop().getMinutesInHour()); io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime openingTime = new io.motown.operatorapi.viewmodel.persistence.entities.OpeningTime(dayOfWeek, timeStart, timeStop); chargingStation.getOpeningTimes().add(openingTime); } repository.createOrUpdate(chargingStation); } } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and update its opening times", event.getChargingStationId()); } return chargingStation != null; }
[ "private", "boolean", "updateChargingStationOpeningTimes", "(", "ChargingStationOpeningTimesChangedEvent", "event", ",", "boolean", "clear", ")", "{", "ChargingStation", "chargingStation", "=", "repository", ".", "findOne", "(", "event", ".", "getChargingStationId", "(", ...
Updates the opening times of the charging station. @param event The event which contains the opening times. @param clear Whether to clear the opening times or not. @return {@code true} if the update has been performed, {@code false} if the charging station can't be found.
[ "Updates", "the", "opening", "times", "of", "the", "charging", "station", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L408-L434
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.addCorrectReturnInstruction
public static void addCorrectReturnInstruction(MethodVisitor mv, ReturnType returnType, boolean createCast) { if (returnType.isPrimitive()) { char ch = returnType.descriptor.charAt(0); switch (ch) { case 'V': // void is treated as a special primitive mv.visitInsn(RETURN); break; case 'I': case 'Z': case 'S': case 'B': case 'C': mv.visitInsn(IRETURN); break; case 'F': mv.visitInsn(FRETURN); break; case 'D': mv.visitInsn(DRETURN); break; case 'J': mv.visitInsn(LRETURN); break; default: throw new IllegalArgumentException("Not supported for '" + ch + "'"); } } else { // either array or reference type if (GlobalConfiguration.assertsMode) { // Must not end with a ';' unless it starts with a '[' if (returnType.descriptor.endsWith(";") && !returnType.descriptor.startsWith("[")) { throw new IllegalArgumentException("Invalid signature of '" + returnType.descriptor + "'"); } } if (createCast) { mv.visitTypeInsn(CHECKCAST, returnType.descriptor); } mv.visitInsn(ARETURN); } }
java
public static void addCorrectReturnInstruction(MethodVisitor mv, ReturnType returnType, boolean createCast) { if (returnType.isPrimitive()) { char ch = returnType.descriptor.charAt(0); switch (ch) { case 'V': // void is treated as a special primitive mv.visitInsn(RETURN); break; case 'I': case 'Z': case 'S': case 'B': case 'C': mv.visitInsn(IRETURN); break; case 'F': mv.visitInsn(FRETURN); break; case 'D': mv.visitInsn(DRETURN); break; case 'J': mv.visitInsn(LRETURN); break; default: throw new IllegalArgumentException("Not supported for '" + ch + "'"); } } else { // either array or reference type if (GlobalConfiguration.assertsMode) { // Must not end with a ';' unless it starts with a '[' if (returnType.descriptor.endsWith(";") && !returnType.descriptor.startsWith("[")) { throw new IllegalArgumentException("Invalid signature of '" + returnType.descriptor + "'"); } } if (createCast) { mv.visitTypeInsn(CHECKCAST, returnType.descriptor); } mv.visitInsn(ARETURN); } }
[ "public", "static", "void", "addCorrectReturnInstruction", "(", "MethodVisitor", "mv", ",", "ReturnType", "returnType", ",", "boolean", "createCast", ")", "{", "if", "(", "returnType", ".", "isPrimitive", "(", ")", ")", "{", "char", "ch", "=", "returnType", "....
Depending on the signature of the return type, add the appropriate instructions to the method visitor. @param mv where to visit to append the instructions @param returnType return type descriptor @param createCast whether to include CHECKCAST instructions for return type values
[ "Depending", "on", "the", "signature", "of", "the", "return", "type", "add", "the", "appropriate", "instructions", "to", "the", "method", "visitor", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L113-L153
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java
InstallKernelMap.populateFeatureNameFromManifest
private static void populateFeatureNameFromManifest(File esa, Map<String, String> shortNameMap) throws IOException { String esaLocation = esa.getCanonicalPath(); ZipFile zip = null; try { zip = new ZipFile(esaLocation); Enumeration<? extends ZipEntry> zipEntries = zip.entries(); ZipEntry subsystemEntry = null; while (zipEntries.hasMoreElements()) { ZipEntry nextEntry = zipEntries.nextElement(); if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) { subsystemEntry = nextEntry; break; } } if (subsystemEntry != null) { Manifest m = ManifestProcessor.parseManifest(zip.getInputStream(subsystemEntry)); Attributes manifestAttrs = m.getMainAttributes(); String featureName = manifestAttrs.getValue(SHORTNAME_HEADER_NAME); if (featureName == null) { // Symbolic name field has ";" as delimiter between the actual symbolic name and other tokens such as visibility featureName = manifestAttrs.getValue(SYMBOLICNAME_HEADER_NAME).split(";")[0]; } shortNameMap.put(esa.getCanonicalPath(), featureName); } } finally { if (zip != null) { zip.close(); } } }
java
private static void populateFeatureNameFromManifest(File esa, Map<String, String> shortNameMap) throws IOException { String esaLocation = esa.getCanonicalPath(); ZipFile zip = null; try { zip = new ZipFile(esaLocation); Enumeration<? extends ZipEntry> zipEntries = zip.entries(); ZipEntry subsystemEntry = null; while (zipEntries.hasMoreElements()) { ZipEntry nextEntry = zipEntries.nextElement(); if ("OSGI-INF/SUBSYSTEM.MF".equalsIgnoreCase(nextEntry.getName())) { subsystemEntry = nextEntry; break; } } if (subsystemEntry != null) { Manifest m = ManifestProcessor.parseManifest(zip.getInputStream(subsystemEntry)); Attributes manifestAttrs = m.getMainAttributes(); String featureName = manifestAttrs.getValue(SHORTNAME_HEADER_NAME); if (featureName == null) { // Symbolic name field has ";" as delimiter between the actual symbolic name and other tokens such as visibility featureName = manifestAttrs.getValue(SYMBOLICNAME_HEADER_NAME).split(";")[0]; } shortNameMap.put(esa.getCanonicalPath(), featureName); } } finally { if (zip != null) { zip.close(); } } }
[ "private", "static", "void", "populateFeatureNameFromManifest", "(", "File", "esa", ",", "Map", "<", "String", ",", "String", ">", "shortNameMap", ")", "throws", "IOException", "{", "String", "esaLocation", "=", "esa", ".", "getCanonicalPath", "(", ")", ";", "...
Populate the feature name (short name if available, otherwise symbolic name) from the ESA's manifest into the shortNameMap. @param esa ESA file @param shortNameMap Map to populate with keys being ESA canonical paths and values being feature names (short name or symbolic name) @throws IOException If the ESA's canonical path cannot be resolved or the ESA cannot be read
[ "Populate", "the", "feature", "name", "(", "short", "name", "if", "available", "otherwise", "symbolic", "name", ")", "from", "the", "ESA", "s", "manifest", "into", "the", "shortNameMap", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java#L804-L833
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/AttachmentManager.java
AttachmentManager.uploadAttachment
public Attachment uploadAttachment(String fileName, String contentType, byte[] content) throws RedmineException, IOException { final InputStream is = new ByteArrayInputStream(content); try { return uploadAttachment(fileName, contentType, is, content.length); } finally { try { is.close(); } catch (IOException e) { throw new RedmineInternalError("Unexpected exception", e); } } }
java
public Attachment uploadAttachment(String fileName, String contentType, byte[] content) throws RedmineException, IOException { final InputStream is = new ByteArrayInputStream(content); try { return uploadAttachment(fileName, contentType, is, content.length); } finally { try { is.close(); } catch (IOException e) { throw new RedmineInternalError("Unexpected exception", e); } } }
[ "public", "Attachment", "uploadAttachment", "(", "String", "fileName", ",", "String", "contentType", ",", "byte", "[", "]", "content", ")", "throws", "RedmineException", ",", "IOException", "{", "final", "InputStream", "is", "=", "new", "ByteArrayInputStream", "("...
Uploads an attachment. @param fileName file name of the attachment. @param contentType content type of the attachment. @param content attachment content stream. @return attachment content. @throws RedmineException if something goes wrong. @throws java.io.IOException if input cannot be read.
[ "Uploads", "an", "attachment", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/AttachmentManager.java#L75-L87
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java
CmsTabbedPanel.addNamed
public void addNamed(E tabContent, String tabName, String tabId) { add(tabContent, tabName); m_tabsById.put(tabId, tabContent); }
java
public void addNamed(E tabContent, String tabName, String tabId) { add(tabContent, tabName); m_tabsById.put(tabId, tabContent); }
[ "public", "void", "addNamed", "(", "E", "tabContent", ",", "String", "tabName", ",", "String", "tabId", ")", "{", "add", "(", "tabContent", ",", "tabName", ")", ";", "m_tabsById", ".", "put", "(", "tabId", ",", "tabContent", ")", ";", "}" ]
Adds a tab with a user-defined id.<p> @param tabContent the tab content @param tabName the tab name @param tabId the tab id
[ "Adds", "a", "tab", "with", "a", "user", "-", "defined", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java#L327-L331
google/closure-compiler
src/com/google/javascript/jscomp/AmbiguateProperties.java
AmbiguateProperties.addRelatedInstance
private void addRelatedInstance(FunctionType constructor, JSTypeBitSet related) { checkArgument(constructor.hasInstanceType(), "Constructor %s without instance type.", constructor); ObjectType instanceType = constructor.getInstanceType(); addRelatedType(instanceType, related); }
java
private void addRelatedInstance(FunctionType constructor, JSTypeBitSet related) { checkArgument(constructor.hasInstanceType(), "Constructor %s without instance type.", constructor); ObjectType instanceType = constructor.getInstanceType(); addRelatedType(instanceType, related); }
[ "private", "void", "addRelatedInstance", "(", "FunctionType", "constructor", ",", "JSTypeBitSet", "related", ")", "{", "checkArgument", "(", "constructor", ".", "hasInstanceType", "(", ")", ",", "\"Constructor %s without instance type.\"", ",", "constructor", ")", ";", ...
Adds the instance of the given constructor, its implicit prototype and all its related types to the given bit set.
[ "Adds", "the", "instance", "of", "the", "given", "constructor", "its", "implicit", "prototype", "and", "all", "its", "related", "types", "to", "the", "given", "bit", "set", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AmbiguateProperties.java#L334-L339
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/concurrency/SingletonMap.java
SingletonMap.get
public V get(final K key, final LogNode log) throws E, InterruptedException, NullSingletonException { final SingletonHolder<V> singletonHolder = map.get(key); V instance = null; if (singletonHolder != null) { // There is already a SingletonHolder in the map for this key -- get the value instance = singletonHolder.get(); } else { // There is no SingletonHolder in the map for this key, need to create one // (need to handle race condition, hence the putIfAbsent call) final SingletonHolder<V> newSingletonHolder = new SingletonHolder<>(); final SingletonHolder<V> oldSingletonHolder = map.putIfAbsent(key, newSingletonHolder); if (oldSingletonHolder != null) { // There was already a singleton in the map for this key, due to a race condition -- // return the existing singleton instance = oldSingletonHolder.get(); } else { try { // Create a new instance instance = newInstance(key, log); } finally { // Initialize newSingletonHolder with the new instance. // Always need to call .set() even if an exception is thrown by newInstance() // or newInstance() returns null, since .set() calls initialized.countDown(). // Otherwise threads that call .get() may end up waiting forever. newSingletonHolder.set(instance); } } } if (instance == null) { throw new NullSingletonException(key); } else { return instance; } }
java
public V get(final K key, final LogNode log) throws E, InterruptedException, NullSingletonException { final SingletonHolder<V> singletonHolder = map.get(key); V instance = null; if (singletonHolder != null) { // There is already a SingletonHolder in the map for this key -- get the value instance = singletonHolder.get(); } else { // There is no SingletonHolder in the map for this key, need to create one // (need to handle race condition, hence the putIfAbsent call) final SingletonHolder<V> newSingletonHolder = new SingletonHolder<>(); final SingletonHolder<V> oldSingletonHolder = map.putIfAbsent(key, newSingletonHolder); if (oldSingletonHolder != null) { // There was already a singleton in the map for this key, due to a race condition -- // return the existing singleton instance = oldSingletonHolder.get(); } else { try { // Create a new instance instance = newInstance(key, log); } finally { // Initialize newSingletonHolder with the new instance. // Always need to call .set() even if an exception is thrown by newInstance() // or newInstance() returns null, since .set() calls initialized.countDown(). // Otherwise threads that call .get() may end up waiting forever. newSingletonHolder.set(instance); } } } if (instance == null) { throw new NullSingletonException(key); } else { return instance; } }
[ "public", "V", "get", "(", "final", "K", "key", ",", "final", "LogNode", "log", ")", "throws", "E", ",", "InterruptedException", ",", "NullSingletonException", "{", "final", "SingletonHolder", "<", "V", ">", "singletonHolder", "=", "map", ".", "get", "(", ...
Check if the given key is in the map, and if so, return the value of {@link #newInstance(Object, LogNode)} for that key, or block on the result of {@link #newInstance(Object, LogNode)} if another thread is currently creating the new instance. If the given key is not currently in the map, store a placeholder in the map for this key, then run {@link #newInstance(Object, LogNode)} for the key, store the result in the placeholder (which unblocks any other threads waiting for the value), and then return the new instance. @param key The key for the singleton. @param log The log. @return The non-null singleton instance, if {@link #newInstance(Object, LogNode)} returned a non-null instance on this call or a previous call, otherwise throws {@link NullPointerException} if this call or a previous call to {@link #newInstance(Object, LogNode)} returned null. @throws E If {@link #newInstance(Object, LogNode)} threw an exception. @throws InterruptedException if the thread was interrupted while waiting for the singleton to be instantiated by another thread. @throws NullSingletonException if {@link #newInstance(Object, LogNode)} returned null.
[ "Check", "if", "the", "given", "key", "is", "in", "the", "map", "and", "if", "so", "return", "the", "value", "of", "{", "@link", "#newInstance", "(", "Object", "LogNode", ")", "}", "for", "that", "key", "or", "block", "on", "the", "result", "of", "{"...
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/concurrency/SingletonMap.java#L168-L202
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java
GroupedMap.put
public String put(String group, String key, String value) { group = StrUtil.nullToEmpty(group).trim(); writeLock.lock(); try { LinkedHashMap<String, String> valueMap = this.get(group); if (null == valueMap) { valueMap = new LinkedHashMap<>(); this.put(group, valueMap); } this.size = -1; return valueMap.put(key, value); } finally { writeLock.unlock(); } }
java
public String put(String group, String key, String value) { group = StrUtil.nullToEmpty(group).trim(); writeLock.lock(); try { LinkedHashMap<String, String> valueMap = this.get(group); if (null == valueMap) { valueMap = new LinkedHashMap<>(); this.put(group, valueMap); } this.size = -1; return valueMap.put(key, value); } finally { writeLock.unlock(); } }
[ "public", "String", "put", "(", "String", "group", ",", "String", "key", ",", "String", "value", ")", "{", "group", "=", "StrUtil", ".", "nullToEmpty", "(", "group", ")", ".", "trim", "(", ")", ";", "writeLock", ".", "lock", "(", ")", ";", "try", "...
将键值对加入到对应分组中 @param group 分组 @param key 键 @param value 值 @return 此key之前存在的值,如果没有返回null
[ "将键值对加入到对应分组中" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L89-L103
autermann/yaml
src/main/java/com/github/autermann/yaml/Yaml.java
Yaml.dumpAll
public void dumpAll(Iterator<? extends YamlNode> data, OutputStream output) { getDelegate().dumpAll(data, new OutputStreamWriter(output, Charset .forName("UTF-8"))); }
java
public void dumpAll(Iterator<? extends YamlNode> data, OutputStream output) { getDelegate().dumpAll(data, new OutputStreamWriter(output, Charset .forName("UTF-8"))); }
[ "public", "void", "dumpAll", "(", "Iterator", "<", "?", "extends", "YamlNode", ">", "data", ",", "OutputStream", "output", ")", "{", "getDelegate", "(", ")", ".", "dumpAll", "(", "data", ",", "new", "OutputStreamWriter", "(", "output", ",", "Charset", ".",...
Dumps {@code data} into a {@code OutputStream} using a {@code UTF-8} encoding. @param data the data @param output the output stream
[ "Dumps", "{", "@code", "data", "}", "into", "a", "{", "@code", "OutputStream", "}", "using", "a", "{", "@code", "UTF", "-", "8", "}", "encoding", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/Yaml.java#L160-L163
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.setValue
public void setValue(Set<Token[]> tokensSet) { if (tokensSet == null) { throw new IllegalArgumentException("tokensSet must not be null"); } if (type == null) { type = ItemType.SET; } if (!isListableType()) { throw new IllegalArgumentException("The type of this item must be 'set', 'array' or 'list'"); } tokensList = new ArrayList<>(tokensSet); }
java
public void setValue(Set<Token[]> tokensSet) { if (tokensSet == null) { throw new IllegalArgumentException("tokensSet must not be null"); } if (type == null) { type = ItemType.SET; } if (!isListableType()) { throw new IllegalArgumentException("The type of this item must be 'set', 'array' or 'list'"); } tokensList = new ArrayList<>(tokensSet); }
[ "public", "void", "setValue", "(", "Set", "<", "Token", "[", "]", ">", "tokensSet", ")", "{", "if", "(", "tokensSet", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"tokensSet must not be null\"", ")", ";", "}", "if", "(", "type...
Sets a value to this Set type item. @param tokensSet the tokens set
[ "Sets", "a", "value", "to", "this", "Set", "type", "item", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L357-L368
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
InvocationWriter.castToNonPrimitiveIfNecessary
public void castToNonPrimitiveIfNecessary(final ClassNode sourceType, final ClassNode targetType) { OperandStack os = controller.getOperandStack(); ClassNode boxedType = os.box(); if (WideningCategories.implementsInterfaceOrSubclassOf(boxedType, targetType)) return; MethodVisitor mv = controller.getMethodVisitor(); if (ClassHelper.CLASS_Type.equals(targetType)) { castToClassMethod.call(mv); } else if (ClassHelper.STRING_TYPE.equals(targetType)) { castToStringMethod.call(mv); } else if (targetType.isDerivedFrom(ClassHelper.Enum_Type)) { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToEnumMethod.call(mv); BytecodeHelper.doCast(mv, targetType); } else { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToTypeMethod.call(mv); } }
java
public void castToNonPrimitiveIfNecessary(final ClassNode sourceType, final ClassNode targetType) { OperandStack os = controller.getOperandStack(); ClassNode boxedType = os.box(); if (WideningCategories.implementsInterfaceOrSubclassOf(boxedType, targetType)) return; MethodVisitor mv = controller.getMethodVisitor(); if (ClassHelper.CLASS_Type.equals(targetType)) { castToClassMethod.call(mv); } else if (ClassHelper.STRING_TYPE.equals(targetType)) { castToStringMethod.call(mv); } else if (targetType.isDerivedFrom(ClassHelper.Enum_Type)) { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToEnumMethod.call(mv); BytecodeHelper.doCast(mv, targetType); } else { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToTypeMethod.call(mv); } }
[ "public", "void", "castToNonPrimitiveIfNecessary", "(", "final", "ClassNode", "sourceType", ",", "final", "ClassNode", "targetType", ")", "{", "OperandStack", "os", "=", "controller", ".", "getOperandStack", "(", ")", ";", "ClassNode", "boxedType", "=", "os", ".",...
This converts sourceType to a non primitive by using Groovy casting. sourceType might be a primitive This might be done using SBA#castToType
[ "This", "converts", "sourceType", "to", "a", "non", "primitive", "by", "using", "Groovy", "casting", ".", "sourceType", "might", "be", "a", "primitive", "This", "might", "be", "done", "using", "SBA#castToType" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java#L932-L951
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java
PhotosApi.setMeta
public Response setMeta(String photoId, String title, String description) throws JinxException { JinxUtils.validateParams(photoId, title, description); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.setMeta"); params.put("photo_id", photoId); params.put("title", title); params.put("description", description); return jinx.flickrPost(params, Response.class); }
java
public Response setMeta(String photoId, String title, String description) throws JinxException { JinxUtils.validateParams(photoId, title, description); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.setMeta"); params.put("photo_id", photoId); params.put("title", title); params.put("description", description); return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "setMeta", "(", "String", "photoId", ",", "String", "title", ",", "String", "description", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ",", "title", ",", "description", ")", ";", "Map", "<", ...
Set the meta information for a photo. <br> This method requires authentication with 'write' permission. @param photoId Required. The id of the photo to set metadata for. @param title Required. Title for the photo. @param description Required. Description for the photo. @return response object with the result of the requested operation. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.setMeta.html">flickr.photos.setMeta</a>
[ "Set", "the", "meta", "information", "for", "a", "photo", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L948-L956
jclawson/hazeltask
hazeltask-core/src/main/java/com/hazeltask/executor/HazelcastExecutorTopologyService.java
HazelcastExecutorTopologyService.addPendingTask
public boolean addPendingTask(HazeltaskTask<GROUP> task, boolean replaceIfExists) { if(!replaceIfExists) return pendingTask.putIfAbsent(task.getId(), task) == null; pendingTask.put(task.getId(), task); return true; }
java
public boolean addPendingTask(HazeltaskTask<GROUP> task, boolean replaceIfExists) { if(!replaceIfExists) return pendingTask.putIfAbsent(task.getId(), task) == null; pendingTask.put(task.getId(), task); return true; }
[ "public", "boolean", "addPendingTask", "(", "HazeltaskTask", "<", "GROUP", ">", "task", ",", "boolean", "replaceIfExists", ")", "{", "if", "(", "!", "replaceIfExists", ")", "return", "pendingTask", ".", "putIfAbsent", "(", "task", ".", "getId", "(", ")", ","...
Add to the write ahead log (hazelcast IMap) that tracks all the outstanding tasks
[ "Add", "to", "the", "write", "ahead", "log", "(", "hazelcast", "IMap", ")", "that", "tracks", "all", "the", "outstanding", "tasks" ]
train
https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/HazelcastExecutorTopologyService.java#L140-L146
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/manager/ChallengeInfo.java
ChallengeInfo.applyParams
public void applyParams(AbstractHBCIJob task, AbstractHBCIJob hktan, HBCITwoStepMechanism hbciTwoStepMechanism) { String code = task.getHBCICode(); // Code des Geschaeftsvorfalls // Job-Parameter holen Job job = this.getData(code); // Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir // auch keine Challenge-Parameter setzen if (job == null) { log.info("have no challenge data for " + code + ", will not apply challenge params"); return; } HHDVersion version = HHDVersion.find(hbciTwoStepMechanism); log.debug("using hhd version " + version); // Parameter fuer die passende HHD-Version holen HhdVersion hhd = job.getVersion(version.getChallengeVersion()); // Wir haben keine Parameter fuer diese HHD-Version if (hhd == null) { log.info("have no challenge data for " + code + " in " + version + ", will not apply challenge params"); return; } // Schritt 1: Challenge-Klasse uebernehmen String klass = hhd.getKlass(); log.debug("using challenge klass " + klass); hktan.setParam("challengeklass", klass); // Schritt 2: Challenge-Parameter uebernehmen List<Param> params = hhd.getParams(); for (int i = 0; i < params.size(); ++i) { int num = i + 1; // Die Job-Parameter beginnen bei 1 Param param = params.get(i); // Checken, ob der Parameter angewendet werden soll. if (!param.isComplied(hbciTwoStepMechanism)) { log.debug("skipping challenge parameter " + num + " (" + param.path + "), condition " + param.conditionName + "=" + param.conditionValue + " not complied"); continue; } // Parameter uebernehmen. Aber nur wenn er auch einen Wert hat. // Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie // werden dann freigelassen String value = param.getValue(task); if (value == null || value.length() == 0) { log.debug("challenge parameter " + num + " (" + param.path + ") is empty"); continue; } log.debug("adding challenge parameter " + num + " " + param.path + "=" + value); hktan.setParam("ChallengeKlassParam" + num, value); } }
java
public void applyParams(AbstractHBCIJob task, AbstractHBCIJob hktan, HBCITwoStepMechanism hbciTwoStepMechanism) { String code = task.getHBCICode(); // Code des Geschaeftsvorfalls // Job-Parameter holen Job job = this.getData(code); // Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir // auch keine Challenge-Parameter setzen if (job == null) { log.info("have no challenge data for " + code + ", will not apply challenge params"); return; } HHDVersion version = HHDVersion.find(hbciTwoStepMechanism); log.debug("using hhd version " + version); // Parameter fuer die passende HHD-Version holen HhdVersion hhd = job.getVersion(version.getChallengeVersion()); // Wir haben keine Parameter fuer diese HHD-Version if (hhd == null) { log.info("have no challenge data for " + code + " in " + version + ", will not apply challenge params"); return; } // Schritt 1: Challenge-Klasse uebernehmen String klass = hhd.getKlass(); log.debug("using challenge klass " + klass); hktan.setParam("challengeklass", klass); // Schritt 2: Challenge-Parameter uebernehmen List<Param> params = hhd.getParams(); for (int i = 0; i < params.size(); ++i) { int num = i + 1; // Die Job-Parameter beginnen bei 1 Param param = params.get(i); // Checken, ob der Parameter angewendet werden soll. if (!param.isComplied(hbciTwoStepMechanism)) { log.debug("skipping challenge parameter " + num + " (" + param.path + "), condition " + param.conditionName + "=" + param.conditionValue + " not complied"); continue; } // Parameter uebernehmen. Aber nur wenn er auch einen Wert hat. // Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie // werden dann freigelassen String value = param.getValue(task); if (value == null || value.length() == 0) { log.debug("challenge parameter " + num + " (" + param.path + ") is empty"); continue; } log.debug("adding challenge parameter " + num + " " + param.path + "=" + value); hktan.setParam("ChallengeKlassParam" + num, value); } }
[ "public", "void", "applyParams", "(", "AbstractHBCIJob", "task", ",", "AbstractHBCIJob", "hktan", ",", "HBCITwoStepMechanism", "hbciTwoStepMechanism", ")", "{", "String", "code", "=", "task", ".", "getHBCICode", "(", ")", ";", "// Code des Geschaeftsvorfalls", "// Job...
Uebernimmt die Challenge-Parameter in den HKTAN-Geschaeftsvorfall. @param task der Job, zu dem die Challenge-Parameter ermittelt werden sollen. @param hktan der HKTAN-Geschaeftsvorfall, in dem die Parameter gesetzt werden sollen. @param hbciTwoStepMechanism die BPD-Informationen zum TAN-Verfahren.
[ "Uebernimmt", "die", "Challenge", "-", "Parameter", "in", "den", "HKTAN", "-", "Geschaeftsvorfall", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/ChallengeInfo.java#L131-L185
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.isSubclassOf
public static boolean isSubclassOf(ClassNode classNode, String parentClassName) { ClassNode currentSuper = classNode.getSuperClass(); while (currentSuper != null && !currentSuper.getName().equals(OBJECT_CLASS)) { if (currentSuper.getName().equals(parentClassName)) return true; currentSuper = currentSuper.getSuperClass(); } return false; }
java
public static boolean isSubclassOf(ClassNode classNode, String parentClassName) { ClassNode currentSuper = classNode.getSuperClass(); while (currentSuper != null && !currentSuper.getName().equals(OBJECT_CLASS)) { if (currentSuper.getName().equals(parentClassName)) return true; currentSuper = currentSuper.getSuperClass(); } return false; }
[ "public", "static", "boolean", "isSubclassOf", "(", "ClassNode", "classNode", ",", "String", "parentClassName", ")", "{", "ClassNode", "currentSuper", "=", "classNode", ".", "getSuperClass", "(", ")", ";", "while", "(", "currentSuper", "!=", "null", "&&", "!", ...
Returns true if the given class name is a parent class of the given class @param classNode The class node @param parentClassName the parent class name @return True if it is a subclass
[ "Returns", "true", "if", "the", "given", "class", "name", "is", "a", "parent", "class", "of", "the", "given", "class" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1148-L1155
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateKeyAsync
public Observable<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion) { return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
java
public Observable<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion) { return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "KeyBundle", ">", "updateKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ")", "{", "return", "updateKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ")...
The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object
[ "The", "update", "key", "operation", "changes", "specified", "attributes", "of", "a", "stored", "key", "and", "can", "be", "applied", "to", "any", "key", "type", "and", "key", "version", "stored", "in", "Azure", "Key", "Vault", ".", "In", "order", "to", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1205-L1212
avast/syringe
src/main/java/com/avast/syringe/aop/AroundInterceptor.java
AroundInterceptor.handleException
public Throwable handleException(T proxy, Method method, Object[] args, Throwable cause, Map<String, Object> context) { //Just return the cause return cause; }
java
public Throwable handleException(T proxy, Method method, Object[] args, Throwable cause, Map<String, Object> context) { //Just return the cause return cause; }
[ "public", "Throwable", "handleException", "(", "T", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ",", "Throwable", "cause", ",", "Map", "<", "String", ",", "Object", ">", "context", ")", "{", "//Just return the cause", "return", "cause"...
Handle exception caused by: <ul> <li>Target method code itself.</li> <li>Invocation of the original method. These exceptions won't be wrapped into {@link java.lang.reflect.InvocationTargetException}.</li> </ul> <p> The implementation is not allowed to throw a checked exception. Exceptional behavior should be expressed by returning a result. </p> @param proxy The proxied instance. @param method Intercepted method. @param args Array of arguments, primitive types are boxed. @param cause The original exception (throwable). @param context @return The resulting exception to be thrown.
[ "Handle", "exception", "caused", "by", ":", "<ul", ">", "<li", ">", "Target", "method", "code", "itself", ".", "<", "/", "li", ">", "<li", ">", "Invocation", "of", "the", "original", "method", ".", "These", "exceptions", "won", "t", "be", "wrapped", "i...
train
https://github.com/avast/syringe/blob/762da5e50776f2bc028e0cf17eac9bd09b5b6aab/src/main/java/com/avast/syringe/aop/AroundInterceptor.java#L93-L96
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java
JsiiObjectRef.fromObjId
public static JsiiObjectRef fromObjId(final String objId) { ObjectNode node = JsonNodeFactory.instance.objectNode(); node.put(TOKEN_REF, objId); return new JsiiObjectRef(objId, node); }
java
public static JsiiObjectRef fromObjId(final String objId) { ObjectNode node = JsonNodeFactory.instance.objectNode(); node.put(TOKEN_REF, objId); return new JsiiObjectRef(objId, node); }
[ "public", "static", "JsiiObjectRef", "fromObjId", "(", "final", "String", "objId", ")", "{", "ObjectNode", "node", "=", "JsonNodeFactory", ".", "instance", ".", "objectNode", "(", ")", ";", "node", ".", "put", "(", "TOKEN_REF", ",", "objId", ")", ";", "ret...
Creates an object ref from an object ID. @param objId Object ID. @return The new object ref.
[ "Creates", "an", "object", "ref", "from", "an", "object", "ID", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java#L63-L67
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GroupApi.java
GroupApi.deleteLdapGroupLink
public void deleteLdapGroupLink(Object groupIdOrPath, String cn) throws GitLabApiException { if (cn == null || cn.trim().isEmpty()) { throw new RuntimeException("cn cannot be null or empty"); } delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links", cn); }
java
public void deleteLdapGroupLink(Object groupIdOrPath, String cn) throws GitLabApiException { if (cn == null || cn.trim().isEmpty()) { throw new RuntimeException("cn cannot be null or empty"); } delete(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "ldap_group_links", cn); }
[ "public", "void", "deleteLdapGroupLink", "(", "Object", "groupIdOrPath", ",", "String", "cn", ")", "throws", "GitLabApiException", "{", "if", "(", "cn", "==", "null", "||", "cn", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", ...
Deletes an LDAP group link. <pre><code>GitLab Endpoint: DELETE /groups/:id/ldap_group_links/:cn</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path @param cn the CN of the LDAP group link to delete @throws GitLabApiException if any exception occurs
[ "Deletes", "an", "LDAP", "group", "link", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L961-L968
asciidoctor/asciidoctorj
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/ProcessorProxyUtil.java
ProcessorProxyUtil.getExtensionBaseClass
public static RubyClass getExtensionBaseClass(Ruby rubyRuntime, String processorClassName) { RubyModule extensionsModule = getExtensionsModule(rubyRuntime); return extensionsModule.getClass(processorClassName); }
java
public static RubyClass getExtensionBaseClass(Ruby rubyRuntime, String processorClassName) { RubyModule extensionsModule = getExtensionsModule(rubyRuntime); return extensionsModule.getClass(processorClassName); }
[ "public", "static", "RubyClass", "getExtensionBaseClass", "(", "Ruby", "rubyRuntime", ",", "String", "processorClassName", ")", "{", "RubyModule", "extensionsModule", "=", "getExtensionsModule", "(", "rubyRuntime", ")", ";", "return", "extensionsModule", ".", "getClass"...
For a simple Ruby class name like "Treeprocessor" it returns the associated RubyClass from Asciidoctor::Extensions, e.g. Asciidoctor::Extensions::Treeprocessor @param rubyRuntime @param processorClassName @return The Ruby class object for the given extension class name, e.g. Asciidoctor::Extensions::TreeProcessor
[ "For", "a", "simple", "Ruby", "class", "name", "like", "Treeprocessor", "it", "returns", "the", "associated", "RubyClass", "from", "Asciidoctor", "::", "Extensions", "e", ".", "g", ".", "Asciidoctor", "::", "Extensions", "::", "Treeprocessor" ]
train
https://github.com/asciidoctor/asciidoctorj/blob/e348c9a12b54c33fea7b05d70224c007e2ee75a9/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/ProcessorProxyUtil.java#L23-L26
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.setCompoundDrawablesRelative
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public void setCompoundDrawablesRelative (Drawable start, Drawable top, Drawable end, Drawable bottom){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) mInputView.setCompoundDrawablesRelative(start, top, end, bottom); else mInputView.setCompoundDrawables(start, top, end, bottom); }
java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public void setCompoundDrawablesRelative (Drawable start, Drawable top, Drawable end, Drawable bottom){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) mInputView.setCompoundDrawablesRelative(start, top, end, bottom); else mInputView.setCompoundDrawables(start, top, end, bottom); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "public", "void", "setCompoundDrawablesRelative", "(", "Drawable", "start", ",", "Drawable", "top", ",", "Drawable", "end", ",", "Drawable", "bottom", ")", "{", "if", "(", "Build...
Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text. Use {@code null} if you do not want a Drawable there. The Drawables must already have had {@link Drawable#setBounds} called. <p> Calling this method will overwrite any Drawables previously set using {@link #setCompoundDrawables} or related methods. @attr ref android.R.styleable#TextView_drawableStart @attr ref android.R.styleable#TextView_drawableTop @attr ref android.R.styleable#TextView_drawableEnd @attr ref android.R.styleable#TextView_drawableBottom
[ "Sets", "the", "Drawables", "(", "if", "any", ")", "to", "appear", "to", "the", "start", "of", "above", "to", "the", "end", "of", "and", "below", "the", "text", ".", "Use", "{", "@code", "null", "}", "if", "you", "do", "not", "want", "a", "Drawable...
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2718-L2724
google/closure-templates
java/src/com/google/template/soy/soyparse/ParseErrors.java
ParseErrors.validateSelectCaseLabel
static String validateSelectCaseLabel(ExprNode caseValue, ErrorReporter reporter) { boolean isNumeric; boolean isError; String value; if (caseValue instanceof StringNode) { value = ((StringNode) caseValue).getValue(); // Validate that our select cases are argument names as required by the ICU MessageFormat // library. We can offer a much better user experience by doing this validation eagerly. // NOTE: in theory we could allow numeric select cases, but this is almost always an error // (they should have used plural), if there turns out to be some good reason for this (e.g. // the numbers are reflect ordinals instead of cardinals), then we can revisit this error. int argNumber = MessagePattern.validateArgumentName(value); if (argNumber != MessagePattern.ARG_NAME_NOT_NUMBER) { try { // there are more efficient ways to do this, but we are already in an error case so who // cares Long.parseLong(value); isNumeric = true; } catch (NumberFormatException nfe) { isNumeric = false; } isError = true; } else { isNumeric = false; isError = false; } } else { isNumeric = caseValue instanceof FloatNode || caseValue instanceof IntegerNode; isError = true; value = ""; } if (isError) { reporter.report( caseValue.getSourceLocation(), SELECT_CASE_INVALID_VALUE, isNumeric ? " Did you mean to use {plural} instead of {select}?" : ""); } return value; }
java
static String validateSelectCaseLabel(ExprNode caseValue, ErrorReporter reporter) { boolean isNumeric; boolean isError; String value; if (caseValue instanceof StringNode) { value = ((StringNode) caseValue).getValue(); // Validate that our select cases are argument names as required by the ICU MessageFormat // library. We can offer a much better user experience by doing this validation eagerly. // NOTE: in theory we could allow numeric select cases, but this is almost always an error // (they should have used plural), if there turns out to be some good reason for this (e.g. // the numbers are reflect ordinals instead of cardinals), then we can revisit this error. int argNumber = MessagePattern.validateArgumentName(value); if (argNumber != MessagePattern.ARG_NAME_NOT_NUMBER) { try { // there are more efficient ways to do this, but we are already in an error case so who // cares Long.parseLong(value); isNumeric = true; } catch (NumberFormatException nfe) { isNumeric = false; } isError = true; } else { isNumeric = false; isError = false; } } else { isNumeric = caseValue instanceof FloatNode || caseValue instanceof IntegerNode; isError = true; value = ""; } if (isError) { reporter.report( caseValue.getSourceLocation(), SELECT_CASE_INVALID_VALUE, isNumeric ? " Did you mean to use {plural} instead of {select}?" : ""); } return value; }
[ "static", "String", "validateSelectCaseLabel", "(", "ExprNode", "caseValue", ",", "ErrorReporter", "reporter", ")", "{", "boolean", "isNumeric", ";", "boolean", "isError", ";", "String", "value", ";", "if", "(", "caseValue", "instanceof", "StringNode", ")", "{", ...
Validates an expression being used as a {@code case} label in a {@code select}.
[ "Validates", "an", "expression", "being", "used", "as", "a", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/ParseErrors.java#L342-L380
google/closure-templates
java/src/com/google/template/soy/soytree/MsgNode.java
MsgNode.genSubstUnitInfo
private static SubstUnitInfo genSubstUnitInfo(MsgNode msgNode, ErrorReporter errorReporter) { return genFinalSubstUnitInfoMapsHelper( RepresentativeNodes.createFromNode(msgNode, errorReporter)); }
java
private static SubstUnitInfo genSubstUnitInfo(MsgNode msgNode, ErrorReporter errorReporter) { return genFinalSubstUnitInfoMapsHelper( RepresentativeNodes.createFromNode(msgNode, errorReporter)); }
[ "private", "static", "SubstUnitInfo", "genSubstUnitInfo", "(", "MsgNode", "msgNode", ",", "ErrorReporter", "errorReporter", ")", "{", "return", "genFinalSubstUnitInfoMapsHelper", "(", "RepresentativeNodes", ".", "createFromNode", "(", "msgNode", ",", "errorReporter", ")",...
Helper function to generate SubstUnitInfo, which contains mappings from/to substitution unit nodes (placeholders and plural/select nodes) to/from generated var names. <p>It is guaranteed that the same var name will never be shared by multiple nodes of different types (types are placeholder, plural, and select). @param msgNode The MsgNode to process. @return The generated SubstUnitInfo for the given MsgNode.
[ "Helper", "function", "to", "generate", "SubstUnitInfo", "which", "contains", "mappings", "from", "/", "to", "substitution", "unit", "nodes", "(", "placeholders", "and", "plural", "/", "select", "nodes", ")", "to", "/", "from", "generated", "var", "names", "."...
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/MsgNode.java#L460-L463
wcm-io-caravan/caravan-hal
resource/src/main/java/io/wcm/caravan/hal/resource/HalResourceFactory.java
HalResourceFactory.getStateAsObject
@Deprecated public static <T> T getStateAsObject(HalResource halResource, Class<T> type) { return halResource.adaptTo(type); }
java
@Deprecated public static <T> T getStateAsObject(HalResource halResource, Class<T> type) { return halResource.adaptTo(type); }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "T", "getStateAsObject", "(", "HalResource", "halResource", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "halResource", ".", "adaptTo", "(", "type", ")", ";", "}" ]
Converts the JSON model to an object of the given type. @param halResource HAL resource with model to convert @param type Type of the requested object @param <T> Output type @return State as object @deprecated use {@link HalResource#adaptTo(Class)}
[ "Converts", "the", "JSON", "model", "to", "an", "object", "of", "the", "given", "type", "." ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResourceFactory.java#L104-L107
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageUtil.java
CmsContainerpageUtil.createElement
public CmsContainerPageElementPanel createElement( CmsContainerElementData containerElement, I_CmsDropContainer container, boolean isNew) throws Exception { if (containerElement.isGroupContainer() || containerElement.isInheritContainer()) { List<CmsContainerElementData> subElements = new ArrayList<CmsContainerElementData>(); for (String subId : containerElement.getSubItems()) { CmsContainerElementData element = m_controller.getCachedElement(subId); if (element != null) { subElements.add(element); } else { CmsDebugLog.getInstance().printLine("Cached element not found"); } } return createGroupcontainerElement(containerElement, subElements, container); } Element element = CmsDomUtil.createElement(containerElement.getContents().get(container.getContainerId())); // ensure any embedded flash players are set opaque so UI elements may be placed above them CmsDomUtil.fixFlashZindex(element); if (isNew) { CmsContentEditor.replaceResourceIds( element, CmsUUID.getNullUUID().toString(), CmsContainerpageController.getServerId(containerElement.getClientId())); } CmsContainerPageElementPanel result = createElement(element, container, containerElement); if (!CmsContainerpageController.get().shouldShowInContext(containerElement)) { result.getElement().getStyle().setDisplay(Style.Display.NONE); result.addStyleName(CmsTemplateContextInfo.DUMMY_ELEMENT_MARKER); } return result; }
java
public CmsContainerPageElementPanel createElement( CmsContainerElementData containerElement, I_CmsDropContainer container, boolean isNew) throws Exception { if (containerElement.isGroupContainer() || containerElement.isInheritContainer()) { List<CmsContainerElementData> subElements = new ArrayList<CmsContainerElementData>(); for (String subId : containerElement.getSubItems()) { CmsContainerElementData element = m_controller.getCachedElement(subId); if (element != null) { subElements.add(element); } else { CmsDebugLog.getInstance().printLine("Cached element not found"); } } return createGroupcontainerElement(containerElement, subElements, container); } Element element = CmsDomUtil.createElement(containerElement.getContents().get(container.getContainerId())); // ensure any embedded flash players are set opaque so UI elements may be placed above them CmsDomUtil.fixFlashZindex(element); if (isNew) { CmsContentEditor.replaceResourceIds( element, CmsUUID.getNullUUID().toString(), CmsContainerpageController.getServerId(containerElement.getClientId())); } CmsContainerPageElementPanel result = createElement(element, container, containerElement); if (!CmsContainerpageController.get().shouldShowInContext(containerElement)) { result.getElement().getStyle().setDisplay(Style.Display.NONE); result.addStyleName(CmsTemplateContextInfo.DUMMY_ELEMENT_MARKER); } return result; }
[ "public", "CmsContainerPageElementPanel", "createElement", "(", "CmsContainerElementData", "containerElement", ",", "I_CmsDropContainer", "container", ",", "boolean", "isNew", ")", "throws", "Exception", "{", "if", "(", "containerElement", ".", "isGroupContainer", "(", ")...
Creates an drag container element.<p> @param containerElement the container element data @param container the container parent @param isNew in case of a newly created element @return the draggable element @throws Exception if something goes wrong
[ "Creates", "an", "drag", "container", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageUtil.java#L334-L368
febit/wit
wit-core/src/main/java/org/febit/wit/global/GlobalManager.java
GlobalManager.forEachGlobal
public void forEachGlobal(BiConsumer<String, Object> action) { Objects.requireNonNull(action); this.globalVars.forEach(action); }
java
public void forEachGlobal(BiConsumer<String, Object> action) { Objects.requireNonNull(action); this.globalVars.forEach(action); }
[ "public", "void", "forEachGlobal", "(", "BiConsumer", "<", "String", ",", "Object", ">", "action", ")", "{", "Objects", ".", "requireNonNull", "(", "action", ")", ";", "this", ".", "globalVars", ".", "forEach", "(", "action", ")", ";", "}" ]
Performs the given action for each global vars until all have been processed or the action throws an exception. @param action @since 2.5.0
[ "Performs", "the", "given", "action", "for", "each", "global", "vars", "until", "all", "have", "been", "processed", "or", "the", "action", "throws", "an", "exception", "." ]
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit/global/GlobalManager.java#L61-L64
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java
AVIMConversation.queryBlockedMembers
public void queryBlockedMembers(int offset, int limit, final AVIMConversationSimpleResultCallback callback) { if (null == callback) { return; } else if (offset < 0 || limit > 100) { callback.internalDone(null, new AVIMException(new IllegalArgumentException("offset/limit is illegal."))); return; } Map<String, Object> params = new HashMap<String, Object>(); params.put(Conversation.QUERY_PARAM_LIMIT, limit); params.put(Conversation.QUERY_PARAM_OFFSET, offset); boolean ret = InternalConfiguration.getOperationTube().processMembers(this.client.getClientId(), this.conversationId, getType(), JSON.toJSONString(params), Conversation.AVIMOperation.CONVERSATION_BLOCKED_MEMBER_QUERY, callback); if (!ret) { callback.internalDone(null, new AVException(AVException.OPERATION_FORBIDDEN, "couldn't start service in background.")); } }
java
public void queryBlockedMembers(int offset, int limit, final AVIMConversationSimpleResultCallback callback) { if (null == callback) { return; } else if (offset < 0 || limit > 100) { callback.internalDone(null, new AVIMException(new IllegalArgumentException("offset/limit is illegal."))); return; } Map<String, Object> params = new HashMap<String, Object>(); params.put(Conversation.QUERY_PARAM_LIMIT, limit); params.put(Conversation.QUERY_PARAM_OFFSET, offset); boolean ret = InternalConfiguration.getOperationTube().processMembers(this.client.getClientId(), this.conversationId, getType(), JSON.toJSONString(params), Conversation.AVIMOperation.CONVERSATION_BLOCKED_MEMBER_QUERY, callback); if (!ret) { callback.internalDone(null, new AVException(AVException.OPERATION_FORBIDDEN, "couldn't start service in background.")); } }
[ "public", "void", "queryBlockedMembers", "(", "int", "offset", ",", "int", "limit", ",", "final", "AVIMConversationSimpleResultCallback", "callback", ")", "{", "if", "(", "null", "==", "callback", ")", "{", "return", ";", "}", "else", "if", "(", "offset", "<...
查询黑名单的成员列表 @param offset 查询结果的起始点 @param limit 查询结果集上限 @param callback 结果回调函数
[ "查询黑名单的成员列表" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L1337-L1353
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java
GarbageCollector.onPropertyValueChanged
public synchronized void onPropertyValueChanged(Property property, Object oldValue, Object newValue) { if (!configuration.isUseGc()) { return; } removeReferenceAndCheckForGC(property, oldValue); if (newValue != null && DolphinUtils.isDolphinBean(newValue.getClass())) { Instance instance = getInstance(newValue); Reference reference = new PropertyReference(propertyToParent.get(property), property, instance); if (reference.hasCircularReference()) { throw new CircularDependencyException("Circular dependency detected!"); } instance.getReferences().add(reference); removeFromGC(instance); } }
java
public synchronized void onPropertyValueChanged(Property property, Object oldValue, Object newValue) { if (!configuration.isUseGc()) { return; } removeReferenceAndCheckForGC(property, oldValue); if (newValue != null && DolphinUtils.isDolphinBean(newValue.getClass())) { Instance instance = getInstance(newValue); Reference reference = new PropertyReference(propertyToParent.get(property), property, instance); if (reference.hasCircularReference()) { throw new CircularDependencyException("Circular dependency detected!"); } instance.getReferences().add(reference); removeFromGC(instance); } }
[ "public", "synchronized", "void", "onPropertyValueChanged", "(", "Property", "property", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "if", "(", "!", "configuration", ".", "isUseGc", "(", ")", ")", "{", "return", ";", "}", "removeReferenceAn...
This method must be called for each value change of a {@link Property} @param property the property @param oldValue the old value @param newValue the new value
[ "This", "method", "must", "be", "called", "for", "each", "value", "change", "of", "a", "{", "@link", "Property", "}" ]
train
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java#L149-L164
jenkinsci/jenkins
core/src/main/java/hudson/tasks/BuildWrapper.java
BuildWrapper.decorateLauncher
public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException { return launcher; }
java
public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException { return launcher; }
[ "public", "Launcher", "decorateLauncher", "(", "AbstractBuild", "build", ",", "Launcher", "launcher", ",", "BuildListener", "listener", ")", "throws", "IOException", ",", "InterruptedException", ",", "RunnerAbortedException", "{", "return", "launcher", ";", "}" ]
Provides an opportunity for a {@link BuildWrapper} to decorate a {@link Launcher} to be used in the build. <p> This hook is called very early on in the build (even before {@link #setUp(AbstractBuild, Launcher, BuildListener)} is invoked.) The typical use of {@link Launcher} decoration involves in modifying the environment that processes run, such as the use of sudo/pfexec/chroot, or manipulating environment variables. <p> The default implementation is no-op, which just returns the {@code launcher} parameter as-is. @param build The build in progress for which this {@link BuildWrapper} is called. Never null. @param launcher The default launcher. Never null. This method is expected to wrap this launcher. This makes sure that when multiple {@link BuildWrapper}s attempt to decorate the same launcher it will sort of work. But if you are developing a plugin where such collision is not a concern, you can also simply discard this {@link Launcher} and create an entirely different {@link Launcher} and return it, too. @param listener Connected to the build output. Never null. Can be used for error reporting. @return Must not be null. If a fatal error happens, throw an exception. @throws RunnerAbortedException If a fatal error is detected but the implementation handled it gracefully, throw this exception to suppress stack trace. @since 1.280 @see LauncherDecorator
[ "Provides", "an", "opportunity", "for", "a", "{", "@link", "BuildWrapper", "}", "to", "decorate", "a", "{", "@link", "Launcher", "}", "to", "be", "used", "in", "the", "build", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/BuildWrapper.java#L187-L189
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.storeReferences
private void storeReferences(Object obj, ClassDescriptor cld, boolean insert, boolean ignoreReferences) { // get all members of obj that are references and store them Collection listRds = cld.getObjectReferenceDescriptors(); // return if nothing to do if(listRds == null || listRds.size() == 0) { return; } Iterator i = listRds.iterator(); while (i.hasNext()) { ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next(); /* arminw: the super-references (used for table per subclass inheritance) must be performed in any case. The "normal" 1:1 references can be ignored when flag "ignoreReferences" is set */ if((!ignoreReferences && rds.getCascadingStore() != ObjectReferenceDescriptor.CASCADE_NONE) || rds.isSuperReferenceDescriptor()) { storeAndLinkOneToOne(false, obj, cld, rds, insert); } } }
java
private void storeReferences(Object obj, ClassDescriptor cld, boolean insert, boolean ignoreReferences) { // get all members of obj that are references and store them Collection listRds = cld.getObjectReferenceDescriptors(); // return if nothing to do if(listRds == null || listRds.size() == 0) { return; } Iterator i = listRds.iterator(); while (i.hasNext()) { ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next(); /* arminw: the super-references (used for table per subclass inheritance) must be performed in any case. The "normal" 1:1 references can be ignored when flag "ignoreReferences" is set */ if((!ignoreReferences && rds.getCascadingStore() != ObjectReferenceDescriptor.CASCADE_NONE) || rds.isSuperReferenceDescriptor()) { storeAndLinkOneToOne(false, obj, cld, rds, insert); } } }
[ "private", "void", "storeReferences", "(", "Object", "obj", ",", "ClassDescriptor", "cld", ",", "boolean", "insert", ",", "boolean", "ignoreReferences", ")", "{", "// get all members of obj that are references and store them", "Collection", "listRds", "=", "cld", ".", "...
Store all object references that <b>obj</b> points to. All objects which we have a FK pointing to (Via ReferenceDescriptors) will be stored if auto-update is true <b>AND</b> the member field containing the object reference is NOT null. With flag <em>ignoreReferences</em> the storing/linking of references can be suppressed (independent of the used auto-update setting), except {@link org.apache.ojb.broker.metadata.SuperReferenceDescriptor} these kind of reference (descriptor) will always be performed. @param obj Object which we will store references for
[ "Store", "all", "object", "references", "that", "<b", ">", "obj<", "/", "b", ">", "points", "to", ".", "All", "objects", "which", "we", "have", "a", "FK", "pointing", "to", "(", "Via", "ReferenceDescriptors", ")", "will", "be", "stored", "if", "auto", ...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L963-L987
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java
RegisteredResources.compare
@Override public int compare(JTAResource o1, JTAResource o2) { if (tc.isEntryEnabled()) Tr.entry(tc, "compare", new Object[] { o1, o2, this }); int result = 0; int p1 = o1.getPriority(); int p2 = o2.getPriority(); if (p1 < p2) result = 1; else if (p1 > p2) result = -1; if (tc.isEntryEnabled()) Tr.exit(tc, "compare", result); return result; }
java
@Override public int compare(JTAResource o1, JTAResource o2) { if (tc.isEntryEnabled()) Tr.entry(tc, "compare", new Object[] { o1, o2, this }); int result = 0; int p1 = o1.getPriority(); int p2 = o2.getPriority(); if (p1 < p2) result = 1; else if (p1 > p2) result = -1; if (tc.isEntryEnabled()) Tr.exit(tc, "compare", result); return result; }
[ "@", "Override", "public", "int", "compare", "(", "JTAResource", "o1", ",", "JTAResource", "o2", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"compare\"", ",", "new", "Object", "[", "]", "{", ...
Comparator returning 0 should leave elements in list alone, preserving original order.
[ "Comparator", "returning", "0", "should", "leave", "elements", "in", "list", "alone", "preserving", "original", "order", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2631-L2645
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java
UCharacterName.getGroupName
public synchronized String getGroupName(int ch, int choice) { // gets the msb int msb = getCodepointMSB(ch); int group = getGroup(ch); // return this if it is an exact match if (msb == m_groupinfo_[group * m_groupsize_]) { int index = getGroupLengths(group, m_groupoffsets_, m_grouplengths_); int offset = ch & GROUP_MASK_; return getGroupName(index + m_groupoffsets_[offset], m_grouplengths_[offset], choice); } return null; }
java
public synchronized String getGroupName(int ch, int choice) { // gets the msb int msb = getCodepointMSB(ch); int group = getGroup(ch); // return this if it is an exact match if (msb == m_groupinfo_[group * m_groupsize_]) { int index = getGroupLengths(group, m_groupoffsets_, m_grouplengths_); int offset = ch & GROUP_MASK_; return getGroupName(index + m_groupoffsets_[offset], m_grouplengths_[offset], choice); } return null; }
[ "public", "synchronized", "String", "getGroupName", "(", "int", "ch", ",", "int", "choice", ")", "{", "// gets the msb", "int", "msb", "=", "getCodepointMSB", "(", "ch", ")", ";", "int", "group", "=", "getGroup", "(", "ch", ")", ";", "// return this if it is...
Gets the group name of the character @param ch character to get the group name @param choice name choice selector to choose a unicode 1.0 or newer name
[ "Gets", "the", "group", "name", "of", "the", "character" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L507-L523
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/RedmineJSONParser.java
RedmineJSONParser.getDateOrNull
private static Date getDateOrNull(JSONObject obj, String field) throws JSONException { String dateStr = JsonInput.getStringOrNull(obj, field); if (dateStr == null) return null; try { if (dateStr.length() >= 5 && dateStr.charAt(4) == '/') { return RedmineDateUtils.FULL_DATE_FORMAT.get().parse(dateStr); } if (dateStr.endsWith("Z")) { dateStr = dateStr.substring(0, dateStr.length() - 1) + "GMT-00:00"; } else { final int inset = 6; if (dateStr.length() <= inset) throw new JSONException("Bad date value " + dateStr); String s0 = dateStr.substring(0, dateStr.length() - inset); String s1 = dateStr.substring(dateStr.length() - inset, dateStr.length()); dateStr = s0 + "GMT" + s1; } return RedmineDateUtils.FULL_DATE_FORMAT_V2.get().parse(dateStr); } catch (ParseException e) { throw new JSONException("Bad date value " + dateStr); } }
java
private static Date getDateOrNull(JSONObject obj, String field) throws JSONException { String dateStr = JsonInput.getStringOrNull(obj, field); if (dateStr == null) return null; try { if (dateStr.length() >= 5 && dateStr.charAt(4) == '/') { return RedmineDateUtils.FULL_DATE_FORMAT.get().parse(dateStr); } if (dateStr.endsWith("Z")) { dateStr = dateStr.substring(0, dateStr.length() - 1) + "GMT-00:00"; } else { final int inset = 6; if (dateStr.length() <= inset) throw new JSONException("Bad date value " + dateStr); String s0 = dateStr.substring(0, dateStr.length() - inset); String s1 = dateStr.substring(dateStr.length() - inset, dateStr.length()); dateStr = s0 + "GMT" + s1; } return RedmineDateUtils.FULL_DATE_FORMAT_V2.get().parse(dateStr); } catch (ParseException e) { throw new JSONException("Bad date value " + dateStr); } }
[ "private", "static", "Date", "getDateOrNull", "(", "JSONObject", "obj", ",", "String", "field", ")", "throws", "JSONException", "{", "String", "dateStr", "=", "JsonInput", ".", "getStringOrNull", "(", "obj", ",", "field", ")", ";", "if", "(", "dateStr", "=="...
Fetches an optional date from an object. @param obj object to get a field from. @param field field to get a value from. @throws RedmineFormatException if value is not valid
[ "Fetches", "an", "optional", "date", "from", "an", "object", "." ]
train
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/RedmineJSONParser.java#L549-L574
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/context/ContextHelper.java
ContextHelper.getCookie
public static Cookie getCookie(final Collection<Cookie> cookies, final String name) { if (cookies != null) { for (final Cookie cookie : cookies) { if (cookie != null && CommonHelper.areEquals(name, cookie.getName())) { return cookie; } } } return null; }
java
public static Cookie getCookie(final Collection<Cookie> cookies, final String name) { if (cookies != null) { for (final Cookie cookie : cookies) { if (cookie != null && CommonHelper.areEquals(name, cookie.getName())) { return cookie; } } } return null; }
[ "public", "static", "Cookie", "getCookie", "(", "final", "Collection", "<", "Cookie", ">", "cookies", ",", "final", "String", "name", ")", "{", "if", "(", "cookies", "!=", "null", ")", "{", "for", "(", "final", "Cookie", "cookie", ":", "cookies", ")", ...
Get a specific cookie by its name. @param cookies provided cookies @param name the name of the cookie @return the cookie
[ "Get", "a", "specific", "cookie", "by", "its", "name", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/context/ContextHelper.java#L22-L31
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java
RTMPHandshake.getDHOffset2
protected int getDHOffset2(byte[] handshake, int bufferOffset) { bufferOffset += 768; int offset = handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = (offset % 632) + 8; if (res + KEY_LENGTH > 767) { log.error("Invalid DH offset"); } return res; }
java
protected int getDHOffset2(byte[] handshake, int bufferOffset) { bufferOffset += 768; int offset = handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = (offset % 632) + 8; if (res + KEY_LENGTH > 767) { log.error("Invalid DH offset"); } return res; }
[ "protected", "int", "getDHOffset2", "(", "byte", "[", "]", "handshake", ",", "int", "bufferOffset", ")", "{", "bufferOffset", "+=", "768", ";", "int", "offset", "=", "handshake", "[", "bufferOffset", "]", "&", "0xff", ";", "bufferOffset", "++", ";", "offse...
Returns the DH byte offset. @param handshake handshake sequence @param bufferOffset buffer offset @return dh offset
[ "Returns", "the", "DH", "byte", "offset", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L467-L481
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if (null != m_predicates) { for (int i = 0; i < m_predicates.length; i++) { m_predicates[i].fixupVariables(vars, globalsSize); } } if (null != m_relativePathPattern) { m_relativePathPattern.fixupVariables(vars, globalsSize); } }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if (null != m_predicates) { for (int i = 0; i < m_predicates.length; i++) { m_predicates[i].fixupVariables(vars, globalsSize); } } if (null != m_relativePathPattern) { m_relativePathPattern.fixupVariables(vars, globalsSize); } }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "super", ".", "fixupVariables", "(", "vars", ",", "globalsSize", ")", ";", "if", "(", "null", "!=", "m_predicates", ")", "{", "for",...
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). @param globalsSize The number of variables in the global variable area.
[ "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/patterns/StepPattern.java#L158-L175
GoogleCloudPlatform/bigdata-interop
util/src/main/java/com/google/cloud/hadoop/util/AbstractGoogleAsyncWriteChannel.java
AbstractGoogleAsyncWriteChannel.waitForCompletionAndThrowIfUploadFailed
private S waitForCompletionAndThrowIfUploadFailed() throws IOException { try { return uploadOperation.get(); } catch (InterruptedException e) { // If we were interrupted, we need to cancel the upload operation. uploadOperation.cancel(true); IOException exception = new ClosedByInterruptException(); exception.addSuppressed(e); throw exception; } catch (ExecutionException e) { if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw new IOException("Upload failed", e.getCause()); } }
java
private S waitForCompletionAndThrowIfUploadFailed() throws IOException { try { return uploadOperation.get(); } catch (InterruptedException e) { // If we were interrupted, we need to cancel the upload operation. uploadOperation.cancel(true); IOException exception = new ClosedByInterruptException(); exception.addSuppressed(e); throw exception; } catch (ExecutionException e) { if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw new IOException("Upload failed", e.getCause()); } }
[ "private", "S", "waitForCompletionAndThrowIfUploadFailed", "(", ")", "throws", "IOException", "{", "try", "{", "return", "uploadOperation", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "// If we were interrupted, we need to canc...
Throws if upload operation failed. Propagates any errors. @throws IOException on IO error
[ "Throws", "if", "upload", "operation", "failed", ".", "Propagates", "any", "errors", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/AbstractGoogleAsyncWriteChannel.java#L300-L315
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.set
public <K, V> void set(PropertyMapKey<K, V> property, Map<K, V> value) { properties.put(property.getName(), value); }
java
public <K, V> void set(PropertyMapKey<K, V> property, Map<K, V> value) { properties.put(property.getName(), value); }
[ "public", "<", "K", ",", "V", ">", "void", "set", "(", "PropertyMapKey", "<", "K", ",", "V", ">", "property", ",", "Map", "<", "K", ",", "V", ">", "value", ")", "{", "properties", ".", "put", "(", "property", ".", "getName", "(", ")", ",", "val...
Associates the specified map with the specified property key. If the properties previously contained a mapping for the property key, the old value is replaced by the specified map. @param <K> the type of keys maintained by the map @param <V> the type of mapped values @param property the property key with which the specified map is to be associated @param value the map to be associated with the specified property key
[ "Associates", "the", "specified", "map", "with", "the", "specified", "property", "key", ".", "If", "the", "properties", "previously", "contained", "a", "mapping", "for", "the", "property", "key", "the", "old", "value", "is", "replaced", "by", "the", "specified...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L144-L146
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.expectRange
public void expectRange(String name, int minLength, int maxLength) { expectRange(name, minLength, maxLength, messages.get(Validation.RANGE_KEY.name(), name, minLength, maxLength)); }
java
public void expectRange(String name, int minLength, int maxLength) { expectRange(name, minLength, maxLength, messages.get(Validation.RANGE_KEY.name(), name, minLength, maxLength)); }
[ "public", "void", "expectRange", "(", "String", "name", ",", "int", "minLength", ",", "int", "maxLength", ")", "{", "expectRange", "(", "name", ",", "minLength", ",", "maxLength", ",", "messages", ".", "get", "(", "Validation", ".", "RANGE_KEY", ".", "name...
Validates a field to be in a certain range @param name The field to check @param minLength The minimum length @param maxLength The maximum length
[ "Validates", "a", "field", "to", "be", "in", "a", "certain", "range" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L341-L343
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_lan_lanName_dhcp_dhcpName_PUT
public void serviceName_modem_lan_lanName_dhcp_dhcpName_PUT(String serviceName, String lanName, String dhcpName, OvhDHCP body) throws IOException { String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_modem_lan_lanName_dhcp_dhcpName_PUT(String serviceName, String lanName, String dhcpName, OvhDHCP body) throws IOException { String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName}"; StringBuilder sb = path(qPath, serviceName, lanName, dhcpName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_modem_lan_lanName_dhcp_dhcpName_PUT", "(", "String", "serviceName", ",", "String", "lanName", ",", "String", "dhcpName", ",", "OvhDHCP", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/lan/{lan...
Alter this object properties REST: PUT /xdsl/{serviceName}/modem/lan/{lanName}/dhcp/{dhcpName} @param body [required] New object properties @param serviceName [required] The internal name of your XDSL offer @param lanName [required] Name of the LAN @param dhcpName [required] Name of the DHCP
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1038-L1042
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.formatEntityKey
public static String formatEntityKey(EntityDataModel entityDataModel, Object entity) throws ODataEdmException { Key entityKey = getAndCheckEntityType(entityDataModel, entity.getClass()).getKey(); List<PropertyRef> keyPropertyRefs = entityKey.getPropertyRefs(); try { if (keyPropertyRefs.size() == 1) { return getKeyValueFromPropertyRef(entityDataModel, entity, keyPropertyRefs.get(0)); } else if (keyPropertyRefs.size() > 1) { List<String> processedKeys = new ArrayList<>(); for (PropertyRef propertyRef : keyPropertyRefs) { processedKeys.add(String.format("%s=%s", propertyRef.getPath(), getKeyValueFromPropertyRef(entityDataModel, entity, propertyRef))); } return processedKeys.stream().map(Object::toString).collect(Collectors.joining(",")); } else { LOG.error("Not possible to retrieve entity key for entity " + entity); throw new ODataEdmException("Entity key is not found for " + entity); } } catch (IllegalAccessException e) { LOG.error("Not possible to retrieve entity key for entity " + entity); throw new ODataEdmException("Not possible to retrieve entity key for entity " + entity, e); } }
java
public static String formatEntityKey(EntityDataModel entityDataModel, Object entity) throws ODataEdmException { Key entityKey = getAndCheckEntityType(entityDataModel, entity.getClass()).getKey(); List<PropertyRef> keyPropertyRefs = entityKey.getPropertyRefs(); try { if (keyPropertyRefs.size() == 1) { return getKeyValueFromPropertyRef(entityDataModel, entity, keyPropertyRefs.get(0)); } else if (keyPropertyRefs.size() > 1) { List<String> processedKeys = new ArrayList<>(); for (PropertyRef propertyRef : keyPropertyRefs) { processedKeys.add(String.format("%s=%s", propertyRef.getPath(), getKeyValueFromPropertyRef(entityDataModel, entity, propertyRef))); } return processedKeys.stream().map(Object::toString).collect(Collectors.joining(",")); } else { LOG.error("Not possible to retrieve entity key for entity " + entity); throw new ODataEdmException("Entity key is not found for " + entity); } } catch (IllegalAccessException e) { LOG.error("Not possible to retrieve entity key for entity " + entity); throw new ODataEdmException("Not possible to retrieve entity key for entity " + entity, e); } }
[ "public", "static", "String", "formatEntityKey", "(", "EntityDataModel", "entityDataModel", ",", "Object", "entity", ")", "throws", "ODataEdmException", "{", "Key", "entityKey", "=", "getAndCheckEntityType", "(", "entityDataModel", ",", "entity", ".", "getClass", "(",...
Get the entity key for a given entity by inspecting the Entity Data Model. @param entityDataModel The Entity Data Model. @param entity The given entity. @return The String representation of the entity key. @throws ODataEdmException If unable to format entity key
[ "Get", "the", "entity", "key", "for", "a", "given", "entity", "by", "inspecting", "the", "Entity", "Data", "Model", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L696-L718
tango-controls/JTango
dao/src/main/java/fr/esrf/TangoDs/DeviceClass.java
DeviceClass.command_handler
public Any command_handler(final DeviceImpl device, final String command, final Any in_any) throws DevFailed { Any ret = Util.instance().get_orb().create_any(); Util.out4.println("Entering DeviceClass::command_handler() method"); int i; final String cmd_name = command.toLowerCase(); for (i = 0; i < command_list.size(); i++) { final Command cmd = (Command) command_list.elementAt(i); if (cmd.get_name().toLowerCase().equals(cmd_name) == true) { // // Call the always executed method // device.always_executed_hook(); // // Check if the command is allowed // if (cmd.is_allowed(device, in_any) == false) { final StringBuffer o = new StringBuffer("Command "); o.append(command); o.append(" not allowed when the device is in "); o.append(Tango_DevStateName[device.get_state().value()]); o.append(" state"); Except.throw_exception("API_CommandNotAllowed", o.toString(), "DeviceClass.command_handler"); } // // Execute the command // ret = cmd.execute(device, in_any); break; } } if (i == command_list.size()) { Util.out3.println("DeviceClass.command_handler(): command " + command + " not found"); // // throw an exception to client // Except.throw_exception("API_CommandNotFound", "Command " + command + " not found", "DeviceClass.command_handler"); } Util.out4.println("Leaving DeviceClass.command_handler() method"); return ret; }
java
public Any command_handler(final DeviceImpl device, final String command, final Any in_any) throws DevFailed { Any ret = Util.instance().get_orb().create_any(); Util.out4.println("Entering DeviceClass::command_handler() method"); int i; final String cmd_name = command.toLowerCase(); for (i = 0; i < command_list.size(); i++) { final Command cmd = (Command) command_list.elementAt(i); if (cmd.get_name().toLowerCase().equals(cmd_name) == true) { // // Call the always executed method // device.always_executed_hook(); // // Check if the command is allowed // if (cmd.is_allowed(device, in_any) == false) { final StringBuffer o = new StringBuffer("Command "); o.append(command); o.append(" not allowed when the device is in "); o.append(Tango_DevStateName[device.get_state().value()]); o.append(" state"); Except.throw_exception("API_CommandNotAllowed", o.toString(), "DeviceClass.command_handler"); } // // Execute the command // ret = cmd.execute(device, in_any); break; } } if (i == command_list.size()) { Util.out3.println("DeviceClass.command_handler(): command " + command + " not found"); // // throw an exception to client // Except.throw_exception("API_CommandNotFound", "Command " + command + " not found", "DeviceClass.command_handler"); } Util.out4.println("Leaving DeviceClass.command_handler() method"); return ret; }
[ "public", "Any", "command_handler", "(", "final", "DeviceImpl", "device", ",", "final", "String", "command", ",", "final", "Any", "in_any", ")", "throws", "DevFailed", "{", "Any", "ret", "=", "Util", ".", "instance", "(", ")", ".", "get_orb", "(", ")", "...
Execute a command. <p> It looks for the correct command object in the command object vector. If the command is found, it invoke the <i>always_executed_hook</i> method. Check if the command is allowed by invoking the <i>is_allowed</i> method If the command is allowed, invokes the <i>execute</i> method. @param device The device on which the command must be executed @param command The command name @param in_any The command input data still packed in a CORBA Any object @return A CORBA Any object with the output data packed in @throws DevFailed If the command is not found, if the command is not allowed in the actual device state and re-throws of all the exception thrown by the <i>always_executed_hook</i>, <i>is_alloed</i> and <i>execute</i> methods. Click <a href= "../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read <b>DevFailed</b> exception specification
[ "Execute", "a", "command", ".", "<p", ">", "It", "looks", "for", "the", "correct", "command", "object", "in", "the", "command", "object", "vector", ".", "If", "the", "command", "is", "found", "it", "invoke", "the", "<i", ">", "always_executed_hook<", "/", ...
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/DeviceClass.java#L356-L410
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java
AnimationInteractivityManager.ConvertDirectionalVectorToQuaternion
public Quaternionf ConvertDirectionalVectorToQuaternion(Vector3f d) { d.negate(); Quaternionf q = new Quaternionf(); // check for exception condition if ((d.x == 0) && (d.z == 0)) { // exception condition if direction is (0,y,0): // straight up, straight down or all zero's. if (d.y > 0) { // direction straight up AxisAngle4f angleAxis = new AxisAngle4f(-(float) Math.PI / 2, 1, 0, 0); q.set(angleAxis); } else if (d.y < 0) { // direction straight down AxisAngle4f angleAxis = new AxisAngle4f((float) Math.PI / 2, 1, 0, 0); q.set(angleAxis); } else { // All zero's. Just set to identity quaternion q.identity(); } } else { d.normalize(); Vector3f up = new Vector3f(0, 1, 0); Vector3f s = new Vector3f(); d.cross(up, s); s.normalize(); Vector3f u = new Vector3f(); d.cross(s, u); u.normalize(); Matrix4f matrix = new Matrix4f(s.x, s.y, s.z, 0, u.x, u.y, u.z, 0, d.x, d.y, d.z, 0, 0, 0, 0, 1); q.setFromNormalized(matrix); } return q; }
java
public Quaternionf ConvertDirectionalVectorToQuaternion(Vector3f d) { d.negate(); Quaternionf q = new Quaternionf(); // check for exception condition if ((d.x == 0) && (d.z == 0)) { // exception condition if direction is (0,y,0): // straight up, straight down or all zero's. if (d.y > 0) { // direction straight up AxisAngle4f angleAxis = new AxisAngle4f(-(float) Math.PI / 2, 1, 0, 0); q.set(angleAxis); } else if (d.y < 0) { // direction straight down AxisAngle4f angleAxis = new AxisAngle4f((float) Math.PI / 2, 1, 0, 0); q.set(angleAxis); } else { // All zero's. Just set to identity quaternion q.identity(); } } else { d.normalize(); Vector3f up = new Vector3f(0, 1, 0); Vector3f s = new Vector3f(); d.cross(up, s); s.normalize(); Vector3f u = new Vector3f(); d.cross(s, u); u.normalize(); Matrix4f matrix = new Matrix4f(s.x, s.y, s.z, 0, u.x, u.y, u.z, 0, d.x, d.y, d.z, 0, 0, 0, 0, 1); q.setFromNormalized(matrix); } return q; }
[ "public", "Quaternionf", "ConvertDirectionalVectorToQuaternion", "(", "Vector3f", "d", ")", "{", "d", ".", "negate", "(", ")", ";", "Quaternionf", "q", "=", "new", "Quaternionf", "(", ")", ";", "// check for exception condition", "if", "(", "(", "d", ".", "x",...
Converts a vector into a quaternion. Used for the direction of spot and directional lights Called upon initialization and updates to those vectors @param d
[ "Converts", "a", "vector", "into", "a", "quaternion", ".", "Used", "for", "the", "direction", "of", "spot", "and", "directional", "lights", "Called", "upon", "initialization", "and", "updates", "to", "those", "vectors" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java#L2701-L2732
indeedeng/util
io/src/main/java/com/indeed/util/io/Files.java
Files.deleteOrDie
public static boolean deleteOrDie(@Nonnull final String file) throws IOException { // this returns true if the file was actually deleted // and false for 2 cases: // 1. file did not exist to start with // 2. File.delete() failed at some point for some reason // so we disambiguate the 'false' case below by checking for file existence final boolean fileWasDeleted = delete(file); if (fileWasDeleted) { // file was definitely deleted return true; } else { final File fileObj = new File(file); if (fileObj.exists()) { throw new IOException("File still exists after erasure, cannot write object to file: " + file); } // file was not deleted, because it does not exist return false; } }
java
public static boolean deleteOrDie(@Nonnull final String file) throws IOException { // this returns true if the file was actually deleted // and false for 2 cases: // 1. file did not exist to start with // 2. File.delete() failed at some point for some reason // so we disambiguate the 'false' case below by checking for file existence final boolean fileWasDeleted = delete(file); if (fileWasDeleted) { // file was definitely deleted return true; } else { final File fileObj = new File(file); if (fileObj.exists()) { throw new IOException("File still exists after erasure, cannot write object to file: " + file); } // file was not deleted, because it does not exist return false; } }
[ "public", "static", "boolean", "deleteOrDie", "(", "@", "Nonnull", "final", "String", "file", ")", "throws", "IOException", "{", "// this returns true if the file was actually deleted\r", "// and false for 2 cases:\r", "// 1. file did not exist to start with\r", "// 2. File.del...
Deletes file or recursively deletes a directory @param file path to erase @return true if all deletions were successful, false if file did not exist @throws IOException if deletion fails and the file still exists at the end
[ "Deletes", "file", "or", "recursively", "deletes", "a", "directory" ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L726-L746
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_privateDatabase_serviceName_ram_duration_POST
public OvhOrder hosting_privateDatabase_serviceName_ram_duration_POST(String serviceName, String duration, OvhAvailableRamSizeEnum ram) throws IOException { String qPath = "/order/hosting/privateDatabase/{serviceName}/ram/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ram", ram); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder hosting_privateDatabase_serviceName_ram_duration_POST(String serviceName, String duration, OvhAvailableRamSizeEnum ram) throws IOException { String qPath = "/order/hosting/privateDatabase/{serviceName}/ram/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ram", ram); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "hosting_privateDatabase_serviceName_ram_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhAvailableRamSizeEnum", "ram", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/privateDatabase/{serviceNa...
Create order REST: POST /order/hosting/privateDatabase/{serviceName}/ram/{duration} @param ram [required] Private database ram size @param serviceName [required] The internal name of your private database @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5184-L5191
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.toStringBinary
public static String toStringBinary(final byte [] b, int off, int len) { StringBuilder result = new StringBuilder(); try { String first = new String(b, off, len, "ISO-8859-1"); for (int i = 0; i < first.length(); ++i) { int ch = first.charAt(i) & 0xFF; if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || " `~!@#$%^&*()-_=+[]{}\\|;:'\",.<>/?".indexOf(ch) >= 0) { result.append(first.charAt(i)); } else { result.append(String.format("\\x%02X", ch)); } } } catch (UnsupportedEncodingException e) { } return result.toString(); }
java
public static String toStringBinary(final byte [] b, int off, int len) { StringBuilder result = new StringBuilder(); try { String first = new String(b, off, len, "ISO-8859-1"); for (int i = 0; i < first.length(); ++i) { int ch = first.charAt(i) & 0xFF; if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || " `~!@#$%^&*()-_=+[]{}\\|;:'\",.<>/?".indexOf(ch) >= 0) { result.append(first.charAt(i)); } else { result.append(String.format("\\x%02X", ch)); } } } catch (UnsupportedEncodingException e) { } return result.toString(); }
[ "public", "static", "String", "toStringBinary", "(", "final", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "String", "first", "=", "new", "Stri...
Write a printable representation of a byte array. Non-printable characters are hex escaped in the format \\x%02X, eg: \x00 \x05 etc @param b array to write out @param off offset to start at @param len length to write @return string output
[ "Write", "a", "printable", "representation", "of", "a", "byte", "array", ".", "Non", "-", "printable", "characters", "are", "hex", "escaped", "in", "the", "format", "\\\\", "x%02X", "eg", ":", "\\", "x00", "\\", "x05", "etc" ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L231-L249
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.offlineRegion
public void offlineRegion(String resourceGroupName, String accountName, String region) { offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body(); }
java
public void offlineRegion(String resourceGroupName, String accountName, String region) { offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body(); }
[ "public", "void", "offlineRegion", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "region", ")", "{", "offlineRegionWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "region", ")", ".", "toBlocking", "(", ...
Offline the specified region for the specified Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param region Cosmos DB region, with spaces between words and each word capitalized. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Offline", "the", "specified", "region", "for", "the", "specified", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1284-L1286
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.setTypeface
public View setTypeface(Context context, @LayoutRes int layoutRes, String typefaceName, int style) { return setTypeface(context, layoutRes, null, typefaceName, 0); }
java
public View setTypeface(Context context, @LayoutRes int layoutRes, String typefaceName, int style) { return setTypeface(context, layoutRes, null, typefaceName, 0); }
[ "public", "View", "setTypeface", "(", "Context", "context", ",", "@", "LayoutRes", "int", "layoutRes", ",", "String", "typefaceName", ",", "int", "style", ")", "{", "return", "setTypeface", "(", "context", ",", "layoutRes", ",", "null", ",", "typefaceName", ...
Set the typeface to the all text views belong to the view group. @param context the context. @param layoutRes the layout resource id. @param typefaceName typeface name. @param style the typeface style. @return the view.
[ "Set", "the", "typeface", "to", "the", "all", "text", "views", "belong", "to", "the", "view", "group", "." ]
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L265-L267
alibaba/java-dns-cache-manipulator
library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java
DnsCacheManipulator.listDnsCache
public static List<DnsCacheEntry> listDnsCache() { try { return InetAddressCacheUtil.listInetAddressCache().getCache(); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e); } }
java
public static List<DnsCacheEntry> listDnsCache() { try { return InetAddressCacheUtil.listInetAddressCache().getCache(); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e); } }
[ "public", "static", "List", "<", "DnsCacheEntry", ">", "listDnsCache", "(", ")", "{", "try", "{", "return", "InetAddressCacheUtil", ".", "listInetAddressCache", "(", ")", ".", "getCache", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw...
Get all dns cache entries. @return dns cache entries @throws DnsCacheManipulatorException Operation fail @see #getWholeDnsCache() @since 1.2.0
[ "Get", "all", "dns", "cache", "entries", "." ]
train
https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L162-L168
wildfly/wildfly-core
jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java
ObjectNameAddressUtil.createObjectName
static ObjectName createObjectName(final String domain, final PathAddress pathAddress) { return createObjectName(domain, pathAddress, null); }
java
static ObjectName createObjectName(final String domain, final PathAddress pathAddress) { return createObjectName(domain, pathAddress, null); }
[ "static", "ObjectName", "createObjectName", "(", "final", "String", "domain", ",", "final", "PathAddress", "pathAddress", ")", "{", "return", "createObjectName", "(", "domain", ",", "pathAddress", ",", "null", ")", ";", "}" ]
Creates an ObjectName representation of a {@link PathAddress}. @param domain the JMX domain to use for the ObjectName. Cannot be {@code null} @param pathAddress the address. Cannot be {@code null} @return the ObjectName. Will not return {@code null}
[ "Creates", "an", "ObjectName", "representation", "of", "a", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java#L135-L137
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java
MappingUtils.returnField
public static Object returnField(Object object, String fieldName) throws MjdbcException { AssertUtils.assertNotNull(object); Object result = null; Field field = null; try { field = object.getClass().getField(fieldName); result = field.get(object); } catch (NoSuchFieldException ex) { throw new MjdbcException(ex); } catch (IllegalAccessException ex) { throw new MjdbcException(ex); } return result; }
java
public static Object returnField(Object object, String fieldName) throws MjdbcException { AssertUtils.assertNotNull(object); Object result = null; Field field = null; try { field = object.getClass().getField(fieldName); result = field.get(object); } catch (NoSuchFieldException ex) { throw new MjdbcException(ex); } catch (IllegalAccessException ex) { throw new MjdbcException(ex); } return result; }
[ "public", "static", "Object", "returnField", "(", "Object", "object", ",", "String", "fieldName", ")", "throws", "MjdbcException", "{", "AssertUtils", ".", "assertNotNull", "(", "object", ")", ";", "Object", "result", "=", "null", ";", "Field", "field", "=", ...
Returns class field value Is used to return Constants @param object Class field of which would be returned @param fieldName field name @return field value @throws org.midao.jdbc.core.exception.MjdbcException if field is not present or access is prohibited
[ "Returns", "class", "field", "value", "Is", "used", "to", "return", "Constants" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L451-L467
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileUtil.java
FileUtil.fullyDelete
@Deprecated public static void fullyDelete(FileSystem fs, Path dir) throws IOException { fs.delete(dir, true); }
java
@Deprecated public static void fullyDelete(FileSystem fs, Path dir) throws IOException { fs.delete(dir, true); }
[ "@", "Deprecated", "public", "static", "void", "fullyDelete", "(", "FileSystem", "fs", ",", "Path", "dir", ")", "throws", "IOException", "{", "fs", ".", "delete", "(", "dir", ",", "true", ")", ";", "}" ]
Recursively delete a directory. @param fs {@link FileSystem} on which the path is present @param dir directory to recursively delete @throws IOException @deprecated Use {@link FileSystem#delete(Path, boolean)}
[ "Recursively", "delete", "a", "directory", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L120-L124
craftercms/commons
utilities/src/main/java/org/craftercms/commons/http/CookieManager.java
CookieManager.addCookie
public void addCookie(String name, String value, HttpServletResponse response) { Cookie cookie = new Cookie(name, value); cookie.setHttpOnly(httpOnly); cookie.setSecure(secure); if (StringUtils.isNotEmpty(domain)) { cookie.setDomain(domain); } if (StringUtils.isNotEmpty(path)) { cookie.setPath(path); } if (maxAge != null) { cookie.setMaxAge(maxAge); } response.addCookie(cookie); logger.debug(LOG_KEY_ADDED_COOKIE, name); }
java
public void addCookie(String name, String value, HttpServletResponse response) { Cookie cookie = new Cookie(name, value); cookie.setHttpOnly(httpOnly); cookie.setSecure(secure); if (StringUtils.isNotEmpty(domain)) { cookie.setDomain(domain); } if (StringUtils.isNotEmpty(path)) { cookie.setPath(path); } if (maxAge != null) { cookie.setMaxAge(maxAge); } response.addCookie(cookie); logger.debug(LOG_KEY_ADDED_COOKIE, name); }
[ "public", "void", "addCookie", "(", "String", "name", ",", "String", "value", ",", "HttpServletResponse", "response", ")", "{", "Cookie", "cookie", "=", "new", "Cookie", "(", "name", ",", "value", ")", ";", "cookie", ".", "setHttpOnly", "(", "httpOnly", ")...
Add a new cookie, using the configured domain, path and max age, to the response. @param name the name of the cookie @param value the value of the cookie
[ "Add", "a", "new", "cookie", "using", "the", "configured", "domain", "path", "and", "max", "age", "to", "the", "response", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/http/CookieManager.java#L71-L88
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java
MetamodelImpl.assignMappedSuperClass
public void assignMappedSuperClass(Map<Class<?>, ManagedType<?>> mappedSuperClass) { if (this.mappedSuperClassTypes == null) { this.mappedSuperClassTypes = mappedSuperClass; } else { this.mappedSuperClassTypes.putAll(mappedSuperClassTypes); } }
java
public void assignMappedSuperClass(Map<Class<?>, ManagedType<?>> mappedSuperClass) { if (this.mappedSuperClassTypes == null) { this.mappedSuperClassTypes = mappedSuperClass; } else { this.mappedSuperClassTypes.putAll(mappedSuperClassTypes); } }
[ "public", "void", "assignMappedSuperClass", "(", "Map", "<", "Class", "<", "?", ">", ",", "ManagedType", "<", "?", ">", ">", "mappedSuperClass", ")", "{", "if", "(", "this", ".", "mappedSuperClassTypes", "==", "null", ")", "{", "this", ".", "mappedSuperCla...
Adds mapped super class to mapped super class collection. @param mappedSuperClass the mappedSuperClassTypes to set
[ "Adds", "mapped", "super", "class", "to", "mapped", "super", "class", "collection", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L333-L343
GerdHolz/TOVAL
src/de/invation/code/toval/time/TimeUtils.java
TimeUtils.diffFromDate
private static Date diffFromDate(Date date, long diff, boolean clearTimeOfDay){ Date result = convertToUtilDate(convertToLocalDateTime(date).plusNanos(diff*1000000)); if(!clearTimeOfDay) return result; return clearTimeOfDay(result); }
java
private static Date diffFromDate(Date date, long diff, boolean clearTimeOfDay){ Date result = convertToUtilDate(convertToLocalDateTime(date).plusNanos(diff*1000000)); if(!clearTimeOfDay) return result; return clearTimeOfDay(result); }
[ "private", "static", "Date", "diffFromDate", "(", "Date", "date", ",", "long", "diff", ",", "boolean", "clearTimeOfDay", ")", "{", "Date", "result", "=", "convertToUtilDate", "(", "convertToLocalDateTime", "(", "date", ")", ".", "plusNanos", "(", "diff", "*", ...
Caution: Difference calculation is based on adding/subtracting milliseconds and omits time zones.<br> In some cases the method might return possibly unexpected results due to time zones.<br> When for example to the last day of CEST without time of day information (in 2016: 30.10.2016 00:00:00 000) milliseconds for one day are added, the resulting date is NOT 30.10.2016 23:00:00 000 (as expected due to one hour subtraction because of summer time) but 31.10.2016 00:00:00 000.
[ "Caution", ":", "Difference", "calculation", "is", "based", "on", "adding", "/", "subtracting", "milliseconds", "and", "omits", "time", "zones", ".", "<br", ">", "In", "some", "cases", "the", "method", "might", "return", "possibly", "unexpected", "results", "d...
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/time/TimeUtils.java#L128-L133
js-lib-com/dom
src/main/java/js/dom/w3c/DocumentImpl.java
DocumentImpl.evaluateXPathNodeNS
Element evaluateXPathNodeNS(Node contextNode, NamespaceContext namespaceContext, String expression, Object... args) { if (args.length > 0) { expression = Strings.format(expression, args); } Node node = null; try { XPath xpath = XPathFactory.newInstance().newXPath(); if (namespaceContext != null) { xpath.setNamespaceContext(namespaceContext); } Object result = xpath.evaluate(expression, contextNode, XPathConstants.NODE); if (result == null) { return null; } node = (Node) result; if (node.getNodeType() != Node.ELEMENT_NODE) { log.debug("XPath expression |%s| on |%s| yields a node that is not element. Force to null.", xpath, contextNode); return null; } } catch (XPathExpressionException e) { throw new DomException(e); } return getElement(node); }
java
Element evaluateXPathNodeNS(Node contextNode, NamespaceContext namespaceContext, String expression, Object... args) { if (args.length > 0) { expression = Strings.format(expression, args); } Node node = null; try { XPath xpath = XPathFactory.newInstance().newXPath(); if (namespaceContext != null) { xpath.setNamespaceContext(namespaceContext); } Object result = xpath.evaluate(expression, contextNode, XPathConstants.NODE); if (result == null) { return null; } node = (Node) result; if (node.getNodeType() != Node.ELEMENT_NODE) { log.debug("XPath expression |%s| on |%s| yields a node that is not element. Force to null.", xpath, contextNode); return null; } } catch (XPathExpressionException e) { throw new DomException(e); } return getElement(node); }
[ "Element", "evaluateXPathNodeNS", "(", "Node", "contextNode", ",", "NamespaceContext", "namespaceContext", ",", "String", "expression", ",", "Object", "...", "args", ")", "{", "if", "(", "args", ".", "length", ">", "0", ")", "{", "expression", "=", "Strings", ...
Name space aware variant for {@link #evaluateXPathNode(Node, String, Object...)}. @param contextNode evaluation context node, @param namespaceContext name space context maps prefixes to name space URIs, @param expression XPath expression, formatting tags supported, @param args optional formatting arguments. @return evaluation result as element, possible null.
[ "Name", "space", "aware", "variant", "for", "{", "@link", "#evaluateXPathNode", "(", "Node", "String", "Object", "...", ")", "}", "." ]
train
https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L300-L324
irmen/Pyrolite
java/src/main/java/net/razorvine/pyro/PyroProxy.java
PyroProxy.call_oneway
public void call_oneway(String method, Object... arguments) throws PickleException, PyroException, IOException { internal_call(method, null, Message.FLAGS_ONEWAY, true, arguments); }
java
public void call_oneway(String method, Object... arguments) throws PickleException, PyroException, IOException { internal_call(method, null, Message.FLAGS_ONEWAY, true, arguments); }
[ "public", "void", "call_oneway", "(", "String", "method", ",", "Object", "...", "arguments", ")", "throws", "PickleException", ",", "PyroException", ",", "IOException", "{", "internal_call", "(", "method", ",", "null", ",", "Message", ".", "FLAGS_ONEWAY", ",", ...
Call a method on the remote Pyro object this proxy is for, using Oneway call semantics (return immediately). @param method the name of the method you want to call @param arguments zero or more arguments for the remote method
[ "Call", "a", "method", "on", "the", "remote", "Pyro", "object", "this", "proxy", "is", "for", "using", "Oneway", "call", "semantics", "(", "return", "immediately", ")", "." ]
train
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pyro/PyroProxy.java#L186-L188
adyliu/jafka
src/main/java/io/jafka/producer/ZKBrokerPartitionInfo.java
ZKBrokerPartitionInfo.getZKTopicPartitionInfo
private Map<String, SortedSet<Partition>> getZKTopicPartitionInfo(Map<Integer, Broker> allBrokers) { final Map<String, SortedSet<Partition>> brokerPartitionsPerTopic = new HashMap<String, SortedSet<Partition>>(); ZkUtils.makeSurePersistentPathExists(zkClient, ZkUtils.BrokerTopicsPath); List<String> topics = ZkUtils.getChildrenParentMayNotExist(zkClient, ZkUtils.BrokerTopicsPath); for (String topic : topics) { // find the number of broker partitions registered for this topic String brokerTopicPath = ZkUtils.BrokerTopicsPath + "/" + topic; List<String> brokerList = ZkUtils.getChildrenParentMayNotExist(zkClient, brokerTopicPath); // final SortedSet<Partition> sortedBrokerPartitions = new TreeSet<Partition>(); final Set<Integer> existBids = new HashSet<Integer>(); for (String bid : brokerList) { final int ibid = Integer.parseInt(bid); final String numPath = brokerTopicPath + "/" + bid; final Integer numPartition = Integer.valueOf(ZkUtils.readData(zkClient, numPath)); for (int i = 0; i < numPartition.intValue(); i++) { sortedBrokerPartitions.add(new Partition(ibid, i)); } existBids.add(ibid); } // add all brokers after topic created for(Integer bid:allBrokers.keySet()){ if(!existBids.contains(bid)){ sortedBrokerPartitions.add(new Partition(bid,0));// this broker run after topic created } } logger.debug("Broker ids and # of partitions on each for topic: " + topic + " = " + sortedBrokerPartitions); brokerPartitionsPerTopic.put(topic, sortedBrokerPartitions); } return brokerPartitionsPerTopic; }
java
private Map<String, SortedSet<Partition>> getZKTopicPartitionInfo(Map<Integer, Broker> allBrokers) { final Map<String, SortedSet<Partition>> brokerPartitionsPerTopic = new HashMap<String, SortedSet<Partition>>(); ZkUtils.makeSurePersistentPathExists(zkClient, ZkUtils.BrokerTopicsPath); List<String> topics = ZkUtils.getChildrenParentMayNotExist(zkClient, ZkUtils.BrokerTopicsPath); for (String topic : topics) { // find the number of broker partitions registered for this topic String brokerTopicPath = ZkUtils.BrokerTopicsPath + "/" + topic; List<String> brokerList = ZkUtils.getChildrenParentMayNotExist(zkClient, brokerTopicPath); // final SortedSet<Partition> sortedBrokerPartitions = new TreeSet<Partition>(); final Set<Integer> existBids = new HashSet<Integer>(); for (String bid : brokerList) { final int ibid = Integer.parseInt(bid); final String numPath = brokerTopicPath + "/" + bid; final Integer numPartition = Integer.valueOf(ZkUtils.readData(zkClient, numPath)); for (int i = 0; i < numPartition.intValue(); i++) { sortedBrokerPartitions.add(new Partition(ibid, i)); } existBids.add(ibid); } // add all brokers after topic created for(Integer bid:allBrokers.keySet()){ if(!existBids.contains(bid)){ sortedBrokerPartitions.add(new Partition(bid,0));// this broker run after topic created } } logger.debug("Broker ids and # of partitions on each for topic: " + topic + " = " + sortedBrokerPartitions); brokerPartitionsPerTopic.put(topic, sortedBrokerPartitions); } return brokerPartitionsPerTopic; }
[ "private", "Map", "<", "String", ",", "SortedSet", "<", "Partition", ">", ">", "getZKTopicPartitionInfo", "(", "Map", "<", "Integer", ",", "Broker", ">", "allBrokers", ")", "{", "final", "Map", "<", "String", ",", "SortedSet", "<", "Partition", ">", ">", ...
Generate a sequence of (brokerId, numPartitions) for all topics registered in zookeeper @param allBrokers all register brokers @return a mapping from topic to sequence of (brokerId, numPartitions)
[ "Generate", "a", "sequence", "of", "(", "brokerId", "numPartitions", ")", "for", "all", "topics", "registered", "in", "zookeeper" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/producer/ZKBrokerPartitionInfo.java#L133-L163
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java
DBService.getColumnSlice
public Iterable<DColumn> getColumnSlice(String storeName, String rowKey, String startCol, String endCol) { DRow row = new DRow(m_tenant, storeName, rowKey); return row.getColumns(startCol, endCol, 1024); }
java
public Iterable<DColumn> getColumnSlice(String storeName, String rowKey, String startCol, String endCol) { DRow row = new DRow(m_tenant, storeName, rowKey); return row.getColumns(startCol, endCol, 1024); }
[ "public", "Iterable", "<", "DColumn", ">", "getColumnSlice", "(", "String", "storeName", ",", "String", "rowKey", ",", "String", "startCol", ",", "String", "endCol", ")", "{", "DRow", "row", "=", "new", "DRow", "(", "m_tenant", ",", "storeName", ",", "rowK...
Get columns for the row with the given key in the given store. Columns range is defined by an interval [startCol, endCol]. Columns are returned as an Iterator of {@link DColumn}s. Empty iterator is returned if no row is found with the given key or no columns in the given interval found. @param storeName Name of store to query. @param rowKey Key of row to fetch. @param startCol First name in the column names interval. @param endCol Last name in the column names interval. @return Iterator of {@link DColumn}s. If there is no such row, the iterator's hasNext() will be false.
[ "Get", "columns", "for", "the", "row", "with", "the", "given", "key", "in", "the", "given", "store", ".", "Columns", "range", "is", "defined", "by", "an", "interval", "[", "startCol", "endCol", "]", ".", "Columns", "are", "returned", "as", "an", "Iterato...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java#L258-L261
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/DateUtils.java
DateUtils.handleException
private static <E extends RuntimeException> E handleException(E ex) { if (JodaTime.hasExpectedBehavior()) return ex; throw new IllegalStateException("Joda-time 2.2 or later version is required, but found version: " + JodaTime.getVersion(), ex); }
java
private static <E extends RuntimeException> E handleException(E ex) { if (JodaTime.hasExpectedBehavior()) return ex; throw new IllegalStateException("Joda-time 2.2 or later version is required, but found version: " + JodaTime.getVersion(), ex); }
[ "private", "static", "<", "E", "extends", "RuntimeException", ">", "E", "handleException", "(", "E", "ex", ")", "{", "if", "(", "JodaTime", ".", "hasExpectedBehavior", "(", ")", ")", "return", "ex", ";", "throw", "new", "IllegalStateException", "(", "\"Joda-...
Returns the original runtime exception iff the joda-time being used at runtime behaves as expected. @throws IllegalStateException if the joda-time being used at runtime doens't appear to be of the right version.
[ "Returns", "the", "original", "runtime", "exception", "iff", "the", "joda", "-", "time", "being", "used", "at", "runtime", "behaves", "as", "expected", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/DateUtils.java#L146-L150
fuinorg/utils4j
src/main/java/org/fuin/utils4j/PropertiesUtils.java
PropertiesUtils.loadProperties
public static Properties loadProperties(final String baseUrl, final String filename) { checkNotNull("baseUrl", baseUrl); checkNotNull("filename", filename); try { final URL url = new URL(baseUrl); return loadProperties(url, filename); } catch (final MalformedURLException ex) { throw new IllegalArgumentException("The argument 'srcUrl' is not a valid URL [" + baseUrl + "]!", ex); } }
java
public static Properties loadProperties(final String baseUrl, final String filename) { checkNotNull("baseUrl", baseUrl); checkNotNull("filename", filename); try { final URL url = new URL(baseUrl); return loadProperties(url, filename); } catch (final MalformedURLException ex) { throw new IllegalArgumentException("The argument 'srcUrl' is not a valid URL [" + baseUrl + "]!", ex); } }
[ "public", "static", "Properties", "loadProperties", "(", "final", "String", "baseUrl", ",", "final", "String", "filename", ")", "{", "checkNotNull", "(", "\"baseUrl\"", ",", "baseUrl", ")", ";", "checkNotNull", "(", "\"filename\"", ",", "filename", ")", ";", "...
Load a file from an directory. Wraps a possible <code>MalformedURLException</code> exception into a <code>RuntimeException</code>. @param baseUrl Directory URL as <code>String</code> - Cannot be <code>null</code>. @param filename Filename without path - Cannot be <code>null</code>. @return Properties.
[ "Load", "a", "file", "from", "an", "directory", ".", "Wraps", "a", "possible", "<code", ">", "MalformedURLException<", "/", "code", ">", "exception", "into", "a", "<code", ">", "RuntimeException<", "/", "code", ">", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesUtils.java#L180-L191
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java
ServerUpdater.removeRoleFromUser
public ServerUpdater removeRoleFromUser(User user, Role role) { delegate.removeRoleFromUser(user, role); return this; }
java
public ServerUpdater removeRoleFromUser(User user, Role role) { delegate.removeRoleFromUser(user, role); return this; }
[ "public", "ServerUpdater", "removeRoleFromUser", "(", "User", "user", ",", "Role", "role", ")", "{", "delegate", ".", "removeRoleFromUser", "(", "user", ",", "role", ")", ";", "return", "this", ";", "}" ]
Queues a role to be removed from the user. @param user The server member the role should be removed from. @param role The role which should be removed from the user. @return The current instance in order to chain call methods.
[ "Queues", "a", "role", "to", "be", "removed", "from", "the", "user", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L491-L494
googleapis/google-cloud-java
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java
NotificationChannelServiceClient.deleteNotificationChannel
public final void deleteNotificationChannel(NotificationChannelName name, boolean force) { DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder() .setName(name == null ? null : name.toString()) .setForce(force) .build(); deleteNotificationChannel(request); }
java
public final void deleteNotificationChannel(NotificationChannelName name, boolean force) { DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder() .setName(name == null ? null : name.toString()) .setForce(force) .build(); deleteNotificationChannel(request); }
[ "public", "final", "void", "deleteNotificationChannel", "(", "NotificationChannelName", "name", ",", "boolean", "force", ")", "{", "DeleteNotificationChannelRequest", "request", "=", "DeleteNotificationChannelRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "...
Deletes a notification channel. <p>Sample code: <pre><code> try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) { NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); boolean force = false; notificationChannelServiceClient.deleteNotificationChannel(name, force); } </code></pre> @param name The channel for which to execute the request. The format is `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. @param force If true, the notification channel will be deleted regardless of its use in alert policies (the policies will be updated to remove the channel). If false, channels that are still referenced by an existing alerting policy will fail to be deleted in a delete operation. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Deletes", "a", "notification", "channel", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java#L904-L912
maxirosson/jdroid-android
jdroid-android-google-maps/src/main/java/com/jdroid/android/google/maps/MapUtils.java
MapUtils.vectorToBitmap
public static BitmapDescriptor vectorToBitmap(@DrawableRes int drawableRes, @ColorRes int colorRes) { Drawable vectorDrawable = VectorDrawableCompat.create(AbstractApplication.get().getResources(), drawableRes, null); Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); DrawableCompat.setTint(vectorDrawable, AbstractApplication.get().getResources().getColor(colorRes)); vectorDrawable.draw(canvas); return BitmapDescriptorFactory.fromBitmap(bitmap); }
java
public static BitmapDescriptor vectorToBitmap(@DrawableRes int drawableRes, @ColorRes int colorRes) { Drawable vectorDrawable = VectorDrawableCompat.create(AbstractApplication.get().getResources(), drawableRes, null); Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); DrawableCompat.setTint(vectorDrawable, AbstractApplication.get().getResources().getColor(colorRes)); vectorDrawable.draw(canvas); return BitmapDescriptorFactory.fromBitmap(bitmap); }
[ "public", "static", "BitmapDescriptor", "vectorToBitmap", "(", "@", "DrawableRes", "int", "drawableRes", ",", "@", "ColorRes", "int", "colorRes", ")", "{", "Drawable", "vectorDrawable", "=", "VectorDrawableCompat", ".", "create", "(", "AbstractApplication", ".", "ge...
Convert a {@link Drawable} to a {@link BitmapDescriptor}, for use as a marker icon.
[ "Convert", "a", "{" ]
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-google-maps/src/main/java/com/jdroid/android/google/maps/MapUtils.java#L31-L39
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readOwner
public CmsUser readOwner(CmsDbContext dbc, CmsProject project) throws CmsException { return readUser(dbc, project.getOwnerId()); }
java
public CmsUser readOwner(CmsDbContext dbc, CmsProject project) throws CmsException { return readUser(dbc, project.getOwnerId()); }
[ "public", "CmsUser", "readOwner", "(", "CmsDbContext", "dbc", ",", "CmsProject", "project", ")", "throws", "CmsException", "{", "return", "readUser", "(", "dbc", ",", "project", ".", "getOwnerId", "(", ")", ")", ";", "}" ]
Reads the owner of a project.<p> @param dbc the current database context @param project the project to get the owner from @return the owner of a resource @throws CmsException if something goes wrong
[ "Reads", "the", "owner", "of", "a", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7117-L7120
killbill/killbill
util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java
InternalCallContextFactory.createInternalCallContext
public InternalCallContext createInternalCallContext(@Nullable final Long tenantRecordId, @Nullable final Long accountRecordId, final String userName, final CallOrigin callOrigin, final UserType userType, @Nullable final UUID userToken) { return createInternalCallContext(tenantRecordId, accountRecordId, userName, callOrigin, userType, userToken, null, null, null, null); }
java
public InternalCallContext createInternalCallContext(@Nullable final Long tenantRecordId, @Nullable final Long accountRecordId, final String userName, final CallOrigin callOrigin, final UserType userType, @Nullable final UUID userToken) { return createInternalCallContext(tenantRecordId, accountRecordId, userName, callOrigin, userType, userToken, null, null, null, null); }
[ "public", "InternalCallContext", "createInternalCallContext", "(", "@", "Nullable", "final", "Long", "tenantRecordId", ",", "@", "Nullable", "final", "Long", "accountRecordId", ",", "final", "String", "userName", ",", "final", "CallOrigin", "callOrigin", ",", "final",...
Create an internal call callcontext <p/> This is used by notification queue and persistent bus - accountRecordId is expected to be non null @param tenantRecordId tenant record id - if null, the default tenant record id value will be used @param accountRecordId account record id (can be null in specific use-cases, e.g. config change events in BeatrixListener) @param userName user name @param callOrigin call origin @param userType user type @param userToken user token, if any @return internal call callcontext
[ "Create", "an", "internal", "call", "callcontext", "<p", "/", ">", "This", "is", "used", "by", "notification", "queue", "and", "persistent", "bus", "-", "accountRecordId", "is", "expected", "to", "be", "non", "null" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java#L235-L238
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java
ExcelDateUtil.getJavaCalendar
public static Calendar getJavaCalendar(final double excelDate, final boolean use1904windowing) { if (isValidExcelDate(excelDate)) { int startYear = EXCEL_BASE_YEAR; int dayAdjust = -1; // Excel thinks 2/29/1900 is a valid date, which // it isn't final int wholeDays = (int) Math.floor(excelDate); if (use1904windowing) { startYear = EXCEL_WINDOWING_1904; dayAdjust = 1; // 1904 date windowing uses 1/2/1904 as the // first day } else if (wholeDays < EXCEL_FUDGE_19000229) { // Date is prior to 3/1/1900, so adjust because Excel thinks // 2/29/1900 exists // If Excel date == 2/29/1900, will become 3/1/1900 in Java // representation dayAdjust = 0; } final GregorianCalendar calendar = new GregorianCalendar(startYear, 0, wholeDays + dayAdjust); final int millisecondsInDay = (int) ((excelDate - Math.floor(excelDate)) * DAY_MILLISECONDS + HALF_MILLISEC); calendar.set(Calendar.MILLISECOND, millisecondsInDay); return calendar; } else { return null; } }
java
public static Calendar getJavaCalendar(final double excelDate, final boolean use1904windowing) { if (isValidExcelDate(excelDate)) { int startYear = EXCEL_BASE_YEAR; int dayAdjust = -1; // Excel thinks 2/29/1900 is a valid date, which // it isn't final int wholeDays = (int) Math.floor(excelDate); if (use1904windowing) { startYear = EXCEL_WINDOWING_1904; dayAdjust = 1; // 1904 date windowing uses 1/2/1904 as the // first day } else if (wholeDays < EXCEL_FUDGE_19000229) { // Date is prior to 3/1/1900, so adjust because Excel thinks // 2/29/1900 exists // If Excel date == 2/29/1900, will become 3/1/1900 in Java // representation dayAdjust = 0; } final GregorianCalendar calendar = new GregorianCalendar(startYear, 0, wholeDays + dayAdjust); final int millisecondsInDay = (int) ((excelDate - Math.floor(excelDate)) * DAY_MILLISECONDS + HALF_MILLISEC); calendar.set(Calendar.MILLISECOND, millisecondsInDay); return calendar; } else { return null; } }
[ "public", "static", "Calendar", "getJavaCalendar", "(", "final", "double", "excelDate", ",", "final", "boolean", "use1904windowing", ")", "{", "if", "(", "isValidExcelDate", "(", "excelDate", ")", ")", "{", "int", "startYear", "=", "EXCEL_BASE_YEAR", ";", "int",...
Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date. @param excelDate The Excel date. @param use1904windowing true if date uses 1904 windowing, or false if using 1900 date windowing. @return Java representation of the date without any time. @see java.util.TimeZone
[ "Given", "an", "Excel", "date", "with", "either", "1900", "or", "1904", "date", "windowing", "converts", "it", "to", "a", "java", ".", "util", ".", "Date", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java#L72-L97
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.rollingUpdateUndeploy
private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, true); }
java
private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, true); }
[ "private", "RollingUpdateOp", "rollingUpdateUndeploy", "(", "final", "ZooKeeperClient", "client", ",", "final", "RollingUpdateOpFactory", "opFactory", ",", "final", "DeploymentGroup", "deploymentGroup", ",", "final", "String", "host", ")", "{", "return", "rollingUpdateUnd...
rollingUpdateUndeploy is used to undeploy jobs during a rolling update. It enables the 'skipRedundantUndeploys' flag, which enables the redundantDeployment() check.
[ "rollingUpdateUndeploy", "is", "used", "to", "undeploy", "jobs", "during", "a", "rolling", "update", ".", "It", "enables", "the", "skipRedundantUndeploys", "flag", "which", "enables", "the", "redundantDeployment", "()", "check", "." ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1077-L1082
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.addEvidence
public static void addEvidence(ProbabilisticNetwork bn, String nodeName, String status) throws ShanksException { ProbabilisticNode node = ShanksAgentBayesianReasoningCapability .getNode(bn, nodeName); if (node.hasEvidence()) { ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node); } int states = node.getStatesSize(); for (int i = 0; i < states; i++) { if (status.equals(node.getStateAt(i))) { node.addFinding(i); try { bn.updateEvidences(); } catch (Exception e) { throw new ShanksException(e); } return; } } throw new UnknowkNodeStateException(bn, nodeName, status); }
java
public static void addEvidence(ProbabilisticNetwork bn, String nodeName, String status) throws ShanksException { ProbabilisticNode node = ShanksAgentBayesianReasoningCapability .getNode(bn, nodeName); if (node.hasEvidence()) { ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node); } int states = node.getStatesSize(); for (int i = 0; i < states; i++) { if (status.equals(node.getStateAt(i))) { node.addFinding(i); try { bn.updateEvidences(); } catch (Exception e) { throw new ShanksException(e); } return; } } throw new UnknowkNodeStateException(bn, nodeName, status); }
[ "public", "static", "void", "addEvidence", "(", "ProbabilisticNetwork", "bn", ",", "String", "nodeName", ",", "String", "status", ")", "throws", "ShanksException", "{", "ProbabilisticNode", "node", "=", "ShanksAgentBayesianReasoningCapability", ".", "getNode", "(", "b...
Add information to the Bayesian network to reason with it. @param bn @param nodeName @param status @throws ShanksException
[ "Add", "information", "to", "the", "Bayesian", "network", "to", "reason", "with", "it", "." ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L114-L134
groovy/groovy-core
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.eachRow
public void eachRow(String sql, List<Object> params, int offset, int maxRows, Closure closure) throws SQLException { eachRow(sql, params, null, offset, maxRows, closure); }
java
public void eachRow(String sql, List<Object> params, int offset, int maxRows, Closure closure) throws SQLException { eachRow(sql, params, null, offset, maxRows, closure); }
[ "public", "void", "eachRow", "(", "String", "sql", ",", "List", "<", "Object", ">", "params", ",", "int", "offset", ",", "int", "maxRows", ",", "Closure", "closure", ")", "throws", "SQLException", "{", "eachRow", "(", "sql", ",", "params", ",", "null", ...
Performs the given SQL query calling the given <code>closure</code> with each row of the result set starting at the provided <code>offset</code>, and including up to <code>maxRows</code> number of rows. The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code> that supports accessing the fields using property style notation and ordinal index values. The query may contain placeholder question marks which match the given list of parameters. <p> Note that the underlying implementation is based on either invoking <code>ResultSet.absolute()</code>, or if the ResultSet type is <code>ResultSet.TYPE_FORWARD_ONLY</code>, the <code>ResultSet.next()</code> method is invoked equivalently. The first row of a ResultSet is 1, so passing in an offset of 1 or less has no effect on the initial positioning within the result set. <p> Note that different database and JDBC driver implementations may work differently with respect to this method. Specifically, one should expect that <code>ResultSet.TYPE_FORWARD_ONLY</code> may be less efficient than a "scrollable" type. @param sql the sql statement @param params a list of parameters @param offset the 1-based offset for the first row to be processed @param maxRows the maximum number of rows to be processed @param closure called for each row with a GroovyResultSet @throws SQLException if a database access error occurs
[ "Performs", "the", "given", "SQL", "query", "calling", "the", "given", "<code", ">", "closure<", "/", "code", ">", "with", "each", "row", "of", "the", "result", "set", "starting", "at", "the", "provided", "<code", ">", "offset<", "/", "code", ">", "and",...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1445-L1447
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java
Cache2kBuilder.buildForLongKey
@SuppressWarnings("unchecked") public final LongCache<V> buildForLongKey() { Cache2kConfiguration<K,V> cfg = config(); if (cfg.getKeyType().getType() != Long.class) { throw new IllegalArgumentException("Long key type expected, was: " + cfg.getKeyType()); } return (LongCache<V>) CacheManager.PROVIDER.createCache(manager, config()); }
java
@SuppressWarnings("unchecked") public final LongCache<V> buildForLongKey() { Cache2kConfiguration<K,V> cfg = config(); if (cfg.getKeyType().getType() != Long.class) { throw new IllegalArgumentException("Long key type expected, was: " + cfg.getKeyType()); } return (LongCache<V>) CacheManager.PROVIDER.createCache(manager, config()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "LongCache", "<", "V", ">", "buildForLongKey", "(", ")", "{", "Cache2kConfiguration", "<", "K", ",", "V", ">", "cfg", "=", "config", "(", ")", ";", "if", "(", "cfg", ".", "getKeyType"...
Builds a cache with the specified configuration parameters. The behavior is identical to {@link #build()} except that it checks that the key type is {@code Integer} and casts the created cache to the specialized interface. @throws IllegalArgumentException if a cache of the same name is already active in the cache manager @throws IllegalArgumentException if key type is unexpected @throws IllegalArgumentException if a configuration entry for the named cache is required but not present
[ "Builds", "a", "cache", "with", "the", "specified", "configuration", "parameters", ".", "The", "behavior", "is", "identical", "to", "{", "@link", "#build", "()", "}", "except", "that", "it", "checks", "that", "the", "key", "type", "is", "{", "@code", "Inte...
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java#L906-L913
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java
URIUtils.newURIBuilder
public static StringBuilder newURIBuilder(String scheme, String server, int port) { StringBuilder builder = new StringBuilder(); appendSchemeHostPort(builder, scheme, server, port); return builder; }
java
public static StringBuilder newURIBuilder(String scheme, String server, int port) { StringBuilder builder = new StringBuilder(); appendSchemeHostPort(builder, scheme, server, port); return builder; }
[ "public", "static", "StringBuilder", "newURIBuilder", "(", "String", "scheme", ",", "String", "server", ",", "int", "port", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "appendSchemeHostPort", "(", "builder", ",", "scheme", ...
Create a new URI StringBuilder from the arguments, handling IPv6 host encoding and default ports @param scheme the URI scheme @param server the URI server @param port the URI port @return a StringBuilder containing URI prefix
[ "Create", "a", "new", "URI", "StringBuilder", "from", "the", "arguments", "handling", "IPv6", "host", "encoding", "and", "default", "ports" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L856-L860
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java
NetworkConfig.setPeerProperties
public void setPeerProperties(String name, Properties properties) throws InvalidArgumentException { setNodeProperties("Peer", name, peers, properties); }
java
public void setPeerProperties(String name, Properties properties) throws InvalidArgumentException { setNodeProperties("Peer", name, peers, properties); }
[ "public", "void", "setPeerProperties", "(", "String", "name", ",", "Properties", "properties", ")", "throws", "InvalidArgumentException", "{", "setNodeProperties", "(", "\"Peer\"", ",", "name", ",", "peers", ",", "properties", ")", ";", "}" ]
Set a specific peer's properties. @param name The name of the peer's property to set. @param properties The properties to set. @throws InvalidArgumentException
[ "Set", "a", "specific", "peer", "s", "properties", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java#L176-L178
thombergs/docx-stamper
src/main/java/org/wickedsource/docxstamper/processor/CommentProcessorRegistry.java
CommentProcessorRegistry.runProcessorsOnInlineContent
private <T> void runProcessorsOnInlineContent(ProxyBuilder<T> proxyBuilder, ParagraphCoordinates paragraphCoordinates) { ParagraphWrapper paragraph = new ParagraphWrapper(paragraphCoordinates.getParagraph()); List<String> processorExpressions = expressionUtil .findProcessorExpressions(paragraph.getText()); for (String processorExpression : processorExpressions) { String strippedExpression = expressionUtil.stripExpression(processorExpression); for (final ICommentProcessor processor : commentProcessors) { Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor); proxyBuilder.withInterface(commentProcessorInterface, processor); processor.setCurrentParagraphCoordinates(paragraphCoordinates); } try { T contextRootProxy = proxyBuilder.build(); expressionResolver.resolveExpression(strippedExpression, contextRootProxy); placeholderReplacer.replace(paragraph, processorExpression, null); logger.debug(String.format( "Processor expression '%s' has been successfully processed by a comment processor.", processorExpression)); } catch (SpelEvaluationException | SpelParseException e) { if (failOnInvalidExpression) { throw new UnresolvedExpressionException(strippedExpression, e); } else { logger.warn(String.format( "Skipping processor expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.", processorExpression, e.getMessage())); logger.trace("Reason for skipping processor expression: ", e); } } catch (ProxyException e) { throw new DocxStamperException("Could not create a proxy around context root object", e); } } }
java
private <T> void runProcessorsOnInlineContent(ProxyBuilder<T> proxyBuilder, ParagraphCoordinates paragraphCoordinates) { ParagraphWrapper paragraph = new ParagraphWrapper(paragraphCoordinates.getParagraph()); List<String> processorExpressions = expressionUtil .findProcessorExpressions(paragraph.getText()); for (String processorExpression : processorExpressions) { String strippedExpression = expressionUtil.stripExpression(processorExpression); for (final ICommentProcessor processor : commentProcessors) { Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor); proxyBuilder.withInterface(commentProcessorInterface, processor); processor.setCurrentParagraphCoordinates(paragraphCoordinates); } try { T contextRootProxy = proxyBuilder.build(); expressionResolver.resolveExpression(strippedExpression, contextRootProxy); placeholderReplacer.replace(paragraph, processorExpression, null); logger.debug(String.format( "Processor expression '%s' has been successfully processed by a comment processor.", processorExpression)); } catch (SpelEvaluationException | SpelParseException e) { if (failOnInvalidExpression) { throw new UnresolvedExpressionException(strippedExpression, e); } else { logger.warn(String.format( "Skipping processor expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.", processorExpression, e.getMessage())); logger.trace("Reason for skipping processor expression: ", e); } } catch (ProxyException e) { throw new DocxStamperException("Could not create a proxy around context root object", e); } } }
[ "private", "<", "T", ">", "void", "runProcessorsOnInlineContent", "(", "ProxyBuilder", "<", "T", ">", "proxyBuilder", ",", "ParagraphCoordinates", "paragraphCoordinates", ")", "{", "ParagraphWrapper", "paragraph", "=", "new", "ParagraphWrapper", "(", "paragraphCoordinat...
Finds all processor expressions within the specified paragraph and tries to evaluate it against all registered {@link ICommentProcessor}s. @param proxyBuilder a builder for a proxy around the context root object to customize its interface @param paragraphCoordinates the paragraph to process. @param <T> type of the context root object
[ "Finds", "all", "processor", "expressions", "within", "the", "specified", "paragraph", "and", "tries", "to", "evaluate", "it", "against", "all", "registered", "{", "@link", "ICommentProcessor", "}", "s", "." ]
train
https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/processor/CommentProcessorRegistry.java#L112-L148
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/ScanAdapter.java
ScanAdapter.buildFilter
public Filters.Filter buildFilter(Scan scan, ReadHooks hooks) { ChainFilter chain = FILTERS.chain(); Optional<Filters.Filter> familyFilter = createColumnFamilyFilter(scan); if (familyFilter.isPresent()) { chain.filter(familyFilter.get()); } if (scan.getTimeRange() != null && !scan.getTimeRange().isAllTime()) { chain.filter(createTimeRangeFilter(scan.getTimeRange())); } if (scan.getMaxVersions() != Integer.MAX_VALUE) { chain.filter(createColumnLimitFilter(scan.getMaxVersions())); } Optional<Filters.Filter> userFilter = createUserFilter(scan, hooks); if (userFilter.isPresent()) { chain.filter(userFilter.get()); } return chain; }
java
public Filters.Filter buildFilter(Scan scan, ReadHooks hooks) { ChainFilter chain = FILTERS.chain(); Optional<Filters.Filter> familyFilter = createColumnFamilyFilter(scan); if (familyFilter.isPresent()) { chain.filter(familyFilter.get()); } if (scan.getTimeRange() != null && !scan.getTimeRange().isAllTime()) { chain.filter(createTimeRangeFilter(scan.getTimeRange())); } if (scan.getMaxVersions() != Integer.MAX_VALUE) { chain.filter(createColumnLimitFilter(scan.getMaxVersions())); } Optional<Filters.Filter> userFilter = createUserFilter(scan, hooks); if (userFilter.isPresent()) { chain.filter(userFilter.get()); } return chain; }
[ "public", "Filters", ".", "Filter", "buildFilter", "(", "Scan", "scan", ",", "ReadHooks", "hooks", ")", "{", "ChainFilter", "chain", "=", "FILTERS", ".", "chain", "(", ")", ";", "Optional", "<", "Filters", ".", "Filter", ">", "familyFilter", "=", "createCo...
Given a {@link Scan}, build a {@link Filters.Filter} that include matching columns @param scan a {@link Scan} object. @param hooks a {@link ReadHooks} object. @return a {@link Filters.Filter} object.
[ "Given", "a", "{", "@link", "Scan", "}", "build", "a", "{", "@link", "Filters", ".", "Filter", "}", "that", "include", "matching", "columns" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/ScanAdapter.java#L117-L138
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_senders_sender_DELETE
public void serviceName_senders_sender_DELETE(String serviceName, String sender) throws IOException { String qPath = "/sms/{serviceName}/senders/{sender}"; StringBuilder sb = path(qPath, serviceName, sender); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_senders_sender_DELETE(String serviceName, String sender) throws IOException { String qPath = "/sms/{serviceName}/senders/{sender}"; StringBuilder sb = path(qPath, serviceName, sender); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_senders_sender_DELETE", "(", "String", "serviceName", ",", "String", "sender", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/senders/{sender}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", "...
Delete the sms sender given REST: DELETE /sms/{serviceName}/senders/{sender} @param serviceName [required] The internal name of your SMS offer @param sender [required] The sms sender
[ "Delete", "the", "sms", "sender", "given" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L210-L214
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java
DefaultVelocityEngine.restoreTemplateScope
private void restoreTemplateScope(InternalContextAdapterImpl ica, Scope currentTemplateScope) { if (currentTemplateScope.getParent() != null) { ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getParent()); } else if (currentTemplateScope.getReplaced() != null) { ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getReplaced()); } else { ica.remove(TEMPLATE_SCOPE_NAME); } }
java
private void restoreTemplateScope(InternalContextAdapterImpl ica, Scope currentTemplateScope) { if (currentTemplateScope.getParent() != null) { ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getParent()); } else if (currentTemplateScope.getReplaced() != null) { ica.put(TEMPLATE_SCOPE_NAME, currentTemplateScope.getReplaced()); } else { ica.remove(TEMPLATE_SCOPE_NAME); } }
[ "private", "void", "restoreTemplateScope", "(", "InternalContextAdapterImpl", "ica", ",", "Scope", "currentTemplateScope", ")", "{", "if", "(", "currentTemplateScope", ".", "getParent", "(", ")", "!=", "null", ")", "{", "ica", ".", "put", "(", "TEMPLATE_SCOPE_NAME...
Restore the previous {@code $template} variable, if any, in the velocity context. @param ica the current velocity context @param currentTemplateScope the current Scope, from which to take the replaced variable
[ "Restore", "the", "previous", "{", "@code", "$template", "}", "variable", "if", "any", "in", "the", "velocity", "context", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java#L178-L187
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserRowSync.java
UserRowSync.setRow
public void setRow(long id, TRow row) { lock.lock(); try { RowCondition rowCondition = rows.remove(id); if (rowCondition != null) { rowCondition.row = row; rowCondition.condition.signalAll(); } } finally { lock.unlock(); } }
java
public void setRow(long id, TRow row) { lock.lock(); try { RowCondition rowCondition = rows.remove(id); if (rowCondition != null) { rowCondition.row = row; rowCondition.condition.signalAll(); } } finally { lock.unlock(); } }
[ "public", "void", "setRow", "(", "long", "id", ",", "TRow", "row", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "RowCondition", "rowCondition", "=", "rows", ".", "remove", "(", "id", ")", ";", "if", "(", "rowCondition", "!=", "null", "...
Set the row id, row, and notify all waiting threads to retrieve the row. @param id user row id @param row user row or null
[ "Set", "the", "row", "id", "row", "and", "notify", "all", "waiting", "threads", "to", "retrieve", "the", "row", "." ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserRowSync.java#L114-L126
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/Schema.java
Schema.storeKeyspaceInstance
public void storeKeyspaceInstance(Keyspace keyspace) { if (keyspaceInstances.containsKey(keyspace.getName())) throw new IllegalArgumentException(String.format("Keyspace %s was already initialized.", keyspace.getName())); keyspaceInstances.put(keyspace.getName(), keyspace); }
java
public void storeKeyspaceInstance(Keyspace keyspace) { if (keyspaceInstances.containsKey(keyspace.getName())) throw new IllegalArgumentException(String.format("Keyspace %s was already initialized.", keyspace.getName())); keyspaceInstances.put(keyspace.getName(), keyspace); }
[ "public", "void", "storeKeyspaceInstance", "(", "Keyspace", "keyspace", ")", "{", "if", "(", "keyspaceInstances", ".", "containsKey", "(", "keyspace", ".", "getName", "(", ")", ")", ")", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", ...
Store given Keyspace instance to the schema @param keyspace The Keyspace instance to store @throws IllegalArgumentException if Keyspace is already stored
[ "Store", "given", "Keyspace", "instance", "to", "the", "schema" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/Schema.java#L150-L156
alkacon/opencms-core
src/org/opencms/workplace/CmsDialog.java
CmsDialog.dialogButtons
public String dialogButtons(int[] buttons, String[] attributes) { StringBuffer result = new StringBuffer(256); result.append(dialogButtonRow(HTML_START)); for (int i = 0; i < buttons.length; i++) { dialogButtonsHtml(result, buttons[i], attributes[i]); } result.append(dialogButtonRow(HTML_END)); return result.toString(); }
java
public String dialogButtons(int[] buttons, String[] attributes) { StringBuffer result = new StringBuffer(256); result.append(dialogButtonRow(HTML_START)); for (int i = 0; i < buttons.length; i++) { dialogButtonsHtml(result, buttons[i], attributes[i]); } result.append(dialogButtonRow(HTML_END)); return result.toString(); }
[ "public", "String", "dialogButtons", "(", "int", "[", "]", "buttons", ",", "String", "[", "]", "attributes", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "256", ")", ";", "result", ".", "append", "(", "dialogButtonRow", "(", "HTML_S...
Builds the html for the button row under the dialog content area, including buttons.<p> @param buttons array of constants of which buttons to include in the row @param attributes array of Strings for additional button attributes @return the html for the button row under the dialog content area, including buttons
[ "Builds", "the", "html", "for", "the", "button", "row", "under", "the", "dialog", "content", "area", "including", "buttons", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L635-L644
autermann/yaml
src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java
YamlMappingNode.put
public T put(YamlNode key, BigDecimal value) { return put(key, getNodeFactory().bigDecimalNode(value)); }
java
public T put(YamlNode key, BigDecimal value) { return put(key, getNodeFactory().bigDecimalNode(value)); }
[ "public", "T", "put", "(", "YamlNode", "key", ",", "BigDecimal", "value", ")", "{", "return", "put", "(", "key", ",", "getNodeFactory", "(", ")", ".", "bigDecimalNode", "(", "value", ")", ")", ";", "}" ]
Adds the specified {@code key}/{@code value} pair to this mapping. @param key the key @param value the value @return {@code this}
[ "Adds", "the", "specified", "{", "@code", "key", "}", "/", "{", "@code", "value", "}", "pair", "to", "this", "mapping", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L708-L710
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
BigtableDataClient.readRowAsync
public ApiFuture<Row> readRowAsync(String tableId, String rowKey, @Nullable Filter filter) { return readRowAsync(tableId, ByteString.copyFromUtf8(rowKey), filter); }
java
public ApiFuture<Row> readRowAsync(String tableId, String rowKey, @Nullable Filter filter) { return readRowAsync(tableId, ByteString.copyFromUtf8(rowKey), filter); }
[ "public", "ApiFuture", "<", "Row", ">", "readRowAsync", "(", "String", "tableId", ",", "String", "rowKey", ",", "@", "Nullable", "Filter", "filter", ")", "{", "return", "readRowAsync", "(", "tableId", ",", "ByteString", ".", "copyFromUtf8", "(", "rowKey", ")...
Convenience method for asynchronously reading a single row. If the row does not exist, the future's value will be null. <p>Sample code: <pre>{@code try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) { String tableId = "[TABLE]"; // Build the filter expression Filters.Filter filter = FILTERS.chain() .filter(FILTERS.qualifier().regex("prefix.*")) .filter(FILTERS.limit().cellsPerRow(10)); ApiFuture<Row> futureResult = bigtableDataClient.readRowAsync(tableId, "key", filter); ApiFutures.addCallback(futureResult, new ApiFutureCallback<Row>() { public void onFailure(Throwable t) { if (t instanceof NotFoundException) { System.out.println("Tried to read a non-existent table"); } else { t.printStackTrace(); } } public void onSuccess(Row row) { if (result != null) { System.out.println("Got row: " + result); } } }, MoreExecutors.directExecutor()); } }</pre>
[ "Convenience", "method", "for", "asynchronously", "reading", "a", "single", "row", ".", "If", "the", "row", "does", "not", "exist", "the", "future", "s", "value", "will", "be", "null", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L375-L377
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java
AttributeConstraintRule.validateNull
private boolean validateNull(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } if (!validationObject.equals(null) || validationObject != null) { throwValidationException(((Null) annotate).message()); } return true; }
java
private boolean validateNull(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } if (!validationObject.equals(null) || validationObject != null) { throwValidationException(((Null) annotate).message()); } return true; }
[ "private", "boolean", "validateNull", "(", "Object", "validationObject", ",", "Annotation", "annotate", ")", "{", "if", "(", "checkNullObject", "(", "validationObject", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "validationObject", ".", "equals...
Checks whether a given date is that in past or not @param validationObject @param annotate @return
[ "Checks", "whether", "a", "given", "date", "is", "that", "in", "past", "or", "not" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L361-L374
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java
ExtensionsInner.beginCreateAsync
public Observable<Void> beginCreateAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, extensionName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginCreateAsync(String resourceGroupName, String clusterName, String extensionName, ExtensionInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, extensionName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "extensionName", ",", "ExtensionInner", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resource...
Creates an HDInsight cluster extension. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param extensionName The name of the cluster extension. @param parameters The cluster extensions create request. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Creates", "an", "HDInsight", "cluster", "extension", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L634-L641
google/closure-templates
java/src/com/google/template/soy/passes/PluginResolver.java
PluginResolver.nullResolver
public static PluginResolver nullResolver(Mode mode, ErrorReporter reporter) { return new PluginResolver( mode, ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), reporter); }
java
public static PluginResolver nullResolver(Mode mode, ErrorReporter reporter) { return new PluginResolver( mode, ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), reporter); }
[ "public", "static", "PluginResolver", "nullResolver", "(", "Mode", "mode", ",", "ErrorReporter", "reporter", ")", "{", "return", "new", "PluginResolver", "(", "mode", ",", "ImmutableMap", ".", "of", "(", ")", ",", "ImmutableMap", ".", "of", "(", ")", ",", ...
Returns an empty resolver. Useful for tests, or situations where it is known that no plugins will be needed.
[ "Returns", "an", "empty", "resolver", ".", "Useful", "for", "tests", "or", "situations", "where", "it", "is", "known", "that", "no", "plugins", "will", "be", "needed", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PluginResolver.java#L48-L51
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java
CalligraphyContextWrapper.onActivityCreateView
public static View onActivityCreateView(Activity activity, View parent, View view, String name, Context context, AttributeSet attr) { return get(activity).onActivityCreateView(parent, view, name, context, attr); }
java
public static View onActivityCreateView(Activity activity, View parent, View view, String name, Context context, AttributeSet attr) { return get(activity).onActivityCreateView(parent, view, name, context, attr); }
[ "public", "static", "View", "onActivityCreateView", "(", "Activity", "activity", ",", "View", "parent", ",", "View", "view", ",", "String", "name", ",", "Context", "context", ",", "AttributeSet", "attr", ")", "{", "return", "get", "(", "activity", ")", ".", ...
You only need to call this <b>IF</b> you call {@link uk.co.chrisjenx.calligraphy.CalligraphyConfig.Builder#disablePrivateFactoryInjection()} This will need to be called from the {@link android.app.Activity#onCreateView(android.view.View, String, android.content.Context, android.util.AttributeSet)} method to enable view font injection if the view is created inside the activity onCreateView. You would implement this method like so in you base activity. <pre> {@code public View onCreateView(View parent, String name, Context context, AttributeSet attrs) { return CalligraphyContextWrapper.onActivityCreateView(this, parent, super.onCreateView(parent, name, context, attrs), name, context, attrs); } } </pre> @param activity The activity the original that the ContextWrapper was attached too. @param parent Parent view from onCreateView @param view The View Created inside onCreateView or from super.onCreateView @param name The View name from onCreateView @param context The context from onCreateView @param attr The AttributeSet from onCreateView @return The same view passed in, or null if null passed in.
[ "You", "only", "need", "to", "call", "this", "<b", ">", "IF<", "/", "b", ">", "you", "call", "{", "@link", "uk", ".", "co", ".", "chrisjenx", ".", "calligraphy", ".", "CalligraphyConfig", ".", "Builder#disablePrivateFactoryInjection", "()", "}", "This", "w...
train
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyContextWrapper.java#L58-L60
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java
XmlWriter.writeBlockElement
public void writeBlockElement(String name, Object text) { startBlockElement(name); writeText(text); endBlockElement(name); }
java
public void writeBlockElement(String name, Object text) { startBlockElement(name); writeText(text); endBlockElement(name); }
[ "public", "void", "writeBlockElement", "(", "String", "name", ",", "Object", "text", ")", "{", "startBlockElement", "(", "name", ")", ";", "writeText", "(", "text", ")", ";", "endBlockElement", "(", "name", ")", ";", "}" ]
Convenience method, same as doing a startBlockElement(), writeText(text), endBlockElement().
[ "Convenience", "method", "same", "as", "doing", "a", "startBlockElement", "()", "writeText", "(", "text", ")", "endBlockElement", "()", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java#L279-L284
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.clickOnByJs
protected void clickOnByJs(PageElement toClick, Object... args) throws TechnicalException, FailureException { displayMessageAtTheBeginningOfMethod("clickOnByJs: %s in %s", toClick.toString(), toClick.getPage().getApplication()); try { Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(toClick, args))); ((JavascriptExecutor) getDriver()) .executeScript("document.evaluate(\"" + Utilities.getLocatorValue(toClick, args).replace("\"", "\\\"") + "\", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).click();"); } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK), toClick, toClick.getPage().getApplication()), true, toClick.getPage().getCallBack()); } }
java
protected void clickOnByJs(PageElement toClick, Object... args) throws TechnicalException, FailureException { displayMessageAtTheBeginningOfMethod("clickOnByJs: %s in %s", toClick.toString(), toClick.getPage().getApplication()); try { Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(toClick, args))); ((JavascriptExecutor) getDriver()) .executeScript("document.evaluate(\"" + Utilities.getLocatorValue(toClick, args).replace("\"", "\\\"") + "\", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0).click();"); } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK), toClick, toClick.getPage().getApplication()), true, toClick.getPage().getCallBack()); } }
[ "protected", "void", "clickOnByJs", "(", "PageElement", "toClick", ",", "Object", "...", "args", ")", "throws", "TechnicalException", ",", "FailureException", "{", "displayMessageAtTheBeginningOfMethod", "(", "\"clickOnByJs: %s in %s\"", ",", "toClick", ".", "toString", ...
Click on html element by Javascript. @param toClick html element @param args list of arguments to format the found selector with @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK} message (with screenshot, with exception) @throws FailureException if the scenario encounters a functional error
[ "Click", "on", "html", "element", "by", "Javascript", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L136-L146