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
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java
ProgressBarRenderer.startColSpanDiv
protected String startColSpanDiv(ResponseWriter rw, ProgressBar progressBar) throws IOException { String clazz = Responsive.getResponsiveStyleClass(progressBar, false); if (clazz!= null && clazz.trim().length()>0) { rw.startElement("div", progressBar); rw.writeAttribute("class", clazz, "class"); } return clazz; }
java
protected String startColSpanDiv(ResponseWriter rw, ProgressBar progressBar) throws IOException { String clazz = Responsive.getResponsiveStyleClass(progressBar, false); if (clazz!= null && clazz.trim().length()>0) { rw.startElement("div", progressBar); rw.writeAttribute("class", clazz, "class"); } return clazz; }
[ "protected", "String", "startColSpanDiv", "(", "ResponseWriter", "rw", ",", "ProgressBar", "progressBar", ")", "throws", "IOException", "{", "String", "clazz", "=", "Responsive", ".", "getResponsiveStyleClass", "(", "progressBar", ",", "false", ")", ";", "if", "("...
Start the column span div (if there's one). This method is protected in order to allow third-party frameworks to derive from it. @param rw the response writer @throws IOException may be thrown by the response writer
[ "Start", "the", "column", "span", "div", "(", "if", "there", "s", "one", ")", ".", "This", "method", "is", "protected", "in", "order", "to", "allow", "third", "-", "party", "frameworks", "to", "derive", "from", "it", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java#L159-L166
cdk/cdk
storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java
CDKToBeam.addGeometricConfiguration
private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, int flavour, GraphBuilder gb, Map<IAtom, Integer> indices) { IBond db = dbs.getStereoBond(); IBond[] bs = dbs.getBonds(); // don't try to set a configuration on aromatic bonds if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return; int u = indices.get(db.getBegin()); int v = indices.get(db.getEnd()); // is bs[0] always connected to db.atom(0)? int x = indices.get(bs[0].getOther(db.getBegin())); int y = indices.get(bs[1].getOther(db.getEnd())); if (dbs.getStereo() == TOGETHER) { gb.geometric(u, v).together(x, y); } else { gb.geometric(u, v).opposite(x, y); } }
java
private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, int flavour, GraphBuilder gb, Map<IAtom, Integer> indices) { IBond db = dbs.getStereoBond(); IBond[] bs = dbs.getBonds(); // don't try to set a configuration on aromatic bonds if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return; int u = indices.get(db.getBegin()); int v = indices.get(db.getEnd()); // is bs[0] always connected to db.atom(0)? int x = indices.get(bs[0].getOther(db.getBegin())); int y = indices.get(bs[1].getOther(db.getEnd())); if (dbs.getStereo() == TOGETHER) { gb.geometric(u, v).together(x, y); } else { gb.geometric(u, v).opposite(x, y); } }
[ "private", "static", "void", "addGeometricConfiguration", "(", "IDoubleBondStereochemistry", "dbs", ",", "int", "flavour", ",", "GraphBuilder", "gb", ",", "Map", "<", "IAtom", ",", "Integer", ">", "indices", ")", "{", "IBond", "db", "=", "dbs", ".", "getStereo...
Add double-bond stereo configuration to the Beam GraphBuilder. @param dbs stereo element specifying double-bond configuration @param gb the current graph builder @param indices atom indices
[ "Add", "double", "-", "bond", "stereo", "configuration", "to", "the", "Beam", "GraphBuilder", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java#L309-L329
UrielCh/ovh-java-sdk
ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java
ApiOvhMsServices.serviceName_account_userPrincipalName_sharepoint_GET
public OvhSharepointInformation serviceName_account_userPrincipalName_sharepoint_GET(String serviceName, String userPrincipalName) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSharepointInformation.class); }
java
public OvhSharepointInformation serviceName_account_userPrincipalName_sharepoint_GET(String serviceName, String userPrincipalName) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSharepointInformation.class); }
[ "public", "OvhSharepointInformation", "serviceName_account_userPrincipalName_sharepoint_GET", "(", "String", "serviceName", ",", "String", "userPrincipalName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/msServices/{serviceName}/account/{userPrincipalName}/sharepoi...
Get this object properties REST: GET /msServices/{serviceName}/account/{userPrincipalName}/sharepoint @param serviceName [required] The internal name of your Active Directory organization @param userPrincipalName [required] User Principal Name API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L322-L327
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.leftShift
public static ZonedDateTime leftShift(final LocalDateTime self, ZoneId zone) { return ZonedDateTime.of(self, zone); }
java
public static ZonedDateTime leftShift(final LocalDateTime self, ZoneId zone) { return ZonedDateTime.of(self, zone); }
[ "public", "static", "ZonedDateTime", "leftShift", "(", "final", "LocalDateTime", "self", ",", "ZoneId", "zone", ")", "{", "return", "ZonedDateTime", ".", "of", "(", "self", ",", "zone", ")", ";", "}" ]
Returns a {@link java.time.OffsetDateTime} of this date/time and the provided {@link java.time.ZoneId}. @param self a LocalDateTime @param zone a ZoneId @return a ZonedDateTime @since 2.5.0
[ "Returns", "a", "{", "@link", "java", ".", "time", ".", "OffsetDateTime", "}", "of", "this", "date", "/", "time", "and", "the", "provided", "{", "@link", "java", ".", "time", ".", "ZoneId", "}", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L818-L820
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/places/PlacesInterface.java
PlacesInterface.getInfo
public Location getInfo(String placeId, String woeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId != null) { parameters.put("woe_id", woeId); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
java
public Location getInfo(String placeId, String woeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId != null) { parameters.put("woe_id", woeId); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
[ "public", "Location", "getInfo", "(", "String", "placeId", ",", "String", "woeId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "pa...
Get informations about a place. <p> This method does not require authentication. </p> @param placeId A Flickr Places ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.) @param woeId A Where On Earth (WOE) ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.) @return A Location @throws FlickrException
[ "Get", "informations", "about", "a", "place", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L319-L336
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/primitives/curve25519/ge_scalarmult_base.java
ge_scalarmult_base.ge_scalarmult_base
public static void ge_scalarmult_base(ge_p3 h, byte[] a) { byte[] e = new byte[64]; byte carry; ge_p1p1 r = new ge_p1p1(); ge_p2 s = new ge_p2(); ge_precomp t = new ge_precomp(); int i; for (i = 0; i < 32; ++i) { e[2 * i + 0] = (byte) ((a[i] >>> 0) & 15); e[2 * i + 1] = (byte) ((a[i] >>> 4) & 15); } /* each e[i] is between 0 and 15 */ /* e[63] is between 0 and 7 */ carry = 0; for (i = 0; i < 63; ++i) { e[i] += carry; carry = (byte) (e[i] + 8); carry >>= 4; e[i] -= carry << 4; } e[63] += carry; /* each e[i] is between -8 and 8 */ ge_p3_0.ge_p3_0(h); for (i = 1; i < 64; i += 2) { select(t, i / 2, e[i]); ge_madd.ge_madd(r, h, t); ge_p1p1_to_p3.ge_p1p1_to_p3(h, r); } ge_p3_dbl.ge_p3_dbl(r, h); ge_p1p1_to_p2.ge_p1p1_to_p2(s, r); ge_p2_dbl.ge_p2_dbl(r, s); ge_p1p1_to_p2.ge_p1p1_to_p2(s, r); ge_p2_dbl.ge_p2_dbl(r, s); ge_p1p1_to_p2.ge_p1p1_to_p2(s, r); ge_p2_dbl.ge_p2_dbl(r, s); ge_p1p1_to_p3.ge_p1p1_to_p3(h, r); for (i = 0; i < 64; i += 2) { select(t, i / 2, e[i]); ge_madd.ge_madd(r, h, t); ge_p1p1_to_p3.ge_p1p1_to_p3(h, r); } }
java
public static void ge_scalarmult_base(ge_p3 h, byte[] a) { byte[] e = new byte[64]; byte carry; ge_p1p1 r = new ge_p1p1(); ge_p2 s = new ge_p2(); ge_precomp t = new ge_precomp(); int i; for (i = 0; i < 32; ++i) { e[2 * i + 0] = (byte) ((a[i] >>> 0) & 15); e[2 * i + 1] = (byte) ((a[i] >>> 4) & 15); } /* each e[i] is between 0 and 15 */ /* e[63] is between 0 and 7 */ carry = 0; for (i = 0; i < 63; ++i) { e[i] += carry; carry = (byte) (e[i] + 8); carry >>= 4; e[i] -= carry << 4; } e[63] += carry; /* each e[i] is between -8 and 8 */ ge_p3_0.ge_p3_0(h); for (i = 1; i < 64; i += 2) { select(t, i / 2, e[i]); ge_madd.ge_madd(r, h, t); ge_p1p1_to_p3.ge_p1p1_to_p3(h, r); } ge_p3_dbl.ge_p3_dbl(r, h); ge_p1p1_to_p2.ge_p1p1_to_p2(s, r); ge_p2_dbl.ge_p2_dbl(r, s); ge_p1p1_to_p2.ge_p1p1_to_p2(s, r); ge_p2_dbl.ge_p2_dbl(r, s); ge_p1p1_to_p2.ge_p1p1_to_p2(s, r); ge_p2_dbl.ge_p2_dbl(r, s); ge_p1p1_to_p3.ge_p1p1_to_p3(h, r); for (i = 0; i < 64; i += 2) { select(t, i / 2, e[i]); ge_madd.ge_madd(r, h, t); ge_p1p1_to_p3.ge_p1p1_to_p3(h, r); } }
[ "public", "static", "void", "ge_scalarmult_base", "(", "ge_p3", "h", ",", "byte", "[", "]", "a", ")", "{", "byte", "[", "]", "e", "=", "new", "byte", "[", "64", "]", ";", "byte", "carry", ";", "ge_p1p1", "r", "=", "new", "ge_p1p1", "(", ")", ";",...
/* h = a * B where a = a[0]+256*a[1]+...+256^31 a[31] B is the Ed25519 base point (x,4/5) with x positive. Preconditions: a[31] <= 127
[ "/", "*", "h", "=", "a", "*", "B", "where", "a", "=", "a", "[", "0", "]", "+", "256", "*", "a", "[", "1", "]", "+", "...", "+", "256^31", "a", "[", "31", "]", "B", "is", "the", "Ed25519", "base", "point", "(", "x", "4", "/", "5", ")", ...
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/primitives/curve25519/ge_scalarmult_base.java#L69-L115
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/MessageSerializer.java
MessageSerializer.makeTransaction
public final Transaction makeTransaction(byte[] payloadBytes, int offset) throws ProtocolException { return makeTransaction(payloadBytes, offset, payloadBytes.length, null); }
java
public final Transaction makeTransaction(byte[] payloadBytes, int offset) throws ProtocolException { return makeTransaction(payloadBytes, offset, payloadBytes.length, null); }
[ "public", "final", "Transaction", "makeTransaction", "(", "byte", "[", "]", "payloadBytes", ",", "int", "offset", ")", "throws", "ProtocolException", "{", "return", "makeTransaction", "(", "payloadBytes", ",", "offset", ",", "payloadBytes", ".", "length", ",", "...
Make a transaction from the payload. Extension point for alternative serialization format support. @throws UnsupportedOperationException if this serializer/deserializer does not support deserialization. This can occur either because it's a dummy serializer (i.e. for messages with no network parameters), or because it does not support deserializing transactions.
[ "Make", "a", "transaction", "from", "the", "payload", ".", "Extension", "point", "for", "alternative", "serialization", "format", "support", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/MessageSerializer.java#L141-L143
google/closure-compiler
src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java
PeepholeRemoveDeadCode.optimizeSubtree
@Override Node optimizeSubtree(Node subtree) { switch (subtree.getToken()) { case ASSIGN: return tryFoldAssignment(subtree); case COMMA: return tryFoldComma(subtree); case SCRIPT: case BLOCK: return tryOptimizeBlock(subtree); case EXPR_RESULT: return tryFoldExpr(subtree); case HOOK: return tryFoldHook(subtree); case SWITCH: return tryOptimizeSwitch(subtree); case IF: return tryFoldIf(subtree); case WHILE: throw checkNormalization(false, "WHILE"); case FOR: { Node condition = NodeUtil.getConditionExpression(subtree); if (condition != null) { tryFoldForCondition(condition); } return tryFoldFor(subtree); } case DO: Node foldedDo = tryFoldDoAway(subtree); if (foldedDo.isDo()) { return tryFoldEmptyDo(foldedDo); } return foldedDo; case TRY: return tryFoldTry(subtree); case LABEL: return tryFoldLabel(subtree); case ARRAY_PATTERN: return tryOptimizeArrayPattern(subtree); case OBJECT_PATTERN: return tryOptimizeObjectPattern(subtree); case VAR: case CONST: case LET: return tryOptimizeNameDeclaration(subtree); default: return subtree; } }
java
@Override Node optimizeSubtree(Node subtree) { switch (subtree.getToken()) { case ASSIGN: return tryFoldAssignment(subtree); case COMMA: return tryFoldComma(subtree); case SCRIPT: case BLOCK: return tryOptimizeBlock(subtree); case EXPR_RESULT: return tryFoldExpr(subtree); case HOOK: return tryFoldHook(subtree); case SWITCH: return tryOptimizeSwitch(subtree); case IF: return tryFoldIf(subtree); case WHILE: throw checkNormalization(false, "WHILE"); case FOR: { Node condition = NodeUtil.getConditionExpression(subtree); if (condition != null) { tryFoldForCondition(condition); } return tryFoldFor(subtree); } case DO: Node foldedDo = tryFoldDoAway(subtree); if (foldedDo.isDo()) { return tryFoldEmptyDo(foldedDo); } return foldedDo; case TRY: return tryFoldTry(subtree); case LABEL: return tryFoldLabel(subtree); case ARRAY_PATTERN: return tryOptimizeArrayPattern(subtree); case OBJECT_PATTERN: return tryOptimizeObjectPattern(subtree); case VAR: case CONST: case LET: return tryOptimizeNameDeclaration(subtree); default: return subtree; } }
[ "@", "Override", "Node", "optimizeSubtree", "(", "Node", "subtree", ")", "{", "switch", "(", "subtree", ".", "getToken", "(", ")", ")", "{", "case", "ASSIGN", ":", "return", "tryFoldAssignment", "(", "subtree", ")", ";", "case", "COMMA", ":", "return", "...
could be changed to use code from CheckUnreachableCode to do this.
[ "could", "be", "changed", "to", "use", "code", "from", "CheckUnreachableCode", "to", "do", "this", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java#L74-L124
alkacon/opencms-core
src/org/opencms/site/CmsSite.java
CmsSite.setParameters
public void setParameters(SortedMap<String, String> parameters) { m_parameters = new TreeMap<String, String>(parameters); }
java
public void setParameters(SortedMap<String, String> parameters) { m_parameters = new TreeMap<String, String>(parameters); }
[ "public", "void", "setParameters", "(", "SortedMap", "<", "String", ",", "String", ">", "parameters", ")", "{", "m_parameters", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", "parameters", ")", ";", "}" ]
Sets the parameters.<p> @param parameters the parameters to set
[ "Sets", "the", "parameters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSite.java#L728-L731
apiman/apiman
common/util/src/main/java/io/apiman/common/util/AesEncrypter.java
AesEncrypter.keySpecFromSecretKey
private static SecretKeySpec keySpecFromSecretKey(String secretKey) { if (!keySpecs.containsKey(secretKey)) { byte[] ivraw = secretKey.getBytes(); SecretKeySpec skeySpec = new SecretKeySpec(ivraw, "AES"); //$NON-NLS-1$ keySpecs.put(secretKey, skeySpec); } return keySpecs.get(secretKey); }
java
private static SecretKeySpec keySpecFromSecretKey(String secretKey) { if (!keySpecs.containsKey(secretKey)) { byte[] ivraw = secretKey.getBytes(); SecretKeySpec skeySpec = new SecretKeySpec(ivraw, "AES"); //$NON-NLS-1$ keySpecs.put(secretKey, skeySpec); } return keySpecs.get(secretKey); }
[ "private", "static", "SecretKeySpec", "keySpecFromSecretKey", "(", "String", "secretKey", ")", "{", "if", "(", "!", "keySpecs", ".", "containsKey", "(", "secretKey", ")", ")", "{", "byte", "[", "]", "ivraw", "=", "secretKey", ".", "getBytes", "(", ")", ";"...
Returns a {@link SecretKeySpec} given a secret key. @param secretKey
[ "Returns", "a", "{" ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/util/src/main/java/io/apiman/common/util/AesEncrypter.java#L94-L101
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/EntityManagerFactory.java
EntityManagerFactory.createEntityManager
public EntityManager createEntityManager(String projectId, String jsonCredentialsFile) { return createEntityManager(projectId, jsonCredentialsFile, null); }
java
public EntityManager createEntityManager(String projectId, String jsonCredentialsFile) { return createEntityManager(projectId, jsonCredentialsFile, null); }
[ "public", "EntityManager", "createEntityManager", "(", "String", "projectId", ",", "String", "jsonCredentialsFile", ")", "{", "return", "createEntityManager", "(", "projectId", ",", "jsonCredentialsFile", ",", "null", ")", ";", "}" ]
Creates and return a new {@link EntityManager} using the provided JSON formatted credentials. @param projectId the project ID @param jsonCredentialsFile the JSON formatted credentials file for the target Cloud project. @return a new {@link EntityManager}
[ "Creates", "and", "return", "a", "new", "{", "@link", "EntityManager", "}", "using", "the", "provided", "JSON", "formatted", "credentials", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/EntityManagerFactory.java#L88-L90
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java
UserMetadata.setFieldProtected
public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) { FieldMetadata metaData = formModel.getFieldMetadata(fieldName); metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField)); }
java
public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) { FieldMetadata metaData = formModel.getFieldMetadata(fieldName); metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField)); }
[ "public", "static", "void", "setFieldProtected", "(", "FormModel", "formModel", ",", "String", "fieldName", ",", "boolean", "protectedField", ")", "{", "FieldMetadata", "metaData", "=", "formModel", ".", "getFieldMetadata", "(", "fieldName", ")", ";", "metaData", ...
defines the protectable state for a field @param formModel the formmodel @param fieldName the field to protect @param protectedField if true the field will be defined as protectable otherwise false
[ "defines", "the", "protectable", "state", "for", "a", "field" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java#L56-L59
square/pollexor
src/main/java/com/squareup/pollexor/Utilities.java
Utilities.rightPadString
static void rightPadString(StringBuilder builder, char padding, int multipleOf) { if (builder == null) { throw new IllegalArgumentException("Builder input must not be empty."); } if (multipleOf < 2) { throw new IllegalArgumentException("Multiple must be greater than one."); } int needed = multipleOf - (builder.length() % multipleOf); if (needed < multipleOf) { for (int i = needed; i > 0; i--) { builder.append(padding); } } }
java
static void rightPadString(StringBuilder builder, char padding, int multipleOf) { if (builder == null) { throw new IllegalArgumentException("Builder input must not be empty."); } if (multipleOf < 2) { throw new IllegalArgumentException("Multiple must be greater than one."); } int needed = multipleOf - (builder.length() % multipleOf); if (needed < multipleOf) { for (int i = needed; i > 0; i--) { builder.append(padding); } } }
[ "static", "void", "rightPadString", "(", "StringBuilder", "builder", ",", "char", "padding", ",", "int", "multipleOf", ")", "{", "if", "(", "builder", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Builder input must not be empty.\"", ...
Pad a {@link StringBuilder} to a desired multiple on the right using a specified character. @param builder Builder to pad. @param padding Padding character. @param multipleOf Number which the length must be a multiple of. @throws IllegalArgumentException if {@code builder} is null or {@code multipleOf} is less than 2.
[ "Pad", "a", "{", "@link", "StringBuilder", "}", "to", "a", "desired", "multiple", "on", "the", "right", "using", "a", "specified", "character", "." ]
train
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L84-L97
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/BaasDocument.java
BaasDocument.fetchAllSync
public static BaasResult<List<BaasDocument>> fetchAllSync(String collection, BaasQuery.Criteria filter) { BaasBox box = BaasBox.getDefaultChecked(); if (collection == null) throw new IllegalArgumentException("collection cannot be null"); Fetch f = new Fetch(box, collection, filter, RequestOptions.DEFAULT, null); return box.submitSync(f); }
java
public static BaasResult<List<BaasDocument>> fetchAllSync(String collection, BaasQuery.Criteria filter) { BaasBox box = BaasBox.getDefaultChecked(); if (collection == null) throw new IllegalArgumentException("collection cannot be null"); Fetch f = new Fetch(box, collection, filter, RequestOptions.DEFAULT, null); return box.submitSync(f); }
[ "public", "static", "BaasResult", "<", "List", "<", "BaasDocument", ">", ">", "fetchAllSync", "(", "String", "collection", ",", "BaasQuery", ".", "Criteria", "filter", ")", "{", "BaasBox", "box", "=", "BaasBox", ".", "getDefaultChecked", "(", ")", ";", "if",...
Synchronously retrieves the list of documents readable to the user in <code>collection</code> @param collection the collection to retrieve not <code>null</code> @return the result of the request
[ "Synchronously", "retrieves", "the", "list", "of", "documents", "readable", "to", "the", "user", "in", "<code", ">", "collection<", "/", "code", ">" ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L276-L281
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_server_serverId_PUT
public void serviceName_udp_farm_farmId_server_serverId_PUT(String serviceName, Long farmId, Long serverId, OvhBackendUDPServer body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId}"; StringBuilder sb = path(qPath, serviceName, farmId, serverId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_udp_farm_farmId_server_serverId_PUT(String serviceName, Long farmId, Long serverId, OvhBackendUDPServer body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId}"; StringBuilder sb = path(qPath, serviceName, farmId, serverId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_udp_farm_farmId_server_serverId_PUT", "(", "String", "serviceName", ",", "Long", "farmId", ",", "Long", "serverId", ",", "OvhBackendUDPServer", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceNa...
Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm @param serverId [required] Id of your server API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L961-L965
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java
SDVariable.rsub
public SDVariable rsub(String name, SDVariable x) { val result = sameDiff.f().rsub(this,x); return sameDiff.updateVariableNameAndReference(result,name); }
java
public SDVariable rsub(String name, SDVariable x) { val result = sameDiff.f().rsub(this,x); return sameDiff.updateVariableNameAndReference(result,name); }
[ "public", "SDVariable", "rsub", "(", "String", "name", ",", "SDVariable", "x", ")", "{", "val", "result", "=", "sameDiff", ".", "f", "(", ")", ".", "rsub", "(", "this", ",", "x", ")", ";", "return", "sameDiff", ".", "updateVariableNameAndReference", "(",...
Reverse subtraction operation: elementwise {@code x - this}<br> If this and x variables have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. @param name Name of the output variable @param x Variable to perform operation with @return Output (result) SDVariable
[ "Reverse", "subtraction", "operation", ":", "elementwise", "{", "@code", "x", "-", "this", "}", "<br", ">", "If", "this", "and", "x", "variables", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "the", "inputs", ".", "<br",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L933-L936
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java
BeanDefinitionParserUtils.setPropertyReference
public static void setPropertyReference(BeanDefinitionBuilder builder, String beanReference, String propertyName) { if (StringUtils.hasText(beanReference)) { builder.addPropertyReference(propertyName, beanReference); } }
java
public static void setPropertyReference(BeanDefinitionBuilder builder, String beanReference, String propertyName) { if (StringUtils.hasText(beanReference)) { builder.addPropertyReference(propertyName, beanReference); } }
[ "public", "static", "void", "setPropertyReference", "(", "BeanDefinitionBuilder", "builder", ",", "String", "beanReference", ",", "String", "propertyName", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "beanReference", ")", ")", "{", "builder", ".", "...
Sets the property reference on bean definition in case reference is set properly. @param builder the bean definition builder to be configured @param beanReference bean reference to populate the property @param propertyName the name of the property
[ "Sets", "the", "property", "reference", "on", "bean", "definition", "in", "case", "reference", "is", "set", "properly", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L75-L79
h2oai/h2o-3
h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostScoreTask.java
XGBoostScoreTask.createMetricsBuilder
private ModelMetrics.MetricBuilder createMetricsBuilder(final int responseClassesNum, final String[] responseDomain) { switch (responseClassesNum) { case 1: return new ModelMetricsRegression.MetricBuilderRegression(); case 2: return new ModelMetricsBinomial.MetricBuilderBinomial(responseDomain); default: return new ModelMetricsMultinomial.MetricBuilderMultinomial(responseClassesNum, responseDomain); } }
java
private ModelMetrics.MetricBuilder createMetricsBuilder(final int responseClassesNum, final String[] responseDomain) { switch (responseClassesNum) { case 1: return new ModelMetricsRegression.MetricBuilderRegression(); case 2: return new ModelMetricsBinomial.MetricBuilderBinomial(responseDomain); default: return new ModelMetricsMultinomial.MetricBuilderMultinomial(responseClassesNum, responseDomain); } }
[ "private", "ModelMetrics", ".", "MetricBuilder", "createMetricsBuilder", "(", "final", "int", "responseClassesNum", ",", "final", "String", "[", "]", "responseDomain", ")", "{", "switch", "(", "responseClassesNum", ")", "{", "case", "1", ":", "return", "new", "M...
Constructs a MetricBuilder for this XGBoostScoreTask based on parameters of response variable @param responseClassesNum Number of classes found in response variable @param responseDomain Specific domains in response variable @return An instance of {@link hex.ModelMetrics.MetricBuilder} corresponding to given response variable type
[ "Constructs", "a", "MetricBuilder", "for", "this", "XGBoostScoreTask", "based", "on", "parameters", "of", "response", "variable" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostScoreTask.java#L134-L143
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java
AbstractWComponent.collateVisible
private static void collateVisible(final WComponent component, final List<WComponent> list) { if (component.isVisible()) { if (component instanceof Container) { final int size = ((Container) component).getChildCount(); for (int i = 0; i < size; i++) { collateVisible(((Container) component).getChildAt(i), list); } } list.add(component); } }
java
private static void collateVisible(final WComponent component, final List<WComponent> list) { if (component.isVisible()) { if (component instanceof Container) { final int size = ((Container) component).getChildCount(); for (int i = 0; i < size; i++) { collateVisible(((Container) component).getChildAt(i), list); } } list.add(component); } }
[ "private", "static", "void", "collateVisible", "(", "final", "WComponent", "component", ",", "final", "List", "<", "WComponent", ">", "list", ")", "{", "if", "(", "component", ".", "isVisible", "(", ")", ")", "{", "if", "(", "component", "instanceof", "Con...
Collates all the visible components in this branch of the WComponent tree. WComponents are added to the <code>list</code> in depth-first order, as this list is traversed in order during the request handling phase. @param component the current branch to collate visible items in. @param list the list to add the visible components to.
[ "Collates", "all", "the", "visible", "components", "in", "this", "branch", "of", "the", "WComponent", "tree", ".", "WComponents", "are", "added", "to", "the", "<code", ">", "list<", "/", "code", ">", "in", "depth", "-", "first", "order", "as", "this", "l...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java#L434-L448
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java
BCrypt.encode_base64
private static String encode_base64(byte d[], int len) throws IllegalArgumentException { int off = 0; StringBuilder rs = new StringBuilder(); int c1, c2; if (len <= 0 || len > d.length) { throw new IllegalArgumentException("Invalid len"); } while (off < len) { c1 = d[off++] & 0xff; rs.append(base64_code[(c1 >> 2) & 0x3f]); c1 = (c1 & 0x03) << 4; if (off >= len) { rs.append(base64_code[c1 & 0x3f]); break; } c2 = d[off++] & 0xff; c1 |= (c2 >> 4) & 0x0f; rs.append(base64_code[c1 & 0x3f]); c1 = (c2 & 0x0f) << 2; if (off >= len) { rs.append(base64_code[c1 & 0x3f]); break; } c2 = d[off++] & 0xff; c1 |= (c2 >> 6) & 0x03; rs.append(base64_code[c1 & 0x3f]); rs.append(base64_code[c2 & 0x3f]); } return rs.toString(); }
java
private static String encode_base64(byte d[], int len) throws IllegalArgumentException { int off = 0; StringBuilder rs = new StringBuilder(); int c1, c2; if (len <= 0 || len > d.length) { throw new IllegalArgumentException("Invalid len"); } while (off < len) { c1 = d[off++] & 0xff; rs.append(base64_code[(c1 >> 2) & 0x3f]); c1 = (c1 & 0x03) << 4; if (off >= len) { rs.append(base64_code[c1 & 0x3f]); break; } c2 = d[off++] & 0xff; c1 |= (c2 >> 4) & 0x0f; rs.append(base64_code[c1 & 0x3f]); c1 = (c2 & 0x0f) << 2; if (off >= len) { rs.append(base64_code[c1 & 0x3f]); break; } c2 = d[off++] & 0xff; c1 |= (c2 >> 6) & 0x03; rs.append(base64_code[c1 & 0x3f]); rs.append(base64_code[c2 & 0x3f]); } return rs.toString(); }
[ "private", "static", "String", "encode_base64", "(", "byte", "d", "[", "]", ",", "int", "len", ")", "throws", "IllegalArgumentException", "{", "int", "off", "=", "0", ";", "StringBuilder", "rs", "=", "new", "StringBuilder", "(", ")", ";", "int", "c1", ",...
Encode a byte array using bcrypt's slightly-modified base64 encoding scheme. Note that this is *not* compatible with the standard MIME-base64 encoding. @param d the byte array to encode @param len the number of bytes to encode @return base64-encoded string @exception IllegalArgumentException if the length is invalid
[ "Encode", "a", "byte", "array", "using", "bcrypt", "s", "slightly", "-", "modified", "base64", "encoding", "scheme", ".", "Note", "that", "this", "is", "*", "not", "*", "compatible", "with", "the", "standard", "MIME", "-", "base64", "encoding", "." ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java#L382-L414
codeprimate-software/cp-elements
src/main/java/org/cp/elements/io/FileSystemUtils.java
FileSystemUtils.appendToPath
public static String appendToPath(String basePath, String... pathElements) { Assert.notNull(basePath, "basePath cannot be null"); String fileSeparator = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR : File.separator); for (String pathElement : ArrayUtils.nullSafeArray(pathElements, String.class)) { if (StringUtils.hasText(pathElement)) { basePath = String.format("%1$s%2$s%3$s", basePath.trim(), fileSeparator, pathElement.trim()); } } String fileSeparatorPattern = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR_PATTERN : UNIX_FILE_SEPARATOR_PATTERN); return basePath.trim().replaceAll(fileSeparatorPattern, fileSeparator); }
java
public static String appendToPath(String basePath, String... pathElements) { Assert.notNull(basePath, "basePath cannot be null"); String fileSeparator = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR : File.separator); for (String pathElement : ArrayUtils.nullSafeArray(pathElements, String.class)) { if (StringUtils.hasText(pathElement)) { basePath = String.format("%1$s%2$s%3$s", basePath.trim(), fileSeparator, pathElement.trim()); } } String fileSeparatorPattern = (SystemUtils.isWindows() ? WINDOWS_FILE_SEPARATOR_PATTERN : UNIX_FILE_SEPARATOR_PATTERN); return basePath.trim().replaceAll(fileSeparatorPattern, fileSeparator); }
[ "public", "static", "String", "appendToPath", "(", "String", "basePath", ",", "String", "...", "pathElements", ")", "{", "Assert", ".", "notNull", "(", "basePath", ",", "\"basePath cannot be null\"", ")", ";", "String", "fileSeparator", "=", "(", "SystemUtils", ...
Creates a file system path by appending the array of path elements to the base path separated by {@link File#separator}. If the array of path elements is null or empty then base path is returned. @param basePath base of the file system path expressed as a pathname {@link String}. @param pathElements array of path elements to append to the base path. @return the path elements appended to the base path separated by {@link File#separator}. @throws NullPointerException if basePath is null. @see java.io.File#separator
[ "Creates", "a", "file", "system", "path", "by", "appending", "the", "array", "of", "path", "elements", "to", "the", "base", "path", "separated", "by", "{", "@link", "File#separator", "}", ".", "If", "the", "array", "of", "path", "elements", "is", "null", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/io/FileSystemUtils.java#L72-L87
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/net/URLUtil.java
URLUtil.getQueryParams
public static Map<String, String> getQueryParams(String uri, String encoding) throws URISyntaxException, UnsupportedEncodingException{ if(encoding==null) encoding = IOUtil.UTF_8.name(); String query = new URI(uri).getRawQuery(); Map<String, String> map = new HashMap<String, String>(); StringTokenizer params = new StringTokenizer(query, "&;"); while(params.hasMoreTokens()){ String param = params.nextToken(); int equal = param.indexOf('='); String name = param.substring(0, equal); String value = param.substring(equal+1); name = URLDecoder.decode(name, encoding); value = URLDecoder.decode(value, encoding); map.put(name, value); } return map; }
java
public static Map<String, String> getQueryParams(String uri, String encoding) throws URISyntaxException, UnsupportedEncodingException{ if(encoding==null) encoding = IOUtil.UTF_8.name(); String query = new URI(uri).getRawQuery(); Map<String, String> map = new HashMap<String, String>(); StringTokenizer params = new StringTokenizer(query, "&;"); while(params.hasMoreTokens()){ String param = params.nextToken(); int equal = param.indexOf('='); String name = param.substring(0, equal); String value = param.substring(equal+1); name = URLDecoder.decode(name, encoding); value = URLDecoder.decode(value, encoding); map.put(name, value); } return map; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "getQueryParams", "(", "String", "uri", ",", "String", "encoding", ")", "throws", "URISyntaxException", ",", "UnsupportedEncodingException", "{", "if", "(", "encoding", "==", "null", ")", "encoding", ...
returns Query Parameters in specified uri as <code>Map</code>. key will be param name and value wil be param value. @param uri The string to be parsed into a URI @param encoding if null, <code>UTF-8</code> will be used @throws URISyntaxException in case of invalid uri @throws UnsupportedEncodingException if named character encoding is not supported
[ "returns", "Query", "Parameters", "in", "specified", "uri", "as", "<code", ">", "Map<", "/", "code", ">", ".", "key", "will", "be", "param", "name", "and", "value", "wil", "be", "param", "value", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/net/URLUtil.java#L110-L127
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java
JQLChecker.extractPlaceHoldersFromVariableStatement
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) { final One<Boolean> valid = new One<>(); if (!StringUtils.hasText(jql)) return result; valid.value0 = false; analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() { @Override public void enterBind_parameter(Bind_parameterContext ctx) { String parameter; if (ctx.bind_parameter_name() != null) { parameter = ctx.bind_parameter_name().getText(); } else { parameter = ctx.getText(); } result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter)); } @Override public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) { result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText())); } }); return result; }
java
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) { final One<Boolean> valid = new One<>(); if (!StringUtils.hasText(jql)) return result; valid.value0 = false; analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() { @Override public void enterBind_parameter(Bind_parameterContext ctx) { String parameter; if (ctx.bind_parameter_name() != null) { parameter = ctx.bind_parameter_name().getText(); } else { parameter = ctx.getText(); } result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter)); } @Override public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) { result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText())); } }); return result; }
[ "private", "<", "L", "extends", "Collection", "<", "JQLPlaceHolder", ">", ">", "L", "extractPlaceHoldersFromVariableStatement", "(", "final", "JQLContext", "jqlContext", ",", "String", "jql", ",", "final", "L", "result", ")", "{", "final", "One", "<", "Boolean",...
Extract place holders from variable statement. @param <L> the generic type @param jqlContext the jql context @param jql the jql @param result the result @return the l
[ "Extract", "place", "holders", "from", "variable", "statement", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L915-L943
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.getBeanForField
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final Object getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) { FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex); instrumentAnnotationMetadata(context, injectionPoint); return getBeanForField(resolutionContext, context, injectionPoint); }
java
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final Object getBeanForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) { FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex); instrumentAnnotationMetadata(context, injectionPoint); return getBeanForField(resolutionContext, context, injectionPoint); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "Object", "getBeanForField", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ",", "int", "fieldIndex", ")", "{", "Fiel...
Obtains a bean definition for the field at the given index and the argument at the given index <p> Warning: this method is used by internal generated code and should not be called by user code. @param resolutionContext The resolution context @param context The context @param fieldIndex The field index @return The resolved bean
[ "Obtains", "a", "bean", "definition", "for", "the", "field", "at", "the", "given", "index", "and", "the", "argument", "at", "the", "given", "index", "<p", ">", "Warning", ":", "this", "method", "is", "used", "by", "internal", "generated", "code", "and", ...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1142-L1149
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphGenerator.java
GraphGenerator.generateGraph
public <E> ObjectGraph generateGraph(E entity, PersistenceDelegator delegator, NodeState state) { this.builder.assign(this); Node node = generate(entity, delegator, delegator.getPersistenceCache(), state); this.builder.assignHeadNode(node); return this.builder.getGraph(); }
java
public <E> ObjectGraph generateGraph(E entity, PersistenceDelegator delegator, NodeState state) { this.builder.assign(this); Node node = generate(entity, delegator, delegator.getPersistenceCache(), state); this.builder.assignHeadNode(node); return this.builder.getGraph(); }
[ "public", "<", "E", ">", "ObjectGraph", "generateGraph", "(", "E", "entity", ",", "PersistenceDelegator", "delegator", ",", "NodeState", "state", ")", "{", "this", ".", "builder", ".", "assign", "(", "this", ")", ";", "Node", "node", "=", "generate", "(", ...
Generate entity graph and returns after assigning headnode. n @param entity entity. @param delegator delegator @param pc persistence cache @return object graph.
[ "Generate", "entity", "graph", "and", "returns", "after", "assigning", "headnode", ".", "n" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphGenerator.java#L98-L105
paypal/SeLion
server/src/main/java/com/paypal/selion/pojos/BrowserStatisticsCollection.java
BrowserStatisticsCollection.setMaxBrowserInstances
public void setMaxBrowserInstances(String browserName, int maxBrowserInstances) { logger.entering(new Object[] { browserName, maxBrowserInstances }); validateBrowserName(browserName); BrowserStatistics lStatistics = createStatisticsIfNotPresent(browserName); lStatistics.setMaxBrowserInstances(maxBrowserInstances); logger.exiting(); }
java
public void setMaxBrowserInstances(String browserName, int maxBrowserInstances) { logger.entering(new Object[] { browserName, maxBrowserInstances }); validateBrowserName(browserName); BrowserStatistics lStatistics = createStatisticsIfNotPresent(browserName); lStatistics.setMaxBrowserInstances(maxBrowserInstances); logger.exiting(); }
[ "public", "void", "setMaxBrowserInstances", "(", "String", "browserName", ",", "int", "maxBrowserInstances", ")", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "browserName", ",", "maxBrowserInstances", "}", ")", ";", "validateBrowserName", ...
Sets the maximum instances for a particular browser. This call creates a unique statistics for the provided browser name it does not exists. @param browserName Name of the browser. @param maxBrowserInstances Maximum instances of the browser.
[ "Sets", "the", "maximum", "instances", "for", "a", "particular", "browser", ".", "This", "call", "creates", "a", "unique", "statistics", "for", "the", "provided", "browser", "name", "it", "does", "not", "exists", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/pojos/BrowserStatisticsCollection.java#L61-L67
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java
JBBPOut.BeginBin
public static JBBPOut BeginBin(final OutputStream out, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) { return new JBBPOut(out, byteOrder, bitOrder); }
java
public static JBBPOut BeginBin(final OutputStream out, final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) { return new JBBPOut(out, byteOrder, bitOrder); }
[ "public", "static", "JBBPOut", "BeginBin", "(", "final", "OutputStream", "out", ",", "final", "JBBPByteOrder", "byteOrder", ",", "final", "JBBPBitOrder", "bitOrder", ")", "{", "return", "new", "JBBPOut", "(", "out", ",", "byteOrder", ",", "bitOrder", ")", ";",...
Start a DSL session for a defined stream with defined parameters. @param out the defined stream @param byteOrder the byte outOrder for the session @param bitOrder the bit outOrder for the session @return the new DSL session generated for the stream with parameters
[ "Start", "a", "DSL", "session", "for", "a", "defined", "stream", "with", "defined", "parameters", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L119-L121
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.updateSubscription
public Subscription updateSubscription(final String uuid, final SubscriptionUpdate subscriptionUpdate) { return doPUT(Subscriptions.SUBSCRIPTIONS_RESOURCE + "/" + uuid, subscriptionUpdate, Subscription.class); }
java
public Subscription updateSubscription(final String uuid, final SubscriptionUpdate subscriptionUpdate) { return doPUT(Subscriptions.SUBSCRIPTIONS_RESOURCE + "/" + uuid, subscriptionUpdate, Subscription.class); }
[ "public", "Subscription", "updateSubscription", "(", "final", "String", "uuid", ",", "final", "SubscriptionUpdate", "subscriptionUpdate", ")", "{", "return", "doPUT", "(", "Subscriptions", ".", "SUBSCRIPTIONS_RESOURCE", "+", "\"/\"", "+", "uuid", ",", "subscriptionUpd...
Update a particular {@link Subscription} by it's UUID <p> Returns information about a single subscription. @param uuid UUID of the subscription to update @param subscriptionUpdate subscriptionUpdate object @return Subscription the updated subscription
[ "Update", "a", "particular", "{", "@link", "Subscription", "}", "by", "it", "s", "UUID", "<p", ">", "Returns", "information", "about", "a", "single", "subscription", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L588-L593
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java
LdapHelper.cloneAttribute
public static Attribute cloneAttribute(String newAttrName, Attribute attr) throws WIMSystemException { Attribute newAttr = new BasicAttribute(newAttrName); try { for (NamingEnumeration<?> neu = attr.getAll(); neu.hasMoreElements();) { newAttr.add(neu.nextElement()); } } catch (NamingException e) { throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)))); } return newAttr; }
java
public static Attribute cloneAttribute(String newAttrName, Attribute attr) throws WIMSystemException { Attribute newAttr = new BasicAttribute(newAttrName); try { for (NamingEnumeration<?> neu = attr.getAll(); neu.hasMoreElements();) { newAttr.add(neu.nextElement()); } } catch (NamingException e) { throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)))); } return newAttr; }
[ "public", "static", "Attribute", "cloneAttribute", "(", "String", "newAttrName", ",", "Attribute", "attr", ")", "throws", "WIMSystemException", "{", "Attribute", "newAttr", "=", "new", "BasicAttribute", "(", "newAttrName", ")", ";", "try", "{", "for", "(", "Nami...
Clone the specified attribute with a new name. @param newAttrName The new name of the attribute @param attr The Attribute object to be cloned. @return The cloned Attribute object with the new name. @throws WIMSystemException
[ "Clone", "the", "specified", "attribute", "with", "a", "new", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java#L898-L908
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java
VisualizationUtils.getTrajectoryChart
public static Chart getTrajectoryChart(String title, Trajectory t){ if(t.getDimension()==2){ double[] xData = new double[t.size()]; double[] yData = new double[t.size()]; for(int i = 0; i < t.size(); i++){ xData[i] = t.get(i).x; yData[i] = t.get(i).y; } // Create Chart Chart chart = QuickChart.getChart(title, "X", "Y", "y(x)", xData, yData); return chart; //Show it // SwingWrapper swr = new SwingWrapper(chart); // swr.displayChart(); } return null; }
java
public static Chart getTrajectoryChart(String title, Trajectory t){ if(t.getDimension()==2){ double[] xData = new double[t.size()]; double[] yData = new double[t.size()]; for(int i = 0; i < t.size(); i++){ xData[i] = t.get(i).x; yData[i] = t.get(i).y; } // Create Chart Chart chart = QuickChart.getChart(title, "X", "Y", "y(x)", xData, yData); return chart; //Show it // SwingWrapper swr = new SwingWrapper(chart); // swr.displayChart(); } return null; }
[ "public", "static", "Chart", "getTrajectoryChart", "(", "String", "title", ",", "Trajectory", "t", ")", "{", "if", "(", "t", ".", "getDimension", "(", ")", "==", "2", ")", "{", "double", "[", "]", "xData", "=", "new", "double", "[", "t", ".", "size",...
Plots the trajectory @param title Title of the plot @param t Trajectory to be plotted
[ "Plots", "the", "trajectory" ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L56-L74
xebia-france/xebia-management-extras
src/main/java/fr/xebia/management/statistics/ServiceStatistics.java
ServiceStatistics.containsThrowableOfType
public static boolean containsThrowableOfType(Throwable throwable, Class<?>... throwableTypes) { List<Throwable> alreadyProcessedThrowables = new ArrayList<Throwable>(); while (true) { if (throwable == null) { // end of the list of causes return false; } else if (alreadyProcessedThrowables.contains(throwable)) { // infinite loop in causes return false; } else { for (Class<?> throwableType : throwableTypes) { if (throwableType.isAssignableFrom(throwable.getClass())) { return true; } } alreadyProcessedThrowables.add(throwable); throwable = throwable.getCause(); } } }
java
public static boolean containsThrowableOfType(Throwable throwable, Class<?>... throwableTypes) { List<Throwable> alreadyProcessedThrowables = new ArrayList<Throwable>(); while (true) { if (throwable == null) { // end of the list of causes return false; } else if (alreadyProcessedThrowables.contains(throwable)) { // infinite loop in causes return false; } else { for (Class<?> throwableType : throwableTypes) { if (throwableType.isAssignableFrom(throwable.getClass())) { return true; } } alreadyProcessedThrowables.add(throwable); throwable = throwable.getCause(); } } }
[ "public", "static", "boolean", "containsThrowableOfType", "(", "Throwable", "throwable", ",", "Class", "<", "?", ">", "...", "throwableTypes", ")", "{", "List", "<", "Throwable", ">", "alreadyProcessedThrowables", "=", "new", "ArrayList", "<", "Throwable", ">", ...
Returns <code>true</code> if the given <code>throwable</code> or one of its cause is an instance of one of the given <code>throwableTypes</code>.
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "given", "<code", ">", "throwable<", "/", "code", ">", "or", "one", "of", "its", "cause", "is", "an", "instance", "of", "one", "of", "the", "given", "<code", ">", "throwableTypes<", "/", ...
train
https://github.com/xebia-france/xebia-management-extras/blob/09f52a0ddb898e402a04f0adfacda74a5d0556e8/src/main/java/fr/xebia/management/statistics/ServiceStatistics.java#L42-L61
raphw/byte-buddy
byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java
ClassByImplementationBenchmark.benchmarkCglib
@Benchmark public ExampleInterface benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); CallbackHelper callbackHelper = new CallbackHelper(Object.class, new Class[]{baseClass}) { protected Object getCallback(Method method) { if (method.getDeclaringClass() == baseClass) { return new FixedValue() { public Object loadObject() { return null; } }; } else { return NoOp.INSTANCE; } } }; enhancer.setCallbackFilter(callbackHelper); enhancer.setCallbacks(callbackHelper.getCallbacks()); return (ExampleInterface) enhancer.create(); }
java
@Benchmark public ExampleInterface benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); CallbackHelper callbackHelper = new CallbackHelper(Object.class, new Class[]{baseClass}) { protected Object getCallback(Method method) { if (method.getDeclaringClass() == baseClass) { return new FixedValue() { public Object loadObject() { return null; } }; } else { return NoOp.INSTANCE; } } }; enhancer.setCallbackFilter(callbackHelper); enhancer.setCallbacks(callbackHelper.getCallbacks()); return (ExampleInterface) enhancer.create(); }
[ "@", "Benchmark", "public", "ExampleInterface", "benchmarkCglib", "(", ")", "{", "Enhancer", "enhancer", "=", "new", "Enhancer", "(", ")", ";", "enhancer", ".", "setUseCache", "(", "false", ")", ";", "enhancer", ".", "setClassLoader", "(", "newClassLoader", "(...
Performs a benchmark of an interface implementation using cglib. @return The created instance, in order to avoid JIT removal.
[ "Performs", "a", "benchmark", "of", "an", "interface", "implementation", "using", "cglib", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-benchmark/src/main/java/net/bytebuddy/benchmark/ClassByImplementationBenchmark.java#L319-L341
opencb/java-common-libs
commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/GenericDocumentComplexConverter.java
GenericDocumentComplexConverter.replaceDots
public static Document replaceDots(Document document) { return modifyKeys(document, key -> key.replace(".", TO_REPLACE_DOTS), "."); }
java
public static Document replaceDots(Document document) { return modifyKeys(document, key -> key.replace(".", TO_REPLACE_DOTS), "."); }
[ "public", "static", "Document", "replaceDots", "(", "Document", "document", ")", "{", "return", "modifyKeys", "(", "document", ",", "key", "->", "key", ".", "replace", "(", "\".\"", ",", "TO_REPLACE_DOTS", ")", ",", "\".\"", ")", ";", "}" ]
Replace all the dots in the keys with {@link #TO_REPLACE_DOTS}. MongoDB is not able to store dots in key fields. @param document Document to modify @return Document modified
[ "Replace", "all", "the", "dots", "in", "the", "keys", "with", "{", "@link", "#TO_REPLACE_DOTS", "}", "." ]
train
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/GenericDocumentComplexConverter.java#L109-L111
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/RepositoryConfigUtils.java
RepositoryConfigUtils.setProxyAuthenticator
public static void setProxyAuthenticator(final String proxyHost, final String proxyPort, final String proxyUser, final String decodedPwd) { if (proxyUser == null || proxyUser.isEmpty() || decodedPwd == null || decodedPwd.isEmpty()) { return; } //Authenticate proxy credentials Authenticator.setDefault(new Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { if (getRequestorType() == RequestorType.PROXY) { if (getRequestingHost().equals(proxyHost) && getRequestingPort() == Integer.valueOf(proxyPort)) { return new PasswordAuthentication(proxyUser, decodedPwd.toCharArray()); } } return null; } }); }
java
public static void setProxyAuthenticator(final String proxyHost, final String proxyPort, final String proxyUser, final String decodedPwd) { if (proxyUser == null || proxyUser.isEmpty() || decodedPwd == null || decodedPwd.isEmpty()) { return; } //Authenticate proxy credentials Authenticator.setDefault(new Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { if (getRequestorType() == RequestorType.PROXY) { if (getRequestingHost().equals(proxyHost) && getRequestingPort() == Integer.valueOf(proxyPort)) { return new PasswordAuthentication(proxyUser, decodedPwd.toCharArray()); } } return null; } }); }
[ "public", "static", "void", "setProxyAuthenticator", "(", "final", "String", "proxyHost", ",", "final", "String", "proxyPort", ",", "final", "String", "proxyUser", ",", "final", "String", "decodedPwd", ")", "{", "if", "(", "proxyUser", "==", "null", "||", "pro...
Set Proxy Authenticator Default @param proxyHost The proxy host @param proxyPort The proxy port @param proxyUser the proxy username @param decodedPwd the proxy password decoded
[ "Set", "Proxy", "Authenticator", "Default" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/RepositoryConfigUtils.java#L131-L147
dropbox/dropbox-sdk-java
examples/longpoll/src/main/java/com/dropbox/core/examples/longpoll/Main.java
Main.createClient
private static DbxClientV2 createClient(DbxAuthInfo auth, StandardHttpRequestor.Config config) { String clientUserAgentId = "examples-longpoll"; StandardHttpRequestor requestor = new StandardHttpRequestor(config); DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder(clientUserAgentId) .withHttpRequestor(requestor) .build(); return new DbxClientV2(requestConfig, auth.getAccessToken(), auth.getHost()); }
java
private static DbxClientV2 createClient(DbxAuthInfo auth, StandardHttpRequestor.Config config) { String clientUserAgentId = "examples-longpoll"; StandardHttpRequestor requestor = new StandardHttpRequestor(config); DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder(clientUserAgentId) .withHttpRequestor(requestor) .build(); return new DbxClientV2(requestConfig, auth.getAccessToken(), auth.getHost()); }
[ "private", "static", "DbxClientV2", "createClient", "(", "DbxAuthInfo", "auth", ",", "StandardHttpRequestor", ".", "Config", "config", ")", "{", "String", "clientUserAgentId", "=", "\"examples-longpoll\"", ";", "StandardHttpRequestor", "requestor", "=", "new", "Standard...
Create a new Dropbox client using the given authentication information and HTTP client config. @param auth Authentication information @param config HTTP request configuration @return new Dropbox V2 client
[ "Create", "a", "new", "Dropbox", "client", "using", "the", "given", "authentication", "information", "and", "HTTP", "client", "config", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/examples/longpoll/src/main/java/com/dropbox/core/examples/longpoll/Main.java#L110-L118
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/SmartsheetFactory.java
SmartsheetFactory.createDefaultClient
public static Smartsheet createDefaultClient(String accessToken) { SmartsheetImpl smartsheet = new SmartsheetImpl(DEFAULT_BASE_URI, accessToken); return smartsheet; }
java
public static Smartsheet createDefaultClient(String accessToken) { SmartsheetImpl smartsheet = new SmartsheetImpl(DEFAULT_BASE_URI, accessToken); return smartsheet; }
[ "public", "static", "Smartsheet", "createDefaultClient", "(", "String", "accessToken", ")", "{", "SmartsheetImpl", "smartsheet", "=", "new", "SmartsheetImpl", "(", "DEFAULT_BASE_URI", ",", "accessToken", ")", ";", "return", "smartsheet", ";", "}" ]
<p>Creates a Smartsheet client with default parameters.</p> @param accessToken @return the Smartsheet client
[ "<p", ">", "Creates", "a", "Smartsheet", "client", "with", "default", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/SmartsheetFactory.java#L60-L63
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeMarkInterior
private Shape decodeMarkInterior(int width, int height) { int left = (width - 3) / 2 - 5; int top = (height - 2) / 2 - 5; path.reset(); path.moveTo(left + 1, top + 1); path.lineTo(left + 4, top + 1); path.lineTo(left + 5, top + 3); path.lineTo(left + 7, top + 1); path.lineTo(left + 10, top + 1); path.lineTo(left + 7, top + 4); path.lineTo(left + 7, top + 5); path.lineTo(left + 10, top + 9); path.lineTo(left + 6, top + 8); path.lineTo(left + 5, top + 6); path.lineTo(left + 4, top + 9); path.lineTo(left + 0, top + 9); path.lineTo(left + 4, top + 5); path.lineTo(left + 4, top + 4); path.closePath(); return path; }
java
private Shape decodeMarkInterior(int width, int height) { int left = (width - 3) / 2 - 5; int top = (height - 2) / 2 - 5; path.reset(); path.moveTo(left + 1, top + 1); path.lineTo(left + 4, top + 1); path.lineTo(left + 5, top + 3); path.lineTo(left + 7, top + 1); path.lineTo(left + 10, top + 1); path.lineTo(left + 7, top + 4); path.lineTo(left + 7, top + 5); path.lineTo(left + 10, top + 9); path.lineTo(left + 6, top + 8); path.lineTo(left + 5, top + 6); path.lineTo(left + 4, top + 9); path.lineTo(left + 0, top + 9); path.lineTo(left + 4, top + 5); path.lineTo(left + 4, top + 4); path.closePath(); return path; }
[ "private", "Shape", "decodeMarkInterior", "(", "int", "width", ",", "int", "height", ")", "{", "int", "left", "=", "(", "width", "-", "3", ")", "/", "2", "-", "5", ";", "int", "top", "=", "(", "height", "-", "2", ")", "/", "2", "-", "5", ";", ...
Create the shape for the mark interior. @param width the width. @param height the height. @return the shape of the mark interior.
[ "Create", "the", "shape", "for", "the", "mark", "interior", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L305-L327
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/watermark/TimestampWatermark.java
TimestampWatermark.getInterval
private static int getInterval(long diffInMilliSecs, long hourInterval, int maxIntervals) { long totalHours = DoubleMath.roundToInt((double) diffInMilliSecs / (60 * 60 * 1000), RoundingMode.CEILING); long totalIntervals = DoubleMath.roundToInt((double) totalHours / hourInterval, RoundingMode.CEILING); if (totalIntervals > maxIntervals) { hourInterval = DoubleMath.roundToInt((double) totalHours / maxIntervals, RoundingMode.CEILING); } return Ints.checkedCast(hourInterval); }
java
private static int getInterval(long diffInMilliSecs, long hourInterval, int maxIntervals) { long totalHours = DoubleMath.roundToInt((double) diffInMilliSecs / (60 * 60 * 1000), RoundingMode.CEILING); long totalIntervals = DoubleMath.roundToInt((double) totalHours / hourInterval, RoundingMode.CEILING); if (totalIntervals > maxIntervals) { hourInterval = DoubleMath.roundToInt((double) totalHours / maxIntervals, RoundingMode.CEILING); } return Ints.checkedCast(hourInterval); }
[ "private", "static", "int", "getInterval", "(", "long", "diffInMilliSecs", ",", "long", "hourInterval", ",", "int", "maxIntervals", ")", "{", "long", "totalHours", "=", "DoubleMath", ".", "roundToInt", "(", "(", "double", ")", "diffInMilliSecs", "/", "(", "60"...
recalculate interval(in hours) if total number of partitions greater than maximum number of allowed partitions @param diffInMilliSecs difference in range @param hourInterval hour interval (ex: 4 hours) @param maxIntervals max number of allowed partitions @return calculated interval in hours
[ "recalculate", "interval", "(", "in", "hours", ")", "if", "total", "number", "of", "partitions", "greater", "than", "maximum", "number", "of", "allowed", "partitions" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/watermark/TimestampWatermark.java#L125-L133
ManfredTremmel/gwt-bean-validators
gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/ObjectUtils.java
ObjectUtils.nullSafeEquals
public static boolean nullSafeEquals(@Nullable final Object o1, @Nullable final Object o2) { if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (o1.equals(o2)) { return true; } if (o1.getClass().isArray() && o2.getClass().isArray()) { return ObjectUtils.arrayEquals(o1, o2); } return false; }
java
public static boolean nullSafeEquals(@Nullable final Object o1, @Nullable final Object o2) { if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (o1.equals(o2)) { return true; } if (o1.getClass().isArray() && o2.getClass().isArray()) { return ObjectUtils.arrayEquals(o1, o2); } return false; }
[ "public", "static", "boolean", "nullSafeEquals", "(", "@", "Nullable", "final", "Object", "o1", ",", "@", "Nullable", "final", "Object", "o2", ")", "{", "if", "(", "o1", "==", "o2", ")", "{", "return", "true", ";", "}", "if", "(", "o1", "==", "null",...
Determine if the given objects are equal, returning {@code true} if both are {@code null} or {@code false} if only one is {@code null}. <p> Compares arrays with {@code Arrays.equals}, performing an equality check based on the array elements rather than the array reference. @param o1 first Object to compare @param o2 second Object to compare @return whether the given objects are equal @see Object#equals(Object) @see java.util.Arrays#equals
[ "Determine", "if", "the", "given", "objects", "are", "equal", "returning", "{", "@code", "true", "}", "if", "both", "are", "{", "@code", "null", "}", "or", "{", "@code", "false", "}", "if", "only", "one", "is", "{", "@code", "null", "}", ".", "<p", ...
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/ObjectUtils.java#L338-L352
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseScsr2csr_compress
public static int cusparseScsr2csr_compress( cusparseHandle handle, int m, int n, cusparseMatDescr descrA, Pointer csrSortedValA, Pointer csrSortedColIndA, Pointer csrSortedRowPtrA, int nnzA, Pointer nnzPerRow, Pointer csrSortedValC, Pointer csrSortedColIndC, Pointer csrSortedRowPtrC, float tol) { return checkResult(cusparseScsr2csr_compressNative(handle, m, n, descrA, csrSortedValA, csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, csrSortedValC, csrSortedColIndC, csrSortedRowPtrC, tol)); }
java
public static int cusparseScsr2csr_compress( cusparseHandle handle, int m, int n, cusparseMatDescr descrA, Pointer csrSortedValA, Pointer csrSortedColIndA, Pointer csrSortedRowPtrA, int nnzA, Pointer nnzPerRow, Pointer csrSortedValC, Pointer csrSortedColIndC, Pointer csrSortedRowPtrC, float tol) { return checkResult(cusparseScsr2csr_compressNative(handle, m, n, descrA, csrSortedValA, csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, csrSortedValC, csrSortedColIndC, csrSortedRowPtrC, tol)); }
[ "public", "static", "int", "cusparseScsr2csr_compress", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "int", "n", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "csrSortedValA", ",", "Pointer", "csrSortedColIndA", ",", "Pointer", "csrSortedRowPtrA", ","...
Description: This routine takes as input a csr form and compresses it to return a compressed csr form
[ "Description", ":", "This", "routine", "takes", "as", "input", "a", "csr", "form", "and", "compresses", "it", "to", "return", "a", "compressed", "csr", "form" ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L11039-L11055
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.checkCredentials
@Override public boolean checkCredentials(final String uid, final String password) { StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(","); sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(","); sb.append(baseDn); if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) { return false; } try { Hashtable<String,String> environment = (Hashtable<String,String>) ctx.getEnvironment().clone(); environment.put(Context.SECURITY_PRINCIPAL, sb.toString()); environment.put(Context.SECURITY_CREDENTIALS, password); DirContext dirContext = new InitialDirContext(environment); dirContext.close(); validationCount++; return true; } catch (NamingException ex) { handleNamingException("NamingException " + ex.getLocalizedMessage() + "\n", ex); } return false; }
java
@Override public boolean checkCredentials(final String uid, final String password) { StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(","); sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(","); sb.append(baseDn); if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) { return false; } try { Hashtable<String,String> environment = (Hashtable<String,String>) ctx.getEnvironment().clone(); environment.put(Context.SECURITY_PRINCIPAL, sb.toString()); environment.put(Context.SECURITY_CREDENTIALS, password); DirContext dirContext = new InitialDirContext(environment); dirContext.close(); validationCount++; return true; } catch (NamingException ex) { handleNamingException("NamingException " + ex.getLocalizedMessage() + "\n", ex); } return false; }
[ "@", "Override", "public", "boolean", "checkCredentials", "(", "final", "String", "uid", ",", "final", "String", "password", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "userIdentifyer", "+", "\"=\"", ")", ".", "append", "(", "uid", ")...
We use this method to check the given credentials to be valid. To prevent the check every action call, the result (if true) will be cached for 60s. @param uid the given uid. @param password the given password. @return true if credentials are valid, otherwise false.
[ "We", "use", "this", "method", "to", "check", "the", "given", "credentials", "to", "be", "valid", ".", "To", "prevent", "the", "check", "every", "action", "call", "the", "result", "(", "if", "true", ")", "will", "be", "cached", "for", "60s", "." ]
train
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L590-L610
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java
SecurityServiceImpl.autoDetectService
private <V> V autoDetectService(String serviceName, ConcurrentServiceReferenceMap<String, V> map) { Iterator<V> services = map.getServices(); if (services.hasNext() == false) { Tr.error(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName)); } V service = services.next(); if (services.hasNext()) { Tr.error(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName)); } return service; }
java
private <V> V autoDetectService(String serviceName, ConcurrentServiceReferenceMap<String, V> map) { Iterator<V> services = map.getServices(); if (services.hasNext() == false) { Tr.error(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName)); } V service = services.next(); if (services.hasNext()) { Tr.error(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName); throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName)); } return service; }
[ "private", "<", "V", ">", "V", "autoDetectService", "(", "String", "serviceName", ",", "ConcurrentServiceReferenceMap", "<", "String", ",", "V", ">", "map", ")", "{", "Iterator", "<", "V", ">", "services", "=", "map", ".", "getServices", "(", ")", ";", "...
When the configuration element is not defined, use some "auto-detect" logic to try and return the single Service of a specified field. If there is no service, or multiple services, that is considered an error case which "auto-detect" can not resolve. @param serviceName name of the service @param map ConcurrentServiceReferenceMap of registered services @return id of the single service registered in map. Will not return null.
[ "When", "the", "configuration", "element", "is", "not", "defined", "use", "some", "auto", "-", "detect", "logic", "to", "try", "and", "return", "the", "single", "Service", "of", "a", "specified", "field", ".", "If", "there", "is", "no", "service", "or", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L401-L414
playn/playn
java-base/src/playn/java/JavaGraphics.java
JavaGraphics.registerFont
public void registerFont (String name, java.awt.Font font) { if (font == null) throw new NullPointerException(); fonts.put(name, font); }
java
public void registerFont (String name, java.awt.Font font) { if (font == null) throw new NullPointerException(); fonts.put(name, font); }
[ "public", "void", "registerFont", "(", "String", "name", ",", "java", ".", "awt", ".", "Font", "font", ")", "{", "if", "(", "font", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "fonts", ".", "put", "(", "name", ",", "font...
Registers a font with the graphics system. @param name the name under which to register the font. @param font the Java font, which can be loaded from a path via {@link JavaAssets#getFont}.
[ "Registers", "a", "font", "with", "the", "graphics", "system", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaGraphics.java#L72-L75
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.UByte
public JBBPDslBuilder UByte(final String name) { final Item item = new Item(BinType.UBYTE, name, this.byteOrder); this.addItem(item); return this; }
java
public JBBPDslBuilder UByte(final String name) { final Item item = new Item(BinType.UBYTE, name, this.byteOrder); this.addItem(item); return this; }
[ "public", "JBBPDslBuilder", "UByte", "(", "final", "String", "name", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", "BinType", ".", "UBYTE", ",", "name", ",", "this", ".", "byteOrder", ")", ";", "this", ".", "addItem", "(", "item", ")", ...
Add named unsigned byte field. @param name name of the field, can be null for anonymous one @return the builder instance, must not be null
[ "Add", "named", "unsigned", "byte", "field", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L893-L897
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.memclr
public static void memclr( byte[] array, int offset, int length ) { for( int i = 0; i < length; ++i, ++offset ) array[offset] = 0; }
java
public static void memclr( byte[] array, int offset, int length ) { for( int i = 0; i < length; ++i, ++offset ) array[offset] = 0; }
[ "public", "static", "void", "memclr", "(", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ",", "++", "offset", ")", "array", "[", "offs...
Fill the given array with zeros. @param array the array to clear @param offset the start offset @param length the number of <code>byte</code>s to clear.
[ "Fill", "the", "given", "array", "with", "zeros", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L534-L537
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.deepUnbox
public static Object deepUnbox(Class<?> type, final Object src) { Class<?> compType = type.getComponentType(); if (compType.isArray()) { final Object[] src2 = (Object[]) src; final Object[] result = (Object[]) newArray(compType, src2.length); for (int i = 0; i < src2.length; i++) { result[i] = deepUnbox(compType, src2[i]); } return result; } else { return unboxAll(compType, src, 0, -1); } }
java
public static Object deepUnbox(Class<?> type, final Object src) { Class<?> compType = type.getComponentType(); if (compType.isArray()) { final Object[] src2 = (Object[]) src; final Object[] result = (Object[]) newArray(compType, src2.length); for (int i = 0; i < src2.length; i++) { result[i] = deepUnbox(compType, src2[i]); } return result; } else { return unboxAll(compType, src, 0, -1); } }
[ "public", "static", "Object", "deepUnbox", "(", "Class", "<", "?", ">", "type", ",", "final", "Object", "src", ")", "{", "Class", "<", "?", ">", "compType", "=", "type", ".", "getComponentType", "(", ")", ";", "if", "(", "compType", ".", "isArray", "...
Returns any multidimensional array into an array of primitives. @param type target type @param src source array @return multidimensional array of primitives
[ "Returns", "any", "multidimensional", "array", "into", "an", "array", "of", "primitives", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L683-L695
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java
ClientFactory.createNamedClient
public static synchronized IClient createNamedClient(String name, Class<? extends IClientConfig> configClass) throws ClientException { IClientConfig config = getNamedConfig(name, configClass); return registerClientFromProperties(name, config); }
java
public static synchronized IClient createNamedClient(String name, Class<? extends IClientConfig> configClass) throws ClientException { IClientConfig config = getNamedConfig(name, configClass); return registerClientFromProperties(name, config); }
[ "public", "static", "synchronized", "IClient", "createNamedClient", "(", "String", "name", ",", "Class", "<", "?", "extends", "IClientConfig", ">", "configClass", ")", "throws", "ClientException", "{", "IClientConfig", "config", "=", "getNamedConfig", "(", "name", ...
Creates a named client using a IClientConfig instance created off the configClass class object passed in as the parameter. @throws ClientException if any error occurs, or if the client with the same name already exists
[ "Creates", "a", "named", "client", "using", "a", "IClientConfig", "instance", "created", "off", "the", "configClass", "class", "object", "passed", "in", "as", "the", "parameter", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L127-L130
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.createImageUrl
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException { return tmdbConfiguration.getConfig().createImageUrl(imagePath, requiredSize); }
java
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException { return tmdbConfiguration.getConfig().createImageUrl(imagePath, requiredSize); }
[ "public", "URL", "createImageUrl", "(", "String", "imagePath", ",", "String", "requiredSize", ")", "throws", "MovieDbException", "{", "return", "tmdbConfiguration", ".", "getConfig", "(", ")", ".", "createImageUrl", "(", "imagePath", ",", "requiredSize", ")", ";",...
Generate the full image URL from the size and image path @param imagePath imagePath @param requiredSize requiredSize @return @throws MovieDbException exception
[ "Generate", "the", "full", "image", "URL", "from", "the", "size", "and", "image", "path" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L578-L580
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java
JBBPBitOutputStream.writeBits
public void writeBits(final int value, final JBBPBitNumber bitNumber) throws IOException { if (this.bitBufferCount == 0 && bitNumber == JBBPBitNumber.BITS_8) { write(value); } else { final int initialMask; int mask; initialMask = 1; mask = initialMask << this.bitBufferCount; int accum = value; int i = bitNumber.getBitNumber(); while (i > 0) { this.bitBuffer = this.bitBuffer | ((accum & 1) == 0 ? 0 : mask); accum >>= 1; mask = mask << 1; i--; this.bitBufferCount++; if (this.bitBufferCount == 8) { this.bitBufferCount = 0; writeByte(this.bitBuffer); mask = initialMask; this.bitBuffer = 0; } } } }
java
public void writeBits(final int value, final JBBPBitNumber bitNumber) throws IOException { if (this.bitBufferCount == 0 && bitNumber == JBBPBitNumber.BITS_8) { write(value); } else { final int initialMask; int mask; initialMask = 1; mask = initialMask << this.bitBufferCount; int accum = value; int i = bitNumber.getBitNumber(); while (i > 0) { this.bitBuffer = this.bitBuffer | ((accum & 1) == 0 ? 0 : mask); accum >>= 1; mask = mask << 1; i--; this.bitBufferCount++; if (this.bitBufferCount == 8) { this.bitBufferCount = 0; writeByte(this.bitBuffer); mask = initialMask; this.bitBuffer = 0; } } } }
[ "public", "void", "writeBits", "(", "final", "int", "value", ",", "final", "JBBPBitNumber", "bitNumber", ")", "throws", "IOException", "{", "if", "(", "this", ".", "bitBufferCount", "==", "0", "&&", "bitNumber", "==", "JBBPBitNumber", ".", "BITS_8", ")", "{"...
Write bits into the output stream. @param value the value which bits will be written in the output stream @param bitNumber number of bits from the value to be written, must be in 1..8 @throws IOException it will be thrown for transport errors @throws IllegalArgumentException it will be thrown for wrong bit number
[ "Write", "bits", "into", "the", "output", "stream", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L260-L288
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java
ResourceConverter.setTypeResolver
public void setTypeResolver(RelationshipResolver resolver, Class<?> type) { if (resolver != null) { String typeName = ReflectionUtils.getTypeName(type); if (typeName != null) { typedResolvers.put(type, resolver); } } }
java
public void setTypeResolver(RelationshipResolver resolver, Class<?> type) { if (resolver != null) { String typeName = ReflectionUtils.getTypeName(type); if (typeName != null) { typedResolvers.put(type, resolver); } } }
[ "public", "void", "setTypeResolver", "(", "RelationshipResolver", "resolver", ",", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "resolver", "!=", "null", ")", "{", "String", "typeName", "=", "ReflectionUtils", ".", "getTypeName", "(", "type", ")", ...
Registers relationship resolver for given type. Resolver will be used if relationship resolution is enabled trough relationship annotation. @param resolver resolver instance @param type type
[ "Registers", "relationship", "resolver", "for", "given", "type", ".", "Resolver", "will", "be", "used", "if", "relationship", "resolution", "is", "enabled", "trough", "relationship", "annotation", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java#L131-L139
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multRows
public static void multRows(double[] values, DMatrixRMaj A) { if( values.length < A.numRows ) { throw new IllegalArgumentException("Not enough elements in values."); } int index = 0; for (int row = 0; row < A.numRows; row++) { double v = values[row]; for (int col = 0; col < A.numCols; col++, index++) { A.data[index] *= v; } } }
java
public static void multRows(double[] values, DMatrixRMaj A) { if( values.length < A.numRows ) { throw new IllegalArgumentException("Not enough elements in values."); } int index = 0; for (int row = 0; row < A.numRows; row++) { double v = values[row]; for (int col = 0; col < A.numCols; col++, index++) { A.data[index] *= v; } } }
[ "public", "static", "void", "multRows", "(", "double", "[", "]", "values", ",", "DMatrixRMaj", "A", ")", "{", "if", "(", "values", ".", "length", "<", "A", ".", "numRows", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Not enough elements in v...
Multiplies every element in row i by value[i]. @param values array. Not modified. @param A Matrix. Modified.
[ "Multiplies", "every", "element", "in", "row", "i", "by", "value", "[", "i", "]", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1746-L1758
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java
CmsContainerPageElementPanel.addListCollectorEditorButtons
private void addListCollectorEditorButtons(Element editable) { CmsListCollectorEditor editor = new CmsListCollectorEditor(editable, m_clientId); add(editor, editable.getParentElement()); if (CmsDomUtil.hasDimension(editable.getParentElement())) { editor.setParentHasDimensions(true); editor.setPosition(CmsDomUtil.getEditablePosition(editable), getElement()); } else { editor.setParentHasDimensions(false); } m_editables.put(editable, editor); }
java
private void addListCollectorEditorButtons(Element editable) { CmsListCollectorEditor editor = new CmsListCollectorEditor(editable, m_clientId); add(editor, editable.getParentElement()); if (CmsDomUtil.hasDimension(editable.getParentElement())) { editor.setParentHasDimensions(true); editor.setPosition(CmsDomUtil.getEditablePosition(editable), getElement()); } else { editor.setParentHasDimensions(false); } m_editables.put(editable, editor); }
[ "private", "void", "addListCollectorEditorButtons", "(", "Element", "editable", ")", "{", "CmsListCollectorEditor", "editor", "=", "new", "CmsListCollectorEditor", "(", "editable", ",", "m_clientId", ")", ";", "add", "(", "editor", ",", "editable", ".", "getParentEl...
Adds the collector edit buttons.<p> @param editable the marker element for an editable list element
[ "Adds", "the", "collector", "edit", "buttons", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java#L1193-L1204
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java
XmlStringTools.appendTextInsideTag
public static StringBuffer appendTextInsideTag(StringBuffer buffer, String text, String tag, Map<String, String> attributes) { StringBuffer _buffer = initStringBufferIfNecessary(buffer); Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP; return doAppendTextInsideTag(_buffer, text, tag, _attributes); }
java
public static StringBuffer appendTextInsideTag(StringBuffer buffer, String text, String tag, Map<String, String> attributes) { StringBuffer _buffer = initStringBufferIfNecessary(buffer); Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP; return doAppendTextInsideTag(_buffer, text, tag, _attributes); }
[ "public", "static", "StringBuffer", "appendTextInsideTag", "(", "StringBuffer", "buffer", ",", "String", "text", ",", "String", "tag", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "StringBuffer", "_buffer", "=", "initStringBufferIfNecessa...
Wrap a text inside a tag with attributes. @param buffer StringBuffer to fill @param text the text to wrap @param tag the tag to use @param attributes the attribute map @return the buffer
[ "Wrap", "a", "text", "inside", "a", "tag", "with", "attributes", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L404-L409
optimaize/command4j
src/main/java/com/optimaize/command4j/ext/extensions/timeout/configurabletimeout/Util.java
Util.newExecutor
@NotNull static ExecutorService newExecutor() { ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); tpe.allowCoreThreadTimeOut(true); return tpe; }
java
@NotNull static ExecutorService newExecutor() { ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); tpe.allowCoreThreadTimeOut(true); return tpe; }
[ "@", "NotNull", "static", "ExecutorService", "newExecutor", "(", ")", "{", "ThreadPoolExecutor", "tpe", "=", "new", "ThreadPoolExecutor", "(", "0", ",", "1", ",", "10", ",", "TimeUnit", ".", "SECONDS", ",", "new", "SynchronousQueue", "<", "Runnable", ">", "(...
Creates an executor service with one thread that is removed automatically after 10 second idle time. The pool is therefore garbage collected and shutdown automatically. <p>This executor service can be used for situations, where a task should be executed immediately in a separate thread and the pool is not kept around.</p> impl notes: eike couldn't find a good place to put this class. thus for now it lives just here. maybe in the future the same code will be used in other places too ... then it may be moved.
[ "Creates", "an", "executor", "service", "with", "one", "thread", "that", "is", "removed", "automatically", "after", "10", "second", "idle", "time", ".", "The", "pool", "is", "therefore", "garbage", "collected", "and", "shutdown", "automatically", "." ]
train
https://github.com/optimaize/command4j/blob/6d550759a4593c7941a1e0d760b407fa88833d71/src/main/java/com/optimaize/command4j/ext/extensions/timeout/configurabletimeout/Util.java#L25-L30
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java
CloneInlineImages.inlineExternal
protected Node inlineExternal(Document doc, ParsedURL urldata, Node eold) { File in = new File(urldata.getPath()); if(!in.exists()) { LoggingUtil.warning("Referencing non-existant file: " + urldata.toString()); return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); FileInputStream instream = new FileInputStream(in); byte[] buf = new byte[4096]; while(true) { int read = instream.read(buf, 0, buf.length); if(read <= 0) { break; } encoder.write(buf, 0, read); } instream.close(); encoder.close(); } catch(IOException e) { LoggingUtil.exception("Exception serializing image to png", e); return null; } Element i = (Element) super.cloneNode(doc, eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); return i; }
java
protected Node inlineExternal(Document doc, ParsedURL urldata, Node eold) { File in = new File(urldata.getPath()); if(!in.exists()) { LoggingUtil.warning("Referencing non-existant file: " + urldata.toString()); return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); FileInputStream instream = new FileInputStream(in); byte[] buf = new byte[4096]; while(true) { int read = instream.read(buf, 0, buf.length); if(read <= 0) { break; } encoder.write(buf, 0, read); } instream.close(); encoder.close(); } catch(IOException e) { LoggingUtil.exception("Exception serializing image to png", e); return null; } Element i = (Element) super.cloneNode(doc, eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); return i; }
[ "protected", "Node", "inlineExternal", "(", "Document", "doc", ",", "ParsedURL", "urldata", ",", "Node", "eold", ")", "{", "File", "in", "=", "new", "File", "(", "urldata", ".", "getPath", "(", ")", ")", ";", "if", "(", "!", "in", ".", "exists", "(",...
Inline an external file (usually from temp). @param doc Document (element factory) @param urldata URL @param eold Existing node @return Replacement node, or {@code null}
[ "Inline", "an", "external", "file", "(", "usually", "from", "temp", ")", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java#L111-L141
infinispan/infinispan
server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheAdd.java
CacheAdd.extractIndexingProperties
private Properties extractIndexingProperties(OperationContext context, ModelNode operation, String cacheConfiguration) { Properties properties = new Properties(); PathAddress cacheAddress = getCacheAddressFromOperation(operation); Resource cacheConfigResource = context.readResourceFromRoot(cacheAddress.subAddress(0, 2), true) .getChild(PathElement.pathElement(ModelKeys.CONFIGURATIONS, ModelKeys.CONFIGURATIONS_NAME)) .getChild(PathElement.pathElement(getConfigurationKey(), cacheConfiguration)); PathElement indexingPathElement = PathElement.pathElement(ModelKeys.INDEXING, ModelKeys.INDEXING_NAME); if (cacheConfigResource == null || !cacheConfigResource.hasChild(indexingPathElement)) { return properties; } Resource indexingResource = cacheConfigResource.getChild(indexingPathElement); if (indexingResource == null) return properties; ModelNode indexingModel = indexingResource.getModel(); boolean hasProperties = indexingModel.hasDefined(ModelKeys.INDEXING_PROPERTIES); if (!hasProperties) return properties; ModelNode modelNode = indexingResource.getModel().get(ModelKeys.INDEXING_PROPERTIES); List<Property> modelProperties = modelNode.asPropertyList(); modelProperties.forEach(p -> properties.put(p.getName(), p.getValue().asString())); return properties; }
java
private Properties extractIndexingProperties(OperationContext context, ModelNode operation, String cacheConfiguration) { Properties properties = new Properties(); PathAddress cacheAddress = getCacheAddressFromOperation(operation); Resource cacheConfigResource = context.readResourceFromRoot(cacheAddress.subAddress(0, 2), true) .getChild(PathElement.pathElement(ModelKeys.CONFIGURATIONS, ModelKeys.CONFIGURATIONS_NAME)) .getChild(PathElement.pathElement(getConfigurationKey(), cacheConfiguration)); PathElement indexingPathElement = PathElement.pathElement(ModelKeys.INDEXING, ModelKeys.INDEXING_NAME); if (cacheConfigResource == null || !cacheConfigResource.hasChild(indexingPathElement)) { return properties; } Resource indexingResource = cacheConfigResource.getChild(indexingPathElement); if (indexingResource == null) return properties; ModelNode indexingModel = indexingResource.getModel(); boolean hasProperties = indexingModel.hasDefined(ModelKeys.INDEXING_PROPERTIES); if (!hasProperties) return properties; ModelNode modelNode = indexingResource.getModel().get(ModelKeys.INDEXING_PROPERTIES); List<Property> modelProperties = modelNode.asPropertyList(); modelProperties.forEach(p -> properties.put(p.getName(), p.getValue().asString())); return properties; }
[ "private", "Properties", "extractIndexingProperties", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "String", "cacheConfiguration", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "PathAddress", "cacheAddress", ...
Extract indexing information for the cache from the model. @return a {@link Properties} with the indexing properties or empty if the cache is not indexed
[ "Extract", "indexing", "information", "for", "the", "cache", "from", "the", "model", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheAdd.java#L115-L140
op4j/op4j
src/main/java/org/op4j/functions/FnFunc.java
FnFunc.ifNotNullThen
public static final <T> Function<T,T> ifNotNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) { return ifTrueThen(targetType, FnObject.isNotNull(), thenFunction); }
java
public static final <T> Function<T,T> ifNotNullThen(final Type<T> targetType, final IFunction<? super T,? extends T> thenFunction) { return ifTrueThen(targetType, FnObject.isNotNull(), thenFunction); }
[ "public", "static", "final", "<", "T", ">", "Function", "<", "T", ",", "T", ">", "ifNotNullThen", "(", "final", "Type", "<", "T", ">", "targetType", ",", "final", "IFunction", "<", "?", "super", "T", ",", "?", "extends", "T", ">", "thenFunction", ")"...
<p> Builds a function that will execute the specified function <tt>thenFunction</tt> only if the target object is not null. </p> <p> The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>) because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by <tt>thenFunction</tt> must be the same as the type required as input, in order to keep consistency. </p> @param targetType the target type. @param thenFunction the function to be executed on the target object if it is not null. @return a function that executes the "thenFunction" if the target object is not null.
[ "<p", ">", "Builds", "a", "function", "that", "will", "execute", "the", "specified", "function", "<tt", ">", "thenFunction<", "/", "tt", ">", "only", "if", "the", "target", "object", "is", "not", "null", ".", "<", "/", "p", ">", "<p", ">", "The", "bu...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnFunc.java#L221-L223
apache/groovy
src/main/groovy/groovy/ui/GroovyMain.java
GroovyMain.processArgs
static void processArgs(String[] args, final PrintStream out, final PrintStream err) { GroovyCommand groovyCommand = new GroovyCommand(); CommandLine parser = new CommandLine(groovyCommand).setUnmatchedArgumentsAllowed(true).setStopAtUnmatched(true); try { List<CommandLine> result = parser.parse(args); if (CommandLine.printHelpIfRequested(result, out, err, Help.Ansi.AUTO)) { return; } // TODO: pass printstream(s) down through process if (!groovyCommand.process(parser)) { // If we fail, then exit with an error so scripting frameworks can catch it. System.exit(1); } } catch (ParameterException ex) { // command line arguments could not be parsed err.println(ex.getMessage()); ex.getCommandLine().usage(err); } catch (IOException ioe) { err.println("error: " + ioe.getMessage()); } }
java
static void processArgs(String[] args, final PrintStream out, final PrintStream err) { GroovyCommand groovyCommand = new GroovyCommand(); CommandLine parser = new CommandLine(groovyCommand).setUnmatchedArgumentsAllowed(true).setStopAtUnmatched(true); try { List<CommandLine> result = parser.parse(args); if (CommandLine.printHelpIfRequested(result, out, err, Help.Ansi.AUTO)) { return; } // TODO: pass printstream(s) down through process if (!groovyCommand.process(parser)) { // If we fail, then exit with an error so scripting frameworks can catch it. System.exit(1); } } catch (ParameterException ex) { // command line arguments could not be parsed err.println(ex.getMessage()); ex.getCommandLine().usage(err); } catch (IOException ioe) { err.println("error: " + ioe.getMessage()); } }
[ "static", "void", "processArgs", "(", "String", "[", "]", "args", ",", "final", "PrintStream", "out", ",", "final", "PrintStream", "err", ")", "{", "GroovyCommand", "groovyCommand", "=", "new", "GroovyCommand", "(", ")", ";", "CommandLine", "parser", "=", "n...
package-level visibility for testing purposes (just usage/errors at this stage)
[ "package", "-", "level", "visibility", "for", "testing", "purposes", "(", "just", "usage", "/", "errors", "at", "this", "stage", ")" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/ui/GroovyMain.java#L125-L145
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackageFromDrl
public void addPackageFromDrl(final Reader source, final Reader dsl) throws DroolsParserException, IOException { this.resource = new ReaderResource(source, ResourceType.DSLR); final DrlParser parser = new DrlParser(configuration.getLanguageLevel()); final PackageDescr pkg = parser.parse(source, dsl); this.results.addAll(parser.getErrors()); if (!parser.hasErrors()) { addPackage(pkg); } this.resource = null; }
java
public void addPackageFromDrl(final Reader source, final Reader dsl) throws DroolsParserException, IOException { this.resource = new ReaderResource(source, ResourceType.DSLR); final DrlParser parser = new DrlParser(configuration.getLanguageLevel()); final PackageDescr pkg = parser.parse(source, dsl); this.results.addAll(parser.getErrors()); if (!parser.hasErrors()) { addPackage(pkg); } this.resource = null; }
[ "public", "void", "addPackageFromDrl", "(", "final", "Reader", "source", ",", "final", "Reader", "dsl", ")", "throws", "DroolsParserException", ",", "IOException", "{", "this", ".", "resource", "=", "new", "ReaderResource", "(", "source", ",", "ResourceType", "....
Load a rule package from DRL source using the supplied DSL configuration. @param source The source of the rules. @param dsl The source of the domain specific language configuration. @throws DroolsParserException @throws IOException
[ "Load", "a", "rule", "package", "from", "DRL", "source", "using", "the", "supplied", "DSL", "configuration", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L638-L650
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/beans/Application.java
Application.replaceApplicationBindings
public boolean replaceApplicationBindings( String externalExportPrefix, Set<String> applicationNames ) { // There is a change if the set do not have the same size or if they do not contain the same // number of element. If no binding had been registered previously, then we only check whether // the new set contains something. boolean changed = false; Set<String> oldApplicationNames = this.applicationBindings.remove( externalExportPrefix ); if( oldApplicationNames == null ) { changed = ! applicationNames.isEmpty(); } else if( oldApplicationNames.size() != applicationNames.size()) { changed = true; } else { oldApplicationNames.removeAll( applicationNames ); changed = ! oldApplicationNames.isEmpty(); } // Do not register keys when there is no binding if( ! applicationNames.isEmpty()) this.applicationBindings.put( externalExportPrefix, applicationNames ); return changed; }
java
public boolean replaceApplicationBindings( String externalExportPrefix, Set<String> applicationNames ) { // There is a change if the set do not have the same size or if they do not contain the same // number of element. If no binding had been registered previously, then we only check whether // the new set contains something. boolean changed = false; Set<String> oldApplicationNames = this.applicationBindings.remove( externalExportPrefix ); if( oldApplicationNames == null ) { changed = ! applicationNames.isEmpty(); } else if( oldApplicationNames.size() != applicationNames.size()) { changed = true; } else { oldApplicationNames.removeAll( applicationNames ); changed = ! oldApplicationNames.isEmpty(); } // Do not register keys when there is no binding if( ! applicationNames.isEmpty()) this.applicationBindings.put( externalExportPrefix, applicationNames ); return changed; }
[ "public", "boolean", "replaceApplicationBindings", "(", "String", "externalExportPrefix", ",", "Set", "<", "String", ">", "applicationNames", ")", "{", "// There is a change if the set do not have the same size or if they do not contain the same", "// number of element. If no binding h...
Replaces application bindings for a given prefix. @param externalExportPrefix an external export prefix (not null) @param applicationNames a non-null set of application names @return true if bindings were modified, false otherwise
[ "Replaces", "application", "bindings", "for", "a", "given", "prefix", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/beans/Application.java#L192-L215
Stratio/bdt
src/main/java/com/stratio/qa/specs/RestSpec.java
RestSpec.sendRequest
@When("^I send a '(.+?)' request to '(.+?)'( with user and password '(.+:.+?)')? based on '([^:]+?)'( as '(json|string|gov)')? with:$") public void sendRequest(String requestType, String endPoint, String foo, String loginInfo, String baseData, String baz, String type, DataTable modifications) throws Exception { // Retrieve data String retrievedData = commonspec.retrieveData(baseData, type); // Modify data commonspec.getLogger().debug("Modifying data {} as {}", retrievedData, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); String user = null; String password = null; if (loginInfo != null) { user = loginInfo.substring(0, loginInfo.indexOf(':')); password = loginInfo.substring(loginInfo.indexOf(':') + 1, loginInfo.length()); } commonspec.getLogger().debug("Generating request {} to {} with data {} as {}", requestType, endPoint, modifiedData, type); Future<Response> response = commonspec.generateRequest(requestType, false, user, password, endPoint, modifiedData, type, ""); // Save response commonspec.getLogger().debug("Saving response"); commonspec.setResponse(requestType, response.get()); }
java
@When("^I send a '(.+?)' request to '(.+?)'( with user and password '(.+:.+?)')? based on '([^:]+?)'( as '(json|string|gov)')? with:$") public void sendRequest(String requestType, String endPoint, String foo, String loginInfo, String baseData, String baz, String type, DataTable modifications) throws Exception { // Retrieve data String retrievedData = commonspec.retrieveData(baseData, type); // Modify data commonspec.getLogger().debug("Modifying data {} as {}", retrievedData, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); String user = null; String password = null; if (loginInfo != null) { user = loginInfo.substring(0, loginInfo.indexOf(':')); password = loginInfo.substring(loginInfo.indexOf(':') + 1, loginInfo.length()); } commonspec.getLogger().debug("Generating request {} to {} with data {} as {}", requestType, endPoint, modifiedData, type); Future<Response> response = commonspec.generateRequest(requestType, false, user, password, endPoint, modifiedData, type, ""); // Save response commonspec.getLogger().debug("Saving response"); commonspec.setResponse(requestType, response.get()); }
[ "@", "When", "(", "\"^I send a '(.+?)' request to '(.+?)'( with user and password '(.+:.+?)')? based on '([^:]+?)'( as '(json|string|gov)')? with:$\"", ")", "public", "void", "sendRequest", "(", "String", "requestType", ",", "String", "endPoint", ",", "String", "foo", ",", "Strin...
Send a request of the type specified @param requestType type of request to be sent. Possible values: GET|DELETE|POST|PUT|CONNECT|PATCH|HEAD|OPTIONS|REQUEST|TRACE @param endPoint end point to be used @param foo parameter generated by cucumber because of the optional expression @param baseData path to file containing the schema to be used @param type element to read from file (element should contain a json) @param modifications DataTable containing the modifications to be done to the base schema element. Syntax will be: {@code | <key path> | <type of modification> | <new value> | } where: key path: path to the key to be modified type of modification: DELETE|ADD|UPDATE new value: in case of UPDATE or ADD, new value to be used for example: if the element read is {"key1": "value1", "key2": {"key3": "value3"}} and we want to modify the value in "key3" with "new value3" the modification will be: | key2.key3 | UPDATE | "new value3" | being the result of the modification: {"key1": "value1", "key2": {"key3": "new value3"}} @throws Exception
[ "Send", "a", "request", "of", "the", "type", "specified" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/RestSpec.java#L204-L227
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java
Reflection.invokeGetterMethodOnTarget
public Object invokeGetterMethodOnTarget( String javaPropertyName, Object target ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { String[] methodNamesArray = findMethodNames("get" + javaPropertyName); if (methodNamesArray.length <= 0) { // Try 'is' getter ... methodNamesArray = findMethodNames("is" + javaPropertyName); } if (methodNamesArray.length <= 0) { // Try 'are' getter ... methodNamesArray = findMethodNames("are" + javaPropertyName); } return invokeBestMethodOnTarget(methodNamesArray, target); }
java
public Object invokeGetterMethodOnTarget( String javaPropertyName, Object target ) throws NoSuchMethodException, SecurityException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { String[] methodNamesArray = findMethodNames("get" + javaPropertyName); if (methodNamesArray.length <= 0) { // Try 'is' getter ... methodNamesArray = findMethodNames("is" + javaPropertyName); } if (methodNamesArray.length <= 0) { // Try 'are' getter ... methodNamesArray = findMethodNames("are" + javaPropertyName); } return invokeBestMethodOnTarget(methodNamesArray, target); }
[ "public", "Object", "invokeGetterMethodOnTarget", "(", "String", "javaPropertyName", ",", "Object", "target", ")", "throws", "NoSuchMethodException", ",", "SecurityException", ",", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{...
Find and execute the getter method on the target class for the supplied property name. If no such method is found, a NoSuchMethodException is thrown. @param javaPropertyName the name of the property whose getter is to be invoked, in the order they are to be tried @param target the object on which the method is to be invoked @return the property value (the result of the getter method call) @throws NoSuchMethodException if a matching method is not found. @throws SecurityException if access to the information is denied. @throws InvocationTargetException @throws IllegalAccessException @throws IllegalArgumentException
[ "Find", "and", "execute", "the", "getter", "method", "on", "the", "target", "class", "for", "the", "supplied", "property", "name", ".", "If", "no", "such", "method", "is", "found", "a", "NoSuchMethodException", "is", "thrown", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L633-L647
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getSessionTokenLogin
public TokenAuthorisation getSessionTokenLogin(TokenAuthorisation token, String username, String password) throws MovieDbException { return tmdbAuth.getSessionTokenLogin(token, username, password); }
java
public TokenAuthorisation getSessionTokenLogin(TokenAuthorisation token, String username, String password) throws MovieDbException { return tmdbAuth.getSessionTokenLogin(token, username, password); }
[ "public", "TokenAuthorisation", "getSessionTokenLogin", "(", "TokenAuthorisation", "token", ",", "String", "username", ",", "String", "password", ")", "throws", "MovieDbException", "{", "return", "tmdbAuth", ".", "getSessionTokenLogin", "(", "token", ",", "username", ...
This method is used to generate a session id for user based authentication. User must provide their username and password A session id is required in order to use any of the write methods. @param token Session token @param username User's username @param password User's password @return TokenAuthorisation @throws MovieDbException exception
[ "This", "method", "is", "used", "to", "generate", "a", "session", "id", "for", "user", "based", "authentication", ".", "User", "must", "provide", "their", "username", "and", "password" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L399-L401
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java
AStar.newAStarNode
@Pure protected AStarNode<ST, PT> newAStarNode(PT node, double cost, double estimatedCost, ST arrival) { return new Candidate(arrival, node, cost, estimatedCost); }
java
@Pure protected AStarNode<ST, PT> newAStarNode(PT node, double cost, double estimatedCost, ST arrival) { return new Candidate(arrival, node, cost, estimatedCost); }
[ "@", "Pure", "protected", "AStarNode", "<", "ST", ",", "PT", ">", "newAStarNode", "(", "PT", "node", ",", "double", "cost", ",", "double", "estimatedCost", ",", "ST", "arrival", ")", "{", "return", "new", "Candidate", "(", "arrival", ",", "node", ",", ...
Create a instance of {@link AStarNode A* node}. @param node is the node of the graph to put in the A* node. @param cost is the cost to reach the node. @param estimatedCost is the estimated cost to reach the target. @param arrival is the segment, which permits to arrive at the node. @return the A* node.
[ "Create", "a", "instance", "of", "{", "@link", "AStarNode", "A", "*", "node", "}", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L482-L485
geomajas/geomajas-project-client-gwt2
server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java
GeomajasServerExtension.createLayer
protected ServerLayer<?> createLayer(MapConfiguration mapConfiguration, ClientLayerInfo layerInfo, ViewPort viewPort, MapEventBus eventBus) { ServerLayer<?> layer = null; switch (layerInfo.getLayerType()) { case RASTER: layer = new RasterServerLayerImpl(mapConfiguration, (ClientRasterLayerInfo) layerInfo, viewPort, eventBus); break; default: layer = new VectorServerLayerImpl(mapConfiguration, (ClientVectorLayerInfo) layerInfo, viewPort, eventBus); break; } return layer; }
java
protected ServerLayer<?> createLayer(MapConfiguration mapConfiguration, ClientLayerInfo layerInfo, ViewPort viewPort, MapEventBus eventBus) { ServerLayer<?> layer = null; switch (layerInfo.getLayerType()) { case RASTER: layer = new RasterServerLayerImpl(mapConfiguration, (ClientRasterLayerInfo) layerInfo, viewPort, eventBus); break; default: layer = new VectorServerLayerImpl(mapConfiguration, (ClientVectorLayerInfo) layerInfo, viewPort, eventBus); break; } return layer; }
[ "protected", "ServerLayer", "<", "?", ">", "createLayer", "(", "MapConfiguration", "mapConfiguration", ",", "ClientLayerInfo", "layerInfo", ",", "ViewPort", "viewPort", ",", "MapEventBus", "eventBus", ")", "{", "ServerLayer", "<", "?", ">", "layer", "=", "null", ...
Create a new layer, based upon a server-side layer configuration object. @param mapConfiguration The map configuration. @param layerInfo The server-side configuration object. @param viewPort The map viewport. @param eventBus The map eventBus. @return The new layer object. It has NOT been added to the map just yet.
[ "Create", "a", "new", "layer", "based", "upon", "a", "server", "-", "side", "layer", "configuration", "object", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java#L220-L234
demidenko05/beigesoft-orm
src/main/java/org/beigesoft/orm/holder/HldProcessorNames.java
HldProcessorNames.getFor
@Override public final String getFor(final Class<?> pClass, final String pThingName) { if ("list".equals(pThingName)) { return PrcEntitiesPage.class.getSimpleName(); } else if ("about".equals(pThingName)) { return PrcAbout.class.getSimpleName(); } return null; }
java
@Override public final String getFor(final Class<?> pClass, final String pThingName) { if ("list".equals(pThingName)) { return PrcEntitiesPage.class.getSimpleName(); } else if ("about".equals(pThingName)) { return PrcAbout.class.getSimpleName(); } return null; }
[ "@", "Override", "public", "final", "String", "getFor", "(", "final", "Class", "<", "?", ">", "pClass", ",", "final", "String", "pThingName", ")", "{", "if", "(", "\"list\"", ".", "equals", "(", "pThingName", ")", ")", "{", "return", "PrcEntitiesPage", "...
<p>Get thing for given class and thing name.</p> @param pClass a Class @param pThingName Thing Name @return a thing
[ "<p", ">", "Get", "thing", "for", "given", "class", "and", "thing", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-orm/blob/f1b2c70701a111741a436911ca24ef9d38eba0b9/src/main/java/org/beigesoft/orm/holder/HldProcessorNames.java#L33-L41
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
DefaultFaceletFactory._removeFirst
private String _removeFirst(String string, String toRemove) { // do exactly what String.replaceFirst(toRemove, "") internally does, // except treating the search as literal text and not as regex return Pattern.compile(toRemove, Pattern.LITERAL).matcher(string).replaceFirst(""); }
java
private String _removeFirst(String string, String toRemove) { // do exactly what String.replaceFirst(toRemove, "") internally does, // except treating the search as literal text and not as regex return Pattern.compile(toRemove, Pattern.LITERAL).matcher(string).replaceFirst(""); }
[ "private", "String", "_removeFirst", "(", "String", "string", ",", "String", "toRemove", ")", "{", "// do exactly what String.replaceFirst(toRemove, \"\") internally does,", "// except treating the search as literal text and not as regex", "return", "Pattern", ".", "compile", "(", ...
Removes the first appearance of toRemove in string. Works just like string.replaceFirst(toRemove, ""), except that toRemove is not treated as a regex (which could cause problems with filenames). @param string @param toRemove @return
[ "Removes", "the", "first", "appearance", "of", "toRemove", "in", "string", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java#L613-L619
Stratio/stratio-cassandra
src/java/org/apache/cassandra/net/MessagingService.java
MessagingService.sendOneWay
public void sendOneWay(MessageOut message, int id, InetAddress to) { if (logger.isTraceEnabled()) logger.trace(FBUtilities.getBroadcastAddress() + " sending " + message.verb + " to " + id + "@" + to); if (to.equals(FBUtilities.getBroadcastAddress())) logger.trace("Message-to-self {} going over MessagingService", message); // message sinks are a testing hook MessageOut processedMessage = SinkManager.processOutboundMessage(message, id, to); if (processedMessage == null) { return; } // get pooled connection (really, connection queue) OutboundTcpConnection connection = getConnection(to, processedMessage); // write it connection.enqueue(processedMessage, id); }
java
public void sendOneWay(MessageOut message, int id, InetAddress to) { if (logger.isTraceEnabled()) logger.trace(FBUtilities.getBroadcastAddress() + " sending " + message.verb + " to " + id + "@" + to); if (to.equals(FBUtilities.getBroadcastAddress())) logger.trace("Message-to-self {} going over MessagingService", message); // message sinks are a testing hook MessageOut processedMessage = SinkManager.processOutboundMessage(message, id, to); if (processedMessage == null) { return; } // get pooled connection (really, connection queue) OutboundTcpConnection connection = getConnection(to, processedMessage); // write it connection.enqueue(processedMessage, id); }
[ "public", "void", "sendOneWay", "(", "MessageOut", "message", ",", "int", "id", ",", "InetAddress", "to", ")", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "logger", ".", "trace", "(", "FBUtilities", ".", "getBroadcastAddress", "(", ")",...
Send a message to a given endpoint. This method adheres to the fire and forget style messaging. @param message messages to be sent. @param to endpoint to which the message needs to be sent
[ "Send", "a", "message", "to", "a", "given", "endpoint", ".", "This", "method", "adheres", "to", "the", "fire", "and", "forget", "style", "messaging", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/net/MessagingService.java#L663-L683
line/armeria
saml/src/main/java/com/linecorp/armeria/server/saml/SamlUtil.java
SamlUtil.getNameId
public static Optional<NameID> getNameId(Response response, SamlNameIdFormat expectedFormat) { return getNameId(response, nameId -> nameId.getFormat().equals(expectedFormat.urn())); }
java
public static Optional<NameID> getNameId(Response response, SamlNameIdFormat expectedFormat) { return getNameId(response, nameId -> nameId.getFormat().equals(expectedFormat.urn())); }
[ "public", "static", "Optional", "<", "NameID", ">", "getNameId", "(", "Response", "response", ",", "SamlNameIdFormat", "expectedFormat", ")", "{", "return", "getNameId", "(", "response", ",", "nameId", "->", "nameId", ".", "getFormat", "(", ")", ".", "equals",...
Returns a {@link NameID} that its name format equals to the specified {@code expectedFormat}, from the {@link Response}.
[ "Returns", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/SamlUtil.java#L33-L35
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/ServerEnvironment.java
ServerEnvironment.getFileFromProperty
private File getFileFromProperty(final String name, final Properties props) { return getFileFromPath(props.getProperty(name)); }
java
private File getFileFromProperty(final String name, final Properties props) { return getFileFromPath(props.getProperty(name)); }
[ "private", "File", "getFileFromProperty", "(", "final", "String", "name", ",", "final", "Properties", "props", ")", "{", "return", "getFileFromPath", "(", "props", ".", "getProperty", "(", "name", ")", ")", ";", "}" ]
Get a File from configuration. @param name the name of the property @param props the set of configuration properties @return the CanonicalFile form for the given name.
[ "Get", "a", "File", "from", "configuration", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/ServerEnvironment.java#L1179-L1181
softindex/datakernel
core-codegen/src/main/java/io/datakernel/codegen/ClassBuilder.java
ClassBuilder.withMethod
public ClassBuilder<T> withMethod(String methodName, Class<?> returnClass, List<? extends Class<?>> argumentTypes, Expression expression) { Type[] types = new Type[argumentTypes.size()]; for (int i = 0; i < argumentTypes.size(); i++) { types[i] = getType(argumentTypes.get(i)); } return withMethod(new Method(methodName, getType(returnClass), types), expression); }
java
public ClassBuilder<T> withMethod(String methodName, Class<?> returnClass, List<? extends Class<?>> argumentTypes, Expression expression) { Type[] types = new Type[argumentTypes.size()]; for (int i = 0; i < argumentTypes.size(); i++) { types[i] = getType(argumentTypes.get(i)); } return withMethod(new Method(methodName, getType(returnClass), types), expression); }
[ "public", "ClassBuilder", "<", "T", ">", "withMethod", "(", "String", "methodName", ",", "Class", "<", "?", ">", "returnClass", ",", "List", "<", "?", "extends", "Class", "<", "?", ">", ">", "argumentTypes", ",", "Expression", "expression", ")", "{", "Ty...
Creates a new method for a dynamic class @param methodName name of method @param returnClass type which returns this method @param argumentTypes list of types of arguments @param expression function which will be processed @return changed AsmFunctionFactory
[ "Creates", "a", "new", "method", "for", "a", "dynamic", "class" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-codegen/src/main/java/io/datakernel/codegen/ClassBuilder.java#L200-L206
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java
CmsSitemapToolbar.setNewEnabled
public void setNewEnabled(boolean enabled, String disabledReason) { if (enabled) { m_newMenuButton.enable(); } else { m_newMenuButton.disable(disabledReason); } }
java
public void setNewEnabled(boolean enabled, String disabledReason) { if (enabled) { m_newMenuButton.enable(); } else { m_newMenuButton.disable(disabledReason); } }
[ "public", "void", "setNewEnabled", "(", "boolean", "enabled", ",", "String", "disabledReason", ")", "{", "if", "(", "enabled", ")", "{", "m_newMenuButton", ".", "enable", "(", ")", ";", "}", "else", "{", "m_newMenuButton", ".", "disable", "(", "disabledReaso...
Enables/disables the new menu button.<p> @param enabled <code>true</code> to enable the button @param disabledReason the reason, why the button is disabled
[ "Enables", "/", "disables", "the", "new", "menu", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsSitemapToolbar.java#L243-L250
line/armeria
core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotationUtil.java
AnnotationUtil.findDeclared
static <T extends Annotation> List<T> findDeclared( AnnotatedElement element, Class<T> annotationType) { return find(element, annotationType, EnumSet.noneOf(FindOption.class)); }
java
static <T extends Annotation> List<T> findDeclared( AnnotatedElement element, Class<T> annotationType) { return find(element, annotationType, EnumSet.noneOf(FindOption.class)); }
[ "static", "<", "T", "extends", "Annotation", ">", "List", "<", "T", ">", "findDeclared", "(", "AnnotatedElement", "element", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "return", "find", "(", "element", ",", "annotationType", ",", "EnumSet", "...
Returns all annotations of the {@code annotationType} which are found from the specified {@code element}. <p>Note that this method will <em>not</em> find annotations from both the super classes of the {@code element} and the meta-annotations. @param element the {@link AnnotatedElement} to find annotations @param annotationType the type of the annotation to find
[ "Returns", "all", "annotations", "of", "the", "{", "@code", "annotationType", "}", "which", "are", "found", "from", "the", "specified", "{", "@code", "element", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotationUtil.java#L170-L173
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT
public void billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingScreenListsConditions body) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingScreenListsConditions body) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "conditionId", ",", "OvhEasyHuntingScreenListsConditions", "body", ")", "throws", "IOException", ...
Alter this object properties REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param conditionId [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3269-L3273
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/GV/AbstractSEPAGV.java
AbstractSEPAGV.determinePainVersion
private SepaVersion determinePainVersion(HBCIPassportInternal passport, String gvName) { // Schritt 1: Wir holen uns die globale maximale PAIN-Version SepaVersion globalVersion = this.determinePainVersionInternal(passport, GVSEPAInfo.getLowlevelName()); // Schritt 2: Die des Geschaeftsvorfalls - fuer den Fall, dass die Bank // dort weitere Einschraenkungen hinterlegt hat SepaVersion jobVersion = this.determinePainVersionInternal(passport, gvName); // Wir haben gar keine PAIN-Version gefunden if (globalVersion == null && jobVersion == null) { SepaVersion def = this.getDefaultPainVersion(); log.warn("unable to determine matching pain version, using default: " + def); return def; } // Wenn wir keine GV-spezifische haben, dann nehmen wir die globale if (jobVersion == null) { log.debug("have no job-specific pain version, using global pain version: " + globalVersion); return globalVersion; } // Ansonsten hat die vom Job Vorrang: log.debug("using job-specific pain version: " + jobVersion); return jobVersion; }
java
private SepaVersion determinePainVersion(HBCIPassportInternal passport, String gvName) { // Schritt 1: Wir holen uns die globale maximale PAIN-Version SepaVersion globalVersion = this.determinePainVersionInternal(passport, GVSEPAInfo.getLowlevelName()); // Schritt 2: Die des Geschaeftsvorfalls - fuer den Fall, dass die Bank // dort weitere Einschraenkungen hinterlegt hat SepaVersion jobVersion = this.determinePainVersionInternal(passport, gvName); // Wir haben gar keine PAIN-Version gefunden if (globalVersion == null && jobVersion == null) { SepaVersion def = this.getDefaultPainVersion(); log.warn("unable to determine matching pain version, using default: " + def); return def; } // Wenn wir keine GV-spezifische haben, dann nehmen wir die globale if (jobVersion == null) { log.debug("have no job-specific pain version, using global pain version: " + globalVersion); return globalVersion; } // Ansonsten hat die vom Job Vorrang: log.debug("using job-specific pain version: " + jobVersion); return jobVersion; }
[ "private", "SepaVersion", "determinePainVersion", "(", "HBCIPassportInternal", "passport", ",", "String", "gvName", ")", "{", "// Schritt 1: Wir holen uns die globale maximale PAIN-Version", "SepaVersion", "globalVersion", "=", "this", ".", "determinePainVersionInternal", "(", ...
Diese Methode schaut in den BPD nach den unterstützen pain Versionen (bei LastSEPA pain.008.xxx.xx) und vergleicht diese mit den von HBCI4Java unterstützen pain Versionen. Der größte gemeinsamme Nenner wird zurueckgeliefert. @param passport @param gvName der Geschaeftsvorfall fuer den in den BPD nach dem PAIN-Versionen gesucht werden soll. @return die ermittelte PAIN-Version.
[ "Diese", "Methode", "schaut", "in", "den", "BPD", "nach", "den", "unterstützen", "pain", "Versionen", "(", "bei", "LastSEPA", "pain", ".", "008", ".", "xxx", ".", "xx", ")", "und", "vergleicht", "diese", "mit", "den", "von", "HBCI4Java", "unterstützen", "p...
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractSEPAGV.java#L71-L95
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java
SpellingCheckRule.ignoreToken
protected boolean ignoreToken(AnalyzedTokenReadings[] tokens, int idx) throws IOException { List<String> words = new ArrayList<>(); for (AnalyzedTokenReadings token : tokens) { words.add(token.getToken()); } return ignoreWord(words, idx); }
java
protected boolean ignoreToken(AnalyzedTokenReadings[] tokens, int idx) throws IOException { List<String> words = new ArrayList<>(); for (AnalyzedTokenReadings token : tokens) { words.add(token.getToken()); } return ignoreWord(words, idx); }
[ "protected", "boolean", "ignoreToken", "(", "AnalyzedTokenReadings", "[", "]", "tokens", ",", "int", "idx", ")", "throws", "IOException", "{", "List", "<", "String", ">", "words", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "AnalyzedTokenReadin...
Returns true iff the token at the given position should be ignored by the spell checker.
[ "Returns", "true", "iff", "the", "token", "at", "the", "given", "position", "should", "be", "ignored", "by", "the", "spell", "checker", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java#L258-L264
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaBindTextureToArray
public static int cudaBindTextureToArray(textureReference texref, cudaArray array, cudaChannelFormatDesc desc) { return checkResult(cudaBindTextureToArrayNative(texref, array, desc)); }
java
public static int cudaBindTextureToArray(textureReference texref, cudaArray array, cudaChannelFormatDesc desc) { return checkResult(cudaBindTextureToArrayNative(texref, array, desc)); }
[ "public", "static", "int", "cudaBindTextureToArray", "(", "textureReference", "texref", ",", "cudaArray", "array", ",", "cudaChannelFormatDesc", "desc", ")", "{", "return", "checkResult", "(", "cudaBindTextureToArrayNative", "(", "texref", ",", "array", ",", "desc", ...
[C++ API] Binds an array to a texture <pre> template < class T, int dim, enum cudaTextureReadMode readMode > cudaError_t cudaBindTextureToArray ( const texture < T, dim, readMode > & tex, cudaArray_const_t array, const cudaChannelFormatDesc& desc ) [inline] </pre> <div> <p>[C++ API] Binds an array to a texture Binds the CUDA array <tt>array</tt> to the texture reference <tt>tex</tt>. <tt>desc</tt> describes how the memory is interpreted when fetching values from the texture. Any CUDA array previously bound to <tt>tex</tt> is unbound. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param texref Texture to bind @param array Memory array on device @param desc Channel format @param tex Texture to bind @param array Memory array on device @param tex Texture to bind @param array Memory array on device @param desc Channel format @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidTexture @see JCuda#cudaCreateChannelDesc @see JCuda#cudaGetChannelDesc @see JCuda#cudaGetTextureReference @see JCuda#cudaBindTexture @see JCuda#cudaBindTexture @see JCuda#cudaBindTexture2D @see JCuda#cudaBindTexture2D @see JCuda#cudaBindTextureToArray @see JCuda#cudaBindTextureToArray @see JCuda#cudaUnbindTexture @see JCuda#cudaGetTextureAlignmentOffset
[ "[", "C", "++", "API", "]", "Binds", "an", "array", "to", "a", "texture" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L9209-L9212
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.optionalLongAttribute
public static long optionalLongAttribute( final XMLStreamReader reader, final String localName, final long defaultValue) { return optionalLongAttribute(reader, null, localName, defaultValue); }
java
public static long optionalLongAttribute( final XMLStreamReader reader, final String localName, final long defaultValue) { return optionalLongAttribute(reader, null, localName, defaultValue); }
[ "public", "static", "long", "optionalLongAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ",", "final", "long", "defaultValue", ")", "{", "return", "optionalLongAttribute", "(", "reader", ",", "null", ",", "localName", ",...
Returns the value of an attribute as a long. If the attribute is empty, this method returns the default value provided. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @param defaultValue default value @return value of attribute, or the default value if the attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "long", ".", "If", "the", "attribute", "is", "empty", "this", "method", "returns", "the", "default", "value", "provided", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L842-L847
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java
ThreadSafeJOptionPane.showInputDialog
public static String showInputDialog(final Component parentComponent, final Object message) { return execute(new StringOptionPane() { public void show(final StringResult result) { result.setResult(JOptionPane.showInputDialog(parentComponent, message)); } }); }
java
public static String showInputDialog(final Component parentComponent, final Object message) { return execute(new StringOptionPane() { public void show(final StringResult result) { result.setResult(JOptionPane.showInputDialog(parentComponent, message)); } }); }
[ "public", "static", "String", "showInputDialog", "(", "final", "Component", "parentComponent", ",", "final", "Object", "message", ")", "{", "return", "execute", "(", "new", "StringOptionPane", "(", ")", "{", "public", "void", "show", "(", "final", "StringResult"...
Shows a question-message dialog requesting input from the user parented to <code>parentComponent</code>. The dialog is displayed on top of the <code>Component</code>'s frame, and is usually positioned below the <code>Component</code>. @param parentComponent the parent <code>Component</code> for the dialog @param message the <code>Object</code> to display @return user's input, or <code>null</code> meaning the user canceled the input
[ "Shows", "a", "question", "-", "message", "dialog", "requesting", "input", "from", "the", "user", "parented", "to", "<code", ">", "parentComponent<", "/", "code", ">", ".", "The", "dialog", "is", "displayed", "on", "top", "of", "the", "<code", ">", "Compon...
train
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java#L252-L260
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/interpolate/FactoryInterpolation.java
FactoryInterpolation.createPixelS
public static <T extends ImageGray<T>> InterpolatePixelS<T> createPixelS(double min, double max, InterpolationType type, BorderType borderType, Class<T> imageType) { InterpolatePixelS<T> alg; switch( type ) { case NEAREST_NEIGHBOR: alg = nearestNeighborPixelS(imageType); break; case BILINEAR: return bilinearPixelS(imageType, borderType); case BICUBIC: alg = bicubicS(-0.5f, (float) min, (float) max, imageType); break; case POLYNOMIAL4: alg = polynomialS(4, min, max, imageType); break; default: throw new IllegalArgumentException("Add type: "+type); } if( borderType != null ) alg.setBorder(FactoryImageBorder.single(imageType, borderType)); return alg; }
java
public static <T extends ImageGray<T>> InterpolatePixelS<T> createPixelS(double min, double max, InterpolationType type, BorderType borderType, Class<T> imageType) { InterpolatePixelS<T> alg; switch( type ) { case NEAREST_NEIGHBOR: alg = nearestNeighborPixelS(imageType); break; case BILINEAR: return bilinearPixelS(imageType, borderType); case BICUBIC: alg = bicubicS(-0.5f, (float) min, (float) max, imageType); break; case POLYNOMIAL4: alg = polynomialS(4, min, max, imageType); break; default: throw new IllegalArgumentException("Add type: "+type); } if( borderType != null ) alg.setBorder(FactoryImageBorder.single(imageType, borderType)); return alg; }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "InterpolatePixelS", "<", "T", ">", "createPixelS", "(", "double", "min", ",", "double", "max", ",", "InterpolationType", "type", ",", "BorderType", "borderType", ",", "Class", "<", ...
Creates an interpolation class of the specified type for the specified image type. @param min Minimum possible pixel value. Inclusive. @param max Maximum possible pixel value. Inclusive. @param type Interpolation type @param borderType Border type. If null then it will not be set here. @param imageType Type of input image @return Interpolation
[ "Creates", "an", "interpolation", "class", "of", "the", "specified", "type", "for", "the", "specified", "image", "type", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/interpolate/FactoryInterpolation.java#L80-L108
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java
MapElement.boundsIntersects
@Pure protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) { final Rectangle2d bounds = getBoundingBox(); assert bounds != null; return bounds.intersects(rectangle); }
java
@Pure protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) { final Rectangle2d bounds = getBoundingBox(); assert bounds != null; return bounds.intersects(rectangle); }
[ "@", "Pure", "protected", "final", "boolean", "boundsIntersects", "(", "Shape2D", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", "extends", "Rectangle2afp", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", ">", "rec...
Replies if the bounds of this element has an intersection with the specified rectangle. @param rectangle the rectangle. @return <code>true</code> if this bounds is intersecting the specified area, otherwise <code>false</code>
[ "Replies", "if", "the", "bounds", "of", "this", "element", "has", "an", "intersection", "with", "the", "specified", "rectangle", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L455-L460
janus-project/guava.janusproject.io
guava/src/com/google/common/collect/SortedIterables.java
SortedIterables.hasSameComparator
public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> elements) { checkNotNull(comparator); checkNotNull(elements); Comparator<?> comparator2; if (elements instanceof SortedSet) { comparator2 = comparator((SortedSet<?>) elements); } else if (elements instanceof SortedIterable) { comparator2 = ((SortedIterable<?>) elements).comparator(); } else { return false; } return comparator.equals(comparator2); }
java
public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> elements) { checkNotNull(comparator); checkNotNull(elements); Comparator<?> comparator2; if (elements instanceof SortedSet) { comparator2 = comparator((SortedSet<?>) elements); } else if (elements instanceof SortedIterable) { comparator2 = ((SortedIterable<?>) elements).comparator(); } else { return false; } return comparator.equals(comparator2); }
[ "public", "static", "boolean", "hasSameComparator", "(", "Comparator", "<", "?", ">", "comparator", ",", "Iterable", "<", "?", ">", "elements", ")", "{", "checkNotNull", "(", "comparator", ")", ";", "checkNotNull", "(", "elements", ")", ";", "Comparator", "<...
Returns {@code true} if {@code elements} is a sorted collection using an ordering equivalent to {@code comparator}.
[ "Returns", "{" ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/SortedIterables.java#L37-L49
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java
PendingCheckpointStats.reportFailedCheckpoint
void reportFailedCheckpoint(long failureTimestamp, @Nullable Throwable cause) { FailedCheckpointStats failed = new FailedCheckpointStats( checkpointId, triggerTimestamp, props, numberOfSubtasks, new HashMap<>(taskStats), currentNumAcknowledgedSubtasks, currentStateSize, currentAlignmentBuffered, failureTimestamp, latestAcknowledgedSubtask, cause); trackerCallback.reportFailedCheckpoint(failed); }
java
void reportFailedCheckpoint(long failureTimestamp, @Nullable Throwable cause) { FailedCheckpointStats failed = new FailedCheckpointStats( checkpointId, triggerTimestamp, props, numberOfSubtasks, new HashMap<>(taskStats), currentNumAcknowledgedSubtasks, currentStateSize, currentAlignmentBuffered, failureTimestamp, latestAcknowledgedSubtask, cause); trackerCallback.reportFailedCheckpoint(failed); }
[ "void", "reportFailedCheckpoint", "(", "long", "failureTimestamp", ",", "@", "Nullable", "Throwable", "cause", ")", "{", "FailedCheckpointStats", "failed", "=", "new", "FailedCheckpointStats", "(", "checkpointId", ",", "triggerTimestamp", ",", "props", ",", "numberOfS...
Reports a failed pending checkpoint. @param failureTimestamp Timestamp of the failure. @param cause Optional cause of the failure.
[ "Reports", "a", "failed", "pending", "checkpoint", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java#L170-L185
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isBetweenInclusive
public static int isBetweenInclusive (final int nValue, final String sName, final int nLowerBoundInclusive, final int nUpperBoundInclusive) { if (isEnabled ()) return isBetweenInclusive (nValue, () -> sName, nLowerBoundInclusive, nUpperBoundInclusive); return nValue; }
java
public static int isBetweenInclusive (final int nValue, final String sName, final int nLowerBoundInclusive, final int nUpperBoundInclusive) { if (isEnabled ()) return isBetweenInclusive (nValue, () -> sName, nLowerBoundInclusive, nUpperBoundInclusive); return nValue; }
[ "public", "static", "int", "isBetweenInclusive", "(", "final", "int", "nValue", ",", "final", "String", "sName", ",", "final", "int", "nLowerBoundInclusive", ",", "final", "int", "nUpperBoundInclusive", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "return"...
Check if <code>nValue &ge; nLowerBoundInclusive &amp;&amp; nValue &le; nUpperBoundInclusive</code> @param nValue Value @param sName Name @param nLowerBoundInclusive Lower bound @param nUpperBoundInclusive Upper bound @return The value
[ "Check", "if", "<code", ">", "nValue", "&ge", ";", "nLowerBoundInclusive", "&amp", ";", "&amp", ";", "nValue", "&le", ";", "nUpperBoundInclusive<", "/", "code", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2277-L2285
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java
OverrideService.updateRepeatNumber
public void updateRepeatNumber(int id, Integer repeatNumber) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE + " SET " + Constants.ENABLED_OVERRIDES_REPEAT_NUMBER + "= ? " + " WHERE " + Constants.GENERIC_ID + " = ?"; statement = sqlConnection.prepareStatement(queryString); statement.setInt(1, repeatNumber); statement.setInt(2, id); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void updateRepeatNumber(int id, Integer repeatNumber) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE + " SET " + Constants.ENABLED_OVERRIDES_REPEAT_NUMBER + "= ? " + " WHERE " + Constants.GENERIC_ID + " = ?"; statement = sqlConnection.prepareStatement(queryString); statement.setInt(1, repeatNumber); statement.setInt(2, id); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "updateRepeatNumber", "(", "int", "id", ",", "Integer", "repeatNumber", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "Str...
Update the repeat number for a given enabled override @param id enabled override ID to update @param repeatNumber updated value of repeat
[ "Update", "the", "repeat", "number", "for", "a", "given", "enabled", "override" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java#L208-L229
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.betaCdf
public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }
java
public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }
[ "public", "static", "double", "betaCdf", "(", "double", "x", ",", "double", "a", ",", "double", "b", ")", "{", "if", "(", "x", "<", "0", "||", "a", "<=", "0", "||", "b", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All t...
Calculates the probability from 0 to X under Beta Distribution @param x @param a @param b @return
[ "Calculates", "the", "probability", "from", "0", "to", "X", "under", "Beta", "Distribution" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L213-L239
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getElementMatching
@Pure public static Element getElementMatching(Node document, XMLConstraint constraint, String... path) { assert document != null : AssertMessages.notNullParameter(0); assert constraint != null : AssertMessages.notNullParameter(1); return getElementMatching(document, constraint, true, path); }
java
@Pure public static Element getElementMatching(Node document, XMLConstraint constraint, String... path) { assert document != null : AssertMessages.notNullParameter(0); assert constraint != null : AssertMessages.notNullParameter(1); return getElementMatching(document, constraint, true, path); }
[ "@", "Pure", "public", "static", "Element", "getElementMatching", "(", "Node", "document", ",", "XMLConstraint", "constraint", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ...
Replies the node that corresponds to the specified path. <p>The path is an ordered list of tag's names and ended by the name of the desired node. @param document is the XML document to explore. @param constraint is the constraint that the replied element must respect. @param path is the list of names. @return the node or <code>null</code> if it was not found in the document.
[ "Replies", "the", "node", "that", "corresponds", "to", "the", "specified", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1441-L1446
xebia/Xebium
src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java
SeleniumDriverFixture.startDriverOnUrl
public void startDriverOnUrl(final WebDriver webDriver, final String browserUrl) { setCommandProcessor(startWebDriverCommandProcessor(browserUrl, webDriver)); setTimeoutOnSelenium(); LOG.debug("Started command processor"); }
java
public void startDriverOnUrl(final WebDriver webDriver, final String browserUrl) { setCommandProcessor(startWebDriverCommandProcessor(browserUrl, webDriver)); setTimeoutOnSelenium(); LOG.debug("Started command processor"); }
[ "public", "void", "startDriverOnUrl", "(", "final", "WebDriver", "webDriver", ",", "final", "String", "browserUrl", ")", "{", "setCommandProcessor", "(", "startWebDriverCommandProcessor", "(", "browserUrl", ",", "webDriver", ")", ")", ";", "setTimeoutOnSelenium", "(",...
<p><code> | start driver | <i>$Driver</i> | on url | <i>http://localhost</i> | </code></p> @param webDriver a WebDriver instance @param browserUrl
[ "<p", ">", "<code", ">", "|", "start", "driver", "|", "<i", ">", "$Driver<", "/", "i", ">", "|", "on", "url", "|", "<i", ">", "http", ":", "//", "localhost<", "/", "i", ">", "|", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L168-L172
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.KumarJohnsonDivergence
public static double KumarJohnsonDivergence(double[] p, double[] q) { double r = 0; for (int i = 0; i < p.length; i++) { if (p[i] != 0 && q[i] != 0) { r += Math.pow(p[i] * p[i] - q[i] * q[i], 2) / 2 * Math.pow(p[i] * q[i], 1.5); } } return r; }
java
public static double KumarJohnsonDivergence(double[] p, double[] q) { double r = 0; for (int i = 0; i < p.length; i++) { if (p[i] != 0 && q[i] != 0) { r += Math.pow(p[i] * p[i] - q[i] * q[i], 2) / 2 * Math.pow(p[i] * q[i], 1.5); } } return r; }
[ "public", "static", "double", "KumarJohnsonDivergence", "(", "double", "[", "]", "p", ",", "double", "[", "]", "q", ")", "{", "double", "r", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", ".", "length", ";", "i", "++", ")"...
Gets the Kumar-Johnson divergence. @param p P vector. @param q Q vector. @return The Kumar-Johnson divergence between p and q.
[ "Gets", "the", "Kumar", "-", "Johnson", "divergence", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L543-L551
hankcs/HanLP
src/main/java/com/hankcs/hanlp/HanLP.java
HanLP.extractWords
public static List<WordInfo> extractWords(String text, int size, boolean newWordsOnly) { NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly); return discover.discover(text, size); }
java
public static List<WordInfo> extractWords(String text, int size, boolean newWordsOnly) { NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly); return discover.discover(text, size); }
[ "public", "static", "List", "<", "WordInfo", ">", "extractWords", "(", "String", "text", ",", "int", "size", ",", "boolean", "newWordsOnly", ")", "{", "NewWordDiscover", "discover", "=", "new", "NewWordDiscover", "(", "4", ",", "0.0f", ",", ".5f", ",", "10...
提取词语(新词发现) @param text 大文本 @param size 需要提取词语的数量 @param newWordsOnly 是否只提取词典中没有的词语 @return 一个词语列表
[ "提取词语(新词发现)" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L757-L761
biezhi/anima
src/main/java/io/github/biezhi/anima/core/AnimaQuery.java
AnimaQuery.queryOne
public <S> S queryOne(Class<S> type, String sql, Object[] params) { Connection conn = getConn(); try { Query query = conn.createQuery(sql) .withParams(params) .setAutoDeriveColumnNames(true) .throwOnMappingFailure(false); return ifReturn(AnimaUtils.isBasicType(type), () -> query.executeScalar(type), () -> query.executeAndFetchFirst(type)); } finally { this.closeConn(conn); this.clean(null); } }
java
public <S> S queryOne(Class<S> type, String sql, Object[] params) { Connection conn = getConn(); try { Query query = conn.createQuery(sql) .withParams(params) .setAutoDeriveColumnNames(true) .throwOnMappingFailure(false); return ifReturn(AnimaUtils.isBasicType(type), () -> query.executeScalar(type), () -> query.executeAndFetchFirst(type)); } finally { this.closeConn(conn); this.clean(null); } }
[ "public", "<", "S", ">", "S", "queryOne", "(", "Class", "<", "S", ">", "type", ",", "String", "sql", ",", "Object", "[", "]", "params", ")", "{", "Connection", "conn", "=", "getConn", "(", ")", ";", "try", "{", "Query", "query", "=", "conn", ".",...
Querying a model @param type model type @param sql sql statement @param params params @param <S> @return S
[ "Querying", "a", "model" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1072-L1087
apache/incubator-heron
heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java
TopologyBuilder.setBolt
@SuppressWarnings("rawtypes") public <K extends Serializable, V extends Serializable> BoltDeclarer setBolt( String id, IStatefulWindowedBolt<K, V> bolt) throws IllegalArgumentException { return setBolt(id, bolt, null); }
java
@SuppressWarnings("rawtypes") public <K extends Serializable, V extends Serializable> BoltDeclarer setBolt( String id, IStatefulWindowedBolt<K, V> bolt) throws IllegalArgumentException { return setBolt(id, bolt, null); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "<", "K", "extends", "Serializable", ",", "V", "extends", "Serializable", ">", "BoltDeclarer", "setBolt", "(", "String", "id", ",", "IStatefulWindowedBolt", "<", "K", ",", "V", ">", "bolt", ")", "t...
Define a new bolt in this topology. This defines a stateful windowed bolt, intended for stateful windowing operations. The {@link IStatefulWindowedBolt#execute(TupleWindow)} method is triggered for each window interval with the list of current events in the window. During initialization of this bolt (potentially after failure) {@link IStatefulWindowedBolt#initState(State)} is invoked with its previously saved state. @param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs. @param bolt the stateful windowed bolt @param <K> Type of key for {@link org.apache.heron.api.state.HashMapState} @param <V> Type of value for {@link org.apache.heron.api.state.HashMapState} @return use the returned object to declare the inputs to this component @throws IllegalArgumentException {@code parallelism_hint} is not positive
[ "Define", "a", "new", "bolt", "in", "this", "topology", ".", "This", "defines", "a", "stateful", "windowed", "bolt", "intended", "for", "stateful", "windowing", "operations", ".", "The", "{" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/topology/TopologyBuilder.java#L210-L215
buschmais/jqa-core-framework
rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java
RuleHelper.getAllRules
private CollectRulesVisitor getAllRules(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException { CollectRulesVisitor visitor = new CollectRulesVisitor(); RuleSetExecutor executor = new RuleSetExecutor(visitor, new RuleSetExecutorConfiguration()); executor.execute(ruleSet, ruleSelection); return visitor; }
java
private CollectRulesVisitor getAllRules(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException { CollectRulesVisitor visitor = new CollectRulesVisitor(); RuleSetExecutor executor = new RuleSetExecutor(visitor, new RuleSetExecutorConfiguration()); executor.execute(ruleSet, ruleSelection); return visitor; }
[ "private", "CollectRulesVisitor", "getAllRules", "(", "RuleSet", "ruleSet", ",", "RuleSelection", "ruleSelection", ")", "throws", "RuleException", "{", "CollectRulesVisitor", "visitor", "=", "new", "CollectRulesVisitor", "(", ")", ";", "RuleSetExecutor", "executor", "="...
Determines all rules. @param ruleSet The rule set. @return The visitor with all valid and missing rules. @throws RuleException If the rules cannot be evaluated.
[ "Determines", "all", "rules", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/RuleHelper.java#L86-L91
wkgcass/Style
src/main/java/net/cassite/style/aggregation/MapFuncSup.java
MapFuncSup.forThose
public <R> R forThose(RFunc2<Boolean, K, V> predicate, RFunc2<R, K, V> func) { return forThose(predicate, Style.$(func)); }
java
public <R> R forThose(RFunc2<Boolean, K, V> predicate, RFunc2<R, K, V> func) { return forThose(predicate, Style.$(func)); }
[ "public", "<", "R", ">", "R", "forThose", "(", "RFunc2", "<", "Boolean", ",", "K", ",", "V", ">", "predicate", ",", "RFunc2", "<", "R", ",", "K", ",", "V", ">", "func", ")", "{", "return", "forThose", "(", "predicate", ",", "Style", ".", "$", "...
define a function to deal with each element in the map @param predicate a function takes in each element from map and returns true or false(or null) @param func a function takes in each element from map and returns 'last loop info' @return return 'last loop value'.<br> check <a href="https://github.com/wkgcass/Style/">tutorial</a> for more info about 'last loop value'
[ "define", "a", "function", "to", "deal", "with", "each", "element", "in", "the", "map" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L146-L148
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java
OCommandExecutorSQLSelect.createIndexedProperty
private static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) { if (iItem == null || !(iItem instanceof OSQLFilterItemField)) return null; if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) return null; final OSQLFilterItemField item = (OSQLFilterItemField) iItem; if (item.hasChainOperators() && !item.isFieldChain()) return null; final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft(); if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) { return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue); } final Object value = OSQLHelper.getValue(origValue); if (value == null) return null; return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value); }
java
private static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) { if (iItem == null || !(iItem instanceof OSQLFilterItemField)) return null; if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) return null; final OSQLFilterItemField item = (OSQLFilterItemField) iItem; if (item.hasChainOperators() && !item.isFieldChain()) return null; final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft(); if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) { return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue); } final Object value = OSQLHelper.getValue(origValue); if (value == null) return null; return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value); }
[ "private", "static", "OIndexSearchResult", "createIndexedProperty", "(", "final", "OSQLFilterCondition", "iCondition", ",", "final", "Object", "iItem", ")", "{", "if", "(", "iItem", "==", "null", "||", "!", "(", "iItem", "instanceof", "OSQLFilterItemField", ")", "...
Add SQL filter field to the search candidate list. @param iCondition Condition item @param iItem Value to search @return true if the property was indexed and found, otherwise false
[ "Add", "SQL", "filter", "field", "to", "the", "search", "candidate", "list", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java#L519-L543
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java
SinglePerturbationNeighbourhood.canAdd
private boolean canAdd(SubsetSolution solution, Set<Integer> addCandidates){ return !addCandidates.isEmpty() && isValidSubsetSize(solution.getNumSelectedIDs()+1); }
java
private boolean canAdd(SubsetSolution solution, Set<Integer> addCandidates){ return !addCandidates.isEmpty() && isValidSubsetSize(solution.getNumSelectedIDs()+1); }
[ "private", "boolean", "canAdd", "(", "SubsetSolution", "solution", ",", "Set", "<", "Integer", ">", "addCandidates", ")", "{", "return", "!", "addCandidates", ".", "isEmpty", "(", ")", "&&", "isValidSubsetSize", "(", "solution", ".", "getNumSelectedIDs", "(", ...
Check if it is allowed to add one more item to the selection. @param solution solution for which moves are generated @param addCandidates set of candidate IDs to be added @return <code>true</code> if it is allowed to add an item to the selection
[ "Check", "if", "it", "is", "allowed", "to", "add", "one", "more", "item", "to", "the", "selection", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java#L221-L224
jbundle/jbundle
main/calendar/src/main/java/org/jbundle/main/calendar/db/AnnivMasterHandler.java
AnnivMasterHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { AnnivMaster recAnnivMaster = (AnnivMaster)this.getOwner(); if (iChangeType == DBConstants.AFTER_ADD_TYPE) { Object bookmark = recAnnivMaster.getLastModified(DBConstants.BOOKMARK_HANDLE); try { recAnnivMaster.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); recAnnivMaster.addNew(); } catch (DBException ex) { ex.printStackTrace(); } } if (iChangeType == DBConstants.AFTER_UPDATE_TYPE) { Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.removeAppointments(this.getAnniversary()); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); } if (iChangeType == DBConstants.AFTER_DELETE_TYPE) { recAnnivMaster.removeAppointments(this.getAnniversary()); } return super.doRecordChange(field, iChangeType, bDisplayOption); }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { AnnivMaster recAnnivMaster = (AnnivMaster)this.getOwner(); if (iChangeType == DBConstants.AFTER_ADD_TYPE) { Object bookmark = recAnnivMaster.getLastModified(DBConstants.BOOKMARK_HANDLE); try { recAnnivMaster.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); recAnnivMaster.addNew(); } catch (DBException ex) { ex.printStackTrace(); } } if (iChangeType == DBConstants.AFTER_UPDATE_TYPE) { Calendar calStart = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.START_ANNIV_DATE)).getCalendar(); Calendar calEnd = ((DateTimeField)this.getCalendarControl().getField(CalendarControl.END_ANNIV_DATE)).getCalendar(); recAnnivMaster.removeAppointments(this.getAnniversary()); recAnnivMaster.addAppointments(this.getAnniversary(), calStart, calEnd); } if (iChangeType == DBConstants.AFTER_DELETE_TYPE) { recAnnivMaster.removeAppointments(this.getAnniversary()); } return super.doRecordChange(field, iChangeType, bDisplayOption); }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "AnnivMaster", "recAnnivMaster", "=", "(", "AnnivMaster", ")", "this", ".", "getOwner", "(", ")", ";", "if", "(", "iChangeType"...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. ADD_TYPE - Before a write. UPDATE_TYPE - Before an update. DELETE_TYPE - Before a delete. AFTER_UPDATE_TYPE - After a write or update. LOCK_TYPE - Before a lock. SELECT_TYPE - After a select. DESELECT_TYPE - After a deselect. MOVE_NEXT_TYPE - After a move. AFTER_REQUERY_TYPE - Record opened. SELECT_EOF_TYPE - EOF Hit.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/calendar/src/main/java/org/jbundle/main/calendar/db/AnnivMasterHandler.java#L75-L107
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java
AlignedBox3d.setFromCornersProperties
public void setFromCornersProperties(Point3d p1, Point3d p2) { if (p1.getX()<p2.getX()) { this.minxProperty = p1.xProperty; this.maxxProperty = p2.xProperty; } else { this.minxProperty = p2.xProperty; this.maxxProperty = p1.xProperty; } if (p1.getY()<p2.getY()) { this.minyProperty = p1.yProperty; this.maxyProperty = p2.yProperty; } else { this.minyProperty = p2.yProperty; this.maxyProperty = p1.yProperty; } if (p1.getZ()<p2.getZ()) { this.minzProperty = p1.zProperty; this.maxzProperty = p2.zProperty; } else { this.minzProperty = p2.zProperty; this.maxzProperty = p1.zProperty; } }
java
public void setFromCornersProperties(Point3d p1, Point3d p2) { if (p1.getX()<p2.getX()) { this.minxProperty = p1.xProperty; this.maxxProperty = p2.xProperty; } else { this.minxProperty = p2.xProperty; this.maxxProperty = p1.xProperty; } if (p1.getY()<p2.getY()) { this.minyProperty = p1.yProperty; this.maxyProperty = p2.yProperty; } else { this.minyProperty = p2.yProperty; this.maxyProperty = p1.yProperty; } if (p1.getZ()<p2.getZ()) { this.minzProperty = p1.zProperty; this.maxzProperty = p2.zProperty; } else { this.minzProperty = p2.zProperty; this.maxzProperty = p1.zProperty; } }
[ "public", "void", "setFromCornersProperties", "(", "Point3d", "p1", ",", "Point3d", "p2", ")", "{", "if", "(", "p1", ".", "getX", "(", ")", "<", "p2", ".", "getX", "(", ")", ")", "{", "this", ".", "minxProperty", "=", "p1", ".", "xProperty", ";", "...
Change the frame of the box. @param p1 is the coordinate of the first corner. @param p2 is the coordinate of the second corner.
[ "Change", "the", "frame", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L332-L357
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/StringUtil.java
StringUtil.boxify
public static String boxify(final char boxing, final String text) { if (boxing != 0 && StringUtils.isNotBlank(text)) { final StringBuilder b = new StringBuilder(); b.append(NEW_LINE); final String line = StringUtils.repeat(String.valueOf(boxing), text.length() + 4); b.append(line).append(NEW_LINE); b.append(boxing).append(SPACE).append(text).append(SPACE).append(boxing).append(NEW_LINE); b.append(line).append(NEW_LINE); return b.toString(); } return EMPTY; }
java
public static String boxify(final char boxing, final String text) { if (boxing != 0 && StringUtils.isNotBlank(text)) { final StringBuilder b = new StringBuilder(); b.append(NEW_LINE); final String line = StringUtils.repeat(String.valueOf(boxing), text.length() + 4); b.append(line).append(NEW_LINE); b.append(boxing).append(SPACE).append(text).append(SPACE).append(boxing).append(NEW_LINE); b.append(line).append(NEW_LINE); return b.toString(); } return EMPTY; }
[ "public", "static", "String", "boxify", "(", "final", "char", "boxing", ",", "final", "String", "text", ")", "{", "if", "(", "boxing", "!=", "0", "&&", "StringUtils", ".", "isNotBlank", "(", "text", ")", ")", "{", "final", "StringBuilder", "b", "=", "n...
Returns a String which is surrounded by a box made of boxing char. @param boxing boxing character, eg '+' @param text @return
[ "Returns", "a", "String", "which", "is", "surrounded", "by", "a", "box", "made", "of", "boxing", "char", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/StringUtil.java#L544-L555
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java
CmsPreviewUtil.setImage
public static void setImage(String path, Map<String, String> attributes) { CmsJSONMap attributesJS = CmsJSONMap.createJSONMap(); for (Entry<String, String> entry : attributes.entrySet()) { attributesJS.put(entry.getKey(), entry.getValue()); } nativeSetImage(path, attributesJS); }
java
public static void setImage(String path, Map<String, String> attributes) { CmsJSONMap attributesJS = CmsJSONMap.createJSONMap(); for (Entry<String, String> entry : attributes.entrySet()) { attributesJS.put(entry.getKey(), entry.getValue()); } nativeSetImage(path, attributesJS); }
[ "public", "static", "void", "setImage", "(", "String", "path", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "CmsJSONMap", "attributesJS", "=", "CmsJSONMap", ".", "createJSONMap", "(", ")", ";", "for", "(", "Entry", "<", "String", ...
Sets the image tag within the rich text editor (FCKEditor, CKEditor, ...).<p> @param path the image path @param attributes the image tag attributes
[ "Sets", "the", "image", "tag", "within", "the", "rich", "text", "editor", "(", "FCKEditor", "CKEditor", "...", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java#L222-L229