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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public RegExp anyChar() {
// FIXME: there is some code duplication here with the parser
List<Interval> list = new ArrayList<Interval>();
list.add(new Interval(0, CharClasses.maxChar));
return new RegExp1(sym.CCLASS,list);
} | RegExp function() { List<Interval> list = new ArrayList<Interval>(); list.add(new Interval(0, CharClasses.maxChar)); return new RegExp1(sym.CCLASS,list); } | /**
* Returns a regexp that matches any character: <code>[^]</code>
* @return the regexp for <code>[^]</code>
*/ | Returns a regexp that matches any character: <code>[^]</code> | anyChar | {
"repo_name": "ravileite/Compiladores",
"path": "libraries/JFlex/jflex-1.6.1/src/main/java/jflex/RegExp.java",
"license": "apache-2.0",
"size": 9244
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,454,484 |
public void setCertificateFactory(CertificateFactory certFactory) {
this.certificateFactory = certFactory;
} | void function(CertificateFactory certFactory) { this.certificateFactory = certFactory; } | /**
* Sets the CertificateFactory instance on this Crypto instance
*
* @param certFactory the CertificateFactory the CertificateFactory instance to set
*/ | Sets the CertificateFactory instance on this Crypto instance | setCertificateFactory | {
"repo_name": "asoldano/wss4j",
"path": "ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java",
"license": "apache-2.0",
"size": 12639
} | [
"java.security.cert.CertificateFactory"
] | import java.security.cert.CertificateFactory; | import java.security.cert.*; | [
"java.security"
] | java.security; | 1,775,344 |
private boolean changeStateTo(DeviceId d, PortNumber p, BlockState newState) {
Map<PortNumber, BlockState> portMap =
blockedPorts.computeIfAbsent(d, k -> new HashMap<>());
BlockState oldState =
portMap.computeIfAbsent(p, k -> BlockState.UNCHECKED);
portMap.put(p, newState);
return (oldState != newState);
} | boolean function(DeviceId d, PortNumber p, BlockState newState) { Map<PortNumber, BlockState> portMap = blockedPorts.computeIfAbsent(d, k -> new HashMap<>()); BlockState oldState = portMap.computeIfAbsent(p, k -> BlockState.UNCHECKED); portMap.put(p, newState); return (oldState != newState); } | /**
* Changes the state of the given device id / port number pair to the
* specified state.
*
* @param d device identifier
* @param p port number
* @param newState the updated state
* @return true, if the state changed from what was previously mapped
*/ | Changes the state of the given device id / port number pair to the specified state | changeStateTo | {
"repo_name": "kuujo/onos",
"path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/PortAuthTracker.java",
"license": "apache-2.0",
"size": 11308
} | [
"java.util.HashMap",
"java.util.Map",
"org.onosproject.net.DeviceId",
"org.onosproject.net.PortNumber"
] | import java.util.HashMap; import java.util.Map; import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber; | import java.util.*; import org.onosproject.net.*; | [
"java.util",
"org.onosproject.net"
] | java.util; org.onosproject.net; | 1,863,439 |
protected void copy(PackFile file, InputStream in, File target) throws IOException
{
OutputStream out = getTarget(file, target);
try
{
byte[] buffer = new byte[5120];
long bytesCopied = 0;
while (bytesCopied < file.length())
{
if (cancellable.isCancelled())
{
// operation cancelled
throw new InterruptedIOException("Copy operation cancelled");
}
bytesCopied = copy(file, buffer, in, out, bytesCopied);
}
}
finally
{
FileUtils.close(out);
}
postCopy(file);
} | void function(PackFile file, InputStream in, File target) throws IOException { OutputStream out = getTarget(file, target); try { byte[] buffer = new byte[5120]; long bytesCopied = 0; while (bytesCopied < file.length()) { if (cancellable.isCancelled()) { throw new InterruptedIOException(STR); } bytesCopied = copy(file, buffer, in, out, bytesCopied); } } finally { FileUtils.close(out); } postCopy(file); } | /**
* Copies an input stream to a target, setting its timestamp to that of the pack file.
* <p/>
* If the target is a blockable file, then a temporary file will be created, and the file queued.
*
* @param file the pack file
* @param in the pack file stream
* @param target the file to write to
* @throws InterruptedIOException if the copy operation is cancelled
* @throws IOException for any I/O error
*/ | Copies an input stream to a target, setting its timestamp to that of the pack file. If the target is a blockable file, then a temporary file will be created, and the file queued | copy | {
"repo_name": "mtjandra/izpack",
"path": "izpack-installer/src/main/java/com/izforge/izpack/installer/unpacker/FileUnpacker.java",
"license": "apache-2.0",
"size": 8523
} | [
"com.izforge.izpack.api.data.PackFile",
"com.izforge.izpack.util.file.FileUtils",
"java.io.File",
"java.io.IOException",
"java.io.InputStream",
"java.io.InterruptedIOException",
"java.io.OutputStream"
] | import com.izforge.izpack.api.data.PackFile; import com.izforge.izpack.util.file.FileUtils; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InterruptedIOException; import java.io.OutputStream; | import com.izforge.izpack.api.data.*; import com.izforge.izpack.util.file.*; import java.io.*; | [
"com.izforge.izpack",
"java.io"
] | com.izforge.izpack; java.io; | 1,802,321 |
Collection<BranchResponse> getBranches(String spaceName, String projectName); | Collection<BranchResponse> getBranches(String spaceName, String projectName); | /**
* [GET] /spaces/{spaceName}/projects/{projectName}/branches
*/ | [GET] /spaces/{spaceName}/projects/{projectName}/branches | getBranches | {
"repo_name": "manstis/kie-wb-distributions",
"path": "business-central-tests/business-central-tests-rest/src/main/java/org/kie/wb/test/rest/client/WorkbenchClient.java",
"license": "apache-2.0",
"size": 6450
} | [
"java.util.Collection",
"org.guvnor.rest.client.BranchResponse"
] | import java.util.Collection; import org.guvnor.rest.client.BranchResponse; | import java.util.*; import org.guvnor.rest.client.*; | [
"java.util",
"org.guvnor.rest"
] | java.util; org.guvnor.rest; | 2,680,976 |
private boolean markReferencedVar(Var var) {
if (referenced.add(var)) {
for (Continuation c : continuations.get(var)) {
c.apply();
}
return true;
}
return false;
} | boolean function(Var var) { if (referenced.add(var)) { for (Continuation c : continuations.get(var)) { c.apply(); } return true; } return false; } | /**
* Marks a var as referenced, recursing into any values of this var
* that we skipped.
* @return True if this variable had not been referenced before.
*/ | Marks a var as referenced, recursing into any values of this var that we skipped | markReferencedVar | {
"repo_name": "zombiezen/cardcpx",
"path": "third_party/closure-compiler/src/com/google/javascript/jscomp/RemoveUnusedVars.java",
"license": "apache-2.0",
"size": 34961
} | [
"com.google.javascript.jscomp.Scope"
] | import com.google.javascript.jscomp.Scope; | import com.google.javascript.jscomp.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,153,415 |
public boolean close() {
synchronized (this) {
shutdown.set(true);
emsToShutDown = new CountDownLatch(emSet.size());
}
try {
emsToShutDown.await(shutdownWaitTime, shutdownWaitTimeUnit);
} catch (InterruptedException e) {
}
return shutdownRemaining();
} | boolean function() { synchronized (this) { shutdown.set(true); emsToShutDown = new CountDownLatch(emSet.size()); } try { emsToShutDown.await(shutdownWaitTime, shutdownWaitTimeUnit); } catch (InterruptedException e) { } return shutdownRemaining(); } | /**
* Closes all EntityManagers that were opened by this Supplier.
* It will first wait for the EMs to be closed by the running threads.
* If this times out it will shutdown the remaining EMs itself.
* @return true if clean close, false if timeout occured
*/ | Closes all EntityManagers that were opened by this Supplier. It will first wait for the EMs to be closed by the running threads. If this times out it will shutdown the remaining EMs itself | close | {
"repo_name": "ggerla/aries",
"path": "jpa/jpa-support/src/main/java/org/apache/aries/jpa/support/impl/EMSupplierImpl.java",
"license": "apache-2.0",
"size": 5784
} | [
"java.util.concurrent.CountDownLatch"
] | import java.util.concurrent.CountDownLatch; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 214,422 |
protected Date getSQLDate(java.util.Date date) {
if (date != null) {
Date d = new Date(date.getTime());
return d;
}
return null;
}
| Date function(java.util.Date date) { if (date != null) { Date d = new Date(date.getTime()); return d; } return null; } | /**
* This method converts the photo date attribute into a java.sql.Date object
*
* @param photo The photo to have the date converted
*
* @return a new java.sql.Date object, or null if the photo date is null
*/ | This method converts the photo date attribute into a java.sql.Date object | getSQLDate | {
"repo_name": "BackupTheBerlios/arara-svn",
"path": "core/tags/arara-1.0/src/main/java/net/indrix/arara/dao/AbstractDAO.java",
"license": "gpl-2.0",
"size": 18102
} | [
"java.sql.Date"
] | import java.sql.Date; | import java.sql.*; | [
"java.sql"
] | java.sql; | 92,193 |
public IN getLastNode()
throws DatabaseException {
return search
(null, SearchType.RIGHT, -1, null, true );
}
| IN function() throws DatabaseException { return search (null, SearchType.RIGHT, -1, null, true ); } | /**
* Find the rightmost node (IN or BIN) in the tree. Do not descend into a
* duplicate tree if the rightmost entry of the last BIN refers to one.
*
* @return the rightmost node in the tree, null if the tree is empty. The
* returned node is latched and the caller must release it.
*/ | Find the rightmost node (IN or BIN) in the tree. Do not descend into a duplicate tree if the rightmost entry of the last BIN refers to one | getLastNode | {
"repo_name": "ckaestne/CIDE",
"path": "CIDE_Samples/cide_samples/Berkeley DB JE/src/com/sleepycat/je/tree/Tree.java",
"license": "gpl-3.0",
"size": 131570
} | [
"com.sleepycat.je.DatabaseException"
] | import com.sleepycat.je.DatabaseException; | import com.sleepycat.je.*; | [
"com.sleepycat.je"
] | com.sleepycat.je; | 2,649,217 |
@Override
protected void verify(FullHttpResponse response) {
final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS;
final HttpHeaders headers = response.headers();
if (!response.status().equals(status)) {
throw new WebSocketHandshakeException("Invalid handshake response getStatus: " + response.status());
}
CharSequence upgrade = headers.get(HttpHeaderNames.UPGRADE);
if (!HttpHeaderValues.WEBSOCKET.contentEqualsIgnoreCase(upgrade)) {
throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + upgrade);
}
if (!headers.containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE, true)) {
throw new WebSocketHandshakeException("Invalid handshake response connection: "
+ headers.get(HttpHeaderNames.CONNECTION));
}
CharSequence accept = headers.get(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT);
if (accept == null || !accept.equals(expectedChallengeResponseString)) {
throw new WebSocketHandshakeException(String.format(
"Invalid challenge. Actual: %s. Expected: %s", accept, expectedChallengeResponseString));
}
} | void function(FullHttpResponse response) { final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS; final HttpHeaders headers = response.headers(); if (!response.status().equals(status)) { throw new WebSocketHandshakeException(STR + response.status()); } CharSequence upgrade = headers.get(HttpHeaderNames.UPGRADE); if (!HttpHeaderValues.WEBSOCKET.contentEqualsIgnoreCase(upgrade)) { throw new WebSocketHandshakeException(STR + upgrade); } if (!headers.containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE, true)) { throw new WebSocketHandshakeException(STR + headers.get(HttpHeaderNames.CONNECTION)); } CharSequence accept = headers.get(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT); if (accept == null !accept.equals(expectedChallengeResponseString)) { throw new WebSocketHandshakeException(String.format( STR, accept, expectedChallengeResponseString)); } } | /**
* <p>
* Process server response:
* </p>
*
* <pre>
* HTTP/1.1 101 Switching Protocols
* Upgrade: websocket
* Connection: Upgrade
* Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
* Sec-WebSocket-Protocol: chat
* </pre>
*
* @param response
* HTTP response returned from the server for the request sent by beginOpeningHandshake00().
* @throws WebSocketHandshakeException
*/ | Process server response: <code> HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat </code> | verify | {
"repo_name": "SinaTadayon/netty",
"path": "codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java",
"license": "apache-2.0",
"size": 9520
} | [
"io.netty.handler.codec.http.FullHttpResponse",
"io.netty.handler.codec.http.HttpHeaderNames",
"io.netty.handler.codec.http.HttpHeaderValues",
"io.netty.handler.codec.http.HttpHeaders",
"io.netty.handler.codec.http.HttpResponseStatus"
] | import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpResponseStatus; | import io.netty.handler.codec.http.*; | [
"io.netty.handler"
] | io.netty.handler; | 737,486 |
// @Test
public void testGetDocument() {
System.out.println("GetDocument");
String name = "test_multi_pages.docx";
String storage = "";
String folder = "";
try {
ResponseMessage result = wordsApi.GetDocument(name, storage, folder);
} catch (ApiException apiException) {
System.out.println("exp:" + apiException.getMessage());
assertNull(apiException);
}
} | System.out.println(STR); String name = STR; String storage = STRSTRexp:" + apiException.getMessage()); assertNull(apiException); } } | /**
* Test of GetDocument method, of class WordsApi.
*/ | Test of GetDocument method, of class WordsApi | testGetDocument | {
"repo_name": "aspose-words/Aspose.Words-for-Cloud",
"path": "SDKs/Aspose.Words-Cloud-SDK-for-Java/src/test/java/com/aspose/words/api/WordsApiTest.java",
"license": "mit",
"size": 41541
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,127,106 |
public void start(final long flushInterval) {
// flush the telemetry at regualar interval
this.timer = new Timer(true);
this.timer.scheduleAtFixedRate(new TelemetryTask(this), flushInterval, flushInterval);
} | void function(final long flushInterval) { this.timer = new Timer(true); this.timer.scheduleAtFixedRate(new TelemetryTask(this), flushInterval, flushInterval); } | /**
* Startsthe flush timer for the telemetry.
*
* @param flushInterval
* Telemetry flush interval, in milliseconds.
*/ | Startsthe flush timer for the telemetry | start | {
"repo_name": "DataDog/java-dogstatsd-client",
"path": "src/main/java/com/timgroup/statsd/Telemetry.java",
"license": "mit",
"size": 12345
} | [
"java.util.Timer"
] | import java.util.Timer; | import java.util.*; | [
"java.util"
] | java.util; | 1,953,780 |
public Object receiveFTMessage(FTMessage ev) throws IOException; | Object function(FTMessage ev) throws IOException; | /**
* For sending a non functional message to the FTManager linked to this object.
* @param ev the message to send
* @return depends on the message meaning
* @exception java.io.IOException if a problem occurs during this method call
*/ | For sending a non functional message to the FTManager linked to this object | receiveFTMessage | {
"repo_name": "acontes/programming",
"path": "src/Core/org/objectweb/proactive/core/body/UniversalBody.java",
"license": "agpl-3.0",
"size": 7566
} | [
"java.io.IOException",
"org.objectweb.proactive.core.body.ft.internalmsg.FTMessage"
] | import java.io.IOException; import org.objectweb.proactive.core.body.ft.internalmsg.FTMessage; | import java.io.*; import org.objectweb.proactive.core.body.ft.internalmsg.*; | [
"java.io",
"org.objectweb.proactive"
] | java.io; org.objectweb.proactive; | 252,704 |
@Test
public void testFilteringOnFindWithLowVersion() throws RepositoryBackendException {
ProductDefinition productDefinition = new SimpleProductDefinition("com.ibm.ws.wlp", "8.0.0.0", "Archive", "ILAN", "DEVELOPERS");
Collection<? extends RepositoryResource> result = new RepositoryConnectionList(userRepoConnection).findResources("keyword1",
Collections.singleton(productDefinition),
null, null);
filterResources.validateReturnedResources(result, EnumSet.of(FilterResources.Resources.FEATURE_WITH_NO_VERSION));
} | void function() throws RepositoryBackendException { ProductDefinition productDefinition = new SimpleProductDefinition(STR, STR, STR, "ILAN", STR); Collection<? extends RepositoryResource> result = new RepositoryConnectionList(userRepoConnection).findResources(STR, Collections.singleton(productDefinition), null, null); filterResources.validateReturnedResources(result, EnumSet.of(FilterResources.Resources.FEATURE_WITH_NO_VERSION)); } | /**
* Tests that if you filter on search for version lower than most of the resources in the repo you get back the expected result
*
* @throws RepositoryBackendException
*/ | Tests that if you filter on search for version lower than most of the resources in the repo you get back the expected result | testFilteringOnFindWithLowVersion | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.repository_fat_shared/src/com/ibm/ws/repository/test/ResourceFilteringTest.java",
"license": "epl-1.0",
"size": 56882
} | [
"com.ibm.ws.repository.connections.ProductDefinition",
"com.ibm.ws.repository.connections.RepositoryConnectionList",
"com.ibm.ws.repository.connections.SimpleProductDefinition",
"com.ibm.ws.repository.exceptions.RepositoryBackendException",
"com.ibm.ws.repository.resources.RepositoryResource",
"java.util.Collection",
"java.util.Collections",
"java.util.EnumSet"
] | import com.ibm.ws.repository.connections.ProductDefinition; import com.ibm.ws.repository.connections.RepositoryConnectionList; import com.ibm.ws.repository.connections.SimpleProductDefinition; import com.ibm.ws.repository.exceptions.RepositoryBackendException; import com.ibm.ws.repository.resources.RepositoryResource; import java.util.Collection; import java.util.Collections; import java.util.EnumSet; | import com.ibm.ws.repository.connections.*; import com.ibm.ws.repository.exceptions.*; import com.ibm.ws.repository.resources.*; import java.util.*; | [
"com.ibm.ws",
"java.util"
] | com.ibm.ws; java.util; | 1,435,116 |
@Override
public void create() {
prefs = createPreferences();
bootGame();
spriteBatch = createSpriteBatch();
assetManager = createAssetManager();
muteManager = createMuteManager();
BureauScreen tmp = createStartUpScreen();
tmp.prepareAssets(true);
tmp.readyScreen();
setScreen(tmp);
Texture.setAssetManager(assetManager);
} | void function() { prefs = createPreferences(); bootGame(); spriteBatch = createSpriteBatch(); assetManager = createAssetManager(); muteManager = createMuteManager(); BureauScreen tmp = createStartUpScreen(); tmp.prepareAssets(true); tmp.readyScreen(); setScreen(tmp); Texture.setAssetManager(assetManager); } | /**
* The game is booted in this order:<p>
* <code>createPreferences()</code>
* <code>bootGame()</code>
* <code>create*Manager()</code>
* <code>createFirstScreen()</code>
* <p>
* Afterwards the first screen is directly shown.
*/ | The game is booted in this order: <code>createPreferences()</code> <code>bootGame()</code> <code>create*Manager()</code> <code>createFirstScreen()</code> Afterwards the first screen is directly shown | create | {
"repo_name": "onyxbits/pocketbandit",
"path": "src/de/onyxbits/bureauengine/BureauGame.java",
"license": "apache-2.0",
"size": 4368
} | [
"com.badlogic.gdx.graphics.Texture",
"de.onyxbits.bureauengine.screen.BureauScreen"
] | import com.badlogic.gdx.graphics.Texture; import de.onyxbits.bureauengine.screen.BureauScreen; | import com.badlogic.gdx.graphics.*; import de.onyxbits.bureauengine.screen.*; | [
"com.badlogic.gdx",
"de.onyxbits.bureauengine"
] | com.badlogic.gdx; de.onyxbits.bureauengine; | 1,666,715 |
public void putAll(ObjectIntHashMap m) {
int numKeysToBeAdded = m.size();
if (numKeysToBeAdded == 0)
return;
if (numKeysToBeAdded > threshold) {
int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1);
if (targetCapacity > MAXIMUM_CAPACITY)
targetCapacity = MAXIMUM_CAPACITY;
int newCapacity = table.length;
while (newCapacity < targetCapacity)
newCapacity <<= 1;
if (newCapacity > table.length)
resize(newCapacity);
}
for (Iterator i = m.entrySet().iterator(); i.hasNext(); ) {
Entry e = (Entry) i.next();
put(e.getKey(), e.getValue());
}
} | void function(ObjectIntHashMap m) { int numKeysToBeAdded = m.size(); if (numKeysToBeAdded == 0) return; if (numKeysToBeAdded > threshold) { int targetCapacity = (int)(numKeysToBeAdded / loadFactor + 1); if (targetCapacity > MAXIMUM_CAPACITY) targetCapacity = MAXIMUM_CAPACITY; int newCapacity = table.length; while (newCapacity < targetCapacity) newCapacity <<= 1; if (newCapacity > table.length) resize(newCapacity); } for (Iterator i = m.entrySet().iterator(); i.hasNext(); ) { Entry e = (Entry) i.next(); put(e.getKey(), e.getValue()); } } | /**
* Copies all of the mappings from the specified map to this map.
* These mappings will replace any mappings that this map had for
* any of the keys currently in the specified map.
*
* @param m mappings to be stored in this map
* @throws NullPointerException if the specified map is null
*/ | Copies all of the mappings from the specified map to this map. These mappings will replace any mappings that this map had for any of the keys currently in the specified map | putAll | {
"repo_name": "ameybarve15/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/ObjectIntHashMap.java",
"license": "apache-2.0",
"size": 39476
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,583,850 |
public byte[] getEncoded()
throws IOException
{
return resp.getEncoded();
} | byte[] function() throws IOException { return resp.getEncoded(); } | /**
* return the ASN.1 encoded representation of this object.
*/ | return the ASN.1 encoded representation of this object | getEncoded | {
"repo_name": "savichris/spongycastle",
"path": "pkix/src/main/java/org/spongycastle/cert/ocsp/BasicOCSPResp.java",
"license": "mit",
"size": 5582
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,379,958 |
@Test
public void testDescriptiveStatistics() throws Exception {
DescriptiveStatistics u = new DescriptiveStatistics();
loadStats("data/PiDigits.txt", u);
Assert.assertEquals("PiDigits: std", std, u.getStandardDeviation(), 1E-14);
Assert.assertEquals("PiDigits: mean", mean, u.getMean(), 1E-14);
loadStats("data/Mavro.txt", u);
Assert.assertEquals("Mavro: std", std, u.getStandardDeviation(), 1E-14);
Assert.assertEquals("Mavro: mean", mean, u.getMean(), 1E-14);
loadStats("data/Michelso.txt", u);
Assert.assertEquals("Michelso: std", std, u.getStandardDeviation(), 1E-14);
Assert.assertEquals("Michelso: mean", mean, u.getMean(), 1E-14);
loadStats("data/NumAcc1.txt", u);
Assert.assertEquals("NumAcc1: std", std, u.getStandardDeviation(), 1E-14);
Assert.assertEquals("NumAcc1: mean", mean, u.getMean(), 1E-14);
loadStats("data/NumAcc2.txt", u);
Assert.assertEquals("NumAcc2: std", std, u.getStandardDeviation(), 1E-14);
Assert.assertEquals("NumAcc2: mean", mean, u.getMean(), 1E-14);
} | void function() throws Exception { DescriptiveStatistics u = new DescriptiveStatistics(); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); } | /**
* Test DescriptiveStatistics - implementations that store full array of
* values and execute multi-pass algorithms
*/ | Test DescriptiveStatistics - implementations that store full array of values and execute multi-pass algorithms | testDescriptiveStatistics | {
"repo_name": "venkateshamurthy/java-quantiles",
"path": "src/test/java/org/apache/commons/math3/stat/CertifiedDataTest.java",
"license": "apache-2.0",
"size": 5531
} | [
"org.apache.commons.math3.stat.descriptive.DescriptiveStatistics",
"org.junit.Assert"
] | import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.junit.Assert; | import org.apache.commons.math3.stat.descriptive.*; import org.junit.*; | [
"org.apache.commons",
"org.junit"
] | org.apache.commons; org.junit; | 2,305,786 |
Objects.requireNonNull(freemarkerContent, "freemarker content must not be null");
Configuration c = new Configuration();
c.setStrictSyntaxMode(true);
c.setTagSyntax(Configuration.AUTO_DETECT_TAG_SYNTAX);
String templateName = "validation";
StringTemplateLoader stringLoader = new StringTemplateLoader();
stringLoader.putTemplate(templateName, freemarkerContent);
c.setTemplateLoader(stringLoader);
try {
c.getTemplate(templateName);
}
catch (ParseException e) {
// Validation failed! - was not able to parse the template!
throw new AMWException("The template is syntactically incorrect: " + e.getMessage(), e);
}
catch (IOException e) {
// Something else went wrong
throw new AMWException("The template can not be validated: " + e.getMessage(), e);
}
} | Objects.requireNonNull(freemarkerContent, STR); Configuration c = new Configuration(); c.setStrictSyntaxMode(true); c.setTagSyntax(Configuration.AUTO_DETECT_TAG_SYNTAX); String templateName = STR; StringTemplateLoader stringLoader = new StringTemplateLoader(); stringLoader.putTemplate(templateName, freemarkerContent); c.setTemplateLoader(stringLoader); try { c.getTemplate(templateName); } catch (ParseException e) { throw new AMWException(STR + e.getMessage(), e); } catch (IOException e) { throw new AMWException(STR + e.getMessage(), e); } } | /**
* Validates if the given freemarker context is syntactically correct.
*
* @param freemarkerContent
* @throws AMWException
* if the template can not be successfully validate. The error message distincts between
* parsing exceptions and other (unexpected) potential issues.
*/ | Validates if the given freemarker context is syntactically correct | validateFreemarkerSyntax | {
"repo_name": "a-gogo/agogo",
"path": "AMW_business/src/main/java/ch/puzzle/itc/mobiliar/business/template/control/FreemarkerSyntaxValidator.java",
"license": "agpl-3.0",
"size": 2545
} | [
"ch.puzzle.itc.mobiliar.common.exception.AMWException",
"freemarker.cache.StringTemplateLoader",
"freemarker.core.ParseException",
"freemarker.template.Configuration",
"java.io.IOException",
"java.util.Objects"
] | import ch.puzzle.itc.mobiliar.common.exception.AMWException; import freemarker.cache.StringTemplateLoader; import freemarker.core.ParseException; import freemarker.template.Configuration; import java.io.IOException; import java.util.Objects; | import ch.puzzle.itc.mobiliar.common.exception.*; import freemarker.cache.*; import freemarker.core.*; import freemarker.template.*; import java.io.*; import java.util.*; | [
"ch.puzzle.itc",
"freemarker.cache",
"freemarker.core",
"freemarker.template",
"java.io",
"java.util"
] | ch.puzzle.itc; freemarker.cache; freemarker.core; freemarker.template; java.io; java.util; | 1,306,386 |
public void createGroup(String path) throws IOException;
public void close() throws IOException; | void createGroup(String path) throws IOException; public void function() throws IOException; | /**
* Closes and resets the service.
*
* @throws IOException If there is an error closing the file.
*/ | Closes and resets the service | close | {
"repo_name": "bramalingam/bioformats",
"path": "components/formats-gpl/src/loci/formats/services/JHDFService.java",
"license": "gpl-2.0",
"size": 7084
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,839,271 |
private static <E> void verifyLinkedHashSetContents(
LinkedHashSet<E> set, Collection<E> contents) {
assertEquals("LinkedHashSet should have preserved order for iteration",
new ArrayList<E>(set), new ArrayList<E>(contents));
verifySetContents(set, contents);
} | static <E> void function( LinkedHashSet<E> set, Collection<E> contents) { assertEquals(STR, new ArrayList<E>(set), new ArrayList<E>(contents)); verifySetContents(set, contents); } | /**
* Utility method to verify that the given LinkedHashSet is equal to and
* hashes identically to a set constructed with the elements in the given
* collection. Also verifies that the ordering in the set is the same
* as the ordering of the given contents.
*/ | Utility method to verify that the given LinkedHashSet is equal to and hashes identically to a set constructed with the elements in the given collection. Also verifies that the ordering in the set is the same as the ordering of the given contents | verifyLinkedHashSetContents | {
"repo_name": "g0alshhhit/guavaHelper",
"path": "guava-gwt/test-super/com/google/common/collect/super/com/google/common/collect/SetsTest.java",
"license": "apache-2.0",
"size": 27045
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.LinkedHashSet"
] | import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,221,971 |
void handleException(HttpException ex); | void handleException(HttpException ex); | /**
* Reports a protocol exception thrown while processing the request.
*/ | Reports a protocol exception thrown while processing the request | handleException | {
"repo_name": "viapp/httpasyncclient-android",
"path": "src/main/java/org/apache/http/nio/protocol/NHttpResponseTrigger.java",
"license": "apache-2.0",
"size": 2545
} | [
"org.apache.http.HttpException"
] | import org.apache.http.HttpException; | import org.apache.http.*; | [
"org.apache.http"
] | org.apache.http; | 1,333,663 |
@Generated
@Selector("setPairingDelegate:queue:")
public native void setPairingDelegateQueue(@Mapped(ObjCObjectMapper.class) CHIPDevicePairingDelegate delegate,
NSObject queue); | @Selector(STR) native void function(@Mapped(ObjCObjectMapper.class) CHIPDevicePairingDelegate delegate, NSObject queue); | /**
* Set the Delegate for the Device Pairing as well as the Queue on which the Delegate callbacks will be triggered
*
* @param[in] delegate The delegate the pairing process should use
* @param[in] queue The queue on which the callbacks will be delivered
*/ | Set the Delegate for the Device Pairing as well as the Queue on which the Delegate callbacks will be triggered | setPairingDelegateQueue | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/chip/CHIPDeviceController.java",
"license": "apache-2.0",
"size": 9204
} | [
"org.moe.natj.general.ann.Mapped",
"org.moe.natj.objc.ann.Selector",
"org.moe.natj.objc.map.ObjCObjectMapper"
] | import org.moe.natj.general.ann.Mapped; import org.moe.natj.objc.ann.Selector; import org.moe.natj.objc.map.ObjCObjectMapper; | import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*; import org.moe.natj.objc.map.*; | [
"org.moe.natj"
] | org.moe.natj; | 567,095 |
public void setSelectionId(int value) {
this.selectionId = value;
}
/**
* Gets the value of the plannedTo property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar } | void function(int value) { this.selectionId = value; } /** * Gets the value of the plannedTo property. * * * possible object is * {@link XMLGregorianCalendar } | /**
* Sets the value of the selectionId property.
*
*/ | Sets the value of the selectionId property | setSelectionId | {
"repo_name": "contactlab/soap-api-java-client-next",
"path": "src/main/java/com/contactlab/api/ws/StartSelection.java",
"license": "apache-2.0",
"size": 3270
} | [
"javax.xml.datatype.XMLGregorianCalendar"
] | import javax.xml.datatype.XMLGregorianCalendar; | import javax.xml.datatype.*; | [
"javax.xml"
] | javax.xml; | 1,783,846 |
@Setup(Level.Invocation)
public void init() throws IOException {
file = File.createTempFile("log", ".txt");
file.deleteOnExit();
} | @Setup(Level.Invocation) void function() throws IOException { file = File.createTempFile("log", ".txt"); file.deleteOnExit(); } | /**
* Creates a new empty temporary file.
*
* @throws IOException
* Failed to create new temporary file
*/ | Creates a new empty temporary file | init | {
"repo_name": "pmwmedia/tinylog",
"path": "benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java",
"license": "apache-2.0",
"size": 9128
} | [
"java.io.File",
"java.io.IOException",
"org.openjdk.jmh.annotations.Level",
"org.openjdk.jmh.annotations.Setup"
] | import java.io.File; import java.io.IOException; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Setup; | import java.io.*; import org.openjdk.jmh.annotations.*; | [
"java.io",
"org.openjdk.jmh"
] | java.io; org.openjdk.jmh; | 2,811,617 |
Optional<Boolean> isHideModal(); | Optional<Boolean> isHideModal(); | /**
* If true, the modal picker date will be hide.
*/ | If true, the modal picker date will be hide | isHideModal | {
"repo_name": "opensingular/singular-core",
"path": "lib/wicket-utils/src/main/java/org/opensingular/lib/wicket/util/behavior/DatePickerSettings.java",
"license": "apache-2.0",
"size": 2099
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 410,559 |
public boolean isAttached();
/**
* Get the {@link com.oneplusar.android.world.OnePlusARObject OnePlusARObject} | boolean function(); /** * Get the {@link com.oneplusar.android.world.OnePlusARObject OnePlusARObject} | /**
* Check if the plugin is attached.
*
* @return
*/ | Check if the plugin is attached | isAttached | {
"repo_name": "BeAlive75/OnePlusAR",
"path": "android/OnePlusAR_Framework/src/com/oneplusar/android/plugin/OnePlusARObjectPlugin.java",
"license": "apache-2.0",
"size": 3521
} | [
"com.oneplusar.android.world.OnePlusARObject"
] | import com.oneplusar.android.world.OnePlusARObject; | import com.oneplusar.android.world.*; | [
"com.oneplusar.android"
] | com.oneplusar.android; | 289,079 |
protected Map<String, String[]> getDeprecatedProps() {
Map<String, String[]> result = new HashMap<>();
for (String key : deprecatedKeyMap.keySet()) {
result.put(key, deprecatedKeyMap.get(key).newKeys);
}
return result;
} | Map<String, String[]> function() { Map<String, String[]> result = new HashMap<>(); for (String key : deprecatedKeyMap.keySet()) { result.put(key, deprecatedKeyMap.get(key).newKeys); } return result; } | /**
* Method to get deprecated properties.
*
* @return {@code Map} of deprecated properties with new properties in array,
* or empty {@code Map} if no deprecated properties
*/ | Method to get deprecated properties | getDeprecatedProps | {
"repo_name": "caskdata/cdap",
"path": "cdap-common/src/main/java/co/cask/cdap/common/conf/Configuration.java",
"license": "apache-2.0",
"size": 67579
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,537,128 |
@Override
public Completable connect(ProductSubscription... args) {
if (args == null || args.length == 0) {
throw new IllegalArgumentException("Subscriptions must be made at connection time");
}
if (streamingService != null) {
throw new UnsupportedOperationException(
"Exchange only handles a single connection - disconnect the current connection.");
}
ProductSubscription subscriptions = args[0];
streamingService = createStreamingService(subscriptions);
List<Completable> completables = new ArrayList<>();
if (subscriptions.hasUnauthenticated()) {
completables.add(streamingService.connect());
}
if (subscriptions.hasAuthenticated()) {
if (exchangeSpecification.getApiKey() == null) {
throw new IllegalArgumentException("API key required for authenticated streams");
}
LOG.info("Connecting to authenticated web socket");
BinanceAuthenticated binance =
ExchangeRestProxyBuilder.forInterface(
BinanceAuthenticated.class, getExchangeSpecification())
.build();
userDataChannel =
new BinanceUserDataChannel(binance, exchangeSpecification.getApiKey(), onApiCall);
try {
completables.add(createAndConnectUserDataService(userDataChannel.getListenKey()));
} catch (NoActiveChannelException e) {
throw new IllegalStateException("Failed to establish user data channel", e);
}
}
streamingMarketDataService =
new BinanceStreamingMarketDataService(
streamingService,
(BinanceMarketDataService) marketDataService,
onApiCall,
orderBookUpdateFrequencyParameter);
streamingAccountService = new BinanceStreamingAccountService(userDataStreamingService);
streamingTradeService = new BinanceStreamingTradeService(userDataStreamingService);
return Completable.concat(completables)
.doOnComplete(() -> streamingMarketDataService.openSubscriptions(subscriptions))
.doOnComplete(() -> streamingAccountService.openSubscriptions())
.doOnComplete(() -> streamingTradeService.openSubscriptions());
} | Completable function(ProductSubscription... args) { if (args == null args.length == 0) { throw new IllegalArgumentException(STR); } if (streamingService != null) { throw new UnsupportedOperationException( STR); } ProductSubscription subscriptions = args[0]; streamingService = createStreamingService(subscriptions); List<Completable> completables = new ArrayList<>(); if (subscriptions.hasUnauthenticated()) { completables.add(streamingService.connect()); } if (subscriptions.hasAuthenticated()) { if (exchangeSpecification.getApiKey() == null) { throw new IllegalArgumentException(STR); } LOG.info(STR); BinanceAuthenticated binance = ExchangeRestProxyBuilder.forInterface( BinanceAuthenticated.class, getExchangeSpecification()) .build(); userDataChannel = new BinanceUserDataChannel(binance, exchangeSpecification.getApiKey(), onApiCall); try { completables.add(createAndConnectUserDataService(userDataChannel.getListenKey())); } catch (NoActiveChannelException e) { throw new IllegalStateException(STR, e); } } streamingMarketDataService = new BinanceStreamingMarketDataService( streamingService, (BinanceMarketDataService) marketDataService, onApiCall, orderBookUpdateFrequencyParameter); streamingAccountService = new BinanceStreamingAccountService(userDataStreamingService); streamingTradeService = new BinanceStreamingTradeService(userDataStreamingService); return Completable.concat(completables) .doOnComplete(() -> streamingMarketDataService.openSubscriptions(subscriptions)) .doOnComplete(() -> streamingAccountService.openSubscriptions()) .doOnComplete(() -> streamingTradeService.openSubscriptions()); } | /**
* Binance streaming API expects connections to multiple channels to be defined at connection
* time. To define the channels for this connection pass a `ProductSubscription` in at connection
* time.
*
* @param args A single `ProductSubscription` to define the subscriptions required to be available
* during this connection.
* @return A completable which fulfils once connection is complete.
*/ | Binance streaming API expects connections to multiple channels to be defined at connection time. To define the channels for this connection pass a `ProductSubscription` in at connection time | connect | {
"repo_name": "douggie/XChange",
"path": "xchange-stream-binance/src/main/java/info/bitrich/xchangestream/binance/BinanceStreamingExchange.java",
"license": "mit",
"size": 9523
} | [
"info.bitrich.xchangestream.binance.BinanceUserDataChannel",
"info.bitrich.xchangestream.core.ProductSubscription",
"io.reactivex.Completable",
"java.util.ArrayList",
"java.util.List",
"org.knowm.xchange.binance.BinanceAuthenticated",
"org.knowm.xchange.binance.service.BinanceMarketDataService",
"org.knowm.xchange.client.ExchangeRestProxyBuilder"
] | import info.bitrich.xchangestream.binance.BinanceUserDataChannel; import info.bitrich.xchangestream.core.ProductSubscription; import io.reactivex.Completable; import java.util.ArrayList; import java.util.List; import org.knowm.xchange.binance.BinanceAuthenticated; import org.knowm.xchange.binance.service.BinanceMarketDataService; import org.knowm.xchange.client.ExchangeRestProxyBuilder; | import info.bitrich.xchangestream.binance.*; import info.bitrich.xchangestream.core.*; import io.reactivex.*; import java.util.*; import org.knowm.xchange.binance.*; import org.knowm.xchange.binance.service.*; import org.knowm.xchange.client.*; | [
"info.bitrich.xchangestream",
"io.reactivex",
"java.util",
"org.knowm.xchange"
] | info.bitrich.xchangestream; io.reactivex; java.util; org.knowm.xchange; | 770,382 |
public static void main(String[] args) {
String embFile = null;
String embResource = null;
String className = null;
String fontName = null;
Map options = new java.util.HashMap();
String[] arguments = parseArguments(options, args);
determineLogLevel(options);
PFMReader app = new PFMReader();
log.info("PFM Reader for Apache FOP " + Version.getVersion() + "\n");
if (options.get("-ef") != null) {
embFile = (String)options.get("-ef");
}
if (options.get("-er") != null) {
embResource = (String)options.get("-er");
}
if (options.get("-fn") != null) {
fontName = (String)options.get("-fn");
}
if (options.get("-cn") != null) {
className = (String)options.get("-cn");
}
if (arguments.length != 2 || options.get("-h") != null
|| options.get("-help") != null || options.get("--help") != null) {
displayUsage();
} else {
try {
log.info("Parsing font...");
PFMFile pfm = app.loadPFM(arguments[0]);
if (pfm != null) {
app.preview(pfm);
Document doc = app.constructFontXML(pfm,
fontName, className, embResource, embFile);
app.writeFontXML(doc, arguments[1]);
}
log.info("XML font metrics file successfullly created.");
} catch (Exception e) {
log.error("Error while building XML font metrics file", e);
System.exit(-1);
}
}
} | static void function(String[] args) { String embFile = null; String embResource = null; String className = null; String fontName = null; Map options = new java.util.HashMap(); String[] arguments = parseArguments(options, args); determineLogLevel(options); PFMReader app = new PFMReader(); log.info(STR + Version.getVersion() + "\n"); if (options.get("-ef") != null) { embFile = (String)options.get("-ef"); } if (options.get("-er") != null) { embResource = (String)options.get("-er"); } if (options.get("-fn") != null) { fontName = (String)options.get("-fn"); } if (options.get("-cn") != null) { className = (String)options.get("-cn"); } if (arguments.length != 2 options.get("-h") != null options.get("-help") != null options.get(STR) != null) { displayUsage(); } else { try { log.info(STR); PFMFile pfm = app.loadPFM(arguments[0]); if (pfm != null) { app.preview(pfm); Document doc = app.constructFontXML(pfm, fontName, className, embResource, embFile); app.writeFontXML(doc, arguments[1]); } log.info(STR); } catch (Exception e) { log.error(STR, e); System.exit(-1); } } } | /**
* The main method for the PFM reader tool.
*
* @param args Command-line arguments: [options] metricfile.pfm xmlfile.xml
* where options can be:
* -fn <fontname>
* default is to use the fontname in the .pfm file, but you can override
* that name to make sure that the embedded font is used instead of installed
* fonts when viewing documents with Acrobat Reader.
* -cn <classname>
* default is to use the fontname
* -ef <path to the Type1 .pfb fontfile>
* will add the possibility to embed the font. When running fop, fop will look
* for this file to embed it
* -er <path to Type1 fontfile relative to org/apache/fop/render/pdf/fonts>
* you can also include the fontfile in the fop.jar file when building fop.
* You can use both -ef and -er. The file specified in -ef will be searched first,
* then the -er file.
*/ | The main method for the PFM reader tool | main | {
"repo_name": "argv-minus-one/fop",
"path": "fop-core/src/main/java/org/apache/fop/fonts/apps/PFMReader.java",
"license": "apache-2.0",
"size": 11541
} | [
"java.util.Map",
"org.apache.fop.Version",
"org.apache.fop.fonts.type1.PFMFile",
"org.w3c.dom.Document"
] | import java.util.Map; import org.apache.fop.Version; import org.apache.fop.fonts.type1.PFMFile; import org.w3c.dom.Document; | import java.util.*; import org.apache.fop.*; import org.apache.fop.fonts.type1.*; import org.w3c.dom.*; | [
"java.util",
"org.apache.fop",
"org.w3c.dom"
] | java.util; org.apache.fop; org.w3c.dom; | 485,636 |
public List<Long> streamBatchedUpdateQuery(String schemaName, String qry, List<Object[]> params,
SqlClientContext cliCtx) throws IgniteCheckedException; | List<Long> function(String schemaName, String qry, List<Object[]> params, SqlClientContext cliCtx) throws IgniteCheckedException; | /**
* Execute a batched INSERT statement using data streamer as receiver.
*
* @param schemaName Schema name.
* @param qry Query.
* @param params Query parameters.
* @param cliCtx Client connection context.
* @return Update counters.
* @throws IgniteCheckedException If failed.
*/ | Execute a batched INSERT statement using data streamer as receiver | streamBatchedUpdateQuery | {
"repo_name": "shroman/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java",
"license": "apache-2.0",
"size": 15927
} | [
"java.util.List",
"org.apache.ignite.IgniteCheckedException"
] | import java.util.List; import org.apache.ignite.IgniteCheckedException; | import java.util.*; import org.apache.ignite.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 848,873 |
public Observable<ServiceResponse<ExpressRouteCircuitsArpTableListResultInner>> beginListArpTableWithServiceResponseAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (circuitName == null) {
throw new IllegalArgumentException("Parameter circuitName is required and cannot be null.");
}
if (peeringName == null) {
throw new IllegalArgumentException("Parameter peeringName is required and cannot be null.");
}
if (devicePath == null) {
throw new IllegalArgumentException("Parameter devicePath is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<ExpressRouteCircuitsArpTableListResultInner>> function(String resourceGroupName, String circuitName, String peeringName, String devicePath) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (circuitName == null) { throw new IllegalArgumentException(STR); } if (peeringName == null) { throw new IllegalArgumentException(STR); } if (devicePath == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* Gets the currently advertised ARP table associated with the express route circuit in a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param circuitName The name of the express route circuit.
* @param peeringName The name of the peering.
* @param devicePath The path of the device.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ExpressRouteCircuitsArpTableListResultInner object
*/ | Gets the currently advertised ARP table associated with the express route circuit in a resource group | beginListArpTableWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java",
"license": "mit",
"size": 125492
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 257,995 |
@SuppressWarnings("unchecked")
@Override
public void map(KEYIN key, VALUEIN value,
Context context) throws IOException, InterruptedException {
if(key instanceof org.apache.hadoop.io.BytesWritable){
randomizeBytes(((org.apache.hadoop.io.BytesWritable)key).getBytes(),0,((org.apache.hadoop.io.BytesWritable)key).getLength());
computeSum(((org.apache.hadoop.io.BytesWritable)value).getBytes(),0,((org.apache.hadoop.io.BytesWritable)value).getLength());
computeHash(((org.apache.hadoop.io.BytesWritable)value).getBytes(),0,((org.apache.hadoop.io.BytesWritable)value).getLength());
nr_records++;
}else
System.out.println("Not bytes writable");
context.write((KEYOUT) key, (VALUEOUT) value);
} | @SuppressWarnings(STR) void function(KEYIN key, VALUEIN value, Context context) throws IOException, InterruptedException { if(key instanceof org.apache.hadoop.io.BytesWritable){ randomizeBytes(((org.apache.hadoop.io.BytesWritable)key).getBytes(),0,((org.apache.hadoop.io.BytesWritable)key).getLength()); computeSum(((org.apache.hadoop.io.BytesWritable)value).getBytes(),0,((org.apache.hadoop.io.BytesWritable)value).getLength()); computeHash(((org.apache.hadoop.io.BytesWritable)value).getBytes(),0,((org.apache.hadoop.io.BytesWritable)value).getLength()); nr_records++; }else System.out.println(STR); context.write((KEYOUT) key, (VALUEOUT) value); } | /**
* Called once for each key/value pair in the input split. Most applications
* should override this, but the default is the identity function.
*/ | Called once for each key/value pair in the input split. Most applications should override this, but the default is the identity function | map | {
"repo_name": "simbadzina/hadoop-fcfs",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/FlorinMapper.java",
"license": "apache-2.0",
"size": 8108
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 284,456 |
MessageEdit mergeMessage(Element el) throws PermissionException, IdUsedException; | MessageEdit mergeMessage(Element el) throws PermissionException, IdUsedException; | /**
* Merge in a new message as defined in the xml. Must commitEdit() to make official, or cancelEdit() when done!
*
* @param el
* The message information in XML in a DOM element.
* @return The newly added message, locked for update.
* @exception PermissionException
* If the user does not have write permission to the channel.
* @exception IdUsedException
* if the user id is already used.
*/ | Merge in a new message as defined in the xml. Must commitEdit() to make official, or cancelEdit() when done | mergeMessage | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "message/message-api/api/src/java/org/sakaiproject/message/api/MessageChannel.java",
"license": "apache-2.0",
"size": 13131
} | [
"org.sakaiproject.exception.IdUsedException",
"org.sakaiproject.exception.PermissionException",
"org.w3c.dom.Element"
] | import org.sakaiproject.exception.IdUsedException; import org.sakaiproject.exception.PermissionException; import org.w3c.dom.Element; | import org.sakaiproject.exception.*; import org.w3c.dom.*; | [
"org.sakaiproject.exception",
"org.w3c.dom"
] | org.sakaiproject.exception; org.w3c.dom; | 1,295,107 |
@Test
public void testSimpleUse()
{
ContentStore store = getStore();
String content = "Content for testSimpleUse";
ContentWriter writer = store.getWriter(ContentStore.NEW_CONTENT_CONTEXT);
assertNotNull("Writer may not be null", writer);
// Ensure that the URL is available
String contentUrlBefore = writer.getContentUrl();
assertNotNull("Content URL may not be null for unused writer", contentUrlBefore);
assertTrue("URL is not valid: " + contentUrlBefore, AbstractContentStore.isValidContentUrl(contentUrlBefore));
// Write something
writer.putContent(content);
String contentUrlAfter = writer.getContentUrl();
assertTrue("URL is not valid: " + contentUrlBefore, AbstractContentStore.isValidContentUrl(contentUrlAfter));
assertEquals("The content URL may not change just because the writer has put content", contentUrlBefore, contentUrlAfter);
// Get the readers
ContentReader reader = store.getReader(contentUrlBefore);
assertNotNull("Reader from store is null", reader);
assertEquals(reader.getContentUrl(), writer.getContentUrl());
String checkContent = reader.getContentString();
assertEquals("Content is different", content, checkContent);
}
| void function() { ContentStore store = getStore(); String content = STR; ContentWriter writer = store.getWriter(ContentStore.NEW_CONTENT_CONTEXT); assertNotNull(STR, writer); String contentUrlBefore = writer.getContentUrl(); assertNotNull(STR, contentUrlBefore); assertTrue(STR + contentUrlBefore, AbstractContentStore.isValidContentUrl(contentUrlBefore)); writer.putContent(content); String contentUrlAfter = writer.getContentUrl(); assertTrue(STR + contentUrlBefore, AbstractContentStore.isValidContentUrl(contentUrlAfter)); assertEquals(STR, contentUrlBefore, contentUrlAfter); ContentReader reader = store.getReader(contentUrlBefore); assertNotNull(STR, reader); assertEquals(reader.getContentUrl(), writer.getContentUrl()); String checkContent = reader.getContentString(); assertEquals(STR, content, checkContent); } | /**
* Get a writer and write a little bit of content before reading it.
*/ | Get a writer and write a little bit of content before reading it | testSimpleUse | {
"repo_name": "Alfresco/community-edition",
"path": "projects/repository/source/test-java/org/alfresco/repo/content/AbstractWritableContentStoreTest.java",
"license": "lgpl-3.0",
"size": 30606
} | [
"org.alfresco.service.cmr.repository.ContentReader",
"org.alfresco.service.cmr.repository.ContentWriter",
"org.junit.Assert"
] | import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentWriter; import org.junit.Assert; | import org.alfresco.service.cmr.repository.*; import org.junit.*; | [
"org.alfresco.service",
"org.junit"
] | org.alfresco.service; org.junit; | 855,698 |
@Override
public void init() throws ServletException {
// Put your code here
sc = this.getServletContext();
userDao = new AADAO();
super.init();
}
| void function() throws ServletException { sc = this.getServletContext(); userDao = new AADAO(); super.init(); } | /**
* Initialization of the servlet. <br>
*
* @throws ServletException
* if an error occurs
*/ | Initialization of the servlet. | init | {
"repo_name": "swen2014/AllAvailable",
"path": "AllAvailableServer/src/com/cmu/qiuoffer/Servlet/LogIn.java",
"license": "apache-2.0",
"size": 2707
} | [
"javax.servlet.ServletException"
] | import javax.servlet.ServletException; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 1,929,352 |
ByteArrayInputStream in = new ByteArrayInputStream("2".getBytes());
System.setIn(in);
String actual = new ConsoleInput().ask("testQuestion");
assertThat(actual, is("2"));
} | ByteArrayInputStream in = new ByteArrayInputStream("2".getBytes()); System.setIn(in); String actual = new ConsoleInput().ask(STR); assertThat(actual, is("2")); } | /**
* Test ask() method.
*/ | Test ask() method | whenSetTwoThenReturnTwoInAsk | {
"repo_name": "roman-sd/java-a-to-z",
"path": "chapter_004/src/test/java/ru/sdroman/calculator/ConsoleInputTest.java",
"license": "apache-2.0",
"size": 612
} | [
"java.io.ByteArrayInputStream",
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import java.io.ByteArrayInputStream; import org.hamcrest.core.Is; import org.junit.Assert; | import java.io.*; import org.hamcrest.core.*; import org.junit.*; | [
"java.io",
"org.hamcrest.core",
"org.junit"
] | java.io; org.hamcrest.core; org.junit; | 124,336 |
private void chooseDestinationFile() {
FileFilter fileFilter = null;
if (m_ResultsDestinationCBox.getSelectedItem() == DEST_CSV_TEXT) {
fileFilter = m_csvFileFilter;
} else {
fileFilter = m_arffFileFilter;
}
m_DestFileChooser.setFileFilter(fileFilter);
int returnVal = m_DestFileChooser.showSaveDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
m_ResultsDestinationPathTField.setText(m_DestFileChooser.getSelectedFile().toString());
} | void function() { FileFilter fileFilter = null; if (m_ResultsDestinationCBox.getSelectedItem() == DEST_CSV_TEXT) { fileFilter = m_csvFileFilter; } else { fileFilter = m_arffFileFilter; } m_DestFileChooser.setFileFilter(fileFilter); int returnVal = m_DestFileChooser.showSaveDialog(this); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } m_ResultsDestinationPathTField.setText(m_DestFileChooser.getSelectedFile().toString()); } | /**
* Lets user browse for a destination file..
*/ | Lets user browse for a destination file. | chooseDestinationFile | {
"repo_name": "dsibournemouth/autoweka",
"path": "weka-3.7.7/src/main/java/weka/gui/experiment/SimpleSetupPanel.java",
"license": "gpl-3.0",
"size": 43141
} | [
"javax.swing.JFileChooser",
"javax.swing.filechooser.FileFilter"
] | import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; | import javax.swing.*; import javax.swing.filechooser.*; | [
"javax.swing"
] | javax.swing; | 980,355 |
protected void initDebugger() {
if (reader == null || writer == null) {
throw new NullPointerException(
"Reader or writer isn't initialized.");
}
// If debugging is enabled, we open a window and write out all network
// traffic.
if (config.isDebuggerEnabled()) {
if (debugger == null) {
// Detect the debugger class to use.
String className = null;
// Use try block since we may not have permission to get a
// system
// property (for example, when an applet).
try {
className = System.getProperty("smack.debuggerClass");
} catch (Throwable t) {
// Ignore.
}
Class<?> debuggerClass = null;
if (className != null) {
try {
debuggerClass = Class.forName(className);
} catch (Exception e) {
log.warn("Unabled to instantiate debugger class "
+ className);
}
}
if (debuggerClass == null) {
try {
debuggerClass = Class
.forName("org.jivesoftware.smackx.debugger.EnhancedDebugger");
} catch (Exception ex) {
try {
debuggerClass = Class
.forName("org.jivesoftware.smack.debugger.LiteDebugger");
} catch (Exception ex2) {
log.warn("Unabled to instantiate either Smack debugger class");
}
}
}
// Create a new debugger instance. If an exception occurs then
// disable the debugging
// option
try {
Constructor<?> constructor = debuggerClass.getConstructor(
Connection.class, Writer.class, Reader.class);
debugger = (SmackDebugger) constructor.newInstance(this,
writer, reader);
reader = debugger.getReader();
writer = debugger.getWriter();
} catch (Exception e) {
throw new IllegalArgumentException(
"Can't initialize the configured debugger!", e);
}
} else {
// Obtain new reader and writer from the existing debugger
reader = debugger.newConnectionReader(reader);
writer = debugger.newConnectionWriter(writer);
}
}
} | void function() { if (reader == null writer == null) { throw new NullPointerException( STR); } if (config.isDebuggerEnabled()) { if (debugger == null) { String className = null; try { className = System.getProperty(STR); } catch (Throwable t) { } Class<?> debuggerClass = null; if (className != null) { try { debuggerClass = Class.forName(className); } catch (Exception e) { log.warn(STR + className); } } if (debuggerClass == null) { try { debuggerClass = Class .forName(STR); } catch (Exception ex) { try { debuggerClass = Class .forName(STR); } catch (Exception ex2) { log.warn(STR); } } } try { Constructor<?> constructor = debuggerClass.getConstructor( Connection.class, Writer.class, Reader.class); debugger = (SmackDebugger) constructor.newInstance(this, writer, reader); reader = debugger.getReader(); writer = debugger.getWriter(); } catch (Exception e) { throw new IllegalArgumentException( STR, e); } } else { reader = debugger.newConnectionReader(reader); writer = debugger.newConnectionWriter(writer); } } } | /**
* Initialize the {@link #debugger}. You can specify a customized
* {@link SmackDebugger} by setup the system property
* <code>smack.debuggerClass</code> to the implementation.
*
* @throws IllegalStateException
* if the reader or writer isn't yet initialized.
* @throws IllegalArgumentException
* if the SmackDebugger can't be loaded.
*/ | Initialize the <code>#debugger</code>. You can specify a customized <code>SmackDebugger</code> by setup the system property <code>smack.debuggerClass</code> to the implementation | initDebugger | {
"repo_name": "abmargb/jamppa",
"path": "src/main/java/org/jivesoftware/smack/Connection.java",
"license": "apache-2.0",
"size": 37404
} | [
"java.io.Reader",
"java.io.Writer",
"java.lang.reflect.Constructor",
"org.jivesoftware.smack.debugger.SmackDebugger"
] | import java.io.Reader; import java.io.Writer; import java.lang.reflect.Constructor; import org.jivesoftware.smack.debugger.SmackDebugger; | import java.io.*; import java.lang.reflect.*; import org.jivesoftware.smack.debugger.*; | [
"java.io",
"java.lang",
"org.jivesoftware.smack"
] | java.io; java.lang; org.jivesoftware.smack; | 1,976,568 |
public void packAndPosition() {
pack();
String[] coordsString = Settings.getString( locationSettingKey ).split( "," );
if ( coordsString.length != 2 )
coordsString = Settings.getDefaultString( locationSettingKey ).split( "," );
final int cx = Integer.parseInt( coordsString[ 0 ] );
final int cy = Integer.parseInt( coordsString[ 1 ] );
setLocation( cx - ( getWidth() >> 1 ), cy - ( getHeight() >> 1 ) );
ensureVisibleBounds();
}
| void function() { pack(); String[] coordsString = Settings.getString( locationSettingKey ).split( "," ); if ( coordsString.length != 2 ) coordsString = Settings.getDefaultString( locationSettingKey ).split( "," ); final int cx = Integer.parseInt( coordsString[ 0 ] ); final int cy = Integer.parseInt( coordsString[ 1 ] ); setLocation( cx - ( getWidth() >> 1 ), cy - ( getHeight() >> 1 ) ); ensureVisibleBounds(); } | /**
* Packs and positions the dialog to its saved location.
*/ | Packs and positions the dialog to its saved location | packAndPosition | {
"repo_name": "icza/sc2gears",
"path": "src/hu/belicza/andras/sc2gears/ui/ontopdialogs/BaseOnTopDialog.java",
"license": "apache-2.0",
"size": 8814
} | [
"hu.belicza.andras.sc2gears.settings.Settings"
] | import hu.belicza.andras.sc2gears.settings.Settings; | import hu.belicza.andras.sc2gears.settings.*; | [
"hu.belicza.andras"
] | hu.belicza.andras; | 367,567 |
private static void validateTopLevel(List<ProcessorDefinition<?>> children) {
for (ProcessorDefinition child : children) {
// validate that top-level is only added on the route (eg top level)
RouteDefinition route = ProcessorDefinitionHelper.getRoute(child);
boolean parentIsRoute = child.getParent() == route;
if (child.isTopLevelOnly() && !parentIsRoute) {
throw new IllegalArgumentException(
"The output must be added as top-level on the route. Try moving " + child + " to the top of route.");
}
if (child.getOutputs() != null && !child.getOutputs().isEmpty()) {
validateTopLevel(child.getOutputs());
}
}
} | static void function(List<ProcessorDefinition<?>> children) { for (ProcessorDefinition child : children) { RouteDefinition route = ProcessorDefinitionHelper.getRoute(child); boolean parentIsRoute = child.getParent() == route; if (child.isTopLevelOnly() && !parentIsRoute) { throw new IllegalArgumentException( STR + child + STR); } if (child.getOutputs() != null && !child.getOutputs().isEmpty()) { validateTopLevel(child.getOutputs()); } } } | /**
* Validates that top-level only definitions is not added in the wrong places, such as nested inside a splitter etc.
*/ | Validates that top-level only definitions is not added in the wrong places, such as nested inside a splitter etc | validateTopLevel | {
"repo_name": "tadayosi/camel",
"path": "core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java",
"license": "apache-2.0",
"size": 31912
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,979,448 |
public boolean waitForCompletion(boolean verbose
) throws IOException, InterruptedException,
ClassNotFoundException {
if (state == JobState.DEFINE) {
submit();
}
if (verbose) {
jobClient.monitorAndPrintJob(conf, info);
} else {
info.waitForCompletion();
}
return isSuccessful();
} | boolean function(boolean verbose ) throws IOException, InterruptedException, ClassNotFoundException { if (state == JobState.DEFINE) { submit(); } if (verbose) { jobClient.monitorAndPrintJob(conf, info); } else { info.waitForCompletion(); } return isSuccessful(); } | /**
* Submit the job to the cluster and wait for it to finish.
* @param verbose print the progress to the user
* @return true if the job succeeded
* @throws IOException thrown if the communication with the
* <code>JobTracker</code> is lost
*/ | Submit the job to the cluster and wait for it to finish | waitForCompletion | {
"repo_name": "leonhong/hadoop-20-warehouse",
"path": "src/mapred/org/apache/hadoop/mapreduce/Job.java",
"license": "apache-2.0",
"size": 15416
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,221,965 |
public static Resource has_External_Reference() {
return _namespace_CDAO("CDAO_0000164");
} | static Resource function() { return _namespace_CDAO(STR); } | /**
* Associates a TU to some external taxonomy reference.
* (http://purl.obolibrary.org/obo/CDAO_0000164)
*/ | Associates a TU to some external taxonomy reference. (HREF) | has_External_Reference | {
"repo_name": "BioInterchange/BioInterchange",
"path": "supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/CDAO.java",
"license": "mit",
"size": 85675
} | [
"com.hp.hpl.jena.rdf.model.Resource"
] | import com.hp.hpl.jena.rdf.model.Resource; | import com.hp.hpl.jena.rdf.model.*; | [
"com.hp.hpl"
] | com.hp.hpl; | 1,656,077 |
public void addNoCompressionUserAgent(String userAgent) {
try {
Pattern nRule = Pattern.compile(userAgent);
noCompressionUserAgents =
addREArray(noCompressionUserAgents, nRule);
} catch (PatternSyntaxException pse) {
log.error(sm.getString("http11processor.regexp.error", userAgent), pse);
}
} | void function(String userAgent) { try { Pattern nRule = Pattern.compile(userAgent); noCompressionUserAgents = addREArray(noCompressionUserAgents, nRule); } catch (PatternSyntaxException pse) { log.error(sm.getString(STR, userAgent), pse); } } | /**
* Add user-agent for which gzip compression didn't works
* The user agent String given will be exactly matched
* to the user-agent header submitted by the client.
*
* @param userAgent user-agent string
*/ | Add user-agent for which gzip compression didn't works The user agent String given will be exactly matched to the user-agent header submitted by the client | addNoCompressionUserAgent | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.0/Http11NioProcessor.java",
"license": "mit",
"size": 54880
} | [
"java.util.regex.Pattern",
"java.util.regex.PatternSyntaxException"
] | import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,368,234 |
public void connectAndBind(String host, int port, BindType bindType,
String systemId, String password, String systemType,
TypeOfNumber addrTon, NumberingPlanIndicator addrNpi,
String addressRange, long timeout) throws IOException {
connectAndBind(host, port, new BindParameter(bindType, systemId,
password, systemType, addrTon, addrNpi, addressRange), timeout);
}
| void function(String host, int port, BindType bindType, String systemId, String password, String systemType, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, String addressRange, long timeout) throws IOException { connectAndBind(host, port, new BindParameter(bindType, systemId, password, systemType, addrTon, addrNpi, addressRange), timeout); } | /**
* Open connection and bind immediately with specified timeout. The default
* timeout is 1 minutes.
*
* @param host is the SMSC host address.
* @param port is the SMSC listen port.
* @param bindType is the bind type.
* @param systemId is the system id.
* @param password is the password.
* @param systemType is the system type.
* @param addrTon is the address TON.
* @param addrNpi is the address NPI.
* @param addressRange is the address range.
* @param timeout is the timeout.
* @throws IOException if there is an IO error found.
*/ | Open connection and bind immediately with specified timeout. The default timeout is 1 minutes | connectAndBind | {
"repo_name": "pmoerenhout/jsmpp-1",
"path": "jsmpp/src/main/java/org/jsmpp/session/SMPPSession.java",
"license": "apache-2.0",
"size": 27649
} | [
"java.io.IOException",
"org.jsmpp.bean.BindType",
"org.jsmpp.bean.NumberingPlanIndicator",
"org.jsmpp.bean.TypeOfNumber"
] | import java.io.IOException; import org.jsmpp.bean.BindType; import org.jsmpp.bean.NumberingPlanIndicator; import org.jsmpp.bean.TypeOfNumber; | import java.io.*; import org.jsmpp.bean.*; | [
"java.io",
"org.jsmpp.bean"
] | java.io; org.jsmpp.bean; | 1,618,804 |
EClass getControlAreaOperator(); | EClass getControlAreaOperator(); | /**
* Returns the meta object for class '{@link gluemodel.CIM.IEC61970.Informative.Financial.ControlAreaOperator <em>Control Area Operator</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Control Area Operator</em>'.
* @see gluemodel.CIM.IEC61970.Informative.Financial.ControlAreaOperator
* @generated
*/ | Returns the meta object for class '<code>gluemodel.CIM.IEC61970.Informative.Financial.ControlAreaOperator Control Area Operator</code>'. | getControlAreaOperator | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Informative/Financial/FinancialPackage.java",
"license": "mit",
"size": 116407
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,777,176 |
Locations locate(String tableName, Collection<Range> ranges)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException; | Locations locate(String tableName, Collection<Range> ranges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException; | /**
* Locates the tablet servers and tablets that would service a collections of ranges. If a range
* covers multiple tablets, it will occur multiple times in the returned map.
*
* @param ranges
* The input ranges that should be mapped to tablet servers and tablets.
*
* @throws TableOfflineException
* if the table is offline or goes offline during the operation
* @since 1.8.0
*/ | Locates the tablet servers and tablets that would service a collections of ranges. If a range covers multiple tablets, it will occur multiple times in the returned map | locate | {
"repo_name": "ivakegg/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java",
"license": "apache-2.0",
"size": 43874
} | [
"java.util.Collection",
"org.apache.accumulo.core.client.AccumuloException",
"org.apache.accumulo.core.client.AccumuloSecurityException",
"org.apache.accumulo.core.client.TableNotFoundException",
"org.apache.accumulo.core.data.Range"
] | import java.util.Collection; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Range; | import java.util.*; import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.data.*; | [
"java.util",
"org.apache.accumulo"
] | java.util; org.apache.accumulo; | 1,752,747 |
JButton createButton(String text, int actionID, ActionListener l)
{
JButton b = UIUtilities.createHyperLinkButton(text);
b.setActionCommand(""+actionID);
b.addActionListener(l);
return b;
} | JButton createButton(String text, int actionID, ActionListener l) { JButton b = UIUtilities.createHyperLinkButton(text); b.setActionCommand(""+actionID); b.addActionListener(l); return b; } | /**
* Creates a button.
*
* @param text The text of the button.
* @param actionID The action command id.
* @param l The action listener.
* @return See above.
*/ | Creates a button | createButton | {
"repo_name": "rleigh-dundee/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/ui/ActivityComponent.java",
"license": "gpl-2.0",
"size": 28001
} | [
"java.awt.event.ActionListener",
"javax.swing.JButton",
"org.openmicroscopy.shoola.util.ui.UIUtilities"
] | import java.awt.event.ActionListener; import javax.swing.JButton; import org.openmicroscopy.shoola.util.ui.UIUtilities; | import java.awt.event.*; import javax.swing.*; import org.openmicroscopy.shoola.util.ui.*; | [
"java.awt",
"javax.swing",
"org.openmicroscopy.shoola"
] | java.awt; javax.swing; org.openmicroscopy.shoola; | 2,051,198 |
public AccountingDocument getAccountingDocumentForValidation() {
return accountingDocumentForValidation;
} | AccountingDocument function() { return accountingDocumentForValidation; } | /**
* Gets the accountingDocumentForValidation attribute.
* @return Returns the accountingDocumentForValidation.
*/ | Gets the accountingDocumentForValidation attribute | getAccountingDocumentForValidation | {
"repo_name": "UniversityOfHawaii/kfs",
"path": "kfs-core/src/main/java/org/kuali/kfs/fp/document/validation/impl/DisbursementVoucherVendorInformationValidation.java",
"license": "agpl-3.0",
"size": 10843
} | [
"org.kuali.kfs.sys.document.AccountingDocument"
] | import org.kuali.kfs.sys.document.AccountingDocument; | import org.kuali.kfs.sys.document.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,418,965 |
public synchronized void setManualFramingRect(int width, int height) {
if (initialized) {
Point screenResolution = configManager.getScreenResolution();
if (width > screenResolution.x) {
width = screenResolution.x;
}
if (height > screenResolution.y) {
height = screenResolution.y;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width,
topOffset + height);
Log.d(TAG, "Calculated manual framing rect: " + framingRect);
framingRectInPreview = null;
} else {
requestedFramingRectWidth = width;
requestedFramingRectHeight = height;
}
} | synchronized void function(int width, int height) { if (initialized) { Point screenResolution = configManager.getScreenResolution(); if (width > screenResolution.x) { width = screenResolution.x; } if (height > screenResolution.y) { height = screenResolution.y; } int leftOffset = (screenResolution.x - width) / 2; int topOffset = (screenResolution.y - height) / 2; framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height); Log.d(TAG, STR + framingRect); framingRectInPreview = null; } else { requestedFramingRectWidth = width; requestedFramingRectHeight = height; } } | /**
* Allows third party apps to specify the scanning rectangle dimensions,
* rather than determine them automatically based on screen resolution.
*
* @param width
* The width in pixels to scan.
* @param height
* The height in pixels to scan.
*/ | Allows third party apps to specify the scanning rectangle dimensions, rather than determine them automatically based on screen resolution | setManualFramingRect | {
"repo_name": "Waynehfut/EasyConnect",
"path": "app/src/main/java/com/waynehfut/zxing/camera/CameraManager.java",
"license": "mit",
"size": 11026
} | [
"android.graphics.Point",
"android.graphics.Rect",
"android.util.Log"
] | import android.graphics.Point; import android.graphics.Rect; import android.util.Log; | import android.graphics.*; import android.util.*; | [
"android.graphics",
"android.util"
] | android.graphics; android.util; | 1,875,706 |
public void setSubAccount(SubAccount subAccount) {
this.subAccount = subAccount;
}
| void function(SubAccount subAccount) { this.subAccount = subAccount; } | /**
* Sets the subAccount attribute value.
*
* @param subAccount The subAccount to set.
* @deprecated
*/ | Sets the subAccount attribute value | setSubAccount | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/bc/businessobject/BudgetConstructionControlList.java",
"license": "agpl-3.0",
"size": 12936
} | [
"org.kuali.kfs.coa.businessobject.SubAccount"
] | import org.kuali.kfs.coa.businessobject.SubAccount; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 2,385,965 |
public static void main(final String[] args) {
// instantiate speed examples
final SpeedTestSocket speedTestSocket = new SpeedTestSocket();
//set timeout for download
speedTestSocket.setSocketTimeout(SOCKET_TIMEOUT);
speedTestSocket.setComputationMethod(ComputationMethod.MEDIAN_INTERVAL);
// add a listener to wait for speed examples completion and progress
speedTestSocket.addSpeedTestListener(new ISpeedTestListener() { | static void function(final String[] args) { final SpeedTestSocket speedTestSocket = new SpeedTestSocket(); speedTestSocket.setSocketTimeout(SOCKET_TIMEOUT); speedTestSocket.setComputationMethod(ComputationMethod.MEDIAN_INTERVAL); speedTestSocket.addSpeedTestListener(new ISpeedTestListener() { | /**
* Download file example main.
*
* @param args no args required
*/ | Download file example main | main | {
"repo_name": "bertrandmartel/speed-test-lib",
"path": "examples/src/main/java/fr/bmartel/speedtest/examples/DownloadFileMedianIntervalExample.java",
"license": "mit",
"size": 3651
} | [
"fr.bmartel.speedtest.SpeedTestSocket",
"fr.bmartel.speedtest.inter.ISpeedTestListener",
"fr.bmartel.speedtest.model.ComputationMethod"
] | import fr.bmartel.speedtest.SpeedTestSocket; import fr.bmartel.speedtest.inter.ISpeedTestListener; import fr.bmartel.speedtest.model.ComputationMethod; | import fr.bmartel.speedtest.*; import fr.bmartel.speedtest.inter.*; import fr.bmartel.speedtest.model.*; | [
"fr.bmartel.speedtest"
] | fr.bmartel.speedtest; | 492,821 |
static <T> Node<T> node(Collection<T> c) {
return new CollectionNode<>(c);
}
/**
* Produces a {@link Node.Builder}.
*
* @param exactSizeIfKnown -1 if a variable size builder is requested,
* otherwise the exact capacity desired. A fixed capacity builder will
* fail if the wrong number of elements are added to the builder.
* @param generator the array factory
* @param <T> the type of elements of the node builder
* @return a {@code Node.Builder} | static <T> Node<T> node(Collection<T> c) { return new CollectionNode<>(c); } /** * Produces a {@link Node.Builder}. * * @param exactSizeIfKnown -1 if a variable size builder is requested, * otherwise the exact capacity desired. A fixed capacity builder will * fail if the wrong number of elements are added to the builder. * @param generator the array factory * @param <T> the type of elements of the node builder * @return a {@code Node.Builder} | /**
* Produces a {@link Node} describing a {@link Collection}.
* <p>
* The node will hold a reference to the collection and will not make a copy.
*
* @param <T> the type of elements held by the node
* @param c the collection
* @return a node holding a collection
*/ | Produces a <code>Node</code> describing a <code>Collection</code>. The node will hold a reference to the collection and will not make a copy | node | {
"repo_name": "streamsupport/streamsupport",
"path": "src/main/java/java8/util/stream/Nodes.java",
"license": "gpl-2.0",
"size": 107608
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,075,880 |
public final V getAndUpdate(UnaryOperator<V> updateFunction) {
V prev = get(), next = null;
for (boolean haveNext = false;;) {
if (!haveNext)
next = updateFunction.apply(prev);
if (weakCompareAndSetVolatile(prev, next))
return prev;
haveNext = (prev == (prev = get()));
}
} | final V function(UnaryOperator<V> updateFunction) { V prev = get(), next = null; for (boolean haveNext = false;;) { if (!haveNext) next = updateFunction.apply(prev); if (weakCompareAndSetVolatile(prev, next)) return prev; haveNext = (prev == (prev = get())); } } | /**
* Atomically updates the current value with the results of
* applying the given function, returning the previous value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
*
* @param updateFunction a side-effect-free function
* @return the previous value
* @since 1.8
*/ | Atomically updates the current value with the results of applying the given function, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads | getAndUpdate | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java",
"license": "gpl-2.0",
"size": 14128
} | [
"java.util.function.UnaryOperator"
] | import java.util.function.UnaryOperator; | import java.util.function.*; | [
"java.util"
] | java.util; | 940,116 |
public final MetaProperty<ExternalId> indexFamilyId() {
return _indexFamilyId;
} | final MetaProperty<ExternalId> function() { return _indexFamilyId; } | /**
* The meta-property for the {@code indexFamilyId} property.
* @return the meta-property, not null
*/ | The meta-property for the indexFamilyId property | indexFamilyId | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/index/Index.java",
"license": "apache-2.0",
"size": 8183
} | [
"com.opengamma.id.ExternalId",
"org.joda.beans.MetaProperty"
] | import com.opengamma.id.ExternalId; import org.joda.beans.MetaProperty; | import com.opengamma.id.*; import org.joda.beans.*; | [
"com.opengamma.id",
"org.joda.beans"
] | com.opengamma.id; org.joda.beans; | 2,324,569 |
Set<ControllerNode> getNodes(); | Set<ControllerNode> getNodes(); | /**
* Returns the set of current cluster members.
*
* @return set of cluster members
*/ | Returns the set of current cluster members | getNodes | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "core/api/src/main/java/org/onosproject/cluster/ClusterService.java",
"license": "apache-2.0",
"size": 2331
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 933,741 |
EClass getSAPAssignment(); | EClass getSAPAssignment(); | /**
* Returns the meta object for class '{@link gluemodel.COSEM.InterfaceClasses.SAPAssignment <em>SAP Assignment</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>SAP Assignment</em>'.
* @see gluemodel.COSEM.InterfaceClasses.SAPAssignment
* @generated
*/ | Returns the meta object for class '<code>gluemodel.COSEM.InterfaceClasses.SAPAssignment SAP Assignment</code>'. | getSAPAssignment | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/COSEM/InterfaceClasses/InterfaceClassesPackage.java",
"license": "mit",
"size": 201104
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,804,403 |
void setSelectionFromWebKit(int start, int end) {
if (start < 0 || end < 0) return;
Spannable text = (Spannable) getText();
int length = text.length();
if (start > length || end > length) return;
mFromWebKit = true;
Selection.setSelection(text, start, end);
mFromWebKit = false;
} | void setSelectionFromWebKit(int start, int end) { if (start < 0 end < 0) return; Spannable text = (Spannable) getText(); int length = text.length(); if (start > length end > length) return; mFromWebKit = true; Selection.setSelection(text, start, end); mFromWebKit = false; } | /**
* Set the selection, and disable our onSelectionChanged action.
*/ | Set the selection, and disable our onSelectionChanged action | setSelectionFromWebKit | {
"repo_name": "mateor/PDroidHistory",
"path": "frameworks/base/core/java/android/webkit/WebTextView.java",
"license": "gpl-3.0",
"size": 38403
} | [
"android.text.Selection",
"android.text.Spannable"
] | import android.text.Selection; import android.text.Spannable; | import android.text.*; | [
"android.text"
] | android.text; | 1,140,669 |
public final static String process(final Reader reader, final Configuration configuration) throws IOException
{
final Processor p = new Processor(!(reader instanceof BufferedReader) ? new BufferedReader(reader) : reader,
configuration);
return p.process();
} | final static String function(final Reader reader, final Configuration configuration) throws IOException { final Processor p = new Processor(!(reader instanceof BufferedReader) ? new BufferedReader(reader) : reader, configuration); return p.process(); } | /**
* Transforms an input stream into HTML using the given Configuration.
*
* @param reader
* The Reader to process.
* @param configuration
* The Configuration.
* @return The processed String.
* @throws IOException
* if an IO error occurs
* @since 0.7
* @see Configuration
*/ | Transforms an input stream into HTML using the given Configuration | process | {
"repo_name": "rjeschke/txtmark",
"path": "src/main/java/com/github/rjeschke/txtmark/Processor.java",
"license": "apache-2.0",
"size": 33678
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.Reader"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 1,031,274 |
@RequestMapping(value = "/roles/list", method = RequestMethod.GET)
public void getRoles(HttpServletRequest request, Model model) {
Principal p = request.getUserPrincipal();
if (p instanceof UsernamePasswordAuthenticationToken) {
UsernamePasswordAuthenticationToken u = (UsernamePasswordAuthenticationToken) p;
if (u.getPrincipal() instanceof UserDetails) {
UserDetails user = (UserDetails) u.getPrincipal();
model.addAttribute(JsonView.JSON_VIEW_RESULT, user.getAuthorities());
model.addAttribute(JsonView.JSON_VIEW_CLASS, Views.Public.class);
}
}
} | @RequestMapping(value = STR, method = RequestMethod.GET) void function(HttpServletRequest request, Model model) { Principal p = request.getUserPrincipal(); if (p instanceof UsernamePasswordAuthenticationToken) { UsernamePasswordAuthenticationToken u = (UsernamePasswordAuthenticationToken) p; if (u.getPrincipal() instanceof UserDetails) { UserDetails user = (UserDetails) u.getPrincipal(); model.addAttribute(JsonView.JSON_VIEW_RESULT, user.getAuthorities()); model.addAttribute(JsonView.JSON_VIEW_CLASS, Views.Public.class); } } } | /**
* Returns all roles of logged users.
*
* @param request Do nothing.
* @return Return all roles of logged users.
*/ | Returns all roles of logged users | getRoles | {
"repo_name": "abada-investigacion/contramed",
"path": "trazability/trazability-rest/src/main/java/com/abada/trazability/rest/identity/IdentityController.java",
"license": "gpl-3.0",
"size": 3705
} | [
"com.abada.springframework.web.servlet.view.JsonView",
"com.abada.trazability.entity.view.Views",
"java.security.Principal",
"javax.servlet.http.HttpServletRequest",
"org.springframework.security.authentication.UsernamePasswordAuthenticationToken",
"org.springframework.security.core.userdetails.UserDetails",
"org.springframework.ui.Model",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod"
] | import com.abada.springframework.web.servlet.view.JsonView; import com.abada.trazability.entity.view.Views; import java.security.Principal; import javax.servlet.http.HttpServletRequest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import com.abada.springframework.web.servlet.view.*; import com.abada.trazability.entity.view.*; import java.security.*; import javax.servlet.http.*; import org.springframework.security.authentication.*; import org.springframework.security.core.userdetails.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*; | [
"com.abada.springframework",
"com.abada.trazability",
"java.security",
"javax.servlet",
"org.springframework.security",
"org.springframework.ui",
"org.springframework.web"
] | com.abada.springframework; com.abada.trazability; java.security; javax.servlet; org.springframework.security; org.springframework.ui; org.springframework.web; | 615,396 |
private void openTreeToParentConcept(String actType) {
try {
HttpSession session = m_classReq.getSession();
String sCCodeDB = (String) m_classReq.getParameter("sCCodeDB");
String sCCode = (String) m_classReq.getParameter("sCCode");
String sCCodeName = (String) m_classReq.getParameter("sCCodeName");
String sNodeID = (String) m_classReq.getParameter("nodeID");
String treeName = "parentTree" + sCCodeName;
DataManager.setAttribute(session, "SelectedParentName", sCCodeName);
DataManager.setAttribute(session, "SelectedParentCC", sCCode);
DataManager.setAttribute(session, "SelectedParentDB", sCCodeDB);
sCCodeDB = m_eBean.getVocabAttr(m_eUser, sCCodeDB,
EVSSearch.VOCAB_DBORIGIN, EVSSearch.VOCAB_NAME); // "vocabDBOrigin", "vocabName");
if (sCCode != null && !sCCode.equals("")) {
this.doCollapseAllNodes(treeName);
this.doTreeOpenToConcept("parentTree", "Blocks", sCCode,
sCCodeDB, sCCodeName, sNodeID);
} else {
this.doCollapseAllNodes(sCCodeDB);
this.doTreeSearch(actType, "Blocks");
}
} catch (Exception e) {
logger
.error("Error - openTreeToParentConcept : " + e.toString(),
e);
}
} | void function(String actType) { try { HttpSession session = m_classReq.getSession(); String sCCodeDB = (String) m_classReq.getParameter(STR); String sCCode = (String) m_classReq.getParameter(STR); String sCCodeName = (String) m_classReq.getParameter(STR); String sNodeID = (String) m_classReq.getParameter(STR); String treeName = STR + sCCodeName; DataManager.setAttribute(session, STR, sCCodeName); DataManager.setAttribute(session, STR, sCCode); DataManager.setAttribute(session, STR, sCCodeDB); sCCodeDB = m_eBean.getVocabAttr(m_eUser, sCCodeDB, EVSSearch.VOCAB_DBORIGIN, EVSSearch.VOCAB_NAME); if (sCCode != null && !sCCode.equals("")) { this.doCollapseAllNodes(treeName); this.doTreeOpenToConcept(STR, "BlocksSTRBlocksSTRError - openTreeToParentConcept : " + e.toString(), e); } } | /**
* to open the tree to the selected concept from the parent level
* @param actType String action type
*/ | to open the tree to the selected concept from the parent level | openTreeToParentConcept | {
"repo_name": "NCIP/cadsr-cdecurate",
"path": "src/gov/nih/nci/cadsr/cdecurate/tool/EVSSearch.java",
"license": "bsd-3-clause",
"size": 284529
} | [
"gov.nih.nci.cadsr.cdecurate.util.DataManager",
"javax.servlet.http.HttpSession"
] | import gov.nih.nci.cadsr.cdecurate.util.DataManager; import javax.servlet.http.HttpSession; | import gov.nih.nci.cadsr.cdecurate.util.*; import javax.servlet.http.*; | [
"gov.nih.nci",
"javax.servlet"
] | gov.nih.nci; javax.servlet; | 2,581,397 |
public void doDeep_delete_assignment(RunData data)
{
if (!"POST".equals(data.getRequest().getMethod())) {
return;
}
SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());
// get the delete assignment ids
List ids = (List) state.getAttribute(DELETE_ASSIGNMENT_IDS);
for (int i = 0; i < ids.size(); i++)
{
String currentId = (String) ids.get(i);
AssignmentEdit a = editAssignment(currentId, "doDeep_delete_assignment", state, false);
if (a != null)
{
try
{
TaggingManager taggingManager = (TaggingManager) ComponentManager
.get("org.sakaiproject.taggable.api.TaggingManager");
AssignmentActivityProducer assignmentActivityProducer = (AssignmentActivityProducer) ComponentManager
.get("org.sakaiproject.assignment.taggable.api.AssignmentActivityProducer");
if (taggingManager.isTaggable()) {
for (TaggingProvider provider : taggingManager
.getProviders()) {
provider.removeTags(assignmentActivityProducer
.getActivity(a));
}
}
AssignmentService.removeAssignment(a);
}
catch (PermissionException e)
{
addAlert(state, rb.getFormattedMessage("youarenot_editAssignment", new Object[]{a.getTitle()}));
M_log.warn(this + ":doDeep_delete_assignment " + e.getMessage());
}
}
}
if (state.getAttribute(STATE_MESSAGE) == null)
{
state.setAttribute(DELETE_ASSIGNMENT_IDS, new ArrayList());
state.setAttribute(STATE_MODE, MODE_LIST_ASSIGNMENTS);
}
} // doDeep_delete_Assignment | void function(RunData data) { if (!"POST".equals(data.getRequest().getMethod())) { return; } SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); List ids = (List) state.getAttribute(DELETE_ASSIGNMENT_IDS); for (int i = 0; i < ids.size(); i++) { String currentId = (String) ids.get(i); AssignmentEdit a = editAssignment(currentId, STR, state, false); if (a != null) { try { TaggingManager taggingManager = (TaggingManager) ComponentManager .get(STR); AssignmentActivityProducer assignmentActivityProducer = (AssignmentActivityProducer) ComponentManager .get(STR); if (taggingManager.isTaggable()) { for (TaggingProvider provider : taggingManager .getProviders()) { provider.removeTags(assignmentActivityProducer .getActivity(a)); } } AssignmentService.removeAssignment(a); } catch (PermissionException e) { addAlert(state, rb.getFormattedMessage(STR, new Object[]{a.getTitle()})); M_log.warn(this + STR + e.getMessage()); } } } if (state.getAttribute(STATE_MESSAGE) == null) { state.setAttribute(DELETE_ASSIGNMENT_IDS, new ArrayList()); state.setAttribute(STATE_MODE, MODE_LIST_ASSIGNMENTS); } } | /**
* Action is to delete the assignment and also the related AssignmentSubmission
*/ | Action is to delete the assignment and also the related AssignmentSubmission | doDeep_delete_assignment | {
"repo_name": "tl-its-umich-edu/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 671846
} | [
"java.util.ArrayList",
"java.util.List",
"org.sakaiproject.assignment.api.AssignmentEdit",
"org.sakaiproject.assignment.cover.AssignmentService",
"org.sakaiproject.assignment.taggable.api.AssignmentActivityProducer",
"org.sakaiproject.cheftool.JetspeedRunData",
"org.sakaiproject.cheftool.RunData",
"org.sakaiproject.component.cover.ComponentManager",
"org.sakaiproject.event.api.SessionState",
"org.sakaiproject.exception.PermissionException",
"org.sakaiproject.taggable.api.TaggingManager",
"org.sakaiproject.taggable.api.TaggingProvider"
] | import java.util.ArrayList; import java.util.List; import org.sakaiproject.assignment.api.AssignmentEdit; import org.sakaiproject.assignment.cover.AssignmentService; import org.sakaiproject.assignment.taggable.api.AssignmentActivityProducer; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.event.api.SessionState; import org.sakaiproject.exception.PermissionException; import org.sakaiproject.taggable.api.TaggingManager; import org.sakaiproject.taggable.api.TaggingProvider; | import java.util.*; import org.sakaiproject.assignment.api.*; import org.sakaiproject.assignment.cover.*; import org.sakaiproject.assignment.taggable.api.*; import org.sakaiproject.cheftool.*; import org.sakaiproject.component.cover.*; import org.sakaiproject.event.api.*; import org.sakaiproject.exception.*; import org.sakaiproject.taggable.api.*; | [
"java.util",
"org.sakaiproject.assignment",
"org.sakaiproject.cheftool",
"org.sakaiproject.component",
"org.sakaiproject.event",
"org.sakaiproject.exception",
"org.sakaiproject.taggable"
] | java.util; org.sakaiproject.assignment; org.sakaiproject.cheftool; org.sakaiproject.component; org.sakaiproject.event; org.sakaiproject.exception; org.sakaiproject.taggable; | 909,071 |
public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack)
{
return par1 == 3 ? false : (par1 == 2 ? isItemFuel(par2ItemStack) : true);
}
| boolean function(int par1, ItemStack par2ItemStack) { return par1 == 3 ? false : (par1 == 2 ? isItemFuel(par2ItemStack) : true); } | /**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/ | Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot | isItemValidForSlot | {
"repo_name": "NEMESIS13cz/Evercraft",
"path": "java/evercraft/NEMESIS13cz/TileEntity/TileEntity/TileEntityAlloyFurnace.java",
"license": "gpl-3.0",
"size": 21587
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 2,871,803 |
public void SA207_235(Vector<FractionI> myFractions) {
ZeroAllValues();
String radiogenicIsotopeDateName = RadDates.age207_235r.getName();
if (myFractions.size() > 0) {
calculateSingleDateInterpretation(radiogenicIsotopeDateName, myFractions.get(0));
}
} | void function(Vector<FractionI> myFractions) { ZeroAllValues(); String radiogenicIsotopeDateName = RadDates.age207_235r.getName(); if (myFractions.size() > 0) { calculateSingleDateInterpretation(radiogenicIsotopeDateName, myFractions.get(0)); } } | /**
* zeroes all values and sets this <code>SampleDateModel</code>'s
* <code>name</code>, <code>value</code>, <code>oneSigma</code>, and
* <code>internalTwoSigmaUnctWithTracerCalibrationAndDecayConstantUnct</code>
* to those of the first <code>Fraction</code> found in argument
* <code>myFractions</code>.
*
* @pre argument <code>myFractions</code> is a valid collection of
* <code>Fractions</code>
* @post this <code>SampleDateModel</code>'s fields are zeroed out and its
* <code>name</code>, <code>value</code>, <code>oneSigma</code>, and
* <code>internalTwoSigmaUnctWithTracerCalibrationAndDecayConstantUnct</code>
* are set to those of the first <code>Fraction</code> found in argument
* <code>myFractions</code>
*
* @param myFractions the collection of <code>Fractions</code> that will be
* used to set this <code>SampleDateModel</code>'s fields
*/ | zeroes all values and sets this <code>SampleDateModel</code>'s <code>name</code>, <code>value</code>, <code>oneSigma</code>, and <code>internalTwoSigmaUnctWithTracerCalibrationAndDecayConstantUnct</code> to those of the first <code>Fraction</code> found in argument <code>myFractions</code> | SA207_235 | {
"repo_name": "johnzeringue/ET_Redux",
"path": "src/main/java/org/earthtime/UPb_Redux/valueModels/SampleDateModel.java",
"license": "apache-2.0",
"size": 130389
} | [
"java.util.Vector",
"org.earthtime.UPb_Redux",
"org.earthtime.dataDictionaries.RadDates"
] | import java.util.Vector; import org.earthtime.UPb_Redux; import org.earthtime.dataDictionaries.RadDates; | import java.util.*; import org.earthtime.*; | [
"java.util",
"org.earthtime"
] | java.util; org.earthtime; | 2,773,938 |
@Override
public String addArchive(Path path)
{
GitCommitJar commit = null;
try {
commit = new GitCommitJar(path);
return addArchive(commit);
} catch (IOException e) {
throw new RepositoryException(e);
} finally {
if (commit != null)
commit.close();
}
} | String function(Path path) { GitCommitJar commit = null; try { commit = new GitCommitJar(path); return addArchive(commit); } catch (IOException e) { throw new RepositoryException(e); } finally { if (commit != null) commit.close(); } } | /**
* Adds a path to the repository. If the path is a directory,
* adds the contents recursively.
*/ | Adds a path to the repository. If the path is a directory, adds the contents recursively | addArchive | {
"repo_name": "WelcomeHUME/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/env/repository/AbstractRepository.java",
"license": "gpl-2.0",
"size": 20914
} | [
"com.caucho.env.git.GitCommitJar",
"com.caucho.vfs.Path",
"java.io.IOException"
] | import com.caucho.env.git.GitCommitJar; import com.caucho.vfs.Path; import java.io.IOException; | import com.caucho.env.git.*; import com.caucho.vfs.*; import java.io.*; | [
"com.caucho.env",
"com.caucho.vfs",
"java.io"
] | com.caucho.env; com.caucho.vfs; java.io; | 402,201 |
private CampPattern translateTemporalAllocation(SemNewObject ast) {
List<SemValue> args = ast.getArguments();
if (DATE_TYPE.equals(ast.getType().getDisplayName())) {
Iterator<SemValue> argIter = args.iterator();
ZonedDateTime translation = ZonedDateTime.ofInstant(Instant.EPOCH, ZoneId.systemDefault())
.withYear(intFrom(argIter.next())).withMonth(intFrom(argIter.next()))
.withDayOfMonth(intFrom(argIter.next()));
if (argIter.hasNext())
translation = translation.withHour(intFrom(argIter.next()));
if (argIter.hasNext())
translation = translation.withMinute(intFrom(argIter.next()));
if (argIter.hasNext())
translation = translation.withSecond(intFrom(argIter.next()));
ConstPattern constant = new ConstPattern(translation.toString());
return new UnaryPattern(UnaryOperator.TimeFromString, constant);
}
if (TIME_TYPE.equals(ast.getType().getDisplayName()) && args.size() == 1) {
long epochMilli = longFrom(args.get(0));
LocalTime translation = ZonedDateTime.ofInstant(Instant.ofEpochMilli(epochMilli),
ZoneOffset.UTC).toLocalTime();
// TODO this should really be a unique CAMP type corresponding to the TTRL type for LocalTimeComponentValue
return new ConstPattern(translation.toString());
}
return notImplemented("Translation of temporal allocation: " + ast);
} | CampPattern function(SemNewObject ast) { List<SemValue> args = ast.getArguments(); if (DATE_TYPE.equals(ast.getType().getDisplayName())) { Iterator<SemValue> argIter = args.iterator(); ZonedDateTime translation = ZonedDateTime.ofInstant(Instant.EPOCH, ZoneId.systemDefault()) .withYear(intFrom(argIter.next())).withMonth(intFrom(argIter.next())) .withDayOfMonth(intFrom(argIter.next())); if (argIter.hasNext()) translation = translation.withHour(intFrom(argIter.next())); if (argIter.hasNext()) translation = translation.withMinute(intFrom(argIter.next())); if (argIter.hasNext()) translation = translation.withSecond(intFrom(argIter.next())); ConstPattern constant = new ConstPattern(translation.toString()); return new UnaryPattern(UnaryOperator.TimeFromString, constant); } if (TIME_TYPE.equals(ast.getType().getDisplayName()) && args.size() == 1) { long epochMilli = longFrom(args.get(0)); LocalTime translation = ZonedDateTime.ofInstant(Instant.ofEpochMilli(epochMilli), ZoneOffset.UTC).toLocalTime(); return new ConstPattern(translation.toString()); } return notImplemented(STR + ast); } | /**
* Incomplete but evolving translation for object allocations involving temporal constructs
* @param ast the object allocation (SemNewObject)
* @return the translation
*/ | Incomplete but evolving translation for object allocations involving temporal constructs | translateTemporalAllocation | {
"repo_name": "querycert/qcert",
"path": "compiler/parsingJava/jrulesParser/src/org/qcert/camp/translator/SemRule2CAMP.java",
"license": "apache-2.0",
"size": 70950
} | [
"com.ibm.rules.engine.lang.semantics.SemNewObject",
"com.ibm.rules.engine.lang.semantics.SemValue",
"java.time.Instant",
"java.time.LocalTime",
"java.time.ZoneId",
"java.time.ZoneOffset",
"java.time.ZonedDateTime",
"java.util.Iterator",
"java.util.List",
"org.qcert.camp.pattern.CampPattern",
"org.qcert.camp.pattern.ConstPattern",
"org.qcert.camp.pattern.UnaryOperator",
"org.qcert.camp.pattern.UnaryPattern"
] | import com.ibm.rules.engine.lang.semantics.SemNewObject; import com.ibm.rules.engine.lang.semantics.SemValue; import java.time.Instant; import java.time.LocalTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.Iterator; import java.util.List; import org.qcert.camp.pattern.CampPattern; import org.qcert.camp.pattern.ConstPattern; import org.qcert.camp.pattern.UnaryOperator; import org.qcert.camp.pattern.UnaryPattern; | import com.ibm.rules.engine.lang.semantics.*; import java.time.*; import java.util.*; import org.qcert.camp.pattern.*; | [
"com.ibm.rules",
"java.time",
"java.util",
"org.qcert.camp"
] | com.ibm.rules; java.time; java.util; org.qcert.camp; | 1,273,897 |
public boolean canModifyUser( User other )
{
if ( other == null )
{
return false;
}
final Set<String> authorities = getAllAuthorities();
if ( authorities.contains( UserRole.AUTHORITY_ALL ) )
{
return true;
}
return authorities.containsAll( other.getAllAuthorities() );
} | boolean function( User other ) { if ( other == null ) { return false; } final Set<String> authorities = getAllAuthorities(); if ( authorities.contains( UserRole.AUTHORITY_ALL ) ) { return true; } return authorities.containsAll( other.getAllAuthorities() ); } | /**
* Indicates whether this user can modify the given user. This user must
* have the ALL authority or possess all user authorities of the other user
* to do so.
*
* @param other the user to modify.
*/ | Indicates whether this user can modify the given user. This user must have the ALL authority or possess all user authorities of the other user to do so | canModifyUser | {
"repo_name": "dhis2/dhis2-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java",
"license": "bsd-3-clause",
"size": 39570
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,473,845 |
public Collection<MessageCollector> getCollectors() {
return mCollectors;
} | Collection<MessageCollector> function() { return mCollectors; } | /**
* Get the collection of all message collectors for this connection.
*
* @return a collection of message collectors for this connection
*/ | Get the collection of all message collectors for this connection | getCollectors | {
"repo_name": "D-3/BS808",
"path": "libjt808/src/main/java/com/deew/jt808/conn/Connection.java",
"license": "gpl-2.0",
"size": 17135
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,338,898 |
public void setStartDate (Timestamp StartDate); | void function (Timestamp StartDate); | /** Set Start Date.
* First effective day (inclusive)
*/ | Set Start Date. First effective day (inclusive) | setStartDate | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_C_Subscription.java",
"license": "gpl-2.0",
"size": 6648
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,062,165 |
public void testConstructor() {
// try a null source
CategoryToPieDataset p1 = new CategoryToPieDataset(null,
TableOrder.BY_COLUMN, 0);
assertNull(p1.getUnderlyingDataset());
assertEquals(p1.getItemCount(), 0);
assertTrue(p1.getKeys().isEmpty());
assertNull(p1.getValue("R1"));
} | void function() { CategoryToPieDataset p1 = new CategoryToPieDataset(null, TableOrder.BY_COLUMN, 0); assertNull(p1.getUnderlyingDataset()); assertEquals(p1.getItemCount(), 0); assertTrue(p1.getKeys().isEmpty()); assertNull(p1.getValue("R1")); } | /**
* Some tests for the constructor.
*/ | Some tests for the constructor | testConstructor | {
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/jfreechart-1.0.5/tests/org/jfree/data/category/junit/CategoryToPieDatasetTests.java",
"license": "gpl-2.0",
"size": 8518
} | [
"org.jfree.data.category.CategoryToPieDataset",
"org.jfree.util.TableOrder"
] | import org.jfree.data.category.CategoryToPieDataset; import org.jfree.util.TableOrder; | import org.jfree.data.category.*; import org.jfree.util.*; | [
"org.jfree.data",
"org.jfree.util"
] | org.jfree.data; org.jfree.util; | 501,591 |
public static SMOutputElement myAddNewKMLGeometryPlacemarkElevatedElement(SMOutputElement parentElement, String plName, GeoPoint[] outerRegionPoints, GeoPoint[] innerRegionPoints, double givRoomHeight, double givRoomElevation, String givStyleUrl)
throws javax.xml.stream.XMLStreamException
{
SMOutputElement placemarkEl = parentElement.addElement("Placemark");
SMOutputElement placemarkNameEl = placemarkEl.addElement("name");
placemarkNameEl.addCharacters(plName);
if(givStyleUrl != null)
{
if(givStyleUrl.indexOf("#")!= 0)
givStyleUrl = "#"+givStyleUrl;
SMOutputElement placemarkStyleUrlEl = placemarkEl.addElement("styleUrl");
placemarkStyleUrlEl.addCharacters(givStyleUrl);
}
SMOutputElement multiGeomEl = placemarkEl.addElement("GeometryCollection");
double roomTopHeight = givRoomElevation + givRoomHeight;
double roomTopInnerFaceHeight = roomTopHeight + 0.000000000000001;
double roomBaseInnerFaceHeight = givRoomElevation + 0.30; // fixed floor thickness is 30 centimeters thick
//
// Outer Base polygon
//
SMOutputElement polygonElOuterBase = multiGeomEl.addElement("Polygon");
SMOutputElement altitudeModeElOuterBase = polygonElOuterBase.addElement("altitudeMode");
altitudeModeElOuterBase.addCharacters("relativeToGround");
SMOutputElement outerBoundaryIsElOuterBase = polygonElOuterBase.addElement("outerBoundaryIs");
SMOutputElement outLinRingElOuterBase = outerBoundaryIsElOuterBase.addElement("LinearRing");
SMOutputElement outCoordinatesElOuterBase = outLinRingElOuterBase.addElement("coordinates");
for(int i = 0 ; i < outerRegionPoints.length; i++)
{
if(outerRegionPoints[i].isValidPoint())
outCoordinatesElOuterBase.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], givRoomElevation) +" ");
}
if(outerRegionPoints.length > 0) // final closing edge
{
if(outerRegionPoints[0].isValidPoint())
outCoordinatesElOuterBase.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[0], givRoomElevation) +" ");
}
//
// Outer faces (as many as the points on the base)
//
for(int i = 0 ; i < outerRegionPoints.length; i++)
{
SMOutputElement polygonElOuterFace = multiGeomEl.addElement("Polygon");
SMOutputElement altitudeModeElOuterFace = polygonElOuterFace.addElement("altitudeMode");
altitudeModeElOuterFace.addCharacters("relativeToGround");
SMOutputElement outerBoundaryIsElOuterFace = polygonElOuterFace.addElement("outerBoundaryIs");
SMOutputElement outLinRingElOuterFace = outerBoundaryIsElOuterFace.addElement("LinearRing");
SMOutputElement outCoordinatesElOuterFace = outLinRingElOuterFace.addElement("coordinates");
if(outerRegionPoints[i].isValidPoint() && outerRegionPoints[(i+1)%outerRegionPoints.length].isValidPoint())
{
outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], givRoomElevation) +" ");
outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[(i+1)%outerRegionPoints.length], givRoomElevation) +" ");
outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[(i+1)%outerRegionPoints.length], roomTopHeight) +" ");
outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], roomTopHeight) +" ");
outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], givRoomElevation) +" ");
}
}
//
// Top Face polygon (outer AND inner -if defined)
//
SMOutputElement polygonElTopFace = multiGeomEl.addElement("Polygon");
SMOutputElement altitudeModeElTopFace = polygonElTopFace.addElement("altitudeMode");
altitudeModeElTopFace.addCharacters("relativeToGround");
// outer edges for Top Face
SMOutputElement outerBoundaryIsElTopFace = polygonElTopFace.addElement("outerBoundaryIs");
SMOutputElement outLinRingElTopFace = outerBoundaryIsElTopFace.addElement("LinearRing");
SMOutputElement outCoordinatesElTopFace = outLinRingElTopFace.addElement("coordinates");
for(int i = 0 ; i < outerRegionPoints.length; i++)
{
if(outerRegionPoints[i].isValidPoint())
outCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], roomTopHeight) +" ");
}
if(outerRegionPoints.length > 0) // final closing edge
{
if(outerRegionPoints[0].isValidPoint())
outCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[0], roomTopHeight) +" ");
}
// inner edges for Top Face
if(innerRegionPoints !=null && innerRegionPoints.length >0)
{
SMOutputElement innerBoundaryIsElTopFace = polygonElTopFace.addElement("innerBoundaryIs");
SMOutputElement inLinRingElTopFace = innerBoundaryIsElTopFace.addElement("LinearRing");
SMOutputElement inCoordinatesElTopFace = inLinRingElTopFace.addElement("coordinates");
for(int i = 0 ; i < innerRegionPoints.length; i++)
{
if(innerRegionPoints[i].isValidPoint())
inCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomTopInnerFaceHeight) +" ");
}
if(innerRegionPoints.length > 0) // final closing edge
{
if(innerRegionPoints[0].isValidPoint())
inCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[0], roomTopInnerFaceHeight) +" ");
}
//
// Inner Faces of Room Side Walls (as many as the points in the innerRegionPoints Vector)
//
for(int i = 0 ; i < innerRegionPoints.length; i++)
{
SMOutputElement polygonElInnerFace = multiGeomEl.addElement("Polygon");
SMOutputElement altitudeModeElInnerFace = polygonElInnerFace.addElement("altitudeMode");
altitudeModeElInnerFace.addCharacters("relativeToGround");
SMOutputElement outerBoundaryIsElInnerFace = polygonElInnerFace.addElement("outerBoundaryIs");
SMOutputElement inLinRingElInnerFace = outerBoundaryIsElInnerFace.addElement("LinearRing");
SMOutputElement inCoordinatesElInnerFace = inLinRingElInnerFace.addElement("coordinates");
if(innerRegionPoints[i].isValidPoint() && innerRegionPoints[(i+1)%innerRegionPoints.length].isValidPoint()) {
inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomTopInnerFaceHeight) +" ");
inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[(i+1)%innerRegionPoints.length], roomTopInnerFaceHeight) +" ");
inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[(i+1)%innerRegionPoints.length], roomBaseInnerFaceHeight) +" ");
inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomBaseInnerFaceHeight) +" ");
inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomTopInnerFaceHeight) +" ");
}
}
//
// Inner Face for Room base
//
SMOutputElement polygonElInnerBase = multiGeomEl.addElement("Polygon");
SMOutputElement altitudeModeElInnerBase = polygonElInnerBase.addElement("altitudeMode");
altitudeModeElInnerBase.addCharacters("relativeToGround");
SMOutputElement innerBoundaryIsElInnerBase = polygonElInnerBase.addElement("outerBoundaryIs");
SMOutputElement inLinRingElInnerBase = innerBoundaryIsElInnerBase.addElement("LinearRing");
SMOutputElement inCoordinatesElInnerBase = inLinRingElInnerBase.addElement("coordinates");
for(int i = 0 ; i < innerRegionPoints.length; i++)
{
if(innerRegionPoints[i].isValidPoint())
inCoordinatesElInnerBase.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomBaseInnerFaceHeight) +" ");
}
if(innerRegionPoints.length > 0) // final closing edge
{
if(innerRegionPoints[0].isValidPoint())
inCoordinatesElInnerBase.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[0], roomBaseInnerFaceHeight) +" ");
}
}
return placemarkEl;
}
| static SMOutputElement function(SMOutputElement parentElement, String plName, GeoPoint[] outerRegionPoints, GeoPoint[] innerRegionPoints, double givRoomHeight, double givRoomElevation, String givStyleUrl) throws javax.xml.stream.XMLStreamException { SMOutputElement placemarkEl = parentElement.addElement(STR); SMOutputElement placemarkNameEl = placemarkEl.addElement("name"); placemarkNameEl.addCharacters(plName); if(givStyleUrl != null) { if(givStyleUrl.indexOf("#")!= 0) givStyleUrl = "#"+givStyleUrl; SMOutputElement placemarkStyleUrlEl = placemarkEl.addElement(STR); placemarkStyleUrlEl.addCharacters(givStyleUrl); } SMOutputElement multiGeomEl = placemarkEl.addElement(STR); double roomTopHeight = givRoomElevation + givRoomHeight; double roomTopInnerFaceHeight = roomTopHeight + 0.000000000000001; double roomBaseInnerFaceHeight = givRoomElevation + 0.30; SMOutputElement altitudeModeElOuterBase = polygonElOuterBase.addElement(STR); altitudeModeElOuterBase.addCharacters(STR); SMOutputElement outerBoundaryIsElOuterBase = polygonElOuterBase.addElement(STR); SMOutputElement outLinRingElOuterBase = outerBoundaryIsElOuterBase.addElement(STR); SMOutputElement outCoordinatesElOuterBase = outLinRingElOuterBase.addElement(STR); for(int i = 0 ; i < outerRegionPoints.length; i++) { if(outerRegionPoints[i].isValidPoint()) outCoordinatesElOuterBase.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], givRoomElevation) +" "); } if(outerRegionPoints.length > 0) { if(outerRegionPoints[0].isValidPoint()) outCoordinatesElOuterBase.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[0], givRoomElevation) +" "); } { SMOutputElement polygonElOuterFace = multiGeomEl.addElement(STR); SMOutputElement altitudeModeElOuterFace = polygonElOuterFace.addElement(STR); altitudeModeElOuterFace.addCharacters(STR); SMOutputElement outerBoundaryIsElOuterFace = polygonElOuterFace.addElement(STR); SMOutputElement outLinRingElOuterFace = outerBoundaryIsElOuterFace.addElement(STR); SMOutputElement outCoordinatesElOuterFace = outLinRingElOuterFace.addElement(STR); if(outerRegionPoints[i].isValidPoint() && outerRegionPoints[(i+1)%outerRegionPoints.length].isValidPoint()) { outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], givRoomElevation) +" "); outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[(i+1)%outerRegionPoints.length], givRoomElevation) +" "); outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[(i+1)%outerRegionPoints.length], roomTopHeight) +" "); outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], roomTopHeight) +" "); outCoordinatesElOuterFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], givRoomElevation) +" "); } } SMOutputElement altitudeModeElTopFace = polygonElTopFace.addElement(STR); altitudeModeElTopFace.addCharacters(STR); SMOutputElement outerBoundaryIsElTopFace = polygonElTopFace.addElement(STR); SMOutputElement outLinRingElTopFace = outerBoundaryIsElTopFace.addElement(STR); SMOutputElement outCoordinatesElTopFace = outLinRingElTopFace.addElement(STR); for(int i = 0 ; i < outerRegionPoints.length; i++) { if(outerRegionPoints[i].isValidPoint()) outCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[i], roomTopHeight) +" "); } if(outerRegionPoints.length > 0) { if(outerRegionPoints[0].isValidPoint()) outCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(outerRegionPoints[0], roomTopHeight) +" "); } if(innerRegionPoints !=null && innerRegionPoints.length >0) { SMOutputElement innerBoundaryIsElTopFace = polygonElTopFace.addElement(STR); SMOutputElement inLinRingElTopFace = innerBoundaryIsElTopFace.addElement(STR); SMOutputElement inCoordinatesElTopFace = inLinRingElTopFace.addElement(STR); for(int i = 0 ; i < innerRegionPoints.length; i++) { if(innerRegionPoints[i].isValidPoint()) inCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomTopInnerFaceHeight) +" "); } if(innerRegionPoints.length > 0) { if(innerRegionPoints[0].isValidPoint()) inCoordinatesElTopFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[0], roomTopInnerFaceHeight) +" "); } { SMOutputElement polygonElInnerFace = multiGeomEl.addElement(STR); SMOutputElement altitudeModeElInnerFace = polygonElInnerFace.addElement(STR); altitudeModeElInnerFace.addCharacters(STR); SMOutputElement outerBoundaryIsElInnerFace = polygonElInnerFace.addElement(STR); SMOutputElement inLinRingElInnerFace = outerBoundaryIsElInnerFace.addElement(STR); SMOutputElement inCoordinatesElInnerFace = inLinRingElInnerFace.addElement(STR); if(innerRegionPoints[i].isValidPoint() && innerRegionPoints[(i+1)%innerRegionPoints.length].isValidPoint()) { inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomTopInnerFaceHeight) +" "); inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[(i+1)%innerRegionPoints.length], roomTopInnerFaceHeight) +" "); inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[(i+1)%innerRegionPoints.length], roomBaseInnerFaceHeight) +" "); inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomBaseInnerFaceHeight) +" "); inCoordinatesElInnerFace.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomTopInnerFaceHeight) +" "); } } SMOutputElement altitudeModeElInnerBase = polygonElInnerBase.addElement(STR); altitudeModeElInnerBase.addCharacters(STR); SMOutputElement innerBoundaryIsElInnerBase = polygonElInnerBase.addElement(STR); SMOutputElement inLinRingElInnerBase = innerBoundaryIsElInnerBase.addElement(STR); SMOutputElement inCoordinatesElInnerBase = inLinRingElInnerBase.addElement(STR); for(int i = 0 ; i < innerRegionPoints.length; i++) { if(innerRegionPoints[i].isValidPoint()) inCoordinatesElInnerBase.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[i], roomBaseInnerFaceHeight) +" "); } if(innerRegionPoints.length > 0) { if(innerRegionPoints[0].isValidPoint()) inCoordinatesElInnerBase.addCharacters(KMLProcessTools.toGEPlacemarkString(innerRegionPoints[0], roomBaseInnerFaceHeight) +" "); } } return placemarkEl; } | /**
* Translates vector of outer and a vector of inner points to a KML placemark/room
*
*
*/ | Translates vector of outer and a vector of inner points to a KML placemark/room | myAddNewKMLGeometryPlacemarkElevatedElement | {
"repo_name": "vitrofp7/vitro",
"path": "source/trunk/Demo/vitroUI/webUI/src/main/java/presentation/webgui/vitroappservlet/KMLPresentationService/KMLProcessTools.java",
"license": "lgpl-3.0",
"size": 18830
} | [
"org.codehaus.staxmate.out.SMOutputElement"
] | import org.codehaus.staxmate.out.SMOutputElement; | import org.codehaus.staxmate.out.*; | [
"org.codehaus.staxmate"
] | org.codehaus.staxmate; | 847,683 |
@Generated
@Selector("setEvent:")
public native void setEvent(EKEvent value); | @Selector(STR) native void function(EKEvent value); | /**
* [@property] event
* <p>
* Specifies the event to view.
* <p>
* You must set this prior to displaying the view controller.
*/ | [@property] event Specifies the event to view. You must set this prior to displaying the view controller | setEvent | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/eventkitui/EKEventViewController.java",
"license": "apache-2.0",
"size": 9007
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,752,875 |
protected void findReferencedClassNames(final Set<String> refdClassNames) {
for (final TypeParameter typeParameter : typeParameters) {
if (typeParameter != null) {
typeParameter.findReferencedClassNames(refdClassNames);
}
}
for (final TypeSignature typeSignature : parameterTypeSignatures) {
if (typeSignature != null) {
typeSignature.findReferencedClassNames(refdClassNames);
}
}
resultType.findReferencedClassNames(refdClassNames);
for (final ClassRefOrTypeVariableSignature typeSignature : throwsSignatures) {
if (typeSignature != null) {
typeSignature.findReferencedClassNames(refdClassNames);
}
}
} | void function(final Set<String> refdClassNames) { for (final TypeParameter typeParameter : typeParameters) { if (typeParameter != null) { typeParameter.findReferencedClassNames(refdClassNames); } } for (final TypeSignature typeSignature : parameterTypeSignatures) { if (typeSignature != null) { typeSignature.findReferencedClassNames(refdClassNames); } } resultType.findReferencedClassNames(refdClassNames); for (final ClassRefOrTypeVariableSignature typeSignature : throwsSignatures) { if (typeSignature != null) { typeSignature.findReferencedClassNames(refdClassNames); } } } | /**
* Get the names of any classes referenced in the type signature.
*
* @param refdClassNames
* the referenced class names.
*/ | Get the names of any classes referenced in the type signature | findReferencedClassNames | {
"repo_name": "lukehutch/fast-classpath-scanner",
"path": "src/main/java/io/github/classgraph/MethodTypeSignature.java",
"license": "mit",
"size": 14429
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 675,253 |
protected List<ROW> getRows() {
return Collections.unmodifiableList(rows);
} | List<ROW> function() { return Collections.unmodifiableList(rows); } | /**
* Returns an unmodifiable list of the rows in this section.
*
* @return the rows in this section
*/ | Returns an unmodifiable list of the rows in this section | getRows | {
"repo_name": "Darsstar/framework",
"path": "server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java",
"license": "apache-2.0",
"size": 27228
} | [
"java.util.Collections",
"java.util.List"
] | import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 45,227 |
protected void addSignalPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SetCommand_signal_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_SetCommand_signal_feature", "_UI_SetCommand_type"),
StatemachinePackage.Literals.SET_COMMAND__SIGNAL,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), StatemachinePackage.Literals.SET_COMMAND__SIGNAL, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Signal feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Signal feature. | addSignalPropertyDescriptor | {
"repo_name": "spoenemann/xtext-gef",
"path": "org.xtext.example.statemachine.edit/src/org/xtext/example/statemachine/statemachine/provider/SetCommandItemProvider.java",
"license": "epl-1.0",
"size": 5664
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.xtext.example.statemachine.statemachine.StatemachinePackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.xtext.example.statemachine.statemachine.StatemachinePackage; | import org.eclipse.emf.edit.provider.*; import org.xtext.example.statemachine.statemachine.*; | [
"org.eclipse.emf",
"org.xtext.example"
] | org.eclipse.emf; org.xtext.example; | 2,547,662 |
public static org.opennms.netmgt.config.service.Attribute unmarshal(
final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return (org.opennms.netmgt.config.service.Attribute) Unmarshaller.unmarshal(org.opennms.netmgt.config.service.Attribute.class, reader);
} | static org.opennms.netmgt.config.service.Attribute function( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.opennms.netmgt.config.service.Attribute) Unmarshaller.unmarshal(org.opennms.netmgt.config.service.Attribute.class, reader); } | /**
* Method unmarshal.
*
* @param reader
* @throws org.exolab.castor.xml.MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException if this
* object is an invalid instance according to the schema
* @return the unmarshaled
* org.opennms.netmgt.config.service.Attribute
*/ | Method unmarshal | unmarshal | {
"repo_name": "vishwaAbhinav/OpenNMS",
"path": "opennms-config/target/generated-sources/castor/org/opennms/netmgt/config/service/Attribute.java",
"license": "gpl-2.0",
"size": 6027
} | [
"org.exolab.castor.xml.Unmarshaller"
] | import org.exolab.castor.xml.Unmarshaller; | import org.exolab.castor.xml.*; | [
"org.exolab.castor"
] | org.exolab.castor; | 1,387,745 |
public static KeySpec readKeySpec(File file) throws IOException, KeyException {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "ASCII"));
try {
return readKeySpec(reader, file.getAbsolutePath());
}
finally {
reader.close();
}
} | static KeySpec function(File file) throws IOException, KeyException { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "ASCII")); try { return readKeySpec(reader, file.getAbsolutePath()); } finally { reader.close(); } } | /**
* Reads a key spec from a PEM file.
*
* @param file
* The PEM file to read from
* @return The created key spec
* @throws IOException
* @throws KeyException
*/ | Reads a key spec from a PEM file | readKeySpec | {
"repo_name": "puppetlabs/puppetdb-javaclient",
"path": "src/main/java/com/puppetlabs/puppetdb/javaclient/ssl/KeySpecFactory.java",
"license": "apache-2.0",
"size": 5320
} | [
"java.io.BufferedReader",
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStreamReader",
"java.security.KeyException",
"java.security.spec.KeySpec"
] | import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.security.KeyException; import java.security.spec.KeySpec; | import java.io.*; import java.security.*; import java.security.spec.*; | [
"java.io",
"java.security"
] | java.io; java.security; | 2,795,744 |
public void openImageGallery(ActionListener response){
impl.openImageGallery(response);
}
/**
* <p>Opens the device gallery to pick an image or a video.<br>
* The method returns immediately and the response is sent asynchronously
* to the given ActionListener Object as the source value of the event (as a String)</p>
*
* <p>E.g. within the callback action performed call you can use this code: {@code String path = (String) evt.getSource();}.<br>
* A more detailed sample of picking a video file can be seen here:
* </p>
*
* <script src="https://gist.github.com/codenameone/fb73f5d47443052f8956.js"></script>
* <img src="https://www.codenameone.com/img/developer-guide/components-mediaplayer.png" alt="Media player sample" />
*
* <p>Version 5.0 and higher support multi-selection (i.e. the types {@link #GALLERY_IMAGE_MULTI}, {@link #GALLERY_VIDEO_MULTI}, and {@link #GALLERY_ALL_MULTI}). When using one of the multiselection
* types, the {@literal source} of the ActionEvent will be a {@code String[]}, containing the paths of the selected elements, or {@literal null} if the user cancelled the dialog.</p>
*
* <h4>Platform support</h4>
* <p>Currently (version 5.0 and higher), all platforms support the types {@link #GALLERY_IMAGE}, {@link #GALLERY_VIDEO}, {@link #GALLERY_ALL}, {@link #GALLERY_IMAGE_MULTI}, {@link #GALLERY_VIDEO_MULTI}, {@link #GALLERY_ALL_MULTI}. On iOS,
* multi-selection requires a deployment target of iOS 8.0 or higher, so it is disabled by default. You can enable multi-selection on iOS, by adding the {@literal ios.enableGalleryMultiselect=true} build hint. This
* build hint will be added automatically for you if you run your app in the simulator, and it calls {@literal openGallery()} with one of the multiselect gallery types.</p>
*
* @param response a callback Object to retrieve the file path For multiselection types ({@link #GALLERY_IMAGE_MULTI}, {@link #GALLERY_VIDEO_MULTI}, and {@link #GALLERY_ALL_MULTI}), the {@literal source} | void function(ActionListener response){ impl.openImageGallery(response); } /** * <p>Opens the device gallery to pick an image or a video.<br> * The method returns immediately and the response is sent asynchronously * to the given ActionListener Object as the source value of the event (as a String)</p> * * <p>E.g. within the callback action performed call you can use this code: {@code String path = (String) evt.getSource();}.<br> * A more detailed sample of picking a video file can be seen here: * </p> * * <script src=STRhttps: * * <p>Version 5.0 and higher support multi-selection (i.e. the types {@link #GALLERY_IMAGE_MULTI}, {@link #GALLERY_VIDEO_MULTI}, and {@link #GALLERY_ALL_MULTI}). When using one of the multiselection * types, the {@literal source} of the ActionEvent will be a {@code String[]}, containing the paths of the selected elements, or {@literal null} if the user cancelled the dialog.</p> * * <h4>Platform support</h4> * <p>Currently (version 5.0 and higher), all platforms support the types {@link #GALLERY_IMAGE}, {@link #GALLERY_VIDEO}, {@link #GALLERY_ALL}, {@link #GALLERY_IMAGE_MULTI}, {@link #GALLERY_VIDEO_MULTI}, {@link #GALLERY_ALL_MULTI}. On iOS, * multi-selection requires a deployment target of iOS 8.0 or higher, so it is disabled by default. You can enable multi-selection on iOS, by adding the {@literal ios.enableGalleryMultiselect=true} build hint. This * build hint will be added automatically for you if you run your app in the simulator, and it calls {@literal openGallery()} with one of the multiselect gallery types.</p> * * @param response a callback Object to retrieve the file path For multiselection types ({@link #GALLERY_IMAGE_MULTI}, {@link #GALLERY_VIDEO_MULTI}, and {@link #GALLERY_ALL_MULTI}), the {@literal source} | /**
* Opens the device image gallery
* The method returns immediately and the response will be sent asynchronously
* to the given ActionListener Object
*
* use this in the actionPerformed to retrieve the file path
* String path = (String) evt.getSource();
*
* @param response a callback Object to retrieve the file path
* @throws RuntimeException if this feature failed or unsupported on the platform
* @deprecated see openGallery instead
*/ | Opens the device image gallery The method returns immediately and the response will be sent asynchronously to the given ActionListener Object use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource() | openImageGallery | {
"repo_name": "diamonddevgroup/CodenameOne",
"path": "CodenameOne/src/com/codename1/ui/Display.java",
"license": "gpl-2.0",
"size": 187718
} | [
"com.codename1.ui.events.ActionEvent",
"com.codename1.ui.events.ActionListener"
] | import com.codename1.ui.events.ActionEvent; import com.codename1.ui.events.ActionListener; | import com.codename1.ui.events.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 2,145,067 |
public void testUploadFileNotFound() {
String fullPath2Upload = mBaseFolderPath + FILE_NOT_FOUND_PATH;
RemoteOperationResult result = mActivity.uploadFile(
FILE_NOT_FOUND_PATH,
fullPath2Upload,
"image/png"
);
mUploadedFilePath = fullPath2Upload;
assertFalse(result.isSuccess());
}
| void function() { String fullPath2Upload = mBaseFolderPath + FILE_NOT_FOUND_PATH; RemoteOperationResult result = mActivity.uploadFile( FILE_NOT_FOUND_PATH, fullPath2Upload, STR ); mUploadedFilePath = fullPath2Upload; assertFalse(result.isSuccess()); } | /**
* Test Upload Not Found File
*/ | Test Upload Not Found File | testUploadFileNotFound | {
"repo_name": "ckelsel/AndroidTraining",
"path": "training/owncloud-android-library/test_client/tests/src/com/owncloud/android/lib/test_project/test/UploadFileTest.java",
"license": "apache-2.0",
"size": 3904
} | [
"com.owncloud.android.lib.common.operations.RemoteOperationResult"
] | import com.owncloud.android.lib.common.operations.RemoteOperationResult; | import com.owncloud.android.lib.common.operations.*; | [
"com.owncloud.android"
] | com.owncloud.android; | 992,343 |
public RotationalLimitMotor getRotationalLimitMotor(int index) {
return rotationalMotors.get(index);
} | RotationalLimitMotor function(int index) { return rotationalMotors.get(index); } | /**
* returns one of the three RotationalLimitMotors of this 6DofJoint which
* allow manipulating the rotational axes
* @param index the index of the RotationalLimitMotor
* @return the RotationalLimitMotor at the given index
*/ | returns one of the three RotationalLimitMotors of this 6DofJoint which allow manipulating the rotational axes | getRotationalLimitMotor | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "external/jmonkeyengine/engine/src/bullet/com/jme3/bullet/joints/SixDofJoint.java",
"license": "gpl-2.0",
"size": 12410
} | [
"com.jme3.bullet.joints.motors.RotationalLimitMotor"
] | import com.jme3.bullet.joints.motors.RotationalLimitMotor; | import com.jme3.bullet.joints.motors.*; | [
"com.jme3.bullet"
] | com.jme3.bullet; | 1,800,007 |
protected void renderImageContent(
UIXRenderingContext context,
UINode node,
ImageProviderResponse response
) throws IOException
{
// If we've got a ClientAction, let it write its dependencies
// before we start rendering the link
_writeClientActionDependency(context, node);
renderImage(context, node, response, null);
// render onkeydown if adfbtn attribute has been rendered.
// this means that the accessKey has been rendered in IE
_renderOnKeyDownScript(context);
} | void function( UIXRenderingContext context, UINode node, ImageProviderResponse response ) throws IOException { _writeClientActionDependency(context, node); renderImage(context, node, response, null); _renderOnKeyDownScript(context); } | /**
* Renders the button as an image using the image specified by
* the ImageProviderResponse. This method is called by
* <code>renderContent()</code> when image generation succeeds. Otherwise,
* <code>renderAltContent()</code> is called.
* @param context The rendering context
* @param node the node to be rendered
* @param response ImageProviderResponse which descibes the button
* image to render
* @throws IOException
*/ | Renders the button as an image using the image specified by the ImageProviderResponse. This method is called by <code>renderContent()</code> when image generation succeeds. Otherwise, <code>renderAltContent()</code> is called | renderImageContent | {
"repo_name": "adamrduffy/trinidad-1.0.x",
"path": "trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/ButtonRenderer.java",
"license": "apache-2.0",
"size": 25184
} | [
"java.io.IOException",
"org.apache.myfaces.trinidadinternal.image.ImageProviderResponse",
"org.apache.myfaces.trinidadinternal.ui.UINode",
"org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext"
] | import java.io.IOException; import org.apache.myfaces.trinidadinternal.image.ImageProviderResponse; import org.apache.myfaces.trinidadinternal.ui.UINode; import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext; | import java.io.*; import org.apache.myfaces.trinidadinternal.image.*; import org.apache.myfaces.trinidadinternal.ui.*; | [
"java.io",
"org.apache.myfaces"
] | java.io; org.apache.myfaces; | 979,629 |
MeterRegistry meterRegistry(); | MeterRegistry meterRegistry(); | /**
* Returns the {@link MeterRegistry} that collects various stats.
*/ | Returns the <code>MeterRegistry</code> that collects various stats | meterRegistry | {
"repo_name": "imasahiro/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/RequestContext.java",
"license": "apache-2.0",
"size": 21953
} | [
"io.micrometer.core.instrument.MeterRegistry"
] | import io.micrometer.core.instrument.MeterRegistry; | import io.micrometer.core.instrument.*; | [
"io.micrometer.core"
] | io.micrometer.core; | 907,090 |
public static File relativize(File base, File child) {
return new File(base.toURI().relativize(child.toURI()).getPath());
} | static File function(File base, File child) { return new File(base.toURI().relativize(child.toURI()).getPath()); } | /**
* Makes a file path relative to the base
*/ | Makes a file path relative to the base | relativize | {
"repo_name": "gfneto/Hive2Hive",
"path": "org.hive2hive.core/src/main/java/org/hive2hive/core/file/FileUtil.java",
"license": "mit",
"size": 3908
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 308,716 |
public static TextEdit[] createNLSEdits(ICompilationUnit cu, int[] positions) throws CoreException {
List<InsertEdit> result= new ArrayList<>();
try {
NLSLine[] allLines= NLSScanner.scan(cu);
for (int i= 0; i < allLines.length; i++) {
NLSLine line= allLines[i];
NLSElement[] elements= line.getElements();
for (int j= 0; j < elements.length; j++) {
NLSElement element= elements[j];
if (!element.hasTag()) {
for (int k= 0; k < positions.length; k++) {
if (isPositionInElement(element, positions[k])) {
int editOffset;
if (j==0) {
if (elements.length > j+1) {
editOffset= elements[j+1].getTagPosition().getOffset();
} else {
editOffset= findLineEnd(cu, element.getPosition().getOffset());
}
} else {
Region previousPosition= elements[j-1].getTagPosition();
editOffset= previousPosition.getOffset() + previousPosition.getLength();
}
String editText= ' ' + NLSElement.createTagText(j + 1); //tags are 1-based
result.add(new InsertEdit(editOffset, editText));
}
}
}
}
}
} catch (InvalidInputException e) {
return null;
} catch (BadLocationException e) {
return null;
}
if (result.isEmpty())
return null;
return result.toArray(new TextEdit[result.size()]);
} | static TextEdit[] function(ICompilationUnit cu, int[] positions) throws CoreException { List<InsertEdit> result= new ArrayList<>(); try { NLSLine[] allLines= NLSScanner.scan(cu); for (int i= 0; i < allLines.length; i++) { NLSLine line= allLines[i]; NLSElement[] elements= line.getElements(); for (int j= 0; j < elements.length; j++) { NLSElement element= elements[j]; if (!element.hasTag()) { for (int k= 0; k < positions.length; k++) { if (isPositionInElement(element, positions[k])) { int editOffset; if (j==0) { if (elements.length > j+1) { editOffset= elements[j+1].getTagPosition().getOffset(); } else { editOffset= findLineEnd(cu, element.getPosition().getOffset()); } } else { Region previousPosition= elements[j-1].getTagPosition(); editOffset= previousPosition.getOffset() + previousPosition.getLength(); } String editText= ' ' + NLSElement.createTagText(j + 1); result.add(new InsertEdit(editOffset, editText)); } } } } } } catch (InvalidInputException e) { return null; } catch (BadLocationException e) { return null; } if (result.isEmpty()) return null; return result.toArray(new TextEdit[result.size()]); } | /**
* Creates and returns NLS tag edits for strings that are at the specified positions in a
* compilation unit.
*
* @param cu the compilation unit
* @param positions positions of the strings
* @return the edit, or <code>null</code> if all strings are already NLSed or the edits could
* not be created for some other reason.
* @throws CoreException if scanning fails
*/ | Creates and returns NLS tag edits for strings that are at the specified positions in a compilation unit | createNLSEdits | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/corext/refactoring/nls/NLSUtil.java",
"license": "epl-1.0",
"size": 9854
} | [
"java.util.ArrayList",
"java.util.List",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.jdt.core.ICompilationUnit",
"org.eclipse.jdt.core.compiler.InvalidInputException",
"org.eclipse.jface.text.BadLocationException",
"org.eclipse.jface.text.Region",
"org.eclipse.text.edits.InsertEdit",
"org.eclipse.text.edits.TextEdit"
] | import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Region; import org.eclipse.text.edits.InsertEdit; import org.eclipse.text.edits.TextEdit; | import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.compiler.*; import org.eclipse.jface.text.*; import org.eclipse.text.edits.*; | [
"java.util",
"org.eclipse.core",
"org.eclipse.jdt",
"org.eclipse.jface",
"org.eclipse.text"
] | java.util; org.eclipse.core; org.eclipse.jdt; org.eclipse.jface; org.eclipse.text; | 1,197,830 |
public ActionForward clear(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
FormatForm formatForm = (FormatForm) form;
List<CustomerProfile> customers = formatForm.getCustomers();
for (CustomerProfile customerProfile : customers) {
customerProfile.setSelectedForFormat(false);
}
formatForm.setCustomers(customers);
return mapping.findForward(PdpConstants.MAPPING_SELECTION);
} | ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FormatForm formatForm = (FormatForm) form; List<CustomerProfile> customers = formatForm.getCustomers(); for (CustomerProfile customerProfile : customers) { customerProfile.setSelectedForFormat(false); } formatForm.setCustomers(customers); return mapping.findForward(PdpConstants.MAPPING_SELECTION); } | /**
* This method clears all the customer checkboxes.
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/ | This method clears all the customer checkboxes | clear | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/pdp/web/struts/FormatAction.java",
"license": "apache-2.0",
"size": 11277
} | [
"java.util.List",
"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.kfs.pdp.PdpConstants",
"org.kuali.kfs.pdp.businessobject.CustomerProfile"
] | import java.util.List; 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.kfs.pdp.PdpConstants; import org.kuali.kfs.pdp.businessobject.CustomerProfile; | import java.util.*; import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kfs.pdp.*; import org.kuali.kfs.pdp.businessobject.*; | [
"java.util",
"javax.servlet",
"org.apache.struts",
"org.kuali.kfs"
] | java.util; javax.servlet; org.apache.struts; org.kuali.kfs; | 311,794 |
@Test(dataProvider="separateTrimmed")
public void testMergingFromSeparatedReadTrimmedAlignments(final File unmapped, final List<File> r1Align, final List<File> r2Align, final int r1Trim, final int r2Trim, final String testName) throws Exception {
final File output = File.createTempFile("mergeMultipleAlignmentsTest", ".sam");
output.deleteOnExit();
doMergeAlignment(unmapped, null, r1Align, r2Align, r1Trim, r2Trim,
false, true, false, 1,
"0", "1.0", "align!", "myAligner",
true, fasta, output,
SamPairUtil.PairOrientation.FR, null, null, null, null, null);
SamReaderFactory factory = SamReaderFactory.makeDefault();
final SamReader result = factory.open(output);
for (final SAMRecord sam : result) {
// Get the alignment record
final List<File> rFiles = sam.getFirstOfPairFlag() ? r1Align : r2Align;
SAMRecord alignment = null;
for (final File f : rFiles) {
for (final SAMRecord tmp : factory.open(f)) {
if (tmp.getReadName().equals(sam.getReadName())) {
alignment = tmp;
break;
}
}
if (alignment != null) break;
}
final int trim = sam.getFirstOfPairFlag() ? r1Trim : r2Trim;
final int notWrittenToFastq = sam.getReadLength() - (trim + alignment.getReadLength());
final int beginning = sam.getReadNegativeStrandFlag() ? notWrittenToFastq : trim;
final int end = sam.getReadNegativeStrandFlag() ? trim : notWrittenToFastq;
if (!sam.getReadUnmappedFlag()) {
final CigarElement firstMergedCigarElement = sam.getCigar().getCigarElement(0);
final CigarElement lastMergedCigarElement = sam.getCigar().getCigarElement(sam.getCigar().getCigarElements().size() - 1);
final CigarElement firstAlignedCigarElement = alignment.getCigar().getCigarElement(0);
final CigarElement lastAlignedCigarElement = alignment.getCigar().getCigarElement(alignment.getCigar().getCigarElements().size() - 1);
if (beginning > 0) {
Assert.assertEquals(firstMergedCigarElement.getOperator(), CigarOperator.S, "First element is not a soft clip");
Assert.assertEquals(firstMergedCigarElement.getLength(), beginning + ((firstAlignedCigarElement.getOperator() == CigarOperator.S) ? firstAlignedCigarElement.getLength() : 0));
}
if (end > 0) {
Assert.assertEquals(lastMergedCigarElement.getOperator(), CigarOperator.S, "Last element is not a soft clip");
Assert.assertEquals(lastMergedCigarElement.getLength(), end + ((lastAlignedCigarElement.getOperator() == CigarOperator.S) ? lastAlignedCigarElement.getLength() : 0));
}
}
}
} | @Test(dataProvider=STR) void function(final File unmapped, final List<File> r1Align, final List<File> r2Align, final int r1Trim, final int r2Trim, final String testName) throws Exception { final File output = File.createTempFile(STR, ".sam"); output.deleteOnExit(); doMergeAlignment(unmapped, null, r1Align, r2Align, r1Trim, r2Trim, false, true, false, 1, "0", "1.0", STR, STR, true, fasta, output, SamPairUtil.PairOrientation.FR, null, null, null, null, null); SamReaderFactory factory = SamReaderFactory.makeDefault(); final SamReader result = factory.open(output); for (final SAMRecord sam : result) { final List<File> rFiles = sam.getFirstOfPairFlag() ? r1Align : r2Align; SAMRecord alignment = null; for (final File f : rFiles) { for (final SAMRecord tmp : factory.open(f)) { if (tmp.getReadName().equals(sam.getReadName())) { alignment = tmp; break; } } if (alignment != null) break; } final int trim = sam.getFirstOfPairFlag() ? r1Trim : r2Trim; final int notWrittenToFastq = sam.getReadLength() - (trim + alignment.getReadLength()); final int beginning = sam.getReadNegativeStrandFlag() ? notWrittenToFastq : trim; final int end = sam.getReadNegativeStrandFlag() ? trim : notWrittenToFastq; if (!sam.getReadUnmappedFlag()) { final CigarElement firstMergedCigarElement = sam.getCigar().getCigarElement(0); final CigarElement lastMergedCigarElement = sam.getCigar().getCigarElement(sam.getCigar().getCigarElements().size() - 1); final CigarElement firstAlignedCigarElement = alignment.getCigar().getCigarElement(0); final CigarElement lastAlignedCigarElement = alignment.getCigar().getCigarElement(alignment.getCigar().getCigarElements().size() - 1); if (beginning > 0) { Assert.assertEquals(firstMergedCigarElement.getOperator(), CigarOperator.S, STR); Assert.assertEquals(firstMergedCigarElement.getLength(), beginning + ((firstAlignedCigarElement.getOperator() == CigarOperator.S) ? firstAlignedCigarElement.getLength() : 0)); } if (end > 0) { Assert.assertEquals(lastMergedCigarElement.getOperator(), CigarOperator.S, STR); Assert.assertEquals(lastMergedCigarElement.getLength(), end + ((lastAlignedCigarElement.getOperator() == CigarOperator.S) ? lastAlignedCigarElement.getLength() : 0)); } } } } | /**
* Minimal test of merging data from separate read 1 and read 2 alignments
*/ | Minimal test of merging data from separate read 1 and read 2 alignments | testMergingFromSeparatedReadTrimmedAlignments | {
"repo_name": "alecw/picard",
"path": "src/test/java/picard/sam/MergeBamAlignmentTest.java",
"license": "mit",
"size": 102668
} | [
"java.io.File",
"java.util.List",
"org.testng.Assert",
"org.testng.annotations.Test"
] | import java.io.File; import java.util.List; import org.testng.Assert; import org.testng.annotations.Test; | import java.io.*; import java.util.*; import org.testng.*; import org.testng.annotations.*; | [
"java.io",
"java.util",
"org.testng",
"org.testng.annotations"
] | java.io; java.util; org.testng; org.testng.annotations; | 1,438,157 |
final <R extends Quantity<R>> Unit<R> inferSymbol(Unit<R> result, final char operation, final Unit<?> other) {
if (result instanceof ConventionalUnit<?> && result.getSymbol() == null) {
final String symbol = inferSymbol(operation, other);
if (symbol != null) {
result = ((ConventionalUnit<R>) result).forSymbol(symbol);
}
}
return result;
}
/**
* Returns the symbol (if any) of this unit. A unit may have no symbol, in which case
* the {@link #toString()} method is responsible for creating a string representation.
*
* <div class="note"><b>Example:</b>
* {@link Units#METRE} has the {@code "m"} symbol and the same string representation.
* But {@link Units#METRES_PER_SECOND} has no symbol; it has only the {@code "m/s"} | final <R extends Quantity<R>> Unit<R> inferSymbol(Unit<R> result, final char operation, final Unit<?> other) { if (result instanceof ConventionalUnit<?> && result.getSymbol() == null) { final String symbol = inferSymbol(operation, other); if (symbol != null) { result = ((ConventionalUnit<R>) result).forSymbol(symbol); } } return result; } /** * Returns the symbol (if any) of this unit. A unit may have no symbol, in which case * the {@link #toString()} method is responsible for creating a string representation. * * <div class="note"><b>Example:</b> * {@link Units#METRE} has the {@code "m"} symbol and the same string representation. * But {@link Units#METRES_PER_SECOND} has no symbol; it has only the {@code "m/s"} | /**
* If the {@code result} unit is a {@link ConventionalUnit} with no symbol, tries to infer a symbol for it.
* Otherwise returns {@code result} unchanged.
*
* @param result the result of an arithmetic operation.
* @param operation {@link #MULTIPLY}, {@link #DIVIDE} or an exponent.
* @param other the left operand used in the operation, or {@code null} if {@code operation} is an exponent.
* @return {@code result} or an equivalent unit augmented with a symbol.
*/ | If the result unit is a <code>ConventionalUnit</code> with no symbol, tries to infer a symbol for it. Otherwise returns result unchanged | inferSymbol | {
"repo_name": "apache/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java",
"license": "apache-2.0",
"size": 22474
} | [
"javax.measure.Quantity",
"javax.measure.Unit"
] | import javax.measure.Quantity; import javax.measure.Unit; | import javax.measure.*; | [
"javax.measure"
] | javax.measure; | 2,435,851 |
return this.sendAsync(HttpMethod.POST, body);
} | return this.sendAsync(HttpMethod.POST, body); } | /**
* Creates the CallTransfer
*
* @return a future for the operation
*/ | Creates the CallTransfer | postAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/CallTransferRequest.java",
"license": "mit",
"size": 2073
} | [
"com.microsoft.graph.http.HttpMethod"
] | import com.microsoft.graph.http.HttpMethod; | import com.microsoft.graph.http.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 330,936 |
@Test(expected = CloudPoolDriverException.class)
public void terminateOnClientError() throws Exception {
// set up mock to throw an error whenever terminateInstance is called
int desiredCapacity = 1;
setUpMockedAutoScalingGroup(GROUP_NAME, ONDEMAND_LAUNCH_CONFIG, desiredCapacity,
ec2Instances(ec2Instance("i-1", "running")));
doThrow(new AmazonClientException("API unreachable")).when(this.mockAwsClient).getAutoScalingGroup(GROUP_NAME);
this.driver.terminateMachines(asList("i-1"));
} | @Test(expected = CloudPoolDriverException.class) void function() throws Exception { int desiredCapacity = 1; setUpMockedAutoScalingGroup(GROUP_NAME, ONDEMAND_LAUNCH_CONFIG, desiredCapacity, ec2Instances(ec2Instance("i-1", STR))); doThrow(new AmazonClientException(STR)).when(this.mockAwsClient).getAutoScalingGroup(GROUP_NAME); this.driver.terminateMachines(asList("i-1")); } | /**
* On a client error, a {@link CloudPoolDriverException} should be raised.
*/ | On a client error, a <code>CloudPoolDriverException</code> should be raised | terminateOnClientError | {
"repo_name": "elastisys/scale.cloudpool",
"path": "aws/autoscaling/src/test/java/com/elastisys/scale/cloudpool/aws/autoscaling/driver/TestAwsAsDriverOperation.java",
"license": "apache-2.0",
"size": 32078
} | [
"com.amazonaws.AmazonClientException",
"com.elastisys.scale.cloudpool.aws.autoscaling.driver.TestUtils",
"com.elastisys.scale.cloudpool.commons.basepool.driver.CloudPoolDriverException",
"org.junit.Test",
"org.mockito.Mockito"
] | import com.amazonaws.AmazonClientException; import com.elastisys.scale.cloudpool.aws.autoscaling.driver.TestUtils; import com.elastisys.scale.cloudpool.commons.basepool.driver.CloudPoolDriverException; import org.junit.Test; import org.mockito.Mockito; | import com.amazonaws.*; import com.elastisys.scale.cloudpool.aws.autoscaling.driver.*; import com.elastisys.scale.cloudpool.commons.basepool.driver.*; import org.junit.*; import org.mockito.*; | [
"com.amazonaws",
"com.elastisys.scale",
"org.junit",
"org.mockito"
] | com.amazonaws; com.elastisys.scale; org.junit; org.mockito; | 2,648,288 |
private static byte[] convertToByteArray(CharSequence charSequence) {
checkNotNull(charSequence);
byte[] byteArray = new byte[charSequence.length() << 1];
for (int i = 0; i < charSequence.length(); i++) {
int bytePosition = i << 1;
byteArray[bytePosition] = (byte) ((charSequence.charAt(i) & 0xFF00) >> 8);
byteArray[bytePosition + 1] = (byte) (charSequence.charAt(i) & 0x00FF);
}
return byteArray;
} | static byte[] function(CharSequence charSequence) { checkNotNull(charSequence); byte[] byteArray = new byte[charSequence.length() << 1]; for (int i = 0; i < charSequence.length(); i++) { int bytePosition = i << 1; byteArray[bytePosition] = (byte) ((charSequence.charAt(i) & 0xFF00) >> 8); byteArray[bytePosition + 1] = (byte) (charSequence.charAt(i) & 0x00FF); } return byteArray; } | /**
* Convert a CharSequence (which are UTF16) into a byte array.
* <p/>
* Note: a String.getBytes() is not used to avoid creating a String of the password in the JVM.
*/ | Convert a CharSequence (which are UTF16) into a byte array. Note: a String.getBytes() is not used to avoid creating a String of the password in the JVM | convertToByteArray | {
"repo_name": "bither/bitherj",
"path": "bitherj/src/main/java/net/bither/bitherj/crypto/KeyCrypterScrypt.java",
"license": "apache-2.0",
"size": 7864
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 38,663 |
protected int getRecommendMaxNumberMessagesPerPage(Plugin.AttackStrength strength) {
switch (strength) {
case LOW:
return NUMBER_MSGS_ATTACK_PER_PAGE_LOW;
case MEDIUM:
default:
return NUMBER_MSGS_ATTACK_PER_PAGE_MED;
case HIGH:
return NUMBER_MSGS_ATTACK_PER_PAGE_HIGH;
case INSANE:
return NUMBER_MSGS_ATTACK_PER_PAGE_INSANE;
}
} | int function(Plugin.AttackStrength strength) { switch (strength) { case LOW: return NUMBER_MSGS_ATTACK_PER_PAGE_LOW; case MEDIUM: default: return NUMBER_MSGS_ATTACK_PER_PAGE_MED; case HIGH: return NUMBER_MSGS_ATTACK_PER_PAGE_HIGH; case INSANE: return NUMBER_MSGS_ATTACK_PER_PAGE_INSANE; } } | /**
* Gets the recommended maximum number of messages that a scanner can send per page for the
* given strength.
*
* @param strength the attack strength.
* @return the recommended maximum number of messages.
* @see AbstractAppPlugin
*/ | Gets the recommended maximum number of messages that a scanner can send per page for the given strength | getRecommendMaxNumberMessagesPerPage | {
"repo_name": "secdec/zap-extensions",
"path": "testutils/src/main/java/org/zaproxy/zap/testutils/ActiveScannerTestUtils.java",
"license": "apache-2.0",
"size": 15541
} | [
"org.parosproxy.paros.core.scanner.Plugin"
] | import org.parosproxy.paros.core.scanner.Plugin; | import org.parosproxy.paros.core.scanner.*; | [
"org.parosproxy.paros"
] | org.parosproxy.paros; | 2,622,962 |
@Override
public void populateExchangeFromCxfRequest(org.apache.cxf.message.Exchange cxfExchange,
Exchange camelExchange) {
Method method = null;
QName operationName = null;
ExchangePattern mep = ExchangePattern.InOut;
// extract binding operation information
BindingOperationInfo boi = camelExchange.getProperty(BindingOperationInfo.class.getName(),
BindingOperationInfo.class);
if (boi != null) {
Service service = cxfExchange.get(Service.class);
if (service != null) {
MethodDispatcher md = (MethodDispatcher)service.get(MethodDispatcher.class.getName());
if (md != null) {
method = md.getMethod(boi);
}
}
if (boi.getOperationInfo().isOneWay()) {
mep = ExchangePattern.InOnly;
}
operationName = boi.getName();
}
// set operation name in header
if (operationName != null) {
camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
boi.getName().getNamespaceURI());
camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
boi.getName().getLocalPart());
if (LOG.isTraceEnabled()) {
LOG.trace("Set IN header: {}={}",
CxfConstants.OPERATION_NAMESPACE, boi.getName().getNamespaceURI());
LOG.trace("Set IN header: {}={}",
CxfConstants.OPERATION_NAME, boi.getName().getLocalPart());
}
} else if (method != null) {
camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, method.getName());
if (LOG.isTraceEnabled()) {
LOG.trace("Set IN header: {}={}",
CxfConstants.OPERATION_NAME, method.getName());
}
}
// set message exchange pattern
camelExchange.setPattern(mep);
LOG.trace("Set exchange MEP: {}", mep);
// propagate headers
Message cxfMessage = cxfExchange.getInMessage();
propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getIn(), camelExchange);
// propagate the security subject from CXF security context
SecurityContext securityContext = cxfMessage.get(SecurityContext.class);
if (securityContext instanceof LoginSecurityContext
&& ((LoginSecurityContext)securityContext).getSubject() != null) {
camelExchange.getIn().getHeaders().put(Exchange.AUTHENTICATION,
((LoginSecurityContext)securityContext).getSubject());
} else if (securityContext != null) {
Principal user = securityContext.getUserPrincipal();
if (user != null) {
Subject subject = new Subject();
subject.getPrincipals().add(user);
camelExchange.getIn().getHeaders().put(Exchange.AUTHENTICATION, subject);
}
}
// Propagating properties from CXF Exchange to Camel Exchange has an
// side effect of copying reply side stuff when the producer is retried.
// So, we do not want to do this.
//camelExchange.getProperties().putAll(cxfExchange);
// propagate request context
Object value = cxfMessage.get(Client.REQUEST_CONTEXT);
if (value != null && !headerFilterStrategy.applyFilterToExternalHeaders(
Client.REQUEST_CONTEXT, value, camelExchange)) {
camelExchange.getIn().setHeader(Client.REQUEST_CONTEXT, value);
LOG.trace("Populate context from CXF message {} value={}", Client.REQUEST_CONTEXT, value);
}
// setup the charset from content-type header
setCharsetWithContentType(camelExchange);
// set body
String encoding = (String)camelExchange.getProperty(Exchange.CHARSET_NAME);
Object body = DefaultCxfBinding.getContentFromCxf(cxfMessage,
camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class), encoding);
if (body != null) {
camelExchange.getIn().setBody(body);
}
// propagate attachments if the data format is not POJO
if (cxfMessage.getAttachments() != null
&& !camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class).equals(DataFormat.POJO)) {
for (Attachment attachment : cxfMessage.getAttachments()) {
camelExchange.getIn(AttachmentMessage.class).addAttachmentObject(attachment.getId(), createCamelAttachment(attachment));
}
}
} | void function(org.apache.cxf.message.Exchange cxfExchange, Exchange camelExchange) { Method method = null; QName operationName = null; ExchangePattern mep = ExchangePattern.InOut; BindingOperationInfo boi = camelExchange.getProperty(BindingOperationInfo.class.getName(), BindingOperationInfo.class); if (boi != null) { Service service = cxfExchange.get(Service.class); if (service != null) { MethodDispatcher md = (MethodDispatcher)service.get(MethodDispatcher.class.getName()); if (md != null) { method = md.getMethod(boi); } } if (boi.getOperationInfo().isOneWay()) { mep = ExchangePattern.InOnly; } operationName = boi.getName(); } if (operationName != null) { camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, boi.getName().getNamespaceURI()); camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, boi.getName().getLocalPart()); if (LOG.isTraceEnabled()) { LOG.trace(STR, CxfConstants.OPERATION_NAMESPACE, boi.getName().getNamespaceURI()); LOG.trace(STR, CxfConstants.OPERATION_NAME, boi.getName().getLocalPart()); } } else if (method != null) { camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, method.getName()); if (LOG.isTraceEnabled()) { LOG.trace(STR, CxfConstants.OPERATION_NAME, method.getName()); } } camelExchange.setPattern(mep); LOG.trace(STR, mep); Message cxfMessage = cxfExchange.getInMessage(); propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getIn(), camelExchange); SecurityContext securityContext = cxfMessage.get(SecurityContext.class); if (securityContext instanceof LoginSecurityContext && ((LoginSecurityContext)securityContext).getSubject() != null) { camelExchange.getIn().getHeaders().put(Exchange.AUTHENTICATION, ((LoginSecurityContext)securityContext).getSubject()); } else if (securityContext != null) { Principal user = securityContext.getUserPrincipal(); if (user != null) { Subject subject = new Subject(); subject.getPrincipals().add(user); camelExchange.getIn().getHeaders().put(Exchange.AUTHENTICATION, subject); } } Object value = cxfMessage.get(Client.REQUEST_CONTEXT); if (value != null && !headerFilterStrategy.applyFilterToExternalHeaders( Client.REQUEST_CONTEXT, value, camelExchange)) { camelExchange.getIn().setHeader(Client.REQUEST_CONTEXT, value); LOG.trace(STR, Client.REQUEST_CONTEXT, value); } setCharsetWithContentType(camelExchange); String encoding = (String)camelExchange.getProperty(Exchange.CHARSET_NAME); Object body = DefaultCxfBinding.getContentFromCxf(cxfMessage, camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class), encoding); if (body != null) { camelExchange.getIn().setBody(body); } if (cxfMessage.getAttachments() != null && !camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class).equals(DataFormat.POJO)) { for (Attachment attachment : cxfMessage.getAttachments()) { camelExchange.getIn(AttachmentMessage.class).addAttachmentObject(attachment.getId(), createCamelAttachment(attachment)); } } } | /**
* This method is called by {@link CxfConsumer}.
*/ | This method is called by <code>CxfConsumer</code> | populateExchangeFromCxfRequest | {
"repo_name": "objectiser/camel",
"path": "components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java",
"license": "apache-2.0",
"size": 47211
} | [
"java.lang.reflect.Method",
"java.security.Principal",
"javax.security.auth.Subject",
"javax.xml.namespace.QName",
"org.apache.camel.Exchange",
"org.apache.camel.ExchangePattern",
"org.apache.camel.attachment.AttachmentMessage",
"org.apache.camel.component.cxf.common.message.CxfConstants",
"org.apache.cxf.endpoint.Client",
"org.apache.cxf.message.Attachment",
"org.apache.cxf.message.Message",
"org.apache.cxf.security.LoginSecurityContext",
"org.apache.cxf.security.SecurityContext",
"org.apache.cxf.service.Service",
"org.apache.cxf.service.invoker.MethodDispatcher",
"org.apache.cxf.service.model.BindingOperationInfo"
] | import java.lang.reflect.Method; import java.security.Principal; import javax.security.auth.Subject; import javax.xml.namespace.QName; import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.attachment.AttachmentMessage; import org.apache.camel.component.cxf.common.message.CxfConstants; import org.apache.cxf.endpoint.Client; import org.apache.cxf.message.Attachment; import org.apache.cxf.message.Message; import org.apache.cxf.security.LoginSecurityContext; import org.apache.cxf.security.SecurityContext; import org.apache.cxf.service.Service; import org.apache.cxf.service.invoker.MethodDispatcher; import org.apache.cxf.service.model.BindingOperationInfo; | import java.lang.reflect.*; import java.security.*; import javax.security.auth.*; import javax.xml.namespace.*; import org.apache.camel.*; import org.apache.camel.attachment.*; import org.apache.camel.component.cxf.common.message.*; import org.apache.cxf.endpoint.*; import org.apache.cxf.message.*; import org.apache.cxf.security.*; import org.apache.cxf.service.*; import org.apache.cxf.service.invoker.*; import org.apache.cxf.service.model.*; | [
"java.lang",
"java.security",
"javax.security",
"javax.xml",
"org.apache.camel",
"org.apache.cxf"
] | java.lang; java.security; javax.security; javax.xml; org.apache.camel; org.apache.cxf; | 1,589,766 |
AllocatedHosts allocatedHosts();
default boolean allowModelVersionMismatch(Instant now) { return false; } | AllocatedHosts allocatedHosts(); default boolean allowModelVersionMismatch(Instant now) { return false; } | /**
* Gets the allocated hosts for this model.
*
* @return {@link AllocatedHosts} instance, if available
*/ | Gets the allocated hosts for this model | allocatedHosts | {
"repo_name": "vespa-engine/vespa",
"path": "config-model-api/src/main/java/com/yahoo/config/model/api/Model.java",
"license": "apache-2.0",
"size": 3383
} | [
"com.yahoo.config.provision.AllocatedHosts",
"java.time.Instant"
] | import com.yahoo.config.provision.AllocatedHosts; import java.time.Instant; | import com.yahoo.config.provision.*; import java.time.*; | [
"com.yahoo.config",
"java.time"
] | com.yahoo.config; java.time; | 398,432 |
long longCount(Queryable<T> source,
FunctionExpression<Predicate1<T>> predicate); | long longCount(Queryable<T> source, FunctionExpression<Predicate1<T>> predicate); | /**
* Returns an long that represents the number of
* elements in a sequence that satisfy a condition.
*/ | Returns an long that represents the number of elements in a sequence that satisfy a condition | longCount | {
"repo_name": "vlsi/incubator-calcite",
"path": "linq4j/src/main/java/org/apache/calcite/linq4j/QueryableFactory.java",
"license": "apache-2.0",
"size": 29143
} | [
"org.apache.calcite.linq4j.function.Predicate1",
"org.apache.calcite.linq4j.tree.FunctionExpression"
] | import org.apache.calcite.linq4j.function.Predicate1; import org.apache.calcite.linq4j.tree.FunctionExpression; | import org.apache.calcite.linq4j.function.*; import org.apache.calcite.linq4j.tree.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 1,038,745 |
public String getExtraNameCharacters() throws SQLException {
if (JdbcDebugCfg.entryActive)
debug[methodId_getExtraNameCharacters].methodEntry();
try {
return null;
} finally {
if (JdbcDebugCfg.entryActive)
debug[methodId_getExtraNameCharacters].methodExit();
}
}
// --------------------------------------------------------------------
// Functions describing which features are supported. | String function() throws SQLException { if (JdbcDebugCfg.entryActive) debug[methodId_getExtraNameCharacters].methodEntry(); try { return null; } finally { if (JdbcDebugCfg.entryActive) debug[methodId_getExtraNameCharacters].methodExit(); } } | /**
* Retrieves all the "extra" characters that can be used in unquoted
* identifier names (those beyond a-z, A-Z, 0-9 and _).
*
* @return null
* @throws SQLException
* - if a database access error occurs
**/ | Retrieves all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, A-Z, 0-9 and _) | getExtraNameCharacters | {
"repo_name": "mashengchen/incubator-trafodion",
"path": "core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXDatabaseMetaData.java",
"license": "apache-2.0",
"size": 191582
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,236,208 |
public MatchOther processPage(Page page); | MatchOther function(Page page); | /**
* process the page, extract urls to fetch, extract the data and store
*
* @param page page
*
* @return whether continue to match
*/ | process the page, extract urls to fetch, extract the data and store | processPage | {
"repo_name": "sanlingdd/personalLinkedProfilesIn",
"path": "webmagic-extension/src/main/java/us/codecraft/webmagic/handler/SubPageProcessor.java",
"license": "apache-2.0",
"size": 373
} | [
"us.codecraft.webmagic.Page"
] | import us.codecraft.webmagic.Page; | import us.codecraft.webmagic.*; | [
"us.codecraft.webmagic"
] | us.codecraft.webmagic; | 1,678,841 |
public Builder onComponentOnly(@Nullable Boolean b) {
this.onComponentOnly = b;
return this;
} | Builder function(@Nullable Boolean b) { this.onComponentOnly = b; return this; } | /**
* If true, it will return only issues on the passed component(s)
* If false, it will return all issues on the passed component(s) and their descendants
*/ | If true, it will return only issues on the passed component(s) If false, it will return all issues on the passed component(s) and their descendants | onComponentOnly | {
"repo_name": "Godin/sonar",
"path": "server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueQuery.java",
"license": "lgpl-3.0",
"size": 15375
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 1,694,142 |
HashSet<Agent> getAssociatedAgents(Entity entity) throws EntityException; | HashSet<Agent> getAssociatedAgents(Entity entity) throws EntityException; | /**
* Returns the agents associated to a given entity.
*
* @param entity is the entity.
* @return a set of agents.
* @throws AgentException
*/ | Returns the agents associated to a given entity | getAssociatedAgents | {
"repo_name": "FracturedPlane/EnvironmentInterface",
"path": "src/aiInterface/environment/EnvironmentInterfaceStandard.java",
"license": "gpl-2.0",
"size": 7800
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 628,531 |
public void testGetActionChains() throws Exception {
int previousSize = ActionChainFactory.getActionChains(user).size();
ActionChainFactory.createActionChain(TestUtils.randomString(), user);
ActionChainFactory.createActionChain(TestUtils.randomString(), user);
ActionChainFactory.createActionChain(TestUtils.randomString(), user);
assertEquals(previousSize + 3, ActionChainFactory.getActionChains(user).size());
} | void function() throws Exception { int previousSize = ActionChainFactory.getActionChains(user).size(); ActionChainFactory.createActionChain(TestUtils.randomString(), user); ActionChainFactory.createActionChain(TestUtils.randomString(), user); ActionChainFactory.createActionChain(TestUtils.randomString(), user); assertEquals(previousSize + 3, ActionChainFactory.getActionChains(user).size()); } | /**
* Tests getActionChains().
* @throws Exception if something bad happens
*/ | Tests getActionChains() | testGetActionChains | {
"repo_name": "mcalmer/spacewalk",
"path": "java/code/src/com/redhat/rhn/domain/action/test/ActionChainFactoryTest.java",
"license": "gpl-2.0",
"size": 16976
} | [
"com.redhat.rhn.domain.action.ActionChainFactory",
"com.redhat.rhn.testing.TestUtils"
] | import com.redhat.rhn.domain.action.ActionChainFactory; import com.redhat.rhn.testing.TestUtils; | import com.redhat.rhn.domain.action.*; import com.redhat.rhn.testing.*; | [
"com.redhat.rhn"
] | com.redhat.rhn; | 2,263,026 |
@SuppressWarnings({ "unchecked" })
public List<String> OMFApplicationHandler(OMFMessage message, String fromTopic, List<String> memberships, String toTopic, HashMap<String, Node> nodes) throws IllegalArgumentException {
Log.i(appTAG, classTAG+": IN APP HANDLER");
HashMap<String, Object> resourceProps =new HashMap<String, Object>(this.properties);
HashMap<String, Node> Nodes = new HashMap<String, Node>(nodes);
RegularExpression regEx = new RegularExpression();
String commandLineStart = null;
String appDescription = null;
String binPath = null;
String packageName = null;
String serviceName = null;
String actionName = null;
String hrn = null;
Intent tmpintent = null;
//String uid = null;
//String myUid ="xmpp://"+uid+"@"+serverName; //currently unused
//String myResType = "Application Proxy"; //currently unused
String platform = "android_shell";
Process p = null;
Log.i(appTAG, classTAG+": i LISTEN TO: " +fromTopic);
Log.i(appTAG,classTAG+": "+resourceProps.toString());
Log.i(appTAG,classTAG+": i SEND TO:" + toTopic);
if(((PropType)resourceProps.get("platform"))!= null){
platform = (String)((PropType)resourceProps.get("platform")).getProp();
Log.i(appTAG, classTAG+": IN PLATFORM ASSIGNMENT");
}
if(((PropType)resourceProps.get("hrn"))!= null && ((PropType)resourceProps.get("hrn")).getType().equalsIgnoreCase("string")){
hrn = (String)((PropType)resourceProps.get("hrn")).getProp();
Log.i(appTAG, classTAG+": assign hrn");
}
Log.i(appTAG, classTAG+": IS PLATFORM ANDROID = "+platform);
//Assuming these properties are standard
if(platform.equalsIgnoreCase("android"))
{
if(resourceProps.get("description")!=null)
{
appDescription = (String)((PropType)resourceProps.get("description")).getProp();
Log.i(appTAG, classTAG+": "+appDescription +" uid:"+ this.uid);
}
//appId = (String)((PropType)resourceProps.get("app_id")).getProp();
HashMap<String, Object> binary_path = (HashMap<String, Object>)((PropType)resourceProps.get("binary_path")).getProp();
if (binary_path.get("package") != null) {
packageName = (String)((PropType) binary_path.get("package")).getProp();
} else {
Log.e(appTAG, classTAG+": Error getting package name.");
throw new IllegalArgumentException("You need to specify a package name.");
}
if (binary_path.get("service") != null) {
serviceName = (String)((PropType) binary_path.get("service")).getProp();
}
if (binary_path.get("action") != null) {
actionName = (String)((PropType) binary_path.get("action")).getProp();
}
Log.w(appTAG,classTAG+": NAME:"+ packageName + "." + serviceName + " " + actionName);
if (serviceName != null && actionName == null) {
tmpintent = new Intent();
tmpintent.setClassName(packageName, packageName + "." + serviceName);
} else if (serviceName == null && actionName != null) {
try {
tmpintent = new Intent((String)Intent.class.getField(actionName).get(tmpintent));
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//tmpintent = new Intent(Intent.ACTION_VIEW);
tmpintent.setPackage(packageName);
} else {
Log.e(appTAG, classTAG+": Error getting service or action name");
throw new IllegalArgumentException("You need to specify package a service or an action name.");
}
String key = null;
PropType propType = null;
p = null;
Log.i(appTAG, classTAG+": Before loop");
if(resourceProps.get("parameters")!=null){
HashMap<String, Object> params = new HashMap<String, Object>((HashMap<String, Object>)((PropType)resourceProps.get("parameters")).getProp());
Iterator<Entry<String, Object>> it = params.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> pairs = (Map.Entry<String, Object>)it.next();
key = pairs.getKey();
propType =(PropType) pairs.getValue();
if(propType.getType().equalsIgnoreCase("hash"))
{
HashMap<String,Object> parameter = (HashMap<String,Object>)propType.getProp();
Log.w(appTAG,classTAG+":TYPE :"+parameter.get("type"));
Log.w(appTAG,classTAG+":EXTRA :"+parameter.get("extra"));
if(parameter.get("extra")!=null && (((PropType)parameter.get("value")).getType().equalsIgnoreCase("string") || ((PropType)parameter.get("value")).getType().equalsIgnoreCase("integer")))
{
if(((String)((PropType)parameter.get("extra")).getProp()).equalsIgnoreCase("parameter"))//CHANGED HERE!!
{
Log.w(appTAG,classTAG+": "+key+":"+((String)((PropType)parameter.get("value")).getProp()));
tmpintent.putExtra(key, ((String)((PropType)parameter.get("value")).getProp()));
}
} else if ((parameter.get("extra") != null) && ((String)((PropType)parameter.get("extra")).getProp()).equalsIgnoreCase("INTENT")) {
//Log.e(TAG,key+":"+((String)((PropType)parameter.get("value")).getProp()));
if (key.equalsIgnoreCase("data_and_type")) {
//Log.e(TAG,key+":"+((String)((PropType)parameter.get("value")).getProp()));
HashMap<String, Object> data_type = (HashMap<String, Object>)((PropType)(parameter.get("value"))).getProp();
Uri data = Uri.parse((String)((PropType)data_type.get("data")).getProp());
String type = (String)((PropType)data_type.get("extra")).getProp();
Log.i(appTAG,classTAG+": "+data+":"+type);
tmpintent.setDataAndType(data, type);
}
}
}
it.remove(); // avoids a ConcurrentModificationException
}
}
}
else
{
if(resourceProps.get("description")!=null)
{
appDescription = (String)((PropType)resourceProps.get("description")).getProp();
Log.i(appTAG, classTAG+": "+appDescription);
}
binPath = (String)((PropType)resourceProps.get("binary_path")).getProp();
commandLineStart = binPath;
//commandLineStop = "am broadcast -a "+ binPath+".SERVICESTOP";
//String commandLineStop = "am force-stop "+binPath;
//String key = null;
PropType propType = null;
p = null;
Log.i(appTAG, classTAG+": "+commandLineStart);
Log.i(appTAG, classTAG+": Before loop");
if(resourceProps.get("parameters")!=null){
HashMap<String, Object> params = new HashMap<String, Object>((HashMap<String, Object>)((PropType)resourceProps.get("parameters")).getProp());
Iterator<Entry<String, Object>> it = params.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> pairs = (Map.Entry<String, Object>)it.next();
//System.out.println(pairs.getKey() + " = " + pairs.getValue());
//key = pairs.getKey();
propType =(PropType) pairs.getValue();
//Log.e(TAG,"In Loop");
//Log.e(TAG,"Found: "+key);
//Log.e(TAG,"Found: "+propType.getType().toString());
//Log.e(TAG,"Found: "+propType.getProp().toString());
if(propType.getType().equalsIgnoreCase("hash"))
{
HashMap<String,Object> parameter = (HashMap<String,Object>)propType.getProp();
if(parameter.get("type")!=null && ((PropType)parameter.get("cmd")).getType().equalsIgnoreCase("string")) //Maybe change needed here!!! change "type" to "extra"
{
//Log.e(TAG,"Cmd: "+((String)((PropType)parameter.get("cmd")).getProp()));
commandLineStart+=" "+((String)((PropType)parameter.get("cmd")).getProp());
}
//Maybe change needed here!!! change "type" to "extra"
if(parameter.get("type")!=null && (((PropType)parameter.get("value")).getType().equalsIgnoreCase("string") || ((PropType)parameter.get("value")).getType().equalsIgnoreCase("integer")))
{
//Log.e(TAG,"Value: "+((String)((PropType)parameter.get("value")).getProp()));
commandLineStart+=" "+((String)((PropType)parameter.get("value")).getProp());
}
}
it.remove(); // avoids a ConcurrentModificationException
}
Log.i(appTAG, classTAG+": Command ready: "+commandLineStart);
}
}
if(message.getMessageType().equalsIgnoreCase("create"))
{
Log.i(appTAG,classTAG+": "+fromTopic+": "+"create");
}
else if (message.getMessageType().equalsIgnoreCase("configure"))
{
Log.i(appTAG,classTAG+": "+fromTopic+": "+"Configure");
if(message.getGuard("type")==null || ((String)((PropType)message.getGuard("type")).getProp()).equalsIgnoreCase((String)((PropType)resourceProps.get("type")).getProp())){
Log.i(appTAG, classTAG+": Passed guard: Type");
if(message.getGuard("name")==null || ((String)((PropType)message.getGuard("name")).getProp()).equalsIgnoreCase((String)((PropType)resourceProps.get("hrn")).getProp())){
Log.i(appTAG, classTAG+": Passed guard: name");
if(message.getProperty("state")!=null)
{
PropType prop = (PropType)message.getProperty("state");
if(prop.getType().equalsIgnoreCase("string"))
{
if(((String)prop.getProp()).equalsIgnoreCase("running"))
{
Log.i(appTAG,classTAG+": Starting application");
if(platform.equalsIgnoreCase("android") && tmpintent != null)
{
if (serviceName != null) {
Log.i(appTAG, classTAG+": Starting intent as a service");
ctx.startService(tmpintent);
} else if (actionName != null) {
Log.i(appTAG, classTAG+": Starting intent as an activity");
tmpintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(tmpintent);
}
}
else{
try {
Log.i(appTAG,classTAG+": Executing command");
p = Runtime.getRuntime().exec(commandLineStart);
ProcessesPID.put(fromTopic, regEx.pidReg(p.toString()));
Processes.put(fromTopic, p);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
//String line=bufferedReader.readLine();
String line = "";
//Log.i(TAG,"Process:"+p);
//Log.i(TAG,"Line 1st output:"+line);
int i = 1;
//Output from the process needs to run on a different thread otherwise it blocks the RC from handling messages
class MyThread implements Runnable {
String line;
BufferedReader bufferedReader;
int i;
String hrn;
String uid;
String fromTopic;
HashMap<String, Node> Nodes;
String serverName;
public MyThread(BufferedReader BufferedReader, String Line, int I, String Hrn, String Uid, String FromTopic, HashMap<String, Node> nodes, String ServerName) {
// store parameter for later user
bufferedReader = BufferedReader;
line = Line;
i = I;
hrn = Hrn;
uid = Uid;
fromTopic = FromTopic;
Nodes = new HashMap<String, Node> (nodes);
serverName = ServerName;
} | @SuppressWarnings({ STR }) List<String> function(OMFMessage message, String fromTopic, List<String> memberships, String toTopic, HashMap<String, Node> nodes) throws IllegalArgumentException { Log.i(appTAG, classTAG+STR); HashMap<String, Object> resourceProps =new HashMap<String, Object>(this.properties); HashMap<String, Node> Nodes = new HashMap<String, Node>(nodes); RegularExpression regEx = new RegularExpression(); String commandLineStart = null; String appDescription = null; String binPath = null; String packageName = null; String serviceName = null; String actionName = null; String hrn = null; Intent tmpintent = null; String platform = STR; Process p = null; Log.i(appTAG, classTAG+STR +fromTopic); Log.i(appTAG,classTAG+STR+resourceProps.toString()); Log.i(appTAG,classTAG+STR + toTopic); if(((PropType)resourceProps.get(STR))!= null){ platform = (String)((PropType)resourceProps.get(STR)).getProp(); Log.i(appTAG, classTAG+STR); } if(((PropType)resourceProps.get("hrn"))!= null && ((PropType)resourceProps.get("hrn")).getType().equalsIgnoreCase(STR)){ hrn = (String)((PropType)resourceProps.get("hrn")).getProp(); Log.i(appTAG, classTAG+STR); } Log.i(appTAG, classTAG+STR+platform); if(platform.equalsIgnoreCase(STR)) { if(resourceProps.get(STR)!=null) { appDescription = (String)((PropType)resourceProps.get(STR)).getProp(); Log.i(appTAG, classTAG+STR+appDescription +STR+ this.uid); } HashMap<String, Object> binary_path = (HashMap<String, Object>)((PropType)resourceProps.get(STR)).getProp(); if (binary_path.get(STR) != null) { packageName = (String)((PropType) binary_path.get(STR)).getProp(); } else { Log.e(appTAG, classTAG+STR); throw new IllegalArgumentException(STR); } if (binary_path.get(STR) != null) { serviceName = (String)((PropType) binary_path.get(STR)).getProp(); } if (binary_path.get(STR) != null) { actionName = (String)((PropType) binary_path.get(STR)).getProp(); } Log.w(appTAG,classTAG+STR+ packageName + "." + serviceName + " " + actionName); if (serviceName != null && actionName == null) { tmpintent = new Intent(); tmpintent.setClassName(packageName, packageName + "." + serviceName); } else if (serviceName == null && actionName != null) { try { tmpintent = new Intent((String)Intent.class.getField(actionName).get(tmpintent)); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } tmpintent.setPackage(packageName); } else { Log.e(appTAG, classTAG+STR); throw new IllegalArgumentException(STR); } String key = null; PropType propType = null; p = null; Log.i(appTAG, classTAG+STR); if(resourceProps.get(STR)!=null){ HashMap<String, Object> params = new HashMap<String, Object>((HashMap<String, Object>)((PropType)resourceProps.get(STR)).getProp()); Iterator<Entry<String, Object>> it = params.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Object> pairs = (Map.Entry<String, Object>)it.next(); key = pairs.getKey(); propType =(PropType) pairs.getValue(); if(propType.getType().equalsIgnoreCase("hash")) { HashMap<String,Object> parameter = (HashMap<String,Object>)propType.getProp(); Log.w(appTAG,classTAG+STR+parameter.get("type")); Log.w(appTAG,classTAG+STR+parameter.get("extra")); if(parameter.get("extra")!=null && (((PropType)parameter.get("value")).getType().equalsIgnoreCase(STR) ((PropType)parameter.get("value")).getType().equalsIgnoreCase(STR))) { if(((String)((PropType)parameter.get("extra")).getProp()).equalsIgnoreCase(STR)) { Log.w(appTAG,classTAG+STR+key+":"+((String)((PropType)parameter.get("value")).getProp())); tmpintent.putExtra(key, ((String)((PropType)parameter.get("value")).getProp())); } } else if ((parameter.get("extra") != null) && ((String)((PropType)parameter.get("extra")).getProp()).equalsIgnoreCase(STR)) { if (key.equalsIgnoreCase(STR)) { HashMap<String, Object> data_type = (HashMap<String, Object>)((PropType)(parameter.get("value"))).getProp(); Uri data = Uri.parse((String)((PropType)data_type.get("data")).getProp()); String type = (String)((PropType)data_type.get("extra")).getProp(); Log.i(appTAG,classTAG+STR+data+":"+type); tmpintent.setDataAndType(data, type); } } } it.remove(); } } } else { if(resourceProps.get(STR)!=null) { appDescription = (String)((PropType)resourceProps.get(STR)).getProp(); Log.i(appTAG, classTAG+STR+appDescription); } binPath = (String)((PropType)resourceProps.get(STR)).getProp(); commandLineStart = binPath; PropType propType = null; p = null; Log.i(appTAG, classTAG+STR+commandLineStart); Log.i(appTAG, classTAG+STR); if(resourceProps.get(STR)!=null){ HashMap<String, Object> params = new HashMap<String, Object>((HashMap<String, Object>)((PropType)resourceProps.get(STR)).getProp()); Iterator<Entry<String, Object>> it = params.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Object> pairs = (Map.Entry<String, Object>)it.next(); propType =(PropType) pairs.getValue(); if(propType.getType().equalsIgnoreCase("hash")) { HashMap<String,Object> parameter = (HashMap<String,Object>)propType.getProp(); if(parameter.get("type")!=null && ((PropType)parameter.get("cmd")).getType().equalsIgnoreCase(STR)) { commandLineStart+=" "+((String)((PropType)parameter.get("cmd")).getProp()); } if(parameter.get("type")!=null && (((PropType)parameter.get("value")).getType().equalsIgnoreCase(STR) ((PropType)parameter.get("value")).getType().equalsIgnoreCase(STR))) { commandLineStart+=" "+((String)((PropType)parameter.get("value")).getProp()); } } it.remove(); } Log.i(appTAG, classTAG+STR+commandLineStart); } } if(message.getMessageType().equalsIgnoreCase(STR)) { Log.i(appTAG,classTAG+STR+fromTopic+STR+STR); } else if (message.getMessageType().equalsIgnoreCase(STR)) { Log.i(appTAG,classTAG+STR+fromTopic+STR+STR); if(message.getGuard("type")==null ((String)((PropType)message.getGuard("type")).getProp()).equalsIgnoreCase((String)((PropType)resourceProps.get("type")).getProp())){ Log.i(appTAG, classTAG+STR); if(message.getGuard("name")==null ((String)((PropType)message.getGuard("name")).getProp()).equalsIgnoreCase((String)((PropType)resourceProps.get("hrn")).getProp())){ Log.i(appTAG, classTAG+STR); if(message.getProperty("state")!=null) { PropType prop = (PropType)message.getProperty("state"); if(prop.getType().equalsIgnoreCase(STR)) { if(((String)prop.getProp()).equalsIgnoreCase(STR)) { Log.i(appTAG,classTAG+STR); if(platform.equalsIgnoreCase(STR) && tmpintent != null) { if (serviceName != null) { Log.i(appTAG, classTAG+STR); ctx.startService(tmpintent); } else if (actionName != null) { Log.i(appTAG, classTAG+STR); tmpintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ctx.startActivity(tmpintent); } } else{ try { Log.i(appTAG,classTAG+STR); p = Runtime.getRuntime().exec(commandLineStart); ProcessesPID.put(fromTopic, regEx.pidReg(p.toString())); Processes.put(fromTopic, p); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; int i = 1; class MyThread implements Runnable { String line; BufferedReader bufferedReader; int i; String hrn; String uid; String fromTopic; HashMap<String, Node> Nodes; String serverName; public MyThread(BufferedReader BufferedReader, String Line, int I, String Hrn, String Uid, String FromTopic, HashMap<String, Node> nodes, String ServerName) { bufferedReader = BufferedReader; line = Line; i = I; hrn = Hrn; uid = Uid; fromTopic = FromTopic; Nodes = new HashMap<String, Node> (nodes); serverName = ServerName; } | /**
* Application Handler
* @param message : OMF message type
* @param fromTopic : from which topic the message arrived
* @param memberships : List of the topic memberships
* @param toTopic : to which topic the resource proxy replies
* @param nodes : HashMap of the created Nodes by the RC
*/ | Application Handler | OMFApplicationHandler | {
"repo_name": "NitLab/Android_Resource_Controller",
"path": "Android Studio Project/app/src/main/java/com/omf/resourcecontroller/OMF/OMFProxyHandlers.java",
"license": "mit",
"size": 37437
} | [
"android.content.Intent",
"android.net.Uri",
"android.util.Log",
"java.io.BufferedReader",
"java.io.InputStreamReader",
"java.util.HashMap",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"org.jivesoftware.smackx.pubsub.Node"
] | import android.content.Intent; import android.net.Uri; import android.util.Log; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.jivesoftware.smackx.pubsub.Node; | import android.content.*; import android.net.*; import android.util.*; import java.io.*; import java.util.*; import org.jivesoftware.smackx.pubsub.*; | [
"android.content",
"android.net",
"android.util",
"java.io",
"java.util",
"org.jivesoftware.smackx"
] | android.content; android.net; android.util; java.io; java.util; org.jivesoftware.smackx; | 962,043 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.