method2testcases stringlengths 118 3.08k |
|---|
### Question:
NameUtilities { public static String getFullName(Class c) { if (c == null) { throw new IllegalArgumentException("class cannot be null"); } StringBuilder name = new StringBuilder(); name.append(c.getPackage().getName()).append("."); Class klaus = c; List<Class> enclosingClasses = new ArrayList<Class>(); wh... |
### Question:
UriUtils { public static String replaceNamespace(String base, String replacement) { Matcher m = replaceNamespacePattern.matcher(base); String result = m.replaceAll(replacement); return result; } static Map<String, String> createMapFromUriQueryString(URI uri); static String getNameSpace(String s); static ... |
### Question:
JSONReader { public Attributes readDataset(Attributes attrs) { boolean wrappedInArray = next() == Event.START_ARRAY; if (wrappedInArray) next(); expect(Event.START_OBJECT); if (attrs == null) { attrs = new Attributes(); } fmi = null; next(); doReadDataset(attrs); if (wrappedInArray) next(); return attrs; ... |
### Question:
DicomOutputStream extends FilterOutputStream { public void writeCommand(Attributes cmd) throws IOException { if (explicitVR || bigEndian) throw new IllegalStateException("explicitVR=" + explicitVR + ", bigEndian=" + bigEndian); cmd.writeGroupTo(this, Tag.CommandGroupLength); } DicomOutputStream(OutputStre... |
### Question:
AttributeSelector implements Serializable { public boolean matches(List<ItemPointer> itemPointers, String privateCreator, int tag) { int level; if (tag != this.tag || !Objects.equals(privateCreator, this.privateCreator) || (itemPointers.size() != (level = level()))) { return false; } for (int i = 0; i < l... |
### Question:
DicomOutputStream extends FilterOutputStream { public void writeDataset(Attributes fmi, Attributes dataset) throws IOException { if (fmi != null) { writeFileMetaInformation(fmi); switchTransferSyntax(fmi.getString(Tag.TransferSyntaxUID, null)); } if (dataset.bigEndian() != bigEndian || encOpts.groupLength... |
### Question:
DicomOutputStream extends FilterOutputStream { public final void setEncodingOptions(DicomEncodingOptions encOpts) { if (encOpts == null) throw new NullPointerException(); this.encOpts = encOpts; } DicomOutputStream(OutputStream out, String tsuid); DicomOutputStream(File file); final void setPreamble(byte... |
### Question:
DicomOutputStream extends FilterOutputStream { public void close() throws IOException { try { finish(); } catch (IOException ignored) { } super.close(); } DicomOutputStream(OutputStream out, String tsuid); DicomOutputStream(File file); final void setPreamble(byte[] preamble); final boolean isExplicitVR()... |
### Question:
DicomOutputStream extends FilterOutputStream { public void writeFileMetaInformation(Attributes fmi) throws IOException { if (!explicitVR || bigEndian || countingOutputStream != null) throw new IllegalStateException("explicitVR=" + explicitVR + ", bigEndian=" + bigEndian + ", deflated=" + (countingOutputSt... |
### Question:
RecordFactory { public RecordType getRecordType(String cuid) { if (cuid == null) throw new NullPointerException(); lazyLoadDefaultConfiguration(); RecordType recordType = recordTypes.get(cuid); return recordType != null ? recordType : RecordType.PRIVATE; } void loadDefaultConfiguration(); void loadConfig... |
### Question:
FindSCU { static void mergeKeys(Attributes attrs, Attributes keys) { try { attrs.accept(new MergeNested(keys), false); } catch (Exception e) { throw new RuntimeException(e); } attrs.addAll(keys); } FindSCU(); final void setPriority(int priority); final void setInformationModel(InformationModel model, Stri... |
### Question:
LdapHL7Configuration extends LdapDicomConfigurationExtension implements HL7Configuration { @Override public HL7Application findHL7Application(String name) throws ConfigurationException { Device device = config.findDevice( "(&(objectclass=hl7Application)(hl7ApplicationName=" + name + "))", name); HL7Device... |
### Question:
IOD extends ArrayList<IOD.DataElement> { public static IOD load(String uri) throws IOException { if (uri.startsWith("resource:")) { try { uri = ResourceLocator.getResource(uri.substring(9), IOD.class); } catch (NullPointerException npe) { throw new FileNotFoundException(uri); } } else if (uri.indexOf(':')... |
### Question:
PersonName { public String get(Component c) { return get(Group.Alphabetic, c); } PersonName(); PersonName(String s); PersonName(String s, boolean lenient); String toString(); String toString(Group g, boolean trim); String get(Component c); String get(Group g, Component c); void set(Component c, String s... |
### Question:
PersonName { public String toString() { int totLen = 0; Group lastGroup = Group.Alphabetic; for (Group g : Group.values()) { Component lastCompOfGroup = Component.FamilyName; for (Component c : Component.values()) { String s = get(g, c); if (s != null) { totLen += s.length(); lastGroup = g; lastCompOfGrou... |
### Question:
ValueSelector implements Serializable { @Override public String toString() { if (str == null) str = attributeSelector.toStringBuilder() .append("/Value[@number=\"") .append(valueIndex + 1) .append("\"]") .toString(); return str; } ValueSelector(int tag, String privateCreator, int index, ItemPointer... ite... |
### Question:
ValueSelector implements Serializable { public static ValueSelector valueOf(String s) { int fromIndex = s.lastIndexOf("DicomAttribute"); try { return new ValueSelector(AttributeSelector.valueOf(s), AttributeSelector.selectNumber(s, fromIndex) - 1); } catch (Exception e) { throw new IllegalArgumentExceptio... |
### Question:
ElementDictionary { public static VR vrOf(int tag, String privateCreator) { return getElementDictionary(privateCreator).vrOf(tag); } protected ElementDictionary(String privateCreator, Class<?> tagClass); static ElementDictionary getStandardElementDictionary(); static ElementDictionary getElementDictionar... |
### Question:
ElementDictionary { public static String keywordOf(int tag, String privateCreator) { return getElementDictionary(privateCreator).keywordOf(tag); } protected ElementDictionary(String privateCreator, Class<?> tagClass); static ElementDictionary getStandardElementDictionary(); static ElementDictionary getEl... |
### Question:
ElementDictionary { public static int tagForKeyword(String keyword, String privateCreatorID) { return getElementDictionary(privateCreatorID).tagForKeyword(keyword); } protected ElementDictionary(String privateCreator, Class<?> tagClass); static ElementDictionary getStandardElementDictionary(); static Ele... |
### Question:
DateUtils { public static String formatDA(TimeZone tz, Date date) { return formatDA(tz, date, new StringBuilder(8)).toString(); } static String formatDA(TimeZone tz, Date date); static StringBuilder formatDA(TimeZone tz, Date date,
StringBuilder toAppendTo); static String formatTM(TimeZone tz... |
### Question:
DateUtils { public static String formatTM(TimeZone tz, Date date) { return formatTM(tz, date, new DatePrecision()); } static String formatDA(TimeZone tz, Date date); static StringBuilder formatDA(TimeZone tz, Date date,
StringBuilder toAppendTo); static String formatTM(TimeZone tz, Date date)... |
### Question:
DateUtils { public static String formatDT(TimeZone tz, Date date) { return formatDT(tz, date, new DatePrecision()); } static String formatDA(TimeZone tz, Date date); static StringBuilder formatDA(TimeZone tz, Date date,
StringBuilder toAppendTo); static String formatTM(TimeZone tz, Date date)... |
### Question:
DateUtils { public static Date parseDA(TimeZone tz, String s) { return parseDA(tz, s, false); } static String formatDA(TimeZone tz, Date date); static StringBuilder formatDA(TimeZone tz, Date date,
StringBuilder toAppendTo); static String formatTM(TimeZone tz, Date date); static String format... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { public int size() { return size; } IntHashMap(); IntHashMap(int expectedMaxSize); int size(); boolean isEmpty(); @SuppressWarnings("unchecked") V get(int key); boolean containsKey(int key); @SuppressWarnings("unchecked") V put(int key, V value); voi... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { @SuppressWarnings("unchecked") public V get(int key) { byte[] states = this.states; int[] keys = this.keys; int mask = keys.length - 1; int i = key & mask; while (states[i] != FREE) { if (keys[i] == key) return (V) values[i]; i = (i + 1) & mask; } re... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { @SuppressWarnings("unchecked") public V put(int key, V value) { byte[] states = this.states; int[] keys = this.keys; int mask = keys.length - 1; int i = key & mask; while (states[i] > FREE) { if (keys[i] == key) { V oldValue = (V) values[i]; values[i... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { public boolean containsKey(int key) { byte[] states = this.states; int[] keys = this.keys; int mask = keys.length - 1; int i = key & mask; while (states[i] != FREE) { if (keys[i] == key) return states[i] > FREE; i = (i + 1) & mask; } return false; } ... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { public void rehash() { resize(keys.length); } IntHashMap(); IntHashMap(int expectedMaxSize); int size(); boolean isEmpty(); @SuppressWarnings("unchecked") V get(int key); boolean containsKey(int key); @SuppressWarnings("unchecked") V put(int key, V ... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { @SuppressWarnings("unchecked") public V remove(int key) { byte[] states = this.states; int[] keys = this.keys; int mask = keys.length - 1; int i = key & mask; while (states[i] != FREE) { if (keys[i] == key) { if (states[i] < FREE) return null; states... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { public void clear() { Arrays.fill(values, null); Arrays.fill(states, FREE); size = 0; free = keys.length >>> 1; } IntHashMap(); IntHashMap(int expectedMaxSize); int size(); boolean isEmpty(); @SuppressWarnings("unchecked") V get(int key); boolean co... |
### Question:
IntHashMap implements Cloneable, java.io.Serializable { @SuppressWarnings("unchecked") public Object clone() { try { IntHashMap<V> m = (IntHashMap<V>) super.clone(); m.states = states.clone(); m.keys = keys.clone(); m.values = values.clone(); return m; } catch (CloneNotSupportedException e) { throw new In... |
### Question:
AttributeSelector implements Serializable { @Override public String toString() { if (str == null) str = toStringBuilder().toString(); return str; } AttributeSelector(int tag); AttributeSelector(int tag, String privateCreator); AttributeSelector(int tag, String privateCreator, ItemPointer... itemPointers... |
### Question:
AttributeSelector implements Serializable { public static AttributeSelector valueOf(String s) { int fromIndex = s.lastIndexOf("DicomAttribute"); try { return new AttributeSelector( selectTag(s, fromIndex), selectPrivateCreator(s, fromIndex), itemPointersOf(s, fromIndex)); } catch (Exception e) { throw new... |
### Question:
Post extends AuditableEntity { @PrePersist public void slugify(){ this.slug = new Slugify().slugify(this.title); } @PrePersist void slugify(); }### Answer:
@Test public void testSlug() { System.out.println("getSlug"); Post instance = new Post(); instance.setTitle("test post 1"); instance.slugify(); asse... |
### Question:
PostService { public Post createPost(PostForm form) { Post _post = Post.builder() .title(form.getTitle()) .content(form.getContent()) .build(); Post saved = this.postRepository.save(_post); return saved; } Post createPost(PostForm form); Post updatePost(String slug, PostForm form); void deletePost(String... |
### Question:
UserServiceClient { public User findByUsername(String username) { try { ResponseEntity<User> response = this.restTemplate.getForEntity(userServiceUrl + "/users/{username}", User.class, username); return response.getBody(); } catch (HttpClientErrorException e) { if (e.getStatusCode() == NOT_FOUND) { return... |
### Question:
GraphUIController { public void refresh() { if (dfa == null) { throw new IllegalStateException("Graph has not been built using start() yet."); } panel.renderGraph(dfa); if (!panel.isJumpToActionEnabled()) { updateStatePanel(); } } GraphUIController(VisualGraphPanel panel); void start(final DFAExecution<? ... |
### Question:
Tracing extends org.apache.cassandra.tracing.Tracing { Span spanFromPayload(Tracer tracer, @Nullable Map<String, ByteBuffer> payload) { ByteBuffer b3 = payload != null ? payload.get("b3") : null; if (b3 == null) return tracer.nextSpan(); TraceContextOrSamplingFlags extracted = B3SingleFormat.parseB3Single... |
### Question:
HashTableHipsterDirectedGraph extends HashTableHipsterGraph<V,E> implements HipsterDirectedGraph<V,E> { @Override public GraphEdge<V,E> connect(V v1, V v2, E value){ Preconditions.checkArgument(v1 != null && v2 != null, "Vertices cannot be null"); GraphEdge<V,E> edge = new DirectedEdge<V, E>(v1, v2, value... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public boolean add(V v){ if(!connected.containsKey(v)){ connected.put(v, new LinkedHashSet<GraphEdge<V, E>>()); return true; } return false; } HashBasedHipsterGraph(); @Override boolean add(V v); @Override Set<V> add(V... vertices); @Ov... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public boolean remove(V v){ Set<GraphEdge<V, E>> edges = this.connected.get(v); if (edges == null) return false; for(Iterator<GraphEdge<V,E>> it = edges.iterator(); it.hasNext(); ){ GraphEdge<V,E> edge = it.next(); it.remove(); V v2 = e... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public GraphEdge<V,E> connect(V v1, V v2, E value){ if(v1 == null || v2 == null) throw new IllegalArgumentException("Invalid vertices. A vertex cannot be null"); if (!connected.containsKey(v1)) throw new IllegalArgumentException(v1 + " ... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public Iterable<V> vertices() { return connected.keySet(); } HashBasedHipsterGraph(); @Override boolean add(V v); @Override Set<V> add(V... vertices); @Override boolean remove(V v); @Override Set<V> remove(V... vertices); @Override Grap... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edgesOf(V vertex) { Set<GraphEdge<V, E>> set = connected.get(vertex); if (set == null) set = Collections.emptySet(); return set; } HashBasedHipsterGraph(); @Override boolean add(V v); @Override Set<V> ad... |
### Question:
HashBasedHipsterDirectedGraph extends HashBasedHipsterGraph<V, E> implements HipsterMutableGraph<V, E>, HipsterDirectedGraph<V, E> { @Override public Iterable<GraphEdge<V, E>> outgoingEdgesOf(final V vertex) { return F.filter(edgesOf(vertex), new Function<GraphEdge<V, E>, Boolean>() { @Override public Boo... |
### Question:
HashBasedHipsterDirectedGraph extends HashBasedHipsterGraph<V, E> implements HipsterMutableGraph<V, E>, HipsterDirectedGraph<V, E> { @Override public Iterable<GraphEdge<V, E>> incomingEdgesOf(final V vertex) { return F.filter(edgesOf(vertex), new Function<GraphEdge<V, E>, Boolean>() { @Override public Boo... |
### Question:
HashBasedHipsterDirectedGraph extends HashBasedHipsterGraph<V, E> implements HipsterMutableGraph<V, E>, HipsterDirectedGraph<V, E> { @Override public Iterable<GraphEdge<V, E>> edges() { return F.map( F.filter(HashBasedHipsterDirectedGraph.super.vedges(), new Function<Map.Entry<V, GraphEdge<V, E>>, Boolean... |
### Question:
HashTableHipsterDirectedGraph extends HashTableHipsterGraph<V,E> implements HipsterDirectedGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> outgoingEdgesOf(V vertex) { return graphTable.row(vertex).values(); } @Override GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<GraphEdge<V, E... |
### Question:
HashTableHipsterDirectedGraph extends HashTableHipsterGraph<V,E> implements HipsterDirectedGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> incomingEdgesOf(V vertex) { return graphTable.column(vertex).values(); } @Override GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<GraphEdge<V... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { public void add(V v){ if (!graphTable.containsColumn(v) && !graphTable.containsRow(v)){ disconnected.add(v); } } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> edge); GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<Gra... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { public void remove(V v){ for(GraphEdge<V,E> edge : edgesOf(v)){ V connectedVertex = edge.getVertex1().equals(v) ? edge.getVertex2() : edge.getVertex1(); if (!greaterThan(1, edgesOf(connectedVertex))){ disconnected.add(connectedVertex); } } if (graphTabl... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { public GraphEdge<V,E> connect(V v1, V v2, E value){ Preconditions.checkArgument(v1 != null && v2 != null, "Vertices cannot be null"); GraphEdge<V,E> edge = new UndirectedEdge<V, E>(v1, v2, value); graphTable.put(v1, v2, edge); graphTable.put(v2, v1, edg... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edges() { return graphTable.values(); } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> edge); GraphEdge<V,E> connect(V v1, V v2, E value); @Override Iterable<GraphEdge<V, E>> edges(); @Overri... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { @Override public Iterable<V> vertices() { return Sets.union(Sets.union(graphTable.rowKeySet(), graphTable.columnKeySet()), disconnected); } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> edge); GraphEdge<V,E> connect(V v1, V v2, E val... |
### Question:
HashTableHipsterGraph implements HipsterGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edgesOf(V vertex) { return Sets.union(Sets.newHashSet(graphTable.row(vertex).values()), Sets.newHashSet(graphTable.column(vertex).values())); } void add(V v); void remove(V v); void remove(V v, GraphEdge<V,E> ... |
### Question:
HashBasedHipsterGraph implements HipsterMutableGraph<V,E> { @Override public Iterable<GraphEdge<V, E>> edges() { return F.map(vedges(), new Function<Map.Entry<V, GraphEdge<V, E>>, GraphEdge<V, E>>() { @Override public GraphEdge<V, E> apply(Map.Entry<V, GraphEdge<V, E>> entry) { return entry.getValue(); } ... |
### Question:
CallArgumentsToByteArray { public byte[] getGasPrice() { byte[] gasPrice = new byte[] {0}; if (args.gasPrice != null && args.gasPrice.length() != 0) { gasPrice = stringHexToByteArray(args.gasPrice); } return gasPrice; } CallArgumentsToByteArray(Web3.CallArguments args); byte[] getGasPrice(); byte[] getGas... |
### Question:
Value { public boolean isEmpty() { if (isNull()) { return true; } if (isBytes() && asBytes().length == 0) { return true; } if (isList() && asList().isEmpty()) { return true; } if (isString() && asString().equals("")) { return true; } return false; } Value(); Value(Object obj); static Value fromRlpEncoded... |
### Question:
LockWhitelist { public Integer getSize() { return whitelistedAddresses.size(); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Address address); boolean isWhiteliste... |
### Question:
LockWhitelist { public List<Address> getAddresses() { return new ArrayList<>(whitelistedAddresses.keySet()); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Address ... |
### Question:
LockWhitelist { public boolean isWhitelisted(Address address) { return whitelistedAddresses.containsKey(address); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Add... |
### Question:
LockWhitelist { public boolean remove(Address address) { return whitelistedAddresses.remove(address) != null; } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses, int disableBlockHeight); boolean isWhitelisted(Address... |
### Question:
LockWhitelist { public <T extends LockWhitelistEntry> List<T> getAll(Class<T> type) { return whitelistedAddresses.values().stream() .filter(e -> e.getClass() == type) .map(type::cast) .collect(Collectors.toList()); } LockWhitelist(Map<Address, LockWhitelistEntry> whitelistedAddresses); LockWhitelist(Map<... |
### Question:
CoinbaseInformation { public Sha256Hash getWitnessMerkleRoot() { return witnessMerkleRoot; } CoinbaseInformation(Sha256Hash witnessMerkleRoot); Sha256Hash getWitnessMerkleRoot(); }### Answer:
@Test public void getWitnessMerkleRoot() { Sha256Hash secondHashTx = Sha256Hash.wrap(Hex.decode("e3d0840a0825fb7d... |
### Question:
Federation { public List<FederationMember> getMembers() { return members; } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); int getNumberOfSignaturesRequired();... |
### Question:
Federation { public Integer getBtcPublicKeyIndex(BtcECKey key) { for (int i = 0; i < members.size(); i++) { if (Arrays.equals(key.getPubKey(), members.get(i).getBtcPublicKey().getPubKey())) { return i; } } return null; } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNu... |
### Question:
Federation { public boolean hasBtcPublicKey(BtcECKey key) { return getBtcPublicKeyIndex(key) != null; } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); int getN... |
### Question:
Federation { public boolean hasMemberWithRskAddress(byte[] address) { return members.stream() .anyMatch(m -> Arrays.equals(m.getRskPublicKey().getAddress(), address)); } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<Federatio... |
### Question:
Federation { @Override public String toString() { return String.format("%d of %d signatures federation", getNumberOfSignaturesRequired(), members.size()); } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getM... |
### Question:
Federation { public boolean isMember(FederationMember federationMember){ return this.members.contains(federationMember); } Federation(List<FederationMember> members, Instant creationTime, long creationBlockNumber, NetworkParameters btcParams); List<FederationMember> getMembers(); List<BtcECKey> getBtcPub... |
### Question:
PartialMerkleTreeFormatUtils { public static VarInt getHashesCount(byte[] pmtSerialized) { return new VarInt(pmtSerialized, BLOCK_TRANSACTION_COUNT_LENGTH); } static VarInt getHashesCount(byte[] pmtSerialized); static VarInt getFlagBitsCount(byte[] pmtSerialized); static boolean hasExpectedSize(byte[] pm... |
### Question:
ReleaseRequestQueue { public void add(Address destination, Coin amount, Keccak256 rskTxHash) { entries.add(new Entry(destination, amount, rskTxHash)); } ReleaseRequestQueue(List<Entry> entries); List<Entry> getEntriesWithoutHash(); List<Entry> getEntriesWithHash(); List<Entry> getEntries(); void add(Addre... |
### Question:
ReleaseRequestQueue { public void process(int maxIterations, Processor processor) { ListIterator<Entry> iterator = entries.listIterator(); List<Entry> toRetry = new ArrayList<>(); int i = 0; while (iterator.hasNext() && i < maxIterations) { Entry entry = iterator.next(); iterator.remove(); ++i; if (!proce... |
### Question:
RepositoryBtcBlockStoreWithCache implements BtcBlockStoreWithCache { @Override public synchronized StoredBlock getChainHead() { byte[] ba = repository.getStorageBytes(contractAddress, DataWord.fromString(BLOCK_STORE_CHAIN_HEAD_KEY)); if (ba == null) { return null; } return byteArrayToStoredBlock(ba); } Re... |
### Question:
RepositoryBtcBlockStoreWithCache implements BtcBlockStoreWithCache { @Override public NetworkParameters getParams() { return btcNetworkParams; } RepositoryBtcBlockStoreWithCache(NetworkParameters btcNetworkParams, Repository repository, Map<Sha256Hash, StoredBlock> cacheBlocks, RskAddress contractAddress)... |
### Question:
RemascStorageProvider { public Coin getRewardBalance() { if (rewardBalance != null) { return rewardBalance; } DataWord address = DataWord.fromString(REWARD_BALANCE_KEY); DataWord value = this.repository.getStorageValue(this.contractAddress, address); if (value == null) { return Coin.ZERO; } return new Coi... |
### Question:
RemascStorageProvider { public Coin getBurnedBalance() { if (burnedBalance != null) { return burnedBalance; } DataWord address = DataWord.fromString(BURNED_BALANCE_KEY); DataWord value = this.repository.getStorageValue(this.contractAddress, address); if (value == null) { return Coin.ZERO; } return new Coi... |
### Question:
RemascStorageProvider { public Boolean getBrokenSelectionRule() { if (brokenSelectionRule!= null) { return brokenSelectionRule; } DataWord address = DataWord.fromString(BROKEN_SELECTION_RULE_KEY); byte[] bytes = this.repository.getStorageBytes(this.contractAddress, address); if (bytes == null || bytes.len... |
### Question:
RemascFederationProvider { public int getFederationSize() { return this.federationSupport.getFederationSize(); } RemascFederationProvider(
ActivationConfig activationConfig,
BridgeConstants bridgeConstants,
Repository repository,
Block processingBlock); int ... |
### Question:
RemascFederationProvider { public RskAddress getFederatorAddress(int n) { byte[] publicKey = this.federationSupport.getFederatorBtcPublicKey(n); return new RskAddress(ECKey.fromPublicOnly(publicKey).getAddress()); } RemascFederationProvider(
ActivationConfig activationConfig,
Bridg... |
### Question:
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Overrid... |
### Question:
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { @Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override ... |
### Question:
Wallet { public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(a... |
### Question:
Wallet { public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress addAc... |
### Question:
Wallet { public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; } Wallet(K... |
### Question:
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); ... |
### Question:
Wallet { public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); a... |
### Question:
Wallet { public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes... |
### Question:
SnapshotManager { @VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; } SnapshotManager(
Blockchain blockchain,
BlockStore blockStore,
TransactionPool transactionPool,
MinerServer minerServer); int takeSnapshot(); boolean resetSnapsh... |
### Question:
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter,
... |
### Question:
BlockChainImpl implements Blockchain { @Override public Block getBlockByHash(byte[] hash) { return blockStore.getBlockByHash(hash); } BlockChainImpl(BlockStore blockStore,
ReceiptStore receiptStore,
TransactionPool transactionPool,
... |
### Question:
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.s... |
### Question:
BlockUtils { public static boolean tooMuchProcessTime(long nanoseconds) { return nanoseconds > MAX_BLOCK_PROCESS_TIME_NANOSECONDS; } private BlockUtils(); static boolean tooMuchProcessTime(long nanoseconds); static boolean blockInSomeBlockChain(Block block, Blockchain blockChain); static Set<Keccak256> u... |
### Question:
TransactionPoolImpl implements TransactionPool { @Override public PendingState getPendingState() { return getPendingState(getCurrentRepository()); } TransactionPoolImpl(
RskSystemProperties config,
RepositoryLocator repositoryLocator,
BlockStore blockStore,
... |
### Question:
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl(
... |
### Question:
SelectionRule { public static boolean isThisBlockHashSmaller(byte[] thisBlockHash, byte[] compareBlockHash) { return FastByteComparisons.compareTo( thisBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH, compareBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH) < 0; } static boolean shouldWeAddThisBlock(
... |
### Question:
BlockChainFlusher implements InternalService { private void flush() { if (nFlush == 0) { flushAll(); } nFlush++; nFlush = nFlush % flushNumberOfBlocks; } BlockChainFlusher(
int flushNumberOfBlocks,
CompositeEthereumListener emitter,
TrieStore trieStore,
Bloc... |
### Question:
Uint24 implements Comparable<Uint24> { public int intValue() { return intValue; } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Uint24 o); @Override String toString(); static Uint24 decode(byte[] bytes, int offs... |
### Question:
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); byte[] encode(); int intValue(); @Override bo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.