method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
return JpaOperations.INSTANCE.getEntityManager();
}
/**
* Returns the {@link EntityManager} for the given {@link Class<?> entity}
*
* @param clazz the entity class corresponding to the entity manager persistence unit.
* @return {@link EntityManager} | return JpaOperations.INSTANCE.getEntityManager(); } /** * Returns the {@link EntityManager} for the given {@link Class<?> entity} * * @param clazz the entity class corresponding to the entity manager persistence unit. * @return {@link EntityManager} | /**
* Returns the default {@link EntityManager}
*
* @return {@link EntityManager}
*/ | Returns the default <code>EntityManager</code> | getEntityManager | {
"repo_name": "quarkusio/quarkus",
"path": "extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/Panache.java",
"license": "apache-2.0",
"size": 3972
} | [
"io.quarkus.hibernate.orm.panache.runtime.JpaOperations",
"javax.persistence.EntityManager"
] | import io.quarkus.hibernate.orm.panache.runtime.JpaOperations; import javax.persistence.EntityManager; | import io.quarkus.hibernate.orm.panache.runtime.*; import javax.persistence.*; | [
"io.quarkus.hibernate",
"javax.persistence"
] | io.quarkus.hibernate; javax.persistence; | 2,185,420 |
static Iterable<String> blacklistedDexopts(
RuleContext ruleContext, List<String> dexopts) {
return Iterables.filter(
dexopts,
new FlagMatcher(
getAndroidConfig(ruleContext).getTargetDexoptsThatPreventIncrementalDexing()));
} | static Iterable<String> blacklistedDexopts( RuleContext ruleContext, List<String> dexopts) { return Iterables.filter( dexopts, new FlagMatcher( getAndroidConfig(ruleContext).getTargetDexoptsThatPreventIncrementalDexing())); } | /**
* Returns the subset of the given dexopts that are blacklisted from using incremental dexing
* by default.
*/ | Returns the subset of the given dexopts that are blacklisted from using incremental dexing by default | blacklistedDexopts | {
"repo_name": "damienmg/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java",
"license": "apache-2.0",
"size": 25755
} | [
"com.google.common.collect.Iterables",
"com.google.devtools.build.lib.analysis.RuleContext",
"com.google.devtools.build.lib.rules.android.AndroidCommon",
"java.util.List"
] | import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.rules.android.AndroidCommon; import java.util.List; | import com.google.common.collect.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.rules.android.*; import java.util.*; | [
"com.google.common",
"com.google.devtools",
"java.util"
] | com.google.common; com.google.devtools; java.util; | 728,358 |
public static AztecCode encode(byte[] data, int minECCPercent, int userSpecifiedLayers) {
// High-level encode
BitArray bits = new HighLevelEncoder(data).encode();
// stuff bits and choose symbol size
int eccBits = bits.getSize() * minECCPercent / 100 + 11;
int totalSizeBits = bits.getSize() + eccBits;
boolean compact;
int layers;
int totalBitsInLayer;
int wordSize;
BitArray stuffedBits;
if (userSpecifiedLayers != DEFAULT_AZTEC_LAYERS) {
compact = userSpecifiedLayers < 0;
layers = Math.abs(userSpecifiedLayers);
if (layers > (compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS)) {
throw new IllegalArgumentException(
String.format("Illegal value %s for layers", userSpecifiedLayers));
}
totalBitsInLayer = totalBitsInLayer(layers, compact);
wordSize = WORD_SIZE[layers];
int usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);
stuffedBits = stuffBits(bits, wordSize);
if (stuffedBits.getSize() + eccBits > usableBitsInLayers) {
throw new IllegalArgumentException("Data to large for user specified layer");
}
if (compact && stuffedBits.getSize() > wordSize * 64) {
// Compact format only allows 64 data words, though C4 can hold more words than that
throw new IllegalArgumentException("Data to large for user specified layer");
}
} else {
wordSize = 0;
stuffedBits = null;
// We look at the possible table sizes in the order Compact1, Compact2, Compact3,
// Compact4, Normal4,... Normal(i) for i < 4 isn't typically used since Compact(i+1)
// is the same size, but has more data.
for (int i = 0; ; i++) {
if (i > MAX_NB_BITS) {
throw new IllegalArgumentException("Data too large for an Aztec code");
}
compact = i <= 3;
layers = compact ? i + 1 : i;
totalBitsInLayer = totalBitsInLayer(layers, compact);
if (totalSizeBits > totalBitsInLayer) {
continue;
}
// [Re]stuff the bits if this is the first opportunity, or if the
// wordSize has changed
if (wordSize != WORD_SIZE[layers]) {
wordSize = WORD_SIZE[layers];
stuffedBits = stuffBits(bits, wordSize);
}
int usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);
if (compact && stuffedBits.getSize() > wordSize * 64) {
// Compact format only allows 64 data words, though C4 can hold more words than that
continue;
}
if (stuffedBits.getSize() + eccBits <= usableBitsInLayers) {
break;
}
}
}
BitArray messageBits = generateCheckWords(stuffedBits, totalBitsInLayer, wordSize);
// generate mode message
int messageSizeInWords = stuffedBits.getSize() / wordSize;
BitArray modeMessage = generateModeMessage(compact, layers, messageSizeInWords);
// allocate symbol
int baseMatrixSize = compact ? 11 + layers * 4 : 14 + layers * 4; // not including alignment lines
int[] alignmentMap = new int[baseMatrixSize];
int matrixSize;
if (compact) {
// no alignment marks in compact mode, alignmentMap is a no-op
matrixSize = baseMatrixSize;
for (int i = 0; i < alignmentMap.length; i++) {
alignmentMap[i] = i;
}
} else {
matrixSize = baseMatrixSize + 1 + 2 * ((baseMatrixSize / 2 - 1) / 15);
int origCenter = baseMatrixSize / 2;
int center = matrixSize / 2;
for (int i = 0; i < origCenter; i++) {
int newOffset = i + i / 15;
alignmentMap[origCenter - i - 1] = center - newOffset - 1;
alignmentMap[origCenter + i] = center + newOffset + 1;
}
}
BitMatrix matrix = new BitMatrix(matrixSize);
// draw data bits
for (int i = 0, rowOffset = 0; i < layers; i++) {
int rowSize = compact ? (layers - i) * 4 + 9 : (layers - i) * 4 + 12;
for (int j = 0; j < rowSize; j++) {
int columnOffset = j * 2;
for (int k = 0; k < 2; k++) {
if (messageBits.get(rowOffset + columnOffset + k)) {
matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]);
}
if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) {
matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]);
}
if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) {
matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]);
}
if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) {
matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]);
}
}
}
rowOffset += rowSize * 8;
}
// draw mode message
drawModeMessage(matrix, compact, matrixSize, modeMessage);
// draw alignment marks
if (compact) {
drawBullsEye(matrix, matrixSize / 2, 5);
} else {
drawBullsEye(matrix, matrixSize / 2, 7);
for (int i = 0, j = 0; i < baseMatrixSize / 2 - 1; i += 15, j += 16) {
for (int k = (matrixSize / 2) & 1; k < matrixSize; k += 2) {
matrix.set(matrixSize / 2 - j, k);
matrix.set(matrixSize / 2 + j, k);
matrix.set(k, matrixSize / 2 - j);
matrix.set(k, matrixSize / 2 + j);
}
}
}
AztecCode aztec = new AztecCode();
aztec.setCompact(compact);
aztec.setSize(matrixSize);
aztec.setLayers(layers);
aztec.setCodeWords(messageSizeInWords);
aztec.setMatrix(matrix);
return aztec;
} | static AztecCode function(byte[] data, int minECCPercent, int userSpecifiedLayers) { BitArray bits = new HighLevelEncoder(data).encode(); int eccBits = bits.getSize() * minECCPercent / 100 + 11; int totalSizeBits = bits.getSize() + eccBits; boolean compact; int layers; int totalBitsInLayer; int wordSize; BitArray stuffedBits; if (userSpecifiedLayers != DEFAULT_AZTEC_LAYERS) { compact = userSpecifiedLayers < 0; layers = Math.abs(userSpecifiedLayers); if (layers > (compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS)) { throw new IllegalArgumentException( String.format(STR, userSpecifiedLayers)); } totalBitsInLayer = totalBitsInLayer(layers, compact); wordSize = WORD_SIZE[layers]; int usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize); stuffedBits = stuffBits(bits, wordSize); if (stuffedBits.getSize() + eccBits > usableBitsInLayers) { throw new IllegalArgumentException(STR); } if (compact && stuffedBits.getSize() > wordSize * 64) { throw new IllegalArgumentException(STR); } } else { wordSize = 0; stuffedBits = null; for (int i = 0; ; i++) { if (i > MAX_NB_BITS) { throw new IllegalArgumentException(STR); } compact = i <= 3; layers = compact ? i + 1 : i; totalBitsInLayer = totalBitsInLayer(layers, compact); if (totalSizeBits > totalBitsInLayer) { continue; } if (wordSize != WORD_SIZE[layers]) { wordSize = WORD_SIZE[layers]; stuffedBits = stuffBits(bits, wordSize); } int usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize); if (compact && stuffedBits.getSize() > wordSize * 64) { continue; } if (stuffedBits.getSize() + eccBits <= usableBitsInLayers) { break; } } } BitArray messageBits = generateCheckWords(stuffedBits, totalBitsInLayer, wordSize); int messageSizeInWords = stuffedBits.getSize() / wordSize; BitArray modeMessage = generateModeMessage(compact, layers, messageSizeInWords); int baseMatrixSize = compact ? 11 + layers * 4 : 14 + layers * 4; int[] alignmentMap = new int[baseMatrixSize]; int matrixSize; if (compact) { matrixSize = baseMatrixSize; for (int i = 0; i < alignmentMap.length; i++) { alignmentMap[i] = i; } } else { matrixSize = baseMatrixSize + 1 + 2 * ((baseMatrixSize / 2 - 1) / 15); int origCenter = baseMatrixSize / 2; int center = matrixSize / 2; for (int i = 0; i < origCenter; i++) { int newOffset = i + i / 15; alignmentMap[origCenter - i - 1] = center - newOffset - 1; alignmentMap[origCenter + i] = center + newOffset + 1; } } BitMatrix matrix = new BitMatrix(matrixSize); for (int i = 0, rowOffset = 0; i < layers; i++) { int rowSize = compact ? (layers - i) * 4 + 9 : (layers - i) * 4 + 12; for (int j = 0; j < rowSize; j++) { int columnOffset = j * 2; for (int k = 0; k < 2; k++) { if (messageBits.get(rowOffset + columnOffset + k)) { matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]); } if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) { matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]); } if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) { matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]); } if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) { matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]); } } } rowOffset += rowSize * 8; } drawModeMessage(matrix, compact, matrixSize, modeMessage); if (compact) { drawBullsEye(matrix, matrixSize / 2, 5); } else { drawBullsEye(matrix, matrixSize / 2, 7); for (int i = 0, j = 0; i < baseMatrixSize / 2 - 1; i += 15, j += 16) { for (int k = (matrixSize / 2) & 1; k < matrixSize; k += 2) { matrix.set(matrixSize / 2 - j, k); matrix.set(matrixSize / 2 + j, k); matrix.set(k, matrixSize / 2 - j); matrix.set(k, matrixSize / 2 + j); } } } AztecCode aztec = new AztecCode(); aztec.setCompact(compact); aztec.setSize(matrixSize); aztec.setLayers(layers); aztec.setCodeWords(messageSizeInWords); aztec.setMatrix(matrix); return aztec; } | /**
* Encodes the given binary content as an Aztec symbol
*
* @param data input data string
* @param minECCPercent minimal percentage of error check words (According to ISO/IEC 24778:2008,
* a minimum of 23% + 3 words is recommended)
* @param userSpecifiedLayers if non-zero, a user-specified value for the number of layers
* @return Aztec symbol matrix with metadata
*/ | Encodes the given binary content as an Aztec symbol | encode | {
"repo_name": "alfred82santa/tarrabmeCheckerAndriod",
"path": "app/src/main/java/com/tarrabme/zxing/aztec/encoder/Encoder.java",
"license": "gpl-2.0",
"size": 12385
} | [
"com.tarrabme.zxing.common.BitArray",
"com.tarrabme.zxing.common.BitMatrix"
] | import com.tarrabme.zxing.common.BitArray; import com.tarrabme.zxing.common.BitMatrix; | import com.tarrabme.zxing.common.*; | [
"com.tarrabme.zxing"
] | com.tarrabme.zxing; | 2,552,167 |
private Config getConfig() {
final HazelcastProperties hazelcast = casProperties.getTicket().getRegistry().getHazelcast();
final HazelcastProperties.Cluster cluster = hazelcast.getCluster();
final Config config;
if (hazelcast.getConfigLocation() != null
&& hazelcast.getConfigLocation().exists()) {
try {
final URL configUrl = hazelcast.getConfigLocation().getURL();
config = new XmlConfigBuilder(hazelcast.getConfigLocation().getInputStream()).build();
config.setConfigurationUrl(configUrl);
} catch (final Exception e) {
throw Throwables.propagate(e);
}
} else {
config = new Config();
config.setProperty("hazelcast.prefer.ipv4.stack", String.valueOf(cluster.isIpv4Enabled()));
final TcpIpConfig tcpIpConfig = new TcpIpConfig()
.setEnabled(cluster.isTcpipEnabled())
.setMembers(cluster.getMembers())
.setConnectionTimeoutSeconds(cluster.getTimeout());
final MulticastConfig multicastConfig = new MulticastConfig().setEnabled(cluster.isMulticastEnabled());
if (cluster.isMulticastEnabled()) {
multicastConfig.setMulticastGroup(cluster.getMulticastGroup());
multicastConfig.setMulticastPort(cluster.getMulticastPort());
final Set<String> trustedInterfaces = StringUtils.commaDelimitedListToSet(cluster.getMulticastTrustedInterfaces());
if (!trustedInterfaces.isEmpty()) {
multicastConfig.setTrustedInterfaces(trustedInterfaces);
}
multicastConfig.setMulticastTimeoutSeconds(cluster.getMulticastTimeout());
multicastConfig.setMulticastTimeToLive(cluster.getMulticastTimeToLive());
}
//Join config
final JoinConfig joinConfig = new JoinConfig()
.setMulticastConfig(multicastConfig)
.setTcpIpConfig(tcpIpConfig);
//Network config
final NetworkConfig networkConfig = new NetworkConfig()
.setPort(cluster.getPort())
.setPortAutoIncrement(cluster.isPortAutoIncrement())
.setJoin(joinConfig);
//Map config
final MapConfig mapConfig = new MapConfig().setName(hazelcast.getMapName())
.setMaxIdleSeconds(casProperties.getTicket().getTgt().getMaxTimeToLiveInSeconds())
.setBackupCount(cluster.getBackupCount())
.setAsyncBackupCount(cluster.getAsyncBackupCount())
.setEvictionPolicy(EvictionPolicy.valueOf(
cluster.getEvictionPolicy()))
.setEvictionPercentage(cluster.getEvictionPercentage())
.setMaxSizeConfig(new MaxSizeConfig()
.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(cluster.getMaxSizePolicy()))
.setSize(cluster.getMaxHeapSizePercentage()));
final Map<String, MapConfig> mapConfigs = new HashMap<>();
mapConfigs.put(hazelcast.getMapName(), mapConfig);
//Finally aggregate all those config into the main Config
config.setMapConfigs(mapConfigs).setNetworkConfig(networkConfig);
}
return config.setInstanceName(cluster.getInstanceName())
.setProperty(HazelcastProperties.LOGGING_TYPE_PROP, cluster.getLoggingType())
.setProperty(HazelcastProperties.MAX_HEARTBEAT_SECONDS_PROP, String.valueOf(cluster.getMaxNoHeartbeatSeconds()));
} | Config function() { final HazelcastProperties hazelcast = casProperties.getTicket().getRegistry().getHazelcast(); final HazelcastProperties.Cluster cluster = hazelcast.getCluster(); final Config config; if (hazelcast.getConfigLocation() != null && hazelcast.getConfigLocation().exists()) { try { final URL configUrl = hazelcast.getConfigLocation().getURL(); config = new XmlConfigBuilder(hazelcast.getConfigLocation().getInputStream()).build(); config.setConfigurationUrl(configUrl); } catch (final Exception e) { throw Throwables.propagate(e); } } else { config = new Config(); config.setProperty(STR, String.valueOf(cluster.isIpv4Enabled())); final TcpIpConfig tcpIpConfig = new TcpIpConfig() .setEnabled(cluster.isTcpipEnabled()) .setMembers(cluster.getMembers()) .setConnectionTimeoutSeconds(cluster.getTimeout()); final MulticastConfig multicastConfig = new MulticastConfig().setEnabled(cluster.isMulticastEnabled()); if (cluster.isMulticastEnabled()) { multicastConfig.setMulticastGroup(cluster.getMulticastGroup()); multicastConfig.setMulticastPort(cluster.getMulticastPort()); final Set<String> trustedInterfaces = StringUtils.commaDelimitedListToSet(cluster.getMulticastTrustedInterfaces()); if (!trustedInterfaces.isEmpty()) { multicastConfig.setTrustedInterfaces(trustedInterfaces); } multicastConfig.setMulticastTimeoutSeconds(cluster.getMulticastTimeout()); multicastConfig.setMulticastTimeToLive(cluster.getMulticastTimeToLive()); } final JoinConfig joinConfig = new JoinConfig() .setMulticastConfig(multicastConfig) .setTcpIpConfig(tcpIpConfig); final NetworkConfig networkConfig = new NetworkConfig() .setPort(cluster.getPort()) .setPortAutoIncrement(cluster.isPortAutoIncrement()) .setJoin(joinConfig); final MapConfig mapConfig = new MapConfig().setName(hazelcast.getMapName()) .setMaxIdleSeconds(casProperties.getTicket().getTgt().getMaxTimeToLiveInSeconds()) .setBackupCount(cluster.getBackupCount()) .setAsyncBackupCount(cluster.getAsyncBackupCount()) .setEvictionPolicy(EvictionPolicy.valueOf( cluster.getEvictionPolicy())) .setEvictionPercentage(cluster.getEvictionPercentage()) .setMaxSizeConfig(new MaxSizeConfig() .setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(cluster.getMaxSizePolicy())) .setSize(cluster.getMaxHeapSizePercentage())); final Map<String, MapConfig> mapConfigs = new HashMap<>(); mapConfigs.put(hazelcast.getMapName(), mapConfig); config.setMapConfigs(mapConfigs).setNetworkConfig(networkConfig); } return config.setInstanceName(cluster.getInstanceName()) .setProperty(HazelcastProperties.LOGGING_TYPE_PROP, cluster.getLoggingType()) .setProperty(HazelcastProperties.MAX_HEARTBEAT_SECONDS_PROP, String.valueOf(cluster.getMaxNoHeartbeatSeconds())); } | /**
* Get Hazelcast <code>Config</code> instance.
*
* @return Hazelcast Config
* @throws IOException if parsing of hazelcast xml configuration fails
*/ | Get Hazelcast <code>Config</code> instance | getConfig | {
"repo_name": "vydra/cas",
"path": "support/cas-server-support-hazelcast-ticket-registry/src/main/java/org/apereo/cas/config/HazelcastInstanceConfiguration.java",
"license": "apache-2.0",
"size": 7341
} | [
"com.google.common.base.Throwables",
"com.hazelcast.config.Config",
"com.hazelcast.config.EvictionPolicy",
"com.hazelcast.config.JoinConfig",
"com.hazelcast.config.MapConfig",
"com.hazelcast.config.MaxSizeConfig",
"com.hazelcast.config.MulticastConfig",
"com.hazelcast.config.NetworkConfig",
"com.haz... | import com.google.common.base.Throwables; import com.hazelcast.config.Config; import com.hazelcast.config.EvictionPolicy; import com.hazelcast.config.JoinConfig; import com.hazelcast.config.MapConfig; import com.hazelcast.config.MaxSizeConfig; import com.hazelcast.config.MulticastConfig; import com.hazelcast.config.NetworkConfig; import com.hazelcast.config.TcpIpConfig; import com.hazelcast.config.XmlConfigBuilder; import java.util.HashMap; import java.util.Map; import java.util.Set; import org.apereo.cas.configuration.model.support.hazelcast.HazelcastProperties; import org.springframework.util.StringUtils; | import com.google.common.base.*; import com.hazelcast.config.*; import java.util.*; import org.apereo.cas.configuration.model.support.hazelcast.*; import org.springframework.util.*; | [
"com.google.common",
"com.hazelcast.config",
"java.util",
"org.apereo.cas",
"org.springframework.util"
] | com.google.common; com.hazelcast.config; java.util; org.apereo.cas; org.springframework.util; | 749,224 |
private long getNextSeekPosition(ExtractorInput input) throws IOException, InterruptedException {
if (start == end) {
return C.POSITION_UNSET;
}
long currentPosition = input.getPosition();
if (!skipToNextPage(input, end)) {
if (start == currentPosition) {
throw new IOException("No ogg page can be found.");
}
return start;
}
pageHeader.populate(input, false);
input.resetPeekPosition();
long granuleDistance = targetGranule - pageHeader.granulePosition;
int pageSize = pageHeader.headerSize + pageHeader.bodySize;
if (0 <= granuleDistance && granuleDistance < MATCH_RANGE) {
return C.POSITION_UNSET;
}
if (granuleDistance < 0) {
end = currentPosition;
endGranule = pageHeader.granulePosition;
} else {
start = input.getPosition() + pageSize;
startGranule = pageHeader.granulePosition;
}
if (end - start < MATCH_BYTE_RANGE) {
end = start;
return start;
}
long offset = pageSize * (granuleDistance <= 0 ? 2L : 1L);
long nextPosition =
input.getPosition()
- offset
+ (granuleDistance * (end - start) / (endGranule - startGranule));
return Util.constrainValue(nextPosition, start, end - 1);
} | long function(ExtractorInput input) throws IOException, InterruptedException { if (start == end) { return C.POSITION_UNSET; } long currentPosition = input.getPosition(); if (!skipToNextPage(input, end)) { if (start == currentPosition) { throw new IOException(STR); } return start; } pageHeader.populate(input, false); input.resetPeekPosition(); long granuleDistance = targetGranule - pageHeader.granulePosition; int pageSize = pageHeader.headerSize + pageHeader.bodySize; if (0 <= granuleDistance && granuleDistance < MATCH_RANGE) { return C.POSITION_UNSET; } if (granuleDistance < 0) { end = currentPosition; endGranule = pageHeader.granulePosition; } else { start = input.getPosition() + pageSize; startGranule = pageHeader.granulePosition; } if (end - start < MATCH_BYTE_RANGE) { end = start; return start; } long offset = pageSize * (granuleDistance <= 0 ? 2L : 1L); long nextPosition = input.getPosition() - offset + (granuleDistance * (end - start) / (endGranule - startGranule)); return Util.constrainValue(nextPosition, start, end - 1); } | /**
* Performs a single step of a seeking binary search, returning the byte position from which data
* should be provided for the next step, or {@link C#POSITION_UNSET} if the search has converged.
* If the search has converged then {@link #skipToPageOfTargetGranule(ExtractorInput)} should be
* called to skip to the target page.
*
* @param input The {@link ExtractorInput} to read from.
* @return The byte position from which data should be provided for the next step, or {@link
* C#POSITION_UNSET} if the search has converged.
* @throws IOException If reading from the input fails.
* @throws InterruptedException If interrupted while reading from the input.
*/ | Performs a single step of a seeking binary search, returning the byte position from which data should be provided for the next step, or <code>C#POSITION_UNSET</code> if the search has converged. If the search has converged then <code>#skipToPageOfTargetGranule(ExtractorInput)</code> should be called to skip to the target page | getNextSeekPosition | {
"repo_name": "superbderrick/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/DefaultOggSeeker.java",
"license": "apache-2.0",
"size": 11349
} | [
"com.google.android.exoplayer2.extractor.ExtractorInput",
"com.google.android.exoplayer2.util.Util",
"java.io.IOException"
] | import com.google.android.exoplayer2.extractor.ExtractorInput; import com.google.android.exoplayer2.util.Util; import java.io.IOException; | import com.google.android.exoplayer2.extractor.*; import com.google.android.exoplayer2.util.*; import java.io.*; | [
"com.google.android",
"java.io"
] | com.google.android; java.io; | 1,964,780 |
static StreamMessage<HttpData> of(Path path) {
requireNonNull(path, "path");
return of(path, DEFAULT_FILE_BUFFER_SIZE);
} | static StreamMessage<HttpData> of(Path path) { requireNonNull(path, "path"); return of(path, DEFAULT_FILE_BUFFER_SIZE); } | /**
* Creates a new {@link StreamMessage} that streams the specified {@link Path}.
* The default buffer size({@value PathStreamMessage#DEFAULT_FILE_BUFFER_SIZE}) is used to
* create a buffer used to read data from the {@link Path}.
* Therefore, the returned {@link StreamMessage} will emit {@link HttpData}s chunked to
* size less than or equal to {@value PathStreamMessage#DEFAULT_FILE_BUFFER_SIZE}.
*/ | Creates a new <code>StreamMessage</code> that streams the specified <code>Path</code>. The default buffer size(PathStreamMessage#DEFAULT_FILE_BUFFER_SIZE) is used to create a buffer used to read data from the <code>Path</code>. Therefore, the returned <code>StreamMessage</code> will emit <code>HttpData</code>s chunked to size less than or equal to PathStreamMessage#DEFAULT_FILE_BUFFER_SIZE | of | {
"repo_name": "kojilin/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/stream/StreamMessage.java",
"license": "apache-2.0",
"size": 30730
} | [
"com.linecorp.armeria.common.HttpData",
"java.nio.file.Path",
"java.util.Objects"
] | import com.linecorp.armeria.common.HttpData; import java.nio.file.Path; import java.util.Objects; | import com.linecorp.armeria.common.*; import java.nio.file.*; import java.util.*; | [
"com.linecorp.armeria",
"java.nio",
"java.util"
] | com.linecorp.armeria; java.nio; java.util; | 2,251,022 |
private static String getDataType(ItemAwareElement element) {
return Optional
.ofNullable(CustomAttribute.dtype.of(element).get())
.filter(StringUtils::nonEmpty)
.orElseGet(() -> Optional
.ofNullable(element.getItemSubjectRef())
.map(ItemDefinition::getStructureRef)
.orElse(""));
} | static String function(ItemAwareElement element) { return Optional .ofNullable(CustomAttribute.dtype.of(element).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(element.getItemSubjectRef()) .map(ItemDefinition::getStructureRef) .orElse("")); } | /** Returns the Data Type based on the CustomAttribute dtype and in case it does not exist use the ItemSubjectRef.
* @param element the Data Input/Output element
* @return the given element type
*/ | Returns the Data Type based on the CustomAttribute dtype and in case it does not exist use the ItemSubjectRef | getDataType | {
"repo_name": "romartin/kie-wb-common",
"path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-marshalling/src/main/java/org/kie/workbench/common/stunner/bpmn/client/marshall/converters/tostunner/properties/AssignmentsInfos.java",
"license": "apache-2.0",
"size": 6475
} | [
"java.util.Optional",
"org.eclipse.bpmn2.ItemAwareElement",
"org.eclipse.bpmn2.ItemDefinition",
"org.kie.workbench.common.stunner.bpmn.client.marshall.converters.customproperties.CustomAttribute",
"org.kie.workbench.common.stunner.core.util.StringUtils"
] | import java.util.Optional; import org.eclipse.bpmn2.ItemAwareElement; import org.eclipse.bpmn2.ItemDefinition; import org.kie.workbench.common.stunner.bpmn.client.marshall.converters.customproperties.CustomAttribute; import org.kie.workbench.common.stunner.core.util.StringUtils; | import java.util.*; import org.eclipse.bpmn2.*; import org.kie.workbench.common.stunner.bpmn.client.marshall.converters.customproperties.*; import org.kie.workbench.common.stunner.core.util.*; | [
"java.util",
"org.eclipse.bpmn2",
"org.kie.workbench"
] | java.util; org.eclipse.bpmn2; org.kie.workbench; | 913,843 |
@Override
public void message(XdmNode content, boolean terminate, SourceLocator locator) {
if (terminate) {
// Assumes that the content of xsl:message is just a string. This
// is true for XSLT generated from Schematron.
results.addFatalError(content.getStringValue());
}
else {
results.addError(content.getStringValue());
}
}
| void function(XdmNode content, boolean terminate, SourceLocator locator) { if (terminate) { results.addFatalError(content.getStringValue()); } else { results.addError(content.getStringValue()); } } | /**
* Register the output from <code>xsl:message</code> as a validation error.
* Useful when using XSLT for validation (for example, when the XSLT
* is generated from Schematron).
*/ | Register the output from <code>xsl:message</code> as a validation error. Useful when using XSLT for validation (for example, when the XSLT is generated from Schematron) | message | {
"repo_name": "anl-cyberscience/java-taxii",
"path": "src/main/java/org/mitre/taxii/util/ValidationErrorHandler.java",
"license": "bsd-3-clause",
"size": 7987
} | [
"javax.xml.transform.SourceLocator",
"net.sf.saxon.s9api.XdmNode"
] | import javax.xml.transform.SourceLocator; import net.sf.saxon.s9api.XdmNode; | import javax.xml.transform.*; import net.sf.saxon.s9api.*; | [
"javax.xml",
"net.sf.saxon"
] | javax.xml; net.sf.saxon; | 1,775,382 |
public void headers(HeadersInfo headersInfo, Callback callback); | void function(HeadersInfo headersInfo, Callback callback); | /**
* <p>Sends asynchronously a HEADER frame on this stream.</p> <p>HEADERS frames should always be sent after a
* SYN_REPLY frame.</p> <p>Callers may pass a non-null completion callback to be notified of when the headers have
* been actually sent.</p>
*
* @param headersInfo the metadata to send
* @param callback the completion callback that gets notified of headers sent
* @see #headers(HeadersInfo)
*/ | Sends asynchronously a HEADER frame on this stream. HEADERS frames should always be sent after a SYN_REPLY frame. Callers may pass a non-null completion callback to be notified of when the headers have been actually sent | headers | {
"repo_name": "sdw2330976/Research-jetty-9.2.5",
"path": "jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Stream.java",
"license": "apache-2.0",
"size": 9685
} | [
"org.eclipse.jetty.util.Callback"
] | import org.eclipse.jetty.util.Callback; | import org.eclipse.jetty.util.*; | [
"org.eclipse.jetty"
] | org.eclipse.jetty; | 654,755 |
void processHistoryTweet(final Tweet tweet);
}
interface NewTweetAware extends DataProvider { | void processHistoryTweet(final Tweet tweet); } interface NewTweetAware extends DataProvider { | /**
* Callback to process a historic tweet
*
* @param tweet a historic tweet
*/ | Callback to process a historic tweet | processHistoryTweet | {
"repo_name": "Map8524/TweetwallFX",
"path": "controls/src/main/java/org/tweetwallfx/controls/dataprovider/DataProvider.java",
"license": "mit",
"size": 2748
} | [
"org.tweetwallfx.tweet.api.Tweet"
] | import org.tweetwallfx.tweet.api.Tweet; | import org.tweetwallfx.tweet.api.*; | [
"org.tweetwallfx.tweet"
] | org.tweetwallfx.tweet; | 2,397,111 |
@RunsInCurrentThread
protected static void destroy(TestDialog dialog) {
hideAndDispose(dialog);
} | static void function(TestDialog dialog) { hideAndDispose(dialog); } | /**
* Hides and disposes the given dialog. This method is executed in the current thread where it is called.
*
* @param dialog the dialog to destroy.
*/ | Hides and disposes the given dialog. This method is executed in the current thread where it is called | destroy | {
"repo_name": "google/fest",
"path": "third_party/fest-swing/src/test/java/org/fest/swing/test/swing/TestDialog.java",
"license": "apache-2.0",
"size": 6296
} | [
"org.fest.swing.test.task.WindowDestroyTask"
] | import org.fest.swing.test.task.WindowDestroyTask; | import org.fest.swing.test.task.*; | [
"org.fest.swing"
] | org.fest.swing; | 42,165 |
public T xpath(String text) {
return expression(new XPathExpression(text));
} | T function(String text) { return expression(new XPathExpression(text)); } | /**
* Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
* expression</a>
*
* @param text the expression to be evaluated
* @return the builder to continue processing the DSL
*/ | Evaluates an XPath expression | xpath | {
"repo_name": "acartapanis/camel",
"path": "camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java",
"license": "apache-2.0",
"size": 38841
} | [
"org.apache.camel.model.language.XPathExpression"
] | import org.apache.camel.model.language.XPathExpression; | import org.apache.camel.model.language.*; | [
"org.apache.camel"
] | org.apache.camel; | 939,647 |
protected Date compute(String dateString, String patternString) {
String defaultLocale = Locale.getDefault().getISO3Language();
return compute(dateString, patternString, defaultLocale);
} | Date function(String dateString, String patternString) { String defaultLocale = Locale.getDefault().getISO3Language(); return compute(dateString, patternString, defaultLocale); } | /**
* Computes the result for two string input values.
*
* @param dateString
* the input date string
* @param patternString
* the input pattern string
* @return the result of the computation.
*/ | Computes the result for two string input values | compute | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/tools/expression/internal/function/conversion/DateParseCustom.java",
"license": "agpl-3.0",
"size": 8595
} | [
"java.util.Date",
"java.util.Locale"
] | import java.util.Date; import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,301,006 |
public ResultSetFuture executeAsyncSelectTopEqual (
Object yearmonthdaygridid,
Object rank) throws Exception {
return
this.getQuery(kSelectTopEqualName).executeAsync(
yearmonthdaygridid,
rank);
} | ResultSetFuture function ( Object yearmonthdaygridid, Object rank) throws Exception { return this.getQuery(kSelectTopEqualName).executeAsync( yearmonthdaygridid, rank); } | /**
* executeAsyncSelectTopEqual
* executes SelectTopEqual Query asynchronously
* @param yearmonthdaygridid
* @param rank
* @return ResultSetFuture
* @throws Exception
*/ | executeAsyncSelectTopEqual executes SelectTopEqual Query asynchronously | executeAsyncSelectTopEqual | {
"repo_name": "vangav/vos_instagram",
"path": "app/com/vangav/vos_instagram/cassandra_keyspaces/ig_app_data/PostsRankGrid.java",
"license": "mit",
"size": 27838
} | [
"com.datastax.driver.core.ResultSetFuture"
] | import com.datastax.driver.core.ResultSetFuture; | import com.datastax.driver.core.*; | [
"com.datastax.driver"
] | com.datastax.driver; | 520,240 |
public static void stopRinging() {
Log.d(LOG_TAG, "stopRinging");
if (null != mRingTone) {
mRingTone.stop();
mRingTone = null;
}
if (null != mRingbackTone) {
mRingbackTone.stop();
mRingbackTone = null;
}
// sanity checks
if ((null != mRingingPlayer) && mRingingPlayer.isPlaying()) {
Log.d(LOG_TAG, "stop mRingingPLayer");
try {
mRingingPlayer.pause();
} catch (Exception e) {
Log.e(LOG_TAG, "stop mRingingPLayer failed " + e.getLocalizedMessage());
}
}
if ((null != mRingbackPlayer) && mRingbackPlayer.isPlaying()) {
Log.d(LOG_TAG, "stop mRingbackPlayer");
try {
mRingbackPlayer.pause();
} catch (Exception e) {
Log.e(LOG_TAG, "stop mRingbackPlayer failed " + e.getLocalizedMessage());
}
}
} | static void function() { Log.d(LOG_TAG, STR); if (null != mRingTone) { mRingTone.stop(); mRingTone = null; } if (null != mRingbackTone) { mRingbackTone.stop(); mRingbackTone = null; } if ((null != mRingingPlayer) && mRingingPlayer.isPlaying()) { Log.d(LOG_TAG, STR); try { mRingingPlayer.pause(); } catch (Exception e) { Log.e(LOG_TAG, STR + e.getLocalizedMessage()); } } if ((null != mRingbackPlayer) && mRingbackPlayer.isPlaying()) { Log.d(LOG_TAG, STR); try { mRingbackPlayer.pause(); } catch (Exception e) { Log.e(LOG_TAG, STR + e.getLocalizedMessage()); } } } | /**
* Stop the ringing sound
*/ | Stop the ringing sound | stopRinging | {
"repo_name": "matrix-org/matrix-android-console",
"path": "console/src/main/java/org/matrix/console/activity/CallViewActivity.java",
"license": "apache-2.0",
"size": 36019
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 1,002,629 |
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
int rc = super.tightMarshal1(wireFormat, o, bs);
return rc + 0;
} | int function(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } | /**
* Write the booleans that this object uses to a BooleanStream
*/ | Write the booleans that this object uses to a BooleanStream | tightMarshal1 | {
"repo_name": "chirino/fabric8",
"path": "gateway/gateway-core/src/main/java/io/fabric8/gateway/handlers/detecting/protocol/openwire/codec/v1/ActiveMQTempTopicMarshaller.java",
"license": "apache-2.0",
"size": 3677
} | [
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.BooleanStream",
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat",
"java.io.IOException"
] | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.BooleanStream; import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat; import java.io.IOException; | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.*; import java.io.*; | [
"io.fabric8.gateway",
"java.io"
] | io.fabric8.gateway; java.io; | 165,296 |
void setTimestamp(Date value); | void setTimestamp(Date value); | /**
* Sets the value of the '{@link de.dfki.iui.basys.model.domain.productinstance.ProductInstanceLocationChangeEvent#getTimestamp <em>Timestamp</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Timestamp</em>' attribute.
* @see #getTimestamp()
* @generated
*/ | Sets the value of the '<code>de.dfki.iui.basys.model.domain.productinstance.ProductInstanceLocationChangeEvent#getTimestamp Timestamp</code>' attribute. | setTimestamp | {
"repo_name": "BaSys-PC1/models",
"path": "de.dfki.iui.basys.model.domain/src/de/dfki/iui/basys/model/domain/productinstance/ProductInstanceLocationChangeEvent.java",
"license": "epl-1.0",
"size": 1642
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,831,704 |
private int internalStreamRead(byte[] b, int off, int len) throws IOException {
int tRead = 0;
if (byteBuffer != null) {
// Thread safe call of ByteArrayInputStream.available() returns the
// right value.
int tCanRead = Math.min(byteBuffer.available(), len);
tRead = byteBuffer.read(b, off, tCanRead);
if (byteBuffer.available() == 0) {
// the bufferStream is no more needed
byteBuffer.close();
byteBuffer = null;
}
// we return here because a socket read can throw exceptions.
return tRead;
}
// if socket is invalid, we can read all bytes in the buffer, but no
// more from the socket
if (socketInvalid) {
return -1;
}
return currentSocketStream.read(b, off, len);
}
| int function(byte[] b, int off, int len) throws IOException { int tRead = 0; if (byteBuffer != null) { int tCanRead = Math.min(byteBuffer.available(), len); tRead = byteBuffer.read(b, off, tCanRead); if (byteBuffer.available() == 0) { byteBuffer.close(); byteBuffer = null; } return tRead; } if (socketInvalid) { return -1; } return currentSocketStream.read(b, off, len); } | /**
* Checks if some bytes are buffered from an old stream and returns them
* first. Must only be called from {@link #read(byte[], int, int)} inside
* the @see #readLock
*/ | Checks if some bytes are buffered from an old stream and returns them first. Must only be called from <code>#read(byte[], int, int)</code> inside the @see #readLock | internalStreamRead | {
"repo_name": "htwg/SIPUCE",
"path": "socketswitch/src/main/java/de/fhkn/in/uce/socketswitch/HalfCloseSwitchableInputStream.java",
"license": "gpl-3.0",
"size": 5565
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 915,174 |
public boolean isWrapperFor(Class<?> iface) throws SQLException {
checkOpen();
return iface.isInstance(this);
} | boolean function(Class<?> iface) throws SQLException { checkOpen(); return iface.isInstance(this); } | /**
* Checking Wrapper
*
* @param iface - A Class defining an interface that the result must implement.
* @return true if this implements the interface or directly or indirectly wraps an object that does.
* @throws SQLException
*/ | Checking Wrapper | isWrapperFor | {
"repo_name": "derekstavis/bluntly",
"path": "vendor/github.com/youtube/vitess/java/jdbc/src/main/java/com/flipkart/vitess/jdbc/VitessStatement.java",
"license": "mit",
"size": 27251
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 109,563 |
@Test(expected = GenieException.class)
public void testExecuteRequestNotSuccessful() throws Exception {
Mockito.when(this.response.isSuccess()).thenReturn(false);
Mockito.when(this.response.getStatus()).thenReturn(500);
Mockito.when(this.response.getEntity(String.class)).thenReturn("Server error");
Mockito.when(this.restClient.executeWithLoadBalancer(this.request)).thenReturn(this.response);
this.client.executeRequest(this.request, Set.class, String.class);
} | @Test(expected = GenieException.class) void function() throws Exception { Mockito.when(this.response.isSuccess()).thenReturn(false); Mockito.when(this.response.getStatus()).thenReturn(500); Mockito.when(this.response.getEntity(String.class)).thenReturn(STR); Mockito.when(this.restClient.executeWithLoadBalancer(this.request)).thenReturn(this.response); this.client.executeRequest(this.request, Set.class, String.class); } | /**
* Test to make sure if response isn't success an Exception is thrown.
*
* @throws Exception
*/ | Test to make sure if response isn't success an Exception is thrown | testExecuteRequestNotSuccessful | {
"repo_name": "gorcz/genie",
"path": "genie-common/src/test/java/com/netflix/genie/common/client/TestBaseGenieClient.java",
"license": "apache-2.0",
"size": 17902
} | [
"com.netflix.genie.common.exceptions.GenieException",
"java.util.Set",
"org.junit.Test",
"org.mockito.Mockito"
] | import com.netflix.genie.common.exceptions.GenieException; import java.util.Set; import org.junit.Test; import org.mockito.Mockito; | import com.netflix.genie.common.exceptions.*; import java.util.*; import org.junit.*; import org.mockito.*; | [
"com.netflix.genie",
"java.util",
"org.junit",
"org.mockito"
] | com.netflix.genie; java.util; org.junit; org.mockito; | 1,675,765 |
public String getMsgc() {
//Cant get this to work, so im using the decaprated .getcall instead.
try{
msgc = this.securityBean.getSecurityLocator().getCall().getMessageContext();
}
catch( javax.xml.rpc.ServiceException re){
log.error("Could not get securitylocator call",re);
throw new InfrastructureException("Exception",re);
}
try{
nodList = msgc.getCurrentMessage().getSOAPPart().getDocumentElement().getElementsByTagName("ticket");
}
catch(Exception re){
log.error("Could not get securitylocator SOAP part of call",re);
throw new InfrastructureException("Exception",re);
}
for(int i = 0; i< nodList.getLength(); i++){
}
try{
sSOAPMessage = nodList.item(0).getFirstChild().getNodeValue();
}
catch(Exception ee){
log.error("Securitylocator error in getMsgc ",ee);
throw new InfrastructureException("Exception",ee);
}
return sSOAPMessage;
}
| String function() { try{ msgc = this.securityBean.getSecurityLocator().getCall().getMessageContext(); } catch( javax.xml.rpc.ServiceException re){ log.error(STR,re); throw new InfrastructureException(STR,re); } try{ nodList = msgc.getCurrentMessage().getSOAPPart().getDocumentElement().getElementsByTagName(STR); } catch(Exception re){ log.error(STR,re); throw new InfrastructureException(STR,re); } for(int i = 0; i< nodList.getLength(); i++){ } try{ sSOAPMessage = nodList.item(0).getFirstChild().getNodeValue(); } catch(Exception ee){ log.error(STR,ee); throw new InfrastructureException(STR,ee); } return sSOAPMessage; } | /**
* Is this really used??
* Gets the SOAPMessage from the GetTicketByRef call and extracts the Ticket as a string.
* @return
*/ | Is this really used?? Gets the SOAPMessage from the GetTicketByRef call and extracts the Ticket as a string | getMsgc | {
"repo_name": "idega/se.idega.ehealth.npo",
"path": "src/java/se/idega/ehealth/npo/NpoSessionBean.java",
"license": "gpl-3.0",
"size": 10603
} | [
"se.idega.ehealth.npo.exceptions.InfrastructureException"
] | import se.idega.ehealth.npo.exceptions.InfrastructureException; | import se.idega.ehealth.npo.exceptions.*; | [
"se.idega.ehealth"
] | se.idega.ehealth; | 921,635 |
private void showUploadPage(Context context, HttpServletRequest request,
HttpServletResponse response, SubmissionInfo subInfo,
boolean justUploaded) throws SQLException, ServletException,
IOException
{
Bundle[] bundles = subInfo.getSubmissionItem().getItem().getBundles(
"ORIGINAL");
boolean fileAlreadyUploaded = false;
if (!justUploaded)
{
for (Bundle bnd : bundles)
{
fileAlreadyUploaded = bnd.getBitstreams().length > 0;
if (fileAlreadyUploaded)
{
break;
}
}
}
// if user already has uploaded at least one file
if (justUploaded || fileAlreadyUploaded)
{
// The item already has files associated with it.
showUploadFileList(context, request, response, subInfo,
justUploaded, false);
}
else
{
// show the page to choose a file to upload
showChooseFile(context, request, response, subInfo);
}
} | void function(Context context, HttpServletRequest request, HttpServletResponse response, SubmissionInfo subInfo, boolean justUploaded) throws SQLException, ServletException, IOException { Bundle[] bundles = subInfo.getSubmissionItem().getItem().getBundles( STR); boolean fileAlreadyUploaded = false; if (!justUploaded) { for (Bundle bnd : bundles) { fileAlreadyUploaded = bnd.getBitstreams().length > 0; if (fileAlreadyUploaded) { break; } } } if (justUploaded fileAlreadyUploaded) { showUploadFileList(context, request, response, subInfo, justUploaded, false); } else { showChooseFile(context, request, response, subInfo); } } | /**
* Display the appropriate upload page in the file upload sequence. Which
* page this is depends on whether the user has uploaded any files in this
* item already.
*
* @param context
* the DSpace context object
* @param request
* the request object
* @param response
* the response object
* @param subInfo
* the SubmissionInfo object
* @param justUploaded
* true, if the user just finished uploading a file
*/ | Display the appropriate upload page in the file upload sequence. Which page this is depends on whether the user has uploaded any files in this item already | showUploadPage | {
"repo_name": "jamie-dryad/dryad-repo",
"path": "dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/submit/step/JSPUploadStep.java",
"license": "bsd-3-clause",
"size": 21453
} | [
"java.io.IOException",
"java.sql.SQLException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.dspace.app.util.SubmissionInfo",
"org.dspace.content.Bundle",
"org.dspace.core.Context"
] | import java.io.IOException; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.dspace.app.util.SubmissionInfo; import org.dspace.content.Bundle; import org.dspace.core.Context; | import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import org.dspace.app.util.*; import org.dspace.content.*; import org.dspace.core.*; | [
"java.io",
"java.sql",
"javax.servlet",
"org.dspace.app",
"org.dspace.content",
"org.dspace.core"
] | java.io; java.sql; javax.servlet; org.dspace.app; org.dspace.content; org.dspace.core; | 2,000,579 |
public static int getInt(String key, int defaultValue) throws TableKeyNotDefinedException {
try {
return (int) table.getNumber(key);
} catch (NoSuchElementException ex) {
return defaultValue;
}
} | static int function(String key, int defaultValue) throws TableKeyNotDefinedException { try { return (int) table.getNumber(key); } catch (NoSuchElementException ex) { return defaultValue; } } | /**
* Returns the value at the specified key.
*
* @deprecated Use {@link #getNumber(java.lang.String, double) getNumber} instead
* @param key the key
* @param defaultValue the value returned if the key is undefined
* @return the value
* @throws TableKeyNotDefinedException if there is no value mapped to by the key
* @throws IllegalArgumentException if the value mapped to by the key is not an int
* @throws IllegalArgumentException if the key is null
*/ | Returns the value at the specified key | getInt | {
"repo_name": "multiplemonomials/FRC-Test",
"path": "src/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java",
"license": "gpl-3.0",
"size": 11517
} | [
"edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException",
"java.util.NoSuchElementException"
] | import edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException; import java.util.NoSuchElementException; | import edu.wpi.first.wpilibj.tables.*; import java.util.*; | [
"edu.wpi.first",
"java.util"
] | edu.wpi.first; java.util; | 2,501,689 |
private int getEntry() throws CalculetteException
{
final EditText printed = (EditText) rootView.findViewById(R.id.printed);
try
{
return Integer.valueOf(printed.getText().toString());
}
catch (NumberFormatException e)
{
throw new CalculetteException("Integer required");
}
} | int function() throws CalculetteException { final EditText printed = (EditText) rootView.findViewById(R.id.printed); try { return Integer.valueOf(printed.getText().toString()); } catch (NumberFormatException e) { throw new CalculetteException(STR); } } | /**
* Read the number composed by the user.
*
* @return int
* @throws CalculetteException if the value is not a positive integer
*/ | Read the number composed by the user | getEntry | {
"repo_name": "y-guillot/android-calc",
"path": "app/src/main/java/com/android/xcalebret/calculette/MainActivity.java",
"license": "gpl-3.0",
"size": 19848
} | [
"android.widget.EditText",
"com.android.xcalebret.calculette.model.CalculetteException"
] | import android.widget.EditText; import com.android.xcalebret.calculette.model.CalculetteException; | import android.widget.*; import com.android.xcalebret.calculette.model.*; | [
"android.widget",
"com.android.xcalebret"
] | android.widget; com.android.xcalebret; | 872,283 |
public NBTTagCompound readPlayerDataFromFile(EntityPlayerMP playerIn)
{
NBTTagCompound var2 = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound();
NBTTagCompound var3;
if (playerIn.getName().equals(this.mcServer.getServerOwner()) && var2 != null)
{
playerIn.readFromNBT(var2);
var3 = var2;
logger.debug("loading single player");
}
else
{
var3 = this.playerNBTManagerObj.readPlayerData(playerIn);
}
return var3;
} | NBTTagCompound function(EntityPlayerMP playerIn) { NBTTagCompound var2 = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); NBTTagCompound var3; if (playerIn.getName().equals(this.mcServer.getServerOwner()) && var2 != null) { playerIn.readFromNBT(var2); var3 = var2; logger.debug(STR); } else { var3 = this.playerNBTManagerObj.readPlayerData(playerIn); } return var3; } | /**
* called during player login. reads the player information from disk.
*/ | called during player login. reads the player information from disk | readPlayerDataFromFile | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/server/management/ServerConfigurationManager.java",
"license": "mit",
"size": 39517
} | [
"net.minecraft.entity.player.EntityPlayerMP",
"net.minecraft.nbt.NBTTagCompound"
] | import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; | import net.minecraft.entity.player.*; import net.minecraft.nbt.*; | [
"net.minecraft.entity",
"net.minecraft.nbt"
] | net.minecraft.entity; net.minecraft.nbt; | 1,973,084 |
public void configure(@SuppressWarnings("rawtypes") Map stormConf,
JsonNode filterParams) {
} | void function(@SuppressWarnings(STR) Map stormConf, JsonNode filterParams) { } | /**
* Called when this filter is being initialized
*
* @param stormConf
* The Storm configuration used for the parsing bolt
* @param filterParams
* the filter specific configuration. Never null
*/ | Called when this filter is being initialized | configure | {
"repo_name": "jonathanstiansen/storm-crawler",
"path": "core/src/main/java/com/digitalpebble/storm/crawler/parse/ParseFilter.java",
"license": "apache-2.0",
"size": 2455
} | [
"com.fasterxml.jackson.databind.JsonNode",
"java.util.Map"
] | import com.fasterxml.jackson.databind.JsonNode; import java.util.Map; | import com.fasterxml.jackson.databind.*; import java.util.*; | [
"com.fasterxml.jackson",
"java.util"
] | com.fasterxml.jackson; java.util; | 1,856,790 |
public List<MicrosoftGraphTokenLifetimePolicyInner> value() {
return this.value;
} | List<MicrosoftGraphTokenLifetimePolicyInner> function() { return this.value; } | /**
* Get the value property: The value property.
*
* @return the value value.
*/ | Get the value property: The value property | value | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/CollectionOfTokenLifetimePolicy0.java",
"license": "mit",
"size": 3569
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,093,218 |
public static QueryResult createSuccessQueryResult(ResultSet resultSet, String catalog) {
QueryResult result = new QueryResult(resultSet);
result.setCurrentCatalog(catalog);
return result;
} | static QueryResult function(ResultSet resultSet, String catalog) { QueryResult result = new QueryResult(resultSet); result.setCurrentCatalog(catalog); return result; } | /**
* Create a successful query result.
*
* @param resultSet The associated {@link com.stratio.meta.common.data.ResultSet}.
* @param catalog The new session catalog.
* @return A {@link com.stratio.meta.common.result.QueryResult}.
*/ | Create a successful query result | createSuccessQueryResult | {
"repo_name": "dhiguero/stratio-meta",
"path": "meta-common/src/main/java/com/stratio/meta/common/result/QueryResult.java",
"license": "gpl-3.0",
"size": 3667
} | [
"com.stratio.meta.common.data.ResultSet"
] | import com.stratio.meta.common.data.ResultSet; | import com.stratio.meta.common.data.*; | [
"com.stratio.meta"
] | com.stratio.meta; | 2,694,669 |
public double getCategoryStart(int category, int categoryCount,
RectShape area, RectangleEdge edge) {
double result = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
result = area.getX() + area.getWidth() * getLowerMargin();
} else if ((edge == RectangleEdge.LEFT)
|| (edge == RectangleEdge.RIGHT)) {
result = area.getMinY() + area.getHeight() * getLowerMargin();
}
double categorySize = calculateCategorySize(categoryCount, area, edge);
double categoryGapWidth = calculateCategoryGapSize(categoryCount, area,
edge);
result = result + category * (categorySize + categoryGapWidth);
return result;
} | double function(int category, int categoryCount, RectShape area, RectangleEdge edge) { double result = 0.0; if ((edge == RectangleEdge.TOP) (edge == RectangleEdge.BOTTOM)) { result = area.getX() + area.getWidth() * getLowerMargin(); } else if ((edge == RectangleEdge.LEFT) (edge == RectangleEdge.RIGHT)) { result = area.getMinY() + area.getHeight() * getLowerMargin(); } double categorySize = calculateCategorySize(categoryCount, area, edge); double categoryGapWidth = calculateCategoryGapSize(categoryCount, area, edge); result = result + category * (categorySize + categoryGapWidth); return result; } | /**
* Returns the starting coordinate for the specified category.
*
* @param category
* the category.
* @param categoryCount
* the number of categories.
* @param area
* the data area.
* @param edge
* the axis location.
*
* @return The coordinate.
*
* @see #getCategoryMiddle(int, int, RectShape, RectangleEdge)
* @see #getCategoryEnd(int, int, RectShape, RectangleEdge)
*/ | Returns the starting coordinate for the specified category | getCategoryStart | {
"repo_name": "djun100/afreechart",
"path": "src/org/afree/chart/axis/CategoryAxis.java",
"license": "lgpl-3.0",
"size": 50274
} | [
"org.afree.graphics.geom.RectShape",
"org.afree.ui.RectangleEdge"
] | import org.afree.graphics.geom.RectShape; import org.afree.ui.RectangleEdge; | import org.afree.graphics.geom.*; import org.afree.ui.*; | [
"org.afree.graphics",
"org.afree.ui"
] | org.afree.graphics; org.afree.ui; | 180,340 |
public Comparable getKey(int index) {
Comparable result = null;
if (index < 0 || index >= getItemCount()) {
// this includes the case where the underlying dataset is null
throw new IndexOutOfBoundsException("Invalid 'index': " + index);
}
if (this.extract == TableOrder.BY_ROW) {
result = this.source.getColumnKey(index);
}
else if (this.extract == TableOrder.BY_COLUMN) {
result = this.source.getRowKey(index);
}
return result;
} | Comparable function(int index) { Comparable result = null; if (index < 0 index >= getItemCount()) { throw new IndexOutOfBoundsException(STR + index); } if (this.extract == TableOrder.BY_ROW) { result = this.source.getColumnKey(index); } else if (this.extract == TableOrder.BY_COLUMN) { result = this.source.getRowKey(index); } return result; } | /**
* Returns the key at the specified index.
*
* @param index the item index (in the range <code>0</code> to
* <code>getItemCount() - 1</code>).
*
* @return The key.
*
* @throws IndexOutOfBoundsException if <code>index</code> is not in the
* specified range.
*/ | Returns the key at the specified index | getKey | {
"repo_name": "opensim-org/opensim-gui",
"path": "Gui/opensim/jfreechart/src/org/jfree/data/category/CategoryToPieDataset.java",
"license": "apache-2.0",
"size": 10746
} | [
"org.jfree.util.TableOrder"
] | import org.jfree.util.TableOrder; | import org.jfree.util.*; | [
"org.jfree.util"
] | org.jfree.util; | 240,219 |
public File getProgramExecutablePath() {
return getProgramExecutablePathFrom(getDistributionRootPath());
} | File function() { return getProgramExecutablePathFrom(getDistributionRootPath()); } | /**
* Produces a file to the executable which starts the program.
*/ | Produces a file to the executable which starts the program | getProgramExecutablePath | {
"repo_name": "nwaldispuehl/interval-music-compositor",
"path": "intervalmusiccompositor.commons/src/main/java/ch/retorte/intervalmusiccompositor/commons/platform/Platform.java",
"license": "gpl-3.0",
"size": 9076
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 793,881 |
public String getSourceType() {
return "File";
} | String function() { return "File"; } | /**
* Get the source type (file, database...)
* @return The type of source
*/ | Get the source type (file, database...) | getSourceType | {
"repo_name": "GenomicParisCentre/nividic",
"path": "src/main/java/fr/ens/transcriptome/nividic/om/datasources/FileDataSource.java",
"license": "lgpl-2.1",
"size": 3423
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,115,289 |
public static void appendFileNewBlock(DistributedFileSystem fs,
Path p, int length) throws IOException {
assert length >= 0;
byte[] toAppend = new byte[length];
Random random = new Random();
random.nextBytes(toAppend);
appendFileNewBlock(fs, p, toAppend);
} | static void function(DistributedFileSystem fs, Path p, int length) throws IOException { assert length >= 0; byte[] toAppend = new byte[length]; Random random = new Random(); random.nextBytes(toAppend); appendFileNewBlock(fs, p, toAppend); } | /**
* Append specified length of bytes to a given file, starting with new block.
* @param fs The file system
* @param p Path of the file to append
* @param length Length of bytes to append to the file
* @throws IOException
*/ | Append specified length of bytes to a given file, starting with new block | appendFileNewBlock | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java",
"license": "apache-2.0",
"size": 99459
} | [
"java.io.IOException",
"java.util.Random",
"org.apache.hadoop.fs.Path"
] | import java.io.IOException; import java.util.Random; import org.apache.hadoop.fs.Path; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 949,097 |
public static void runJobInTransactionWithTimeout(KeycloakSessionFactory factory, KeycloakSessionTask task, int timeoutInSeconds) {
JtaTransactionManagerLookup lookup = (JtaTransactionManagerLookup)factory.getProviderFactory(JtaTransactionManagerLookup.class);
try {
if (lookup != null) {
if (lookup.getTransactionManager() != null) {
try {
lookup.getTransactionManager().setTransactionTimeout(timeoutInSeconds);
} catch (SystemException e) {
throw new RuntimeException(e);
}
}
}
runJobInTransaction(factory, task);
} finally {
if (lookup != null) {
if (lookup.getTransactionManager() != null) {
try {
// Reset to default transaction timeout
lookup.getTransactionManager().setTransactionTimeout(0);
} catch (SystemException e) {
// Shouldn't happen for Wildfly transaction manager
throw new RuntimeException(e);
}
}
}
}
} | static void function(KeycloakSessionFactory factory, KeycloakSessionTask task, int timeoutInSeconds) { JtaTransactionManagerLookup lookup = (JtaTransactionManagerLookup)factory.getProviderFactory(JtaTransactionManagerLookup.class); try { if (lookup != null) { if (lookup.getTransactionManager() != null) { try { lookup.getTransactionManager().setTransactionTimeout(timeoutInSeconds); } catch (SystemException e) { throw new RuntimeException(e); } } } runJobInTransaction(factory, task); } finally { if (lookup != null) { if (lookup.getTransactionManager() != null) { try { lookup.getTransactionManager().setTransactionTimeout(0); } catch (SystemException e) { throw new RuntimeException(e); } } } } } | /**
* Wrap given runnable job into KeycloakTransaction. Set custom timeout for the JTA transaction (in case we're in the environment with JTA enabled)
*
* @param factory
* @param task
* @param timeoutInSeconds
*/ | Wrap given runnable job into KeycloakTransaction. Set custom timeout for the JTA transaction (in case we're in the environment with JTA enabled) | runJobInTransactionWithTimeout | {
"repo_name": "vmuzikar/keycloak",
"path": "server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java",
"license": "apache-2.0",
"size": 29889
} | [
"javax.transaction.SystemException",
"org.keycloak.models.KeycloakSessionFactory",
"org.keycloak.models.KeycloakSessionTask",
"org.keycloak.transaction.JtaTransactionManagerLookup"
] | import javax.transaction.SystemException; import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.KeycloakSessionTask; import org.keycloak.transaction.JtaTransactionManagerLookup; | import javax.transaction.*; import org.keycloak.models.*; import org.keycloak.transaction.*; | [
"javax.transaction",
"org.keycloak.models",
"org.keycloak.transaction"
] | javax.transaction; org.keycloak.models; org.keycloak.transaction; | 2,219,105 |
private FactoryDto injectLinks(FactoryDto factory, Set<FactoryImage> images) {
String username = null;
if (factory.getCreator() != null && factory.getCreator().getUserId() != null) {
try {
username = userManager.getById(factory.getCreator().getUserId()).getName();
} catch (ApiException ignored) {
// when impossible to get username then named factory link won't be injected
}
}
return factory.withLinks(images != null && !images.isEmpty()
? createLinks(factory, images, getServiceContext(), username)
: createLinks(factory, getServiceContext(), username));
} | FactoryDto function(FactoryDto factory, Set<FactoryImage> images) { String username = null; if (factory.getCreator() != null && factory.getCreator().getUserId() != null) { try { username = userManager.getById(factory.getCreator().getUserId()).getName(); } catch (ApiException ignored) { } } return factory.withLinks(images != null && !images.isEmpty() ? createLinks(factory, images, getServiceContext(), username) : createLinks(factory, getServiceContext(), username)); } | /**
* Injects factory links. If factory is named then accept named link will be injected,
* if {@code images} is not null and not empty then image links will be injected
*/ | Injects factory links. If factory is named then accept named link will be injected, if images is not null and not empty then image links will be injected | injectLinks | {
"repo_name": "sunix/che",
"path": "wsmaster/che-core-api-factory/src/main/java/org/eclipse/che/api/factory/server/FactoryService.java",
"license": "epl-1.0",
"size": 33072
} | [
"java.util.Set",
"org.eclipse.che.api.core.ApiException",
"org.eclipse.che.api.factory.server.FactoryLinksHelper",
"org.eclipse.che.api.factory.shared.dto.FactoryDto"
] | import java.util.Set; import org.eclipse.che.api.core.ApiException; import org.eclipse.che.api.factory.server.FactoryLinksHelper; import org.eclipse.che.api.factory.shared.dto.FactoryDto; | import java.util.*; import org.eclipse.che.api.core.*; import org.eclipse.che.api.factory.server.*; import org.eclipse.che.api.factory.shared.dto.*; | [
"java.util",
"org.eclipse.che"
] | java.util; org.eclipse.che; | 39,405 |
public ArrayList<Concept> getModalityConcept() {
ArrayList<Concept> modalityConcept = new ArrayList();
List<ConceptSet> modalityConceptSet = Context.getConceptService()
.getConceptSetsByConcept(Context.getConceptService()
.getConcept(162826));
for (ConceptSet addModalityConceptSet : modalityConceptSet) {
Concept modalityConceptName = addModalityConceptSet.getConcept();
modalityConcept.add(modalityConceptName);
}
return modalityConcept;
}
| ArrayList<Concept> function() { ArrayList<Concept> modalityConcept = new ArrayList(); List<ConceptSet> modalityConceptSet = Context.getConceptService() .getConceptSetsByConcept(Context.getConceptService() .getConcept(162826)); for (ConceptSet addModalityConceptSet : modalityConceptSet) { Concept modalityConceptName = addModalityConceptSet.getConcept(); modalityConcept.add(modalityConceptName); } return modalityConcept; } | /**
* Get modality concept from concept dictionary
*
* @return modality concept
*/ | Get modality concept from concept dictionary | getModalityConcept | {
"repo_name": "WangchukSFSU/Radiology",
"path": "omod/src/main/java/org/openmrs/module/radiology/fragment/controller/CreateViewRadiologyOrderFragmentController.java",
"license": "mpl-2.0",
"size": 20460
} | [
"java.util.ArrayList",
"java.util.List",
"org.openmrs.Concept",
"org.openmrs.ConceptSet",
"org.openmrs.api.context.Context"
] | import java.util.ArrayList; import java.util.List; import org.openmrs.Concept; import org.openmrs.ConceptSet; import org.openmrs.api.context.Context; | import java.util.*; import org.openmrs.*; import org.openmrs.api.context.*; | [
"java.util",
"org.openmrs",
"org.openmrs.api"
] | java.util; org.openmrs; org.openmrs.api; | 992,095 |
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
final InterMineAPI im = SessionMethods.getInterMineAPI(request.getSession());
Profile profile = SessionMethods.getProfile(session);
StringWriter sw = new StringWriter();
XMLOutputFactory factory = XMLOutputFactory.newInstance();
XMLStreamWriter writer = factory.createXMLStreamWriter(sw);
writer.writeStartElement("tags");
List<Tag> tags = im.getTagManager().getUserTags(profile.getUsername());
for (Tag tag : tags) {
TagBinding.marshal(tag, writer);
}
writer.writeEndElement();
writer.close();
response.setContentType("text/plain");
response.setHeader("Content-Disposition ", "inline; filename=tags.xml");
response.getWriter().print(XmlUtil.indentXmlSimple(sw.getBuffer().toString()));
return null;
} | ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); final InterMineAPI im = SessionMethods.getInterMineAPI(request.getSession()); Profile profile = SessionMethods.getProfile(session); StringWriter sw = new StringWriter(); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(sw); writer.writeStartElement("tags"); List<Tag> tags = im.getTagManager().getUserTags(profile.getUsername()); for (Tag tag : tags) { TagBinding.marshal(tag, writer); } writer.writeEndElement(); writer.close(); response.setContentType(STR); response.setHeader(STR, STR); response.getWriter().print(XmlUtil.indentXmlSimple(sw.getBuffer().toString())); return null; } | /**
* Export user's tags.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
* @return an ActionForward object defining where control goes next
*
* @exception Exception if the application business logic throws
* an exception
*/ | Export user's tags | execute | {
"repo_name": "joshkh/intermine",
"path": "intermine/web/main/src/org/intermine/web/struts/ExportTagsAction.java",
"license": "lgpl-2.1",
"size": 2735
} | [
"java.io.StringWriter",
"java.util.List",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.servlet.http.HttpSession",
"javax.xml.stream.XMLOutputFactory",
"javax.xml.stream.XMLStreamWriter",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.Act... | import java.io.StringWriter; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamWriter; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.intermine.api.InterMineAPI; import org.intermine.api.profile.Profile; import org.intermine.api.xml.TagBinding; import org.intermine.model.userprofile.Tag; import org.intermine.util.XmlUtil; import org.intermine.web.logic.session.SessionMethods; | import java.io.*; import java.util.*; import javax.servlet.http.*; import javax.xml.stream.*; import org.apache.struts.action.*; import org.intermine.api.*; import org.intermine.api.profile.*; import org.intermine.api.xml.*; import org.intermine.model.userprofile.*; import org.intermine.util.*; import org.intermine.web.logic.session.*; | [
"java.io",
"java.util",
"javax.servlet",
"javax.xml",
"org.apache.struts",
"org.intermine.api",
"org.intermine.model",
"org.intermine.util",
"org.intermine.web"
] | java.io; java.util; javax.servlet; javax.xml; org.apache.struts; org.intermine.api; org.intermine.model; org.intermine.util; org.intermine.web; | 558,257 |
private long getDisjunctionScan( BranchNode node ) throws Exception
{
List<ExprNode> children = node.getChildren();
long total = 0L;
for ( ExprNode child : children )
{
annotate( child );
total += ( Long ) child.get( "count" );
if ( total == Long.MAX_VALUE )
{
// We can stop here withoit evaluating the following filters
break;
}
}
return total;
} | long function( BranchNode node ) throws Exception { List<ExprNode> children = node.getChildren(); long total = 0L; for ( ExprNode child : children ) { annotate( child ); total += ( Long ) child.get( "count" ); if ( total == Long.MAX_VALUE ) { break; } } return total; } | /**
* Disjunctions (OR) are the union of candidates across all subexpressions
* so we add all the counts of the child nodes. Notice that we annotate the
* child node with a recursive call.
*
* @param node the OR branch node
* @return the scan count on the OR node
* @throws Exception if there is an error
*/ | Disjunctions (OR) are the union of candidates across all subexpressions so we add all the counts of the child nodes. Notice that we annotate the child node with a recursive call | getDisjunctionScan | {
"repo_name": "lucastheisen/apache-directory-server",
"path": "xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java",
"license": "apache-2.0",
"size": 17263
} | [
"java.util.List",
"org.apache.directory.api.ldap.model.filter.BranchNode",
"org.apache.directory.api.ldap.model.filter.ExprNode"
] | import java.util.List; import org.apache.directory.api.ldap.model.filter.BranchNode; import org.apache.directory.api.ldap.model.filter.ExprNode; | import java.util.*; import org.apache.directory.api.ldap.model.filter.*; | [
"java.util",
"org.apache.directory"
] | java.util; org.apache.directory; | 1,053,811 |
Optional<Vector3i> toWorld(int x, int y, int z); | Optional<Vector3i> toWorld(int x, int y, int z); | /**
* Converts chunk coordinates to world coordinates. Returns nothing if the
* conversion failed because the given chunk coordinates aren't valid.
*
* @param x The x chunk coordinate to convert to world coordinates
* @param y The y chunk coordinate to convert to world coordinates
* @param z The z chunk coordinate to convert to world coordinates
* @return The world coordinates on success, else nothing
*/ | Converts chunk coordinates to world coordinates. Returns nothing if the conversion failed because the given chunk coordinates aren't valid | toWorld | {
"repo_name": "gabizou/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/storage/ChunkLayout.java",
"license": "mit",
"size": 11068
} | [
"com.flowpowered.math.vector.Vector3i",
"com.google.common.base.Optional"
] | import com.flowpowered.math.vector.Vector3i; import com.google.common.base.Optional; | import com.flowpowered.math.vector.*; import com.google.common.base.*; | [
"com.flowpowered.math",
"com.google.common"
] | com.flowpowered.math; com.google.common; | 937,167 |
public static void cleanDirectory(File directory) throws IOException {
if (!directory.exists()) {
String message = directory + " does not exist";
throw new IllegalArgumentException(message);
}
if (!directory.isDirectory()) {
String message = directory + " is not a directory";
throw new IllegalArgumentException(message);
}
File[] files = directory.listFiles();
if (files == null) { // null if security restricted
throw new IOException("Failed to list contents of " + directory);
}
IOException exception = null;
for (File file : files) {
try {
forceDelete(file);
} catch (IOException ioe) {
exception = ioe;
}
}
if (null != exception) {
throw exception;
}
} | static void function(File directory) throws IOException { if (!directory.exists()) { String message = directory + STR; throw new IllegalArgumentException(message); } if (!directory.isDirectory()) { String message = directory + STR; throw new IllegalArgumentException(message); } File[] files = directory.listFiles(); if (files == null) { throw new IOException(STR + directory); } IOException exception = null; for (File file : files) { try { forceDelete(file); } catch (IOException ioe) { exception = ioe; } } if (null != exception) { throw exception; } } | /**
* Cleans a directory without deleting it.
*
* @param directory directory to clean
* @throws IOException in case cleaning is unsuccessful
*/ | Cleans a directory without deleting it | cleanDirectory | {
"repo_name": "copyliu/Spoutcraft_CJKPatch",
"path": "src/minecraft/org/apache/commons/io/FileUtils.java",
"license": "lgpl-3.0",
"size": 83439
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,591,933 |
private void adjustLeft(RectF rect, float left, RectF bounds, float snapMargin, float aspectRatio, boolean topMoves, boolean bottomMoves) {
float newLeft = left;
if (newLeft < 0) {
newLeft /= 1.05f;
mTouchOffset.x -= newLeft / 1.1f;
}
if (newLeft < bounds.left) {
mTouchOffset.x -= (newLeft - bounds.left) / 2f;
}
if (newLeft - bounds.left < snapMargin) {
newLeft = bounds.left;
}
// Checks if the window is too small horizontally
if (rect.right - newLeft < mMinCropWidth) {
newLeft = rect.right - mMinCropWidth;
}
// Checks if the window is too large horizontally
if (rect.right - newLeft > mMaxCropWidth) {
newLeft = rect.right - mMaxCropWidth;
}
if (newLeft - bounds.left < snapMargin) {
newLeft = bounds.left;
}
// check vertical bounds if aspect ratio is in play
if (aspectRatio > 0) {
float newHeight = (rect.right - newLeft) / aspectRatio;
// Checks if the window is too small vertically
if (newHeight < mMinCropHeight) {
newLeft = Math.max(bounds.left, rect.right - mMinCropHeight * aspectRatio);
newHeight = (rect.right - newLeft) / aspectRatio;
}
// Checks if the window is too large vertically
if (newHeight > mMaxCropHeight) {
newLeft = Math.max(bounds.left, rect.right - mMaxCropHeight * aspectRatio);
newHeight = (rect.right - newLeft) / aspectRatio;
}
// if top AND bottom edge moves by aspect ratio check that it is within full height bounds
if (topMoves && bottomMoves) {
newLeft = Math.max(newLeft, Math.max(bounds.left, rect.right - bounds.height() * aspectRatio));
} else {
// if top edge moves by aspect ratio check that it is within bounds
if (topMoves && rect.bottom - newHeight < bounds.top) {
newLeft = Math.max(bounds.left, rect.right - (rect.bottom - bounds.top) * aspectRatio);
newHeight = (rect.right - newLeft) / aspectRatio;
}
// if bottom edge moves by aspect ratio check that it is within bounds
if (bottomMoves && rect.top + newHeight > bounds.bottom) {
newLeft = Math.max(newLeft, Math.max(bounds.left, rect.right - (bounds.bottom - rect.top) * aspectRatio));
}
}
}
rect.left = newLeft;
} | void function(RectF rect, float left, RectF bounds, float snapMargin, float aspectRatio, boolean topMoves, boolean bottomMoves) { float newLeft = left; if (newLeft < 0) { newLeft /= 1.05f; mTouchOffset.x -= newLeft / 1.1f; } if (newLeft < bounds.left) { mTouchOffset.x -= (newLeft - bounds.left) / 2f; } if (newLeft - bounds.left < snapMargin) { newLeft = bounds.left; } if (rect.right - newLeft < mMinCropWidth) { newLeft = rect.right - mMinCropWidth; } if (rect.right - newLeft > mMaxCropWidth) { newLeft = rect.right - mMaxCropWidth; } if (newLeft - bounds.left < snapMargin) { newLeft = bounds.left; } if (aspectRatio > 0) { float newHeight = (rect.right - newLeft) / aspectRatio; if (newHeight < mMinCropHeight) { newLeft = Math.max(bounds.left, rect.right - mMinCropHeight * aspectRatio); newHeight = (rect.right - newLeft) / aspectRatio; } if (newHeight > mMaxCropHeight) { newLeft = Math.max(bounds.left, rect.right - mMaxCropHeight * aspectRatio); newHeight = (rect.right - newLeft) / aspectRatio; } if (topMoves && bottomMoves) { newLeft = Math.max(newLeft, Math.max(bounds.left, rect.right - bounds.height() * aspectRatio)); } else { if (topMoves && rect.bottom - newHeight < bounds.top) { newLeft = Math.max(bounds.left, rect.right - (rect.bottom - bounds.top) * aspectRatio); newHeight = (rect.right - newLeft) / aspectRatio; } if (bottomMoves && rect.top + newHeight > bounds.bottom) { newLeft = Math.max(newLeft, Math.max(bounds.left, rect.right - (bounds.bottom - rect.top) * aspectRatio)); } } } rect.left = newLeft; } | /**
* Get the resulting x-position of the left edge of the crop window given
* the handle's position and the image's bounding box and snap radius.
*
* @param left the position that the left edge is dragged to
* @param bounds the bounding box of the image that is being cropped
* @param snapMargin the snap distance to the image edge (in pixels)
*/ | Get the resulting x-position of the left edge of the crop window given the handle's position and the image's bounding box and snap radius | adjustLeft | {
"repo_name": "anuj7sharma/ImagePicker",
"path": "app/src/main/java/com/imagepicker/cropper/CropWindowMoveHandler.java",
"license": "apache-2.0",
"size": 29072
} | [
"android.graphics.RectF"
] | import android.graphics.RectF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,507,844 |
public void removeChangeListener(ChangeListener pChangeListener) {
changeListeners.remove(pChangeListener);
} | void function(ChangeListener pChangeListener) { changeListeners.remove(pChangeListener); } | /**
* Removes a change listener.
*
* @param pChangeListener
* The change listener to remove.
*/ | Removes a change listener | removeChangeListener | {
"repo_name": "lperilla/jmeter-utilities",
"path": "src/main/java/com/lperilla/jmeter/plugin/gui/component/JLabeledTextField.java",
"license": "apache-2.0",
"size": 6851
} | [
"javax.swing.event.ChangeListener"
] | import javax.swing.event.ChangeListener; | import javax.swing.event.*; | [
"javax.swing"
] | javax.swing; | 1,290,937 |
public Application load(HeliumPackage packageInfo, ApplicationContext context)
throws Exception {
if (packageInfo.getType() != HeliumType.APPLICATION) {
throw new ApplicationException(
"Can't instantiate " + packageInfo.getType() + " package using ApplicationLoader");
}
// check if already loaded
RunningApplication key =
new RunningApplication(packageInfo, context.getNoteId(), context.getParagraphId());
// get resource required by this package
ResourceSet resources = findRequiredResourceSet(packageInfo.getResources(),
context.getNoteId(), context.getParagraphId());
// load class
Class<Application> appClass = loadClass(packageInfo);
// instantiate
ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
ClassLoader cl = appClass.getClassLoader();
Thread.currentThread().setContextClassLoader(cl);
try {
Constructor<Application> constructor = appClass.getConstructor(ApplicationContext.class);
Application app = new ClassLoaderApplication(constructor.newInstance(context), cl);
return app;
} catch (Exception e) {
throw new ApplicationException(e);
} finally {
Thread.currentThread().setContextClassLoader(oldcl);
}
} | Application function(HeliumPackage packageInfo, ApplicationContext context) throws Exception { if (packageInfo.getType() != HeliumType.APPLICATION) { throw new ApplicationException( STR + packageInfo.getType() + STR); } RunningApplication key = new RunningApplication(packageInfo, context.getNoteId(), context.getParagraphId()); ResourceSet resources = findRequiredResourceSet(packageInfo.getResources(), context.getNoteId(), context.getParagraphId()); Class<Application> appClass = loadClass(packageInfo); ClassLoader oldcl = Thread.currentThread().getContextClassLoader(); ClassLoader cl = appClass.getClassLoader(); Thread.currentThread().setContextClassLoader(cl); try { Constructor<Application> constructor = appClass.getConstructor(ApplicationContext.class); Application app = new ClassLoaderApplication(constructor.newInstance(context), cl); return app; } catch (Exception e) { throw new ApplicationException(e); } finally { Thread.currentThread().setContextClassLoader(oldcl); } } | /**
*
* Instantiate application
*
* @param packageInfo
* @param context
* @return
* @throws Exception
*/ | Instantiate application | load | {
"repo_name": "r-kamath/incubator-zeppelin",
"path": "zeppelin-interpreter/src/main/java/org/apache/zeppelin/helium/ApplicationLoader.java",
"license": "apache-2.0",
"size": 7019
} | [
"java.lang.reflect.Constructor",
"org.apache.zeppelin.resource.ResourceSet"
] | import java.lang.reflect.Constructor; import org.apache.zeppelin.resource.ResourceSet; | import java.lang.reflect.*; import org.apache.zeppelin.resource.*; | [
"java.lang",
"org.apache.zeppelin"
] | java.lang; org.apache.zeppelin; | 701,374 |
public Publisher createPublisher(String name, PublisherQoS qos) throws CMException; | Publisher function(String name, PublisherQoS qos) throws CMException; | /**
* Creates a new Publisher for this Participant.
*
* @param name The name of the Publisher.
* @param qos The QoS policies for the Publisher.
* @return The newly created Publisher.
* @throws CMException Thrown when:
* - C&M API not initialized.
* - Participant is not available.
* - Supplied parameters not correct.
* - Communication with SPLICE failed.
*/ | Creates a new Publisher for this Participant | createPublisher | {
"repo_name": "SanderMertens/opensplice",
"path": "src/api/cm/java/code/org/opensplice/cm/Participant.java",
"license": "gpl-3.0",
"size": 6799
} | [
"org.opensplice.cm.qos.PublisherQoS"
] | import org.opensplice.cm.qos.PublisherQoS; | import org.opensplice.cm.qos.*; | [
"org.opensplice.cm"
] | org.opensplice.cm; | 201,806 |
public static List<String> readStringSubKeys(int hkey, String key)
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException
{
if (hkey == HKEY_LOCAL_MACHINE) {
return readStringSubKeys(systemRoot, hkey, key);
}
else if (hkey == HKEY_CURRENT_USER) {
return readStringSubKeys(userRoot, hkey, key);
}
else {
throw new IllegalArgumentException("hkey=" + hkey);
}
} | static List<String> function(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { if (hkey == HKEY_LOCAL_MACHINE) { return readStringSubKeys(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { return readStringSubKeys(userRoot, hkey, key); } else { throw new IllegalArgumentException("hkey=" + hkey); } } | /**
* Read the value name(s) from a given key
* @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE
* @param key
* @return the value name(s)
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InvocationTargetException
*/ | Read the value name(s) from a given key | readStringSubKeys | {
"repo_name": "ostap0207/remotify.me",
"path": "remotify.client/src/main/java/remotify/client/dependable/windows/WinRegistry.java",
"license": "apache-2.0",
"size": 14914
} | [
"java.lang.reflect.InvocationTargetException",
"java.util.List"
] | import java.lang.reflect.InvocationTargetException; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,690,937 |
public Map<String, DateTime> getDateTimeInvalidChars() {
return getDateTimeInvalidCharsWithServiceResponseAsync().toBlocking().single().body();
} | Map<String, DateTime> function() { return getDateTimeInvalidCharsWithServiceResponseAsync().toBlocking().single().body(); } | /**
* Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the Map<String, DateTime> object if successful.
*/ | Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"} | getDateTimeInvalidChars | {
"repo_name": "balajikris/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java",
"license": "mit",
"size": 243390
} | [
"java.util.Map",
"org.joda.time.DateTime"
] | import java.util.Map; import org.joda.time.DateTime; | import java.util.*; import org.joda.time.*; | [
"java.util",
"org.joda.time"
] | java.util; org.joda.time; | 1,317,436 |
public void setPixels(int x, int y, int w, int h,
ColorModel model, int pixels[], int off,
int scan) {
int i,j,k;
int ir,jr;
if(ipixels == null) {
colorModel = model;
ipixels = new int[width*height];
}
j = y;
for(int n=0; n<h; n++, j++) {
i = x;
for(int m=0; m<w; m++, i++) {
ir = (int)Math.round( i*cos + j*sin) - xmin;
jr = (int)Math.round(-i*sin + j*cos) - ymin;
k = ir+jr*width;
ipixels[k] = pixels[ (j-y)*scan+(i-x)+off ];
}
}
}
| void function(int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scan) { int i,j,k; int ir,jr; if(ipixels == null) { colorModel = model; ipixels = new int[width*height]; } j = y; for(int n=0; n<h; n++, j++) { i = x; for(int m=0; m<w; m++, i++) { ir = (int)Math.round( i*cos + j*sin) - xmin; jr = (int)Math.round(-i*sin + j*cos) - ymin; k = ir+jr*width; ipixels[k] = pixels[ (j-y)*scan+(i-x)+off ]; } } } | /**
* As the pixels of the original image are sent store them in memory
* as the rotated image.
*
* This method is called with a subset rectangle of the original image.
*
* @param x position of Left column in original image of this rectangle
* @param y poisition of Top row in original image of this rectangle
* @param w width of this rectangle
* @param h height of this rectangle
* @param model Colormodel associated with original image
* @param pixels Array containing the image or part of it
* @param off The offset into the pixels array where the parsed
* rectangle starts
* @param scan The actual width of the image.
*/ | As the pixels of the original image are sent store them in memory as the rotated image. This method is called with a subset rectangle of the original image | setPixels | {
"repo_name": "chuckre/DigitalPopulations",
"path": "PopulationRealizer/Graph2D/src/graph/RTextLine.java",
"license": "apache-2.0",
"size": 23965
} | [
"java.awt.image.ColorModel"
] | import java.awt.image.ColorModel; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 998,850 |
public T get(Preferences prefs) {
return get(prefs, this.defaultValue);
} | T function(Preferences prefs) { return get(prefs, this.defaultValue); } | /**
* Gets this instance's preference value.
*
* @param prefs the {@linkplain Preferences} object to get the value from.
* @return the retrieved preference value.
*/ | Gets this instance's preference value | get | {
"repo_name": "hdecarne/java-default",
"path": "src/main/java/de/carne/util/prefs/Preference.java",
"license": "gpl-3.0",
"size": 2661
} | [
"java.util.prefs.Preferences"
] | import java.util.prefs.Preferences; | import java.util.prefs.*; | [
"java.util"
] | java.util; | 876,682 |
public void setStatusListener(StatusPanel _status){
status = _status;
} | void function(StatusPanel _status){ status = _status; } | /**
* Stores the supplied object that will receive validation and assigment
* information from now.
*
* @param _status The component that will receive the information.
*/ | Stores the supplied object that will receive validation and assigment information from now | setStatusListener | {
"repo_name": "SanderMertens/opensplice",
"path": "src/tools/cm/common/code/org/opensplice/common/controller/UserDataEditTableEditor.java",
"license": "gpl-3.0",
"size": 28160
} | [
"org.opensplice.common.view.StatusPanel"
] | import org.opensplice.common.view.StatusPanel; | import org.opensplice.common.view.*; | [
"org.opensplice.common"
] | org.opensplice.common; | 706,230 |
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
| ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } | /**
* Checks connectivity to the internet.
*
* Note that the following must be in the manifest for this to work:
*
* <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
*
* @param context Any context.
* @return true if the internet is available.
*/ | Checks connectivity to the internet. Note that the following must be in the manifest for this to work: | isNetworkAvailable | {
"repo_name": "nelladragon/scab",
"path": "android/app/src/main/java/com/nelladragon/common/util/NetworkConnectionStatus.java",
"license": "apache-2.0",
"size": 937
} | [
"android.content.Context",
"android.net.ConnectivityManager",
"android.net.NetworkInfo"
] | import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; | import android.content.*; import android.net.*; | [
"android.content",
"android.net"
] | android.content; android.net; | 1,191,861 |
public static Boolean isLoggedIn(SlingScriptHelper sling) {
PokeGoApiService service = PokeGoApiServiceImpl.getInstance();
return service.getApi() != null;
} | static Boolean function(SlingScriptHelper sling) { PokeGoApiService service = PokeGoApiServiceImpl.getInstance(); return service.getApi() != null; } | /**
* Checks whether a user is logged into the Pokemon API.
* It will attempt to refresh the session if the API is present.
* @param sling
* @return
*/ | Checks whether a user is logged into the Pokemon API. It will attempt to refresh the session if the API is present | isLoggedIn | {
"repo_name": "mickleroy/aem-pokego-lure-client",
"path": "bundle/src/main/java/aem/pokego/lure/web/functions/HelperFunction.java",
"license": "mit",
"size": 1323
} | [
"org.apache.sling.api.scripting.SlingScriptHelper"
] | import org.apache.sling.api.scripting.SlingScriptHelper; | import org.apache.sling.api.scripting.*; | [
"org.apache.sling"
] | org.apache.sling; | 32,898 |
@Override // Closeable
public void close() throws IOException {
storage.close();
IOUtils.closeStream(committedTxnId);
IOUtils.closeStream(curSegment);
} | @Override void function() throws IOException { storage.close(); IOUtils.closeStream(committedTxnId); IOUtils.closeStream(curSegment); } | /**
* Unlock and release resources.
*/ | Unlock and release resources | close | {
"repo_name": "Ethanlm/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java",
"license": "apache-2.0",
"size": 41456
} | [
"java.io.IOException",
"org.apache.hadoop.io.IOUtils"
] | import java.io.IOException; import org.apache.hadoop.io.IOUtils; | import java.io.*; import org.apache.hadoop.io.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 811,155 |
public Amount<Long, Data> getDisk() {
return disk;
} | Amount<Long, Data> function() { return disk; } | /**
* Disk amount.
*
* @return Disk.
*/ | Disk amount | getDisk | {
"repo_name": "kidaa/aurora",
"path": "src/main/java/org/apache/aurora/scheduler/configuration/Resources.java",
"license": "apache-2.0",
"size": 13936
} | [
"com.twitter.common.quantity.Amount",
"com.twitter.common.quantity.Data"
] | import com.twitter.common.quantity.Amount; import com.twitter.common.quantity.Data; | import com.twitter.common.quantity.*; | [
"com.twitter.common"
] | com.twitter.common; | 2,022,350 |
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback); } | /**
* Deletes the specified subnet.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param subnetName The name of the subnet.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Deletes the specified subnet | deleteAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/SubnetsInner.java",
"license": "mit",
"size": 84300
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,011,078 |
public Set<Node> getChildren() {
return Collections.unmodifiableSet(children);
} | Set<Node> function() { return Collections.unmodifiableSet(children); } | /**
* Get an unmodifiable copy of the node's children.
* @return unmodifiable set of node children
*/ | Get an unmodifiable copy of the node's children | getChildren | {
"repo_name": "drhee/toxoMine",
"path": "intermine/pathquery/main/src/org/intermine/pathquery/LogicExpression.java",
"license": "lgpl-2.1",
"size": 20276
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 804,919 |
public static void setScheme(HttpMessage message, String scheme) {
message.headers().set(Names.SCHEME, scheme);
} | static void function(HttpMessage message, String scheme) { message.headers().set(Names.SCHEME, scheme); } | /**
* Sets the {@code "X-SPDY-Scheme"} header.
*/ | Sets the "X-SPDY-Scheme" header | setScheme | {
"repo_name": "KeyNexus/netty",
"path": "src/main/java/org/jboss/netty/handler/codec/spdy/SpdyHttpHeaders.java",
"license": "apache-2.0",
"size": 5252
} | [
"org.jboss.netty.handler.codec.http.HttpMessage"
] | import org.jboss.netty.handler.codec.http.HttpMessage; | import org.jboss.netty.handler.codec.http.*; | [
"org.jboss.netty"
] | org.jboss.netty; | 2,102,538 |
public static JSONObject newInstance(final Map<String, Object> map, final boolean includeSuperClass) {
JSONObject returns = new JSONObject(map);
if (map != null) {
final Iterator<Entry<String, Object>> i = map.entrySet().iterator();
while (i.hasNext()) {
final Entry<String, Object> e = i.next();
if (JSONObject.isStandardProperty(e.getValue().getClass())) {
returns.map.put(e.getKey(), e.getValue());
} else {
returns.map.put(e.getKey(), newInstance(e.getValue(), includeSuperClass));
}
}
}
return returns;
}
| static JSONObject function(final Map<String, Object> map, final boolean includeSuperClass) { JSONObject returns = new JSONObject(map); if (map != null) { final Iterator<Entry<String, Object>> i = map.entrySet().iterator(); while (i.hasNext()) { final Entry<String, Object> e = i.next(); if (JSONObject.isStandardProperty(e.getValue().getClass())) { returns.map.put(e.getKey(), e.getValue()); } else { returns.map.put(e.getKey(), newInstance(e.getValue(), includeSuperClass)); } } } return returns; } | /**
* Construct a JSONObject from a Map.
*
* Note: Use this constructor when the map contains <key,bean>.
*
* @param map - A map with Key-Bean data.
* @param includeSuperClass - Tell whether to include the super class properties.
*/ | Construct a JSONObject from a Map. Note: Use this constructor when the map contains | newInstance | {
"repo_name": "hongyan99/chart-faces",
"path": "chartfaces/src/main/java/org/javaq/chartfaces/json/JSONObject.java",
"license": "apache-2.0",
"size": 57094
} | [
"java.util.Iterator",
"java.util.Map"
] | import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,825,084 |
Integer insertAndReturnKey(ProjectNotificationSetting value); | Integer insertAndReturnKey(ProjectNotificationSetting value); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table m_prj_notifications
*
* @mbg.generated Sat Apr 20 17:20:23 CDT 2019
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_notifications | insertAndReturnKey | {
"repo_name": "aglne/mycollab",
"path": "mycollab-services/src/main/java/com/mycollab/module/project/dao/ProjectNotificationSettingMapper.java",
"license": "agpl-3.0",
"size": 4428
} | [
"com.mycollab.module.project.domain.ProjectNotificationSetting"
] | import com.mycollab.module.project.domain.ProjectNotificationSetting; | import com.mycollab.module.project.domain.*; | [
"com.mycollab.module"
] | com.mycollab.module; | 1,854,575 |
void getCanonName()
throws UnknownHostException
{
if (cname != null || invalid || untrusted) return;
// attempt to get the canonical name
try {
// first get the IP addresses if we don't have them yet
// this is because we need the IP address to then get
// FQDN.
if (addresses == null) {
getIP();
}
// we have to do this check, otherwise we might not
// get the fully qualified domain name
if (init_with_ip) {
cname = addresses[0].getHostName(false).toLowerCase();
} else {
cname = InetAddress.getByName(addresses[0].getHostAddress()).
getHostName(false).toLowerCase();
}
} catch (UnknownHostException uhe) {
invalid = true;
throw uhe;
}
}
private transient String cdomain, hdomain; | void getCanonName() throws UnknownHostException { if (cname != null invalid untrusted) return; try { if (addresses == null) { getIP(); } if (init_with_ip) { cname = addresses[0].getHostName(false).toLowerCase(); } else { cname = InetAddress.getByName(addresses[0].getHostAddress()). getHostName(false).toLowerCase(); } } catch (UnknownHostException uhe) { invalid = true; throw uhe; } } private transient String cdomain, hdomain; | /**
* attempt to get the fully qualified domain name
*
*/ | attempt to get the fully qualified domain name | getCanonName | {
"repo_name": "karianna/jdk8_tl",
"path": "jdk/src/share/classes/java/net/SocketPermission.java",
"license": "gpl-2.0",
"size": 47042
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 1,764,437 |
public GQuery setArray(NodeList<Element> list) {
if (list != null) {
nodeList.<JsCache>cast().clear();
int l = list.getLength();
elements = new Element[l];
for (int i = 0; i < l; i++) {
elements[i] = list.getItem(i);
nodeList.<JsObjectArray<Element>>cast().add(list.getItem(i));
}
}
return this;
} | GQuery function(NodeList<Element> list) { if (list != null) { nodeList.<JsCache>cast().clear(); int l = list.getLength(); elements = new Element[l]; for (int i = 0; i < l; i++) { elements[i] = list.getItem(i); nodeList.<JsObjectArray<Element>>cast().add(list.getItem(i)); } } return this; } | /**
* Force the current matched set of elements to become the specified array of elements.
*/ | Force the current matched set of elements to become the specified array of elements | setArray | {
"repo_name": "stori-es/stori_es",
"path": "dashboard/src/main/java/com/google/gwt/query/client/GQuery.java",
"license": "apache-2.0",
"size": 177285
} | [
"com.google.gwt.dom.client.Element",
"com.google.gwt.dom.client.NodeList",
"com.google.gwt.query.client.js.JsCache",
"com.google.gwt.query.client.js.JsObjectArray"
] | import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NodeList; import com.google.gwt.query.client.js.JsCache; import com.google.gwt.query.client.js.JsObjectArray; | import com.google.gwt.dom.client.*; import com.google.gwt.query.client.js.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,364,359 |
public void openInputWindow(String text, String defaul, Consumer<String> done)
{
this.done = done;
clientThread.invokeLater(() -> client.runScript(
ScriptID.RUNELITE_CHATBOX_INPUT_INIT,
text,
defaul
));
} | void function(String text, String defaul, Consumer<String> done) { this.done = done; clientThread.invokeLater(() -> client.runScript( ScriptID.RUNELITE_CHATBOX_INPUT_INIT, text, defaul )); } | /**
* Opens a RuneScape-style chatbox input
*
* @param text Text to show at the top of the window
* @param defaul Default text in the editable field
* @param done Callback when the text box has been exited, called with "" on esc
*/ | Opens a RuneScape-style chatbox input | openInputWindow | {
"repo_name": "UniquePassive/runelite",
"path": "runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java",
"license": "bsd-2-clause",
"size": 3654
} | [
"java.util.function.Consumer",
"net.runelite.api.ScriptID"
] | import java.util.function.Consumer; import net.runelite.api.ScriptID; | import java.util.function.*; import net.runelite.api.*; | [
"java.util",
"net.runelite.api"
] | java.util; net.runelite.api; | 759,825 |
protected boolean localInvalidate() {
long nextKey = sc.incrementAndRead(InitImageBB.LASTKEY_LOCAL_INVALIDATE);
if (!keyIntervals.keyInRange(KeyIntervals.LOCAL_INVALIDATE, nextKey)) {
Log.getLogWriter().info(
"All local invalidates completed; returning from localInvalidate");
return true;
}
Object key = NameFactory.getObjectNameForCounter(nextKey);
//Set<Region<?, ?>> regionSet = theCache.rootRegions();
Set<Region<?, ?>> regionSet = ((FixedPartitioningTest)testInstance)
.getTestRegions();
for (Region aRegion : regionSet) {
localInvalidate(aRegion, key);
}
return (nextKey >= keyIntervals.getLastKey(KeyIntervals.LOCAL_INVALIDATE));
} | boolean function() { long nextKey = sc.incrementAndRead(InitImageBB.LASTKEY_LOCAL_INVALIDATE); if (!keyIntervals.keyInRange(KeyIntervals.LOCAL_INVALIDATE, nextKey)) { Log.getLogWriter().info( STR); return true; } Object key = NameFactory.getObjectNameForCounter(nextKey); Set<Region<?, ?>> regionSet = ((FixedPartitioningTest)testInstance) .getTestRegions(); for (Region aRegion : regionSet) { localInvalidate(aRegion, key); } return (nextKey >= keyIntervals.getLastKey(KeyIntervals.LOCAL_INVALIDATE)); } | /**
* Locally invalidate a key in region REGION_NAME. The keys to locally
* invalidate are specified in keyIntervals.
*
* @return true if all keys to be locally invalidated have been completed.
*/ | Locally invalidate a key in region REGION_NAME. The keys to locally invalidate are specified in keyIntervals | localInvalidate | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "tests/core/src/main/java/parReg/fixedPartitioning/FixedPartitioningTest.java",
"license": "apache-2.0",
"size": 84646
} | [
"com.gemstone.gemfire.cache.Region",
"java.util.Set"
] | import com.gemstone.gemfire.cache.Region; import java.util.Set; | import com.gemstone.gemfire.cache.*; import java.util.*; | [
"com.gemstone.gemfire",
"java.util"
] | com.gemstone.gemfire; java.util; | 1,499,354 |
public void runningTest(String name, int testIndex, String desc) {
for (Iterator i = reporters.iterator(); i.hasNext(); ) {
IReporter r = (IReporter)i.next();
r.runningTest(name, testIndex, desc);
}
} | void function(String name, int testIndex, String desc) { for (Iterator i = reporters.iterator(); i.hasNext(); ) { IReporter r = (IReporter)i.next(); r.runningTest(name, testIndex, desc); } } | /**
* Called after the test is executed.
* The delegation is passed to the reporters in the list.
* @param elTest the XML node describing the test
* as taken from the test file.
* @param testIndex the index of the test
*/ | Called after the test is executed. The delegation is passed to the reporters in the list | runningTest | {
"repo_name": "ecalo/SQLUnit-5.0-Fork",
"path": "src/net/sourceforge/sqlunit/reporters/ReporterList.java",
"license": "gpl-3.0",
"size": 9114
} | [
"java.util.Iterator",
"net.sourceforge.sqlunit.IReporter"
] | import java.util.Iterator; import net.sourceforge.sqlunit.IReporter; | import java.util.*; import net.sourceforge.sqlunit.*; | [
"java.util",
"net.sourceforge.sqlunit"
] | java.util; net.sourceforge.sqlunit; | 183,767 |
public List<IPodcastFeedEntry> getPodcastFeedEntries(); | List<IPodcastFeedEntry> function(); | /**
* Gets the podcast feed entries.
*
* @return the podcast feed entries
*/ | Gets the podcast feed entries | getPodcastFeedEntries | {
"repo_name": "PDavid/aTunes",
"path": "aTunes/src/main/java/net/sourceforge/atunes/model/IPodcastFeed.java",
"license": "gpl-2.0",
"size": 3488
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 39,534 |
private void destroy() throws InterruptedException {
ProcessTree.get().killAll(proc,cookie);
}
private static class StdinCopyThread extends Thread {
private final InputStream in;
private final OutputStream out;
public StdinCopyThread(String threadName, InputStream in, OutputStream out) {
super(threadName);
this.in = in;
this.out = out;
} | void function() throws InterruptedException { ProcessTree.get().killAll(proc,cookie); } private static class StdinCopyThread extends Thread { private final InputStream in; private final OutputStream out; public StdinCopyThread(String threadName, InputStream in, OutputStream out) { super(threadName); this.in = in; this.out = out; } | /**
* Destroys the child process without join.
*/ | Destroys the child process without join | destroy | {
"repo_name": "wuwen5/jenkins",
"path": "core/src/main/java/hudson/Proc.java",
"license": "mit",
"size": 19913
} | [
"hudson.util.ProcessTree",
"java.io.InputStream",
"java.io.OutputStream"
] | import hudson.util.ProcessTree; import java.io.InputStream; import java.io.OutputStream; | import hudson.util.*; import java.io.*; | [
"hudson.util",
"java.io"
] | hudson.util; java.io; | 2,174,903 |
public static String contentOf(File file, Charset charset) {
return Files.contentOf(file, charset);
} | static String function(File file, Charset charset) { return Files.contentOf(file, charset); } | /**
* Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
* <p>
* Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
* with {@link #assertThat(File)}.
* </p>
*
* @param file the file.
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws UncheckedIOException if an I/O exception occurs.
*/ | Loads the text content of a file, so that it can be passed to <code>#assertThat(String)</code>. Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative with <code>#assertThat(File)</code>. | contentOf | {
"repo_name": "hazendaz/assertj-core",
"path": "src/main/java/org/assertj/core/api/Assertions.java",
"license": "apache-2.0",
"size": 133137
} | [
"java.io.File",
"java.nio.charset.Charset",
"org.assertj.core.util.Files"
] | import java.io.File; import java.nio.charset.Charset; import org.assertj.core.util.Files; | import java.io.*; import java.nio.charset.*; import org.assertj.core.util.*; | [
"java.io",
"java.nio",
"org.assertj.core"
] | java.io; java.nio; org.assertj.core; | 1,179,159 |
private boolean announceHistoricalSegment(
final Handle handle,
final DataSegment segment,
final boolean used
) throws IOException
{
try {
if (segmentExists(handle, segment)) {
log.info("Found [%s] in DB, not updating DB", segment.getIdentifier());
return false;
}
// SELECT -> INSERT can fail due to races; callers must be prepared to retry.
// Avoiding ON DUPLICATE KEY since it's not portable.
// Avoiding try/catch since it may cause inadvertent transaction-splitting.
handle.createStatement(
String.format(
"INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) "
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)",
dbTables.getSegmentsTable()
)
)
.bind("id", segment.getIdentifier())
.bind("dataSource", segment.getDataSource())
.bind("created_date", new DateTime().toString())
.bind("start", segment.getInterval().getStart().toString())
.bind("end", segment.getInterval().getEnd().toString())
.bind("partitioned", (segment.getShardSpec() instanceof NoneShardSpec) ? false : true)
.bind("version", segment.getVersion())
.bind("used", used)
.bind("payload", jsonMapper.writeValueAsBytes(segment))
.execute();
log.info("Published segment [%s] to DB", segment.getIdentifier());
}
catch (Exception e) {
log.error(e, "Exception inserting segment [%s] into DB", segment.getIdentifier());
throw e;
}
return true;
} | boolean function( final Handle handle, final DataSegment segment, final boolean used ) throws IOException { try { if (segmentExists(handle, segment)) { log.info(STR, segment.getIdentifier()); return false; } handle.createStatement( String.format( STRend\STR + STR, dbTables.getSegmentsTable() ) ) .bind("id", segment.getIdentifier()) .bind(STR, segment.getDataSource()) .bind(STR, new DateTime().toString()) .bind("start", segment.getInterval().getStart().toString()) .bind("end", segment.getInterval().getEnd().toString()) .bind(STR, (segment.getShardSpec() instanceof NoneShardSpec) ? false : true) .bind(STR, segment.getVersion()) .bind("used", used) .bind(STR, jsonMapper.writeValueAsBytes(segment)) .execute(); log.info(STR, segment.getIdentifier()); } catch (Exception e) { log.error(e, STR, segment.getIdentifier()); throw e; } return true; } | /**
* Attempts to insert a single segment to the database. If the segment already exists, will do nothing; although,
* this checking is imperfect and callers must be prepared to retry their entire transaction on exceptions.
*
* @return true if the segment was added, false if it already existed
*/ | Attempts to insert a single segment to the database. If the segment already exists, will do nothing; although, this checking is imperfect and callers must be prepared to retry their entire transaction on exceptions | announceHistoricalSegment | {
"repo_name": "erikdubbelboer/druid",
"path": "server/src/main/java/io/druid/metadata/IndexerSQLMetadataStorageCoordinator.java",
"license": "apache-2.0",
"size": 34953
} | [
"io.druid.timeline.DataSegment",
"io.druid.timeline.partition.NoneShardSpec",
"java.io.IOException",
"org.joda.time.DateTime",
"org.skife.jdbi.v2.Handle"
] | import io.druid.timeline.DataSegment; import io.druid.timeline.partition.NoneShardSpec; import java.io.IOException; import org.joda.time.DateTime; import org.skife.jdbi.v2.Handle; | import io.druid.timeline.*; import io.druid.timeline.partition.*; import java.io.*; import org.joda.time.*; import org.skife.jdbi.v2.*; | [
"io.druid.timeline",
"java.io",
"org.joda.time",
"org.skife.jdbi"
] | io.druid.timeline; java.io; org.joda.time; org.skife.jdbi; | 718,365 |
if (object == null) {
return;
}
if (!(object instanceof Serializable)) {
throw new IllegalArgumentException('"' + objectName + "\" must implement Serializable");
}
try (ObjectOutputStream os = new ObjectOutputStream(new NullOutputStream())) {
os.writeObject(object);
} catch (NotSerializableException | InvalidClassException e) {
throw new IllegalArgumentException("\"" + objectName + "\" must be serializable", e);
} catch (IOException e) {
// never really thrown, as the underlying stream never throws it
throw new HazelcastException(e);
}
} | if (object == null) { return; } if (!(object instanceof Serializable)) { throw new IllegalArgumentException('STR\STR); } try (ObjectOutputStream os = new ObjectOutputStream(new NullOutputStream())) { os.writeObject(object); } catch (NotSerializableException InvalidClassException e) { throw new IllegalArgumentException("\"STR\STR, e); } catch (IOException e) { throw new HazelcastException(e); } } | /**
* Checks that the {@code object} implements {@link Serializable} and is
* correctly serializable by actually trying to serialize it. This will
* reveal some non-serializable field early.
*
* @param object object to check
* @param objectName object description for the exception
* @throws IllegalArgumentException if {@code object} is not serializable
*/ | Checks that the object implements <code>Serializable</code> and is correctly serializable by actually trying to serialize it. This will reveal some non-serializable field early | checkSerializable | {
"repo_name": "emre-aydin/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java",
"license": "apache-2.0",
"size": 16747
} | [
"com.hazelcast.core.HazelcastException",
"java.io.IOException",
"java.io.InvalidClassException",
"java.io.NotSerializableException",
"java.io.ObjectOutputStream",
"java.io.Serializable"
] | import com.hazelcast.core.HazelcastException; import java.io.IOException; import java.io.InvalidClassException; import java.io.NotSerializableException; import java.io.ObjectOutputStream; import java.io.Serializable; | import com.hazelcast.core.*; import java.io.*; | [
"com.hazelcast.core",
"java.io"
] | com.hazelcast.core; java.io; | 1,479,844 |
OdeInternalInstance getInternalInstance(); | OdeInternalInstance getInternalInstance(); | /**
* Returns ODE's internal runtime instance.
*/ | Returns ODE's internal runtime instance | getInternalInstance | {
"repo_name": "matthieu/apache-ode",
"path": "runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensionContext.java",
"license": "apache-2.0",
"size": 5246
} | [
"org.apache.ode.bpel.rtrep.v2.OdeInternalInstance"
] | import org.apache.ode.bpel.rtrep.v2.OdeInternalInstance; | import org.apache.ode.bpel.rtrep.v2.*; | [
"org.apache.ode"
] | org.apache.ode; | 2,859,292 |
@Override
public JsonContentAssert isNotEqualTo(Object expected) {
if (expected == null || expected instanceof CharSequence) {
return isNotEqualToJson((CharSequence) expected);
}
if (expected instanceof byte[]) {
return isNotEqualToJson((byte[]) expected);
}
if (expected instanceof File) {
return isNotEqualToJson((File) expected);
}
if (expected instanceof InputStream) {
return isNotEqualToJson((InputStream) expected);
}
if (expected instanceof Resource) {
return isNotEqualToJson((Resource) expected);
}
throw new AssertionError("Unsupport type for JSON assert " + expected.getClass());
}
/**
* Verifies that the actual value is not {@link JSONCompareMode#LENIENT leniently} | JsonContentAssert function(Object expected) { if (expected == null expected instanceof CharSequence) { return isNotEqualToJson((CharSequence) expected); } if (expected instanceof byte[]) { return isNotEqualToJson((byte[]) expected); } if (expected instanceof File) { return isNotEqualToJson((File) expected); } if (expected instanceof InputStream) { return isNotEqualToJson((InputStream) expected); } if (expected instanceof Resource) { return isNotEqualToJson((Resource) expected); } throw new AssertionError(STR + expected.getClass()); } /** * Verifies that the actual value is not {@link JSONCompareMode#LENIENT leniently} | /**
* Overridden version of {@code isNotEqualTo} to perform JSON tests based on the
* object type.
* @see org.assertj.core.api.AbstractAssert#isEqualTo(java.lang.Object)
*/ | Overridden version of isNotEqualTo to perform JSON tests based on the object type | isNotEqualTo | {
"repo_name": "ptahchiev/spring-boot",
"path": "spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java",
"license": "apache-2.0",
"size": 46401
} | [
"java.io.File",
"java.io.InputStream",
"org.skyscreamer.jsonassert.JSONCompareMode",
"org.springframework.core.io.Resource"
] | import java.io.File; import java.io.InputStream; import org.skyscreamer.jsonassert.JSONCompareMode; import org.springframework.core.io.Resource; | import java.io.*; import org.skyscreamer.jsonassert.*; import org.springframework.core.io.*; | [
"java.io",
"org.skyscreamer.jsonassert",
"org.springframework.core"
] | java.io; org.skyscreamer.jsonassert; org.springframework.core; | 1,948,738 |
void showGooglePlayServicesAvailabilityErrorDialog(
final int connectionStatusCode) {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
Dialog dialog = apiAvailability.getErrorDialog(
MainActivity.this,
connectionStatusCode,
REQUEST_GOOGLE_PLAY_SERVICES);
dialog.show();
}
private class MakeRequestTask extends AsyncTask<Void, Void, List<String>> {
private com.google.api.services.tasks.Tasks mService = null;
private Exception mLastError = null;
MakeRequestTask(GoogleAccountCredential credential) {
HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
mService = new com.google.api.services.tasks.Tasks.Builder(
transport, jsonFactory, credential)
.setApplicationName("Google Tasks API Android Quickstart")
.build();
} | void showGooglePlayServicesAvailabilityErrorDialog( final int connectionStatusCode) { GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); Dialog dialog = apiAvailability.getErrorDialog( MainActivity.this, connectionStatusCode, REQUEST_GOOGLE_PLAY_SERVICES); dialog.show(); } private class MakeRequestTask extends AsyncTask<Void, Void, List<String>> { private com.google.api.services.tasks.Tasks mService = null; private Exception mLastError = null; MakeRequestTask(GoogleAccountCredential credential) { HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); mService = new com.google.api.services.tasks.Tasks.Builder( transport, jsonFactory, credential) .setApplicationName(STR) .build(); } | /**
* Display an error dialog showing that Google Play Services is missing
* or out of date.
* @param connectionStatusCode code describing the presence (or lack of)
* Google Play Services on this device.
*/ | Display an error dialog showing that Google Play Services is missing or out of date | showGooglePlayServicesAvailabilityErrorDialog | {
"repo_name": "xni06/Google-Tasks-API-Android-Quickstart",
"path": "app/src/main/java/com/example/quickstart/MainActivity.java",
"license": "gpl-3.0",
"size": 16731
} | [
"android.app.Dialog",
"android.os.AsyncTask",
"com.google.android.gms.common.GoogleApiAvailability",
"com.google.api.client.extensions.android.http.AndroidHttp",
"com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential",
"com.google.api.client.http.HttpTransport",
"com.googl... | import android.app.Dialog; import android.os.AsyncTask; import com.google.android.gms.common.GoogleApiAvailability; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import java.util.List; | import android.app.*; import android.os.*; import com.google.android.gms.common.*; import com.google.api.client.extensions.android.http.*; import com.google.api.client.googleapis.extensions.android.gms.auth.*; import com.google.api.client.http.*; import com.google.api.client.json.*; import com.google.api.client.json.jackson2.*; import java.util.*; | [
"android.app",
"android.os",
"com.google.android",
"com.google.api",
"java.util"
] | android.app; android.os; com.google.android; com.google.api; java.util; | 463,684 |
// --------------
private class OpenFileOrURLAsyncTask extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
mLoadingLayout.setVisibility(View.VISIBLE);
} | class OpenFileOrURLAsyncTask extends AsyncTask<String, String, String> { protected void function() { mLoadingLayout.setVisibility(View.VISIBLE); } | /**
* Before jumping into background thread, start sliding in the
* {@link ProgressBar}. We'll only show it once the animation finishes.
*/ | Before jumping into background thread, start sliding in the <code>ProgressBar</code>. We'll only show it once the animation finishes | onPreExecute | {
"repo_name": "tectronics/wiki-to-speech",
"path": "src/com/jgraves/WikiToSpeech/QuestionView.java",
"license": "mit",
"size": 47074
} | [
"android.os.AsyncTask",
"android.view.View"
] | import android.os.AsyncTask; import android.view.View; | import android.os.*; import android.view.*; | [
"android.os",
"android.view"
] | android.os; android.view; | 2,561,266 |
private static Integer unLocalizedFormatForInt(final String value) {
Locale loc = UI.getCurrent()
.getLocale();
Integer modifiedValue = 0;
if (value != null && !value.contains(".") && !value.contains(",")) {
modifiedValue = Integer.valueOf(value);
} else {
if (value != null && "en".equals(loc.getLanguage())) {
modifiedValue = Integer.valueOf(value.replaceAll(",", ""));
} else if (value != null && "de".equals(loc.getLanguage())) {
modifiedValue = Integer.valueOf(value.replaceAll("\\.", ""));
}
}
return modifiedValue;
}
| static Integer function(final String value) { Locale loc = UI.getCurrent() .getLocale(); Integer modifiedValue = 0; if (value != null && !value.contains(".") && !value.contains(",")) { modifiedValue = Integer.valueOf(value); } else { if (value != null && "enSTR,", STRdeSTR\\.STR")); } } return modifiedValue; } | /**
* Un localized format for int.
*
* @param value
* the value
* @return the integer
*/ | Un localized format for int | unLocalizedFormatForInt | {
"repo_name": "bonprix/vaadin-excel-exporter",
"path": "vaadin-excel-exporter/src/main/java/org/vaadin/addons/excelexporter/utils/FormatUtil.java",
"license": "apache-2.0",
"size": 4981
} | [
"com.vaadin.ui.UI",
"java.util.Locale"
] | import com.vaadin.ui.UI; import java.util.Locale; | import com.vaadin.ui.*; import java.util.*; | [
"com.vaadin.ui",
"java.util"
] | com.vaadin.ui; java.util; | 2,176,382 |
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException; | Serializable function(Object value, SessionImplementor session, Object owner) throws HibernateException; | /**
* Return a cacheable "disassembled" representation of the object.
* @param value the value to cache
* @param session the session
* @param owner optional parent entity object (needed for collections)
* @return the disassembled, deep cloned state
*/ | Return a cacheable "disassembled" representation of the object | disassemble | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/hibernate-distribution-3.6.10.Final/project/hibernate-core/src/main/java/org/hibernate/type/Type.java",
"license": "unlicense",
"size": 19478
} | [
"java.io.Serializable",
"org.hibernate.HibernateException",
"org.hibernate.engine.SessionImplementor"
] | import java.io.Serializable; import org.hibernate.HibernateException; import org.hibernate.engine.SessionImplementor; | import java.io.*; import org.hibernate.*; import org.hibernate.engine.*; | [
"java.io",
"org.hibernate",
"org.hibernate.engine"
] | java.io; org.hibernate; org.hibernate.engine; | 2,035,320 |
public ActionForward disconnect(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
MySessionAction.LOGGER.debug("Disconnect");
SessionTools.unlogUser(request, response);
return mapping.findForward("login");
} | ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { MySessionAction.LOGGER.debug(STR); SessionTools.unlogUser(request, response); return mapping.findForward("login"); } | /**
* Unlog the user.
*
* @param mapping the Mapping.
* @param form the ActionForm.
* @param request the Request.
* @param response the Response.
* @return
*/ | Unlog the user | disconnect | {
"repo_name": "sebastienhouzet/nabaztag-source-code",
"path": "server/MyNabaztag/net/violet/mynabaztag/action/MySessionAction.java",
"license": "mit",
"size": 5476
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"net.violet.platform.util.SessionTools",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.violet.platform.util.SessionTools; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; | import javax.servlet.http.*; import net.violet.platform.util.*; import org.apache.struts.action.*; | [
"javax.servlet",
"net.violet.platform",
"org.apache.struts"
] | javax.servlet; net.violet.platform; org.apache.struts; | 2,652,668 |
@OneOf( { "B", "KB", "MB", "GB", "TB", "PB" } )
@UseDefaults( "MB" )
Property<String> maxObjectSizeUnit(); | @OneOf( { "B", "KB", "MB", "GB", "TB", "PB" } ) @UseDefaults( "MB" ) Property<String> maxObjectSizeUnit(); | /**
* Unit for maximum size of cached objects.
*
* @return Unit for maximum size of cached objects
*/ | Unit for maximum size of cached objects | maxObjectSizeUnit | {
"repo_name": "apache/zest-qi4j",
"path": "extensions/cache-ehcache/src/main/java/org/apache/polygene/cache/ehcache/EhCacheConfiguration.java",
"license": "apache-2.0",
"size": 3551
} | [
"org.apache.polygene.api.common.UseDefaults",
"org.apache.polygene.api.property.Property",
"org.apache.polygene.library.constraints.annotation.OneOf"
] | import org.apache.polygene.api.common.UseDefaults; import org.apache.polygene.api.property.Property; import org.apache.polygene.library.constraints.annotation.OneOf; | import org.apache.polygene.api.common.*; import org.apache.polygene.api.property.*; import org.apache.polygene.library.constraints.annotation.*; | [
"org.apache.polygene"
] | org.apache.polygene; | 2,065,459 |
public String getSelectedSort() {
if(selectedSort == null || "".equals(selectedSort)) {
this.setSelectedSort(OptionsSort.relevance.name());
}
return Val.chkStr(selectedSort);
}
| String function() { if(selectedSort == null "".equals(selectedSort)) { this.setSelectedSort(OptionsSort.relevance.name()); } return Val.chkStr(selectedSort); } | /**
* Gets the user selected sort method.
* @return the selected sort (trimmed, never null, default = "relevance")
*/ | Gets the user selected sort method | getSelectedSort | {
"repo_name": "usgin/usgin-geoportal",
"path": "src/com/esri/gpt/catalog/search/SearchFilterSort.java",
"license": "apache-2.0",
"size": 4777
} | [
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 408,077 |
public void snapshotEntity(BusinessEntity<?> entity); | void function(BusinessEntity<?> entity); | /**
* Save a snapshot of the entire entity before it is changed/deleted in the DB, so that it can be restored later on
* in case of compensation.
*
* @param entity
* The entity state before the change.
*/ | Save a snapshot of the entire entity before it is changed/deleted in the DB, so that it can be restored later on in case of compensation | snapshotEntity | {
"repo_name": "jtux270/translate",
"path": "ovirt/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/context/CompensationContext.java",
"license": "gpl-3.0",
"size": 3320
} | [
"org.ovirt.engine.core.common.businessentities.BusinessEntity"
] | import org.ovirt.engine.core.common.businessentities.BusinessEntity; | import org.ovirt.engine.core.common.businessentities.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 832,895 |
private AudioInputStream captureLiveAudio() {
TargetDataLine inLine = null;
// ----------------------------------------------------------------------
// initialize input line
DataLine.Info info = new DataLine.Info(TargetDataLine.class, null);
if (!AudioSystem.isLineSupported(info)) {
System.out.println("Did not find sound input line.");
System.out.println("Line matching " + info + " not supported.");
return null;
}
selectedFormat = findBestFormat();
if (selectedFormat == null) {
System.out.println("Unable to find sutable format for capture.");
return null;
}
System.out.println("Format = " + selectedFormat);
try {
inLine = (TargetDataLine) AudioSystem.getLine(info);
inLine.open(selectedFormat, inLine.getBufferSize());
} catch (LineUnavailableException ex) {
System.out.println("Unable to open the input line: " + ex);
ex.printStackTrace();
return null;
} catch (SecurityException ex) {
System.out.println("Security " + ex.toString());
ex.printStackTrace();
return null;
} catch (Exception ex) {
System.out.println("Some other exception" + ex.toString());
ex.printStackTrace();
return null;
}
System.out.println("Found and opened sound input line.");
// ----------------------------------------------------------------------
// capture
ByteArrayOutputStream captureArrayStream = new ByteArrayOutputStream();
int frameSizeInBytes = selectedFormat.getFrameSize();
int bufferLengthInFrames = inLine.getBufferSize() / 8;
int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes;
byte[] data = new byte[bufferLengthInBytes];
int numBytesRead;
inLine.start();
System.out.println("Capturing 20 seconds of sound.");
System.out.println("Start Talking....");
Long start = System.currentTimeMillis();
Long time = start;
while (time < (start + 20000)) // for 20 seconds
{
if ((numBytesRead = inLine.read(data, 0, bufferLengthInBytes)) == -1) {
break;
}
captureArrayStream.write(data, 0, numBytesRead);
System.out.print("*");
time = System.currentTimeMillis();
}
System.out.println();
System.out.println(" ...done.");
// we reached the end of the stream. stop and close the line.
inLine.stop();
inLine.close();
inLine = null;
// stop and close the capture stream
try {
captureArrayStream.flush();
captureArrayStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
// load bytes into the audio input stream for playback
byte audioBytes[] = captureArrayStream.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes);
AudioInputStream audioInputStream = new AudioInputStream(bais, selectedFormat, audioBytes.length
/ frameSizeInBytes);
long milliseconds = (long) ((audioInputStream.getFrameLength() * 1000) / selectedFormat
.getFrameRate());
double duration = milliseconds / 1000.0;
try {
audioInputStream.reset();
} catch (Exception ex) {
System.out.println("Failed to reset input to start.");
ex.printStackTrace();
return null; // it can't be used in this case.
}
System.out.println("Captured " + duration + " seconds of audio.");
return audioInputStream;
} | AudioInputStream function() { TargetDataLine inLine = null; DataLine.Info info = new DataLine.Info(TargetDataLine.class, null); if (!AudioSystem.isLineSupported(info)) { System.out.println(STR); System.out.println(STR + info + STR); return null; } selectedFormat = findBestFormat(); if (selectedFormat == null) { System.out.println(STR); return null; } System.out.println(STR + selectedFormat); try { inLine = (TargetDataLine) AudioSystem.getLine(info); inLine.open(selectedFormat, inLine.getBufferSize()); } catch (LineUnavailableException ex) { System.out.println(STR + ex); ex.printStackTrace(); return null; } catch (SecurityException ex) { System.out.println(STR + ex.toString()); ex.printStackTrace(); return null; } catch (Exception ex) { System.out.println(STR + ex.toString()); ex.printStackTrace(); return null; } System.out.println(STR); ByteArrayOutputStream captureArrayStream = new ByteArrayOutputStream(); int frameSizeInBytes = selectedFormat.getFrameSize(); int bufferLengthInFrames = inLine.getBufferSize() / 8; int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes; byte[] data = new byte[bufferLengthInBytes]; int numBytesRead; inLine.start(); System.out.println(STR); System.out.println(STR); Long start = System.currentTimeMillis(); Long time = start; while (time < (start + 20000)) { if ((numBytesRead = inLine.read(data, 0, bufferLengthInBytes)) == -1) { break; } captureArrayStream.write(data, 0, numBytesRead); System.out.print("*"); time = System.currentTimeMillis(); } System.out.println(); System.out.println(STR); inLine.stop(); inLine.close(); inLine = null; try { captureArrayStream.flush(); captureArrayStream.close(); } catch (IOException ex) { ex.printStackTrace(); } byte audioBytes[] = captureArrayStream.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); AudioInputStream audioInputStream = new AudioInputStream(bais, selectedFormat, audioBytes.length / frameSizeInBytes); long milliseconds = (long) ((audioInputStream.getFrameLength() * 1000) / selectedFormat .getFrameRate()); double duration = milliseconds / 1000.0; try { audioInputStream.reset(); } catch (Exception ex) { System.out.println(STR); ex.printStackTrace(); return null; } System.out.println(STR + duration + STR); return audioInputStream; } | /**
* Capture 20 seconds of live audio to a ByteArrayOutputStream in any
* failure case print a message and return null
*/ | Capture 20 seconds of live audio to a ByteArrayOutputStream in any failure case print a message and return null | captureLiveAudio | {
"repo_name": "tobiasschulz/voipcall",
"path": "src/call/debug/TestLines_.java",
"license": "gpl-3.0",
"size": 11594
} | [
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"javax.sound.sampled.AudioInputStream",
"javax.sound.sampled.AudioSystem",
"javax.sound.sampled.DataLine",
"javax.sound.sampled.LineUnavailableException",
"javax.sound.sampled.TargetDataLine"
] | import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.TargetDataLine; | import java.io.*; import javax.sound.sampled.*; | [
"java.io",
"javax.sound"
] | java.io; javax.sound; | 168,257 |
public SimpleSelector getSimpleSelector() {
return simpleSelector;
} | SimpleSelector function() { return simpleSelector; } | /**
* <b>SAC</b>: Implements {@link
* org.w3c.css.sac.DescendantSelector#getSimpleSelector()}.
*/ | SAC: Implements <code>org.w3c.css.sac.DescendantSelector#getSimpleSelector()</code> | getSimpleSelector | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/css/engine/sac/AbstractDescendantSelector.java",
"license": "apache-2.0",
"size": 2803
} | [
"org.w3c.css.sac.SimpleSelector"
] | import org.w3c.css.sac.SimpleSelector; | import org.w3c.css.sac.*; | [
"org.w3c.css"
] | org.w3c.css; | 2,331,283 |
@Test
public void testNonPrivateConstructor() throws Exception {
boolean gotException = false;
try {
assertThatClassIsUtility(NonPrivateConstructor.class);
} catch (AssertionError assertion) {
assertThat(assertion.getMessage(),
containsString("constructor that is not private"));
gotException = true;
}
assertThat(gotException, is(true));
}
static final class NonStaticMethod {
private NonStaticMethod() { }
public void aPublicMethod() { } | void function() throws Exception { boolean gotException = false; try { assertThatClassIsUtility(NonPrivateConstructor.class); } catch (AssertionError assertion) { assertThat(assertion.getMessage(), containsString(STR)); gotException = true; } assertThat(gotException, is(true)); } static final class NonStaticMethod { private NonStaticMethod() { } public void aPublicMethod() { } | /**
* Check that a class with a non private constructor correctly
* produces an error.
* @throws Exception if any of the reflection lookups fail.
*/ | Check that a class with a non private constructor correctly produces an error | testNonPrivateConstructor | {
"repo_name": "opennetworkinglab/spring-open",
"path": "src/test/java/net/onrc/onos/core/util/UtilityClassCheckerTest.java",
"license": "apache-2.0",
"size": 4509
} | [
"net.onrc.onos.core.util.UtilityClassChecker",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import net.onrc.onos.core.util.UtilityClassChecker; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import net.onrc.onos.core.util.*; import org.hamcrest.*; | [
"net.onrc.onos",
"org.hamcrest"
] | net.onrc.onos; org.hamcrest; | 2,241,198 |
void setThreads(ExecutorService threads); | void setThreads(ExecutorService threads); | /**
* Sets the threads pool.
*
* @param threads
* the {@link ExecutorService} threads pool.
*/ | Sets the threads pool | setThreads | {
"repo_name": "devent/sscontrol",
"path": "sscontrol-api/src/main/java/com/anrisoftware/sscontrol/core/api/Service.java",
"license": "agpl-3.0",
"size": 1928
} | [
"java.util.concurrent.ExecutorService"
] | import java.util.concurrent.ExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,738,734 |
public BusinessActivitiesProductionValueIndexProductionValueIndexClient productionValueIndex() {
return (BusinessActivitiesProductionValueIndexProductionValueIndexClient) getClient("productionvalueindex");
} | BusinessActivitiesProductionValueIndexProductionValueIndexClient function() { return (BusinessActivitiesProductionValueIndexProductionValueIndexClient) getClient(STR); } | /**
* <p>Retrieve the client for interacting with business activities production value
* index production value index data.</p>
*
* @return a client for business activities production value index production value
* index data
*/ | Retrieve the client for interacting with business activities production value index production value index data | productionValueIndex | {
"repo_name": "dannil/scb-java-client",
"path": "src/main/java/com/github/dannil/scbjavaclient/client/businessactivities/productionvalueindex/BusinessActivitiesProductionValueIndexClient.java",
"license": "apache-2.0",
"size": 2342
} | [
"com.github.dannil.scbjavaclient.client.businessactivities.productionvalueindex.productionvalueindex.BusinessActivitiesProductionValueIndexProductionValueIndexClient"
] | import com.github.dannil.scbjavaclient.client.businessactivities.productionvalueindex.productionvalueindex.BusinessActivitiesProductionValueIndexProductionValueIndexClient; | import com.github.dannil.scbjavaclient.client.businessactivities.productionvalueindex.productionvalueindex.*; | [
"com.github.dannil"
] | com.github.dannil; | 1,082,409 |
@Override
public boolean visit(final SynchronizedStatement node)
{
visitControlNode(LK_SYNCHRONIZED, lineStart(node), node.getExpression(), node.getBody());
// do not visit children
return false;
} | boolean function(final SynchronizedStatement node) { visitControlNode(LK_SYNCHRONIZED, lineStart(node), node.getExpression(), node.getBody()); return false; } | /**
* 'synchronized' '(' Expression ')' Block
*/ | 'synchronized' '(' Expression ')' Block | visit | {
"repo_name": "UBPL/jive",
"path": "edu.buffalo.cse.jive.core.ast/src/edu/buffalo/cse/jive/internal/core/ast/StatementVisitor.java",
"license": "epl-1.0",
"size": 44641
} | [
"org.eclipse.jdt.core.dom.SynchronizedStatement"
] | import org.eclipse.jdt.core.dom.SynchronizedStatement; | import org.eclipse.jdt.core.dom.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 1,537,731 |
public void start(ContainerReference reference) throws IOException {
Assert.notNull(reference, "Reference must not be null");
URI uri = buildUrl("/containers/" + reference + "/start");
http().post(uri);
} | void function(ContainerReference reference) throws IOException { Assert.notNull(reference, STR); URI uri = buildUrl(STR + reference + STR); http().post(uri); } | /**
* Start a specific container.
* @param reference the container reference to start
* @throws IOException on IO error
*/ | Start a specific container | start | {
"repo_name": "jxblum/spring-boot",
"path": "spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java",
"license": "apache-2.0",
"size": 15993
} | [
"java.io.IOException",
"org.springframework.boot.buildpack.platform.docker.type.ContainerReference",
"org.springframework.util.Assert"
] | import java.io.IOException; import org.springframework.boot.buildpack.platform.docker.type.ContainerReference; import org.springframework.util.Assert; | import java.io.*; import org.springframework.boot.buildpack.platform.docker.type.*; import org.springframework.util.*; | [
"java.io",
"org.springframework.boot",
"org.springframework.util"
] | java.io; org.springframework.boot; org.springframework.util; | 952,657 |
public void readIn
(InStream in)
throws IOException
{
item = (T[]) in.readObjectArray();
} | void function (InStream in) throws IOException { item = (T[]) in.readObjectArray(); } | /**
* Read this tuple's fields from the given in stream. The content object
* array is read using {@link edu.rit.io.InStream#readObjectArray()
* readObjectArray()}.
*
* @param in In stream.
*
* @exception IOException
* Thrown if an I/O error occurred.
*/ | Read this tuple's fields from the given in stream. The content object array is read using <code>edu.rit.io.InStream#readObjectArray() readObjectArray()</code> | readIn | {
"repo_name": "JimiHFord/pj2",
"path": "lib/edu/rit/pj2/tuple/ObjectArrayTuple.java",
"license": "lgpl-3.0",
"size": 4219
} | [
"edu.rit.io.InStream",
"java.io.IOException"
] | import edu.rit.io.InStream; import java.io.IOException; | import edu.rit.io.*; import java.io.*; | [
"edu.rit.io",
"java.io"
] | edu.rit.io; java.io; | 1,783,274 |
void deregister(List<URL> urls) {
for (URL url : urls) {
_data.remove(url.getFile());
}
} | void deregister(List<URL> urls) { for (URL url : urls) { _data.remove(url.getFile()); } } | /**
* Remove mappings for the provided urls.
*/ | Remove mappings for the provided urls | deregister | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.persistence/src/com/ibm/wsspi/persistence/internal/InMemoryUrlStreamHandler.java",
"license": "epl-1.0",
"size": 2759
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,943,351 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Flux<ByteBuffer>>> createUpdateMongoDBCollectionWithResponseAsync(
String resourceGroupName,
String accountName,
String databaseName,
String collectionName,
MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> createUpdateMongoDBCollectionWithResponseAsync( String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters); | /**
* Create or update an Azure Cosmos DB MongoDB Collection.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param databaseName Cosmos DB database name.
* @param collectionName Cosmos DB collection name.
* @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an Azure Cosmos DB MongoDB collection.
*/ | Create or update an Azure Cosmos DB MongoDB Collection | createUpdateMongoDBCollectionWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/fluent/MongoDBResourcesClient.java",
"license": "mit",
"size": 104176
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.resourcemanager.cosmos.models.MongoDBCollectionCreateUpdateParameters",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.cosmos.models.MongoDBCollectionCreateUpdateParameters; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.cosmos.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 1,805,590 |
public void add(BiomeType... biome) {
add(Arrays.asList(checkNotNull(biome)));
} | void function(BiomeType... biome) { add(Arrays.asList(checkNotNull(biome))); } | /**
* Add the given biomes to the list of criteria.
*
* @param biome an array of biomes
*/ | Add the given biomes to the list of criteria | add | {
"repo_name": "HolodeckOne-Minecraft/WorldEdit",
"path": "worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask.java",
"license": "gpl-3.0",
"size": 2804
} | [
"com.sk89q.worldedit.world.biome.BiomeType",
"java.util.Arrays"
] | import com.sk89q.worldedit.world.biome.BiomeType; import java.util.Arrays; | import com.sk89q.worldedit.world.biome.*; import java.util.*; | [
"com.sk89q.worldedit",
"java.util"
] | com.sk89q.worldedit; java.util; | 659,896 |
@Test(timeout = 360000)
public void testDecommissionDifferentNodeAfterMaintenances()
throws Exception {
testDecommissionDifferentNodeAfterMaintenance(2);
testDecommissionDifferentNodeAfterMaintenance(3);
testDecommissionDifferentNodeAfterMaintenance(4);
} | @Test(timeout = 360000) void function() throws Exception { testDecommissionDifferentNodeAfterMaintenance(2); testDecommissionDifferentNodeAfterMaintenance(3); testDecommissionDifferentNodeAfterMaintenance(4); } | /**
* First put a node in maintenance, then put a different node
* in decommission. Make sure decommission process take
* maintenance replica into account.
*/ | First put a node in maintenance, then put a different node in decommission. Make sure decommission process take maintenance replica into account | testDecommissionDifferentNodeAfterMaintenances | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMaintenanceState.java",
"license": "apache-2.0",
"size": 45331
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 902,190 |
public WbXmlContent parse(WbXmlParser parser, byte[] data) throws IOException; | WbXmlContent function(WbXmlParser parser, byte[] data) throws IOException; | /**
* Parse method that parses an opaque data. The opaque data is read from
* the WBXML stream and passed in the byte array argument. In this case
* the parser only calls the plugin if real opaque data is found.
*
* @param parser The parser doing the parsing
* @param data The data read from the opaque
* @return The content representation of the opaque data
* @throws IOException Some error in the parsing
*/ | Parse method that parses an opaque data. The opaque data is read from the WBXML stream and passed in the byte array argument. In this case the parser only calls the plugin if real opaque data is found | parse | {
"repo_name": "Lihuanghe/CMPPGate",
"path": "src/main/java/es/rickyepoderi/wbxml/document/OpaqueContentPlugin.java",
"license": "apache-2.0",
"size": 4096
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,830,222 |
public boolean isTrue(String query, Map<String,?> params) {
QueryResultIF result = null;
try {
result = execute(query, params);
return result.next();
} catch (InvalidQueryException e) {
throw new OntopiaRuntimeException(e);
} finally {
if (result != null)
result.close();
}
} | boolean function(String query, Map<String,?> params) { QueryResultIF result = null; try { result = execute(query, params); return result.next(); } catch (InvalidQueryException e) { throw new OntopiaRuntimeException(e); } finally { if (result != null) result.close(); } } | /**
* EXPERIMENTAL: Returns true if the query produces a row and
* false if the query produces no rows.
*/ | false if the query produces no rows | isTrue | {
"repo_name": "ontopia/ontopia",
"path": "ontopoly-editor/src/main/java/ontopoly/model/QueryMapper.java",
"license": "apache-2.0",
"size": 6853
} | [
"java.util.Map",
"net.ontopia.topicmaps.query.core.InvalidQueryException",
"net.ontopia.topicmaps.query.core.QueryResultIF",
"net.ontopia.utils.OntopiaRuntimeException"
] | import java.util.Map; import net.ontopia.topicmaps.query.core.InvalidQueryException; import net.ontopia.topicmaps.query.core.QueryResultIF; import net.ontopia.utils.OntopiaRuntimeException; | import java.util.*; import net.ontopia.topicmaps.query.core.*; import net.ontopia.utils.*; | [
"java.util",
"net.ontopia.topicmaps",
"net.ontopia.utils"
] | java.util; net.ontopia.topicmaps; net.ontopia.utils; | 1,066,147 |
public synchronized void release(SegmentReader sr) throws IOException {
release(sr, false);
} | synchronized void function(SegmentReader sr) throws IOException { release(sr, false); } | /**
* Release the segment reader (i.e. decRef it and close if there
* are no more references.
* @param sr
* @throws IOException
*/ | Release the segment reader (i.e. decRef it and close if there are no more references | release | {
"repo_name": "chrishumphreys/provocateur",
"path": "provocateur-thirdparty/src/main/java/org/targettest/org/apache/lucene/index/IndexWriter.java",
"license": "apache-2.0",
"size": 174449
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,852,183 |
public ApplicationGatewayPropertiesFormat withUrlPathMaps(List<ApplicationGatewayUrlPathMapInner> urlPathMaps) {
this.urlPathMaps = urlPathMaps;
return this;
} | ApplicationGatewayPropertiesFormat function(List<ApplicationGatewayUrlPathMapInner> urlPathMaps) { this.urlPathMaps = urlPathMaps; return this; } | /**
* Set the urlPathMaps property: URL path map of the application gateway resource. For default limits, see
* [Application Gateway
* limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits).
*
* @param urlPathMaps the urlPathMaps value to set.
* @return the ApplicationGatewayPropertiesFormat object itself.
*/ | Set the urlPathMaps property: URL path map of the application gateway resource. For default limits, see [Application Gateway limits](HREF) | withUrlPathMaps | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/ApplicationGatewayPropertiesFormat.java",
"license": "mit",
"size": 40780
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 121,022 |
ReloadableResourceBundleMessageSource messageSource
= new ReloadableResourceBundleMessageSource();
messageSource.setBasenames("WEB-INF/nls/messages");
messageSource.setUseCodeAsDefaultMessage(false);
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
} | ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasenames(STR); messageSource.setUseCodeAsDefaultMessage(false); messageSource.setDefaultEncoding("UTF-8"); return messageSource; } | /**
* This is all we need to supply the value for #{greeting}, and other
* language property values.
*
* @return Message source to resolve National Language translations.
*/ | This is all we need to supply the value for #{greeting}, and other language property values | messageSource | {
"repo_name": "panopset/tldemo",
"path": "src/main/java/com/panopset/demo/tl/HomeModel.java",
"license": "mit",
"size": 3261
} | [
"org.springframework.context.support.ReloadableResourceBundleMessageSource"
] | import org.springframework.context.support.ReloadableResourceBundleMessageSource; | import org.springframework.context.support.*; | [
"org.springframework.context"
] | org.springframework.context; | 438,963 |
public static EditGiftFragment getInstance(Gift gift) {
EditGiftFragment fragment = new EditGiftFragment();
// Attach some data needed to populate our fragment layouts
Bundle args = new Bundle();
args.putParcelable("gift", gift);
// Set the arguments on the fragment that will be fetched by the edit activity
fragment.setArguments(args);
return fragment;
} | static EditGiftFragment function(Gift gift) { EditGiftFragment fragment = new EditGiftFragment(); Bundle args = new Bundle(); args.putParcelable("gift", gift); fragment.setArguments(args); return fragment; } | /**
* Create Fragment and setup the Bundle arguments
*/ | Create Fragment and setup the Bundle arguments | getInstance | {
"repo_name": "bdiegel/android-giftwise",
"path": "app/src/main/java/com/honu/giftwise/EditGiftFragment.java",
"license": "isc",
"size": 10706
} | [
"android.os.Bundle",
"com.honu.giftwise.data.Gift"
] | import android.os.Bundle; import com.honu.giftwise.data.Gift; | import android.os.*; import com.honu.giftwise.data.*; | [
"android.os",
"com.honu.giftwise"
] | android.os; com.honu.giftwise; | 434,216 |
public Builder setSchema(TableSchema schema) {
this.schema = normalizeTableSchema(schema);
return this;
} | Builder function(TableSchema schema) { this.schema = normalizeTableSchema(schema); return this; } | /**
* required, table schema of this table source.
*/ | required, table schema of this table source | setSchema | {
"repo_name": "bowenli86/flink",
"path": "flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCTableSource.java",
"license": "apache-2.0",
"size": 8640
} | [
"org.apache.flink.api.java.io.jdbc.JdbcTypeUtil",
"org.apache.flink.table.api.TableSchema"
] | import org.apache.flink.api.java.io.jdbc.JdbcTypeUtil; import org.apache.flink.table.api.TableSchema; | import org.apache.flink.api.java.io.jdbc.*; import org.apache.flink.table.api.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,677,834 |
@SuppressWarnings("unchecked")
public <ResultEntity> List<ResultEntity> executeListWithArrayByQuery(
PersistenceManager manager, QueryLanguage language, Class<ResultEntity> resultEntityClass,
String query, Object... parameters)
throws IllegalArgumentException
{
checkNonNull(manager, "manager");
checkNonNull(language, "language");
checkNonNull(resultEntityClass, "resultEntityClass");
checkNonNull(query, "query");
Query q = manager.newQuery(language.getIdentifier(), query);
q.setClass(resultEntityClass);
return (List<ResultEntity>)q.executeWithArray(parameters);
} | @SuppressWarnings(STR) <ResultEntity> List<ResultEntity> function( PersistenceManager manager, QueryLanguage language, Class<ResultEntity> resultEntityClass, String query, Object... parameters) throws IllegalArgumentException { checkNonNull(manager, STR); checkNonNull(language, STR); checkNonNull(resultEntityClass, STR); checkNonNull(query, "query"); Query q = manager.newQuery(language.getIdentifier(), query); q.setClass(resultEntityClass); return (List<ResultEntity>)q.executeWithArray(parameters); } | /**
* Execute a query with parameters to get a list of an entity class.
*
* @param manager
* A persistence manager.
*
* @param language
* A type of query language.
*
* @param resultEntityClass
* An entity class.
*
* @param query
* A query written in the query language.
*
* @param parameters
* Parameters of the query.
*
* @return
* A list of the entity class.
*
* @throws IllegalArgumentException
* {@code manager}, {@code language}, {@code resultEntityClass} or
* {@code query} is {@code null}.
*
* @since 1.18
*/ | Execute a query with parameters to get a list of an entity class | executeListWithArrayByQuery | {
"repo_name": "TakahikoKawasaki/nv-jdo",
"path": "src/main/java/com/neovisionaries/jdo/Dao.java",
"license": "apache-2.0",
"size": 86235
} | [
"java.util.List",
"javax.jdo.PersistenceManager",
"javax.jdo.Query"
] | import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; | import java.util.*; import javax.jdo.*; | [
"java.util",
"javax.jdo"
] | java.util; javax.jdo; | 182,207 |
@Test
public void testInvocationHandlerAbstractClassInvocationConcreteMethod() {
String resultFromAbstractClassConcreteMethod = examplePartialBeanAbstractClass.otherHey("concretemethod");
assertEquals("Other: concretemethod", resultFromAbstractClassConcreteMethod);
} | void function() { String resultFromAbstractClassConcreteMethod = examplePartialBeanAbstractClass.otherHey(STR); assertEquals(STR, resultFromAbstractClassConcreteMethod); } | /**
* Tests the concrete implementation of the "otherHey" method on the
* ExamplePartialBeanAbstractClass bean.
*
* This method's implementation will be provided by the class itself,
* rather than by the InvocationHandler.
*/ | Tests the concrete implementation of the "otherHey" method on the ExamplePartialBeanAbstractClass bean. This method's implementation will be provided by the class itself, rather than by the InvocationHandler | testInvocationHandlerAbstractClassInvocationConcreteMethod | {
"repo_name": "rafabene/jboss-eap-quickstarts",
"path": "deltaspike-partialbean-basic/src/test/java/org/jboss/as/quickstart/deltaspike/partialbean/test/ExamplePartialBeanTest.java",
"license": "apache-2.0",
"size": 3853
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 287,273 |
@Override
public Iterator iterator() {
return new Iterator() {
private volatile int position = 0; | Iterator function() { return new Iterator() { private volatile int position = 0; | /**
* override iterator.
*
* @return object.
*/ | override iterator | iterator | {
"repo_name": "greensnow25/javaaz",
"path": "chapter7/monitore/src/main/java/com/greensnow25/threadSafe/ThreadSafeList.java",
"license": "apache-2.0",
"size": 2891
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 812,540 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.