method2testcases stringlengths 118 6.63k |
|---|
### Question:
ArgumentPasrser { public void parseArgs(String[] args) throws ArgumentParserException { Namespace parsedArgs = parser.parseArgs(args); if (parsedArgs.get("subcommand") == Subcommand.local) { localCommand(parsedArgs); } if (parsedArgs.get("subcommand") == Subcommand.node) { nodeCommand(parsedArgs); } } Arg... |
### Question:
ProgressCalc { public double totalProgressPercent() { if (foundFiles.getCount() == 0) { return 0; } else { return (PERCENT_100 / foundFiles.getCount()) * (processedFiles.getCount() + failedFiles.getCount()); } } ProgressCalc(MetricRegistry metrics); double totalProgressPercent(); double corruptPercent(); ... |
### Question:
HashAttribute { public String getTimestampFQN() { return timestampFQN; } HashAttribute(String hashName); boolean areAttributesValid(Path path); long readHash(Path path); void writeHash(Path path, long hash); void markCorrupted(Path path); boolean isCorrupted(Path path); String getHashFQN(); String getTime... |
### Question:
ProgressCalc { public double corruptPercent() { if (foundFiles.getCount() == 0) { return 0; } else { return (PERCENT_100 / foundFiles.getCount()) * failedFiles.getCount(); } } ProgressCalc(MetricRegistry metrics); double totalProgressPercent(); double corruptPercent(); @Override String toString(); static ... |
### Question:
ProgressCalc { @Override public String toString() { return String.format("Total progress: %.2f%%, corrupt images: %.2f%%, files per second processed: %.2f", totalProgressPercent(), corruptPercent(), filesPerSecond.getMeanRate()); } ProgressCalc(MetricRegistry metrics); double totalProgressPercent(); doubl... |
### Question:
MessageFactory { public ClientMessage hashRequestMessage(byte[] resizedImage, UUID uuid) { ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeLong(uuid.getMostSignificantBits()); message.getBodyBuffer().writeLong(uuid.getLeastSignificantBits()); message.getBodyBuffer().write... |
### Question:
MessageFactory { public ClientMessage resultMessage(long hash, long most, long least) { ClientMessage message = session.createMessage(true); setTaskType(message, TaskType.result); ActiveMQBuffer buffer = message.getBodyBuffer(); buffer.writeLong(most); buffer.writeLong(least); buffer.writeLong(hash); retu... |
### Question:
MessageFactory { public ClientMessage pendingImageQuery() { ClientMessage message = session.createMessage(false); message.putStringProperty(MessageProperty.repository_query.toString(), QueryType.pending.toString()); return message; } MessageFactory(ClientSession session); ClientMessage hashRequestMessage(... |
### Question:
HashAttribute { public void markCorrupted(Path path) throws IOException { ExtendedAttribute.setExtendedAttribute(path, corruptNameFQN, ""); } HashAttribute(String hashName); boolean areAttributesValid(Path path); long readHash(Path path); void writeHash(Path path, long hash); void markCorrupted(Path path)... |
### Question:
MessageFactory { public ClientMessage pendingImageResponse(List<PendingHashImage> pendingImages) throws IOException { List<String> pendingPaths = new LinkedList<String>(); for (PendingHashImage p : pendingImages) { pendingPaths.add(p.getPath()); } try (ByteArrayOutputStream baos = new ByteArrayOutputStrea... |
### Question:
MessageFactory { public ClientMessage corruptMessage(Path path) { ClientMessage message = session.createMessage(true); message.putStringProperty(MessageProperty.path.toString(), path.toString()); message.putStringProperty(MessageProperty.task.toString(), TaskType.corr.toString()); return message; } Messag... |
### Question:
MessageFactory { public ClientMessage eaUpdate(Path path, long hash) { ClientMessage message = session.createMessage(true); setTaskType(message, TaskType.eaupdate); setPath(message, path); message.getBodyBuffer().writeLong(hash); return message; } MessageFactory(ClientSession session); ClientMessage hashR... |
### Question:
MessageFactory { public ClientMessage resizeRequest(Path path, InputStream is) throws IOException { ClientMessage message = session.createMessage(true); copyInputStreamToMessage(is, message); setTaskType(message, TaskType.hash); setPath(message, path); return message; } MessageFactory(ClientSession sessio... |
### Question:
MessageFactory { public ClientMessage trackPath(Path path, UUID uuid) { ClientMessage message = session.createMessage(false); setTaskType(message, TaskType.track); setPath(message, path); message.getBodyBuffer().writeLong(uuid.getMostSignificantBits()); message.getBodyBuffer().writeLong(uuid.getLeastSigni... |
### Question:
HashAttribute { public String getCorruptNameFQN() { return corruptNameFQN; } HashAttribute(String hashName); boolean areAttributesValid(Path path); long readHash(Path path); void writeHash(Path path, long hash); void markCorrupted(Path path); boolean isCorrupted(Path path); String getHashFQN(); String get... |
### Question:
QueueToDatabaseTransaction implements CollectedMessageConsumer { @Override public void onDrain(List<ClientMessage> messages) { try { transactionManager.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { onCall(messages); return null; } }); } catch (SQLException e) { L... |
### Question:
QueueToDatabaseTransaction implements CollectedMessageConsumer { protected void onCall(List<ClientMessage> messages) throws RepositoryException, ActiveMQException { for (ClientMessage message : messages) { processMessage(message); message.acknowledge(); } session.commit(); } QueueToDatabaseTransaction(Cli... |
### Question:
HashAttribute { public boolean isCorrupted(Path path) throws IOException { return ExtendedAttribute.isExtendedAttributeSet(path, corruptNameFQN); } HashAttribute(String hashName); boolean areAttributesValid(Path path); long readHash(Path path); void writeHash(Path path, long hash); void markCorrupted(Path... |
### Question:
ResizerNode implements MessageHandler, Node { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(ResizerNode.class.getSimpleName()).append(" {").append(identity.toString()).append("}"); return sb.toString(); } @Inject ResizerNode(ClientSession session, ImageResizer res... |
### Question:
ResizerNode implements MessageHandler, Node { protected void allocateNewBuffer(int messageSize) { messageBuffer = ByteBuffer.allocateDirect(calcNewBufferSize(messageSize)); } @Inject ResizerNode(ClientSession session, ImageResizer resizer, MetricRegistry metrics); protected ResizerNode(ClientSession ses... |
### Question:
ResizerNode implements MessageHandler, Node { @Override public void onMessage(ClientMessage message) { String pathPropterty = null; resizeRequests.mark(); Context resizeTimeContext = resizeDuration.time(); try { pathPropterty = message.getStringProperty(MessageProperty.path.toString()); LOGGER.debug("Resi... |
### Question:
ByteBufferInputstream extends InputStream { @Override public int read() throws IOException { if (buffer.hasRemaining()) { return buffer.get() & 0xFF; } else { return -1; } } ByteBufferInputstream(ByteBuffer buffer); @Override int read(); @Override int available(); }### Answer:
@Test public void testReadF... |
### Question:
MessageCollector { private void onDrain() { ImmutableList<ClientMessage> immutable; LOGGER.trace("Draining {} collected messsages...", collectedMessages.size()); synchronized (collectedMessages) { immutable = ImmutableList.copyOf(collectedMessages); collectedMessages.clear(); } for (CollectedMessageConsum... |
### Question:
TaskMessageHandler implements MessageHandler { @Override public void onMessage(ClientMessage msg) { try { if (isTaskType(msg, TaskType.track)) { String path = msg.getStringProperty(MessageProperty.path.toString()); long most = msg.getBodyBuffer().readLong(); long least = msg.getBodyBuffer().readLong(); if... |
### Question:
ResultMessageSink implements Node { @Override public void stop() { LOGGER.info("Stopping {}", WORKER_THREAD_NAME); sink.interrupt(); try { sink.join(); } catch (InterruptedException ie) { LOGGER.warn("Interrupted while wating for sink to terminate: {}", ie.toString()); } try { consumer.close(); } catch (A... |
### Question:
HasherNode implements MessageHandler, Node { @Override public void onMessage(ClientMessage message) { hashRequests.mark(); Context hashTimeContext = hashDuration.time(); try { long most = message.getBodyBuffer().readLong(); long least = message.getBodyBuffer().readLong(); if (LOGGER.isTraceEnabled()) { LO... |
### Question:
HasherNode implements MessageHandler, Node { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(HasherNode.class.getSimpleName()).append(" {").append(identity.toString()).append("}"); return sb.toString(); } HasherNode(ClientSession session, ImagePHash hasher, String re... |
### Question:
HasherNode implements MessageHandler, Node { @Override public void stop() { LOGGER.info("Stopping {}...", this.toString()); MessagingUtil.silentClose(consumer); MessagingUtil.silentClose(producer); MessagingUtil.silentClose(session); } HasherNode(ClientSession session, ImagePHash hasher, String requestAdd... |
### Question:
RepositoryNode implements MessageHandler, Node { @Override public String toString() { return RepositoryNode.class.getSimpleName(); } RepositoryNode(ClientSession session, String queryAddress, String taskAddress,
PendingHashImageRepository pendingRepository, ImageRepository imageRepository,
TaskMessa... |
### Question:
StorageNode implements MessageHandler, Node { public boolean processFile(Path path) { LOGGER.trace("Processing {}", path); if (isAlreadySent(path)) { LOGGER.trace("File {} has already been sent, ignoring...", path); return true; } try (InputStream bis = new BufferedInputStream(Files.newInputStream(path)))... |
### Question:
StorageNode implements MessageHandler, Node { @Override public String toString() { return StorageNode.class.getSimpleName(); } StorageNode(ClientSession session, ExtendedAttributeQuery eaQuery, HashAttribute hashAttribute, List<Path> pendingPaths,
String resizeAddress, String eaUpdateAddress); @Inject ... |
### Question:
ByteBufferInputstream extends InputStream { @Override public int available() throws IOException { return buffer.remaining(); } ByteBufferInputstream(ByteBuffer buffer); @Override int read(); @Override int available(); }### Answer:
@Test public void testAvailable() throws Exception { assertThat(input.avai... |
### Question:
ImageFileFilter implements Filter<Path> { @Override public boolean accept(Path entry) throws IOException { return extFilter.accept(entry); } ImageFileFilter(); @Override boolean accept(Path entry); }### Answer:
@Test public void testJpg() throws Exception { assertThat(cut.accept(createFile("foo.jpg")), i... |
### Question:
ImageUtil { public static BufferedImage loadImage(Path path) throws IOException { try (InputStream is = new BufferedInputStream(Files.newInputStream(path))) { BufferedImage bi; try { bi = ImageIO.read(is); } catch (ArrayIndexOutOfBoundsException e) { bi = GifDecoder.read(is).getFrame(0); } return bi; } } ... |
### Question:
Statistics { public void incrementFailedFiles() { dispatchEvent(StatisticsEvent.FAILED_FILES, failedFiles.incrementAndGet()); } int getFoundFiles(); void incrementFoundFiles(); int getProcessedFiles(); void incrementProcessedFiles(); int getFailedFiles(); void incrementFailedFiles(); int getSkippedFiles(... |
### Question:
Statistics { public void incrementFoundFiles() { dispatchEvent(StatisticsEvent.FOUND_FILES, foundFiles.incrementAndGet()); } int getFoundFiles(); void incrementFoundFiles(); int getProcessedFiles(); void incrementProcessedFiles(); int getFailedFiles(); void incrementFailedFiles(); int getSkippedFiles(); ... |
### Question:
Statistics { public void incrementProcessedFiles() { dispatchEvent(StatisticsEvent.PROCESSED_FILES, processedFiles.incrementAndGet()); } int getFoundFiles(); void incrementFoundFiles(); int getProcessedFiles(); void incrementProcessedFiles(); int getFailedFiles(); void incrementFailedFiles(); int getSkip... |
### Question:
Statistics { public void incrementSkippedFiles() { dispatchEvent(StatisticsEvent.SKIPPED_FILES, skippedFiles.incrementAndGet()); } int getFoundFiles(); void incrementFoundFiles(); int getProcessedFiles(); void incrementProcessedFiles(); int getFailedFiles(); void incrementFailedFiles(); int getSkippedFil... |
### Question:
Statistics { public void removeStatisticsListener(StatisticsChangedListener listener) { statisticsChangedListners.remove(listener); } int getFoundFiles(); void incrementFoundFiles(); int getProcessedFiles(); void incrementProcessedFiles(); int getFailedFiles(); void incrementFailedFiles(); int getSkipped... |
### Question:
GroupList { public void remove(Result result) { Collection<ResultGroup> groupsToRemoveFrom = resultsToGroups.removeAll(result); LOGGER.debug("Removing {} from {} group(s).", result, groupsToRemoveFrom.size()); for (ResultGroup g : groupsToRemoveFrom) { g.remove(result, false); checkAndremoveEmptyGroup(g);... |
### Question:
GroupList { public int groupCount() { return groups.size(); } GroupList(); GroupList(DefaultListModel<ResultGroup> mappedListModel); void populateList(Collection<ResultGroup> groupsToAdd); int groupCount(); void remove(Result result); ResultGroup getGroup(long hash); List<ResultGroup> getAllGroups(); voi... |
### Question:
GroupList { public ResultGroup getGroup(long hash) throws IllegalArgumentException { ResultGroup group = hashToGroup.get(hash); if (group == null) { throw new IllegalArgumentException("Query for unknown hash"); } return group; } GroupList(); GroupList(DefaultListModel<ResultGroup> mappedListModel); void ... |
### Question:
GroupList { public ResultGroup previousGroup(ResultGroup currentGroup) { int index = groups.indexOf(currentGroup); index = boundsCheckedIndex(--index); return groups.get(index); } GroupList(); GroupList(DefaultListModel<ResultGroup> mappedListModel); void populateList(Collection<ResultGroup> groupsToAdd)... |
### Question:
GroupList { public ResultGroup nextGroup(ResultGroup currentGroup) { int index = groups.indexOf(currentGroup); index = boundsCheckedIndex(++index); return groups.get(index); } GroupList(); GroupList(DefaultListModel<ResultGroup> mappedListModel); void populateList(Collection<ResultGroup> groupsToAdd); in... |
### Question:
Result { public ImageRecord getImageRecord() { return imageRecord; } Result(ResultGroup parentGroup, ImageRecord imageRecord); ImageRecord getImageRecord(); void remove(); @Override String toString(); @Override final int hashCode(); @Override final boolean equals(Object obj); }### Answer:
@Test public vo... |
### Question:
StringUtil { public static String sanitizeTag(String tagFromGui) { if (tagFromGui == null || "".equals(tagFromGui)) { return MATCH_ALL_TAGS; } return tagFromGui; } private StringUtil(); static String sanitizeTag(String tagFromGui); static final String MATCH_ALL_TAGS; }### Answer:
@Test public void testSa... |
### Question:
Result { public void remove() { LOGGER.debug("Removing result {}", this); parentGroup.remove(this); } Result(ResultGroup parentGroup, ImageRecord imageRecord); ImageRecord getImageRecord(); void remove(); @Override String toString(); @Override final int hashCode(); @Override final boolean equals(Object ob... |
### Question:
ResultGroup { public long getHash() { return hash; } ResultGroup(GroupList parent, long hash, Collection<ImageRecord> records); long getHash(); List<Result> getResults(); boolean remove(Result result); boolean remove(Result result, boolean notifyParent); @Override String toString(); boolean hasResults(); ... |
### Question:
ResultGroup { public List<Result> getResults() { return results; } ResultGroup(GroupList parent, long hash, Collection<ImageRecord> records); long getHash(); List<Result> getResults(); boolean remove(Result result); boolean remove(Result result, boolean notifyParent); @Override String toString(); boolean ... |
### Question:
ResultGroup { public boolean remove(Result result) { return remove(result, true); } ResultGroup(GroupList parent, long hash, Collection<ImageRecord> records); long getHash(); List<Result> getResults(); boolean remove(Result result); boolean remove(Result result, boolean notifyParent); @Override String toS... |
### Question:
ResultGroup { public boolean hasResults() { return !results.isEmpty(); } ResultGroup(GroupList parent, long hash, Collection<ImageRecord> records); long getHash(); List<Result> getResults(); boolean remove(Result result); boolean remove(Result result, boolean notifyParent); @Override String toString(); bo... |
### Question:
ResultGroup { @Override public String toString() { return String.format("%d (%d)", this.hash, results.size()); } ResultGroup(GroupList parent, long hash, Collection<ImageRecord> records); long getHash(); List<Result> getResults(); boolean remove(Result result); boolean remove(Result result, boolean notify... |
### Question:
ImageRecord implements Comparable<ImageRecord> { public String getPath() { return path; } @Deprecated ImageRecord(); ImageRecord(String path, long pHash); String getPath(); long getpHash(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(ImageRecord o); @Override ... |
### Question:
ImageRecord implements Comparable<ImageRecord> { public long getpHash() { return pHash; } @Deprecated ImageRecord(); ImageRecord(String path, long pHash); String getPath(); long getpHash(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(ImageRecord o); @Override ... |
### Question:
ImageRecord implements Comparable<ImageRecord> { @Override public int compareTo(ImageRecord o) { if (o == null) { throw new NullPointerException(); } if (this.pHash == o.getpHash()) { return 0; } else if (this.getpHash() > o.pHash) { return 1; } else { return -1; } } @Deprecated ImageRecord(); ImageReco... |
### Question:
ImageRecord implements Comparable<ImageRecord> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ImageRecord other = (ImageRecord) obj; if (pHash != other.pHash) return false; if (path == null) { if ... |
### Question:
ImageRecord implements Comparable<ImageRecord> { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ImageRecord"); sb.append("{"); sb.append("path:"); sb.append(path); sb.append(","); sb.append("hash:"); sb.append(pHash); sb.append("}"); return sb.toString(); } @Deprec... |
### Question:
BadFileRecord { public String getPath() { return path; } @Deprecated BadFileRecord(); BadFileRecord(Path path); String getPath(); }### Answer:
@Test public void testGetPath() throws Exception { assertThat(badFileRecord.getPath(), is("bad")); } |
### Question:
RepositoryException extends Exception { public final String getMessage() { return message; } RepositoryException(String message, Throwable cause); RepositoryException(String message); final String getMessage(); final Throwable getCause(); }### Answer:
@Test public void testRepositoryExceptionStringThrow... |
### Question:
RepositoryException extends Exception { public final Throwable getCause() { return cause; } RepositoryException(String message, Throwable cause); RepositoryException(String message); final String getMessage(); final Throwable getCause(); }### Answer:
@Test public void testRepositoryExceptionStringThrowa... |
### Question:
OrmliteRepositoryFactory implements RepositoryFactory { @Override public FilterRepository buildFilterRepository() throws RepositoryException { return new OrmliteFilterRepository(filterRecordDao, thumbnailDao); } @Inject OrmliteRepositoryFactory(Database database); @Override FilterRepository buildFilterRe... |
### Question:
OrmliteRepositoryFactory implements RepositoryFactory { @Override public ImageRepository buildImageRepository() throws RepositoryException { return new OrmliteImageRepository(imageRecordDao, ignoreDao); } @Inject OrmliteRepositoryFactory(Database database); @Override FilterRepository buildFilterRepositor... |
### Question:
OrmliteRepositoryFactory implements RepositoryFactory { @Override public TagRepository buildTagRepository() throws RepositoryException { return new OrmliteTagRepository(tagDao); } @Inject OrmliteRepositoryFactory(Database database); @Override FilterRepository buildFilterRepository(); @Override ImageRepos... |
### Question:
OrmliteRepositoryFactory implements RepositoryFactory { @Override public PendingHashImageRepository buildPendingHashImageRepository() throws RepositoryException { return new OrmlitePendingHashImage(pendingDao); } @Inject OrmliteRepositoryFactory(Database database); @Override FilterRepository buildFilterR... |
### Question:
OrmliteRepositoryFactory implements RepositoryFactory { @Override public IgnoreRepository buildIgnoreRepository() throws RepositoryException { return new OrmliteIgnoreRepository(ignoreDao); } @Inject OrmliteRepositoryFactory(Database database); @Override FilterRepository buildFilterRepository(); @Overrid... |
### Question:
OrmlitePendingHashImage implements PendingHashImageRepository { @Override public synchronized boolean store(PendingHashImage image) throws RepositoryException { try { if (pendingDao.queryForMatchingArgs(image).isEmpty()) { pendingDao.create(image); return true; } else { return false; } } catch (SQLExcepti... |
### Question:
ExtendedAttribute implements ExtendedAttributeQuery { public static boolean supportsExtendedAttributes(Path path) { try { return Files.getFileStore(path).supportsFileAttributeView(UserDefinedFileAttributeView.class); } catch (IOException e) { LOGGER.debug("Failed to check extended attributes via FileStore... |
### Question:
OrmlitePendingHashImage implements PendingHashImageRepository { @Override public boolean exists(PendingHashImage image) throws RepositoryException { try { if (pendingDao.refresh(image) == 0) { return !pendingDao.queryForMatching(image).isEmpty(); } else { return true; } } catch (SQLException e) { throw ne... |
### Question:
OrmlitePendingHashImage implements PendingHashImageRepository { @Override public List<PendingHashImage> getAll() throws RepositoryException { try { return pendingDao.queryForAll(); } catch (SQLException e) { throw new RepositoryException("Failed to query for all entries", e); } } OrmlitePendingHashImage(D... |
### Question:
OrmlitePendingHashImage implements PendingHashImageRepository { @Override public PendingHashImage getByUUID(long most, long least) throws RepositoryException { try { synchronized (uuidQuery) { mostParam.setValue(most); leastParam.setValue(least); return pendingDao.queryForFirst(uuidQuery); } } catch (SQLE... |
### Question:
OrmlitePendingHashImage implements PendingHashImageRepository { @Override public void remove(PendingHashImage image) throws RepositoryException { try { pendingDao.delete(image); } catch (SQLException e) { throw new RepositoryException("Failed to remove entry", e); } } OrmlitePendingHashImage(Dao<PendingHa... |
### Question:
OrmliteImageRepository implements ImageRepository { @Override public void store(ImageRecord image) throws RepositoryException { try { imageDao.createOrUpdate(image); } catch (SQLException e) { throw new RepositoryException("Failed to store image", e); } } OrmliteImageRepository(Dao<ImageRecord, String> im... |
### Question:
SeedPeers implements PeerDiscovery { public InetSocketAddress getPeer() throws PeerDiscoveryException { try { return nextPeer(); } catch (UnknownHostException e) { throw new PeerDiscoveryException(e); } } SeedPeers(NetworkParameters params); InetSocketAddress getPeer(); InetSocketAddress[] getPeers(long t... |
### Question:
Address extends VersionedChecksummedBytes { public byte[] getHash160() { return bytes; } Address(NetworkParameters params, byte[] hash160); Address(NetworkParameters params, String address); byte[] getHash160(); NetworkParameters getParameters(); static NetworkParameters getParametersFromAddress(String a... |
### Question:
Address extends VersionedChecksummedBytes { public static NetworkParameters getParametersFromAddress(String address) throws AddressFormatException { try { return new Address(null, address).getParameters(); } catch (WrongNetworkException e) { throw new RuntimeException(e); } } Address(NetworkParameters par... |
### Question:
Block extends Message { public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); } Block(NetworkParameters params); Block(NetworkParameters params, byte[] payloadBytes); Block(NetworkParameters ... |
### Question:
Block extends Message { public Date getTime() { return new Date(getTimeSeconds()*1000); } Block(NetworkParameters params); Block(NetworkParameters params, byte[] payloadBytes); Block(NetworkParameters params, byte[] payloadBytes, boolean parseLazy, boolean parseRetain, int length); BigInteger getBlockIn... |
### Question:
Block extends Message { public void verify() throws VerificationException { verifyHeader(); verifyTransactions(); } Block(NetworkParameters params); Block(NetworkParameters params, byte[] payloadBytes); Block(NetworkParameters params, byte[] payloadBytes, boolean parseLazy, boolean parseRetain, int leng... |
### Question:
SeedPeers implements PeerDiscovery { public InetSocketAddress[] getPeers(long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException { try { return allPeers(); } catch (UnknownHostException e) { throw new PeerDiscoveryException(e); } } SeedPeers(NetworkParameters params); InetSocketAddress getP... |
### Question:
Block extends Message { private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); hash = null; } Block(NetworkParameters params); Block(NetworkParameters params, byte[] payloadBytes); Block(NetworkParameters params, byte[] payloadBytes, boolean ... |
### Question:
Peer { public void addEventListener(PeerEventListener listener) { eventListeners.add(listener); } Peer(NetworkParameters params, AbstractBlockChain chain, VersionMessage ver); Peer(NetworkParameters params, AbstractBlockChain chain, VersionMessage ver, MemoryPool mempool); Peer(NetworkParameters params,... |
### Question:
Peer { public void setDownloadData(boolean downloadData) { this.vDownloadData = downloadData; } Peer(NetworkParameters params, AbstractBlockChain chain, VersionMessage ver); Peer(NetworkParameters params, AbstractBlockChain chain, VersionMessage ver, MemoryPool mempool); Peer(NetworkParameters params, A... |
### Question:
Peer { public ListenableFuture<Block> getBlock(Sha256Hash blockHash) throws IOException { log.info("Request to fetch block {}", blockHash); GetDataMessage getdata = new GetDataMessage(params); getdata.addBlock(blockHash); return sendSingleGetData(getdata); } Peer(NetworkParameters params, AbstractBlockCha... |
### Question:
Peer { public ChannelFuture setMinProtocolVersion(int minProtocolVersion) { this.vMinProtocolVersion = minProtocolVersion; if (getVersionMessage().clientVersion < minProtocolVersion) { log.warn("{}: Disconnecting due to new min protocol version {}", this, minProtocolVersion); return Channels.close(vChanne... |
### Question:
PeerGroup extends AbstractIdleService { public void addPeerDiscovery(PeerDiscovery peerDiscovery) { lock.lock(); try { if (getMaxConnections() == 0) setMaxConnections(DEFAULT_CONNECTIONS); peerDiscoverers.add(peerDiscovery); } finally { lock.unlock(); } } PeerGroup(NetworkParameters params); PeerGroup(Ne... |
### Question:
PeerGroup extends AbstractIdleService { public int numConnectedPeers() { return peers.size(); } PeerGroup(NetworkParameters params); PeerGroup(NetworkParameters params, AbstractBlockChain chain); PeerGroup(NetworkParameters params, AbstractBlockChain chain, ClientBootstrap bootstrap); static ClientBoots... |
### Question:
IrcDiscovery implements PeerDiscovery { static ArrayList<InetSocketAddress> parseUserList(String[] userNames) throws UnknownHostException { ArrayList<InetSocketAddress> addresses = new ArrayList<InetSocketAddress>(); for (String user : userNames) { if (!user.startsWith("u")) { continue; } byte[] addressBy... |
### Question:
PeerGroup extends AbstractIdleService { public void startBlockChainDownload(PeerEventListener listener) { lock.lock(); try { this.downloadListener = listener; synchronized (peers) { if (!peers.isEmpty()) { startBlockChainDownloadFromPeer(peers.iterator().next()); } } } finally { lock.unlock(); } } PeerGro... |
### Question:
ECKey implements Serializable { public void verifyMessage(String message, String signatureBase64) throws SignatureException { ECKey key = ECKey.signedMessageToKey(message, signatureBase64); if (!Arrays.equals(key.getPubKey(), pub)) throw new SignatureException("Signature did not match for message"); } ECK... |
### Question:
ECKey implements Serializable { public String toString() { StringBuilder b = new StringBuilder(); b.append("pub:").append(Utils.bytesToHexString(pub)); if (creationTimeSeconds != 0) { b.append(" timestamp:").append(creationTimeSeconds); } if (isEncrypted()) { b.append(" encrypted"); } return b.toString();... |
### Question:
Utils { public static BigInteger toNanoCoins(int coins, int cents) { checkArgument(cents < 100); BigInteger bi = BigInteger.valueOf(coins).multiply(COIN); bi = bi.add(BigInteger.valueOf(cents).multiply(CENT)); return bi; } static BigInteger toNanoCoins(int coins, int cents); static byte[] bigIntegerToByt... |
### Question:
Utils { public static byte[] reverseBytes(byte[] bytes) { byte[] buf = new byte[bytes.length]; for (int i = 0; i < bytes.length; i++) buf[i] = bytes[bytes.length - 1 - i]; return buf; } static BigInteger toNanoCoins(int coins, int cents); static byte[] bigIntegerToBytes(BigInteger b, int numBytes); stati... |
### Question:
Utils { public static byte[] reverseDwordBytes(byte[] bytes, int trimLength) { checkArgument(bytes.length % 4 == 0); checkArgument(trimLength < 0 || trimLength % 4 == 0); byte[] rev = new byte[trimLength >= 0 && bytes.length > trimLength ? trimLength : bytes.length]; for (int i = 0; i < rev.length; i += 4... |
### Question:
LitecoinURI { public String getLabel() { return (String) parameterMap.get(FIELD_LABEL); } LitecoinURI(String uri); LitecoinURI(NetworkParameters params, String input); Address getAddress(); BigInteger getAmount(); String getLabel(); String getMessage(); Object getParameterByName(String name); @Override S... |
### Question:
LitecoinURI { @Override public String toString() { StringBuilder builder = new StringBuilder("LitecoinURI["); boolean first = true; for (Map.Entry<String, Object> entry : parameterMap.entrySet()) { if (first) { first = false; } else { builder.append(","); } builder.append("'").append(entry.getKey()).appen... |
### Question:
CloudNoticeDAO { public List<Recipient> getRecipients() { return mapper.scan(Recipient.class, new DynamoDBScanExpression()); } CloudNoticeDAO(boolean local); List<Recipient> getRecipients(); void saveRecipient(Recipient recip); void deleteRecipient(Recipient recip); void shutdown(); static final String TA... |
### Question:
CloudNoticeDAO { public void deleteRecipient(Recipient recip) { mapper.delete(recip); } CloudNoticeDAO(boolean local); List<Recipient> getRecipients(); void saveRecipient(Recipient recip); void deleteRecipient(Recipient recip); void shutdown(); static final String TABLE_NAME; }### Answer:
@Test public voi... |
### Question:
DateCalculator { public DateCalculatorResult calculate(String text) { final DateCalcExpressionParser parser = new DateCalcExpressionParser(); final Queue<Token> tokens = parser.parse(text); try { if (!tokens.isEmpty()) { if (tokens.peek() instanceof DateToken) { return handleDateExpression(tokens); } else... |
### Question:
Book { public void addAuthor(Author author) { authors.add(createAuthorRef(author)); } void addAuthor(Author author); }### Answer:
@Test public void booksAndAuthors() { Author author = new Author(); author.name = "Greg L. Turnquist"; author = authorRepo.save(author); Book book = new Book(); book.title = ... |
### Question:
EnumeratedBerDecoder implements BerDecoder { @Override public Value decode( @NotNull ReaderContext context ) throws IOException, Asn1Exception { assert context.getType().getFamily() == Family.ENUMERATED; return context.getType().optimize( context.getScope(), IntegerBerDecoder.readInteger( context.getReade... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.