method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private double findUpperBound(final UnivariateRealFunction f, final double a, final double h) throws FunctionEvaluationException, OptimizationException { final double yA = f.value(a); double yB = yA; for (double step = h; step < Double.MAX_VALUE; step *= Math.max(2, yA / yB)) { final double b = a + step; yB = f.value(b); if (yA * yB <= 0) { return b; } } throw new OptimizationException("unable to bracket optimum in line search"); } private static class IdentityPreconditioner implements Preconditioner {
double function(final UnivariateRealFunction f, final double a, final double h) throws FunctionEvaluationException, OptimizationException { final double yA = f.value(a); double yB = yA; for (double step = h; step < Double.MAX_VALUE; step *= Math.max(2, yA / yB)) { final double b = a + step; yB = f.value(b); if (yA * yB <= 0) { return b; } } throw new OptimizationException(STR); } private static class IdentityPreconditioner implements Preconditioner {
/** * Find the upper bound b ensuring bracketing of a root between a and b * @param f function whose root must be bracketed * @param a lower bound of the interval * @param h initial step to try * @return b such that f(a) and f(b) have opposite signs * @exception FunctionEvaluationException if the function cannot be computed * @exception OptimizationException if no bracket can be found */
Find the upper bound b ensuring bracketing of a root between a and b
findUpperBound
{ "repo_name": "justinwm/astor", "path": "examples/math_76/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java", "license": "gpl-2.0", "size": 11066 }
[ "org.apache.commons.math.FunctionEvaluationException", "org.apache.commons.math.analysis.UnivariateRealFunction", "org.apache.commons.math.optimization.OptimizationException" ]
import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.analysis.UnivariateRealFunction; import org.apache.commons.math.optimization.OptimizationException;
import org.apache.commons.math.*; import org.apache.commons.math.analysis.*; import org.apache.commons.math.optimization.*;
[ "org.apache.commons" ]
org.apache.commons;
2,375,594
public void testStoredProcedureParameterAPI() { if (supportsStoredProcedures() && getPlatform().isMySQL()) { EntityManager em = createEntityManager(); try { StoredProcedureQuery query = em.createStoredProcedureQuery("Parameter_Testing"); query.registerStoredProcedureParameter(1, String.class, ParameterMode.IN); query.registerStoredProcedureParameter(2, Integer.class, ParameterMode.INOUT); query.registerStoredProcedureParameter(3, Integer.class, ParameterMode.OUT); query.setParameter(1, "1"); query.setParameter(2, 2); // Make this call to test the getParameter call with a position. query.getParameter(1); query.getParameter(2); query.getParameter(3); } catch (IllegalArgumentException e) { if (isTransactionActive(em)){ rollbackTransaction(em); } fail("IllegalArgumentException was caught"); } finally { closeEntityManager(em); } } }
void function() { if (supportsStoredProcedures() && getPlatform().isMySQL()) { EntityManager em = createEntityManager(); try { StoredProcedureQuery query = em.createStoredProcedureQuery(STR); query.registerStoredProcedureParameter(1, String.class, ParameterMode.IN); query.registerStoredProcedureParameter(2, Integer.class, ParameterMode.INOUT); query.registerStoredProcedureParameter(3, Integer.class, ParameterMode.OUT); query.setParameter(1, "1"); query.setParameter(2, 2); query.getParameter(1); query.getParameter(2); query.getParameter(3); } catch (IllegalArgumentException e) { if (isTransactionActive(em)){ rollbackTransaction(em); } fail(STR); } finally { closeEntityManager(em); } } }
/** * Test stored procedure parameter API. */
Test stored procedure parameter API
testStoredProcedureParameterAPI
{ "repo_name": "gameduell/eclipselink.runtime", "path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa22/advanced/StoredProcedureQueryTestSuite.java", "license": "epl-1.0", "size": 52079 }
[ "javax.persistence.EntityManager", "javax.persistence.ParameterMode", "javax.persistence.StoredProcedureQuery" ]
import javax.persistence.EntityManager; import javax.persistence.ParameterMode; import javax.persistence.StoredProcedureQuery;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
2,427,629
public interface OnCheckedChangeListener { public void onCheckedChanged(StepikRadioGroup group, @IdRes int checkedId); }
interface OnCheckedChangeListener { public void function(StepikRadioGroup group, @IdRes int checkedId); }
/** * <p>Called when the checked radio button has changed. When the * selection is cleared, checkedId is -1.</p> * * @param group the group in which the checked radio button has changed * @param checkedId the unique identifier of the newly checked radio button */
Called when the checked radio button has changed. When the selection is cleared, checkedId is -1
onCheckedChanged
{ "repo_name": "StepicOrg/stepik-android", "path": "app/src/main/java/org/stepic/droid/ui/custom/StepikRadioGroup.java", "license": "apache-2.0", "size": 11024 }
[ "androidx.annotation.IdRes" ]
import androidx.annotation.IdRes;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
2,875,152
public static void addSeparator(int span, Composite parent) { Label empty = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); GridData lgd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); lgd.horizontalSpan = span; empty.setLayoutData(lgd); }
static void function(int span, Composite parent) { Label empty = new Label(parent, SWT.HORIZONTAL SWT.SEPARATOR); GridData lgd = new GridData(GridData.FILL_HORIZONTAL GridData.GRAB_HORIZONTAL); lgd.horizontalSpan = span; empty.setLayoutData(lgd); }
/** * Add a horizontal line to the page. * @param span number of horizontal columns to span * @param parent parent container */
Add a horizontal line to the page
addSeparator
{ "repo_name": "kolovos/texlipse", "path": "net.sourceforge.texlipse/src/net/sourceforge/texlipse/properties/TexlipsePreferencePage.java", "license": "epl-1.0", "size": 5513 }
[ "org.eclipse.swt.layout.GridData", "org.eclipse.swt.widgets.Composite", "org.eclipse.swt.widgets.Label" ]
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
686,892
public void newFolder(String name) { database.openTransaction("", DBSituation.LOCAL_DATABASE); File newFile = new File(name); GhostFolderDob dob = new GhostFolderDob(null, newFile.getName(), root); database.createElement(dob); // insert in DB and Treeview root.addFolder((GhostFolderDob) database.createElement(dob).get(0)); database.closeTransaction("", Messages.getIdSize(), DBSituation.LOCAL_DATABASE); }
void function(String name) { database.openTransaction(STR", Messages.getIdSize(), DBSituation.LOCAL_DATABASE); }
/** * Insert new Folder * * @param name */
Insert new Folder
newFolder
{ "repo_name": "dev131/DropTillLate_Application", "path": "ch.droptilllate.application/src/ch/droptilllate/application/controller/ViewController.java", "license": "epl-1.0", "size": 21826 }
[ "ch.droptilllate.application.properties.Messages", "ch.droptilllate.database.api.DBSituation" ]
import ch.droptilllate.application.properties.Messages; import ch.droptilllate.database.api.DBSituation;
import ch.droptilllate.application.properties.*; import ch.droptilllate.database.api.*;
[ "ch.droptilllate.application", "ch.droptilllate.database" ]
ch.droptilllate.application; ch.droptilllate.database;
868,033
protected void setDeadForever(Map<String, Object> options) { switch (liveness) { case LIVENESS_DEAD_FOREVER: return; case LIVENESS_DEAD: this.liveness = LIVENESS_DEAD_FOREVER; if (logger.level <= Logger.FINE) logger.log("Found address " + address + " to be dead forever."); break; default: this.best = null; this.liveness = LIVENESS_DEAD_FOREVER; notifyLivenessListeners(address, LIVENESS_DEAD_FOREVER, options); if (logger.level <= Logger.FINE) logger.log("Found address " + address + " to be dead forever."); break; } purgeQueue(); clearLivenessState(); }
void function(Map<String, Object> options) { switch (liveness) { case LIVENESS_DEAD_FOREVER: return; case LIVENESS_DEAD: this.liveness = LIVENESS_DEAD_FOREVER; if (logger.level <= Logger.FINE) logger.log(STR + address + STR); break; default: this.best = null; this.liveness = LIVENESS_DEAD_FOREVER; notifyLivenessListeners(address, LIVENESS_DEAD_FOREVER, options); if (logger.level <= Logger.FINE) logger.log(STR + address + STR); break; } purgeQueue(); clearLivenessState(); }
/** * Internal method which marks this address as being dead. If we were alive or suspected before, it * sends an update out to the observers. */
Internal method which marks this address as being dead. If we were alive or suspected before, it sends an update out to the observers
setDeadForever
{ "repo_name": "barnyard/pi", "path": "freepastry/src/org/mpisws/p2p/transport/sourceroute/manager/SourceRouteManagerImpl.java", "license": "apache-2.0", "size": 43670 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,619,971
public int getMonth() { DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class); Calendar cal = dateTimeService.getCalendar(new Date(this.universityFiscalPeriodEndDate.getTime())); return cal.get(Calendar.MONTH) + 1; }
int function() { DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class); Calendar cal = dateTimeService.getCalendar(new Date(this.universityFiscalPeriodEndDate.getTime())); return cal.get(Calendar.MONTH) + 1; }
/** * This method returns the month that this period represents * * @return the actual month (1 - 12) that this period represents */
This method returns the month that this period represents
getMonth
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/coa/businessobject/AccountingPeriod.java", "license": "agpl-3.0", "size": 8122 }
[ "java.sql.Date", "java.util.Calendar", "org.kuali.kfs.sys.context.SpringContext", "org.kuali.rice.core.api.datetime.DateTimeService" ]
import java.sql.Date; import java.util.Calendar; import org.kuali.kfs.sys.context.SpringContext; import org.kuali.rice.core.api.datetime.DateTimeService;
import java.sql.*; import java.util.*; import org.kuali.kfs.sys.context.*; import org.kuali.rice.core.api.datetime.*;
[ "java.sql", "java.util", "org.kuali.kfs", "org.kuali.rice" ]
java.sql; java.util; org.kuali.kfs; org.kuali.rice;
1,204,731
@Override public void combine(Iterator<Record> values, Collector<Record> out) { reduce(values, out); } }
void function(Iterator<Record> values, Collector<Record> out) { reduce(values, out); } }
/** * Creates partial sums on the price attribute for each data batch. */
Creates partial sums on the price attribute for each data batch
combine
{ "repo_name": "citlab/vs.msc.ws14", "path": "flink-0-7-custom/flink-tests/src/test/java/org/apache/flink/test/recordJobs/relational/TPCHQuery3.java", "license": "apache-2.0", "size": 9280 }
[ "java.util.Iterator", "org.apache.flink.types.Record", "org.apache.flink.util.Collector" ]
import java.util.Iterator; import org.apache.flink.types.Record; import org.apache.flink.util.Collector;
import java.util.*; import org.apache.flink.types.*; import org.apache.flink.util.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
1,860,639
protected ViewTable viewTable(CalcitePrepare.AnalyzeViewResult parsed, String viewSql, List<String> schemaPath, List<String> viewPath) { final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory; final Type elementType = typeFactory.getJavaClass(parsed.rowType); return new ViewTable(elementType, RelDataTypeImpl.proto(parsed.rowType), viewSql, schemaPath, viewPath); }
ViewTable function(CalcitePrepare.AnalyzeViewResult parsed, String viewSql, List<String> schemaPath, List<String> viewPath) { final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory; final Type elementType = typeFactory.getJavaClass(parsed.rowType); return new ViewTable(elementType, RelDataTypeImpl.proto(parsed.rowType), viewSql, schemaPath, viewPath); }
/** Allows a sub-class to return an extension of {@link ViewTable} by * overriding this method. */
Allows a sub-class to return an extension of <code>ViewTable</code> by
viewTable
{ "repo_name": "googleinterns/calcite", "path": "core/src/main/java/org/apache/calcite/schema/impl/ViewTableMacro.java", "license": "apache-2.0", "size": 4690 }
[ "java.lang.reflect.Type", "java.util.List", "org.apache.calcite.adapter.java.JavaTypeFactory", "org.apache.calcite.jdbc.CalcitePrepare", "org.apache.calcite.rel.type.RelDataTypeImpl" ]
import java.lang.reflect.Type; import java.util.List; import org.apache.calcite.adapter.java.JavaTypeFactory; import org.apache.calcite.jdbc.CalcitePrepare; import org.apache.calcite.rel.type.RelDataTypeImpl;
import java.lang.reflect.*; import java.util.*; import org.apache.calcite.adapter.java.*; import org.apache.calcite.jdbc.*; import org.apache.calcite.rel.type.*;
[ "java.lang", "java.util", "org.apache.calcite" ]
java.lang; java.util; org.apache.calcite;
1,891,236
private boolean validTemplates(ProtocolCorrespondenceTypeBase protocolCorrespondenceType, int typeIndex) throws IOException { boolean isValid = true; ProtocolCorrespondenceTemplateBase defaultTemplate = protocolCorrespondenceType.getDefaultProtocolCorrespondenceTemplate(); if (defaultTemplate != null) { if ((defaultTemplate.getCorrespondenceTemplate().length == 0) || StringUtils.isBlank(defaultTemplate.getFileName())) { String filePropertyName = String.format(PROPERTY_NAME_NEW_DEFAULT_TEMPLATE_FILE, typeIndex); GlobalVariables.getMessageMap().putError(filePropertyName, KeyConstants.ERROR_CORRESPONDENCE_TEMPLATE_INVALID_FILE); isValid = false; } } List<ProtocolCorrespondenceTemplateBase> protocolCorrespondenceTemplates = protocolCorrespondenceType.getCommitteeProtocolCorrespondenceTemplates(); for (ProtocolCorrespondenceTemplateBase protocolCorrespondenceTemplate : protocolCorrespondenceTemplates) { if ((protocolCorrespondenceTemplate.getCorrespondenceTemplate() == null) || (protocolCorrespondenceTemplate.getCorrespondenceTemplate().length == 0) || StringUtils.isBlank(protocolCorrespondenceTemplate.getFileName())) { int templateIndex = protocolCorrespondenceTemplates.indexOf(protocolCorrespondenceTemplate); String filePropertyName = String.format(PROPERTY_NAME_TEMPLATE_FILE, typeIndex, templateIndex); GlobalVariables.getMessageMap().putError(filePropertyName, KeyConstants.ERROR_CORRESPONDENCE_TEMPLATE_INVALID_FILE); isValid = false; } } return isValid; }
boolean function(ProtocolCorrespondenceTypeBase protocolCorrespondenceType, int typeIndex) throws IOException { boolean isValid = true; ProtocolCorrespondenceTemplateBase defaultTemplate = protocolCorrespondenceType.getDefaultProtocolCorrespondenceTemplate(); if (defaultTemplate != null) { if ((defaultTemplate.getCorrespondenceTemplate().length == 0) StringUtils.isBlank(defaultTemplate.getFileName())) { String filePropertyName = String.format(PROPERTY_NAME_NEW_DEFAULT_TEMPLATE_FILE, typeIndex); GlobalVariables.getMessageMap().putError(filePropertyName, KeyConstants.ERROR_CORRESPONDENCE_TEMPLATE_INVALID_FILE); isValid = false; } } List<ProtocolCorrespondenceTemplateBase> protocolCorrespondenceTemplates = protocolCorrespondenceType.getCommitteeProtocolCorrespondenceTemplates(); for (ProtocolCorrespondenceTemplateBase protocolCorrespondenceTemplate : protocolCorrespondenceTemplates) { if ((protocolCorrespondenceTemplate.getCorrespondenceTemplate() == null) (protocolCorrespondenceTemplate.getCorrespondenceTemplate().length == 0) StringUtils.isBlank(protocolCorrespondenceTemplate.getFileName())) { int templateIndex = protocolCorrespondenceTemplates.indexOf(protocolCorrespondenceTemplate); String filePropertyName = String.format(PROPERTY_NAME_TEMPLATE_FILE, typeIndex, templateIndex); GlobalVariables.getMessageMap().putError(filePropertyName, KeyConstants.ERROR_CORRESPONDENCE_TEMPLATE_INVALID_FILE); isValid = false; } } return isValid; }
/** * * This method checks that template data of all templates are valid * @param protocolCorrespondenceTemplates * @param typeIndex * @return true if all files are valid of the templates, false otherwise * @throws IOException */
This method checks that template data of all templates are valid
validTemplates
{ "repo_name": "blackcathacker/kc.preclean", "path": "coeus-code/src/main/java/org/kuali/kra/protocol/correspondence/ProtocolCorrespondenceTemplateRule.java", "license": "apache-2.0", "size": 13313 }
[ "java.io.IOException", "java.util.List", "org.apache.commons.lang3.StringUtils", "org.kuali.kra.infrastructure.KeyConstants", "org.kuali.rice.krad.util.GlobalVariables" ]
import java.io.IOException; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.kuali.kra.infrastructure.KeyConstants; import org.kuali.rice.krad.util.GlobalVariables;
import java.io.*; import java.util.*; import org.apache.commons.lang3.*; import org.kuali.kra.infrastructure.*; import org.kuali.rice.krad.util.*;
[ "java.io", "java.util", "org.apache.commons", "org.kuali.kra", "org.kuali.rice" ]
java.io; java.util; org.apache.commons; org.kuali.kra; org.kuali.rice;
1,361,451
protected void removeExpandDirectory(Path path) { String prefix = path.getPath(); if (! prefix.endsWith("/")) prefix = prefix + "/"; removeExpandDirectory(path, prefix); }
void function(Path path) { String prefix = path.getPath(); if (! prefix.endsWith("/")) prefix = prefix + "/"; removeExpandDirectory(path, prefix); }
/** * Recursively remove all files in a directory. Used for wars when * they change. * * @param path root directory to start removal */
Recursively remove all files in a directory. Used for wars when they change
removeExpandDirectory
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/env/deploy/ExpandDeployController.java", "license": "gpl-2.0", "size": 18944 }
[ "com.caucho.vfs.Path" ]
import com.caucho.vfs.Path;
import com.caucho.vfs.*;
[ "com.caucho.vfs" ]
com.caucho.vfs;
511,567
public AuthInitiateMessageV4 createAuthInitiateV4(final ECKey key) { final AuthInitiateMessageV4 message = new AuthInitiateMessageV4(); final BigInteger secretScalar = key.keyAgreement(remotePublicKey); final byte[] token = ByteUtil.bigIntegerToBytes(secretScalar, NONCE_SIZE); final byte[] nonce = initiatorNonce; final byte[] signed = xor(token, nonce); message.signature = ephemeralKey.sign(signed); message.publicKey = key.getPubKeyPoint(); message.nonce = initiatorNonce; return message; }
AuthInitiateMessageV4 function(final ECKey key) { final AuthInitiateMessageV4 message = new AuthInitiateMessageV4(); final BigInteger secretScalar = key.keyAgreement(remotePublicKey); final byte[] token = ByteUtil.bigIntegerToBytes(secretScalar, NONCE_SIZE); final byte[] nonce = initiatorNonce; final byte[] signed = xor(token, nonce); message.signature = ephemeralKey.sign(signed); message.publicKey = key.getPubKeyPoint(); message.nonce = initiatorNonce; return message; }
/** * Create a handshake auth message defined by EIP-8 * * @param key our private key */
Create a handshake auth message defined by EIP-8
createAuthInitiateV4
{ "repo_name": "loxal/FreeEthereum", "path": "free-ethereum-core/src/main/java/org/ethereum/net/rlpx/EncryptionHandshake.java", "license": "mit", "size": 15356 }
[ "java.math.BigInteger", "org.ethereum.crypto.ECKey", "org.ethereum.util.ByteUtil" ]
import java.math.BigInteger; import org.ethereum.crypto.ECKey; import org.ethereum.util.ByteUtil;
import java.math.*; import org.ethereum.crypto.*; import org.ethereum.util.*;
[ "java.math", "org.ethereum.crypto", "org.ethereum.util" ]
java.math; org.ethereum.crypto; org.ethereum.util;
2,505,863
@Test public void testSetLastDdPacket() throws Exception { ospfNbr.setLastDdPacket(new DdPacket()); assertThat(ospfNbr.lastDdPacket(), is(notNullValue())); }
void function() throws Exception { ospfNbr.setLastDdPacket(new DdPacket()); assertThat(ospfNbr.lastDdPacket(), is(notNullValue())); }
/** * Tests lastDdPacket() setter method. */
Tests lastDdPacket() setter method
testSetLastDdPacket
{ "repo_name": "donNewtonAlpha/onos", "path": "protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfNbrImplTest.java", "license": "apache-2.0", "size": 27328 }
[ "org.hamcrest.CoreMatchers", "org.hamcrest.MatcherAssert", "org.onosproject.ospf.protocol.ospfpacket.types.DdPacket" ]
import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.onosproject.ospf.protocol.ospfpacket.types.DdPacket;
import org.hamcrest.*; import org.onosproject.ospf.protocol.ospfpacket.types.*;
[ "org.hamcrest", "org.onosproject.ospf" ]
org.hamcrest; org.onosproject.ospf;
863,297
@Deprecated public DFSInputStream open(String src, int buffersize, boolean verifyChecksum, FileSystem.Statistics stats) throws IOException, UnresolvedLinkException { return open(src, buffersize, verifyChecksum); }
DFSInputStream function(String src, int buffersize, boolean verifyChecksum, FileSystem.Statistics stats) throws IOException, UnresolvedLinkException { return open(src, buffersize, verifyChecksum); }
/** * Create an input stream that obtains a nodelist from the * namenode, and then reads from all the right places. Creates * inner subclass of InputStream that does the right out-of-band * work. * @deprecated Use {@link #open(String, int, boolean)} instead. */
Create an input stream that obtains a nodelist from the namenode, and then reads from all the right places. Creates inner subclass of InputStream that does the right out-of-band work
open
{ "repo_name": "adouang/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java", "license": "apache-2.0", "size": 114163 }
[ "java.io.IOException", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.UnresolvedLinkException" ]
import java.io.IOException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.UnresolvedLinkException;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,075,710
static int capacity(int expectedSize) { if (expectedSize < 3) { checkNonnegative(expectedSize, "expectedSize"); return expectedSize + 1; } if (expectedSize < Ints.MAX_POWER_OF_TWO) { // This is the calculation used in JDK8 to resize when a putAll // happens; it seems to be the most conservative calculation we // can make. 0.75 is the default load factor. return (int) ((float) expectedSize / 0.75F + 1.0F); } return Integer.MAX_VALUE; // any large value } /** * Creates a <i>mutable</i> {@code HashMap} instance with the same mappings as * the specified map. * * <p><b>Note:</b> if mutability is not required, use {@link * ImmutableMap#copyOf(Map)} instead. * * <p><b>Note:</b> if {@code K} is an {@link Enum} type, use {@link * #newEnumMap} instead. * * @param map the mappings to be placed in the new map * @return a new {@code HashMap} initialized with the mappings from {@code * map}
static int capacity(int expectedSize) { if (expectedSize < 3) { checkNonnegative(expectedSize, STR); return expectedSize + 1; } if (expectedSize < Ints.MAX_POWER_OF_TWO) { return (int) ((float) expectedSize / 0.75F + 1.0F); } return Integer.MAX_VALUE; } /** * Creates a <i>mutable</i> {@code HashMap} instance with the same mappings as * the specified map. * * <p><b>Note:</b> if mutability is not required, use { * ImmutableMap#copyOf(Map)} instead. * * <p><b>Note:</b> if {@code K} is an {@link Enum} type, use { * #newEnumMap} instead. * * @param map the mappings to be placed in the new map * @return a new {@code HashMap} initialized with the mappings from { * map}
/** * Returns a capacity that is sufficient to keep the map from being resized as * long as it grows no larger than expectedSize and the load factor is >= its * default (0.75). */
Returns a capacity that is sufficient to keep the map from being resized as long as it grows no larger than expectedSize and the load factor is >= its default (0.75)
capacity
{ "repo_name": "dmi3aleks/guava", "path": "guava/src/com/google/common/collect/Maps.java", "license": "apache-2.0", "size": 137471 }
[ "com.google.common.collect.CollectPreconditions", "com.google.common.primitives.Ints", "java.util.HashMap", "java.util.Map" ]
import com.google.common.collect.CollectPreconditions; import com.google.common.primitives.Ints; import java.util.HashMap; import java.util.Map;
import com.google.common.collect.*; import com.google.common.primitives.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,126,931
public IgniteMessaging message(ClusterGroup grp);
IgniteMessaging function(ClusterGroup grp);
/** * Gets {@code messaging} facade over nodes within the cluster group. All operations * on the returned {@link IgniteMessaging} instance will only include nodes from * the specified cluster group. * * @param grp Cluster group. * @return Messaging instance over given cluster group. */
Gets messaging facade over nodes within the cluster group. All operations on the returned <code>IgniteMessaging</code> instance will only include nodes from the specified cluster group
message
{ "repo_name": "shurun19851206/ignite", "path": "modules/core/src/main/java/org/apache/ignite/Ignite.java", "license": "apache-2.0", "size": 20470 }
[ "org.apache.ignite.cluster.ClusterGroup" ]
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,758,309
public Optional<T> query () { this.log.trace ("query:"); Preconditions.checkState (this.selector.getCardinality () != Selector.Cardinality.MULTIPLE, "Selector must be unique"); List<T> elements = this.queryAll (); T result = null; if (elements.size () > 1) { throw new IllegalStateException ("Query returned multiple elements"); } if (! elements.isEmpty ()) { result = elements.get (0); } return Optional.ofNullable (result); }
Optional<T> function () { this.log.trace (STR); Preconditions.checkState (this.selector.getCardinality () != Selector.Cardinality.MULTIPLE, STR); List<T> elements = this.queryAll (); T result = null; if (elements.size () > 1) { throw new IllegalStateException (STR); } if (! elements.isEmpty ()) { result = elements.get (0); } return Optional.ofNullable (result); }
/** * Fetch the <code>Element</code> instance from the <code>DataStore</code> * which matches the properties set on the <code>Query</code>. Values must * be specified for all of the properties for the <code>Query</code>. * * @return The <code>Element</code> instance which * matches the properties specified for the * query, null if no <code>Element</code> * instances exist in the * <code>DataStore</code> that match the * <code>Query</code> * @throws IllegalStateException if the <code>DataStore</code> is closed * @throws IllegalStateException if any <code>Property</code> instance * associated with the <code>Query</code> has * a null value */
Fetch the <code>Element</code> instance from the <code>DataStore</code> which matches the properties set on the <code>Query</code>. Values must be specified for all of the properties for the <code>Query</code>
query
{ "repo_name": "jestark/LMSDataHarvester", "path": "src/main/java/ca/uoguelph/socs/icc/edm/domain/datastore/memory/MemQuery.java", "license": "gpl-3.0", "size": 9618 }
[ "ca.uoguelph.socs.icc.edm.domain.metadata.Selector", "com.google.common.base.Preconditions", "java.util.List", "java.util.Optional" ]
import ca.uoguelph.socs.icc.edm.domain.metadata.Selector; import com.google.common.base.Preconditions; import java.util.List; import java.util.Optional;
import ca.uoguelph.socs.icc.edm.domain.metadata.*; import com.google.common.base.*; import java.util.*;
[ "ca.uoguelph.socs", "com.google.common", "java.util" ]
ca.uoguelph.socs; com.google.common; java.util;
1,095,904
public static OnlabPackage init() { if (isInited) return (OnlabPackage)EPackage.Registry.INSTANCE.getEPackage(OnlabPackage.eNS_URI); // Obtain or create and register package OnlabPackageImpl theOnlabPackage = (OnlabPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof OnlabPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new OnlabPackageImpl()); isInited = true; // Create package meta-data objects theOnlabPackage.createPackageContents(); // Initialize created meta-data theOnlabPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed theOnlabPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(OnlabPackage.eNS_URI, theOnlabPackage); return theOnlabPackage; }
static OnlabPackage function() { if (isInited) return (OnlabPackage)EPackage.Registry.INSTANCE.getEPackage(OnlabPackage.eNS_URI); OnlabPackageImpl theOnlabPackage = (OnlabPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof OnlabPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new OnlabPackageImpl()); isInited = true; theOnlabPackage.createPackageContents(); theOnlabPackage.initializePackageContents(); theOnlabPackage.freeze(); EPackage.Registry.INSTANCE.put(OnlabPackage.eNS_URI, theOnlabPackage); return theOnlabPackage; }
/** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. * * <p>This method is used to initialize {@link OnlabPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */
Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>OnlabPackage#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
init
{ "repo_name": "FTSRG/viatra-dse-swarm", "path": "plugins/hu.bme.mit.passtheriver.model/src/onlab/impl/OnlabPackageImpl.java", "license": "epl-1.0", "size": 16598 }
[ "org.eclipse.emf.ecore.EPackage" ]
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,569,331
ResourceDto findByUid(String userLogin);
ResourceDto findByUid(String userLogin);
/** * Returns a resource from an LDAP UID. * * @param userLogin * The user LDAP login. * * @return A instance of {@link ResourceDto}. */
Returns a resource from an LDAP UID
findByUid
{ "repo_name": "softdays/mandy", "path": "mandy-service/src/main/java/org/softdays/mandy/service/ResourceService.java", "license": "agpl-3.0", "size": 2298 }
[ "org.softdays.mandy.dto.ResourceDto" ]
import org.softdays.mandy.dto.ResourceDto;
import org.softdays.mandy.dto.*;
[ "org.softdays.mandy" ]
org.softdays.mandy;
1,390,410
EReference getTupleTypeAttribute_TupleType();
EReference getTupleTypeAttribute_TupleType();
/** * Returns the meta object for the container reference '{@link anatlyzer.atlext.OCL.TupleTypeAttribute#getTupleType <em>Tuple Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the container reference '<em>Tuple Type</em>'. * @see anatlyzer.atlext.OCL.TupleTypeAttribute#getTupleType() * @see #getTupleTypeAttribute() * @generated */
Returns the meta object for the container reference '<code>anatlyzer.atlext.OCL.TupleTypeAttribute#getTupleType Tuple Type</code>'.
getTupleTypeAttribute_TupleType
{ "repo_name": "jesusc/anatlyzer", "path": "plugins/anatlyzer.atl.typing/src-gen/anatlyzer/atlext/OCL/OCLPackage.java", "license": "epl-1.0", "size": 484377 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,621,639
public static CodedOutputStream newInstance(OutputStream output) { return newInstance(output, DEFAULT_BUFFER_SIZE); }
static CodedOutputStream function(OutputStream output) { return newInstance(output, DEFAULT_BUFFER_SIZE); }
/** * Create a new {@code CodedOutputStream} wrapping the given * {@code OutputStream}. */
Create a new CodedOutputStream wrapping the given OutputStream
newInstance
{ "repo_name": "vleo/vleo-notebook", "path": "protobuf/trunk/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java", "license": "gpl-3.0", "size": 28767 }
[ "java.io.OutputStream" ]
import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,044,027
public void notifyAllSizesObtained(Job job);
void function(Job job);
/** * Notifies that all the pieces of data related to a job have been * profiled. * * @param job Job whose data has been profiled */
Notifies that all the pieces of data related to a job have been profiled
notifyAllSizesObtained
{ "repo_name": "flordan/final", "path": "code/runtime/commons/src/main/java/es/bsc/mobile/data/DataManager.java", "license": "apache-2.0", "size": 21474 }
[ "es.bsc.mobile.types.Job" ]
import es.bsc.mobile.types.Job;
import es.bsc.mobile.types.*;
[ "es.bsc.mobile" ]
es.bsc.mobile;
1,768,248
public BusinessDayConventionBean getBusinessDayConvention() { return _businessDayConvention; }
BusinessDayConventionBean function() { return _businessDayConvention; }
/** * Gets the businessDayConvention. * @return the businessDayConvention */
Gets the businessDayConvention
getBusinessDayConvention
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-MasterDB/src/main/java/com/opengamma/masterdb/security/hibernate/swap/SwapLegBean.java", "license": "apache-2.0", "size": 9525 }
[ "com.opengamma.masterdb.security.hibernate.BusinessDayConventionBean" ]
import com.opengamma.masterdb.security.hibernate.BusinessDayConventionBean;
import com.opengamma.masterdb.security.hibernate.*;
[ "com.opengamma.masterdb" ]
com.opengamma.masterdb;
130,251
@Deprecated public List<AdminEmailAttributes> getAllAdminEmails() { return makeAttributes(getAdminEmailEntities()); }
List<AdminEmailAttributes> function() { return makeAttributes(getAdminEmailEntities()); }
/** * This method is not scalable. Not to be used unless for admin features. * @return the list of all adminEmails in the database. */
This method is not scalable. Not to be used unless for admin features
getAllAdminEmails
{ "repo_name": "Mynk96/teammates", "path": "src/main/java/teammates/storage/api/AdminEmailsDb.java", "license": "gpl-2.0", "size": 8924 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
323,694
public void addStateChangeListener(StateChangeListener<TaskState> stateChangeListener) { taskState.addStateChangeListener(stateChangeListener); }
void function(StateChangeListener<TaskState> stateChangeListener) { taskState.addStateChangeListener(stateChangeListener); }
/** * Listener is always notified asynchronously using a dedicated notification thread pool so, care should * be taken to avoid leaking {@code this} when adding a listener in a constructor. Additionally, it is * possible notifications are observed out of order due to the asynchronous execution. */
Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leaking this when adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution
addStateChangeListener
{ "repo_name": "electrum/presto", "path": "core/trino-main/src/main/java/io/trino/execution/TaskStateMachine.java", "license": "apache-2.0", "size": 4406 }
[ "io.trino.execution.StateMachine" ]
import io.trino.execution.StateMachine;
import io.trino.execution.*;
[ "io.trino.execution" ]
io.trino.execution;
2,242,181
public static MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>> getExtrasClient(com.mozu.api.DataViewMode dataViewMode, String productCode) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.products.ProductExtraUrl.getExtrasUrl(productCode); String verb = "GET"; Class<?> clz = new ArrayList<com.mozu.api.contracts.productadmin.ProductExtra>(){}.getClass(); MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>> mozuClient = (MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; }
static MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>> function(com.mozu.api.DataViewMode dataViewMode, String productCode) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.products.ProductExtraUrl.getExtrasUrl(productCode); String verb = "GET"; Class<?> clz = new ArrayList<com.mozu.api.contracts.productadmin.ProductExtra>(){}.getClass(); MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>> mozuClient = (MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; }
/** * Retrieves a list of extras configured for the product according to any defined filter and sort criteria. * <p><pre><code> * MozuClient<List<com.mozu.api.contracts.productadmin.ProductExtra>> mozuClient=GetExtrasClient(dataViewMode, productCode); * client.setBaseAddress(url); * client.executeRequest(); * ProductExtra productExtra = client.Result(); * </code></pre></p> * @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only. * @return Mozu.Api.MozuClient <List<com.mozu.api.contracts.productadmin.ProductExtra>> * @see com.mozu.api.contracts.productadmin.ProductExtra */
Retrieves a list of extras configured for the product according to any defined filter and sort criteria. <code><code> MozuClient> mozuClient=GetExtrasClient(dataViewMode, productCode); client.setBaseAddress(url); client.executeRequest(); ProductExtra productExtra = client.Result(); </code></code>
getExtrasClient
{ "repo_name": "johngatti/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/products/ProductExtraClient.java", "license": "mit", "size": 31216 }
[ "com.mozu.api.DataViewMode", "com.mozu.api.Headers", "com.mozu.api.MozuClient", "com.mozu.api.MozuClientFactory", "com.mozu.api.MozuUrl", "java.util.ArrayList", "java.util.List" ]
import com.mozu.api.DataViewMode; import com.mozu.api.Headers; import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; import java.util.ArrayList; import java.util.List;
import com.mozu.api.*; import java.util.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
2,073,148
Observable<Snapshot> listSnapshotsAsync(final String resourceGroupName, final String name);
Observable<Snapshot> listSnapshotsAsync(final String resourceGroupName, final String name);
/** * Returns all Snapshots to the user. * Description for Returns all Snapshots to the user. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Website Name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Returns all Snapshots to the user. Description for Returns all Snapshots to the user
listSnapshotsAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/appservice/v2019_08_01/WebApps.java", "license": "mit", "size": 242740 }
[ "com.microsoft.azure.management.appservice.v2019_08_01.Snapshot" ]
import com.microsoft.azure.management.appservice.v2019_08_01.Snapshot;
import com.microsoft.azure.management.appservice.v2019_08_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
665,474
return TransportUtils.makeUrl(urls.getUrlRoot(), partialUrl); }
return TransportUtils.makeUrl(urls.getUrlRoot(), partialUrl); }
/** * Given a partial URL, use {@link TransportUtils#makeUrl(String, String)} to combine it with * the root URL and return the result. * @param partialUrl a partial URL * @return a full URL including the root URL */
Given a partial URL, use <code>TransportUtils#makeUrl(String, String)</code> to combine it with the root URL and return the result
makeFullUrl
{ "repo_name": "macieksmuga/compliance", "path": "cts-java/src/test/java/org/ga4gh/cts/api/endpoints/RawEndpointsIT.java", "license": "apache-2.0", "size": 3606 }
[ "org.ga4gh.ctk.transport.TransportUtils" ]
import org.ga4gh.ctk.transport.TransportUtils;
import org.ga4gh.ctk.transport.*;
[ "org.ga4gh.ctk" ]
org.ga4gh.ctk;
2,777,108
public double forwardVegaTheoretical(final ForexOptionVanilla option, final BlackForexSmileProviderInterface marketData) { ArgumentChecker.notNull(option, "option"); ArgumentChecker.notNull(marketData, "marketData"); final MulticurveProviderInterface multicurves = marketData.getMulticurveProvider(); final double dfDomestic = multicurves.getDiscountFactor(option.getCurrency2(), option.getUnderlyingForex().getPaymentTime()); final double dfForeign = multicurves.getDiscountFactor(option.getCurrency1(), option.getUnderlyingForex().getPaymentTime()); final double spot = multicurves.getFxRates().getFxRate(option.getCurrency1(), option.getCurrency2()); final double forward = spot * dfForeign / dfDomestic; final double volatility = marketData.getVolatility(option.getCurrency1(), option.getCurrency2(), option.getTimeToExpiry(), option.getStrike(), forward); return BlackFormulaRepository.vega(forward, option.getStrike(), option.getTimeToExpiry(), volatility); }
double function(final ForexOptionVanilla option, final BlackForexSmileProviderInterface marketData) { ArgumentChecker.notNull(option, STR); ArgumentChecker.notNull(marketData, STR); final MulticurveProviderInterface multicurves = marketData.getMulticurveProvider(); final double dfDomestic = multicurves.getDiscountFactor(option.getCurrency2(), option.getUnderlyingForex().getPaymentTime()); final double dfForeign = multicurves.getDiscountFactor(option.getCurrency1(), option.getUnderlyingForex().getPaymentTime()); final double spot = multicurves.getFxRates().getFxRate(option.getCurrency1(), option.getCurrency2()); final double forward = spot * dfForeign / dfDomestic; final double volatility = marketData.getVolatility(option.getCurrency1(), option.getCurrency2(), option.getTimeToExpiry(), option.getStrike(), forward); return BlackFormulaRepository.vega(forward, option.getStrike(), option.getTimeToExpiry(), volatility); }
/** * Computes the forward vega (first derivative with respect to volatility). * * @param option * the Forex option, not null * @param marketData * the curve and smile data, not null * @return the forward vega */
Computes the forward vega (first derivative with respect to volatility)
forwardVegaTheoretical
{ "repo_name": "McLeodMoores/starling", "path": "projects/analytics/src/main/java/com/opengamma/analytics/financial/forex/provider/ForexOptionVanillaBlackSmileMethod.java", "license": "apache-2.0", "size": 44308 }
[ "com.opengamma.analytics.financial.forex.derivative.ForexOptionVanilla", "com.opengamma.analytics.financial.model.volatility.BlackFormulaRepository", "com.opengamma.analytics.financial.provider.description.forex.BlackForexSmileProviderInterface", "com.opengamma.analytics.financial.provider.description.interestrate.MulticurveProviderInterface", "com.opengamma.util.ArgumentChecker" ]
import com.opengamma.analytics.financial.forex.derivative.ForexOptionVanilla; import com.opengamma.analytics.financial.model.volatility.BlackFormulaRepository; import com.opengamma.analytics.financial.provider.description.forex.BlackForexSmileProviderInterface; import com.opengamma.analytics.financial.provider.description.interestrate.MulticurveProviderInterface; import com.opengamma.util.ArgumentChecker;
import com.opengamma.analytics.financial.forex.derivative.*; import com.opengamma.analytics.financial.model.volatility.*; import com.opengamma.analytics.financial.provider.description.forex.*; import com.opengamma.analytics.financial.provider.description.interestrate.*; import com.opengamma.util.*;
[ "com.opengamma.analytics", "com.opengamma.util" ]
com.opengamma.analytics; com.opengamma.util;
1,061,625
public synchronized void removeToggleDocumentListener(ToggleDocumentListener listener) { if (listeners == null) { return; } listeners.removeElement(listener); }
synchronized void function(ToggleDocumentListener listener) { if (listeners == null) { return; } listeners.removeElement(listener); }
/** * Remove a Toggle Document Listener from the listener list. * * @param listener The ToggleDocumentListener to be removed */
Remove a Toggle Document Listener from the listener list
removeToggleDocumentListener
{ "repo_name": "zenovalle/tn5250j", "path": "src/org/tn5250j/gui/ToggleDocument.java", "license": "gpl-2.0", "size": 3114 }
[ "org.tn5250j.event.ToggleDocumentListener" ]
import org.tn5250j.event.ToggleDocumentListener;
import org.tn5250j.event.*;
[ "org.tn5250j.event" ]
org.tn5250j.event;
297,030
public Factory setLoadErrorHandlingPolicy( @Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy) { this.loadErrorHandlingPolicy = loadErrorHandlingPolicy != null ? loadErrorHandlingPolicy : new DefaultLoadErrorHandlingPolicy(); return this; }
Factory function( @Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy) { this.loadErrorHandlingPolicy = loadErrorHandlingPolicy != null ? loadErrorHandlingPolicy : new DefaultLoadErrorHandlingPolicy(); return this; }
/** * Sets the {@link LoadErrorHandlingPolicy}. The default value is created by calling {@link * DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()}. * * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}. * @return This factory, for convenience. */
Sets the <code>LoadErrorHandlingPolicy</code>. The default value is created by calling <code>DefaultLoadErrorHandlingPolicy#DefaultLoadErrorHandlingPolicy()</code>
setLoadErrorHandlingPolicy
{ "repo_name": "androidx/media", "path": "libraries/exoplayer_smoothstreaming/src/main/java/androidx/media3/exoplayer/smoothstreaming/SsMediaSource.java", "license": "apache-2.0", "size": 23672 }
[ "androidx.annotation.Nullable", "androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy", "androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy" ]
import androidx.annotation.Nullable; import androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy; import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
import androidx.annotation.*; import androidx.media3.exoplayer.upstream.*;
[ "androidx.annotation", "androidx.media3" ]
androidx.annotation; androidx.media3;
176,502
private void addAllEdges(Shape3D shape, Transform3D trans, double z, Attributes att, ArrayList<LineSegment> edges[]) { GeometryArray g = (GeometryArray)shape.getGeometry(); Point3d p1 = new Point3d(); Point3d p2 = new Point3d(); Point3d p3 = new Point3d(); Point3d q1 = new Point3d(); Point3d q2 = new Point3d(); Point3d q3 = new Point3d(); if(g.getVertexCount()%3 != 0) { Debug.e("addAllEdges(): shape3D with vertices not a multiple of 3!"); } if(g != null) { for(int i = 0; i < g.getVertexCount(); i+=3) { g.getCoordinate(i, p1); g.getCoordinate(i+1, p2); g.getCoordinate(i+2, p3); trans.transform(p1, q1); trans.transform(p2, q2); trans.transform(p3, q3); addEdge(q1, q2, q3, z, att, edges); } } }
void function(Shape3D shape, Transform3D trans, double z, Attributes att, ArrayList<LineSegment> edges[]) { GeometryArray g = (GeometryArray)shape.getGeometry(); Point3d p1 = new Point3d(); Point3d p2 = new Point3d(); Point3d p3 = new Point3d(); Point3d q1 = new Point3d(); Point3d q2 = new Point3d(); Point3d q3 = new Point3d(); if(g.getVertexCount()%3 != 0) { Debug.e(STR); } if(g != null) { for(int i = 0; i < g.getVertexCount(); i+=3) { g.getCoordinate(i, p1); g.getCoordinate(i+1, p2); g.getCoordinate(i+2, p3); trans.transform(p1, q1); trans.transform(p2, q2); trans.transform(p3, q3); addEdge(q1, q2, q3, z, att, edges); } } }
/** * Run through a Shape3D and set edges from it at plane z * Apply the transform first * @param shape * @param trans * @param z */
Run through a Shape3D and set edges from it at plane z Apply the transform first
addAllEdges
{ "repo_name": "reprappro/host", "path": "src/org/reprap/geometry/polyhedra/AllSTLsToBuild.java", "license": "lgpl-2.1", "size": 44341 }
[ "java.util.ArrayList", "javax.media.j3d.GeometryArray", "javax.media.j3d.Shape3D", "javax.media.j3d.Transform3D", "javax.vecmath.Point3d", "org.reprap.Attributes", "org.reprap.utilities.Debug" ]
import java.util.ArrayList; import javax.media.j3d.GeometryArray; import javax.media.j3d.Shape3D; import javax.media.j3d.Transform3D; import javax.vecmath.Point3d; import org.reprap.Attributes; import org.reprap.utilities.Debug;
import java.util.*; import javax.media.j3d.*; import javax.vecmath.*; import org.reprap.*; import org.reprap.utilities.*;
[ "java.util", "javax.media", "javax.vecmath", "org.reprap", "org.reprap.utilities" ]
java.util; javax.media; javax.vecmath; org.reprap; org.reprap.utilities;
252,804
public synchronized void release() { if (_in!=null) { try{_in.close();}catch(IOException e){LogSupport.ignore(log,e);} _in=null; } if (_connection!=null) _connection=null; }
synchronized void function() { if (_in!=null) { try{_in.close();}catch(IOException e){LogSupport.ignore(log,e);} _in=null; } if (_connection!=null) _connection=null; }
/** Release any resources held by the resource. */
Release any resources held by the resource
release
{ "repo_name": "Jimmy-Gao/browsermob-proxy", "path": "src/main/java/org/browsermob/proxy/jetty/util/URLResource.java", "license": "apache-2.0", "size": 7911 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,038,903
@Test public void testPostHideWorksheetColumns() { System.out.println("PostHideWorksheetColumns"); String name = "test_cells.xlsx"; String sheetName = "Sheet1"; Integer startColumn = 1; Integer totalColumns = 5; String storage = ""; String folder = ""; try { SaaSposeResponse result = cellsApi.PostHideWorksheetColumns(name, sheetName, startColumn, totalColumns, storage, folder); } catch (ApiException apiException) { System.out.println("exp:" + apiException.getMessage()); assertNull(apiException); } }
void function() { System.out.println(STR); String name = STR; String sheetName = STR; Integer startColumn = 1; Integer totalColumns = 5; String storage = STRSTRexp:" + apiException.getMessage()); assertNull(apiException); } }
/** * Test of PostHideWorksheetColumns method, of class CellsApi. */
Test of PostHideWorksheetColumns method, of class CellsApi
testPostHideWorksheetColumns
{ "repo_name": "aspose-cells/Aspose.Cells-for-Cloud", "path": "SDKs/Aspose.Cells-Cloud-SDK-for-Android/Aspose.Cells-Cloud-SDK-Android/src/test/java/com/aspose/cells/api/CellsApiTest.java", "license": "mit", "size": 91749 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
239,810
public int getNullWidth() { return nullFormat.length(); } private DateFormatter dateFormatter = null;
int function() { return nullFormat.length(); } private DateFormatter dateFormatter = null;
/** * Returns the number of characters required to display a NULL. * * @return the number of characters required to display a NULL. */
Returns the number of characters required to display a NULL
getNullWidth
{ "repo_name": "scgray/jsqsh", "path": "jsqsh-core/src/main/java/org/sqsh/DataFormatter.java", "license": "apache-2.0", "size": 14248 }
[ "org.sqsh.format.DateFormatter" ]
import org.sqsh.format.DateFormatter;
import org.sqsh.format.*;
[ "org.sqsh.format" ]
org.sqsh.format;
1,289,025
static <E> IntIndexedSetter<E> of( final List<E> list, final int offset, final int length) { return new IntIndexedGetterSetter<E>() {
static <E> IntIndexedSetter<E> of( final List<E> list, final int offset, final int length) { return new IntIndexedGetterSetter<E>() {
/** * Creates and returns a new instance wrapped around a slice of a list. * * @param list the list * @param offset the offset * @param length the number of elements * @param <E> the type of elements in the list * @return the new instance */
Creates and returns a new instance wrapped around a slice of a list
of
{ "repo_name": "tandauioan/toolboxj", "path": "src/main/java/org/ticdev/toolboxj/collections/IntIndexedGetterSetter.java", "license": "lgpl-3.0", "size": 3740 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,876,480
public static void spreadOutResourceFiles(File dir) { for (File file : dir.listFiles()) { if (file.isDirectory()) { spreadOutResourceFiles(file); } else { String hash = getSHA1(file); File saveTo = new File(App.settings.getObjectsAssetsDir(), hash.substring(0, 2) + File.separator + hash); saveTo.mkdirs(); copyFile(file, saveTo, true); } } }
static void function(File dir) { for (File file : dir.listFiles()) { if (file.isDirectory()) { spreadOutResourceFiles(file); } else { String hash = getSHA1(file); File saveTo = new File(App.settings.getObjectsAssetsDir(), hash.substring(0, 2) + File.separator + hash); saveTo.mkdirs(); copyFile(file, saveTo, true); } } }
/** * Spread out resource files. * * @param dir the dir */
Spread out resource files
spreadOutResourceFiles
{ "repo_name": "LexMinecraft/Launcher", "path": "src/main/java/com/atlauncher/utils/Utils.java", "license": "gpl-3.0", "size": 64695 }
[ "com.atlauncher.App", "java.io.File" ]
import com.atlauncher.App; import java.io.File;
import com.atlauncher.*; import java.io.*;
[ "com.atlauncher", "java.io" ]
com.atlauncher; java.io;
1,416,927
@Test public void testAddViewerAndChangeToEditor() throws Exception { // sandboxing a special repository for this test, want to use a controlled permission // layout Repository repository = new BaseMemoryRepository().getRepository(); org.sakaiproject.nakamura.api.lite.Session adminSession = repository .loginAdministrative(); Content content = new Content("/testAddViewerAndChangeToEditor/content", ImmutableMap.<String, Object> of("key", "value")); adminSession.getContentManager().update(content); // lock down the permissions for the test user adminSession.getAccessControlManager().setAcl( Security.ZONE_CONTENT, "/testAddViewerAndChangeToEditor", new AclModification[] { new AclModification(AclModification.denyKey("test"), Permissions.ALL.getPermission(), Operation.OP_REPLACE) }); adminSession.getAuthorizableManager().createUser("test", "test", "test", new HashMap<String, Object>()); Authorizable testUser = adminSession.getAuthorizableManager() .findAuthorizable("test"); Resource resource = Mockito.mock(Resource.class); when(resource.adaptTo(Content.class)).thenReturn(content); when(resource.adaptTo(org.sakaiproject.nakamura.api.lite.Session.class)).thenReturn( adminSession); SlingHttpServletRequest request = Mockito.mock(SlingHttpServletRequest.class); when(request.getResource()).thenReturn(resource); // first give view permissions when(request.getParameterValues(":manager@Delete")).thenReturn( new String[] { "test" }); when(request.getParameterValues(":editor@Delete")) .thenReturn(new String[] { "test" }); when(request.getParameterValues(":viewer@Delete")).thenReturn(null); when(request.getParameterValues(":manager")).thenReturn(null); when(request.getParameterValues(":editor")).thenReturn(null); when(request.getParameterValues(":viewer")).thenReturn(new String[] { "test" }); servlet.doPost(request, response); // ensure bob can view, but cannot write assertTrue(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_READ)); assertFalse(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_WRITE)); // now give bob editor when(request.getParameterValues(":manager@Delete")).thenReturn( new String[] { "test" }); when(request.getParameterValues(":editor@Delete")).thenReturn(null); when(request.getParameterValues(":viewer@Delete")) .thenReturn(new String[] { "test" }); when(request.getParameterValues(":manager")).thenReturn(null); when(request.getParameterValues(":editor")).thenReturn(new String[] { "test" }); when(request.getParameterValues(":viewer")).thenReturn(null); servlet.doPost(request, response); // ensure bob can view and edit assertTrue(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_READ)); assertTrue(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_WRITE)); adminSession.logout(); }
void function() throws Exception { Repository repository = new BaseMemoryRepository().getRepository(); org.sakaiproject.nakamura.api.lite.Session adminSession = repository .loginAdministrative(); Content content = new Content(STR, ImmutableMap.<String, Object> of("key", "value")); adminSession.getContentManager().update(content); adminSession.getAccessControlManager().setAcl( Security.ZONE_CONTENT, STR, new AclModification[] { new AclModification(AclModification.denyKey("test"), Permissions.ALL.getPermission(), Operation.OP_REPLACE) }); adminSession.getAuthorizableManager().createUser("test", "test", "test", new HashMap<String, Object>()); Authorizable testUser = adminSession.getAuthorizableManager() .findAuthorizable("test"); Resource resource = Mockito.mock(Resource.class); when(resource.adaptTo(Content.class)).thenReturn(content); when(resource.adaptTo(org.sakaiproject.nakamura.api.lite.Session.class)).thenReturn( adminSession); SlingHttpServletRequest request = Mockito.mock(SlingHttpServletRequest.class); when(request.getResource()).thenReturn(resource); when(request.getParameterValues(STR)).thenReturn( new String[] { "test" }); when(request.getParameterValues(STR)) .thenReturn(new String[] { "test" }); when(request.getParameterValues(STR)).thenReturn(null); when(request.getParameterValues(STR)).thenReturn(null); when(request.getParameterValues(STR)).thenReturn(null); when(request.getParameterValues(STR)).thenReturn(new String[] { "test" }); servlet.doPost(request, response); assertTrue(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_READ)); assertFalse(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_WRITE)); when(request.getParameterValues(STR)).thenReturn( new String[] { "test" }); when(request.getParameterValues(STR)).thenReturn(null); when(request.getParameterValues(STR)) .thenReturn(new String[] { "test" }); when(request.getParameterValues(STR)).thenReturn(null); when(request.getParameterValues(STR)).thenReturn(new String[] { "test" }); when(request.getParameterValues(STR)).thenReturn(null); servlet.doPost(request, response); assertTrue(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_READ)); assertTrue(adminSession.getAccessControlManager().can(testUser, Security.ZONE_CONTENT, content.getPath(), Permissions.CAN_WRITE)); adminSession.logout(); }
/** * Verify that when you switch a user from a viewer to an editor (or manager), that they * will have sufficient access to read the the content. * * @throws Exception */
Verify that when you switch a user from a viewer to an editor (or manager), that they will have sufficient access to read the the content
testAddViewerAndChangeToEditor
{ "repo_name": "dylanswartz/nakamura", "path": "bundles/files/impl/src/test/java/org/sakaiproject/nakamura/files/pool/ManageMembersContentPoolServletTest.java", "license": "apache-2.0", "size": 21775 }
[ "com.google.common.collect.ImmutableMap", "java.util.HashMap", "javax.jcr.Session", "org.apache.sling.api.SlingHttpServletRequest", "org.apache.sling.api.resource.Resource", "org.junit.Assert", "org.mockito.Mockito", "org.sakaiproject.nakamura.api.lite.Repository", "org.sakaiproject.nakamura.api.lite.accesscontrol.AclModification", "org.sakaiproject.nakamura.api.lite.accesscontrol.Permissions", "org.sakaiproject.nakamura.api.lite.accesscontrol.Security", "org.sakaiproject.nakamura.api.lite.authorizable.Authorizable", "org.sakaiproject.nakamura.api.lite.content.Content", "org.sakaiproject.nakamura.lite.BaseMemoryRepository" ]
import com.google.common.collect.ImmutableMap; import java.util.HashMap; import javax.jcr.Session; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; import org.junit.Assert; import org.mockito.Mockito; import org.sakaiproject.nakamura.api.lite.Repository; import org.sakaiproject.nakamura.api.lite.accesscontrol.AclModification; import org.sakaiproject.nakamura.api.lite.accesscontrol.Permissions; import org.sakaiproject.nakamura.api.lite.accesscontrol.Security; import org.sakaiproject.nakamura.api.lite.authorizable.Authorizable; import org.sakaiproject.nakamura.api.lite.content.Content; import org.sakaiproject.nakamura.lite.BaseMemoryRepository;
import com.google.common.collect.*; import java.util.*; import javax.jcr.*; import org.apache.sling.api.*; import org.apache.sling.api.resource.*; import org.junit.*; import org.mockito.*; import org.sakaiproject.nakamura.api.lite.*; import org.sakaiproject.nakamura.api.lite.accesscontrol.*; import org.sakaiproject.nakamura.api.lite.authorizable.*; import org.sakaiproject.nakamura.api.lite.content.*; import org.sakaiproject.nakamura.lite.*;
[ "com.google.common", "java.util", "javax.jcr", "org.apache.sling", "org.junit", "org.mockito", "org.sakaiproject.nakamura" ]
com.google.common; java.util; javax.jcr; org.apache.sling; org.junit; org.mockito; org.sakaiproject.nakamura;
1,340,377
public Point2D.Double findClickedCoordinate(double xLoc, double yLoc){ SuperTile tile = findClickedTile(xLoc, yLoc); return tile.getCoordinates(); }
Point2D.Double function(double xLoc, double yLoc){ SuperTile tile = findClickedTile(xLoc, yLoc); return tile.getCoordinates(); }
/** * Get the grid coordinate of the mouse click event * for x and y pixel locations * * @param xLoc - x pixel location * @param yLoc - y pixel location * @return Point2D containing the grid coordinations of the mouse click * as (col, row) or (x, y) */
Get the grid coordinate of the mouse click event for x and y pixel locations
findClickedCoordinate
{ "repo_name": "mzhu22/TurnBasedStrategy", "path": "src/authoring_environment/SuperGrid.java", "license": "mit", "size": 3903 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,913,298
void reload() throws IOException;
void reload() throws IOException;
/** * <p>reload</p> * <p>Reload the configuration file<p> * * @throws java.io.IOException if any. */
reload Reload the configuration file
reload
{ "repo_name": "aihua/opennms", "path": "opennms-config/src/main/java/org/opennms/netmgt/config/EnhancedLinkdConfig.java", "license": "agpl-3.0", "size": 3324 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
618,363
// Given final FiscalDate fiscalDate = FiscalYears.earlyFiscalYear(startDate).createFromCalendarDate(currentDate); // When final long calendarYear = fiscalDate.getCalendarYear(); // Then Assert.assertEquals(currentDate.getYear(), calendarYear); }
final FiscalDate fiscalDate = FiscalYears.earlyFiscalYear(startDate).createFromCalendarDate(currentDate); final long calendarYear = fiscalDate.getCalendarYear(); Assert.assertEquals(currentDate.getYear(), calendarYear); }
/** * Ensures that for any given date the correct calendar year will be returned in an early fiscal year. * * @param startDate * The start date of the fiscal year. * @param currentDate * The current date in a calendar year. */
Ensures that for any given date the correct calendar year will be returned in an early fiscal year
shouldReturnCalendarYearInEarlyFiscalYear
{ "repo_name": "sebhoss/fiscal-year", "path": "src/test/java/de/xn__ho_hia/utils/fiscal_year/FiscalDateGetCalendarYearTest.java", "license": "cc0-1.0", "size": 2785 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,599,292
public okhttp3.Call listNamespacedRoleBindingAsync( String namespace, String pretty, Boolean allowWatchBookmarks, String _continue, String fieldSelector, String labelSelector, Integer limit, String resourceVersion, String resourceVersionMatch, Integer timeoutSeconds, Boolean watch, final ApiCallback<V1RoleBindingList> _callback) throws ApiException { okhttp3.Call localVarCall = listNamespacedRoleBindingValidateBeforeCall( namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, resourceVersionMatch, timeoutSeconds, watch, _callback); Type localVarReturnType = new TypeToken<V1RoleBindingList>() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; }
okhttp3.Call function( String namespace, String pretty, Boolean allowWatchBookmarks, String _continue, String fieldSelector, String labelSelector, Integer limit, String resourceVersion, String resourceVersionMatch, Integer timeoutSeconds, Boolean watch, final ApiCallback<V1RoleBindingList> _callback) throws ApiException { okhttp3.Call localVarCall = listNamespacedRoleBindingValidateBeforeCall( namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, resourceVersionMatch, timeoutSeconds, watch, _callback); Type localVarReturnType = new TypeToken<V1RoleBindingList>() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; }
/** * (asynchronously) list or watch objects of kind RoleBinding * * @param namespace object name and auth scope, such as for teams and projects (required) * @param pretty If &#39;true&#39;, then the output is pretty printed. (optional) * @param allowWatchBookmarks allowWatchBookmarks requests watch events with type * \&quot;BOOKMARK\&quot;. Servers that do not implement bookmarks may ignore this flag and * bookmarks are sent at the server&#39;s discretion. Clients should not assume bookmarks are * returned at any specific interval, nor may they assume the server will send any BOOKMARK * event during a session. If this is not a watch, this field is ignored. (optional) * @param _continue The continue option should be set when retrieving more results from the * server. Since this value is server defined, clients may only use the continue value from a * previous query result with identical query parameters (except for the value of continue) * and the server may reject a continue value it does not recognize. If the specified continue * value is no longer valid whether due to expiration (generally five to fifteen minutes) or a * configuration change on the server, the server will respond with a 410 ResourceExpired * error together with a continue token. If the client needs a consistent list, it must * restart their list without the continue field. Otherwise, the client may send another list * request with the token received with the 410 error, the server will respond with a list * starting from the next key, but from the latest snapshot, which is inconsistent from the * previous list results - objects that are created, modified, or deleted after the first list * request will be included in the response, as long as their keys are after the \&quot;next * key\&quot;. This field is not supported when watch is true. Clients may start a watch from * the last resourceVersion value returned by the server and not miss any modifications. * (optional) * @param fieldSelector A selector to restrict the list of returned objects by their fields. * Defaults to everything. (optional) * @param labelSelector A selector to restrict the list of returned objects by their labels. * Defaults to everything. (optional) * @param limit limit is a maximum number of responses to return for a list call. If more items * exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value * that can be used with the same initial query to retrieve the next set of results. Setting a * limit may return fewer than the requested amount of items (up to zero items) in the event * all requested objects are filtered out and clients should only use the presence of the * continue field to determine whether more results are available. Servers may choose not to * support the limit argument and will return all of the available results. If limit is * specified and the continue field is empty, clients may assume that no more results are * available. This field is not supported if watch is true. The server guarantees that the * objects returned when using continue will be identical to issuing a single list call * without a limit - that is, no objects created, modified, or deleted after the first request * is issued will be included in any subsequent continued requests. This is sometimes referred * to as a consistent snapshot, and ensures that a client that is using limit to receive * smaller chunks of a very large result can ensure they see all possible objects. If objects * are updated during a chunked list the version of the object that was present at the time * the first list result was calculated is returned. (optional) * @param resourceVersion resourceVersion sets a constraint on what resource versions a request * may be served from. See * https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. * Defaults to unset (optional) * @param resourceVersionMatch resourceVersionMatch determines how resourceVersion is applied to * list calls. It is highly recommended that resourceVersionMatch be set for list calls where * resourceVersion is set See * https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. * Defaults to unset (optional) * @param timeoutSeconds Timeout for the list/watch call. This limits the duration of the call, * regardless of any activity or inactivity. (optional) * @param watch Watch for changes to the described resources and return them as a stream of add, * update, and remove notifications. Specify resourceVersion. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details * <table summary="Response Details" border="1"> * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> * <tr><td> 200 </td><td> OK </td><td> - </td></tr> * <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr> * </table> */
(asynchronously) list or watch objects of kind RoleBinding
listNamespacedRoleBindingAsync
{ "repo_name": "kubernetes-client/java", "path": "kubernetes/src/main/java/io/kubernetes/client/openapi/apis/RbacAuthorizationV1Api.java", "license": "apache-2.0", "size": 563123 }
[ "com.google.gson.reflect.TypeToken", "io.kubernetes.client.openapi.ApiCallback", "io.kubernetes.client.openapi.ApiException", "io.kubernetes.client.openapi.models.V1RoleBindingList", "java.lang.reflect.Type" ]
import com.google.gson.reflect.TypeToken; import io.kubernetes.client.openapi.ApiCallback; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.models.V1RoleBindingList; import java.lang.reflect.Type;
import com.google.gson.reflect.*; import io.kubernetes.client.openapi.*; import io.kubernetes.client.openapi.models.*; import java.lang.reflect.*;
[ "com.google.gson", "io.kubernetes.client", "java.lang" ]
com.google.gson; io.kubernetes.client; java.lang;
2,509,483
public final Property<ZonedDateTime> startDate() { return metaBean().startDate().createProperty(this); }
final Property<ZonedDateTime> function() { return metaBean().startDate().createProperty(this); }
/** * Gets the the {@code startDate} property. * @return the property, not null */
Gets the the startDate property
startDate
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/capfloor/CapFloorCMSSpreadSecurity.java", "license": "apache-2.0", "size": 25415 }
[ "org.joda.beans.Property", "org.threeten.bp.ZonedDateTime" ]
import org.joda.beans.Property; import org.threeten.bp.ZonedDateTime;
import org.joda.beans.*; import org.threeten.bp.*;
[ "org.joda.beans", "org.threeten.bp" ]
org.joda.beans; org.threeten.bp;
185,288
static Property getProperty(IteratorScope scope) { requireNonNull(scope); switch (scope) { case scan: return Property.TABLE_ITERATOR_SCAN_PREFIX; case minc: return Property.TABLE_ITERATOR_MINC_PREFIX; case majc: return Property.TABLE_ITERATOR_MAJC_PREFIX; default: throw new IllegalStateException("Could not find configuration property for IteratorScope"); } }
static Property getProperty(IteratorScope scope) { requireNonNull(scope); switch (scope) { case scan: return Property.TABLE_ITERATOR_SCAN_PREFIX; case minc: return Property.TABLE_ITERATOR_MINC_PREFIX; case majc: return Property.TABLE_ITERATOR_MAJC_PREFIX; default: throw new IllegalStateException(STR); } }
/** * Fetch the correct configuration key prefix for the given scope. Throws an IllegalArgumentException if no property exists for the given scope. */
Fetch the correct configuration key prefix for the given scope. Throws an IllegalArgumentException if no property exists for the given scope
getProperty
{ "repo_name": "adamjshook/accumulo", "path": "core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java", "license": "apache-2.0", "size": 15314 }
[ "java.util.Objects", "org.apache.accumulo.core.conf.Property" ]
import java.util.Objects; import org.apache.accumulo.core.conf.Property;
import java.util.*; import org.apache.accumulo.core.conf.*;
[ "java.util", "org.apache.accumulo" ]
java.util; org.apache.accumulo;
2,076,596
public void testSetGetWantClientAuth() throws Exception { SSLSocket socket = createSSLSocket(); socket.setNeedClientAuth(true); socket.setWantClientAuth(false); assertFalse("Result does not correspond to expected", socket.getWantClientAuth()); assertFalse("Socket did not reset its want client auth state", socket.getNeedClientAuth()); socket.setNeedClientAuth(true); socket.setWantClientAuth(true); assertTrue("Result does not correspond to expected", socket.getWantClientAuth()); assertFalse("Socket did not reset its want client auth state", socket.getNeedClientAuth()); }
void function() throws Exception { SSLSocket socket = createSSLSocket(); socket.setNeedClientAuth(true); socket.setWantClientAuth(false); assertFalse(STR, socket.getWantClientAuth()); assertFalse(STR, socket.getNeedClientAuth()); socket.setNeedClientAuth(true); socket.setWantClientAuth(true); assertTrue(STR, socket.getWantClientAuth()); assertFalse(STR, socket.getNeedClientAuth()); }
/** * setWantClientAuth(boolean want) method testing. * getWantClientAuth() method testing. */
setWantClientAuth(boolean want) method testing. getWantClientAuth() method testing
testSetGetWantClientAuth
{ "repo_name": "freeVM/freeVM", "path": "enhanced/java/classlib/modules/x-net/src/test/impl/java.injected/org/apache/harmony/xnet/provider/jsse/SSLSocketImplTest.java", "license": "apache-2.0", "size": 38570 }
[ "javax.net.ssl.SSLSocket" ]
import javax.net.ssl.SSLSocket;
import javax.net.ssl.*;
[ "javax.net" ]
javax.net;
1,671,854
@VisibleForTesting boolean isCheckInSafe(final ContentletRelationships relationships) { if (relationships != null && relationships.getRelationshipsRecords().size() > 0) { final boolean isClusterReadOnly = ElasticsearchUtil.isClusterInReadOnlyMode(); final boolean isEitherLiveOrWorkingIndicesReadOnly = ElasticsearchUtil.isEitherLiveOrWorkingIndicesReadOnly(); if ( (isEitherLiveOrWorkingIndicesReadOnly || isClusterReadOnly) && hasLegacyRelationships(relationships)) { return false; } } return true; }
boolean isCheckInSafe(final ContentletRelationships relationships) { if (relationships != null && relationships.getRelationshipsRecords().size() > 0) { final boolean isClusterReadOnly = ElasticsearchUtil.isClusterInReadOnlyMode(); final boolean isEitherLiveOrWorkingIndicesReadOnly = ElasticsearchUtil.isEitherLiveOrWorkingIndicesReadOnly(); if ( (isEitherLiveOrWorkingIndicesReadOnly isClusterReadOnly) && hasLegacyRelationships(relationships)) { return false; } } return true; }
/** * Method that verifies if a check in operation can be executed. * It is safe to execute a checkin if write operations can be performed on the ES cluster. * Otherwise, check in will be allowed only if the contentlet to be saved does not have legacy relationships * @param relationships ContentletRelationships with the records to be saved * @return */
Method that verifies if a check in operation can be executed. It is safe to execute a checkin if write operations can be performed on the ES cluster. Otherwise, check in will be allowed only if the contentlet to be saved does not have legacy relationships
isCheckInSafe
{ "repo_name": "dotCMS/core", "path": "dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java", "license": "gpl-3.0", "size": 427219 }
[ "com.dotmarketing.portlets.structure.model.ContentletRelationships" ]
import com.dotmarketing.portlets.structure.model.ContentletRelationships;
import com.dotmarketing.portlets.structure.model.*;
[ "com.dotmarketing.portlets" ]
com.dotmarketing.portlets;
626,455
public void apply(List<CompilationUnit> astCompilationUnits, RuleContext ctx, Language language) { RuleChainVisitor visitor = getRuleChainVisitor(language); if (visitor != null) { visitor.visitAll(astCompilationUnits, ctx); } }
void function(List<CompilationUnit> astCompilationUnits, RuleContext ctx, Language language) { RuleChainVisitor visitor = getRuleChainVisitor(language); if (visitor != null) { visitor.visitAll(astCompilationUnits, ctx); } }
/** * Apply the RuleChain to the given ASTCompilationUnits using the given * RuleContext, for those rules using the given Language. * * @param astCompilationUnits * The ASTCompilationUnits. * @param ctx * The RuleContext. * @param language * The Language. */
Apply the RuleChain to the given ASTCompilationUnits using the given RuleContext, for those rules using the given Language
apply
{ "repo_name": "bolav/pmd-src-4.2.6-perl", "path": "src/net/sourceforge/pmd/RuleChain.java", "license": "bsd-3-clause", "size": 3028 }
[ "java.util.List", "net.sourceforge.pmd.ast.CompilationUnit" ]
import java.util.List; import net.sourceforge.pmd.ast.CompilationUnit;
import java.util.*; import net.sourceforge.pmd.ast.*;
[ "java.util", "net.sourceforge.pmd" ]
java.util; net.sourceforge.pmd;
470,096
private static boolean isArrayInitialization(int currentType, int parentType) { return (currentType == TokenTypes.RCURLY || currentType == TokenTypes.LCURLY) && (parentType == TokenTypes.ARRAY_INIT || parentType == TokenTypes.ANNOTATION_ARRAY_INIT); }
static boolean function(int currentType, int parentType) { return (currentType == TokenTypes.RCURLY currentType == TokenTypes.LCURLY) && (parentType == TokenTypes.ARRAY_INIT parentType == TokenTypes.ANNOTATION_ARRAY_INIT); }
/** * Is array initialization. * @param currentType current token * @param parentType parent token * @return true is current token inside array initialization */
Is array initialization
isArrayInitialization
{ "repo_name": "ivanov-alex/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java", "license": "apache-2.0", "size": 19512 }
[ "com.puppycrawl.tools.checkstyle.api.TokenTypes" ]
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
2,079,910
public Map<String, String> getAttributes() { return attributes; }
Map<String, String> function() { return attributes; }
/** * Returns a map of all attributes associated with this sharing profile. * Each entry key is the attribute identifier, while each value is the * attribute value itself. * * @return * The attribute map for this sharing profile. */
Returns a map of all attributes associated with this sharing profile. Each entry key is the attribute identifier, while each value is the attribute value itself
getAttributes
{ "repo_name": "glyptodon/guacamole-client", "path": "guacamole/src/main/java/org/apache/guacamole/rest/sharingprofile/APISharingProfile.java", "license": "apache-2.0", "size": 6718 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,732,813
@Test public void test_assignAccount() throws Exception { entityManager.getTransaction().begin(); instance.create(account); entityManager.getTransaction().commit(); entityManager.clear(); entityManager.getTransaction().begin(); instance.assignAccount(account.getId(), "new"); entityManager.getTransaction().commit(); entityManager.clear(); Account retrievedAccount = entityManager.find(Account.class, account.getId()); assertEquals("'assignAccount' should be correct.", "new", retrievedAccount.getClaimOfficer()); assertNotNull("'assignAccount' should be correct.", retrievedAccount.getClaimOfficerAssignmentDate()); }
void function() throws Exception { entityManager.getTransaction().begin(); instance.create(account); entityManager.getTransaction().commit(); entityManager.clear(); entityManager.getTransaction().begin(); instance.assignAccount(account.getId(), "new"); entityManager.getTransaction().commit(); entityManager.clear(); Account retrievedAccount = entityManager.find(Account.class, account.getId()); assertEquals(STR, "new", retrievedAccount.getClaimOfficer()); assertNotNull(STR, retrievedAccount.getClaimOfficerAssignmentDate()); }
/** * <p> * Accuracy test for the method <code>assignAccount(long accountId, String claimOfficer)</code>.<br> * The result should be correct. * </p> * * @throws Exception * to JUnit. */
Accuracy test for the method <code>assignAccount(long accountId, String claimOfficer)</code>. The result should be correct.
test_assignAccount
{ "repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application", "path": "Code/Batch_Processing/src/java/tests/gov/opm/scrd/services/impl/AccountServiceImplUnitTests.java", "license": "apache-2.0", "size": 61048 }
[ "gov.opm.scrd.entities.application.Account", "org.junit.Assert" ]
import gov.opm.scrd.entities.application.Account; import org.junit.Assert;
import gov.opm.scrd.entities.application.*; import org.junit.*;
[ "gov.opm.scrd", "org.junit" ]
gov.opm.scrd; org.junit;
1,749,167
@GET @Path("dataset") @Produces({ "application/xml", "application/json", "application/atom+xml", "application/rdf+xml", "application/rss+xml", "application/zip" }) public DatasetResource getDataset(@QueryParam("productTypeId") String productTypeId) throws WebApplicationException { if (productTypeId == null || productTypeId.trim().equals("")) { throw new BadRequestException( ErrorType.BAD_REQUEST_EXCEPTION_DATASET_RESOURCE.getErrorType()); } try { FileManagerClient client = getContextClient(); String datasetId; String datasetName; Metadata datasetMetadata; List<ProductType> productTypes = new Vector<ProductType>(); if (productTypeId.equals("ALL")) { productTypes = client.getProductTypes(); datasetId = productTypeId; datasetName = productTypeId; datasetMetadata = new Metadata(); datasetMetadata.addMetadata("ProductType", productTypeId); } else { ProductType productType = client.getProductTypeById(productTypeId); productTypes.add(productType); datasetId = productType.getProductTypeId(); datasetName = productType.getName(); datasetMetadata = productType.getTypeMetadata(); } String productDirPath = getContextWorkingDir().getCanonicalPath() + "/" + datasetName; DatasetResource resource = new DatasetResource(datasetId, datasetName, datasetMetadata, getContextWorkingDir()); // Add all products of the chosen type(s) to the dataset. for (ProductType productType : productTypes) { for (Product product : client.getProductsByProductType(productType)) { product.setProductReferences(client.getProductReferences(product)); resource.addProductResource( new ProductResource( product, client.getMetadata(product), product.getProductReferences(), new File(productDirPath))); } } return resource; } catch (Exception e) { // Just for Logging Purposes String message = "Unable to find the requested resource."; LOGGER.log(Level.FINE, message, e); throw new NotFoundException(e.getMessage()); } }
@Path(STR) @Produces({ STR, STR, STR, STR, STR, STR }) DatasetResource function(@QueryParam(STR) String productTypeId) throws WebApplicationException { if (productTypeId == null productTypeId.trim().equals(STRALLSTRProductTypeSTR/STRUnable to find the requested resource."; LOGGER.log(Level.FINE, message, e); throw new NotFoundException(e.getMessage()); } }
/** * Gets an HTTP response that represents a set of {@link Product products} from the file manager. * * @param productTypeId the ID of the {@link ProductType} for the data set or "ALL" to denote all * product types * @return an HTTP response that represents a set of {@link Product products} from the file * manager */
Gets an HTTP response that represents a set of <code>Product products</code> from the file manager
getDataset
{ "repo_name": "apache/oodt", "path": "webapp/fmprod/src/main/java/org/apache/oodt/cas/product/jaxrs/services/CasProductJaxrsService.java", "license": "apache-2.0", "size": 13080 }
[ "java.util.logging.Level", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.QueryParam", "javax.ws.rs.WebApplicationException", "org.apache.oodt.cas.product.jaxrs.exceptions.NotFoundException", "org.apache.oodt.cas.product.jaxrs.resources.DatasetResource" ]
import java.util.logging.Level; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import org.apache.oodt.cas.product.jaxrs.exceptions.NotFoundException; import org.apache.oodt.cas.product.jaxrs.resources.DatasetResource;
import java.util.logging.*; import javax.ws.rs.*; import org.apache.oodt.cas.product.jaxrs.exceptions.*; import org.apache.oodt.cas.product.jaxrs.resources.*;
[ "java.util", "javax.ws", "org.apache.oodt" ]
java.util; javax.ws; org.apache.oodt;
2,903,819
public void updated(String pid, Dictionary properties) { String compositeIdentity = (String) properties.get(compositeIdentityKey); String portName = (String) properties.get(portNameKey); Object id = properties.get(ebusIdKey); Integer ebusId = id instanceof Integer ? (Integer) id : Integer.parseInt(id.toString()); Object rate = properties.get(poolingRateKey); Integer poolingRate = rate instanceof Integer ? (Integer) rate: Integer.parseInt(rate.toString()); String configFilePath = (String) properties.get(configFilePathKey); Object mck = properties.get(mock); Boolean isMock = mck instanceof Boolean ? (Boolean) mck : Boolean.parseBoolean(mck != null ? mck.toString(): "false"); // We need to check if the servive with the given pid already exist in our collection. This would // mean that the configuration has been updated. EbusDevice ebusDevSer = ( EbusDevice) ebusDevServices.get( pid ); if( ebusDevSer != null ) { // in which case, the simplest is to get rid of the existing instance, and recreate a brand new one. ebusDevSer.stop(); ebusDevServices.remove(ebusDevSer); ebusDevSer = null; } try { URL configUrl = null; if( configFilePath.startsWith("file:")){ configFilePath = configFilePath.substring("file:".length()); File file = new File(configFilePath); if( file.exists() && !file.isDirectory()) { try { configUrl= file.toURI().toURL(); } catch (MalformedURLException e) { Activator.log(LogService.LOG_ERROR, "Error creating url for file path: " + configFilePath); } } else { Activator.log(LogService.LOG_ERROR, "Error reading EbusDevice file at: " + file.getAbsolutePath()); } } else { configUrl = Activator.getResourceStream(configFilePath); } if (configUrl != null) { InputStream configFileStream = configUrl.openStream(); // Create an xml file EbusDevice configuration reader, and // pass it the EbusDeviceFactory as delegate //EbusDeviceConfig mdbConfig = new EbusDeviceConfig(this, pid, compositeIdentity, portName, modbusId, poolingRate, isMock); // , tell it to read the file. This in turn will call back the // EbusDeviceFactory to create the wires. //mdbConfig.parse(configFileStream); configFileStream.close(); } } catch (java.io.IOException e) { Activator.log(LogService.LOG_INFO, "Configuration file: " + configFilePath + " could not be found."); } }
void function(String pid, Dictionary properties) { String compositeIdentity = (String) properties.get(compositeIdentityKey); String portName = (String) properties.get(portNameKey); Object id = properties.get(ebusIdKey); Integer ebusId = id instanceof Integer ? (Integer) id : Integer.parseInt(id.toString()); Object rate = properties.get(poolingRateKey); Integer poolingRate = rate instanceof Integer ? (Integer) rate: Integer.parseInt(rate.toString()); String configFilePath = (String) properties.get(configFilePathKey); Object mck = properties.get(mock); Boolean isMock = mck instanceof Boolean ? (Boolean) mck : Boolean.parseBoolean(mck != null ? mck.toString(): "false"); EbusDevice ebusDevSer = ( EbusDevice) ebusDevServices.get( pid ); if( ebusDevSer != null ) { ebusDevSer.stop(); ebusDevServices.remove(ebusDevSer); ebusDevSer = null; } try { URL configUrl = null; if( configFilePath.startsWith("file:")){ configFilePath = configFilePath.substring("file:".length()); File file = new File(configFilePath); if( file.exists() && !file.isDirectory()) { try { configUrl= file.toURI().toURL(); } catch (MalformedURLException e) { Activator.log(LogService.LOG_ERROR, STR + configFilePath); } } else { Activator.log(LogService.LOG_ERROR, STR + file.getAbsolutePath()); } } else { configUrl = Activator.getResourceStream(configFilePath); } if (configUrl != null) { InputStream configFileStream = configUrl.openStream(); configFileStream.close(); } } catch (java.io.IOException e) { Activator.log(LogService.LOG_INFO, STR + configFilePath + STR); } }
/** * ManagedServiceFactory Interface method * Called by the framewok when the configuration manager has fond new configuration for this service. * * @param pid The persistent identificator of the EbusDevice service to update. * @param properties The new properties for this service. */
ManagedServiceFactory Interface method Called by the framewok when the configuration manager has fond new configuration for this service
updated
{ "repo_name": "lathil/Ptoceti", "path": "com.ptoceti.osgi.ebusdevice/src/main/java/com/ptoceti/ebus/ebusdevice/impl/EbusDeviceFactory.java", "license": "apache-2.0", "size": 7474 }
[ "com.ptoceti.ebus.ebusdevice.EbusDevice", "java.io.File", "java.io.InputStream", "java.net.MalformedURLException", "java.util.Dictionary", "org.osgi.service.log.LogService" ]
import com.ptoceti.ebus.ebusdevice.EbusDevice; import java.io.File; import java.io.InputStream; import java.net.MalformedURLException; import java.util.Dictionary; import org.osgi.service.log.LogService;
import com.ptoceti.ebus.ebusdevice.*; import java.io.*; import java.net.*; import java.util.*; import org.osgi.service.log.*;
[ "com.ptoceti.ebus", "java.io", "java.net", "java.util", "org.osgi.service" ]
com.ptoceti.ebus; java.io; java.net; java.util; org.osgi.service;
2,634,010
@Override public String toString() { final StringBuilder s = new StringBuilder("radial-gradient(focus-angle ").append(focusAngle) .append("deg, focus-distance ").append(focusDistance * 100) .append("% , center ").append(GradientUtils.lengthToString(centerX, proportional)) .append(" ").append(GradientUtils.lengthToString(centerY, proportional)) .append(", radius ").append(GradientUtils.lengthToString(radius, proportional)) .append(", "); switch (cycleMethod) { case REFLECT: s.append("reflect").append(", "); break; case REPEAT: s.append("repeat").append(", "); break; } for (Stop stop : stops) { s.append(stop).append(", "); } s.delete(s.length() - 2, s.length()); s.append(")"); return s.toString(); } /** * Creates a radial gradient value from a string representation. * <p>The format of the string representation is based on * JavaFX CSS specification for radial gradient which is * <pre> * radial-gradient([focus-angle &lt;angle&gt;, ]? * [focus-distance &lt;percentage&gt;, ]? * [center &lt;point&gt;, ]? * radius [&lt;length&gt; | &lt;percentage&gt;], * [[repeat | reflect],]? * &lt;color-stop&gt;[, &lt;color-stop&gt;]+) * </pre> * where * <pre> * &lt;point&gt; = [ [ &lt;length&gt; &lt;length&gt; ] | [ &lt;percentage&gt; | &lt;percentage&gt; ] ] * &lt;color-stop&gt; = [ &lt;color&gt; [ &lt;percentage&gt; | &lt;length&gt;]? ] * </pre> * </p> * <p>Currently length can be only specified in px, the specification of unit can be omited. * Format of color representation is the one used in {@link Color#web(String color)}. * The radial-gradient keyword can be omited. * For additional information about the format of string representation, see the * <a href="../doc-files/cssref.html">CSS Reference Guide</a>. * </p> * * Examples: * <pre><code> * RadialGradient g * = RadialGradient.valueOf("radial-gradient(center 100px 100px, radius 200px, red 0%, blue 30%, black 100%)"); * RadialGradient g * = RadialGradient.valueOf("center 100px 100px, radius 200px, red 0%, blue 30%, black 100%"); * RadialGradient g * = RadialGradient.valueOf("radial-gradient(center 50% 50%, radius 50%, cyan, violet 75%, magenta)"); * RadialGradient g * = RadialGradient.valueOf("center 50% 50%, radius 50%, cyan, violet 75%, magenta"); * </code></pre> * * @param value the string to convert * @throws NullPointerException if the {@code value} is {@code null}
@Override String function() { final StringBuilder s = new StringBuilder(STR).append(focusAngle) .append(STR).append(focusDistance * 100) .append(STR).append(GradientUtils.lengthToString(centerX, proportional)) .append(" ").append(GradientUtils.lengthToString(centerY, proportional)) .append(STR).append(GradientUtils.lengthToString(radius, proportional)) .append(STR); switch (cycleMethod) { case REFLECT: s.append(STR).append(STR); break; case REPEAT: s.append(STR).append(STR); break; } for (Stop stop : stops) { s.append(stop).append(STR); } s.delete(s.length() - 2, s.length()); s.append(")"); return s.toString(); } /** * Creates a radial gradient value from a string representation. * <p>The format of the string representation is based on * JavaFX CSS specification for radial gradient which is * <pre> * radial-gradient([focus-angle &lt;angle&gt;, ]? * [focus-distance &lt;percentage&gt;, ]? * [center &lt;point&gt;, ]? * radius [&lt;length&gt; &lt;percentage&gt;], * [[repeat reflect],]? * &lt;color-stop&gt;[, &lt;color-stop&gt;]+) * </pre> * where * <pre> * &lt;point&gt; = [ [ &lt;length&gt; &lt;length&gt; ] [ &lt;percentage&gt; &lt;percentage&gt; ] ] * &lt;color-stop&gt; = [ &lt;color&gt; [ &lt;percentage&gt; &lt;length&gt;]? ] * </pre> * </p> * <p>Currently length can be only specified in px, the specification of unit can be omited. * Format of color representation is the one used in {@link Color#web(String color)}. * The radial-gradient keyword can be omited. * For additional information about the format of string representation, see the * <a href=STR>CSS Reference Guide</a>. * </p> * * Examples: * <pre><code> * RadialGradient g * = RadialGradient.valueOf(STR); * RadialGradient g * = RadialGradient.valueOf(STR); * RadialGradient g * = RadialGradient.valueOf(STR); * RadialGradient g * = RadialGradient.valueOf(STR); * </code></pre> * * @param value the string to convert * @throws NullPointerException if the {@code value} is {@code null}
/** * Returns a string representation of this {@code RadialGradient} object. * @return a string representation of this {@code RadialGradient} object. */
Returns a string representation of this RadialGradient object
toString
{ "repo_name": "166MMX/openjdk.java.net-openjfx-8u40-rt", "path": "modules/graphics/src/main/java/javafx/scene/paint/RadialGradient.java", "license": "gpl-2.0", "size": 19975 }
[ "com.sun.javafx.scene.paint.GradientUtils" ]
import com.sun.javafx.scene.paint.GradientUtils;
import com.sun.javafx.scene.paint.*;
[ "com.sun.javafx" ]
com.sun.javafx;
505,986
@Test public void testBuildXmlSinkDirect() { XmlSink.Bound<Bird> sink = XmlSink.writeOf(Bird.class, testRootElement, testFilePrefix); assertEquals(testClass, sink.classToBind); assertEquals(testRootElement, sink.rootElementName); assertEquals(testFilePrefix, sink.baseOutputFilename); }
void function() { XmlSink.Bound<Bird> sink = XmlSink.writeOf(Bird.class, testRootElement, testFilePrefix); assertEquals(testClass, sink.classToBind); assertEquals(testRootElement, sink.rootElementName); assertEquals(testFilePrefix, sink.baseOutputFilename); }
/** * Alternate builder method correctly initializes an XML Sink. */
Alternate builder method correctly initializes an XML Sink
testBuildXmlSinkDirect
{ "repo_name": "yafengguo/Apache-beam", "path": "sdks/java/core/src/test/java/org/apache/beam/sdk/io/XmlSinkTest.java", "license": "apache-2.0", "size": 9061 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,580,803
private String getName(int name, Locale locale) { if (nameTable == null) { byte[] data = getTrueTypeTable((byte)'n', (byte) 'a', (byte) 'm', (byte) 'e'); if( data == null ) return null; nameTable = ByteBuffer.wrap( data ); } return NameDecoder.getName(nameTable, name, locale); }
String function(int name, Locale locale) { if (nameTable == null) { byte[] data = getTrueTypeTable((byte)'n', (byte) 'a', (byte) 'm', (byte) 'e'); if( data == null ) return null; nameTable = ByteBuffer.wrap( data ); } return NameDecoder.getName(nameTable, name, locale); }
/** * Extracts a String from the font&#x2019;s name table. * * @param name the numeric TrueType or OpenType name ID. * * @param locale the locale for which names shall be localized, or * <code>null</code> if the locale does mot matter because the name * is known to be language-independent (for example, because it is * the PostScript name). */
Extracts a String from the font&#x2019;s name table
getName
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java", "license": "bsd-3-clause", "size": 11203 }
[ "gnu.java.awt.font.opentype.NameDecoder", "java.nio.ByteBuffer", "java.util.Locale" ]
import gnu.java.awt.font.opentype.NameDecoder; import java.nio.ByteBuffer; import java.util.Locale;
import gnu.java.awt.font.opentype.*; import java.nio.*; import java.util.*;
[ "gnu.java.awt", "java.nio", "java.util" ]
gnu.java.awt; java.nio; java.util;
178,480
protected StringBuffer consolidateFieldNames(List fieldNames, String delimiter) { StringBuffer sb = new StringBuffer(); // setup some vars boolean firstPass = true; String delim = ""; // walk through the list for (Iterator iter = fieldNames.iterator(); iter.hasNext(); ) { String fieldName = (String) iter.next(); // get the human-readable name // add the new one, with the appropriate delimiter sb.append(delim + getDataDictionaryService().getAttributeLabel(newDataObject.getClass(), fieldName)); // after the first item, start using a delimiter if (firstPass) { delim = delimiter; firstPass = false; } } return sb; }
StringBuffer function(List fieldNames, String delimiter) { StringBuffer sb = new StringBuffer(); boolean firstPass = true; String delim = ""; for (Iterator iter = fieldNames.iterator(); iter.hasNext(); ) { String fieldName = (String) iter.next(); sb.append(delim + getDataDictionaryService().getAttributeLabel(newDataObject.getClass(), fieldName)); if (firstPass) { delim = delimiter; firstPass = false; } } return sb; }
/** * This method turns a list of field property names, into a delimited string of the human-readable names. * * @param fieldNames - List of fieldNames * @return A filled StringBuffer ready to go in an error message */
This method turns a list of field property names, into a delimited string of the human-readable names
consolidateFieldNames
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-kns/src/main/java/org/kuali/kfs/krad/rules/MaintenanceDocumentRuleBase.java", "license": "agpl-3.0", "size": 61252 }
[ "java.util.Iterator", "java.util.List" ]
import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
928,193
boolean ping(TaskAttemptID taskid) throws IOException;
boolean ping(TaskAttemptID taskid) throws IOException;
/** * Periodically called by child to check if parent is still alive. * * @return True if the task is known */
Periodically called by child to check if parent is still alive
ping
{ "repo_name": "dongpf/hadoop-0.19.1", "path": "src/mapred/org/apache/hadoop/mapred/TaskUmbilicalProtocol.java", "license": "apache-2.0", "size": 6399 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
621,981
String getName(); /** * Returns the {@link java.io.ObjectInputStream} associated with * the Client being handled. * It will be <code>null</code> if no {@link ClientObjectHandler}
String getName(); /** * Returns the {@link java.io.ObjectInputStream} associated with * the Client being handled. * It will be <code>null</code> if no {@link ClientObjectHandler}
/** * Returns the ClientHandler name * @since 1.4.6 */
Returns the ClientHandler name
getName
{ "repo_name": "QuickServerLab/QuickServer-Main", "path": "src/main/org/quickserver/net/server/ClientHandler.java", "license": "lgpl-2.1", "size": 15954 }
[ "java.io.ObjectInputStream" ]
import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,446,462
public void addWord(Word word) { list.add(word); updateMaxQueueSize(); }
void function(Word word) { list.add(word); updateMaxQueueSize(); }
/** * Adds word to the pool. * @param word word to add */
Adds word to the pool
addWord
{ "repo_name": "ferrerverck/englishwords", "path": "src/com/words/controller/words/wordpool/WordPool.java", "license": "gpl-3.0", "size": 7895 }
[ "com.words.controller.words.Word" ]
import com.words.controller.words.Word;
import com.words.controller.words.*;
[ "com.words.controller" ]
com.words.controller;
900,459
@Generated @StructureField(order = 0, isGetter = true) public native int mChunkType();
@StructureField(order = 0, isGetter = true) native int function();
/** * four char code */
four char code
mChunkType
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/audiotoolbox/struct/CAFChunkHeader.java", "license": "apache-2.0", "size": 2055 }
[ "org.moe.natj.c.ann.StructureField" ]
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.c.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,573,616
public void packageRemove(HlPackage pkg);
void function(HlPackage pkg);
/** * Replaces packageClose() and packageDelete() with a single call, primarily * to make it easier to handle the safe marking of HlPackage and DirectoryItem * objects as invalid. * @param pkg The package to remove and close. */
Replaces packageClose() and packageDelete() with a single call, primarily to make it easier to handle the safe marking of HlPackage and DirectoryItem objects as invalid
packageRemove
{ "repo_name": "DHager/jhllib", "path": "src/main/java/com/technofovea/hllib/methods/ManagedCalls.java", "license": "lgpl-3.0", "size": 1499 }
[ "com.technofovea.hllib.HlPackage" ]
import com.technofovea.hllib.HlPackage;
import com.technofovea.hllib.*;
[ "com.technofovea.hllib" ]
com.technofovea.hllib;
1,738,832
public void setRefreshing() { int left = Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getAbsoluteLeft() + (Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getOffsetWidth()/2); int top = Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getAbsoluteTop() + (Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getOffsetHeight()/2); status.setFlag_getDashboard(); status.refresh(left, top); }
void function() { int left = Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getAbsoluteLeft() + (Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getOffsetWidth()/2); int top = Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getAbsoluteTop() + (Main.get().mainPanel.dashboard.keyMapDashboard.scrollTable.getOffsetHeight()/2); status.setFlag_getDashboard(); status.refresh(left, top); }
/** * Sets the refreshing */
Sets the refreshing
setRefreshing
{ "repo_name": "papamas/DMS-KANGREG-XI-MANADO", "path": "src/main/java/com/openkm/frontend/client/widget/dashboard/keymap/KeyMapTable.java", "license": "gpl-3.0", "size": 28777 }
[ "com.openkm.frontend.client.Main" ]
import com.openkm.frontend.client.Main;
import com.openkm.frontend.client.*;
[ "com.openkm.frontend" ]
com.openkm.frontend;
2,817,876
@Deprecated public String toString(Directory dir) { return toString(); }
String function(Directory dir) { return toString(); }
/** * Returns readable description of this segment. * @deprecated Use {@link #toString()} instead. */
Returns readable description of this segment
toString
{ "repo_name": "PATRIC3/p3_solr", "path": "lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java", "license": "apache-2.0", "size": 39975 }
[ "org.apache.lucene.store.Directory" ]
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.*;
[ "org.apache.lucene" ]
org.apache.lucene;
1,241,643
@Override public IntIntMultiValueMap invert() { final IntIntMultiValueMap inv = new DefaultIntIntMultiValueMap(); final IntIterator keyIt = keySet().iterator(); while (keyIt.hasNext()) { final int key = keyIt.nextInt(); final IntIterator valIt = get(key).iterator(); while (valIt.hasNext()) { final int val = valIt.nextInt(); inv.add(val, key); } } return inv; }
IntIntMultiValueMap function() { final IntIntMultiValueMap inv = new DefaultIntIntMultiValueMap(); final IntIterator keyIt = keySet().iterator(); while (keyIt.hasNext()) { final int key = keyIt.nextInt(); final IntIterator valIt = get(key).iterator(); while (valIt.hasNext()) { final int val = valIt.nextInt(); inv.add(val, key); } } return inv; }
/** * Implementation returns a new {@link DefaultIntIntMultiValueMap} instance. * <p> * Changing the returned map does not affect this multi value map. * * @see ch.javasoft.util.map.MultiValueMap#invert() */
Implementation returns a new <code>DefaultIntIntMultiValueMap</code> instance. Changing the returned map does not affect this multi value map
invert
{ "repo_name": "mpgerstl/tEFMA", "path": "ch/javasoft/util/map/DefaultIntIntMultiValueMap.java", "license": "bsd-2-clause", "size": 15799 }
[ "ch.javasoft.util.ints.IntIterator" ]
import ch.javasoft.util.ints.IntIterator;
import ch.javasoft.util.ints.*;
[ "ch.javasoft.util" ]
ch.javasoft.util;
2,796,463
private void freezeAuditableAspect(NodeRef nodeRef, NodeRef versionNodeRef) { if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUDITABLE)) { Map<QName, Serializable> properties = dbNodeService.getProperties(nodeRef); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATOR, properties.get(ContentModel.PROP_CREATOR)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATED, properties.get(ContentModel.PROP_CREATED)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIER, properties.get(ContentModel.PROP_MODIFIER)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIED, properties.get(ContentModel.PROP_MODIFIED)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_ACCESSED, properties.get(ContentModel.PROP_ACCESSED)); if (properties.get(ContentModel.PROP_OWNER) != null) { dbNodeService.setProperty(versionNodeRef, PROP_FROZEN_OWNER, properties.get(ContentModel.PROP_OWNER)); } } }
void function(NodeRef nodeRef, NodeRef versionNodeRef) { if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUDITABLE)) { Map<QName, Serializable> properties = dbNodeService.getProperties(nodeRef); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATOR, properties.get(ContentModel.PROP_CREATOR)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATED, properties.get(ContentModel.PROP_CREATED)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIER, properties.get(ContentModel.PROP_MODIFIER)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIED, properties.get(ContentModel.PROP_MODIFIED)); dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_ACCESSED, properties.get(ContentModel.PROP_ACCESSED)); if (properties.get(ContentModel.PROP_OWNER) != null) { dbNodeService.setProperty(versionNodeRef, PROP_FROZEN_OWNER, properties.get(ContentModel.PROP_OWNER)); } } }
/** * Freezes audit aspect properties. * * @param nodeRef * @param versionNodeRef */
Freezes audit aspect properties
freezeAuditableAspect
{ "repo_name": "dnacreative/records-management", "path": "rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java", "license": "lgpl-3.0", "size": 33420 }
[ "java.io.Serializable", "java.util.Map", "org.alfresco.model.ContentModel", "org.alfresco.repo.version.Version2Model", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.service.namespace.QName" ]
import java.io.Serializable; import java.util.Map; import org.alfresco.model.ContentModel; import org.alfresco.repo.version.Version2Model; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName;
import java.io.*; import java.util.*; import org.alfresco.model.*; import org.alfresco.repo.version.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.namespace.*;
[ "java.io", "java.util", "org.alfresco.model", "org.alfresco.repo", "org.alfresco.service" ]
java.io; java.util; org.alfresco.model; org.alfresco.repo; org.alfresco.service;
2,643,762
@Test public void testFilteringForNoMaxVersionWithProductId() throws IOException, BadVersionException, RequestFailureException, SecurityException, ClientFailureException { Asset assetWithMaxVersion = createTestAsset(); WlpInformation wlpInfo = new WlpInformation(); AppliesToFilterInfo filterInfo = new AppliesToFilterInfo(); filterInfo.setProductId("correct"); FilterVersion maxVersion = new FilterVersion(); maxVersion.setValue("8.5.5.4"); filterInfo.setMaxVersion(maxVersion); filterInfo.setHasMaxVersion("true"); wlpInfo.setAppliesToFilterInfo(Collections.singleton(filterInfo)); assetWithMaxVersion.setWlpInformation(wlpInfo); assetWithMaxVersion = _writeableClient.addAsset(assetWithMaxVersion); Asset assetWithNoMaxVersion = createTestAsset(); filterInfo.setMaxVersion(null); filterInfo.setHasMaxVersion("false"); assetWithNoMaxVersion.setWlpInformation(wlpInfo); assetWithNoMaxVersion = _writeableClient.addAsset(assetWithNoMaxVersion); Asset assetWithNoMaxVersionWrongProduct = createTestAsset(); filterInfo.setMaxVersion(null); filterInfo.setHasMaxVersion("false"); filterInfo.setProductId("incorrect"); assetWithNoMaxVersionWrongProduct.setWlpInformation(wlpInfo); assetWithNoMaxVersionWrongProduct = _writeableClient.addAsset(assetWithNoMaxVersionWrongProduct); Collection<Asset> assets = _client.getAssetsWithUnboundedMaxVersion(null, Collections.singleton("correct"), null); assertEquals("One asset should be obtained", 1, assets.size()); assertTrue("Should get back the feature", assets.contains(assetWithNoMaxVersion)); }
void function() throws IOException, BadVersionException, RequestFailureException, SecurityException, ClientFailureException { Asset assetWithMaxVersion = createTestAsset(); WlpInformation wlpInfo = new WlpInformation(); AppliesToFilterInfo filterInfo = new AppliesToFilterInfo(); filterInfo.setProductId(STR); FilterVersion maxVersion = new FilterVersion(); maxVersion.setValue(STR); filterInfo.setMaxVersion(maxVersion); filterInfo.setHasMaxVersion("true"); wlpInfo.setAppliesToFilterInfo(Collections.singleton(filterInfo)); assetWithMaxVersion.setWlpInformation(wlpInfo); assetWithMaxVersion = _writeableClient.addAsset(assetWithMaxVersion); Asset assetWithNoMaxVersion = createTestAsset(); filterInfo.setMaxVersion(null); filterInfo.setHasMaxVersion("false"); assetWithNoMaxVersion.setWlpInformation(wlpInfo); assetWithNoMaxVersion = _writeableClient.addAsset(assetWithNoMaxVersion); Asset assetWithNoMaxVersionWrongProduct = createTestAsset(); filterInfo.setMaxVersion(null); filterInfo.setHasMaxVersion("false"); filterInfo.setProductId(STR); assetWithNoMaxVersionWrongProduct.setWlpInformation(wlpInfo); assetWithNoMaxVersionWrongProduct = _writeableClient.addAsset(assetWithNoMaxVersionWrongProduct); Collection<Asset> assets = _client.getAssetsWithUnboundedMaxVersion(null, Collections.singleton(STR), null); assertEquals(STR, 1, assets.size()); assertTrue(STR, assets.contains(assetWithNoMaxVersion)); }
/** * Tests that you can filter for an asset with no max version * * @throws RequestFailureException * @throws BadVersionException * @throws IOException * @throws ClientFailureException * @throws SecurityException */
Tests that you can filter for an asset with no max version
testFilteringForNoMaxVersionWithProductId
{ "repo_name": "WASdev/tool.lars", "path": "client-lib-tests/src/fat/java/com/ibm/ws/repository/transport/client/test/RepositoryClientTest.java", "license": "apache-2.0", "size": 75497 }
[ "com.ibm.ws.repository.transport.exceptions.BadVersionException", "com.ibm.ws.repository.transport.exceptions.ClientFailureException", "com.ibm.ws.repository.transport.exceptions.RequestFailureException", "com.ibm.ws.repository.transport.model.AppliesToFilterInfo", "com.ibm.ws.repository.transport.model.Asset", "com.ibm.ws.repository.transport.model.FilterVersion", "com.ibm.ws.repository.transport.model.WlpInformation", "java.io.IOException", "java.util.Collection", "java.util.Collections", "org.junit.Assert" ]
import com.ibm.ws.repository.transport.exceptions.BadVersionException; import com.ibm.ws.repository.transport.exceptions.ClientFailureException; import com.ibm.ws.repository.transport.exceptions.RequestFailureException; import com.ibm.ws.repository.transport.model.AppliesToFilterInfo; import com.ibm.ws.repository.transport.model.Asset; import com.ibm.ws.repository.transport.model.FilterVersion; import com.ibm.ws.repository.transport.model.WlpInformation; import java.io.IOException; import java.util.Collection; import java.util.Collections; import org.junit.Assert;
import com.ibm.ws.repository.transport.exceptions.*; import com.ibm.ws.repository.transport.model.*; import java.io.*; import java.util.*; import org.junit.*;
[ "com.ibm.ws", "java.io", "java.util", "org.junit" ]
com.ibm.ws; java.io; java.util; org.junit;
1,585,893
public Object visit(ForStatement node) { print("l."+node.getBeginLine()+" ForStatement {"); print("initialization:"); if (node.getInitialization() != null) { indent(); Iterator it = node.getInitialization().iterator(); while (it.hasNext()) { ((Node)it.next()).acceptVisitor(this); } unindent(); } print("condition:"); if (node.getCondition() != null) { indent(); node.getCondition().acceptVisitor(this); unindent(); } print("update:"); if (node.getUpdate() != null) { indent(); Iterator it = node.getUpdate().iterator(); while (it.hasNext()) { ((Node)it.next()).acceptVisitor(this); } unindent(); } print("body:"); indent(); node.getBody().acceptVisitor(this); unindent(); displayProperties(node); print("}"); return null; }
Object function(ForStatement node) { print("l."+node.getBeginLine()+STR); print(STR); if (node.getInitialization() != null) { indent(); Iterator it = node.getInitialization().iterator(); while (it.hasNext()) { ((Node)it.next()).acceptVisitor(this); } unindent(); } print(STR); if (node.getCondition() != null) { indent(); node.getCondition().acceptVisitor(this); unindent(); } print(STR); if (node.getUpdate() != null) { indent(); Iterator it = node.getUpdate().iterator(); while (it.hasNext()) { ((Node)it.next()).acceptVisitor(this); } unindent(); } print("body:"); indent(); node.getBody().acceptVisitor(this); unindent(); displayProperties(node); print("}"); return null; }
/** * Visits a ForStatement * @param node the node to visit */
Visits a ForStatement
visit
{ "repo_name": "moegyver/mJeliot", "path": "Jeliot/src/koala/dynamicjava/util/DisplayVisitor.java", "license": "mit", "size": 43449 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,645,013
private static void checkJobStatus(JobStatus status, JobID expJobId, String expJobName, JobStatus.State expState, float expCleanupProgress) throws Exception { assert F.eq(status.getJobID(), expJobId) : "Expected=" + expJobId + ", actual=" + status.getJobID(); assert F.eq(status.getJobName(), expJobName) : "Expected=" + expJobName + ", actual=" + status.getJobName(); assert F.eq(status.getState(), expState) : "Expected=" + expState + ", actual=" + status.getState(); assert F.eq(status.getCleanupProgress(), expCleanupProgress) : "Expected=" + expCleanupProgress + ", actual=" + status.getCleanupProgress(); }
static void function(JobStatus status, JobID expJobId, String expJobName, JobStatus.State expState, float expCleanupProgress) throws Exception { assert F.eq(status.getJobID(), expJobId) : STR + expJobId + STR + status.getJobID(); assert F.eq(status.getJobName(), expJobName) : STR + expJobName + STR + status.getJobName(); assert F.eq(status.getState(), expState) : STR + expState + STR + status.getState(); assert F.eq(status.getCleanupProgress(), expCleanupProgress) : STR + expCleanupProgress + STR + status.getCleanupProgress(); }
/** * Check job status. * * @param status Job status. * @param expJobId Expected job ID. * @param expJobName Expected job name. * @param expState Expected state. * @param expCleanupProgress Expected cleanup progress. * @throws Exception If failed. */
Check job status
checkJobStatus
{ "repo_name": "ilantukh/ignite", "path": "modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java", "license": "apache-2.0", "size": 22240 }
[ "org.apache.hadoop.mapreduce.JobID", "org.apache.hadoop.mapreduce.JobStatus", "org.apache.ignite.internal.util.typedef.F" ]
import org.apache.hadoop.mapreduce.JobID; import org.apache.hadoop.mapreduce.JobStatus; import org.apache.ignite.internal.util.typedef.F;
import org.apache.hadoop.mapreduce.*; import org.apache.ignite.internal.util.typedef.*;
[ "org.apache.hadoop", "org.apache.ignite" ]
org.apache.hadoop; org.apache.ignite;
1,107,791
public void closeWebApplicationContext(ServletContext servletContext) { servletContext.log("Closing Spring root WebApplicationContext"); try { if (this.context instanceof ConfigurableWebApplicationContext) { ((ConfigurableWebApplicationContext) this.context).close(); } } finally { ClassLoader ccl = Thread.currentThread().getContextClassLoader(); if (ccl == ContextLoader.class.getClassLoader()) { currentContext = null; } else if (ccl != null) { currentContextPerThread.remove(ccl); } servletContext.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (this.parentContextRef != null) { this.parentContextRef.release(); } } } /** * Obtain the Spring root web application context for the current thread * (i.e. for the current thread's context ClassLoader, which needs to be * the web application's ClassLoader). * @return the current root web application context, or {@code null}
void function(ServletContext servletContext) { servletContext.log(STR); try { if (this.context instanceof ConfigurableWebApplicationContext) { ((ConfigurableWebApplicationContext) this.context).close(); } } finally { ClassLoader ccl = Thread.currentThread().getContextClassLoader(); if (ccl == ContextLoader.class.getClassLoader()) { currentContext = null; } else if (ccl != null) { currentContextPerThread.remove(ccl); } servletContext.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (this.parentContextRef != null) { this.parentContextRef.release(); } } } /** * Obtain the Spring root web application context for the current thread * (i.e. for the current thread's context ClassLoader, which needs to be * the web application's ClassLoader). * @return the current root web application context, or {@code null}
/** * Close Spring's web application context for the given servlet context. If * the default {@link #loadParentContext(ServletContext)} implementation, * which uses ContextSingletonBeanFactoryLocator, has loaded any shared * parent context, release one reference to that shared parent context. * <p>If overriding {@link #loadParentContext(ServletContext)}, you may have * to override this method as well. * @param servletContext the ServletContext that the WebApplicationContext runs in */
Close Spring's web application context for the given servlet context. If the default <code>#loadParentContext(ServletContext)</code> implementation, which uses ContextSingletonBeanFactoryLocator, has loaded any shared parent context, release one reference to that shared parent context. If overriding <code>#loadParentContext(ServletContext)</code>, you may have to override this method as well
closeWebApplicationContext
{ "repo_name": "kingtang/spring-learn", "path": "spring-web/src/main/java/org/springframework/web/context/ContextLoader.java", "license": "gpl-3.0", "size": 28250 }
[ "javax.servlet.ServletContext" ]
import javax.servlet.ServletContext;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
2,630,058
long appendSchemaChangeToTable(String userId, String tableId, List<String> current, List<ColumnChange> changes, long transactionId);
long appendSchemaChangeToTable(String userId, String tableId, List<String> current, List<ColumnChange> changes, long transactionId);
/** * Append a schema change to the table's changes. * * @param userId * @param tableId * @param current * @param changes * @throws IOException */
Append a schema change to the table's changes
appendSchemaChangeToTable
{ "repo_name": "zimingd/Synapse-Repository-Services", "path": "lib/models/src/main/java/org/sagebionetworks/repo/model/dao/table/TableRowTruthDAO.java", "license": "apache-2.0", "size": 5506 }
[ "java.util.List", "org.sagebionetworks.repo.model.table.ColumnChange" ]
import java.util.List; import org.sagebionetworks.repo.model.table.ColumnChange;
import java.util.*; import org.sagebionetworks.repo.model.table.*;
[ "java.util", "org.sagebionetworks.repo" ]
java.util; org.sagebionetworks.repo;
1,194,123
private Object doInsert(DataValueDescriptor[] row) throws StandardException { return this.gfContainer.insertRow(row, this.tran, this.txState, this.tran.getLanguageConnectionContext(), false ); }
Object function(DataValueDescriptor[] row) throws StandardException { return this.gfContainer.insertRow(row, this.tran, this.txState, this.tran.getLanguageConnectionContext(), false ); }
/** * Insert a new row into the heap and return the region key of the row. * * @param row * The row to insert. * * @return the new slotId * * @exception StandardException * Standard exception policy. */
Insert a new row into the heap and return the region key of the row
doInsert
{ "repo_name": "papicella/snappy-store", "path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/access/heap/MemHeapController.java", "license": "apache-2.0", "size": 12212 }
[ "com.pivotal.gemfirexd.internal.iapi.error.StandardException", "com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor" ]
import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor;
import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.types.*;
[ "com.pivotal.gemfirexd" ]
com.pivotal.gemfirexd;
860,603
@Basic( optional = true ) @Column( name = "hp_screen_score" ) public Integer getHpScreeningScore() { return this.hpScreeningScore; }
@Basic( optional = true ) @Column( name = STR ) Integer function() { return this.hpScreeningScore; }
/** * Return the value associated with the column: hpScreenScore. * @return A Integer object (this.hpScreenScore) */
Return the value associated with the column: hpScreenScore
getHpScreeningScore
{ "repo_name": "servinglynk/servinglynk-hmis", "path": "hmis-model-v2016/src/main/java/com/servinglynk/hmis/warehouse/model/v2016/Entryssvf.java", "license": "mpl-2.0", "size": 25761 }
[ "javax.persistence.Basic", "javax.persistence.Column" ]
import javax.persistence.Basic; import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
1,339,148
public static byte[] escapeEasternUnicodeByteStream(byte[] origBytes, String origString, int offset, int length) { if ((origBytes == null) || (origBytes.length == 0)) { return origBytes; } int bytesLen = origBytes.length; int bufIndex = 0; int strIndex = 0; ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(bytesLen); while (true) { if (origString.charAt(strIndex) == '\\') { // write it out as-is bytesOut.write(origBytes[bufIndex++]); // bytesOut.write(origBytes[bufIndex++]); } else { // Grab the first byte int loByte = origBytes[bufIndex]; if (loByte < 0) { loByte += 256; // adjust for signedness/wrap-around } // We always write the first byte bytesOut.write(loByte); // // The codepage characters in question exist between // 0x81-0x9F and 0xE0-0xFC... // // See: // // http://www.microsoft.com/GLOBALDEV/Reference/dbcs/932.htm // // Problematic characters in GBK // // U+905C : CJK UNIFIED IDEOGRAPH // // Problematic characters in Big5 // // B9F0 = U+5C62 : CJK UNIFIED IDEOGRAPH // if (loByte >= 0x80) { if (bufIndex < (bytesLen - 1)) { int hiByte = origBytes[bufIndex + 1]; if (hiByte < 0) { hiByte += 256; // adjust for signedness/wrap-around } // write the high byte here, and increment the index // for the high byte bytesOut.write(hiByte); bufIndex++; // escape 0x5c if necessary if (hiByte == 0x5C) { bytesOut.write(hiByte); } } } else if (loByte == 0x5c) { if (bufIndex < (bytesLen - 1)) { int hiByte = origBytes[bufIndex + 1]; if (hiByte < 0) { hiByte += 256; // adjust for signedness/wrap-around } if (hiByte == 0x62) { // we need to escape the 0x5c bytesOut.write(0x5c); bytesOut.write(0x62); bufIndex++; } } } bufIndex++; } if (bufIndex >= bytesLen) { // we're done break; } strIndex++; } return bytesOut.toByteArray(); }
static byte[] function(byte[] origBytes, String origString, int offset, int length) { if ((origBytes == null) (origBytes.length == 0)) { return origBytes; } int bytesLen = origBytes.length; int bufIndex = 0; int strIndex = 0; ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(bytesLen); while (true) { if (origString.charAt(strIndex) == '\\') { bytesOut.write(origBytes[bufIndex++]); } else { int loByte = origBytes[bufIndex]; if (loByte < 0) { loByte += 256; } bytesOut.write(loByte); if (bufIndex < (bytesLen - 1)) { int hiByte = origBytes[bufIndex + 1]; if (hiByte < 0) { hiByte += 256; } bytesOut.write(hiByte); bufIndex++; if (hiByte == 0x5C) { bytesOut.write(hiByte); } } } else if (loByte == 0x5c) { if (bufIndex < (bytesLen - 1)) { int hiByte = origBytes[bufIndex + 1]; if (hiByte < 0) { hiByte += 256; } if (hiByte == 0x62) { bytesOut.write(0x5c); bytesOut.write(0x62); bufIndex++; } } } bufIndex++; } if (bufIndex >= bytesLen) { break; } strIndex++; } return bytesOut.toByteArray(); }
/** * Unfortunately, SJIS has 0x5c as a high byte in some of its double-byte * characters, so we need to escape it. * * @param origBytes the original bytes in SJIS format * @param origString the string that had .getBytes() called on it * @param offset where to start converting from * @param length how many characters to convert. * * @return byte[] with 0x5c escaped */
Unfortunately, SJIS has 0x5c as a high byte in some of its double-byte characters, so we need to escape it
escapeEasternUnicodeByteStream
{ "repo_name": "devoof/jPrinterAdmin", "path": "mysql-connector-java-5.1.23/src/com/mysql/jdbc/StringUtils.java", "license": "gpl-2.0", "size": 62879 }
[ "java.io.ByteArrayOutputStream" ]
import java.io.ByteArrayOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
604,848
protected Cursor query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) { return mDataBase.query(table, columns, selection, selectionArgs, groupBy, having, orderBy); }
Cursor function(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) { return mDataBase.query(table, columns, selection, selectionArgs, groupBy, having, orderBy); }
/** * Runs a query on the real database * * @param table table name * @param columns columns * @param selection selection * @param selectionArgs selectionargs * @param groupBy groupby * @param having having clause * @param orderBy orderby * @return cursor */
Runs a query on the real database
query
{ "repo_name": "midhunhk/ae-apps-library", "path": "modules/database-helpers/src/main/java/com/ae/apps/lib/db/CopiedDataBaseHelper.java", "license": "apache-2.0", "size": 5136 }
[ "android.database.Cursor" ]
import android.database.Cursor;
import android.database.*;
[ "android.database" ]
android.database;
2,088,853
@Override public Adapter createClassDetailsAdapter() { if (classDetailsItemProvider == null) { classDetailsItemProvider = new ClassDetailsItemProvider(this); } return classDetailsItemProvider; } protected ConversionArgumentItemProvider conversionArgumentItemProvider;
Adapter function() { if (classDetailsItemProvider == null) { classDetailsItemProvider = new ClassDetailsItemProvider(this); } return classDetailsItemProvider; } protected ConversionArgumentItemProvider conversionArgumentItemProvider;
/** * This creates an adapter for a {@link com.openMap1.mapper.ClassDetails}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>com.openMap1.mapper.ClassDetails</code>.
createClassDetailsAdapter
{ "repo_name": "openmapsoftware/mappingtools", "path": "openmap-mapper-edit/src/main/java/com/openMap1/mapper/provider/MapperItemProviderAdapterFactory.java", "license": "epl-1.0", "size": 26253 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,588,679
public Image createTintedVersion(Color color);
Image function(Color color);
/** * Creates a new image with is tinted with the specified color. * * Tinting works by multiplying the color of the image's pixels * with the specified color. * * @param color The color used for tinting. * @return a new Image object. */
Creates a new image with is tinted with the specified color. Tinting works by multiplying the color of the image's pixels with the specified color
createTintedVersion
{ "repo_name": "ColaMachine/MyBlock", "path": "src/main/java/de/matthiasmann/twl/renderer/Image.java", "license": "bsd-2-clause", "size": 3049 }
[ "de.matthiasmann.twl.Color" ]
import de.matthiasmann.twl.Color;
import de.matthiasmann.twl.*;
[ "de.matthiasmann.twl" ]
de.matthiasmann.twl;
1,610,152
@Override public Value evalConstant() { return _value; }
Value function() { return _value; }
/** * Evaluates the expression as a constant. * * @return the expression value. */
Evaluates the expression as a constant
evalConstant
{ "repo_name": "CleverCloud/Quercus", "path": "quercus/src/main/java/com/caucho/quercus/expr/LiteralStringExpr.java", "license": "gpl-2.0", "size": 3642 }
[ "com.caucho.quercus.env.Value" ]
import com.caucho.quercus.env.Value;
import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
2,270,452
public QName createQName() { return new QName(nsUri,localName); }
QName function() { return new QName(nsUri,localName); }
/** * Creates a new QName object from {@link #nsUri} and {@link #localName}. */
Creates a new QName object from <code>#nsUri</code> and <code>#localName</code>
createQName
{ "repo_name": "axDev-JDK/jaxws", "path": "src/share/jaxws_classes/com/sun/xml/internal/ws/util/QNameMap.java", "license": "gpl-2.0", "size": 14361 }
[ "javax.xml.namespace.QName" ]
import javax.xml.namespace.QName;
import javax.xml.namespace.*;
[ "javax.xml" ]
javax.xml;
997,579
void reportRemoteBadBlock(DatanodeInfo dnInfo, ExtendedBlock block) throws IOException { LocatedBlock lb = new LocatedBlock(block, new DatanodeInfo[]{dnInfo}); bpNamenode.reportBadBlocks(new LocatedBlock[]{lb}); }
void reportRemoteBadBlock(DatanodeInfo dnInfo, ExtendedBlock block) throws IOException { LocatedBlock lb = new LocatedBlock(block, new DatanodeInfo[]{dnInfo}); bpNamenode.reportBadBlocks(new LocatedBlock[]{lb}); }
/** * Report a bad block from another DN in this cluster. */
Report a bad block from another DN in this cluster
reportRemoteBadBlock
{ "repo_name": "gigaroby/hops", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java", "license": "apache-2.0", "size": 19073 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.DatanodeInfo", "org.apache.hadoop.hdfs.protocol.ExtendedBlock", "org.apache.hadoop.hdfs.protocol.LocatedBlock" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlock;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,765,331
void assertCounterGt(String name, long expected, BaseSource source);
void assertCounterGt(String name, long expected, BaseSource source);
/** * Assert that a counter exists and that it's value is greater than the given value. * * @param name The name of the counter. * @param expected The value the counter is expected to be greater than. * @param source The BaseSource{@link BaseSource} that will provide the tags, * gauges, and counters. */
Assert that a counter exists and that it's value is greater than the given value
assertCounterGt
{ "repo_name": "ultratendency/hbase", "path": "hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelper.java", "license": "apache-2.0", "size": 6630 }
[ "org.apache.hadoop.hbase.metrics.BaseSource" ]
import org.apache.hadoop.hbase.metrics.BaseSource;
import org.apache.hadoop.hbase.metrics.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
982,685
public int getRowTable(String table_name){ String countQuery = "SELECT * FROM " + table_name; db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); row = cursor.getCount(); return row; }
int function(String table_name){ String countQuery = STR + table_name; db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); row = cursor.getCount(); return row; }
/** * This method will return your total row from a table * * @param table_name : your table name * @return will return your total row from a table */
This method will return your total row from a table
getRowTable
{ "repo_name": "abangadit/sqlitehelper", "path": "SqliteHelper.java", "license": "apache-2.0", "size": 7337 }
[ "android.database.Cursor" ]
import android.database.Cursor;
import android.database.*;
[ "android.database" ]
android.database;
1,126,859
@ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<PrivateEndpointConnectionInner> listByServerAsync(String resourceGroupName, String serverName) { return new PagedFlux<>( () -> listByServerSinglePageAsync(resourceGroupName, serverName), nextLink -> listByServerNextSinglePageAsync(nextLink)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<PrivateEndpointConnectionInner> function(String resourceGroupName, String serverName) { return new PagedFlux<>( () -> listByServerSinglePageAsync(resourceGroupName, serverName), nextLink -> listByServerNextSinglePageAsync(nextLink)); }
/** * Gets all private endpoint connections on a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private endpoint connections on a server. */
Gets all private endpoint connections on a server
listByServerAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java", "license": "mit", "size": 77661 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.postgresql.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,869,072
public HidModel updateExistingGateway(String hid, UpdateGatewayModel model) { String method = "updateExistingGateway"; try { URI uri = buildUri(UPDATE_EXISTING_URL.replace("{hid}", hid)); HidModel result = execute(new HttpPut(uri), JsonUtils.toJson(model), HidModel.class); log(method, result); return result; } catch (Throwable e) { throw handleException(e); } }
HidModel function(String hid, UpdateGatewayModel model) { String method = STR; try { URI uri = buildUri(UPDATE_EXISTING_URL.replace("{hid}", hid)); HidModel result = execute(new HttpPut(uri), JsonUtils.toJson(model), HidModel.class); log(method, result); return result; } catch (Throwable e) { throw handleException(e); } }
/** * Sends PUT request to update specific existing gateway according to * {@code model} passed * * @param hid {@link String} representing {@code hid} of gateway to be updated * @param model {@link GatewayModel} representing gateway parameters to be * updated * * @return {@link HidModel} containing {@code hid} of gateway updated * * @throws AcnClientException if request failed */
Sends PUT request to update specific existing gateway according to model passed
updateExistingGateway
{ "repo_name": "arrow-acs/acn-sdk-java", "path": "acn-client/src/main/java/com/arrow/acn/client/api/GatewayApi.java", "license": "apache-2.0", "size": 14791 }
[ "com.arrow.acn.client.model.UpdateGatewayModel", "com.arrow.acs.JsonUtils", "com.arrow.acs.client.model.HidModel", "org.apache.http.client.methods.HttpPut" ]
import com.arrow.acn.client.model.UpdateGatewayModel; import com.arrow.acs.JsonUtils; import com.arrow.acs.client.model.HidModel; import org.apache.http.client.methods.HttpPut;
import com.arrow.acn.client.model.*; import com.arrow.acs.*; import com.arrow.acs.client.model.*; import org.apache.http.client.methods.*;
[ "com.arrow.acn", "com.arrow.acs", "org.apache.http" ]
com.arrow.acn; com.arrow.acs; org.apache.http;
2,704,249
public String getAliasForX509CertThumb(byte[] thumb) throws WSSecurityException;
String function(byte[] thumb) throws WSSecurityException;
/** * Lookup a X509 Certificate in the keystore according to a given * Thumbprint. * * The search gets all alias names of the keystore, then reads the certificate chain * or certificate for each alias. Then the thumbprint for each user certificate * is compared with the thumbprint parameter. * * @param thumb The SHA1 thumbprint info bytes * @return alias name of the certificate that matches the thumbprint * or null if no such certificate was found. * @throws WSSecurityException if problems during keystore handling or wrong certificate */
Lookup a X509 Certificate in the keystore according to a given Thumbprint. The search gets all alias names of the keystore, then reads the certificate chain or certificate for each alias. Then the thumbprint for each user certificate is compared with the thumbprint parameter
getAliasForX509CertThumb
{ "repo_name": "hpmtissera/wso2-wss4j", "path": "modules/wss4j/src/org/apache/ws/security/components/crypto/Crypto.java", "license": "apache-2.0", "size": 8706 }
[ "org.apache.ws.security.WSSecurityException" ]
import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.*;
[ "org.apache.ws" ]
org.apache.ws;
2,121,806
public static BrowseDAO getInstance(Context context) throws BrowseException { String db = ConfigurationManager.getProperty("db.name"); if ("postgres".equals(db)) { return new BrowseDAOPostgres(context); } else if ("oracle".equals(db)) { return new BrowseDAOOracle(context); } else { throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database"); } }
static BrowseDAO function(Context context) throws BrowseException { String db = ConfigurationManager.getProperty(STR); if (STR.equals(db)) { return new BrowseDAOPostgres(context); } else if (STR.equals(db)) { return new BrowseDAOOracle(context); } else { throw new BrowseException(STR); } }
/** * Get an instance of the relevant Read Only DAO class, which will * conform to the BrowseDAO interface * * @param context the DSpace context * @return the relevant DAO * @throws BrowseException */
Get an instance of the relevant Read Only DAO class, which will conform to the BrowseDAO interface
getInstance
{ "repo_name": "jamie-dryad/dryad-repo", "path": "dspace-api/src/main/java/org/dspace/browse/BrowseDAOFactory.java", "license": "bsd-3-clause", "size": 3295 }
[ "org.dspace.core.ConfigurationManager", "org.dspace.core.Context" ]
import org.dspace.core.ConfigurationManager; import org.dspace.core.Context;
import org.dspace.core.*;
[ "org.dspace.core" ]
org.dspace.core;
2,484,498
public void addFailure(final Test test, final AssertionFailedError t) { addFailure(test, (Throwable) t); }
void function(final Test test, final AssertionFailedError t) { addFailure(test, (Throwable) t); }
/** * Interface TestListener for JUnit &gt; 3.4. * * <p>A Test failed. * @param test the test. * @param t the assertion. */
Interface TestListener for JUnit &gt; 3.4. A Test failed
addFailure
{ "repo_name": "mourao666/cassandra-sim", "path": "test/unit/org/apache/cassandra/CassandraXMLJUnitResultFormatter.java", "license": "apache-2.0", "size": 12942 }
[ "junit.framework.AssertionFailedError", "junit.framework.Test" ]
import junit.framework.AssertionFailedError; import junit.framework.Test;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
1,319,532
public void put(CacheGroup group, Object id, Object object) { this.cacheManager.put(group.toString(), id, object); }
void function(CacheGroup group, Object id, Object object) { this.cacheManager.put(group.toString(), id, object); }
/** * Puts an object with an ID in the specified {@link CacheGroup} group parameter. * <p> * The id parameter can be used to retrieve the object from the cache. * * @param group the {@link CacheGroup} which the object should be placed in * @param id the ID of the stored object. * @param object the object that is going to be stored */
Puts an object with an ID in the specified <code>CacheGroup</code> group parameter. The id parameter can be used to retrieve the object from the cache
put
{ "repo_name": "craftfire/Bifrost", "path": "src/main/java/com/craftfire/bifrost/classes/general/Cache.java", "license": "lgpl-3.0", "size": 8406 }
[ "com.craftfire.bifrost.enums.CacheGroup" ]
import com.craftfire.bifrost.enums.CacheGroup;
import com.craftfire.bifrost.enums.*;
[ "com.craftfire.bifrost" ]
com.craftfire.bifrost;
1,414,529
public SignupMeeting getMeeting();
SignupMeeting function();
/** * get the SignupMeeting object * * @return the SignupMeeting object */
get the SignupMeeting object
getMeeting
{ "repo_name": "harfalm/Sakai-10.1", "path": "signup/api/src/java/org/sakaiproject/signup/logic/messages/SignupEventTrackingInfo.java", "license": "apache-2.0", "size": 3428 }
[ "org.sakaiproject.signup.model.SignupMeeting" ]
import org.sakaiproject.signup.model.SignupMeeting;
import org.sakaiproject.signup.model.*;
[ "org.sakaiproject.signup" ]
org.sakaiproject.signup;
139,764
public static Discount parse(String disc) { if (disc.toLowerCase().equals("log2")) { return log2(); } Matcher m = LOG_PAT.matcher(disc); if (m.matches()) { String grp = m.group(1); double base = grp != null ? Double.parseDouble(grp) : 2; return new LogDiscount(base); } m = EXP_PAT.matcher(disc); if (m.matches()) { double hl = Double.parseDouble(m.group(1)); return new ExponentialDiscount(hl); } throw new IllegalArgumentException("invalid discount specification " + disc); }
static Discount function(String disc) { if (disc.toLowerCase().equals("log2")) { return log2(); } Matcher m = LOG_PAT.matcher(disc); if (m.matches()) { String grp = m.group(1); double base = grp != null ? Double.parseDouble(grp) : 2; return new LogDiscount(base); } m = EXP_PAT.matcher(disc); if (m.matches()) { double hl = Double.parseDouble(m.group(1)); return new ExponentialDiscount(hl); } throw new IllegalArgumentException(STR + disc); }
/** * Parse a discount expression from a string. * @param disc The discount string. * @return The discount. */
Parse a discount expression from a string
parse
{ "repo_name": "amaliujia/lenskit", "path": "lenskit-eval/src/main/java/org/lenskit/eval/traintest/metrics/Discounts.java", "license": "lgpl-2.1", "size": 2840 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,546,852
static void record(ContextMenuParams params, int action) { assert action >= 0; assert action < NUM_ACTIONS; String histogramName; if (params.isVideo()) { histogramName = "ContextMenu.SelectedOption.Video"; } else if (params.isImage()) { histogramName = params.isAnchor() ? "ContextMenu.SelectedOption.ImageLink" : "ContextMenu.SelectedOption.Image"; } else { assert params.isAnchor(); histogramName = "ContextMenu.SelectedOption.Link"; } RecordHistogram.recordEnumeratedHistogram(histogramName, action, NUM_ACTIONS); } } public ChromeContextMenuPopulator(ChromeContextMenuItemDelegate delegate) { mDelegate = delegate; }
static void record(ContextMenuParams params, int action) { assert action >= 0; assert action < NUM_ACTIONS; String histogramName; if (params.isVideo()) { histogramName = STR; } else if (params.isImage()) { histogramName = params.isAnchor() ? STR : STR; } else { assert params.isAnchor(); histogramName = STR; } RecordHistogram.recordEnumeratedHistogram(histogramName, action, NUM_ACTIONS); } } public ChromeContextMenuPopulator(ChromeContextMenuItemDelegate delegate) { mDelegate = delegate; }
/** * Records a histogram entry when the user selects an item from a context menu. * @param params The ContextMenuParams describing the current context menu. * @param action The action that the user selected (e.g. ACTION_SAVE_IMAGE). */
Records a histogram entry when the user selects an item from a context menu
record
{ "repo_name": "TheTypoMaster/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java", "license": "bsd-3-clause", "size": 13896 }
[ "org.chromium.base.metrics.RecordHistogram" ]
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.*;
[ "org.chromium.base" ]
org.chromium.base;
914,058
public static boolean exists(final File file) throws SecurityException { if (file == null) { throw new IllegalArgumentException("file cannot be <null>"); }
static boolean function(final File file) throws SecurityException { if (file == null) { throw new IllegalArgumentException(STR); }
/** * Check if the file exists. * * @return {@code true} if file exists, {@code false} otherwise * @throws SecurityException if the required permissions to read the file, * or the path it is in, are missing * @see File#exists */
Check if the file exists
exists
{ "repo_name": "trejkaz/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java", "license": "apache-2.0", "size": 19681 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,091,517
private SecretKey t12DeriveKey(String algorithm, AlgorithmParameterSpec params) throws IOException { try { KeyAgreement ka = KeyAgreement.getInstance(algorithmName); ka.init(localPrivateKey); ka.doPhase(peerPublicKey, true); SecretKey preMasterSecret = ka.generateSecret("TlsPremasterSecret"); SSLMasterKeyDerivation mskd = SSLMasterKeyDerivation.valueOf( context.negotiatedProtocol); if (mskd == null) { // unlikely throw new SSLHandshakeException( "No expected master key derivation for protocol: " + context.negotiatedProtocol.name); } SSLKeyDerivation kd = mskd.createKeyDerivation( context, preMasterSecret); return kd.deriveKey("MasterSecret", params); } catch (GeneralSecurityException gse) { throw (SSLHandshakeException) new SSLHandshakeException( "Could not generate secret").initCause(gse); } }
SecretKey function(String algorithm, AlgorithmParameterSpec params) throws IOException { try { KeyAgreement ka = KeyAgreement.getInstance(algorithmName); ka.init(localPrivateKey); ka.doPhase(peerPublicKey, true); SecretKey preMasterSecret = ka.generateSecret(STR); SSLMasterKeyDerivation mskd = SSLMasterKeyDerivation.valueOf( context.negotiatedProtocol); if (mskd == null) { throw new SSLHandshakeException( STR + context.negotiatedProtocol.name); } SSLKeyDerivation kd = mskd.createKeyDerivation( context, preMasterSecret); return kd.deriveKey(STR, params); } catch (GeneralSecurityException gse) { throw (SSLHandshakeException) new SSLHandshakeException( STR).initCause(gse); } }
/** * Handle the TLSv1-1.2 objects, which don't use the HKDF algorithms. */
Handle the TLSv1-1.2 objects, which don't use the HKDF algorithms
t12DeriveKey
{ "repo_name": "md-5/jdk10", "path": "src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java", "license": "gpl-2.0", "size": 5383 }
[ "java.io.IOException", "java.security.GeneralSecurityException", "java.security.spec.AlgorithmParameterSpec", "javax.crypto.KeyAgreement", "javax.crypto.SecretKey", "javax.net.ssl.SSLHandshakeException" ]
import java.io.IOException; import java.security.GeneralSecurityException; import java.security.spec.AlgorithmParameterSpec; import javax.crypto.KeyAgreement; import javax.crypto.SecretKey; import javax.net.ssl.SSLHandshakeException;
import java.io.*; import java.security.*; import java.security.spec.*; import javax.crypto.*; import javax.net.ssl.*;
[ "java.io", "java.security", "javax.crypto", "javax.net" ]
java.io; java.security; javax.crypto; javax.net;
1,403,983
String location = String.format("System/Library/Frameworks/%s.framework", name); FileReference reference = FileReference.of(location, SourceTree.SDKROOT).withExplicitFileType(FRAMEWORK_FILE_TYPE); fileReferences.add(reference); return this; }
String location = String.format(STR, name); FileReference reference = FileReference.of(location, SourceTree.SDKROOT).withExplicitFileType(FRAMEWORK_FILE_TYPE); fileReferences.add(reference); return this; }
/** * Creates a new SDK framework based on the passed name. * * @param name simple framework name without ".framework" suffix, e.g. "Foundation" */
Creates a new SDK framework based on the passed name
addSdkFramework
{ "repo_name": "juhalindfors/bazel-patches", "path": "src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/LibraryObjects.java", "license": "apache-2.0", "size": 4633 }
[ "com.facebook.buck.apple.xcode.xcodeproj.PBXReference" ]
import com.facebook.buck.apple.xcode.xcodeproj.PBXReference;
import com.facebook.buck.apple.xcode.xcodeproj.*;
[ "com.facebook.buck" ]
com.facebook.buck;
82,639
public boolean addNewCompanyProfile(final CompanyProfile companyProfile);
boolean function(final CompanyProfile companyProfile);
/** * Save a new CompanyProfile record * @param companyProfile CompanyProfile record * @return */
Save a new CompanyProfile record
addNewCompanyProfile
{ "repo_name": "marktriggs/nyu-sakai-10.4", "path": "profile2/impl/src/java/org/sakaiproject/profile2/dao/ProfileDao.java", "license": "apache-2.0", "size": 19837 }
[ "org.sakaiproject.profile2.model.CompanyProfile" ]
import org.sakaiproject.profile2.model.CompanyProfile;
import org.sakaiproject.profile2.model.*;
[ "org.sakaiproject.profile2" ]
org.sakaiproject.profile2;
1,180,418
public void start() throws LifecycleException { // Validate and update our current component state if (started) throw new LifecycleException (sm.getString("realmBase.alreadyStarted")); lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; // Create a MessageDigest instance for credentials, if desired if (digest != null) { try { md = MessageDigest.getInstance(digest); } catch (NoSuchAlgorithmException e) { throw new LifecycleException (sm.getString("realmBase.algorithm", digest), e); } } }
void function() throws LifecycleException { if (started) throw new LifecycleException (sm.getString(STR)); lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; if (digest != null) { try { md = MessageDigest.getInstance(digest); } catch (NoSuchAlgorithmException e) { throw new LifecycleException (sm.getString(STR, digest), e); } } }
/** * Prepare for the beginning of active use of the public methods of this * component. This method should be called before any of the public * methods of this component are utilized. It should also send a * LifecycleEvent of type START_EVENT to any registered listeners. * * @throws LifecycleException if this component detects a fatal error * that prevents this component from being used */
Prepare for the beginning of active use of the public methods of this component. This method should be called before any of the public methods of this component are utilized. It should also send a LifecycleEvent of type START_EVENT to any registered listeners
start
{ "repo_name": "NorthFacing/step-by-Java", "path": "fra-tomcat/fra-tomcat-analysis/source/book01/HowTomcatWorks/src/org/apache/catalina/realm/RealmBase.java", "license": "gpl-2.0", "size": 20806 }
[ "java.security.MessageDigest", "java.security.NoSuchAlgorithmException", "org.apache.catalina.LifecycleException" ]
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.apache.catalina.LifecycleException;
import java.security.*; import org.apache.catalina.*;
[ "java.security", "org.apache.catalina" ]
java.security; org.apache.catalina;
700,387
public static ExertionEnvelop getTemplate(Uuid exertionID, String providerName) { ExertionEnvelop ee = getTemplate(); ee.exertionID = exertionID; ee.providerName = providerName; return ee; }
static ExertionEnvelop function(Uuid exertionID, String providerName) { ExertionEnvelop ee = getTemplate(); ee.exertionID = exertionID; ee.providerName = providerName; return ee; }
/** * Create a template for mograms. * * @param exertionID * @param providerName * @return */
Create a template for mograms
getTemplate
{ "repo_name": "mwsobol/SORCER", "path": "core/sorcer-platform/src/main/java/sorcer/core/exertion/ExertionEnvelop.java", "license": "apache-2.0", "size": 5430 }
[ "net.jini.id.Uuid" ]
import net.jini.id.Uuid;
import net.jini.id.*;
[ "net.jini.id" ]
net.jini.id;
1,534,277
public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException, IllegalStateException { if (tc.isEntryEnabled()) Tr.entry(tc, "enlistResource", xaRes); // Determine if we are attempting to enlist a second resource within a transaction // that can't support 2PC anyway. if (_disableTwoPhase && (_resourceObjects.size() > 0)) { final String msg = "Unable to enlist a second resource within the transaction. Two phase support is disabled " + "as the recovery log was not available at transaction start"; final IllegalStateException ise = new IllegalStateException(msg); if (tc.isEntryEnabled()) Tr.exit(tc, "enlistResource", new Object[] { "(SPI)", ise }); throw ise; } // Create the resource wrapper and see if it already exists in the table OnePhaseResourceImpl jtaRes = new OnePhaseResourceImpl((OnePhaseXAResource) xaRes, _txServiceXid); boolean register = true; // See if any other resource has been enlisted // Allow 1PC and 2PC to be enlisted, it will be rejected at prepare time if LPS is not enabled // Reject multiple 1PC enlistments if (_onePhaseResourceEnlisted != null) { if (_onePhaseResourceEnlisted.equals(jtaRes)) { register = false; jtaRes = _onePhaseResourceEnlisted; } else { Tr.error(tc, "WTRN0062_ILLEGAL_ENLIST_FOR_MULTIPLE_1PC_RESOURCES"); final String msg = "Illegal attempt to enlist multiple 1PC XAResources"; final IllegalStateException ise = new IllegalStateException(msg); // FFDC in TransactionImpl if (tc.isEntryEnabled()) Tr.exit(tc, "enlistResource", new Object[] { "(SPI)", ise }); throw ise; } } // // start association of Resource object and register if first time with JTA // and record that a 1PC resource has now been registered with the transaction. // try { this.startRes(jtaRes); if (register) { jtaRes.setResourceStatus(StatefulResource.REGISTERED); // This is 1PC then we need to insert at element 0 // of the list so we can ensure it is processed last // at completion time. _resourceObjects.add(0, jtaRes); // Check and update LPS enablement state for the application - LIDB1673.22 checkLPSEnablement(); if (tc.isEventEnabled()) Tr.event(tc, "(SPI) RESOURCE registered with Transaction. TX: " + _transaction.getLocalTID() + ", Resource: " + jtaRes); _onePhaseResourceEnlisted = jtaRes; } } catch (RollbackException rbe) { FFDCFilter.processException(rbe, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "480", this); if (tc.isEntryEnabled()) Tr.exit(tc, "enlistResource", rbe); throw rbe; } catch (SystemException se) { FFDCFilter.processException(se, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "487", this); if (tc.isEntryEnabled()) Tr.exit(tc, "enlistResource", se); throw se; } if (tc.isEntryEnabled()) Tr.exit(tc, "enlistResource", Boolean.TRUE); return true; }
boolean function(XAResource xaRes) throws RollbackException, SystemException, IllegalStateException { if (tc.isEntryEnabled()) Tr.entry(tc, STR, xaRes); if (_disableTwoPhase && (_resourceObjects.size() > 0)) { final String msg = STR + STR; final IllegalStateException ise = new IllegalStateException(msg); if (tc.isEntryEnabled()) Tr.exit(tc, STR, new Object[] { "(SPI)", ise }); throw ise; } OnePhaseResourceImpl jtaRes = new OnePhaseResourceImpl((OnePhaseXAResource) xaRes, _txServiceXid); boolean register = true; if (_onePhaseResourceEnlisted != null) { if (_onePhaseResourceEnlisted.equals(jtaRes)) { register = false; jtaRes = _onePhaseResourceEnlisted; } else { Tr.error(tc, STR); final String msg = STR; final IllegalStateException ise = new IllegalStateException(msg); if (tc.isEntryEnabled()) Tr.exit(tc, STR, new Object[] { "(SPI)", ise }); throw ise; } } this.startRes(jtaRes); if (register) { jtaRes.setResourceStatus(StatefulResource.REGISTERED); _resourceObjects.add(0, jtaRes); checkLPSEnablement(); if (tc.isEventEnabled()) Tr.event(tc, STR + _transaction.getLocalTID() + STR + jtaRes); _onePhaseResourceEnlisted = jtaRes; } } catch (RollbackException rbe) { FFDCFilter.processException(rbe, STR, "480", this); if (tc.isEntryEnabled()) Tr.exit(tc, STR, rbe); throw rbe; } catch (SystemException se) { FFDCFilter.processException(se, STR, "487", this); if (tc.isEntryEnabled()) Tr.exit(tc, STR, se); throw se; } if (tc.isEntryEnabled()) Tr.exit(tc, STR, Boolean.TRUE); return true; }
/** * Attempts to add a one-Phase XA Resource to this unit of work. * * @param xaRes The XAResource to add to this unit of work * * @return true if the resource was added, false if not. * * @throws RollbackException if enlistment fails * @throws SystemException if unexpected error occurs */
Attempts to add a one-Phase XA Resource to this unit of work
enlistResource
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java", "license": "epl-1.0", "size": 124704 }
[ "com.ibm.tx.jta.OnePhaseXAResource", "com.ibm.websphere.ras.Tr", "com.ibm.ws.Transaction", "com.ibm.ws.ffdc.FFDCFilter", "javax.transaction.RollbackException", "javax.transaction.SystemException", "javax.transaction.xa.XAResource" ]
import com.ibm.tx.jta.OnePhaseXAResource; import com.ibm.websphere.ras.Tr; import com.ibm.ws.Transaction; import com.ibm.ws.ffdc.FFDCFilter; import javax.transaction.RollbackException; import javax.transaction.SystemException; import javax.transaction.xa.XAResource;
import com.ibm.tx.jta.*; import com.ibm.websphere.ras.*; import com.ibm.ws.*; import com.ibm.ws.ffdc.*; import javax.transaction.*; import javax.transaction.xa.*;
[ "com.ibm.tx", "com.ibm.websphere", "com.ibm.ws", "javax.transaction" ]
com.ibm.tx; com.ibm.websphere; com.ibm.ws; javax.transaction;
929,990
public Fop newFop(String outputFormat, OutputStream stream) throws FOPException { return newFOUserAgent().newFop(outputFormat, stream); }
Fop function(String outputFormat, OutputStream stream) throws FOPException { return newFOUserAgent().newFop(outputFormat, stream); }
/** * Returns a new {@link Fop} instance. FOP will be configured with a default user agent * instance. Use this factory method if your output type requires an output stream. * <p> * MIME types are used to select the output format (ex. "application/pdf" for PDF). You can * use the constants defined in {@link MimeConstants}. * @param outputFormat the MIME type of the output format to use (ex. "application/pdf"). * @param stream the output stream * @return the new Fop instance * @throws FOPException when the constructor fails */
Returns a new <code>Fop</code> instance. FOP will be configured with a default user agent instance. Use this factory method if your output type requires an output stream. MIME types are used to select the output format (ex. "application/pdf" for PDF). You can use the constants defined in <code>MimeConstants</code>
newFop
{ "repo_name": "apache/fop", "path": "fop-core/src/main/java/org/apache/fop/apps/FopFactory.java", "license": "apache-2.0", "size": 17647 }
[ "java.io.OutputStream" ]
import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,680,942
static BooleanLiteralSet getBooleanOutcomes(BooleanLiteralSet left, BooleanLiteralSet right, boolean condition) { return right.union(left.intersection(BooleanLiteralSet.get(!condition))); } private final class BooleanOutcomePair { final BooleanLiteralSet toBooleanOutcomes; final BooleanLiteralSet booleanValues; // The scope if only half of the expression executed, when applicable. final FlowScope leftScope; // The scope when the whole expression executed. final FlowScope rightScope; // The scope when we don't know how much of the expression is executed. FlowScope joinedScope = null; BooleanOutcomePair( BooleanLiteralSet toBooleanOutcomes, BooleanLiteralSet booleanValues, FlowScope leftScope, FlowScope rightScope) { this.toBooleanOutcomes = toBooleanOutcomes; this.booleanValues = booleanValues; this.leftScope = leftScope; this.rightScope = rightScope; }
static BooleanLiteralSet getBooleanOutcomes(BooleanLiteralSet left, BooleanLiteralSet right, boolean condition) { return right.union(left.intersection(BooleanLiteralSet.get(!condition))); } private final class BooleanOutcomePair { final BooleanLiteralSet toBooleanOutcomes; final BooleanLiteralSet booleanValues; final FlowScope leftScope; final FlowScope rightScope; FlowScope joinedScope = null; BooleanOutcomePair( BooleanLiteralSet toBooleanOutcomes, BooleanLiteralSet booleanValues, FlowScope leftScope, FlowScope rightScope) { this.toBooleanOutcomes = toBooleanOutcomes; this.booleanValues = booleanValues; this.leftScope = leftScope; this.rightScope = rightScope; }
/** * Infers the boolean literal set that can be taken by a * short-circuiting binary operation ({@code &&} or {@code ||}). * @param left the set of possible {@code ToBoolean} predicate results for * the expression on the left side of the operator * @param right the set of possible {@code ToBoolean} predicate results for * the expression on the right side of the operator * @param condition the left side {@code ToBoolean} predicate result that * causes the right side to get evaluated (i.e. not short-circuited) * @return a set of possible {@code ToBoolean} predicate results for the * entire expression */
Infers the boolean literal set that can be taken by a short-circuiting binary operation (&& or ||)
getBooleanOutcomes
{ "repo_name": "h4ck3rm1k3/javascript-closure-compiler-git", "path": "src/com/google/javascript/jscomp/TypeInference.java", "license": "apache-2.0", "size": 52310 }
[ "com.google.javascript.jscomp.type.FlowScope", "com.google.javascript.rhino.jstype.BooleanLiteralSet" ]
import com.google.javascript.jscomp.type.FlowScope; import com.google.javascript.rhino.jstype.BooleanLiteralSet;
import com.google.javascript.jscomp.type.*; import com.google.javascript.rhino.jstype.*;
[ "com.google.javascript" ]
com.google.javascript;
1,732,261
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { if(request.getParameter("view")!=null){ HttpSession session = request.getSession(); int pk_user = 0; if(session.getAttribute("pk_user")!=null){ pk_user=Integer.parseInt(session.getAttribute("pk_user").toString()); } JSONObject settings2 = new JSONObject(); ArrayList<menuModel> listGroup=new menuControl().groupItemsMenu(pk_user); if(listGroup.size()>0){ for (menuModel list1 : listGroup) { JSONArray principal2 = new JSONArray(); ArrayList<menuModel> list=new menuControl().selectItemsMenu(pk_user, list1.getFl_section()); for (menuModel list2 : list) { JSONObject data = new JSONObject(); data.put("id", list2.getPk_item_menu()); data.put("parentid", list2.getFk_item_parent()); data.put("text", "<span data-indextree='"+list1.getFl_section()+"'>"+list2.getFl_text()+"</span>"); data.put("icon", list2.getFl_icon()); data.put("expanded", list2.getFl_expanded()); principal2.add(data); } settings2.put(list1.getFl_section(),principal2); } settings2.put("length",listGroup.size()); } response.setContentType("application/json"); out.print(settings2); out.flush(); out.close(); } } }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(STR); try (PrintWriter out = response.getWriter()) { if(request.getParameter("view")!=null){ HttpSession session = request.getSession(); int pk_user = 0; if(session.getAttribute(STR)!=null){ pk_user=Integer.parseInt(session.getAttribute(STR).toString()); } JSONObject settings2 = new JSONObject(); ArrayList<menuModel> listGroup=new menuControl().groupItemsMenu(pk_user); if(listGroup.size()>0){ for (menuModel list1 : listGroup) { JSONArray principal2 = new JSONArray(); ArrayList<menuModel> list=new menuControl().selectItemsMenu(pk_user, list1.getFl_section()); for (menuModel list2 : list) { JSONObject data = new JSONObject(); data.put("id", list2.getPk_item_menu()); data.put(STR, list2.getFk_item_parent()); data.put("text", STR+list1.getFl_section()+"'>"+list2.getFl_text()+STR); data.put("icon", list2.getFl_icon()); data.put(STR, list2.getFl_expanded()); principal2.add(data); } settings2.put(list1.getFl_section(),principal2); } settings2.put(STR,listGroup.size()); } response.setContentType(STR); out.print(settings2); out.flush(); out.close(); } } }
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods
processRequest
{ "repo_name": "CaehLabControl/ClientManager", "path": "src/java/services/menuServices.java", "license": "gpl-2.0", "size": 4568 }
[ "java.io.IOException", "java.io.PrintWriter", "java.util.ArrayList", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "javax.servlet.http.HttpSession", "org.json.simple.JSONArray", "org.json.simple.JSONObject" ]
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.json.simple.JSONArray; import org.json.simple.JSONObject;
import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.json.simple.*;
[ "java.io", "java.util", "javax.servlet", "org.json.simple" ]
java.io; java.util; javax.servlet; org.json.simple;
1,679,576