repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
cdk/cdk
descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java
XLogPDescriptor.getAtomTypeXCount
private int getAtomTypeXCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int nocounter = 0; IBond bond; for (IAtom neighbour : neighbours) { if ((neighbour.getSymbol().equals("N") || neighbour.getSymbol().equals("O")) && !(Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) { //if (ac.getMaximumBondOrder(neighbours[i]) == 1.0) { bond = ac.getBond(neighbour, atom); if (bond.getOrder() != IBond.Order.DOUBLE) { nocounter += 1; } } } return nocounter; }
java
private int getAtomTypeXCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int nocounter = 0; IBond bond; for (IAtom neighbour : neighbours) { if ((neighbour.getSymbol().equals("N") || neighbour.getSymbol().equals("O")) && !(Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) { //if (ac.getMaximumBondOrder(neighbours[i]) == 1.0) { bond = ac.getBond(neighbour, atom); if (bond.getOrder() != IBond.Order.DOUBLE) { nocounter += 1; } } } return nocounter; }
[ "private", "int", "getAtomTypeXCount", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "List", "<", "IAtom", ">", "neighbours", "=", "ac", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "int", "nocounter", "=", "0", ";", "IBond", "bond",...
Gets the atomType X Count attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The nitrogenOrOxygenCount value
[ "Gets", "the", "atomType", "X", "Count", "attribute", "of", "the", "XLogPDescriptor", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1050-L1065
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.floorDivide
protected static final int floorDivide(int numerator, int denominator, int[] remainder) { if (numerator >= 0) { remainder[0] = numerator % denominator; return numerator / denominator; } int quotient = ((numerator + 1) / denominator) - 1; remainder[0] = numerator - (quotient * denominator); return quotient; }
java
protected static final int floorDivide(int numerator, int denominator, int[] remainder) { if (numerator >= 0) { remainder[0] = numerator % denominator; return numerator / denominator; } int quotient = ((numerator + 1) / denominator) - 1; remainder[0] = numerator - (quotient * denominator); return quotient; }
[ "protected", "static", "final", "int", "floorDivide", "(", "int", "numerator", ",", "int", "denominator", ",", "int", "[", "]", "remainder", ")", "{", "if", "(", "numerator", ">=", "0", ")", "{", "remainder", "[", "0", "]", "=", "numerator", "%", "deno...
Divide two integers, returning the floor of the quotient, and the modulus remainder. <p> Unlike the built-in division, this is mathematically well-behaved. E.g., <code>-1/4</code> =&gt; 0 and <code>-1%4</code> =&gt; -1, but <code>floorDivide(-1,4)</code> =&gt; -1 with <code>remainder[0]</code> =&gt; 3. @param numerator the numerator @param denominator a divisor which must be &gt; 0 @param remainder an array of at least one element in which the value <code>numerator mod denominator</code> is returned. Unlike <code>numerator % denominator</code>, this will always be non-negative. @return the floor of the quotient.
[ "Divide", "two", "integers", "returning", "the", "floor", "of", "the", "quotient", "and", "the", "modulus", "remainder", ".", "<p", ">", "Unlike", "the", "built", "-", "in", "division", "this", "is", "mathematically", "well", "-", "behaved", ".", "E", ".",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L6079-L6087
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/NameSpaceBinderImpl.java
NameSpaceBinderImpl.bindJavaGlobal
@Override public void bindJavaGlobal(String name, EJBBinding bindingObject) { String bindingName = buildJavaGlobalName(name); ejbJavaColonHelper.addGlobalBinding(bindingName, bindingObject); }
java
@Override public void bindJavaGlobal(String name, EJBBinding bindingObject) { String bindingName = buildJavaGlobalName(name); ejbJavaColonHelper.addGlobalBinding(bindingName, bindingObject); }
[ "@", "Override", "public", "void", "bindJavaGlobal", "(", "String", "name", ",", "EJBBinding", "bindingObject", ")", "{", "String", "bindingName", "=", "buildJavaGlobalName", "(", "name", ")", ";", "ejbJavaColonHelper", ".", "addGlobalBinding", "(", "bindingName", ...
Adds the EJB reference for later lookup in the java:global name space. @param name The lookup name. @param bindingObject The binding information.
[ "Adds", "the", "EJB", "reference", "for", "later", "lookup", "in", "the", "java", ":", "global", "name", "space", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/NameSpaceBinderImpl.java#L84-L88
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetVMSecurityRules
public SecurityGroupViewResultInner beginGetVMSecurityRules(String resourceGroupName, String networkWatcherName, String targetResourceId) { return beginGetVMSecurityRulesWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).toBlocking().single().body(); }
java
public SecurityGroupViewResultInner beginGetVMSecurityRules(String resourceGroupName, String networkWatcherName, String targetResourceId) { return beginGetVMSecurityRulesWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).toBlocking().single().body(); }
[ "public", "SecurityGroupViewResultInner", "beginGetVMSecurityRules", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "targetResourceId", ")", "{", "return", "beginGetVMSecurityRulesWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Gets the configured and effective security group rules on the specified VM. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param targetResourceId ID of the target VM. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SecurityGroupViewResultInner object if successful.
[ "Gets", "the", "configured", "and", "effective", "security", "group", "rules", "on", "the", "specified", "VM", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1370-L1372
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java
AStar.estimate
@Pure protected double estimate(PT p1, PT p2) { assert p1 != null && p2 != null; if (this.heuristic == null) { throw new IllegalStateException(Locale.getString("E1")); //$NON-NLS-1$ } return this.heuristic.evaluate(p1, p2); }
java
@Pure protected double estimate(PT p1, PT p2) { assert p1 != null && p2 != null; if (this.heuristic == null) { throw new IllegalStateException(Locale.getString("E1")); //$NON-NLS-1$ } return this.heuristic.evaluate(p1, p2); }
[ "@", "Pure", "protected", "double", "estimate", "(", "PT", "p1", ",", "PT", "p2", ")", "{", "assert", "p1", "!=", "null", "&&", "p2", "!=", "null", ";", "if", "(", "this", ".", "heuristic", "==", "null", ")", "{", "throw", "new", "IllegalStateExcepti...
Evaluate the distance between two points in the graph. <p>By default, this function uses the heuristic passed as parameter of the constructor. @param p1 the first point. @param p2 the second point. @return the evaluated distance between {@code p1} and {@code p2}.
[ "Evaluate", "the", "distance", "between", "two", "points", "in", "the", "graph", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L301-L308
buschmais/jqa-maven-plugin
src/main/java/com/buschmais/jqassistant/scm/maven/AbstractMojo.java
AbstractMojo.getStoreConfiguration
private StoreConfiguration getStoreConfiguration(MavenProject rootModule) { StoreConfiguration.StoreConfigurationBuilder builder = StoreConfiguration.builder(); if (store.getUri() == null) { File storeDirectory = OptionHelper.selectValue(new File(rootModule.getBuild().getDirectory(), STORE_DIRECTORY), this.storeDirectory); storeDirectory.getParentFile().mkdirs(); URI uri = new File(storeDirectory, "/").toURI(); builder.uri(uri); } else { builder.uri(store.getUri()); builder.username(store.getUsername()); builder.password(store.getPassword()); builder.encryptionLevel(store.getEncryptionLevel()); } builder.properties(store.getProperties()); builder.embedded(getEmbeddedNeo4jConfiguration()); StoreConfiguration storeConfiguration = builder.build(); getLog().debug("Using store configuration " + storeConfiguration); return storeConfiguration; }
java
private StoreConfiguration getStoreConfiguration(MavenProject rootModule) { StoreConfiguration.StoreConfigurationBuilder builder = StoreConfiguration.builder(); if (store.getUri() == null) { File storeDirectory = OptionHelper.selectValue(new File(rootModule.getBuild().getDirectory(), STORE_DIRECTORY), this.storeDirectory); storeDirectory.getParentFile().mkdirs(); URI uri = new File(storeDirectory, "/").toURI(); builder.uri(uri); } else { builder.uri(store.getUri()); builder.username(store.getUsername()); builder.password(store.getPassword()); builder.encryptionLevel(store.getEncryptionLevel()); } builder.properties(store.getProperties()); builder.embedded(getEmbeddedNeo4jConfiguration()); StoreConfiguration storeConfiguration = builder.build(); getLog().debug("Using store configuration " + storeConfiguration); return storeConfiguration; }
[ "private", "StoreConfiguration", "getStoreConfiguration", "(", "MavenProject", "rootModule", ")", "{", "StoreConfiguration", ".", "StoreConfigurationBuilder", "builder", "=", "StoreConfiguration", ".", "builder", "(", ")", ";", "if", "(", "store", ".", "getUri", "(", ...
Creates the {@link StoreConfiguration}. This is a copy of the {@link #store} enriched by default values and additional command line parameters. @param rootModule The root module. @return The directory.
[ "Creates", "the", "{", "@link", "StoreConfiguration", "}", ".", "This", "is", "a", "copy", "of", "the", "{", "@link", "#store", "}", "enriched", "by", "default", "values", "and", "additional", "command", "line", "parameters", "." ]
train
https://github.com/buschmais/jqa-maven-plugin/blob/5c21a8058fc1b013333081907fbf00d3525e11c3/src/main/java/com/buschmais/jqassistant/scm/maven/AbstractMojo.java#L449-L467
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setTime
public void setTime(final int parameterIndex, final Time time, final Calendar cal) throws SQLException { // SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); // sdf.setCalendar(cal); if(time == null) { setNull(parameterIndex, Types.TIME); return; } setParameter(parameterIndex, new TimeParameter(time.getTime())); }
java
public void setTime(final int parameterIndex, final Time time, final Calendar cal) throws SQLException { // SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); // sdf.setCalendar(cal); if(time == null) { setNull(parameterIndex, Types.TIME); return; } setParameter(parameterIndex, new TimeParameter(time.getTime())); }
[ "public", "void", "setTime", "(", "final", "int", "parameterIndex", ",", "final", "Time", "time", ",", "final", "Calendar", "cal", ")", "throws", "SQLException", "{", "// SimpleDateFormat sdf = new SimpleDateFormat(\"HH:mm:ss\");", "// sdf.setCalendar(cal);", ...
Sets the designated parameter to the given <code>java.sql.Time</code> value, using the given <code>Calendar</code> object. The driver uses the <code>Calendar</code> object to construct an SQL <code>TIME</code> value, which the driver then sends to the database. With a <code>Calendar</code> object, the driver can calculate the time taking into account a custom timezone. If no <code>Calendar</code> object is specified, the driver uses the default timezone, which is that of the virtual machine running the application. @param parameterIndex the first parameter is 1, the second is 2, ... @param time the parameter value @param cal the <code>Calendar</code> object the driver will use to construct the time @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> @since 1.2
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "java", ".", "sql", ".", "Time<", "/", "code", ">", "value", "using", "the", "given", "<code", ">", "Calendar<", "/", "code", ">", "object", ".", "The", "driver", "uses", "th...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L375-L385
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/Objects2.java
Objects2.checkNotEmpty
public static <T> T checkNotEmpty(T reference, Object errorMessage) { checkNotNull(reference, "Expected not null object, got '%s'", reference); checkNotEmpty(reference, String.valueOf(errorMessage), Arrays2.EMPTY_ARRAY); return reference; }
java
public static <T> T checkNotEmpty(T reference, Object errorMessage) { checkNotNull(reference, "Expected not null object, got '%s'", reference); checkNotEmpty(reference, String.valueOf(errorMessage), Arrays2.EMPTY_ARRAY); return reference; }
[ "public", "static", "<", "T", ">", "T", "checkNotEmpty", "(", "T", "reference", ",", "Object", "errorMessage", ")", "{", "checkNotNull", "(", "reference", ",", "\"Expected not null object, got '%s'\"", ",", "reference", ")", ";", "checkNotEmpty", "(", "reference",...
Performs emptiness and nullness check. @see #checkNotEmpty(Object, String, Object...)
[ "Performs", "emptiness", "and", "nullness", "check", "." ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Objects2.java#L604-L608
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuStreamCreateWithPriority
public static int cuStreamCreateWithPriority(CUstream phStream, int flags, int priority) { return checkResult(cuStreamCreateWithPriorityNative(phStream, flags, priority)); }
java
public static int cuStreamCreateWithPriority(CUstream phStream, int flags, int priority) { return checkResult(cuStreamCreateWithPriorityNative(phStream, flags, priority)); }
[ "public", "static", "int", "cuStreamCreateWithPriority", "(", "CUstream", "phStream", ",", "int", "flags", ",", "int", "priority", ")", "{", "return", "checkResult", "(", "cuStreamCreateWithPriorityNative", "(", "phStream", ",", "flags", ",", "priority", ")", ")",...
Create a stream with the given priority Creates a stream with the specified priority and returns a handle in phStream. This API alters the scheduler priority of work in the stream. Work in a higher priority stream may preempt work already executing in a low priority stream. priority follows a convention where lower numbers represent higher priorities. '0' represents default priority. The range of meaningful numerical priorities can be queried using ::cuCtxGetStreamPriorityRange. If the specified priority is outside the numerical range returned by ::cuCtxGetStreamPriorityRange, it will automatically be clamped to the lowest or the highest number in the range. @param phStream Returned newly created stream @param flags Flags for stream creation. See ::cuStreamCreate for a list of valid flags @param priority Stream priority. Lower numbers represent higher priorities. See ::cuCtxGetStreamPriorityRange for more information about meaningful stream priorities that can be passed. Note: Stream priorities are supported only on GPUs with compute capability 3.5 or higher. Note: In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations. @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_OUT_OF_MEMORY @see JCudaDriver#cuStreamDestroy @see JCudaDriver#cuStreamCreate @see JCudaDriver#cuStreamGetPriority @see JCudaDriver#cuCtxGetStreamPriorityRange @see JCudaDriver#cuStreamGetFlags @see JCudaDriver#cuStreamWaitEvent @see JCudaDriver#cuStreamQuery @see JCudaDriver#cuStreamSynchronize @see JCudaDriver#cuStreamAddCallback @see JCudaDriver#cudaStreamCreateWithPriority
[ "Create", "a", "stream", "with", "the", "given", "priority" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L14441-L14444
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.optionalStringAttribute
public static String optionalStringAttribute( final XMLStreamReader reader, final String localName, final String defaultValue) { return optionalStringAttribute(reader, null, localName, defaultValue); }
java
public static String optionalStringAttribute( final XMLStreamReader reader, final String localName, final String defaultValue) { return optionalStringAttribute(reader, null, localName, defaultValue); }
[ "public", "static", "String", "optionalStringAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ",", "final", "String", "defaultValue", ")", "{", "return", "optionalStringAttribute", "(", "reader", ",", "null", ",", "localNam...
Returns the value of an attribute as a String. 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", "String", ".", "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#L932-L937
alkacon/opencms-core
src/org/opencms/relations/CmsLinkUpdateUtil.java
CmsLinkUpdateUtil.updateXmlForVfsFile
public static void updateXmlForVfsFile(CmsLink link, Element element) { // if element is not null if (element != null) { // update the type attribute updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, link.getType().getNameForXml()); // update the sub-elements updateXml(link, element, false); } }
java
public static void updateXmlForVfsFile(CmsLink link, Element element) { // if element is not null if (element != null) { // update the type attribute updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, link.getType().getNameForXml()); // update the sub-elements updateXml(link, element, false); } }
[ "public", "static", "void", "updateXmlForVfsFile", "(", "CmsLink", "link", ",", "Element", "element", ")", "{", "// if element is not null", "if", "(", "element", "!=", "null", ")", "{", "// update the type attribute", "updateAttribute", "(", "element", ",", "CmsLin...
Updates the given xml element with this link information.<p> @param link the link to get the information from @param element the &lt;link&gt; element to update
[ "Updates", "the", "given", "xml", "element", "with", "this", "link", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsLinkUpdateUtil.java#L109-L118
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java
Table.createGSI
public Index createGSI( CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition) { return doCreateGSI(create, hashKeyDefinition, rangeKeyDefinition); }
java
public Index createGSI( CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition) { return doCreateGSI(create, hashKeyDefinition, rangeKeyDefinition); }
[ "public", "Index", "createGSI", "(", "CreateGlobalSecondaryIndexAction", "create", ",", "AttributeDefinition", "hashKeyDefinition", ",", "AttributeDefinition", "rangeKeyDefinition", ")", "{", "return", "doCreateGSI", "(", "create", ",", "hashKeyDefinition", ",", "rangeKeyDe...
Creates a global secondary index (GSI) with both a hash key and a range key on this table. Involves network calls. This table must be in the <code>ACTIVE</code> state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in the <code>CREATING</code> state. Once created, the index will be in <code>ACTIVE</code> state. @param create used to specify the details of the index creation @param hashKeyDefinition used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table. @param rangeKeyDefinition used to specify the attribute for describing the key schema for the range key of the GSI to be created for this table. @return the index being created
[ "Creates", "a", "global", "secondary", "index", "(", "GSI", ")", "with", "both", "a", "hash", "key", "and", "a", "range", "key", "on", "this", "table", ".", "Involves", "network", "calls", ".", "This", "table", "must", "be", "in", "the", "<code", ">", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java#L416-L421
alkacon/opencms-core
src/org/opencms/db/generic/CmsVfsDriver.java
CmsVfsDriver.internalCreateCounter
protected void internalCreateCounter(CmsDbContext dbc, String name, int value) throws CmsDbSqlException { PreparedStatement stmt = null; Connection conn = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, CmsProject.ONLINE_PROJECT_ID, "C_CREATE_COUNTER"); stmt.setString(1, name); stmt.setInt(2, value); stmt.executeUpdate(); } catch (SQLException e) { throw wrapException(stmt, e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
java
protected void internalCreateCounter(CmsDbContext dbc, String name, int value) throws CmsDbSqlException { PreparedStatement stmt = null; Connection conn = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, CmsProject.ONLINE_PROJECT_ID, "C_CREATE_COUNTER"); stmt.setString(1, name); stmt.setInt(2, value); stmt.executeUpdate(); } catch (SQLException e) { throw wrapException(stmt, e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
[ "protected", "void", "internalCreateCounter", "(", "CmsDbContext", "dbc", ",", "String", "name", ",", "int", "value", ")", "throws", "CmsDbSqlException", "{", "PreparedStatement", "stmt", "=", "null", ";", "Connection", "conn", "=", "null", ";", "try", "{", "c...
Creates a new counter.<p> @param dbc the database context @param name the name of the counter to create @param value the inital value of the counter @throws CmsDbSqlException if something goes wrong
[ "Creates", "a", "new", "counter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L3714-L3729
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_scheduler_serviceName_events_POST
public void billingAccount_scheduler_serviceName_events_POST(String billingAccount, String serviceName, OvhSchedulerCategoryEnum category, Date dateEnd, Date dateStart, String description, String title, String uid) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "category", category); addBody(o, "dateEnd", dateEnd); addBody(o, "dateStart", dateStart); addBody(o, "description", description); addBody(o, "title", title); addBody(o, "uid", uid); exec(qPath, "POST", sb.toString(), o); }
java
public void billingAccount_scheduler_serviceName_events_POST(String billingAccount, String serviceName, OvhSchedulerCategoryEnum category, Date dateEnd, Date dateStart, String description, String title, String uid) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "category", category); addBody(o, "dateEnd", dateEnd); addBody(o, "dateStart", dateStart); addBody(o, "description", description); addBody(o, "title", title); addBody(o, "uid", uid); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "billingAccount_scheduler_serviceName_events_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhSchedulerCategoryEnum", "category", ",", "Date", "dateEnd", ",", "Date", "dateStart", ",", "String", "description", ",", "String",...
Add a scheduler event REST: POST /telephony/{billingAccount}/scheduler/{serviceName}/events @param dateEnd [required] The ending date of the event @param category [required] The category of the event @param title [required] The title of the event @param uid [required] The unique ICS event identifier @param dateStart [required] The beginning date of the event @param description [required] The descritpion of the event @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Add", "a", "scheduler", "event" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L606-L617
RestComm/Restcomm-Connect
restcomm/restcomm.mscontrol.mms/src/main/java/org/restcomm/connect/mscontrol/mms/MmsConferenceController.java
MmsConferenceController.onJoinCall
private void onJoinCall(JoinCall message, ActorRef self, ActorRef sender) { connectionMode = message.getConnectionMode(); // Tell call to join conference by passing reference to the media mixer final JoinConference join = new JoinConference(this.cnfEndpoint, connectionMode, message.getSid()); message.getCall().tell(join, sender); }
java
private void onJoinCall(JoinCall message, ActorRef self, ActorRef sender) { connectionMode = message.getConnectionMode(); // Tell call to join conference by passing reference to the media mixer final JoinConference join = new JoinConference(this.cnfEndpoint, connectionMode, message.getSid()); message.getCall().tell(join, sender); }
[ "private", "void", "onJoinCall", "(", "JoinCall", "message", ",", "ActorRef", "self", ",", "ActorRef", "sender", ")", "{", "connectionMode", "=", "message", ".", "getConnectionMode", "(", ")", ";", "// Tell call to join conference by passing reference to the media mixer",...
/*private void onMediaGroupStateChanged(MediaGroupStateChanged message, ActorRef self, ActorRef sender) throws Exception { switch (message.state()) { case ACTIVE: if (is(creatingMediaGroup)) { fsm.transition(message, gettingCnfMediaResourceController); } break; case INACTIVE: if (is(creatingMediaGroup)) { this.fail = Boolean.TRUE; fsm.transition(message, failed); } else if (is(stopping)) { Stop media group actor this.mediaGroup.tell(new StopObserving(self), self); context().stop(mediaGroup); this.mediaGroup = null; Move to next state if (this.mediaGroup == null && this.cnfEndpoint == null) { this.fsm.transition(message, fail ? failed : inactive); } } break; default: break; } }
[ "/", "*", "private", "void", "onMediaGroupStateChanged", "(", "MediaGroupStateChanged", "message", "ActorRef", "self", "ActorRef", "sender", ")", "throws", "Exception", "{", "switch", "(", "message", ".", "state", "()", ")", "{", "case", "ACTIVE", ":", "if", "...
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.mscontrol.mms/src/main/java/org/restcomm/connect/mscontrol/mms/MmsConferenceController.java#L380-L385
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java
NonplanarBonds.hasOnlyPlainBonds
private boolean hasOnlyPlainBonds(int v, IBond allowedDoubleBond) { int count = 0; for (int neighbor : graph[v]) { IBond adjBond = edgeToBond.get(v, neighbor); // non single bonds if (adjBond.getOrder().numeric() > 1) { if (!allowedDoubleBond.equals(adjBond)) { return false; } } // single bonds else { if (adjBond.getStereo() == UP_OR_DOWN || adjBond.getStereo() == UP_OR_DOWN_INVERTED) { return false; } count++; } } return count > 0; }
java
private boolean hasOnlyPlainBonds(int v, IBond allowedDoubleBond) { int count = 0; for (int neighbor : graph[v]) { IBond adjBond = edgeToBond.get(v, neighbor); // non single bonds if (adjBond.getOrder().numeric() > 1) { if (!allowedDoubleBond.equals(adjBond)) { return false; } } // single bonds else { if (adjBond.getStereo() == UP_OR_DOWN || adjBond.getStereo() == UP_OR_DOWN_INVERTED) { return false; } count++; } } return count > 0; }
[ "private", "boolean", "hasOnlyPlainBonds", "(", "int", "v", ",", "IBond", "allowedDoubleBond", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "neighbor", ":", "graph", "[", "v", "]", ")", "{", "IBond", "adjBond", "=", "edgeToBond", ".", "g...
Check that an atom (v:index) is only adjacent to plain single bonds (may be a bold or hashed wedged - e.g. at fat end) with the single exception being the allowed double bond passed as an argument. @param v atom index @param allowedDoubleBond a double bond that is allowed @return the atom is adjacent to one or more plain single bonds
[ "Check", "that", "an", "atom", "(", "v", ":", "index", ")", "is", "only", "adjacent", "to", "plain", "single", "bonds", "(", "may", "be", "a", "bold", "or", "hashed", "wedged", "-", "e", ".", "g", ".", "at", "fat", "end", ")", "with", "the", "sin...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java#L1184-L1203
jmxtrans/jmxtrans
jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StackdriverWriter.java
StackdriverWriter.internalWrite
@Override public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { String gatewayMessage = getGatewayMessage(results); // message won't be returned if there are no numeric values in the query results if (gatewayMessage != null) { logger.info(gatewayMessage); doSend(gatewayMessage); } }
java
@Override public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { String gatewayMessage = getGatewayMessage(results); // message won't be returned if there are no numeric values in the query results if (gatewayMessage != null) { logger.info(gatewayMessage); doSend(gatewayMessage); } }
[ "@", "Override", "public", "void", "internalWrite", "(", "Server", "server", ",", "Query", "query", ",", "ImmutableList", "<", "Result", ">", "results", ")", "throws", "Exception", "{", "String", "gatewayMessage", "=", "getGatewayMessage", "(", "results", ")", ...
Implementation of the base writing method. Operates in two stages: <br/> First turns the query result into a JSON message in Stackdriver format <br/> Second posts the message to the Stackdriver gateway via HTTP
[ "Implementation", "of", "the", "base", "writing", "method", ".", "Operates", "in", "two", "stages", ":", "<br", "/", ">", "First", "turns", "the", "query", "result", "into", "a", "JSON", "message", "in", "Stackdriver", "format", "<br", "/", ">", "Second", ...
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StackdriverWriter.java#L260-L269
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSplitPaneDividerBackground
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JSplitPane.HORIZONTAL_SPLIT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
java
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JSplitPane.HORIZONTAL_SPLIT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
[ "public", "void", "paintSplitPaneDividerBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "if", "(", "orientation", "==", "JSplitPane"...
Paints the background of the divider of a split pane. This implementation invokes the method of the same name without the orientation. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
[ "Paints", "the", "background", "of", "the", "divider", "of", "a", "split", "pane", ".", "This", "implementation", "invokes", "the", "method", "of", "the", "same", "name", "without", "the", "orientation", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1838-L1848
alkacon/opencms-core
src/org/opencms/configuration/CmsSetNextRule.java
CmsSetNextRule.finish
public void finish(String namespace, String name) throws Exception { String dummy = name; dummy = namespace; dummy = null; m_bodyText = dummy; }
java
public void finish(String namespace, String name) throws Exception { String dummy = name; dummy = namespace; dummy = null; m_bodyText = dummy; }
[ "public", "void", "finish", "(", "String", "namespace", ",", "String", "name", ")", "throws", "Exception", "{", "String", "dummy", "=", "name", ";", "dummy", "=", "namespace", ";", "dummy", "=", "null", ";", "m_bodyText", "=", "dummy", ";", "}" ]
Clean up after parsing is complete.<p> @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace aware or the element has no namespace @param name the local name if the parser is namespace aware, or just the element name otherwise @throws Exception if something goes wrong
[ "Clean", "up", "after", "parsing", "is", "complete", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsSetNextRule.java#L365-L371
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multTransB
public static void multTransB(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { // TODO add a matrix vectory multiply here MatrixMatrixMult_DDRM.multTransB(alpha,a,b,c); }
java
public static void multTransB(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { // TODO add a matrix vectory multiply here MatrixMatrixMult_DDRM.multTransB(alpha,a,b,c); }
[ "public", "static", "void", "multTransB", "(", "double", "alpha", ",", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "// TODO add a matrix vectory multiply here", "MatrixMatrixMult_DDRM", ".", "multTransB", "(", "alpha", ",", "a", ...
<p> Performs the following operation:<br> <br> c = &alpha; * a * b<sup>T</sup> <br> c<sub>ij</sub> = &alpha; &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>} </p> @param alpha Scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "&alpha", ";", "*", "a", "*", "b<sup", ">", "T<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&alpha", ";", "&sum", ";",...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L197-L201
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/tree/TreeContext.java
TreeContext.setMetadata
public Object setMetadata(ITree node, String key, Object value) { if (node == null) return setMetadata(key, value); else { Object res = node.setMetadata(key, value); if (res == null) return getMetadata(key); return res; } }
java
public Object setMetadata(ITree node, String key, Object value) { if (node == null) return setMetadata(key, value); else { Object res = node.setMetadata(key, value); if (res == null) return getMetadata(key); return res; } }
[ "public", "Object", "setMetadata", "(", "ITree", "node", ",", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "node", "==", "null", ")", "return", "setMetadata", "(", "key", ",", "value", ")", ";", "else", "{", "Object", "res", "=", "no...
Store a local metadata @param key of the metadata @param value of the metadata @return the previous value of metadata if existed or null
[ "Store", "a", "local", "metadata" ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/tree/TreeContext.java#L108-L117
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java
ObjectReader.getPropertyValue
private Object getPropertyValue(Object pObj, String pProperty) { Method m = null; Class[] cl = new Class[0]; try { //return Util.getPropertyValue(pObj, pProperty); // Find method m = pObj.getClass(). getMethod("get" + StringUtil.capitalize(pProperty), new Class[0]); // Invoke it Object result = m.invoke(pObj, new Object[0]); return result; } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (InvocationTargetException ite) { ite.printStackTrace(); } return null; }
java
private Object getPropertyValue(Object pObj, String pProperty) { Method m = null; Class[] cl = new Class[0]; try { //return Util.getPropertyValue(pObj, pProperty); // Find method m = pObj.getClass(). getMethod("get" + StringUtil.capitalize(pProperty), new Class[0]); // Invoke it Object result = m.invoke(pObj, new Object[0]); return result; } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (InvocationTargetException ite) { ite.printStackTrace(); } return null; }
[ "private", "Object", "getPropertyValue", "(", "Object", "pObj", ",", "String", "pProperty", ")", "{", "Method", "m", "=", "null", ";", "Class", "[", "]", "cl", "=", "new", "Class", "[", "0", "]", ";", "try", "{", "//return Util.getPropertyValue(pObj, pProper...
Gets the property value from an object using reflection @param obj The object to get a property from @param property The name of the property @return The property value as an Object
[ "Gets", "the", "property", "value", "from", "an", "object", "using", "reflection" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L368-L395
alkacon/opencms-core
src/org/opencms/ui/login/CmsLoginController.java
CmsLoginController.logout
public static void logout(CmsObject cms, HttpServletRequest request, HttpServletResponse response) throws IOException { String loggedInUser = cms.getRequestContext().getCurrentUser().getName(); HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); /* we need this because a new session might be created after this method, but before the session info is updated in OpenCmsCore.showResource. */ cms.getRequestContext().setUpdateSessionEnabled(false); } // logout was successful if (LOG.isInfoEnabled()) { LOG.info( org.opencms.jsp.Messages.get().getBundle().key( org.opencms.jsp.Messages.LOG_LOGOUT_SUCCESFUL_3, loggedInUser, cms.getRequestContext().addSiteRoot(cms.getRequestContext().getUri()), cms.getRequestContext().getRemoteAddress())); } response.sendRedirect(getFormLink(cms)); }
java
public static void logout(CmsObject cms, HttpServletRequest request, HttpServletResponse response) throws IOException { String loggedInUser = cms.getRequestContext().getCurrentUser().getName(); HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); /* we need this because a new session might be created after this method, but before the session info is updated in OpenCmsCore.showResource. */ cms.getRequestContext().setUpdateSessionEnabled(false); } // logout was successful if (LOG.isInfoEnabled()) { LOG.info( org.opencms.jsp.Messages.get().getBundle().key( org.opencms.jsp.Messages.LOG_LOGOUT_SUCCESFUL_3, loggedInUser, cms.getRequestContext().addSiteRoot(cms.getRequestContext().getUri()), cms.getRequestContext().getRemoteAddress())); } response.sendRedirect(getFormLink(cms)); }
[ "public", "static", "void", "logout", "(", "CmsObject", "cms", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "String", "loggedInUser", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getCurre...
Logs out the current user redirecting to the login form afterwards.<p> @param cms the cms context @param request the servlet request @param response the servlet response @throws IOException if writing to the response fails
[ "Logs", "out", "the", "current", "user", "redirecting", "to", "the", "login", "form", "afterwards", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginController.java#L357-L378
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java
ParseUtils.unsupportedElement
public static XMLStreamException unsupportedElement(final XMLExtendedStreamReader reader, String supportedElement) { XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unsupportedElement( new QName(reader.getNamespaceURI(), reader.getLocalName(),reader.getPrefix()), reader.getLocation(), supportedElement); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.UNSUPPORTED_ELEMENT) .element(reader.getName()) .alternatives(new HashSet<String>() {{add(supportedElement);}}), ex); }
java
public static XMLStreamException unsupportedElement(final XMLExtendedStreamReader reader, String supportedElement) { XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unsupportedElement( new QName(reader.getNamespaceURI(), reader.getLocalName(),reader.getPrefix()), reader.getLocation(), supportedElement); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.UNSUPPORTED_ELEMENT) .element(reader.getName()) .alternatives(new HashSet<String>() {{add(supportedElement);}}), ex); }
[ "public", "static", "XMLStreamException", "unsupportedElement", "(", "final", "XMLExtendedStreamReader", "reader", ",", "String", "supportedElement", ")", "{", "XMLStreamException", "ex", "=", "ControllerLogger", ".", "ROOT_LOGGER", ".", "unsupportedElement", "(", "new", ...
Get an exception reporting a missing, required XML attribute. @param reader the stream reader @param supportedElement the element that is to be used in place of the unsupported one. @return the exception
[ "Get", "an", "exception", "reporting", "a", "missing", "required", "XML", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L644-L653
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.setObject
@Override public void setObject(String parameterName, Object x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public void setObject(String parameterName, Object x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setObject", "(", "String", "parameterName", ",", "Object", "x", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the value of the designated parameter with the given object.
[ "Sets", "the", "value", "of", "the", "designated", "parameter", "with", "the", "given", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L831-L836
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java
ApiOvhHostingprivateDatabase.serviceName_dump_dumpId_GET
public OvhDump serviceName_dump_dumpId_GET(String serviceName, Long dumpId) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/dump/{dumpId}"; StringBuilder sb = path(qPath, serviceName, dumpId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDump.class); }
java
public OvhDump serviceName_dump_dumpId_GET(String serviceName, Long dumpId) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/dump/{dumpId}"; StringBuilder sb = path(qPath, serviceName, dumpId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDump.class); }
[ "public", "OvhDump", "serviceName_dump_dumpId_GET", "(", "String", "serviceName", ",", "Long", "dumpId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/privateDatabase/{serviceName}/dump/{dumpId}\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Get this object properties REST: GET /hosting/privateDatabase/{serviceName}/dump/{dumpId} @param serviceName [required] The internal name of your private database @param dumpId [required] Dump id
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L671-L676
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.saveElementValue
protected void saveElementValue(String field, Page page) throws TechnicalException, FailureException { logger.debug("saveValueInStep: {} in {}.", field, page.getApplication()); saveElementValue(field, page.getPageKey() + field, page); }
java
protected void saveElementValue(String field, Page page) throws TechnicalException, FailureException { logger.debug("saveValueInStep: {} in {}.", field, page.getApplication()); saveElementValue(field, page.getPageKey() + field, page); }
[ "protected", "void", "saveElementValue", "(", "String", "field", ",", "Page", "page", ")", "throws", "TechnicalException", ",", "FailureException", "{", "logger", ".", "debug", "(", "\"saveValueInStep: {} in {}.\"", ",", "field", ",", "page", ".", "getApplication", ...
Save value in memory using default target key (Page key + field). @param field is name of the field to retrieve. @param page is target page. @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT} message (with screenshot, with exception) or with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_RETRIEVE_VALUE} message (with screenshot, with exception) @throws FailureException if the scenario encounters a functional error
[ "Save", "value", "in", "memory", "using", "default", "target", "key", "(", "Page", "key", "+", "field", ")", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L546-L549
ocpsoft/prettytime
nlp/src/main/java/org/ocpsoft/prettytime/nlp/PrettyTimeParser.java
PrettyTimeParser.parseSyntax
public List<DateGroup> parseSyntax(String language) { language = words2numbers(language); List<DateGroup> result = new ArrayList<DateGroup>(); List<com.joestelmach.natty.DateGroup> groups = parser.parse(language); Date now = new Date(); for (com.joestelmach.natty.DateGroup group : groups) { result.add(new DateGroupImpl(now, group)); } return result; }
java
public List<DateGroup> parseSyntax(String language) { language = words2numbers(language); List<DateGroup> result = new ArrayList<DateGroup>(); List<com.joestelmach.natty.DateGroup> groups = parser.parse(language); Date now = new Date(); for (com.joestelmach.natty.DateGroup group : groups) { result.add(new DateGroupImpl(now, group)); } return result; }
[ "public", "List", "<", "DateGroup", ">", "parseSyntax", "(", "String", "language", ")", "{", "language", "=", "words2numbers", "(", "language", ")", ";", "List", "<", "DateGroup", ">", "result", "=", "new", "ArrayList", "<", "DateGroup", ">", "(", ")", "...
Parse the given language and return a {@link List} with all discovered {@link DateGroup} instances.
[ "Parse", "the", "given", "language", "and", "return", "a", "{" ]
train
https://github.com/ocpsoft/prettytime/blob/8a742bd1d8eaacc2a36865d144a43ea0211e25b7/nlp/src/main/java/org/ocpsoft/prettytime/nlp/PrettyTimeParser.java#L160-L171
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java
ContextItems.getItem
public String getItem(String itemName, String suffix) { return items.get(lookupItemName(itemName, suffix, false)); }
java
public String getItem(String itemName, String suffix) { return items.get(lookupItemName(itemName, suffix, false)); }
[ "public", "String", "getItem", "(", "String", "itemName", ",", "String", "suffix", ")", "{", "return", "items", ".", "get", "(", "lookupItemName", "(", "itemName", ",", "suffix", ",", "false", ")", ")", ";", "}" ]
Retrieves a context item qualified by a suffix. @param itemName Item name @param suffix Item suffix @return Item value
[ "Retrieves", "a", "context", "item", "qualified", "by", "a", "suffix", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L195-L197
elki-project/elki
elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java
APRIORI.binarySearch
private int binarySearch(List<SparseItemset> candidates, SparseItemset scratch, int begin, int end) { --end; while(begin < end) { final int mid = (begin + end) >>> 1; SparseItemset midVal = candidates.get(mid); int cmp = midVal.compareTo(scratch); if(cmp < 0) { begin = mid + 1; } else if(cmp > 0) { end = mid - 1; } else { return mid; // key found } } return -(begin + 1); // key not found, return next }
java
private int binarySearch(List<SparseItemset> candidates, SparseItemset scratch, int begin, int end) { --end; while(begin < end) { final int mid = (begin + end) >>> 1; SparseItemset midVal = candidates.get(mid); int cmp = midVal.compareTo(scratch); if(cmp < 0) { begin = mid + 1; } else if(cmp > 0) { end = mid - 1; } else { return mid; // key found } } return -(begin + 1); // key not found, return next }
[ "private", "int", "binarySearch", "(", "List", "<", "SparseItemset", ">", "candidates", ",", "SparseItemset", "scratch", ",", "int", "begin", ",", "int", "end", ")", "{", "--", "end", ";", "while", "(", "begin", "<", "end", ")", "{", "final", "int", "m...
Binary-search for the next-larger element. @param candidates Candidates to search for @param scratch Scratch space @param begin Search interval begin @param end Search interval end @return Position of first equal-or-larger element
[ "Binary", "-", "search", "for", "the", "next", "-", "larger", "element", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java#L541-L559
ModeShape/modeshape
index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/LuceneQueryFactory.java
LuceneQueryFactory.forMultiColumnIndex
public static LuceneQueryFactory forMultiColumnIndex( ValueFactories factories, Map<String, Object> variables, Map<String, PropertyType> propertyTypesByName ) { return new LuceneQueryFactory(factories, variables, propertyTypesByName); }
java
public static LuceneQueryFactory forMultiColumnIndex( ValueFactories factories, Map<String, Object> variables, Map<String, PropertyType> propertyTypesByName ) { return new LuceneQueryFactory(factories, variables, propertyTypesByName); }
[ "public", "static", "LuceneQueryFactory", "forMultiColumnIndex", "(", "ValueFactories", "factories", ",", "Map", "<", "String", ",", "Object", ">", "variables", ",", "Map", "<", "String", ",", "PropertyType", ">", "propertyTypesByName", ")", "{", "return", "new", ...
Creates a new query factory which can be used to produce Lucene queries for {@link org.modeshape.jcr.index.lucene.MultiColumnIndex} indexes. @param factories a {@link ValueFactories} instance; may not be null @param variables a {@link Map} instance which contains the query variables for a particular query; may be {@code null} @param propertyTypesByName a {@link Map} representing the columns and their types for the index definition for which the query should be created; may not be null. @return a {@link LuceneQueryFactory} instance, never {@code null}
[ "Creates", "a", "new", "query", "factory", "which", "can", "be", "used", "to", "produce", "Lucene", "queries", "for", "{", "@link", "org", ".", "modeshape", ".", "jcr", ".", "index", ".", "lucene", ".", "MultiColumnIndex", "}", "indexes", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/LuceneQueryFactory.java#L126-L130
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsConfigurationCache.java
CmsConfigurationCache.isDetailPage
public boolean isDetailPage(CmsObject cms, CmsResource resource) { try { boolean result = m_detailPageIdCache.get(resource).booleanValue(); if (!result) { // We want new detail pages to be available fast, so we don't cache negative results m_detailPageIdCache.invalidate(resource); } return result; } catch (ExecutionException e) { LOG.error(e.getLocalizedMessage(), e); return true; } }
java
public boolean isDetailPage(CmsObject cms, CmsResource resource) { try { boolean result = m_detailPageIdCache.get(resource).booleanValue(); if (!result) { // We want new detail pages to be available fast, so we don't cache negative results m_detailPageIdCache.invalidate(resource); } return result; } catch (ExecutionException e) { LOG.error(e.getLocalizedMessage(), e); return true; } }
[ "public", "boolean", "isDetailPage", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "try", "{", "boolean", "result", "=", "m_detailPageIdCache", ".", "get", "(", "resource", ")", ".", "booleanValue", "(", ")", ";", "if", "(", "!", "resu...
Checks if the given resource is a detail page.<p> Delegates the actual work to the cache state, but also caches the result.<p> @param cms the current CMS context @param resource the resource to check @return true if the given resource is a detail page
[ "Checks", "if", "the", "given", "resource", "is", "a", "detail", "page", ".", "<p", ">", "Delegates", "the", "actual", "work", "to", "the", "cache", "state", "but", "also", "caches", "the", "result", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationCache.java#L266-L279
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspImageBean.java
CmsJspImageBean.addSrcSetWidthVariants
public void addSrcSetWidthVariants(int minWidth, int maxWidth) { int imageWidth = getWidth(); if (imageWidth > minWidth) { // only add variants in case the image is larger then the given minimum int srcSetMaxWidth = getSrcSetMaxWidth(); for (double factor : m_sizeVariants) { long width = Math.round(imageWidth * factor); if (width > srcSetMaxWidth) { if (width <= maxWidth) { setSrcSets(createWidthVariation(String.valueOf(width))); } } else { break; } } } }
java
public void addSrcSetWidthVariants(int minWidth, int maxWidth) { int imageWidth = getWidth(); if (imageWidth > minWidth) { // only add variants in case the image is larger then the given minimum int srcSetMaxWidth = getSrcSetMaxWidth(); for (double factor : m_sizeVariants) { long width = Math.round(imageWidth * factor); if (width > srcSetMaxWidth) { if (width <= maxWidth) { setSrcSets(createWidthVariation(String.valueOf(width))); } } else { break; } } } }
[ "public", "void", "addSrcSetWidthVariants", "(", "int", "minWidth", ",", "int", "maxWidth", ")", "{", "int", "imageWidth", "=", "getWidth", "(", ")", ";", "if", "(", "imageWidth", ">", "minWidth", ")", "{", "// only add variants in case the image is larger then the ...
Adds a number of size variations to the source set.<p> In case the screen size is not really known, it may be a good idea to add some variations for large images to make sure there are some common options in case the basic image is very large.<p> @param minWidth the minimum image width to add size variations for @param maxWidth the maximum width size variation to create
[ "Adds", "a", "number", "of", "size", "variations", "to", "the", "source", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspImageBean.java#L380-L397
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/associate/BaseAssociateLocation2DFilter.java
BaseAssociateLocation2DFilter.backwardsValidation
private boolean backwardsValidation(int indexSrc, int bestIndex) { double bestScoreV = maxError; int bestIndexV = -1; D d_forward = descDst.get(bestIndex); setActiveSource(locationDst.get(bestIndex)); for( int j = 0; j < locationSrc.size(); j++ ) { // compute distance between the two features double distance = computeDistanceToSource(locationSrc.get(j)); if( distance > maxDistance ) continue; D d_v = descSrc.get(j); double score = scoreAssociation.score(d_forward,d_v); if( score < bestScoreV ) { bestScoreV = score; bestIndexV = j; } } return bestIndexV == indexSrc; }
java
private boolean backwardsValidation(int indexSrc, int bestIndex) { double bestScoreV = maxError; int bestIndexV = -1; D d_forward = descDst.get(bestIndex); setActiveSource(locationDst.get(bestIndex)); for( int j = 0; j < locationSrc.size(); j++ ) { // compute distance between the two features double distance = computeDistanceToSource(locationSrc.get(j)); if( distance > maxDistance ) continue; D d_v = descSrc.get(j); double score = scoreAssociation.score(d_forward,d_v); if( score < bestScoreV ) { bestScoreV = score; bestIndexV = j; } } return bestIndexV == indexSrc; }
[ "private", "boolean", "backwardsValidation", "(", "int", "indexSrc", ",", "int", "bestIndex", ")", "{", "double", "bestScoreV", "=", "maxError", ";", "int", "bestIndexV", "=", "-", "1", ";", "D", "d_forward", "=", "descDst", ".", "get", "(", "bestIndex", "...
Finds the best match for an index in destination and sees if it matches the source index @param indexSrc The index in source being examined @param bestIndex Index in dst with the best fit to source @return true if a match was found and false if not
[ "Finds", "the", "best", "match", "for", "an", "index", "in", "destination", "and", "sees", "if", "it", "matches", "the", "source", "index" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/associate/BaseAssociateLocation2DFilter.java#L167-L191
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
FSEditLog.logOpenFile
public void logOpenFile(String path, INodeFileUnderConstruction newNode) throws IOException { AddOp op = AddOp.getInstance(); op.set(newNode.getId(), path, newNode.getReplication(), newNode.getModificationTime(), newNode.getAccessTime(), newNode.getPreferredBlockSize(), newNode.getBlocks(), newNode.getPermissionStatus(), newNode.getClientName(), newNode.getClientMachine()); logEdit(op); }
java
public void logOpenFile(String path, INodeFileUnderConstruction newNode) throws IOException { AddOp op = AddOp.getInstance(); op.set(newNode.getId(), path, newNode.getReplication(), newNode.getModificationTime(), newNode.getAccessTime(), newNode.getPreferredBlockSize(), newNode.getBlocks(), newNode.getPermissionStatus(), newNode.getClientName(), newNode.getClientMachine()); logEdit(op); }
[ "public", "void", "logOpenFile", "(", "String", "path", ",", "INodeFileUnderConstruction", "newNode", ")", "throws", "IOException", "{", "AddOp", "op", "=", "AddOp", ".", "getInstance", "(", ")", ";", "op", ".", "set", "(", "newNode", ".", "getId", "(", ")...
Add open lease record to edit log. Records the block locations of the last block.
[ "Add", "open", "lease", "record", "to", "edit", "log", ".", "Records", "the", "block", "locations", "of", "the", "last", "block", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java#L729-L743
mguymon/model-citizen
core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java
ModelFactory.setRegisterBlueprints
public void setRegisterBlueprints(Collection blueprints) throws RegisterBlueprintException { for (Object blueprint : blueprints) { if (blueprint instanceof Class) { registerBlueprint((Class) blueprint); } else if (blueprint instanceof String) { registerBlueprint((String) blueprint); } else if (blueprint instanceof String) { registerBlueprint(blueprint); } else { throw new RegisterBlueprintException("Only supports List comprised of Class<Blueprint>, Blueprint, or String className"); } } }
java
public void setRegisterBlueprints(Collection blueprints) throws RegisterBlueprintException { for (Object blueprint : blueprints) { if (blueprint instanceof Class) { registerBlueprint((Class) blueprint); } else if (blueprint instanceof String) { registerBlueprint((String) blueprint); } else if (blueprint instanceof String) { registerBlueprint(blueprint); } else { throw new RegisterBlueprintException("Only supports List comprised of Class<Blueprint>, Blueprint, or String className"); } } }
[ "public", "void", "setRegisterBlueprints", "(", "Collection", "blueprints", ")", "throws", "RegisterBlueprintException", "{", "for", "(", "Object", "blueprint", ":", "blueprints", ")", "{", "if", "(", "blueprint", "instanceof", "Class", ")", "{", "registerBlueprint"...
Register a List of Blueprint, Class, or String class names of Blueprint @param blueprints List @throws RegisterBlueprintException failed to register blueprint
[ "Register", "a", "List", "of", "Blueprint", "Class", "or", "String", "class", "names", "of", "Blueprint" ]
train
https://github.com/mguymon/model-citizen/blob/9078ab4121897a21e598dd4f0efa6996b46e4dea/core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java#L150-L162
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/CmsCoreProvider.java
CmsCoreProvider.getResourceState
public void getResourceState(final CmsUUID structureId, final AsyncCallback<CmsResourceState> callback) { CmsRpcAction<CmsResourceState> action = new CmsRpcAction<CmsResourceState>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { start(0, false); getService().getResourceState(structureId, this); } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(CmsResourceState result) { stop(false); callback.onSuccess(result); } }; action.execute(); }
java
public void getResourceState(final CmsUUID structureId, final AsyncCallback<CmsResourceState> callback) { CmsRpcAction<CmsResourceState> action = new CmsRpcAction<CmsResourceState>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { start(0, false); getService().getResourceState(structureId, this); } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(CmsResourceState result) { stop(false); callback.onSuccess(result); } }; action.execute(); }
[ "public", "void", "getResourceState", "(", "final", "CmsUUID", "structureId", ",", "final", "AsyncCallback", "<", "CmsResourceState", ">", "callback", ")", "{", "CmsRpcAction", "<", "CmsResourceState", ">", "action", "=", "new", "CmsRpcAction", "<", "CmsResourceStat...
Fetches the state of a resource from the server.<p> @param structureId the structure id of the resource @param callback the callback which should receive the result
[ "Fetches", "the", "state", "of", "a", "resource", "from", "the", "server", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/CmsCoreProvider.java#L312-L337
lesaint/damapping
core-parent/util/src/main/java/fr/javatronic/damapping/util/Preconditions.java
Preconditions.checkArgument
public static void checkArgument(boolean test, @Nullable String message) { if (!test) { throw new IllegalArgumentException(message == null || message.isEmpty() ? IAE_DEFAULT_MSG : message); } }
java
public static void checkArgument(boolean test, @Nullable String message) { if (!test) { throw new IllegalArgumentException(message == null || message.isEmpty() ? IAE_DEFAULT_MSG : message); } }
[ "public", "static", "void", "checkArgument", "(", "boolean", "test", ",", "@", "Nullable", "String", "message", ")", "{", "if", "(", "!", "test", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", "==", "null", "||", "message", ".", "isE...
Throws a {@link IllegalArgumentException} with the specified message if the specified boolean value is false. <p> A default message will be used if the specified message is {@code null} or empty. </p> @param test a boolean value @param message a {@link String} or {@code null}
[ "Throws", "a", "{", "@link", "IllegalArgumentException", "}", "with", "the", "specified", "message", "if", "the", "specified", "boolean", "value", "is", "false", ".", "<p", ">", "A", "default", "message", "will", "be", "used", "if", "the", "specified", "mess...
train
https://github.com/lesaint/damapping/blob/357afa5866939fd2a18c09213975ffef4836f328/core-parent/util/src/main/java/fr/javatronic/damapping/util/Preconditions.java#L91-L95
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.changeSign
public static void changeSign(DMatrixD1 input , DMatrixD1 output) { output.reshape(input.numRows,input.numCols); final int size = input.getNumElements(); for( int i = 0; i < size; i++ ) { output.data[i] = -input.data[i]; } }
java
public static void changeSign(DMatrixD1 input , DMatrixD1 output) { output.reshape(input.numRows,input.numCols); final int size = input.getNumElements(); for( int i = 0; i < size; i++ ) { output.data[i] = -input.data[i]; } }
[ "public", "static", "void", "changeSign", "(", "DMatrixD1", "input", ",", "DMatrixD1", "output", ")", "{", "output", ".", "reshape", "(", "input", ".", "numRows", ",", "input", ".", "numCols", ")", ";", "final", "int", "size", "=", "input", ".", "getNumE...
<p> Changes the sign of every element in the matrix.<br> <br> output<sub>ij</sub> = -input<sub>ij</sub> </p> @param input A matrix. Modified.
[ "<p", ">", "Changes", "the", "sign", "of", "every", "element", "in", "the", "matrix", ".", "<br", ">", "<br", ">", "output<sub", ">", "ij<", "/", "sub", ">", "=", "-", "input<sub", ">", "ij<", "/", "sub", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2528-L2537
i-net-software/jlessc
src/com/inet/lib/less/CustomFunctions.java
CustomFunctions.colorizeImage
static void colorizeImage( CssFormatter formatter, List<Expression> parameters ) throws IOException { if( parameters.size() < 4 ) { throw new LessException( "error evaluating function colorize-image expects url, main_color, contrast_color " ); } String relativeURL = parameters.get( 0 ).stringValue( formatter ); String urlString = parameters.get( 1 ).stringValue( formatter ); URL url = new URL( formatter.getBaseURL(), relativeURL ); String urlStr = UrlUtils.removeQuote( urlString ); url = new URL( url, urlStr ); int mainColor = ColorUtils.argb( UrlUtils.getColor( parameters.get( 2 ), formatter ) ); int contrastColor = ColorUtils.argb( UrlUtils.getColor( parameters.get( 3 ), formatter ) ); BufferedImage loadedImage = ImageIO.read( url.openStream() ); // convert the image in a standard color model int width = loadedImage.getWidth( null ); int height = loadedImage.getHeight( null ); BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB ); Graphics2D bGr = image.createGraphics(); bGr.drawImage( loadedImage, 0, 0, null ); bGr.dispose(); final float[] mainColorHsb = Color.RGBtoHSB( (mainColor >> 16) & 0xFF, (mainColor >> 8) & 0xFF, mainColor & 0xFF, null ); final float[] contrastColorHsb = Color.RGBtoHSB( (contrastColor >> 16) & 0xFF, (contrastColor >> 8) & 0xFF, contrastColor & 0xFF, null ); // get the pixel data WritableRaster raster = image.getRaster(); DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer(); int[] data = buffer.getData(); float[] hsb = new float[3]; int hsbColor = 0; int lastRgb = data[0] + 1; for( int i = 0; i < data.length; i++ ) { int rgb = data[i]; if( rgb == lastRgb ) { data[i] = hsbColor; continue; } int r = (rgb >> 16) & 0xFF; int g = (rgb >> 8) & 0xFF; int b = rgb & 0xFF; Color.RGBtoHSB( r, g, b, hsb ); float[] hsbColorize; if( hsb[1] == 1.0f ) { hsbColorize = hsb; hsb[0] = hsb[0] * 3f / 4f + mainColorHsb[0] / 4f; hsb[1] = hsb[1] * 3f / 4f + mainColorHsb[1] / 4f; hsb[2] = hsb[2] * 3f / 4f + mainColorHsb[2] / 4f; } else { if( hsb[2] == 1.0f ) { hsbColorize = contrastColorHsb; } else { hsbColorize = mainColorHsb; } } lastRgb = rgb; hsbColor = Color.HSBtoRGB( hsbColorize[0], hsbColorize[1], hsbColorize[2] ); hsbColor = (rgb & 0xFF000000) | (hsbColor & 0xFFFFFF); data[i] = hsbColor; } ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write( image, "PNG", out ); UrlUtils.dataUri( formatter, out.toByteArray(), urlString, "image/png;base64" ); }
java
static void colorizeImage( CssFormatter formatter, List<Expression> parameters ) throws IOException { if( parameters.size() < 4 ) { throw new LessException( "error evaluating function colorize-image expects url, main_color, contrast_color " ); } String relativeURL = parameters.get( 0 ).stringValue( formatter ); String urlString = parameters.get( 1 ).stringValue( formatter ); URL url = new URL( formatter.getBaseURL(), relativeURL ); String urlStr = UrlUtils.removeQuote( urlString ); url = new URL( url, urlStr ); int mainColor = ColorUtils.argb( UrlUtils.getColor( parameters.get( 2 ), formatter ) ); int contrastColor = ColorUtils.argb( UrlUtils.getColor( parameters.get( 3 ), formatter ) ); BufferedImage loadedImage = ImageIO.read( url.openStream() ); // convert the image in a standard color model int width = loadedImage.getWidth( null ); int height = loadedImage.getHeight( null ); BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB ); Graphics2D bGr = image.createGraphics(); bGr.drawImage( loadedImage, 0, 0, null ); bGr.dispose(); final float[] mainColorHsb = Color.RGBtoHSB( (mainColor >> 16) & 0xFF, (mainColor >> 8) & 0xFF, mainColor & 0xFF, null ); final float[] contrastColorHsb = Color.RGBtoHSB( (contrastColor >> 16) & 0xFF, (contrastColor >> 8) & 0xFF, contrastColor & 0xFF, null ); // get the pixel data WritableRaster raster = image.getRaster(); DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer(); int[] data = buffer.getData(); float[] hsb = new float[3]; int hsbColor = 0; int lastRgb = data[0] + 1; for( int i = 0; i < data.length; i++ ) { int rgb = data[i]; if( rgb == lastRgb ) { data[i] = hsbColor; continue; } int r = (rgb >> 16) & 0xFF; int g = (rgb >> 8) & 0xFF; int b = rgb & 0xFF; Color.RGBtoHSB( r, g, b, hsb ); float[] hsbColorize; if( hsb[1] == 1.0f ) { hsbColorize = hsb; hsb[0] = hsb[0] * 3f / 4f + mainColorHsb[0] / 4f; hsb[1] = hsb[1] * 3f / 4f + mainColorHsb[1] / 4f; hsb[2] = hsb[2] * 3f / 4f + mainColorHsb[2] / 4f; } else { if( hsb[2] == 1.0f ) { hsbColorize = contrastColorHsb; } else { hsbColorize = mainColorHsb; } } lastRgb = rgb; hsbColor = Color.HSBtoRGB( hsbColorize[0], hsbColorize[1], hsbColorize[2] ); hsbColor = (rgb & 0xFF000000) | (hsbColor & 0xFFFFFF); data[i] = hsbColor; } ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write( image, "PNG", out ); UrlUtils.dataUri( formatter, out.toByteArray(), urlString, "image/png;base64" ); }
[ "static", "void", "colorizeImage", "(", "CssFormatter", "formatter", ",", "List", "<", "Expression", ">", "parameters", ")", "throws", "IOException", "{", "if", "(", "parameters", ".", "size", "(", ")", "<", "4", ")", "{", "throw", "new", "LessException", ...
Colorize an image and inline it as base64. @param formatter current formatter @param parameters the parameters (relativeURL, url, main_color, contrast_color) @throws IOException if any I/O error occur @throws LessException if parameter list is wrong
[ "Colorize", "an", "image", "and", "inline", "it", "as", "base64", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CustomFunctions.java#L53-L121
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.addAsync
public <T extends IEntity> void addAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareAdd(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
java
public <T extends IEntity> void addAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareAdd(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
[ "public", "<", "T", "extends", "IEntity", ">", "void", "addAsync", "(", "T", "entity", ",", "CallbackHandler", "callbackHandler", ")", "throws", "FMSException", "{", "IntuitMessage", "intuitMessage", "=", "prepareAdd", "(", "entity", ")", ";", "//set callback hand...
Method to add the given entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException throws FMSException
[ "Method", "to", "add", "the", "given", "entity", "in", "asynchronous", "fashion" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L757-L766
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_input_inputId_PUT
public OvhOperation serviceName_input_inputId_PUT(String serviceName, String inputId, String description, String engineId, String exposedPort, String optionId, Boolean singleInstanceEnabled, String streamId, String title) throws IOException { String qPath = "/dbaas/logs/{serviceName}/input/{inputId}"; StringBuilder sb = path(qPath, serviceName, inputId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "engineId", engineId); addBody(o, "exposedPort", exposedPort); addBody(o, "optionId", optionId); addBody(o, "singleInstanceEnabled", singleInstanceEnabled); addBody(o, "streamId", streamId); addBody(o, "title", title); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_input_inputId_PUT(String serviceName, String inputId, String description, String engineId, String exposedPort, String optionId, Boolean singleInstanceEnabled, String streamId, String title) throws IOException { String qPath = "/dbaas/logs/{serviceName}/input/{inputId}"; StringBuilder sb = path(qPath, serviceName, inputId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "engineId", engineId); addBody(o, "exposedPort", exposedPort); addBody(o, "optionId", optionId); addBody(o, "singleInstanceEnabled", singleInstanceEnabled); addBody(o, "streamId", streamId); addBody(o, "title", title); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_input_inputId_PUT", "(", "String", "serviceName", ",", "String", "inputId", ",", "String", "description", ",", "String", "engineId", ",", "String", "exposedPort", ",", "String", "optionId", ",", "Boolean", "singleInstanceEnabled", ...
Update information of specified input object REST: PUT /dbaas/logs/{serviceName}/input/{inputId} @param serviceName [required] Service name @param inputId [required] Input ID @param streamId [required] Stream ID @param engineId [required] Engine ID @param description [required] Description @param singleInstanceEnabled [required] Indicate if input have only a single instance @param optionId [required] Option ID @param title [required] Title @param exposedPort [required] Exposed port
[ "Update", "information", "of", "specified", "input", "object" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L417-L430
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/jaxrx/JettyServer.java
JettyServer.register
public static void register(final Server s) { final ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig"); sh.setInitParameter("com.sun.jersey.config.property.packages", "org.jaxrx.resource"); new Context(s, "/", Context.SESSIONS).addServlet(sh, "/"); }
java
public static void register(final Server s) { final ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig"); sh.setInitParameter("com.sun.jersey.config.property.packages", "org.jaxrx.resource"); new Context(s, "/", Context.SESSIONS).addServlet(sh, "/"); }
[ "public", "static", "void", "register", "(", "final", "Server", "s", ")", "{", "final", "ServletHolder", "sh", "=", "new", "ServletHolder", "(", "ServletContainer", ".", "class", ")", ";", "sh", ".", "setInitParameter", "(", "\"com.sun.jersey.config.property.resou...
Constructor, attaching JAX-RX to the specified server. @param s server instance
[ "Constructor", "attaching", "JAX", "-", "RX", "to", "the", "specified", "server", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/JettyServer.java#L70-L77
knowm/XChange
xchange-gemini/src/main/java/org/knowm/xchange/gemini/v1/service/GeminiAccountService.java
GeminiAccountService.requestDepositAddress
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { GeminiDepositAddressResponse response = super.requestDepositAddressRaw(currency); return response.getAddress(); }
java
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { GeminiDepositAddressResponse response = super.requestDepositAddressRaw(currency); return response.getAddress(); }
[ "@", "Override", "public", "String", "requestDepositAddress", "(", "Currency", "currency", ",", "String", "...", "arguments", ")", "throws", "IOException", "{", "GeminiDepositAddressResponse", "response", "=", "super", ".", "requestDepositAddressRaw", "(", "currency", ...
This will result in a new address being created each time, and is severely rate-limited
[ "This", "will", "result", "in", "a", "new", "address", "being", "created", "each", "time", "and", "is", "severely", "rate", "-", "limited" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-gemini/src/main/java/org/knowm/xchange/gemini/v1/service/GeminiAccountService.java#L71-L75
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getNotifications
public void getNotifications(Patient patient, Collection<Notification> result) { List<String> lst = null; result.clear(); if (patient == null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null); } else if (patient != null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null, patient.getIdElement().getIdPart()); } if (lst != null) { for (String item : lst) { result.add(new Notification(item)); } } }
java
public void getNotifications(Patient patient, Collection<Notification> result) { List<String> lst = null; result.clear(); if (patient == null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null); } else if (patient != null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null, patient.getIdElement().getIdPart()); } if (lst != null) { for (String item : lst) { result.add(new Notification(item)); } } }
[ "public", "void", "getNotifications", "(", "Patient", "patient", ",", "Collection", "<", "Notification", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "null", ";", "result", ".", "clear", "(", ")", ";", "if", "(", "patient", "==", "n...
Returns notifications for the current user. @param patient If not null, only notifications associated with the current user are returned. Otherwise, all notifications for the current user are returned. @param result The list to receive the results.
[ "Returns", "notifications", "for", "the", "current", "user", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L86-L101
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3.java
MurmurHash3.getLong
private static long getLong(final char[] charArr, final int index, final int rem) { long out = 0L; for (int i = rem; i-- > 0;) { //i= 3,2,1,0 final char c = charArr[index + i]; out ^= (c & 0xFFFFL) << (i * 16); //equivalent to |= } return out; }
java
private static long getLong(final char[] charArr, final int index, final int rem) { long out = 0L; for (int i = rem; i-- > 0;) { //i= 3,2,1,0 final char c = charArr[index + i]; out ^= (c & 0xFFFFL) << (i * 16); //equivalent to |= } return out; }
[ "private", "static", "long", "getLong", "(", "final", "char", "[", "]", "charArr", ",", "final", "int", "index", ",", "final", "int", "rem", ")", "{", "long", "out", "=", "0L", ";", "for", "(", "int", "i", "=", "rem", ";", "i", "--", ">", "0", ...
Gets a long from the given char array starting at the given char array index and continuing for remainder (rem) chars. The chars are extracted in little-endian order. There is no limit checking. @param charArr The given input char array. @param index Zero-based index from the start of the char array. @param rem Remainder chars. An integer in the range [1,4]. @return long
[ "Gets", "a", "long", "from", "the", "given", "char", "array", "starting", "at", "the", "given", "char", "array", "index", "and", "continuing", "for", "remainder", "(", "rem", ")", "chars", ".", "The", "chars", "are", "extracted", "in", "little", "-", "en...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3.java#L327-L334
box/box-java-sdk
src/main/java/com/box/sdk/InMemoryLRUAccessTokenCache.java
InMemoryLRUAccessTokenCache.put
public void put(String key, String value) { synchronized (this.cache) { this.cache.put(key, value); } }
java
public void put(String key, String value) { synchronized (this.cache) { this.cache.put(key, value); } }
[ "public", "void", "put", "(", "String", "key", ",", "String", "value", ")", "{", "synchronized", "(", "this", ".", "cache", ")", "{", "this", ".", "cache", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Add an entry to the cache. @param key key to use. @param value access token information to store.
[ "Add", "an", "entry", "to", "the", "cache", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/InMemoryLRUAccessTokenCache.java#L33-L37
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doGet
public void doGet(String url, HttpResponse response, Map<String, Object> headers) { doGet(url, response, headers, true); }
java
public void doGet(String url, HttpResponse response, Map<String, Object> headers) { doGet(url, response, headers, true); }
[ "public", "void", "doGet", "(", "String", "url", ",", "HttpResponse", "response", ",", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "doGet", "(", "url", ",", "response", ",", "headers", ",", "true", ")", ";", "}" ]
GETs content from URL. @param url url to get from. @param response response to store url and response value in.
[ "GETs", "content", "from", "URL", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L388-L390
derari/cthul
objects/src/main/java/org/cthul/objects/reflection/Signatures.java
Signatures.bestMethod
public static Method bestMethod(Class<?> clazz, String name, Class<?>[] argTypes) throws AmbiguousMethodMatchException { return bestMethod(collectMethods(clazz, name), argTypes); }
java
public static Method bestMethod(Class<?> clazz, String name, Class<?>[] argTypes) throws AmbiguousMethodMatchException { return bestMethod(collectMethods(clazz, name), argTypes); }
[ "public", "static", "Method", "bestMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ",", "Class", "<", "?", ">", "[", "]", "argTypes", ")", "throws", "AmbiguousMethodMatchException", "{", "return", "bestMethod", "(", "collectMethods", "(...
Finds the best method for the given argument types. @param clazz @param name @param argTypes @return method @throws AmbiguousSignatureMatchException if multiple methods match equally
[ "Finds", "the", "best", "method", "for", "the", "given", "argument", "types", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L139-L141
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java
PaymentProtocol.createPaymentAck
public static Protos.PaymentACK createPaymentAck(Protos.Payment paymentMessage, @Nullable String memo) { final Protos.PaymentACK.Builder builder = Protos.PaymentACK.newBuilder(); builder.setPayment(paymentMessage); if (memo != null) builder.setMemo(memo); return builder.build(); }
java
public static Protos.PaymentACK createPaymentAck(Protos.Payment paymentMessage, @Nullable String memo) { final Protos.PaymentACK.Builder builder = Protos.PaymentACK.newBuilder(); builder.setPayment(paymentMessage); if (memo != null) builder.setMemo(memo); return builder.build(); }
[ "public", "static", "Protos", ".", "PaymentACK", "createPaymentAck", "(", "Protos", ".", "Payment", "paymentMessage", ",", "@", "Nullable", "String", "memo", ")", "{", "final", "Protos", ".", "PaymentACK", ".", "Builder", "builder", "=", "Protos", ".", "Paymen...
Create a payment ack. @param paymentMessage payment message to send with the ack @param memo arbitrary, user readable memo, or null if none @return created payment ack
[ "Create", "a", "payment", "ack", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L376-L382
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsServicesWithRateLimiter.java
AdWordsServicesWithRateLimiter.getUtility
@Override public <T> T getUtility(AdWordsSession session, Class<T> utilityClass) { T originalUtilityObject = adWordsServices.getUtility(session, utilityClass); return getProxyObject(originalUtilityObject, session, utilityClass, true); }
java
@Override public <T> T getUtility(AdWordsSession session, Class<T> utilityClass) { T originalUtilityObject = adWordsServices.getUtility(session, utilityClass); return getProxyObject(originalUtilityObject, session, utilityClass, true); }
[ "@", "Override", "public", "<", "T", ">", "T", "getUtility", "(", "AdWordsSession", "session", ",", "Class", "<", "T", ">", "utilityClass", ")", "{", "T", "originalUtilityObject", "=", "adWordsServices", ".", "getUtility", "(", "session", ",", "utilityClass", ...
Gets a rate-limit-aware instance of the utility represented by the utilityClass with a reference to the session. <p>The objects returned by this method are not thread-safe. @param <T> the service type @param session your current session @param utilityClass the AdWords utility class @return the rate-limit-aware client for the utility
[ "Gets", "a", "rate", "-", "limit", "-", "aware", "instance", "of", "the", "utility", "represented", "by", "the", "utilityClass", "with", "a", "reference", "to", "the", "session", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsServicesWithRateLimiter.java#L61-L65
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createFillableFocusRectangle
public Shape createFillableFocusRectangle(int x, int y, int w, int h) { final int left = x; final int top = y; final int right = x + w; final int bottom = y + h; path.reset(); path.moveTo(left, top); path.lineTo(left, bottom); path.lineTo(right, bottom); path.lineTo(right, top); final float offset = 1.4f; final float left2 = left + offset; final float top2 = top + offset; final float right2 = right - offset; final float bottom2 = bottom - offset; // TODO These two lines were curveTo in Nimbus. Perhaps we should // revisit this? path.lineTo(right2, top); path.lineTo(right2, bottom2); path.lineTo(left2, bottom2); path.lineTo(left2, top2); path.lineTo(right2, top2); path.lineTo(right2, top); path.closePath(); return path; }
java
public Shape createFillableFocusRectangle(int x, int y, int w, int h) { final int left = x; final int top = y; final int right = x + w; final int bottom = y + h; path.reset(); path.moveTo(left, top); path.lineTo(left, bottom); path.lineTo(right, bottom); path.lineTo(right, top); final float offset = 1.4f; final float left2 = left + offset; final float top2 = top + offset; final float right2 = right - offset; final float bottom2 = bottom - offset; // TODO These two lines were curveTo in Nimbus. Perhaps we should // revisit this? path.lineTo(right2, top); path.lineTo(right2, bottom2); path.lineTo(left2, bottom2); path.lineTo(left2, top2); path.lineTo(right2, top2); path.lineTo(right2, top); path.closePath(); return path; }
[ "public", "Shape", "createFillableFocusRectangle", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "final", "int", "left", "=", "x", ";", "final", "int", "top", "=", "y", ";", "final", "int", "right", "=", "x", "+", ...
Return a path for a focus rectangle. <p>This path is suitable for filling.</p> @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "focus", "rectangle", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L445-L475
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.getMetadataWithChildrenIfChanged
public Maybe<DbxEntry./*@Nullable*/WithChildren> getMetadataWithChildrenIfChanged(String path, boolean includeMediaInfo, /*@Nullable*/String previousFolderHash) throws DbxException { return getMetadataWithChildrenIfChangedBase(path, includeMediaInfo, previousFolderHash, DbxEntry.WithChildren.ReaderMaybeDeleted); }
java
public Maybe<DbxEntry./*@Nullable*/WithChildren> getMetadataWithChildrenIfChanged(String path, boolean includeMediaInfo, /*@Nullable*/String previousFolderHash) throws DbxException { return getMetadataWithChildrenIfChangedBase(path, includeMediaInfo, previousFolderHash, DbxEntry.WithChildren.ReaderMaybeDeleted); }
[ "public", "Maybe", "<", "DbxEntry", ".", "/*@Nullable*/", "WithChildren", ">", "getMetadataWithChildrenIfChanged", "(", "String", "path", ",", "boolean", "includeMediaInfo", ",", "/*@Nullable*/", "String", "previousFolderHash", ")", "throws", "DbxException", "{", "retur...
Get the metadata for a given path and its children if anything has changed since the last time you got them (as determined by the value of {@link DbxEntry.WithChildren#hash} from the last result). @param path The path (starting with "/") to the file or folder (see {@link DbxPathV1}). @param previousFolderHash The value of {@link DbxEntry.WithChildren#hash} from the last time you got the metadata for this folder (and children). @return Never returns {@code null}. If the folder at the given path hasn't changed since you last retrieved it (i.e. its contents match {@code previousFolderHash}), return {@code Maybe.Nothing}. If it doesn't match {@code previousFolderHash} return either {@code Maybe.Just(null)} if there's nothing there or {@code Maybe.Just} with the metadata.
[ "Get", "the", "metadata", "for", "a", "given", "path", "and", "its", "children", "if", "anything", "has", "changed", "since", "the", "last", "time", "you", "got", "them", "(", "as", "determined", "by", "the", "value", "of", "{", "@link", "DbxEntry", ".",...
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L264-L268
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ImplementationImpl.java
ImplementationImpl.newDSet
public DSet newDSet() { if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, cannot create a DSet with a null database."); } return (DSet) DSetFactory.singleton.createCollectionOrMap(getCurrentPBKey()); }
java
public DSet newDSet() { if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, cannot create a DSet with a null database."); } return (DSet) DSetFactory.singleton.createCollectionOrMap(getCurrentPBKey()); }
[ "public", "DSet", "newDSet", "(", ")", "{", "if", "(", "(", "getCurrentDatabase", "(", ")", "==", "null", ")", ")", "{", "throw", "new", "DatabaseClosedException", "(", "\"Database is NULL, cannot create a DSet with a null database.\"", ")", ";", "}", "return", "(...
Create a new <code>DSet</code> object. @return The new <code>DSet</code> object. @see DSet
[ "Create", "a", "new", "<code", ">", "DSet<", "/", "code", ">", "object", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ImplementationImpl.java#L239-L246
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/AbstractStandardTransformationOperation.java
AbstractStandardTransformationOperation.getParameterOrException
protected String getParameterOrException(Map<String, String> parameters, String paramName) throws TransformationOperationException { return getParameter(parameters, paramName, true, null); }
java
protected String getParameterOrException(Map<String, String> parameters, String paramName) throws TransformationOperationException { return getParameter(parameters, paramName, true, null); }
[ "protected", "String", "getParameterOrException", "(", "Map", "<", "String", ",", "String", ">", "parameters", ",", "String", "paramName", ")", "throws", "TransformationOperationException", "{", "return", "getParameter", "(", "parameters", ",", "paramName", ",", "tr...
Get the parameter with the given parameter name from the parameter map. If the parameters does not contain such a parameter, the function throws a TransformationOperationException.
[ "Get", "the", "parameter", "with", "the", "given", "parameter", "name", "from", "the", "parameter", "map", ".", "If", "the", "parameters", "does", "not", "contain", "such", "a", "parameter", "the", "function", "throws", "a", "TransformationOperationException", "...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/AbstractStandardTransformationOperation.java#L94-L97
abel533/Mapper
core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java
SqlHelper.insertColumns
public static String insertColumns(Class<?> entityClass, boolean skipId, boolean notNull, boolean notEmpty) { StringBuilder sql = new StringBuilder(); sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">"); //获取全部列 Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass); //当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值 for (EntityColumn column : columnSet) { if (!column.isInsertable()) { continue; } if (skipId && column.isId()) { continue; } if (notNull) { sql.append(SqlHelper.getIfNotNull(column, column.getColumn() + ",", notEmpty)); } else { sql.append(column.getColumn() + ","); } } sql.append("</trim>"); return sql.toString(); }
java
public static String insertColumns(Class<?> entityClass, boolean skipId, boolean notNull, boolean notEmpty) { StringBuilder sql = new StringBuilder(); sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">"); //获取全部列 Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass); //当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值 for (EntityColumn column : columnSet) { if (!column.isInsertable()) { continue; } if (skipId && column.isId()) { continue; } if (notNull) { sql.append(SqlHelper.getIfNotNull(column, column.getColumn() + ",", notEmpty)); } else { sql.append(column.getColumn() + ","); } } sql.append("</trim>"); return sql.toString(); }
[ "public", "static", "String", "insertColumns", "(", "Class", "<", "?", ">", "entityClass", ",", "boolean", "skipId", ",", "boolean", "notNull", ",", "boolean", "notEmpty", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ...
insert table()列 @param entityClass @param skipId 是否从列中忽略id类型 @param notNull 是否判断!=null @param notEmpty 是否判断String类型!='' @return
[ "insert", "table", "()", "列" ]
train
https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L402-L423
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java
ImageHolder.decideIcon
public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) { if (imageHolder == null) { return null; } else { return imageHolder.decideIcon(ctx, iconColor, tint); } }
java
public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) { if (imageHolder == null) { return null; } else { return imageHolder.decideIcon(ctx, iconColor, tint); } }
[ "public", "static", "Drawable", "decideIcon", "(", "ImageHolder", "imageHolder", ",", "Context", "ctx", ",", "int", "iconColor", ",", "boolean", "tint", ")", "{", "if", "(", "imageHolder", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", ...
a small static helper which catches nulls for us @param imageHolder @param ctx @param iconColor @param tint @return
[ "a", "small", "static", "helper", "which", "catches", "nulls", "for", "us" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L243-L249
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java
Utility.addColor
public static String addColor(String orgString, String replaceString, int color) { return orgString.replace(replaceString, "<font color=\"" + colorToHexString(color) + "\">" + replaceString + "</font>"); }
java
public static String addColor(String orgString, String replaceString, int color) { return orgString.replace(replaceString, "<font color=\"" + colorToHexString(color) + "\">" + replaceString + "</font>"); }
[ "public", "static", "String", "addColor", "(", "String", "orgString", ",", "String", "replaceString", ",", "int", "color", ")", "{", "return", "orgString", ".", "replace", "(", "replaceString", ",", "\"<font color=\\\"\"", "+", "colorToHexString", "(", "color", ...
在字符串中查找指定的子字符串并将其改成指定的颜色 @param orgString 原始字符串 @param replaceString 需要替换的子字符串 @param color 替换后的子字符串的颜色 @return 返回带有 html 标签的字符串
[ "在字符串中查找指定的子字符串并将其改成指定的颜色" ]
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java#L127-L129
jboss/jboss-servlet-api_spec
src/main/java/javax/servlet/http/HttpServlet.java
HttpServlet.doTrace
protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int responseLength; String CRLF = "\r\n"; StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI()) .append(" ").append(req.getProtocol()); Enumeration<String> reqHeaderEnum = req.getHeaderNames(); while( reqHeaderEnum.hasMoreElements() ) { String headerName = reqHeaderEnum.nextElement(); buffer.append(CRLF).append(headerName).append(": ") .append(req.getHeader(headerName)); } buffer.append(CRLF); responseLength = buffer.length(); resp.setContentType("message/http"); resp.setContentLength(responseLength); ServletOutputStream out = resp.getOutputStream(); out.print(buffer.toString()); }
java
protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int responseLength; String CRLF = "\r\n"; StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI()) .append(" ").append(req.getProtocol()); Enumeration<String> reqHeaderEnum = req.getHeaderNames(); while( reqHeaderEnum.hasMoreElements() ) { String headerName = reqHeaderEnum.nextElement(); buffer.append(CRLF).append(headerName).append(": ") .append(req.getHeader(headerName)); } buffer.append(CRLF); responseLength = buffer.length(); resp.setContentType("message/http"); resp.setContentLength(responseLength); ServletOutputStream out = resp.getOutputStream(); out.print(buffer.toString()); }
[ "protected", "void", "doTrace", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "int", "responseLength", ";", "String", "CRLF", "=", "\"\\r\\n\"", ";", "StringBuilder", "buffer", "=", ...
Called by the server (via the <code>service</code> method) to allow a servlet to handle a TRACE request. A TRACE returns the headers sent with the TRACE request to the client, so that they can be used in debugging. There's no need to override this method. @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client @throws IOException if an input or output error occurs while the servlet is handling the TRACE request @throws ServletException if the request for the TRACE cannot be handled
[ "Called", "by", "the", "server", "(", "via", "the", "<code", ">", "service<", "/", "code", ">", "method", ")", "to", "allow", "a", "servlet", "to", "handle", "a", "TRACE", "request", "." ]
train
https://github.com/jboss/jboss-servlet-api_spec/blob/5bc96f2b833c072baff6eb8ae49bc7b5e503e9b2/src/main/java/javax/servlet/http/HttpServlet.java#L622-L648
belaban/JGroups
src/org/jgroups/conf/ClassConfigurator.java
ClassConfigurator.get
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException { return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader()); }
java
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException { return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader()); }
[ "public", "static", "Class", "get", "(", "String", "clazzname", ",", "ClassLoader", "loader", ")", "throws", "ClassNotFoundException", "{", "return", "Util", ".", "loadClass", "(", "clazzname", ",", "loader", "!=", "null", "?", "loader", ":", "ClassConfigurator"...
Loads and returns the class from the class name @param clazzname a fully classified class name to be loaded @return a Class object that represents a class that implements java.io.Externalizable
[ "Loads", "and", "returns", "the", "class", "from", "the", "class", "name" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ClassConfigurator.java#L142-L144
apache/groovy
src/main/groovy/groovy/time/TimeCategory.java
TimeCategory.getRelativeDaylightSavingsOffset
public static Duration getRelativeDaylightSavingsOffset(Date self, Date other) { Duration d1 = getDaylightSavingsOffset(self); Duration d2 = getDaylightSavingsOffset(other); return new TimeDuration(0, 0, 0, (int) (d2.toMilliseconds() - d1.toMilliseconds())); }
java
public static Duration getRelativeDaylightSavingsOffset(Date self, Date other) { Duration d1 = getDaylightSavingsOffset(self); Duration d2 = getDaylightSavingsOffset(other); return new TimeDuration(0, 0, 0, (int) (d2.toMilliseconds() - d1.toMilliseconds())); }
[ "public", "static", "Duration", "getRelativeDaylightSavingsOffset", "(", "Date", "self", ",", "Date", "other", ")", "{", "Duration", "d1", "=", "getDaylightSavingsOffset", "(", "self", ")", ";", "Duration", "d2", "=", "getDaylightSavingsOffset", "(", "other", ")",...
Return a Duration representing the DST difference (if any) between two dates. i.e. if one date is before the DST changeover, and the other date is after, the resulting duration will represent the DST offset. @param self a Date @param other another Date @return a Duration
[ "Return", "a", "Duration", "representing", "the", "DST", "difference", "(", "if", "any", ")", "between", "two", "dates", ".", "i", ".", "e", ".", "if", "one", "date", "is", "before", "the", "DST", "changeover", "and", "the", "other", "date", "is", "aft...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/time/TimeCategory.java#L105-L109
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/alarmcallbacks/EmailAlarmCallback.java
EmailAlarmCallback.getConfigurationRequest
private ConfigurationRequest getConfigurationRequest(Map<String, String> userNames) { ConfigurationRequest configurationRequest = new ConfigurationRequest(); configurationRequest.addField(new TextField("sender", "Sender", "graylog@example.org", "The sender of sent out mail alerts", ConfigurationField.Optional.OPTIONAL)); configurationRequest.addField(new TextField("subject", "E-Mail Subject", "Graylog alert for stream: ${stream.title}: ${check_result.resultDescription}", "The subject of sent out mail alerts", ConfigurationField.Optional.NOT_OPTIONAL)); configurationRequest.addField(new TextField("body", "E-Mail Body", FormattedEmailAlertSender.bodyTemplate, "The template to generate the body from", ConfigurationField.Optional.OPTIONAL, TextField.Attribute.TEXTAREA)); configurationRequest.addField(new ListField(CK_USER_RECEIVERS, "User Receivers", Collections.emptyList(), userNames, "Graylog usernames that should receive this alert", ConfigurationField.Optional.OPTIONAL)); configurationRequest.addField(new ListField(CK_EMAIL_RECEIVERS, "E-Mail Receivers", Collections.emptyList(), Collections.emptyMap(), "E-Mail addresses that should receive this alert", ConfigurationField.Optional.OPTIONAL, ListField.Attribute.ALLOW_CREATE)); return configurationRequest; }
java
private ConfigurationRequest getConfigurationRequest(Map<String, String> userNames) { ConfigurationRequest configurationRequest = new ConfigurationRequest(); configurationRequest.addField(new TextField("sender", "Sender", "graylog@example.org", "The sender of sent out mail alerts", ConfigurationField.Optional.OPTIONAL)); configurationRequest.addField(new TextField("subject", "E-Mail Subject", "Graylog alert for stream: ${stream.title}: ${check_result.resultDescription}", "The subject of sent out mail alerts", ConfigurationField.Optional.NOT_OPTIONAL)); configurationRequest.addField(new TextField("body", "E-Mail Body", FormattedEmailAlertSender.bodyTemplate, "The template to generate the body from", ConfigurationField.Optional.OPTIONAL, TextField.Attribute.TEXTAREA)); configurationRequest.addField(new ListField(CK_USER_RECEIVERS, "User Receivers", Collections.emptyList(), userNames, "Graylog usernames that should receive this alert", ConfigurationField.Optional.OPTIONAL)); configurationRequest.addField(new ListField(CK_EMAIL_RECEIVERS, "E-Mail Receivers", Collections.emptyList(), Collections.emptyMap(), "E-Mail addresses that should receive this alert", ConfigurationField.Optional.OPTIONAL, ListField.Attribute.ALLOW_CREATE)); return configurationRequest; }
[ "private", "ConfigurationRequest", "getConfigurationRequest", "(", "Map", "<", "String", ",", "String", ">", "userNames", ")", "{", "ConfigurationRequest", "configurationRequest", "=", "new", "ConfigurationRequest", "(", ")", ";", "configurationRequest", ".", "addField"...
I am truly sorry about this, but leaking the user list is not okay...
[ "I", "am", "truly", "sorry", "about", "this", "but", "leaking", "the", "user", "list", "is", "not", "okay", "..." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/alarmcallbacks/EmailAlarmCallback.java#L173-L210
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/UsersApi.java
UsersApi.getUserDevices
public DevicesEnvelope getUserDevices(String userId, Integer offset, Integer count, Boolean includeProperties, String owner, Boolean includeShareInfo, String dtid) throws ApiException { ApiResponse<DevicesEnvelope> resp = getUserDevicesWithHttpInfo(userId, offset, count, includeProperties, owner, includeShareInfo, dtid); return resp.getData(); }
java
public DevicesEnvelope getUserDevices(String userId, Integer offset, Integer count, Boolean includeProperties, String owner, Boolean includeShareInfo, String dtid) throws ApiException { ApiResponse<DevicesEnvelope> resp = getUserDevicesWithHttpInfo(userId, offset, count, includeProperties, owner, includeShareInfo, dtid); return resp.getData(); }
[ "public", "DevicesEnvelope", "getUserDevices", "(", "String", "userId", ",", "Integer", "offset", ",", "Integer", "count", ",", "Boolean", "includeProperties", ",", "String", "owner", ",", "Boolean", "includeShareInfo", ",", "String", "dtid", ")", "throws", "ApiEx...
Get User Devices Retrieve User&#39;s Devices @param userId User ID (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param includeProperties Optional. Boolean (true/false) - If false, only return the user&#39;s device types. If true, also return device types shared by other users. (optional) @param owner Return owned and/or shared devices. Default to ALL. (optional) @param includeShareInfo Include share info (optional) @param dtid Return only devices of this device type. If empty, assumes all device types allowed by the authorization. (optional) @return DevicesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "User", "Devices", "Retrieve", "User&#39", ";", "s", "Devices" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/UsersApi.java#L648-L651
apache/incubator-druid
core/src/main/java/org/apache/druid/utils/CloseableUtils.java
CloseableUtils.closeBoth
public static void closeBoth(Closeable first, Closeable second) throws IOException { //noinspection EmptyTryBlock try (Closeable ignore1 = second; Closeable ignore2 = first) { // piggy-back try-with-resources semantics } }
java
public static void closeBoth(Closeable first, Closeable second) throws IOException { //noinspection EmptyTryBlock try (Closeable ignore1 = second; Closeable ignore2 = first) { // piggy-back try-with-resources semantics } }
[ "public", "static", "void", "closeBoth", "(", "Closeable", "first", ",", "Closeable", "second", ")", "throws", "IOException", "{", "//noinspection EmptyTryBlock", "try", "(", "Closeable", "ignore1", "=", "second", ";", "Closeable", "ignore2", "=", "first", ")", ...
Call method instead of code like first.close(); second.close(); to have safety of {@link org.apache.druid.java.util.common.io.Closer}, but without associated boilerplate code of creating a Closer and registering objects in it.
[ "Call", "method", "instead", "of", "code", "like" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CloseableUtils.java#L40-L46
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/DDPStateSingleton.java
DDPStateSingleton.handleLoginResult
@SuppressWarnings("unchecked") public void handleLoginResult(Map<String, Object> jsonFields) { if (jsonFields.containsKey("result")) { Map<String, Object> result = (Map<String, Object>) jsonFields .get(DdpMessageField.RESULT); mResumeToken = (String) result.get("token"); saveResumeToken(mResumeToken); mUserId = (String) result.get("id"); mDDPState = DDPSTATE.LoggedIn; broadcastConnectionState(mDDPState); } else if (jsonFields.containsKey("error")) { Map<String, Object> error = (Map<String, Object>) jsonFields .get(DdpMessageField.ERROR); broadcastDDPError((String) error.get("message")); } }
java
@SuppressWarnings("unchecked") public void handleLoginResult(Map<String, Object> jsonFields) { if (jsonFields.containsKey("result")) { Map<String, Object> result = (Map<String, Object>) jsonFields .get(DdpMessageField.RESULT); mResumeToken = (String) result.get("token"); saveResumeToken(mResumeToken); mUserId = (String) result.get("id"); mDDPState = DDPSTATE.LoggedIn; broadcastConnectionState(mDDPState); } else if (jsonFields.containsKey("error")) { Map<String, Object> error = (Map<String, Object>) jsonFields .get(DdpMessageField.ERROR); broadcastDDPError((String) error.get("message")); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "handleLoginResult", "(", "Map", "<", "String", ",", "Object", ">", "jsonFields", ")", "{", "if", "(", "jsonFields", ".", "containsKey", "(", "\"result\"", ")", ")", "{", "Map", "<", "St...
Handles callback from login command @param jsonFields fields from result
[ "Handles", "callback", "from", "login", "command" ]
train
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/DDPStateSingleton.java#L389-L404
openbase/jul
pattern/default/src/main/java/org/openbase/jul/pattern/CompletableFutureLite.java
CompletableFutureLite.get
@Override public V get(final long timeout, final TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { synchronized (lock) { if (value != null) { return value; } lock.wait(timeUnit.toMillis(timeout)); if (value != null) { return value; } if (throwable != null) { throw new ExecutionException(throwable); } throw new TimeoutException(); } }
java
@Override public V get(final long timeout, final TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { synchronized (lock) { if (value != null) { return value; } lock.wait(timeUnit.toMillis(timeout)); if (value != null) { return value; } if (throwable != null) { throw new ExecutionException(throwable); } throw new TimeoutException(); } }
[ "@", "Override", "public", "V", "get", "(", "final", "long", "timeout", ",", "final", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "val...
Method blocks until the future is done. The method return the result if the future was normally completed. If the future was exceptionally completed or canceled an exception is thrown. @param timeout the maximal time to wait for completion. @param timeUnit the unit of the given timeout. @return the result of the task. @throws InterruptedException is thrown if the thread was externally interrupted. @throws ExecutionException is thrown if the task was canceled or exceptionally completed. @throws TimeoutException in thrown if the timeout was reached and the task is still not done.
[ "Method", "blocks", "until", "the", "future", "is", "done", ".", "The", "method", "return", "the", "result", "if", "the", "future", "was", "normally", "completed", ".", "If", "the", "future", "was", "exceptionally", "completed", "or", "canceled", "an", "exce...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/default/src/main/java/org/openbase/jul/pattern/CompletableFutureLite.java#L188-L205
tango-controls/JTango
server/src/main/java/org/tango/server/build/BuilderUtils.java
BuilderUtils.setEnumLabelProperty
static AttributePropertiesImpl setEnumLabelProperty(final Class<?> type, final AttributePropertiesImpl props) throws DevFailed { // if is is an enum set enum values in properties if (AttributeTangoType.getTypeFromClass(type).equals(AttributeTangoType.DEVENUM)) { // final Class<Enum<?>> enumType = (Class<Enum<?>>) field.getType(); final Object[] enumValues = type.getEnumConstants(); final String[] enumLabels = new String[enumValues.length]; for (int i = 0; i < enumLabels.length; i++) { enumLabels[i] = enumValues[i].toString(); } props.setEnumLabels(enumLabels, false); } return props; }
java
static AttributePropertiesImpl setEnumLabelProperty(final Class<?> type, final AttributePropertiesImpl props) throws DevFailed { // if is is an enum set enum values in properties if (AttributeTangoType.getTypeFromClass(type).equals(AttributeTangoType.DEVENUM)) { // final Class<Enum<?>> enumType = (Class<Enum<?>>) field.getType(); final Object[] enumValues = type.getEnumConstants(); final String[] enumLabels = new String[enumValues.length]; for (int i = 0; i < enumLabels.length; i++) { enumLabels[i] = enumValues[i].toString(); } props.setEnumLabels(enumLabels, false); } return props; }
[ "static", "AttributePropertiesImpl", "setEnumLabelProperty", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "AttributePropertiesImpl", "props", ")", "throws", "DevFailed", "{", "// if is is an enum set enum values in properties", "if", "(", "AttributeTangoType"...
Set enum label for Enum types @param type @param props @throws DevFailed
[ "Set", "enum", "label", "for", "Enum", "types" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/BuilderUtils.java#L174-L187
james-hu/jabb-core
src/main/java/net/sf/jabb/util/parallel/BackoffStrategies.java
BackoffStrategies.exponentialBackoff
public static BackoffStrategy exponentialBackoff(long maximumTime, TimeUnit maximumTimeUnit) { Preconditions.checkNotNull(maximumTimeUnit, "The maximum time unit may not be null"); return new ExponentialBackoffStrategy(1, maximumTimeUnit.toMillis(maximumTime)); }
java
public static BackoffStrategy exponentialBackoff(long maximumTime, TimeUnit maximumTimeUnit) { Preconditions.checkNotNull(maximumTimeUnit, "The maximum time unit may not be null"); return new ExponentialBackoffStrategy(1, maximumTimeUnit.toMillis(maximumTime)); }
[ "public", "static", "BackoffStrategy", "exponentialBackoff", "(", "long", "maximumTime", ",", "TimeUnit", "maximumTimeUnit", ")", "{", "Preconditions", ".", "checkNotNull", "(", "maximumTimeUnit", ",", "\"The maximum time unit may not be null\"", ")", ";", "return", "new"...
Returns a strategy which waits for an exponential amount of time after the first failed attempt, and in exponentially incrementing amounts after each failed attempt up to the maximumTime. @param maximumTime the maximum time to wait @param maximumTimeUnit the unit of the maximum time @return a backoff strategy that increments with each failed attempt using exponential backoff
[ "Returns", "a", "strategy", "which", "waits", "for", "an", "exponential", "amount", "of", "time", "after", "the", "first", "failed", "attempt", "and", "in", "exponentially", "incrementing", "amounts", "after", "each", "failed", "attempt", "up", "to", "the", "m...
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/parallel/BackoffStrategies.java#L185-L188
graphhopper/graphhopper
core/src/main/java/com/graphhopper/util/Downloader.java
Downloader.fetch
public InputStream fetch(HttpURLConnection connection, boolean readErrorStreamNoException) throws IOException { // create connection but before reading get the correct inputstream based on the compression and if error connection.connect(); InputStream is; if (readErrorStreamNoException && connection.getResponseCode() >= 400 && connection.getErrorStream() != null) is = connection.getErrorStream(); else is = connection.getInputStream(); if (is == null) throw new IOException("Stream is null. Message:" + connection.getResponseMessage()); // wrap try { String encoding = connection.getContentEncoding(); if (encoding != null && encoding.equalsIgnoreCase("gzip")) is = new GZIPInputStream(is); else if (encoding != null && encoding.equalsIgnoreCase("deflate")) is = new InflaterInputStream(is, new Inflater(true)); } catch (IOException ex) { } return is; }
java
public InputStream fetch(HttpURLConnection connection, boolean readErrorStreamNoException) throws IOException { // create connection but before reading get the correct inputstream based on the compression and if error connection.connect(); InputStream is; if (readErrorStreamNoException && connection.getResponseCode() >= 400 && connection.getErrorStream() != null) is = connection.getErrorStream(); else is = connection.getInputStream(); if (is == null) throw new IOException("Stream is null. Message:" + connection.getResponseMessage()); // wrap try { String encoding = connection.getContentEncoding(); if (encoding != null && encoding.equalsIgnoreCase("gzip")) is = new GZIPInputStream(is); else if (encoding != null && encoding.equalsIgnoreCase("deflate")) is = new InflaterInputStream(is, new Inflater(true)); } catch (IOException ex) { } return is; }
[ "public", "InputStream", "fetch", "(", "HttpURLConnection", "connection", ",", "boolean", "readErrorStreamNoException", ")", "throws", "IOException", "{", "// create connection but before reading get the correct inputstream based on the compression and if error", "connection", ".", "...
This method initiates a connect call of the provided connection and returns the response stream. It only returns the error stream if it is available and readErrorStreamNoException is true otherwise it throws an IOException if an error happens. Furthermore it wraps the stream to decompress it if the connection content encoding is specified.
[ "This", "method", "initiates", "a", "connect", "call", "of", "the", "provided", "connection", "and", "returns", "the", "response", "stream", ".", "It", "only", "returns", "the", "error", "stream", "if", "it", "is", "available", "and", "readErrorStreamNoException...
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/Downloader.java#L66-L90
languagetool-org/languagetool
languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java
LinguisticServices.getNumberOfSyllables
@Override public int getNumberOfSyllables(String word, Language lang) { return getNumberOfSyllables(word, getLocale(lang)); }
java
@Override public int getNumberOfSyllables(String word, Language lang) { return getNumberOfSyllables(word, getLocale(lang)); }
[ "@", "Override", "public", "int", "getNumberOfSyllables", "(", "String", "word", ",", "Language", "lang", ")", "{", "return", "getNumberOfSyllables", "(", "word", ",", "getLocale", "(", "lang", ")", ")", ";", "}" ]
Returns the number of syllable of a word Returns -1 if the word was not found or anything goes wrong
[ "Returns", "the", "number", "of", "syllable", "of", "a", "word", "Returns", "-", "1", "if", "the", "word", "was", "not", "found", "or", "anything", "goes", "wrong" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/LinguisticServices.java#L222-L225
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.buildContainerNameFrom
public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); // Prevent container names from being too long (see #480) if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; }
java
public static String buildContainerNameFrom( String scopedInstancePath, String applicationName ) { String containerName = scopedInstancePath + "_from_" + applicationName; containerName = containerName.replaceFirst( "^/", "" ).replace( "/", "-" ).replaceAll( "\\s+", "_" ); // Prevent container names from being too long (see #480) if( containerName.length() > 61 ) containerName = containerName.substring( 0, 61 ); return containerName; }
[ "public", "static", "String", "buildContainerNameFrom", "(", "String", "scopedInstancePath", ",", "String", "applicationName", ")", "{", "String", "containerName", "=", "scopedInstancePath", "+", "\"_from_\"", "+", "applicationName", ";", "containerName", "=", "containe...
Builds a container name. @param scopedInstancePath a scoped instance path @param applicationName an application name @return a non-null string
[ "Builds", "a", "container", "name", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L410-L420
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/locking/consistentkey/ExpectedValueCheckingStore.java
ExpectedValueCheckingStore.mutate
@Override public void mutate(StaticBuffer key, List<Entry> additions, List<StaticBuffer> deletions, StoreTransaction txh) throws BackendException { ExpectedValueCheckingTransaction etx = (ExpectedValueCheckingTransaction)txh; boolean hasAtLeastOneLock = etx.prepareForMutations(); if (hasAtLeastOneLock) { // Force all mutations on this transaction to use strong consistency store.mutate(key, additions, deletions, getConsistentTx(txh)); } else { store.mutate(key, additions, deletions, unwrapTx(txh)); } }
java
@Override public void mutate(StaticBuffer key, List<Entry> additions, List<StaticBuffer> deletions, StoreTransaction txh) throws BackendException { ExpectedValueCheckingTransaction etx = (ExpectedValueCheckingTransaction)txh; boolean hasAtLeastOneLock = etx.prepareForMutations(); if (hasAtLeastOneLock) { // Force all mutations on this transaction to use strong consistency store.mutate(key, additions, deletions, getConsistentTx(txh)); } else { store.mutate(key, additions, deletions, unwrapTx(txh)); } }
[ "@", "Override", "public", "void", "mutate", "(", "StaticBuffer", "key", ",", "List", "<", "Entry", ">", "additions", ",", "List", "<", "StaticBuffer", ">", "deletions", ",", "StoreTransaction", "txh", ")", "throws", "BackendException", "{", "ExpectedValueChecki...
{@inheritDoc} <p/> This implementation supports locking when {@code lockStore} is non-null.
[ "{" ]
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/locking/consistentkey/ExpectedValueCheckingStore.java#L57-L67
alibaba/otter
shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/ExtractZooKeeperArbitrateEvent.java
ExtractZooKeeperArbitrateEvent.await
public EtlEventData await(Long pipelineId) throws InterruptedException { Assert.notNull(pipelineId); PermitMonitor permitMonitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class); permitMonitor.waitForPermit();// 阻塞等待授权 ExtractStageListener extractStageListener = ArbitrateFactory.getInstance(pipelineId, ExtractStageListener.class); Long processId = extractStageListener.waitForProcess(); // 符合条件的processId ChannelStatus status = permitMonitor.getChannelPermit(); if (status.isStart()) {// 即时查询一下当前的状态,状态随时可能会变 // 根据pipelineId+processId构造对应的path String path = StagePathUtils.getSelectStage(pipelineId, processId); try { byte[] data = zookeeper.readData(path); EtlEventData eventData = JsonUtils.unmarshalFromByte(data, EtlEventData.class); Node node = LoadBalanceFactory.getNextTransformNode(pipelineId);// 获取下一个处理节点信息 if (node == null) {// 没有后端节点 // TerminEventData termin = new TerminEventData(); // termin.setPipelineId(pipelineId); // termin.setType(TerminType.ROLLBACK); // termin.setCode("no_node"); // termin.setDesc(MessageFormat.format("pipeline[{}] extract stage has no node!", pipelineId)); // terminEvent.single(termin); throw new ArbitrateException("Extract_single", "no next node"); } else { eventData.setNextNid(node.getId()); return eventData;// 只有这一条路返回 } } catch (ZkNoNodeException e) { logger.error("pipeline[{}] processId[{}] is invalid , retry again", pipelineId, processId); return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次 } catch (ZkException e) { throw new ArbitrateException("Extract_await", e.getMessage(), e); } } else { logger.warn("pipelineId[{}] extract ignore processId[{}] by status[{}]", new Object[] { pipelineId, processId, status }); // 释放下processId,因为load是等待processId最小值完成Tranform才继续,如果这里不释放,会一直卡死等待 String path = StagePathUtils.getProcess(pipelineId, processId); zookeeper.delete(path); return await(pipelineId);// 递归调用 } }
java
public EtlEventData await(Long pipelineId) throws InterruptedException { Assert.notNull(pipelineId); PermitMonitor permitMonitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class); permitMonitor.waitForPermit();// 阻塞等待授权 ExtractStageListener extractStageListener = ArbitrateFactory.getInstance(pipelineId, ExtractStageListener.class); Long processId = extractStageListener.waitForProcess(); // 符合条件的processId ChannelStatus status = permitMonitor.getChannelPermit(); if (status.isStart()) {// 即时查询一下当前的状态,状态随时可能会变 // 根据pipelineId+processId构造对应的path String path = StagePathUtils.getSelectStage(pipelineId, processId); try { byte[] data = zookeeper.readData(path); EtlEventData eventData = JsonUtils.unmarshalFromByte(data, EtlEventData.class); Node node = LoadBalanceFactory.getNextTransformNode(pipelineId);// 获取下一个处理节点信息 if (node == null) {// 没有后端节点 // TerminEventData termin = new TerminEventData(); // termin.setPipelineId(pipelineId); // termin.setType(TerminType.ROLLBACK); // termin.setCode("no_node"); // termin.setDesc(MessageFormat.format("pipeline[{}] extract stage has no node!", pipelineId)); // terminEvent.single(termin); throw new ArbitrateException("Extract_single", "no next node"); } else { eventData.setNextNid(node.getId()); return eventData;// 只有这一条路返回 } } catch (ZkNoNodeException e) { logger.error("pipeline[{}] processId[{}] is invalid , retry again", pipelineId, processId); return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次 } catch (ZkException e) { throw new ArbitrateException("Extract_await", e.getMessage(), e); } } else { logger.warn("pipelineId[{}] extract ignore processId[{}] by status[{}]", new Object[] { pipelineId, processId, status }); // 释放下processId,因为load是等待processId最小值完成Tranform才继续,如果这里不释放,会一直卡死等待 String path = StagePathUtils.getProcess(pipelineId, processId); zookeeper.delete(path); return await(pipelineId);// 递归调用 } }
[ "public", "EtlEventData", "await", "(", "Long", "pipelineId", ")", "throws", "InterruptedException", "{", "Assert", ".", "notNull", "(", "pipelineId", ")", ";", "PermitMonitor", "permitMonitor", "=", "ArbitrateFactory", ".", "getInstance", "(", "pipelineId", ",", ...
<pre> 算法: 1. 检查当前的Permit,阻塞等待其授权(解决Channel的pause状态处理) 2. 开始阻塞获取符合条件的processId 3. 检查当前的即时Permit状态 (在阻塞获取processId过程会出现一些error信号,process节点会被删除) 4. 获取Select传递的EventData数据,添加next node信息后直接返回 </pre> @return
[ "<pre", ">", "算法", ":", "1", ".", "检查当前的Permit,阻塞等待其授权", "(", "解决Channel的pause状态处理", ")", "2", ".", "开始阻塞获取符合条件的processId", "3", ".", "检查当前的即时Permit状态", "(", "在阻塞获取processId过程会出现一些error信号", "process节点会被删除", ")", "4", ".", "获取Select传递的EventData数据,添加next", "node信息后直接返回", ...
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/ExtractZooKeeperArbitrateEvent.java#L67-L113
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java
DataManipulationOps.create1D_F32
public static Kernel1D_F32 create1D_F32( double[] kernel ) { Kernel1D_F32 k = new Kernel1D_F32(kernel.length,kernel.length/2); for (int i = 0; i < kernel.length; i++) { k.data[i] = (float)kernel[i]; } return k; }
java
public static Kernel1D_F32 create1D_F32( double[] kernel ) { Kernel1D_F32 k = new Kernel1D_F32(kernel.length,kernel.length/2); for (int i = 0; i < kernel.length; i++) { k.data[i] = (float)kernel[i]; } return k; }
[ "public", "static", "Kernel1D_F32", "create1D_F32", "(", "double", "[", "]", "kernel", ")", "{", "Kernel1D_F32", "k", "=", "new", "Kernel1D_F32", "(", "kernel", ".", "length", ",", "kernel", ".", "length", "/", "2", ")", ";", "for", "(", "int", "i", "=...
Converts the double array into a 1D float kernel @param kernel Kernel in array format @return The kernel
[ "Converts", "the", "double", "array", "into", "a", "1D", "float", "kernel" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/deepboof/DataManipulationOps.java#L55-L61
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/DigitalOptionDeltaLikelihood.java
DigitalOptionDeltaLikelihood.getValue
@Override public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException { /* * The following valuation code requires in-depth knowledge of the model to calculate the denstiy analytically. */ BlackScholesModel blackScholesModel = null; if(model instanceof MonteCarloAssetModel) { try { blackScholesModel = (BlackScholesModel)((MonteCarloAssetModel)model).getModel(); } catch(Exception e) {} } else if(model instanceof MonteCarloBlackScholesModel) { blackScholesModel = ((MonteCarloBlackScholesModel)model).getModel(); } if(model == null) { throw new ClassCastException("This method requires a Black-Scholes type model (MonteCarloBlackScholesModel)."); } // Get underlying and numeraire RandomVariable underlyingAtMaturity = model.getAssetValue(maturity,0); RandomVariable underlyingAtToday = model.getAssetValue(0.0,0); // Get some model parameters double T = maturity-evaluationTime; double r = blackScholesModel.getRiskFreeRate().doubleValue(); double sigma = blackScholesModel.getVolatility().doubleValue(); RandomVariable lr = underlyingAtMaturity.log().sub(underlyingAtToday.log()).sub(r * T - 0.5 * sigma*sigma * T).div(sigma * sigma * T).div(underlyingAtToday); RandomVariable payoff = underlyingAtMaturity.sub(strike).choose(new Scalar(1.0), new Scalar(0.0)); RandomVariable modifiedPayoff = payoff.mult(lr); RandomVariable numeraireAtMaturity = model.getNumeraire(maturity); RandomVariable numeraireAtToday = model.getNumeraire(0); RandomVariable monteCarloWeightsAtMaturity = model.getMonteCarloWeights(maturity); RandomVariable monteCarloWeightsAtToday = model.getMonteCarloWeights(maturity); return modifiedPayoff.div(numeraireAtMaturity).mult(numeraireAtToday).mult(monteCarloWeightsAtMaturity).div(monteCarloWeightsAtToday); }
java
@Override public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException { /* * The following valuation code requires in-depth knowledge of the model to calculate the denstiy analytically. */ BlackScholesModel blackScholesModel = null; if(model instanceof MonteCarloAssetModel) { try { blackScholesModel = (BlackScholesModel)((MonteCarloAssetModel)model).getModel(); } catch(Exception e) {} } else if(model instanceof MonteCarloBlackScholesModel) { blackScholesModel = ((MonteCarloBlackScholesModel)model).getModel(); } if(model == null) { throw new ClassCastException("This method requires a Black-Scholes type model (MonteCarloBlackScholesModel)."); } // Get underlying and numeraire RandomVariable underlyingAtMaturity = model.getAssetValue(maturity,0); RandomVariable underlyingAtToday = model.getAssetValue(0.0,0); // Get some model parameters double T = maturity-evaluationTime; double r = blackScholesModel.getRiskFreeRate().doubleValue(); double sigma = blackScholesModel.getVolatility().doubleValue(); RandomVariable lr = underlyingAtMaturity.log().sub(underlyingAtToday.log()).sub(r * T - 0.5 * sigma*sigma * T).div(sigma * sigma * T).div(underlyingAtToday); RandomVariable payoff = underlyingAtMaturity.sub(strike).choose(new Scalar(1.0), new Scalar(0.0)); RandomVariable modifiedPayoff = payoff.mult(lr); RandomVariable numeraireAtMaturity = model.getNumeraire(maturity); RandomVariable numeraireAtToday = model.getNumeraire(0); RandomVariable monteCarloWeightsAtMaturity = model.getMonteCarloWeights(maturity); RandomVariable monteCarloWeightsAtToday = model.getMonteCarloWeights(maturity); return modifiedPayoff.div(numeraireAtMaturity).mult(numeraireAtToday).mult(monteCarloWeightsAtMaturity).div(monteCarloWeightsAtToday); }
[ "@", "Override", "public", "RandomVariable", "getValue", "(", "double", "evaluationTime", ",", "AssetModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "/*\n\t\t * The following valuation code requires in-depth knowledge of the model to calculate the ...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/DigitalOptionDeltaLikelihood.java#L51-L92
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.constructEmitFromClause
private static void constructEmitFromClause(LinkedList<SchemaTableTree> distinctQueryStack, ColumnList cols) { int count = 1; for (SchemaTableTree schemaTableTree : distinctQueryStack) { if (count > 1) { if (!schemaTableTree.getSchemaTable().isEdgeTable() && schemaTableTree.isEmit()) { //if the VertexStep is for an edge table there is no need to print edge ids as its already printed. printEdgeId(schemaTableTree.parent, cols); } } count++; } }
java
private static void constructEmitFromClause(LinkedList<SchemaTableTree> distinctQueryStack, ColumnList cols) { int count = 1; for (SchemaTableTree schemaTableTree : distinctQueryStack) { if (count > 1) { if (!schemaTableTree.getSchemaTable().isEdgeTable() && schemaTableTree.isEmit()) { //if the VertexStep is for an edge table there is no need to print edge ids as its already printed. printEdgeId(schemaTableTree.parent, cols); } } count++; } }
[ "private", "static", "void", "constructEmitFromClause", "(", "LinkedList", "<", "SchemaTableTree", ">", "distinctQueryStack", ",", "ColumnList", "cols", ")", "{", "int", "count", "=", "1", ";", "for", "(", "SchemaTableTree", "schemaTableTree", ":", "distinctQuerySta...
If emit is true then the edge id also needs to be printed. This is required when there are multiple edges to the same vertex. Only by having access to the edge id can on tell if the vertex needs to be emitted.
[ "If", "emit", "is", "true", "then", "the", "edge", "id", "also", "needs", "to", "be", "printed", ".", "This", "is", "required", "when", "there", "are", "multiple", "edges", "to", "the", "same", "vertex", ".", "Only", "by", "having", "access", "to", "th...
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L1818-L1829
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java
ICalPropertyScribe.writeXml
public final void writeXml(T property, Element element, WriteContext context) { XCalElement xcalElement = new XCalElement(element); _writeXml(property, xcalElement, context); }
java
public final void writeXml(T property, Element element, WriteContext context) { XCalElement xcalElement = new XCalElement(element); _writeXml(property, xcalElement, context); }
[ "public", "final", "void", "writeXml", "(", "T", "property", ",", "Element", "element", ",", "WriteContext", "context", ")", "{", "XCalElement", "xcalElement", "=", "new", "XCalElement", "(", "element", ")", ";", "_writeXml", "(", "property", ",", "xcalElement...
Marshals a property's value to an XML element (xCal). @param property the property @param element the property's XML element @param context the context @throws SkipMeException if the property should not be written to the data stream
[ "Marshals", "a", "property", "s", "value", "to", "an", "XML", "element", "(", "xCal", ")", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java#L208-L211
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/impl/CurrentAddressStructuredTypeImpl.java
CurrentAddressStructuredTypeImpl.createXSString
private <T extends XSString> T createXSString(Class<T> clazz, String value) { if (value == null) { return null; } QName elementName = null; String localName = null; try { elementName = (QName) clazz.getDeclaredField("DEFAULT_ELEMENT_NAME").get(null); localName = (String) clazz.getDeclaredField("DEFAULT_ELEMENT_LOCAL_NAME").get(null); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) { throw new RuntimeException(e); } XMLObjectBuilder<? extends XMLObject> builder = XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(elementName); Object object = builder.buildObject(new QName(this.getElementQName().getNamespaceURI(), localName, this.getElementQName().getPrefix())); T xsstring = clazz.cast(object); xsstring.setValue(value); return xsstring; }
java
private <T extends XSString> T createXSString(Class<T> clazz, String value) { if (value == null) { return null; } QName elementName = null; String localName = null; try { elementName = (QName) clazz.getDeclaredField("DEFAULT_ELEMENT_NAME").get(null); localName = (String) clazz.getDeclaredField("DEFAULT_ELEMENT_LOCAL_NAME").get(null); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) { throw new RuntimeException(e); } XMLObjectBuilder<? extends XMLObject> builder = XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(elementName); Object object = builder.buildObject(new QName(this.getElementQName().getNamespaceURI(), localName, this.getElementQName().getPrefix())); T xsstring = clazz.cast(object); xsstring.setValue(value); return xsstring; }
[ "private", "<", "T", "extends", "XSString", ">", "T", "createXSString", "(", "Class", "<", "T", ">", "clazz", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "QName", "elementName", "=", "null...
Utility method for creating an OpenSAML object given its type and assigns the value. @param clazz the class to create @param value the string value to assign @return the XML object or {@code null} if value is {@code null}
[ "Utility", "method", "for", "creating", "an", "OpenSAML", "object", "given", "its", "type", "and", "assigns", "the", "value", "." ]
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/impl/CurrentAddressStructuredTypeImpl.java#L248-L266
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarZooKeeperClient.java
AvatarZooKeeperClient.registerPrimarySsId
public synchronized void registerPrimarySsId(String address, Long ssid) throws IOException { String node = getSsIdNode(address); zkCreateRecursively(node, SerializableUtils.toBytes(ssid), true, ssid.toString()); }
java
public synchronized void registerPrimarySsId(String address, Long ssid) throws IOException { String node = getSsIdNode(address); zkCreateRecursively(node, SerializableUtils.toBytes(ssid), true, ssid.toString()); }
[ "public", "synchronized", "void", "registerPrimarySsId", "(", "String", "address", ",", "Long", "ssid", ")", "throws", "IOException", "{", "String", "node", "=", "getSsIdNode", "(", "address", ")", ";", "zkCreateRecursively", "(", "node", ",", "SerializableUtils",...
Creates a node in zookeeper denoting the current session id of the primary avatarnode of the cluster. The primary avatarnode always syncs this information to zookeeper when it starts. @param address the address of the cluster, used to create the path name for the znode @param ssid the session id of the primary avatarnode @throws IOException
[ "Creates", "a", "node", "in", "zookeeper", "denoting", "the", "current", "session", "id", "of", "the", "primary", "avatarnode", "of", "the", "cluster", ".", "The", "primary", "avatarnode", "always", "syncs", "this", "information", "to", "zookeeper", "when", "i...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarZooKeeperClient.java#L112-L117
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java
SoundStore.playAsMusic
void playAsMusic(int buffer,float pitch,float gain, boolean loop) { paused = false; setMOD(null); if (soundWorks) { if (currentMusic != -1) { AL10.alSourceStop(sources.get(0)); } getMusicSource(); AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffer); AL10.alSourcef(sources.get(0), AL10.AL_PITCH, pitch); AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, loop ? AL10.AL_TRUE : AL10.AL_FALSE); currentMusic = sources.get(0); if (!music) { pauseLoop(); } else { AL10.alSourcePlay(sources.get(0)); } } }
java
void playAsMusic(int buffer,float pitch,float gain, boolean loop) { paused = false; setMOD(null); if (soundWorks) { if (currentMusic != -1) { AL10.alSourceStop(sources.get(0)); } getMusicSource(); AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffer); AL10.alSourcef(sources.get(0), AL10.AL_PITCH, pitch); AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, loop ? AL10.AL_TRUE : AL10.AL_FALSE); currentMusic = sources.get(0); if (!music) { pauseLoop(); } else { AL10.alSourcePlay(sources.get(0)); } } }
[ "void", "playAsMusic", "(", "int", "buffer", ",", "float", "pitch", ",", "float", "gain", ",", "boolean", "loop", ")", "{", "paused", "=", "false", ";", "setMOD", "(", "null", ")", ";", "if", "(", "soundWorks", ")", "{", "if", "(", "currentMusic", "!...
Play the specified buffer as music (i.e. use the music channel) @param buffer The buffer to be played @param pitch The pitch to play the music at @param gain The gaing to play the music at @param loop True if we should loop the music
[ "Play", "the", "specified", "buffer", "as", "music", "(", "i", ".", "e", ".", "use", "the", "music", "channel", ")" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java#L467-L491
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.virtualNumbers_number_serviceInfos_GET
public OvhService virtualNumbers_number_serviceInfos_GET(String number) throws IOException { String qPath = "/sms/virtualNumbers/{number}/serviceInfos"; StringBuilder sb = path(qPath, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
java
public OvhService virtualNumbers_number_serviceInfos_GET(String number) throws IOException { String qPath = "/sms/virtualNumbers/{number}/serviceInfos"; StringBuilder sb = path(qPath, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
[ "public", "OvhService", "virtualNumbers_number_serviceInfos_GET", "(", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/virtualNumbers/{number}/serviceInfos\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "number", "...
Get this object properties REST: GET /sms/virtualNumbers/{number}/serviceInfos @param number [required] Your virtual number
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1747-L1752
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java
KeyStoreUtil.updateWithCaPem
public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { InputStream is = new FileInputStream(pCaCert); try { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is); String alias = cert.getSubjectX500Principal().getName(); pTrustStore.setCertificateEntry(alias, cert); } finally { is.close(); } }
java
public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { InputStream is = new FileInputStream(pCaCert); try { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is); String alias = cert.getSubjectX500Principal().getName(); pTrustStore.setCertificateEntry(alias, cert); } finally { is.close(); } }
[ "public", "static", "void", "updateWithCaPem", "(", "KeyStore", "pTrustStore", ",", "File", "pCaCert", ")", "throws", "IOException", ",", "CertificateException", ",", "KeyStoreException", ",", "NoSuchAlgorithmException", "{", "InputStream", "is", "=", "new", "FileInpu...
Update a keystore with a CA certificate @param pTrustStore the keystore to update @param pCaCert CA cert as PEM used for the trust store
[ "Update", "a", "keystore", "with", "a", "CA", "certificate" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java#L55-L67
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.uploadFile
protected void uploadFile(PageElement pageElement, String fileOrKey, Object... args) throws TechnicalException, FailureException { final String path = Context.getValue(fileOrKey) != null ? Context.getValue(fileOrKey) : System.getProperty(USER_DIR) + File.separator + DOWNLOADED_FILES_FOLDER + File.separator + fileOrKey; if (!"".equals(path)) { try { final WebElement element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement, args))); element.clear(); if (DriverFactory.IE.equals(Context.getBrowser())) { final String javascript = "arguments[0].value='" + path + "';"; ((JavascriptExecutor) getDriver()).executeScript(javascript, element); } else { element.sendKeys(path); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UPLOADING_FILE), path), true, pageElement.getPage().getCallBack()); } } else { logger.debug("Empty data provided. No need to update file upload path. If you want clear data, you need use: \"I clear text in ...\""); } }
java
protected void uploadFile(PageElement pageElement, String fileOrKey, Object... args) throws TechnicalException, FailureException { final String path = Context.getValue(fileOrKey) != null ? Context.getValue(fileOrKey) : System.getProperty(USER_DIR) + File.separator + DOWNLOADED_FILES_FOLDER + File.separator + fileOrKey; if (!"".equals(path)) { try { final WebElement element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement, args))); element.clear(); if (DriverFactory.IE.equals(Context.getBrowser())) { final String javascript = "arguments[0].value='" + path + "';"; ((JavascriptExecutor) getDriver()).executeScript(javascript, element); } else { element.sendKeys(path); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UPLOADING_FILE), path), true, pageElement.getPage().getCallBack()); } } else { logger.debug("Empty data provided. No need to update file upload path. If you want clear data, you need use: \"I clear text in ...\""); } }
[ "protected", "void", "uploadFile", "(", "PageElement", "pageElement", ",", "String", "fileOrKey", ",", "Object", "...", "args", ")", "throws", "TechnicalException", ",", "FailureException", "{", "final", "String", "path", "=", "Context", ".", "getValue", "(", "f...
Updates a html file input with the path of the file to upload. @param pageElement Is target element @param fileOrKey Is the file path (text or text in context (after a save)) @param args list of arguments to format the found selector with @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UPLOADING_FILE} message (with screenshot, no exception) @throws FailureException if the scenario encounters a functional error
[ "Updates", "a", "html", "file", "input", "with", "the", "path", "of", "the", "file", "to", "upload", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L793-L811
springfox/springfox
springfox-spring-web/src/main/java/springfox/documentation/spring/web/plugins/Docket.java
Docket.additionalModels
public Docket additionalModels(ResolvedType first, ResolvedType... remaining) { additionalModels.add(first); additionalModels.addAll(Arrays.stream(remaining).collect(toSet())); return this; }
java
public Docket additionalModels(ResolvedType first, ResolvedType... remaining) { additionalModels.add(first); additionalModels.addAll(Arrays.stream(remaining).collect(toSet())); return this; }
[ "public", "Docket", "additionalModels", "(", "ResolvedType", "first", ",", "ResolvedType", "...", "remaining", ")", "{", "additionalModels", ".", "add", "(", "first", ")", ";", "additionalModels", ".", "addAll", "(", "Arrays", ".", "stream", "(", "remaining", ...
Method to add additional models that are not part of any annotation or are perhaps implicit @param first - at least one is required @param remaining - possible collection of more @return on-going docket @since 2.4.0
[ "Method", "to", "add", "additional", "models", "that", "are", "not", "part", "of", "any", "annotation", "or", "are", "perhaps", "implicit" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-spring-web/src/main/java/springfox/documentation/spring/web/plugins/Docket.java#L409-L413
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/template/TemplateUtil.java
TemplateUtil.mapTaggedComponents
public static Map<String, WComponent> mapTaggedComponents(final Map<String, Object> context, final Map<String, WComponent> taggedComponents) { Map<String, WComponent> componentsByKey = new HashMap<>(); // Replace each component tag with the key so it can be used in the replace writer for (Map.Entry<String, WComponent> tagged : taggedComponents.entrySet()) { String tag = tagged.getKey(); WComponent comp = tagged.getValue(); // The key needs to be something which would never be output by a Template. String key = "[WC-TemplateLayout-" + tag + "]"; componentsByKey.put(key, comp); // Map the tag to the key in the context context.put(tag, key); } return componentsByKey; }
java
public static Map<String, WComponent> mapTaggedComponents(final Map<String, Object> context, final Map<String, WComponent> taggedComponents) { Map<String, WComponent> componentsByKey = new HashMap<>(); // Replace each component tag with the key so it can be used in the replace writer for (Map.Entry<String, WComponent> tagged : taggedComponents.entrySet()) { String tag = tagged.getKey(); WComponent comp = tagged.getValue(); // The key needs to be something which would never be output by a Template. String key = "[WC-TemplateLayout-" + tag + "]"; componentsByKey.put(key, comp); // Map the tag to the key in the context context.put(tag, key); } return componentsByKey; }
[ "public", "static", "Map", "<", "String", ",", "WComponent", ">", "mapTaggedComponents", "(", "final", "Map", "<", "String", ",", "Object", ">", "context", ",", "final", "Map", "<", "String", ",", "WComponent", ">", "taggedComponents", ")", "{", "Map", "<"...
Replace each component tag with the key so it can be used in the replace writer. @param context the context to modify. @param taggedComponents the tagged components @return the keyed components
[ "Replace", "each", "component", "tag", "with", "the", "key", "so", "it", "can", "be", "used", "in", "the", "replace", "writer", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/template/TemplateUtil.java#L29-L47
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java
FitLinesToContour.sanityCheckCornerOrder
boolean sanityCheckCornerOrder( int numLines, GrowQueue_I32 corners ) { int contourAnchor0 = corners.get(anchor0); int previous = 0; for (int i = 1; i < numLines; i++) { int contourIndex = corners.get(CircularIndex.addOffset(anchor0, i, corners.size())); int pixelsFromAnchor0 = CircularIndex.distanceP(contourAnchor0, contourIndex, contour.size()); if (pixelsFromAnchor0 < previous) { return false; } else { previous = pixelsFromAnchor0; } } return true; }
java
boolean sanityCheckCornerOrder( int numLines, GrowQueue_I32 corners ) { int contourAnchor0 = corners.get(anchor0); int previous = 0; for (int i = 1; i < numLines; i++) { int contourIndex = corners.get(CircularIndex.addOffset(anchor0, i, corners.size())); int pixelsFromAnchor0 = CircularIndex.distanceP(contourAnchor0, contourIndex, contour.size()); if (pixelsFromAnchor0 < previous) { return false; } else { previous = pixelsFromAnchor0; } } return true; }
[ "boolean", "sanityCheckCornerOrder", "(", "int", "numLines", ",", "GrowQueue_I32", "corners", ")", "{", "int", "contourAnchor0", "=", "corners", ".", "get", "(", "anchor0", ")", ";", "int", "previous", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";"...
All the corners should be in increasing order from the first anchor.
[ "All", "the", "corners", "should", "be", "in", "increasing", "order", "from", "the", "first", "anchor", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L157-L171
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setBytes
public void setBytes(final int parameterIndex, final byte[] x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } setParameter(parameterIndex, new ByteParameter(x)); }
java
public void setBytes(final int parameterIndex, final byte[] x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } setParameter(parameterIndex, new ByteParameter(x)); }
[ "public", "void", "setBytes", "(", "final", "int", "parameterIndex", ",", "final", "byte", "[", "]", "x", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "BLOB", ")", ";",...
Sets the designated parameter to the given Java array of bytes. The driver converts this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code> (depending on the argument's size relative to the driver's limits on <code>VARBINARY</code> values) when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param x the parameter value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "Java", "array", "of", "bytes", ".", "The", "driver", "converts", "this", "to", "an", "SQL", "<code", ">", "VARBINARY<", "/", "code", ">", "or", "<code", ">", "LONGVARBINARY<", "/", "code", ...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1110-L1117
OpenLiberty/open-liberty
dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/util/Link.java
Link.parseMessageDestinationLink
public static Link parseMessageDestinationLink(String origin, String link) { return parse(origin, link, false); }
java
public static Link parseMessageDestinationLink(String origin, String link) { return parse(origin, link, false); }
[ "public", "static", "Link", "parseMessageDestinationLink", "(", "String", "origin", ",", "String", "link", ")", "{", "return", "parse", "(", "origin", ",", "link", ",", "false", ")", ";", "}" ]
Parse a message-destination-link @param origin original module name. @param link link provided on the link element @return
[ "Parse", "a", "message", "-", "destination", "-", "link" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/util/Link.java#L29-L31
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java
MyHTTPUtils.getContent
public static String getContent(String stringUrl, Map<String, String> parameters) throws IOException { return getContent(stringUrl, parameters, null); }
java
public static String getContent(String stringUrl, Map<String, String> parameters) throws IOException { return getContent(stringUrl, parameters, null); }
[ "public", "static", "String", "getContent", "(", "String", "stringUrl", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "IOException", "{", "return", "getContent", "(", "stringUrl", ",", "parameters", ",", "null", ")", ";", "}" ]
Get content for url/parameters @param stringUrl URL to get content @param parameters HTTP parameters to pass @return content the response content @throws IOException I/O error happened
[ "Get", "content", "for", "url", "/", "parameters" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L82-L85
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java
CommerceSubscriptionEntryPersistenceImpl.removeByUUID_G
@Override public CommerceSubscriptionEntry removeByUUID_G(String uuid, long groupId) throws NoSuchSubscriptionEntryException { CommerceSubscriptionEntry commerceSubscriptionEntry = findByUUID_G(uuid, groupId); return remove(commerceSubscriptionEntry); }
java
@Override public CommerceSubscriptionEntry removeByUUID_G(String uuid, long groupId) throws NoSuchSubscriptionEntryException { CommerceSubscriptionEntry commerceSubscriptionEntry = findByUUID_G(uuid, groupId); return remove(commerceSubscriptionEntry); }
[ "@", "Override", "public", "CommerceSubscriptionEntry", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchSubscriptionEntryException", "{", "CommerceSubscriptionEntry", "commerceSubscriptionEntry", "=", "findByUUID_G", "(", "uuid", ",", ...
Removes the commerce subscription entry where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce subscription entry that was removed
[ "Removes", "the", "commerce", "subscription", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L822-L829
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java
ParsedScheduleExpression.getNextVariableDay
private int getNextVariableDay(int day, int lastDay, int dayOfWeek) // d659945 { int nextDay = ADVANCE_TO_NEXT_MONTH; for (int i = 0; i < variableDayOfMonthRanges.size(); i++) { int result = variableDayOfMonthRanges.get(i).getNextDay(day, lastDay, dayOfWeek); if (result == day) { return day; } nextDay = Math.min(nextDay, result); } return nextDay; }
java
private int getNextVariableDay(int day, int lastDay, int dayOfWeek) // d659945 { int nextDay = ADVANCE_TO_NEXT_MONTH; for (int i = 0; i < variableDayOfMonthRanges.size(); i++) { int result = variableDayOfMonthRanges.get(i).getNextDay(day, lastDay, dayOfWeek); if (result == day) { return day; } nextDay = Math.min(nextDay, result); } return nextDay; }
[ "private", "int", "getNextVariableDay", "(", "int", "day", ",", "int", "lastDay", ",", "int", "dayOfWeek", ")", "// d659945", "{", "int", "nextDay", "=", "ADVANCE_TO_NEXT_MONTH", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "variableDayOfMonthRanges...
Returns the next day of the month after <tt>day</tt> that satisfies the variableDayOfMonthRanges constraint. @param day the current 0-based day of the month @param lastDay the current 0-based last day of the month @param dayOfWeek the current 0-based day of the week @return a value greater than or equal to <tt>day</tt>
[ "Returns", "the", "next", "day", "of", "the", "month", "after", "<tt", ">", "day<", "/", "tt", ">", "that", "satisfies", "the", "variableDayOfMonthRanges", "constraint", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L1057-L1073
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.createPipeline
public CreatePipelineResponse createPipeline(CreatePipelineRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); checkStringNotEmpty(request.getSourceBucket(), "The parameter sourceBucket should NOT be null or empty string."); checkStringNotEmpty(request.getTargetBucket(), "The parameter targetBucket should NOT be null or empty string."); if (request.getConfig() == null || request.getConfig().getCapacity() == null) { PipelineConfig config = new PipelineConfig(); config.setCapacity(DEFAULT_PIPELINE_CAPACITY); request.setConfig(config); } InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PIPELINE); return invokeHttpClient(internalRequest, CreatePipelineResponse.class); }
java
public CreatePipelineResponse createPipeline(CreatePipelineRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); checkStringNotEmpty(request.getSourceBucket(), "The parameter sourceBucket should NOT be null or empty string."); checkStringNotEmpty(request.getTargetBucket(), "The parameter targetBucket should NOT be null or empty string."); if (request.getConfig() == null || request.getConfig().getCapacity() == null) { PipelineConfig config = new PipelineConfig(); config.setCapacity(DEFAULT_PIPELINE_CAPACITY); request.setConfig(config); } InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PIPELINE); return invokeHttpClient(internalRequest, CreatePipelineResponse.class); }
[ "public", "CreatePipelineResponse", "createPipeline", "(", "CreatePipelineRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPipelineName", "(", ")", ...
Creates a pipeline which enable you to perform multiple transcodes in parallel. @param request The request object containing all options for creating new pipeline.
[ "Creates", "a", "pipeline", "which", "enable", "you", "to", "perform", "multiple", "transcodes", "in", "parallel", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L571-L587
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.multi8p
public double multi8p(int x, int y, double masc) { int aR = getIntComponent0(x - 1, y - 1); int bR = getIntComponent0(x - 1, y); int cR = getIntComponent0(x - 1, y + 1); int aG = getIntComponent1(x - 1, y - 1); int bG = getIntComponent1(x - 1, y); int cG = getIntComponent1(x - 1, y + 1); int aB = getIntComponent1(x - 1, y - 1); int bB = getIntComponent1(x - 1, y); int cB = getIntComponent1(x - 1, y + 1); int dR = getIntComponent0(x, y - 1); int eR = getIntComponent0(x, y); int fR = getIntComponent0(x, y + 1); int dG = getIntComponent1(x, y - 1); int eG = getIntComponent1(x, y); int fG = getIntComponent1(x, y + 1); int dB = getIntComponent1(x, y - 1); int eB = getIntComponent1(x, y); int fB = getIntComponent1(x, y + 1); int gR = getIntComponent0(x + 1, y - 1); int hR = getIntComponent0(x + 1, y); int iR = getIntComponent0(x + 1, y + 1); int gG = getIntComponent1(x + 1, y - 1); int hG = getIntComponent1(x + 1, y); int iG = getIntComponent1(x + 1, y + 1); int gB = getIntComponent1(x + 1, y - 1); int hB = getIntComponent1(x + 1, y); int iB = getIntComponent1(x + 1, y + 1); double rgb = 0; rgb = ((aR * masc) + (bR * masc) + (cR * masc) + (dR * masc) + (eR * masc) + (fR * masc) + (gR * masc) + (hR * masc) + (iR * masc)); return (rgb); }
java
public double multi8p(int x, int y, double masc) { int aR = getIntComponent0(x - 1, y - 1); int bR = getIntComponent0(x - 1, y); int cR = getIntComponent0(x - 1, y + 1); int aG = getIntComponent1(x - 1, y - 1); int bG = getIntComponent1(x - 1, y); int cG = getIntComponent1(x - 1, y + 1); int aB = getIntComponent1(x - 1, y - 1); int bB = getIntComponent1(x - 1, y); int cB = getIntComponent1(x - 1, y + 1); int dR = getIntComponent0(x, y - 1); int eR = getIntComponent0(x, y); int fR = getIntComponent0(x, y + 1); int dG = getIntComponent1(x, y - 1); int eG = getIntComponent1(x, y); int fG = getIntComponent1(x, y + 1); int dB = getIntComponent1(x, y - 1); int eB = getIntComponent1(x, y); int fB = getIntComponent1(x, y + 1); int gR = getIntComponent0(x + 1, y - 1); int hR = getIntComponent0(x + 1, y); int iR = getIntComponent0(x + 1, y + 1); int gG = getIntComponent1(x + 1, y - 1); int hG = getIntComponent1(x + 1, y); int iG = getIntComponent1(x + 1, y + 1); int gB = getIntComponent1(x + 1, y - 1); int hB = getIntComponent1(x + 1, y); int iB = getIntComponent1(x + 1, y + 1); double rgb = 0; rgb = ((aR * masc) + (bR * masc) + (cR * masc) + (dR * masc) + (eR * masc) + (fR * masc) + (gR * masc) + (hR * masc) + (iR * masc)); return (rgb); }
[ "public", "double", "multi8p", "(", "int", "x", ",", "int", "y", ",", "double", "masc", ")", "{", "int", "aR", "=", "getIntComponent0", "(", "x", "-", "1", ",", "y", "-", "1", ")", ";", "int", "bR", "=", "getIntComponent0", "(", "x", "-", "1", ...
Multiple of gradient windwos per masc relation of x y @return int[]
[ "Multiple", "of", "gradient", "windwos", "per", "masc", "relation", "of", "x", "y" ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L565-L606
paypal/SeLion
client/src/main/java/com/paypal/selion/internal/utils/RegexUtils.java
RegexUtils.wildCardMatch
public static boolean wildCardMatch(String text, String pattern) { logger.entering(new Object[] { text, pattern }); Preconditions.checkArgument(text != null, "The text on which the search is to be run cannot be null."); Preconditions.checkArgument(pattern != null, "The search pattern cannot be null."); // Create the cards by splitting using a RegEx. If more speed // is desired, a simpler character based splitting can be done. String[] cards = pattern.split("\\*"); // Iterate over the cards. for (String card : cards) { int idx = text.indexOf(card); // Card not detected in the text. if (idx == -1) { logger.exiting(false); return false; } // Move ahead, towards the right of the text. text = text.substring(idx + card.length()); } logger.exiting(true); return true; }
java
public static boolean wildCardMatch(String text, String pattern) { logger.entering(new Object[] { text, pattern }); Preconditions.checkArgument(text != null, "The text on which the search is to be run cannot be null."); Preconditions.checkArgument(pattern != null, "The search pattern cannot be null."); // Create the cards by splitting using a RegEx. If more speed // is desired, a simpler character based splitting can be done. String[] cards = pattern.split("\\*"); // Iterate over the cards. for (String card : cards) { int idx = text.indexOf(card); // Card not detected in the text. if (idx == -1) { logger.exiting(false); return false; } // Move ahead, towards the right of the text. text = text.substring(idx + card.length()); } logger.exiting(true); return true; }
[ "public", "static", "boolean", "wildCardMatch", "(", "String", "text", ",", "String", "pattern", ")", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "text", ",", "pattern", "}", ")", ";", "Preconditions", ".", "checkArgument", "(", ...
Performs a wild-card matching for the text and pattern provided. @param text the text to be tested for matches. @param pattern the pattern to be matched for. This can contain the wildcard character '*' (asterisk). @return <tt>true</tt> if a match is found, <tt>false</tt> otherwise.
[ "Performs", "a", "wild", "-", "card", "matching", "for", "the", "text", "and", "pattern", "provided", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/utils/RegexUtils.java#L42-L65
venmo/cursor-utils
cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java
IterableCursorWrapper.getBoolean
public boolean getBoolean(String columnName, boolean defaultValue) { int defaultValueAsInt = (defaultValue) ? SQLITE_TRUE : SQLITE_FALSE; return getInteger(columnName, defaultValueAsInt) == SQLITE_TRUE; }
java
public boolean getBoolean(String columnName, boolean defaultValue) { int defaultValueAsInt = (defaultValue) ? SQLITE_TRUE : SQLITE_FALSE; return getInteger(columnName, defaultValueAsInt) == SQLITE_TRUE; }
[ "public", "boolean", "getBoolean", "(", "String", "columnName", ",", "boolean", "defaultValue", ")", "{", "int", "defaultValueAsInt", "=", "(", "defaultValue", ")", "?", "SQLITE_TRUE", ":", "SQLITE_FALSE", ";", "return", "getInteger", "(", "columnName", ",", "de...
Booleans in SQLite are handled as {@code int}s. Use this as a convenience to retrieve a boolean from a column.
[ "Booleans", "in", "SQLite", "are", "handled", "as", "{" ]
train
https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java#L52-L56
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/NodeIdRepresentation.java
NodeIdRepresentation.modifyResource
public void modifyResource(final String resourceName, final long nodeId, final InputStream newValue) throws JaxRxException { synchronized (resourceName) { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; if (mDatabase.existsResource(resourceName)) { try { // Creating a new session session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); // Creating a write transaction wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); if (wtx.moveTo(nodeId)) { final long parentKey = wtx.getNode().getParentKey(); wtx.remove(); wtx.moveTo(parentKey); WorkerHelper.shredInputStream(wtx, newValue, EShredderInsert.ADDASFIRSTCHILD); } else { // workerHelper.closeWTX(abort, wtx, session, database); throw new JaxRxException(404, NOTFOUND); } } catch (final TTException exc) { abort = true; throw new JaxRxException(exc); } finally { try { WorkerHelper.closeWTX(abort, wtx, session); } catch (final TTException exce) { throw new JaxRxException(exce); } } } else { throw new JaxRxException(404, "Requested resource not found"); } } }
java
public void modifyResource(final String resourceName, final long nodeId, final InputStream newValue) throws JaxRxException { synchronized (resourceName) { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; if (mDatabase.existsResource(resourceName)) { try { // Creating a new session session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); // Creating a write transaction wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); if (wtx.moveTo(nodeId)) { final long parentKey = wtx.getNode().getParentKey(); wtx.remove(); wtx.moveTo(parentKey); WorkerHelper.shredInputStream(wtx, newValue, EShredderInsert.ADDASFIRSTCHILD); } else { // workerHelper.closeWTX(abort, wtx, session, database); throw new JaxRxException(404, NOTFOUND); } } catch (final TTException exc) { abort = true; throw new JaxRxException(exc); } finally { try { WorkerHelper.closeWTX(abort, wtx, session); } catch (final TTException exce) { throw new JaxRxException(exce); } } } else { throw new JaxRxException(404, "Requested resource not found"); } } }
[ "public", "void", "modifyResource", "(", "final", "String", "resourceName", ",", "final", "long", "nodeId", ",", "final", "InputStream", "newValue", ")", "throws", "JaxRxException", "{", "synchronized", "(", "resourceName", ")", "{", "ISession", "session", "=", ...
This method is responsible to modify the XML resource, which is addressed through a unique node id. @param resourceName The name of the database, where the node id belongs to. @param nodeId The node id. @param newValue The new value of the node that has to be replaced. @throws JaxRxException The exception occurred.
[ "This", "method", "is", "responsible", "to", "modify", "the", "XML", "resource", "which", "is", "addressed", "through", "a", "unique", "node", "id", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/NodeIdRepresentation.java#L274-L313
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getBoolean
public final boolean getBoolean(String attribute, String... path) { return Boolean.parseBoolean(getNodeString(attribute, path)); }
java
public final boolean getBoolean(String attribute, String... path) { return Boolean.parseBoolean(getNodeString(attribute, path)); }
[ "public", "final", "boolean", "getBoolean", "(", "String", "attribute", ",", "String", "...", "path", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "getNodeString", "(", "attribute", ",", "path", ")", ")", ";", "}" ]
Get a boolean in the xml tree. @param attribute The attribute to get as boolean. @param path The node path (child list) @return The boolean value. @throws LionEngineException If unable to read node.
[ "Get", "a", "boolean", "in", "the", "xml", "tree", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L185-L188
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java
PaymentProtocol.parsePaymentRequest
public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest) throws PaymentProtocolException { return new PaymentSession(paymentRequest, false, null); }
java
public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest) throws PaymentProtocolException { return new PaymentSession(paymentRequest, false, null); }
[ "public", "static", "PaymentSession", "parsePaymentRequest", "(", "Protos", ".", "PaymentRequest", "paymentRequest", ")", "throws", "PaymentProtocolException", "{", "return", "new", "PaymentSession", "(", "paymentRequest", ",", "false", ",", "null", ")", ";", "}" ]
Parse a payment request. @param paymentRequest payment request to parse @return instance of {@link PaymentSession}, used as a value object @throws PaymentProtocolException
[ "Parse", "a", "payment", "request", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L113-L116
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java
CmsAreaSelectPanel.setSelectPositionY
private void setSelectPositionY(int posY, int height) { m_markerStyle.setTop(posY, Unit.PX); m_markerStyle.setHeight(height, Unit.PX); m_overlayTopStyle.setHeight(posY, Unit.PX); m_overlayBottomStyle.setHeight(m_elementHeight - posY - height, Unit.PX); m_currentSelection.setTop(posY); m_currentSelection.setHeight(height); }
java
private void setSelectPositionY(int posY, int height) { m_markerStyle.setTop(posY, Unit.PX); m_markerStyle.setHeight(height, Unit.PX); m_overlayTopStyle.setHeight(posY, Unit.PX); m_overlayBottomStyle.setHeight(m_elementHeight - posY - height, Unit.PX); m_currentSelection.setTop(posY); m_currentSelection.setHeight(height); }
[ "private", "void", "setSelectPositionY", "(", "int", "posY", ",", "int", "height", ")", "{", "m_markerStyle", ".", "setTop", "(", "posY", ",", "Unit", ".", "PX", ")", ";", "m_markerStyle", ".", "setHeight", "(", "height", ",", "Unit", ".", "PX", ")", "...
Sets Y position and height of the select area.<p> @param posY the new Y position @param height the new height
[ "Sets", "Y", "position", "and", "height", "of", "the", "select", "area", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java#L813-L823
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/OgnlUtil.java
OgnlUtil.getValue
public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) { try { OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true)); return Ognl.getValue(exp, context, root); } catch (OgnlException ex) { throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex .getReason(), path, lineNumber); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
java
public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) { try { OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true)); return Ognl.getValue(exp, context, root); } catch (OgnlException ex) { throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex .getReason(), path, lineNumber); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
[ "public", "static", "Object", "getValue", "(", "Object", "exp", ",", "Map", "ctx", ",", "Object", "root", ",", "String", "path", ",", "int", "lineNumber", ")", "{", "try", "{", "OgnlContext", "context", "=", "new", "OgnlContext", "(", "null", ",", "null"...
Returns the value using the OGNL expression, the root object, a context mpa, a path and a line number. @param exp the OGNL expression @param ctx the context map @param root the root object @param path the path @param lineNumber the line number @return the value @throws OgnlRuntimeException when a {@link ognl.OgnlException} occurs
[ "Returns", "the", "value", "using", "the", "OGNL", "expression", "the", "root", "object", "a", "context", "mpa", "a", "path", "and", "a", "line", "number", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L96-L106