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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
List<SemanticMacro> l = new ArrayList<SemanticMacro>();
SAXBuilder builder = new SAXBuilder();
try {
Document doc = builder.build(url.openStream());
Element root = doc.getRootElement();
if (root.getName() == "semmacros") {
List<Element> macros = root.getChildren("defmacro");
for (Element m : macros) {
String longname = m.getAttributeValue("longname");
String shortname = m.getAttributeValue("shortname");
Formula f = new Formula();
f.parseXML(m.getChild("rmrsincrement"));
SemanticMacro newMacro = new SemanticMacro(shortname, longname, f);
l.add(newMacro);
}
}
} catch (IOException e) {
System.out.println(e);
} catch (JDOMException e) {
System.out.println(e);
}
return l;
} | List<SemanticMacro> l = new ArrayList<SemanticMacro>(); SAXBuilder builder = new SAXBuilder(); try { Document doc = builder.build(url.openStream()); Element root = doc.getRootElement(); if (root.getName() == STR) { List<Element> macros = root.getChildren(STR); for (Element m : macros) { String longname = m.getAttributeValue(STR); String shortname = m.getAttributeValue(STR); Formula f = new Formula(); f.parseXML(m.getChild(STR)); SemanticMacro newMacro = new SemanticMacro(shortname, longname, f); l.add(newMacro); } } } catch (IOException e) { System.out.println(e); } catch (JDOMException e) { System.out.println(e); } return l; } | /**
* Loads a xml specification of semantic macros from a given url.
* @param url the specified url of the xml to load
* @return the list of semantic macros
*/ | Loads a xml specification of semantic macros from a given url | loadMacros | {
"repo_name": "ONatalia/Masterarbeit",
"path": "src/inpro/irmrsc/util/RMRSLoader.java",
"license": "bsd-2-clause",
"size": 4075
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.jdom.Document",
"org.jdom.Element",
"org.jdom.JDOMException",
"org.jdom.input.SAXBuilder"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; | import java.io.*; import java.util.*; import org.jdom.*; import org.jdom.input.*; | [
"java.io",
"java.util",
"org.jdom",
"org.jdom.input"
] | java.io; java.util; org.jdom; org.jdom.input; | 2,055,557 |
try {
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(givenDate);
givenDate = getGenericDateAsStringRepresentation(date, GERMAN_DATE_PATTERN);
} catch (Exception e) {
Log.e(Dates.class.getSimpleName(), "could not parse date to german representation");
}
return givenDate;
} | try { Date date = new SimpleDateFormat(STR).parse(givenDate); givenDate = getGenericDateAsStringRepresentation(date, GERMAN_DATE_PATTERN); } catch (Exception e) { Log.e(Dates.class.getSimpleName(), STR); } return givenDate; } | /**
* Transforms a date string to the german date string representation
*
* @param givenDate the date to transform
* @return a german string representation of the given date
*/ | Transforms a date string to the german date string representation | getGermanDateByDateString | {
"repo_name": "lidox/nccn-distress-thermometer",
"path": "NCCN/app/src/main/java/com/artursworld/nccn/controller/util/Dates.java",
"license": "mit",
"size": 2681
} | [
"android.util.Log",
"java.text.SimpleDateFormat",
"java.util.Date"
] | import android.util.Log; import java.text.SimpleDateFormat; import java.util.Date; | import android.util.*; import java.text.*; import java.util.*; | [
"android.util",
"java.text",
"java.util"
] | android.util; java.text; java.util; | 145,520 |
public void train(TaggedWord tw, int loc, double weight) {
IntTaggedWord iTW =
new IntTaggedWord(tw.word(), tw.tag(), wordIndex, tagIndex);
IntTaggedWord iT = new IntTaggedWord(nullWord, iTW.tag);
IntTaggedWord iW = new IntTaggedWord(iTW.word, nullTag);
seenCounter.incrementCount(iW, weight);
IntTaggedWord i = NULL_ITW;
if (treesRead > indexToStartUnkCounting) {
// start doing this once some way through trees;
// treesRead is 1 based counting
if (seenCounter.getCount(iW) < 2) {
// it's an entirely unknown word
int s = model.getSignatureIndex(iTW.word, loc,
wordIndex.get(iTW.word));
IntTaggedWord iTS = new IntTaggedWord(s, iTW.tag);
IntTaggedWord iS = new IntTaggedWord(s, nullTag);
unSeenCounter.incrementCount(iTS, weight);
unSeenCounter.incrementCount(iT, weight);
unSeenCounter.incrementCount(iS, weight);
unSeenCounter.incrementCount(i, weight);
}
}
} | void function(TaggedWord tw, int loc, double weight) { IntTaggedWord iTW = new IntTaggedWord(tw.word(), tw.tag(), wordIndex, tagIndex); IntTaggedWord iT = new IntTaggedWord(nullWord, iTW.tag); IntTaggedWord iW = new IntTaggedWord(iTW.word, nullTag); seenCounter.incrementCount(iW, weight); IntTaggedWord i = NULL_ITW; if (treesRead > indexToStartUnkCounting) { if (seenCounter.getCount(iW) < 2) { int s = model.getSignatureIndex(iTW.word, loc, wordIndex.get(iTW.word)); IntTaggedWord iTS = new IntTaggedWord(s, iTW.tag); IntTaggedWord iS = new IntTaggedWord(s, nullTag); unSeenCounter.incrementCount(iTS, weight); unSeenCounter.incrementCount(iT, weight); unSeenCounter.incrementCount(iS, weight); unSeenCounter.incrementCount(i, weight); } } } | /**
* Trains this lexicon on the Collection of trees.
*/ | Trains this lexicon on the Collection of trees | train | {
"repo_name": "hbbpb/stanford-corenlp-gv",
"path": "src/edu/stanford/nlp/parser/lexparser/FrenchUnknownWordModelTrainer.java",
"license": "gpl-2.0",
"size": 2906
} | [
"edu.stanford.nlp.ling.TaggedWord"
] | import edu.stanford.nlp.ling.TaggedWord; | import edu.stanford.nlp.ling.*; | [
"edu.stanford.nlp"
] | edu.stanford.nlp; | 1,499,003 |
public java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI> getSubterm_lists_AppendHLAPI(){
java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.lists.impl.AppendImpl.class)){
retour.add(new fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI(
(fr.lip6.move.pnml.hlpn.lists.Append)elemnt
));
}
}
return retour;
}
| java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.lists.impl.AppendImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.lists.hlapi.AppendHLAPI( (fr.lip6.move.pnml.hlpn.lists.Append)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of AppendHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of AppendHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_lists_AppendHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/lists/hlapi/EmptyListHLAPI.java",
"license": "epl-1.0",
"size": 113924
} | [
"fr.lip6.move.pnml.hlpn.terms.Term",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 5,425 |
protected String getTranslatedFile(String fileName) throws IOException {
File f = new File(tempDir, fileName);
assertTrue(fileName + " not generated", f.exists());
return Files.toString(f, Options.getCharset());
} | String function(String fileName) throws IOException { File f = new File(tempDir, fileName); assertTrue(fileName + STR, f.exists()); return Files.toString(f, Options.getCharset()); } | /**
* Return the contents of a previously translated file, made by a call to
* {@link #translateMethod} above.
*/ | Return the contents of a previously translated file, made by a call to <code>#translateMethod</code> above | getTranslatedFile | {
"repo_name": "androiddream/j2objc",
"path": "translator/src/test/java/com/google/devtools/j2objc/GenerationTest.java",
"license": "apache-2.0",
"size": 18160
} | [
"com.google.common.io.Files",
"java.io.File",
"java.io.IOException"
] | import com.google.common.io.Files; import java.io.File; import java.io.IOException; | import com.google.common.io.*; import java.io.*; | [
"com.google.common",
"java.io"
] | com.google.common; java.io; | 2,770,586 |
Collection<Warning> getWarnings(); | Collection<Warning> getWarnings(); | /**
* Get the {@link Collection} of warnings.
*/ | Get the <code>Collection</code> of warnings | getWarnings | {
"repo_name": "forcedotcom/aura",
"path": "aura/src/main/java/org/auraframework/validation/ErrorAccumulator.java",
"license": "apache-2.0",
"size": 1803
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 731,611 |
public PrivateLinkServiceConnection withGroupIds(List<String> groupIds) {
if (this.innerProperties() == null) {
this.innerProperties = new PrivateLinkServiceConnectionProperties();
}
this.innerProperties().withGroupIds(groupIds);
return this;
} | PrivateLinkServiceConnection function(List<String> groupIds) { if (this.innerProperties() == null) { this.innerProperties = new PrivateLinkServiceConnectionProperties(); } this.innerProperties().withGroupIds(groupIds); return this; } | /**
* Set the groupIds property: The ID(s) of the group(s) obtained from the remote resource that this private endpoint
* should connect to.
*
* @param groupIds the groupIds value to set.
* @return the PrivateLinkServiceConnection object itself.
*/ | Set the groupIds property: The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to | withGroupIds | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/PrivateLinkServiceConnection.java",
"license": "mit",
"size": 7601
} | [
"com.azure.resourcemanager.network.fluent.models.PrivateLinkServiceConnectionProperties",
"java.util.List"
] | import com.azure.resourcemanager.network.fluent.models.PrivateLinkServiceConnectionProperties; import java.util.List; | import com.azure.resourcemanager.network.fluent.models.*; import java.util.*; | [
"com.azure.resourcemanager",
"java.util"
] | com.azure.resourcemanager; java.util; | 651,355 |
public void testSetClasspath() throws SQLException
{
setDBClasspath("EMC.MAIL_APP");
// Test we don't need a re-boot to see the new classes.
CallableStatement cs = prepareCall("CALL EMC.ADDCONTACT(?, ?)");
cs.setInt(1, 0);
cs.setString(2, "now@classpathchange.com");
cs.executeUpdate();
cs.close();
derby2035Workaround();
} | void function() throws SQLException { setDBClasspath(STR); CallableStatement cs = prepareCall(STR); cs.setInt(1, 0); cs.setString(2, STR); cs.executeUpdate(); cs.close(); derby2035Workaround(); } | /**
* Set the classpath to include the MAIL_APP jar.
* @throws SQLException
*/ | Set the classpath to include the MAIL_APP jar | testSetClasspath | {
"repo_name": "kavin256/Derby",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java",
"license": "apache-2.0",
"size": 46217
} | [
"java.sql.CallableStatement",
"java.sql.SQLException"
] | import java.sql.CallableStatement; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,382,028 |
public SerialMessage getMessage(MeterScale meterScale) {
logger.debug("NODE {}: Creating new message for application command METER_GET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData,
SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(), (byte) METER_GET,
(byte) (meterScale.getScale() << 3) };
result.setMessagePayload(newPayload);
return result;
} | SerialMessage function(MeterScale meterScale) { logger.debug(STR, this.getNode().getNodeId()); SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get); byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(), (byte) METER_GET, (byte) (meterScale.getScale() << 3) }; result.setMessagePayload(newPayload); return result; } | /**
* Gets a SerialMessage with the METER_GET command
*
* @return the serial message
*/ | Gets a SerialMessage with the METER_GET command | getMessage | {
"repo_name": "idserda/openhab",
"path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMeterCommandClass.java",
"license": "epl-1.0",
"size": 22749
} | [
"org.openhab.binding.zwave.internal.protocol.SerialMessage"
] | import org.openhab.binding.zwave.internal.protocol.SerialMessage; | import org.openhab.binding.zwave.internal.protocol.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 788,421 |
@Test(timeout = 120000)
public void testDelegationToken() throws Exception {
UserGroupInformation.createRemoteUser("JobTracker");
DistributedFileSystem dfs = cluster.getFileSystem();
KeyProvider keyProvider = Mockito.mock(KeyProvider.class,
withSettings().extraInterfaces(
DelegationTokenExtension.class,
CryptoExtension.class));
Mockito.when(keyProvider.getConf()).thenReturn(conf);
byte[] testIdentifier = "Test identifier for delegation token".getBytes();
Token<?> testToken = new Token(testIdentifier, new byte[0],
new Text(), new Text());
Mockito.when(((DelegationTokenExtension)keyProvider).
addDelegationTokens(anyString(), (Credentials)any())).
thenReturn(new Token<?>[] { testToken });
dfs.getClient().setKeyProvider(keyProvider);
Credentials creds = new Credentials();
final Token<?> tokens[] = dfs.addDelegationTokens("JobTracker", creds);
DistributedFileSystem.LOG.debug("Delegation tokens: " +
Arrays.asList(tokens));
Assert.assertEquals(2, tokens.length);
Assert.assertEquals(tokens[1], testToken);
Assert.assertEquals(1, creds.numberOfTokens());
} | @Test(timeout = 120000) void function() throws Exception { UserGroupInformation.createRemoteUser(STR); DistributedFileSystem dfs = cluster.getFileSystem(); KeyProvider keyProvider = Mockito.mock(KeyProvider.class, withSettings().extraInterfaces( DelegationTokenExtension.class, CryptoExtension.class)); Mockito.when(keyProvider.getConf()).thenReturn(conf); byte[] testIdentifier = STR.getBytes(); Token<?> testToken = new Token(testIdentifier, new byte[0], new Text(), new Text()); Mockito.when(((DelegationTokenExtension)keyProvider). addDelegationTokens(anyString(), (Credentials)any())). thenReturn(new Token<?>[] { testToken }); dfs.getClient().setKeyProvider(keyProvider); Credentials creds = new Credentials(); final Token<?> tokens[] = dfs.addDelegationTokens(STR, creds); DistributedFileSystem.LOG.debug(STR + Arrays.asList(tokens)); Assert.assertEquals(2, tokens.length); Assert.assertEquals(tokens[1], testToken); Assert.assertEquals(1, creds.numberOfTokens()); } | /**
* Tests obtaining delegation token from stored key
*/ | Tests obtaining delegation token from stored key | testDelegationToken | {
"repo_name": "wankunde/cloudera_hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java",
"license": "apache-2.0",
"size": 51631
} | [
"java.util.Arrays",
"org.apache.hadoop.crypto.key.KeyProvider",
"org.apache.hadoop.crypto.key.KeyProviderCryptoExtension",
"org.apache.hadoop.crypto.key.KeyProviderDelegationTokenExtension",
"org.apache.hadoop.io.Text",
"org.apache.hadoop.security.Credentials",
"org.apache.hadoop.security.UserGroupInformation",
"org.apache.hadoop.security.token.Token",
"org.junit.Assert",
"org.junit.Test",
"org.mockito.Mockito"
] | import java.util.Arrays; import org.apache.hadoop.crypto.key.KeyProvider; import org.apache.hadoop.crypto.key.KeyProviderCryptoExtension; import org.apache.hadoop.crypto.key.KeyProviderDelegationTokenExtension; import org.apache.hadoop.io.Text; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; | import java.util.*; import org.apache.hadoop.crypto.key.*; import org.apache.hadoop.io.*; import org.apache.hadoop.security.*; import org.apache.hadoop.security.token.*; import org.junit.*; import org.mockito.*; | [
"java.util",
"org.apache.hadoop",
"org.junit",
"org.mockito"
] | java.util; org.apache.hadoop; org.junit; org.mockito; | 408,464 |
private static ILaunchConfiguration createNewLaunchConfiguration(IProject project) throws CoreException,
OperationCanceledException {
String initialName = calculateLaunchConfigName(project);
// Create a new launch config
ILaunchConfiguration launchConfig = GwtSuperDevModeCodeServerLaunchUtil.createLaunchConfig(initialName, project);
return launchConfig;
} | static ILaunchConfiguration function(IProject project) throws CoreException, OperationCanceledException { String initialName = calculateLaunchConfigName(project); ILaunchConfiguration launchConfig = GwtSuperDevModeCodeServerLaunchUtil.createLaunchConfig(initialName, project); return launchConfig; } | /**
* Create a new launch configuration.
*/ | Create a new launch configuration | createNewLaunchConfiguration | {
"repo_name": "gwt-plugins/gwt-eclipse-plugin",
"path": "plugins/com.gwtplugins.gwt.eclipse.core/src/com/google/gwt/eclipse/core/launch/util/GwtSuperDevModeCodeServerLaunchUtil.java",
"license": "epl-1.0",
"size": 9412
} | [
"org.eclipse.core.resources.IProject",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.OperationCanceledException",
"org.eclipse.debug.core.ILaunchConfiguration"
] | import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.debug.core.ILaunchConfiguration; | import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; | [
"org.eclipse.core",
"org.eclipse.debug"
] | org.eclipse.core; org.eclipse.debug; | 1,841,665 |
public void readGroup(AttributeSet attrs) {
TypedArray a = mContext.obtainStyledAttributes(attrs,
R.styleable.SherlockMenuGroup);
groupId = a.getResourceId(R.styleable.SherlockMenuGroup_android_id, defaultGroupId);
groupCategory = a.getInt(R.styleable.SherlockMenuGroup_android_menuCategory, defaultItemCategory);
groupOrder = a.getInt(R.styleable.SherlockMenuGroup_android_orderInCategory, defaultItemOrder);
groupCheckable = a.getInt(R.styleable.SherlockMenuGroup_android_checkableBehavior, defaultItemCheckable);
groupVisible = a.getBoolean(R.styleable.SherlockMenuGroup_android_visible, defaultItemVisible);
groupEnabled = a.getBoolean(R.styleable.SherlockMenuGroup_android_enabled, defaultItemEnabled);
a.recycle();
}
| void function(AttributeSet attrs) { TypedArray a = mContext.obtainStyledAttributes(attrs, R.styleable.SherlockMenuGroup); groupId = a.getResourceId(R.styleable.SherlockMenuGroup_android_id, defaultGroupId); groupCategory = a.getInt(R.styleable.SherlockMenuGroup_android_menuCategory, defaultItemCategory); groupOrder = a.getInt(R.styleable.SherlockMenuGroup_android_orderInCategory, defaultItemOrder); groupCheckable = a.getInt(R.styleable.SherlockMenuGroup_android_checkableBehavior, defaultItemCheckable); groupVisible = a.getBoolean(R.styleable.SherlockMenuGroup_android_visible, defaultItemVisible); groupEnabled = a.getBoolean(R.styleable.SherlockMenuGroup_android_enabled, defaultItemEnabled); a.recycle(); } | /**
* Called when the parser is pointing to a group tag.
*/ | Called when the parser is pointing to a group tag | readGroup | {
"repo_name": "joebowen/landing_zone_project",
"path": "openrocket-release-15.03/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/view/MenuInflater.java",
"license": "gpl-2.0",
"size": 19430
} | [
"android.content.res.TypedArray",
"android.util.AttributeSet"
] | import android.content.res.TypedArray; import android.util.AttributeSet; | import android.content.res.*; import android.util.*; | [
"android.content",
"android.util"
] | android.content; android.util; | 582,477 |
@Override
public AssertionResult getResult(SampleResult inResponse) {
log.debug("HTMLAssertions.getResult() called");
if (inResponse.getResponseData().length == 0) {
return new AssertionResult(getName()).setResultForNull();
}
return runTidy(inResponse);
} | AssertionResult function(SampleResult inResponse) { log.debug(STR); if (inResponse.getResponseData().length == 0) { return new AssertionResult(getName()).setResultForNull(); } return runTidy(inResponse); } | /**
* Returns the result of the Assertion. If so an AssertionResult containing
* a FailureMessage will be returned. Otherwise the returned AssertionResult
* will reflect the success of the Sample.
*/ | Returns the result of the Assertion. If so an AssertionResult containing a FailureMessage will be returned. Otherwise the returned AssertionResult will reflect the success of the Sample | getResult | {
"repo_name": "apache/jmeter",
"path": "src/components/src/main/java/org/apache/jmeter/assertions/HTMLAssertion.java",
"license": "apache-2.0",
"size": 12319
} | [
"org.apache.jmeter.samplers.SampleResult"
] | import org.apache.jmeter.samplers.SampleResult; | import org.apache.jmeter.samplers.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 2,639,619 |
@Deprecated
protected JWT signJWT(SignedJWT signedJWT, String tenantDomain, int tenantId)
throws IdentityOAuth2Exception {
if (JWSAlgorithm.RS256.equals(signatureAlgorithm) || JWSAlgorithm.RS384.equals(signatureAlgorithm) ||
JWSAlgorithm.RS512.equals(signatureAlgorithm)) {
return signJWTWithRSA(signedJWT, signatureAlgorithm, tenantDomain, tenantId);
} else if (JWSAlgorithm.HS256.equals(signatureAlgorithm) ||
JWSAlgorithm.HS384.equals(signatureAlgorithm) ||
JWSAlgorithm.HS512.equals(signatureAlgorithm)) {
// return signWithHMAC(payLoad,jwsAlgorithm,tenantDomain,tenantId); implementation
// need to be done
} else if (JWSAlgorithm.ES256.equals(signatureAlgorithm) ||
JWSAlgorithm.ES384.equals(signatureAlgorithm) ||
JWSAlgorithm.ES512.equals(signatureAlgorithm)) {
// return signWithEC(payLoad,jwsAlgorithm,tenantDomain,tenantId); implementation
// need to be done
}
log.error("UnSupported Signature Algorithm");
throw new IdentityOAuth2Exception("UnSupported Signature Algorithm");
} | JWT function(SignedJWT signedJWT, String tenantDomain, int tenantId) throws IdentityOAuth2Exception { if (JWSAlgorithm.RS256.equals(signatureAlgorithm) JWSAlgorithm.RS384.equals(signatureAlgorithm) JWSAlgorithm.RS512.equals(signatureAlgorithm)) { return signJWTWithRSA(signedJWT, signatureAlgorithm, tenantDomain, tenantId); } else if (JWSAlgorithm.HS256.equals(signatureAlgorithm) JWSAlgorithm.HS384.equals(signatureAlgorithm) JWSAlgorithm.HS512.equals(signatureAlgorithm)) { } else if (JWSAlgorithm.ES256.equals(signatureAlgorithm) JWSAlgorithm.ES384.equals(signatureAlgorithm) JWSAlgorithm.ES512.equals(signatureAlgorithm)) { } log.error(STR); throw new IdentityOAuth2Exception(STR); } | /**
* Generic Signing function
*
* @param signedJWT
* @param tenantDomain
* @param tenantId
* @return
* @throws IdentityOAuth2Exception
*/ | Generic Signing function | signJWT | {
"repo_name": "chirankavinda123/identity-inbound-auth-oauth",
"path": "components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/authcontext/JWTTokenGenerator.java",
"license": "apache-2.0",
"size": 23633
} | [
"com.nimbusds.jose.JWSAlgorithm",
"com.nimbusds.jwt.SignedJWT",
"org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception"
] | import com.nimbusds.jose.JWSAlgorithm; import com.nimbusds.jwt.SignedJWT; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; | import com.nimbusds.jose.*; import com.nimbusds.jwt.*; import org.wso2.carbon.identity.oauth2.*; | [
"com.nimbusds.jose",
"com.nimbusds.jwt",
"org.wso2.carbon"
] | com.nimbusds.jose; com.nimbusds.jwt; org.wso2.carbon; | 138,652 |
private boolean isBreakOnOpcode(Integer opcode) {
boolean shouldBreak = false;
if (config.isBreakOnPingPong()) {
// break on every message type
shouldBreak = true;
} else {
// break only on non-ping/pong
boolean isPing = opcode.equals(WebSocketMessage.OPCODE_PING);
boolean isPong = opcode.equals(WebSocketMessage.OPCODE_PONG);
if (!isPing && !isPong) {
shouldBreak = true;
}
}
return shouldBreak;
} | boolean function(Integer opcode) { boolean shouldBreak = false; if (config.isBreakOnPingPong()) { shouldBreak = true; } else { boolean isPing = opcode.equals(WebSocketMessage.OPCODE_PING); boolean isPong = opcode.equals(WebSocketMessage.OPCODE_PONG); if (!isPing && !isPong) { shouldBreak = true; } } return shouldBreak; } | /**
* Check out if breakpoint should be applied on given {@link WebSocketMessageDTO#opcode}.
*
* @param opcode
* @return True if it should break on given opcode.
*/ | Check out if breakpoint should be applied on given <code>WebSocketMessageDTO#opcode</code> | isBreakOnOpcode | {
"repo_name": "kingthorin/zap-extensions",
"path": "addOns/websocket/src/main/java/org/zaproxy/zap/extension/websocket/brk/WebSocketBreakpointMessageHandler.java",
"license": "apache-2.0",
"size": 4428
} | [
"org.zaproxy.zap.extension.websocket.WebSocketMessage"
] | import org.zaproxy.zap.extension.websocket.WebSocketMessage; | import org.zaproxy.zap.extension.websocket.*; | [
"org.zaproxy.zap"
] | org.zaproxy.zap; | 1,541,990 |
public Module init(
StarlarkThread thread, //
Map<String, Object> predeclared,
@Nullable Object label) // a regrettable Bazelism we needn't widely expose in the API
throws EvalException, InterruptedException {
// Pseudocode:
// module = new module(predeclared, label=label)
// toplevel = new StarlarkFunction(prog.toplevel, module)
// call(thread, toplevel)
// return module # or module.globals?
throw new UnsupportedOperationException();
}
} | Module function( StarlarkThread thread, @Nullable Object label) throws EvalException, InterruptedException { throw new UnsupportedOperationException(); } } | /**
* Execute the toplevel function of a compiled program and returns the module populated by its
* top-level assignments.
*
* <p>The keys of predeclared must match the set used when creating the Program.
*/ | Execute the toplevel function of a compiled program and returns the module populated by its top-level assignments. The keys of predeclared must match the set used when creating the Program | init | {
"repo_name": "aehlig/bazel",
"path": "src/main/java/com/google/devtools/build/lib/syntax/Starlark.java",
"license": "apache-2.0",
"size": 10394
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 26,543 |
void createIndexes(Session session, Collection<? extends Index> indexesToAdd); | void createIndexes(Session session, Collection<? extends Index> indexesToAdd); | /**
* Create new indexes on existing table(s). Both Table and Group indexes are supported. Primary
* keys can not be created through this interface. Specified index IDs will not be used as they
* are recalculated later. Blocks until the actual index data has been created.
*
* @param indexesToAdd a list of indexes to add to the existing AIS
*/ | Create new indexes on existing table(s). Both Table and Group indexes are supported. Primary keys can not be created through this interface. Specified index IDs will not be used as they are recalculated later. Blocks until the actual index data has been created | createIndexes | {
"repo_name": "AydinSakar/sql-layer",
"path": "src/main/java/com/foundationdb/server/api/DDLFunctions.java",
"license": "agpl-3.0",
"size": 10189
} | [
"com.foundationdb.ais.model.Index",
"com.foundationdb.server.service.session.Session",
"java.util.Collection"
] | import com.foundationdb.ais.model.Index; import com.foundationdb.server.service.session.Session; import java.util.Collection; | import com.foundationdb.ais.model.*; import com.foundationdb.server.service.session.*; import java.util.*; | [
"com.foundationdb.ais",
"com.foundationdb.server",
"java.util"
] | com.foundationdb.ais; com.foundationdb.server; java.util; | 2,648,150 |
List<VnicProfileView> getAllForNetwork(Guid networkId, Guid userId, boolean filtered); | List<VnicProfileView> getAllForNetwork(Guid networkId, Guid userId, boolean filtered); | /**
* Retrieves all vnic profiles associated to the given network.
*
* @param networkId
* the network's ID
* @param userId
* the id of the user performing the query
* @param filtered
* does the query should be filtered by the user
* @return the list of vnic profiles
*/ | Retrieves all vnic profiles associated to the given network | getAllForNetwork | {
"repo_name": "jtux270/translate",
"path": "ovirt/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VnicProfileViewDao.java",
"license": "gpl-3.0",
"size": 2670
} | [
"java.util.List",
"org.ovirt.engine.core.common.businessentities.network.VnicProfileView",
"org.ovirt.engine.core.compat.Guid"
] | import java.util.List; import org.ovirt.engine.core.common.businessentities.network.VnicProfileView; import org.ovirt.engine.core.compat.Guid; | import java.util.*; import org.ovirt.engine.core.common.businessentities.network.*; import org.ovirt.engine.core.compat.*; | [
"java.util",
"org.ovirt.engine"
] | java.util; org.ovirt.engine; | 2,225,133 |
public SVGElement getFarthestViewportElement() {
return SVGLocatableSupport.getFarthestViewportElement(this);
} | SVGElement function() { return SVGLocatableSupport.getFarthestViewportElement(this); } | /**
* <b>DOM</b>: Implements {@link
* org.w3c.dom.svg.SVGLocatable#getFarthestViewportElement()}.
*/ | DOM: Implements <code>org.w3c.dom.svg.SVGLocatable#getFarthestViewportElement()</code> | getFarthestViewportElement | {
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/dom/svg/SVGGraphicsElement.java",
"license": "apache-2.0",
"size": 9292
} | [
"org.w3c.dom.svg.SVGElement"
] | import org.w3c.dom.svg.SVGElement; | import org.w3c.dom.svg.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,461,753 |
@SuppressWarnings("rawtypes")
public static void serialize(Class clazz, Object instance, File output)
throws JAXBException {
JAXBContext context = JAXBContext.newInstance(clazz);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
m.marshal(instance, output);
} | @SuppressWarnings(STR) static void function(Class clazz, Object instance, File output) throws JAXBException { JAXBContext context = JAXBContext.newInstance(clazz); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(instance, output); } | /**
* Serialize an object to XML using JAXB, writing it to the desired file
* @param clazz the class of the object to serialize (wtf is wrong with reflection?!)
* @param instance the actual object instance to serialize
* @param output the file to write the xml into
* @throws JAXBException when serialization fails
*/ | Serialize an object to XML using JAXB, writing it to the desired file | serialize | {
"repo_name": "Klamann/maps4cim",
"path": "maps4cim-core/src/main/java/de/nx42/maps4cim/util/Serializer.java",
"license": "apache-2.0",
"size": 11518
} | [
"java.io.File",
"javax.xml.bind.JAXBContext",
"javax.xml.bind.JAXBException",
"javax.xml.bind.Marshaller"
] | import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; | import java.io.*; import javax.xml.bind.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 1,638,529 |
public void setDependencies(List<DependencyNode> dependencies) {
if (dependencies == null) {
return;
}
this.dependencies = dependencies;
Set<String> allDependencies = new HashSet<>();
dependencies.forEach(dependencyNode -> {
allDependencies.add(dependencyNode.artifactId);
allDependencies.addAll(dependencyNode.allDependencies);
});
this.allDependencies = allDependencies;
} | void function(List<DependencyNode> dependencies) { if (dependencies == null) { return; } this.dependencies = dependencies; Set<String> allDependencies = new HashSet<>(); dependencies.forEach(dependencyNode -> { allDependencies.add(dependencyNode.artifactId); allDependencies.addAll(dependencyNode.allDependencies); }); this.allDependencies = allDependencies; } | /**
* Sets the dependencies list of the UUF Component reflected by this node.
*
* @param dependencies dependencies list to be set
*/ | Sets the dependencies list of the UUF Component reflected by this node | setDependencies | {
"repo_name": "Shan1024/carbon-uuf",
"path": "components/uuf-core/src/main/java/org/wso2/carbon/uuf/api/config/DependencyNode.java",
"license": "apache-2.0",
"size": 4873
} | [
"java.util.HashSet",
"java.util.List",
"java.util.Set"
] | import java.util.HashSet; import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,579,228 |
public Set<String> getCASScopes() {
final Set<String> scopeSet = new HashSet<>();
for (final Scope defaultScope : this.casScopeHandler.getDefaults()) {
scopeSet.add(defaultScope.getName());
}
return scopeSet;
} | Set<String> function() { final Set<String> scopeSet = new HashSet<>(); for (final Scope defaultScope : this.casScopeHandler.getDefaults()) { scopeSet.add(defaultScope.getName()); } return scopeSet; } | /**
* Retrieve a set of scopes specific to the CAS handler.
*
* @return the set of scopes
*/ | Retrieve a set of scopes specific to the CAS handler | getCASScopes | {
"repo_name": "CenterForOpenScience/cas-overlay",
"path": "cas-server-support-oauth/src/main/java/org/jasig/cas/support/oauth/scope/ScopeManager.java",
"license": "apache-2.0",
"size": 3150
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,022,156 |
public Map<HRegionInfo, ServerName> getRegionToRegionServerMap() {
return regionToRegionServerMap;
} | Map<HRegionInfo, ServerName> function() { return regionToRegionServerMap; } | /**
* Get region to region server map
* @return region to region server map
*/ | Get region to region server map | getRegionToRegionServerMap | {
"repo_name": "Jackygq1982/hbase_src",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/SnapshotOfRegionAssignmentFromMeta.java",
"license": "apache-2.0",
"size": 8092
} | [
"java.util.Map",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.ServerName"
] | import java.util.Map; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.ServerName; | import java.util.*; import org.apache.hadoop.hbase.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,077,583 |
static int hashCodeImpl(Set<?> s) {
int hashCode = 0;
for (Object o : s) {
hashCode += o != null ? o.hashCode() : 0;
}
return hashCode;
} | static int hashCodeImpl(Set<?> s) { int hashCode = 0; for (Object o : s) { hashCode += o != null ? o.hashCode() : 0; } return hashCode; } | /**
* An implementation for {@link Set#hashCode()}.
*/ | An implementation for <code>Set#hashCode()</code> | hashCodeImpl | {
"repo_name": "hceylan/guava",
"path": "guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Sets.java",
"license": "apache-2.0",
"size": 47528
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,858,835 |
public String readXmlHash(ElasticContext ec, String id) throws Exception {
return (new XmlContent(ec)).readXmlHash(ec,id);
} | String function(ElasticContext ec, String id) throws Exception { return (new XmlContent(ec)).readXmlHash(ec,id); } | /**
* Read an xml hash.
* @param ec the context
* @param id the id
* @return the hash
* @throws Exception
*/ | Read an xml hash | readXmlHash | {
"repo_name": "usgin/geoportal-server-catalog",
"path": "geoportal/src/main/java/com/esri/geoportal/lib/elastic/util/ItemIO.java",
"license": "apache-2.0",
"size": 7537
} | [
"com.esri.geoportal.lib.elastic.ElasticContext",
"com.esri.geoportal.lib.elastic.kvp.XmlContent"
] | import com.esri.geoportal.lib.elastic.ElasticContext; import com.esri.geoportal.lib.elastic.kvp.XmlContent; | import com.esri.geoportal.lib.elastic.*; import com.esri.geoportal.lib.elastic.kvp.*; | [
"com.esri.geoportal"
] | com.esri.geoportal; | 908,641 |
@Override
public CloseFuture close() {
return null;
} | CloseFuture function() { return null; } | /**
* Does nothing.
* @return
*/ | Does nothing | close | {
"repo_name": "Maxcloud/Mushy",
"path": "src/tools/MockIOSession.java",
"license": "gpl-3.0",
"size": 3972
} | [
"org.apache.mina.common.CloseFuture"
] | import org.apache.mina.common.CloseFuture; | import org.apache.mina.common.*; | [
"org.apache.mina"
] | org.apache.mina; | 45,112 |
public void init() {
loadInterfaces();
isAnyNetInterfaceAvailable = (mIfaces.length > 0);
mIsConnectivityAvailable = isConnectivityAvailable();
mIsCoreInstalled = System.isCoreInstalled();
mIsDaemonBeating = System.isCoreInitialized();
// check minimum requirements for system initialization
if (!mIsCoreInstalled) {
EMPTY_LIST_MESSAGE = mIsConnectivityAvailable ?
getString(R.string.missing_core_update) :
getString(R.string.no_connectivity);
return;
} else if (!mIsDaemonBeating) {
try {
System.initCore();
mIsDaemonBeating = true;
if (Client.hadCrashed()) {
Logger.warning("Client has previously crashed, building a crash report.");
CrashReporter.notifyNativeLibraryCrash();
onInitializationError(getString(R.string.JNI_crash_detected));
return;
}
} catch (UnsatisfiedLinkError e) {
onInitializationError("hi developer, you missed to build JNI stuff, thanks for playing with me :)");
return;
} catch (System.SuException e) {
onInitializationError(getString(R.string.only_4_root));
return;
} catch (System.DaemonException e) {
Logger.error(e.getMessage());
}
if (!mIsDaemonBeating) {
if (mIsConnectivityAvailable) {
EMPTY_LIST_MESSAGE = getString(R.string.heart_attack_update);
} else {
onInitializationError(getString(R.string.heart_attack));
}
return;
}
}
// if all is initialized, configure the network
initSystem();
} | void function() { loadInterfaces(); isAnyNetInterfaceAvailable = (mIfaces.length > 0); mIsConnectivityAvailable = isConnectivityAvailable(); mIsCoreInstalled = System.isCoreInstalled(); mIsDaemonBeating = System.isCoreInitialized(); if (!mIsCoreInstalled) { EMPTY_LIST_MESSAGE = mIsConnectivityAvailable ? getString(R.string.missing_core_update) : getString(R.string.no_connectivity); return; } else if (!mIsDaemonBeating) { try { System.initCore(); mIsDaemonBeating = true; if (Client.hadCrashed()) { Logger.warning(STR); CrashReporter.notifyNativeLibraryCrash(); onInitializationError(getString(R.string.JNI_crash_detected)); return; } } catch (UnsatisfiedLinkError e) { onInitializationError(STR); return; } catch (System.SuException e) { onInitializationError(getString(R.string.only_4_root)); return; } catch (System.DaemonException e) { Logger.error(e.getMessage()); } if (!mIsDaemonBeating) { if (mIsConnectivityAvailable) { EMPTY_LIST_MESSAGE = getString(R.string.heart_attack_update); } else { onInitializationError(getString(R.string.heart_attack)); } return; } } initSystem(); } | /**
* Performs the firsts actions when the app starts.
* called also when the user connects to a wifi from the app, and when the core is updated.
*/ | Performs the firsts actions when the app starts. called also when the user connects to a wifi from the app, and when the core is updated | init | {
"repo_name": "cameronaaron/android",
"path": "cSploit/src/main/java/org/csploit/android/MainFragment.java",
"license": "gpl-3.0",
"size": 49664
} | [
"org.csploit.android.core.Client",
"org.csploit.android.core.CrashReporter",
"org.csploit.android.core.Logger",
"org.csploit.android.core.System"
] | import org.csploit.android.core.Client; import org.csploit.android.core.CrashReporter; import org.csploit.android.core.Logger; import org.csploit.android.core.System; | import org.csploit.android.core.*; | [
"org.csploit.android"
] | org.csploit.android; | 2,404,549 |
public Builder nextId(final int id) {
if (!types.isEmpty()) {
if (id != FLOATING_ID && id < blockHeadId + types.size()) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("requested nextId {} could potentially overlap "
+ "with existing registrations {}+{} ",
id, blockHeadId, types.size(), new RuntimeException());
}
}
blocks.add(new RegistrationBlock(this.blockHeadId, types));
types = new ArrayList<>();
}
this.blockHeadId = id;
return this;
} | Builder function(final int id) { if (!types.isEmpty()) { if (id != FLOATING_ID && id < blockHeadId + types.size()) { if (LOGGER.isWarnEnabled()) { LOGGER.warn(STR + STR, id, blockHeadId, types.size(), new RuntimeException()); } } blocks.add(new RegistrationBlock(this.blockHeadId, types)); types = new ArrayList<>(); } this.blockHeadId = id; return this; } | /**
* Sets the next Kryo registration Id for following register entries.
*
* @param id Kryo registration Id
* @return this
* @see Kryo#register(Class, Serializer, int)
*/ | Sets the next Kryo registration Id for following register entries | nextId | {
"repo_name": "kuujo/copycat",
"path": "utils/src/main/java/io/atomix/utils/serializer/Namespace.java",
"license": "apache-2.0",
"size": 19312
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 818,778 |
public Date getAccessDate() {
return accessDate;
} | Date function() { return accessDate; } | /**
* Return the date when the user last issued a client command.
*
* @return Last access date
*/ | Return the date when the user last issued a client command | getAccessDate | {
"repo_name": "ModelN/build-management",
"path": "mn-build-core/src/main/java/com/modeln/build/perforce/User.java",
"license": "mit",
"size": 10355
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,846,691 |
public List<TableName> listTableNamesByNamespace(String name) throws IOException; | List<TableName> function(String name) throws IOException; | /**
* Get list of table names by namespace
* @param name namespace name
* @return table names
* @throws IOException
*/ | Get list of table names by namespace | listTableNamesByNamespace | {
"repo_name": "vincentpoon/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java",
"license": "apache-2.0",
"size": 15223
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.TableName"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.TableName; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,198,418 |
public int[] positionFor(int offset) {
int line = Arrays.binarySearch(lines.toArray(), offset);
int off;
if (line < 0) {
line = -(line) - 1; // If the offset is not in the lines array
off = lines.get(line - 1); // Get offset of previous line
}
else {
off = lines.get(line) - 1; // Get offset of current line - 1
}
int column = offset - off;
return new int[] { line, column }; // Line and column starts at 1
} | int[] function(int offset) { int line = Arrays.binarySearch(lines.toArray(), offset); int off; if (line < 0) { line = -(line) - 1; off = lines.get(line - 1); } else { off = lines.get(line) - 1; } int column = offset - off; return new int[] { line, column }; } | /**
* Converts a position given as an offset into a (line, column) array.
*
* @param offset in the associated stream
* @return position as (line, column) in the stream
*/ | Converts a position given as an offset into a (line, column) array | positionFor | {
"repo_name": "GumTreeDiff/gumtree",
"path": "core/src/main/java/com/github/gumtreediff/io/LineReader.java",
"license": "lgpl-3.0",
"size": 3010
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 2,869,552 |
public Link publish(final String path)
throws ServerIOException, IOException {
return cloudApi.publish(path);
} | Link function(final String path) throws ServerIOException, IOException { return cloudApi.publish(path); } | /**
* Publishing a file or folder
*
* @see <p>API reference <a href="http://api.yandex.com/disk/api/reference/publish.xml">english</a>,
* <a href="https://tech.yandex.ru/disk/api/reference/publish-docpage/">russian</a></p>
*/ | Publishing a file or folder | publish | {
"repo_name": "yandex-disk/yandex-disk-restapi-java",
"path": "disk-restapi-sdk/src/main/java/com/yandex/disk/rest/RestClient.java",
"license": "apache-2.0",
"size": 19562
} | [
"com.yandex.disk.rest.exceptions.ServerIOException",
"com.yandex.disk.rest.json.Link",
"java.io.IOException"
] | import com.yandex.disk.rest.exceptions.ServerIOException; import com.yandex.disk.rest.json.Link; import java.io.IOException; | import com.yandex.disk.rest.exceptions.*; import com.yandex.disk.rest.json.*; import java.io.*; | [
"com.yandex.disk",
"java.io"
] | com.yandex.disk; java.io; | 307,202 |
public ServiceCall<Void> postMethodGlobalNotProvidedValidAsync(final ServiceCallback<Void> serviceCallback) {
return ServiceCall.create(postMethodGlobalNotProvidedValidWithServiceResponseAsync(), serviceCallback);
} | ServiceCall<Void> function(final ServiceCallback<Void> serviceCallback) { return ServiceCall.create(postMethodGlobalNotProvidedValidWithServiceResponseAsync(), serviceCallback); } | /**
* POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/ | POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed | postMethodGlobalNotProvidedValidAsync | {
"repo_name": "tbombach/autorest",
"path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/azurespecials/implementation/SubscriptionInCredentialsImpl.java",
"license": "mit",
"size": 20911
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,353,587 |
if ("geometry".equalsIgnoreCase(type)) {
return instance.create(GeometryIndexType.TYPE_GEOMETRY, values);
} else if ("vertex".equalsIgnoreCase(type)) {
return instance.create(GeometryIndexType.TYPE_VERTEX, values);
} else if ("edge".equalsIgnoreCase(type)) {
return instance.create(GeometryIndexType.TYPE_EDGE, values);
}
return null;
} | if (STR.equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_GEOMETRY, values); } else if (STR.equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_VERTEX, values); } else if ("edge".equalsIgnoreCase(type)) { return instance.create(GeometryIndexType.TYPE_EDGE, values); } return null; } | /**
* Create a new geometry index instance.
*
* @param instance
* The index service instance to help you create the index.
* @param type
* The type for the deepest index value.
* @param values
* A list of values for the children to create.
* @return The new index.
*/ | Create a new geometry index instance | create | {
"repo_name": "geomajas/geomajas-project-client-gwt",
"path": "plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndexService.java",
"license": "agpl-3.0",
"size": 11965
} | [
"org.geomajas.plugin.editing.client.service.GeometryIndexType"
] | import org.geomajas.plugin.editing.client.service.GeometryIndexType; | import org.geomajas.plugin.editing.client.service.*; | [
"org.geomajas.plugin"
] | org.geomajas.plugin; | 1,299,657 |
public RexNode makeNewInvocation(
RelDataType type,
List<RexNode> exprs) {
return new RexCall(
type,
SqlStdOperatorTable.NEW,
exprs);
} | RexNode function( RelDataType type, List<RexNode> exprs) { return new RexCall( type, SqlStdOperatorTable.NEW, exprs); } | /**
* Creates an invocation of the NEW operator.
*
* @param type Type to be instantiated
* @param exprs Arguments to NEW operator
* @return Expression invoking NEW operator
*/ | Creates an invocation of the NEW operator | makeNewInvocation | {
"repo_name": "mehant/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/rex/RexBuilder.java",
"license": "apache-2.0",
"size": 42908
} | [
"java.util.List",
"org.apache.calcite.rel.type.RelDataType",
"org.apache.calcite.sql.fun.SqlStdOperatorTable"
] | import java.util.List; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.fun.SqlStdOperatorTable; | import java.util.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.sql.fun.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 1,643,901 |
public static void agentDeparted(Workgroup workgroup, AgentSession agentSession) {
for (WorkgroupEventListener listener : listeners) {
try {
listener.agentDeparted(workgroup, agentSession);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
}
} | static void function(Workgroup workgroup, AgentSession agentSession) { for (WorkgroupEventListener listener : listeners) { try { listener.agentDeparted(workgroup, agentSession); } catch (Exception e) { Log.error(e.getMessage(), e); } } } | /**
* Notification message that an Agent has left a Workgroup.
*
* @param workgroup the workgroup where the agent has left.
* @param agentSession the session of the agent that has ended.
*/ | Notification message that an Agent has left a Workgroup | agentDeparted | {
"repo_name": "wudingli/openfire",
"path": "src/plugins/fastpath/src/java/org/jivesoftware/xmpp/workgroup/event/WorkgroupEventDispatcher.java",
"license": "apache-2.0",
"size": 8571
} | [
"org.jivesoftware.xmpp.workgroup.AgentSession",
"org.jivesoftware.xmpp.workgroup.Workgroup"
] | import org.jivesoftware.xmpp.workgroup.AgentSession; import org.jivesoftware.xmpp.workgroup.Workgroup; | import org.jivesoftware.xmpp.workgroup.*; | [
"org.jivesoftware.xmpp"
] | org.jivesoftware.xmpp; | 178,471 |
@Test(expected = IllegalArgumentException.class)
public void invalidXMLConfigurationFileThrowsCheckstyleException() throws IOException, Exception {
DefaultConfiguration main = createCheckConfig(TreeWalker.class);
final DefaultConfiguration checkConfig = createCheckConfig(StereotypeCheck.class);
checkConfig.addAttribute("file", "src/test/resources/stereotype_invalidXML.xml");
main.addChild(checkConfig);
final String[] expected = { "" };
try {
verify(main, getPath(SampleIs.class), expected);
} catch (IllegalArgumentException ex) {
assertThat(ex.getMessage()).contains("Attribute 'to' must appear on element 'dependency'");
throw ex;
}
} | @Test(expected = IllegalArgumentException.class) void function() throws IOException, Exception { DefaultConfiguration main = createCheckConfig(TreeWalker.class); final DefaultConfiguration checkConfig = createCheckConfig(StereotypeCheck.class); checkConfig.addAttribute("file", STR); main.addChild(checkConfig); final String[] expected = { STRAttribute 'to' must appear on element 'dependency'"); throw ex; } } | /**
* If the stereotype configuration file is not valid against the XSD.
*
* @throws IOException
* @throws Exception
*/ | If the stereotype configuration file is not valid against the XSD | invalidXMLConfigurationFileThrowsCheckstyleException | {
"repo_name": "NovaTecConsulting/stereotype-check",
"path": "stereotype.check.plugin.test/src/test/java/info/novatec/ita/check/config/StereotypeCheckConfigurationReaderTest.java",
"license": "apache-2.0",
"size": 14856
} | [
"com.puppycrawl.tools.checkstyle.DefaultConfiguration",
"com.puppycrawl.tools.checkstyle.TreeWalker",
"info.novatec.ita.check.StereotypeCheck",
"java.io.IOException",
"org.junit.Test"
] | import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.TreeWalker; import info.novatec.ita.check.StereotypeCheck; import java.io.IOException; import org.junit.Test; | import com.puppycrawl.tools.checkstyle.*; import info.novatec.ita.check.*; import java.io.*; import org.junit.*; | [
"com.puppycrawl.tools",
"info.novatec.ita",
"java.io",
"org.junit"
] | com.puppycrawl.tools; info.novatec.ita; java.io; org.junit; | 834,325 |
@Override
public @NotNull BigDecimalAssert isNegative() {
return isLessThan(ZERO);
} | @NotNull BigDecimalAssert function() { return isLessThan(ZERO); } | /**
* Verifies that the actual {@code BigDecimal} is negative.
*
* @return this assertion object.
* @throws AssertionError if the actual {@code BigDecimal} value is {@code null}.
* @throws AssertionError if the actual {@code BigDecimal} value is not negative.
*/ | Verifies that the actual BigDecimal is negative | isNegative | {
"repo_name": "alexruiz/fest-assert-1.x",
"path": "src/main/java/org/fest/assertions/BigDecimalAssert.java",
"license": "apache-2.0",
"size": 2977
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,479,665 |
public CodeElementExtractor.ElementDescription getContainerDescription() {
return this.container;
} | CodeElementExtractor.ElementDescription function() { return this.container; } | /** Replies the container description.
*
* @return the container description.
*/ | Replies the container description | getContainerDescription | {
"repo_name": "sarl/sarl",
"path": "main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/ExpressionBuilderFragment.java",
"license": "apache-2.0",
"size": 55031
} | [
"io.sarl.lang.mwe2.codebuilder.extractor.CodeElementExtractor"
] | import io.sarl.lang.mwe2.codebuilder.extractor.CodeElementExtractor; | import io.sarl.lang.mwe2.codebuilder.extractor.*; | [
"io.sarl.lang"
] | io.sarl.lang; | 459,139 |
public boolean parse() {
try {
SAXParser parser = sParserFactory.newSAXParser();
mHandler = new GpxHandler();
parser.parse(new InputSource(new FileReader(mFileName)), mHandler);
return mHandler.getSuccess();
} catch (Exception e) {
GPLog.error(this, null, e);
}
return false;
} | boolean function() { try { SAXParser parser = sParserFactory.newSAXParser(); mHandler = new GpxHandler(); parser.parse(new InputSource(new FileReader(mFileName)), mHandler); return mHandler.getSuccess(); } catch (Exception e) { GPLog.error(this, null, e); } return false; } | /**
* Parses the GPX file.
*
* @return <code>true</code> if success.
*/ | Parses the GPX file | parse | {
"repo_name": "geopaparazzi/geopaparazzi",
"path": "geopaparazzi_library/src/main/java/eu/geopaparazzi/library/gpx/parser/GpxParser.java",
"license": "gpl-3.0",
"size": 15599
} | [
"eu.geopaparazzi.library.database.GPLog",
"java.io.FileReader",
"javax.xml.parsers.SAXParser",
"org.xml.sax.InputSource"
] | import eu.geopaparazzi.library.database.GPLog; import java.io.FileReader; import javax.xml.parsers.SAXParser; import org.xml.sax.InputSource; | import eu.geopaparazzi.library.database.*; import java.io.*; import javax.xml.parsers.*; import org.xml.sax.*; | [
"eu.geopaparazzi.library",
"java.io",
"javax.xml",
"org.xml.sax"
] | eu.geopaparazzi.library; java.io; javax.xml; org.xml.sax; | 623,909 |
public boolean recalculateCreditSplit() {
boolean noErrors = true;
if(isInstitutionalProposalCreditsLimitApplicable()) {
Map<String, Map<String, ScaleTwoDecimal>> totalsMap = calculateCreditSplitTotals();
noErrors = checkIfPersonTotalsAreValid(totalsMap);
noErrors &= checkIfPersonUnitsTotalsAreValid(totalsMap);
}
return noErrors;
} | boolean function() { boolean noErrors = true; if(isInstitutionalProposalCreditsLimitApplicable()) { Map<String, Map<String, ScaleTwoDecimal>> totalsMap = calculateCreditSplitTotals(); noErrors = checkIfPersonTotalsAreValid(totalsMap); noErrors &= checkIfPersonUnitsTotalsAreValid(totalsMap); } return noErrors; } | /**
* Apply calculation total rules
*/ | Apply calculation total rules | recalculateCreditSplit | {
"repo_name": "sanjupolus/KC6.oLatest",
"path": "coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/contacts/InstitutionalProposalCreditSplitBean.java",
"license": "agpl-3.0",
"size": 16814
} | [
"java.util.Map",
"org.kuali.coeus.sys.api.model.ScaleTwoDecimal"
] | import java.util.Map; import org.kuali.coeus.sys.api.model.ScaleTwoDecimal; | import java.util.*; import org.kuali.coeus.sys.api.model.*; | [
"java.util",
"org.kuali.coeus"
] | java.util; org.kuali.coeus; | 1,854,788 |
public static void logVersionInfo() {
Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR));
Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER));
Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION));
if (false) {
int[] values = new int[1];
GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0);
int majorVersion = values[0];
GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0);
int minorVersion = values[0];
if (GLES30.glGetError() == GLES30.GL_NO_ERROR) {
Log.i(TAG, "iversion: " + majorVersion + "." + minorVersion);
}
}
} | static void function() { Log.i(TAG, STR + GLES20.glGetString(GLES20.GL_VENDOR)); Log.i(TAG, STR + GLES20.glGetString(GLES20.GL_RENDERER)); Log.i(TAG, STR + GLES20.glGetString(GLES20.GL_VERSION)); if (false) { int[] values = new int[1]; GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0); int majorVersion = values[0]; GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0); int minorVersion = values[0]; if (GLES30.glGetError() == GLES30.GL_NO_ERROR) { Log.i(TAG, STR + majorVersion + "." + minorVersion); } } } | /**
* Writes GL version info to the log.
*/ | Writes GL version info to the log | logVersionInfo | {
"repo_name": "DisruptiveMind/cineio-broadcast-android",
"path": "cineio-broadcast-android-sdk/src/main/java/io/cine/android/streaming/gles/GlUtil.java",
"license": "mit",
"size": 7198
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,350,369 |
@Override
public Observable<List<IGameDatasource>> search(String query, int offset, int limit) {
return netImpl.search(query, offset, limit)
.toObservable();
} | Observable<List<IGameDatasource>> function(String query, int offset, int limit) { return netImpl.search(query, offset, limit) .toObservable(); } | /**
* Searches game that matches the specified query name
*
* @param query the name to query.
* @param offset the offset of the query
* @param limit the max amount of items to return
* @return a list of games matching the query.
*/ | Searches game that matches the specified query name | search | {
"repo_name": "Yorxxx/playednext",
"path": "app/src/main/java/com/piticlistudio/playednext/game/model/repository/datasource/GamedataRepository.java",
"license": "apache-2.0",
"size": 1868
} | [
"com.piticlistudio.playednext.game.model.entity.datasource.IGameDatasource",
"io.reactivex.Observable",
"java.util.List"
] | import com.piticlistudio.playednext.game.model.entity.datasource.IGameDatasource; import io.reactivex.Observable; import java.util.List; | import com.piticlistudio.playednext.game.model.entity.datasource.*; import io.reactivex.*; import java.util.*; | [
"com.piticlistudio.playednext",
"io.reactivex",
"java.util"
] | com.piticlistudio.playednext; io.reactivex; java.util; | 2,734,349 |
public static String nodeToString(Node node) {
return DOM2Writer.nodeToString(node);
} | static String function(Node node) { return DOM2Writer.nodeToString(node); } | /**
* Serialize the given node to a String.
*
* @param node Node to be serialized.
* @return The serialized node as a java.lang.String instance.
*/ | Serialize the given node to a String | nodeToString | {
"repo_name": "dharshanaw/carbon-identity-framework",
"path": "components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java",
"license": "apache-2.0",
"size": 40688
} | [
"com.ibm.wsdl.util.xml.DOM2Writer",
"org.w3c.dom.Node"
] | import com.ibm.wsdl.util.xml.DOM2Writer; import org.w3c.dom.Node; | import com.ibm.wsdl.util.xml.*; import org.w3c.dom.*; | [
"com.ibm.wsdl",
"org.w3c.dom"
] | com.ibm.wsdl; org.w3c.dom; | 552,370 |
void done(RegisteredMigrationStep dbMigration); | void done(RegisteredMigrationStep dbMigration); | /**
* Saves in persisted migration history the fact that the specified {@link RegisteredMigrationStep} has
* been successfully executed.
*
* @throws RuntimeException if the information can not be persisted (and committed).
*/ | Saves in persisted migration history the fact that the specified <code>RegisteredMigrationStep</code> has been successfully executed | done | {
"repo_name": "Builders-SonarSource/sonarqube-bis",
"path": "server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/history/MigrationHistory.java",
"license": "lgpl-3.0",
"size": 2029
} | [
"org.sonar.server.platform.db.migration.step.RegisteredMigrationStep"
] | import org.sonar.server.platform.db.migration.step.RegisteredMigrationStep; | import org.sonar.server.platform.db.migration.step.*; | [
"org.sonar.server"
] | org.sonar.server; | 917,423 |
private void notifyRegisterChanged() {
for (final IRegistersChangedListener listener : reglisteners) {
listener.registerDataChanged();
}
} | void function() { for (final IRegistersChangedListener listener : reglisteners) { listener.registerDataChanged(); } } | /**
* Notifies the register listeners about changes in the register values.
*/ | Notifies the register listeners about changes in the register values | notifyRegisterChanged | {
"repo_name": "AmesianX/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Gui/Debug/RegisterPanel/CRegisterProvider.java",
"license": "apache-2.0",
"size": 8519
} | [
"com.google.security.zynamics.zylib.gui.JRegisterView"
] | import com.google.security.zynamics.zylib.gui.JRegisterView; | import com.google.security.zynamics.zylib.gui.*; | [
"com.google.security"
] | com.google.security; | 345,770 |
private void orderTreeModel(List<List> hierarchy){
if(hierarchy != null){
for(List nodeList : hierarchy){
orderTreeModel((List)nodeList.get(1));
}
Collections.sort(hierarchy, new NodeListComparator());
}
} | void function(List<List> hierarchy){ if(hierarchy != null){ for(List nodeList : hierarchy){ orderTreeModel((List)nodeList.get(1)); } Collections.sort(hierarchy, new NodeListComparator()); } } | /**
* takes a list representation of the tree and orders it Alphabetically
* @param hierarchy
*/ | takes a list representation of the tree and orders it Alphabetically | orderTreeModel | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "delegatedaccess/impl/src/java/org/sakaiproject/delegatedaccess/logic/ProjectLogicImpl.java",
"license": "apache-2.0",
"size": 109911
} | [
"java.util.Collections",
"java.util.List"
] | import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,185,462 |
@XmlElement(name = "mimeType")
public String getMimeTypeName()
{
return reference.getMimeType().getName();
} | @XmlElement(name = STR) String function() { return reference.getMimeType().getName(); } | /**
* Gets the name of the MIME type for the reference.
* @return the name of the MIME type for the reference
*/ | Gets the name of the MIME type for the reference | getMimeTypeName | {
"repo_name": "apache/oodt",
"path": "webapp/fmprod/src/main/java/org/apache/oodt/cas/product/jaxrs/resources/TransferResource.java",
"license": "apache-2.0",
"size": 5099
} | [
"javax.xml.bind.annotation.XmlElement"
] | import javax.xml.bind.annotation.XmlElement; | import javax.xml.bind.annotation.*; | [
"javax.xml"
] | javax.xml; | 765,604 |
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
int index = requestCode>>16;
if (index != 0) {
index--;
if (mFragments.mActive == null || index < 0 || index >= mFragments.mActive.size()) {
Log.w(TAG, "Activity result fragment index out of range: 0x"
+ Integer.toHexString(requestCode));
return;
}
Fragment frag = mFragments.mActive.get(index);
if (frag == null) {
Log.w(TAG, "Activity result no fragment exists for index: 0x"
+ Integer.toHexString(requestCode));
} else {
frag.onActivityResult(requestCode&0xffff, resultCode, data);
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
| void function(int requestCode, int resultCode, Intent data) { int index = requestCode>>16; if (index != 0) { index--; if (mFragments.mActive == null index < 0 index >= mFragments.mActive.size()) { Log.w(TAG, STR + Integer.toHexString(requestCode)); return; } Fragment frag = mFragments.mActive.get(index); if (frag == null) { Log.w(TAG, STR + Integer.toHexString(requestCode)); } else { frag.onActivityResult(requestCode&0xffff, resultCode, data); } return; } super.onActivityResult(requestCode, resultCode, data); } | /**
* Dispatch incoming result to the correct fragment.
*/ | Dispatch incoming result to the correct fragment | onActivityResult | {
"repo_name": "beshkenadze/ActionBarSherlock",
"path": "plugins/maps/src/android/support/v4/app/FragmentMapActivity.java",
"license": "apache-2.0",
"size": 48877
} | [
"android.content.Intent",
"android.util.Log"
] | import android.content.Intent; import android.util.Log; | import android.content.*; import android.util.*; | [
"android.content",
"android.util"
] | android.content; android.util; | 246,879 |
private void readProcMemInfoFile(boolean readAgain) {
if (readMemInfoFile && !readAgain) {
return;
}
// Read "/proc/memInfo" file
BufferedReader in;
InputStreamReader fReader;
try {
fReader = new InputStreamReader(
Files.newInputStream(Paths.get(procfsMemFile)),
Charset.forName("UTF-8"));
in = new BufferedReader(fReader);
} catch (IOException f) {
// shouldn't happen....
LOG.warn("Couldn't read " + procfsMemFile
+ "; can't determine memory settings");
return;
}
Matcher mat;
try {
String str = in.readLine();
while (str != null) {
mat = PROCFS_MEMFILE_FORMAT.matcher(str);
if (mat.find()) {
if (mat.group(1).equals(MEMTOTAL_STRING)) {
ramSize = Long.parseLong(mat.group(2));
} else if (mat.group(1).equals(SWAPTOTAL_STRING)) {
swapSize = Long.parseLong(mat.group(2));
} else if (mat.group(1).equals(MEMFREE_STRING)) {
ramSizeFree = safeParseLong(mat.group(2));
} else if (mat.group(1).equals(SWAPFREE_STRING)) {
swapSizeFree = safeParseLong(mat.group(2));
} else if (mat.group(1).equals(INACTIVE_STRING)) {
inactiveSize = Long.parseLong(mat.group(2));
} else if (mat.group(1).equals(INACTIVEFILE_STRING)) {
inactiveFileSize = Long.parseLong(mat.group(2));
} else if (mat.group(1).equals(HARDWARECORRUPTED_STRING)) {
hardwareCorruptSize = Long.parseLong(mat.group(2));
} else if (mat.group(1).equals(HUGEPAGESTOTAL_STRING)) {
hugePagesTotal = Long.parseLong(mat.group(2));
} else if (mat.group(1).equals(HUGEPAGESIZE_STRING)) {
hugePageSize = Long.parseLong(mat.group(2));
}
}
str = in.readLine();
}
} catch (IOException io) {
LOG.warn("Error reading the stream " + io);
} finally {
// Close the streams
try {
fReader.close();
try {
in.close();
} catch (IOException i) {
LOG.warn("Error closing the stream " + in);
}
} catch (IOException i) {
LOG.warn("Error closing the stream " + fReader);
}
}
readMemInfoFile = true;
} | void function(boolean readAgain) { if (readMemInfoFile && !readAgain) { return; } BufferedReader in; InputStreamReader fReader; try { fReader = new InputStreamReader( Files.newInputStream(Paths.get(procfsMemFile)), Charset.forName("UTF-8")); in = new BufferedReader(fReader); } catch (IOException f) { LOG.warn(STR + procfsMemFile + STR); return; } Matcher mat; try { String str = in.readLine(); while (str != null) { mat = PROCFS_MEMFILE_FORMAT.matcher(str); if (mat.find()) { if (mat.group(1).equals(MEMTOTAL_STRING)) { ramSize = Long.parseLong(mat.group(2)); } else if (mat.group(1).equals(SWAPTOTAL_STRING)) { swapSize = Long.parseLong(mat.group(2)); } else if (mat.group(1).equals(MEMFREE_STRING)) { ramSizeFree = safeParseLong(mat.group(2)); } else if (mat.group(1).equals(SWAPFREE_STRING)) { swapSizeFree = safeParseLong(mat.group(2)); } else if (mat.group(1).equals(INACTIVE_STRING)) { inactiveSize = Long.parseLong(mat.group(2)); } else if (mat.group(1).equals(INACTIVEFILE_STRING)) { inactiveFileSize = Long.parseLong(mat.group(2)); } else if (mat.group(1).equals(HARDWARECORRUPTED_STRING)) { hardwareCorruptSize = Long.parseLong(mat.group(2)); } else if (mat.group(1).equals(HUGEPAGESTOTAL_STRING)) { hugePagesTotal = Long.parseLong(mat.group(2)); } else if (mat.group(1).equals(HUGEPAGESIZE_STRING)) { hugePageSize = Long.parseLong(mat.group(2)); } } str = in.readLine(); } } catch (IOException io) { LOG.warn(STR + io); } finally { try { fReader.close(); try { in.close(); } catch (IOException i) { LOG.warn(STR + in); } } catch (IOException i) { LOG.warn(STR + fReader); } } readMemInfoFile = true; } | /**
* Read /proc/meminfo, parse and compute memory information.
* @param readAgain if false, read only on the first time
*/ | Read /proc/meminfo, parse and compute memory information | readProcMemInfoFile | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SysInfoLinux.java",
"license": "apache-2.0",
"size": 23705
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.nio.charset.Charset",
"java.nio.file.Files",
"java.nio.file.Paths",
"java.util.regex.Matcher"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.util.regex.Matcher; | import java.io.*; import java.nio.charset.*; import java.nio.file.*; import java.util.regex.*; | [
"java.io",
"java.nio",
"java.util"
] | java.io; java.nio; java.util; | 1,237,199 |
@Test
public void testSetName() {
String name = "a test name";
QueueConfig queueConfig = new QueueConfig().setName(name);
assertEquals(name, queueConfig.getName());
} | void function() { String name = STR; QueueConfig queueConfig = new QueueConfig().setName(name); assertEquals(name, queueConfig.getName()); } | /**
* Test method for {@link com.hazelcast.config.QueueConfig#setName(java.lang.String)}.
*/ | Test method for <code>com.hazelcast.config.QueueConfig#setName(java.lang.String)</code> | testSetName | {
"repo_name": "tombujok/hazelcast",
"path": "hazelcast/src/test/java/com/hazelcast/config/QueueConfigTest.java",
"license": "apache-2.0",
"size": 3173
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 595,747 |
List<String> gitignoreLines = new ArrayList<String>();
try {
// default charset should be ok here
List<String> jazzignoreLines = Files.readLines(jazzignore, Charset.defaultCharset());
String lineForRegex = "";
boolean needToTransform = false;
for (String line : jazzignoreLines) {
line = line.trim();
if (!line.startsWith("#")) {
needToTransform = true;
lineForRegex += line;
if (!line.endsWith("\\")) {
addGroupsToList(lineForRegex, gitignoreLines);
lineForRegex = "";
needToTransform = false;
}
}
}
if (needToTransform) {
gitignoreLines = addGroupsToList(lineForRegex, gitignoreLines);
}
} catch (IOException ioe) {
throw new RuntimeException("unable to read .jazzignore file " + jazzignore.getAbsolutePath(), ioe);
}
return gitignoreLines;
} | List<String> gitignoreLines = new ArrayList<String>(); try { List<String> jazzignoreLines = Files.readLines(jazzignore, Charset.defaultCharset()); String lineForRegex = STR#STR\\STRSTRunable to read .jazzignore file " + jazzignore.getAbsolutePath(), ioe); } return gitignoreLines; } | /**
* Translates a .jazzignore file to .gitignore
*
* @param jazzignore
* the input .jazzignore file
*
* @return the translation, as a list of lines
*/ | Translates a .jazzignore file to .gitignore | toGitignore | {
"repo_name": "rtcTo/rtc2gitcli",
"path": "rtc2git.cli.extension/src/to/rtc/cli/migrate/util/JazzignoreTranslator.java",
"license": "mit",
"size": 2747
} | [
"java.nio.charset.Charset",
"java.util.ArrayList",
"java.util.List"
] | import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; | import java.nio.charset.*; import java.util.*; | [
"java.nio",
"java.util"
] | java.nio; java.util; | 1,607,423 |
public static void recordMediumTimesHistogram(String name, long duration, TimeUnit timeUnit) {
recordCustomTimesHistogramMilliseconds(
name, timeUnit.toMillis(duration), 10, TimeUnit.MINUTES.toMillis(3), 50);
} | static void function(String name, long duration, TimeUnit timeUnit) { recordCustomTimesHistogramMilliseconds( name, timeUnit.toMillis(duration), 10, TimeUnit.MINUTES.toMillis(3), 50); } | /**
* Records a sample in a histogram of times. Useful for recording medium durations. This is the
* Java equivalent of the UMA_HISTOGRAM_MEDIUM_TIMES C++ macro.
* @param name name of the histogram
* @param duration duration to be recorded
* @param timeUnit the unit of the duration argument
*/ | Records a sample in a histogram of times. Useful for recording medium durations. This is the Java equivalent of the UMA_HISTOGRAM_MEDIUM_TIMES C++ macro | recordMediumTimesHistogram | {
"repo_name": "Teamxrtc/webrtc-streaming-node",
"path": "third_party/webrtc/src/chromium/src/base/android/java/src/org/chromium/base/metrics/RecordHistogram.java",
"license": "mit",
"size": 8722
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,222,847 |
EReference getIfBranch_Statements(); | EReference getIfBranch_Statements(); | /**
* Returns the meta object for the containment reference list '{@link org.eclectic.frontend.core.IfBranch#getStatements <em>Statements</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Statements</em>'.
* @see org.eclectic.frontend.core.IfBranch#getStatements()
* @see #getIfBranch()
* @generated
*/ | Returns the meta object for the containment reference list '<code>org.eclectic.frontend.core.IfBranch#getStatements Statements</code>'. | getIfBranch_Statements | {
"repo_name": "jesusc/eclectic",
"path": "plugins/org.eclectic.frontend.asm/src-gen/org/eclectic/frontend/core/CorePackage.java",
"license": "gpl-3.0",
"size": 187193
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,635,920 |
public final ThreadFactory getThreadFactory() {
return this.threadFactory;
}
| final ThreadFactory function() { return this.threadFactory; } | /**
* Return the external factory to use for creating new Threads, if any.
*/ | Return the external factory to use for creating new Threads, if any | getThreadFactory | {
"repo_name": "bbossgroups/bbossgroups-3.5",
"path": "bboss-core/src/org/frameworkset/schedule/SimpleAsyncTaskExecutor.java",
"license": "apache-2.0",
"size": 7396
} | [
"java.util.concurrent.ThreadFactory"
] | import java.util.concurrent.ThreadFactory; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,621,599 |
public boolean isWritable() {
LOG.debug("Checking if file exists");
if (file.exists()) {
LOG.debug("Checking can write: " + file.canWrite());
return file.canWrite();
}
LOG.debug("Authorized");
return true;
}
private static final Method CAN_EXECUTE_METHOD;
static {
Method method = null;
try {
method = File.class.getMethod("canExecute");
} catch (Throwable t) {
}
CAN_EXECUTE_METHOD = method;
} | boolean function() { LOG.debug(STR); if (file.exists()) { LOG.debug(STR + file.canWrite()); return file.canWrite(); } LOG.debug(STR); return true; } private static final Method CAN_EXECUTE_METHOD; static { Method method = null; try { method = File.class.getMethod(STR); } catch (Throwable t) { } CAN_EXECUTE_METHOD = method; } | /**
* Check file write permission.
*/ | Check file write permission | isWritable | {
"repo_name": "lucastheisen/mina-sshd",
"path": "sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeSshFile.java",
"license": "apache-2.0",
"size": 19484
} | [
"java.io.File",
"java.lang.reflect.Method"
] | import java.io.File; import java.lang.reflect.Method; | import java.io.*; import java.lang.reflect.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 2,678,493 |
public long readVLong() throws IOException {
byte b = readByte();
long i = b & 0x7FL;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 7;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 14;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 21;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 28;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 35;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 42;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 49;
if ((b & 0x80) == 0) return i;
b = readByte();
i |= (b & 0x7FL) << 56;
if ((b & 0x80) == 0) return i;
throw new IOException("Invalid vLong detected (negative values disallowed)");
} | long function() throws IOException { byte b = readByte(); long i = b & 0x7FL; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 7; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 14; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 21; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 28; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 35; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 42; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 49; if ((b & 0x80) == 0) return i; b = readByte(); i = (b & 0x7FL) << 56; if ((b & 0x80) == 0) return i; throw new IOException(STR); } | /** Reads a long stored in variable-length format. Reads between one and
* nine bytes. Smaller values take fewer bytes. Negative numbers are not
* supported. */ | Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not | readVLong | {
"repo_name": "bighaidao/lucene",
"path": "lucene-core/src/main/java/org/apache/lucene/store/DataInput.java",
"license": "apache-2.0",
"size": 8458
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,562,662 |
public JsonArray getJsonArray(Object source, Object... jpath) {
return asJsonArray(get(jsonify(source), newJsonArray(jpath)));
} | JsonArray function(Object source, Object... jpath) { return asJsonArray(get(jsonify(source), newJsonArray(jpath))); } | /**
* Gets the JsonArray in the specified jpath.
*
* @param source the source
* @param jpath the fully qualified json path to the field required. eg get({'a': {'b': {'c': [1,
* 2, 3, 4]}}}, "a", "b" "c", 1]) is '2'. Numerals are presumed to be array indexes
* @return the json element returns 'Null' for any invalid path return the source if the input
* jpath is '.'
*/ | Gets the JsonArray in the specified jpath | getJsonArray | {
"repo_name": "balajeetm/json-mystique",
"path": "json-mystique-utils/gson-utils/src/main/java/com/balajeetm/mystique/util/gson/lever/JsonLever.java",
"license": "apache-2.0",
"size": 77289
} | [
"com.google.gson.JsonArray"
] | import com.google.gson.JsonArray; | import com.google.gson.*; | [
"com.google.gson"
] | com.google.gson; | 2,740,921 |
EEnum getStatus(); | EEnum getStatus(); | /**
* Returns the meta object for enum '{@link fopramodel.Status <em>Status</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for enum '<em>Status</em>'.
* @see fopramodel.Status
* @generated
*/ | Returns the meta object for enum '<code>fopramodel.Status Status</code>'. | getStatus | {
"repo_name": "ArendtTh/Seminar-Eclipse-WS201415",
"path": "de.unimarburg.swt.fopra.model/src/fopramodel/FopramodelPackage.java",
"license": "epl-1.0",
"size": 43454
} | [
"org.eclipse.emf.ecore.EEnum"
] | import org.eclipse.emf.ecore.EEnum; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,370,950 |
public final ClientCache getClientCache(final ClientCacheFactory factory) {
synchronized (JUnit4CacheTestCase.class) {
InternalCache gemFireCache = GemFireCacheImpl.getInstance();
if (gemFireCache != null && !gemFireCache.isClosed()
&& gemFireCache.getCancelCriterion().isCancelInProgress()) {
await("waiting for cache to close")
.until(gemFireCache::isClosed);
}
if (cache == null || cache.isClosed()) {
cache = null;
disconnectFromDS();
cache = (InternalCache) factory.create();
}
if (cache != null) {
IgnoredException.addIgnoredException("java.net.ConnectException");
}
return (ClientCache) cache;
}
} | final ClientCache function(final ClientCacheFactory factory) { synchronized (JUnit4CacheTestCase.class) { InternalCache gemFireCache = GemFireCacheImpl.getInstance(); if (gemFireCache != null && !gemFireCache.isClosed() && gemFireCache.getCancelCriterion().isCancelInProgress()) { await(STR) .until(gemFireCache::isClosed); } if (cache == null cache.isClosed()) { cache = null; disconnectFromDS(); cache = (InternalCache) factory.create(); } if (cache != null) { IgnoredException.addIgnoredException(STR); } return (ClientCache) cache; } } | /**
* Creates a client cache from the factory if one does not already exist.
*
* @since GemFire 6.5
*/ | Creates a client cache from the factory if one does not already exist | getClientCache | {
"repo_name": "PurelyApplied/geode",
"path": "geode-dunit/src/main/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java",
"license": "apache-2.0",
"size": 18299
} | [
"org.apache.geode.cache.client.ClientCache",
"org.apache.geode.cache.client.ClientCacheFactory",
"org.apache.geode.internal.cache.GemFireCacheImpl",
"org.apache.geode.internal.cache.InternalCache",
"org.apache.geode.test.awaitility.GeodeAwaitility",
"org.apache.geode.test.dunit.IgnoredException"
] | import org.apache.geode.cache.client.ClientCache; import org.apache.geode.cache.client.ClientCacheFactory; import org.apache.geode.internal.cache.GemFireCacheImpl; import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.test.awaitility.GeodeAwaitility; import org.apache.geode.test.dunit.IgnoredException; | import org.apache.geode.cache.client.*; import org.apache.geode.internal.cache.*; import org.apache.geode.test.awaitility.*; import org.apache.geode.test.dunit.*; | [
"org.apache.geode"
] | org.apache.geode; | 248,752 |
void loadTypes(IArena arena); | void loadTypes(IArena arena); | /**
* Load types for an arena from config.
*
* <p>For arena manager use.</p>
*
* @param arena The arena.
*/ | Load types for an arena from config. For arena manager use | loadTypes | {
"repo_name": "JCThePants/PV-StarAPI",
"path": "src/com/jcwhatever/pvs/api/points/IPointsManager.java",
"license": "mit",
"size": 2212
} | [
"com.jcwhatever.pvs.api.arena.IArena"
] | import com.jcwhatever.pvs.api.arena.IArena; | import com.jcwhatever.pvs.api.arena.*; | [
"com.jcwhatever.pvs"
] | com.jcwhatever.pvs; | 2,320,262 |
public interface BatchHandler {
public BatchResponsePart handleBatchPart(BatchRequestPart batchRequestPart) throws ODataException; | interface BatchHandler { public BatchResponsePart function(BatchRequestPart batchRequestPart) throws ODataException; | /**
* <p>Handles the {@link BatchRequestPart} in a way that it results in a corresponding {@link BatchResponsePart}.</p>
* @param batchRequestPart the incoming MIME part
* @return the corresponding result
* @throws ODataException
*/ | Handles the <code>BatchRequestPart</code> in a way that it results in a corresponding <code>BatchResponsePart</code> | handleBatchPart | {
"repo_name": "SAP/cloud-odata-java",
"path": "odata-api/src/main/java/com/sap/core/odata/api/batch/BatchHandler.java",
"license": "apache-2.0",
"size": 1706
} | [
"com.sap.core.odata.api.exception.ODataException"
] | import com.sap.core.odata.api.exception.ODataException; | import com.sap.core.odata.api.exception.*; | [
"com.sap.core"
] | com.sap.core; | 2,788,465 |
private void publishSchedule(SchedulePublishingData publishingData) {
boolean schedulePublished = false;
try {
// validate input
if(publishingData.to < timeService.now()) {
log.warning("Optimization time frame in past. Cancelling.");
return;
}
// collect problem data
SchedulingProblem problem = new SchedulingProblem();
// make sure $from is at the begin of a slot
problem.from = ensureTimeIsAtSlotStart(ZonedDateTime.ofInstant(Instant.ofEpochSecond(publishingData.from), ZoneId.systemDefault())).toEpochSecond();
problem.to = publishingData.to;
problem.slotLength = configuration.scheduleOptimizationSlotLength;
problem.optimizationTimeBuffer = configuration.optimizationTimeBuffer;
problem.flexibilityAdaptionBuffer = configuration.flexibilityAdaptationBuffer;
// get forecasts, use first suitable service
problem.electricityDemand = getConsumptionForecast(problem.from, problem.to);
problem.electricityProduction = getProductionForecast(problem.from, problem.to);
// consider meter configuration
if(component.getBaseConfiguration().meterConfiguration == MeterConfiguration.ConsumptionIncludingProduction) {
// demand forecast includes a production forecast -> remove production
for(int i = 0; i < problem.electricityDemand.length; i++) {
problem.electricityDemand[i] -= problem.electricityProduction[i];
// both forecasts are independent, hence demand could be negative
if(problem.electricityDemand[i] < 0) {
problem.electricityDemand[i] = 0;
}
}
}
// get all available flexibilities and tasks
problem.schedules = component.getCommunicationInterface().retrieveSchedules(problem.from, problem.to);
// use first found solver
for(OptimizationService service : component.getOptimizationServices()) {
if(service.canSolve(SchedulingProblem.class, SchedulingSolution.class)) {
// solve problem
SchedulingSolution solution = service.solve(problem, SchedulingProblem.class, SchedulingSolution.class);
log.finest("Scheduling tasks.");
// schedule tasks
component.getCommunicationInterface().scheduleTasks(solution.tasks, problem.schedules);
if(false == publishingData.initial) {
// check if schedule deviates from target
log.finest("Checking schedule for target deviations.");
boolean publish = false;
PublicSchedule targetSchedule = component.getTargetSchedule();
if(null != targetSchedule) {
// determine offset between target schedule start and solution schedule start
long offsetInSeconds = solution.schedule.startingTime - targetSchedule.startingTime;
int slotOffset = (int)(offsetInSeconds / configuration.scheduleOptimizationSlotLength);
// now check whether the absolute deviation exceeds the threshold for reporting
for(int i = 0; i < solution.schedule.consumption.length; i++) {
if(Math.abs(targetSchedule.consumption[i + slotOffset] - solution.schedule.consumption[i]) >
configuration.scheduleDeviationReportingThreshold) {
// deviation too large
log.finest(
"Consumption target='" + targetSchedule.consumption[i + slotOffset] +
"' deviates to much from solution='" +
solution.schedule.consumption[i] + "'");
publish = true;
break;
}
if(Math.abs(targetSchedule.production[i + slotOffset] - solution.schedule.production[i]) >
configuration.scheduleDeviationReportingThreshold) {
// deviation too large
log.finest(
"Production target='" + targetSchedule.production[i + slotOffset] +
"' deviates to much from solution='" +
solution.schedule.production[i] + "'");
publish = true;
break;
}
}
} else {
log.finest("No target schedule available.");
publish = true;
}
// publishing necessary?
if(true == publish) {
log.finest("Publishing schedule update.");
// publish solution
schedulePublished = Scheduler.getFmsCommunicationService().publishSchedule(solution.schedule, solution.flexibility,
PublicationType.ScheduleUpdate);
} else {
// nothing to publish, hence we are done
schedulePublished = true;
}
} else {
log.finest("Publishing schedule.");
// publish solution
schedulePublished = Scheduler.getFmsCommunicationService().publishSchedule(solution.schedule, solution.flexibility,
PublicationType.InitialSchedule);
// now update own target schedule to follow this publication
// update is only done for initial publication, since no target schedule has been set by FMS yet
log.finest("Updating target schedule using optimization solution.");
component.setTargetSchedule(solution.schedule);
}
// finished
break;
}
}
} finally {
if(!schedulePublished) {
// failure !
if(publishingData.initial) {
log.warning("Initial schedule publication failed!");
component.setIncompleteInitialPublication(publishingData);
} else {
log.warning("Updated schedule publication failed!");
component.setIncompleteUpdatePublication(publishingData);
}
// persistence
component.saveState();
} else {
log.info("Successfully finished schedule publication.");
// reset any publication attempt for this type of publication
if(publishingData.initial) {
component.setIncompleteInitialPublication(null);
// Sets the time for the next publication based on now.
// Keep in mind that this time is only used as reference on a scheduler restart to make sure at least one schedule is published.
// Using now + 1 day should be sufficient, since it is rewritten after every future publication (hopefully without previous errors).
component.getData().latestInitialSchedulePublication = timeService.now();
} else {
component.setIncompleteUpdatePublication(null);
component.getData().latestScheduleUpdatePublication = timeService.now();
}
// persistence
component.saveState();
}
}
}
| void function(SchedulePublishingData publishingData) { boolean schedulePublished = false; try { if(publishingData.to < timeService.now()) { log.warning(STR); return; } SchedulingProblem problem = new SchedulingProblem(); problem.from = ensureTimeIsAtSlotStart(ZonedDateTime.ofInstant(Instant.ofEpochSecond(publishingData.from), ZoneId.systemDefault())).toEpochSecond(); problem.to = publishingData.to; problem.slotLength = configuration.scheduleOptimizationSlotLength; problem.optimizationTimeBuffer = configuration.optimizationTimeBuffer; problem.flexibilityAdaptionBuffer = configuration.flexibilityAdaptationBuffer; problem.electricityDemand = getConsumptionForecast(problem.from, problem.to); problem.electricityProduction = getProductionForecast(problem.from, problem.to); if(component.getBaseConfiguration().meterConfiguration == MeterConfiguration.ConsumptionIncludingProduction) { for(int i = 0; i < problem.electricityDemand.length; i++) { problem.electricityDemand[i] -= problem.electricityProduction[i]; if(problem.electricityDemand[i] < 0) { problem.electricityDemand[i] = 0; } } } problem.schedules = component.getCommunicationInterface().retrieveSchedules(problem.from, problem.to); for(OptimizationService service : component.getOptimizationServices()) { if(service.canSolve(SchedulingProblem.class, SchedulingSolution.class)) { SchedulingSolution solution = service.solve(problem, SchedulingProblem.class, SchedulingSolution.class); log.finest(STR); component.getCommunicationInterface().scheduleTasks(solution.tasks, problem.schedules); if(false == publishingData.initial) { log.finest(STR); boolean publish = false; PublicSchedule targetSchedule = component.getTargetSchedule(); if(null != targetSchedule) { long offsetInSeconds = solution.schedule.startingTime - targetSchedule.startingTime; int slotOffset = (int)(offsetInSeconds / configuration.scheduleOptimizationSlotLength); for(int i = 0; i < solution.schedule.consumption.length; i++) { if(Math.abs(targetSchedule.consumption[i + slotOffset] - solution.schedule.consumption[i]) > configuration.scheduleDeviationReportingThreshold) { log.finest( STR + targetSchedule.consumption[i + slotOffset] + STR + solution.schedule.consumption[i] + "'"); publish = true; break; } if(Math.abs(targetSchedule.production[i + slotOffset] - solution.schedule.production[i]) > configuration.scheduleDeviationReportingThreshold) { log.finest( STR + targetSchedule.production[i + slotOffset] + STR + solution.schedule.production[i] + "'"); publish = true; break; } } } else { log.finest(STR); publish = true; } if(true == publish) { log.finest(STR); schedulePublished = Scheduler.getFmsCommunicationService().publishSchedule(solution.schedule, solution.flexibility, PublicationType.ScheduleUpdate); } else { schedulePublished = true; } } else { log.finest(STR); schedulePublished = Scheduler.getFmsCommunicationService().publishSchedule(solution.schedule, solution.flexibility, PublicationType.InitialSchedule); log.finest(STR); component.setTargetSchedule(solution.schedule); } break; } } } finally { if(!schedulePublished) { if(publishingData.initial) { log.warning(STR); component.setIncompleteInitialPublication(publishingData); } else { log.warning(STR); component.setIncompleteUpdatePublication(publishingData); } component.saveState(); } else { log.info(STR); if(publishingData.initial) { component.setIncompleteInitialPublication(null); component.getData().latestInitialSchedulePublication = timeService.now(); } else { component.setIncompleteUpdatePublication(null); component.getData().latestScheduleUpdatePublication = timeService.now(); } component.saveState(); } } } | /**
* PublicSchedule publishing
*
* Starts an optimization and then tries to publish the result.
* If publishing fails, another try (including a new optimization) is performed some time in the future.
*
* @param publishingData
*/ | PublicSchedule publishing Starts an optimization and then tries to publish the result. If publishing fails, another try (including a new optimization) is performed some time in the future | publishSchedule | {
"repo_name": "kfoerderer/gridcontrol-bems",
"path": "de.fzi.osh.scheduling/src/de/fzi/osh/scheduling/SchedulerController.java",
"license": "mit",
"size": 29299
} | [
"de.fzi.osh.com.fms.FmsCommunicationService",
"de.fzi.osh.com.fms.PublicSchedule",
"de.fzi.osh.core.configuration.BaseConfiguration",
"de.fzi.osh.optimization.OptimizationService",
"de.fzi.osh.optimization.schedule.SchedulingProblem",
"de.fzi.osh.optimization.schedule.SchedulingSolution",
"de.fzi.osh.scheduling.dataobjects.SchedulePublishingData",
"java.time.Instant",
"java.time.ZoneId",
"java.time.ZonedDateTime"
] | import de.fzi.osh.com.fms.FmsCommunicationService; import de.fzi.osh.com.fms.PublicSchedule; import de.fzi.osh.core.configuration.BaseConfiguration; import de.fzi.osh.optimization.OptimizationService; import de.fzi.osh.optimization.schedule.SchedulingProblem; import de.fzi.osh.optimization.schedule.SchedulingSolution; import de.fzi.osh.scheduling.dataobjects.SchedulePublishingData; import java.time.Instant; import java.time.ZoneId; import java.time.ZonedDateTime; | import de.fzi.osh.com.fms.*; import de.fzi.osh.core.configuration.*; import de.fzi.osh.optimization.*; import de.fzi.osh.optimization.schedule.*; import de.fzi.osh.scheduling.dataobjects.*; import java.time.*; | [
"de.fzi.osh",
"java.time"
] | de.fzi.osh; java.time; | 1,670,296 |
public static void init(String conf_filename, String tracker_server) throws FileNotFoundException, IOException, MyException {
IniFileReader iniReader;
String[] szTrackerServers;
String[] parts;
iniReader = new IniFileReader(conf_filename);
g_connect_timeout = iniReader.getIntValue("connect_timeout", DEFAULT_CONNECT_TIMEOUT);
if (g_connect_timeout < 0) {
g_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
}
g_connect_timeout *= 1000; //millisecond
g_network_timeout = iniReader.getIntValue("network_timeout", DEFAULT_NETWORK_TIMEOUT);
if (g_network_timeout < 0) {
g_network_timeout = DEFAULT_NETWORK_TIMEOUT;
}
g_network_timeout *= 1000; //millisecond
g_charset = iniReader.getStrValue("charset");
if (g_charset == null || g_charset.length() == 0) {
g_charset = "ISO8859-1";
}
szTrackerServers = iniReader.getValues("tracker_server");
if (szTrackerServers == null) {
szTrackerServers = tracker_server.split(";");
//throw new MyException("item \"tracker_server\" in " + conf_filename + " not found");
}
InetSocketAddress[] tracker_servers = new InetSocketAddress[szTrackerServers.length];
for (int i = 0; i < szTrackerServers.length; i++) {
parts = szTrackerServers[i].split("\\:", 2);
if (parts.length != 2) {
throw new MyException("the value of item \"tracker_server\" is invalid, the correct format is host:port");
}
tracker_servers[i] = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim()));
}
g_tracker_group = new TrackerGroup(tracker_servers);
g_tracker_http_port = iniReader.getIntValue("http.tracker_http_port", 80);
g_anti_steal_token = iniReader.getBoolValue("http.anti_steal_token", false);
if (g_anti_steal_token) {
g_secret_key = iniReader.getStrValue("http.secret_key");
}
} | static void function(String conf_filename, String tracker_server) throws FileNotFoundException, IOException, MyException { IniFileReader iniReader; String[] szTrackerServers; String[] parts; iniReader = new IniFileReader(conf_filename); g_connect_timeout = iniReader.getIntValue(STR, DEFAULT_CONNECT_TIMEOUT); if (g_connect_timeout < 0) { g_connect_timeout = DEFAULT_CONNECT_TIMEOUT; } g_connect_timeout *= 1000; g_network_timeout = iniReader.getIntValue(STR, DEFAULT_NETWORK_TIMEOUT); if (g_network_timeout < 0) { g_network_timeout = DEFAULT_NETWORK_TIMEOUT; } g_network_timeout *= 1000; g_charset = iniReader.getStrValue(STR); if (g_charset == null g_charset.length() == 0) { g_charset = STR; } szTrackerServers = iniReader.getValues(STR); if (szTrackerServers == null) { szTrackerServers = tracker_server.split(";"); } InetSocketAddress[] tracker_servers = new InetSocketAddress[szTrackerServers.length]; for (int i = 0; i < szTrackerServers.length; i++) { parts = szTrackerServers[i].split("\\:", 2); if (parts.length != 2) { throw new MyException(STRtracker_server\STR); } tracker_servers[i] = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim())); } g_tracker_group = new TrackerGroup(tracker_servers); g_tracker_http_port = iniReader.getIntValue(STR, 80); g_anti_steal_token = iniReader.getBoolValue(STR, false); if (g_anti_steal_token) { g_secret_key = iniReader.getStrValue(STR); } } | /**
* load global variables
* @param conf_filename config filename
*/ | load global variables | init | {
"repo_name": "babymm/mumu",
"path": "mumu-common/mumu-common-fdfs/src/main/java/org/csource/fastdfs/ClientGlobal.java",
"license": "apache-2.0",
"size": 5782
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"java.net.InetSocketAddress",
"org.csource.common.IniFileReader",
"org.csource.common.MyException"
] | import java.io.FileNotFoundException; import java.io.IOException; import java.net.InetSocketAddress; import org.csource.common.IniFileReader; import org.csource.common.MyException; | import java.io.*; import java.net.*; import org.csource.common.*; | [
"java.io",
"java.net",
"org.csource.common"
] | java.io; java.net; org.csource.common; | 1,927,506 |
public void makeRevocable(RevocationListener<T> listener, Executor executor); | void function(RevocationListener<T> listener, Executor executor); | /**
* Make the lock revocable. Your listener will get called when another process/thread
* wants you to release the lock. Revocation is cooperative.
*
* @param listener the listener
* @param executor executor for the listener
*/ | Make the lock revocable. Your listener will get called when another process/thread wants you to release the lock. Revocation is cooperative | makeRevocable | {
"repo_name": "box/curator",
"path": "curator-recipes/src/main/java/com/netflix/curator/framework/recipes/locks/Revocable.java",
"license": "apache-2.0",
"size": 1430
} | [
"java.util.concurrent.Executor"
] | import java.util.concurrent.Executor; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,612,859 |
private MatrixRunType getTestSuiteFromFile(String buildFileName) throws JAXBException {
File buildResultsFile = new File(buildFileName);
StreamSource source = new StreamSource(buildResultsFile);
JAXBElement<MatrixRunType> root = unmarshaller.unmarshal(source, MatrixRunType.class);
return root.getValue();
} | MatrixRunType function(String buildFileName) throws JAXBException { File buildResultsFile = new File(buildFileName); StreamSource source = new StreamSource(buildResultsFile); JAXBElement<MatrixRunType> root = unmarshaller.unmarshal(source, MatrixRunType.class); return root.getValue(); } | /**
* Use JAXB to create a MatrixRunType object from the file
*
* @param buildFileName Name of the build.xml file with results for a particular test run
* @return JAXB representation of the test result
* @throws JAXBException
*/ | Use JAXB to create a MatrixRunType object from the file | getTestSuiteFromFile | {
"repo_name": "fusesource/hudson-results",
"path": "src/main/java/org/fusesource/hudsonresults/SummarizeBuildResults.java",
"license": "apache-2.0",
"size": 15613
} | [
"java.io.File",
"javax.xml.bind.JAXBElement",
"javax.xml.bind.JAXBException",
"javax.xml.transform.stream.StreamSource"
] | import java.io.File; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.transform.stream.StreamSource; | import java.io.*; import javax.xml.bind.*; import javax.xml.transform.stream.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 680,557 |
public void setPropBuild(PDPropBuild propBuild)
{
dictionary.setItem(COSName.PROP_BUILD, propBuild);
}
| void function(PDPropBuild propBuild) { dictionary.setItem(COSName.PROP_BUILD, propBuild); } | /**
* PDF signature build dictionary. Provides informations about the signature handler.
*
* @param propBuild the prop build
*/ | PDF signature build dictionary. Provides informations about the signature handler | setPropBuild | {
"repo_name": "mdamt/PdfBox-Android",
"path": "library/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/PDSignature.java",
"license": "apache-2.0",
"size": 11115
} | [
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 1,194,504 |
protected void putIntoModel(final Map<String, Object> model, final String key, final Object value) {
LOGGER.trace("Adding attribute [{}] into the view model for [{}] with value [{}]", key, getClass().getSimpleName(), value);
model.put(key, value);
} | void function(final Map<String, Object> model, final String key, final Object value) { LOGGER.trace(STR, key, getClass().getSimpleName(), value); model.put(key, value); } | /**
* Put into model.
*
* @param model the model
* @param key the key
* @param value the value
*/ | Put into model | putIntoModel | {
"repo_name": "philliprower/cas",
"path": "core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java",
"license": "apache-2.0",
"size": 10513
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 219,616 |
private String hashToMD5(String password) {
String original = password;
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
md.update(original.getBytes());
byte[] digest = md.digest();
StringBuffer sb = new StringBuffer();
for (byte b : digest) {
sb.append(String.format("%02x", b & 0xff));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
return password;
}
}
@SuppressWarnings("serial")
static class MemberList extends ArrayList<Member>{}
@SuppressWarnings("serial")
static class UsernameList extends ArrayList<String>{}
@SuppressWarnings("serial")
static class BadgeList extends ArrayList<Badge>{} | String function(String password) { String original = password; MessageDigest md; try { md = MessageDigest.getInstance("MD5"); md.update(original.getBytes()); byte[] digest = md.digest(); StringBuffer sb = new StringBuffer(); for (byte b : digest) { sb.append(String.format("%02x", b & 0xff)); } return sb.toString(); } catch (NoSuchAlgorithmException e) { return password; } } @SuppressWarnings(STR) static class MemberList extends ArrayList<Member>{} @SuppressWarnings(STR) static class UsernameList extends ArrayList<String>{} @SuppressWarnings(STR) static class BadgeList extends ArrayList<Badge>{} | /**
* Hash to md5 a plain text password
* @param password
* @return the md5 hashed password
*/ | Hash to md5 a plain text password | hashToMD5 | {
"repo_name": "guillaumemaka/spring-social-betaseries",
"path": "spring-social-betaseries/src/main/java/org/springframework/social/betaseries/api/impl/MemberTemplate.java",
"license": "apache-2.0",
"size": 10699
} | [
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException",
"java.util.ArrayList",
"org.springframework.social.betaseries.api.Badge",
"org.springframework.social.betaseries.api.Member"
] | import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import org.springframework.social.betaseries.api.Badge; import org.springframework.social.betaseries.api.Member; | import java.security.*; import java.util.*; import org.springframework.social.betaseries.api.*; | [
"java.security",
"java.util",
"org.springframework.social"
] | java.security; java.util; org.springframework.social; | 1,844,591 |
public void onFinish();
}
public static final float ANIMATION_DURATION_IN_MILLIS = 850.0f;
// About 24 FPS.
private static final long DELAY_MILLIS = 41;
private static final int MAX_TRANSLATION_Y = 30;
private static final float ALPHA_DELIMITER = 0.95f;
private static final long SEC_TO_MILLIS = TimeUnit.SECONDS.toMillis(1);
private final TextView mSecondsView;
private long mTimeSeconds;
private long mStopTimeInFuture;
private CountDownListener mListener;
private boolean mStarted;
public CountDownView(Context context) {
this(context, null, 0);
}
public CountDownView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CountDownView(Context context, AttributeSet attrs, int style) {
super(context, attrs, style);
LayoutInflater.from(context).inflate(R.layout.card_countdown, this);
mSecondsView = (TextView) findViewById(R.id.seconds_view);
} | void function(); } public static final float ANIMATION_DURATION_IN_MILLIS = 850.0f; private static final long DELAY_MILLIS = 41; private static final int MAX_TRANSLATION_Y = 30; private static final float ALPHA_DELIMITER = 0.95f; private static final long SEC_TO_MILLIS = TimeUnit.SECONDS.toMillis(1); private final TextView mSecondsView; private long mTimeSeconds; private long mStopTimeInFuture; private CountDownListener mListener; private boolean mStarted; public CountDownView(Context context) { this(context, null, 0); } public CountDownView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CountDownView(Context context, AttributeSet attrs, int style) { super(context, attrs, style); LayoutInflater.from(context).inflate(R.layout.card_countdown, this); mSecondsView = (TextView) findViewById(R.id.seconds_view); } | /**
* Notified when the countdown is finished.
*/ | Notified when the countdown is finished | onFinish | {
"repo_name": "Munk801/ZGlass",
"path": "src/com/google/android/glass/zglass/CountDownView.java",
"license": "apache-2.0",
"size": 5272
} | [
"android.content.Context",
"android.util.AttributeSet",
"android.view.LayoutInflater",
"android.widget.TextView",
"java.util.concurrent.TimeUnit"
] | import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.TextView; import java.util.concurrent.TimeUnit; | import android.content.*; import android.util.*; import android.view.*; import android.widget.*; import java.util.concurrent.*; | [
"android.content",
"android.util",
"android.view",
"android.widget",
"java.util"
] | android.content; android.util; android.view; android.widget; java.util; | 567,336 |
private void traverse(ConQATGraphInnerNode node) throws ConQATException {
int depth = parentList.size();
parentList.add(node);
for (ConQATGraphInnerNode inner : new ArrayList<ConQATGraphInnerNode>(
node.getInnerNodes())) {
traverse(inner);
}
for (ConQATVertex vertex : new ArrayList<ConQATVertex>(node
.getChildVertices())) {
int targetDepth = determineDepth(vertex.getId());
if (targetDepth < depth) {
vertex.relocate(parentList.get(targetDepth));
}
}
parentList.remove(depth);
if (!node.hasChildren()) {
node.remove();
}
} | void function(ConQATGraphInnerNode node) throws ConQATException { int depth = parentList.size(); parentList.add(node); for (ConQATGraphInnerNode inner : new ArrayList<ConQATGraphInnerNode>( node.getInnerNodes())) { traverse(inner); } for (ConQATVertex vertex : new ArrayList<ConQATVertex>(node .getChildVertices())) { int targetDepth = determineDepth(vertex.getId()); if (targetDepth < depth) { vertex.relocate(parentList.get(targetDepth)); } } parentList.remove(depth); if (!node.hasChildren()) { node.remove(); } } | /**
* Traverse the node hierarchie, relocate the vertices and remove empty
* inner nodes.
*/ | Traverse the node hierarchie, relocate the vertices and remove empty inner nodes | traverse | {
"repo_name": "vimaier/conqat",
"path": "org.conqat.engine.graph/src/org/conqat/engine/graph/concentrate/HierarchySimplifier.java",
"license": "apache-2.0",
"size": 5094
} | [
"java.util.ArrayList",
"org.conqat.engine.core.core.ConQATException",
"org.conqat.engine.graph.nodes.ConQATGraphInnerNode",
"org.conqat.engine.graph.nodes.ConQATVertex"
] | import java.util.ArrayList; import org.conqat.engine.core.core.ConQATException; import org.conqat.engine.graph.nodes.ConQATGraphInnerNode; import org.conqat.engine.graph.nodes.ConQATVertex; | import java.util.*; import org.conqat.engine.core.core.*; import org.conqat.engine.graph.nodes.*; | [
"java.util",
"org.conqat.engine"
] | java.util; org.conqat.engine; | 2,394,854 |
public void setPartnerId(String partner) throws IOException {
write("PARTNER ID=" + partner);
String line = read();
if (!"PARTNEROK".equals(line))
throw new IOException("Invalid response " + line);
} | void function(String partner) throws IOException { write(STR + partner); String line = read(); if (!STR.equals(line)) throw new IOException(STR + line); } | /**
* Sets the partner ID of the beagle
*
* @param partner
* partner id (16 bytes, hex)
* @throws IOException
*/ | Sets the partner ID of the beagle | setPartnerId | {
"repo_name": "ligius-/jbeagle",
"path": "src/de/schierla/jbeagle/BeagleConnector.java",
"license": "gpl-3.0",
"size": 9221
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 547,108 |
public ObjectCodeService getObjectCodeService() {
return objectCodeService;
} | ObjectCodeService function() { return objectCodeService; } | /**
* Gets the objectCodeService attribute.
*
* @return Returns the objectCodeService.
*/ | Gets the objectCodeService attribute | getObjectCodeService | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-core/src/main/java/org/kuali/kfs/gl/batch/service/impl/EncumbranceClosingOriginEntryGenerationServiceImpl.java",
"license": "agpl-3.0",
"size": 35661
} | [
"org.kuali.kfs.coa.service.ObjectCodeService"
] | import org.kuali.kfs.coa.service.ObjectCodeService; | import org.kuali.kfs.coa.service.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,557,105 |
EReference getexportedHeading_FHeading(); | EReference getexportedHeading_FHeading(); | /**
* Returns the meta object for the containment reference '{@link org.xtext.example.delphi.delphi.exportedHeading#getFHeading <em>FHeading</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>FHeading</em>'.
* @see org.xtext.example.delphi.delphi.exportedHeading#getFHeading()
* @see #getexportedHeading()
* @generated
*/ | Returns the meta object for the containment reference '<code>org.xtext.example.delphi.delphi.exportedHeading#getFHeading FHeading</code>'. | getexportedHeading_FHeading | {
"repo_name": "adolfosbh/cs2as",
"path": "org.xtext.example.delphi/src-gen/org/xtext/example/delphi/delphi/DelphiPackage.java",
"license": "epl-1.0",
"size": 434880
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 416,107 |
Set<String> getActivatedGroupNames(ObjFace face);
| Set<String> getActivatedGroupNames(ObjFace face); | /**
* Returns an unmodifiable set containing the names of the groups that
* are activated with the given face. If the groups that are
* activated with the given face are the same as for the previous face,
* then <code>null</code> will be returned.
*
* @param face The face
* @return The names of the groups that are activated with the
* given face
*/ | Returns an unmodifiable set containing the names of the groups that are activated with the given face. If the groups that are activated with the given face are the same as for the previous face, then <code>null</code> will be returned | getActivatedGroupNames | {
"repo_name": "javagl/Obj",
"path": "src/main/java/de/javagl/obj/ReadableObj.java",
"license": "mit",
"size": 6936
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 25,581 |
public List<DimensionalItemObject> getFilterOptions( String filter )
{
int index = filters.indexOf( new BaseDimensionalObject( filter ) );
return index != -1 ? filters.get( index ).getItems() : new ArrayList<DimensionalItemObject>();
} | List<DimensionalItemObject> function( String filter ) { int index = filters.indexOf( new BaseDimensionalObject( filter ) ); return index != -1 ? filters.get( index ).getItems() : new ArrayList<DimensionalItemObject>(); } | /**
* Retrieves the options for the given filter. Returns an empty list if the
* filter is not present.
*/ | Retrieves the options for the given filter. Returns an empty list if the filter is not present | getFilterOptions | {
"repo_name": "EyeSeeTea/dhis2",
"path": "dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java",
"license": "gpl-3.0",
"size": 60770
} | [
"java.util.ArrayList",
"java.util.List",
"org.hisp.dhis.common.BaseDimensionalObject",
"org.hisp.dhis.common.DimensionalItemObject"
] | import java.util.ArrayList; import java.util.List; import org.hisp.dhis.common.BaseDimensionalObject; import org.hisp.dhis.common.DimensionalItemObject; | import java.util.*; import org.hisp.dhis.common.*; | [
"java.util",
"org.hisp.dhis"
] | java.util; org.hisp.dhis; | 544,390 |
public BigDecimal getErrorRate() {
return errorRate;
} | BigDecimal function() { return errorRate; } | /**
* Get the error rate of this evaluation
*
* @return BigDecimal
*/ | Get the error rate of this evaluation | getErrorRate | {
"repo_name": "sergenguetta/mercury",
"path": "src/main/java/mercury/annotation/AnnotationEvaluation.java",
"license": "mit",
"size": 9388
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 2,556,897 |
@Test
public void testUdpPortCriterionEquals() {
new EqualsTester()
.addEqualityGroup(matchUdpPort1, sameAsMatchUdpPort1)
.addEqualityGroup(matchUdpPort2)
.testEquals();
}
// TcpFlagsCriterion class | void function() { new EqualsTester() .addEqualityGroup(matchUdpPort1, sameAsMatchUdpPort1) .addEqualityGroup(matchUdpPort2) .testEquals(); } | /**
* Test the equals() method of the UdpPortCriterion class.
*/ | Test the equals() method of the UdpPortCriterion class | testUdpPortCriterionEquals | {
"repo_name": "sonu283304/onos",
"path": "core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java",
"license": "apache-2.0",
"size": 44713
} | [
"com.google.common.testing.EqualsTester"
] | import com.google.common.testing.EqualsTester; | import com.google.common.testing.*; | [
"com.google.common"
] | com.google.common; | 2,223,877 |
@RequiredScope({download})
@RequestMapping(value = UrlHelpers.FILE_DOWNLOAD, method = RequestMethod.GET)
public void fileRedirectURLForAffiliate(
@RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId,
@PathVariable String id,
@RequestParam(required = false) Boolean redirect,
@RequestParam(required = true) FileHandleAssociateType fileAssociateType,
@RequestParam(required = true) String fileAssociateId,
HttpServletResponse response) throws DatastoreException,
NotFoundException, IOException {
// Get the redirect url
String redirectUrl = fileService.getPresignedUrlForFileHandle(userId,
id, fileAssociateType, fileAssociateId);
RedirectUtils.handleRedirect(redirect, redirectUrl, response);
} | @RequiredScope({download}) @RequestMapping(value = UrlHelpers.FILE_DOWNLOAD, method = RequestMethod.GET) void function( @RequestParam(value = AuthorizationConstants.USER_ID_PARAM) Long userId, @PathVariable String id, @RequestParam(required = false) Boolean redirect, @RequestParam(required = true) FileHandleAssociateType fileAssociateType, @RequestParam(required = true) String fileAssociateId, HttpServletResponse response) throws DatastoreException, NotFoundException, IOException { String redirectUrl = fileService.getPresignedUrlForFileHandle(userId, id, fileAssociateType, fileAssociateId); RedirectUtils.handleRedirect(redirect, redirectUrl, response); } | /**
*
* Get the actual URL of the file from with an associated object .
* <p>
* Note: This call will result in a HTTP temporary redirect (307), to the
* actual file URL if the caller meets all of the download requirements.
* </p>
*
* @param userId
* @param id
* the ID of the file handle to be downloaded
* @param redirect
* When set to false, the URL will be returned as text/plain
* instead of redirecting.
* @param fileAssociateType
* the type of object with which the file is associated
* @param fileAssociateId
* the ID fo the object with which the file is associated
* @param response
* @throws DatastoreException
* @throws NotFoundException
* @throws IOException
*/ | Get the actual URL of the file from with an associated object . Note: This call will result in a HTTP temporary redirect (307), to the actual file URL if the caller meets all of the download requirements. | fileRedirectURLForAffiliate | {
"repo_name": "Sage-Bionetworks/Synapse-Repository-Services",
"path": "services/repository/src/main/java/org/sagebionetworks/file/controller/UploadController.java",
"license": "apache-2.0",
"size": 47138
} | [
"java.io.IOException",
"javax.servlet.http.HttpServletResponse",
"org.sagebionetworks.repo.model.AuthorizationConstants",
"org.sagebionetworks.repo.model.DatastoreException",
"org.sagebionetworks.repo.model.file.FileHandleAssociateType",
"org.sagebionetworks.repo.web.NotFoundException",
"org.sagebionetworks.repo.web.RequiredScope",
"org.sagebionetworks.repo.web.UrlHelpers",
"org.sagebionetworks.repo.web.controller.RedirectUtils",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.RequestParam"
] | import java.io.IOException; import javax.servlet.http.HttpServletResponse; import org.sagebionetworks.repo.model.AuthorizationConstants; import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.file.FileHandleAssociateType; import org.sagebionetworks.repo.web.NotFoundException; import org.sagebionetworks.repo.web.RequiredScope; import org.sagebionetworks.repo.web.UrlHelpers; import org.sagebionetworks.repo.web.controller.RedirectUtils; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; | import java.io.*; import javax.servlet.http.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.file.*; import org.sagebionetworks.repo.web.*; import org.sagebionetworks.repo.web.controller.*; import org.springframework.web.bind.annotation.*; | [
"java.io",
"javax.servlet",
"org.sagebionetworks.repo",
"org.springframework.web"
] | java.io; javax.servlet; org.sagebionetworks.repo; org.springframework.web; | 2,383,757 |
public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
return mapping.findForward(RiceConstants.MAPPING_BASIC);
} | ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward(RiceConstants.MAPPING_BASIC); } | /**
* Default refresh method. Called from returning frameworks.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/ | Default refresh method. Called from returning frameworks | refresh | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-kns/src/main/java/org/kuali/kfs/kns/web/struts/action/KualiAction.java",
"license": "agpl-3.0",
"size": 56528
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping",
"org.kuali.rice.core.api.util.RiceConstants"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.rice.core.api.util.RiceConstants; | import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.rice.core.api.util.*; | [
"javax.servlet",
"org.apache.struts",
"org.kuali.rice"
] | javax.servlet; org.apache.struts; org.kuali.rice; | 1,624,977 |
checkIterAddAllowed();
DataCursor cursor = null;
boolean doAutoCommit = beginAutoCommit();
try {
cursor = new DataCursor(view, true);
OperationStatus status =
cursor.getSearchKey(Long.valueOf(index), null, false);
if (status == OperationStatus.SUCCESS) {
cursor.putBefore(value);
closeCursor(cursor);
} else {
closeCursor(cursor);
cursor = null;
view.append(value, null, null);
}
commitAutoCommit(doAutoCommit);
} catch (Exception e) {
closeCursor(cursor);
throw handleException(e, doAutoCommit);
}
} | checkIterAddAllowed(); DataCursor cursor = null; boolean doAutoCommit = beginAutoCommit(); try { cursor = new DataCursor(view, true); OperationStatus status = cursor.getSearchKey(Long.valueOf(index), null, false); if (status == OperationStatus.SUCCESS) { cursor.putBefore(value); closeCursor(cursor); } else { closeCursor(cursor); cursor = null; view.append(value, null, null); } commitAutoCommit(doAutoCommit); } catch (Exception e) { closeCursor(cursor); throw handleException(e, doAutoCommit); } } | /**
* Inserts the specified element at the specified position in this list
* (optional operation).
* This method conforms to the {@link List#add(int, Object)} interface.
*
* @throws UnsupportedOperationException if the collection is a sublist, or
* if the collection is indexed, or if the collection is read-only, or if
* the RECNO-RENUMBER access method was not used.
*
* @throws RuntimeExceptionWrapper if a {@link DatabaseException} is
* thrown.
*/ | Inserts the specified element at the specified position in this list (optional operation). This method conforms to the <code>List#add(int, Object)</code> interface | add | {
"repo_name": "mxrrow/zaicoin",
"path": "src/deps/db/java/src/com/sleepycat/collections/StoredList.java",
"license": "mit",
"size": 20823
} | [
"com.sleepycat.db.OperationStatus"
] | import com.sleepycat.db.OperationStatus; | import com.sleepycat.db.*; | [
"com.sleepycat.db"
] | com.sleepycat.db; | 1,506,598 |
@Override
public Integer save(TMotdBean motdBean) {
TMotd tMotd;
try {
tMotd = BaseTMotd.createTMotd(motdBean);
tMotd.save();
return tMotd.getObjectID();
} catch (Exception e) {
LOGGER.error("Saving of motd failed with " + e.getMessage());
return null;
}
}
| Integer function(TMotdBean motdBean) { TMotd tMotd; try { tMotd = BaseTMotd.createTMotd(motdBean); tMotd.save(); return tMotd.getObjectID(); } catch (Exception e) { LOGGER.error(STR + e.getMessage()); return null; } } | /**
* Saves a motd bean
* @param motdBean
* @return
*/ | Saves a motd bean | save | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/TMotdPeer.java",
"license": "gpl-3.0",
"size": 3677
} | [
"com.aurel.track.beans.TMotdBean"
] | import com.aurel.track.beans.TMotdBean; | import com.aurel.track.beans.*; | [
"com.aurel.track"
] | com.aurel.track; | 2,446,260 |
public AFPResourceLevel getResourceLevel(Map foreignAttributes) {
AFPResourceLevel resourceLevel = null;
if (foreignAttributes != null && !foreignAttributes.isEmpty()) {
if (foreignAttributes.containsKey(RESOURCE_LEVEL)) {
String levelString = (String)foreignAttributes.get(RESOURCE_LEVEL);
resourceLevel = AFPResourceLevel.valueOf(levelString);
// if external get resource group file attributes
if (resourceLevel != null && resourceLevel.isExternal()) {
String resourceGroupFile
= (String)foreignAttributes.get(RESOURCE_GROUP_FILE);
if (resourceGroupFile == null) {
String msg = RESOURCE_GROUP_FILE + " not specified";
LOG.error(msg);
throw new UnsupportedOperationException(msg);
}
File resourceExternalGroupFile = new File(resourceGroupFile);
SecurityManager security = System.getSecurityManager();
try {
if (security != null) {
security.checkWrite(resourceExternalGroupFile.getPath());
}
} catch (SecurityException ex) {
String msg = "unable to gain write access to external resource file: "
+ resourceGroupFile;
LOG.error(msg);
}
try {
boolean exists = resourceExternalGroupFile.exists();
if (exists) {
LOG.warn("overwriting external resource file: "
+ resourceGroupFile);
}
resourceLevel.setExternalFilePath(resourceGroupFile);
} catch (SecurityException ex) {
String msg = "unable to gain read access to external resource file: "
+ resourceGroupFile;
LOG.error(msg);
}
}
}
}
return resourceLevel;
} | AFPResourceLevel function(Map foreignAttributes) { AFPResourceLevel resourceLevel = null; if (foreignAttributes != null && !foreignAttributes.isEmpty()) { if (foreignAttributes.containsKey(RESOURCE_LEVEL)) { String levelString = (String)foreignAttributes.get(RESOURCE_LEVEL); resourceLevel = AFPResourceLevel.valueOf(levelString); if (resourceLevel != null && resourceLevel.isExternal()) { String resourceGroupFile = (String)foreignAttributes.get(RESOURCE_GROUP_FILE); if (resourceGroupFile == null) { String msg = RESOURCE_GROUP_FILE + STR; LOG.error(msg); throw new UnsupportedOperationException(msg); } File resourceExternalGroupFile = new File(resourceGroupFile); SecurityManager security = System.getSecurityManager(); try { if (security != null) { security.checkWrite(resourceExternalGroupFile.getPath()); } } catch (SecurityException ex) { String msg = STR + resourceGroupFile; LOG.error(msg); } try { boolean exists = resourceExternalGroupFile.exists(); if (exists) { LOG.warn(STR + resourceGroupFile); } resourceLevel.setExternalFilePath(resourceGroupFile); } catch (SecurityException ex) { String msg = STR + resourceGroupFile; LOG.error(msg); } } } } return resourceLevel; } | /**
* Returns the resource level
*
* @param foreignAttributes the foreign attributes
* @return the resource level
*/ | Returns the resource level | getResourceLevel | {
"repo_name": "pellcorp/fop",
"path": "src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java",
"license": "apache-2.0",
"size": 5203
} | [
"java.io.File",
"java.util.Map",
"org.apache.fop.afp.AFPResourceLevel"
] | import java.io.File; import java.util.Map; import org.apache.fop.afp.AFPResourceLevel; | import java.io.*; import java.util.*; import org.apache.fop.afp.*; | [
"java.io",
"java.util",
"org.apache.fop"
] | java.io; java.util; org.apache.fop; | 2,481,406 |
public static boolean isBlank(final String value) {
return StringUtils.isBlank(value);
} | static boolean function(final String value) { return StringUtils.isBlank(value); } | /**
* Check that value is empty (""), null or whitespace only.
* @param value Value
* @return true if the String is not empty (""), not null and not whitespace only.
*/ | Check that value is empty (""), null or whitespace only | isBlank | {
"repo_name": "aksivaram2k2/jmeter-trunk",
"path": "src/jorphan/org/apache/jorphan/util/JOrphanUtils.java",
"license": "apache-2.0",
"size": 18915
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,867,873 |
private ObjectValue convertAndParseDocumentData(Object input, ParseContext context) {
String badDocReason =
"Invalid data. Data must be a Map<String, Object> or a suitable POJO object, but it was ";
// Check Array before calling CustomClassMapper since it'll give you a confusing message
// to use List instead, which also won't work in a set().
if (input.getClass().isArray()) {
throw new IllegalArgumentException(badDocReason + "an array");
}
Object converted = CustomClassMapper.convertToPlainJavaTypes(input);
Value parsedValue = parseData(converted, context);
if (parsedValue.getValueTypeCase() != Value.ValueTypeCase.MAP_VALUE) {
throw new IllegalArgumentException(badDocReason + "of type: " + Util.typeName(input));
}
return new ObjectValue(parsedValue);
} | ObjectValue function(Object input, ParseContext context) { String badDocReason = STR; if (input.getClass().isArray()) { throw new IllegalArgumentException(badDocReason + STR); } Object converted = CustomClassMapper.convertToPlainJavaTypes(input); Value parsedValue = parseData(converted, context); if (parsedValue.getValueTypeCase() != Value.ValueTypeCase.MAP_VALUE) { throw new IllegalArgumentException(badDocReason + STR + Util.typeName(input)); } return new ObjectValue(parsedValue); } | /**
* Converts a POJO to native types and then parses it into model types. It expects the input to
* conform to document data (i.e. it must parse into an ObjectValue model type) and will throw an
* appropriate error otherwise.
*/ | Converts a POJO to native types and then parses it into model types. It expects the input to conform to document data (i.e. it must parse into an ObjectValue model type) and will throw an appropriate error otherwise | convertAndParseDocumentData | {
"repo_name": "firebase/firebase-android-sdk",
"path": "firebase-firestore/src/main/java/com/google/firebase/firestore/UserDataReader.java",
"license": "apache-2.0",
"size": 20617
} | [
"com.google.firebase.firestore.core.UserData",
"com.google.firebase.firestore.model.ObjectValue",
"com.google.firebase.firestore.util.CustomClassMapper",
"com.google.firebase.firestore.util.Util",
"com.google.firestore.v1.Value"
] | import com.google.firebase.firestore.core.UserData; import com.google.firebase.firestore.model.ObjectValue; import com.google.firebase.firestore.util.CustomClassMapper; import com.google.firebase.firestore.util.Util; import com.google.firestore.v1.Value; | import com.google.firebase.firestore.core.*; import com.google.firebase.firestore.model.*; import com.google.firebase.firestore.util.*; import com.google.firestore.v1.*; | [
"com.google.firebase",
"com.google.firestore"
] | com.google.firebase; com.google.firestore; | 2,573,123 |
public void testGroupByRollup()
throws SQLException
{
Statement s = createStatement();
s.executeUpdate("create table ru (a int, b int, c int, d int)");
s.executeUpdate("insert into ru values (1,1,1,1), (1,2,3,4),"+
"(1,1,2,2), (4,3,2,1), (4,4,4,4)");
JDBC.assertUnorderedResultSet( s.executeQuery(
"select a,b,c,sum(d) from ru group by rollup(a,b,c)"),
new String[][]{
{"1","1","1","1"},
{"1","1","2","2"},
{"1","2","3","4"},
{"4","3","2","1"},
{"4","4","4","4"},
{"1","1",null,"3"},
{"1","2",null,"4"},
{"4","3",null,"1"},
{"4","4",null,"4"},
{"1",null,null,"7"},
{"4",null,null,"5"},
{null,null,null,"12"}});
JDBC.assertFullResultSet( s.executeQuery(
"select count(*) from ru group by mod(a,b)"),
new String[][]{ {"3"},{"2"}});
// Try a few negative tests:
assertStatementError("42X04", s,
"select a,b,c,sum(d) from ru group by rollup");
assertStatementError("42X01", s,
"select a,b,c,sum(d) from ru group by rollup(");
assertStatementError("42X01", s,
"select a,b,c,sum(d) from ru group by rollup)");
assertStatementError("42X01", s,
"select a,b,c,sum(d) from ru group by rollup()");
s.executeUpdate("drop table ru");
s.close();
} | void function() throws SQLException { Statement s = createStatement(); s.executeUpdate(STR); s.executeUpdate(STR+ STR); JDBC.assertUnorderedResultSet( s.executeQuery( STR), new String[][]{ {"1","1","1","1"}, {"1","1","2","2"}, {"1","2","3","4"}, {"4","3","2","1"}, {"4","4","4","4"}, {"1","1",null,"3"}, {"1","2",null,"4"}, {"4","3",null,"1"}, {"4","4",null,"4"}, {"1",null,null,"7"}, {"4",null,null,"5"}, {null,null,null,"12"}}); JDBC.assertFullResultSet( s.executeQuery( STR), new String[][]{ {"3"},{"2"}}); assertStatementError("42X04", s, STR); assertStatementError("42X01", s, STR); assertStatementError("42X01", s, STR); assertStatementError("42X01", s, STR); s.executeUpdate(STR); s.close(); } | /**
* Basic test of GROUP BY ROLLUP capability.
*
* This test case has a few basic tests of GROUP BY ROLLUP, both
* positive and negative tests.
*/ | Basic test of GROUP BY ROLLUP capability. This test case has a few basic tests of GROUP BY ROLLUP, both positive and negative tests | testGroupByRollup | {
"repo_name": "splicemachine/spliceengine",
"path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/lang/OLAPTest.java",
"license": "agpl-3.0",
"size": 51427
} | [
"com.splicemachine.dbTesting.junit.JDBC",
"java.sql.SQLException",
"java.sql.Statement"
] | import com.splicemachine.dbTesting.junit.JDBC; import java.sql.SQLException; import java.sql.Statement; | import com.splicemachine.*; import java.sql.*; | [
"com.splicemachine",
"java.sql"
] | com.splicemachine; java.sql; | 319,761 |
protected long getHostAppId() {
Cursor cursor = null;
try {
cursor = mContext.getContentResolver().query(HostApp.URI,
new String[] { HostAppColumns._ID },
HostAppColumns.PACKAGE_NAME + " = ?",
new String[] { mHostAppPackageName }, null);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getLong(cursor
.getColumnIndexOrThrow(HostAppColumns._ID));
}
} catch (SQLException e) {
if (Dbg.DEBUG) {
Dbg.w("Failed to query host apps", e);
}
} catch (SecurityException e) {
if (Dbg.DEBUG) {
Dbg.w("Failed to query host apps", e);
}
} catch (IllegalArgumentException e) {
if (Dbg.DEBUG) {
Dbg.w("Failed to query host apps", e);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return -1;
} | long function() { Cursor cursor = null; try { cursor = mContext.getContentResolver().query(HostApp.URI, new String[] { HostAppColumns._ID }, HostAppColumns.PACKAGE_NAME + STR, new String[] { mHostAppPackageName }, null); if (cursor != null && cursor.moveToFirst()) { return cursor.getLong(cursor .getColumnIndexOrThrow(HostAppColumns._ID)); } } catch (SQLException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } catch (SecurityException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } catch (IllegalArgumentException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } finally { if (cursor != null) { cursor.close(); } } return -1; } | /**
* Get the host application id for this control.
*
* @return The host application id.
*/ | Get the host application id for this control | getHostAppId | {
"repo_name": "Ayrat-Salavatovich/Learn_Android_Programming",
"path": "Day 114/SmartWatchPlayer/src/com/sonyericsson/extras/liveware/extension/util/control/ControlExtension.java",
"license": "unlicense",
"size": 22724
} | [
"android.database.Cursor",
"android.database.SQLException",
"com.sonyericsson.extras.liveware.aef.registration.Registration",
"com.sonyericsson.extras.liveware.extension.util.Dbg"
] | import android.database.Cursor; import android.database.SQLException; import com.sonyericsson.extras.liveware.aef.registration.Registration; import com.sonyericsson.extras.liveware.extension.util.Dbg; | import android.database.*; import com.sonyericsson.extras.liveware.aef.registration.*; import com.sonyericsson.extras.liveware.extension.util.*; | [
"android.database",
"com.sonyericsson.extras"
] | android.database; com.sonyericsson.extras; | 1,561,850 |
public static long getMaxSequenceIdInList(Collection<StoreFile> sfs) {
long max = 0;
for (StoreFile sf : sfs) {
max = Math.max(max, sf.getMaxSequenceId());
}
return max;
} | static long function(Collection<StoreFile> sfs) { long max = 0; for (StoreFile sf : sfs) { max = Math.max(max, sf.getMaxSequenceId()); } return max; } | /**
* Return the highest sequence ID found across all storefiles in
* the given list.
* @param sfs
* @return 0 if no non-bulk-load files are provided or, this is Store that
* does not yet have any store files.
*/ | Return the highest sequence ID found across all storefiles in the given list | getMaxSequenceIdInList | {
"repo_name": "narendragoyal/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java",
"license": "apache-2.0",
"size": 57432
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 377,494 |
public void showAbsolute(Component invoker, int x, int y) {
GUIHelper.showPopupMenu(this, invoker, x, y);
} | void function(Component invoker, int x, int y) { GUIHelper.showPopupMenu(this, invoker, x, y); } | /**
* Displays the popup menu using the absolute screen position.
*
* @param invoker the invoking component
* @param x the absolute X position on screen
* @param y the absolute Y position on screen
*/ | Displays the popup menu using the absolute screen position | showAbsolute | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/main/java/adams/gui/core/BasePopupMenu.java",
"license": "gpl-3.0",
"size": 4043
} | [
"java.awt.Component"
] | import java.awt.Component; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,650,664 |
public static String toString(PropertyIdValue o) {
return o.getIri() + " (property)";
} | static String function(PropertyIdValue o) { return o.getIri() + STR; } | /**
* Returns a human-readable string representation of the given object.
*
* @see java.lang.Object#toString()
* @param o
* the object to represent as string
* @return a string representation of the object
*/ | Returns a human-readable string representation of the given object | toString | {
"repo_name": "notconfusing/Wikidata-Toolkit",
"path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/ToString.java",
"license": "apache-2.0",
"size": 15918
} | [
"org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue"
] | import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue; | import org.wikidata.wdtk.datamodel.interfaces.*; | [
"org.wikidata.wdtk"
] | org.wikidata.wdtk; | 697,002 |
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> createCluster(
com.google.bigtable.admin.v2.CreateClusterRequest request) {
return futureUnaryCall(
getChannel().newCall(getCreateClusterMethodHelper(), getCallOptions()), request);
} | com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> function( com.google.bigtable.admin.v2.CreateClusterRequest request) { return futureUnaryCall( getChannel().newCall(getCreateClusterMethodHelper(), getCallOptions()), request); } | /**
* <pre>
* Creates a cluster within an instance.
* </pre>
*/ | <code> Creates a cluster within an instance. </code> | createCluster | {
"repo_name": "pongad/api-client-staging",
"path": "generated/java/grpc-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BigtableInstanceAdminGrpc.java",
"license": "bsd-3-clause",
"size": 106367
} | [
"io.grpc.stub.ClientCalls"
] | import io.grpc.stub.ClientCalls; | import io.grpc.stub.*; | [
"io.grpc.stub"
] | io.grpc.stub; | 278,352 |
MastershipService mastership(); | MastershipService mastership(); | /**
* Reference to a mastership service implementation.
*
* @return mastership service
*/ | Reference to a mastership service implementation | mastership | {
"repo_name": "donNewtonAlpha/onos",
"path": "core/api/src/main/java/org/onosproject/ui/model/ServiceBundle.java",
"license": "apache-2.0",
"size": 2445
} | [
"org.onosproject.mastership.MastershipService"
] | import org.onosproject.mastership.MastershipService; | import org.onosproject.mastership.*; | [
"org.onosproject.mastership"
] | org.onosproject.mastership; | 1,747,799 |
void generateInitialAttributes(final Map<I_M_Attribute, Object> defaultAttributesValue); | void generateInitialAttributes(final Map<I_M_Attribute, Object> defaultAttributesValue); | /**
* Generate initial storage attributes
*
* @param defaultAttributesValue
* @throws AdempiereException if attributes were already generated
*/ | Generate initial storage attributes | generateInitialAttributes | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/attribute/storage/IAttributeStorage.java",
"license": "gpl-2.0",
"size": 13224
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,452,856 |
public void setSwipeThreshold(float swipeThreshold) {
this.swipeThreshold = swipeThreshold;
}
class AnimatePanX implements Animation {
private Motion motion;
private Image replaceImage;
private int updatePos;
public AnimatePanX(float destPan, Image replaceImage, int updatePos) {
motion = Motion.createEaseInOutMotion((int)(panPositionX * 10000), (int)(destPan * 10000), 200);
motion.start();
this.replaceImage = replaceImage;
this.updatePos = updatePos;
Display.getInstance().getCurrent().registerAnimated(this);
} | void function(float swipeThreshold) { this.swipeThreshold = swipeThreshold; } class AnimatePanX implements Animation { private Motion motion; private Image replaceImage; private int updatePos; public AnimatePanX(float destPan, Image replaceImage, int updatePos) { motion = Motion.createEaseInOutMotion((int)(panPositionX * 10000), (int)(destPan * 10000), 200); motion.start(); this.replaceImage = replaceImage; this.updatePos = updatePos; Display.getInstance().getCurrent().registerAnimated(this); } | /**
* The swipe threshold is a number between 0 and 1 that indicates the threshold
* after which the swiped image moves to the next image. Below that number the image
* will bounce back
* @param swipeThreshold the swipeThreshold to set
*/ | The swipe threshold is a number between 0 and 1 that indicates the threshold after which the swiped image moves to the next image. Below that number the image will bounce back | setSwipeThreshold | {
"repo_name": "sannysanoff/CodenameOne",
"path": "CodenameOne/src/com/codename1/components/ImageViewer.java",
"license": "gpl-2.0",
"size": 27999
} | [
"com.codename1.ui.Display",
"com.codename1.ui.Image",
"com.codename1.ui.animations.Animation",
"com.codename1.ui.animations.Motion"
] | import com.codename1.ui.Display; import com.codename1.ui.Image; import com.codename1.ui.animations.Animation; import com.codename1.ui.animations.Motion; | import com.codename1.ui.*; import com.codename1.ui.animations.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 47,378 |
public static final SecretKeyFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
if (algorithm == null) {
throw new NullPointerException(Messages.getString("crypto.02")); //$NON-NLS-1$
}
synchronized (engine) {
engine.getInstance(algorithm, null);
return new SecretKeyFactory((SecretKeyFactorySpi) engine.spi,
engine.provider, algorithm);
}
}
| static final SecretKeyFactory function(String algorithm) throws NoSuchAlgorithmException { if (algorithm == null) { throw new NullPointerException(Messages.getString(STR)); } synchronized (engine) { engine.getInstance(algorithm, null); return new SecretKeyFactory((SecretKeyFactorySpi) engine.spi, engine.provider, algorithm); } } | /**
* Creates a new {@code SecretKeyFactory} instance for the specified key
* algorithm.
*
* @param algorithm
* the name of the key algorithm.
* @return a secret key factory for the specified key algorithm.
* @throws NoSuchAlgorithmException
* if no installed provider can provide the requested algorithm.
* @throws NullPointerException
* if the specified algorithm is {@code null}.
*/ | Creates a new SecretKeyFactory instance for the specified key algorithm | getInstance | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/crypto/src/main/java/javax/crypto/SecretKeyFactory.java",
"license": "gpl-2.0",
"size": 8801
} | [
"java.security.NoSuchAlgorithmException",
"org.apache.harmony.crypto.internal.nls.Messages"
] | import java.security.NoSuchAlgorithmException; import org.apache.harmony.crypto.internal.nls.Messages; | import java.security.*; import org.apache.harmony.crypto.internal.nls.*; | [
"java.security",
"org.apache.harmony"
] | java.security; org.apache.harmony; | 1,068,846 |
protected ECSchema getSchema() {
return schema;
} | ECSchema function() { return schema; } | /**
* Get EC schema.
* @return
*/ | Get EC schema | getSchema | {
"repo_name": "robzor92/hops",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/grouper/BlockGrouper.java",
"license": "apache-2.0",
"size": 2879
} | [
"org.apache.hadoop.io.erasurecode.ECSchema"
] | import org.apache.hadoop.io.erasurecode.ECSchema; | import org.apache.hadoop.io.erasurecode.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 943,909 |
public static Document parse(InputSource inputSource) throws SAXException,
IOException {
DocumentBuilder db = getBuilder();
return db.parse(inputSource);
} | static Document function(InputSource inputSource) throws SAXException, IOException { DocumentBuilder db = getBuilder(); return db.parse(inputSource); } | /**
* Parse an XML document located using an {@link InputSource} using the
* pooled document builder.
*/ | Parse an XML document located using an <code>InputSource</code> using the pooled document builder | parse | {
"repo_name": "TheRingbearer/HAWKS",
"path": "ode/utils/src/main/java/org/apache/ode/utils/DOMUtils.java",
"license": "apache-2.0",
"size": 40920
} | [
"java.io.IOException",
"javax.xml.parsers.DocumentBuilder",
"org.w3c.dom.Document",
"org.xml.sax.InputSource",
"org.xml.sax.SAXException"
] | import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | java.io; javax.xml; org.w3c.dom; org.xml.sax; | 1,402,920 |
public Unit getValue(); | Unit function(); | /**
* Return the value of this measurement.
*
* @return The wrapped value (an instance of TheUnit)
*/ | Return the value of this measurement | getValue | {
"repo_name": "openxc/openxc-android",
"path": "library/src/main/java/com/openxc/measurements/Measurement.java",
"license": "bsd-3-clause",
"size": 1877
} | [
"com.openxc.units.Unit"
] | import com.openxc.units.Unit; | import com.openxc.units.*; | [
"com.openxc.units"
] | com.openxc.units; | 1,116,870 |
if (!UrlValidatorUtil.isValid(longURL)) {
return Either.left(Constants.INVALID_URL);
}
Url shortenUrl = getUrlIfAlreadyShortened(longURL);
String shortenCode = (shortenUrl != null) ? shortenUrl.getShorthand() : createShortenUrl(longURL);
return Either.right(shortenCode);
} | if (!UrlValidatorUtil.isValid(longURL)) { return Either.left(Constants.INVALID_URL); } Url shortenUrl = getUrlIfAlreadyShortened(longURL); String shortenCode = (shortenUrl != null) ? shortenUrl.getShorthand() : createShortenUrl(longURL); return Either.right(shortenCode); } | /**
* Check of the given URL is valid, if valid check if it is already shortened,
* if not shorten and return the shorten code.
*
* @param longURL URL that needed to be shortened.
* @return String representing Shorten code.
*/ | Check of the given URL is valid, if valid check if it is already shortened, if not shorten and return the shorten code | returnShortenCode | {
"repo_name": "urls/url-shortener",
"path": "url-shortener-backend/src/main/java/me/amarpandey/urlshortener/services/UrlShortenerService.java",
"license": "mit",
"size": 3076
} | [
"io.vavr.control.Either",
"me.amarpandey.urlshortener.entity.Url",
"me.amarpandey.urlshortener.utils.Constants",
"me.amarpandey.urlshortener.validators.UrlValidatorUtil"
] | import io.vavr.control.Either; import me.amarpandey.urlshortener.entity.Url; import me.amarpandey.urlshortener.utils.Constants; import me.amarpandey.urlshortener.validators.UrlValidatorUtil; | import io.vavr.control.*; import me.amarpandey.urlshortener.entity.*; import me.amarpandey.urlshortener.utils.*; import me.amarpandey.urlshortener.validators.*; | [
"io.vavr.control",
"me.amarpandey.urlshortener"
] | io.vavr.control; me.amarpandey.urlshortener; | 372,037 |
// [START dialogflow_delete_entity]
public static void deleteEntity(String projectId, String entityTypeId, String entityValue)
throws Exception {
// Instantiates a client
try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
// Set the entity type name using the projectID (my-project-id) and entityTypeId (KINDS_LIST)
EntityTypeName name = EntityTypeName.of(projectId, entityTypeId);
// Performs the delete entity type request
entityTypesClient.batchDeleteEntitiesAsync(name, Arrays.asList(entityValue))
.getInitialFuture().get();
}
}
// [END dialogflow_delete_entity] | static void function(String projectId, String entityTypeId, String entityValue) throws Exception { try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { EntityTypeName name = EntityTypeName.of(projectId, entityTypeId); entityTypesClient.batchDeleteEntitiesAsync(name, Arrays.asList(entityValue)) .getInitialFuture().get(); } } | /**
* Delete entity with the given entity type and entity value
* @param projectId Project/agent id.
* @param entityTypeId The id of the entity_type.
* @param entityValue The value of the entity to delete.
*/ | Delete entity with the given entity type and entity value | deleteEntity | {
"repo_name": "dialogflow/dialogflow-java-client-v2",
"path": "samples/src/main/java/com/example/dialogflow/EntityManagement.java",
"license": "apache-2.0",
"size": 7043
} | [
"com.google.cloud.dialogflow.v2.EntityTypeName",
"com.google.cloud.dialogflow.v2.EntityTypesClient",
"java.util.Arrays"
] | import com.google.cloud.dialogflow.v2.EntityTypeName; import com.google.cloud.dialogflow.v2.EntityTypesClient; import java.util.Arrays; | import com.google.cloud.dialogflow.v2.*; import java.util.*; | [
"com.google.cloud",
"java.util"
] | com.google.cloud; java.util; | 2,201,378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.