_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22300 | AssemblyFiles.addEntry | train | public void addEntry(File srcFile, File destFile) {
entries.add(new Entry(srcFile,destFile));
} | java | {
"resource": ""
} |
q22301 | StartOrderResolver.resolve | train | private List<Resolvable> resolve(List<Resolvable> images) {
List<Resolvable> resolved = new ArrayList<>();
// First pass: Pick all data images and all without dependencies
for (Resolvable config : images) {
List<String> volumesOrLinks = extractDependentImagesFor(config);
... | java | {
"resource": ""
} |
q22302 | ArchiveService.createChangedFilesArchive | train | public File createChangedFilesArchive(List<AssemblyFiles.Entry> entries, File assemblyDir,
String imageName, MojoParameters mojoParameters) throws MojoExecutionException {
return dockerAssemblyManager.createChangedFilesArchive(entries, assemblyDir, imageName, mojoParame... | java | {
"resource": ""
} |
q22303 | ContainerNetworkingConfig.aliases | train | public ContainerNetworkingConfig aliases(NetworkConfig config) {
JsonObject endPoints = new JsonObject();
endPoints.add("Aliases", JsonFactory.newJsonArray(config.getAliases()));
JsonObject endpointConfigMap = new JsonObject();
endpointConfigMap.add(config.getCustomNetwork(), endPoints)... | java | {
"resource": ""
} |
q22304 | BuildService.buildImage | train | public void buildImage(ImageConfiguration imageConfig, ImagePullManager imagePullManager, BuildContext buildContext)
throws DockerAccessException, MojoExecutionException {
if (imagePullManager != null) {
autoPullBaseImage(imageConfig, imagePullManager, buildContext);
}
... | java | {
"resource": ""
} |
q22305 | BuildService.buildImage | train | protected void buildImage(ImageConfiguration imageConfig, MojoParameters params, boolean noCache, Map<String, String> buildArgs)
throws DockerAccessException, MojoExecutionException {
String imageName = imageConfig.getName();
ImageName.validate(imageName);
BuildImageConfiguration b... | java | {
"resource": ""
} |
q22306 | RunService.stopContainer | train | public void stopContainer(String containerId,
ImageConfiguration imageConfig,
boolean keepContainer,
boolean removeVolumes)
throws DockerAccessException, ExecException {
ContainerTracker.ContainerShutdownDescriptor... | java | {
"resource": ""
} |
q22307 | RunService.stopPreviouslyStartedContainer | train | public void stopPreviouslyStartedContainer(String containerId,
boolean keepContainer,
boolean removeVolumes)
throws DockerAccessException, ExecException {
ContainerTracker.ContainerShutdownDescriptor descriptor... | java | {
"resource": ""
} |
q22308 | RunService.stopStartedContainers | train | public void stopStartedContainers(boolean keepContainer,
boolean removeVolumes,
boolean removeCustomNetworks,
GavLabel gavLabel)
throws DockerAccessException, ExecException {
Set<Network> ne... | java | {
"resource": ""
} |
q22309 | RunService.getImagesConfigsInOrder | train | public List<StartOrderResolver.Resolvable> getImagesConfigsInOrder(QueryService queryService, List<ImageConfiguration> images) {
return StartOrderResolver.resolve(queryService, convertToResolvables(images));
} | java | {
"resource": ""
} |
q22310 | RunService.createPortMapping | train | public PortMapping createPortMapping(RunImageConfiguration runConfig, Properties properties) {
try {
return new PortMapping(runConfig.getPorts(), properties);
} catch (IllegalArgumentException exp) {
throw new IllegalArgumentException("Cannot parse port mapping", exp);
}
... | java | {
"resource": ""
} |
q22311 | RunService.addShutdownHookForStoppingContainers | train | public void addShutdownHookForStoppingContainers(final boolean keepContainer, final boolean removeVolumes, final boolean removeCustomNetworks) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
stopStartedContaine... | java | {
"resource": ""
} |
q22312 | RunService.createVolumesAsPerVolumeBinds | train | public List<String> createVolumesAsPerVolumeBinds(ServiceHub hub, List<String> binds, List<VolumeConfiguration> volumes)
throws DockerAccessException {
Map<String, Integer> indexMap = new HashMap<>();
List<String> volumesCreated = new ArrayList<>();
for (int index = 0; index < volu... | java | {
"resource": ""
} |
q22313 | LocalSocketUtil.canConnectUnixSocket | train | public static boolean canConnectUnixSocket(File path) {
try (UnixSocketChannel channel = UnixSocketChannel.open()) {
return channel.connect(new UnixSocketAddress(path));
} catch (IOException e) {
return false;
}
} | java | {
"resource": ""
} |
q22314 | AwsSigner4Request.getOrderedHeadersToSign | train | private static Map<String, String> getOrderedHeadersToSign(Header[] headers) {
Map<String, String> unique = new TreeMap<>();
for (Header header : headers) {
String key = header.getName().toLowerCase(Locale.US).trim();
if (key.equals("connection")) {
// do not sign... | java | {
"resource": ""
} |
q22315 | AwsSigner4Request.canonicalHeaders | train | private static String canonicalHeaders(Map<String, String> headers) {
StringBuilder canonical = new StringBuilder();
for (Map.Entry<String, String> header : headers.entrySet()) {
canonical.append(header.getKey()).append(':').append(header.getValue()).append('\n');
}
return ca... | java | {
"resource": ""
} |
q22316 | PortMapping.updateProperties | train | public void updateProperties(Map<String, Container.PortBinding> dockerObtainedDynamicBindings) {
for (Map.Entry<String, Container.PortBinding> entry : dockerObtainedDynamicBindings.entrySet()) {
String variable = entry.getKey();
Container.PortBinding portBinding = entry.getValue();
... | java | {
"resource": ""
} |
q22317 | PortMapping.toDockerPortBindingsJson | train | JsonObject toDockerPortBindingsJson() {
Map<String, Integer> portMap = getContainerPortToHostPortMap();
if (!portMap.isEmpty()) {
JsonObject portBindings = new JsonObject();
Map<String, String> bindToMap = getBindToHostMap();
for (Map.Entry<String, Integer> entry : p... | java | {
"resource": ""
} |
q22318 | PortMapping.toJson | train | public JsonArray toJson() {
Map<String, Integer> portMap = getContainerPortToHostPortMap();
if (portMap.isEmpty()) {
return null;
}
JsonArray ret = new JsonArray();
Map<String, String> bindToMap = getBindToHostMap();
for (Map.Entry<String, Integer> entry : p... | java | {
"resource": ""
} |
q22319 | PortMapping.getPortFromProjectOrSystemProperty | train | private Integer getPortFromProjectOrSystemProperty(String var) {
String sysProp = System.getProperty(var);
if (sysProp != null) {
return getAsIntOrNull(sysProp);
}
if (projProperties.containsKey(var)) {
return getAsIntOrNull(projProperties.getProperty(var));
... | java | {
"resource": ""
} |
q22320 | MappingTrackArchiver.getAssemblyFiles | train | public AssemblyFiles getAssemblyFiles(MavenSession session) {
AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName));
// Where the 'real' files are copied to
for (Addition addition : added) {
Object resource = addition.resource;
File ... | java | {
"resource": ""
} |
q22321 | MappingTrackArchiver.getArtifactFromJar | train | private Artifact getArtifactFromJar(File jar) {
// Lets figure the real mvn source of file.
String type = extractFileType(jar);
if (type != null) {
try {
ArrayList<Properties> options = new ArrayList<Properties>();
try (ZipInputStream in = new ZipInput... | java | {
"resource": ""
} |
q22322 | DockerAccessWithHcClient.logRemoveResponse | train | private void logRemoveResponse(JsonArray logElements) {
for (int i = 0; i < logElements.size(); i++) {
JsonObject entry = logElements.get(i).getAsJsonObject();
for (Object key : entry.keySet()) {
log.debug("%s: %s", key, entry.get(key.toString()));
}
}... | java | {
"resource": ""
} |
q22323 | AuthConfigFactory.extendedAuthentication | train | private AuthConfig extendedAuthentication(AuthConfig standardAuthConfig, String registry) throws IOException, MojoExecutionException {
EcrExtendedAuth ecr = new EcrExtendedAuth(log, registry);
if (ecr.isAwsRegistry()) {
return ecr.extendedAuth(standardAuthConfig);
}
return st... | java | {
"resource": ""
} |
q22324 | AuthConfigFactory.parseOpenShiftConfig | train | private AuthConfig parseOpenShiftConfig() {
Map kubeConfig = DockerFileUtil.readKubeConfig();
if (kubeConfig == null) {
return null;
}
String currentContextName = (String) kubeConfig.get("current-context");
if (currentContextName == null) {
return null;
... | java | {
"resource": ""
} |
q22325 | QueryService.getMandatoryContainer | train | public Container getMandatoryContainer(String containerIdOrName) throws DockerAccessException {
Container container = getContainer(containerIdOrName);
if (container == null) {
throw new DockerAccessException("Cannot find container %s", containerIdOrName);
}
return container;
... | java | {
"resource": ""
} |
q22326 | QueryService.getNetworkByName | train | public Network getNetworkByName(final String networkName) throws DockerAccessException {
for (Network el : docker.listNetworks()) {
if (networkName.equals(el.getName())) {
return el;
}
}
return null;
} | java | {
"resource": ""
} |
q22327 | QueryService.getContainersForImage | train | public List<Container> getContainersForImage(final String image, final boolean all) throws DockerAccessException {
return docker.getContainersForImage(image, all);
} | java | {
"resource": ""
} |
q22328 | LogRequestor.fetchLogs | train | public void fetchLogs() {
try {
callback.open();
this.request = getLogRequest(false);
final HttpResponse response = client.execute(request);
parseResponse(response);
} catch (LogCallback.DoneException e) {
// Signifies we're finished with the l... | java | {
"resource": ""
} |
q22329 | LogRequestor.run | train | public void run() {
try {
callback.open();
this.request = getLogRequest(true);
final HttpResponse response = client.execute(request);
parseResponse(response);
} catch (LogCallback.DoneException e) {
// Signifies we're finished with the log stre... | java | {
"resource": ""
} |
q22330 | DockerAssemblyConfigurationSource.mainProjectInterpolator | train | private FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject)
{
if (mainProject != null) {
// 5
return FixedStringSearchInterpolator.create(
new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource(
Interpolat... | java | {
"resource": ""
} |
q22331 | NamePatternUtil.convertImageNamePattern | train | public static String convertImageNamePattern(String pattern) {
final String REGEX_PREFIX = "%regex[", ANT_PREFIX = "%ant[", PATTERN_SUFFIX="]";
if(pattern.startsWith(REGEX_PREFIX) && pattern.endsWith(PATTERN_SUFFIX)) {
return pattern.substring(REGEX_PREFIX.length(), pattern.length() - PATTE... | java | {
"resource": ""
} |
q22332 | AwsSigner4.sign | train | void sign(HttpRequest request, AuthConfig credentials, Date signingTime) {
AwsSigner4Request sr = new AwsSigner4Request(region, service, request, signingTime);
if(!request.containsHeader("X-Amz-Date")) {
request.addHeader("X-Amz-Date", sr.getSigningDateTime());
}
request.addH... | java | {
"resource": ""
} |
q22333 | PropertyConfigHandler.buildConfigured | train | private boolean buildConfigured(BuildImageConfiguration config, ValueProvider valueProvider, MavenProject project) {
if (isStringValueNull(valueProvider, config, FROM, () -> config.getFrom())) {
return true;
}
if (valueProvider.getMap(FROM_EXT, config == null ? null : config.getFr... | java | {
"resource": ""
} |
q22334 | PropertyConfigHandler.extractPortValues | train | private List<String> extractPortValues(List<String> config, ValueProvider valueProvider) {
List<String> ret = new ArrayList<>();
List<String> ports = valueProvider.getList(PORTS, config);
if (ports == null) {
return null;
}
List<String[]> parsedPorts = EnvUtil.splitOn... | java | {
"resource": ""
} |
q22335 | BuildMojo.processImageConfig | train | private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException {
BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration();
if (buildConfig != null) {
if(buildConfig.skip()) {
log.info("%s : Skippe... | java | {
"resource": ""
} |
q22336 | UrlBuilder.u | train | private Builder u(String format, String ... args) {
return new Builder(createUrl(String.format(format, (Object[]) encodeArgs(args))));
} | java | {
"resource": ""
} |
q22337 | ImageName.getSimpleName | train | public String getSimpleName() {
String prefix = user + "/";
return repository.startsWith(prefix) ? repository.substring(prefix.length()) : repository;
} | java | {
"resource": ""
} |
q22338 | ImageName.doValidate | train | private void doValidate() {
List<String> errors = new ArrayList<>();
// Strip off user from repository name
String image = user != null ? repository.substring(user.length() + 1) : repository;
Object[] checks = new Object[] {
"registry", DOMAIN_REGEXP, registry,
"i... | java | {
"resource": ""
} |
q22339 | ImageArchiveUtil.findEntryByRepoTag | train | public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest) {
if(repoTag == null || manifest == null) {
return null;
}
for(ImageArchiveManifestEntry entry : manifest.getEntries()) {
for(String entryRepoTag : entry.getRepoTags... | java | {
"resource": ""
} |
q22340 | ImageArchiveUtil.mapEntriesById | train | public static Map<String, ImageArchiveManifestEntry> mapEntriesById(Iterable<ImageArchiveManifestEntry> entries) {
Map<String, ImageArchiveManifestEntry> mapped = new LinkedHashMap<>();
for(ImageArchiveManifestEntry entry : entries) {
mapped.put(entry.getId(), entry);
}
ret... | java | {
"resource": ""
} |
q22341 | StartMojo.hasBeenAllImagesStarted | train | private boolean hasBeenAllImagesStarted(Queue<ImageConfiguration> imagesWaitingToStart, Queue<ImageConfiguration> imagesStarting) {
return imagesWaitingToStart.isEmpty() && imagesStarting.isEmpty();
} | java | {
"resource": ""
} |
q22342 | StartMojo.getImagesWhoseDependenciesHasStarted | train | private List<ImageConfiguration> getImagesWhoseDependenciesHasStarted(Queue<ImageConfiguration> imagesRemaining,
Set<String> containersStarted,
Set<String> aliases) {
... | java | {
"resource": ""
} |
q22343 | StartMojo.prepareStart | train | private Queue<ImageConfiguration> prepareStart(ServiceHub hub, QueryService queryService, RunService runService, Set<String> imageAliases)
throws DockerAccessException, MojoExecutionException {
final Queue<ImageConfiguration> imagesWaitingToStart = new ArrayDeque<>();
for (StartOrderResolver.Res... | java | {
"resource": ""
} |
q22344 | DockerFileUtil.extractLines | train | public static List<String[]> extractLines(File dockerFile, String keyword, FixedStringSearchInterpolator interpolator) throws IOException {
List<String[]> ret = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) {
String line;
while ((... | java | {
"resource": ""
} |
q22345 | DockerFileUtil.interpolate | train | public static String interpolate(File dockerFile, FixedStringSearchInterpolator interpolator) throws IOException {
StringBuilder ret = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) {
String line;
while ((line = reader.readLine()... | java | {
"resource": ""
} |
q22346 | DockerFileUtil.createInterpolator | train | public static FixedStringSearchInterpolator createInterpolator(MojoParameters params, String filter) {
String[] delimiters = extractDelimiters(filter);
if (delimiters == null) {
// Don't interpolate anything
return FixedStringSearchInterpolator.create();
}
Docker... | java | {
"resource": ""
} |
q22347 | FieldScopeLogicMap.with | train | public FieldScopeLogicMap<V> with(FieldScopeLogic fieldScopeLogic, V value) {
ImmutableList.Builder<Entry<V>> newEntries = ImmutableList.builder();
// Earlier entries override later ones, so we insert the new one at the front of the list.
newEntries.add(Entry.of(fieldScopeLogic, value));
newEntries.addA... | java | {
"resource": ""
} |
q22348 | FieldScopeLogicMap.defaultValue | train | public static <V> FieldScopeLogicMap<V> defaultValue(V value) {
return new FieldScopeLogicMap<>(ImmutableList.of(Entry.of(FieldScopeLogic.all(), value)));
} | java | {
"resource": ""
} |
q22349 | FieldScopeUtil.fieldNumbersFunction | train | static Function<Optional<Descriptor>, String> fieldNumbersFunction(
final String fmt, final Iterable<Integer> fieldNumbers) {
return new Function<Optional<Descriptor>, String>() {
@Override
public String apply(Optional<Descriptor> optDescriptor) {
return resolveFieldNumbers(optDescriptor, ... | java | {
"resource": ""
} |
q22350 | FieldScopeUtil.fieldScopeFunction | train | static Function<Optional<Descriptor>, String> fieldScopeFunction(
final String fmt, final FieldScope fieldScope) {
return new Function<Optional<Descriptor>, String>() {
@Override
public String apply(Optional<Descriptor> optDescriptor) {
return String.format(fmt, fieldScope.usingCorresponde... | java | {
"resource": ""
} |
q22351 | FieldScopeUtil.concat | train | static Function<Optional<Descriptor>, String> concat(
final Function<? super Optional<Descriptor>, String> function1,
final Function<? super Optional<Descriptor>, String> function2) {
return new Function<Optional<Descriptor>, String>() {
@Override
public String apply(Optional<Descriptor> opt... | java | {
"resource": ""
} |
q22352 | FieldScopeUtil.getSingleDescriptor | train | static Optional<Descriptor> getSingleDescriptor(Iterable<? extends Message> messages) {
Optional<Descriptor> optDescriptor = Optional.absent();
for (Message message : messages) {
if (message != null) {
Descriptor descriptor = message.getDescriptorForType();
if (!optDescriptor.isPresent()) ... | java | {
"resource": ""
} |
q22353 | MultimapSubject.containsExactly | train | @CanIgnoreReturnValue
public Ordered containsExactly() {
return check().about(iterableEntries()).that(actual().entries()).containsExactly();
} | java | {
"resource": ""
} |
q22354 | MultimapSubject.advanceToFind | train | private static boolean advanceToFind(Iterator<?> iterator, Object value) {
while (iterator.hasNext()) {
if (Objects.equal(iterator.next(), value)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q22355 | TruthFailureSubject.factKeys | train | public IterableSubject factKeys() {
if (!(actual() instanceof ErrorWithFacts)) {
failWithActual(simpleFact("expected a failure thrown by Truth's new failure API"));
return ignoreCheck().that(ImmutableList.of());
}
ErrorWithFacts error = (ErrorWithFacts) actual();
return check("factKeys()").t... | java | {
"resource": ""
} |
q22356 | MapWithProtoValuesSubject.usingFloatToleranceForFieldDescriptorsForValues | train | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldDescriptorsForValues(
float tolerance, FieldDescriptor firstFieldDescriptor, FieldDescriptor... rest) {
return usingConfig(
config.usingFloatToleranceForFieldDescriptors(
tolerance, asList(firstFieldDescriptor, rest)));... | java | {
"resource": ""
} |
q22357 | FieldScopeLogic.ignoringFields | train | FieldScopeLogic ignoringFields(Iterable<Integer> fieldNumbers) {
if (isEmpty(fieldNumbers)) {
return this;
}
return and(
this,
new NegationFieldScopeLogic(new FieldNumbersLogic(fieldNumbers, /* isRecursive = */ true)));
} | java | {
"resource": ""
} |
q22358 | IntStreamSubject.containsAnyOf | train | @SuppressWarnings("GoodTime") // false positive; b/122617528
public void containsAnyOf(int first, int second, int... rest) {
check().that(actualList).containsAnyOf(first, second, box(rest));
} | java | {
"resource": ""
} |
q22359 | StringSubject.hasLength | train | public void hasLength(int expectedLength) {
checkArgument(expectedLength >= 0, "expectedLength(%s) must be >= 0", expectedLength);
check("length()").that(actual().length()).isEqualTo(expectedLength);
} | java | {
"resource": ""
} |
q22360 | StringSubject.contains | train | public void contains(CharSequence string) {
checkNotNull(string);
if (actual() == null) {
failWithActual("expected a string that contains", string);
} else if (!actual().contains(string)) {
failWithActual("expected to contain", string);
}
} | java | {
"resource": ""
} |
q22361 | StringSubject.startsWith | train | public void startsWith(String string) {
checkNotNull(string);
if (actual() == null) {
failWithActual("expected a string that starts with", string);
} else if (!actual().startsWith(string)) {
failWithActual("expected to start with", string);
}
} | java | {
"resource": ""
} |
q22362 | StringSubject.endsWith | train | public void endsWith(String string) {
checkNotNull(string);
if (actual() == null) {
failWithActual("expected a string that ends with", string);
} else if (!actual().endsWith(string)) {
failWithActual("expected to end with", string);
}
} | java | {
"resource": ""
} |
q22363 | StringSubject.matches | train | @GwtIncompatible("java.util.regex.Pattern")
public void matches(Pattern regex) {
if (!regex.matcher(actual()).matches()) {
failWithActual("expected to match", regex);
}
} | java | {
"resource": ""
} |
q22364 | StringSubject.containsMatch | train | @GwtIncompatible("java.util.regex.Pattern")
public void containsMatch(Pattern regex) {
if (!regex.matcher(actual()).find()) {
failWithActual("expected to contain a match for", regex);
}
} | java | {
"resource": ""
} |
q22365 | StringSubject.doesNotContainMatch | train | @GwtIncompatible("java.util.regex.Pattern")
public void doesNotContainMatch(Pattern regex) {
Matcher matcher = regex.matcher(actual());
if (matcher.find()) {
failWithoutActual(
fact("expected not to contain a match for", regex),
fact("but contained", matcher.group()),
fact(... | java | {
"resource": ""
} |
q22366 | Platform.containsMatch | train | static boolean containsMatch(String actual, String regex) {
return Pattern.compile(regex).matcher(actual).find();
} | java | {
"resource": ""
} |
q22367 | Correspondence.formattingDiffsUsing | train | public Correspondence<A, E> formattingDiffsUsing(DiffFormatter<? super A, ? super E> formatter) {
return new FormattingDiffs<>(this, formatter);
} | java | {
"resource": ""
} |
q22368 | ComparisonFailureWithFacts.formatExpectedAndActual | train | @VisibleForTesting
static ImmutableList<Fact> formatExpectedAndActual(String expected, String actual) {
ImmutableList<Fact> result;
// TODO(cpovirk): Call attention to differences in trailing whitespace.
// TODO(cpovirk): And changes in the *kind* of whitespace characters in the middle of the line.
... | java | {
"resource": ""
} |
q22369 | ComparisonFailureWithFacts.validSurrogatePairAt | train | private static boolean validSurrogatePairAt(CharSequence string, int index) {
return index >= 0
&& index <= (string.length() - 2)
&& isHighSurrogate(string.charAt(index))
&& isLowSurrogate(string.charAt(index + 1));
} | java | {
"resource": ""
} |
q22370 | Platform.isInstanceOfType | train | static boolean isInstanceOfType(Object instance, Class<?> clazz) {
if (clazz.isInterface()) {
throw new UnsupportedOperationException(
"Under GWT, we can't determine whether an object is an instance of an interface Class");
}
for (Class<?> current = instance.getClass();
current != n... | java | {
"resource": ""
} |
q22371 | ProtoTruthMessageDifferencer.diffMessages | train | DiffResult diffMessages(Message actual, Message expected) {
checkNotNull(actual);
checkNotNull(expected);
checkArgument(
actual.getDescriptorForType() == expected.getDescriptorForType(),
"The actual [%s] and expected [%s] message descriptors do not match.",
actual.getDescriptorForTyp... | java | {
"resource": ""
} |
q22372 | ProtoTruthMessageDifferencer.findMatchingPairResult | train | @NullableDecl
private RepeatedField.PairResult findMatchingPairResult(
Deque<Integer> actualIndices,
List<?> actualValues,
int expectedIndex,
Object expectedValue,
boolean excludeNonRecursive,
FieldDescriptor fieldDescriptor,
FluentEqualityConfig config) {
Iterator<Intege... | java | {
"resource": ""
} |
q22373 | SubjectUtils.annotateEmptyStrings | train | static <T> Iterable<T> annotateEmptyStrings(Iterable<T> items) {
if (Iterables.contains(items, "")) {
List<T> annotatedItems = Lists.newArrayList();
for (T item : items) {
if (Objects.equal(item, "")) {
// This is a safe cast because know that at least one instance of T (this item) is ... | java | {
"resource": ""
} |
q22374 | FailureMetadata.description | train | private ImmutableList<Fact> description() {
String description = null;
boolean descriptionWasDerived = false;
for (Step step : steps) {
if (step.isCheckCall()) {
checkState(description != null);
if (step.descriptionUpdate == null) {
description = null;
descriptionWa... | java | {
"resource": ""
} |
q22375 | MapSubject.containsExactlyEntriesIn | train | @CanIgnoreReturnValue
public Ordered containsExactlyEntriesIn(Map<?, ?> expectedMap) {
if (expectedMap.isEmpty()) {
if (actual().isEmpty()) {
return IN_ORDER;
} else {
isEmpty(); // fails
return ALREADY_FAILED;
}
}
boolean containsAnyOrder =
containsEntrie... | java | {
"resource": ""
} |
q22376 | MapSubject.containsAtLeastEntriesIn | train | @CanIgnoreReturnValue
public Ordered containsAtLeastEntriesIn(Map<?, ?> expectedMap) {
if (expectedMap.isEmpty()) {
return IN_ORDER;
}
boolean containsAnyOrder =
containsEntriesInAnyOrder(expectedMap, "contains at least", /* allowUnexpected= */ true);
if (containsAnyOrder) {
return... | java | {
"resource": ""
} |
q22377 | Fact.makeMessage | train | static String makeMessage(ImmutableList<String> messages, ImmutableList<Fact> facts) {
int longestKeyLength = 0;
boolean seenNewlineInValue = false;
for (Fact fact : facts) {
if (fact.value != null) {
longestKeyLength = max(longestKeyLength, fact.key.length());
// TODO(cpovirk): Look f... | java | {
"resource": ""
} |
q22378 | FieldDescriptorOrUnknown.shortName | train | final String shortName() {
if (fieldDescriptor().isPresent()) {
return fieldDescriptor().get().isExtension()
? "[" + fieldDescriptor().get() + "]"
: fieldDescriptor().get().getName();
} else {
return String.valueOf(unknownFieldDescriptor().get().fieldNumber());
}
} | java | {
"resource": ""
} |
q22379 | IterableSubject.hasSize | train | public final void hasSize(int expectedSize) {
checkArgument(expectedSize >= 0, "expectedSize(%s) must be >= 0", expectedSize);
int actualSize = size(actual());
check("size()").that(actualSize).isEqualTo(expectedSize);
} | java | {
"resource": ""
} |
q22380 | IterableSubject.containsNoDuplicates | train | public final void containsNoDuplicates() {
List<Entry<?>> duplicates = newArrayList();
for (Multiset.Entry<?> entry : LinkedHashMultiset.create(actual()).entrySet()) {
if (entry.getCount() > 1) {
duplicates.add(entry);
}
}
if (!duplicates.isEmpty()) {
failWithoutActual(
... | java | {
"resource": ""
} |
q22381 | IterableSubject.containsAtLeastElementsIn | train | @CanIgnoreReturnValue
public final Ordered containsAtLeastElementsIn(Iterable<?> expectedIterable) {
List<?> actual = Lists.newLinkedList(actual());
final Collection<?> expected = iterableToCollection(expectedIterable);
List<Object> missing = newArrayList();
List<Object> actualNotInOrder = newArrayLi... | java | {
"resource": ""
} |
q22382 | IterableSubject.moveElements | train | private static void moveElements(List<?> input, Collection<Object> output, int maxElements) {
for (int i = 0; i < maxElements; i++) {
output.add(input.remove(0));
}
} | java | {
"resource": ""
} |
q22383 | RecursableDiffEntity.isAnyChildMatched | train | final boolean isAnyChildMatched() {
if (isAnyChildMatched == null) {
isAnyChildMatched = false;
for (RecursableDiffEntity entity : childEntities()) {
if ((entity.isMatched() && !entity.isContentEmpty()) || entity.isAnyChildMatched()) {
isAnyChildMatched = true;
break;
... | java | {
"resource": ""
} |
q22384 | RecursableDiffEntity.isAnyChildIgnored | train | final boolean isAnyChildIgnored() {
if (isAnyChildIgnored == null) {
isAnyChildIgnored = false;
for (RecursableDiffEntity entity : childEntities()) {
if ((entity.isIgnored() && !entity.isContentEmpty()) || entity.isAnyChildIgnored()) {
isAnyChildIgnored = true;
break;
... | java | {
"resource": ""
} |
q22385 | StackTraceCleaner.addToStreak | train | private void addToStreak(StackTraceElementWrapper stackTraceElementWrapper) {
if (stackTraceElementWrapper.getStackFrameType() != currentStreakType) {
endStreak();
currentStreakType = stackTraceElementWrapper.getStackFrameType();
currentStreakLength = 1;
} else {
currentStreakLength++;
... | java | {
"resource": ""
} |
q22386 | StackTraceCleaner.endStreak | train | private void endStreak() {
if (currentStreakLength == 0) {
return;
}
if (currentStreakLength == 1) {
// A single frame isn't a streak. Just include the frame as-is in the result.
cleanedStackTrace.add(lastStackFrameElementWrapper);
} else {
// Add a single frame to the result su... | java | {
"resource": ""
} |
q22387 | MapFileWriter.writeFile | train | public static void writeFile(MapWriterConfiguration configuration, TileBasedDataProcessor dataProcessor)
throws IOException {
EXECUTOR_SERVICE = Executors.newFixedThreadPool(configuration.getThreads());
RandomAccessFile randomAccessFile = new RandomAccessFile(configuration.getOutputFile(), "... | java | {
"resource": ""
} |
q22388 | AbstractPoiPersistenceManager.stringToTags | train | protected static Set<Tag> stringToTags(String data) {
Set<Tag> tags = new HashSet<>();
String[] split = data.split("\r");
for (String s : split) {
if (s.indexOf(Tag.KEY_VALUE_SEPARATOR) > -1) {
String[] keyValue = s.split(String.valueOf(Tag.KEY_VALUE_SEPARATOR));
... | java | {
"resource": ""
} |
q22389 | AbstractPoiPersistenceManager.tagsToString | train | protected static String tagsToString(Set<Tag> tags) {
StringBuilder sb = new StringBuilder();
for (Tag tag : tags) {
if (sb.length() > 0) {
sb.append('\r');
}
sb.append(tag.key).append(Tag.KEY_VALUE_SEPARATOR).append(tag.value);
}
retur... | java | {
"resource": ""
} |
q22390 | FileSystemTileCache.storeData | train | private void storeData(Job key, TileBitmap bitmap) {
OutputStream outputStream = null;
try {
File file = getOutputFile(key);
if (file == null) {
// if the file cannot be written, silently return
return;
}
outputStream = new ... | java | {
"resource": ""
} |
q22391 | ClusterMapActivity.onOptionsItemSelected | train | @Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case 1234:
if (clusterer != null) {
break;
}
// create clusterer instance
clu... | java | {
"resource": ""
} |
q22392 | GeoTagger.updateTagData | train | private void updateTagData(Map<Poi, Map<String, String>> pois, String key, String value) {
for (Map.Entry<Poi, Map<String, String>> entry : pois.entrySet()) {
Poi poi = entry.getKey();
String tmpValue = value;
Map<String, String> tagmap = entry.getValue();
if (!t... | java | {
"resource": ""
} |
q22393 | TDRelation.fromRelation | train | public static TDRelation fromRelation(Relation relation, WayResolver resolver, List<String> preferredLanguages) {
if (relation == null) {
return null;
}
if (relation.getMembers().isEmpty()) {
return null;
}
SpecialTagExtractionResult ster = OSMUtils.extr... | java | {
"resource": ""
} |
q22394 | GroupLayer.onTap | train | @Override
public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) {
for (int i = layers.size() - 1; i >= 0; i--) {
Layer layer = layers.get(i);
if (layer.onTap(tapLatLong, layerXY, tapXY)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q22395 | ClusterManager.isItemInViewport | train | protected boolean isItemInViewport(final GeoItem item) {
BoundingBox curBounds = getCurBounds();
return curBounds != null && curBounds.contains(item.getLatLong());
} | java | {
"resource": ""
} |
q22396 | ClusterManager.getCurBounds | train | protected synchronized BoundingBox getCurBounds() {
if (currBoundingBox == null) {
if (mapView == null) {
throw new NullPointerException("mapView == null");
}
if (mapView.getWidth() <= 0 || mapView.getHeight() <= 0) {
throw new IllegalArgumentE... | java | {
"resource": ""
} |
q22397 | ClusterManager.addLeftItems | train | private void addLeftItems() {
// Log.w(TAG,"addLeftItems() {.... (0)");
if (leftItems.size() == 0) {
return;
}
// Log.w(TAG,"addLeftItems() {.... (1)");
ArrayList<T> currentLeftItems = new ArrayList<T>();
currentLeftItems.addAll(leftItems);
// Log.w(T... | java | {
"resource": ""
} |
q22398 | ClusterManager.resetViewport | train | private synchronized void resetViewport(boolean isMoving) {
isClustering = true;
clusterTask = new ClusterTask();
clusterTask.execute(new Boolean[]{isMoving});
} | java | {
"resource": ""
} |
q22399 | PoiWriter.commit | train | private void commit() throws SQLException {
LOGGER.info("Committing...");
this.progressManager.setMessage("Committing...");
this.pStmtIndex.executeBatch();
this.pStmtData.executeBatch();
this.pStmtCatMap.executeBatch();
if (this.configuration.isGeoTags()) {
th... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.