repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java
AuthenticationAPIClient.loginWithPhoneNumber
@SuppressWarnings("WeakerAccess") public AuthenticationRequest loginWithPhoneNumber(@NonNull String phoneNumber, @NonNull String verificationCode) { return loginWithPhoneNumber(phoneNumber, verificationCode, SMS_CONNECTION); }
java
@SuppressWarnings("WeakerAccess") public AuthenticationRequest loginWithPhoneNumber(@NonNull String phoneNumber, @NonNull String verificationCode) { return loginWithPhoneNumber(phoneNumber, verificationCode, SMS_CONNECTION); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "AuthenticationRequest", "loginWithPhoneNumber", "(", "@", "NonNull", "String", "phoneNumber", ",", "@", "NonNull", "String", "verificationCode", ")", "{", "return", "loginWithPhoneNumber", "(", "phoneNumb...
Log in a user using a phone number and a verification code received via SMS (Part of passwordless login flow). By default it will try to authenticate using the "sms" connection. Example usage: <pre> {@code client.loginWithPhoneNumber("{phone number}", "{code}") .start(new BaseCallback<Credentials>() { {@literal}Override public void onSuccess(Credentials payload) { } {@literal}@Override public void onFailure(AuthenticationException error) { } }); } </pre> @param phoneNumber where the user received the verification code @param verificationCode sent by Auth0 via SMS @return a request to configure and start that will yield {@link Credentials}
[ "Log", "in", "a", "user", "using", "a", "phone", "number", "and", "a", "verification", "code", "received", "via", "SMS", "(", "Part", "of", "passwordless", "login", "flow", ")", ".", "By", "default", "it", "will", "try", "to", "authenticate", "using", "t...
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L373-L376
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.addMessageJobDeclaration
protected void addMessageJobDeclaration(MessageJobDeclaration messageJobDeclaration, ActivityImpl activity, boolean exclusive) { ProcessDefinition procDef = (ProcessDefinition) activity.getProcessDefinition(); if (!exists(messageJobDeclaration, procDef.getKey(), activity.getActivityId())) { messageJobDeclaration.setExclusive(exclusive); messageJobDeclaration.setActivity(activity); messageJobDeclaration.setJobPriorityProvider((ParameterValueProvider) activity.getProperty(PROPERTYNAME_JOB_PRIORITY)); addMessageJobDeclarationToActivity(messageJobDeclaration, activity); addJobDeclarationToProcessDefinition(messageJobDeclaration, procDef); } }
java
protected void addMessageJobDeclaration(MessageJobDeclaration messageJobDeclaration, ActivityImpl activity, boolean exclusive) { ProcessDefinition procDef = (ProcessDefinition) activity.getProcessDefinition(); if (!exists(messageJobDeclaration, procDef.getKey(), activity.getActivityId())) { messageJobDeclaration.setExclusive(exclusive); messageJobDeclaration.setActivity(activity); messageJobDeclaration.setJobPriorityProvider((ParameterValueProvider) activity.getProperty(PROPERTYNAME_JOB_PRIORITY)); addMessageJobDeclarationToActivity(messageJobDeclaration, activity); addJobDeclarationToProcessDefinition(messageJobDeclaration, procDef); } }
[ "protected", "void", "addMessageJobDeclaration", "(", "MessageJobDeclaration", "messageJobDeclaration", ",", "ActivityImpl", "activity", ",", "boolean", "exclusive", ")", "{", "ProcessDefinition", "procDef", "=", "(", "ProcessDefinition", ")", "activity", ".", "getProcess...
Adds the new message job declaration to existing declarations. There will be executed an existing check before the adding is executed. @param messageJobDeclaration the new message job declaration @param activity the corresponding activity @param exclusive the flag which indicates if the async should be exclusive
[ "Adds", "the", "new", "message", "job", "declaration", "to", "existing", "declarations", ".", "There", "will", "be", "executed", "an", "existing", "check", "before", "the", "adding", "is", "executed", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1829-L1839
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getUnits
public Number getUnits(int field) throws MPXJException { Number result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { try { result = Double.valueOf(m_formats.getUnitsDecimalFormat().parse(m_fields[field]).doubleValue() * 100); } catch (ParseException ex) { throw new MPXJException("Failed to parse units", ex); } } else { result = null; } return (result); }
java
public Number getUnits(int field) throws MPXJException { Number result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { try { result = Double.valueOf(m_formats.getUnitsDecimalFormat().parse(m_fields[field]).doubleValue() * 100); } catch (ParseException ex) { throw new MPXJException("Failed to parse units", ex); } } else { result = null; } return (result); }
[ "public", "Number", "getUnits", "(", "int", "field", ")", "throws", "MPXJException", "{", "Number", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", ...
Accessor method used to retrieve a Number instance representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field @throws MPXJException normally thrown when parsing fails
[ "Accessor", "method", "used", "to", "retrieve", "a", "Number", "instance", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L509-L531
twilio/twilio-java
src/main/java/com/twilio/rest/proxy/v1/service/session/InteractionReader.java
InteractionReader.previousPage
@Override public Page<Interaction> previousPage(final Page<Interaction> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.PROXY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Interaction> previousPage(final Page<Interaction> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.PROXY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Interaction", ">", "previousPage", "(", "final", "Page", "<", "Interaction", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET...
Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page
[ "Retrieve", "the", "previous", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/proxy/v1/service/session/InteractionReader.java#L118-L129
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/Console.java
Console.readLine
public String readLine(String format, Object... args) { synchronized (CONSOLE_LOCK) { format(format, args); return readLine(); } }
java
public String readLine(String format, Object... args) { synchronized (CONSOLE_LOCK) { format(format, args); return readLine(); } }
[ "public", "String", "readLine", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "synchronized", "(", "CONSOLE_LOCK", ")", "{", "format", "(", "format", ",", "args", ")", ";", "return", "readLine", "(", ")", ";", "}", "}" ]
Reads a line from this console, using the specified prompt. The prompt is given as a format string and optional arguments. Note that this can be a source of errors: if it is possible that your prompt contains {@code %} characters, you must use the format string {@code "%s"} and pass the actual prompt as a parameter. @param format the format string (see {@link java.util.Formatter#format}) @param args the list of arguments passed to the formatter. If there are more arguments than required by {@code format}, additional arguments are ignored. @return the line, or null at EOF.
[ "Reads", "a", "line", "from", "this", "console", "using", "the", "specified", "prompt", ".", "The", "prompt", "is", "given", "as", "a", "format", "string", "and", "optional", "arguments", ".", "Note", "that", "this", "can", "be", "a", "source", "of", "er...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/Console.java#L123-L128
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDaoFactoryBuilder.java
BindDaoFactoryBuilder.buildDaoFactoryInterfaceInternal
public TypeSpec.Builder buildDaoFactoryInterfaceInternal(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema) throws Exception { String schemaName = buildDaoFactoryName(schema); classBuilder = TypeSpec.interfaceBuilder(schemaName).addModifiers(Modifier.PUBLIC).addSuperinterface(BindDaoFactory.class); classBuilder.addJavadoc("<p>\n"); classBuilder.addJavadoc("Represents dao factory interface for $L.\n", schema.getName()); classBuilder.addJavadoc("This class expose database interface through Dao attribute.\n", schema.getName()); classBuilder.addJavadoc("</p>\n\n"); JavadocUtility.generateJavadocGeneratedBy(classBuilder); classBuilder.addJavadoc("@see $T\n", TypeUtility.typeName(schema.getElement())); for (SQLiteDaoDefinition dao : schema.getCollection()) { TypeName daoName = BindDaoBuilder.daoInterfaceTypeName(dao); TypeName daoImplName = BindDaoBuilder.daoTypeName(dao); classBuilder.addJavadoc("@see $T\n", daoName); classBuilder.addJavadoc("@see $T\n", daoImplName); String entity = BindDataSourceSubProcessor.generateEntityName(dao, dao.getEntity()); classBuilder.addJavadoc("@see $T\n", TypeUtility.typeName(entity)); } for (SQLiteDaoDefinition dao : schema.getCollection()) { TypeName daoImplName = BindDaoBuilder.daoTypeName(dao); // dao with external connections { MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("get" + dao.getName()) .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).addJavadoc("Retrieve dao $L.\n\n@return dao implementation\n", dao.getName()) .returns(daoImplName); classBuilder.addMethod(methodBuilder.build()); } } SchemaUtility.generateTransaction(classBuilder, schema, true); return classBuilder; }
java
public TypeSpec.Builder buildDaoFactoryInterfaceInternal(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema) throws Exception { String schemaName = buildDaoFactoryName(schema); classBuilder = TypeSpec.interfaceBuilder(schemaName).addModifiers(Modifier.PUBLIC).addSuperinterface(BindDaoFactory.class); classBuilder.addJavadoc("<p>\n"); classBuilder.addJavadoc("Represents dao factory interface for $L.\n", schema.getName()); classBuilder.addJavadoc("This class expose database interface through Dao attribute.\n", schema.getName()); classBuilder.addJavadoc("</p>\n\n"); JavadocUtility.generateJavadocGeneratedBy(classBuilder); classBuilder.addJavadoc("@see $T\n", TypeUtility.typeName(schema.getElement())); for (SQLiteDaoDefinition dao : schema.getCollection()) { TypeName daoName = BindDaoBuilder.daoInterfaceTypeName(dao); TypeName daoImplName = BindDaoBuilder.daoTypeName(dao); classBuilder.addJavadoc("@see $T\n", daoName); classBuilder.addJavadoc("@see $T\n", daoImplName); String entity = BindDataSourceSubProcessor.generateEntityName(dao, dao.getEntity()); classBuilder.addJavadoc("@see $T\n", TypeUtility.typeName(entity)); } for (SQLiteDaoDefinition dao : schema.getCollection()) { TypeName daoImplName = BindDaoBuilder.daoTypeName(dao); // dao with external connections { MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("get" + dao.getName()) .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).addJavadoc("Retrieve dao $L.\n\n@return dao implementation\n", dao.getName()) .returns(daoImplName); classBuilder.addMethod(methodBuilder.build()); } } SchemaUtility.generateTransaction(classBuilder, schema, true); return classBuilder; }
[ "public", "TypeSpec", ".", "Builder", "buildDaoFactoryInterfaceInternal", "(", "Elements", "elementUtils", ",", "Filer", "filer", ",", "SQLiteDatabaseSchema", "schema", ")", "throws", "Exception", "{", "String", "schemaName", "=", "buildDaoFactoryName", "(", "schema", ...
Build dao factory interface. @param elementUtils the element utils @param filer the filer @param schema the schema @return schema typeName @throws Exception the exception
[ "Build", "dao", "factory", "interface", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDaoFactoryBuilder.java#L118-L158
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/FactorGraph.java
FactorGraph.addVar
public void addVar(Var var) { int id = var.getId(); boolean alreadyAdded = (0 <= id && id < vars.size()); if (alreadyAdded) { if (vars.get(id) != var) { throw new IllegalStateException("Var id already set, but factor not yet added."); } } else { // Var was not yet in the factor graph. // // Check and set the id. if (id != -1 && id != vars.size()) { throw new IllegalStateException("Var id already set, but incorrect: " + id); } var.setId(vars.size()); // Add the Var. vars.add(var); if (bg != null) { log.warn("Discarding BipartiteGraph. This may indicate inefficiency."); } bg = null; } }
java
public void addVar(Var var) { int id = var.getId(); boolean alreadyAdded = (0 <= id && id < vars.size()); if (alreadyAdded) { if (vars.get(id) != var) { throw new IllegalStateException("Var id already set, but factor not yet added."); } } else { // Var was not yet in the factor graph. // // Check and set the id. if (id != -1 && id != vars.size()) { throw new IllegalStateException("Var id already set, but incorrect: " + id); } var.setId(vars.size()); // Add the Var. vars.add(var); if (bg != null) { log.warn("Discarding BipartiteGraph. This may indicate inefficiency."); } bg = null; } }
[ "public", "void", "addVar", "(", "Var", "var", ")", "{", "int", "id", "=", "var", ".", "getId", "(", ")", ";", "boolean", "alreadyAdded", "=", "(", "0", "<=", "id", "&&", "id", "<", "vars", ".", "size", "(", ")", ")", ";", "if", "(", "alreadyAd...
Adds a variable to this factor graph, if not already present. @param var The variable to add. @return The node for this variable.
[ "Adds", "a", "variable", "to", "this", "factor", "graph", "if", "not", "already", "present", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/FactorGraph.java#L124-L145
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java
UnsignedUtils.parseInt
public static int parseInt(String s, int radix) { if (s == null || s.length() == 0 || s.trim().length() == 0) { throw new NumberFormatException("Null or empty string"); } long result = parseLong(s, radix); if ((result & INT_MASK) != result) { throw new NumberFormatException("Input [" + s + "] in base [" + radix + "] is not in the range of an unsigned integer"); } return (int) result; }
java
public static int parseInt(String s, int radix) { if (s == null || s.length() == 0 || s.trim().length() == 0) { throw new NumberFormatException("Null or empty string"); } long result = parseLong(s, radix); if ((result & INT_MASK) != result) { throw new NumberFormatException("Input [" + s + "] in base [" + radix + "] is not in the range of an unsigned integer"); } return (int) result; }
[ "public", "static", "int", "parseInt", "(", "String", "s", ",", "int", "radix", ")", "{", "if", "(", "s", "==", "null", "||", "s", ".", "length", "(", ")", "==", "0", "||", "s", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", ...
Returns the unsigned {@code int} value represented by a string with the given radix. @param s the string containing the unsigned integer representation to be parsed. @param radix the radix to use while parsing {@code s}; must be between {@link Character#MIN_RADIX} and {@link #MAX_RADIX}. @throws NumberFormatException if the string does not contain a valid unsigned {@code int}, or if supplied radix is invalid.
[ "Returns", "the", "unsigned", "{", "@code", "int", "}", "value", "represented", "by", "a", "string", "with", "the", "given", "radix", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java#L113-L123
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java
MetamodelImpl.getEntityAttribute
public Attribute getEntityAttribute(Class clazz, String fieldName) { if (entityTypes != null && entityTypes.containsKey(clazz)) { EntityType entityType = entityTypes.get(clazz); return entityType.getAttribute(fieldName); } throw new IllegalArgumentException("No entity found: " + clazz); }
java
public Attribute getEntityAttribute(Class clazz, String fieldName) { if (entityTypes != null && entityTypes.containsKey(clazz)) { EntityType entityType = entityTypes.get(clazz); return entityType.getAttribute(fieldName); } throw new IllegalArgumentException("No entity found: " + clazz); }
[ "public", "Attribute", "getEntityAttribute", "(", "Class", "clazz", ",", "String", "fieldName", ")", "{", "if", "(", "entityTypes", "!=", "null", "&&", "entityTypes", ".", "containsKey", "(", "clazz", ")", ")", "{", "EntityType", "entityType", "=", "entityType...
Returns entity attribute for given managed entity class. @param clazz Entity class @param fieldName field name @return entity attribute
[ "Returns", "entity", "attribute", "for", "given", "managed", "entity", "class", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L367-L375
landawn/AbacusUtil
src/com/landawn/abacus/util/Multiset.java
Multiset.replaceAll
public <E extends Exception> void replaceAll(Try.BiFunction<? super T, ? super Integer, Integer, E> function) throws E { List<T> keyToRemove = null; Integer newVal = null; for (Map.Entry<T, MutableInt> entry : this.valueMap.entrySet()) { newVal = function.apply(entry.getKey(), entry.getValue().value()); if (newVal == null || newVal.intValue() <= 0) { if (keyToRemove == null) { keyToRemove = new ArrayList<>(); } keyToRemove.add(entry.getKey()); } else { entry.getValue().setValue(newVal); } } if (N.notNullOrEmpty(keyToRemove)) { for (T key : keyToRemove) { valueMap.remove(key); } } }
java
public <E extends Exception> void replaceAll(Try.BiFunction<? super T, ? super Integer, Integer, E> function) throws E { List<T> keyToRemove = null; Integer newVal = null; for (Map.Entry<T, MutableInt> entry : this.valueMap.entrySet()) { newVal = function.apply(entry.getKey(), entry.getValue().value()); if (newVal == null || newVal.intValue() <= 0) { if (keyToRemove == null) { keyToRemove = new ArrayList<>(); } keyToRemove.add(entry.getKey()); } else { entry.getValue().setValue(newVal); } } if (N.notNullOrEmpty(keyToRemove)) { for (T key : keyToRemove) { valueMap.remove(key); } } }
[ "public", "<", "E", "extends", "Exception", ">", "void", "replaceAll", "(", "Try", ".", "BiFunction", "<", "?", "super", "T", ",", "?", "super", "Integer", ",", "Integer", ",", "E", ">", "function", ")", "throws", "E", "{", "List", "<", "T", ">", "...
The associated elements will be removed if zero or negative occurrences are returned by the specified <code>function</code>. @param function
[ "The", "associated", "elements", "will", "be", "removed", "if", "zero", "or", "negative", "occurrences", "are", "returned", "by", "the", "specified", "<code", ">", "function<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multiset.java#L979-L1002
aws/aws-sdk-java
aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/model/RawRequest.java
RawRequest.queryParameter
public RawRequest queryParameter(String name, String value) { queryParameters.computeIfAbsent(name, k -> new ArrayList<>()); queryParameters.get(name).add(value); setRequestConfigDirty(); return this; }
java
public RawRequest queryParameter(String name, String value) { queryParameters.computeIfAbsent(name, k -> new ArrayList<>()); queryParameters.get(name).add(value); setRequestConfigDirty(); return this; }
[ "public", "RawRequest", "queryParameter", "(", "String", "name", ",", "String", "value", ")", "{", "queryParameters", ".", "computeIfAbsent", "(", "name", ",", "k", "->", "new", "ArrayList", "<>", "(", ")", ")", ";", "queryParameters", ".", "get", "(", "na...
Set a query parameter value for the underlying HTTP request. <p> Query parameters set with this method will be merged with query parameters found in the configured {@link SdkRequestConfig}. @param name The name of the header. @param value The value of the header. @return This object for method chaining.
[ "Set", "a", "query", "parameter", "value", "for", "the", "underlying", "HTTP", "request", ".", "<p", ">", "Query", "parameters", "set", "with", "this", "method", "will", "be", "merged", "with", "query", "parameters", "found", "in", "the", "configured", "{", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/model/RawRequest.java#L117-L122
jenkinsci/jenkins
core/src/main/java/jenkins/model/GlobalConfiguration.java
GlobalConfiguration.configure
@Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { req.bindJSON(this, json); return true; }
java
@Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { req.bindJSON(this, json); return true; }
[ "@", "Override", "public", "boolean", "configure", "(", "StaplerRequest", "req", ",", "JSONObject", "json", ")", "throws", "FormException", "{", "req", ".", "bindJSON", "(", "this", ",", "json", ")", ";", "return", "true", ";", "}" ]
By default, calls {@link StaplerRequest#bindJSON(Object, JSONObject)}, appropriate when your implementation has getters and setters for all fields. <p>{@inheritDoc}
[ "By", "default", "calls", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/GlobalConfiguration.java#L65-L69
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.projectionCombine
public static void projectionCombine( DMatrixRMaj M , Vector3D_F64 T , DMatrixRMaj P ) { CommonOps_DDRM.insert(M,P,0,0); P.data[3] = T.x; P.data[7] = T.y; P.data[11] = T.z; }
java
public static void projectionCombine( DMatrixRMaj M , Vector3D_F64 T , DMatrixRMaj P ) { CommonOps_DDRM.insert(M,P,0,0); P.data[3] = T.x; P.data[7] = T.y; P.data[11] = T.z; }
[ "public", "static", "void", "projectionCombine", "(", "DMatrixRMaj", "M", ",", "Vector3D_F64", "T", ",", "DMatrixRMaj", "P", ")", "{", "CommonOps_DDRM", ".", "insert", "(", "M", ",", "P", ",", "0", ",", "0", ")", ";", "P", ".", "data", "[", "3", "]",...
P = [M|T] @param M (Input) 3x3 matrix @param T (Input) 3x1 vector @param P (Output) [M,T]
[ "P", "=", "[", "M|T", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L677-L682
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
AbstractExecutableMemberWriter.addParameters
protected void addParameters(ExecutableMemberDoc member, Content htmltree, int indentSize) { addParameters(member, true, htmltree, indentSize); }
java
protected void addParameters(ExecutableMemberDoc member, Content htmltree, int indentSize) { addParameters(member, true, htmltree, indentSize); }
[ "protected", "void", "addParameters", "(", "ExecutableMemberDoc", "member", ",", "Content", "htmltree", ",", "int", "indentSize", ")", "{", "addParameters", "(", "member", ",", "true", ",", "htmltree", ",", "indentSize", ")", ";", "}" ]
Add all the parameters for the executable member. @param member the member to write parameters for. @param htmltree the content tree to which the parameters information will be added.
[ "Add", "all", "the", "parameters", "for", "the", "executable", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java#L175-L177
BoltsFramework/Bolts-Android
bolts-tasks/src/main/java/bolts/Task.java
Task.onSuccessTask
public <TContinuationResult> Task<TContinuationResult> onSuccessTask( final Continuation<TResult, Task<TContinuationResult>> continuation, Executor executor) { return onSuccessTask(continuation, executor, null); }
java
public <TContinuationResult> Task<TContinuationResult> onSuccessTask( final Continuation<TResult, Task<TContinuationResult>> continuation, Executor executor) { return onSuccessTask(continuation, executor, null); }
[ "public", "<", "TContinuationResult", ">", "Task", "<", "TContinuationResult", ">", "onSuccessTask", "(", "final", "Continuation", "<", "TResult", ",", "Task", "<", "TContinuationResult", ">", ">", "continuation", ",", "Executor", "executor", ")", "{", "return", ...
Runs a continuation when a task completes successfully, forwarding along {@link java.lang.Exception}s or cancellation.
[ "Runs", "a", "continuation", "when", "a", "task", "completes", "successfully", "forwarding", "along", "{" ]
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L791-L794
VoltDB/voltdb
src/frontend/org/voltdb/rejoin/RejoinTaskBuffer.java
RejoinTaskBuffer.appendTask
public int appendTask(long sourceHSId, TransactionInfoBaseMessage task) throws IOException { Preconditions.checkState(compiledSize == 0, "buffer is already compiled"); final int msgSerializedSize = task.getSerializedSize(); ensureCapacity(taskHeaderSize() + msgSerializedSize); ByteBuffer bb = m_container.b(); bb.putInt(msgSerializedSize); bb.putLong(sourceHSId); int limit = bb.limit(); bb.limit(bb.position() + msgSerializedSize); task.flattenToBuffer(bb.slice()); bb.limit(limit); bb.position(bb.position() + msgSerializedSize); // Don't allow any further expansion to the underlying buffer if (bb.position() + taskHeaderSize() > DEFAULT_BUFFER_SIZE) { compile(); return 0; } else { return DEFAULT_BUFFER_SIZE - (bb.position() + taskHeaderSize()); } }
java
public int appendTask(long sourceHSId, TransactionInfoBaseMessage task) throws IOException { Preconditions.checkState(compiledSize == 0, "buffer is already compiled"); final int msgSerializedSize = task.getSerializedSize(); ensureCapacity(taskHeaderSize() + msgSerializedSize); ByteBuffer bb = m_container.b(); bb.putInt(msgSerializedSize); bb.putLong(sourceHSId); int limit = bb.limit(); bb.limit(bb.position() + msgSerializedSize); task.flattenToBuffer(bb.slice()); bb.limit(limit); bb.position(bb.position() + msgSerializedSize); // Don't allow any further expansion to the underlying buffer if (bb.position() + taskHeaderSize() > DEFAULT_BUFFER_SIZE) { compile(); return 0; } else { return DEFAULT_BUFFER_SIZE - (bb.position() + taskHeaderSize()); } }
[ "public", "int", "appendTask", "(", "long", "sourceHSId", ",", "TransactionInfoBaseMessage", "task", ")", "throws", "IOException", "{", "Preconditions", ".", "checkState", "(", "compiledSize", "==", "0", ",", "\"buffer is already compiled\"", ")", ";", "final", "int...
Appends a task message to the buffer. @param sourceHSId @param task @throws IOException If the buffer is not of the type TASK @return how many bytes are left in this buffer for adding a new task
[ "Appends", "a", "task", "message", "to", "the", "buffer", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/rejoin/RejoinTaskBuffer.java#L150-L173
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/nfs/io/NfsFileBase.java
NfsFileBase.setParentFileAndName
private void setParentFileAndName(F parentFile, String name, LinkTracker<N, F> linkTracker) throws IOException { if (parentFile != null) { parentFile = parentFile.followLinks(linkTracker); if (StringUtils.isBlank(name) || ".".equals(name)) { name = parentFile.getName(); parentFile = parentFile.getParentFile(); } else if ("..".equals(name)) { parentFile = parentFile.getParentFile(); if (parentFile == null) { name = ""; } else { name = parentFile.getName(); parentFile = parentFile.getParentFile(); } } } _parentFile = parentFile; _name = name; setPathFields(); }
java
private void setParentFileAndName(F parentFile, String name, LinkTracker<N, F> linkTracker) throws IOException { if (parentFile != null) { parentFile = parentFile.followLinks(linkTracker); if (StringUtils.isBlank(name) || ".".equals(name)) { name = parentFile.getName(); parentFile = parentFile.getParentFile(); } else if ("..".equals(name)) { parentFile = parentFile.getParentFile(); if (parentFile == null) { name = ""; } else { name = parentFile.getName(); parentFile = parentFile.getParentFile(); } } } _parentFile = parentFile; _name = name; setPathFields(); }
[ "private", "void", "setParentFileAndName", "(", "F", "parentFile", ",", "String", "name", ",", "LinkTracker", "<", "N", ",", "F", ">", "linkTracker", ")", "throws", "IOException", "{", "if", "(", "parentFile", "!=", "null", ")", "{", "parentFile", "=", "pa...
This method handles special cases, such as symbolic links in the parent directory, empty filenames, or the special names "." and "..". The algorithm required is simplified by the fact that special cases for the parent file are handled before this is called, as the path is always resolved from the bottom up. This means that the special cases have already been resolved for the parents and all supporting ancestors, so those possibilities need only be considered at the current level, eliminating any need for explicit recursive handling here. @param parentFile The original parent file. This may be changed for cases that require special handling, e.g., symbolic links, ".", "..", and empty names. @param name The original name. This may also be changed for cases that require special handling. @param linkTracker The tracker to use. This must be passed so that monitoring is continued until the link resolves to a file that is not a symbolic link. @throws IOException if links cannot be followed.
[ "This", "method", "handles", "special", "cases", "such", "as", "symbolic", "links", "in", "the", "parent", "directory", "empty", "filenames", "or", "the", "special", "names", ".", "and", "..", ".", "The", "algorithm", "required", "is", "simplified", "by", "t...
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/nfs/io/NfsFileBase.java#L1292-L1312
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.firstRow
public GroovyRowResult firstRow(Map params, String sql) throws SQLException { return firstRow(sql, singletonList(params)); }
java
public GroovyRowResult firstRow(Map params, String sql) throws SQLException { return firstRow(sql, singletonList(params)); }
[ "public", "GroovyRowResult", "firstRow", "(", "Map", "params", ",", "String", "sql", ")", "throws", "SQLException", "{", "return", "firstRow", "(", "sql", ",", "singletonList", "(", "params", ")", ")", ";", "}" ]
A variant of {@link #firstRow(String, java.util.List)} useful when providing the named parameters as named arguments. @param params a map containing the named parameters @param sql the SQL statement @return a GroovyRowResult object or <code>null</code> if no row is found @throws SQLException if a database access error occurs @since 1.8.7
[ "A", "variant", "of", "{", "@link", "#firstRow", "(", "String", "java", ".", "util", ".", "List", ")", "}", "useful", "when", "providing", "the", "named", "parameters", "as", "named", "arguments", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2272-L2274
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.getInstance
public static DoubleMatrix getInstance(int rows, int cols, ItemSupplier s) { DoubleMatrix m = new DoubleMatrix(rows, cols); ItemConsumer c = m.consumer; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { c.set(i, j, s.get(i, j)); } } return m; }
java
public static DoubleMatrix getInstance(int rows, int cols, ItemSupplier s) { DoubleMatrix m = new DoubleMatrix(rows, cols); ItemConsumer c = m.consumer; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { c.set(i, j, s.get(i, j)); } } return m; }
[ "public", "static", "DoubleMatrix", "getInstance", "(", "int", "rows", ",", "int", "cols", ",", "ItemSupplier", "s", ")", "{", "DoubleMatrix", "m", "=", "new", "DoubleMatrix", "(", "rows", ",", "cols", ")", ";", "ItemConsumer", "c", "=", "m", ".", "consu...
Returns new DoubleMatrix initialized by function @param rows @param cols @param s @return
[ "Returns", "new", "DoubleMatrix", "initialized", "by", "function" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L657-L669
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java
PatternProps.skipWhiteSpace
public static int skipWhiteSpace(CharSequence s, int i) { while(i<s.length() && isWhiteSpace(s.charAt(i))) { ++i; } return i; }
java
public static int skipWhiteSpace(CharSequence s, int i) { while(i<s.length() && isWhiteSpace(s.charAt(i))) { ++i; } return i; }
[ "public", "static", "int", "skipWhiteSpace", "(", "CharSequence", "s", ",", "int", "i", ")", "{", "while", "(", "i", "<", "s", ".", "length", "(", ")", "&&", "isWhiteSpace", "(", "s", ".", "charAt", "(", "i", ")", ")", ")", "{", "++", "i", ";", ...
Skips over Pattern_White_Space starting at index i of the CharSequence. @return The smallest index at or after i with a non-white space character.
[ "Skips", "over", "Pattern_White_Space", "starting", "at", "index", "i", "of", "the", "CharSequence", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java#L95-L100
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolOperationHandler.java
TransactionalProtocolOperationHandler.internalExecute
protected OperationResponse internalExecute(final Operation operation, final ManagementRequestContext<?> context, final OperationMessageHandler messageHandler, final ModelController.OperationTransactionControl control) { // Execute the operation return controller.execute( operation, messageHandler, control); }
java
protected OperationResponse internalExecute(final Operation operation, final ManagementRequestContext<?> context, final OperationMessageHandler messageHandler, final ModelController.OperationTransactionControl control) { // Execute the operation return controller.execute( operation, messageHandler, control); }
[ "protected", "OperationResponse", "internalExecute", "(", "final", "Operation", "operation", ",", "final", "ManagementRequestContext", "<", "?", ">", "context", ",", "final", "OperationMessageHandler", "messageHandler", ",", "final", "ModelController", ".", "OperationTran...
Subclasses can override this method to determine how to execute the method, e.g. attach to an existing operation or not @param operation the operation being executed @param messageHandler the operation message handler proxy @param control the operation transaction control @return the result of the executed operation
[ "Subclasses", "can", "override", "this", "method", "to", "determine", "how", "to", "execute", "the", "method", "e", ".", "g", ".", "attach", "to", "an", "existing", "operation", "or", "not" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolOperationHandler.java#L267-L273
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java
TemplateElasticsearchUpdater.createTemplateWithJson
public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception { if (isTemplateExist(client, template)) { if (force) { logger.debug("Template [{}] already exists. Force is set. Removing it.", template); removeTemplate(client, template); } else { logger.debug("Template [{}] already exists.", template); } } if (!isTemplateExist(client, template)) { logger.debug("Template [{}] doesn't exist. Creating it.", template); createTemplateWithJsonInElasticsearch(client, template, json); } }
java
public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception { if (isTemplateExist(client, template)) { if (force) { logger.debug("Template [{}] already exists. Force is set. Removing it.", template); removeTemplate(client, template); } else { logger.debug("Template [{}] already exists.", template); } } if (!isTemplateExist(client, template)) { logger.debug("Template [{}] doesn't exist. Creating it.", template); createTemplateWithJsonInElasticsearch(client, template, json); } }
[ "public", "static", "void", "createTemplateWithJson", "(", "RestClient", "client", ",", "String", "template", ",", "String", "json", ",", "boolean", "force", ")", "throws", "Exception", "{", "if", "(", "isTemplateExist", "(", "client", ",", "template", ")", ")...
Create a new template in Elasticsearch @param client Elasticsearch client @param template Template name @param json JSon content for the template @param force set it to true if you want to force cleaning template before adding it @throws Exception if something goes wrong
[ "Create", "a", "new", "template", "in", "Elasticsearch" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L182-L196
venmo/cursor-utils
cursor-utils/src/main/java/com/venmo/cursor/CursorUtils.java
CursorUtils.consumeToLinkedHashSet
public static <T> LinkedHashSet<T> consumeToLinkedHashSet(IterableCursor<T> cursor) { return consumeToCollection(cursor, new LinkedHashSet<T>(cursor.getCount())); }
java
public static <T> LinkedHashSet<T> consumeToLinkedHashSet(IterableCursor<T> cursor) { return consumeToCollection(cursor, new LinkedHashSet<T>(cursor.getCount())); }
[ "public", "static", "<", "T", ">", "LinkedHashSet", "<", "T", ">", "consumeToLinkedHashSet", "(", "IterableCursor", "<", "T", ">", "cursor", ")", "{", "return", "consumeToCollection", "(", "cursor", ",", "new", "LinkedHashSet", "<", "T", ">", "(", "cursor", ...
Returns an {@link java.util.LinkedHashSet} of the {@link android.database.Cursor} and closes it.
[ "Returns", "an", "{" ]
train
https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/CursorUtils.java#L58-L60
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLogFactory.java
BookKeeperLogFactory.createDebugLogWrapper
public DebugLogWrapper createDebugLogWrapper(int logId) { Preconditions.checkState(this.bookKeeper.get() != null, "BookKeeperLogFactory is not initialized."); return new DebugLogWrapper(logId, this.zkClient, this.bookKeeper.get(), this.config, this.executor); }
java
public DebugLogWrapper createDebugLogWrapper(int logId) { Preconditions.checkState(this.bookKeeper.get() != null, "BookKeeperLogFactory is not initialized."); return new DebugLogWrapper(logId, this.zkClient, this.bookKeeper.get(), this.config, this.executor); }
[ "public", "DebugLogWrapper", "createDebugLogWrapper", "(", "int", "logId", ")", "{", "Preconditions", ".", "checkState", "(", "this", ".", "bookKeeper", ".", "get", "(", ")", "!=", "null", ",", "\"BookKeeperLogFactory is not initialized.\"", ")", ";", "return", "n...
Creates a new DebugLogWrapper that can be used for debugging purposes. This should not be used for regular operations. @param logId Id of the Log to create a wrapper for. @return A new instance of the DebugLogWrapper class.
[ "Creates", "a", "new", "DebugLogWrapper", "that", "can", "be", "used", "for", "debugging", "purposes", ".", "This", "should", "not", "be", "used", "for", "regular", "operations", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLogFactory.java#L112-L115
Jasig/uPortal
uPortal-security/uPortal-security-xslt/src/main/java/org/apereo/portal/security/xslt/XalanLayoutElementTitleHelper.java
XalanLayoutElementTitleHelper.getTitle
public static String getTitle(String id, String language, String name) { if (id != null && id.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) { final Locale locale = localeManagerFactory.parseLocale(language); return messageSource.getMessage(name, new Object[] {}, name, locale); } return name; }
java
public static String getTitle(String id, String language, String name) { if (id != null && id.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) { final Locale locale = localeManagerFactory.parseLocale(language); return messageSource.getMessage(name, new Object[] {}, name, locale); } return name; }
[ "public", "static", "String", "getTitle", "(", "String", "id", ",", "String", "language", ",", "String", "name", ")", "{", "if", "(", "id", "!=", "null", "&&", "id", ".", "startsWith", "(", "Constants", ".", "FRAGMENT_ID_USER_PREFIX", ")", ")", "{", "fin...
This method checks whether id indicates that it is a layout owner's structure element (or at least derived from it). If it is the case, then it asks {@link MessageSource} to resolve the message using layout element's name. Otherwise it returns the name. Note that layout owner's element identifier format is 'uXlYnZ' where X stands for layout owners id, Y stands for layout id, and Z stands for element (node) identifier, hence identifiers that start with 'u' are considered as derived from layout owner. @param id - layout structure element's identifier. @param language - locale identifier. @param name - default layout strucute element's name. @return localized title in case of layout owner's element or default name otherwise.
[ "This", "method", "checks", "whether", "id", "indicates", "that", "it", "is", "a", "layout", "owner", "s", "structure", "element", "(", "or", "at", "least", "derived", "from", "it", ")", ".", "If", "it", "is", "the", "case", "then", "it", "asks", "{", ...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-xslt/src/main/java/org/apereo/portal/security/xslt/XalanLayoutElementTitleHelper.java#L57-L63
jbossas/jboss-invocation
src/main/java/org/jboss/invocation/proxy/ProxyFactory.java
ProxyFactory.setInvocationHandlerStatic
public static void setInvocationHandlerStatic(Object proxy, InvocationHandler handler) { try { final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD); AccessController.doPrivileged(new SetAccessiblePrivilege(field)); field.set(proxy, handler); } catch (NoSuchFieldException e) { throw new RuntimeException("Could not find invocation handler on generated proxy", e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public static void setInvocationHandlerStatic(Object proxy, InvocationHandler handler) { try { final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD); AccessController.doPrivileged(new SetAccessiblePrivilege(field)); field.set(proxy, handler); } catch (NoSuchFieldException e) { throw new RuntimeException("Could not find invocation handler on generated proxy", e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "setInvocationHandlerStatic", "(", "Object", "proxy", ",", "InvocationHandler", "handler", ")", "{", "try", "{", "final", "Field", "field", "=", "proxy", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", "INVOCATION_HANDLER_FIELD...
Sets the invocation handler for a proxy. This method is less efficient than {@link #setInvocationHandler(Object, InvocationHandler)}, however it will work on any proxy, not just proxies from a specific factory. @param proxy the proxy to modify @param handler the handler to use
[ "Sets", "the", "invocation", "handler", "for", "a", "proxy", ".", "This", "method", "is", "less", "efficient", "than", "{", "@link", "#setInvocationHandler", "(", "Object", "InvocationHandler", ")", "}", "however", "it", "will", "work", "on", "any", "proxy", ...
train
https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyFactory.java#L394-L406
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/GeneralizedCounter.java
GeneralizedCounter.getCount
public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
java
public double getCount(K o1, K o2, K o3) { if (depth != 3) { wrongDepth(); } GeneralizedCounter<K> gc1 = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o1)); if (gc1 == null) { return 0.0; } else { return gc1.getCount(o2, o3); } }
[ "public", "double", "getCount", "(", "K", "o1", ",", "K", "o2", ",", "K", "o3", ")", "{", "if", "(", "depth", "!=", "3", ")", "{", "wrongDepth", "(", ")", ";", "}", "GeneralizedCounter", "<", "K", ">", "gc1", "=", "ErasureUtils", ".", "<", "Gener...
A convenience method equivalent to <code>{@link #getCounts}({o1,o2,o3})</code>; works only for depth 3 GeneralizedCounters
[ "A", "convenience", "method", "equivalent", "to", "<code", ">", "{" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/GeneralizedCounter.java#L343-L353
Terradue/jcatalogue-client
apis/src/main/java/com/terradue/jcatalogue/repository/Proxy.java
Proxy.setAuthentication
public Proxy setAuthentication( Authentication auth ) { if ( eq( this.auth, auth ) ) { return this; } return new Proxy( type, host, port, auth ); }
java
public Proxy setAuthentication( Authentication auth ) { if ( eq( this.auth, auth ) ) { return this; } return new Proxy( type, host, port, auth ); }
[ "public", "Proxy", "setAuthentication", "(", "Authentication", "auth", ")", "{", "if", "(", "eq", "(", "this", ".", "auth", ",", "auth", ")", ")", "{", "return", "this", ";", "}", "return", "new", "Proxy", "(", "type", ",", "host", ",", "port", ",", ...
Sets the authentication to use for the proxy connection. @param auth The authentication to use, may be {@code null}. @return The new proxy, never {@code null}.
[ "Sets", "the", "authentication", "to", "use", "for", "the", "proxy", "connection", "." ]
train
https://github.com/Terradue/jcatalogue-client/blob/1f24c4da952d8ad2373c4fa97eed48b0b8a88d21/apis/src/main/java/com/terradue/jcatalogue/repository/Proxy.java#L154-L161
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValue
public Elements getElementsByAttributeValue(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValue(key, value), this); }
java
public Elements getElementsByAttributeValue(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValue(key, value), this); }
[ "public", "Elements", "getElementsByAttributeValue", "(", "String", "key", ",", "String", "value", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValue", "(", "key", ",", "value", ")", ",", "this", ")", ";", "}" ...
Find elements that have an attribute with the specific value. Case insensitive. @param key name of the attribute @param value value of the attribute @return elements that have this attribute with this value, empty if none
[ "Find", "elements", "that", "have", "an", "attribute", "with", "the", "specific", "value", ".", "Case", "insensitive", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L863-L865
Netflix/netflix-graph
src/main/java/com/netflix/nfgraph/NFGraph.java
NFGraph.getConnection
public int getConnection(String connectionModel, String nodeType, int ordinal, String propertyName) { int connectionModelIndex = modelHolder.getModelIndex(connectionModel); return getConnection(connectionModelIndex, nodeType, ordinal, propertyName); }
java
public int getConnection(String connectionModel, String nodeType, int ordinal, String propertyName) { int connectionModelIndex = modelHolder.getModelIndex(connectionModel); return getConnection(connectionModelIndex, nodeType, ordinal, propertyName); }
[ "public", "int", "getConnection", "(", "String", "connectionModel", ",", "String", "nodeType", ",", "int", "ordinal", ",", "String", "propertyName", ")", "{", "int", "connectionModelIndex", "=", "modelHolder", ".", "getModelIndex", "(", "connectionModel", ")", ";"...
Retrieve a single connected ordinal in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected. @return the connected ordinal, or -1 if there is no such ordinal
[ "Retrieve", "a", "single", "connected", "ordinal", "in", "a", "given", "connection", "model", "given", "the", "type", "and", "ordinal", "of", "the", "originating", "node", "and", "the", "property", "by", "which", "this", "node", "is", "connected", "." ]
train
https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/NFGraph.java#L115-L118
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java
QuickSelect.quickSelect
public static <T> T quickSelect(List<? extends T> data, Comparator<? super T> comparator, int rank) { quickSelect(data, comparator, 0, data.size(), rank); return data.get(rank); }
java
public static <T> T quickSelect(List<? extends T> data, Comparator<? super T> comparator, int rank) { quickSelect(data, comparator, 0, data.size(), rank); return data.get(rank); }
[ "public", "static", "<", "T", ">", "T", "quickSelect", "(", "List", "<", "?", "extends", "T", ">", "data", ",", "Comparator", "<", "?", "super", "T", ">", "comparator", ",", "int", "rank", ")", "{", "quickSelect", "(", "data", ",", "comparator", ",",...
QuickSelect is essentially quicksort, except that we only "sort" that half of the array that we are interested in. Note: the array is <b>modified</b> by this. @param <T> object type @param data Data to process @param comparator Comparator to use @param rank Rank position that we are interested in (integer!) @return Value at the given rank
[ "QuickSelect", "is", "essentially", "quicksort", "except", "that", "we", "only", "sort", "that", "half", "of", "the", "array", "that", "we", "are", "interested", "in", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java#L608-L611
lightbend/config
config/src/main/java/com/typesafe/config/ConfigFactory.java
ConfigFactory.parseFile
public static Config parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parse().toConfig(); }
java
public static Config parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parse().toConfig(); }
[ "public", "static", "Config", "parseFile", "(", "File", "file", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newFile", "(", "file", ",", "options", ")", ".", "parse", "(", ")", ".", "toConfig", "(", ")", ";", "}" ]
Parses a file into a Config instance. Does not call {@link Config#resolve} or merge the file with any other configuration; this method parses a single file and does nothing else. It does process "include" statements in the parsed file, and may end up doing other IO due to those statements. @param file the file to parse @param options parse options to control how the file is interpreted @return the parsed configuration @throws ConfigException on IO or parse errors
[ "Parses", "a", "file", "into", "a", "Config", "instance", ".", "Does", "not", "call", "{", "@link", "Config#resolve", "}", "or", "merge", "the", "file", "with", "any", "other", "configuration", ";", "this", "method", "parses", "a", "single", "file", "and",...
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L738-L740
arquillian/arquillian-cube
kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/DefaultConfiguration.java
DefaultConfiguration.getKubernetesConfigurationUrl
public static URL getKubernetesConfigurationUrl(Map<String, String> map) throws MalformedURLException { if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, ""))) { return new URL(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, "")); } else if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_RESOURCE_NAME, ""))) { String resourceName = Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_RESOURCE_NAME, ""); return findConfigResource(resourceName); } else if (map.containsKey(ENVIRONMENT_CONFIG_URL)) { return new URL(map.get(ENVIRONMENT_CONFIG_URL)); } else if (map.containsKey(ENVIRONMENT_CONFIG_RESOURCE_NAME)) { String resourceName = map.get(ENVIRONMENT_CONFIG_RESOURCE_NAME); return findConfigResource(resourceName); } else { // Let the resource locator find the resource return null; } }
java
public static URL getKubernetesConfigurationUrl(Map<String, String> map) throws MalformedURLException { if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, ""))) { return new URL(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, "")); } else if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_RESOURCE_NAME, ""))) { String resourceName = Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_RESOURCE_NAME, ""); return findConfigResource(resourceName); } else if (map.containsKey(ENVIRONMENT_CONFIG_URL)) { return new URL(map.get(ENVIRONMENT_CONFIG_URL)); } else if (map.containsKey(ENVIRONMENT_CONFIG_RESOURCE_NAME)) { String resourceName = map.get(ENVIRONMENT_CONFIG_RESOURCE_NAME); return findConfigResource(resourceName); } else { // Let the resource locator find the resource return null; } }
[ "public", "static", "URL", "getKubernetesConfigurationUrl", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "throws", "MalformedURLException", "{", "if", "(", "Strings", ".", "isNotNullOrEmpty", "(", "Utils", ".", "getSystemPropertyOrEnvVar", "(", "ENVI...
Applies the kubernetes json url to the configuration. @param map The arquillian configuration.
[ "Applies", "the", "kubernetes", "json", "url", "to", "the", "configuration", "." ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/DefaultConfiguration.java#L237-L252
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java
DBIDUtil.internalIntersection
private static ModifiableDBIDs internalIntersection(DBIDs first, DBIDs second) { second = second.size() > 16 && !(second instanceof SetDBIDs) ? newHashSet(second) : second; ModifiableDBIDs inter = newHashSet(first.size()); for(DBIDIter it = first.iter(); it.valid(); it.advance()) { if(second.contains(it)) { inter.add(it); } } return inter; }
java
private static ModifiableDBIDs internalIntersection(DBIDs first, DBIDs second) { second = second.size() > 16 && !(second instanceof SetDBIDs) ? newHashSet(second) : second; ModifiableDBIDs inter = newHashSet(first.size()); for(DBIDIter it = first.iter(); it.valid(); it.advance()) { if(second.contains(it)) { inter.add(it); } } return inter; }
[ "private", "static", "ModifiableDBIDs", "internalIntersection", "(", "DBIDs", "first", ",", "DBIDs", "second", ")", "{", "second", "=", "second", ".", "size", "(", ")", ">", "16", "&&", "!", "(", "second", "instanceof", "SetDBIDs", ")", "?", "newHashSet", ...
Compute the set intersection of two sets. @param first First set @param second Second set @return result.
[ "Compute", "the", "set", "intersection", "of", "two", "sets", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L314-L323
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.setIntHeader
@Deprecated public static void setIntHeader(HttpMessage message, String name, int value) { message.headers().setInt(name, value); }
java
@Deprecated public static void setIntHeader(HttpMessage message, String name, int value) { message.headers().setInt(name, value); }
[ "@", "Deprecated", "public", "static", "void", "setIntHeader", "(", "HttpMessage", "message", ",", "String", "name", ",", "int", "value", ")", "{", "message", ".", "headers", "(", ")", ".", "setInt", "(", "name", ",", "value", ")", ";", "}" ]
@deprecated Use {@link #setInt(CharSequence, int)} instead. @see #setIntHeader(HttpMessage, CharSequence, int)
[ "@deprecated", "Use", "{", "@link", "#setInt", "(", "CharSequence", "int", ")", "}", "instead", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L764-L767
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLUnit.java
XMLUnit.compareXML
public static Diff compareXML(String control, String test) throws SAXException, IOException { return new Diff(control, test); }
java
public static Diff compareXML(String control, String test) throws SAXException, IOException { return new Diff(control, test); }
[ "public", "static", "Diff", "compareXML", "(", "String", "control", ",", "String", "test", ")", "throws", "SAXException", ",", "IOException", "{", "return", "new", "Diff", "(", "control", ",", "test", ")", ";", "}" ]
Compare two XML documents provided as strings @param control Control document @param test Document to test @return Diff object describing differences in documents @throws SAXException @throws IOException
[ "Compare", "two", "XML", "documents", "provided", "as", "strings" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLUnit.java#L619-L622
twilio/authy-java
src/main/java/com/authy/AuthyUtil.java
AuthyUtil.loadProperties
public static Properties loadProperties(String path, Class cls) { Properties properties = new Properties(); // environment variables will always override properties file try { InputStream in = cls.getResourceAsStream(path); // if we cant find the properties file if (in != null) { properties.load(in); } // Env variables will always override properties if (System.getenv("api_key") != null && System.getenv("api_url") != null) { properties.put("api_key", System.getenv("api_key")); properties.put("api_url", System.getenv("api_url")); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Problems loading properties", e); } return properties; }
java
public static Properties loadProperties(String path, Class cls) { Properties properties = new Properties(); // environment variables will always override properties file try { InputStream in = cls.getResourceAsStream(path); // if we cant find the properties file if (in != null) { properties.load(in); } // Env variables will always override properties if (System.getenv("api_key") != null && System.getenv("api_url") != null) { properties.put("api_key", System.getenv("api_key")); properties.put("api_url", System.getenv("api_url")); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Problems loading properties", e); } return properties; }
[ "public", "static", "Properties", "loadProperties", "(", "String", "path", ",", "Class", "cls", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "// environment variables will always override properties file", "try", "{", "InputStream", "...
Loads your api_key and api_url properties from the given property file <p> Two important things to have in mind here: 1) if api_key and api_url are defined as environment variables, they will be returned as the properties. 2) If you want to load your properties file have in mind your classloader path may change. @return the Properties object containing the properties to setup Authy or an empty Properties object if no properties were found
[ "Loads", "your", "api_key", "and", "api_url", "properties", "from", "the", "given", "property", "file", "<p", ">", "Two", "important", "things", "to", "have", "in", "mind", "here", ":", "1", ")", "if", "api_key", "and", "api_url", "are", "defined", "as", ...
train
https://github.com/twilio/authy-java/blob/55e3a5ff57a93b3eb36f5b59e8824e60af2b8b91/src/main/java/com/authy/AuthyUtil.java#L216-L244
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java
ReferenceEntityLockService.isLocked
private boolean isLocked(Class entityType, String entityKey) throws LockingException { return isLocked(entityType, entityKey, null); }
java
private boolean isLocked(Class entityType, String entityKey) throws LockingException { return isLocked(entityType, entityKey, null); }
[ "private", "boolean", "isLocked", "(", "Class", "entityType", ",", "String", "entityKey", ")", "throws", "LockingException", "{", "return", "isLocked", "(", "entityType", ",", "entityKey", ",", "null", ")", ";", "}" ]
Answers if the entity represented by the entityType and entityKey already has a lock of some type. @param entityType @param entityKey @exception org.apereo.portal.concurrency.LockingException
[ "Answers", "if", "the", "entity", "represented", "by", "the", "entityType", "and", "entityKey", "already", "has", "a", "lock", "of", "some", "type", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java#L190-L192
enioka/jqm
jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java
ScheduledJob.addParameter
public ScheduledJob addParameter(String key, String value) { this.parameters.put(key, value); return this; }
java
public ScheduledJob addParameter(String key, String value) { this.parameters.put(key, value); return this; }
[ "public", "ScheduledJob", "addParameter", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "parameters", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a parameter to the override parameters. See {@link #getParameters()}. @param key @param value @return
[ "Add", "a", "parameter", "to", "the", "override", "parameters", ".", "See", "{", "@link", "#getParameters", "()", "}", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-admin/src/main/java/com/enioka/api/admin/ScheduledJob.java#L158-L162
etourdot/xincproc
xpointer/src/main/java/org/etourdot/xincproc/xpointer/XPointerEngine.java
XPointerEngine.verifyXPathExpression
public String verifyXPathExpression(final Iterable<XmlNsScheme> xmlNsSchemes, final String xpathExpression) { LOG.trace("verifyXPathExpression: {}", xpathExpression); final XPathCompiler xPathCompiler = processor.newXPathCompiler(); for (final XmlNsScheme xmlNsScheme : xmlNsSchemes) { final String localPart = xmlNsScheme.getQName().getLocalPart(); final String namespaceUri = xmlNsScheme.getQName().getNamespaceURI(); LOG.trace("declareNamespace {}:{}", localPart, namespaceUri); xPathCompiler.declareNamespace(localPart, namespaceUri); } try { xPathCompiler.compile(xpathExpression); } catch (final SaxonApiException e) { return e.getCause().getMessage(); } return ""; }
java
public String verifyXPathExpression(final Iterable<XmlNsScheme> xmlNsSchemes, final String xpathExpression) { LOG.trace("verifyXPathExpression: {}", xpathExpression); final XPathCompiler xPathCompiler = processor.newXPathCompiler(); for (final XmlNsScheme xmlNsScheme : xmlNsSchemes) { final String localPart = xmlNsScheme.getQName().getLocalPart(); final String namespaceUri = xmlNsScheme.getQName().getNamespaceURI(); LOG.trace("declareNamespace {}:{}", localPart, namespaceUri); xPathCompiler.declareNamespace(localPart, namespaceUri); } try { xPathCompiler.compile(xpathExpression); } catch (final SaxonApiException e) { return e.getCause().getMessage(); } return ""; }
[ "public", "String", "verifyXPathExpression", "(", "final", "Iterable", "<", "XmlNsScheme", ">", "xmlNsSchemes", ",", "final", "String", "xpathExpression", ")", "{", "LOG", ".", "trace", "(", "\"verifyXPathExpression: {}\"", ",", "xpathExpression", ")", ";", "final",...
Utility method for verifying xpath expression @param xmlNsSchemes namespaces list @param xpathExpression xpath expression to test @return empty string if expression is right, error otherwise
[ "Utility", "method", "for", "verifying", "xpath", "expression" ]
train
https://github.com/etourdot/xincproc/blob/6e9e9352e1975957ae6821a04c248ea49c7323ec/xpointer/src/main/java/org/etourdot/xincproc/xpointer/XPointerEngine.java#L225-L245
netty/netty
resolver-dns/src/main/java/io/netty/resolver/dns/DnsAddressResolverGroup.java
DnsAddressResolverGroup.newAddressResolver
protected AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop, NameResolver<InetAddress> resolver) throws Exception { return new InetSocketAddressResolver(eventLoop, resolver); }
java
protected AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop, NameResolver<InetAddress> resolver) throws Exception { return new InetSocketAddressResolver(eventLoop, resolver); }
[ "protected", "AddressResolver", "<", "InetSocketAddress", ">", "newAddressResolver", "(", "EventLoop", "eventLoop", ",", "NameResolver", "<", "InetAddress", ">", "resolver", ")", "throws", "Exception", "{", "return", "new", "InetSocketAddressResolver", "(", "eventLoop",...
Creates a new {@link AddressResolver}. Override this method to create an alternative {@link AddressResolver} implementation or override the default configuration.
[ "Creates", "a", "new", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsAddressResolverGroup.java#L121-L125
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/Script.java
Script.getToAddress
public Address getToAddress(NetworkParameters params, boolean forcePayToPubKey) throws ScriptException { if (ScriptPattern.isP2PKH(this)) return LegacyAddress.fromPubKeyHash(params, ScriptPattern.extractHashFromP2PKH(this)); else if (ScriptPattern.isP2SH(this)) return LegacyAddress.fromScriptHash(params, ScriptPattern.extractHashFromP2SH(this)); else if (forcePayToPubKey && ScriptPattern.isP2PK(this)) return LegacyAddress.fromKey(params, ECKey.fromPublicOnly(ScriptPattern.extractKeyFromP2PK(this))); else if (ScriptPattern.isP2WH(this)) return SegwitAddress.fromHash(params, ScriptPattern.extractHashFromP2WH(this)); else throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Cannot cast this script to an address"); }
java
public Address getToAddress(NetworkParameters params, boolean forcePayToPubKey) throws ScriptException { if (ScriptPattern.isP2PKH(this)) return LegacyAddress.fromPubKeyHash(params, ScriptPattern.extractHashFromP2PKH(this)); else if (ScriptPattern.isP2SH(this)) return LegacyAddress.fromScriptHash(params, ScriptPattern.extractHashFromP2SH(this)); else if (forcePayToPubKey && ScriptPattern.isP2PK(this)) return LegacyAddress.fromKey(params, ECKey.fromPublicOnly(ScriptPattern.extractKeyFromP2PK(this))); else if (ScriptPattern.isP2WH(this)) return SegwitAddress.fromHash(params, ScriptPattern.extractHashFromP2WH(this)); else throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Cannot cast this script to an address"); }
[ "public", "Address", "getToAddress", "(", "NetworkParameters", "params", ",", "boolean", "forcePayToPubKey", ")", "throws", "ScriptException", "{", "if", "(", "ScriptPattern", ".", "isP2PKH", "(", "this", ")", ")", "return", "LegacyAddress", ".", "fromPubKeyHash", ...
Gets the destination address from this script, if it's in the required form. @param forcePayToPubKey If true, allow payToPubKey to be casted to the corresponding address. This is useful if you prefer showing addresses rather than pubkeys.
[ "Gets", "the", "destination", "address", "from", "this", "script", "if", "it", "s", "in", "the", "required", "form", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L301-L312
WASdev/ci.maven
liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java
SpringBootUtil.getSpringBootUberJAR
public static File getSpringBootUberJAR(MavenProject project, Log log) { File fatArchive = getSpringBootUberJARLocation(project, log); if (net.wasdev.wlp.common.plugins.util.SpringBootUtil.isSpringBootUberJar(fatArchive)) { log.info("Found Spring Boot Uber JAR: " + fatArchive.getAbsolutePath()); return fatArchive; } log.warn("Spring Boot Uber JAR was not found in expected location: " + fatArchive.getAbsolutePath()); return null; }
java
public static File getSpringBootUberJAR(MavenProject project, Log log) { File fatArchive = getSpringBootUberJARLocation(project, log); if (net.wasdev.wlp.common.plugins.util.SpringBootUtil.isSpringBootUberJar(fatArchive)) { log.info("Found Spring Boot Uber JAR: " + fatArchive.getAbsolutePath()); return fatArchive; } log.warn("Spring Boot Uber JAR was not found in expected location: " + fatArchive.getAbsolutePath()); return null; }
[ "public", "static", "File", "getSpringBootUberJAR", "(", "MavenProject", "project", ",", "Log", "log", ")", "{", "File", "fatArchive", "=", "getSpringBootUberJARLocation", "(", "project", ",", "log", ")", ";", "if", "(", "net", ".", "wasdev", ".", "wlp", "."...
Get the Spring Boot Uber JAR in its expected location, validating the JAR contents and handling spring-boot-maven-plugin classifier configuration as well. If the JAR was not found in its expected location, then return null. @param outputDirectory @param project @param log @return the JAR File if it was found, false otherwise
[ "Get", "the", "Spring", "Boot", "Uber", "JAR", "in", "its", "expected", "location", "validating", "the", "JAR", "contents", "and", "handling", "spring", "-", "boot", "-", "maven", "-", "plugin", "classifier", "configuration", "as", "well", ".", "If", "the", ...
train
https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L56-L67
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/MasterUtils.java
MasterUtils.createMasters
public static void createMasters(MasterRegistry registry, MasterContext context) { List<Callable<Void>> callables = new ArrayList<>(); for (final MasterFactory factory : alluxio.master.ServiceUtils.getMasterServiceLoader()) { callables.add(() -> { if (factory.isEnabled()) { factory.create(registry, context); } return null; }); } try { CommonUtils.invokeAll(callables, 10 * Constants.MINUTE_MS); } catch (Exception e) { throw new RuntimeException("Failed to start masters", e); } }
java
public static void createMasters(MasterRegistry registry, MasterContext context) { List<Callable<Void>> callables = new ArrayList<>(); for (final MasterFactory factory : alluxio.master.ServiceUtils.getMasterServiceLoader()) { callables.add(() -> { if (factory.isEnabled()) { factory.create(registry, context); } return null; }); } try { CommonUtils.invokeAll(callables, 10 * Constants.MINUTE_MS); } catch (Exception e) { throw new RuntimeException("Failed to start masters", e); } }
[ "public", "static", "void", "createMasters", "(", "MasterRegistry", "registry", ",", "MasterContext", "context", ")", "{", "List", "<", "Callable", "<", "Void", ">>", "callables", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "MasterFact...
Creates all the masters and registers them to the master registry. @param registry the master registry @param context master context
[ "Creates", "all", "the", "masters", "and", "registers", "them", "to", "the", "master", "registry", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/MasterUtils.java#L44-L59
liferay/com-liferay-commerce
commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java
CommerceNotificationTemplateWrapper.getSubject
@Override public String getSubject(String languageId, boolean useDefault) { return _commerceNotificationTemplate.getSubject(languageId, useDefault); }
java
@Override public String getSubject(String languageId, boolean useDefault) { return _commerceNotificationTemplate.getSubject(languageId, useDefault); }
[ "@", "Override", "public", "String", "getSubject", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_commerceNotificationTemplate", ".", "getSubject", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized subject of this commerce notification template in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized subject of this commerce notification template
[ "Returns", "the", "localized", "subject", "of", "this", "commerce", "notification", "template", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java#L554-L557
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/ZKDatabase.java
ZKDatabase.processTxn
public ProcessTxnResult processTxn(TxnHeader hdr, Record txn) { return dataTree.processTxn(hdr, txn); }
java
public ProcessTxnResult processTxn(TxnHeader hdr, Record txn) { return dataTree.processTxn(hdr, txn); }
[ "public", "ProcessTxnResult", "processTxn", "(", "TxnHeader", "hdr", ",", "Record", "txn", ")", "{", "return", "dataTree", ".", "processTxn", "(", "hdr", ",", "txn", ")", ";", "}" ]
the process txn on the data @param hdr the txnheader for the txn @param txn the transaction that needs to be processed @return the result of processing the transaction on this datatree/zkdatabase
[ "the", "process", "txn", "on", "the", "data" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/ZKDatabase.java#L176-L178
Whiley/WhileyCompiler
src/main/java/wyil/check/FlowTypeCheck.java
FlowTypeCheck.checkFail
private Environment checkFail(Stmt.Fail stmt, Environment environment, EnclosingScope scope) { return FlowTypeUtils.BOTTOM; }
java
private Environment checkFail(Stmt.Fail stmt, Environment environment, EnclosingScope scope) { return FlowTypeUtils.BOTTOM; }
[ "private", "Environment", "checkFail", "(", "Stmt", ".", "Fail", "stmt", ",", "Environment", "environment", ",", "EnclosingScope", "scope", ")", "{", "return", "FlowTypeUtils", ".", "BOTTOM", ";", "}" ]
Type check a fail statement. The environment after a fail statement is "bottom" because that represents an unreachable program point. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @return
[ "Type", "check", "a", "fail", "statement", ".", "The", "environment", "after", "a", "fail", "statement", "is", "bottom", "because", "that", "represents", "an", "unreachable", "program", "point", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L386-L388
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/CoreRenderer.java
CoreRenderer.getErrorAndRequiredClass
public String getErrorAndRequiredClass(UIInput input, String clientId) { String styleClass = ""; if (BsfUtils.isLegacyFeedbackClassesEnabled()) { styleClass = FacesMessages.getErrorSeverityClass(clientId); } if (input.isRequired()) { styleClass += " bf-required"; } else { Annotation[] readAnnotations = ELTools.readAnnotations(input); if (null != readAnnotations && readAnnotations.length > 0) { for (Annotation a : readAnnotations) { if ((a.annotationType().getName().endsWith("NotNull")) || (a.annotationType().getName().endsWith("NotEmpty")) || (a.annotationType().getName().endsWith("NotBlank"))) { styleClass += " bf-required"; break; } } } } return styleClass; }
java
public String getErrorAndRequiredClass(UIInput input, String clientId) { String styleClass = ""; if (BsfUtils.isLegacyFeedbackClassesEnabled()) { styleClass = FacesMessages.getErrorSeverityClass(clientId); } if (input.isRequired()) { styleClass += " bf-required"; } else { Annotation[] readAnnotations = ELTools.readAnnotations(input); if (null != readAnnotations && readAnnotations.length > 0) { for (Annotation a : readAnnotations) { if ((a.annotationType().getName().endsWith("NotNull")) || (a.annotationType().getName().endsWith("NotEmpty")) || (a.annotationType().getName().endsWith("NotBlank"))) { styleClass += " bf-required"; break; } } } } return styleClass; }
[ "public", "String", "getErrorAndRequiredClass", "(", "UIInput", "input", ",", "String", "clientId", ")", "{", "String", "styleClass", "=", "\"\"", ";", "if", "(", "BsfUtils", ".", "isLegacyFeedbackClassesEnabled", "(", ")", ")", "{", "styleClass", "=", "FacesMes...
Yields the value of the required and error level CSS class. @param input must not be null @param clientId must not be null @return can never be null
[ "Yields", "the", "value", "of", "the", "required", "and", "error", "level", "CSS", "class", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/CoreRenderer.java#L180-L201
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/AbstractHistogramLogReader.java
AbstractHistogramLogReader.nextIntervalHistogram
public EncodableHistogram nextIntervalHistogram(final Double startTimeSec, final Double endTimeSec) { return nextIntervalHistogram(startTimeSec, endTimeSec, false); }
java
public EncodableHistogram nextIntervalHistogram(final Double startTimeSec, final Double endTimeSec) { return nextIntervalHistogram(startTimeSec, endTimeSec, false); }
[ "public", "EncodableHistogram", "nextIntervalHistogram", "(", "final", "Double", "startTimeSec", ",", "final", "Double", "endTimeSec", ")", "{", "return", "nextIntervalHistogram", "(", "startTimeSec", ",", "endTimeSec", ",", "false", ")", ";", "}" ]
Read the next interval histogram from the log, if interval falls within a time range. <p> Returns a histogram object if an interval line was found with an associated start timestamp value that falls between startTimeSec and endTimeSec, or null if no such interval line is found. Note that the range is assumed to be in seconds relative to the actual timestamp value found in each interval line in the log, and not in absolute time. <p> Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than rangeEndTimeSec. <p> The histogram returned will have it's timestamp set to the absolute timestamp calculated from adding the interval's indicated timestamp value to the latest [optional] start time found in the log. <p> Upon encountering any unexpected format errors in reading the next interval from the file, this method will return a null. @param startTimeSec The (non-absolute time) start of the expected time range, in seconds. @param endTimeSec The (non-absolute time) end of the expected time range, in seconds. @return a histogram, or a null if no appropriate interval found
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "a", "time", "range", ".", "<p", ">", "Returns", "a", "histogram", "object", "if", "an", "interval", "line", "was", "found", "with", "an", "associate...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/AbstractHistogramLogReader.java#L101-L104
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/permission/GroupPermissionDao.java
GroupPermissionDao.deleteByRootComponentIdAndGroupId
public int deleteByRootComponentIdAndGroupId(DbSession dbSession, long rootComponentId, @Nullable Integer groupId) { return mapper(dbSession).deleteByRootComponentIdAndGroupId(rootComponentId, groupId); }
java
public int deleteByRootComponentIdAndGroupId(DbSession dbSession, long rootComponentId, @Nullable Integer groupId) { return mapper(dbSession).deleteByRootComponentIdAndGroupId(rootComponentId, groupId); }
[ "public", "int", "deleteByRootComponentIdAndGroupId", "(", "DbSession", "dbSession", ",", "long", "rootComponentId", ",", "@", "Nullable", "Integer", "groupId", ")", "{", "return", "mapper", "(", "dbSession", ")", ".", "deleteByRootComponentIdAndGroupId", "(", "rootCo...
Delete all permissions of the specified group (group "AnyOne" if {@code groupId} is {@code null}) for the specified component.
[ "Delete", "all", "permissions", "of", "the", "specified", "group", "(", "group", "AnyOne", "if", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/GroupPermissionDao.java#L155-L157
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/TraceImpl.java
TraceImpl.internalBytes
private void internalBytes(Object source, Class sourceClass, byte[] data, int start, int count) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(sourceClass.getName()); stringBuffer.append(" ["); if (source != null) { stringBuffer.append(source); } else { stringBuffer.append("Static"); } stringBuffer.append("]"); stringBuffer.append(ls); if (data != null) { if (count > 0) { stringBuffer.append(formatBytes(data, start, count, true)); } else { stringBuffer.append(formatBytes(data, start, data.length, true)); } } else { stringBuffer.append("data is null"); } Tr.debug(traceComponent, stringBuffer.toString()); if (usePrintWriterForTrace) { if (printWriter != null) { printWriter.print(new java.util.Date()+" B "); printWriter.println(stringBuffer.toString()); printWriter.flush(); } } }
java
private void internalBytes(Object source, Class sourceClass, byte[] data, int start, int count) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(sourceClass.getName()); stringBuffer.append(" ["); if (source != null) { stringBuffer.append(source); } else { stringBuffer.append("Static"); } stringBuffer.append("]"); stringBuffer.append(ls); if (data != null) { if (count > 0) { stringBuffer.append(formatBytes(data, start, count, true)); } else { stringBuffer.append(formatBytes(data, start, data.length, true)); } } else { stringBuffer.append("data is null"); } Tr.debug(traceComponent, stringBuffer.toString()); if (usePrintWriterForTrace) { if (printWriter != null) { printWriter.print(new java.util.Date()+" B "); printWriter.println(stringBuffer.toString()); printWriter.flush(); } } }
[ "private", "void", "internalBytes", "(", "Object", "source", ",", "Class", "sourceClass", ",", "byte", "[", "]", "data", ",", "int", "start", ",", "int", "count", ")", "{", "StringBuffer", "stringBuffer", "=", "new", "StringBuffer", "(", ")", ";", "stringB...
Internal implementation of byte data trace. @param source @param sourceClass @param data @param start @param count
[ "Internal", "implementation", "of", "byte", "data", "trace", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/TraceImpl.java#L198-L244
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java
DataNode.createDataNode
public static DataNode createDataNode(String args[], Configuration conf) throws IOException { DataNode dn = instantiateDataNode(args, conf); if (dn != null) { dn.runDatanodeDaemon(); } return dn; }
java
public static DataNode createDataNode(String args[], Configuration conf) throws IOException { DataNode dn = instantiateDataNode(args, conf); if (dn != null) { dn.runDatanodeDaemon(); } return dn; }
[ "public", "static", "DataNode", "createDataNode", "(", "String", "args", "[", "]", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "DataNode", "dn", "=", "instantiateDataNode", "(", "args", ",", "conf", ")", ";", "if", "(", "dn", "!=", "nu...
Instantiate & Start a single datanode daemon and wait for it to finish. If this thread is specifically interrupted, it will stop waiting.
[ "Instantiate", "&", "Start", "a", "single", "datanode", "daemon", "and", "wait", "for", "it", "to", "finish", ".", "If", "this", "thread", "is", "specifically", "interrupted", "it", "will", "stop", "waiting", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2398-L2405
Atmosphere/atmosphere-samples
samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java
MeteorChat.doPost
@Override public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException { String body = req.getReader().readLine().trim(); // Simple JSON -- Use Jackson for more complex structure // Message looks like { "author" : "foo", "message" : "bar" } String author = body.substring(body.indexOf(":") + 2, body.indexOf(",") - 1); String message = body.substring(body.lastIndexOf(":") + 2, body.length() - 2); broadcaster.broadcast(new Data(author, message).toString()); }
java
@Override public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException { String body = req.getReader().readLine().trim(); // Simple JSON -- Use Jackson for more complex structure // Message looks like { "author" : "foo", "message" : "bar" } String author = body.substring(body.indexOf(":") + 2, body.indexOf(",") - 1); String message = body.substring(body.lastIndexOf(":") + 2, body.length() - 2); broadcaster.broadcast(new Data(author, message).toString()); }
[ "@", "Override", "public", "void", "doPost", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "IOException", "{", "String", "body", "=", "req", ".", "getReader", "(", ")", ".", "readLine", "(", ")", ".", "trim", "(", ")",...
Re-use the {@link Meteor} created on the first GET for broadcasting message. @param req An {@link HttpServletRequest} @param res An {@link HttpServletResponse}
[ "Re", "-", "use", "the", "{", "@link", "Meteor", "}", "created", "on", "the", "first", "GET", "for", "broadcasting", "message", "." ]
train
https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java#L63-L71
Alluxio/alluxio
examples/src/main/java/alluxio/examples/BasicCheckpoint.java
BasicCheckpoint.main
public static void main(String[] args) throws IOException { if (args.length != 2) { System.out.println("java -cp " + RuntimeConstants.ALLUXIO_JAR + " alluxio.examples.BasicCheckpoint <FileFolder> <Files>"); System.exit(-1); } FileSystemContext fsContext = FileSystemContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())); boolean result = CliUtils.runExample(new BasicCheckpoint(args[0], Integer.parseInt(args[1]), fsContext)); System.exit(result ? 0 : 1); }
java
public static void main(String[] args) throws IOException { if (args.length != 2) { System.out.println("java -cp " + RuntimeConstants.ALLUXIO_JAR + " alluxio.examples.BasicCheckpoint <FileFolder> <Files>"); System.exit(-1); } FileSystemContext fsContext = FileSystemContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())); boolean result = CliUtils.runExample(new BasicCheckpoint(args[0], Integer.parseInt(args[1]), fsContext)); System.exit(result ? 0 : 1); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "if", "(", "args", ".", "length", "!=", "2", ")", "{", "System", ".", "out", ".", "println", "(", "\"java -cp \"", "+", "RuntimeConstants", ".", "AL...
Example program for using checkpoints. Usage: {@code java -cp <ALLUXIO-VERSION> alluxio.examples.BasicCheckpoint <FileFolder> <Files>} @param args the folder for the files and the files to use
[ "Example", "program", "for", "using", "checkpoints", ".", "Usage", ":", "{", "@code", "java", "-", "cp", "<ALLUXIO", "-", "VERSION", ">", "alluxio", ".", "examples", ".", "BasicCheckpoint", "<FileFolder", ">", "<Files", ">", "}" ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/examples/src/main/java/alluxio/examples/BasicCheckpoint.java#L104-L115
landawn/AbacusUtil
src/com/landawn/abacus/util/Multimap.java
Multimap.replaceAll
public boolean replaceAll(final K key, final Collection<?> oldValues, final E newValue) { final V val = valueMap.get(key); if (val == null) { return false; } if (val.removeAll(oldValues)) { val.add(newValue); return true; } return false; }
java
public boolean replaceAll(final K key, final Collection<?> oldValues, final E newValue) { final V val = valueMap.get(key); if (val == null) { return false; } if (val.removeAll(oldValues)) { val.add(newValue); return true; } return false; }
[ "public", "boolean", "replaceAll", "(", "final", "K", "key", ",", "final", "Collection", "<", "?", ">", "oldValues", ",", "final", "E", "newValue", ")", "{", "final", "V", "val", "=", "valueMap", ".", "get", "(", "key", ")", ";", "if", "(", "val", ...
Replaces all of the specified <code>oldValue</code> with the specified <code>newValue</code>. <code>False</code> is returned if no <code>oldValue</code> is found. @param key @param oldValues @param newValue @return <code>true</code> if this Multimap is modified by this operation, otherwise <code>false</code>.
[ "Replaces", "all", "of", "the", "specified", "<code", ">", "oldValue<", "/", "code", ">", "with", "the", "specified", "<code", ">", "newValue<", "/", "code", ">", ".", "<code", ">", "False<", "/", "code", ">", "is", "returned", "if", "no", "<code", ">"...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multimap.java#L822-L835
lucmoreau/ProvToolbox
prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java
InteropFramework.readDocumentFromFile
public Document readDocumentFromFile(String filename, ProvFormat format) { try { switch (format) { case DOT: case JPEG: case PNG: case SVG: throw new UnsupportedOperationException(); // we don't load PROV // from these // formats case JSON: { return new org.openprovenance.prov.json.Converter(pFactory) .readDocument(filename); } case PROVN: { Utility u = new Utility(); CommonTree tree = u.convertASNToTree(filename); Object o = u.convertTreeToJavaBean(tree, pFactory); Document doc = (Document) o; // Namespace ns=Namespace.gatherNamespaces(doc); // doc.setNamespace(ns); return doc; } case RDFXML: case TRIG: case TURTLE: { org.openprovenance.prov.rdf.Utility rdfU = new org.openprovenance.prov.rdf.Utility( pFactory, onto); Document doc = rdfU.parseRDF(filename); return doc; } case XML: { File in = new File(filename); ProvDeserialiser deserial = ProvDeserialiser .getThreadProvDeserialiser(); Document doc = deserial.deserialiseDocument(in); return doc; } default: { System.out.println("Unknown format " + filename); throw new UnsupportedOperationException(); } } } catch (IOException e) { throw new InteropException(e); } catch (RDFParseException e) { throw new InteropException(e); } catch (RDFHandlerException e) { throw new InteropException(e); } catch (JAXBException e) { throw new InteropException(e); } catch (RecognitionException e) { throw new InteropException(e); } }
java
public Document readDocumentFromFile(String filename, ProvFormat format) { try { switch (format) { case DOT: case JPEG: case PNG: case SVG: throw new UnsupportedOperationException(); // we don't load PROV // from these // formats case JSON: { return new org.openprovenance.prov.json.Converter(pFactory) .readDocument(filename); } case PROVN: { Utility u = new Utility(); CommonTree tree = u.convertASNToTree(filename); Object o = u.convertTreeToJavaBean(tree, pFactory); Document doc = (Document) o; // Namespace ns=Namespace.gatherNamespaces(doc); // doc.setNamespace(ns); return doc; } case RDFXML: case TRIG: case TURTLE: { org.openprovenance.prov.rdf.Utility rdfU = new org.openprovenance.prov.rdf.Utility( pFactory, onto); Document doc = rdfU.parseRDF(filename); return doc; } case XML: { File in = new File(filename); ProvDeserialiser deserial = ProvDeserialiser .getThreadProvDeserialiser(); Document doc = deserial.deserialiseDocument(in); return doc; } default: { System.out.println("Unknown format " + filename); throw new UnsupportedOperationException(); } } } catch (IOException e) { throw new InteropException(e); } catch (RDFParseException e) { throw new InteropException(e); } catch (RDFHandlerException e) { throw new InteropException(e); } catch (JAXBException e) { throw new InteropException(e); } catch (RecognitionException e) { throw new InteropException(e); } }
[ "public", "Document", "readDocumentFromFile", "(", "String", "filename", ",", "ProvFormat", "format", ")", "{", "try", "{", "switch", "(", "format", ")", "{", "case", "DOT", ":", "case", "JPEG", ":", "case", "PNG", ":", "case", "SVG", ":", "throw", "new"...
Reads a document from a file, using the format to decide which parser to read the file with. @param filename the file to read a document from @param format the format of the file @return a Document
[ "Reads", "a", "document", "from", "a", "file", "using", "the", "format", "to", "decide", "which", "parser", "to", "read", "the", "file", "with", "." ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L701-L758
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.getHostPort
private static String getHostPort(SocketAddress address) { if (address instanceof ResourceAddress) { ResourceAddress lowest = getLowestTransportLayer((ResourceAddress)address); return format(HOST_PORT_FORMAT, lowest.getResource().getHost(), lowest.getResource().getPort()); } if (address instanceof InetSocketAddress) { InetSocketAddress inet = (InetSocketAddress)address; // we don't use inet.toString() because it would include a leading /, for example "/127.0.0.1:21345" // use getHostString() to avoid a reverse DNS lookup return format(HOST_PORT_FORMAT, inet.getHostString(), inet.getPort()); } return null; }
java
private static String getHostPort(SocketAddress address) { if (address instanceof ResourceAddress) { ResourceAddress lowest = getLowestTransportLayer((ResourceAddress)address); return format(HOST_PORT_FORMAT, lowest.getResource().getHost(), lowest.getResource().getPort()); } if (address instanceof InetSocketAddress) { InetSocketAddress inet = (InetSocketAddress)address; // we don't use inet.toString() because it would include a leading /, for example "/127.0.0.1:21345" // use getHostString() to avoid a reverse DNS lookup return format(HOST_PORT_FORMAT, inet.getHostString(), inet.getPort()); } return null; }
[ "private", "static", "String", "getHostPort", "(", "SocketAddress", "address", ")", "{", "if", "(", "address", "instanceof", "ResourceAddress", ")", "{", "ResourceAddress", "lowest", "=", "getLowestTransportLayer", "(", "(", "ResourceAddress", ")", "address", ")", ...
Method attempting to retrieve host port identifier @param address @return
[ "Method", "attempting", "to", "retrieve", "host", "port", "identifier" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L195-L207
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java
GeneratedDOAuth2UserDaoImpl.queryByCreatedDate
public Iterable<DOAuth2User> queryByCreatedDate(java.util.Date createdDate) { return queryByField(null, DOAuth2UserMapper.Field.CREATEDDATE.getFieldName(), createdDate); }
java
public Iterable<DOAuth2User> queryByCreatedDate(java.util.Date createdDate) { return queryByField(null, DOAuth2UserMapper.Field.CREATEDDATE.getFieldName(), createdDate); }
[ "public", "Iterable", "<", "DOAuth2User", ">", "queryByCreatedDate", "(", "java", ".", "util", ".", "Date", "createdDate", ")", "{", "return", "queryByField", "(", "null", ",", "DOAuth2UserMapper", ".", "Field", ".", "CREATEDDATE", ".", "getFieldName", "(", ")...
query-by method for field createdDate @param createdDate the specified attribute @return an Iterable of DOAuth2Users for the specified createdDate
[ "query", "-", "by", "method", "for", "field", "createdDate" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L79-L81
enioka/jqm
jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JndiContext.java
JndiContext.getParentCl
private static ClassLoader getParentCl() { try { Method m = ClassLoader.class.getMethod("getPlatformClassLoader"); return (ClassLoader) m.invoke(null); } catch (NoSuchMethodException e) { // Java < 9, just use the bootstrap CL. return null; } catch (Exception e) { throw new JqmInitError("Could not fetch Platform Class Loader", e); } }
java
private static ClassLoader getParentCl() { try { Method m = ClassLoader.class.getMethod("getPlatformClassLoader"); return (ClassLoader) m.invoke(null); } catch (NoSuchMethodException e) { // Java < 9, just use the bootstrap CL. return null; } catch (Exception e) { throw new JqmInitError("Could not fetch Platform Class Loader", e); } }
[ "private", "static", "ClassLoader", "getParentCl", "(", ")", "{", "try", "{", "Method", "m", "=", "ClassLoader", ".", "class", ".", "getMethod", "(", "\"getPlatformClassLoader\"", ")", ";", "return", "(", "ClassLoader", ")", "m", ".", "invoke", "(", "null", ...
A helper - in Java 9, the extension CL was renamed to platform CL and hosts all the JDK classes. Before 9, it was useless and we used bootstrap CL instead. @return the base CL to use.
[ "A", "helper", "-", "in", "Java", "9", "the", "extension", "CL", "was", "renamed", "to", "platform", "CL", "and", "hosts", "all", "the", "JDK", "classes", ".", "Before", "9", "it", "was", "useless", "and", "we", "used", "bootstrap", "CL", "instead", "....
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JndiContext.java#L413-L429
google/closure-compiler
src/com/google/javascript/jscomp/ProcessClosureProvidesAndRequires.java
ProcessClosureProvidesAndRequires.collectProvidedNames
Map<String, ProvidedName> collectProvidedNames(Node externs, Node root) { if (this.providedNames.isEmpty()) { // goog is special-cased because it is provided in Closure's base library. providedNames.put(GOOG, new ProvidedName(GOOG, null, null, false /* implicit */, false)); NodeTraversal.traverseRoots(compiler, new CollectDefinitions(), externs, root); } return this.providedNames; }
java
Map<String, ProvidedName> collectProvidedNames(Node externs, Node root) { if (this.providedNames.isEmpty()) { // goog is special-cased because it is provided in Closure's base library. providedNames.put(GOOG, new ProvidedName(GOOG, null, null, false /* implicit */, false)); NodeTraversal.traverseRoots(compiler, new CollectDefinitions(), externs, root); } return this.providedNames; }
[ "Map", "<", "String", ",", "ProvidedName", ">", "collectProvidedNames", "(", "Node", "externs", ",", "Node", "root", ")", "{", "if", "(", "this", ".", "providedNames", ".", "isEmpty", "(", ")", ")", "{", "// goog is special-cased because it is provided in Closure'...
Collects all goog.provides in the given namespace and warns on invalid code
[ "Collects", "all", "goog", ".", "provides", "in", "the", "given", "namespace", "and", "warns", "on", "invalid", "code" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessClosureProvidesAndRequires.java#L97-L104
Impetus/Kundera
src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/util/KunderaPropertyBuilder.java
KunderaPropertyBuilder.propertyNullCheck
private static void propertyNullCheck(String dbType, String host, String port, String dbName) { if (dbType == null || dbType.isEmpty()) { LOGGER.error("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty"); } if (host == null || host.isEmpty()) { LOGGER.error("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty"); } if (port == null || port.isEmpty()) { LOGGER.error("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty"); } if (dbName == null || dbName.isEmpty()) { LOGGER.error("Property'" + EthConstants.DATABASE_NAME + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_NAME + "' can't be null or empty"); } }
java
private static void propertyNullCheck(String dbType, String host, String port, String dbName) { if (dbType == null || dbType.isEmpty()) { LOGGER.error("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty"); } if (host == null || host.isEmpty()) { LOGGER.error("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty"); } if (port == null || port.isEmpty()) { LOGGER.error("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty"); } if (dbName == null || dbName.isEmpty()) { LOGGER.error("Property'" + EthConstants.DATABASE_NAME + "' can't be null or empty"); throw new KunderaException("Property '" + EthConstants.DATABASE_NAME + "' can't be null or empty"); } }
[ "private", "static", "void", "propertyNullCheck", "(", "String", "dbType", ",", "String", "host", ",", "String", "port", ",", "String", "dbName", ")", "{", "if", "(", "dbType", "==", "null", "||", "dbType", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ...
Property null check. @param dbType the db type @param host the host @param port the port @param dbName the db name
[ "Property", "null", "check", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/util/KunderaPropertyBuilder.java#L134-L161
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java
IncrementalIndex.loadDimensionIterable
public void loadDimensionIterable( Iterable<String> oldDimensionOrder, Map<String, ColumnCapabilitiesImpl> oldColumnCapabilities ) { synchronized (dimensionDescs) { if (!dimensionDescs.isEmpty()) { throw new ISE("Cannot load dimension order when existing order[%s] is not empty.", dimensionDescs.keySet()); } for (String dim : oldDimensionOrder) { if (dimensionDescs.get(dim) == null) { ColumnCapabilitiesImpl capabilities = oldColumnCapabilities.get(dim); columnCapabilities.put(dim, capabilities); DimensionHandler handler = DimensionHandlerUtils.getHandlerFromCapabilities(dim, capabilities, null); addNewDimension(dim, capabilities, handler); } } } }
java
public void loadDimensionIterable( Iterable<String> oldDimensionOrder, Map<String, ColumnCapabilitiesImpl> oldColumnCapabilities ) { synchronized (dimensionDescs) { if (!dimensionDescs.isEmpty()) { throw new ISE("Cannot load dimension order when existing order[%s] is not empty.", dimensionDescs.keySet()); } for (String dim : oldDimensionOrder) { if (dimensionDescs.get(dim) == null) { ColumnCapabilitiesImpl capabilities = oldColumnCapabilities.get(dim); columnCapabilities.put(dim, capabilities); DimensionHandler handler = DimensionHandlerUtils.getHandlerFromCapabilities(dim, capabilities, null); addNewDimension(dim, capabilities, handler); } } } }
[ "public", "void", "loadDimensionIterable", "(", "Iterable", "<", "String", ">", "oldDimensionOrder", ",", "Map", "<", "String", ",", "ColumnCapabilitiesImpl", ">", "oldColumnCapabilities", ")", "{", "synchronized", "(", "dimensionDescs", ")", "{", "if", "(", "!", ...
Currently called to initialize IncrementalIndex dimension order during index creation Index dimension ordering could be changed to initialize from DimensionsSpec after resolution of https://github.com/apache/incubator-druid/issues/2011
[ "Currently", "called", "to", "initialize", "IncrementalIndex", "dimension", "order", "during", "index", "creation", "Index", "dimension", "ordering", "could", "be", "changed", "to", "initialize", "from", "DimensionsSpec", "after", "resolution", "of", "https", ":", "...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java#L923-L941
Sciss/abc4j
abc/src/main/java/abc/parser/AbcGrammar.java
AbcGrammar.TexText
Rule TexText() { return ZeroOrMore( FirstOf(WSP(), CharRange('!', '$'), //exclude % which is comment ? '%', CharRange('&', '['), //exclude \ which is tex escape CharRange(']', '~'), LatinExtendedAndOtherAlphabet(), TexEscape()) ).label(TexText).suppressSubnodes(); }
java
Rule TexText() { return ZeroOrMore( FirstOf(WSP(), CharRange('!', '$'), //exclude % which is comment ? '%', CharRange('&', '['), //exclude \ which is tex escape CharRange(']', '~'), LatinExtendedAndOtherAlphabet(), TexEscape()) ).label(TexText).suppressSubnodes(); }
[ "Rule", "TexText", "(", ")", "{", "return", "ZeroOrMore", "(", "FirstOf", "(", "WSP", "(", ")", ",", "CharRange", "(", "'", "'", ",", "'", "'", ")", ",", "//exclude % which is comment ?\r", "'", "'", ",", "CharRange", "(", "'", "'", ",", "'", "'", ...
tex-text ::= *(WSP / %21-%5B / %5D-7E / tex-escape) <p>text that may contain TeX escapes
[ "tex", "-", "text", "::", "=", "*", "(", "WSP", "/", "%21", "-", "%5B", "/", "%5D", "-", "7E", "/", "tex", "-", "escape", ")", "<p", ">", "text", "that", "may", "contain", "TeX", "escapes" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L2474-L2485
google/closure-templates
java/src/com/google/template/soy/internal/proto/JavaQualifiedNames.java
JavaQualifiedNames.getClassName
public static String getClassName(Descriptor descriptor, ProtoFlavor flavor) { return getClassName(classNameWithoutPackage(descriptor, flavor), descriptor.getFile(), flavor); }
java
public static String getClassName(Descriptor descriptor, ProtoFlavor flavor) { return getClassName(classNameWithoutPackage(descriptor, flavor), descriptor.getFile(), flavor); }
[ "public", "static", "String", "getClassName", "(", "Descriptor", "descriptor", ",", "ProtoFlavor", "flavor", ")", "{", "return", "getClassName", "(", "classNameWithoutPackage", "(", "descriptor", ",", "flavor", ")", ",", "descriptor", ".", "getFile", "(", ")", "...
Gets the fully qualified name for generated classes in Java convention. Nested classes will be separated using '$' instead of '.'.
[ "Gets", "the", "fully", "qualified", "name", "for", "generated", "classes", "in", "Java", "convention", ".", "Nested", "classes", "will", "be", "separated", "using", "$", "instead", "of", ".", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/JavaQualifiedNames.java#L96-L98
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.setSchemaTypeInfo
public static void setSchemaTypeInfo(Configuration conf, StructTypeInfo schemaTypeInfo) { if (schemaTypeInfo != null) { conf.set(SCHEMA_TYPE_INFO, schemaTypeInfo.getTypeName()); LOG.debug("Set schema typeInfo on conf: {}", schemaTypeInfo); } }
java
public static void setSchemaTypeInfo(Configuration conf, StructTypeInfo schemaTypeInfo) { if (schemaTypeInfo != null) { conf.set(SCHEMA_TYPE_INFO, schemaTypeInfo.getTypeName()); LOG.debug("Set schema typeInfo on conf: {}", schemaTypeInfo); } }
[ "public", "static", "void", "setSchemaTypeInfo", "(", "Configuration", "conf", ",", "StructTypeInfo", "schemaTypeInfo", ")", "{", "if", "(", "schemaTypeInfo", "!=", "null", ")", "{", "conf", ".", "set", "(", "SCHEMA_TYPE_INFO", ",", "schemaTypeInfo", ".", "getTy...
Sets the StructTypeInfo that declares the total schema of the file in the configuration
[ "Sets", "the", "StructTypeInfo", "that", "declares", "the", "total", "schema", "of", "the", "file", "in", "the", "configuration" ]
train
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L133-L138
sdl/Testy
src/main/java/com/sdl/selenium/web/XPathBuilder.java
XPathBuilder.setTemplate
@SuppressWarnings("unchecked") public <T extends XPathBuilder> T setTemplate(final String key, final String value) { if (value == null) { templates.remove(key); } else { templates.put(key, value); } return (T) this; }
java
@SuppressWarnings("unchecked") public <T extends XPathBuilder> T setTemplate(final String key, final String value) { if (value == null) { templates.remove(key); } else { templates.put(key, value); } return (T) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "XPathBuilder", ">", "T", "setTemplate", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "templates", ...
For customize template please see here: See http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#dpos @param key name template @param value template @param <T> the element which calls this method @return this element
[ "For", "customize", "template", "please", "see", "here", ":", "See", "http", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "api", "/", "java", "/", "util", "/", "Formatter", ".", "html#dpos" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/XPathBuilder.java#L447-L455
canoo/dolphin-platform
platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java
TypeUtils.unrollVariableAssignments
private static Type unrollVariableAssignments(TypeVariable<?> var, final Map<TypeVariable<?>, Type> typeVarAssigns) { Type result; do { result = typeVarAssigns.get(var); if (result instanceof TypeVariable<?> && !result.equals(var)) { var = (TypeVariable<?>) result; continue; } break; } while (true); return result; }
java
private static Type unrollVariableAssignments(TypeVariable<?> var, final Map<TypeVariable<?>, Type> typeVarAssigns) { Type result; do { result = typeVarAssigns.get(var); if (result instanceof TypeVariable<?> && !result.equals(var)) { var = (TypeVariable<?>) result; continue; } break; } while (true); return result; }
[ "private", "static", "Type", "unrollVariableAssignments", "(", "TypeVariable", "<", "?", ">", "var", ",", "final", "Map", "<", "TypeVariable", "<", "?", ">", ",", "Type", ">", "typeVarAssigns", ")", "{", "Type", "result", ";", "do", "{", "result", "=", "...
Look up {@code var} in {@code typeVarAssigns} <em>transitively</em>, i.e. keep looking until the value found is <em>not</em> a type variable. @param var the type variable to look up @param typeVarAssigns the map used for the look up @return Type or {@code null} if some variable was not in the map @since 3.2
[ "Look", "up", "{", "@code", "var", "}", "in", "{", "@code", "typeVarAssigns", "}", "<em", ">", "transitively<", "/", "em", ">", "i", ".", "e", ".", "keep", "looking", "until", "the", "value", "found", "is", "<em", ">", "not<", "/", "em", ">", "a", ...
train
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java#L422-L433
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.setMonths
public static Date setMonths(final Date date, final int amount) { return set(date, Calendar.MONTH, amount); }
java
public static Date setMonths(final Date date, final int amount) { return set(date, Calendar.MONTH, amount); }
[ "public", "static", "Date", "setMonths", "(", "final", "Date", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "MONTH", ",", "amount", ")", ";", "}" ]
Sets the months field to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Sets", "the", "months", "field", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L555-L557
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java
CommonExpectations.successfullyReachedProtectedResourceWithJwtCookie
public static Expectations successfullyReachedProtectedResourceWithJwtCookie(String testAction, String protectedUrl, String username) { return successfullyReachedProtectedResourceWithJwtCookie(testAction, protectedUrl, username, JwtFatConstants.DEFAULT_ISS_REGEX); }
java
public static Expectations successfullyReachedProtectedResourceWithJwtCookie(String testAction, String protectedUrl, String username) { return successfullyReachedProtectedResourceWithJwtCookie(testAction, protectedUrl, username, JwtFatConstants.DEFAULT_ISS_REGEX); }
[ "public", "static", "Expectations", "successfullyReachedProtectedResourceWithJwtCookie", "(", "String", "testAction", ",", "String", "protectedUrl", ",", "String", "username", ")", "{", "return", "successfullyReachedProtectedResourceWithJwtCookie", "(", "testAction", ",", "pr...
Sets expectations that will check: <ol> <li>Successfully reached the specified URL <li>Response text includes JWT cookie and principal information </ol>
[ "Sets", "expectations", "that", "will", "check", ":", "<ol", ">", "<li", ">", "Successfully", "reached", "the", "specified", "URL", "<li", ">", "Response", "text", "includes", "JWT", "cookie", "and", "principal", "information", "<", "/", "ol", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L31-L33
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java
JmxUtil.unregisterMBean
public static void unregisterMBean(ObjectName objectName, MBeanServer mBeanServer) throws Exception { if (mBeanServer.isRegistered(objectName)) { SecurityActions.unregisterMBean(objectName, mBeanServer); log.tracef("Unregistered %s", objectName); } }
java
public static void unregisterMBean(ObjectName objectName, MBeanServer mBeanServer) throws Exception { if (mBeanServer.isRegistered(objectName)) { SecurityActions.unregisterMBean(objectName, mBeanServer); log.tracef("Unregistered %s", objectName); } }
[ "public", "static", "void", "unregisterMBean", "(", "ObjectName", "objectName", ",", "MBeanServer", "mBeanServer", ")", "throws", "Exception", "{", "if", "(", "mBeanServer", ".", "isRegistered", "(", "objectName", ")", ")", "{", "SecurityActions", ".", "unregister...
Unregister the MBean located under the given {@link ObjectName} @param objectName {@link ObjectName} where the MBean is registered @param mBeanServer {@link MBeanServer} from which to unregister the MBean. @throws Exception If unregistration could not be completed.
[ "Unregister", "the", "MBean", "located", "under", "the", "given", "{", "@link", "ObjectName", "}" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java#L80-L85
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.writerTo
public static BitWriter writerTo(BitStore store, Operation operation, int finalPos, int initialPos) { if (store == null) throw new IllegalArgumentException("null store"); if (operation == null) throw new IllegalArgumentException("null operation"); if (finalPos < 0) throw new IllegalArgumentException("negative finalPos"); if (initialPos < finalPos) throw new IllegalArgumentException("finalPos exceeds initialPos"); if (initialPos > store.size()) throw new IllegalArgumentException("invalid initialPos"); switch(operation) { case SET: return new BitStoreWriter.Set(store, finalPos, initialPos); case AND: return new BitStoreWriter.And(store, finalPos, initialPos); case OR: return new BitStoreWriter.Or (store, finalPos, initialPos); case XOR: return new BitStoreWriter.Xor(store, finalPos, initialPos); default: throw new IllegalStateException("unsupported operation"); } }
java
public static BitWriter writerTo(BitStore store, Operation operation, int finalPos, int initialPos) { if (store == null) throw new IllegalArgumentException("null store"); if (operation == null) throw new IllegalArgumentException("null operation"); if (finalPos < 0) throw new IllegalArgumentException("negative finalPos"); if (initialPos < finalPos) throw new IllegalArgumentException("finalPos exceeds initialPos"); if (initialPos > store.size()) throw new IllegalArgumentException("invalid initialPos"); switch(operation) { case SET: return new BitStoreWriter.Set(store, finalPos, initialPos); case AND: return new BitStoreWriter.And(store, finalPos, initialPos); case OR: return new BitStoreWriter.Or (store, finalPos, initialPos); case XOR: return new BitStoreWriter.Xor(store, finalPos, initialPos); default: throw new IllegalStateException("unsupported operation"); } }
[ "public", "static", "BitWriter", "writerTo", "(", "BitStore", "store", ",", "Operation", "operation", ",", "int", "finalPos", ",", "int", "initialPos", ")", "{", "if", "(", "store", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null st...
Creates a {@link BitWriter} that writes its bits to a {@link BitStore} using a specified {@link Operation}. This method is primarily intended to assist in implementing a highly adapted {@link BitStore} implementation. Generally {@link BitStore.Op#openWriter(int, int)}, {@link BitStore#openWriter(int, int)} {@link BitStore.Op#openWriter(int, int)} and should be used in preference to this method. Note that the {@link BitWriter} will <em>write in big-endian order</em> which this means that the first bit is written at the largest index, working downwards to the least index. @param store the store to which bits will be written @param operation the operation that should be applied on writing @param finalPos the (exclusive) index at which the writer stops; less than <code>initialPos</code> @param initialPos the (inclusive) index at which the writer starts; greater than <code>finalPos</code> @return a writer into the store @see BitStore#openWriter() @see BitStore#openWriter(int, int) @see BitStore.Op#openWriter(int, int)
[ "Creates", "a", "{", "@link", "BitWriter", "}", "that", "writes", "its", "bits", "to", "a", "{", "@link", "BitStore", "}", "using", "a", "specified", "{", "@link", "Operation", "}", ".", "This", "method", "is", "primarily", "intended", "to", "assist", "i...
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L983-L998
mapbox/mapbox-java
services-turf/src/main/java/com/mapbox/turf/TurfClassification.java
TurfClassification.nearestPoint
@NonNull public static Point nearestPoint(@NonNull Point targetPoint, @NonNull List<Point> points) { if (points.isEmpty()) { return targetPoint; } Point nearestPoint = points.get(0); double minDist = Double.POSITIVE_INFINITY; for (Point point : points) { double distanceToPoint = TurfMeasurement.distance(targetPoint, point); if (distanceToPoint < minDist) { nearestPoint = point; minDist = distanceToPoint; } } return nearestPoint; }
java
@NonNull public static Point nearestPoint(@NonNull Point targetPoint, @NonNull List<Point> points) { if (points.isEmpty()) { return targetPoint; } Point nearestPoint = points.get(0); double minDist = Double.POSITIVE_INFINITY; for (Point point : points) { double distanceToPoint = TurfMeasurement.distance(targetPoint, point); if (distanceToPoint < minDist) { nearestPoint = point; minDist = distanceToPoint; } } return nearestPoint; }
[ "@", "NonNull", "public", "static", "Point", "nearestPoint", "(", "@", "NonNull", "Point", "targetPoint", ",", "@", "NonNull", "List", "<", "Point", ">", "points", ")", "{", "if", "(", "points", ".", "isEmpty", "(", ")", ")", "{", "return", "targetPoint"...
Takes a reference point and a list of {@link Point} geometries and returns the point from the set point list closest to the reference. This calculation is geodesic. @param targetPoint the reference point @param points set list of points to run against the input point @return the closest point in the set to the reference point @since 3.0.0
[ "Takes", "a", "reference", "point", "and", "a", "list", "of", "{", "@link", "Point", "}", "geometries", "and", "returns", "the", "point", "from", "the", "set", "point", "list", "closest", "to", "the", "reference", ".", "This", "calculation", "is", "geodesi...
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfClassification.java#L30-L45
beders/Resty
src/main/java/us/monoid/util/EncoderUtil.java
EncoderUtil.encodeIfNecessary
public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) { if (hasToBeEncoded(text, usedCharacters)) return encodeEncodedWord(text, usage, usedCharacters); else return text; }
java
public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) { if (hasToBeEncoded(text, usedCharacters)) return encodeEncodedWord(text, usage, usedCharacters); else return text; }
[ "public", "static", "String", "encodeIfNecessary", "(", "String", "text", ",", "Usage", "usage", ",", "int", "usedCharacters", ")", "{", "if", "(", "hasToBeEncoded", "(", "text", ",", "usedCharacters", ")", ")", "return", "encodeEncodedWord", "(", "text", ",",...
Shortcut method that encodes the specified text into an encoded-word if the text has to be encoded. @param text text to encode. @param usage whether the encoded-word is to be used to replace a text token or a word entity (see RFC 822). @param usedCharacters number of characters already used up ( <code>0 <= usedCharacters <= 50</code>). @return the specified text if encoding is not necessary or an encoded word or a sequence of encoded words otherwise.
[ "Shortcut", "method", "that", "encodes", "the", "specified", "text", "into", "an", "encoded", "-", "word", "if", "the", "text", "has", "to", "be", "encoded", "." ]
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L190-L195
JetBrains/xodus
entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java
PersistentEntityStoreImpl.deleteLinks
private void deleteLinks(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity) { final PersistentEntityId id = entity.getId(); final int entityTypeId = id.getTypeId(); final long entityLocalId = id.getLocalId(); final Transaction envTxn = txn.getEnvironmentTransaction(); final LinksTable links = getLinksTable(txn, entityTypeId); final IntHashSet deletedLinks = new IntHashSet(); try (Cursor cursor = links.getFirstIndexCursor(envTxn)) { for (boolean success = cursor.getSearchKeyRange(PropertyKey.propertyKeyToEntry(new PropertyKey(entityLocalId, 0))) != null; success; success = cursor.getNext()) { final ByteIterable keyEntry = cursor.getKey(); final PropertyKey key = PropertyKey.entryToPropertyKey(keyEntry); if (key.getEntityLocalId() != entityLocalId) { break; } final ByteIterable valueEntry = cursor.getValue(); if (links.delete(envTxn, keyEntry, valueEntry)) { int linkId = key.getPropertyId(); if (getLinkName(txn, linkId) != null) { deletedLinks.add(linkId); final LinkValue linkValue = LinkValue.entryToLinkValue(valueEntry); txn.linkDeleted(entity.getId(), (PersistentEntityId) linkValue.getEntityId(), linkValue.getLinkId()); } } } } for (Integer linkId : deletedLinks) { links.deleteAllIndex(envTxn, linkId, entityLocalId); } }
java
private void deleteLinks(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity) { final PersistentEntityId id = entity.getId(); final int entityTypeId = id.getTypeId(); final long entityLocalId = id.getLocalId(); final Transaction envTxn = txn.getEnvironmentTransaction(); final LinksTable links = getLinksTable(txn, entityTypeId); final IntHashSet deletedLinks = new IntHashSet(); try (Cursor cursor = links.getFirstIndexCursor(envTxn)) { for (boolean success = cursor.getSearchKeyRange(PropertyKey.propertyKeyToEntry(new PropertyKey(entityLocalId, 0))) != null; success; success = cursor.getNext()) { final ByteIterable keyEntry = cursor.getKey(); final PropertyKey key = PropertyKey.entryToPropertyKey(keyEntry); if (key.getEntityLocalId() != entityLocalId) { break; } final ByteIterable valueEntry = cursor.getValue(); if (links.delete(envTxn, keyEntry, valueEntry)) { int linkId = key.getPropertyId(); if (getLinkName(txn, linkId) != null) { deletedLinks.add(linkId); final LinkValue linkValue = LinkValue.entryToLinkValue(valueEntry); txn.linkDeleted(entity.getId(), (PersistentEntityId) linkValue.getEntityId(), linkValue.getLinkId()); } } } } for (Integer linkId : deletedLinks) { links.deleteAllIndex(envTxn, linkId, entityLocalId); } }
[ "private", "void", "deleteLinks", "(", "@", "NotNull", "final", "PersistentStoreTransaction", "txn", ",", "@", "NotNull", "final", "PersistentEntity", "entity", ")", "{", "final", "PersistentEntityId", "id", "=", "entity", ".", "getId", "(", ")", ";", "final", ...
Deletes all outgoing links of specified entity. @param entity the entity.
[ "Deletes", "all", "outgoing", "links", "of", "specified", "entity", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java#L1543-L1572
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java
ImageLoader.isCached
public boolean isCached(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType) { throwIfNotOnMainThread(); String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType); return imageCache.getBitmap(cacheKey) != null; }
java
public boolean isCached(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType) { throwIfNotOnMainThread(); String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight, scaleType); return imageCache.getBitmap(cacheKey) != null; }
[ "public", "boolean", "isCached", "(", "String", "requestUrl", ",", "int", "maxWidth", ",", "int", "maxHeight", ",", "ScaleType", "scaleType", ")", "{", "throwIfNotOnMainThread", "(", ")", ";", "String", "cacheKey", "=", "getCacheKey", "(", "requestUrl", ",", "...
Checks if the item is available in the cache. @param requestUrl The url of the remote image @param maxWidth The maximum width of the returned image. @param maxHeight The maximum height of the returned image. @param scaleType The scaleType of the imageView. @return True if the item exists in cache, false otherwise.
[ "Checks", "if", "the", "item", "is", "available", "in", "the", "cache", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java#L222-L227
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.targetType
@Nullable public static TargetType targetType(VisitorState state) { if (!(state.getPath().getLeaf() instanceof ExpressionTree)) { return null; } TreePath parent = state.getPath(); ExpressionTree current; do { current = (ExpressionTree) parent.getLeaf(); parent = parent.getParentPath(); } while (parent != null && parent.getLeaf().getKind() == Kind.PARENTHESIZED); if (parent == null) { return null; } Type type = new TargetTypeVisitor(current, state, parent).visit(parent.getLeaf(), null); if (type == null) { return null; } return TargetType.create(type, parent); }
java
@Nullable public static TargetType targetType(VisitorState state) { if (!(state.getPath().getLeaf() instanceof ExpressionTree)) { return null; } TreePath parent = state.getPath(); ExpressionTree current; do { current = (ExpressionTree) parent.getLeaf(); parent = parent.getParentPath(); } while (parent != null && parent.getLeaf().getKind() == Kind.PARENTHESIZED); if (parent == null) { return null; } Type type = new TargetTypeVisitor(current, state, parent).visit(parent.getLeaf(), null); if (type == null) { return null; } return TargetType.create(type, parent); }
[ "@", "Nullable", "public", "static", "TargetType", "targetType", "(", "VisitorState", "state", ")", "{", "if", "(", "!", "(", "state", ".", "getPath", "(", ")", ".", "getLeaf", "(", ")", "instanceof", "ExpressionTree", ")", ")", "{", "return", "null", ";...
Returns the target type of the tree at the given {@link VisitorState}'s path, or else {@code null}. <p>For example, the target type of an assignment expression is the variable's type, and the target type of a return statement is the enclosing method's type.
[ "Returns", "the", "target", "type", "of", "the", "tree", "at", "the", "given", "{", "@link", "VisitorState", "}", "s", "path", "or", "else", "{", "@code", "null", "}", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L1301-L1322
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java
JQMHeader.setLeftButton
public JQMButton setLeftButton(String text, JQMPage page, DataIcon icon) { if (page == null) throw new RuntimeException("page cannot be null"); return setLeftButton(text, "#" + page.getId(), icon); }
java
public JQMButton setLeftButton(String text, JQMPage page, DataIcon icon) { if (page == null) throw new RuntimeException("page cannot be null"); return setLeftButton(text, "#" + page.getId(), icon); }
[ "public", "JQMButton", "setLeftButton", "(", "String", "text", ",", "JQMPage", "page", ",", "DataIcon", "icon", ")", "{", "if", "(", "page", "==", "null", ")", "throw", "new", "RuntimeException", "(", "\"page cannot be null\"", ")", ";", "return", "setLeftButt...
Creates a new {@link JQMButton} with the given text and linking to the given {@link JQMPage} and with the given icon and then sets that button in the left slot. Any existing right button will be replaced. @param text the text for the button @param page the optional page for the button to link to, if null then this button does not navigate by default @param icon the icon to use or null if no icon is required @return the created button
[ "Creates", "a", "new", "{", "@link", "JQMButton", "}", "with", "the", "given", "text", "and", "linking", "to", "the", "given", "{", "@link", "JQMPage", "}", "and", "with", "the", "given", "icon", "and", "then", "sets", "that", "button", "in", "the", "l...
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java#L203-L207
apache/flink
flink-core/src/main/java/org/apache/flink/util/IOUtils.java
IOUtils.skipFully
public static void skipFully(final InputStream in, long len) throws IOException { while (len > 0) { final long ret = in.skip(len); if (ret < 0) { throw new IOException("Premeture EOF from inputStream"); } len -= ret; } }
java
public static void skipFully(final InputStream in, long len) throws IOException { while (len > 0) { final long ret = in.skip(len); if (ret < 0) { throw new IOException("Premeture EOF from inputStream"); } len -= ret; } }
[ "public", "static", "void", "skipFully", "(", "final", "InputStream", "in", ",", "long", "len", ")", "throws", "IOException", "{", "while", "(", "len", ">", "0", ")", "{", "final", "long", "ret", "=", "in", ".", "skip", "(", "len", ")", ";", "if", ...
Similar to readFully(). Skips bytes in a loop. @param in The InputStream to skip bytes from @param len number of bytes to skip @throws IOException if it could not skip requested number of bytes for any reason (including EOF)
[ "Similar", "to", "readFully", "()", ".", "Skips", "bytes", "in", "a", "loop", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L152-L160
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/search/SearcherFactory.java
SearcherFactory.createSearcherElseDefault
public static <T extends Searcher> T createSearcherElseDefault(final SearchType type, final T defaultSearcher) { try { return createSearcher(type); } catch (IllegalArgumentException ignore) { return defaultSearcher; } }
java
public static <T extends Searcher> T createSearcherElseDefault(final SearchType type, final T defaultSearcher) { try { return createSearcher(type); } catch (IllegalArgumentException ignore) { return defaultSearcher; } }
[ "public", "static", "<", "T", "extends", "Searcher", ">", "T", "createSearcherElseDefault", "(", "final", "SearchType", "type", ",", "final", "T", "defaultSearcher", ")", "{", "try", "{", "return", "createSearcher", "(", "type", ")", ";", "}", "catch", "(", ...
Creates an instance of the Searcher interface implementing the searching algorithm based on the SearchType, otherwise returns the provided default Searcher implementation if a Searcher based on the specified SearchType is not available. @param <T> the Class type of the actual Searcher implementation based on the SearchType. @param type the type of searching algorithm Searcher implementation to create. @param defaultSearcher the default Searcher implementation to use if a Searcher based on the specified SearchType is not available. @return a Searcher implementation subclass that implements the searching algorithm based on the SearchType, or the provided default Searcher implementation if the Searcher based on the SearchType is not available. @see #createSearcher(SearchType) @see org.cp.elements.util.search.Searcher @see org.cp.elements.util.search.SearchType
[ "Creates", "an", "instance", "of", "the", "Searcher", "interface", "implementing", "the", "searching", "algorithm", "based", "on", "the", "SearchType", "otherwise", "returns", "the", "provided", "default", "Searcher", "implementation", "if", "a", "Searcher", "based"...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/search/SearcherFactory.java#L74-L81
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/PropertyMapper.java
PropertyMapper.addNewMapping
public static void addNewMapping(final Class<?> type, final String property, final String mapping) { allowedColmns.computeIfAbsent(type, k -> new HashMap<>()); allowedColmns.get(type).put(property, mapping); }
java
public static void addNewMapping(final Class<?> type, final String property, final String mapping) { allowedColmns.computeIfAbsent(type, k -> new HashMap<>()); allowedColmns.get(type).put(property, mapping); }
[ "public", "static", "void", "addNewMapping", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "String", "property", ",", "final", "String", "mapping", ")", "{", "allowedColmns", ".", "computeIfAbsent", "(", "type", ",", "k", "->", "new", "HashMa...
Add new mapping - property name and alias. @param type entity type @param property alias of property @param mapping property name
[ "Add", "new", "mapping", "-", "property", "name", "and", "alias", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/rsql/PropertyMapper.java#L38-L41
facebook/fresco
samples/animation2/src/main/java/com/facebook/samples/animation2/color/ExampleColorBackend.java
ExampleColorBackend.createSampleColorAnimationBackend
public static AnimationBackend createSampleColorAnimationBackend(Resources resources) { // Get the animation duration in ms for each color frame int frameDurationMs = resources.getInteger(android.R.integer.config_mediumAnimTime); // Create and return the backend return new ExampleColorBackend(SampleData.COLORS, frameDurationMs); }
java
public static AnimationBackend createSampleColorAnimationBackend(Resources resources) { // Get the animation duration in ms for each color frame int frameDurationMs = resources.getInteger(android.R.integer.config_mediumAnimTime); // Create and return the backend return new ExampleColorBackend(SampleData.COLORS, frameDurationMs); }
[ "public", "static", "AnimationBackend", "createSampleColorAnimationBackend", "(", "Resources", "resources", ")", "{", "// Get the animation duration in ms for each color frame", "int", "frameDurationMs", "=", "resources", ".", "getInteger", "(", "android", ".", "R", ".", "i...
Creates a simple animation backend that cycles through a list of colors. @return the backend to use
[ "Creates", "a", "simple", "animation", "backend", "that", "cycles", "through", "a", "list", "of", "colors", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/animation2/src/main/java/com/facebook/samples/animation2/color/ExampleColorBackend.java#L35-L40
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.createOrUpdate
public ExpressRouteCircuitInner createOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuitInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, parameters).toBlocking().last().body(); }
java
public ExpressRouteCircuitInner createOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuitInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, parameters).toBlocking().last().body(); }
[ "public", "ExpressRouteCircuitInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "ExpressRouteCircuitInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ...
Creates or updates an express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of the circuit. @param parameters Parameters supplied to the create or update express route circuit 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 ExpressRouteCircuitInner object if successful.
[ "Creates", "or", "updates", "an", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L395-L397
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.assign
public SDVariable assign(String name, SDVariable in, Number value) { SDVariable ret = f().assign(in, value); return updateVariableNameAndReference(ret, name); }
java
public SDVariable assign(String name, SDVariable in, Number value) { SDVariable ret = f().assign(in, value); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "assign", "(", "String", "name", ",", "SDVariable", "in", ",", "Number", "value", ")", "{", "SDVariable", "ret", "=", "f", "(", ")", ".", "assign", "(", "in", ",", "value", ")", ";", "return", "updateVariableNameAndReference", "(", ...
Return an array with equal shape to the input, but all elements set to 'value' @param name Name of the output variable @param in Input variable @param value Value to set @return Output variable
[ "Return", "an", "array", "with", "equal", "shape", "to", "the", "input", "but", "all", "elements", "set", "to", "value" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L204-L207
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java
StereoTool.signedDistanceToPlane
public static double signedDistanceToPlane(Vector3d planeNormal, Point3d pointInPlane, Point3d point) { if (planeNormal == null) return Double.NaN; Vector3d pointPointDiff = new Vector3d(); pointPointDiff.sub(point, pointInPlane); return planeNormal.dot(pointPointDiff); }
java
public static double signedDistanceToPlane(Vector3d planeNormal, Point3d pointInPlane, Point3d point) { if (planeNormal == null) return Double.NaN; Vector3d pointPointDiff = new Vector3d(); pointPointDiff.sub(point, pointInPlane); return planeNormal.dot(pointPointDiff); }
[ "public", "static", "double", "signedDistanceToPlane", "(", "Vector3d", "planeNormal", ",", "Point3d", "pointInPlane", ",", "Point3d", "point", ")", "{", "if", "(", "planeNormal", "==", "null", ")", "return", "Double", ".", "NaN", ";", "Vector3d", "pointPointDif...
Given a normalized normal for a plane, any point in that plane, and a point, will return the distance between the plane and that point. @param planeNormal the normalized plane normal @param pointInPlane an arbitrary point in that plane @param point the point to measure @return the signed distance to the plane
[ "Given", "a", "normalized", "normal", "for", "a", "plane", "any", "point", "in", "that", "plane", "and", "a", "point", "will", "return", "the", "distance", "between", "the", "plane", "and", "that", "point", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java#L367-L373
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
StorableGenerator.lookupMethod
private static Method lookupMethod(Class type, String name, Class... args) { try { return type.getMethod(name, args); } catch (NoSuchMethodException e) { Error error = new NoSuchMethodError(); error.initCause(e); throw error; } }
java
private static Method lookupMethod(Class type, String name, Class... args) { try { return type.getMethod(name, args); } catch (NoSuchMethodException e) { Error error = new NoSuchMethodError(); error.initCause(e); throw error; } }
[ "private", "static", "Method", "lookupMethod", "(", "Class", "type", ",", "String", "name", ",", "Class", "...", "args", ")", "{", "try", "{", "return", "type", ".", "getMethod", "(", "name", ",", "args", ")", ";", "}", "catch", "(", "NoSuchMethodExcepti...
/* private static Method lookupMethod(Class type, MethodInfo mi) { MethodDesc desc = mi.getMethodDescriptor(); TypeDesc[] params = desc.getParameterTypes(); Class[] args; if (params == null || params.length == 0) { args = null; } else { args = new Class[params.length]; for (int i=0; i<args.length; i++) { args[i] = params[i].toClass(); } } return lookupMethod(type, mi.getName(), args); }
[ "/", "*", "private", "static", "Method", "lookupMethod", "(", "Class", "type", "MethodInfo", "mi", ")", "{", "MethodDesc", "desc", "=", "mi", ".", "getMethodDescriptor", "()", ";", "TypeDesc", "[]", "params", "=", "desc", ".", "getParameterTypes", "()", ";",...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L1856-L1864
javagl/CommonUI
src/main/java/de/javagl/common/ui/closeable/CloseableTab.java
CloseableTab.addTo
public static void addTo( JTabbedPane tabbedPane, String title, JComponent component, CloseCallback closeCallback) { int index = tabbedPane.getTabCount(); tabbedPane.addTab(title, component); tabbedPane.setTabComponentAt( index, new CloseableTab(tabbedPane, closeCallback)); tabbedPane.setSelectedIndex(index); }
java
public static void addTo( JTabbedPane tabbedPane, String title, JComponent component, CloseCallback closeCallback) { int index = tabbedPane.getTabCount(); tabbedPane.addTab(title, component); tabbedPane.setTabComponentAt( index, new CloseableTab(tabbedPane, closeCallback)); tabbedPane.setSelectedIndex(index); }
[ "public", "static", "void", "addTo", "(", "JTabbedPane", "tabbedPane", ",", "String", "title", ",", "JComponent", "component", ",", "CloseCallback", "closeCallback", ")", "{", "int", "index", "=", "tabbedPane", ".", "getTabCount", "(", ")", ";", "tabbedPane", ...
Adds a {@link CloseableTab} with the given title and component to the given tabbed pane. The given {@link CloseCallback} will be consulted to decide whether the tab may be closed @param tabbedPane The tabbed pane @param title The title of the tab @param component The component in the tab @param closeCallback The {@link CloseCallback}
[ "Adds", "a", "{", "@link", "CloseableTab", "}", "with", "the", "given", "title", "and", "component", "to", "the", "given", "tabbed", "pane", ".", "The", "given", "{", "@link", "CloseCallback", "}", "will", "be", "consulted", "to", "decide", "whether", "the...
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/closeable/CloseableTab.java#L94-L103
sockeqwe/mosby
mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpBasePresenter.java
MvpBasePresenter.ifViewAttached
protected final void ifViewAttached(boolean exceptionIfViewNotAttached, ViewAction<V> action) { final V view = viewRef == null ? null : viewRef.get(); if (view != null) { action.run(view); } else if (exceptionIfViewNotAttached) { throw new IllegalStateException( "No View attached to Presenter. Presenter destroyed = " + presenterDestroyed); } }
java
protected final void ifViewAttached(boolean exceptionIfViewNotAttached, ViewAction<V> action) { final V view = viewRef == null ? null : viewRef.get(); if (view != null) { action.run(view); } else if (exceptionIfViewNotAttached) { throw new IllegalStateException( "No View attached to Presenter. Presenter destroyed = " + presenterDestroyed); } }
[ "protected", "final", "void", "ifViewAttached", "(", "boolean", "exceptionIfViewNotAttached", ",", "ViewAction", "<", "V", ">", "action", ")", "{", "final", "V", "view", "=", "viewRef", "==", "null", "?", "null", ":", "viewRef", ".", "get", "(", ")", ";", ...
Executes the passed Action only if the View is attached. If no View is attached, either an exception is thrown (if parameter exceptionIfViewNotAttached is true) or the action is just not executed (no exception thrown). Note that if no view is attached, this will not re-execute the given action if the View gets re-attached. @param exceptionIfViewNotAttached true, if an exception should be thrown if no view is attached while trying to execute the action. false, if no exception should be thrown (the action will not be executed since no view is attached) @param action The {@link ViewAction} that will be executed if a view is attached. This is where you call view.isLoading etc. Use the view reference passed as parameter to {@link ViewAction#run(Object)} and not deprecated method {@link #getView()}
[ "Executes", "the", "passed", "Action", "only", "if", "the", "View", "is", "attached", ".", "If", "no", "View", "is", "attached", "either", "an", "exception", "is", "thrown", "(", "if", "parameter", "exceptionIfViewNotAttached", "is", "true", ")", "or", "the"...
train
https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/MvpBasePresenter.java#L118-L126
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/MessageUtils.java
MessageUtils.getMessage
public static FacesMessage getMessage(String bundleBaseName, Locale locale, String messageId, Object params[]) { if (bundleBaseName == null) { throw new NullPointerException( "Unable to locate ResourceBundle: bundle is null"); } ResourceBundle bundle = ResourceBundle.getBundle(bundleBaseName, locale); return getMessage(bundle, messageId, params); }
java
public static FacesMessage getMessage(String bundleBaseName, Locale locale, String messageId, Object params[]) { if (bundleBaseName == null) { throw new NullPointerException( "Unable to locate ResourceBundle: bundle is null"); } ResourceBundle bundle = ResourceBundle.getBundle(bundleBaseName, locale); return getMessage(bundle, messageId, params); }
[ "public", "static", "FacesMessage", "getMessage", "(", "String", "bundleBaseName", ",", "Locale", "locale", ",", "String", "messageId", ",", "Object", "params", "[", "]", ")", "{", "if", "(", "bundleBaseName", "==", "null", ")", "{", "throw", "new", "NullPoi...
Retrieve the message from a specific bundle. It does not look on application message bundle or default message bundle. If it is required to look on those bundles use getMessageFromBundle instead @param bundleBaseName baseName of ResourceBundle to load localized messages @param locale current locale @param messageId id of message @param params parameters to set at localized message @return generated FacesMessage
[ "Retrieve", "the", "message", "from", "a", "specific", "bundle", ".", "It", "does", "not", "look", "on", "application", "message", "bundle", "or", "default", "message", "bundle", ".", "If", "it", "is", "required", "to", "look", "on", "those", "bundles", "u...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/MessageUtils.java#L511-L522
Twitter4J/Twitter4J
twitter4j-core/src/internal-json/java/twitter4j/JSONImplFactory.java
JSONImplFactory.createUrlEntity
public static URLEntity createUrlEntity(int start, int end, String url, String expandedURL, String displayURL) { return new URLEntityJSONImpl(start, end, url, expandedURL, displayURL); }
java
public static URLEntity createUrlEntity(int start, int end, String url, String expandedURL, String displayURL) { return new URLEntityJSONImpl(start, end, url, expandedURL, displayURL); }
[ "public", "static", "URLEntity", "createUrlEntity", "(", "int", "start", ",", "int", "end", ",", "String", "url", ",", "String", "expandedURL", ",", "String", "displayURL", ")", "{", "return", "new", "URLEntityJSONImpl", "(", "start", ",", "end", ",", "url",...
static factory method for twitter-text-java @return url entity @since Twitter4J 2.2.6
[ "static", "factory", "method", "for", "twitter", "-", "text", "-", "java" ]
train
https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-json/java/twitter4j/JSONImplFactory.java#L295-L297
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationBoolean
private static boolean configurationBoolean(Properties properties, String key, boolean defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Boolean.valueOf(properties.getProperty(key)); } return defaultValue; }
java
private static boolean configurationBoolean(Properties properties, String key, boolean defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Boolean.valueOf(properties.getProperty(key)); } return defaultValue; }
[ "private", "static", "boolean", "configurationBoolean", "(", "Properties", "properties", ",", "String", "key", ",", "boolean", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "key", ...
Get configuration boolean @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "boolean" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L445-L454
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java
SVGGlyphLoader.loadGlyph
public static SVGGlyph loadGlyph(URL url) throws IOException { String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/') + 1); int startPos = 0; int endPos = 0; while (endPos < filename.length() && filename.charAt(endPos) != '-') { endPos++; } int id = Integer.parseInt(filename.substring(startPos, endPos)); startPos = endPos + 1; while (endPos < filename.length() && filename.charAt(endPos) != '.') { endPos++; } String name = filename.substring(startPos, endPos); return new SVGGlyph(id, name, extractSvgPath(getStringFromInputStream(url.openStream())), Color.BLACK); }
java
public static SVGGlyph loadGlyph(URL url) throws IOException { String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/') + 1); int startPos = 0; int endPos = 0; while (endPos < filename.length() && filename.charAt(endPos) != '-') { endPos++; } int id = Integer.parseInt(filename.substring(startPos, endPos)); startPos = endPos + 1; while (endPos < filename.length() && filename.charAt(endPos) != '.') { endPos++; } String name = filename.substring(startPos, endPos); return new SVGGlyph(id, name, extractSvgPath(getStringFromInputStream(url.openStream())), Color.BLACK); }
[ "public", "static", "SVGGlyph", "loadGlyph", "(", "URL", "url", ")", "throws", "IOException", "{", "String", "urlString", "=", "url", ".", "toString", "(", ")", ";", "String", "filename", "=", "urlString", ".", "substring", "(", "urlString", ".", "lastIndexO...
load a single svg icon from a file @param url of the svg icon @return SVGGLyph node @throws IOException
[ "load", "a", "single", "svg", "icon", "from", "a", "file" ]
train
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/svg/SVGGlyphLoader.java#L176-L194
infinispan/infinispan
core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java
AbstractComponentRegistry.getRegisteredComponents
public Set<Component> getRegisteredComponents() { Set<Component> set = new HashSet<>(); for (ComponentRef<?> c : basicComponentRegistry.getRegisteredComponents()) { ComponentMetadata metadata = c.wired() != null ? componentMetadataRepo.getComponentMetadata(c.wired().getClass()) : null; Component component = new Component(c, metadata); set.add(component); } return set; }
java
public Set<Component> getRegisteredComponents() { Set<Component> set = new HashSet<>(); for (ComponentRef<?> c : basicComponentRegistry.getRegisteredComponents()) { ComponentMetadata metadata = c.wired() != null ? componentMetadataRepo.getComponentMetadata(c.wired().getClass()) : null; Component component = new Component(c, metadata); set.add(component); } return set; }
[ "public", "Set", "<", "Component", ">", "getRegisteredComponents", "(", ")", "{", "Set", "<", "Component", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "ComponentRef", "<", "?", ">", "c", ":", "basicComponentRegistry", ".", "getReg...
Returns an immutable set containing all the components that exists in the repository at this moment. @return a set of components
[ "Returns", "an", "immutable", "set", "containing", "all", "the", "components", "that", "exists", "in", "the", "repository", "at", "this", "moment", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java#L445-L454
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/compress/Lz4hcCodec.java
Lz4hcCodec.createCompressor
@Override public Compressor createCompressor() { if (!isNativeCodeLoaded()) { throw new RuntimeException("native lz4 library not available"); } int bufferSize = conf.getInt( IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY, IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT); System.out.println("Create Lz4hc codec"); return new Lz4Compressor(bufferSize, true); }
java
@Override public Compressor createCompressor() { if (!isNativeCodeLoaded()) { throw new RuntimeException("native lz4 library not available"); } int bufferSize = conf.getInt( IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY, IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT); System.out.println("Create Lz4hc codec"); return new Lz4Compressor(bufferSize, true); }
[ "@", "Override", "public", "Compressor", "createCompressor", "(", ")", "{", "if", "(", "!", "isNativeCodeLoaded", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"native lz4 library not available\"", ")", ";", "}", "int", "bufferSize", "=", "conf"...
Create a new {@link Compressor} for use by this {@link CompressionCodec}. @return a new compressor for use by this codec
[ "Create", "a", "new", "{", "@link", "Compressor", "}", "for", "use", "by", "this", "{", "@link", "CompressionCodec", "}", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/compress/Lz4hcCodec.java#L41-L51
galenframework/galen
galen-core/src/main/java/com/galenframework/javascript/GalenJsApi.java
GalenJsApi.checkPageSpecLayout
public static LayoutReport checkPageSpecLayout(WebDriver driver, PageSpec pageSpec, String[]includedTags, String[]excludedTags, String screenshotFilePath) throws IOException { TestSession session = TestSession.current(); if (session == null) { throw new UnregisteredTestSession("Cannot check layout as there was no TestSession created"); } TestReport report = session.getReport(); File screenshotFile = null; if (screenshotFilePath != null) { screenshotFile = new File(screenshotFilePath); if (!screenshotFile.exists() || !screenshotFile.isFile()) { throw new IOException("Couldn't find screenshot in " + screenshotFilePath); } } if (pageSpec == null) { throw new IOException("Page spec is not defined"); } List<String> includedTagsList = toList(includedTags); LayoutReport layoutReport = Galen.checkLayout(new SeleniumBrowser(driver), pageSpec, new SectionFilter(includedTagsList, toList(excludedTags)), screenshotFile, session.getListener()); GalenUtils.attachLayoutReport(layoutReport, report, "<unknown>", includedTagsList); return layoutReport; }
java
public static LayoutReport checkPageSpecLayout(WebDriver driver, PageSpec pageSpec, String[]includedTags, String[]excludedTags, String screenshotFilePath) throws IOException { TestSession session = TestSession.current(); if (session == null) { throw new UnregisteredTestSession("Cannot check layout as there was no TestSession created"); } TestReport report = session.getReport(); File screenshotFile = null; if (screenshotFilePath != null) { screenshotFile = new File(screenshotFilePath); if (!screenshotFile.exists() || !screenshotFile.isFile()) { throw new IOException("Couldn't find screenshot in " + screenshotFilePath); } } if (pageSpec == null) { throw new IOException("Page spec is not defined"); } List<String> includedTagsList = toList(includedTags); LayoutReport layoutReport = Galen.checkLayout(new SeleniumBrowser(driver), pageSpec, new SectionFilter(includedTagsList, toList(excludedTags)), screenshotFile, session.getListener()); GalenUtils.attachLayoutReport(layoutReport, report, "<unknown>", includedTagsList); return layoutReport; }
[ "public", "static", "LayoutReport", "checkPageSpecLayout", "(", "WebDriver", "driver", ",", "PageSpec", "pageSpec", ",", "String", "[", "]", "includedTags", ",", "String", "[", "]", "excludedTags", ",", "String", "screenshotFilePath", ")", "throws", "IOException", ...
Used in GalenApi.js @param driver @param pageSpec @param includedTags @param excludedTags @param screenshotFilePath @return @throws IOException
[ "Used", "in", "GalenApi", ".", "js" ]
train
https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/javascript/GalenJsApi.java#L125-L156
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/initializer/ConverterInitializerFactory.java
ConverterInitializerFactory.newInstance
public static ConverterInitializer newInstance(State state, WorkUnitStream workUnits) { int branches = state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1); if (branches == 1) { return newInstance(state, workUnits, branches, 0); } List<ConverterInitializer> cis = Lists.newArrayList(); for (int branchId = 0; branchId < branches; branchId++) { cis.add(newInstance(state, workUnits, branches, branchId)); } return new MultiConverterInitializer(cis); }
java
public static ConverterInitializer newInstance(State state, WorkUnitStream workUnits) { int branches = state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1); if (branches == 1) { return newInstance(state, workUnits, branches, 0); } List<ConverterInitializer> cis = Lists.newArrayList(); for (int branchId = 0; branchId < branches; branchId++) { cis.add(newInstance(state, workUnits, branches, branchId)); } return new MultiConverterInitializer(cis); }
[ "public", "static", "ConverterInitializer", "newInstance", "(", "State", "state", ",", "WorkUnitStream", "workUnits", ")", "{", "int", "branches", "=", "state", ".", "getPropAsInt", "(", "ConfigurationKeys", ".", "FORK_BRANCHES_KEY", ",", "1", ")", ";", "if", "(...
Provides WriterInitializer based on the writer. Mostly writer is decided by the Writer builder (and destination) that user passes. If there's more than one branch, it will instantiate same number of WriterInitializer instance as number of branches and combine it into MultiWriterInitializer. @param state @return WriterInitializer
[ "Provides", "WriterInitializer", "based", "on", "the", "writer", ".", "Mostly", "writer", "is", "decided", "by", "the", "Writer", "builder", "(", "and", "destination", ")", "that", "user", "passes", ".", "If", "there", "s", "more", "than", "one", "branch", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/initializer/ConverterInitializerFactory.java#L43-L54
Ellzord/JALSE
src/main/java/jalse/entities/DefaultEntityProxyFactory.java
DefaultEntityProxyFactory.uncacheProxyOfEntity
public void uncacheProxyOfEntity(final Entity e, final Class<? extends Entity> type) { cache.invalidateType(e, type); }
java
public void uncacheProxyOfEntity(final Entity e, final Class<? extends Entity> type) { cache.invalidateType(e, type); }
[ "public", "void", "uncacheProxyOfEntity", "(", "final", "Entity", "e", ",", "final", "Class", "<", "?", "extends", "Entity", ">", "type", ")", "{", "cache", ".", "invalidateType", "(", "e", ",", "type", ")", ";", "}" ]
Uncaches the specific type proxy for an entity. @param e Entity to uncache for. @param type Proxy type.
[ "Uncaches", "the", "specific", "type", "proxy", "for", "an", "entity", "." ]
train
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/DefaultEntityProxyFactory.java#L277-L279
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.writeImmutableElements
public void writeImmutableElements(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.logger.log(Level.FINER, "Writing odselement: mimeTypeEntry to zip file"); this.mimetypeElement.write(xmlUtil, writer); this.logger.log(Level.FINER, "Writing odselement: manifestElement to zip file"); this.manifestElement.write(xmlUtil, writer); }
java
public void writeImmutableElements(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.logger.log(Level.FINER, "Writing odselement: mimeTypeEntry to zip file"); this.mimetypeElement.write(xmlUtil, writer); this.logger.log(Level.FINER, "Writing odselement: manifestElement to zip file"); this.manifestElement.write(xmlUtil, writer); }
[ "public", "void", "writeImmutableElements", "(", "final", "XMLUtil", "xmlUtil", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "this", ".", "logger", ".", "log", "(", "Level", ".", "FINER", ",", "\"Writing odselement: mimeTypeEntry to zi...
Write the mimetype and manifest elements to a writer. @param xmlUtil the xml util @param writer the writer @throws IOException if write fails
[ "Write", "the", "mimetype", "and", "manifest", "elements", "to", "a", "writer", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L385-L390
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/CustomStorableCodecFactory.java
CustomStorableCodecFactory.createCodec
protected <S extends Storable> CustomStorableCodec<S> createCodec(Class<S> type, boolean isMaster, Layout layout, RawSupport support) throws SupportException { return createCodec(type, isMaster, layout); }
java
protected <S extends Storable> CustomStorableCodec<S> createCodec(Class<S> type, boolean isMaster, Layout layout, RawSupport support) throws SupportException { return createCodec(type, isMaster, layout); }
[ "protected", "<", "S", "extends", "Storable", ">", "CustomStorableCodec", "<", "S", ">", "createCodec", "(", "Class", "<", "S", ">", "type", ",", "boolean", "isMaster", ",", "Layout", "layout", ",", "RawSupport", "support", ")", "throws", "SupportException", ...
Note: This factory method is not abstract for backwards compatibility.
[ "Note", ":", "This", "factory", "method", "is", "not", "abstract", "for", "backwards", "compatibility", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/CustomStorableCodecFactory.java#L106-L111
lessthanoptimal/BoofCV
integration/boofcv-openkinect/src/main/java/boofcv/openkinect/UtilOpenKinect.java
UtilOpenKinect.bufferRgbToMsU8
public static void bufferRgbToMsU8( byte []input , Planar<GrayU8> output ) { GrayU8 band0 = output.getBand(0); GrayU8 band1 = output.getBand(1); GrayU8 band2 = output.getBand(2); int indexIn = 0; for( int y = 0; y < output.height; y++ ) { int indexOut = output.startIndex + y*output.stride; for( int x = 0; x < output.width; x++ , indexOut++ ) { band0.data[indexOut] = input[indexIn++]; band1.data[indexOut] = input[indexIn++]; band2.data[indexOut] = input[indexIn++]; } } }
java
public static void bufferRgbToMsU8( byte []input , Planar<GrayU8> output ) { GrayU8 band0 = output.getBand(0); GrayU8 band1 = output.getBand(1); GrayU8 band2 = output.getBand(2); int indexIn = 0; for( int y = 0; y < output.height; y++ ) { int indexOut = output.startIndex + y*output.stride; for( int x = 0; x < output.width; x++ , indexOut++ ) { band0.data[indexOut] = input[indexIn++]; band1.data[indexOut] = input[indexIn++]; band2.data[indexOut] = input[indexIn++]; } } }
[ "public", "static", "void", "bufferRgbToMsU8", "(", "byte", "[", "]", "input", ",", "Planar", "<", "GrayU8", ">", "output", ")", "{", "GrayU8", "band0", "=", "output", ".", "getBand", "(", "0", ")", ";", "GrayU8", "band1", "=", "output", ".", "getBand"...
Converts byte array that contains RGB data into a 3-channel Planar image @param input Input array @param output Output depth image
[ "Converts", "byte", "array", "that", "contains", "RGB", "data", "into", "a", "3", "-", "channel", "Planar", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-openkinect/src/main/java/boofcv/openkinect/UtilOpenKinect.java#L116-L130
grpc/grpc-java
core/src/main/java/io/grpc/internal/GrpcUtil.java
GrpcUtil.getThreadFactory
public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) { if (IS_RESTRICTED_APPENGINE) { @SuppressWarnings("BetaApi") ThreadFactory factory = MoreExecutors.platformThreadFactory(); return factory; } else { return new ThreadFactoryBuilder() .setDaemon(daemon) .setNameFormat(nameFormat) .build(); } }
java
public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) { if (IS_RESTRICTED_APPENGINE) { @SuppressWarnings("BetaApi") ThreadFactory factory = MoreExecutors.platformThreadFactory(); return factory; } else { return new ThreadFactoryBuilder() .setDaemon(daemon) .setNameFormat(nameFormat) .build(); } }
[ "public", "static", "ThreadFactory", "getThreadFactory", "(", "String", "nameFormat", ",", "boolean", "daemon", ")", "{", "if", "(", "IS_RESTRICTED_APPENGINE", ")", "{", "@", "SuppressWarnings", "(", "\"BetaApi\"", ")", "ThreadFactory", "factory", "=", "MoreExecutor...
Get a {@link ThreadFactory} suitable for use in the current environment. @param nameFormat to apply to threads created by the factory. @param daemon {@code true} if the threads the factory creates are daemon threads, {@code false} otherwise. @return a {@link ThreadFactory}.
[ "Get", "a", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GrpcUtil.java#L576-L587