method2testcases stringlengths 118 3.08k |
|---|
### Question:
IAMPolicyManager { public String getReadOnlyArn(SecretsGroupIdentifier group) { return getArn(group, AccessLevel.READONLY); } IAMPolicyManager(AmazonIdentityManagement client, AWSCredentialsProvider awsCredentials, ClientConfiguration clientConfiguration); static IAMPolicyManager fromCredentials(AWSCreden... |
### Question:
FileEncryptionContext implements EncryptionContext { @Override public Map<String, String> toMap() { return ImmutableMap.of( "0", FILE_VERSION, "1", groupIdentifier.region.getName(), "2", groupIdentifier.name); } FileEncryptionContext(SecretsGroupIdentifier groupIdentifier); @Override Map<String, String> t... |
### Question:
FilterGenerator { public static String convertNumberToLetters(int number) { int range = 'z'-'a' + 1; StringBuilder sb = new StringBuilder(); do { int last = number % range; sb.append(Character.toChars('a' + last)); number /= range; } while (number != 0); return sb.reverse().toString(); } FilterGenerator(i... |
### Question:
IAMPolicyName { @Override public String toString() { return String.format("%s_%s_%s_%s", AWSResourceNameSerialization.GLOBAL_PREFIX, group.region.getName(), AWSResourceNameSerialization.encodeSecretsGroupName(group.name), accessLevel); } IAMPolicyName(SecretsGroupIdentifier group, AccessLevel accessLevel)... |
### Question:
IAMPolicyName { @Override public boolean equals(final Object obj) { if (obj instanceof IAMPolicyName) { final IAMPolicyName other = (IAMPolicyName) obj; return Objects.equal(group, other.group) && Objects.equal(accessLevel, other.accessLevel); } else { return false; } } IAMPolicyName(SecretsGroupIdentifie... |
### Question:
UserConfig { public void addLocalFilePath(SecretsGroupIdentifier group, File path) { checkUniqueGroup(group); checkUniqueFilePath(path); localFiles.put(group, path); } UserConfig(@JsonProperty("localFiles") Map<SecretsGroupIdentifier, File> localFiles); UserConfig(); Map<SecretsGroupIdentifier, File> get... |
### Question:
FileUserConfig extends UserConfig { @Override public Optional<File> getLocalFilePath(SecretsGroupIdentifier group) { return Optional.ofNullable(localFiles.get(group)); } FileUserConfig(File configFile); @Override Optional<File> getLocalFilePath(SecretsGroupIdentifier group); @Override void addLocalFilePat... |
### Question:
FileUserConfig extends UserConfig { @Override public void updateLocalFilePath(SecretsGroupIdentifier group, File path) { checkUniqueFilePath(path); localFiles.put(group, path); persist(); } FileUserConfig(File configFile); @Override Optional<File> getLocalFilePath(SecretsGroupIdentifier group); @Override ... |
### Question:
FileUserConfig extends UserConfig { @Override public void removeLocalFilePath(SecretsGroupIdentifier group) { localFiles.remove(group); persist(); } FileUserConfig(File configFile); @Override Optional<File> getLocalFilePath(SecretsGroupIdentifier group); @Override void addLocalFilePath(SecretsGroupIdentif... |
### Question:
AWSResourceNameSerialization { public static String decodeSecretsGroupName(String encoded) { return encoded.replace('-', '.'); } static String decodeSecretsGroupName(String encoded); static String encodeSecretsGroupName(String name); static final String GLOBAL_PREFIX; static final String GLOBAL_STRING_DE... |
### Question:
AWSResourceNameSerialization { public static String encodeSecretsGroupName(String name) { return name.replace('.', '-'); } static String decodeSecretsGroupName(String encoded); static String encodeSecretsGroupName(String name); static final String GLOBAL_PREFIX; static final String GLOBAL_STRING_DELIMITE... |
### Question:
RawSecretEntry implements BestEffortShred { public String toJsonBlob() { try { return objectMapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new SerializationException("Failed to serialize secret entry to JSON blob", e); } } @Deprecated RawSecretEntry(); RawSecretEntry(@JsonP... |
### Question:
RawSecretEntry implements BestEffortShred { public static RawSecretEntry fromJsonBlob(String jsonBlob) { try { return objectMapper.readValue(jsonBlob, RawSecretEntry.class); } catch (IOException e) { throw new ParseException("Failed to deserialize secret entry from JSON blob", e); } } @Deprecated RawSecr... |
### Question:
RoleARN extends ARN { public String getRoleName() { return this.resource; } RoleARN(final String arn); String getRoleName(); }### Answer:
@Test public void role() { RoleARN arn = new RoleARN("arn:aws:iam::12345:role/role-name"); assertThat(arn.getRoleName(), is("role-name")); } |
### Question:
SecretValue implements BestEffortShred { @Override public boolean equals(final Object obj) { if (obj instanceof SecretValue) { final SecretValue other = (SecretValue) obj; return Arrays.equals(secretValue, other.asByteArray()) && Objects.equal(type, other.type) && Objects.equal(encoding, other.encoding); ... |
### Question:
Principal { @Override public String toString() { return String.format("%s [%s]", name, type.toString()); } Principal(PrincipalType type, String principalName); static Principal fromArn(String arn, String account); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object... |
### Question:
Principal { @Override public boolean equals(final Object obj) { if(obj instanceof Principal){ final Principal other = (Principal) obj; return Objects.equal(name, other.name) && Objects.equal(type, other.type); } else{ return false; } } Principal(PrincipalType type, String principalName); static Principal ... |
### Question:
SecretsGroupIdentifier implements Comparable<SecretsGroupIdentifier> { @Override public String toString() { return String.format("%s [%s]", name, region.getName()); } SecretsGroupIdentifier(@JsonProperty("region") Region region,
@JsonProperty("name") String name); @Overri... |
### Question:
SecretsGroupIdentifier implements Comparable<SecretsGroupIdentifier> { @Override public boolean equals(final Object obj) { if(obj instanceof SecretsGroupIdentifier){ final SecretsGroupIdentifier other = (SecretsGroupIdentifier) obj; return Objects.equal(name, other.name) && Objects.equal(region, other.reg... |
### Question:
SecretsGroupIdentifier implements Comparable<SecretsGroupIdentifier> { @Override public int compareTo(SecretsGroupIdentifier o) { if (region.compareTo(o.region) == 0) { return name.compareTo(o.name); } else { return region.compareTo(o.region); } } SecretsGroupIdentifier(@JsonProperty("region") Region regi... |
### Question:
SecretIdentifier { @Override public String toString() { return name; } @JsonCreator SecretIdentifier(@JsonProperty("name") String name); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj); final String name; }### Answer:
@Test public void testConstructWithVa... |
### Question:
SecretIdentifier { @Override public boolean equals(final Object obj) { if(obj instanceof SecretIdentifier){ final SecretIdentifier other = (SecretIdentifier) obj; return Objects.equal(name, other.name); } else { return false; } } @JsonCreator SecretIdentifier(@JsonProperty("name") String name); @Override... |
### Question:
IAMPolicyManager { public void detachAdmin(SecretsGroupIdentifier group, Principal principal) { detachPrincipal(group, principal, AccessLevel.ADMIN); } IAMPolicyManager(AmazonIdentityManagement client, AWSCredentialsProvider awsCredentials, ClientConfiguration clientConfiguration); static IAMPolicyManager... |
### Question:
LambdaHandler implements RequestStreamHandler { @Override public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException { I inputObject = deserializeEventJson(input, getInputType()); O handlerResult = handleRequest(inputObject, context); serializeOutput(output, hand... |
### Question:
Handler extends LambdaHandler<AuthorizationInput, AuthorizationOutput> { @Override public AuthorizationOutput handleRequest(AuthorizationInput input, Context context) { final String authenticationToken = input.getAuthorizationToken(); final PolicyDocument policyDocument = new PolicyDocument(); PolicyState... |
### Question:
UserServiceImpl implements UserService { @Override public User registerNewUser(String username, String email) throws UserRegistrationException { checkEmailValidity(email); checkEmailUniqueness(email); checkUsernameUniqueness(username); User newUser = new User() .setId(UUID.randomUUID().toString()) .setUse... |
### Question:
DataTypes { public static int parseSizeInt(String size, int def) { return parseNum(size, Integer.class, def); } static T parseNum(String num, Class<T> cls, T def); static int parseSizeInt(String size, int def); static boolean parseBool(final String val); static Object decodeValueType(char typeId, String ... |
### Question:
SSLContextContainer implements SSLContextContainerIfc { public static <T> T find(Map<String, T> data, String key) { if (data.containsKey(key)) { return data.get(key); } int idx = key.indexOf("."); if (idx >= 0) { String asteriskKey = "*" + key.substring(idx); T value = data.get(asteriskKey); if (value != ... |
### Question:
WebSocketXMPPIOService extends XMPPIOService<RefObject> { protected int parseHttpHeaders(byte[] buf, Map<String, String> headers) { int i = 0; while (buf[i] != '\n') { i++; } i++; if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, "parsing request = \n{0}", new String(buf)); } StringBuilder builder... |
### Question:
NodeNameUtil { public static String createNodeName(String eventName, String xmlns) { return (eventName == null ? "*" : eventName) + "|" + (xmlns == null ? "*" : xmlns); } private NodeNameUtil(); static String createNodeName(String eventName, String xmlns); static EventName parseNodeName(String nodeName);... |
### Question:
NodeNameUtil { public static EventName parseNodeName(String nodeName) { int i = nodeName.indexOf('|'); String n = nodeName.substring(0, i); String x = nodeName.substring(i + 1); return new EventName(n.equals("*") ? null : n, x.equals("*") ? null : x); } private NodeNameUtil(); static String createNodeNam... |
### Question:
EventName { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; EventName other = (EventName) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fa... |
### Question:
ImageResizer { public byte[] resize(BufferedImage originalImage) throws IOException { if (originalImage == null) { throw new IIOException("Image is null. Did ImageIO fail to decode the image?"); } BufferedImage resized = ImageUtil.resizeImage(originalImage, size, size); originalImage.flush(); byte[] resiz... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public List<ImageRecord> getByHash(long hash) throws RepositoryException { try { return imageDao.queryForMatching(new ImageRecord(null, hash)); } catch (SQLException e) { throw new RepositoryException("Failed to query by hash", e); } } OrmliteI... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public ImageRecord getByPath(Path path) throws RepositoryException { try { return imageDao.queryForId(path.toString()); } catch (SQLException e) { throw new RepositoryException("Failed to query for path", e); } } OrmliteImageRepository(Dao<Imag... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public synchronized List<ImageRecord> startsWithPath(Path directory) throws RepositoryException { argStartsWithPath.setValue(directory.toString() + STRING_QUERY_WILDCARD); try { return imageDao.query(queryStartsWithPath); } catch (SQLException ... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public void remove(ImageRecord image) throws RepositoryException { try { imageDao.delete(image); } catch (SQLException e) { throw new RepositoryException("Failed to remove image", e); } } OrmliteImageRepository(Dao<ImageRecord, String> imageDao... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public List<ImageRecord> getAll() throws RepositoryException { try { return imageDao.queryForAll(); } catch (SQLException e) { throw new RepositoryException("Failed to query all", e); } } OrmliteImageRepository(Dao<ImageRecord, String> imageDao... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public List<ImageRecord> getAllWithoutIgnored() throws RepositoryException { try { return imageDao.query(queryNotIgnored); } catch (SQLException e) { throw new RepositoryException("Failed to query for non-ignored", e); } } OrmliteImageRepositor... |
### Question:
ExtendedAttribute implements ExtendedAttributeQuery { public static void setExtendedAttribute(Path path, String name, String value) throws IOException { setExtendedAttribute(path, name, StandardCharsets.US_ASCII.encode(value)); } static String createName(String... names); static boolean supportsExtendedA... |
### Question:
OrmliteTagRepository implements TagRepository { @Override public synchronized Tag getByName(String name) throws RepositoryException { try { nameArg.setValue(name); return tagDao.queryForFirst(nameQuery); } catch (SQLException e) { throw new RepositoryException("Failed to query by name", e); } } OrmliteTag... |
### Question:
OrmliteTagRepository implements TagRepository { @Override public void store(Tag tag) throws RepositoryException { try { tagDao.createOrUpdate(tag); } catch (SQLException e) { throw new RepositoryException("Failed to store", e); } } OrmliteTagRepository(Dao<Tag, Long> tagDao); @Override synchronized Tag ge... |
### Question:
OrmliteTagRepository implements TagRepository { @Override public void remove(Tag tag) throws RepositoryException { try { tagDao.delete(tag); } catch (SQLException e) { throw new RepositoryException("Failed to delete", e); } } OrmliteTagRepository(Dao<Tag, Long> tagDao); @Override synchronized Tag getByNam... |
### Question:
OrmliteTagRepository implements TagRepository { @Override public List<Tag> getAll() throws RepositoryException { try { return tagDao.queryForAll(); } catch (SQLException e) { throw new RepositoryException("Failed to query all", e); } } OrmliteTagRepository(Dao<Tag, Long> tagDao); @Override synchronized Ta... |
### Question:
OrmliteTagRepository implements TagRepository { @Override public List<Tag> getWithContext() throws RepositoryException { try { return tagDao.queryForMatching(new Tag(null, true)); } catch (SQLException e) { throw new RepositoryException("Failed to query by context flag", e); } } OrmliteTagRepository(Dao<T... |
### Question:
OrmliteFilterRepository implements FilterRepository { @Override public List<FilterRecord> getByHash(long hash) throws RepositoryException { try { return filterDao.queryForMatching(new FilterRecord(hash, null, null)); } catch (SQLException e) { throw new RepositoryException("Failed to query by hash", e); }... |
### Question:
OrmliteFilterRepository implements FilterRepository { @Override public List<FilterRecord> getByTag(Tag tag) throws RepositoryException { try { return filterDao.queryForMatchingArgs(new FilterRecord(0, tag, null)); } catch (SQLException e) { throw new RepositoryException("Failed to query by tag", e); } } O... |
### Question:
ExtendedAttribute implements ExtendedAttributeQuery { public static String readExtendedAttributeAsString(Path path, String name) throws IOException { ByteBuffer buffer = readExtendedAttribute(path, name); return StandardCharsets.US_ASCII.decode(buffer).toString(); } static String createName(String... nam... |
### Question:
OrmliteFilterRepository implements FilterRepository { @Override public List<FilterRecord> getAll() throws RepositoryException { try { return filterDao.queryForAll(); } catch (SQLException e) { throw new RepositoryException("Failed to get all filters", e); } } OrmliteFilterRepository(Dao<FilterRecord, Inte... |
### Question:
OrmliteFilterRepository implements FilterRepository { @Override public void store(FilterRecord toStore) throws RepositoryException { if (toStore.hasThumbnail()) { checkAndCreateThumbnail(toStore); } try { if (filterDao.queryForMatchingArgs(toStore).isEmpty()) { filterDao.create(toStore); } } catch (SQLExc... |
### Question:
OrmliteFilterRepository implements FilterRepository { @Override public void remove(FilterRecord filter) throws RepositoryException { try { filterDao.delete(filter); } catch (SQLException e) { throw new RepositoryException("Failed to remove Filter", e); } } OrmliteFilterRepository(Dao<FilterRecord, Integer... |
### Question:
OrmliteIgnoreRepository implements IgnoreRepository { @Override public void store(IgnoreRecord toStore) throws RepositoryException { try { ignoreDao.createIfNotExists(toStore); } catch (SQLException e) { throw new RepositoryException("Failed to store ignore", e); } } OrmliteIgnoreRepository(Dao<IgnoreReco... |
### Question:
OrmliteIgnoreRepository implements IgnoreRepository { @Override public void remove(IgnoreRecord toRemove) throws RepositoryException { try { ignoreDao.delete(toRemove); } catch (SQLException e) { throw new RepositoryException("Failed to delete ignore", e); } } OrmliteIgnoreRepository(Dao<IgnoreRecord, Str... |
### Question:
ExtendedAttribute implements ExtendedAttributeQuery { public static boolean isExtendedAttributeSet(Path path, String name) throws IOException { return createUserDefinedFileAttributeView(path).list().contains(name); } static String createName(String... names); static boolean supportsExtendedAttributes(Pat... |
### Question:
OrmliteIgnoreRepository implements IgnoreRepository { @Override public IgnoreRecord findByPath(Path path) throws RepositoryException { return findByPath(path.toString()); } OrmliteIgnoreRepository(Dao<IgnoreRecord, String> ignoreDao); @Override void store(IgnoreRecord toStore); @Override void remove(Ignor... |
### Question:
OrmliteIgnoreRepository implements IgnoreRepository { @Override public boolean isPathIgnored(String path) throws RepositoryException { return findByPath(path) != null; } OrmliteIgnoreRepository(Dao<IgnoreRecord, String> ignoreDao); @Override void store(IgnoreRecord toStore); @Override void remove(IgnoreRe... |
### Question:
OrmliteIgnoreRepository implements IgnoreRepository { @Override public List<IgnoreRecord> getAll() throws RepositoryException { try { return ignoreDao.queryForAll(); } catch (SQLException e) { throw new RepositoryException("Failed to query for all ingored images: " + e.toString(), e); } } OrmliteIgnoreRep... |
### Question:
Tag { @Override public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Tag)) { return false; } Tag other = (Tag) obj; if (contextMenu != other.contextMenu) { return false; } if (tag == null) { if (other.tag != null) { return fals... |
### Question:
Tag { public final String getTag() { return tag; } @Deprecated Tag(); Tag(String tag); Tag(String tag, boolean contextMenu); final String getTag(); final void setTag(String tag); final boolean isContextMenu(); boolean isMatchAll(); final void setContextMenu(boolean contextMenu); @Override String toStri... |
### Question:
ExtendedAttribute implements ExtendedAttributeQuery { public static String createName(String... names) { StringBuilder sb = new StringBuilder(SIMILARIMAGE_NAMESPACE); for (String name : names) { sb.append("."); sb.append(name); } return sb.toString(); } static String createName(String... names); static b... |
### Question:
Tag { public final boolean isContextMenu() { return contextMenu; } @Deprecated Tag(); Tag(String tag); Tag(String tag, boolean contextMenu); final String getTag(); final void setTag(String tag); final boolean isContextMenu(); boolean isMatchAll(); final void setContextMenu(boolean contextMenu); @Overri... |
### Question:
Tag { public boolean isMatchAll() { return StringUtil.MATCH_ALL_TAGS.equals(tag); } @Deprecated Tag(); Tag(String tag); Tag(String tag, boolean contextMenu); final String getTag(); final void setTag(String tag); final boolean isContextMenu(); boolean isMatchAll(); final void setContextMenu(boolean cont... |
### Question:
SQLiteDatabase implements Database { @Override public ConnectionSource getCs() { return connectionSource; } SQLiteDatabase(); SQLiteDatabase(Path dbPath); SQLiteDatabase(String dbPath); @Override ConnectionSource getCs(); @Override void close(); }### Answer:
@Test public void testGetCs() throws Excepti... |
### Question:
SQLiteDatabase implements Database { @Override public void close() { connectionSource.closeQuietly(); } SQLiteDatabase(); SQLiteDatabase(Path dbPath); SQLiteDatabase(String dbPath); @Override ConnectionSource getCs(); @Override void close(); }### Answer:
@Ignore("Closing a closed connection when using ... |
### Question:
FilterRecord { public long getpHash() { return pHash; } @Deprecated FilterRecord(); FilterRecord(long hash, Tag tag); FilterRecord(long pHash, Tag tag, Thumbnail thumbnail); long getpHash(); void setpHash(long pHash); Tag getTag(); void setTag(Tag tag); Thumbnail getThumbnail(); final void setThumbnail... |
### Question:
FilterRecord { public void setpHash(long pHash) { this.pHash = pHash; } @Deprecated FilterRecord(); FilterRecord(long hash, Tag tag); FilterRecord(long pHash, Tag tag, Thumbnail thumbnail); long getpHash(); void setpHash(long pHash); Tag getTag(); void setTag(Tag tag); Thumbnail getThumbnail(); final v... |
### Question:
FilterRecord { public Tag getTag() { return tag; } @Deprecated FilterRecord(); FilterRecord(long hash, Tag tag); FilterRecord(long pHash, Tag tag, Thumbnail thumbnail); long getpHash(); void setpHash(long pHash); Tag getTag(); void setTag(Tag tag); Thumbnail getThumbnail(); final void setThumbnail(Thum... |
### Question:
FilterRecord { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } FilterRecord other = (FilterRecord) obj; if (pHash != other.pHash) { return false; } if (tag == null) { if (other.tag != nul... |
### Question:
ExtendedAttributeDirectoryCache implements ExtendedAttributeQuery { @Override public boolean isEaSupported(Path path) { Path parent = path.getParent(); if (path.getRoot() != null && path.equals(path.getRoot())) { parent = path; } if (parent == null) { return false; } return eaSupport.getUnchecked(parent);... |
### Question:
FilterRecord { public static List<FilterRecord> getTags(FilterRepository repository, Tag tag) throws RepositoryException { if (tag.isMatchAll()) { return repository.getAll(); } else { return repository.getByTag(tag); } } @Deprecated FilterRecord(); FilterRecord(long hash, Tag tag); FilterRecord(long pH... |
### Question:
IgnoreRecord { public ImageRecord getImage() { return image; } @Deprecated IgnoreRecord(); IgnoreRecord(ImageRecord image); ImageRecord getImage(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static final String IMAGEPATH_FIELD_NAME; }### Answer:
@Test pu... |
### Question:
IgnoreRecord { @Override public boolean equals(Object obj) { if (obj instanceof IgnoreRecord) { IgnoreRecord other = (IgnoreRecord) obj; return Objects.equals(this.image, other.image); } return false; } @Deprecated IgnoreRecord(); IgnoreRecord(ImageRecord image); ImageRecord getImage(); @Override boolea... |
### Question:
MainSettingValidator { public static void validate(MainSetting mainSetting) throws IllegalArgumentException { if (mainSetting.threads() < 1) { throw new IllegalArgumentException("Thread number must be greater than zero"); } } private MainSettingValidator(); static void validate(MainSetting mainSetting); ... |
### Question:
HashingHandler implements HashHandler { @Override public boolean handle(Path file) { LOGGER.trace("Handling {} with {}", file, HashingHandler.class.getSimpleName()); ImageHashJob job = new ImageHashJob(file, hasher, imageRepository, statistics); job.setHashAttribute(hashAttribute); threadPool.execute(job)... |
### Question:
DatabaseHandler implements HashHandler { @Override public boolean handle(Path file) { LOGGER.trace("Handling {} with {}", file, ExtendedAttributeHandler.class.getSimpleName()); try { if (isInDatabase(file)) { LOGGER.trace("{} was found in the database"); statistics.incrementSkippedFiles(); statistics.incr... |
### Question:
ExtendedAttributeUpdateHandler implements HashHandler { @Override public boolean handle(Path file) { if (!hashAttribute.areAttributesValid(file)) { try { long hash = hasher.getLongHash(Files.newInputStream(file)); hashAttribute.writeHash(file, hash); } catch (IOException e) { LOGGER.warn("Failed to hash {... |
### Question:
IgnoredImageQueryStage implements Function<Path, List<ImageRecord>> { @Override public List<ImageRecord> apply(Path path) { List<ImageRecord> result = Collections.emptyList(); try { if (path == null || Paths.get("").equals(path)) { result = imageRepository.getAllWithoutIgnored(); } else { result = imageRe... |
### Question:
ImageQueryStage implements Function<Path, List<ImageRecord>> { @Override public List<ImageRecord> apply(Path path) { List<ImageRecord> result = Collections.emptyList(); try { if (path == null || Paths.get("").equals(path)) { result = imageRepository.getAll(); } else { result = imageRepository.startsWithPa... |
### Question:
ImageQueryPipeline implements Function<Path, Multimap<Long, ImageRecord>> { @Override public Multimap<Long, ImageRecord> apply(Path path) { List<ImageRecord> images = imageQueryStage.apply(path); Multimap<Long, ImageRecord> groups = imageGrouper.apply(images); return postProcessing(groups); } ImageQueryPi... |
### Question:
ImageQueryPipeline implements Function<Path, Multimap<Long, ImageRecord>> { public Function<Collection<ImageRecord>, Multimap<Long, ImageRecord>> getImageGrouper() { return imageGrouper; } ImageQueryPipeline(Function<Path, List<ImageRecord>> imageQueryStage,
Function<Collection<ImageRecord>, Multimap<L... |
### Question:
ImageQueryPipeline implements Function<Path, Multimap<Long, ImageRecord>> { public Collection<Function<Multimap<Long, ImageRecord>, Multimap<Long, ImageRecord>>> getPostProcessingStages() { return ImmutableList.copyOf(postProcessingStages); } ImageQueryPipeline(Function<Path, List<ImageRecord>> imageQuery... |
### Question:
GroupByTagStage implements Function<Collection<ImageRecord>, Multimap<Long, ImageRecord>> { @Override public Multimap<Long, ImageRecord> apply(Collection<ImageRecord> t) { Multimap<Long, ImageRecord> result = MultimapBuilder.hashKeys().hashSetValues().build(); rs.build(t); TagFilter tagFilter = new TagFil... |
### Question:
ImageQueryPipelineBuilder { public ImageQueryPipeline build() { if (imageGrouper == null) { imageGrouper = new GroupImagesStage(hammingDistance); LOGGER.warn("No image group stage set, using {}", imageGrouper.getClass().getSimpleName()); } return new ImageQueryPipeline(imageQuery, imageGrouper, postProces... |
### Question:
ImageQueryPipelineBuilder { public ImageQueryPipelineBuilder removeSingleImageGroups() { this.postProcessing.add(new RemoveSingleImageSetStage()); return this; } ImageQueryPipelineBuilder(ImageRepository imageRepository, FilterRepository filterRepository); ImageQueryPipelineBuilder excludeIgnored(); Image... |
### Question:
ImageQueryPipelineBuilder { public ImageQueryPipelineBuilder removeDuplicateGroups() { this.postProcessing.add(new RemoveDuplicateSetStage()); return this; } ImageQueryPipelineBuilder(ImageRepository imageRepository, FilterRepository filterRepository); ImageQueryPipelineBuilder excludeIgnored(); ImageQuer... |
### Question:
ImageQueryPipelineBuilder { public static ImageQueryPipelineBuilder newBuilder(ImageRepository imageRepository, FilterRepository filterRepository) { return new ImageQueryPipelineBuilder(imageRepository, filterRepository); } ImageQueryPipelineBuilder(ImageRepository imageRepository, FilterRepository filter... |
### Question:
ImageQueryPipelineBuilder { public ImageQueryPipelineBuilder groupAll() { this.imageGrouper = new GroupImagesStage(hammingDistance); return this; } ImageQueryPipelineBuilder(ImageRepository imageRepository, FilterRepository filterRepository); ImageQueryPipelineBuilder excludeIgnored(); ImageQueryPipelineB... |
### Question:
RemoveDuplicateSetStage implements Function<Multimap<Long, ImageRecord>, Multimap<Long, ImageRecord>> { @Override public Multimap<Long, ImageRecord> apply(Multimap<Long, ImageRecord> toPrune) { DuplicateUtil.removeDuplicateSets(toPrune); return toPrune; } @Override Multimap<Long, ImageRecord> apply(Multi... |
### Question:
RemoveSingleImageSetStage implements Function<Multimap<Long, ImageRecord>, Multimap<Long, ImageRecord>> { @Override public Multimap<Long, ImageRecord> apply(Multimap<Long, ImageRecord> toPrune) { DuplicateUtil.removeSingleImageGroups(toPrune); return toPrune; } @Override Multimap<Long, ImageRecord> apply... |
### Question:
GroupImagesStage implements Function<Collection<ImageRecord>, Multimap<Long, ImageRecord>> { @Override public Multimap<Long, ImageRecord> apply(Collection<ImageRecord> toGroup) { Multimap<Long, ImageRecord> resultMap = MultimapBuilder.hashKeys().hashSetValues().build(); rs.build(toGroup); Stopwatch sw = S... |
### Question:
HashAttribute { public void writeHash(Path path, long hash) { try { ExtendedAttribute.setExtendedAttribute(path, hashFQN, Long.toHexString(hash)); ExtendedAttribute.setExtendedAttribute(path, timestampFQN, Long.toString(Files.getLastModifiedTime(path).toMillis())); } catch (IOException e) { LOGGER.warn("F... |
### Question:
DCTKernel extends Kernel { public synchronized double[] transformDCT(double[] matrix) { for (int i = 0; i < matrixArea; i++) { this.matrix[i] = matrix[i]; } execute(range); return Doubles.concat(result); } DCTKernel(); DCTKernel(int matrixSize); void setDevice(Device device); @Override void run(); synchr... |
### Question:
GroupImagesStage implements Function<Collection<ImageRecord>, Multimap<Long, ImageRecord>> { public int getHammingDistance() { return hammingDistance; } GroupImagesStage(); GroupImagesStage(int hammingDistance); @Override Multimap<Long, ImageRecord> apply(Collection<ImageRecord> toGroup); int getHammingD... |
### Question:
GroupListPopulator implements Runnable { @Override public void run() { this.logger.info("Populating group list with {} groups", groups.groupCount()); groupListModel.clear(); List<ResultGroup> resultGroups = groups.getAllGroups(); Collections.sort(resultGroups, new Comparator<ResultGroup>() { @Override pub... |
### Question:
TagFilter { public Multimap<Long, ImageRecord> getFilterMatches(RecordSearch recordSearch, Tag tagToMatch, int hammingDistance) { Multimap<Long, ImageRecord> uniqueGroups = MultimapBuilder.hashKeys().hashSetValues().build(); List<FilterRecord> matchingFilters = Collections.emptyList(); try { matchingFilte... |
### Question:
NamedThreadFactory implements ThreadFactory { @Override public Thread newThread(Runnable r) { Thread thread = defaultThreadFactory.newThread(r); thread.setName(threadPrefix + " thread " + threadNumber); threadNumber++; return thread; } NamedThreadFactory(String threadPrefix); @Override Thread newThread(Ru... |
### Question:
ImageFindJobVisitor extends SimpleFileVisitor<Path> { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (isAcceptedFile(file)) { statistics.incrementFoundFiles(); fileCount++; boolean isHandled = false; for (HashHandler handler : handlers) { if (handl... |
### Question:
ImageFindJobVisitor extends SimpleFileVisitor<Path> { @Deprecated public int getFileCount() { return fileCount; } ImageFindJobVisitor(Filter<Path> fileFilter, Collection<HashHandler> handlers, Statistics statistics); @Override FileVisitResult visitFile(Path file, BasicFileAttributes attrs); @Deprecated in... |
### Question:
ImageHashJob implements Runnable { @Override public void run() { try { long hash = processFile(image); if (hashAttribute != null) { hashAttribute.writeHash(image, hash); } } catch (IIOException e) { LOGGER.warn("Failed to process image {} (IIO Error): {}", image, e.toString()); LOGGER.debug(EXCEPTION_STAC... |
### Question:
DuplicateUtil { public static Multimap<Long, ImageRecord> groupByHash(Collection<ImageRecord> dbRecords) { Multimap<Long, ImageRecord> groupedByHash = MultimapBuilder.hashKeys().hashSetValues().build(); logger.info("Grouping records by hash..."); for (ImageRecord ir : dbRecords) { groupedByHash.put(ir.get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.