repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
tvesalainen/util
util/src/main/java/org/vesalainen/navi/Area.java
Area.getPolar
public static Area getPolar(double latFrom, double latTo, double lonFrom, double midLon, double lonTo) { Location[] locs = new Location[5]; locs[0] = new Location(latFrom, lonFrom); locs[1] = new Location(latFrom, lonTo); locs[2] = new Location(latTo, lonFrom); locs[3] = new Location(latTo, lonTo); locs[4] = new Location(latFrom, midLon); return new ConvexArea(locs); }
java
public static Area getPolar(double latFrom, double latTo, double lonFrom, double midLon, double lonTo) { Location[] locs = new Location[5]; locs[0] = new Location(latFrom, lonFrom); locs[1] = new Location(latFrom, lonTo); locs[2] = new Location(latTo, lonFrom); locs[3] = new Location(latTo, lonTo); locs[4] = new Location(latFrom, midLon); return new ConvexArea(locs); }
[ "public", "static", "Area", "getPolar", "(", "double", "latFrom", ",", "double", "latTo", ",", "double", "lonFrom", ",", "double", "midLon", ",", "double", "lonTo", ")", "{", "Location", "[", "]", "locs", "=", "new", "Location", "[", "5", "]", ";", "lo...
Returns rectangular area. Area is limited by lat/lon coordinates. Parameter midLon determines which side of earth area lies. @param latFrom @param latTo @param lonFrom @param midLon @param lonTo @return
[ "Returns", "rectangular", "area", ".", "Area", "is", "limited", "by", "lat", "/", "lon", "coordinates", ".", "Parameter", "midLon", "determines", "which", "side", "of", "earth", "area", "lies", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Area.java#L122-L131
Clivern/Racter
src/main/java/com/clivern/racter/senders/templates/GenericTemplate.java
GenericTemplate.setElement
public Integer setElement(String title, String image_url, String subtitle) { HashMap<String, Object> element = new HashMap<String, Object>(); element.put("title", title); element.put("image_url", image_url); element.put("subtitle", subtitle); this.elements.add(element); return this.elements.size() - 1; }
java
public Integer setElement(String title, String image_url, String subtitle) { HashMap<String, Object> element = new HashMap<String, Object>(); element.put("title", title); element.put("image_url", image_url); element.put("subtitle", subtitle); this.elements.add(element); return this.elements.size() - 1; }
[ "public", "Integer", "setElement", "(", "String", "title", ",", "String", "image_url", ",", "String", "subtitle", ")", "{", "HashMap", "<", "String", ",", "Object", ">", "element", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", ...
Set Element @param title the element title @param image_url the element image url @param subtitle the element subtitle @return Integer the element index
[ "Set", "Element" ]
train
https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/GenericTemplate.java#L62-L72
JodaOrg/joda-time
src/main/java/org/joda/time/DateTimeUtils.java
DateTimeUtils.setDefaultTimeZoneNames
public static final void setDefaultTimeZoneNames(Map<String, DateTimeZone> names) { cZoneNames.set(Collections.unmodifiableMap(new HashMap<String, DateTimeZone>(names))); }
java
public static final void setDefaultTimeZoneNames(Map<String, DateTimeZone> names) { cZoneNames.set(Collections.unmodifiableMap(new HashMap<String, DateTimeZone>(names))); }
[ "public", "static", "final", "void", "setDefaultTimeZoneNames", "(", "Map", "<", "String", ",", "DateTimeZone", ">", "names", ")", "{", "cZoneNames", ".", "set", "(", "Collections", ".", "unmodifiableMap", "(", "new", "HashMap", "<", "String", ",", "DateTimeZo...
Sets the default map of time zone names. <p> The map is copied before storage. @param names the map of abbreviations to zones, not null @since 2.2
[ "Sets", "the", "default", "map", "of", "time", "zone", "names", ".", "<p", ">", "The", "map", "is", "copied", "before", "storage", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeUtils.java#L431-L433
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java
TreeUtils.addChild
public static <T extends MutableTreeNode<T>> void addChild(T parent, T child) { checkArgNotNull(parent, "parent"); parent.addChild(parent.getChildren().size(), child); }
java
public static <T extends MutableTreeNode<T>> void addChild(T parent, T child) { checkArgNotNull(parent, "parent"); parent.addChild(parent.getChildren().size(), child); }
[ "public", "static", "<", "T", "extends", "MutableTreeNode", "<", "T", ">", ">", "void", "addChild", "(", "T", "parent", ",", "T", "child", ")", "{", "checkArgNotNull", "(", "parent", ",", "\"parent\"", ")", ";", "parent", ".", "addChild", "(", "parent", ...
Adds a new child node to a given MutableTreeNode parent. @param parent the parent node @param child the child node to add
[ "Adds", "a", "new", "child", "node", "to", "a", "given", "MutableTreeNode", "parent", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/TreeUtils.java#L46-L49
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_ip_failover_id_attach_POST
public OvhFailoverIp project_serviceName_ip_failover_id_attach_POST(String serviceName, String id, String instanceId) throws IOException { String qPath = "/cloud/project/{serviceName}/ip/failover/{id}/attach"; StringBuilder sb = path(qPath, serviceName, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceId", instanceId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFailoverIp.class); }
java
public OvhFailoverIp project_serviceName_ip_failover_id_attach_POST(String serviceName, String id, String instanceId) throws IOException { String qPath = "/cloud/project/{serviceName}/ip/failover/{id}/attach"; StringBuilder sb = path(qPath, serviceName, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceId", instanceId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhFailoverIp.class); }
[ "public", "OvhFailoverIp", "project_serviceName_ip_failover_id_attach_POST", "(", "String", "serviceName", ",", "String", "id", ",", "String", "instanceId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/ip/failover/{id}/attach\"", ...
Attach failover ip to an instance REST: POST /cloud/project/{serviceName}/ip/failover/{id}/attach @param id [required] Ip id @param instanceId [required] Attach failover ip to instance @param serviceName [required] Project id
[ "Attach", "failover", "ip", "to", "an", "instance" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1293-L1300
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Action.java
Action.withArguments
public Action withArguments(java.util.Map<String, String> arguments) { setArguments(arguments); return this; }
java
public Action withArguments(java.util.Map<String, String> arguments) { setArguments(arguments); return this; }
[ "public", "Action", "withArguments", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "arguments", ")", "{", "setArguments", "(", "arguments", ")", ";", "return", "this", ";", "}" ]
<p> The job arguments used when this trigger fires. For this job run, they replace the default arguments set in the job definition itself. </p> <p> You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue itself consumes. </p> <p> For information about how to specify and consume your own Job arguments, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs in Python</a> topic in the developer guide. </p> <p> For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters Used by AWS Glue</a> topic in the developer guide. </p> @param arguments The job arguments used when this trigger fires. For this job run, they replace the default arguments set in the job definition itself.</p> <p> You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue itself consumes. </p> <p> For information about how to specify and consume your own Job arguments, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs in Python</a> topic in the developer guide. </p> <p> For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters Used by AWS Glue</a> topic in the developer guide. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "job", "arguments", "used", "when", "this", "trigger", "fires", ".", "For", "this", "job", "run", "they", "replace", "the", "default", "arguments", "set", "in", "the", "job", "definition", "itself", ".", "<", "/", "p", ">", "<p", ">",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Action.java#L240-L243
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java
A_CmsListTab.createSelectResourceButton
protected CmsPushButton createSelectResourceButton( String resourcePath, CmsUUID structureId, String title, String resourceType) { CmsPushButton result = new CmsPushButton(); result.setImageClass(I_CmsButton.CHECK_SMALL); result.setButtonStyle(ButtonStyle.FONT_ICON, null); result.setTitle(Messages.get().key(Messages.GUI_PREVIEW_BUTTON_SELECT_0)); result.addClickHandler(new SelectHandler(resourcePath, structureId, title, resourceType)); return result; }
java
protected CmsPushButton createSelectResourceButton( String resourcePath, CmsUUID structureId, String title, String resourceType) { CmsPushButton result = new CmsPushButton(); result.setImageClass(I_CmsButton.CHECK_SMALL); result.setButtonStyle(ButtonStyle.FONT_ICON, null); result.setTitle(Messages.get().key(Messages.GUI_PREVIEW_BUTTON_SELECT_0)); result.addClickHandler(new SelectHandler(resourcePath, structureId, title, resourceType)); return result; }
[ "protected", "CmsPushButton", "createSelectResourceButton", "(", "String", "resourcePath", ",", "CmsUUID", "structureId", ",", "String", "title", ",", "String", "resourceType", ")", "{", "CmsPushButton", "result", "=", "new", "CmsPushButton", "(", ")", ";", "result"...
Creates a button widget to select the specified resource.<p> @param resourcePath the item resource path @param structureId the structure id @param title the resource title @param resourceType the item resource type @return the initialized select resource button
[ "Creates", "a", "button", "widget", "to", "select", "the", "specified", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java#L550-L562
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.enableComputeNodeScheduling
public void enableComputeNodeScheduling(String poolId, String nodeId) throws BatchErrorException, IOException { enableComputeNodeScheduling(poolId, nodeId, null); }
java
public void enableComputeNodeScheduling(String poolId, String nodeId) throws BatchErrorException, IOException { enableComputeNodeScheduling(poolId, nodeId, null); }
[ "public", "void", "enableComputeNodeScheduling", "(", "String", "poolId", ",", "String", "nodeId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "enableComputeNodeScheduling", "(", "poolId", ",", "nodeId", ",", "null", ")", ";", "}" ]
Enables task scheduling on the specified compute node. @param poolId The ID of the pool. @param nodeId The ID of the compute node. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Enables", "task", "scheduling", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L411-L413
overturetool/overture
core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java
SyntaxReader.throwMessage
protected void throwMessage(int number, String message, int depth) throws ParserException, LexException { throw new ParserException(number, message, lastToken().location, depth); }
java
protected void throwMessage(int number, String message, int depth) throws ParserException, LexException { throw new ParserException(number, message, lastToken().location, depth); }
[ "protected", "void", "throwMessage", "(", "int", "number", ",", "String", "message", ",", "int", "depth", ")", "throws", "ParserException", ",", "LexException", "{", "throw", "new", "ParserException", "(", "number", ",", "message", ",", "lastToken", "(", ")", ...
Raise a {@link ParserException} with a given token depth. @param number The error number. @param message The error message. @param depth The depth of the exception (tokens read). @throws ParserException
[ "Raise", "a", "{", "@link", "ParserException", "}", "with", "a", "given", "token", "depth", ".", "@param", "number", "The", "error", "number", ".", "@param", "message", "The", "error", "message", ".", "@param", "depth", "The", "depth", "of", "the", "except...
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java#L522-L526
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/math/RandomNumbersTool.java
RandomNumbersTool.nextLong
private static long nextLong(Random rng, long n) { if (n <= 0) throw new IllegalArgumentException("n must be greater than 0"); long bits, val; do { bits = (rng.nextLong() << 1) >>> 1; val = bits % n; } while (bits - val + (n - 1) < 0L); return val; }
java
private static long nextLong(Random rng, long n) { if (n <= 0) throw new IllegalArgumentException("n must be greater than 0"); long bits, val; do { bits = (rng.nextLong() << 1) >>> 1; val = bits % n; } while (bits - val + (n - 1) < 0L); return val; }
[ "private", "static", "long", "nextLong", "(", "Random", "rng", ",", "long", "n", ")", "{", "if", "(", "n", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"n must be greater than 0\"", ")", ";", "long", "bits", ",", "val", ";", "do", "...
Access the next long random number between 0 and n. @param rng random number generator @param n max value @return a long random number between 0 and n @see <a href="http://stackoverflow.com/questions/2546078/java-random-long-number-in-0-x-n-range">Random Long Number in range, Stack Overflow</a>
[ "Access", "the", "next", "long", "random", "number", "between", "0", "and", "n", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/math/RandomNumbersTool.java#L140-L148
lastaflute/lastaflute
src/main/java/org/lastaflute/web/ruts/config/ActionMapping.java
ActionMapping.createNextJourney
public NextJourney createNextJourney(PlannedJourneyProvider journeyProvider, HtmlResponse response) { // almost copied from super String path = response.getRoutingPath(); final boolean redirectTo = response.isRedirectTo(); if (path.indexOf(":") < 0) { if (!path.startsWith("/")) { path = buildActionPath(getActionDef().getComponentName()) + path; } if (!redirectTo && isHtmlForward(path)) { path = filterHtmlPath(path); } } return newNextJourney(journeyProvider, path, redirectTo, response.isAsIs(), response.getViewObject()); }
java
public NextJourney createNextJourney(PlannedJourneyProvider journeyProvider, HtmlResponse response) { // almost copied from super String path = response.getRoutingPath(); final boolean redirectTo = response.isRedirectTo(); if (path.indexOf(":") < 0) { if (!path.startsWith("/")) { path = buildActionPath(getActionDef().getComponentName()) + path; } if (!redirectTo && isHtmlForward(path)) { path = filterHtmlPath(path); } } return newNextJourney(journeyProvider, path, redirectTo, response.isAsIs(), response.getViewObject()); }
[ "public", "NextJourney", "createNextJourney", "(", "PlannedJourneyProvider", "journeyProvider", ",", "HtmlResponse", "response", ")", "{", "// almost copied from super", "String", "path", "=", "response", ".", "getRoutingPath", "(", ")", ";", "final", "boolean", "redire...
o routing path of forward e.g. /member/list/ -> MemberListAction
[ "o", "routing", "path", "of", "forward", "e", ".", "g", ".", "/", "member", "/", "list", "/", "-", ">", "MemberListAction" ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/ruts/config/ActionMapping.java#L126-L138
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/helper/ItemAdapter.java
ItemAdapter.getItemDetail
private ItemDetail getItemDetail(Gson gson, JsonElement itemType, JsonElement detail) { if (itemType == null || detail == null) return null; Item.Type type = gson.fromJson(itemType, Item.Type.class); Class<? extends ItemDetail> detailType; switch (type) { case Armor: detailType = Armor.class; break; case Back: detailType = Back.class; break; case Bag: detailType = Bag.class; break; case Consumable: detailType = Consumable.class; break; case MiniPet: detailType = Mini.class; break; case Trinket: detailType = Trinket.class; break; case UpgradeComponent: detailType = UpgradeComponent.class; break; case Weapon: detailType = Weapon.class; break; default: detailType = Utility.class; } return gson.fromJson(detail, detailType); }
java
private ItemDetail getItemDetail(Gson gson, JsonElement itemType, JsonElement detail) { if (itemType == null || detail == null) return null; Item.Type type = gson.fromJson(itemType, Item.Type.class); Class<? extends ItemDetail> detailType; switch (type) { case Armor: detailType = Armor.class; break; case Back: detailType = Back.class; break; case Bag: detailType = Bag.class; break; case Consumable: detailType = Consumable.class; break; case MiniPet: detailType = Mini.class; break; case Trinket: detailType = Trinket.class; break; case UpgradeComponent: detailType = UpgradeComponent.class; break; case Weapon: detailType = Weapon.class; break; default: detailType = Utility.class; } return gson.fromJson(detail, detailType); }
[ "private", "ItemDetail", "getItemDetail", "(", "Gson", "gson", ",", "JsonElement", "itemType", ",", "JsonElement", "detail", ")", "{", "if", "(", "itemType", "==", "null", "||", "detail", "==", "null", ")", "return", "null", ";", "Item", ".", "Type", "type...
get the correct type of item detail, will give null if itemType/detail is empty
[ "get", "the", "correct", "type", "of", "item", "detail", "will", "give", "null", "if", "itemType", "/", "detail", "is", "empty" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/helper/ItemAdapter.java#L50-L86
zaproxy/zaproxy
src/org/zaproxy/zap/extension/httppanel/view/util/HttpTextViewUtils.java
HttpTextViewUtils.validateStartEnd
private static void validateStartEnd(int start, int end) { if (start < 0) { throw new IllegalArgumentException("Parameter start must not be negative."); } if (end < 0) { throw new IllegalArgumentException("Parameter end must not be negative."); } if (start > end) { throw new IllegalArgumentException("Parameter start must not be greater than end."); } }
java
private static void validateStartEnd(int start, int end) { if (start < 0) { throw new IllegalArgumentException("Parameter start must not be negative."); } if (end < 0) { throw new IllegalArgumentException("Parameter end must not be negative."); } if (start > end) { throw new IllegalArgumentException("Parameter start must not be greater than end."); } }
[ "private", "static", "void", "validateStartEnd", "(", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter start must not be negative.\"", ")", ";", "}", "if", "(", ...
Validates the given {@code start} and {@code end} positions. @param start the start position to be validated @param end the end position to be validated @throws IllegalArgumentException if any of the conditions is true: <ul> <li>the {@code start} position is negative;</li> <li>the {@code end} position is negative;</li> <li>the {@code start} position is greater than the {@code end} position.</li> </ul>
[ "Validates", "the", "given", "{", "@code", "start", "}", "and", "{", "@code", "end", "}", "positions", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httppanel/view/util/HttpTextViewUtils.java#L145-L155
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CasVersion.java
CasVersion.getDateTime
@SneakyThrows public static ZonedDateTime getDateTime() { val clazz = CasVersion.class; val resource = clazz.getResource(clazz.getSimpleName() + ".class"); if ("file".equals(resource.getProtocol())) { return DateTimeUtils.zonedDateTimeOf(new File(resource.toURI()).lastModified()); } if ("jar".equals(resource.getProtocol())) { val path = resource.getPath(); val file = new File(path.substring(JAR_PROTOCOL_STARTING_INDEX, path.indexOf('!'))); return DateTimeUtils.zonedDateTimeOf(file.lastModified()); } if ("vfs".equals(resource.getProtocol())) { val file = new VfsResource(resource.openConnection().getContent()).getFile(); return DateTimeUtils.zonedDateTimeOf(file.lastModified()); } LOGGER.warn("Unhandled url protocol: [{}] resource: [{}]", resource.getProtocol(), resource); return ZonedDateTime.now(ZoneOffset.UTC); }
java
@SneakyThrows public static ZonedDateTime getDateTime() { val clazz = CasVersion.class; val resource = clazz.getResource(clazz.getSimpleName() + ".class"); if ("file".equals(resource.getProtocol())) { return DateTimeUtils.zonedDateTimeOf(new File(resource.toURI()).lastModified()); } if ("jar".equals(resource.getProtocol())) { val path = resource.getPath(); val file = new File(path.substring(JAR_PROTOCOL_STARTING_INDEX, path.indexOf('!'))); return DateTimeUtils.zonedDateTimeOf(file.lastModified()); } if ("vfs".equals(resource.getProtocol())) { val file = new VfsResource(resource.openConnection().getContent()).getFile(); return DateTimeUtils.zonedDateTimeOf(file.lastModified()); } LOGGER.warn("Unhandled url protocol: [{}] resource: [{}]", resource.getProtocol(), resource); return ZonedDateTime.now(ZoneOffset.UTC); }
[ "@", "SneakyThrows", "public", "static", "ZonedDateTime", "getDateTime", "(", ")", "{", "val", "clazz", "=", "CasVersion", ".", "class", ";", "val", "resource", "=", "clazz", ".", "getResource", "(", "clazz", ".", "getSimpleName", "(", ")", "+", "\".class\""...
Gets last modified date/time for the module. @return the date/time
[ "Gets", "last", "modified", "date", "/", "time", "for", "the", "module", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CasVersion.java#L57-L75
phax/ph-commons
ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java
PDTHelper.getStartWeekOfMonth
public static int getStartWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale) { return getWeekOfWeekBasedYear (aDT.withDayOfMonth (1), aLocale); }
java
public static int getStartWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale) { return getWeekOfWeekBasedYear (aDT.withDayOfMonth (1), aLocale); }
[ "public", "static", "int", "getStartWeekOfMonth", "(", "@", "Nonnull", "final", "LocalDateTime", "aDT", ",", "@", "Nonnull", "final", "Locale", "aLocale", ")", "{", "return", "getWeekOfWeekBasedYear", "(", "aDT", ".", "withDayOfMonth", "(", "1", ")", ",", "aLo...
Get the start--week number for the passed year and month. @param aDT The object to use year and month from. @param aLocale Locale to use. May not be <code>null</code>. @return the start week number.
[ "Get", "the", "start", "--", "week", "number", "for", "the", "passed", "year", "and", "month", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L207-L210
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createProgressBarIndeterminatePattern
public Shape createProgressBarIndeterminatePattern(int x, int y, int w, int h) { final double wHalf = w / 2.0; final double xOffset = 5; path.reset(); path.moveTo(xOffset, 0); path.lineTo(xOffset+wHalf, 0); path.curveTo(xOffset+wHalf-5, h/2-4, xOffset+wHalf+5, h/2+4, xOffset+wHalf, h); path.lineTo(xOffset, h); path.curveTo(xOffset+5, h/2+4, xOffset-5, h/2-4, xOffset, 0); path.closePath(); return path; }
java
public Shape createProgressBarIndeterminatePattern(int x, int y, int w, int h) { final double wHalf = w / 2.0; final double xOffset = 5; path.reset(); path.moveTo(xOffset, 0); path.lineTo(xOffset+wHalf, 0); path.curveTo(xOffset+wHalf-5, h/2-4, xOffset+wHalf+5, h/2+4, xOffset+wHalf, h); path.lineTo(xOffset, h); path.curveTo(xOffset+5, h/2+4, xOffset-5, h/2-4, xOffset, 0); path.closePath(); return path; }
[ "public", "Shape", "createProgressBarIndeterminatePattern", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "final", "double", "wHalf", "=", "w", "/", "2.0", ";", "final", "double", "xOffset", "=", "5", ";", "path", ".", ...
Return a path for the patterned portion of an indeterminate progress bar. @param x the X coordinate of the upper-left corner of the region @param y the Y coordinate of the upper-left corner of the region @param w the width of the region @param h the height of the region @return a path representing the shape.
[ "Return", "a", "path", "for", "the", "patterned", "portion", "of", "an", "indeterminate", "progress", "bar", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L384-L396
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java
AbstractRedisStorage.isActiveInstance
protected boolean isActiveInstance(String instanceId, T jedis) { boolean isActive = ( System.currentTimeMillis() - getLastInstanceActiveTime(instanceId, jedis) < clusterCheckInterval); if (!isActive) { removeLastInstanceActiveTime(instanceId, jedis); } return isActive; }
java
protected boolean isActiveInstance(String instanceId, T jedis) { boolean isActive = ( System.currentTimeMillis() - getLastInstanceActiveTime(instanceId, jedis) < clusterCheckInterval); if (!isActive) { removeLastInstanceActiveTime(instanceId, jedis); } return isActive; }
[ "protected", "boolean", "isActiveInstance", "(", "String", "instanceId", ",", "T", "jedis", ")", "{", "boolean", "isActive", "=", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "getLastInstanceActiveTime", "(", "instanceId", ",", "jedis", ")", "<", "c...
Determine if the instance with the given id has been active in the last 4 minutes @param instanceId the instance to check @param jedis a thread-safe Redis connection @return true if the instance with the given id has been active in the last 4 minutes
[ "Determine", "if", "the", "instance", "with", "the", "given", "id", "has", "been", "active", "in", "the", "last", "4", "minutes" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L657-L663
mgm-tp/jfunk
jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/ConstraintFactory.java
ConstraintFactory.putToCache
private Constraint putToCache(final String id, final Constraint object) { Constraint c = this.map.put(id, object); if (c instanceof DummyConstraint) { ((DummyConstraint) c).constraint = object; return null; } return c; }
java
private Constraint putToCache(final String id, final Constraint object) { Constraint c = this.map.put(id, object); if (c instanceof DummyConstraint) { ((DummyConstraint) c).constraint = object; return null; } return c; }
[ "private", "Constraint", "putToCache", "(", "final", "String", "id", ",", "final", "Constraint", "object", ")", "{", "Constraint", "c", "=", "this", ".", "map", ".", "put", "(", "id", ",", "object", ")", ";", "if", "(", "c", "instanceof", "DummyConstrain...
Puts the given constraint object into the cache using the key id. If an existing DummyConstraint object is found in the table, the reference will be set to the constraint and the constraint will not be put into the table.
[ "Puts", "the", "given", "constraint", "object", "into", "the", "cache", "using", "the", "key", "id", ".", "If", "an", "existing", "DummyConstraint", "object", "is", "found", "in", "the", "table", "the", "reference", "will", "be", "set", "to", "the", "const...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/constraint/ConstraintFactory.java#L182-L189
alipay/sofa-rpc
extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/common/utils/CalculateUtils.java
CalculateUtils.divide
public static double divide(long numerator, long denominator, int scale) { BigDecimal numeratorBd = new BigDecimal(numerator); BigDecimal denominatorBd = new BigDecimal(denominator); return numeratorBd.divide(denominatorBd, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); }
java
public static double divide(long numerator, long denominator, int scale) { BigDecimal numeratorBd = new BigDecimal(numerator); BigDecimal denominatorBd = new BigDecimal(denominator); return numeratorBd.divide(denominatorBd, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); }
[ "public", "static", "double", "divide", "(", "long", "numerator", ",", "long", "denominator", ",", "int", "scale", ")", "{", "BigDecimal", "numeratorBd", "=", "new", "BigDecimal", "(", "numerator", ")", ";", "BigDecimal", "denominatorBd", "=", "new", "BigDecim...
计算比率。计算结果四舍五入。 @param numerator 分子 @param denominator 分母 @param scale 保留小数点后位数 @return 比率
[ "计算比率。计算结果四舍五入。" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/common/utils/CalculateUtils.java#L38-L42
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/userdata/UserDataHelpers.java
UserDataHelpers.interceptWritingFiles
static void interceptWritingFiles( Properties props, File outputDirectory ) throws IOException { if( outputDirectory == null ) return; Logger logger = Logger.getLogger( UserDataHelpers.class.getName()); Set<String> keys = props.stringPropertyNames(); for( final String key : keys ) { if( ! key.startsWith( ENCODE_FILE_CONTENT_PREFIX )) continue; // Get the file content String encodedFileContent = props.getProperty( key ); String realKey = key.substring( ENCODE_FILE_CONTENT_PREFIX.length()); if( encodedFileContent == null ) { logger.fine( "No file content was provided for " + realKey + ". Skipping it..." ); continue; } byte[] fileContent = decodeFromBase64( encodedFileContent ); // Write it to the disk String targetFile = props.getProperty( realKey ); if( targetFile == null ) { logger.fine( "No property named " + realKey + " was found. Skipping it..." ); continue; } Utils.createDirectory( outputDirectory ); File output = new File( outputDirectory, new File( targetFile ).getName()); Utils.copyStream( new ByteArrayInputStream( fileContent ), output ); logger.finer( "Writing " + key + " from user data in " + output.getAbsolutePath()); // Update the properties props.remove( key ); props.setProperty( realKey, output.getAbsolutePath()); } }
java
static void interceptWritingFiles( Properties props, File outputDirectory ) throws IOException { if( outputDirectory == null ) return; Logger logger = Logger.getLogger( UserDataHelpers.class.getName()); Set<String> keys = props.stringPropertyNames(); for( final String key : keys ) { if( ! key.startsWith( ENCODE_FILE_CONTENT_PREFIX )) continue; // Get the file content String encodedFileContent = props.getProperty( key ); String realKey = key.substring( ENCODE_FILE_CONTENT_PREFIX.length()); if( encodedFileContent == null ) { logger.fine( "No file content was provided for " + realKey + ". Skipping it..." ); continue; } byte[] fileContent = decodeFromBase64( encodedFileContent ); // Write it to the disk String targetFile = props.getProperty( realKey ); if( targetFile == null ) { logger.fine( "No property named " + realKey + " was found. Skipping it..." ); continue; } Utils.createDirectory( outputDirectory ); File output = new File( outputDirectory, new File( targetFile ).getName()); Utils.copyStream( new ByteArrayInputStream( fileContent ), output ); logger.finer( "Writing " + key + " from user data in " + output.getAbsolutePath()); // Update the properties props.remove( key ); props.setProperty( realKey, output.getAbsolutePath()); } }
[ "static", "void", "interceptWritingFiles", "(", "Properties", "props", ",", "File", "outputDirectory", ")", "throws", "IOException", "{", "if", "(", "outputDirectory", "==", "null", ")", "return", ";", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", ...
Intercepts the properties and writes file contents. @param props non-null properties @param outputDirectory a directory into which files should be written <p> If null, files sent with {@link #ENCODE_FILE_CONTENT_PREFIX} will not be written. </p> @throws IOException
[ "Intercepts", "the", "properties", "and", "writes", "file", "contents", ".", "@param", "props", "non", "-", "null", "properties", "@param", "outputDirectory", "a", "directory", "into", "which", "files", "should", "be", "written", "<p", ">", "If", "null", "file...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/userdata/UserDataHelpers.java#L242-L279
telly/MrVector
library/src/main/java/com/telly/mrvector/MrVector.java
MrVector.inflateCompatOnly
public static Drawable inflateCompatOnly(Resources resources, @DrawableRes int resId) { return VectorDrawable.create(resources, resId); }
java
public static Drawable inflateCompatOnly(Resources resources, @DrawableRes int resId) { return VectorDrawable.create(resources, resId); }
[ "public", "static", "Drawable", "inflateCompatOnly", "(", "Resources", "resources", ",", "@", "DrawableRes", "int", "resId", ")", "{", "return", "VectorDrawable", ".", "create", "(", "resources", ",", "resId", ")", ";", "}" ]
Inflates a <vector> drawable, using {@link com.telly.mrvector.VectorDrawable} implementation always. @param resources Resources to use for inflation @param resId <vector> drawable resource @return <p>Inflated instance of {@link com.telly.mrvector.VectorDrawable}.</p> @see #inflate(android.content.res.Resources, int)
[ "Inflates", "a", "<vector", ">", "drawable", "using", "{", "@link", "com", ".", "telly", ".", "mrvector", ".", "VectorDrawable", "}", "implementation", "always", ".", "@param", "resources", "Resources", "to", "use", "for", "inflation", "@param", "resId", "<vec...
train
https://github.com/telly/MrVector/blob/846cd05ab6e57dcdc1cae28e796ac84b1d6365d5/library/src/main/java/com/telly/mrvector/MrVector.java#L64-L66
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Invoker.java
Invoker.callGetter
public static Object callGetter(Object o, String prop) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { prop = "get" + prop; Class c = o.getClass(); Method m = getMethodParameterPairIgnoreCase(c, prop, null).getMethod(); // Method m=getMethodIgnoreCase(c,prop,null); if (m.getReturnType().getName().equals("void")) throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] can't have return type void"); return m.invoke(o, null); }
java
public static Object callGetter(Object o, String prop) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { prop = "get" + prop; Class c = o.getClass(); Method m = getMethodParameterPairIgnoreCase(c, prop, null).getMethod(); // Method m=getMethodIgnoreCase(c,prop,null); if (m.getReturnType().getName().equals("void")) throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] can't have return type void"); return m.invoke(o, null); }
[ "public", "static", "Object", "callGetter", "(", "Object", "o", ",", "String", "prop", ")", "throws", "SecurityException", ",", "NoSuchMethodException", ",", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "prop", "=", ...
to invoke a getter Method of a Object @param o Object to invoke method from @param prop Name of the Method without get @return return Value of the getter Method @throws SecurityException @throws NoSuchMethodException @throws IllegalArgumentException @throws IllegalAccessException @throws InvocationTargetException
[ "to", "invoke", "a", "getter", "Method", "of", "a", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L315-L324
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java
KnowledgeExchangeHandler.isBoolean
protected boolean isBoolean(Exchange exchange, Message message, String name) { Boolean b = getBoolean(exchange, message, name); return b != null && b.booleanValue(); }
java
protected boolean isBoolean(Exchange exchange, Message message, String name) { Boolean b = getBoolean(exchange, message, name); return b != null && b.booleanValue(); }
[ "protected", "boolean", "isBoolean", "(", "Exchange", "exchange", ",", "Message", "message", ",", "String", "name", ")", "{", "Boolean", "b", "=", "getBoolean", "(", "exchange", ",", "message", ",", "name", ")", ";", "return", "b", "!=", "null", "&&", "b...
Gets a primitive boolean context property. @param exchange the exchange @param message the message @param name the name @return the property
[ "Gets", "a", "primitive", "boolean", "context", "property", "." ]
train
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L175-L178
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java
SSLChannelProvider.setSslSupport
protected void setSslSupport(SSLSupport service, Map<String, Object> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setSslSupport", service); } sslSupport = service; defaultId = (String) props.get(SSL_CFG_REF); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setSslSupport", "defaultConfigId=" + defaultId); } }
java
protected void setSslSupport(SSLSupport service, Map<String, Object> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setSslSupport", service); } sslSupport = service; defaultId = (String) props.get(SSL_CFG_REF); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setSslSupport", "defaultConfigId=" + defaultId); } }
[ "protected", "void", "setSslSupport", "(", "SSLSupport", "service", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", ...
Required service: this is not dynamic, and so is called before activate @param ref reference to the service
[ "Required", "service", ":", "this", "is", "not", "dynamic", "and", "so", "is", "called", "before", "activate" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java#L198-L209
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.supportSetTypeface
public <F extends android.support.v4.app.Fragment> void supportSetTypeface(F fragment, @StringRes int strResId, int style) { supportSetTypeface(fragment, mApplication.getString(strResId), style); }
java
public <F extends android.support.v4.app.Fragment> void supportSetTypeface(F fragment, @StringRes int strResId, int style) { supportSetTypeface(fragment, mApplication.getString(strResId), style); }
[ "public", "<", "F", "extends", "android", ".", "support", ".", "v4", ".", "app", ".", "Fragment", ">", "void", "supportSetTypeface", "(", "F", "fragment", ",", "@", "StringRes", "int", "strResId", ",", "int", "style", ")", "{", "supportSetTypeface", "(", ...
Set the typeface to the all text views belong to the fragment. Make sure to call this method after fragment view creation. And this is a support package fragments only. @param fragment the fragment. @param strResId string resource containing typeface name. @param style the typeface style.
[ "Set", "the", "typeface", "to", "the", "all", "text", "views", "belong", "to", "the", "fragment", ".", "Make", "sure", "to", "call", "this", "method", "after", "fragment", "view", "creation", ".", "And", "this", "is", "a", "support", "package", "fragments"...
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L457-L459
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java
ByteArrayWriter.writeBinaryString
public void writeBinaryString(byte[] data) throws IOException { if (data == null) writeInt(0); else writeBinaryString(data, 0, data.length); }
java
public void writeBinaryString(byte[] data) throws IOException { if (data == null) writeInt(0); else writeBinaryString(data, 0, data.length); }
[ "public", "void", "writeBinaryString", "(", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "if", "(", "data", "==", "null", ")", "writeInt", "(", "0", ")", ";", "else", "writeBinaryString", "(", "data", ",", "0", ",", "data", ".", "length...
Write a binary string to the array. @param data @throws IOException
[ "Write", "a", "binary", "string", "to", "the", "array", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L100-L105
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/OsUtils.java
OsUtils.executeToFile
public static int executeToFile( final String[] command, final File file ) throws IOException, InterruptedException { return executeToFile( command, file, System.err ); }
java
public static int executeToFile( final String[] command, final File file ) throws IOException, InterruptedException { return executeToFile( command, file, System.err ); }
[ "public", "static", "int", "executeToFile", "(", "final", "String", "[", "]", "command", ",", "final", "File", "file", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "executeToFile", "(", "command", ",", "file", ",", "System", ".", ...
Executes the given command, redirecting stdout to the given file and stderr to actual stderr @param command array of commands to run @param file to write stdout @return error code from system @throws java.io.IOException if problems @throws java.lang.InterruptedException if interrupted
[ "Executes", "the", "given", "command", "redirecting", "stdout", "to", "the", "given", "file", "and", "stderr", "to", "actual", "stderr" ]
train
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/OsUtils.java#L397-L404
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.scheduleFixedRate
public static <T> Connectable<T> scheduleFixedRate(final Stream<T> stream, final long rate, final ScheduledExecutorService ex) { return new NonPausableConnectable<>( stream).scheduleFixedRate(rate, ex); }
java
public static <T> Connectable<T> scheduleFixedRate(final Stream<T> stream, final long rate, final ScheduledExecutorService ex) { return new NonPausableConnectable<>( stream).scheduleFixedRate(rate, ex); }
[ "public", "static", "<", "T", ">", "Connectable", "<", "T", ">", "scheduleFixedRate", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "long", "rate", ",", "final", "ScheduledExecutorService", "ex", ")", "{", "return", "new", "NonPausableConnec...
Execute this Stream on a schedule <pre> {@code //run every 60 seconds Streams.scheduleFixedRate(Stream.generate(()->"next job:"+formatDate(new Date())) .map(this::processJob), 60_000,Executors.newScheduledThreadPool(1))); } </pre> Connect to the Scheduled Stream <pre> {@code Connectable<Data> dataStream = Streams.scheduleFixedRate(Stream.generate(()->"next job:"+formatDate(new Date())) .map(this::processJob) ,60_000,Executors.newScheduledThreadPool(1))); data.connect().forEach(this::logToDB); } </pre> @param stream the stream to schedule element processing on @param rate Time in millis between job runs @param ex ScheduledExecutorService @return Connectable Connectable of emitted from scheduled Stream
[ "Execute", "this", "Stream", "on", "a", "schedule" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L811-L814
outbrain/ob1k
ob1k-cache/src/main/java/com/outbrain/ob1k/cache/memcache/folsom/MemcachedClientBuilder.java
MemcachedClientBuilder.newMessagePackClient
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final MessagePack messagePack, final Class<T> valueType) { if (!ClassUtils.isPrimitiveOrWrapper(valueType)) { messagePack.register(valueType); } return newClient(new MessagePackTranscoder<>(messagePack, valueType)); }
java
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final MessagePack messagePack, final Class<T> valueType) { if (!ClassUtils.isPrimitiveOrWrapper(valueType)) { messagePack.register(valueType); } return newClient(new MessagePackTranscoder<>(messagePack, valueType)); }
[ "public", "static", "<", "T", ">", "MemcachedClientBuilder", "<", "T", ">", "newMessagePackClient", "(", "final", "MessagePack", "messagePack", ",", "final", "Class", "<", "T", ">", "valueType", ")", "{", "if", "(", "!", "ClassUtils", ".", "isPrimitiveOrWrappe...
Create a client builder for MessagePack values. @return The builder
[ "Create", "a", "client", "builder", "for", "MessagePack", "values", "." ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-cache/src/main/java/com/outbrain/ob1k/cache/memcache/folsom/MemcachedClientBuilder.java#L61-L66
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WShufflerRenderer.java
WShufflerRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WShuffler shuffler = (WShuffler) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = shuffler.isReadOnly(); // Start tag xml.appendTagOpen("ui:shuffler"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", shuffler.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { xml.appendOptionalAttribute("disabled", shuffler.isDisabled(), "true"); xml.appendOptionalAttribute("toolTip", shuffler.getToolTip()); xml.appendOptionalAttribute("accessibleText", shuffler.getAccessibleText()); int rows = shuffler.getRows(); xml.appendOptionalAttribute("rows", rows > 0, rows); } xml.appendClose(); // Options List<?> options = shuffler.getOptions(); if (options != null && !options.isEmpty()) { for (int i = 0; i < options.size(); i++) { String stringOption = String.valueOf(options.get(i)); xml.appendTagOpen("ui:option"); xml.appendAttribute("value", stringOption); xml.appendClose(); xml.appendEscaped(stringOption); xml.appendEndTag("ui:option"); } } if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(shuffler, renderContext); } // End tag xml.appendEndTag("ui:shuffler"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WShuffler shuffler = (WShuffler) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = shuffler.isReadOnly(); // Start tag xml.appendTagOpen("ui:shuffler"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", shuffler.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { xml.appendOptionalAttribute("disabled", shuffler.isDisabled(), "true"); xml.appendOptionalAttribute("toolTip", shuffler.getToolTip()); xml.appendOptionalAttribute("accessibleText", shuffler.getAccessibleText()); int rows = shuffler.getRows(); xml.appendOptionalAttribute("rows", rows > 0, rows); } xml.appendClose(); // Options List<?> options = shuffler.getOptions(); if (options != null && !options.isEmpty()) { for (int i = 0; i < options.size(); i++) { String stringOption = String.valueOf(options.get(i)); xml.appendTagOpen("ui:option"); xml.appendAttribute("value", stringOption); xml.appendClose(); xml.appendEscaped(stringOption); xml.appendEndTag("ui:option"); } } if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(shuffler, renderContext); } // End tag xml.appendEndTag("ui:shuffler"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WShuffler", "shuffler", "=", "(", "WShuffler", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderCo...
Paints the given WShuffler. @param component the WShuffler to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WShuffler", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WShufflerRenderer.java#L24-L66
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/VariantCustom.java
VariantCustom.addParam
public void addParam(String name, String value, int type) { // Current size usually is equal to the position params.add(new NameValuePair(type, name, value, params.size())); }
java
public void addParam(String name, String value, int type) { // Current size usually is equal to the position params.add(new NameValuePair(type, name, value, params.size())); }
[ "public", "void", "addParam", "(", "String", "name", ",", "String", "value", ",", "int", "type", ")", "{", "// Current size usually is equal to the position\r", "params", ".", "add", "(", "new", "NameValuePair", "(", "type", ",", "name", ",", "value", ",", "pa...
Support method to add a new param to this custom variant @param name the param name @param value the value of this parameter @param type the type of this parameter
[ "Support", "method", "to", "add", "a", "new", "param", "to", "this", "custom", "variant" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/VariantCustom.java#L142-L145
finmath/finmath-lib
src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java
DiscountCurveInterpolation.createDiscountCurveFromMonteCarloLiborModel
public static DiscountCurveInterface createDiscountCurveFromMonteCarloLiborModel(String forwardCurveName, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{ // Check if the LMM uses a discount curve which is created from a forward curve if(model.getModel().getDiscountCurve()==null || model.getModel().getDiscountCurve().getName().toLowerCase().contains("DiscountCurveFromForwardCurve".toLowerCase())){ return new DiscountCurveFromForwardCurve(ForwardCurveInterpolation.createForwardCurveFromMonteCarloLiborModel(forwardCurveName, model, startTime)); } else { // i.e. forward curve of Libor Model not OIS. In this case return the OIS curve. // Only at startTime 0! return (DiscountCurveInterface) model.getModel().getDiscountCurve(); } }
java
public static DiscountCurveInterface createDiscountCurveFromMonteCarloLiborModel(String forwardCurveName, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{ // Check if the LMM uses a discount curve which is created from a forward curve if(model.getModel().getDiscountCurve()==null || model.getModel().getDiscountCurve().getName().toLowerCase().contains("DiscountCurveFromForwardCurve".toLowerCase())){ return new DiscountCurveFromForwardCurve(ForwardCurveInterpolation.createForwardCurveFromMonteCarloLiborModel(forwardCurveName, model, startTime)); } else { // i.e. forward curve of Libor Model not OIS. In this case return the OIS curve. // Only at startTime 0! return (DiscountCurveInterface) model.getModel().getDiscountCurve(); } }
[ "public", "static", "DiscountCurveInterface", "createDiscountCurveFromMonteCarloLiborModel", "(", "String", "forwardCurveName", ",", "LIBORModelMonteCarloSimulationModel", "model", ",", "double", "startTime", ")", "throws", "CalculationException", "{", "// Check if the LMM uses a d...
Create a discount curve from forwards given by a LIBORMonteCarloModel. If the model uses multiple curves, return its discount curve. @param forwardCurveName name of the forward curve. @param model Monte Carlo model providing the forwards. @param startTime time at which the curve starts, i.e. zero time for the curve @return a discount curve from forwards given by a LIBORMonteCarloModel. @throws CalculationException Thrown if the model failed to provide the forward rates.
[ "Create", "a", "discount", "curve", "from", "forwards", "given", "by", "a", "LIBORMonteCarloModel", ".", "If", "the", "model", "uses", "multiple", "curves", "return", "its", "discount", "curve", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java#L401-L412
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java
CompareFixture.countDifferencesBetweenIgnoreWhitespaceAnd
public int countDifferencesBetweenIgnoreWhitespaceAnd(String first, String second) { String cleanFirst = allWhitespaceToSingleSpace(first); String cleanSecond = allWhitespaceToSingleSpace(second); return countDifferencesBetweenAnd(cleanFirst, cleanSecond); }
java
public int countDifferencesBetweenIgnoreWhitespaceAnd(String first, String second) { String cleanFirst = allWhitespaceToSingleSpace(first); String cleanSecond = allWhitespaceToSingleSpace(second); return countDifferencesBetweenAnd(cleanFirst, cleanSecond); }
[ "public", "int", "countDifferencesBetweenIgnoreWhitespaceAnd", "(", "String", "first", ",", "String", "second", ")", "{", "String", "cleanFirst", "=", "allWhitespaceToSingleSpace", "(", "first", ")", ";", "String", "cleanSecond", "=", "allWhitespaceToSingleSpace", "(", ...
Determines number of differences (substrings that are not equal) between two strings, ignoring differences in whitespace. @param first first string to compare. @param second second string to compare. @return number of different substrings.
[ "Determines", "number", "of", "differences", "(", "substrings", "that", "are", "not", "equal", ")", "between", "two", "strings", "ignoring", "differences", "in", "whitespace", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L127-L131
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java
DatabasesInner.listMetricDefinitions
public List<MetricDefinitionInner> listMetricDefinitions(String resourceGroupName, String serverName, String databaseName) { return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
java
public List<MetricDefinitionInner> listMetricDefinitions(String resourceGroupName, String serverName, String databaseName) { return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
[ "public", "List", "<", "MetricDefinitionInner", ">", "listMetricDefinitions", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "listMetricDefinitionsWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Returns database metric definitions. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;MetricDefinitionInner&gt; object if successful.
[ "Returns", "database", "metric", "definitions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L2388-L2390
camunda/camunda-commons
typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
Variables.untypedValue
public static TypedValue untypedValue(Object value) { if (value instanceof TypedValue) { return untypedValue(value, ((TypedValue) value).isTransient()); } else return untypedValue(value, false); }
java
public static TypedValue untypedValue(Object value) { if (value instanceof TypedValue) { return untypedValue(value, ((TypedValue) value).isTransient()); } else return untypedValue(value, false); }
[ "public", "static", "TypedValue", "untypedValue", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "TypedValue", ")", "{", "return", "untypedValue", "(", "value", ",", "(", "(", "TypedValue", ")", "value", ")", ".", "isTransient", "(", "...
Creates an untyped value, i.e. {@link TypedValue#getType()} returns <code>null</code> for the returned instance.
[ "Creates", "an", "untyped", "value", "i", ".", "e", ".", "{" ]
train
https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java#L362-L367
google/closure-compiler
src/com/google/javascript/rhino/jstype/ObjectType.java
ObjectType.defineSynthesizedProperty
public final boolean defineSynthesizedProperty(String propertyName, JSType type, Node propertyNode) { return defineProperty(propertyName, type, false, propertyNode); }
java
public final boolean defineSynthesizedProperty(String propertyName, JSType type, Node propertyNode) { return defineProperty(propertyName, type, false, propertyNode); }
[ "public", "final", "boolean", "defineSynthesizedProperty", "(", "String", "propertyName", ",", "JSType", "type", ",", "Node", "propertyNode", ")", "{", "return", "defineProperty", "(", "propertyName", ",", "type", ",", "false", ",", "propertyNode", ")", ";", "}"...
Defines a property whose type is on a synthesized object. These objects don't actually exist in the user's program. They're just used for bookkeeping in the type system.
[ "Defines", "a", "property", "whose", "type", "is", "on", "a", "synthesized", "object", ".", "These", "objects", "don", "t", "actually", "exist", "in", "the", "user", "s", "program", ".", "They", "re", "just", "used", "for", "bookkeeping", "in", "the", "t...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/ObjectType.java#L385-L388
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/PartialVAFile.java
PartialVAFile.calculateFullApproximation
protected VectorApproximation calculateFullApproximation(DBID id, V dv) { int[] approximation = new int[dv.getDimensionality()]; for(int d = 0; d < splitPartitions.length; d++) { double[] split = daFiles.get(d).getSplitPositions(); final double val = dv.doubleValue(d); final int lastBorderIndex = split.length - 1; // Value is below data grid if(val < split[0]) { approximation[d] = 0; if(id != null) { LOG.warning("Vector outside of VAFile grid!"); } } // Value is above data grid else if(val > split[lastBorderIndex]) { approximation[d] = lastBorderIndex - 1; if(id != null) { LOG.warning("Vector outside of VAFile grid!"); } } // normal case else { // Search grid position int pos = Arrays.binarySearch(split, val); pos = (pos >= 0) ? pos : ((-pos) - 2); approximation[d] = pos; } } return new VectorApproximation(id, approximation); }
java
protected VectorApproximation calculateFullApproximation(DBID id, V dv) { int[] approximation = new int[dv.getDimensionality()]; for(int d = 0; d < splitPartitions.length; d++) { double[] split = daFiles.get(d).getSplitPositions(); final double val = dv.doubleValue(d); final int lastBorderIndex = split.length - 1; // Value is below data grid if(val < split[0]) { approximation[d] = 0; if(id != null) { LOG.warning("Vector outside of VAFile grid!"); } } // Value is above data grid else if(val > split[lastBorderIndex]) { approximation[d] = lastBorderIndex - 1; if(id != null) { LOG.warning("Vector outside of VAFile grid!"); } } // normal case else { // Search grid position int pos = Arrays.binarySearch(split, val); pos = (pos >= 0) ? pos : ((-pos) - 2); approximation[d] = pos; } } return new VectorApproximation(id, approximation); }
[ "protected", "VectorApproximation", "calculateFullApproximation", "(", "DBID", "id", ",", "V", "dv", ")", "{", "int", "[", "]", "approximation", "=", "new", "int", "[", "dv", ".", "getDimensionality", "(", ")", "]", ";", "for", "(", "int", "d", "=", "0",...
Calculate the VA file position given the existing borders. @param id Object ID @param dv Data vector @return Vector approximation
[ "Calculate", "the", "VA", "file", "position", "given", "the", "existing", "borders", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/PartialVAFile.java#L193-L221
lets-blade/blade
src/main/java/com/blade/mvc/RouteContext.java
RouteContext.queryLong
public Long queryLong(String paramName, Long defaultValue) { return this.request.queryLong(paramName, defaultValue); }
java
public Long queryLong(String paramName, Long defaultValue) { return this.request.queryLong(paramName, defaultValue); }
[ "public", "Long", "queryLong", "(", "String", "paramName", ",", "Long", "defaultValue", ")", "{", "return", "this", ".", "request", ".", "queryLong", "(", "paramName", ",", "defaultValue", ")", ";", "}" ]
Returns a request parameter for a Long type @param paramName Parameter name @param defaultValue default long value @return Return Long parameter values
[ "Returns", "a", "request", "parameter", "for", "a", "Long", "type" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L215-L217
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.createAuthzHeaderForRequestTokenEndpoint
public String createAuthzHeaderForRequestTokenEndpoint(String callbackUrl, String endpointUrl) { Map<String, String> parameters = populateRequestTokenEndpointAuthzHeaderParams(callbackUrl); return signAndCreateAuthzHeader(endpointUrl, parameters); }
java
public String createAuthzHeaderForRequestTokenEndpoint(String callbackUrl, String endpointUrl) { Map<String, String> parameters = populateRequestTokenEndpointAuthzHeaderParams(callbackUrl); return signAndCreateAuthzHeader(endpointUrl, parameters); }
[ "public", "String", "createAuthzHeaderForRequestTokenEndpoint", "(", "String", "callbackUrl", ",", "String", "endpointUrl", ")", "{", "Map", "<", "String", ",", "String", ">", "parameters", "=", "populateRequestTokenEndpointAuthzHeaderParams", "(", "callbackUrl", ")", "...
Generates the Authorization header value required for a {@value TwitterConstants#TWITTER_ENDPOINT_REQUEST_TOKEN} endpoint request. See {@link https://dev.twitter.com/oauth/reference/post/oauth/request_token} for details. @param callbackUrl @param endpointUrl @return
[ "Generates", "the", "Authorization", "header", "value", "required", "for", "a", "{", "@value", "TwitterConstants#TWITTER_ENDPOINT_REQUEST_TOKEN", "}", "endpoint", "request", ".", "See", "{", "@link", "https", ":", "//", "dev", ".", "twitter", ".", "com", "/", "o...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L425-L428
aws/aws-sdk-java
aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53domains/model/GetDomainDetailResult.java
GetDomainDetailResult.getStatusList
public java.util.List<String> getStatusList() { if (statusList == null) { statusList = new com.amazonaws.internal.SdkInternalList<String>(); } return statusList; }
java
public java.util.List<String> getStatusList() { if (statusList == null) { statusList = new com.amazonaws.internal.SdkInternalList<String>(); } return statusList; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getStatusList", "(", ")", "{", "if", "(", "statusList", "==", "null", ")", "{", "statusList", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "String", ...
<p> An array of domain name status codes, also known as Extensible Provisioning Protocol (EPP) status codes. </p> <p> ICANN, the organization that maintains a central database of domain names, has developed a set of domain name status codes that tell you the status of a variety of operations on a domain name, for example, registering a domain name, transferring a domain name to another registrar, renewing the registration for a domain name, and so on. All registrars use this same set of status codes. </p> <p> For a current list of domain name status codes and an explanation of what each code means, go to the <a href="https://www.icann.org/">ICANN website</a> and search for <code>epp status codes</code>. (Search on the ICANN website; web searches sometimes return an old version of the document.) </p> @return An array of domain name status codes, also known as Extensible Provisioning Protocol (EPP) status codes.</p> <p> ICANN, the organization that maintains a central database of domain names, has developed a set of domain name status codes that tell you the status of a variety of operations on a domain name, for example, registering a domain name, transferring a domain name to another registrar, renewing the registration for a domain name, and so on. All registrars use this same set of status codes. </p> <p> For a current list of domain name status codes and an explanation of what each code means, go to the <a href="https://www.icann.org/">ICANN website</a> and search for <code>epp status codes</code>. (Search on the ICANN website; web searches sometimes return an old version of the document.)
[ "<p", ">", "An", "array", "of", "domain", "name", "status", "codes", "also", "known", "as", "Extensible", "Provisioning", "Protocol", "(", "EPP", ")", "status", "codes", ".", "<", "/", "p", ">", "<p", ">", "ICANN", "the", "organization", "that", "maintai...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53domains/model/GetDomainDetailResult.java#L1211-L1216
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java
ComplexMath_F64.minus
public static void minus(Complex_F64 a , Complex_F64 b , Complex_F64 result ) { result.real = a.real - b.real; result.imaginary = a.imaginary - b.imaginary; }
java
public static void minus(Complex_F64 a , Complex_F64 b , Complex_F64 result ) { result.real = a.real - b.real; result.imaginary = a.imaginary - b.imaginary; }
[ "public", "static", "void", "minus", "(", "Complex_F64", "a", ",", "Complex_F64", "b", ",", "Complex_F64", "result", ")", "{", "result", ".", "real", "=", "a", ".", "real", "-", "b", ".", "real", ";", "result", ".", "imaginary", "=", "a", ".", "imagi...
<p> Subtraction: result = a - b </p> @param a Complex number. Not modified. @param b Complex number. Not modified. @param result Storage for output
[ "<p", ">", "Subtraction", ":", "result", "=", "a", "-", "b", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L66-L69
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java
ByteBufferUtils.lastIndexOf
public static int lastIndexOf(ByteBuffer buffer, byte valueToFind, int startIndex) { assert buffer != null; if (startIndex < buffer.position()) { return -1; } else if (startIndex >= buffer.limit()) { startIndex = buffer.limit() - 1; } for (int i = startIndex; i >= buffer.position(); i--) { if (valueToFind == buffer.get(i)) return i; } return -1; }
java
public static int lastIndexOf(ByteBuffer buffer, byte valueToFind, int startIndex) { assert buffer != null; if (startIndex < buffer.position()) { return -1; } else if (startIndex >= buffer.limit()) { startIndex = buffer.limit() - 1; } for (int i = startIndex; i >= buffer.position(); i--) { if (valueToFind == buffer.get(i)) return i; } return -1; }
[ "public", "static", "int", "lastIndexOf", "(", "ByteBuffer", "buffer", ",", "byte", "valueToFind", ",", "int", "startIndex", ")", "{", "assert", "buffer", "!=", "null", ";", "if", "(", "startIndex", "<", "buffer", ".", "position", "(", ")", ")", "{", "re...
ByteBuffer adaptation of org.apache.commons.lang.ArrayUtils.lastIndexOf method @param buffer the array to traverse for looking for the object, may be <code>null</code> @param valueToFind the value to find @param startIndex the start index (i.e. BB position) to travers backwards from @return the last index (i.e. BB position) of the value within the array [between buffer.position() and buffer.limit()]; <code>-1</code> if not found.
[ "ByteBuffer", "adaptation", "of", "org", ".", "apache", ".", "commons", ".", "lang", ".", "ArrayUtils", ".", "lastIndexOf", "method" ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java#L103-L123
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java
PostgreSqlRepositoryCollection.addAttributeInternal
private void addAttributeInternal(EntityType entityType, Attribute attr) { if (!isPersisted(attr)) { return; } if (isMultipleReferenceType(attr)) { createJunctionTable(entityType, attr); if (attr.getDefaultValue() != null && !attr.isNillable()) { @SuppressWarnings("unchecked") Iterable<Entity> defaultRefEntities = (Iterable<Entity>) AttributeUtils.getDefaultTypedValue(attr); if (!Iterables.isEmpty(defaultRefEntities)) { createJunctionTableRows(entityType, attr, defaultRefEntities); } } } else { createColumn(entityType, attr); } }
java
private void addAttributeInternal(EntityType entityType, Attribute attr) { if (!isPersisted(attr)) { return; } if (isMultipleReferenceType(attr)) { createJunctionTable(entityType, attr); if (attr.getDefaultValue() != null && !attr.isNillable()) { @SuppressWarnings("unchecked") Iterable<Entity> defaultRefEntities = (Iterable<Entity>) AttributeUtils.getDefaultTypedValue(attr); if (!Iterables.isEmpty(defaultRefEntities)) { createJunctionTableRows(entityType, attr, defaultRefEntities); } } } else { createColumn(entityType, attr); } }
[ "private", "void", "addAttributeInternal", "(", "EntityType", "entityType", ",", "Attribute", "attr", ")", "{", "if", "(", "!", "isPersisted", "(", "attr", ")", ")", "{", "return", ";", "}", "if", "(", "isMultipleReferenceType", "(", "attr", ")", ")", "{",...
Add attribute to entityType. @param entityType the {@link EntityType} to add attribute to @param attr attribute to add
[ "Add", "attribute", "to", "entityType", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L287-L306
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.setInitializer
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ XExpression expr) { if (field == null || expr == null) return; removeExistingBody(field); associator.associateLogicalContainer(expr, field); }
java
public void setInitializer(/* @Nullable */ JvmField field, /* @Nullable */ XExpression expr) { if (field == null || expr == null) return; removeExistingBody(field); associator.associateLogicalContainer(expr, field); }
[ "public", "void", "setInitializer", "(", "/* @Nullable */", "JvmField", "field", ",", "/* @Nullable */", "XExpression", "expr", ")", "{", "if", "(", "field", "==", "null", "||", "expr", "==", "null", ")", "return", ";", "removeExistingBody", "(", "field", ")",...
Sets the given {@link JvmField} as the logical container for the given {@link XExpression}. This defines the context and the scope for the given expression. @param field the {@link JvmField} that is initialized by the expression. If <code>null</code> this method does nothing. @param expr the initialization expression. Can be <code>null</code> in which case this function does nothing.
[ "Sets", "the", "given", "{", "@link", "JvmField", "}", "as", "the", "logical", "container", "for", "the", "given", "{", "@link", "XExpression", "}", ".", "This", "defines", "the", "context", "and", "the", "scope", "for", "the", "given", "expression", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1260-L1265
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Bindings.java
Bindings.bindText
public static void bindText (final Value<String> value, final TextBoxBase text) { text.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp (KeyUpEvent event) { value.updateIf(((TextBoxBase)event.getSource()).getText()); } }); text.addChangeHandler(new ChangeHandler() { public void onChange (ChangeEvent event) { value.updateIf(((TextBoxBase)event.getSource()).getText()); } }); bindLabel(value, text); }
java
public static void bindText (final Value<String> value, final TextBoxBase text) { text.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp (KeyUpEvent event) { value.updateIf(((TextBoxBase)event.getSource()).getText()); } }); text.addChangeHandler(new ChangeHandler() { public void onChange (ChangeEvent event) { value.updateIf(((TextBoxBase)event.getSource()).getText()); } }); bindLabel(value, text); }
[ "public", "static", "void", "bindText", "(", "final", "Value", "<", "String", ">", "value", ",", "final", "TextBoxBase", "text", ")", "{", "text", ".", "addKeyUpHandler", "(", "new", "KeyUpHandler", "(", ")", "{", "public", "void", "onKeyUp", "(", "KeyUpEv...
Binds the contents of the supplied text box to the supplied string value. The binding is multidirectional, i.e. changes to the value will update the text box and changes to the text box will update the value. The value is updated on key up as well as on change so that both keyboard initiated changes and non-keyboard initiated changes (paste) are handled.
[ "Binds", "the", "contents", "of", "the", "supplied", "text", "box", "to", "the", "supplied", "string", "value", ".", "The", "binding", "is", "multidirectional", "i", ".", "e", ".", "changes", "to", "the", "value", "will", "update", "the", "text", "box", ...
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Bindings.java#L162-L175
anotheria/configureme
src/main/java/org/configureme/repository/IncludeValue.java
IncludeValue.getConfigName
public ConfigurationSourceKey getConfigName() { return new ConfigurationSourceKey(ConfigurationSourceKey.Type.FILE, ConfigurationSourceKey.Format.JSON, configurationName); }
java
public ConfigurationSourceKey getConfigName() { return new ConfigurationSourceKey(ConfigurationSourceKey.Type.FILE, ConfigurationSourceKey.Format.JSON, configurationName); }
[ "public", "ConfigurationSourceKey", "getConfigName", "(", ")", "{", "return", "new", "ConfigurationSourceKey", "(", "ConfigurationSourceKey", ".", "Type", ".", "FILE", ",", "ConfigurationSourceKey", ".", "Format", ".", "JSON", ",", "configurationName", ")", ";", "}"...
Get configuration name of the linked config @return configuration name of the linked config
[ "Get", "configuration", "name", "of", "the", "linked", "config" ]
train
https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/repository/IncludeValue.java#L45-L47
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationFull.java
DatabaseInformationFull.SYSTEM_VERSIONCOLUMNS
Table SYSTEM_VERSIONCOLUMNS() { Table t = sysTables[SYSTEM_VERSIONCOLUMNS]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS]); // ---------------------------------------------------------------- // required by DatabaseMetaData.getVersionColumns result set // ---------------------------------------------------------------- addColumn(t, "SCOPE", Type.SQL_INTEGER); addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null addColumn(t, "COLUMN_SIZE", Type.SQL_SMALLINT); addColumn(t, "BUFFER_LENGTH", Type.SQL_INTEGER); addColumn(t, "DECIMAL_DIGITS", Type.SQL_SMALLINT); addColumn(t, "PSEUDO_COLUMN", Type.SQL_SMALLINT); // not null // ----------------------------------------------------------------- // required by DatabaseMetaData.getVersionColumns filter parameters // ----------------------------------------------------------------- addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null // ----------------------------------------------------------------- HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, null, false); return t; } return t; }
java
Table SYSTEM_VERSIONCOLUMNS() { Table t = sysTables[SYSTEM_VERSIONCOLUMNS]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS]); // ---------------------------------------------------------------- // required by DatabaseMetaData.getVersionColumns result set // ---------------------------------------------------------------- addColumn(t, "SCOPE", Type.SQL_INTEGER); addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null addColumn(t, "COLUMN_SIZE", Type.SQL_SMALLINT); addColumn(t, "BUFFER_LENGTH", Type.SQL_INTEGER); addColumn(t, "DECIMAL_DIGITS", Type.SQL_SMALLINT); addColumn(t, "PSEUDO_COLUMN", Type.SQL_SMALLINT); // not null // ----------------------------------------------------------------- // required by DatabaseMetaData.getVersionColumns filter parameters // ----------------------------------------------------------------- addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null // ----------------------------------------------------------------- HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, null, false); return t; } return t; }
[ "Table", "SYSTEM_VERSIONCOLUMNS", "(", ")", "{", "Table", "t", "=", "sysTables", "[", "SYSTEM_VERSIONCOLUMNS", "]", ";", "if", "(", "t", "==", "null", ")", "{", "t", "=", "createBlankTable", "(", "sysTableHsqlNames", "[", "SYSTEM_VERSIONCOLUMNS", "]", ")", "...
Retrieves a <code>Table</code> object describing the accessible columns that are automatically updated when any value in a row is updated. <p> Each row is a version column description with the following columns: <p> <OL> <LI><B>SCOPE</B> <code>SMALLINT</code> => is not used <LI><B>COLUMN_NAME</B> <code>VARCHAR</code> => column name <LI><B>DATA_TYPE</B> <code>SMALLINT</code> => SQL data type from java.sql.Types <LI><B>TYPE_NAME</B> <code>SMALLINT</code> => Data source dependent type name <LI><B>COLUMN_SIZE</B> <code>INTEGER</code> => precision <LI><B>BUFFER_LENGTH</B> <code>INTEGER</code> => length of column value in bytes <LI><B>DECIMAL_DIGITS</B> <code>SMALLINT</code> => scale <LI><B>PSEUDO_COLUMN</B> <code>SMALLINT</code> => is this a pseudo column like an Oracle <code>ROWID</code>:<BR> (as defined in <code>java.sql.DatabaseMetadata</code>) <UL> <LI><code>versionColumnUnknown</code> - may or may not be pseudo column <LI><code>versionColumnNotPseudo</code> - is NOT a pseudo column <LI><code>versionColumnPseudo</code> - is a pseudo column </UL> </OL> <p> <B>Note:</B> Currently, the HSQLDB engine does not support version columns, so an empty table is returned. <p> @return a <code>Table</code> object describing the columns that are automatically updated when any value in a row is updated
[ "Retrieves", "a", "<code", ">", "Table<", "/", "code", ">", "object", "describing", "the", "accessible", "columns", "that", "are", "automatically", "updated", "when", "any", "value", "in", "a", "row", "is", "updated", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationFull.java#L1128-L1165
apache/flink
flink-core/src/main/java/org/apache/flink/util/ExecutorUtils.java
ExecutorUtils.gracefulShutdown
public static void gracefulShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices) { for (ExecutorService executorService: executorServices) { executorService.shutdown(); } boolean wasInterrupted = false; final long endTime = unit.toMillis(timeout) + System.currentTimeMillis(); long timeLeft = unit.toMillis(timeout); boolean hasTimeLeft = timeLeft > 0L; for (ExecutorService executorService: executorServices) { if (wasInterrupted || !hasTimeLeft) { executorService.shutdownNow(); } else { try { if (!executorService.awaitTermination(timeLeft, TimeUnit.MILLISECONDS)) { LOG.warn("ExecutorService did not terminate in time. Shutting it down now."); executorService.shutdownNow(); } } catch (InterruptedException e) { LOG.warn("Interrupted while shutting down executor services. Shutting all " + "remaining ExecutorServices down now.", e); executorService.shutdownNow(); wasInterrupted = true; Thread.currentThread().interrupt(); } timeLeft = endTime - System.currentTimeMillis(); hasTimeLeft = timeLeft > 0L; } } }
java
public static void gracefulShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices) { for (ExecutorService executorService: executorServices) { executorService.shutdown(); } boolean wasInterrupted = false; final long endTime = unit.toMillis(timeout) + System.currentTimeMillis(); long timeLeft = unit.toMillis(timeout); boolean hasTimeLeft = timeLeft > 0L; for (ExecutorService executorService: executorServices) { if (wasInterrupted || !hasTimeLeft) { executorService.shutdownNow(); } else { try { if (!executorService.awaitTermination(timeLeft, TimeUnit.MILLISECONDS)) { LOG.warn("ExecutorService did not terminate in time. Shutting it down now."); executorService.shutdownNow(); } } catch (InterruptedException e) { LOG.warn("Interrupted while shutting down executor services. Shutting all " + "remaining ExecutorServices down now.", e); executorService.shutdownNow(); wasInterrupted = true; Thread.currentThread().interrupt(); } timeLeft = endTime - System.currentTimeMillis(); hasTimeLeft = timeLeft > 0L; } } }
[ "public", "static", "void", "gracefulShutdown", "(", "long", "timeout", ",", "TimeUnit", "unit", ",", "ExecutorService", "...", "executorServices", ")", "{", "for", "(", "ExecutorService", "executorService", ":", "executorServices", ")", "{", "executorService", ".",...
Gracefully shutdown the given {@link ExecutorService}. The call waits the given timeout that all ExecutorServices terminate. If the ExecutorServices do not terminate in this time, they will be shut down hard. @param timeout to wait for the termination of all ExecutorServices @param unit of the timeout @param executorServices to shut down
[ "Gracefully", "shutdown", "the", "given", "{", "@link", "ExecutorService", "}", ".", "The", "call", "waits", "the", "given", "timeout", "that", "all", "ExecutorServices", "terminate", ".", "If", "the", "ExecutorServices", "do", "not", "terminate", "in", "this", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExecutorUtils.java#L44-L77
aws/aws-sdk-java
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/CreateChannelRequest.java
CreateChannelRequest.withTags
public CreateChannelRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateChannelRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateChannelRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
A collection of key-value pairs. @param tags A collection of key-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "collection", "of", "key", "-", "value", "pairs", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/CreateChannelRequest.java#L507-L510
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java
ServerCommandClient.introspectServer
public ReturnCode introspectServer(String dumpTimestamp, Set<JavaDumpAction> javaDumpActions) { // Since "server dump" is used for diagnostics, we go out of our way to // not send an unrecognized command to the server even if the user has // broken their environment such that the client process supports java // dumps but the server doesn't. String command; if (javaDumpActions.isEmpty()) { command = INTROSPECT_COMMAND + DELIM + dumpTimestamp; } else { StringBuilder commandBuilder = new StringBuilder().append(INTROSPECT_JAVADUMP_COMMAND).append(DELIM).append(dumpTimestamp); for (JavaDumpAction javaDumpAction : javaDumpActions) { commandBuilder.append(',').append(javaDumpAction.name()); } command = commandBuilder.toString(); } return write(command, ReturnCode.DUMP_ACTION, ReturnCode.ERROR_SERVER_DUMP); }
java
public ReturnCode introspectServer(String dumpTimestamp, Set<JavaDumpAction> javaDumpActions) { // Since "server dump" is used for diagnostics, we go out of our way to // not send an unrecognized command to the server even if the user has // broken their environment such that the client process supports java // dumps but the server doesn't. String command; if (javaDumpActions.isEmpty()) { command = INTROSPECT_COMMAND + DELIM + dumpTimestamp; } else { StringBuilder commandBuilder = new StringBuilder().append(INTROSPECT_JAVADUMP_COMMAND).append(DELIM).append(dumpTimestamp); for (JavaDumpAction javaDumpAction : javaDumpActions) { commandBuilder.append(',').append(javaDumpAction.name()); } command = commandBuilder.toString(); } return write(command, ReturnCode.DUMP_ACTION, ReturnCode.ERROR_SERVER_DUMP); }
[ "public", "ReturnCode", "introspectServer", "(", "String", "dumpTimestamp", ",", "Set", "<", "JavaDumpAction", ">", "javaDumpActions", ")", "{", "// Since \"server dump\" is used for diagnostics, we go out of our way to", "// not send an unrecognized command to the server even if the u...
Dump the server by issuing a "introspect" instruction to the server listener
[ "Dump", "the", "server", "by", "issuing", "a", "introspect", "instruction", "to", "the", "server", "listener" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L245-L264
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYLineChartBuilder.java
DJXYLineChartBuilder.addSerie
public DJXYLineChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
java
public DJXYLineChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
[ "public", "DJXYLineChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "StringExpression", "labelExpression", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "labelExpression", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYLineChartBuilder.java#L384-L387
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigWebUtil.java
ConfigWebUtil.getExistingResource
public static Resource getExistingResource(ServletContext sc, String strDir, String defaultDir, Resource configDir, short type, Config config) { // ARP strDir = replacePlaceholder(strDir, config); if (strDir != null && strDir.trim().length() > 0) { Resource res = sc == null ? null : _getExistingFile(config.getResource(ResourceUtil.merge(ReqRspUtil.getRootPath(sc), strDir)), type); if (res != null) return res; res = _getExistingFile(config.getResource(strDir), type); if (res != null) return res; } if (defaultDir == null) return null; return _getExistingFile(configDir.getRealResource(defaultDir), type); }
java
public static Resource getExistingResource(ServletContext sc, String strDir, String defaultDir, Resource configDir, short type, Config config) { // ARP strDir = replacePlaceholder(strDir, config); if (strDir != null && strDir.trim().length() > 0) { Resource res = sc == null ? null : _getExistingFile(config.getResource(ResourceUtil.merge(ReqRspUtil.getRootPath(sc), strDir)), type); if (res != null) return res; res = _getExistingFile(config.getResource(strDir), type); if (res != null) return res; } if (defaultDir == null) return null; return _getExistingFile(configDir.getRealResource(defaultDir), type); }
[ "public", "static", "Resource", "getExistingResource", "(", "ServletContext", "sc", ",", "String", "strDir", ",", "String", "defaultDir", ",", "Resource", "configDir", ",", "short", "type", ",", "Config", "config", ")", "{", "// ARP", "strDir", "=", "replacePlac...
get only a existing file, dont create it @param sc @param strDir @param defaultDir @param configDir @param type @param config @return existing file
[ "get", "only", "a", "existing", "file", "dont", "create", "it" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigWebUtil.java#L361-L375
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.roundHalfUp
public static double roundHalfUp(double d, int scale) { return BigDecimal.valueOf(d).setScale(scale, RoundingMode.HALF_UP).doubleValue(); }
java
public static double roundHalfUp(double d, int scale) { return BigDecimal.valueOf(d).setScale(scale, RoundingMode.HALF_UP).doubleValue(); }
[ "public", "static", "double", "roundHalfUp", "(", "double", "d", ",", "int", "scale", ")", "{", "return", "BigDecimal", ".", "valueOf", "(", "d", ")", ".", "setScale", "(", "scale", ",", "RoundingMode", ".", "HALF_UP", ")", ".", "doubleValue", "(", ")", ...
Round up a double using the "half up" method. @param d a double @param scale the scale @return a double
[ "Round", "up", "a", "double", "using", "the", "half", "up", "method", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L550-L552
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesByteArrayImpl.java
DoublesByteArrayImpl.convertToByteArray
private static byte[] convertToByteArray(final DoublesSketch sketch, final int flags, final boolean ordered, final boolean compact) { final int preLongs = 2; final int extra = 2; // extra space for min and max values final int prePlusExtraBytes = (preLongs + extra) << 3; final int k = sketch.getK(); final long n = sketch.getN(); // If not-compact, have accessor always report full levels. Then use level size to determine // whether to copy data out. final DoublesSketchAccessor dsa = DoublesSketchAccessor.wrap(sketch, !compact); final int outBytes = (compact ? sketch.getCompactStorageBytes() : sketch.getUpdatableStorageBytes()); final byte[] outByteArr = new byte[outBytes]; final WritableMemory memOut = WritableMemory.wrap(outByteArr); //insert preamble-0, N, min, max insertPre0(memOut, preLongs, flags, k); if (sketch.isEmpty()) { return outByteArr; } insertN(memOut, n); insertMinDouble(memOut, sketch.getMinValue()); insertMaxDouble(memOut, sketch.getMaxValue()); long memOffsetBytes = prePlusExtraBytes; // might need to sort base buffer but don't want to change input sketch final int bbCnt = Util.computeBaseBufferItems(k, n); if (bbCnt > 0) { //Base buffer items only final double[] bbItemsArr = dsa.getArray(0, bbCnt); if (ordered) { Arrays.sort(bbItemsArr); } memOut.putDoubleArray(memOffsetBytes, bbItemsArr, 0, bbCnt); } // If n < 2k, totalLevels == 0 so ok to overshoot the offset update memOffsetBytes += (compact ? bbCnt : 2 * k) << 3; // If serializing from a compact sketch to a non-compact form, we may end up copying data for a // higher level one or more times into an unused level. A bit wasteful, but not incorrect. final int totalLevels = Util.computeTotalLevels(sketch.getBitPattern()); for (int lvl = 0; lvl < totalLevels; ++lvl) { dsa.setLevel(lvl); if (dsa.numItems() > 0) { assert dsa.numItems() == k; memOut.putDoubleArray(memOffsetBytes, dsa.getArray(0, k), 0, k); memOffsetBytes += (k << 3); } } return outByteArr; }
java
private static byte[] convertToByteArray(final DoublesSketch sketch, final int flags, final boolean ordered, final boolean compact) { final int preLongs = 2; final int extra = 2; // extra space for min and max values final int prePlusExtraBytes = (preLongs + extra) << 3; final int k = sketch.getK(); final long n = sketch.getN(); // If not-compact, have accessor always report full levels. Then use level size to determine // whether to copy data out. final DoublesSketchAccessor dsa = DoublesSketchAccessor.wrap(sketch, !compact); final int outBytes = (compact ? sketch.getCompactStorageBytes() : sketch.getUpdatableStorageBytes()); final byte[] outByteArr = new byte[outBytes]; final WritableMemory memOut = WritableMemory.wrap(outByteArr); //insert preamble-0, N, min, max insertPre0(memOut, preLongs, flags, k); if (sketch.isEmpty()) { return outByteArr; } insertN(memOut, n); insertMinDouble(memOut, sketch.getMinValue()); insertMaxDouble(memOut, sketch.getMaxValue()); long memOffsetBytes = prePlusExtraBytes; // might need to sort base buffer but don't want to change input sketch final int bbCnt = Util.computeBaseBufferItems(k, n); if (bbCnt > 0) { //Base buffer items only final double[] bbItemsArr = dsa.getArray(0, bbCnt); if (ordered) { Arrays.sort(bbItemsArr); } memOut.putDoubleArray(memOffsetBytes, bbItemsArr, 0, bbCnt); } // If n < 2k, totalLevels == 0 so ok to overshoot the offset update memOffsetBytes += (compact ? bbCnt : 2 * k) << 3; // If serializing from a compact sketch to a non-compact form, we may end up copying data for a // higher level one or more times into an unused level. A bit wasteful, but not incorrect. final int totalLevels = Util.computeTotalLevels(sketch.getBitPattern()); for (int lvl = 0; lvl < totalLevels; ++lvl) { dsa.setLevel(lvl); if (dsa.numItems() > 0) { assert dsa.numItems() == k; memOut.putDoubleArray(memOffsetBytes, dsa.getArray(0, k), 0, k); memOffsetBytes += (k << 3); } } return outByteArr; }
[ "private", "static", "byte", "[", "]", "convertToByteArray", "(", "final", "DoublesSketch", "sketch", ",", "final", "int", "flags", ",", "final", "boolean", "ordered", ",", "final", "boolean", "compact", ")", "{", "final", "int", "preLongs", "=", "2", ";", ...
Returns a byte array, including preamble, min, max and data extracted from the sketch. @param sketch the given DoublesSketch @param flags the Flags field @param ordered true if the desired form of the resulting array has the base buffer sorted. @param compact true if the desired form of the resulting array is in compact form. @return a byte array, including preamble, min, max and data extracted from the Combined Buffer.
[ "Returns", "a", "byte", "array", "including", "preamble", "min", "max", "and", "data", "extracted", "from", "the", "sketch", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesByteArrayImpl.java#L64-L114
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java
NetworkProfilesInner.getByResourceGroup
public NetworkProfileInner getByResourceGroup(String resourceGroupName, String networkProfileName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkProfileName).toBlocking().single().body(); }
java
public NetworkProfileInner getByResourceGroup(String resourceGroupName, String networkProfileName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkProfileName).toBlocking().single().body(); }
[ "public", "NetworkProfileInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "networkProfileName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkProfileName", ")", ".", "toBlocking", "(", ...
Gets the specified network profile in a specified resource group. @param resourceGroupName The name of the resource group. @param networkProfileName The name of the PublicIPPrefx. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the NetworkProfileInner object if successful.
[ "Gets", "the", "specified", "network", "profile", "in", "a", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java#L180-L182
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java
ChannelUpgradeHandler.addProtocol
public void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener) { addProtocol(productString, openListener, null); }
java
public void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener) { addProtocol(productString, openListener, null); }
[ "public", "void", "addProtocol", "(", "String", "productString", ",", "ChannelListener", "<", "?", "super", "StreamConnection", ">", "openListener", ")", "{", "addProtocol", "(", "productString", ",", "openListener", ",", "null", ")", ";", "}" ]
Add a protocol to this handler. @param productString the product string to match @param openListener the open listener to call
[ "Add", "a", "protocol", "to", "this", "handler", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java#L97-L99
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.stopStream
private void stopStream(User user, Stream stream, final KickflipCallback cb) { checkNotNull(stream); // TODO: Add start / stop lat lon to Stream? GenericData data = new GenericData(); data.put("stream_id", stream.getStreamId()); data.put("uuid", user.getUUID()); if (stream.getLatitude() != 0) { data.put("lat", stream.getLatitude()); } if (stream.getLongitude() != 0) { data.put("lon", stream.getLongitude()); } post(STOP_STREAM, new UrlEncodedContent(data), HlsStream.class, cb); }
java
private void stopStream(User user, Stream stream, final KickflipCallback cb) { checkNotNull(stream); // TODO: Add start / stop lat lon to Stream? GenericData data = new GenericData(); data.put("stream_id", stream.getStreamId()); data.put("uuid", user.getUUID()); if (stream.getLatitude() != 0) { data.put("lat", stream.getLatitude()); } if (stream.getLongitude() != 0) { data.put("lon", stream.getLongitude()); } post(STOP_STREAM, new UrlEncodedContent(data), HlsStream.class, cb); }
[ "private", "void", "stopStream", "(", "User", "user", ",", "Stream", "stream", ",", "final", "KickflipCallback", "cb", ")", "{", "checkNotNull", "(", "stream", ")", ";", "// TODO: Add start / stop lat lon to Stream?", "GenericData", "data", "=", "new", "GenericData"...
Stop a Stream owned by the given Kickflip User. @param cb This callback will receive a Stream subclass in #onSuccess(response) depending on the Kickflip account type. Implementors should check if the response is instanceof HlsStream, etc.
[ "Stop", "a", "Stream", "owned", "by", "the", "given", "Kickflip", "User", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L370-L383
E7du/jfinal-ext3
src/main/java/com/jfinal/ext/kit/SqlpKit.java
SqlpKit.selectOne
public static SqlPara selectOne(ModelExt<?> model, String... columns) { return SqlpKit.select(model, FLAG.ONE, columns); }
java
public static SqlPara selectOne(ModelExt<?> model, String... columns) { return SqlpKit.select(model, FLAG.ONE, columns); }
[ "public", "static", "SqlPara", "selectOne", "(", "ModelExt", "<", "?", ">", "model", ",", "String", "...", "columns", ")", "{", "return", "SqlpKit", ".", "select", "(", "model", ",", "FLAG", ".", "ONE", ",", "columns", ")", ";", "}" ]
make SqlPara use the model with attr datas. @param model @columns fetch columns
[ "make", "SqlPara", "use", "the", "model", "with", "attr", "datas", "." ]
train
https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/SqlpKit.java#L124-L126
trellis-ldp-archive/trellis-http
src/main/java/org/trellisldp/http/impl/RdfUtils.java
RdfUtils.getDefaultProfile
public static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier) { return getDefaultProfile(syntax, rdf.createIRI(identifier)); }
java
public static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier) { return getDefaultProfile(syntax, rdf.createIRI(identifier)); }
[ "public", "static", "IRI", "getDefaultProfile", "(", "final", "RDFSyntax", "syntax", ",", "final", "String", "identifier", ")", "{", "return", "getDefaultProfile", "(", "syntax", ",", "rdf", ".", "createIRI", "(", "identifier", ")", ")", ";", "}" ]
Get a default profile IRI from the syntax and/or identifier @param syntax the RDF syntax @param identifier the resource identifier @return a profile IRI usable by the output streamer
[ "Get", "a", "default", "profile", "IRI", "from", "the", "syntax", "and", "/", "or", "identifier" ]
train
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L230-L232
apache/incubator-zipkin
zipkin-collector/core/src/main/java/zipkin2/collector/CollectorSampler.java
CollectorSampler.isSampled
public boolean isSampled(String hexTraceId, boolean debug) { if (Boolean.TRUE.equals(debug)) return true; long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId); // The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity. // This converts to MAX_VALUE to avoid always dropping when traceId == Long.MIN_VALUE long t = traceId == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(traceId); return t <= boundary(); }
java
public boolean isSampled(String hexTraceId, boolean debug) { if (Boolean.TRUE.equals(debug)) return true; long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId); // The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity. // This converts to MAX_VALUE to avoid always dropping when traceId == Long.MIN_VALUE long t = traceId == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(traceId); return t <= boundary(); }
[ "public", "boolean", "isSampled", "(", "String", "hexTraceId", ",", "boolean", "debug", ")", "{", "if", "(", "Boolean", ".", "TRUE", ".", "equals", "(", "debug", ")", ")", "return", "true", ";", "long", "traceId", "=", "HexCodec", ".", "lowerHexToUnsignedL...
Returns true if spans with this trace ID should be recorded to storage. <p>Zipkin v1 allows storage-layer sampling, which can help prevent spikes in traffic from overloading the system. Debug spans are always stored. <p>This uses only the lower 64 bits of the trace ID as instrumentation still send mixed trace ID width. @param hexTraceId the lower 64 bits of the span's trace ID are checked against the boundary @param debug when true, always passes sampling
[ "Returns", "true", "if", "spans", "with", "this", "trace", "ID", "should", "be", "recorded", "to", "storage", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-collector/core/src/main/java/zipkin2/collector/CollectorSampler.java#L66-L73
Azure/azure-sdk-for-java
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java
VirtualNetworkRulesInner.beginCreateOrUpdateAsync
public Observable<VirtualNetworkRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkRuleInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "virtualNetworkRuleName", ",", "VirtualNetworkRuleInner", "parameters", ")", "{", "return", "beginCreateO...
Creates or updates an existing virtual network rule. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param virtualNetworkRuleName The name of the virtual network rule. @param parameters The requested virtual Network Rule Resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object
[ "Creates", "or", "updates", "an", "existing", "virtual", "network", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java#L312-L319
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/products/SwapAnnuity.java
SwapAnnuity.getSwapAnnuity
public static double getSwapAnnuity(ScheduleInterface schedule, ForwardCurveInterface forwardCurve) { DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName()); double evaluationTime = 0.0; // Consider only payment time > 0 return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModel( new CurveInterface[] {forwardCurve, discountCurve} )); }
java
public static double getSwapAnnuity(ScheduleInterface schedule, ForwardCurveInterface forwardCurve) { DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName()); double evaluationTime = 0.0; // Consider only payment time > 0 return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModel( new CurveInterface[] {forwardCurve, discountCurve} )); }
[ "public", "static", "double", "getSwapAnnuity", "(", "ScheduleInterface", "schedule", ",", "ForwardCurveInterface", "forwardCurve", ")", "{", "DiscountCurveInterface", "discountCurve", "=", "new", "DiscountCurveFromForwardCurve", "(", "forwardCurve", ".", "getName", "(", ...
Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve. The discount curve used to calculate the annuity is calculated from the forward curve using classical single curve interpretations of forwards and a default period length. The may be a crude approximation. Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata.products.SwapAnnuity#getSwapAnnuity(double, ScheduleInterface, DiscountCurveInterface, AnalyticModelInterface)}. @param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period. @param forwardCurve The forward curve. @return The swap annuity.
[ "Function", "to", "calculate", "an", "(", "idealized", ")", "single", "curve", "swap", "annuity", "for", "a", "given", "schedule", "and", "forward", "curve", ".", "The", "discount", "curve", "used", "to", "calculate", "the", "annuity", "is", "calculated", "f...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/products/SwapAnnuity.java#L99-L103
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/FieldMap.java
FieldMap.createEnterpriseCustomFieldMap
public void createEnterpriseCustomFieldMap(Props props, Class<?> c) { byte[] fieldMapData = null; for (Integer key : ENTERPRISE_CUSTOM_KEYS) { fieldMapData = props.getByteArray(key); if (fieldMapData != null) { break; } } if (fieldMapData != null) { int index = 4; while (index < fieldMapData.length) { //Looks like the custom fields have varying types, it may be that the last byte of the four represents the type? //System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false)); int typeValue = MPPUtility.getInt(fieldMapData, index); FieldType type = getFieldType(typeValue); if (type != null && type.getClass() == c && type.toString().startsWith("Enterprise Custom Field")) { int varDataKey = (typeValue & 0xFFFF); FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0); m_map.put(type, item); //System.out.println(item); } //System.out.println((type == null ? "?" : type.getClass().getSimpleName() + "." + type) + " " + Integer.toHexString(typeValue)); index += 4; } } }
java
public void createEnterpriseCustomFieldMap(Props props, Class<?> c) { byte[] fieldMapData = null; for (Integer key : ENTERPRISE_CUSTOM_KEYS) { fieldMapData = props.getByteArray(key); if (fieldMapData != null) { break; } } if (fieldMapData != null) { int index = 4; while (index < fieldMapData.length) { //Looks like the custom fields have varying types, it may be that the last byte of the four represents the type? //System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false)); int typeValue = MPPUtility.getInt(fieldMapData, index); FieldType type = getFieldType(typeValue); if (type != null && type.getClass() == c && type.toString().startsWith("Enterprise Custom Field")) { int varDataKey = (typeValue & 0xFFFF); FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0); m_map.put(type, item); //System.out.println(item); } //System.out.println((type == null ? "?" : type.getClass().getSimpleName() + "." + type) + " " + Integer.toHexString(typeValue)); index += 4; } } }
[ "public", "void", "createEnterpriseCustomFieldMap", "(", "Props", "props", ",", "Class", "<", "?", ">", "c", ")", "{", "byte", "[", "]", "fieldMapData", "=", "null", ";", "for", "(", "Integer", "key", ":", "ENTERPRISE_CUSTOM_KEYS", ")", "{", "fieldMapData", ...
Create a field map for enterprise custom fields. @param props props data @param c target class
[ "Create", "a", "field", "map", "for", "enterprise", "custom", "fields", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L316-L349
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java
DPathUtils.getValue
public static <T> T getValue(Object target, String dPath, Class<T> clazz) { if (clazz == null) { throw new NullPointerException("Class parameter is null!"); } Object temp = getValue(target, dPath); return ValueUtils.convertValue(temp, clazz); }
java
public static <T> T getValue(Object target, String dPath, Class<T> clazz) { if (clazz == null) { throw new NullPointerException("Class parameter is null!"); } Object temp = getValue(target, dPath); return ValueUtils.convertValue(temp, clazz); }
[ "public", "static", "<", "T", ">", "T", "getValue", "(", "Object", "target", ",", "String", "dPath", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Class param...
Extract a value from the target object using DPath expression (generic version). @param target @param dPath @param clazz @return
[ "Extract", "a", "value", "from", "the", "target", "object", "using", "DPath", "expression", "(", "generic", "version", ")", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L383-L389
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.listContentKeysAsync
public Observable<ListContentKeysResponseInner> listContentKeysAsync(String resourceGroupName, String accountName, String streamingLocatorName) { return listContentKeysWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<ListContentKeysResponseInner>, ListContentKeysResponseInner>() { @Override public ListContentKeysResponseInner call(ServiceResponse<ListContentKeysResponseInner> response) { return response.body(); } }); }
java
public Observable<ListContentKeysResponseInner> listContentKeysAsync(String resourceGroupName, String accountName, String streamingLocatorName) { return listContentKeysWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<ListContentKeysResponseInner>, ListContentKeysResponseInner>() { @Override public ListContentKeysResponseInner call(ServiceResponse<ListContentKeysResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ListContentKeysResponseInner", ">", "listContentKeysAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingLocatorName", ")", "{", "return", "listContentKeysWithServiceResponseAsync", "(", "resourceGrou...
List Content Keys. List Content Keys used by this Streaming Locator. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ListContentKeysResponseInner object
[ "List", "Content", "Keys", ".", "List", "Content", "Keys", "used", "by", "this", "Streaming", "Locator", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L703-L710
sockeqwe/sqlbrite-dao
objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableAnnotatedClass.java
ObjectMappableAnnotatedClass.isSetterForField
private boolean isSetterForField(ExecutableElement setter, VariableElement field) { return setter.getParameters() != null && setter.getParameters().size() == 1 && setter.getParameters().get(0).asType().equals(field.asType()); // TODO inheritance? TypeUtils is applicable? }
java
private boolean isSetterForField(ExecutableElement setter, VariableElement field) { return setter.getParameters() != null && setter.getParameters().size() == 1 && setter.getParameters().get(0).asType().equals(field.asType()); // TODO inheritance? TypeUtils is applicable? }
[ "private", "boolean", "isSetterForField", "(", "ExecutableElement", "setter", ",", "VariableElement", "field", ")", "{", "return", "setter", ".", "getParameters", "(", ")", "!=", "null", "&&", "setter", ".", "getParameters", "(", ")", ".", "size", "(", ")", ...
Checks if the setter method is valid for the given field @param setter The setter method @param field The field @return true if setter works for given field, otherwise false
[ "Checks", "if", "the", "setter", "method", "is", "valid", "for", "the", "given", "field" ]
train
https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableAnnotatedClass.java#L262-L267
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Truncatewords.java
Truncatewords.apply
@Override public Object apply(Object value, Object... params) { if (value == null) { return ""; } String text = super.asString(value); String[] words = text.split("\\s++"); int length = 15; String truncateString = "..."; if (params.length >= 1) { length = super.asNumber(super.get(0, params)).intValue(); } if (params.length >= 2) { truncateString = super.asString(super.get(1, params)); } if (length >= words.length) { return text; } return join(words, length) + truncateString; }
java
@Override public Object apply(Object value, Object... params) { if (value == null) { return ""; } String text = super.asString(value); String[] words = text.split("\\s++"); int length = 15; String truncateString = "..."; if (params.length >= 1) { length = super.asNumber(super.get(0, params)).intValue(); } if (params.length >= 2) { truncateString = super.asString(super.get(1, params)); } if (length >= words.length) { return text; } return join(words, length) + truncateString; }
[ "@", "Override", "public", "Object", "apply", "(", "Object", "value", ",", "Object", "...", "params", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "String", "text", "=", "super", ".", "asString", "(", "value", ")"...
/* truncatewords(input, words = 15, truncate_string = "...") Truncate a string down to x words
[ "/", "*", "truncatewords", "(", "input", "words", "=", "15", "truncate_string", "=", "...", ")" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Truncatewords.java#L10-L35
lucidworks/spark-solr
src/main/java/com/lucidworks/spark/query/SolrStreamIterator.java
SolrStreamIterator.getStreamContext
protected StreamContext getStreamContext() { StreamContext context = new StreamContext(); solrClientCache = new SparkSolrClientCache(cloudSolrClient, httpSolrClient); context.setSolrClientCache(solrClientCache); context.numWorkers = numWorkers; context.workerID = workerId; return context; }
java
protected StreamContext getStreamContext() { StreamContext context = new StreamContext(); solrClientCache = new SparkSolrClientCache(cloudSolrClient, httpSolrClient); context.setSolrClientCache(solrClientCache); context.numWorkers = numWorkers; context.workerID = workerId; return context; }
[ "protected", "StreamContext", "getStreamContext", "(", ")", "{", "StreamContext", "context", "=", "new", "StreamContext", "(", ")", ";", "solrClientCache", "=", "new", "SparkSolrClientCache", "(", "cloudSolrClient", ",", "httpSolrClient", ")", ";", "context", ".", ...
We have to set the streaming context so that we can pass our own cloud client with authentication
[ "We", "have", "to", "set", "the", "streaming", "context", "so", "that", "we", "can", "pass", "our", "own", "cloud", "client", "with", "authentication" ]
train
https://github.com/lucidworks/spark-solr/blob/8ff1b3cdd99041be6070077c18ec9c1cd7257cc3/src/main/java/com/lucidworks/spark/query/SolrStreamIterator.java#L67-L74
drinkjava2/jDialects
core/src/main/java/com/github/drinkjava2/jdialects/model/TableModel.java
TableModel.sequenceGenerator
public void sequenceGenerator(String name, String sequenceName, Integer initialValue, Integer allocationSize) { checkReadOnly(); this.addGenerator(new SequenceIdGenerator(name, sequenceName, initialValue, allocationSize)); }
java
public void sequenceGenerator(String name, String sequenceName, Integer initialValue, Integer allocationSize) { checkReadOnly(); this.addGenerator(new SequenceIdGenerator(name, sequenceName, initialValue, allocationSize)); }
[ "public", "void", "sequenceGenerator", "(", "String", "name", ",", "String", "sequenceName", ",", "Integer", "initialValue", ",", "Integer", "allocationSize", ")", "{", "checkReadOnly", "(", ")", ";", "this", ".", "addGenerator", "(", "new", "SequenceIdGenerator",...
Add a sequence definition DDL, note: some dialects do not support sequence @param name The name of sequence Java object itself @param sequenceName the name of the sequence will created in database @param initialValue The initial value @param allocationSize The allocationSize
[ "Add", "a", "sequence", "definition", "DDL", "note", ":", "some", "dialects", "do", "not", "support", "sequence" ]
train
https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/model/TableModel.java#L164-L167
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/ComapiClient.java
ComapiClient.copyLogs
public void copyLogs(@NonNull File file, Callback<File> callback) { adapter.adapt(super.copyLogs(file), callback); }
java
public void copyLogs(@NonNull File file, Callback<File> callback) { adapter.adapt(super.copyLogs(file), callback); }
[ "public", "void", "copyLogs", "(", "@", "NonNull", "File", "file", ",", "Callback", "<", "File", ">", "callback", ")", "{", "adapter", ".", "adapt", "(", "super", ".", "copyLogs", "(", "file", ")", ",", "callback", ")", ";", "}" ]
Gets the content of internal log files merged into provided file. @param file File to merge internal logs into. @param callback Callback with a same file this time containing all the internal logs merged into.
[ "Gets", "the", "content", "of", "internal", "log", "files", "merged", "into", "provided", "file", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/ComapiClient.java#L105-L107
sriharshachilakapati/WebGL4J
webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java
WebGL10.glBindTexture
public static void glBindTexture(int target, int textureID) { checkContextCompatibility(); nglBindTexture(target, WebGLObjectMap.get().toTexture(textureID)); }
java
public static void glBindTexture(int target, int textureID) { checkContextCompatibility(); nglBindTexture(target, WebGLObjectMap.get().toTexture(textureID)); }
[ "public", "static", "void", "glBindTexture", "(", "int", "target", ",", "int", "textureID", ")", "{", "checkContextCompatibility", "(", ")", ";", "nglBindTexture", "(", "target", ",", "WebGLObjectMap", ".", "get", "(", ")", ".", "toTexture", "(", "textureID", ...
<p>{@code glBindTexture} lets you create or use a named texture. Calling {@code glBindTexture} with target set to {@link #GL_TEXTURE_2D}, {@link #GL_TEXTURE_CUBE_MAP}, and texture set to the name of the new texture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.</p> <p>{@link #GL_INVALID_ENUM} is generated if target is not one of the allowable values.</p> <p>{@link #GL_INVALID_VALUE} is generated if target is not a name returned from a previous call to {@link #glCreateTexture()}.</p> <p>{@link #GL_INVALID_OPERATION} is generated if texture was previously created with a {@code target} that doesn't match that of {@code target}.</p> @param target Specifies the target to which the texture is bound. Must be either {@link #GL_TEXTURE_2D} or {@link #GL_TEXTURE_CUBE_MAP}. @param textureID Specifies the name of a texture.
[ "<p", ">", "{", "@code", "glBindTexture", "}", "lets", "you", "create", "or", "use", "a", "named", "texture", ".", "Calling", "{", "@code", "glBindTexture", "}", "with", "target", "set", "to", "{", "@link", "#GL_TEXTURE_2D", "}", "{", "@link", "#GL_TEXTURE...
train
https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L642-L646
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DINameSpace.java
DINameSpace.classForMethodFQN
Class classForMethodFQN(String fqn) { try { return classForName(fqn.substring(0, fqn.lastIndexOf('.'))); } catch (Exception e) { return null; } }
java
Class classForMethodFQN(String fqn) { try { return classForName(fqn.substring(0, fqn.lastIndexOf('.'))); } catch (Exception e) { return null; } }
[ "Class", "classForMethodFQN", "(", "String", "fqn", ")", "{", "try", "{", "return", "classForName", "(", "fqn", ".", "substring", "(", "0", ",", "fqn", ".", "lastIndexOf", "(", "'", "'", ")", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", ...
Retrieves the declaring <code>Class</code> object for the specified fully qualified method name, using (if possible) the classLoader attribute of this object's database. <p> @param fqn the fully qualified name of the method for which to retrieve the declaring <code>Class</code> object. @return the declaring <code>Class</code> object for the specified fully qualified method name
[ "Retrieves", "the", "declaring", "<code", ">", "Class<", "/", "code", ">", "object", "for", "the", "specified", "fully", "qualified", "method", "name", "using", "(", "if", "possible", ")", "the", "classLoader", "attribute", "of", "this", "object", "s", "data...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DINameSpace.java#L116-L123
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java
QuasiNewtonBFGS.setFunction
public void setFunction( GradientLineFunction function , double funcMinValue ) { this.function = function; this.funcMinValue = funcMinValue; lineSearch.setFunction(function,funcMinValue); N = function.getN(); B = new DMatrixRMaj(N,N); searchVector = new DMatrixRMaj(N,1); g = new DMatrixRMaj(N,1); s = new DMatrixRMaj(N,1); y = new DMatrixRMaj(N,1); x = new DMatrixRMaj(N,1); temp0_Nx1 = new DMatrixRMaj(N,1); temp1_Nx1 = new DMatrixRMaj(N,1); }
java
public void setFunction( GradientLineFunction function , double funcMinValue ) { this.function = function; this.funcMinValue = funcMinValue; lineSearch.setFunction(function,funcMinValue); N = function.getN(); B = new DMatrixRMaj(N,N); searchVector = new DMatrixRMaj(N,1); g = new DMatrixRMaj(N,1); s = new DMatrixRMaj(N,1); y = new DMatrixRMaj(N,1); x = new DMatrixRMaj(N,1); temp0_Nx1 = new DMatrixRMaj(N,1); temp1_Nx1 = new DMatrixRMaj(N,1); }
[ "public", "void", "setFunction", "(", "GradientLineFunction", "function", ",", "double", "funcMinValue", ")", "{", "this", ".", "function", "=", "function", ";", "this", ".", "funcMinValue", "=", "funcMinValue", ";", "lineSearch", ".", "setFunction", "(", "funct...
Specify the function being optimized @param function Function to optimize @param funcMinValue Minimum possible function value. E.g. 0 for least squares.
[ "Specify", "the", "function", "being", "optimized" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java#L122-L138
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
AtomicIntegerFieldUpdater.addAndGet
public int addAndGet(T obj, int delta) { int prev, next; do { prev = get(obj); next = prev + delta; } while (!compareAndSet(obj, prev, next)); return next; }
java
public int addAndGet(T obj, int delta) { int prev, next; do { prev = get(obj); next = prev + delta; } while (!compareAndSet(obj, prev, next)); return next; }
[ "public", "int", "addAndGet", "(", "T", "obj", ",", "int", "delta", ")", "{", "int", "prev", ",", "next", ";", "do", "{", "prev", "=", "get", "(", "obj", ")", ";", "next", "=", "prev", "+", "delta", ";", "}", "while", "(", "!", "compareAndSet", ...
Atomically adds the given value to the current value of the field of the given object managed by this updater. @param obj An object whose field to get and set @param delta the value to add @return the updated value
[ "Atomically", "adds", "the", "given", "value", "to", "the", "current", "value", "of", "the", "field", "of", "the", "given", "object", "managed", "by", "this", "updater", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java#L265-L272
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.postBuildInfo
public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion)); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST buildInfo"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
java
public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion)); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST buildInfo"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
[ "public", "void", "postBuildInfo", "(", "final", "String", "moduleName", ",", "final", "String", "moduleVersion", ",", "final", "Map", "<", "String", ",", "String", ">", "buildInfo", ",", "final", "String", "user", ",", "final", "String", "password", ")", "t...
Post a build info to the server @param moduleName String @param moduleVersion String @param buildInfo Map<String,String> @param user String @param password String @throws GrapesCommunicationException @throws javax.naming.AuthenticationException
[ "Post", "a", "build", "info", "to", "the", "server" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L130-L143
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java
Broadcast.lte
public static INDArray lte(INDArray x, INDArray y, INDArray z, int... dimensions) { if(dimensions == null || dimensions.length == 0) { validateShapesNoDimCase(x,y,z); return Nd4j.getExecutioner().exec(new OldLessThanOrEqual(x,y,z)); } return Nd4j.getExecutioner().exec(new BroadcastLessThanOrEqual(x,y,z,dimensions)); }
java
public static INDArray lte(INDArray x, INDArray y, INDArray z, int... dimensions) { if(dimensions == null || dimensions.length == 0) { validateShapesNoDimCase(x,y,z); return Nd4j.getExecutioner().exec(new OldLessThanOrEqual(x,y,z)); } return Nd4j.getExecutioner().exec(new BroadcastLessThanOrEqual(x,y,z,dimensions)); }
[ "public", "static", "INDArray", "lte", "(", "INDArray", "x", ",", "INDArray", "y", ",", "INDArray", "z", ",", "int", "...", "dimensions", ")", "{", "if", "(", "dimensions", "==", "null", "||", "dimensions", ".", "length", "==", "0", ")", "{", "validate...
Broadcast less than or equal to op. See: {@link BroadcastLessThanOrEqual}
[ "Broadcast", "less", "than", "or", "equal", "to", "op", ".", "See", ":", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Broadcast.java#L125-L132
wildfly-extras/wildfly-camel
subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java
CamelEndpointDeployerService.deploy
public void deploy(URI uri, final HttpHandler routingHandler) { final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments(); if (!availableDeployments.stream().anyMatch( deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) { /* deploy only if the routing handler is not there already */ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler); deployment.setInitialHandler(servletHandler); }); } }
java
public void deploy(URI uri, final HttpHandler routingHandler) { final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments(); if (!availableDeployments.stream().anyMatch( deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) { /* deploy only if the routing handler is not there already */ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler); deployment.setInitialHandler(servletHandler); }); } }
[ "public", "void", "deploy", "(", "URI", "uri", ",", "final", "HttpHandler", "routingHandler", ")", "{", "final", "Set", "<", "Deployment", ">", "availableDeployments", "=", "hostSupplier", ".", "getValue", "(", ")", ".", "getDeployments", "(", ")", ";", "if"...
Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path. @param uri determines the path and protocol under which the HTTP endpoint should be exposed @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given {@link URI}'s path
[ "Exposes", "an", "HTTP", "endpoint", "that", "will", "be", "served", "by", "the", "given", "{", "@link", "HttpHandler", "}", "under", "the", "given", "{", "@link", "URI", "}", "s", "path", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java#L440-L455
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java
ContentKeyPoliciesInner.createOrUpdate
public ContentKeyPolicyInner createOrUpdate(String resourceGroupName, String accountName, String contentKeyPolicyName, ContentKeyPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName, parameters).toBlocking().single().body(); }
java
public ContentKeyPolicyInner createOrUpdate(String resourceGroupName, String accountName, String contentKeyPolicyName, ContentKeyPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, contentKeyPolicyName, parameters).toBlocking().single().body(); }
[ "public", "ContentKeyPolicyInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "contentKeyPolicyName", ",", "ContentKeyPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resour...
Create or update an Content Key Policy. Create or update a Content Key Policy in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param contentKeyPolicyName The Content Key Policy name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContentKeyPolicyInner object if successful.
[ "Create", "or", "update", "an", "Content", "Key", "Policy", ".", "Create", "or", "update", "a", "Content", "Key", "Policy", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/ContentKeyPoliciesInner.java#L474-L476
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java
DataTree.updateCount
public void updateCount(String lastPrefix, int diff) { String statNode = Quotas.statPath(lastPrefix); DataNode node = nodes.get(statNode); StatsTrack updatedStat = null; if (node == null) { // should not happen LOG.error("Missing count node for stat " + statNode); return; } synchronized (node) { updatedStat = new StatsTrack(new String(node.data)); updatedStat.setCount(updatedStat.getCount() + diff); node.data = updatedStat.toString().getBytes(); } // now check if the counts match the quota String quotaNode = Quotas.quotaPath(lastPrefix); node = nodes.get(quotaNode); StatsTrack thisStats = null; if (node == null) { // should not happen LOG.error("Missing count node for quota " + quotaNode); return; } synchronized (node) { thisStats = new StatsTrack(new String(node.data)); } if (thisStats.getCount() < updatedStat.getCount()) { LOG .warn("Quota exceeded: " + lastPrefix + " count=" + updatedStat.getCount() + " limit=" + thisStats.getCount()); } }
java
public void updateCount(String lastPrefix, int diff) { String statNode = Quotas.statPath(lastPrefix); DataNode node = nodes.get(statNode); StatsTrack updatedStat = null; if (node == null) { // should not happen LOG.error("Missing count node for stat " + statNode); return; } synchronized (node) { updatedStat = new StatsTrack(new String(node.data)); updatedStat.setCount(updatedStat.getCount() + diff); node.data = updatedStat.toString().getBytes(); } // now check if the counts match the quota String quotaNode = Quotas.quotaPath(lastPrefix); node = nodes.get(quotaNode); StatsTrack thisStats = null; if (node == null) { // should not happen LOG.error("Missing count node for quota " + quotaNode); return; } synchronized (node) { thisStats = new StatsTrack(new String(node.data)); } if (thisStats.getCount() < updatedStat.getCount()) { LOG .warn("Quota exceeded: " + lastPrefix + " count=" + updatedStat.getCount() + " limit=" + thisStats.getCount()); } }
[ "public", "void", "updateCount", "(", "String", "lastPrefix", ",", "int", "diff", ")", "{", "String", "statNode", "=", "Quotas", ".", "statPath", "(", "lastPrefix", ")", ";", "DataNode", "node", "=", "nodes", ".", "get", "(", "statNode", ")", ";", "Stats...
update the count of this stat datanode @param lastPrefix the path of the node that is quotaed. @param diff the diff to be added to the count
[ "update", "the", "count", "of", "this", "stat", "datanode" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java#L351-L383
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isMethodCallOnObject
public static boolean isMethodCallOnObject(Expression expression, String methodObjectPattern) { if (expression instanceof MethodCallExpression) { Expression objectExpression = ((MethodCallExpression) expression).getObjectExpression(); if (objectExpression instanceof VariableExpression) { String name = ((VariableExpression) objectExpression).getName(); if (name != null && name.matches(methodObjectPattern)) { return true; } } if (objectExpression instanceof PropertyExpression && objectExpression.getText() != null && objectExpression.getText().matches(methodObjectPattern)) { return true; } if (objectExpression instanceof MethodCallExpression && isMethodNamed((MethodCallExpression) objectExpression, methodObjectPattern)) { return true; } } return false; }
java
public static boolean isMethodCallOnObject(Expression expression, String methodObjectPattern) { if (expression instanceof MethodCallExpression) { Expression objectExpression = ((MethodCallExpression) expression).getObjectExpression(); if (objectExpression instanceof VariableExpression) { String name = ((VariableExpression) objectExpression).getName(); if (name != null && name.matches(methodObjectPattern)) { return true; } } if (objectExpression instanceof PropertyExpression && objectExpression.getText() != null && objectExpression.getText().matches(methodObjectPattern)) { return true; } if (objectExpression instanceof MethodCallExpression && isMethodNamed((MethodCallExpression) objectExpression, methodObjectPattern)) { return true; } } return false; }
[ "public", "static", "boolean", "isMethodCallOnObject", "(", "Expression", "expression", ",", "String", "methodObjectPattern", ")", "{", "if", "(", "expression", "instanceof", "MethodCallExpression", ")", "{", "Expression", "objectExpression", "=", "(", "(", "MethodCal...
Tells you if the expression is a method call on a particular object (which is represented as a String). For instance, you may ask isMethodCallOnObject(e, 'this') to find a this reference. @param expression - the expression @param methodObjectPattern - the name of the method object (receiver) such as 'this' @return as described
[ "Tells", "you", "if", "the", "expression", "is", "a", "method", "call", "on", "a", "particular", "object", "(", "which", "is", "represented", "as", "a", "String", ")", ".", "For", "instance", "you", "may", "ask", "isMethodCallOnObject", "(", "e", "this", ...
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L264-L281
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/query/SqlQuery.java
SqlQuery.namedQuery
public static @NotNull SqlQuery namedQuery(@NotNull @SQL String sql, @NotNull Object bean) { return namedQuery(sql, VariableResolver.forBean(bean)); }
java
public static @NotNull SqlQuery namedQuery(@NotNull @SQL String sql, @NotNull Object bean) { return namedQuery(sql, VariableResolver.forBean(bean)); }
[ "public", "static", "@", "NotNull", "SqlQuery", "namedQuery", "(", "@", "NotNull", "@", "SQL", "String", "sql", ",", "@", "NotNull", "Object", "bean", ")", "{", "return", "namedQuery", "(", "sql", ",", "VariableResolver", ".", "forBean", "(", "bean", ")", ...
Constructs a query with named arguments, using the properties/fields of given bean for resolving arguments. @see #namedQuery(String, VariableResolver) @see VariableResolver#forBean(Object)
[ "Constructs", "a", "query", "with", "named", "arguments", "using", "the", "properties", "/", "fields", "of", "given", "bean", "for", "resolving", "arguments", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/query/SqlQuery.java#L91-L93
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/BeanProvider.java
BeanProvider.getContextualReference
private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans) { Bean<?> bean = beanManager.resolve(beans); //logWarningIfDependent(bean); CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean); @SuppressWarnings({ "unchecked", "UnnecessaryLocalVariable" }) T result = (T) beanManager.getReference(bean, type, creationalContext); return result; }
java
private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans) { Bean<?> bean = beanManager.resolve(beans); //logWarningIfDependent(bean); CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean); @SuppressWarnings({ "unchecked", "UnnecessaryLocalVariable" }) T result = (T) beanManager.getReference(bean, type, creationalContext); return result; }
[ "private", "static", "<", "T", ">", "T", "getContextualReference", "(", "Class", "<", "T", ">", "type", ",", "BeanManager", "beanManager", ",", "Set", "<", "Bean", "<", "?", ">", ">", "beans", ")", "{", "Bean", "<", "?", ">", "bean", "=", "beanManage...
Internal helper method to resolve the right bean and resolve the contextual reference. @param type the type of the bean in question @param beanManager current bean-manager @param beans beans in question @param <T> target type @return the contextual reference
[ "Internal", "helper", "method", "to", "resolve", "the", "right", "bean", "and", "resolve", "the", "contextual", "reference", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/BeanProvider.java#L411-L422
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.getText
public static String getText(Path self, String charset) throws IOException { return IOGroovyMethods.getText(newReader(self, charset)); }
java
public static String getText(Path self, String charset) throws IOException { return IOGroovyMethods.getText(newReader(self, charset)); }
[ "public", "static", "String", "getText", "(", "Path", "self", ",", "String", "charset", ")", "throws", "IOException", "{", "return", "IOGroovyMethods", ".", "getText", "(", "newReader", "(", "self", ",", "charset", ")", ")", ";", "}" ]
Read the content of the Path using the specified encoding and return it as a String. @param self the file whose content we want to read @param charset the charset used to read the content of the file @return a String containing the content of the file @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "Read", "the", "content", "of", "the", "Path", "using", "the", "specified", "encoding", "and", "return", "it", "as", "a", "String", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L380-L382
aws/aws-sdk-java
aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/MetricFilterMatchRecord.java
MetricFilterMatchRecord.withExtractedValues
public MetricFilterMatchRecord withExtractedValues(java.util.Map<String, String> extractedValues) { setExtractedValues(extractedValues); return this; }
java
public MetricFilterMatchRecord withExtractedValues(java.util.Map<String, String> extractedValues) { setExtractedValues(extractedValues); return this; }
[ "public", "MetricFilterMatchRecord", "withExtractedValues", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "extractedValues", ")", "{", "setExtractedValues", "(", "extractedValues", ")", ";", "return", "this", ";", "}" ]
<p> The values extracted from the event data by the filter. </p> @param extractedValues The values extracted from the event data by the filter. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "values", "extracted", "from", "the", "event", "data", "by", "the", "filter", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/MetricFilterMatchRecord.java#L168-L171
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DatanodeBlockInfo.java
DatanodeBlockInfo.detachFile
private void detachFile(int namespaceId, File file, Block b) throws IOException { File tmpFile = blockDataFile.volume.createDetachFile(namespaceId, b, file.getName()); try { IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16*1024, true); if (file.length() != tmpFile.length()) { throw new IOException("Copy of file " + file + " size " + file.length()+ " into file " + tmpFile + " resulted in a size of " + tmpFile.length()); } FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete(); if (!done) { DataNode.LOG.info("detachFile failed to delete temporary file " + tmpFile); } throw e; } }
java
private void detachFile(int namespaceId, File file, Block b) throws IOException { File tmpFile = blockDataFile.volume.createDetachFile(namespaceId, b, file.getName()); try { IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(tmpFile), 16*1024, true); if (file.length() != tmpFile.length()) { throw new IOException("Copy of file " + file + " size " + file.length()+ " into file " + tmpFile + " resulted in a size of " + tmpFile.length()); } FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete(); if (!done) { DataNode.LOG.info("detachFile failed to delete temporary file " + tmpFile); } throw e; } }
[ "private", "void", "detachFile", "(", "int", "namespaceId", ",", "File", "file", ",", "Block", "b", ")", "throws", "IOException", "{", "File", "tmpFile", "=", "blockDataFile", ".", "volume", ".", "createDetachFile", "(", "namespaceId", ",", "b", ",", "file",...
Copy specified file into a temporary file. Then rename the temporary file to the original name. This will cause any hardlinks to the original file to be removed. The temporary files are created in the detachDir. The temporary files will be recovered (especially on Windows) on datanode restart.
[ "Copy", "specified", "file", "into", "a", "temporary", "file", ".", "Then", "rename", "the", "temporary", "file", "to", "the", "original", "name", ".", "This", "will", "cause", "any", "hardlinks", "to", "the", "original", "file", "to", "be", "removed", "."...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DatanodeBlockInfo.java#L186-L206
alkacon/opencms-core
src/org/opencms/acacia/shared/CmsEntity.java
CmsEntity.setAttributeValue
public void setAttributeValue(String attributeName, CmsEntity value) { // make sure there is no attribute value set removeAttributeSilent(attributeName); addAttributeValue(attributeName, value); }
java
public void setAttributeValue(String attributeName, CmsEntity value) { // make sure there is no attribute value set removeAttributeSilent(attributeName); addAttributeValue(attributeName, value); }
[ "public", "void", "setAttributeValue", "(", "String", "attributeName", ",", "CmsEntity", "value", ")", "{", "// make sure there is no attribute value set\r", "removeAttributeSilent", "(", "attributeName", ")", ";", "addAttributeValue", "(", "attributeName", ",", "value", ...
Sets the given attribute value. Will remove all previous attribute values.<p> @param attributeName the attribute name @param value the attribute value
[ "Sets", "the", "given", "attribute", "value", ".", "Will", "remove", "all", "previous", "attribute", "values", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L583-L588
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateCertificatePolicy
public CertificatePolicy updateCertificatePolicy(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy) { return updateCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy).toBlocking().single().body(); }
java
public CertificatePolicy updateCertificatePolicy(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy) { return updateCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy).toBlocking().single().body(); }
[ "public", "CertificatePolicy", "updateCertificatePolicy", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "CertificatePolicy", "certificatePolicy", ")", "{", "return", "updateCertificatePolicyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificat...
Updates the policy for a certificate. Set specified members in the certificate policy. Leave others as null. This operation requires the certificates/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate in the given vault. @param certificatePolicy The policy for the certificate. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CertificatePolicy object if successful.
[ "Updates", "the", "policy", "for", "a", "certificate", ".", "Set", "specified", "members", "in", "the", "certificate", "policy", ".", "Leave", "others", "as", "null", ".", "This", "operation", "requires", "the", "certificates", "/", "update", "permission", "."...
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#L7241-L7243
google/closure-compiler
src/com/google/javascript/jscomp/NodeTraversal.java
NodeTraversal.traverseChangedFunctions
public static void traverseChangedFunctions( final AbstractCompiler compiler, final ChangeScopeRootCallback callback) { final Node jsRoot = compiler.getJsRoot(); NodeTraversal.traverse(compiler, jsRoot, new AbstractPreOrderCallback() { @Override public final boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { if (NodeUtil.isChangeScopeRoot(n) && compiler.hasScopeChanged(n)) { callback.enterChangeScopeRoot(compiler, n); } return true; } }); }
java
public static void traverseChangedFunctions( final AbstractCompiler compiler, final ChangeScopeRootCallback callback) { final Node jsRoot = compiler.getJsRoot(); NodeTraversal.traverse(compiler, jsRoot, new AbstractPreOrderCallback() { @Override public final boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { if (NodeUtil.isChangeScopeRoot(n) && compiler.hasScopeChanged(n)) { callback.enterChangeScopeRoot(compiler, n); } return true; } }); }
[ "public", "static", "void", "traverseChangedFunctions", "(", "final", "AbstractCompiler", "compiler", ",", "final", "ChangeScopeRootCallback", "callback", ")", "{", "final", "Node", "jsRoot", "=", "compiler", ".", "getJsRoot", "(", ")", ";", "NodeTraversal", ".", ...
Traversal for passes that work only on changed functions. Suppose a loopable pass P1 uses this traversal. Then, if a function doesn't change between two runs of P1, it won't look at the function the second time. (We're assuming that P1 runs to a fixpoint, o/w we may miss optimizations.) <p>Most changes are reported with calls to Compiler.reportCodeChange(), which doesn't know which scope changed. We keep track of the current scope by calling Compiler.setScope inside pushScope and popScope. The automatic tracking can be wrong in rare cases when a pass changes scope w/out causing a call to pushScope or popScope. Passes that do cross-scope modifications call Compiler.reportChangeToEnclosingScope(Node n).
[ "Traversal", "for", "passes", "that", "work", "only", "on", "changed", "functions", ".", "Suppose", "a", "loopable", "pass", "P1", "uses", "this", "traversal", ".", "Then", "if", "a", "function", "doesn", "t", "change", "between", "two", "runs", "of", "P1"...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L779-L792
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java
ParseUtil.convertLike
static Selector convertLike(Selector arg, String pattern, String escape) { try { pattern = reduceStringLiteralToken(pattern); boolean escaped = false; char esc = 0; if (escape != null) { escape = reduceStringLiteralToken(escape); if (escape.length() != 1) return null; escaped = true; esc = escape.charAt(0); } return Matching.getInstance().createLikeOperator(arg, pattern, escaped, esc); } catch (Exception e) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.selector.impl.ParseUtil.convertLike", e, "1:183:1.19"); // This should never occur as to get into this we should be missing // the sib.matchspace jar file, but we are already in it. throw new RuntimeException(e); } }
java
static Selector convertLike(Selector arg, String pattern, String escape) { try { pattern = reduceStringLiteralToken(pattern); boolean escaped = false; char esc = 0; if (escape != null) { escape = reduceStringLiteralToken(escape); if (escape.length() != 1) return null; escaped = true; esc = escape.charAt(0); } return Matching.getInstance().createLikeOperator(arg, pattern, escaped, esc); } catch (Exception e) { // No FFDC Code Needed. // FFDC driven by wrapper class. FFDC.processException(cclass, "com.ibm.ws.sib.matchspace.selector.impl.ParseUtil.convertLike", e, "1:183:1.19"); // This should never occur as to get into this we should be missing // the sib.matchspace jar file, but we are already in it. throw new RuntimeException(e); } }
[ "static", "Selector", "convertLike", "(", "Selector", "arg", ",", "String", "pattern", ",", "String", "escape", ")", "{", "try", "{", "pattern", "=", "reduceStringLiteralToken", "(", "pattern", ")", ";", "boolean", "escaped", "=", "false", ";", "char", "esc"...
Convert a partially parsed LIKE expression, in which the pattern and escape are in the form of token images, to the proper Selector expression to represent the LIKE expression @param arg the argument of the like @param pattern the pattern image (still containing leading and trailing ') @param escape the escape (still containing leading and trailing ') or null @return an appropriate Selector or null if the pattern and/or escape are syntactically invalid
[ "Convert", "a", "partially", "parsed", "LIKE", "expression", "in", "which", "the", "pattern", "and", "escape", "are", "in", "the", "form", "of", "token", "images", "to", "the", "proper", "Selector", "expression", "to", "represent", "the", "LIKE", "expression" ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ParseUtil.java#L139-L167
ept/warc-hadoop
src/main/java/com/martinkl/warc/mapred/WARCInputFormat.java
WARCInputFormat.getRecordReader
@Override public RecordReader<LongWritable, WARCWritable> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { reporter.setStatus(split.toString()); return new WARCReader(job, (FileSplit) split); }
java
@Override public RecordReader<LongWritable, WARCWritable> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { reporter.setStatus(split.toString()); return new WARCReader(job, (FileSplit) split); }
[ "@", "Override", "public", "RecordReader", "<", "LongWritable", ",", "WARCWritable", ">", "getRecordReader", "(", "InputSplit", "split", ",", "JobConf", "job", ",", "Reporter", "reporter", ")", "throws", "IOException", "{", "reporter", ".", "setStatus", "(", "sp...
Opens a WARC file (possibly compressed) for reading, and returns a RecordReader for accessing it.
[ "Opens", "a", "WARC", "file", "(", "possibly", "compressed", ")", "for", "reading", "and", "returns", "a", "RecordReader", "for", "accessing", "it", "." ]
train
https://github.com/ept/warc-hadoop/blob/f41cbb8002c29053eed9206e50ab9787de7da67f/src/main/java/com/martinkl/warc/mapred/WARCInputFormat.java#L37-L42
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java
URLConnection.lookupContentHandlerClassFor
private ContentHandler lookupContentHandlerClassFor(String contentType) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String contentHandlerClassName = typeToPackageName(contentType); String contentHandlerPkgPrefixes =getContentHandlerPkgPrefixes(); StringTokenizer packagePrefixIter = new StringTokenizer(contentHandlerPkgPrefixes, "|"); while (packagePrefixIter.hasMoreTokens()) { String packagePrefix = packagePrefixIter.nextToken().trim(); try { String clsName = packagePrefix + "." + contentHandlerClassName; Class cls = null; try { cls = Class.forName(clsName); } catch (ClassNotFoundException e) { ClassLoader cl = ClassLoader.getSystemClassLoader(); if (cl != null) { cls = cl.loadClass(clsName); } } if (cls != null) { ContentHandler handler = (ContentHandler)cls.newInstance(); return handler; } } catch(Exception e) { } } return UnknownContentHandler.INSTANCE; }
java
private ContentHandler lookupContentHandlerClassFor(String contentType) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String contentHandlerClassName = typeToPackageName(contentType); String contentHandlerPkgPrefixes =getContentHandlerPkgPrefixes(); StringTokenizer packagePrefixIter = new StringTokenizer(contentHandlerPkgPrefixes, "|"); while (packagePrefixIter.hasMoreTokens()) { String packagePrefix = packagePrefixIter.nextToken().trim(); try { String clsName = packagePrefix + "." + contentHandlerClassName; Class cls = null; try { cls = Class.forName(clsName); } catch (ClassNotFoundException e) { ClassLoader cl = ClassLoader.getSystemClassLoader(); if (cl != null) { cls = cl.loadClass(clsName); } } if (cls != null) { ContentHandler handler = (ContentHandler)cls.newInstance(); return handler; } } catch(Exception e) { } } return UnknownContentHandler.INSTANCE; }
[ "private", "ContentHandler", "lookupContentHandlerClassFor", "(", "String", "contentType", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "ClassNotFoundException", "{", "String", "contentHandlerClassName", "=", "typeToPackageName", "(", "contentTyp...
Looks for a content handler in a user-defineable set of places. By default it looks in sun.net.www.content, but users can define a vertical-bar delimited set of class prefixes to search through in addition by defining the java.content.handler.pkgs property. The class name must be of the form: <pre> {package-prefix}.{major}.{minor} e.g. YoyoDyne.experimental.text.plain </pre>
[ "Looks", "for", "a", "content", "handler", "in", "a", "user", "-", "defineable", "set", "of", "places", ".", "By", "default", "it", "looks", "in", "sun", ".", "net", ".", "www", ".", "content", "but", "users", "can", "define", "a", "vertical", "-", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1299-L1332
hawkular/hawkular-apm
api/src/main/java/org/hawkular/apm/api/model/trace/Node.java
Node.findCorrelatedNodes
protected void findCorrelatedNodes(CorrelationIdentifier cid, Set<Node> nodes) { if (isCorrelated(cid)) { nodes.add(this); } }
java
protected void findCorrelatedNodes(CorrelationIdentifier cid, Set<Node> nodes) { if (isCorrelated(cid)) { nodes.add(this); } }
[ "protected", "void", "findCorrelatedNodes", "(", "CorrelationIdentifier", "cid", ",", "Set", "<", "Node", ">", "nodes", ")", "{", "if", "(", "isCorrelated", "(", "cid", ")", ")", "{", "nodes", ".", "add", "(", "this", ")", ";", "}", "}" ]
This method identifies all of the nodes within a trace that are associated with the supplied correlation identifier. @param cid The correlation identifier @param nodes The set of nodes that are associated with the correlation identifier
[ "This", "method", "identifies", "all", "of", "the", "nodes", "within", "a", "trace", "that", "are", "associated", "with", "the", "supplied", "correlation", "identifier", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/model/trace/Node.java#L360-L364
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET
public OvhAfnicCorporationTrademarkContact data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET(Long afnicCorporationTrademarkId) throws IOException { String qPath = "/domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId}"; StringBuilder sb = path(qPath, afnicCorporationTrademarkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAfnicCorporationTrademarkContact.class); }
java
public OvhAfnicCorporationTrademarkContact data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET(Long afnicCorporationTrademarkId) throws IOException { String qPath = "/domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId}"; StringBuilder sb = path(qPath, afnicCorporationTrademarkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAfnicCorporationTrademarkContact.class); }
[ "public", "OvhAfnicCorporationTrademarkContact", "data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET", "(", "Long", "afnicCorporationTrademarkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/data/afnicCorporationTrademarkInformation/{afnicCo...
Retrieve a corporation trademark information according to Afnic REST: GET /domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId} @param afnicCorporationTrademarkId [required] Corporation Inpi Information ID
[ "Retrieve", "a", "corporation", "trademark", "information", "according", "to", "Afnic" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L67-L72
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java
SparkExport.exportCSVSequenceLocalNoShuffling
public static void exportCSVSequenceLocalNoShuffling(File baseDir, JavaRDD<List<List<Writable>>> sequences) throws Exception { exportCSVSequenceLocalNoShuffling(baseDir, sequences, "", ",", "csv"); }
java
public static void exportCSVSequenceLocalNoShuffling(File baseDir, JavaRDD<List<List<Writable>>> sequences) throws Exception { exportCSVSequenceLocalNoShuffling(baseDir, sequences, "", ",", "csv"); }
[ "public", "static", "void", "exportCSVSequenceLocalNoShuffling", "(", "File", "baseDir", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "sequences", ")", "throws", "Exception", "{", "exportCSVSequenceLocalNoShuffling", "(", "baseDir", ",...
Quick and dirty CSV export: one file per sequence, without shuffling
[ "Quick", "and", "dirty", "CSV", "export", ":", "one", "file", "per", "sequence", "without", "shuffling" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java#L185-L188
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactSegment
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
java
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
[ "private", "void", "compactSegment", "(", "Segment", "segment", ",", "OffsetPredicate", "predicate", ",", "Segment", "compactSegment", ")", "{", "for", "(", "long", "i", "=", "segment", ".", "firstIndex", "(", ")", ";", "i", "<=", "segment", ".", "lastIndex"...
Compacts the given segment. @param segment The segment to compact. @param compactSegment The segment to which to write the compacted segment.
[ "Compacts", "the", "given", "segment", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L187-L191
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/index/hash/HashIndex.java
HashIndex.beforeFirst
@Override public void beforeFirst(SearchRange searchRange) { close(); // support the equality query only if (!searchRange.isSingleValue()) throw new UnsupportedOperationException(); this.searchKey = searchRange.asSearchKey(); int bucket = searchKey.hashCode() % NUM_BUCKETS; String tblname = ii.indexName() + bucket; TableInfo ti = new TableInfo(tblname, schema(keyType)); // the underlying record file should not perform logging this.rf = ti.open(tx, false); // initialize the file header if needed if (rf.fileSize() == 0) RecordFile.formatFileHeader(ti.fileName(), tx); rf.beforeFirst(); }
java
@Override public void beforeFirst(SearchRange searchRange) { close(); // support the equality query only if (!searchRange.isSingleValue()) throw new UnsupportedOperationException(); this.searchKey = searchRange.asSearchKey(); int bucket = searchKey.hashCode() % NUM_BUCKETS; String tblname = ii.indexName() + bucket; TableInfo ti = new TableInfo(tblname, schema(keyType)); // the underlying record file should not perform logging this.rf = ti.open(tx, false); // initialize the file header if needed if (rf.fileSize() == 0) RecordFile.formatFileHeader(ti.fileName(), tx); rf.beforeFirst(); }
[ "@", "Override", "public", "void", "beforeFirst", "(", "SearchRange", "searchRange", ")", "{", "close", "(", ")", ";", "// support the equality query only\r", "if", "(", "!", "searchRange", ".", "isSingleValue", "(", ")", ")", "throw", "new", "UnsupportedOperation...
Positions the index before the first index record having the specified search key. The method hashes the search key to determine the bucket, and then opens a {@link RecordFile} on the file corresponding to the bucket. The record file for the previous bucket (if any) is closed. @see Index#beforeFirst(SearchRange)
[ "Positions", "the", "index", "before", "the", "first", "index", "record", "having", "the", "specified", "search", "key", ".", "The", "method", "hashes", "the", "search", "key", "to", "determine", "the", "bucket", "and", "then", "opens", "a", "{", "@link", ...
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/hash/HashIndex.java#L123-L142
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java
AbstractFuture.executeListener
private static void executeListener(Runnable runnable, Executor executor, boolean maskExecutorExceptions) { try { executor.execute(runnable); } catch (RuntimeException e) { if (!maskExecutorExceptions) { // Caller wants to handle those exceptions throw e; } // Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if // we're given a bad one. We only catch RuntimeException because we want Errors to propagate // up. log.log( Level.SEVERE, "RuntimeException while executing runnable " + runnable + " with executor " + executor, e); } }
java
private static void executeListener(Runnable runnable, Executor executor, boolean maskExecutorExceptions) { try { executor.execute(runnable); } catch (RuntimeException e) { if (!maskExecutorExceptions) { // Caller wants to handle those exceptions throw e; } // Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if // we're given a bad one. We only catch RuntimeException because we want Errors to propagate // up. log.log( Level.SEVERE, "RuntimeException while executing runnable " + runnable + " with executor " + executor, e); } }
[ "private", "static", "void", "executeListener", "(", "Runnable", "runnable", ",", "Executor", "executor", ",", "boolean", "maskExecutorExceptions", ")", "{", "try", "{", "executor", ".", "execute", "(", "runnable", ")", ";", "}", "catch", "(", "RuntimeException"...
Submits the given runnable to the given {@link Executor} catching and logging all {@linkplain RuntimeException runtime exceptions} thrown by the executor.
[ "Submits", "the", "given", "runnable", "to", "the", "given", "{" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java#L915-L931
burberius/eve-esi
src/main/java/net/troja/eve/esi/auth/OAuth.java
OAuth.getAuthorizationUri
public String getAuthorizationUri(final String redirectUri, final Set<String> scopes, final String state) { if (account == null) throw new IllegalArgumentException("Auth is not set"); if (account.getClientId() == null) throw new IllegalArgumentException("client_id is not set"); StringBuilder builder = new StringBuilder(); builder.append(URI_AUTHENTICATION); builder.append("?"); builder.append("response_type="); builder.append(encode("code")); builder.append("&redirect_uri="); builder.append(encode(redirectUri)); builder.append("&client_id="); builder.append(encode(account.getClientId())); builder.append("&scope="); builder.append(encode(getScopesString(scopes))); builder.append("&state="); builder.append(encode(state)); builder.append("&code_challenge"); builder.append(getCodeChallenge()); // Already url encoded builder.append("&code_challenge_method="); builder.append(encode("S256")); return builder.toString(); }
java
public String getAuthorizationUri(final String redirectUri, final Set<String> scopes, final String state) { if (account == null) throw new IllegalArgumentException("Auth is not set"); if (account.getClientId() == null) throw new IllegalArgumentException("client_id is not set"); StringBuilder builder = new StringBuilder(); builder.append(URI_AUTHENTICATION); builder.append("?"); builder.append("response_type="); builder.append(encode("code")); builder.append("&redirect_uri="); builder.append(encode(redirectUri)); builder.append("&client_id="); builder.append(encode(account.getClientId())); builder.append("&scope="); builder.append(encode(getScopesString(scopes))); builder.append("&state="); builder.append(encode(state)); builder.append("&code_challenge"); builder.append(getCodeChallenge()); // Already url encoded builder.append("&code_challenge_method="); builder.append(encode("S256")); return builder.toString(); }
[ "public", "String", "getAuthorizationUri", "(", "final", "String", "redirectUri", ",", "final", "Set", "<", "String", ">", "scopes", ",", "final", "String", "state", ")", "{", "if", "(", "account", "==", "null", ")", "throw", "new", "IllegalArgumentException",...
Get the authorization uri, where the user logs in. @param redirectUri Uri the user is redirected to, after successful authorization. This must be the same as specified at the Eve Online developer page. @param scopes Scopes of the Eve Online SSO. @param state This should be some secret to prevent XRSF, please read: http://www.thread-safe.com/2014/05/the-correct-use-of-state- parameter-in.html @return
[ "Get", "the", "authorization", "uri", "where", "the", "user", "logs", "in", "." ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/auth/OAuth.java#L163-L186
ugli/jocote
src/main/java/se/ugli/jocote/lpr/Printer.java
Printer.printFile
public void printFile(final File f, final String hostName, final String printerName, final String documentName) throws IOException { final byte buffer[] = new byte[1000]; //Send print file if (!(f.exists() && f.isFile() && f.canRead())) throw new IOException("Error opening print file"); final ByteArrayOutputStream output = new ByteArrayOutputStream(); try (FileInputStream fs = new FileInputStream(f)) { int readCounter; do { readCounter = fs.read(buffer); if (readCounter > 0) output.write(buffer, 0, readCounter); } while (readCounter > 0); printStream(output, hostName, printerName, documentName); } }
java
public void printFile(final File f, final String hostName, final String printerName, final String documentName) throws IOException { final byte buffer[] = new byte[1000]; //Send print file if (!(f.exists() && f.isFile() && f.canRead())) throw new IOException("Error opening print file"); final ByteArrayOutputStream output = new ByteArrayOutputStream(); try (FileInputStream fs = new FileInputStream(f)) { int readCounter; do { readCounter = fs.read(buffer); if (readCounter > 0) output.write(buffer, 0, readCounter); } while (readCounter > 0); printStream(output, hostName, printerName, documentName); } }
[ "public", "void", "printFile", "(", "final", "File", "f", ",", "final", "String", "hostName", ",", "final", "String", "printerName", ",", "final", "String", "documentName", ")", "throws", "IOException", "{", "final", "byte", "buffer", "[", "]", "=", "new", ...
/* Print a file to a network host or printer fileName The path to the file to be printed hostName The host name or IP address of the print server printerName The name of the remote queue or the port on the print server documentName The name of the document as displayed in the spooler of the host
[ "/", "*", "Print", "a", "file", "to", "a", "network", "host", "or", "printer", "fileName", "The", "path", "to", "the", "file", "to", "be", "printed", "hostName", "The", "host", "name", "or", "IP", "address", "of", "the", "print", "server", "printerName",...
train
https://github.com/ugli/jocote/blob/28c34eb5aadbca6597bf006bb92d4fc340c71b41/src/main/java/se/ugli/jocote/lpr/Printer.java#L110-L126
eclipse/xtext-extras
org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java
AbstractXbaseSemanticSequencer.sequence_XDoWhileExpression
protected void sequence_XDoWhileExpression(ISerializationContext context, XDoWhileExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getBodyXExpressionParserRuleCall_2_0(), semanticObject.getBody()); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getPredicateXExpressionParserRuleCall_5_0(), semanticObject.getPredicate()); feeder.finish(); }
java
protected void sequence_XDoWhileExpression(ISerializationContext context, XDoWhileExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getBodyXExpressionParserRuleCall_2_0(), semanticObject.getBody()); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getPredicateXExpressionParserRuleCall_5_0(), semanticObject.getPredicate()); feeder.finish(); }
[ "protected", "void", "sequence_XDoWhileExpression", "(", "ISerializationContext", "context", ",", "XDoWhileExpression", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanti...
Contexts: XExpression returns XDoWhileExpression XAssignment returns XDoWhileExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XDoWhileExpression XOrExpression returns XDoWhileExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XAndExpression returns XDoWhileExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XEqualityExpression returns XDoWhileExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XRelationalExpression returns XDoWhileExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XDoWhileExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XDoWhileExpression XOtherOperatorExpression returns XDoWhileExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XAdditiveExpression returns XDoWhileExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XMultiplicativeExpression returns XDoWhileExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XUnaryOperation returns XDoWhileExpression XCastedExpression returns XDoWhileExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XDoWhileExpression XPostfixOperation returns XDoWhileExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XDoWhileExpression XMemberFeatureCall returns XDoWhileExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XDoWhileExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XDoWhileExpression XPrimaryExpression returns XDoWhileExpression XParenthesizedExpression returns XDoWhileExpression XDoWhileExpression returns XDoWhileExpression XExpressionOrVarDeclaration returns XDoWhileExpression Constraint: (body=XExpression predicate=XExpression)
[ "Contexts", ":", "XExpression", "returns", "XDoWhileExpression", "XAssignment", "returns", "XDoWhileExpression", "XAssignment", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XDoWhileExpression", "XOrExpression", "returns", "XDoWhileExpression", "XOrExpression", ".", "XBinaryOper...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L833-L844