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
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_vpn_POST
public OvhVpn serviceName_vpn_POST(String serviceName, String clientIp, String clientPrivNet, String psk, String serverPrivNet) throws IOException { String qPath = "/router/{serviceName}/vpn"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "clientIp", clientIp); addBody(o, "clientPrivNet", clientPrivNet); addBody(o, "psk", psk); addBody(o, "serverPrivNet", serverPrivNet); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVpn.class); }
java
public OvhVpn serviceName_vpn_POST(String serviceName, String clientIp, String clientPrivNet, String psk, String serverPrivNet) throws IOException { String qPath = "/router/{serviceName}/vpn"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "clientIp", clientIp); addBody(o, "clientPrivNet", clientPrivNet); addBody(o, "psk", psk); addBody(o, "serverPrivNet", serverPrivNet); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVpn.class); }
[ "public", "OvhVpn", "serviceName_vpn_POST", "(", "String", "serviceName", ",", "String", "clientIp", ",", "String", "clientPrivNet", ",", "String", "psk", ",", "String", "serverPrivNet", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceN...
Add a VPN to your router REST: POST /router/{serviceName}/vpn @param serverPrivNet [required] Server's private network @param psk [required] Your PSK key @param clientIp [required] IP you will be connecting from / NULL (allow all) @param clientPrivNet [required] Client's private network @param serviceName [required] The internal name of your Router offer
[ "Add", "a", "VPN", "to", "your", "router" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L151-L161
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/Services.java
Services.deploymentUnitName
public static ServiceName deploymentUnitName(String parent, String name, Phase phase) { return JBOSS_DEPLOYMENT_SUB_UNIT.append(parent, name, phase.name()); }
java
public static ServiceName deploymentUnitName(String parent, String name, Phase phase) { return JBOSS_DEPLOYMENT_SUB_UNIT.append(parent, name, phase.name()); }
[ "public", "static", "ServiceName", "deploymentUnitName", "(", "String", "parent", ",", "String", "name", ",", "Phase", "phase", ")", "{", "return", "JBOSS_DEPLOYMENT_SUB_UNIT", ".", "append", "(", "parent", ",", "name", ",", "phase", ".", "name", "(", ")", "...
Get the service name of a subdeployment. @param parent the parent deployment name @param name the subdeployment name @param phase the deployment phase @return the service name
[ "Get", "the", "service", "name", "of", "a", "subdeployment", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/Services.java#L95-L97
aws/aws-sdk-java
aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/GetIdentityMailFromDomainAttributesResult.java
GetIdentityMailFromDomainAttributesResult.setMailFromDomainAttributes
public void setMailFromDomainAttributes(java.util.Map<String, IdentityMailFromDomainAttributes> mailFromDomainAttributes) { this.mailFromDomainAttributes = mailFromDomainAttributes == null ? null : new com.amazonaws.internal.SdkInternalMap<String, IdentityMailFromDomainAttributes>(mailFromDomainAttributes); }
java
public void setMailFromDomainAttributes(java.util.Map<String, IdentityMailFromDomainAttributes> mailFromDomainAttributes) { this.mailFromDomainAttributes = mailFromDomainAttributes == null ? null : new com.amazonaws.internal.SdkInternalMap<String, IdentityMailFromDomainAttributes>(mailFromDomainAttributes); }
[ "public", "void", "setMailFromDomainAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "IdentityMailFromDomainAttributes", ">", "mailFromDomainAttributes", ")", "{", "this", ".", "mailFromDomainAttributes", "=", "mailFromDomainAttributes", "==", "nul...
<p> A map of identities to custom MAIL FROM attributes. </p> @param mailFromDomainAttributes A map of identities to custom MAIL FROM attributes.
[ "<p", ">", "A", "map", "of", "identities", "to", "custom", "MAIL", "FROM", "attributes", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/GetIdentityMailFromDomainAttributesResult.java#L61-L64
fabric8io/fabric8-forge
addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java
MavenHelpers.updatePomProperty
public static boolean updatePomProperty(Properties properties, String name, Object value, boolean updated) { if (value != null) { Object oldValue = properties.get(name); if (!Objects.equal(oldValue, value)) { getLOG().debug("Updating pom.xml property: " + name + " to " + value); properties.put(name, value); return true; } } return updated; }
java
public static boolean updatePomProperty(Properties properties, String name, Object value, boolean updated) { if (value != null) { Object oldValue = properties.get(name); if (!Objects.equal(oldValue, value)) { getLOG().debug("Updating pom.xml property: " + name + " to " + value); properties.put(name, value); return true; } } return updated; }
[ "public", "static", "boolean", "updatePomProperty", "(", "Properties", "properties", ",", "String", "name", ",", "Object", "value", ",", "boolean", "updated", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "Object", "oldValue", "=", "properties", ".",...
Updates the given maven property value if value is not null and returns true if the pom has been changed @return true if the value changed and was non null or updated was true
[ "Updates", "the", "given", "maven", "property", "value", "if", "value", "is", "not", "null", "and", "returns", "true", "if", "the", "pom", "has", "been", "changed" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java#L261-L272
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/MethodCompiler.java
MethodCompiler.addExceptionHandler
public void addExceptionHandler(Block block, String handler, List<? extends TypeMirror> thrownTypes) { Label label = getLabel(handler); if (!thrownTypes.isEmpty()) { for (TypeMirror thrownType : thrownTypes) { exceptionTableList.add(new ExceptionTable(block, label, subClass.resolveClassIndex((TypeElement)Typ.asElement(thrownType)))); } } else { exceptionTableList.add(new ExceptionTable(block, label, 0)); } }
java
public void addExceptionHandler(Block block, String handler, List<? extends TypeMirror> thrownTypes) { Label label = getLabel(handler); if (!thrownTypes.isEmpty()) { for (TypeMirror thrownType : thrownTypes) { exceptionTableList.add(new ExceptionTable(block, label, subClass.resolveClassIndex((TypeElement)Typ.asElement(thrownType)))); } } else { exceptionTableList.add(new ExceptionTable(block, label, 0)); } }
[ "public", "void", "addExceptionHandler", "(", "Block", "block", ",", "String", "handler", ",", "List", "<", "?", "extends", "TypeMirror", ">", "thrownTypes", ")", "{", "Label", "label", "=", "getLabel", "(", "handler", ")", ";", "if", "(", "!", "thrownType...
Adds an exception handler. If one of catchTypes is thrown inside block the execution continues at handler address. Thrown object is pushed in stack. @param block @param handler @param thrownTypes Throwable objects which are caught. If none is present then all throwables are caught. Note! This is not the same as finally!
[ "Adds", "an", "exception", "handler", ".", "If", "one", "of", "catchTypes", "is", "thrown", "inside", "block", "the", "execution", "continues", "at", "handler", "address", ".", "Thrown", "object", "is", "pushed", "in", "stack", "." ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/MethodCompiler.java#L1669-L1683
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InterfaceEndpointsInner.java
InterfaceEndpointsInner.beginCreateOrUpdate
public InterfaceEndpointInner beginCreateOrUpdate(String resourceGroupName, String interfaceEndpointName, InterfaceEndpointInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, interfaceEndpointName, parameters).toBlocking().single().body(); }
java
public InterfaceEndpointInner beginCreateOrUpdate(String resourceGroupName, String interfaceEndpointName, InterfaceEndpointInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, interfaceEndpointName, parameters).toBlocking().single().body(); }
[ "public", "InterfaceEndpointInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "interfaceEndpointName", ",", "InterfaceEndpointInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Creates or updates an interface endpoint in the specified resource group. @param resourceGroupName The name of the resource group. @param interfaceEndpointName The name of the interface endpoint. @param parameters Parameters supplied to the create or update interface endpoint operation @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 InterfaceEndpointInner object if successful.
[ "Creates", "or", "updates", "an", "interface", "endpoint", "in", "the", "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/InterfaceEndpointsInner.java#L508-L510
coursera/courier
typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java
TSSyntax.importString
private static String importString(String typeName, String moduleName) { return new StringBuilder() .append("import { ") .append(typeName) .append(" } from \"./") .append(moduleName) .append(".") .append(typeName) .append("\";") .toString(); }
java
private static String importString(String typeName, String moduleName) { return new StringBuilder() .append("import { ") .append(typeName) .append(" } from \"./") .append(moduleName) .append(".") .append(typeName) .append("\";") .toString(); }
[ "private", "static", "String", "importString", "(", "String", "typeName", ",", "String", "moduleName", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"import { \"", ")", ".", "append", "(", "typeName", ")", ".", "append", "(", ...
Creates a valid typescript import string given a type name (e.g. "Fortune") and the module name, which is usually the pegasus object's namespace. @param typeName Name of the type to import (e.g. "Fortune") @param moduleName That same type's namespace (e.g. "org.example") @return A fully formed import statement. e.g: import { Fortune } from "./org.example.Fortune"
[ "Creates", "a", "valid", "typescript", "import", "string", "given", "a", "type", "name", "(", "e", ".", "g", ".", "Fortune", ")", "and", "the", "module", "name", "which", "is", "usually", "the", "pegasus", "object", "s", "namespace", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L182-L192
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.lineTo
public SVGPath lineTo(double x, double y) { return append(PATH_LINE_TO).append(x).append(y); }
java
public SVGPath lineTo(double x, double y) { return append(PATH_LINE_TO).append(x).append(y); }
[ "public", "SVGPath", "lineTo", "(", "double", "x", ",", "double", "y", ")", "{", "return", "append", "(", "PATH_LINE_TO", ")", ".", "append", "(", "x", ")", ".", "append", "(", "y", ")", ";", "}" ]
Draw a line to the given coordinates. @param x new coordinates @param y new coordinates @return path object, for compact syntax.
[ "Draw", "a", "line", "to", "the", "given", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L229-L231
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.roundDown
public static BigDecimal roundDown(BigDecimal value, int scale) { return round(value, scale, RoundingMode.DOWN); }
java
public static BigDecimal roundDown(BigDecimal value, int scale) { return round(value, scale, RoundingMode.DOWN); }
[ "public", "static", "BigDecimal", "roundDown", "(", "BigDecimal", "value", ",", "int", "scale", ")", "{", "return", "round", "(", "value", ",", "scale", ",", "RoundingMode", ".", "DOWN", ")", ";", "}" ]
保留固定小数位数,舍去多余位数 @param value 需要科学计算的数据 @param scale 保留的小数位 @return 结果 @since 4.1.0
[ "保留固定小数位数,舍去多余位数" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L969-L971
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/PukKernel.java
PukKernel.setSigma
public void setSigma(double sigma) { if(sigma <= 0 || Double.isNaN(sigma) || Double.isInfinite(sigma)) throw new ArithmeticException("sigma must be positive, not " + sigma); this.sigma = sigma; }
java
public void setSigma(double sigma) { if(sigma <= 0 || Double.isNaN(sigma) || Double.isInfinite(sigma)) throw new ArithmeticException("sigma must be positive, not " + sigma); this.sigma = sigma; }
[ "public", "void", "setSigma", "(", "double", "sigma", ")", "{", "if", "(", "sigma", "<=", "0", "||", "Double", ".", "isNaN", "(", "sigma", ")", "||", "Double", ".", "isInfinite", "(", "sigma", ")", ")", "throw", "new", "ArithmeticException", "(", "\"si...
Sets the sigma parameter value, which controls the width of the kernel @param sigma the positive parameter value
[ "Sets", "the", "sigma", "parameter", "value", "which", "controls", "the", "width", "of", "the", "kernel" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/PukKernel.java#L64-L69
JoeKerouac/utils
src/main/java/com/joe/utils/pattern/PatternUtils.java
PatternUtils.check
private static boolean check(String data, Pattern pattern) { if (StringUtils.isEmpty(data)) { return false; } Matcher matcher = pattern.matcher(data); return matcher.matches(); }
java
private static boolean check(String data, Pattern pattern) { if (StringUtils.isEmpty(data)) { return false; } Matcher matcher = pattern.matcher(data); return matcher.matches(); }
[ "private", "static", "boolean", "check", "(", "String", "data", ",", "Pattern", "pattern", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "data", ")", ")", "{", "return", "false", ";", "}", "Matcher", "matcher", "=", "pattern", ".", "matcher", ...
检查数据是否符合正则 @param data 数据 @param pattern 正则 @return 返回true表示数据符合正则表达式(默认数据为空时返回false)
[ "检查数据是否符合正则" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/pattern/PatternUtils.java#L87-L93
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java
DateTimePeriod.toDays
public List<DateTimePeriod> toDays() { ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>(); // default "current" day to start datetime DateTime currentStart = getStart(); // calculate "next" day DateTime nextStart = currentStart.plusDays(1); // continue adding until we've reached the end while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) { // its okay to add the current list.add(new DateTimeDay(currentStart, nextStart)); // increment both currentStart = nextStart; nextStart = currentStart.plusDays(1); } return list; }
java
public List<DateTimePeriod> toDays() { ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>(); // default "current" day to start datetime DateTime currentStart = getStart(); // calculate "next" day DateTime nextStart = currentStart.plusDays(1); // continue adding until we've reached the end while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) { // its okay to add the current list.add(new DateTimeDay(currentStart, nextStart)); // increment both currentStart = nextStart; nextStart = currentStart.plusDays(1); } return list; }
[ "public", "List", "<", "DateTimePeriod", ">", "toDays", "(", ")", "{", "ArrayList", "<", "DateTimePeriod", ">", "list", "=", "new", "ArrayList", "<", "DateTimePeriod", ">", "(", ")", ";", "// default \"current\" day to start datetime", "DateTime", "currentStart", ...
Converts this period to a list of day periods. Partial days will not be included. For example, a period of "January 2009" will return a list of 31 days - one for each day in January. On the other hand, a period of "January 20, 2009 13:00-59" would return an empty list since partial days are not included. @return A list of day periods contained within this period
[ "Converts", "this", "period", "to", "a", "list", "of", "day", "periods", ".", "Partial", "days", "will", "not", "be", "included", ".", "For", "example", "a", "period", "of", "January", "2009", "will", "return", "a", "list", "of", "31", "days", "-", "on...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L299-L316
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
ContentSpecProcessor.doesInfoTopicMatch
protected boolean doesInfoTopicMatch(final InfoTopic infoTopic, final CSInfoNodeWrapper infoNode, final CSNodeWrapper parentNode) { if (infoNode == null && infoTopic != null) return false; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if (infoTopic.getUniqueId() != null && infoTopic.getUniqueId().matches("^\\d.*")) { return infoTopic.getUniqueId().equals(Integer.toString(parentNode.getId())); } else { // Since a content spec doesn't contain the database ids for the nodes use what is available to see if the topics match return infoTopic.getDBId().equals(infoNode.getTopicId()); } }
java
protected boolean doesInfoTopicMatch(final InfoTopic infoTopic, final CSInfoNodeWrapper infoNode, final CSNodeWrapper parentNode) { if (infoNode == null && infoTopic != null) return false; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if (infoTopic.getUniqueId() != null && infoTopic.getUniqueId().matches("^\\d.*")) { return infoTopic.getUniqueId().equals(Integer.toString(parentNode.getId())); } else { // Since a content spec doesn't contain the database ids for the nodes use what is available to see if the topics match return infoTopic.getDBId().equals(infoNode.getTopicId()); } }
[ "protected", "boolean", "doesInfoTopicMatch", "(", "final", "InfoTopic", "infoTopic", ",", "final", "CSInfoNodeWrapper", "infoNode", ",", "final", "CSNodeWrapper", "parentNode", ")", "{", "if", "(", "infoNode", "==", "null", "&&", "infoTopic", "!=", "null", ")", ...
Checks to see if a ContentSpec topic matches a Content Spec Entity topic. @param infoTopic The ContentSpec topic object. @param infoNode The Content Spec Entity topic. @param parentNode @return True if the topic is determined to match otherwise false.
[ "Checks", "to", "see", "if", "a", "ContentSpec", "topic", "matches", "a", "Content", "Spec", "Entity", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L2155-L2165
Whiley/WhileyCompiler
src/main/java/wyil/type/subtyping/SubtypeOperator.java
SubtypeOperator.isContractive
public boolean isContractive(QualifiedName nid, Type type) { HashSet<QualifiedName> visited = new HashSet<>(); return isContractive(nid, type, visited); }
java
public boolean isContractive(QualifiedName nid, Type type) { HashSet<QualifiedName> visited = new HashSet<>(); return isContractive(nid, type, visited); }
[ "public", "boolean", "isContractive", "(", "QualifiedName", "nid", ",", "Type", "type", ")", "{", "HashSet", "<", "QualifiedName", ">", "visited", "=", "new", "HashSet", "<>", "(", ")", ";", "return", "isContractive", "(", "nid", ",", "type", ",", "visited...
<p> Contractive types are types which cannot accept value because they have an <i>unterminated cycle</i>. An unterminated cycle has no leaf nodes terminating it. For example, <code>X<{X field}></code> is contractive, where as <code>X<{null|X field}></code> is not. </p> <p> This method returns true if the type is contractive, or contains a contractive subcomponent. For example, <code>null|X<{X field}></code> is considered contracted. </p> @param type --- type to test for contractivity. @return @throws ResolveError
[ "<p", ">", "Contractive", "types", "are", "types", "which", "cannot", "accept", "value", "because", "they", "have", "an", "<i", ">", "unterminated", "cycle<", "/", "i", ">", ".", "An", "unterminated", "cycle", "has", "no", "leaf", "nodes", "terminating", "...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/subtyping/SubtypeOperator.java#L165-L168
hankcs/HanLP
src/main/java/com/hankcs/hanlp/classification/statistics/ContinuousDistributions.java
ContinuousDistributions.Gser
protected static double Gser(double x, double A) { // Good for X<A+1. double T9 = 1 / A; double G = T9; double I = 1; while (T9 > G * 0.00001) { T9 = T9 * x / (A + I); G = G + T9; ++I; } G = G * Math.exp(A * Math.log(x) - x - LogGamma(A)); return G; }
java
protected static double Gser(double x, double A) { // Good for X<A+1. double T9 = 1 / A; double G = T9; double I = 1; while (T9 > G * 0.00001) { T9 = T9 * x / (A + I); G = G + T9; ++I; } G = G * Math.exp(A * Math.log(x) - x - LogGamma(A)); return G; }
[ "protected", "static", "double", "Gser", "(", "double", "x", ",", "double", "A", ")", "{", "// Good for X<A+1.", "double", "T9", "=", "1", "/", "A", ";", "double", "G", "=", "T9", ";", "double", "I", "=", "1", ";", "while", "(", "T9", ">", "G", "...
Internal function used by GammaCdf @param x @param A @return
[ "Internal", "function", "used", "by", "GammaCdf" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/classification/statistics/ContinuousDistributions.java#L159-L174
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintMinimizePressed
private void paintMinimizePressed(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintPressed(g, c, width, height); }
java
private void paintMinimizePressed(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintPressed(g, c, width, height); }
[ "private", "void", "paintMinimizePressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "iconifyPainter", ".", "paintPressed", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground minimize button pressed state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "minimize", "button", "pressed", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L195-L197
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/MethodCompiler.java
MethodCompiler.addNewArray
public void addNewArray(String name, TypeMirror type, int size) throws IOException { if (type.getKind() != TypeKind.ARRAY) { throw new IllegalArgumentException(type+" is not array"); } ArrayType at = (ArrayType) type; addVariable(name, at); newarray(type, size); if (!Typ.isPrimitive(at.getComponentType())) { checkcast(at); } tstore(name); }
java
public void addNewArray(String name, TypeMirror type, int size) throws IOException { if (type.getKind() != TypeKind.ARRAY) { throw new IllegalArgumentException(type+" is not array"); } ArrayType at = (ArrayType) type; addVariable(name, at); newarray(type, size); if (!Typ.isPrimitive(at.getComponentType())) { checkcast(at); } tstore(name); }
[ "public", "void", "addNewArray", "(", "String", "name", ",", "TypeMirror", "type", ",", "int", "size", ")", "throws", "IOException", "{", "if", "(", "type", ".", "getKind", "(", ")", "!=", "TypeKind", ".", "ARRAY", ")", "{", "throw", "new", "IllegalArgum...
Create new array <p>Stack: ..., count =&gt; ..., arrayref @param name @param type @param size @throws IOException
[ "Create", "new", "array", "<p", ">", "Stack", ":", "...", "count", "=", "&gt", ";", "...", "arrayref" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/MethodCompiler.java#L1430-L1444
dnsjava/dnsjava
org/xbill/DNS/TSIG.java
TSIG.applyStream
public void applyStream(Message m, TSIGRecord old, boolean first) { if (first) { apply(m, old); return; } Date timeSigned = new Date(); int fudge; hmac.reset(); fudge = Options.intValue("tsigfudge"); if (fudge < 0 || fudge > 0x7FFF) fudge = FUDGE; DNSOutput out = new DNSOutput(); out.writeU16(old.getSignature().length); hmac.update(out.toByteArray()); hmac.update(old.getSignature()); /* Digest the message */ hmac.update(m.toWire()); out = new DNSOutput(); long time = timeSigned.getTime() / 1000; int timeHigh = (int) (time >> 32); long timeLow = (time & 0xFFFFFFFFL); out.writeU16(timeHigh); out.writeU32(timeLow); out.writeU16(fudge); hmac.update(out.toByteArray()); byte [] signature = hmac.doFinal(); byte [] other = null; Record r = new TSIGRecord(name, DClass.ANY, 0, alg, timeSigned, fudge, signature, m.getHeader().getID(), Rcode.NOERROR, other); m.addRecord(r, Section.ADDITIONAL); m.tsigState = Message.TSIG_SIGNED; }
java
public void applyStream(Message m, TSIGRecord old, boolean first) { if (first) { apply(m, old); return; } Date timeSigned = new Date(); int fudge; hmac.reset(); fudge = Options.intValue("tsigfudge"); if (fudge < 0 || fudge > 0x7FFF) fudge = FUDGE; DNSOutput out = new DNSOutput(); out.writeU16(old.getSignature().length); hmac.update(out.toByteArray()); hmac.update(old.getSignature()); /* Digest the message */ hmac.update(m.toWire()); out = new DNSOutput(); long time = timeSigned.getTime() / 1000; int timeHigh = (int) (time >> 32); long timeLow = (time & 0xFFFFFFFFL); out.writeU16(timeHigh); out.writeU32(timeLow); out.writeU16(fudge); hmac.update(out.toByteArray()); byte [] signature = hmac.doFinal(); byte [] other = null; Record r = new TSIGRecord(name, DClass.ANY, 0, alg, timeSigned, fudge, signature, m.getHeader().getID(), Rcode.NOERROR, other); m.addRecord(r, Section.ADDITIONAL); m.tsigState = Message.TSIG_SIGNED; }
[ "public", "void", "applyStream", "(", "Message", "m", ",", "TSIGRecord", "old", ",", "boolean", "first", ")", "{", "if", "(", "first", ")", "{", "apply", "(", "m", ",", "old", ")", ";", "return", ";", "}", "Date", "timeSigned", "=", "new", "Date", ...
Generates a TSIG record for a message and adds it to the message @param m The message @param old If this message is a response, the TSIG from the request
[ "Generates", "a", "TSIG", "record", "for", "a", "message", "and", "adds", "it", "to", "the", "message" ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TSIG.java#L372-L412
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/OmsEpanetParametersOptions.java
OmsEpanetParametersOptions.createFromMap
public static OmsEpanetParametersOptions createFromMap( HashMap<OptionParameterCodes, String> options ) throws Exception { OmsEpanetParametersOptions epOptions = new OmsEpanetParametersOptions(); String units = options.get(OptionParameterCodes.UNITS); epOptions.units = units; String headloss = options.get(OptionParameterCodes.HEADLOSS); epOptions.headloss = headloss; String quality = options.get(OptionParameterCodes.QUALITY); epOptions.quality = quality; String viscosity = options.get(OptionParameterCodes.VISCOSITY); epOptions.viscosity = NumericsUtilities.isNumber(viscosity, Double.class); String diffusivity = options.get(OptionParameterCodes.DIFFUSIVITY); epOptions.diffusivity = NumericsUtilities.isNumber(diffusivity, Double.class); String specGravity = options.get(OptionParameterCodes.SPECIFICGRAVITY); epOptions.specificGravity = NumericsUtilities.isNumber(specGravity, Double.class); String trials = options.get(OptionParameterCodes.TRIALS); epOptions.trials = NumericsUtilities.isNumber(trials, Integer.class); String accuracy = options.get(OptionParameterCodes.ACCURACY); epOptions.accuracy = NumericsUtilities.isNumber(accuracy, Double.class); String unbalanced = options.get(OptionParameterCodes.UNBALANCED); epOptions.unbalanced = unbalanced; String pattern = options.get(OptionParameterCodes.PATTERN); epOptions.pattern = NumericsUtilities.isNumber(pattern, Integer.class); String demandMultiplier = options.get(OptionParameterCodes.DEMANDMULTIPLIER); epOptions.demandMultiplier = NumericsUtilities.isNumber(demandMultiplier, Double.class); String emitterExp = options.get(OptionParameterCodes.EMITEXPON); epOptions.emitterExponent = NumericsUtilities.isNumber(emitterExp, Double.class); String tolerance = options.get(OptionParameterCodes.TOLERANCE); epOptions.tolerance = NumericsUtilities.isNumber(tolerance, Double.class); epOptions.process(); return epOptions; }
java
public static OmsEpanetParametersOptions createFromMap( HashMap<OptionParameterCodes, String> options ) throws Exception { OmsEpanetParametersOptions epOptions = new OmsEpanetParametersOptions(); String units = options.get(OptionParameterCodes.UNITS); epOptions.units = units; String headloss = options.get(OptionParameterCodes.HEADLOSS); epOptions.headloss = headloss; String quality = options.get(OptionParameterCodes.QUALITY); epOptions.quality = quality; String viscosity = options.get(OptionParameterCodes.VISCOSITY); epOptions.viscosity = NumericsUtilities.isNumber(viscosity, Double.class); String diffusivity = options.get(OptionParameterCodes.DIFFUSIVITY); epOptions.diffusivity = NumericsUtilities.isNumber(diffusivity, Double.class); String specGravity = options.get(OptionParameterCodes.SPECIFICGRAVITY); epOptions.specificGravity = NumericsUtilities.isNumber(specGravity, Double.class); String trials = options.get(OptionParameterCodes.TRIALS); epOptions.trials = NumericsUtilities.isNumber(trials, Integer.class); String accuracy = options.get(OptionParameterCodes.ACCURACY); epOptions.accuracy = NumericsUtilities.isNumber(accuracy, Double.class); String unbalanced = options.get(OptionParameterCodes.UNBALANCED); epOptions.unbalanced = unbalanced; String pattern = options.get(OptionParameterCodes.PATTERN); epOptions.pattern = NumericsUtilities.isNumber(pattern, Integer.class); String demandMultiplier = options.get(OptionParameterCodes.DEMANDMULTIPLIER); epOptions.demandMultiplier = NumericsUtilities.isNumber(demandMultiplier, Double.class); String emitterExp = options.get(OptionParameterCodes.EMITEXPON); epOptions.emitterExponent = NumericsUtilities.isNumber(emitterExp, Double.class); String tolerance = options.get(OptionParameterCodes.TOLERANCE); epOptions.tolerance = NumericsUtilities.isNumber(tolerance, Double.class); epOptions.process(); return epOptions; }
[ "public", "static", "OmsEpanetParametersOptions", "createFromMap", "(", "HashMap", "<", "OptionParameterCodes", ",", "String", ">", "options", ")", "throws", "Exception", "{", "OmsEpanetParametersOptions", "epOptions", "=", "new", "OmsEpanetParametersOptions", "(", ")", ...
Create a {@link OmsEpanetParametersOptions} from a {@link HashMap} of values. @param options the {@link HashMap} of values. The keys have to be from {@link OptionParameterCodes}. @return the created {@link OmsEpanetParametersOptions}. @throws Exception
[ "Create", "a", "{", "@link", "OmsEpanetParametersOptions", "}", "from", "a", "{", "@link", "HashMap", "}", "of", "values", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/OmsEpanetParametersOptions.java#L246-L276
forge/core
javaee/impl/src/main/java/org/jboss/forge/addon/javaee/jpa/JPAFieldOperationsImpl.java
JPAFieldOperationsImpl.areTypesSame
private boolean areTypesSame(String from, String to) { String fromCompare = from.endsWith(".java") ? from.substring(0, from.length() - 5) : from; String toCompare = to.endsWith(".java") ? to.substring(0, to.length() - 5) : to; return fromCompare.equals(toCompare); }
java
private boolean areTypesSame(String from, String to) { String fromCompare = from.endsWith(".java") ? from.substring(0, from.length() - 5) : from; String toCompare = to.endsWith(".java") ? to.substring(0, to.length() - 5) : to; return fromCompare.equals(toCompare); }
[ "private", "boolean", "areTypesSame", "(", "String", "from", ",", "String", "to", ")", "{", "String", "fromCompare", "=", "from", ".", "endsWith", "(", "\".java\"", ")", "?", "from", ".", "substring", "(", "0", ",", "from", ".", "length", "(", ")", "-"...
Checks if the types are the same, removing the ".java" in the end of the string in case it exists @param from @param to @return
[ "Checks", "if", "the", "types", "are", "the", "same", "removing", "the", ".", "java", "in", "the", "end", "of", "the", "string", "in", "case", "it", "exists" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/jpa/JPAFieldOperationsImpl.java#L430-L435
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.findFieldInHierarchy
private static Field findFieldInHierarchy(Object object, FieldMatcherStrategy strategy) { assertObjectInGetInternalStateIsNotNull(object); return findSingleFieldUsingStrategy(strategy, object, true, getType(object)); }
java
private static Field findFieldInHierarchy(Object object, FieldMatcherStrategy strategy) { assertObjectInGetInternalStateIsNotNull(object); return findSingleFieldUsingStrategy(strategy, object, true, getType(object)); }
[ "private", "static", "Field", "findFieldInHierarchy", "(", "Object", "object", ",", "FieldMatcherStrategy", "strategy", ")", "{", "assertObjectInGetInternalStateIsNotNull", "(", "object", ")", ";", "return", "findSingleFieldUsingStrategy", "(", "strategy", ",", "object", ...
Find field in hierarchy. @param object the object @param strategy the strategy @return the field
[ "Find", "field", "in", "hierarchy", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L452-L455
jmxtrans/jmxtrans
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java
Settings.getStringSetting
public static String getStringSetting(Map<String, Object> settings, String key, String defaultVal) { final Object value = settings.get(key); return value != null ? value.toString() : defaultVal; }
java
public static String getStringSetting(Map<String, Object> settings, String key, String defaultVal) { final Object value = settings.get(key); return value != null ? value.toString() : defaultVal; }
[ "public", "static", "String", "getStringSetting", "(", "Map", "<", "String", ",", "Object", ">", "settings", ",", "String", "key", ",", "String", "defaultVal", ")", "{", "final", "Object", "value", "=", "settings", ".", "get", "(", "key", ")", ";", "retu...
Gets a String value for the setting, returning the default value if not specified. @param settings @param key the key to get the String setting for @param defaultVal the default value to return if the setting was not specified @return the String value for the setting
[ "Gets", "a", "String", "value", "for", "the", "setting", "returning", "the", "default", "value", "if", "not", "specified", "." ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java#L117-L120
galan/commons
src/main/java/de/galan/commons/net/flux/Flux.java
Flux.addDefaultHeader
public static void addDefaultHeader(String key, String value) { if (isNotBlank(key) && isNotBlank(value)) { if (defaultHeader == null) { defaultHeader = new HashMap<String, String>(); } defaultHeader.put(key, value); } }
java
public static void addDefaultHeader(String key, String value) { if (isNotBlank(key) && isNotBlank(value)) { if (defaultHeader == null) { defaultHeader = new HashMap<String, String>(); } defaultHeader.put(key, value); } }
[ "public", "static", "void", "addDefaultHeader", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "isNotBlank", "(", "key", ")", "&&", "isNotBlank", "(", "value", ")", ")", "{", "if", "(", "defaultHeader", "==", "null", ")", "{", "defa...
Added default headers will always be send, can still be overriden using the builder.
[ "Added", "default", "headers", "will", "always", "be", "send", "can", "still", "be", "overriden", "using", "the", "builder", "." ]
train
https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/net/flux/Flux.java#L103-L110
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.usingSeparatorWithQuote
public CSVParserBuilder<T, K> usingSeparatorWithQuote(char separator, char quote) { this.metadata = new CSVFileMetadata(separator, Optional.of(quote)); return this; }
java
public CSVParserBuilder<T, K> usingSeparatorWithQuote(char separator, char quote) { this.metadata = new CSVFileMetadata(separator, Optional.of(quote)); return this; }
[ "public", "CSVParserBuilder", "<", "T", ",", "K", ">", "usingSeparatorWithQuote", "(", "char", "separator", ",", "char", "quote", ")", "{", "this", ".", "metadata", "=", "new", "CSVFileMetadata", "(", "separator", ",", "Optional", ".", "of", "(", "quote", ...
Use specified characters as field separator and quote character. Quote character can be escaped by preceding it with another quote character. @param separator - field separator character @param quote - quote character @return this parser builder
[ "Use", "specified", "characters", "as", "field", "separator", "and", "quote", "character", ".", "Quote", "character", "can", "be", "escaped", "by", "preceding", "it", "with", "another", "quote", "character", "." ]
train
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L120-L123
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/PropositionCopier.java
PropositionCopier.visit
@Override public void visit(PrimitiveParameter primitiveParameter) { assert this.kh != null : "kh wasn't set"; PrimitiveParameter param = new PrimitiveParameter(propId, this.uniqueIdProvider.getInstance()); param.setPosition(primitiveParameter.getPosition()); param.setGranularity(primitiveParameter.getGranularity()); param.setValue(primitiveParameter.getValue()); param.setSourceSystem(SourceSystem.DERIVED); param.setCreateDate(new Date()); this.kh.insertLogical(param); this.derivationsBuilder.propositionAsserted(primitiveParameter, param); LOGGER.log(Level.FINER, "Asserted derived proposition {0}", param); }
java
@Override public void visit(PrimitiveParameter primitiveParameter) { assert this.kh != null : "kh wasn't set"; PrimitiveParameter param = new PrimitiveParameter(propId, this.uniqueIdProvider.getInstance()); param.setPosition(primitiveParameter.getPosition()); param.setGranularity(primitiveParameter.getGranularity()); param.setValue(primitiveParameter.getValue()); param.setSourceSystem(SourceSystem.DERIVED); param.setCreateDate(new Date()); this.kh.insertLogical(param); this.derivationsBuilder.propositionAsserted(primitiveParameter, param); LOGGER.log(Level.FINER, "Asserted derived proposition {0}", param); }
[ "@", "Override", "public", "void", "visit", "(", "PrimitiveParameter", "primitiveParameter", ")", "{", "assert", "this", ".", "kh", "!=", "null", ":", "\"kh wasn't set\"", ";", "PrimitiveParameter", "param", "=", "new", "PrimitiveParameter", "(", "propId", ",", ...
Creates a derived primitive parameter with the id specified in the constructor and the same characteristics (e.g., data source type, interval, value, etc.). @param primitiveParameter a {@link PrimitiveParameter}. Cannot be <code>null</code>.
[ "Creates", "a", "derived", "primitive", "parameter", "with", "the", "id", "specified", "in", "the", "constructor", "and", "the", "same", "characteristics", "(", "e", ".", "g", ".", "data", "source", "type", "interval", "value", "etc", ".", ")", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/PropositionCopier.java#L156-L168
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.getRelativePath
public static final String getRelativePath(String basedir, String filename) { String basedirPath = uppercaseDrive(basedir); String filenamePath = uppercaseDrive(filename); /* * Verify the arguments and make sure the filename is relative to the * base directory. */ if (basedirPath == null || basedirPath.length() == 0 || filenamePath == null || filenamePath.length() == 0 || !filenamePath.startsWith(basedirPath)) { return ""; } /* * Normalize the arguments. First, determine the file separator that is * being used, then strip that off the end of both the base directory * and filename. */ String separator = determineSeparator(filenamePath); basedirPath = StringUtils.chompLast(basedirPath, separator); filenamePath = StringUtils.chompLast(filenamePath, separator); /* * Remove the base directory from the filename to end up with a relative * filename (relative to the base directory). This filename is then used * to determine the relative path. */ String relativeFilename = filenamePath.substring(basedirPath.length()); return determineRelativePath(relativeFilename, separator); }
java
public static final String getRelativePath(String basedir, String filename) { String basedirPath = uppercaseDrive(basedir); String filenamePath = uppercaseDrive(filename); /* * Verify the arguments and make sure the filename is relative to the * base directory. */ if (basedirPath == null || basedirPath.length() == 0 || filenamePath == null || filenamePath.length() == 0 || !filenamePath.startsWith(basedirPath)) { return ""; } /* * Normalize the arguments. First, determine the file separator that is * being used, then strip that off the end of both the base directory * and filename. */ String separator = determineSeparator(filenamePath); basedirPath = StringUtils.chompLast(basedirPath, separator); filenamePath = StringUtils.chompLast(filenamePath, separator); /* * Remove the base directory from the filename to end up with a relative * filename (relative to the base directory). This filename is then used * to determine the relative path. */ String relativeFilename = filenamePath.substring(basedirPath.length()); return determineRelativePath(relativeFilename, separator); }
[ "public", "static", "final", "String", "getRelativePath", "(", "String", "basedir", ",", "String", "filename", ")", "{", "String", "basedirPath", "=", "uppercaseDrive", "(", "basedir", ")", ";", "String", "filenamePath", "=", "uppercaseDrive", "(", "filename", "...
Determines the relative path of a filename from a base directory. This method is useful in building relative links within pages of a web site. It provides similar functionality to Anakia's <code>$relativePath</code> context variable. The arguments to this method may contain either forward or backward slashes as file separators. The relative path returned is formed using forward slashes as it is expected this path is to be used as a link in a web page (again mimicking Anakia's behavior). <p/> This method is thread-safe. <br/> <pre> PathUtils.getRelativePath( null, null ) = "" PathUtils.getRelativePath( null, "/usr/local/java/bin" ) = "" PathUtils.getRelativePath( "/usr/local/", null ) = "" PathUtils.getRelativePath( "/usr/local/", "/usr/local/java/bin" ) = ".." PathUtils.getRelativePath( "/usr/local/", "/usr/local/java/bin/java.sh" ) = "../.." PathUtils.getRelativePath( "/usr/local/java/bin/java.sh", "/usr/local/" ) = "" </pre> @param basedir The base directory. @param filename The filename that is relative to the base directory. @return The relative path of the filename from the base directory. This value is not terminated with a forward slash. A zero-length string is returned if: the filename is not relative to the base directory, <code>basedir</code> is null or zero-length, or <code>filename</code> is null or zero-length.
[ "Determines", "the", "relative", "path", "of", "a", "filename", "from", "a", "base", "directory", ".", "This", "method", "is", "useful", "in", "building", "relative", "links", "within", "pages", "of", "a", "web", "site", ".", "It", "provides", "similar", "...
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L560-L590
hansenji/pocketknife
pocketknife/src/main/java/pocketknife/PocketKnife.java
PocketKnife.bindArguments
public static <T> void bindArguments(T target, Bundle bundle) { @SuppressWarnings("unchecked") BundleBinding<T> binding = (BundleBinding<T>) getBundleBinding(target.getClass().getClassLoader(), target.getClass()); if (binding != null) { binding.bindArguments(target, bundle); } }
java
public static <T> void bindArguments(T target, Bundle bundle) { @SuppressWarnings("unchecked") BundleBinding<T> binding = (BundleBinding<T>) getBundleBinding(target.getClass().getClassLoader(), target.getClass()); if (binding != null) { binding.bindArguments(target, bundle); } }
[ "public", "static", "<", "T", ">", "void", "bindArguments", "(", "T", "target", ",", "Bundle", "bundle", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "BundleBinding", "<", "T", ">", "binding", "=", "(", "BundleBinding", "<", "T", ">", ")...
Bind annotated fields in the specified {@code target} from the {@link android.os.Bundle}. @param target Target object for bind arguments @param bundle Bundle containing arguments;
[ "Bind", "annotated", "fields", "in", "the", "specified", "{", "@code", "target", "}", "from", "the", "{", "@link", "android", ".", "os", ".", "Bundle", "}", "." ]
train
https://github.com/hansenji/pocketknife/blob/f225dd66bcafdd702f472a5c99be1fb48202e6ca/pocketknife/src/main/java/pocketknife/PocketKnife.java#L91-L97
podio/podio-java
src/main/java/com/podio/calendar/CalendarAPI.java
CalendarAPI.getApp
public List<Event> getApp(int appId, LocalDate dateFrom, LocalDate dateTo, ReferenceType... types) { return getCalendar("app/" + appId, dateFrom, dateTo, null, types); }
java
public List<Event> getApp(int appId, LocalDate dateFrom, LocalDate dateTo, ReferenceType... types) { return getCalendar("app/" + appId, dateFrom, dateTo, null, types); }
[ "public", "List", "<", "Event", ">", "getApp", "(", "int", "appId", ",", "LocalDate", "dateFrom", ",", "LocalDate", "dateTo", ",", "ReferenceType", "...", "types", ")", "{", "return", "getCalendar", "(", "\"app/\"", "+", "appId", ",", "dateFrom", ",", "dat...
Returns the items and tasks that are related to the given app. @param appId The id of the app @param dateFrom The from date @param dateTo The to date @param types The types of events that should be returned. Leave out to get all types of events. @return The events in the calendar
[ "Returns", "the", "items", "and", "tasks", "that", "are", "related", "to", "the", "given", "app", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/calendar/CalendarAPI.java#L63-L66
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/util/CompilerUtil.java
CompilerUtil.findField
private static Field findField(String name, MutableObject<Object> valueHolder) { final String sourceMethod = "findField"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{name, valueHolder}); } Field field = FIELD_NAME_MAP.get(name); if (field != null) { Object arg = marshalArg(field.getType(), valueHolder.getValue()); if (arg != null) { valueHolder.setValue(arg); } else { field = null; } } if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, field); } return field; }
java
private static Field findField(String name, MutableObject<Object> valueHolder) { final String sourceMethod = "findField"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{name, valueHolder}); } Field field = FIELD_NAME_MAP.get(name); if (field != null) { Object arg = marshalArg(field.getType(), valueHolder.getValue()); if (arg != null) { valueHolder.setValue(arg); } else { field = null; } } if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, field); } return field; }
[ "private", "static", "Field", "findField", "(", "String", "name", ",", "MutableObject", "<", "Object", ">", "valueHolder", ")", "{", "final", "String", "sourceMethod", "=", "\"findField\"", ";", "//$NON-NLS-1$\r", "final", "boolean", "isTraceLogging", "=", "log", ...
Returns the field matching the specified name if the type of the value specified in <code>valueHolder</code> can be assigned to the field (with conversion if necessary), or null. @param name the field name @param valueHolder (input/output) On input, the value being assigned. On output, possibly converted value that will be accepted by the field. See {@link #marshalArg(Class, Object)} for conversion rules. @return matching field or null
[ "Returns", "the", "field", "matching", "the", "specified", "name", "if", "the", "type", "of", "the", "value", "specified", "in", "<code", ">", "valueHolder<", "/", "code", ">", "can", "be", "assigned", "to", "the", "field", "(", "with", "conversion", "if",...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/CompilerUtil.java#L328-L347
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java
CoreRemoteMongoCollectionImpl.updateMany
public RemoteUpdateResult updateMany( final Bson filter, final Bson update, final RemoteUpdateOptions updateOptions ) { return executeUpdate(filter, update, updateOptions, true); }
java
public RemoteUpdateResult updateMany( final Bson filter, final Bson update, final RemoteUpdateOptions updateOptions ) { return executeUpdate(filter, update, updateOptions, true); }
[ "public", "RemoteUpdateResult", "updateMany", "(", "final", "Bson", "filter", ",", "final", "Bson", "update", ",", "final", "RemoteUpdateOptions", "updateOptions", ")", "{", "return", "executeUpdate", "(", "filter", ",", "update", ",", "updateOptions", ",", "true"...
Update all documents in the collection according to the specified arguments. @param filter a document describing the query filter, which may not be null. @param update a document describing the update, which may not be null. The update to apply must include only update operators. @param updateOptions the options to apply to the update operation @return the result of the update many operation
[ "Update", "all", "documents", "in", "the", "collection", "according", "to", "the", "specified", "arguments", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L438-L444
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/math/NumberUtils.java
NumberUtils.toFloat
public static float toFloat(final String str, final float defaultValue) { if (str == null) { return defaultValue; } try { return Float.parseFloat(str); } catch (final NumberFormatException nfe) { return defaultValue; } }
java
public static float toFloat(final String str, final float defaultValue) { if (str == null) { return defaultValue; } try { return Float.parseFloat(str); } catch (final NumberFormatException nfe) { return defaultValue; } }
[ "public", "static", "float", "toFloat", "(", "final", "String", "str", ",", "final", "float", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", "{", "return", "Float", ".", "parseFloat", "(", ...
<p>Convert a <code>String</code> to a <code>float</code>, returning a default value if the conversion fails.</p> <p>If the string <code>str</code> is <code>null</code>, the default value is returned.</p> <pre> NumberUtils.toFloat(null, 1.1f) = 1.0f NumberUtils.toFloat("", 1.1f) = 1.1f NumberUtils.toFloat("1.5", 0.0f) = 1.5f </pre> @param str the string to convert, may be <code>null</code> @param defaultValue the default value @return the float represented by the string, or defaultValue if conversion fails @since 2.1
[ "<p", ">", "Convert", "a", "<code", ">", "String<", "/", "code", ">", "to", "a", "<code", ">", "float<", "/", "code", ">", "returning", "a", "default", "value", "if", "the", "conversion", "fails", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/math/NumberUtils.java#L221-L230
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigTreeBuilder.java
ConfigTreeBuilder.build
public static ConfigurationTree build(final Bootstrap bootstrap, final Configuration configuration, final boolean introspect) { final List<Class> roots = resolveRootTypes(new ArrayList<>(), configuration.getClass()); if (introspect) { final List<ConfigPath> content = resolvePaths( bootstrap.getObjectMapper().getSerializationConfig(), null, new ArrayList<>(), configuration.getClass(), configuration, GenericsResolver.resolve(configuration.getClass())); final List<ConfigPath> uniqueContent = resolveUniqueTypePaths(content); return new ConfigurationTree(roots, content, uniqueContent); } else { return new ConfigurationTree(roots); } }
java
public static ConfigurationTree build(final Bootstrap bootstrap, final Configuration configuration, final boolean introspect) { final List<Class> roots = resolveRootTypes(new ArrayList<>(), configuration.getClass()); if (introspect) { final List<ConfigPath> content = resolvePaths( bootstrap.getObjectMapper().getSerializationConfig(), null, new ArrayList<>(), configuration.getClass(), configuration, GenericsResolver.resolve(configuration.getClass())); final List<ConfigPath> uniqueContent = resolveUniqueTypePaths(content); return new ConfigurationTree(roots, content, uniqueContent); } else { return new ConfigurationTree(roots); } }
[ "public", "static", "ConfigurationTree", "build", "(", "final", "Bootstrap", "bootstrap", ",", "final", "Configuration", "configuration", ",", "final", "boolean", "introspect", ")", "{", "final", "List", "<", "Class", ">", "roots", "=", "resolveRootTypes", "(", ...
Analyze configuration object to extract bindable parts. @param bootstrap bootstrap instance @param configuration configuration instance @param introspect true to introspect configuration object and extract values by path and unique sub configurations @return parsed configuration info
[ "Analyze", "configuration", "object", "to", "extract", "bindable", "parts", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/yaml/ConfigTreeBuilder.java#L98-L115
febit/wit
wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java
ClassWriter.put122
private void put122(final int b, final int s1, final int s2) { pool.putBS(b, s1).putShort(s2); }
java
private void put122(final int b, final int s1, final int s2) { pool.putBS(b, s1).putShort(s2); }
[ "private", "void", "put122", "(", "final", "int", "b", ",", "final", "int", "s1", ",", "final", "int", "s2", ")", "{", "pool", ".", "putBS", "(", "b", ",", "s1", ")", ".", "putShort", "(", "s2", ")", ";", "}" ]
Puts one byte and two shorts into the constant pool. @param b a byte. @param s1 a short. @param s2 another short.
[ "Puts", "one", "byte", "and", "two", "shorts", "into", "the", "constant", "pool", "." ]
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java#L741-L743
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/EditDistance.java
EditDistance.compare
public int compare(String string2, int maxDistance) { switch (algorithm) { case Damerau: return DamerauLevenshteinDistance(string2, maxDistance); } throw new IllegalArgumentException("unknown DistanceAlgorithm"); }
java
public int compare(String string2, int maxDistance) { switch (algorithm) { case Damerau: return DamerauLevenshteinDistance(string2, maxDistance); } throw new IllegalArgumentException("unknown DistanceAlgorithm"); }
[ "public", "int", "compare", "(", "String", "string2", ",", "int", "maxDistance", ")", "{", "switch", "(", "algorithm", ")", "{", "case", "Damerau", ":", "return", "DamerauLevenshteinDistance", "(", "string2", ",", "maxDistance", ")", ";", "}", "throw", "new"...
/ <returns>The edit distance (or -1 if maxDistance exceeded).</returns>
[ "/", "<returns", ">", "The", "edit", "distance", "(", "or", "-", "1", "if", "maxDistance", "exceeded", ")", ".", "<", "/", "returns", ">" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/EditDistance.java#L53-L58
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/provider/AbstractJSSEProvider.java
AbstractJSSEProvider.getKeyManagerFactoryInstance
public KeyManagerFactory getKeyManagerFactoryInstance(String keyMgr, String ctxtProvider) throws NoSuchAlgorithmException, NoSuchProviderException { String mgr = keyMgr; String provider = ctxtProvider; if (mgr.indexOf('|') != -1) { String[] keyManagerArray = mgr.split("\\|"); if (keyManagerArray != null && keyManagerArray.length == 2) { mgr = keyManagerArray[0]; provider = keyManagerArray[1]; } } KeyManagerFactory rc = KeyManagerFactory.getInstance(mgr, provider); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getKeyManagerFactory.getInstance(" + mgr + ", " + provider + ") " + rc); return rc; }
java
public KeyManagerFactory getKeyManagerFactoryInstance(String keyMgr, String ctxtProvider) throws NoSuchAlgorithmException, NoSuchProviderException { String mgr = keyMgr; String provider = ctxtProvider; if (mgr.indexOf('|') != -1) { String[] keyManagerArray = mgr.split("\\|"); if (keyManagerArray != null && keyManagerArray.length == 2) { mgr = keyManagerArray[0]; provider = keyManagerArray[1]; } } KeyManagerFactory rc = KeyManagerFactory.getInstance(mgr, provider); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getKeyManagerFactory.getInstance(" + mgr + ", " + provider + ") " + rc); return rc; }
[ "public", "KeyManagerFactory", "getKeyManagerFactoryInstance", "(", "String", "keyMgr", ",", "String", "ctxtProvider", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchProviderException", "{", "String", "mgr", "=", "keyMgr", ";", "String", "provider", "=", "ctxtPr...
Get the key manager factory instance using the provided information. @see com.ibm.websphere.ssl.JSSEProvider#getKeyManagerFactoryInstance() @param keyMgr @param ctxtProvider @return KeyManagerFactory @throws NoSuchAlgorithmException @throws NoSuchProviderException
[ "Get", "the", "key", "manager", "factory", "instance", "using", "the", "provided", "information", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/provider/AbstractJSSEProvider.java#L717-L732
Syncleus/aparapi
src/main/java/com/aparapi/internal/kernel/KernelRunner.java
KernelRunner.getClassModelFromArg
private ClassModel getClassModelFromArg(KernelArg arg, final Class<?> arrayClass) { ClassModel c = null; if (arg.getObjArrayElementModel() == null) { final String tmp = arrayClass.getName().substring(2).replace('/', '.'); final String arrayClassInDotForm = tmp.substring(0, tmp.length() - 1); if (logger.isLoggable(Level.FINE)) { logger.fine("looking for type = " + arrayClassInDotForm); } // get ClassModel of obj array from entrypt.objectArrayFieldsClasses c = entryPoint.getObjectArrayFieldsClasses().get(arrayClassInDotForm); arg.setObjArrayElementModel(c); } else { c = arg.getObjArrayElementModel(); } assert c != null : "should find class for elements " + arrayClass.getName(); return c; }
java
private ClassModel getClassModelFromArg(KernelArg arg, final Class<?> arrayClass) { ClassModel c = null; if (arg.getObjArrayElementModel() == null) { final String tmp = arrayClass.getName().substring(2).replace('/', '.'); final String arrayClassInDotForm = tmp.substring(0, tmp.length() - 1); if (logger.isLoggable(Level.FINE)) { logger.fine("looking for type = " + arrayClassInDotForm); } // get ClassModel of obj array from entrypt.objectArrayFieldsClasses c = entryPoint.getObjectArrayFieldsClasses().get(arrayClassInDotForm); arg.setObjArrayElementModel(c); } else { c = arg.getObjArrayElementModel(); } assert c != null : "should find class for elements " + arrayClass.getName(); return c; }
[ "private", "ClassModel", "getClassModelFromArg", "(", "KernelArg", "arg", ",", "final", "Class", "<", "?", ">", "arrayClass", ")", "{", "ClassModel", "c", "=", "null", ";", "if", "(", "arg", ".", "getObjArrayElementModel", "(", ")", "==", "null", ")", "{",...
Helper method to retrieve the class model from a kernel argument. @param arg the kernel argument @param arrayClass the array Java class for the argument @return the Aparapi ClassModel instance.
[ "Helper", "method", "to", "retrieve", "the", "class", "model", "from", "a", "kernel", "argument", "." ]
train
https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelRunner.java#L763-L782
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/HieroConfig.java
HieroConfig.listFiles
public static File[] listFiles(final String ext) { init(); return config.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(ext); } }); }
java
public static File[] listFiles(final String ext) { init(); return config.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(ext); } }); }
[ "public", "static", "File", "[", "]", "listFiles", "(", "final", "String", "ext", ")", "{", "init", "(", ")", ";", "return", "config", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "dir", ","...
List the files with a given extension in the configuration directory @param ext The extension to search for @return The list of files from the configuration directory
[ "List", "the", "files", "with", "a", "given", "extension", "in", "the", "configuration", "directory" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/HieroConfig.java#L50-L59
OrienteerBAP/wicket-orientdb
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java
OSchemaHelper.oClass
private OSchemaHelper oClass(String className, boolean abstractClass, String... superClasses) { lastClass = schema.getClass(className); if(lastClass==null) { OClass[] superClassesArray = new OClass[superClasses.length]; for (int i = 0; i < superClasses.length; i++) { String superClassName = superClasses[i]; superClassesArray[i] = schema.getClass(superClassName); } lastClass = abstractClass ? schema.createAbstractClass(className, superClassesArray) : schema.createClass(className, superClassesArray); } else { boolean currentlyAbstract = lastClass.isAbstract(); if(currentlyAbstract!=abstractClass) lastClass.setAbstract(abstractClass); } lastProperty = null; lastIndex = null; return this; }
java
private OSchemaHelper oClass(String className, boolean abstractClass, String... superClasses) { lastClass = schema.getClass(className); if(lastClass==null) { OClass[] superClassesArray = new OClass[superClasses.length]; for (int i = 0; i < superClasses.length; i++) { String superClassName = superClasses[i]; superClassesArray[i] = schema.getClass(superClassName); } lastClass = abstractClass ? schema.createAbstractClass(className, superClassesArray) : schema.createClass(className, superClassesArray); } else { boolean currentlyAbstract = lastClass.isAbstract(); if(currentlyAbstract!=abstractClass) lastClass.setAbstract(abstractClass); } lastProperty = null; lastIndex = null; return this; }
[ "private", "OSchemaHelper", "oClass", "(", "String", "className", ",", "boolean", "abstractClass", ",", "String", "...", "superClasses", ")", "{", "lastClass", "=", "schema", ".", "getClass", "(", "className", ")", ";", "if", "(", "lastClass", "==", "null", ...
Create if required {@link OClass} @param className name of a class to create @param abstractClass is this class abstract @param superClasses list of superclasses @return this helper
[ "Create", "if", "required", "{" ]
train
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L88-L107
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/mpssession.java
mpssession.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { mpssession_responses result = (mpssession_responses) service.get_payload_formatter().string_to_resource(mpssession_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.mpssession_response_array); } mpssession[] result_mpssession = new mpssession[result.mpssession_response_array.length]; for(int i = 0; i < result.mpssession_response_array.length; i++) { result_mpssession[i] = result.mpssession_response_array[i].mpssession[0]; } return result_mpssession; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { mpssession_responses result = (mpssession_responses) service.get_payload_formatter().string_to_resource(mpssession_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.mpssession_response_array); } mpssession[] result_mpssession = new mpssession[result.mpssession_response_array.length]; for(int i = 0; i < result.mpssession_response_array.length; i++) { result_mpssession[i] = result.mpssession_response_array[i].mpssession[0]; } return result_mpssession; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "mpssession_responses", "result", "=", "(", "mpssession_responses", ")", "service", ".", "get_payload_formatte...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mpssession.java#L358-L375
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java
NaaccrXmlDictionaryUtils.getDefaultUserDictionaryByVersion
@SuppressWarnings("ConstantConditions") public static NaaccrDictionary getDefaultUserDictionaryByVersion(String naaccrVersion) { if (naaccrVersion == null) throw new RuntimeException("Version is required for getting the default user dictionary."); if (!NaaccrFormat.isVersionSupported(naaccrVersion)) throw new RuntimeException("Unsupported default user dictionary version: " + naaccrVersion); NaaccrDictionary result = _INTERNAL_DICTIONARIES.get("user_" + naaccrVersion); if (result == null) { String resName = "user-defined-naaccr-dictionary-" + naaccrVersion + ".xml"; try (Reader reader = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResource(resName).openStream(), StandardCharsets.UTF_8)) { result = readDictionary(reader); _INTERNAL_DICTIONARIES.put("user_" + naaccrVersion, result); } catch (IOException e) { throw new RuntimeException("Unable to get base dictionary for version " + naaccrVersion, e); } } return result; }
java
@SuppressWarnings("ConstantConditions") public static NaaccrDictionary getDefaultUserDictionaryByVersion(String naaccrVersion) { if (naaccrVersion == null) throw new RuntimeException("Version is required for getting the default user dictionary."); if (!NaaccrFormat.isVersionSupported(naaccrVersion)) throw new RuntimeException("Unsupported default user dictionary version: " + naaccrVersion); NaaccrDictionary result = _INTERNAL_DICTIONARIES.get("user_" + naaccrVersion); if (result == null) { String resName = "user-defined-naaccr-dictionary-" + naaccrVersion + ".xml"; try (Reader reader = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResource(resName).openStream(), StandardCharsets.UTF_8)) { result = readDictionary(reader); _INTERNAL_DICTIONARIES.put("user_" + naaccrVersion, result); } catch (IOException e) { throw new RuntimeException("Unable to get base dictionary for version " + naaccrVersion, e); } } return result; }
[ "@", "SuppressWarnings", "(", "\"ConstantConditions\"", ")", "public", "static", "NaaccrDictionary", "getDefaultUserDictionaryByVersion", "(", "String", "naaccrVersion", ")", "{", "if", "(", "naaccrVersion", "==", "null", ")", "throw", "new", "RuntimeException", "(", ...
Returns the default user dictionary for the requested NAACCR version. @param naaccrVersion NAACCR version, required (see constants in NaaccrFormat) @return the corresponding default user dictionary, throws a runtime exception if not found
[ "Returns", "the", "default", "user", "dictionary", "for", "the", "requested", "NAACCR", "version", "." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java#L215-L233
aws/aws-sdk-java
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/InputSecurityGroup.java
InputSecurityGroup.withTags
public InputSecurityGroup withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public InputSecurityGroup withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "InputSecurityGroup", "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/InputSecurityGroup.java#L252-L255
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java
FavoritesInner.listAsync
public Observable<List<ApplicationInsightsComponentFavoriteInner>> listAsync(String resourceGroupName, String resourceName, FavoriteType favoriteType, FavoriteSourceType sourceType, Boolean canFetchContent, List<String> tags) { return listWithServiceResponseAsync(resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>>, List<ApplicationInsightsComponentFavoriteInner>>() { @Override public List<ApplicationInsightsComponentFavoriteInner> call(ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>> response) { return response.body(); } }); }
java
public Observable<List<ApplicationInsightsComponentFavoriteInner>> listAsync(String resourceGroupName, String resourceName, FavoriteType favoriteType, FavoriteSourceType sourceType, Boolean canFetchContent, List<String> tags) { return listWithServiceResponseAsync(resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>>, List<ApplicationInsightsComponentFavoriteInner>>() { @Override public List<ApplicationInsightsComponentFavoriteInner> call(ServiceResponse<List<ApplicationInsightsComponentFavoriteInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ApplicationInsightsComponentFavoriteInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "FavoriteType", "favoriteType", ",", "FavoriteSourceType", "sourceType", ",", "Boolean", ...
Gets a list of favorites defined within an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param favoriteType The type of favorite. Value can be either shared or user. Possible values include: 'shared', 'user' @param sourceType Source type of favorite to return. When left out, the source type defaults to 'other' (not present in this enum). Possible values include: 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', 'impact', 'segmentation' @param canFetchContent Flag indicating whether or not to return the full content for each applicable favorite. If false, only return summary content for favorites. @param tags Tags that must be present on each favorite returned. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ApplicationInsightsComponentFavoriteInner&gt; object
[ "Gets", "a", "list", "of", "favorites", "defined", "within", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/FavoritesInner.java#L216-L223
database-rider/database-rider
rider-core/src/main/java/com/github/database/rider/core/api/dataset/ScriptableTable.java
ScriptableTable.getScriptResult
private Object getScriptResult(String script, ScriptEngine engine) throws ScriptException { String scriptToExecute = script.substring(script.indexOf(":") + 1); return engine.eval(scriptToExecute); }
java
private Object getScriptResult(String script, ScriptEngine engine) throws ScriptException { String scriptToExecute = script.substring(script.indexOf(":") + 1); return engine.eval(scriptToExecute); }
[ "private", "Object", "getScriptResult", "(", "String", "script", ",", "ScriptEngine", "engine", ")", "throws", "ScriptException", "{", "String", "scriptToExecute", "=", "script", ".", "substring", "(", "script", ".", "indexOf", "(", "\":\"", ")", "+", "1", ")"...
Evaluates the script expression @return script expression result
[ "Evaluates", "the", "script", "expression" ]
train
https://github.com/database-rider/database-rider/blob/7545cc31118df9cfef3f89e27223b433a24fb5dd/rider-core/src/main/java/com/github/database/rider/core/api/dataset/ScriptableTable.java#L94-L97
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java
ImgCompressUtils.imgCompressByScale
public static void imgCompressByScale(String srcFile, String desFile, double base, int wh, Float quality) { ImgCompressUtils.imgCompressByScale(srcFile, desFile, base, wh, quality, false); }
java
public static void imgCompressByScale(String srcFile, String desFile, double base, int wh, Float quality) { ImgCompressUtils.imgCompressByScale(srcFile, desFile, base, wh, quality, false); }
[ "public", "static", "void", "imgCompressByScale", "(", "String", "srcFile", ",", "String", "desFile", ",", "double", "base", ",", "int", "wh", ",", "Float", "quality", ")", "{", "ImgCompressUtils", ".", "imgCompressByScale", "(", "srcFile", ",", "desFile", ","...
根据宽或者高和指定压缩质量进行等比例压缩,注意如果指定的宽或者高大于源图片的高或者宽, 那么压缩图片将直接使用源图片的宽高 @param srcFile 源图片地址 @param desFile 目标图片地址,包括图片名称 @param base 指定压缩后图片的宽或者高 @param wh 此参数用于指定base参数是宽还是高,该参数应由{@link ImgCompressUtils}里的 静态常量指定 @param quality 指定压缩质量,范围[0.0,1.0],如果指定为null则按照默认值
[ "根据宽或者高和指定压缩质量进行等比例压缩", "注意如果指定的宽或者高大于源图片的高或者宽", "那么压缩图片将直接使用源图片的宽高" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/ImgCompressUtils.java#L230-L232
mozilla/rhino
src/org/mozilla/javascript/UintMap.java
UintMap.put
public void put(int key, Object value) { if (key < 0) Kit.codeBug(); int index = ensureIndex(key, false); if (values == null) { values = new Object[1 << power]; } values[index] = value; }
java
public void put(int key, Object value) { if (key < 0) Kit.codeBug(); int index = ensureIndex(key, false); if (values == null) { values = new Object[1 << power]; } values[index] = value; }
[ "public", "void", "put", "(", "int", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "<", "0", ")", "Kit", ".", "codeBug", "(", ")", ";", "int", "index", "=", "ensureIndex", "(", "key", ",", "false", ")", ";", "if", "(", "values", "=...
Set object value of the key. If key does not exist, also set its int value to 0.
[ "Set", "object", "value", "of", "the", "key", ".", "If", "key", "does", "not", "exist", "also", "set", "its", "int", "value", "to", "0", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/UintMap.java#L113-L120
joniles/mpxj
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
FieldTypeHelper.valueIsNotDefault
public static final boolean valueIsNotDefault(FieldType type, Object value) { boolean result = true; if (value == null) { result = false; } else { DataType dataType = type.getDataType(); switch (dataType) { case BOOLEAN: { result = ((Boolean) value).booleanValue(); break; } case CURRENCY: case NUMERIC: { result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001); break; } case DURATION: { result = (((Duration) value).getDuration() != 0); break; } default: { break; } } } return result; }
java
public static final boolean valueIsNotDefault(FieldType type, Object value) { boolean result = true; if (value == null) { result = false; } else { DataType dataType = type.getDataType(); switch (dataType) { case BOOLEAN: { result = ((Boolean) value).booleanValue(); break; } case CURRENCY: case NUMERIC: { result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001); break; } case DURATION: { result = (((Duration) value).getDuration() != 0); break; } default: { break; } } } return result; }
[ "public", "static", "final", "boolean", "valueIsNotDefault", "(", "FieldType", "type", ",", "Object", "value", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "value", "==", "null", ")", "{", "result", "=", "false", ";", "}", "else", "{", "...
Determines if this value is the default value for the given field type. @param type field type @param value value @return true if the value is not default
[ "Determines", "if", "this", "value", "is", "the", "default", "value", "for", "the", "given", "field", "type", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L313-L353
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.disableAction
public static void disableAction(BaseComponent component, String eventName, boolean disable) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.setDisabled(disable); } }
java
public static void disableAction(BaseComponent component, String eventName, boolean disable) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.setDisabled(disable); } }
[ "public", "static", "void", "disableAction", "(", "BaseComponent", "component", ",", "String", "eventName", ",", "boolean", "disable", ")", "{", "ActionListener", "listener", "=", "getListener", "(", "component", ",", "eventName", ")", ";", "if", "(", "listener"...
Enables or disables the deferred event listener associated with the component. @param component The component. @param eventName The name of the event. @param disable Disable state for listener.
[ "Enables", "or", "disables", "the", "deferred", "event", "listener", "associated", "with", "the", "component", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L173-L179
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelConsumer.java
ChannelConsumer.resolveChannelName
protected MessageChannel resolveChannelName(String channelName, TestContext context) { if (endpointConfiguration.getChannelResolver() == null) { if (endpointConfiguration.getBeanFactory() != null) { endpointConfiguration.setChannelResolver(new BeanFactoryChannelResolver(endpointConfiguration.getBeanFactory())); } else { endpointConfiguration.setChannelResolver(new BeanFactoryChannelResolver(context.getApplicationContext())); } } return endpointConfiguration.getChannelResolver().resolveDestination(channelName); }
java
protected MessageChannel resolveChannelName(String channelName, TestContext context) { if (endpointConfiguration.getChannelResolver() == null) { if (endpointConfiguration.getBeanFactory() != null) { endpointConfiguration.setChannelResolver(new BeanFactoryChannelResolver(endpointConfiguration.getBeanFactory())); } else { endpointConfiguration.setChannelResolver(new BeanFactoryChannelResolver(context.getApplicationContext())); } } return endpointConfiguration.getChannelResolver().resolveDestination(channelName); }
[ "protected", "MessageChannel", "resolveChannelName", "(", "String", "channelName", ",", "TestContext", "context", ")", "{", "if", "(", "endpointConfiguration", ".", "getChannelResolver", "(", ")", "==", "null", ")", "{", "if", "(", "endpointConfiguration", ".", "g...
Resolve the channel by name. @param channelName the name to resolve @param context @return the MessageChannel object
[ "Resolve", "the", "channel", "by", "name", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelConsumer.java#L147-L157
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setInt
@NonNull public Parameters setInt(@NonNull String name, int value) { return setValue(name, value); }
java
@NonNull public Parameters setInt(@NonNull String name, int value) { return setValue(name, value); }
[ "@", "NonNull", "public", "Parameters", "setInt", "(", "@", "NonNull", "String", "name", ",", "int", "value", ")", "{", "return", "setValue", "(", "name", ",", "value", ")", ";", "}" ]
Set an int value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The int value. @return The self object.
[ "Set", "an", "int", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L105-L108
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java
ServletUtil.getParameter
public static String getParameter(final ServletRequest pReq, final String pName, final String pDefault) { String str = pReq.getParameter(pName); return str != null ? str : pDefault; }
java
public static String getParameter(final ServletRequest pReq, final String pName, final String pDefault) { String str = pReq.getParameter(pName); return str != null ? str : pDefault; }
[ "public", "static", "String", "getParameter", "(", "final", "ServletRequest", "pReq", ",", "final", "String", "pName", ",", "final", "String", "pDefault", ")", "{", "String", "str", "=", "pReq", ".", "getParameter", "(", "pName", ")", ";", "return", "str", ...
Gets the value of the given parameter from the request, or if the parameter is not set, the default value. @param pReq the servlet request @param pName the parameter name @param pDefault the default value @return the value of the parameter, or the default value, if the parameter is not set.
[ "Gets", "the", "value", "of", "the", "given", "parameter", "from", "the", "request", "or", "if", "the", "parameter", "is", "not", "set", "the", "default", "value", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletUtil.java#L128-L132
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/FieldFormatterRegistry.java
FieldFormatterRegistry.addStrippedPropertyPaths
public void addStrippedPropertyPaths(List<String> strippedPaths, String nestedPath, String propertyPath) { final int startIndex = propertyPath.indexOf('['); if (startIndex != -1) { final int endIndex = propertyPath.indexOf(']'); if (endIndex != -1) { final String prefix = propertyPath.substring(0, startIndex); final String key = propertyPath.substring(startIndex, endIndex + 1); final String suffix = propertyPath.substring(endIndex + 1, propertyPath.length()); // Strip the first key. strippedPaths.add(nestedPath + prefix + suffix); // Search for further keys to strip, with the first key stripped. addStrippedPropertyPaths(strippedPaths, nestedPath + prefix, suffix); // Search for further keys to strip, with the first key not stripped. addStrippedPropertyPaths(strippedPaths, nestedPath + prefix + key, suffix); } } }
java
public void addStrippedPropertyPaths(List<String> strippedPaths, String nestedPath, String propertyPath) { final int startIndex = propertyPath.indexOf('['); if (startIndex != -1) { final int endIndex = propertyPath.indexOf(']'); if (endIndex != -1) { final String prefix = propertyPath.substring(0, startIndex); final String key = propertyPath.substring(startIndex, endIndex + 1); final String suffix = propertyPath.substring(endIndex + 1, propertyPath.length()); // Strip the first key. strippedPaths.add(nestedPath + prefix + suffix); // Search for further keys to strip, with the first key stripped. addStrippedPropertyPaths(strippedPaths, nestedPath + prefix, suffix); // Search for further keys to strip, with the first key not stripped. addStrippedPropertyPaths(strippedPaths, nestedPath + prefix + key, suffix); } } }
[ "public", "void", "addStrippedPropertyPaths", "(", "List", "<", "String", ">", "strippedPaths", ",", "String", "nestedPath", ",", "String", "propertyPath", ")", "{", "final", "int", "startIndex", "=", "propertyPath", ".", "indexOf", "(", "'", "'", ")", ";", ...
パスからリストのインデックス([1])やマップのキー([key])を除去したものを構成する。 <p>SpringFrameworkの「PropertyEditorRegistrySupport#addStrippedPropertyPaths(...)」の処理</p> @param strippedPaths 除去したパス @param nestedPath 現在のネストしたパス @param propertyPath 処理対象のパス
[ "パスからリストのインデックス", "(", "[", "1", "]", ")", "やマップのキー", "(", "[", "key", "]", ")", "を除去したものを構成する。", "<p", ">", "SpringFrameworkの「PropertyEditorRegistrySupport#addStrippedPropertyPaths", "(", "...", ")", "」の処理<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/FieldFormatterRegistry.java#L137-L157
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseActivities
public void parseActivities(List<Element> activityElements, Element parentElement, ScopeImpl scopeElement) { for (Element activityElement : activityElements) { parseActivity(activityElement, parentElement, scopeElement); } }
java
public void parseActivities(List<Element> activityElements, Element parentElement, ScopeImpl scopeElement) { for (Element activityElement : activityElements) { parseActivity(activityElement, parentElement, scopeElement); } }
[ "public", "void", "parseActivities", "(", "List", "<", "Element", ">", "activityElements", ",", "Element", "parentElement", ",", "ScopeImpl", "scopeElement", ")", "{", "for", "(", "Element", "activityElement", ":", "activityElements", ")", "{", "parseActivity", "(...
Parses the activities of a certain level in the process (process, subprocess or another scope). @param activityElements The list of activities to be parsed. This list may be filtered before. @param parentElement The 'parent' element that contains the activities (process, subprocess). @param scopeElement The {@link ScopeImpl} to which the activities must be added.
[ "Parses", "the", "activities", "of", "a", "certain", "level", "in", "the", "process", "(", "process", "subprocess", "or", "another", "scope", ")", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1254-L1258
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteGroupMember
public void deleteGroupMember(Integer groupId, Integer userId) throws IOException { String tailUrl = GitlabGroup.URL + "/" + groupId + "/" + GitlabGroupMember.URL + "/" + userId; retrieve().method(DELETE).to(tailUrl, Void.class); }
java
public void deleteGroupMember(Integer groupId, Integer userId) throws IOException { String tailUrl = GitlabGroup.URL + "/" + groupId + "/" + GitlabGroupMember.URL + "/" + userId; retrieve().method(DELETE).to(tailUrl, Void.class); }
[ "public", "void", "deleteGroupMember", "(", "Integer", "groupId", ",", "Integer", "userId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabGroup", ".", "URL", "+", "\"/\"", "+", "groupId", "+", "\"/\"", "+", "GitlabGroupMember", ".", "URL"...
Delete a group member. @param groupId the group id @param userId the user id @throws IOException on gitlab api call error
[ "Delete", "a", "group", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L759-L762
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeContinue
private Status executeContinue(Stmt.Continue stmt, CallStack frame, EnclosingScope scope) { return Status.CONTINUE; }
java
private Status executeContinue(Stmt.Continue stmt, CallStack frame, EnclosingScope scope) { return Status.CONTINUE; }
[ "private", "Status", "executeContinue", "(", "Stmt", ".", "Continue", "stmt", ",", "CallStack", "frame", ",", "EnclosingScope", "scope", ")", "{", "return", "Status", ".", "CONTINUE", ";", "}" ]
Execute a continue statement. This transfers to control back to the start the nearest enclosing loop. @param stmt --- Break statement. @param frame --- The current stack frame @return
[ "Execute", "a", "continue", "statement", ".", "This", "transfers", "to", "control", "back", "to", "the", "start", "the", "nearest", "enclosing", "loop", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L298-L300
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.newUpdateOpenGraphObjectRequest
public static Request newUpdateOpenGraphObjectRequest(Session session, OpenGraphObject openGraphObject, Callback callback) { if (openGraphObject == null) { throw new FacebookException("openGraphObject cannot be null"); } String path = openGraphObject.getId(); if (path == null) { throw new FacebookException("openGraphObject must have an id"); } Bundle bundle = new Bundle(); bundle.putString(OBJECT_PARAM, openGraphObject.getInnerJSONObject().toString()); return new Request(session, path, bundle, HttpMethod.POST, callback); }
java
public static Request newUpdateOpenGraphObjectRequest(Session session, OpenGraphObject openGraphObject, Callback callback) { if (openGraphObject == null) { throw new FacebookException("openGraphObject cannot be null"); } String path = openGraphObject.getId(); if (path == null) { throw new FacebookException("openGraphObject must have an id"); } Bundle bundle = new Bundle(); bundle.putString(OBJECT_PARAM, openGraphObject.getInnerJSONObject().toString()); return new Request(session, path, bundle, HttpMethod.POST, callback); }
[ "public", "static", "Request", "newUpdateOpenGraphObjectRequest", "(", "Session", "session", ",", "OpenGraphObject", "openGraphObject", ",", "Callback", "callback", ")", "{", "if", "(", "openGraphObject", "==", "null", ")", "{", "throw", "new", "FacebookException", ...
Creates a new Request configured to update a user owned Open Graph object. @param session the Session to use, or null; if non-null, the session must be in an opened state @param openGraphObject the Open Graph object to update, which must have a valid 'id' property @param callback a callback that will be called when the request is completed to handle success or error conditions @return a Request that is ready to execute
[ "Creates", "a", "new", "Request", "configured", "to", "update", "a", "user", "owned", "Open", "Graph", "object", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L781-L795
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java
ResourceBundlesHandlerImpl.storeJawrBundleMapping
private void storeJawrBundleMapping(boolean mappingFileExists, boolean force) { if (config.getUseBundleMapping() && (!mappingFileExists || force)) { bundleMapping.setProperty(JawrConstant.JAWR_CONFIG_HASHCODE, getJawrConfigHashcode()); resourceBundleHandler.storeJawrBundleMapping(bundleMapping); if (resourceBundleHandler.getResourceType().equals(JawrConstant.CSS_TYPE)) { // Retrieve the image servlet mapping BinaryResourcesHandler binaryRsHandler = (BinaryResourcesHandler) config.getContext() .getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE); if (binaryRsHandler != null) { // Here we update the image mapping if we are using the // build time bundle processor JawrConfig binaryJawrConfig = binaryRsHandler.getConfig(); // If we use the full image bundle mapping and the jawr // working directory is not located inside the web // application // We store the image bundle maping which now contains the // mapping for CSS images String jawrWorkingDirectory = binaryJawrConfig.getJawrWorkingDirectory(); if (binaryJawrConfig.getUseBundleMapping() && (jawrWorkingDirectory == null || !jawrWorkingDirectory.startsWith(JawrConstant.URL_SEPARATOR))) { // Store the bundle mapping Properties props = new Properties(); props.putAll(binaryRsHandler.getBinaryPathMap()); props.setProperty(JawrConstant.JAWR_CONFIG_HASHCODE, Integer.toString(binaryJawrConfig.getConfigProperties().hashCode())); binaryRsHandler.getRsBundleHandler().storeJawrBundleMapping(props); } } } } }
java
private void storeJawrBundleMapping(boolean mappingFileExists, boolean force) { if (config.getUseBundleMapping() && (!mappingFileExists || force)) { bundleMapping.setProperty(JawrConstant.JAWR_CONFIG_HASHCODE, getJawrConfigHashcode()); resourceBundleHandler.storeJawrBundleMapping(bundleMapping); if (resourceBundleHandler.getResourceType().equals(JawrConstant.CSS_TYPE)) { // Retrieve the image servlet mapping BinaryResourcesHandler binaryRsHandler = (BinaryResourcesHandler) config.getContext() .getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE); if (binaryRsHandler != null) { // Here we update the image mapping if we are using the // build time bundle processor JawrConfig binaryJawrConfig = binaryRsHandler.getConfig(); // If we use the full image bundle mapping and the jawr // working directory is not located inside the web // application // We store the image bundle maping which now contains the // mapping for CSS images String jawrWorkingDirectory = binaryJawrConfig.getJawrWorkingDirectory(); if (binaryJawrConfig.getUseBundleMapping() && (jawrWorkingDirectory == null || !jawrWorkingDirectory.startsWith(JawrConstant.URL_SEPARATOR))) { // Store the bundle mapping Properties props = new Properties(); props.putAll(binaryRsHandler.getBinaryPathMap()); props.setProperty(JawrConstant.JAWR_CONFIG_HASHCODE, Integer.toString(binaryJawrConfig.getConfigProperties().hashCode())); binaryRsHandler.getRsBundleHandler().storeJawrBundleMapping(props); } } } } }
[ "private", "void", "storeJawrBundleMapping", "(", "boolean", "mappingFileExists", ",", "boolean", "force", ")", "{", "if", "(", "config", ".", "getUseBundleMapping", "(", ")", "&&", "(", "!", "mappingFileExists", "||", "force", ")", ")", "{", "bundleMapping", ...
Stores the Jawr bundle mapping @param mappingFileExists the flag indicating if the mapping file exists @param force force the storage of Jawr bundle mapping
[ "Stores", "the", "Jawr", "bundle", "mapping" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java#L947-L981
google/closure-templates
java/src/com/google/template/soy/jssrc/restricted/JsExprUtils.java
JsExprUtils.wrapWithFunction
@VisibleForTesting static JsExpr wrapWithFunction(String functionExprText, JsExpr jsExpr) { Preconditions.checkNotNull(functionExprText); return new JsExpr(functionExprText + "(" + jsExpr.getText() + ")", Integer.MAX_VALUE); }
java
@VisibleForTesting static JsExpr wrapWithFunction(String functionExprText, JsExpr jsExpr) { Preconditions.checkNotNull(functionExprText); return new JsExpr(functionExprText + "(" + jsExpr.getText() + ")", Integer.MAX_VALUE); }
[ "@", "VisibleForTesting", "static", "JsExpr", "wrapWithFunction", "(", "String", "functionExprText", ",", "JsExpr", "jsExpr", ")", "{", "Preconditions", ".", "checkNotNull", "(", "functionExprText", ")", ";", "return", "new", "JsExpr", "(", "functionExprText", "+", ...
Wraps an expression in a function call. @param functionExprText expression for the function to invoke, such as a function name or constructor phrase (such as "new SomeClass"). @param jsExpr the expression to compute the argument to the function @return a JS expression consisting of a call to the specified function, applied to the provided expression.
[ "Wraps", "an", "expression", "in", "a", "function", "call", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/restricted/JsExprUtils.java#L135-L139
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java
MetatypeUtils.parseDuration
@FFDCIgnore(Exception.class) public static long parseDuration(Object configAlias, String propertyKey, Object obj, long defaultValue, TimeUnit units) { if (obj != null) { try { if (obj instanceof String) return evaluateDuration((String) obj, units); else if (obj instanceof Long) return (Long) obj; } catch (Exception e) { Tr.warning(tc, "invalidDuration", configAlias, propertyKey, obj); throw new IllegalArgumentException("Duration value could not be parsed: key=" + propertyKey + ", value=" + obj, e); } // unknown type Tr.warning(tc, "invalidDuration", configAlias, propertyKey, obj); throw new IllegalArgumentException("Duration value could not be parsed: key=" + propertyKey + ", value=" + obj); } return defaultValue; }
java
@FFDCIgnore(Exception.class) public static long parseDuration(Object configAlias, String propertyKey, Object obj, long defaultValue, TimeUnit units) { if (obj != null) { try { if (obj instanceof String) return evaluateDuration((String) obj, units); else if (obj instanceof Long) return (Long) obj; } catch (Exception e) { Tr.warning(tc, "invalidDuration", configAlias, propertyKey, obj); throw new IllegalArgumentException("Duration value could not be parsed: key=" + propertyKey + ", value=" + obj, e); } // unknown type Tr.warning(tc, "invalidDuration", configAlias, propertyKey, obj); throw new IllegalArgumentException("Duration value could not be parsed: key=" + propertyKey + ", value=" + obj); } return defaultValue; }
[ "@", "FFDCIgnore", "(", "Exception", ".", "class", ")", "public", "static", "long", "parseDuration", "(", "Object", "configAlias", ",", "String", "propertyKey", ",", "Object", "obj", ",", "long", "defaultValue", ",", "TimeUnit", "units", ")", "{", "if", "(",...
Parse a duration from the provided config value: checks for whether or not the object read from the Service/Component configuration is a String or a Metatype converted long duration value <p> If an exception occurs converting the object parameter: A translated warning message will be issued using the provided propertyKey and object as parameters. FFDC for the exception is suppressed: Callers should handle the thrown IllegalArgumentException as appropriate. @param configAlias Name of config (pid or alias) associated with a registered service or DS component. @param propertyKey The key used to retrieve the property value from the map. Used in the warning message if the value is badly formed. @param obj The object retrieved from the configuration property map/dictionary. @param defaultValue The default value that should be applied if the object is null. @param units The unit of time for the duration value. This is only used when converting from a String value. @return Long parsed/retrieved from obj, or default value if obj is null @throws IllegalArgumentException If value is not a String/Short/Integer/Long, or if an error occurs while converting/casting the object to the return parameter type.
[ "Parse", "a", "duration", "from", "the", "provided", "config", "value", ":", "checks", "for", "whether", "or", "not", "the", "object", "read", "from", "the", "Service", "/", "Component", "configuration", "is", "a", "String", "or", "a", "Metatype", "converted...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L465-L484
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/attribute/map/GenericMapAttribute.java
GenericMapAttribute.parseProjection
public static CoordinateReferenceSystem parseProjection( final String projection, final Boolean longitudeFirst) { try { if (longitudeFirst == null) { return CRS.decode(projection); } else { return CRS.decode(projection, longitudeFirst); } } catch (NoSuchAuthorityCodeException e) { throw new RuntimeException(projection + " was not recognized as a crs code", e); } catch (FactoryException e) { throw new RuntimeException("Error occurred while parsing: " + projection, e); } }
java
public static CoordinateReferenceSystem parseProjection( final String projection, final Boolean longitudeFirst) { try { if (longitudeFirst == null) { return CRS.decode(projection); } else { return CRS.decode(projection, longitudeFirst); } } catch (NoSuchAuthorityCodeException e) { throw new RuntimeException(projection + " was not recognized as a crs code", e); } catch (FactoryException e) { throw new RuntimeException("Error occurred while parsing: " + projection, e); } }
[ "public", "static", "CoordinateReferenceSystem", "parseProjection", "(", "final", "String", "projection", ",", "final", "Boolean", "longitudeFirst", ")", "{", "try", "{", "if", "(", "longitudeFirst", "==", "null", ")", "{", "return", "CRS", ".", "decode", "(", ...
Parse the given projection. @param projection The projection string. @param longitudeFirst longitudeFirst
[ "Parse", "the", "given", "projection", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/attribute/map/GenericMapAttribute.java#L84-L97
Jasig/uPortal
uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/profile/ServerProfileMapperImpl.java
ServerProfileMapperImpl.getProfileFname
@Override public String getProfileFname(IPerson person, HttpServletRequest request) { Validate.notNull(person, "Cannot get profile fname for a null person."); Validate.notNull(request, "Cannot get profile fname for a null request."); String userName = person.getUserName(); final String userServerName = request.getServerName(); Matcher matcher = this.pattern.matcher(userServerName); if (matcher.matches()) { logger.debug( "User {} will be given {} profile because server {} matches regular expression {}", userName, this.profile, userServerName, this.serverRegex); return this.profile; } else { logger.debug( "User {} will not be given {} profile because server {} does not match regular expression {}", userName, this.profile, userServerName, this.serverRegex); return null; } }
java
@Override public String getProfileFname(IPerson person, HttpServletRequest request) { Validate.notNull(person, "Cannot get profile fname for a null person."); Validate.notNull(request, "Cannot get profile fname for a null request."); String userName = person.getUserName(); final String userServerName = request.getServerName(); Matcher matcher = this.pattern.matcher(userServerName); if (matcher.matches()) { logger.debug( "User {} will be given {} profile because server {} matches regular expression {}", userName, this.profile, userServerName, this.serverRegex); return this.profile; } else { logger.debug( "User {} will not be given {} profile because server {} does not match regular expression {}", userName, this.profile, userServerName, this.serverRegex); return null; } }
[ "@", "Override", "public", "String", "getProfileFname", "(", "IPerson", "person", ",", "HttpServletRequest", "request", ")", "{", "Validate", ".", "notNull", "(", "person", ",", "\"Cannot get profile fname for a null person.\"", ")", ";", "Validate", ".", "notNull", ...
Returns the profile name specified by {@link #setDefaultProfile(String defaultProfile) setDefaultProfile} or "default" if {@link #setDefaultProfile(String defaultProfile) setDefaultProfile} is not called if the user is using a server in the server regular expression specified by {@link #setServerRegex(String serverRegex) setServerRegex} returns null otherwise @param person cannot be null @param request cannot be null
[ "Returns", "the", "profile", "name", "specified", "by", "{", "@link", "#setDefaultProfile", "(", "String", "defaultProfile", ")", "setDefaultProfile", "}", "or", "default", "if", "{", "@link", "#setDefaultProfile", "(", "String", "defaultProfile", ")", "setDefaultPr...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/profile/ServerProfileMapperImpl.java#L75-L103
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java
SAX2DTM2.endElement
public void endElement(String uri, String localName, String qName) throws SAXException { charactersFlush(); // If no one noticed, startPrefixMapping is a drag. // Pop the context for the last child (the one pushed by startElement) m_contextIndexes.quickPop(1); // Do it again for this one (the one pushed by the last endElement). int topContextIndex = m_contextIndexes.peek(); if (topContextIndex != m_prefixMappings.size()) { m_prefixMappings.setSize(topContextIndex); } m_previous = m_parents.pop(); popShouldStripWhitespace(); }
java
public void endElement(String uri, String localName, String qName) throws SAXException { charactersFlush(); // If no one noticed, startPrefixMapping is a drag. // Pop the context for the last child (the one pushed by startElement) m_contextIndexes.quickPop(1); // Do it again for this one (the one pushed by the last endElement). int topContextIndex = m_contextIndexes.peek(); if (topContextIndex != m_prefixMappings.size()) { m_prefixMappings.setSize(topContextIndex); } m_previous = m_parents.pop(); popShouldStripWhitespace(); }
[ "public", "void", "endElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "charactersFlush", "(", ")", ";", "// If no one noticed, startPrefixMapping is a drag.", "// Pop the context for the last child (the...
Receive notification of the end of an element. <p>By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).</p> @param uri The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. @param localName The local name (without prefix), or the empty string if Namespace processing is not being performed. @param qName The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#endElement
[ "Receive", "notification", "of", "the", "end", "of", "an", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L2226-L2244
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/BeanUtils.java
BeanUtils.getterMethod
public static Method getterMethod(Class<?> target, Class<?> componentClass) { try { return target.getMethod(getterName(componentClass)); } catch (NoSuchMethodException e) { //if (log.isTraceEnabled()) log.trace("Unable to find method " + getterName(componentClass) + " in class " + target); return null; } catch (NullPointerException e) { return null; } }
java
public static Method getterMethod(Class<?> target, Class<?> componentClass) { try { return target.getMethod(getterName(componentClass)); } catch (NoSuchMethodException e) { //if (log.isTraceEnabled()) log.trace("Unable to find method " + getterName(componentClass) + " in class " + target); return null; } catch (NullPointerException e) { return null; } }
[ "public", "static", "Method", "getterMethod", "(", "Class", "<", "?", ">", "target", ",", "Class", "<", "?", ">", "componentClass", ")", "{", "try", "{", "return", "target", ".", "getMethod", "(", "getterName", "(", "componentClass", ")", ")", ";", "}", ...
Returns a Method object corresponding to a getter that retrieves an instance of componentClass from target. @param target class that the getter should exist on @param componentClass component to get @return Method object, or null of one does not exist
[ "Returns", "a", "Method", "object", "corresponding", "to", "a", "getter", "that", "retrieves", "an", "instance", "of", "componentClass", "from", "target", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/BeanUtils.java#L81-L92
box/box-java-sdk
src/main/java/com/box/sdk/BoxRecents.java
BoxRecents.getRecentItems
public static BoxResourceIterable<BoxRecentItem> getRecentItems(final BoxAPIConnection api, int limit, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxRecentItem>( api, RECENTS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxRecentItem factory(JsonObject jsonObject) { return new BoxRecentItem(jsonObject, api); } }; }
java
public static BoxResourceIterable<BoxRecentItem> getRecentItems(final BoxAPIConnection api, int limit, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxRecentItem>( api, RECENTS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxRecentItem factory(JsonObject jsonObject) { return new BoxRecentItem(jsonObject, api); } }; }
[ "public", "static", "BoxResourceIterable", "<", "BoxRecentItem", ">", "getRecentItems", "(", "final", "BoxAPIConnection", "api", ",", "int", "limit", ",", "String", "...", "fields", ")", "{", "QueryStringBuilder", "builder", "=", "new", "QueryStringBuilder", "(", ...
Used to retrieve all collaborations associated with the item. @see <a href="http://google.com">https://developer.box.com/reference#get-recent-items</a> @param api BoxAPIConnection from the associated file. @param limit limit of items to be retrieved. Default is 100. Maximum is 1000 @param fields the optional fields to retrieve. @return An iterable of BoxCollaboration.Info instances associated with the item.
[ "Used", "to", "retrieve", "all", "collaborations", "associated", "with", "the", "item", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRecents.java#L30-L45
jbundle/jbundle
thin/base/thread/src/main/java/org/jbundle/thin/base/thread/AutoTask.java
AutoTask.init
public void init(App application, String strParams, Map<String, Object> properties) { m_application = (App)application; if (m_application != null) m_application.addTask(this, null); // Add this task to the list if (properties != null) { if (m_properties != null) m_properties.putAll(properties); else m_properties = properties; } if (strParams != null) { if (m_properties == null) m_properties = new HashMap<String,Object>(); Util.parseArgs(m_properties, strParams); } m_recordOwnerCollection = new RecordOwnerCollection(this); }
java
public void init(App application, String strParams, Map<String, Object> properties) { m_application = (App)application; if (m_application != null) m_application.addTask(this, null); // Add this task to the list if (properties != null) { if (m_properties != null) m_properties.putAll(properties); else m_properties = properties; } if (strParams != null) { if (m_properties == null) m_properties = new HashMap<String,Object>(); Util.parseArgs(m_properties, strParams); } m_recordOwnerCollection = new RecordOwnerCollection(this); }
[ "public", "void", "init", "(", "App", "application", ",", "String", "strParams", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "m_application", "=", "(", "App", ")", "application", ";", "if", "(", "m_application", "!=", "null", "...
Constructor. @param application The parent application. @param strParams The task properties.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/thread/src/main/java/org/jbundle/thin/base/thread/AutoTask.java#L88-L107
phax/ph-commons
ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java
KeyStoreHelper.loadKeyStoreDirect
@Nonnull public static KeyStore loadKeyStoreDirect (@Nonnull final IKeyStoreType aKeyStoreType, @Nonnull final String sKeyStorePath, @Nullable final char [] aKeyStorePassword) throws GeneralSecurityException, IOException { ValueEnforcer.notNull (aKeyStoreType, "KeyStoreType"); ValueEnforcer.notNull (sKeyStorePath, "KeyStorePath"); // Open the resource stream final InputStream aIS = getResourceProvider ().getInputStream (sKeyStorePath); if (aIS == null) throw new IllegalArgumentException ("Failed to open key store '" + sKeyStorePath + "'"); try { final KeyStore aKeyStore = aKeyStoreType.getKeyStore (); aKeyStore.load (aIS, aKeyStorePassword); return aKeyStore; } catch (final KeyStoreException ex) { throw new IllegalStateException ("No provider can handle key stores of type " + aKeyStoreType, ex); } finally { StreamHelper.close (aIS); } }
java
@Nonnull public static KeyStore loadKeyStoreDirect (@Nonnull final IKeyStoreType aKeyStoreType, @Nonnull final String sKeyStorePath, @Nullable final char [] aKeyStorePassword) throws GeneralSecurityException, IOException { ValueEnforcer.notNull (aKeyStoreType, "KeyStoreType"); ValueEnforcer.notNull (sKeyStorePath, "KeyStorePath"); // Open the resource stream final InputStream aIS = getResourceProvider ().getInputStream (sKeyStorePath); if (aIS == null) throw new IllegalArgumentException ("Failed to open key store '" + sKeyStorePath + "'"); try { final KeyStore aKeyStore = aKeyStoreType.getKeyStore (); aKeyStore.load (aIS, aKeyStorePassword); return aKeyStore; } catch (final KeyStoreException ex) { throw new IllegalStateException ("No provider can handle key stores of type " + aKeyStoreType, ex); } finally { StreamHelper.close (aIS); } }
[ "@", "Nonnull", "public", "static", "KeyStore", "loadKeyStoreDirect", "(", "@", "Nonnull", "final", "IKeyStoreType", "aKeyStoreType", ",", "@", "Nonnull", "final", "String", "sKeyStorePath", ",", "@", "Nullable", "final", "char", "[", "]", "aKeyStorePassword", ")"...
Load a key store from a resource. @param aKeyStoreType Type of key store. May not be <code>null</code>. @param sKeyStorePath The path pointing to the key store. May not be <code>null</code>. @param aKeyStorePassword The key store password. May be <code>null</code> to indicate that no password is required. @return The Java key-store object. @see KeyStore#load(InputStream, char[]) @throws GeneralSecurityException In case of a key store error @throws IOException In case key store loading fails @throws IllegalArgumentException If the key store path is invalid
[ "Load", "a", "key", "store", "from", "a", "resource", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java#L133-L161
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_scatter.java
Scs_scatter.cs_scatter
public static int cs_scatter(Scs A, int j, float beta, int[] w, float[] x, int mark, Scs C, int nz) { int i, p; int Ap[], Ai[], Ci[]; float[] Ax; if (!Scs_util.CS_CSC(A) || w == null || !Scs_util.CS_CSC(C)) return (-1); /* check inputs */ Ap = A.p; Ai = A.i; Ax = A.x; Ci = C.i; for (p = Ap[j]; p < Ap[j + 1]; p++) { i = Ai[p]; /* A(i,j) is nonzero */ if (w[i] < mark) { w[i] = mark; /* i is new entry in column j */ Ci[nz++] = i; /* add i to pattern of C(:,j) */ if (x != null) x[i] = beta * Ax[p]; /* x(i) = beta*A(i,j) */ } else if (x != null) x[i] += beta * Ax[p]; /* i exists in C(:,j) already */ } return nz; }
java
public static int cs_scatter(Scs A, int j, float beta, int[] w, float[] x, int mark, Scs C, int nz) { int i, p; int Ap[], Ai[], Ci[]; float[] Ax; if (!Scs_util.CS_CSC(A) || w == null || !Scs_util.CS_CSC(C)) return (-1); /* check inputs */ Ap = A.p; Ai = A.i; Ax = A.x; Ci = C.i; for (p = Ap[j]; p < Ap[j + 1]; p++) { i = Ai[p]; /* A(i,j) is nonzero */ if (w[i] < mark) { w[i] = mark; /* i is new entry in column j */ Ci[nz++] = i; /* add i to pattern of C(:,j) */ if (x != null) x[i] = beta * Ax[p]; /* x(i) = beta*A(i,j) */ } else if (x != null) x[i] += beta * Ax[p]; /* i exists in C(:,j) already */ } return nz; }
[ "public", "static", "int", "cs_scatter", "(", "Scs", "A", ",", "int", "j", ",", "float", "beta", ",", "int", "[", "]", "w", ",", "float", "[", "]", "x", ",", "int", "mark", ",", "Scs", "C", ",", "int", "nz", ")", "{", "int", "i", ",", "p", ...
Scatters and sums a sparse vector A(:,j) into a dense vector, x = x + beta * A(:,j). @param A the sparse vector is A(:,j) @param j the column of A to use @param beta scalar multiplied by A(:,j) @param w size m, node i is marked if w[i] = mark @param x size m, ignored if null @param mark mark value of w @param C pattern of x accumulated in C.i @param nz pattern of x placed in C starting at C.i[nz] @return new value of nz, -1 on error
[ "Scatters", "and", "sums", "a", "sparse", "vector", "A", "(", ":", "j", ")", "into", "a", "dense", "vector", "x", "=", "x", "+", "beta", "*", "A", "(", ":", "j", ")", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_scatter.java#L59-L80
aws/aws-sdk-java
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/ChannelSummary.java
ChannelSummary.withTags
public ChannelSummary withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public ChannelSummary withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ChannelSummary", "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/ChannelSummary.java#L632-L635
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.createOrUpdateAsync
public Observable<NetworkWatcherInner> createOrUpdateAsync(String resourceGroupName, String networkWatcherName, NetworkWatcherInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NetworkWatcherInner>, NetworkWatcherInner>() { @Override public NetworkWatcherInner call(ServiceResponse<NetworkWatcherInner> response) { return response.body(); } }); }
java
public Observable<NetworkWatcherInner> createOrUpdateAsync(String resourceGroupName, String networkWatcherName, NetworkWatcherInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NetworkWatcherInner>, NetworkWatcherInner>() { @Override public NetworkWatcherInner call(ServiceResponse<NetworkWatcherInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkWatcherInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "NetworkWatcherInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroup...
Creates or updates a network watcher in the specified resource group. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the network watcher resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NetworkWatcherInner object
[ "Creates", "or", "updates", "a", "network", "watcher", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L230-L237
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/Path.java
Path.processEdge
protected void processEdge(int edgeId, int adjNode, int prevEdgeId) { EdgeIteratorState iter = graph.getEdgeIteratorState(edgeId, adjNode); distance += iter.getDistance(); time += weighting.calcMillis(iter, false, prevEdgeId); addEdge(edgeId); }
java
protected void processEdge(int edgeId, int adjNode, int prevEdgeId) { EdgeIteratorState iter = graph.getEdgeIteratorState(edgeId, adjNode); distance += iter.getDistance(); time += weighting.calcMillis(iter, false, prevEdgeId); addEdge(edgeId); }
[ "protected", "void", "processEdge", "(", "int", "edgeId", ",", "int", "adjNode", ",", "int", "prevEdgeId", ")", "{", "EdgeIteratorState", "iter", "=", "graph", ".", "getEdgeIteratorState", "(", "edgeId", ",", "adjNode", ")", ";", "distance", "+=", "iter", "....
Calculates the distance and time of the specified edgeId. Also it adds the edgeId to the path list. @param prevEdgeId here the edge that comes before edgeId is necessary. I.e. for the reverse search we need the next edge.
[ "Calculates", "the", "distance", "and", "time", "of", "the", "specified", "edgeId", ".", "Also", "it", "adds", "the", "edgeId", "to", "the", "path", "list", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/Path.java#L240-L245
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java
JSEventMap.setHandler
public void setHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler) { ValueEnforcer.notNull (eJSEvent, "JSEvent"); ValueEnforcer.notNull (aNewHandler, "NewHandler"); // Set only the new handler and remove any existing handler m_aEvents.put (eJSEvent, new CollectingJSCodeProvider ().appendFlattened (aNewHandler)); }
java
public void setHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler) { ValueEnforcer.notNull (eJSEvent, "JSEvent"); ValueEnforcer.notNull (aNewHandler, "NewHandler"); // Set only the new handler and remove any existing handler m_aEvents.put (eJSEvent, new CollectingJSCodeProvider ().appendFlattened (aNewHandler)); }
[ "public", "void", "setHandler", "(", "@", "Nonnull", "final", "EJSEvent", "eJSEvent", ",", "@", "Nonnull", "final", "IHasJSCode", "aNewHandler", ")", "{", "ValueEnforcer", ".", "notNull", "(", "eJSEvent", ",", "\"JSEvent\"", ")", ";", "ValueEnforcer", ".", "no...
Set a handler for the given JS event. If an existing handler is present, it is automatically overridden. @param eJSEvent The JS event. May not be <code>null</code>. @param aNewHandler The new handler to be added. May not be <code>null</code>.
[ "Set", "a", "handler", "for", "the", "given", "JS", "event", ".", "If", "an", "existing", "handler", "is", "present", "it", "is", "automatically", "overridden", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java#L99-L106
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java
SynchronizedIO.writeFile
public void writeFile(String aFileName, URL aData) throws Exception { Object lock = retrieveLock(aFileName); synchronized (lock) { IO.writeFile(aFileName, aData); } }
java
public void writeFile(String aFileName, URL aData) throws Exception { Object lock = retrieveLock(aFileName); synchronized (lock) { IO.writeFile(aFileName, aData); } }
[ "public", "void", "writeFile", "(", "String", "aFileName", ",", "URL", "aData", ")", "throws", "Exception", "{", "Object", "lock", "=", "retrieveLock", "(", "aFileName", ")", ";", "synchronized", "(", "lock", ")", "{", "IO", ".", "writeFile", "(", "aFileNa...
Write binary file data @param aFileName @param aData @throws Exception
[ "Write", "binary", "file", "data" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java#L134-L142
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java
DTMDefaultBase.findGTE
protected int findGTE(int[] list, int start, int len, int value) { int low = start; int high = start + (len - 1); int end = high; while (low <= high) { int mid = (low + high) / 2; int c = list[mid]; if (c > value) high = mid - 1; else if (c < value) low = mid + 1; else return mid; } return (low <= end && list[low] > value) ? low : -1; }
java
protected int findGTE(int[] list, int start, int len, int value) { int low = start; int high = start + (len - 1); int end = high; while (low <= high) { int mid = (low + high) / 2; int c = list[mid]; if (c > value) high = mid - 1; else if (c < value) low = mid + 1; else return mid; } return (low <= end && list[low] > value) ? low : -1; }
[ "protected", "int", "findGTE", "(", "int", "[", "]", "list", ",", "int", "start", ",", "int", "len", ",", "int", "value", ")", "{", "int", "low", "=", "start", ";", "int", "high", "=", "start", "+", "(", "len", "-", "1", ")", ";", "int", "end",...
Find the first index that occurs in the list that is greater than or equal to the given value. @param list A list of integers. @param start The start index to begin the search. @param len The number of items to search. @param value Find the slot that has a value that is greater than or identical to this argument. @return The index in the list of the slot that is higher or identical to the identity argument, or -1 if no node is higher or equal.
[ "Find", "the", "first", "index", "that", "occurs", "in", "the", "list", "that", "is", "greater", "than", "or", "equal", "to", "the", "given", "value", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L351-L372
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/refresher/HttpRefresher.java
HttpRefresher.isValidConfigNode
private static boolean isValidConfigNode(final boolean sslEnabled, final NodeInfo nodeInfo) { if (sslEnabled && nodeInfo.sslServices().containsKey(ServiceType.CONFIG)) { return true; } else if (nodeInfo.services().containsKey(ServiceType.CONFIG)) { return true; } return false; }
java
private static boolean isValidConfigNode(final boolean sslEnabled, final NodeInfo nodeInfo) { if (sslEnabled && nodeInfo.sslServices().containsKey(ServiceType.CONFIG)) { return true; } else if (nodeInfo.services().containsKey(ServiceType.CONFIG)) { return true; } return false; }
[ "private", "static", "boolean", "isValidConfigNode", "(", "final", "boolean", "sslEnabled", ",", "final", "NodeInfo", "nodeInfo", ")", "{", "if", "(", "sslEnabled", "&&", "nodeInfo", ".", "sslServices", "(", ")", ".", "containsKey", "(", "ServiceType", ".", "C...
Helper method to detect if the given node can actually perform http config refresh. @param sslEnabled true if ssl enabled, false otherwise. @param nodeInfo the node info for the given node. @return true if it is a valid config node, false otherwise.
[ "Helper", "method", "to", "detect", "if", "the", "given", "node", "can", "actually", "perform", "http", "config", "refresh", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/HttpRefresher.java#L367-L374
dbracewell/mango
src/main/java/com/davidbracewell/json/JsonReader.java
JsonReader.endArray
public JsonReader endArray() throws IOException { if (currentValue.getKey() != END_ARRAY) { throw new IOException("Expecting END_ARRAY, but found " + jsonTokenToStructuredElement(null)); } consume(); return this; }
java
public JsonReader endArray() throws IOException { if (currentValue.getKey() != END_ARRAY) { throw new IOException("Expecting END_ARRAY, but found " + jsonTokenToStructuredElement(null)); } consume(); return this; }
[ "public", "JsonReader", "endArray", "(", ")", "throws", "IOException", "{", "if", "(", "currentValue", ".", "getKey", "(", ")", "!=", "END_ARRAY", ")", "{", "throw", "new", "IOException", "(", "\"Expecting END_ARRAY, but found \"", "+", "jsonTokenToStructuredElement...
Ends an Array @return the structured reader @throws IOException Something went wrong reading
[ "Ends", "an", "Array" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonReader.java#L246-L252
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.asyncIncr
@Override public OperationFuture<Long> asyncIncr(String key, long by, long def) { return asyncMutate(Mutator.incr, key, by, def, 0); }
java
@Override public OperationFuture<Long> asyncIncr(String key, long by, long def) { return asyncMutate(Mutator.incr, key, by, def, 0); }
[ "@", "Override", "public", "OperationFuture", "<", "Long", ">", "asyncIncr", "(", "String", "key", ",", "long", "by", ",", "long", "def", ")", "{", "return", "asyncMutate", "(", "Mutator", ".", "incr", ",", "key", ",", "by", ",", "def", ",", "0", ")"...
Asychronous increment. @param key key to increment @param by the amount to increment the value by @param def the default value (if the counter does not exist) @return a future with the incremented value, or -1 if the increment failed. @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Asychronous", "increment", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L2143-L2146
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java
SqlBuilderHelper.generateLogForContentProviderBeginning
static void generateLogForContentProviderBeginning(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { if (method.getParent().isLogEnabled()) { methodBuilder.addStatement("$T.info($S, uri.toString())", Logger.class, "Execute " + method.jql.operationType + " for URI %s"); } }
java
static void generateLogForContentProviderBeginning(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { if (method.getParent().isLogEnabled()) { methodBuilder.addStatement("$T.info($S, uri.toString())", Logger.class, "Execute " + method.jql.operationType + " for URI %s"); } }
[ "static", "void", "generateLogForContentProviderBeginning", "(", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "if", "(", "method", ".", "getParent", "(", ")", ".", "isLogEnabled", "(", ")", ")", "{", "methodBuilder",...
<p> Generate log info at beginning of method </p> . @param method the method @param methodBuilder the method builder
[ "<p", ">", "Generate", "log", "info", "at", "beginning", "of", "method", "<", "/", "p", ">", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L332-L337
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.setRecipients
private void setRecipients(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { for (Recipient recipient : email.getRecipients()) { mimeMsg.addRecipient(convert(recipient.getType()), toInternetAddress(recipient.getAddress())); } }
java
private void setRecipients(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { for (Recipient recipient : email.getRecipients()) { mimeMsg.addRecipient(convert(recipient.getType()), toInternetAddress(recipient.getAddress())); } }
[ "private", "void", "setRecipients", "(", "Email", "email", ",", "MimeMessage", "mimeMsg", ")", "throws", "MessagingException", ",", "AddressException", ",", "UnsupportedEncodingException", "{", "for", "(", "Recipient", "recipient", ":", "email", ".", "getRecipients", ...
Set the recipients addresses on the mime message. @param email the source email @param mimeMsg the mime message to fill @throws MessagingException when the email address is not valid @throws AddressException when the email address is not valid @throws UnsupportedEncodingException when the email address is not valid
[ "Set", "the", "recipients", "addresses", "on", "the", "mime", "message", "." ]
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L165-L169
braintree/browser-switch-android
browser-switch/src/main/java/com/braintreepayments/browserswitch/BrowserSwitchFragment.java
BrowserSwitchFragment.browserSwitch
public void browserSwitch(int requestCode, Intent intent) { if (requestCode == Integer.MIN_VALUE) { BrowserSwitchResult result = BrowserSwitchResult.ERROR .setErrorMessage("Request code cannot be Integer.MIN_VALUE"); onBrowserSwitchResult(requestCode, result, null); return; } if (!isReturnUrlSetup()) { BrowserSwitchResult result = BrowserSwitchResult.ERROR .setErrorMessage("The return url scheme was not set up, incorrectly set up, " + "or more than one Activity on this device defines the same url " + "scheme in it's Android Manifest. See " + "https://github.com/braintree/browser-switch-android for more " + "information on setting up a return url scheme."); onBrowserSwitchResult(requestCode, result, null); return; } else if (availableActivities(intent).size() == 0) { BrowserSwitchResult result = BrowserSwitchResult.ERROR .setErrorMessage(String.format("No installed activities can open this URL: %s", intent.getData().toString())); onBrowserSwitchResult(requestCode, result, null); return; } mRequestCode = requestCode; mContext.startActivity(intent); }
java
public void browserSwitch(int requestCode, Intent intent) { if (requestCode == Integer.MIN_VALUE) { BrowserSwitchResult result = BrowserSwitchResult.ERROR .setErrorMessage("Request code cannot be Integer.MIN_VALUE"); onBrowserSwitchResult(requestCode, result, null); return; } if (!isReturnUrlSetup()) { BrowserSwitchResult result = BrowserSwitchResult.ERROR .setErrorMessage("The return url scheme was not set up, incorrectly set up, " + "or more than one Activity on this device defines the same url " + "scheme in it's Android Manifest. See " + "https://github.com/braintree/browser-switch-android for more " + "information on setting up a return url scheme."); onBrowserSwitchResult(requestCode, result, null); return; } else if (availableActivities(intent).size() == 0) { BrowserSwitchResult result = BrowserSwitchResult.ERROR .setErrorMessage(String.format("No installed activities can open this URL: %s", intent.getData().toString())); onBrowserSwitchResult(requestCode, result, null); return; } mRequestCode = requestCode; mContext.startActivity(intent); }
[ "public", "void", "browserSwitch", "(", "int", "requestCode", ",", "Intent", "intent", ")", "{", "if", "(", "requestCode", "==", "Integer", ".", "MIN_VALUE", ")", "{", "BrowserSwitchResult", "result", "=", "BrowserSwitchResult", ".", "ERROR", ".", "setErrorMessa...
Open a browser or <a href="https://developer.chrome.com/multidevice/android/customtabs">Chrome Custom Tab</a> with the given intent. @param requestCode the request code used to differentiate requests from one another. @param intent an {@link Intent} containing a url to open.
[ "Open", "a", "browser", "or", "<a", "href", "=", "https", ":", "//", "developer", ".", "chrome", ".", "com", "/", "multidevice", "/", "android", "/", "customtabs", ">", "Chrome", "Custom", "Tab<", "/", "a", ">", "with", "the", "given", "intent", "." ]
train
https://github.com/braintree/browser-switch-android/blob/d830de21bc732b51e658e7296aad7b9037842a19/browser-switch/src/main/java/com/braintreepayments/browserswitch/BrowserSwitchFragment.java#L118-L144
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetAutomationRuleResourcesImpl.java
SheetAutomationRuleResourcesImpl.updateAutomationRule
public AutomationRule updateAutomationRule(long sheetId, AutomationRule automationRule) throws SmartsheetException { Util.throwIfNull(automationRule); return this.updateResource("sheets/" + sheetId + "/automationrules/" + automationRule.getId(), AutomationRule.class, automationRule); }
java
public AutomationRule updateAutomationRule(long sheetId, AutomationRule automationRule) throws SmartsheetException { Util.throwIfNull(automationRule); return this.updateResource("sheets/" + sheetId + "/automationrules/" + automationRule.getId(), AutomationRule.class, automationRule); }
[ "public", "AutomationRule", "updateAutomationRule", "(", "long", "sheetId", ",", "AutomationRule", "automationRule", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "automationRule", ")", ";", "return", "this", ".", "updateResource", "(", ...
Updates an automation rule. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/automationrules/{automationRuleId} Exceptions: IllegalArgumentException : if any argument is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param sheetId the sheetId @param automationRule the automation rule to update @return the updated automation rule (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Updates", "an", "automation", "rule", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetAutomationRuleResourcesImpl.java#L114-L118
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/DefaultXPathBinder.java
DefaultXPathBinder.asBoolean
@Override public CloseableValue<Boolean> asBoolean() { final Class<?> callerClass = ReflectionHelper.getDirectCallerClass(); return bindSingeValue(Boolean.TYPE, callerClass); }
java
@Override public CloseableValue<Boolean> asBoolean() { final Class<?> callerClass = ReflectionHelper.getDirectCallerClass(); return bindSingeValue(Boolean.TYPE, callerClass); }
[ "@", "Override", "public", "CloseableValue", "<", "Boolean", ">", "asBoolean", "(", ")", "{", "final", "Class", "<", "?", ">", "callerClass", "=", "ReflectionHelper", ".", "getDirectCallerClass", "(", ")", ";", "return", "bindSingeValue", "(", "Boolean", ".", ...
Evaluates the XPath as a boolean value. This method is just a shortcut for as(Boolean.TYPE); @return true when the selected value equals (ignoring case) 'true'
[ "Evaluates", "the", "XPath", "as", "a", "boolean", "value", ".", "This", "method", "is", "just", "a", "shortcut", "for", "as", "(", "Boolean", ".", "TYPE", ")", ";" ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/DefaultXPathBinder.java#L76-L80
alipay/sofa-rpc
extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistryHelper.java
SofaRegistryHelper.getKeyPairs
private static String getKeyPairs(String key, Object value) { if (value != null) { return "&" + key + "=" + value.toString(); } else { return StringUtils.EMPTY; } }
java
private static String getKeyPairs(String key, Object value) { if (value != null) { return "&" + key + "=" + value.toString(); } else { return StringUtils.EMPTY; } }
[ "private", "static", "String", "getKeyPairs", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "return", "\"&\"", "+", "key", "+", "\"=\"", "+", "value", ".", "toString", "(", ")", ";", "}", "else", ...
Gets key pairs. @param key the key @param value the value @return the key pairs
[ "Gets", "key", "pairs", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistryHelper.java#L237-L243
CloudBees-community/syslog-java-client
src/main/java/com/cloudbees/syslog/util/InternalLogger.java
InternalLogger.log
public synchronized void log(@Nullable Level level, @Nullable String msg, @Nullable Throwable t) { if (!isLoggable(level)) return; System.err.println(df.format(new Date()) + " [" + Thread.currentThread().getName() + "] " + name + " - " + level.getName() + ": " + msg); if (t != null) t.printStackTrace(); }
java
public synchronized void log(@Nullable Level level, @Nullable String msg, @Nullable Throwable t) { if (!isLoggable(level)) return; System.err.println(df.format(new Date()) + " [" + Thread.currentThread().getName() + "] " + name + " - " + level.getName() + ": " + msg); if (t != null) t.printStackTrace(); }
[ "public", "synchronized", "void", "log", "(", "@", "Nullable", "Level", "level", ",", "@", "Nullable", "String", "msg", ",", "@", "Nullable", "Throwable", "t", ")", "{", "if", "(", "!", "isLoggable", "(", "level", ")", ")", "return", ";", "System", "."...
synchronize for the {@link java.text.SimpleDateFormat}. @param level @param msg @param t
[ "synchronize", "for", "the", "{", "@link", "java", ".", "text", ".", "SimpleDateFormat", "}", "." ]
train
https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/util/InternalLogger.java#L119-L126
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.beginResetPasswordAsync
public Observable<Void> beginResetPasswordAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { return beginResetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginResetPasswordAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { return beginResetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginResetPasswordAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "ResetPasswordPayload", "r...
Resets the user password on an environment This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param resetPasswordPayload Represents the payload for resetting passwords. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Resets", "the", "user", "password", "on", "an", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1309-L1316
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java
JSONConverter.writeAttributeList
public void writeAttributeList(OutputStream out, AttributeList value) throws IOException { // AttributeList has no known sub-class. writeStartArray(out); if (value != null) { for (Attribute item : value.asList()) { writeArrayItem(out); writeStartObject(out); writeStringField(out, OM_NAME, item.getName()); writePOJOField(out, OM_VALUE, item.getValue()); writeEndObject(out); } } writeEndArray(out); }
java
public void writeAttributeList(OutputStream out, AttributeList value) throws IOException { // AttributeList has no known sub-class. writeStartArray(out); if (value != null) { for (Attribute item : value.asList()) { writeArrayItem(out); writeStartObject(out); writeStringField(out, OM_NAME, item.getName()); writePOJOField(out, OM_VALUE, item.getValue()); writeEndObject(out); } } writeEndArray(out); }
[ "public", "void", "writeAttributeList", "(", "OutputStream", "out", ",", "AttributeList", "value", ")", "throws", "IOException", "{", "// AttributeList has no known sub-class.", "writeStartArray", "(", "out", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "...
Encode an AttributeList instance as JSON: [ { "name" : String, "value" : POJO }* ] @param out The stream to write JSON to @param value The AttributeList instance to encode. Can be null, but its Attribute items can't be null. @throws IOException If an I/O error occurs @see #readAttributeList(InputStream)
[ "Encode", "an", "AttributeList", "instance", "as", "JSON", ":", "[", "{", "name", ":", "String", "value", ":", "POJO", "}", "*", "]" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1350-L1363
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/wavelet/UtilWavelet.java
UtilWavelet.transformDimension
public static ImageDimension transformDimension( ImageBase orig , int level ) { return transformDimension(orig.width,orig.height,level); }
java
public static ImageDimension transformDimension( ImageBase orig , int level ) { return transformDimension(orig.width,orig.height,level); }
[ "public", "static", "ImageDimension", "transformDimension", "(", "ImageBase", "orig", ",", "int", "level", ")", "{", "return", "transformDimension", "(", "orig", ".", "width", ",", "orig", ".", "height", ",", "level", ")", ";", "}" ]
Returns dimension which is required for the transformed image in a multilevel wavelet transform.
[ "Returns", "dimension", "which", "is", "required", "for", "the", "transformed", "image", "in", "a", "multilevel", "wavelet", "transform", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/wavelet/UtilWavelet.java#L93-L96
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_regionAvailable_GET
public ArrayList<OvhAvailableRegion> project_serviceName_regionAvailable_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/regionAvailable"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t18); }
java
public ArrayList<OvhAvailableRegion> project_serviceName_regionAvailable_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/regionAvailable"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t18); }
[ "public", "ArrayList", "<", "OvhAvailableRegion", ">", "project_serviceName_regionAvailable_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/regionAvailable\"", ";", "StringBuilder", "sb", "=", "p...
List the regions on which you can ask an access to REST: GET /cloud/project/{serviceName}/regionAvailable @param serviceName [required] Public Cloud project
[ "List", "the", "regions", "on", "which", "you", "can", "ask", "an", "access", "to" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1575-L1580
thorntail/thorntail
plugins/gradle/gradle-plugin/src/main/java/org/wildfly/swarm/plugin/gradle/GradleDependencyResolutionHelper.java
GradleDependencyResolutionHelper.determinePluginVersion
public static String determinePluginVersion() { if (pluginVersion == null) { final String fileName = "META-INF/gradle-plugins/thorntail.properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); String version; try (InputStream stream = loader.getResourceAsStream(fileName)) { Properties props = new Properties(); props.load(stream); version = props.getProperty("implementation-version"); } catch (IOException e) { throw new IllegalStateException("Unable to locate file: " + fileName, e); } pluginVersion = version; } return pluginVersion; }
java
public static String determinePluginVersion() { if (pluginVersion == null) { final String fileName = "META-INF/gradle-plugins/thorntail.properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); String version; try (InputStream stream = loader.getResourceAsStream(fileName)) { Properties props = new Properties(); props.load(stream); version = props.getProperty("implementation-version"); } catch (IOException e) { throw new IllegalStateException("Unable to locate file: " + fileName, e); } pluginVersion = version; } return pluginVersion; }
[ "public", "static", "String", "determinePluginVersion", "(", ")", "{", "if", "(", "pluginVersion", "==", "null", ")", "{", "final", "String", "fileName", "=", "\"META-INF/gradle-plugins/thorntail.properties\"", ";", "ClassLoader", "loader", "=", "Thread", ".", "curr...
Parse the plugin definition file and extract the version details from it.
[ "Parse", "the", "plugin", "definition", "file", "and", "extract", "the", "version", "details", "from", "it", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/plugins/gradle/gradle-plugin/src/main/java/org/wildfly/swarm/plugin/gradle/GradleDependencyResolutionHelper.java#L67-L82
naver/android-utilset
UtilSet/src/com/navercorp/utilset/system/ProcessorUtils.java
ProcessorUtils.getNumCores
public static int getNumCores() { //Private Class to display only CPU devices in the directory listing class CpuFilter implements FileFilter { @Override public boolean accept(File pathname) { //Check if filename is "cpu", followed by a single digit number if(Pattern.matches("cpu[0-9]", pathname.getName())) { return true; } return false; } } try { //Get directory containing CPU info File dir = new File("/sys/devices/system/cpu/"); //Filter to only list the devices we care about File[] files = dir.listFiles(new CpuFilter()); if (files == null) return Runtime.getRuntime().availableProcessors(); //Return the number of cores (virtual CPU devices) return files.length; } catch(Exception e) { // The number of cores can vary with JVM status return Runtime.getRuntime().availableProcessors(); } }
java
public static int getNumCores() { //Private Class to display only CPU devices in the directory listing class CpuFilter implements FileFilter { @Override public boolean accept(File pathname) { //Check if filename is "cpu", followed by a single digit number if(Pattern.matches("cpu[0-9]", pathname.getName())) { return true; } return false; } } try { //Get directory containing CPU info File dir = new File("/sys/devices/system/cpu/"); //Filter to only list the devices we care about File[] files = dir.listFiles(new CpuFilter()); if (files == null) return Runtime.getRuntime().availableProcessors(); //Return the number of cores (virtual CPU devices) return files.length; } catch(Exception e) { // The number of cores can vary with JVM status return Runtime.getRuntime().availableProcessors(); } }
[ "public", "static", "int", "getNumCores", "(", ")", "{", "//Private Class to display only CPU devices in the directory listing", "class", "CpuFilter", "implements", "FileFilter", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "pathname", ")", "{", "//...
http://stackoverflow.com/questions/7962155/how-can-you-detect-a-dual-core-cpu-on-an-android-device-from-code Gets the number of cores available in this device, across all processors. Requires: Ability to peruse the file system at "/sys/devices/system/cpu" @return The number of cores, or Runtime.getRuntime().availableProcessors() if failed to get result
[ "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "7962155", "/", "how", "-", "can", "-", "you", "-", "detect", "-", "a", "-", "dual", "-", "core", "-", "cpu", "-", "on", "-", "an", "-", "android", "-", "device", "-", "from",...
train
https://github.com/naver/android-utilset/blob/4af5f821466bc5bec4ea221ca6d87e0ac9b87e0b/UtilSet/src/com/navercorp/utilset/system/ProcessorUtils.java#L16-L47
sebastiangraf/treetank
interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java
Filelistener.watchParents
private void watchParents(Path p, String until) throws IOException { if (p.getParent() != null && !until.equals(p.getParent().toString())) { watchDir(p.getParent().toFile()); watchParents(p.getParent(), until); } }
java
private void watchParents(Path p, String until) throws IOException { if (p.getParent() != null && !until.equals(p.getParent().toString())) { watchDir(p.getParent().toFile()); watchParents(p.getParent(), until); } }
[ "private", "void", "watchParents", "(", "Path", "p", ",", "String", "until", ")", "throws", "IOException", "{", "if", "(", "p", ".", "getParent", "(", ")", "!=", "null", "&&", "!", "until", ".", "equals", "(", "p", ".", "getParent", "(", ")", ".", ...
Watch parent folders of this file until the root listener path has been reached. @param p @param until @throws IOException
[ "Watch", "parent", "folders", "of", "this", "file", "until", "the", "root", "listener", "path", "has", "been", "reached", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L201-L206
nohana/Amalgam
amalgam/src/main/java/com/amalgam/view/MotionEventUtils.java
MotionEventUtils.getVerticalMotionDirection
public static MotionDirection getVerticalMotionDirection(MotionEvent e1, MotionEvent e2, float threshold) { float delta = getVerticalMotionRawDelta(e1, e2); return getVerticalMotionDirection(delta, threshold); }
java
public static MotionDirection getVerticalMotionDirection(MotionEvent e1, MotionEvent e2, float threshold) { float delta = getVerticalMotionRawDelta(e1, e2); return getVerticalMotionDirection(delta, threshold); }
[ "public", "static", "MotionDirection", "getVerticalMotionDirection", "(", "MotionEvent", "e1", ",", "MotionEvent", "e2", ",", "float", "threshold", ")", "{", "float", "delta", "=", "getVerticalMotionRawDelta", "(", "e1", ",", "e2", ")", ";", "return", "getVertical...
Calculate the vertical move motion direction. @param e1 start point of the motion. @param e2 end point of the motion. @param threshold threshold to detect the motion. @return the motion direction for the vertical axis.
[ "Calculate", "the", "vertical", "move", "motion", "direction", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/MotionEventUtils.java#L96-L99
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java
MultipleAlignmentScorer.getAvgTMScore
public static double getAvgTMScore(MultipleAlignment alignment) throws StructureException { List<Atom[]> trans = MultipleAlignmentTools.transformAtoms(alignment); List<Integer> lengths = new ArrayList<Integer>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } return getAvgTMScore(trans, lengths); }
java
public static double getAvgTMScore(MultipleAlignment alignment) throws StructureException { List<Atom[]> trans = MultipleAlignmentTools.transformAtoms(alignment); List<Integer> lengths = new ArrayList<Integer>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } return getAvgTMScore(trans, lengths); }
[ "public", "static", "double", "getAvgTMScore", "(", "MultipleAlignment", "alignment", ")", "throws", "StructureException", "{", "List", "<", "Atom", "[", "]", ">", "trans", "=", "MultipleAlignmentTools", ".", "transformAtoms", "(", "alignment", ")", ";", "List", ...
Calculates the average TMScore of all the possible pairwise structure comparisons of the given alignment. <p> Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment length. @param alignment @return double Average TMscore @throws StructureException
[ "Calculates", "the", "average", "TMScore", "of", "all", "the", "possible", "pairwise", "structure", "comparisons", "of", "the", "given", "alignment", ".", "<p", ">", "Complexity", ":", "T", "(", "n", "l", ")", "=", "O", "(", "l", "*", "n^2", ")", "if",...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java#L235-L245
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.getApiKey
public JSONObject getApiKey(String key, RequestOptions requestOptions) throws AlgoliaException { return client.getRequest("/1/indexes/" + encodedIndexName + "/keys/" + key, false, requestOptions); }
java
public JSONObject getApiKey(String key, RequestOptions requestOptions) throws AlgoliaException { return client.getRequest("/1/indexes/" + encodedIndexName + "/keys/" + key, false, requestOptions); }
[ "public", "JSONObject", "getApiKey", "(", "String", "key", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "return", "client", ".", "getRequest", "(", "\"/1/indexes/\"", "+", "encodedIndexName", "+", "\"/keys/\"", "+", "key", ",", ...
Get ACL of an api key @param requestOptions Options to pass to this request
[ "Get", "ACL", "of", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L997-L999
mapsforge/mapsforge
mapsforge-map-awt/src/main/java/org/mapsforge/map/awt/util/AwtUtil.java
AwtUtil.createTileCache
public static TileCache createTileCache(int tileSize, double overdrawFactor, int capacity, File cacheDirectory) { int cacheSize = getMinimumCacheSize(tileSize, overdrawFactor); TileCache firstLevelTileCache = new InMemoryTileCache(cacheSize); TileCache secondLevelTileCache = new FileSystemTileCache(capacity, cacheDirectory, AwtGraphicFactory.INSTANCE); return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache); }
java
public static TileCache createTileCache(int tileSize, double overdrawFactor, int capacity, File cacheDirectory) { int cacheSize = getMinimumCacheSize(tileSize, overdrawFactor); TileCache firstLevelTileCache = new InMemoryTileCache(cacheSize); TileCache secondLevelTileCache = new FileSystemTileCache(capacity, cacheDirectory, AwtGraphicFactory.INSTANCE); return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache); }
[ "public", "static", "TileCache", "createTileCache", "(", "int", "tileSize", ",", "double", "overdrawFactor", ",", "int", "capacity", ",", "File", "cacheDirectory", ")", "{", "int", "cacheSize", "=", "getMinimumCacheSize", "(", "tileSize", ",", "overdrawFactor", ")...
Utility function to create a two-level tile cache with the right size, using the size of the screen. <p> Combine with <code>FrameBufferController.setUseSquareFrameBuffer(false);</code> @param tileSize the tile size @param overdrawFactor the overdraw factor applied to the map view @param capacity the maximum number of entries in file cache @param cacheDirectory the directory where cached tiles will be stored @return a new cache created on the file system
[ "Utility", "function", "to", "create", "a", "two", "-", "level", "tile", "cache", "with", "the", "right", "size", "using", "the", "size", "of", "the", "screen", ".", "<p", ">", "Combine", "with", "<code", ">", "FrameBufferController", ".", "setUseSquareFrame...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-awt/src/main/java/org/mapsforge/map/awt/util/AwtUtil.java#L40-L45
OpenFeign/feign
core/src/main/java/feign/Request.java
Request.create
public static Request create(HttpMethod httpMethod, String url, Map<String, Collection<String>> headers, byte[] body, Charset charset) { return create(httpMethod, url, headers, Body.encoded(body, charset)); }
java
public static Request create(HttpMethod httpMethod, String url, Map<String, Collection<String>> headers, byte[] body, Charset charset) { return create(httpMethod, url, headers, Body.encoded(body, charset)); }
[ "public", "static", "Request", "create", "(", "HttpMethod", "httpMethod", ",", "String", "url", ",", "Map", "<", "String", ",", "Collection", "<", "String", ">", ">", "headers", ",", "byte", "[", "]", "body", ",", "Charset", "charset", ")", "{", "return"...
Builds a Request. All parameters must be effectively immutable, via safe copies. @param httpMethod for the request. @param url for the request. @param headers to include. @param body of the request, can be {@literal null} @param charset of the request, can be {@literal null} @return a Request
[ "Builds", "a", "Request", ".", "All", "parameters", "must", "be", "effectively", "immutable", "via", "safe", "copies", "." ]
train
https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/Request.java#L117-L123
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java
ParagraphVectors.inferVector
public INDArray inferVector(String text, double learningRate, double minLearningRate, int iterations) { if (tokenizerFactory == null) throw new IllegalStateException("TokenizerFactory should be defined, prior to predict() call"); if (this.vocab == null || this.vocab.numWords() == 0) reassignExistingModel(); List<String> tokens = tokenizerFactory.create(text).getTokens(); List<VocabWord> document = new ArrayList<>(); for (String token : tokens) { if (vocab.containsWord(token)) { document.add(vocab.wordFor(token)); } } if (document.isEmpty()) throw new ND4JIllegalStateException("Text passed for inference has no matches in model vocabulary."); return inferVector(document, learningRate, minLearningRate, iterations); }
java
public INDArray inferVector(String text, double learningRate, double minLearningRate, int iterations) { if (tokenizerFactory == null) throw new IllegalStateException("TokenizerFactory should be defined, prior to predict() call"); if (this.vocab == null || this.vocab.numWords() == 0) reassignExistingModel(); List<String> tokens = tokenizerFactory.create(text).getTokens(); List<VocabWord> document = new ArrayList<>(); for (String token : tokens) { if (vocab.containsWord(token)) { document.add(vocab.wordFor(token)); } } if (document.isEmpty()) throw new ND4JIllegalStateException("Text passed for inference has no matches in model vocabulary."); return inferVector(document, learningRate, minLearningRate, iterations); }
[ "public", "INDArray", "inferVector", "(", "String", "text", ",", "double", "learningRate", ",", "double", "minLearningRate", ",", "int", "iterations", ")", "{", "if", "(", "tokenizerFactory", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"To...
This method calculates inferred vector for given text @param text @return
[ "This", "method", "calculates", "inferred", "vector", "for", "given", "text" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L196-L215
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_sshkey_keyId_DELETE
public void project_serviceName_sshkey_keyId_DELETE(String serviceName, String keyId) throws IOException { String qPath = "/cloud/project/{serviceName}/sshkey/{keyId}"; StringBuilder sb = path(qPath, serviceName, keyId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void project_serviceName_sshkey_keyId_DELETE(String serviceName, String keyId) throws IOException { String qPath = "/cloud/project/{serviceName}/sshkey/{keyId}"; StringBuilder sb = path(qPath, serviceName, keyId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "project_serviceName_sshkey_keyId_DELETE", "(", "String", "serviceName", ",", "String", "keyId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/sshkey/{keyId}\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Delete SSH key REST: DELETE /cloud/project/{serviceName}/sshkey/{keyId} @param keyId [required] SSH key id @param serviceName [required] Project name
[ "Delete", "SSH", "key" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1513-L1517
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/Material.java
Material.addTexture
public void addTexture(int unit, Texture texture) { if (texture == null) { throw new IllegalStateException("Texture cannot be null"); } texture.checkCreated(); if (textures == null) { textures = new TIntObjectHashMap<>(); } textures.put(unit, texture); }
java
public void addTexture(int unit, Texture texture) { if (texture == null) { throw new IllegalStateException("Texture cannot be null"); } texture.checkCreated(); if (textures == null) { textures = new TIntObjectHashMap<>(); } textures.put(unit, texture); }
[ "public", "void", "addTexture", "(", "int", "unit", ",", "Texture", "texture", ")", "{", "if", "(", "texture", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Texture cannot be null\"", ")", ";", "}", "texture", ".", "checkCreated", ...
Adds a texture to the material. If a texture is a already present in the same unit as this one, it will be replaced. @param unit The unit to add the texture to @param texture The texture to add
[ "Adds", "a", "texture", "to", "the", "material", ".", "If", "a", "texture", "is", "a", "already", "present", "in", "the", "same", "unit", "as", "this", "one", "it", "will", "be", "replaced", "." ]
train
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/Material.java#L124-L133
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getUserRoles
public List<Integer> getUserRoles(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_ROLES_FOR_USER_URL, Long.toString(id))); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); List<Integer> roles = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { roles = oAuthResponse.getIdsFromData(); } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return roles; }
java
public List<Integer> getUserRoles(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_ROLES_FOR_USER_URL, Long.toString(id))); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); List<Integer> roles = null; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { roles = oAuthResponse.getIdsFromData(); } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return roles; }
[ "public", "List", "<", "Integer", ">", "getUserRoles", "(", "long", "id", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "URIBuilder", "url", "=", ...
Gets a list of role IDs that have been assigned to a user. @param id Id of the user @return List of Role Ids @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Role @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-roles-for-user">Get Roles for a User documentation</a>
[ "Gets", "a", "list", "of", "role", "IDs", "that", "have", "been", "assigned", "to", "a", "user", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L595-L618
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java
JobGraph.addUserArtifact
public void addUserArtifact(String name, DistributedCache.DistributedCacheEntry file) { if (file == null) { throw new IllegalArgumentException(); } userArtifacts.putIfAbsent(name, file); }
java
public void addUserArtifact(String name, DistributedCache.DistributedCacheEntry file) { if (file == null) { throw new IllegalArgumentException(); } userArtifacts.putIfAbsent(name, file); }
[ "public", "void", "addUserArtifact", "(", "String", "name", ",", "DistributedCache", ".", "DistributedCacheEntry", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "userArtifacts", "."...
Adds the path of a custom file required to run the job on a task manager. @param name a name under which this artifact will be accessible through {@link DistributedCache} @param file path of a custom file required to run the job on a task manager
[ "Adds", "the", "path", "of", "a", "custom", "file", "required", "to", "run", "the", "job", "on", "a", "task", "manager", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java#L517-L523
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceResource.java
SpaceResource.deleteSpace
public void deleteSpace(String spaceID, String storeID) throws ResourceException { try { StorageProvider storage = storageProviderFactory.getStorageProvider(storeID); storage.deleteSpace(spaceID); } catch (NotFoundException e) { throw new ResourceNotFoundException("delete space", spaceID, e); } catch (Exception e) { storageProviderFactory.expireStorageProvider(storeID); throw new ResourceException("delete space", spaceID, e); } }
java
public void deleteSpace(String spaceID, String storeID) throws ResourceException { try { StorageProvider storage = storageProviderFactory.getStorageProvider(storeID); storage.deleteSpace(spaceID); } catch (NotFoundException e) { throw new ResourceNotFoundException("delete space", spaceID, e); } catch (Exception e) { storageProviderFactory.expireStorageProvider(storeID); throw new ResourceException("delete space", spaceID, e); } }
[ "public", "void", "deleteSpace", "(", "String", "spaceID", ",", "String", "storeID", ")", "throws", "ResourceException", "{", "try", "{", "StorageProvider", "storage", "=", "storageProviderFactory", ".", "getStorageProvider", "(", "storeID", ")", ";", "storage", "...
Deletes a space, removing all included content. @param spaceID @param storeID
[ "Deletes", "a", "space", "removing", "all", "included", "content", "." ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceResource.java#L245-L255