method2testcases stringlengths 118 6.63k |
|---|
### Question:
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object obj... |
### Question:
Log4jFileAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { fileOutputStream.write( line.getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] ... |
### Question:
Log4jFileAppender implements Appender { public void close() { try { fileOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolea... |
### Question:
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public int getBatchSizeInt( VariableSpace vars ) { return Const.toInt( vars.environmentSubstitute( this.batchSize ), DEFAULT_BATCH_SIZE ); } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); Stri... |
### Question:
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { ElasticSearchBulkMeta retval = (ElasticSearchBulkMeta) super.clone(); return retval; } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setId... |
### Question:
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public boolean supportsErrorHandling() { return true; } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); voi... |
### Question:
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new ElasticSearchBulkData(); } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); bool... |
### Question:
GlobalMessages extends AbstractMessageHandler { public static ResourceBundle getBundle( String packageName ) throws MissingResourceException { return getBundle( packageName, GlobalMessages.getInstance().getClass() ); } GlobalMessages(); static synchronized MessageHandler getInstance(); static synchronized... |
### Question:
MetaStoreConst { public static IMetaStore openLocalPentahoMetaStore() throws MetaStoreException { return MetaStoreConst.openLocalPentahoMetaStore( true ); } static final String getDefaultPentahoMetaStoreLocation(); static IMetaStore openLocalPentahoMetaStore(); static IMetaStore openLocalPentahoMetaStore... |
### Question:
TransExecutionConfiguration implements ExecutionConfiguration { public Long getPassedBatchId() { return passedBatchId; } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); Object clone(); Map<String, String> getArguments(); void setArguments( Map<String, String> arguments ); voi... |
### Question:
StringObjectId implements ObjectId, Comparable<StringObjectId> { public StringObjectId( String id ) { this.id = id; } StringObjectId( String id ); StringObjectId( ObjectId objectId ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override int compareTo( StringObjectId o ); @Override ... |
### Question:
DateCache { public DateCache() { cache = new HashMap<String, Date>(); } DateCache(); void populate( String datePattern, int fromYear, int toYear ); void addDate( String dateString, Date date ); Date lookupDate( String dateString ); int getSize(); static void main( String[] args ); }### Answer:
@SuppressW... |
### Question:
LookupReferencesException extends KettleException { public String objectTypePairsToString() { StringBuilder result = new StringBuilder(); for ( Map.Entry entry : objectTypePairs.entrySet() ) { if ( entry.getKey() != null ) { result.append( Const.CR ); result.append( "\"" ); result.append( entry.getKey() )... |
### Question:
FileInputList { public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; } static String getRequiredFilesDescription( List<FileObject> nonExistantFile... |
### Question:
DataHandler extends AbstractXulEventHandler { public void clearOptionsData() { getControls(); if ( optionsParameterTree != null ) { optionsParameterTree.getRootChildren().removeAll(); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(... |
### Question:
XMLCheck { public static boolean isXMLWellFormed( InputStream is ) throws KettleException { boolean retval = false; try { SAXParserFactory factory = XMLParserFactoryProducer.createSecureSAXParserFactory(); XMLTreeHandler handler = new XMLTreeHandler(); SAXParser saxParser = factory.newSAXParser(); saxPars... |
### Question:
KettleVFS { public static boolean startsWithScheme( String vfsFileName ) { FileSystemManager fsManager = getInstance().getFileSystemManager(); boolean found = false; String[] schemes = fsManager.getSchemes(); for ( int i = 0; i < schemes.length; i++ ) { if ( vfsFileName.startsWith( schemes[i] + ":" ) ) { ... |
### Question:
SingleRowRowSet extends BaseRowSet implements Comparable<RowSet>, RowSet { @Override public boolean putRow( RowMetaInterface rowMeta, Object[] rowData ) { this.rowMeta = rowMeta; this.row = rowData; return true; } @Override Object[] getRow(); @Override Object[] getRowImmediate(); @Override Object[] getRo... |
### Question:
SingleRowRowSet extends BaseRowSet implements Comparable<RowSet>, RowSet { @Override public boolean putRowWait( RowMetaInterface rowMeta, Object[] rowData, long time, TimeUnit tu ) { return putRow( rowMeta, rowData ); } @Override Object[] getRow(); @Override Object[] getRowImmediate(); @Override Object[]... |
### Question:
SingleRowRowSet extends BaseRowSet implements Comparable<RowSet>, RowSet { @Override public Object[] getRowImmediate() { return getRow(); } @Override Object[] getRow(); @Override Object[] getRowImmediate(); @Override Object[] getRowWait( long timeout, TimeUnit tu ); @Override boolean putRow( RowMetaInter... |
### Question:
SingleRowRowSet extends BaseRowSet implements Comparable<RowSet>, RowSet { @Override public int size() { return row == null ? 0 : 1; } @Override Object[] getRow(); @Override Object[] getRowImmediate(); @Override Object[] getRowWait( long timeout, TimeUnit tu ); @Override boolean putRow( RowMetaInterface ... |
### Question:
DateDetector { public static String getRegexpByDateFormat( String dateFormat ) { return getRegexpByDateFormat( dateFormat, null ); } private DateDetector(); static String getRegexpByDateFormat( String dateFormat ); static String getRegexpByDateFormat( String dateFormat, String locale ); static String get... |
### Question:
DateDetector { public static String getDateFormatByRegex( String regex ) { return getDateFormatByRegex( regex, null ); } private DateDetector(); static String getRegexpByDateFormat( String dateFormat ); static String getRegexpByDateFormat( String dateFormat, String locale ); static String getDateFormatBy... |
### Question:
DateDetector { public static Date getDateFromString( String dateString ) throws ParseException { String dateFormat = detectDateFormat( dateString ); if ( dateFormat == null ) { throw new ParseException( "Unknown date format.", 0 ); } return getDateFromStringByFormat( dateString, dateFormat ); } private D... |
### Question:
DateDetector { public static Date getDateFromStringByFormat( String dateString, String dateFormat ) throws ParseException { if ( dateFormat == null ) { throw new ParseException( "Unknown date format. Format is null. ", 0 ); } if ( dateString == null ) { throw new ParseException( "Unknown date string. Date... |
### Question:
DateDetector { public static String detectDateFormat( String dateString ) { return detectDateFormat( dateString, null ); } private DateDetector(); static String getRegexpByDateFormat( String dateFormat ); static String getRegexpByDateFormat( String dateFormat, String locale ); static String getDateFormat... |
### Question:
DateDetector { public static boolean isValidDate( String dateString, String dateFormat ) { try { getDateFromStringByFormat( dateString, dateFormat ); return true; } catch ( ParseException e ) { return false; } } private DateDetector(); static String getRegexpByDateFormat( String dateFormat ); static Stri... |
### Question:
DateDetector { public static boolean isValidDateFormatToStringDate( String dateFormat, String dateString ) { String detectedDateFormat = detectDateFormat( dateString ); if ( ( dateFormat != null ) && ( dateFormat.equals( detectedDateFormat ) ) ) { return true; } return false; } private DateDetector(); st... |
### Question:
StringEvaluator { public int getCount() { return count; } StringEvaluator(); StringEvaluator( boolean tryTrimming ); StringEvaluator( boolean tryTrimming, List<String> numberFormats, List<String> dateFormats ); StringEvaluator( boolean tryTrimming, String[] numberFormats, String[] dateFormats ); void e... |
### Question:
EnvUtil { public static void environmentInit() throws KettleException { if ( Thread.currentThread().getContextClassLoader() == null ) { Thread.currentThread().setContextClassLoader( ClassLoader.getSystemClassLoader() ); } Map<Object, Object> kettleProperties = EnvUtil.readProperties( Const.KETTLE_PROPERTI... |
### Question:
EnvUtil { public static Locale createLocale( String localeCode ) { Locale resultLocale = null; if ( !Utils.isEmpty( localeCode ) ) { StringTokenizer parser = new StringTokenizer( localeCode, "_" ); if ( parser.countTokens() == 2 ) { resultLocale = new Locale( parser.nextToken(), parser.nextToken() ); } el... |
### Question:
TemporaryCacheManager { public void cacheSmallBlock(SmallBlock smallBlock) { smallBlockCacheMap.put(smallBlock.getHeader().getHash(), smallBlock); } private TemporaryCacheManager(); static TemporaryCacheManager getInstance(); void cacheSmallBlock(SmallBlock smallBlock); void cacheSmallBlockWithRequest(Nu... |
### Question:
RoundManager { public MeetingRound getRoundByIndex(long roundIndex) { MeetingRound round = null; for (int i = roundList.size() - 1; i >= 0; i--) { round = roundList.get(i); if (round.getIndex() == roundIndex) { break; } } return round; } RoundManager(Chain chain); MeetingRound getRoundByIndex(long roundIn... |
### Question:
RoundManager { public boolean clearRound(int count) { Lockers.ROUND_LOCK.lock(); boolean doit = false; try { while (roundList.size() > count) { doit = true; roundList.remove(0); } if (doit) { MeetingRound round = roundList.get(0); round.setPreRound(null); } return true; } finally { Lockers.ROUND_LOCK.unlo... |
### Question:
RoundManager { public MeetingRound initRound() { MeetingRound currentRound = resetRound(false); if (currentRound.getPreRound() == null) { BlockExtendsData extendsData = null; List<BlockHeader> blockHeaderList = chain.getAllBlockHeaderList(); for (int i = blockHeaderList.size() - 1; i >= 0; i--) { BlockHea... |
### Question:
ConsensusTool { public static SmallBlock getSmallBlock(Block block) { SmallBlock smallBlock = new SmallBlock(); smallBlock.setHeader(block.getHeader()); List<NulsDigestData> txHashList = new ArrayList<>(); for (Transaction tx : block.getTxs()) { txHashList.add(tx.getHash()); if (tx.isSystemTx()) { smallBl... |
### Question:
RandomSeedUtils { public static byte[] createRandomSeed() { BigInteger value = new BigInteger(256, new Random()); byte[] result = value.toByteArray(); if (result.length > 32) { byte[] temp = new byte[32]; System.arraycopy(result, result.length - 32, temp, 0, 32); result = temp; } else if (result.length < ... |
### Question:
RandomSeedUtils { public static byte[] getLastDigestEightBytes(byte[] bytes) { byte[] hash = Sha256Hash.hashTwice(bytes); byte[] result = new byte[8]; System.arraycopy(hash, bytes.length - 8, result, 0, 8); return result; } static byte[] createRandomSeed(); static byte[] getLastDigestEightBytes(byte[] by... |
### Question:
BlockQueueProvider { public boolean put(BlockContainer blockContainer) { boolean receive = (blockContainer.getStatus() == BlockContainerStatus.RECEIVED); if (receive) { int status = BlockContainerStatus.RECEIVED; checkDownloadService(); if (!downloadService.isDownloadSuccess().isSuccess()) { status = Bloc... |
### Question:
BlockQueueProvider { public BlockContainer get() { BlockContainer blockContainer = null; if (!downloadBlockQueueHasDestory) { blockContainer = downloadBlockQueue.poll(); } checkDownloadService(); boolean hasDownloadSuccess = downloadService.isDownloadSuccess().isSuccess(); if (blockContainer == null && ha... |
### Question:
BlockProcessTask implements Runnable { @Override public void run() { Lockers.CHAIN_LOCK.lock(); try { doTask(); } catch (Exception e) { Log.error(e); } catch (Error e) { Log.error(e); } catch (Throwable e) { Log.error(e); } finally { Lockers.CHAIN_LOCK.unlock(); } } BlockProcessTask(BlockProcess blockProc... |
### Question:
ChainContainer implements Cloneable { public MeetingRound getCurrentRound() { return roundManager.getCurrentRound(); } ChainContainer(Chain chain); boolean addBlock(Block block); Result verifyBlock(Block block); Result verifyBlock(Block block, boolean isDownload, boolean isNeedCheckCoinBaseTx); boolean ve... |
### Question:
TemporaryCacheManager { public boolean cacheTx(Transaction tx) { return txCacheMap.put(tx.getHash(), tx); } private TemporaryCacheManager(); static TemporaryCacheManager getInstance(); void cacheSmallBlock(SmallBlock smallBlock); void cacheSmallBlockWithRequest(NulsDigestData requestHash, SmallBlock smal... |
### Question:
ChainContainer implements Cloneable { public boolean rollback(Block block) { int length = chain.getAllBlockList().size(); if (block == null || length == 0) { return false; } Block bestBlock = chain.getBestBlock(); if (!block.getHeader().getHash().equals(bestBlock.getHeader().getHash())) { Log.warn("rollba... |
### Question:
ChainContainer implements Cloneable { public ChainContainer getBeforeTheForkChain(ChainContainer chainContainer) { Chain newChain = new Chain(); newChain.setId(chainContainer.getChain().getId()); newChain.initData(chain.getStartBlockHeader(), new CopyOnWriteArrayList<>(chain.getAllBlockHeaderList()), new ... |
### Question:
ChainContainer implements Cloneable { public ChainContainer getAfterTheForkChain(ChainContainer chainContainer) { BlockHeader pointBlockHeader = chainContainer.getChain().getStartBlockHeader(); Chain chain = new Chain(); List<Block> blockList = getChain().getAllBlockList(); boolean canAdd = false; for (in... |
### Question:
MicroKernelBootstrap extends BaseModuleBootstrap { @Override public void init() { String folder = null; try { NulsConfig.NULS_CONFIG = ConfigLoader.loadIni(NulsConstant.USER_CONFIG_FILE); String mode = NulsConfig.NULS_CONFIG.getCfgValue(NulsConstant.CFG_SYSTEM_SECTION, "mode", "main"); if ("main".equals(m... |
### Question:
NulsDigestData extends BaseNulsData { public static NulsDigestData calcDigestData(BaseNulsData data) { return calcDigestData(data, (byte) 0); } NulsDigestData(); NulsDigestData(byte algType, byte[] bytes); @Override int size(); @Override void parse(NulsByteBuffer byteBuffer); byte getDigestAlgType(); voi... |
### Question:
MessageBusServiceImpl implements MessageBusService { @Override public String subscribeMessage(Class<? extends BaseMessage> messageClass, NulsMessageHandler<? extends BaseMessage> messageHandler) { MessageManager.putMessage(messageClass); return handlerManager.registerMessageHandler(null, messageClass, mes... |
### Question:
MessageBusServiceImpl implements MessageBusService { @Override public void unsubscribeMessage(String subscribeId) { this.handlerManager.removeMessageHandler(subscribeId); } @Override String subscribeMessage(Class<? extends BaseMessage> messageClass, NulsMessageHandler<? extends BaseMessage> messageHandle... |
### Question:
MessageBusServiceImpl implements MessageBusService { @Override public void receiveMessage(BaseMessage message, Node node) { try { this.processorManager.offer(new ProcessData(message, node)); } catch (Exception e) { Log.error(e); } } @Override String subscribeMessage(Class<? extends BaseMessage> messageCl... |
### Question:
MessageBusServiceImpl implements MessageBusService { @Override public Result<List<String>> broadcast(BaseMessage message, Node excludeNode, boolean aysn, int percent) { BroadcastResult result = networkService.sendToAllNode(message, excludeNode, aysn, percent); return getNodeIdListResult(result); } @Overr... |
### Question:
TemporaryCacheManager { public void destroy() { this.smallBlockCacheMap.clear(); this.txCacheMap.clear(); } private TemporaryCacheManager(); static TemporaryCacheManager getInstance(); void cacheSmallBlock(SmallBlock smallBlock); void cacheSmallBlockWithRequest(NulsDigestData requestHash, SmallBlock smal... |
### Question:
MessageBusServiceImpl implements MessageBusService { @Override public Result sendToNode(BaseMessage message, Node node, boolean aysn) { BroadcastResult result = networkService.sendToNode(message, node, aysn); if (!result.isSuccess()) { Log.error("send to node fail reason: " + result.getErrorCode().getMsg(... |
### Question:
MessageBusModuleBootstrap extends AbstractMessageBusModule { @Override public void start() { DispatchManager.getInstance().init(true); } @Override void init(); @Override void start(); @Override void shutdown(); @Override void destroy(); @Override String getInfo(); }### Answer:
@Test public void start() ... |
### Question:
MessageBusModuleBootstrap extends AbstractMessageBusModule { @Override public void shutdown() { DispatchManager.getInstance().shutdown(); } @Override void init(); @Override void start(); @Override void shutdown(); @Override void destroy(); @Override String getInfo(); }### Answer:
@Test public void shutd... |
### Question:
MessageBusModuleBootstrap extends AbstractMessageBusModule { @Override public void destroy() { } @Override void init(); @Override void start(); @Override void shutdown(); @Override void destroy(); @Override String getInfo(); }### Answer:
@Test public void destroy() { messageBusModuleBootstrap.destroy();... |
### Question:
AccountBaseService { public Result getPrivateKey(String address, String password) { if (!AddressTool.validAddress(address)) { return Result.getFailed(AccountErrorCode.ADDRESS_ERROR); } Account account = accountService.getAccount(address).getData(); if (null == account) { return Result.getFailed(AccountErr... |
### Question:
AccountBaseService { public Result setPassword(String address, String password) { if (!AddressTool.validAddress(address)) { return Result.getFailed(AccountErrorCode.ADDRESS_ERROR); } if (StringUtils.isBlank(password)) { return Result.getFailed(AccountErrorCode.NULL_PARAMETER); } if (!StringUtils.validPass... |
### Question:
AccountBaseService { public Result changePassword(String address, String oldPassword, String newPassword) { if (!AddressTool.validAddress(address)) { return Result.getFailed(AccountErrorCode.ADDRESS_ERROR); } if (StringUtils.isBlank(oldPassword)) { return Result.getFailed(AccountErrorCode.PARAMETER_ERROR)... |
### Question:
AliasService { public Result saveAlias(AliasPo aliaspo) throws NulsException { try { Result result = aliasStorageService.saveAlias(aliaspo); if (result.isFailed()) { this.rollbackAlias(aliaspo); } AccountPo po = accountStorageService.getAccount(aliaspo.getAddress()).getData(); if (null != po) { po.setAlia... |
### Question:
CallContractData extends TransactionLogicData implements ContractData { public String[][] getArgs() { return args; } @Override int size(); @Override void parse(NulsByteBuffer byteBuffer); @Override byte[] getSender(); void setSender(byte[] sender); @Override byte[] getContractAddress(); void setContractA... |
### Question:
ECKey { public static ECKey signedMessageToKey(String message, String signatureBase64) throws SignatureException { byte[] signatureEncoded; try { signatureEncoded = Base64.decode(signatureBase64); } catch (RuntimeException e) { throw new SignatureException("Could not decode base64", e); } if (signatureEnc... |
### Question:
VersionUtils { public static boolean higherThan(String version0, String version1) { if (StringUtils.isBlank(version0) || StringUtils.isBlank(version1)) { throw new RuntimeException("version is null"); } Integer[] intArr0 = strArrayToInt(version0); Integer[] intArr1 = strArrayToInt(version1); boolean resul... |
### Question:
FileUtil { public static boolean deleteFolder(File folder) { if (!folder.exists()) { return true; } File[] files = folder.listFiles(); for (File file : files) { if (file.isFile()) { try { boolean b = file.delete(); if (!b) { Log.info("delete " + file.getName() + " result:" + b); mkNullToFile(file); } } ca... |
### Question:
UpgradeThread implements Runnable { private boolean download(String url, String filePath, String signature) throws IOException { if (!upgrading) { setFailedMessage("The upgrade has stopped"); return false; } byte[] bytes = HttpDownloadUtils.download(url); if (!verifySig(bytes, Hex.decode(signature))) { se... |
### Question:
PoConvertUtil { public static String getAgentId(NulsDigestData hash) { String hashHex = hash.getDigestHex(); return hashHex.substring(hashHex.length() - 8).toUpperCase(); } static Agent poToAgent(AgentPo agentPo); static AgentPo agentToPo(Agent agent); static Deposit poToDeposit(DepositPo po); static Dep... |
### Question:
ChainManager { public void newOrphanChain(Block block) { Chain orphanChain = new Chain(); orphanChain.initData(block); ChainContainer orphanChainContainer = new ChainContainer(orphanChain); orphanChains.add(orphanChainContainer); } ChainManager(); void newOrphanChain(Block block); boolean checkIsBeforeOrp... |
### Question:
ChainManager { public long getBestBlockHeight() { if(masterChain == null || masterChain.getChain() == null || masterChain.getChain().getEndBlockHeader() == null) { return 0L; } return masterChain.getChain().getEndBlockHeader().getHeight(); } ChainManager(); void newOrphanChain(Block block); boolean checkI... |
### Question:
ChainManager { public boolean checkIsBeforeOrphanChainAndAdd(Block block) { BlockHeader header = block.getHeader(); boolean success = false; for(ChainContainer chainContainer : orphanChains) { Chain chain = chainContainer.getChain(); if(header.getHash().equals(chain.getStartBlockHeader().getPreHash())) { ... |
### Question:
ChainManager { public boolean checkIsAfterOrphanChainAndAdd(Block block) { BlockHeader header = block.getHeader(); for(ChainContainer chainContainer : orphanChains) { Chain chain = chainContainer.getChain(); if(header.getPreHash().equals(chain.getEndBlockHeader().getHash())) { chain.addBlock(block); retur... |
### Question:
RoundManager { public void addRound(MeetingRound meetingRound) { roundList.add(meetingRound); } RoundManager(Chain chain); MeetingRound getRoundByIndex(long roundIndex); void addRound(MeetingRound meetingRound); void checkIsNeedReset(); boolean clearRound(int count); MeetingRound getCurrentRound(); Meetin... |
### Question:
Attribute implements Cloneable, Matchable<Attribute<?>> { public T get() { return value; } Attribute(AttributeDefinition<T> definition); String name(); T get(); T getInitialValue(); void validate(); Attribute<T> protect(); void set(T value); T computeIfAbsent(Supplier<T> supplier); boolean isImmutable(); ... |
### Question:
StandardConversions { public static byte[] convertJavaToOctetStream(Object source, MediaType sourceMediaType, Marshaller marshaller) throws IOException, InterruptedException { if (source == null) return null; if (!sourceMediaType.match(MediaType.APPLICATION_OBJECT)) { throw new EncodingException("sourceMe... |
### Question:
KeyTransformationHandler { public Object stringToKey(String s) { char type = s.charAt(0); switch (type) { case 'S': return s.substring(2); case 'I': return Integer.valueOf(s.substring(2)); case 'Y': return Byte.valueOf(s.substring(2)); case 'L': return Long.valueOf(s.substring(2)); case 'X': return Short.... |
### Question:
KeyTransformationHandler { public String keyToString(Object key) { if (key instanceof byte[]) return "A:" + Base64.getEncoder().encodeToString((byte[]) key); if (key instanceof String) return "S:" + key; else if (key instanceof Integer) return "I:" + key; else if (key instanceof Boolean) return "B:" + key... |
### Question:
HibernateSearchPropertyHelper extends ReflectionPropertyHelper { @Override public Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value) { IndexValueFieldDescriptor fieldDescriptor = getValueFieldDescriptor(entityType, propertyPath); if (fieldDescriptor == null) { return su... |
### Question:
EmptyIntSet extends AbstractImmutableIntSet { @Override public boolean containsAll(IntSet set) { return set.isEmpty(); } static IntSet getInstance(); @Override boolean contains(int i); @Override boolean containsAll(IntSet set); @Override int size(); @Override boolean isEmpty(); @Override boolean contains... |
### Question:
HibernateSearchPropertyHelper extends ReflectionPropertyHelper { @Override public IndexedFieldProvider<Class<?>> getIndexedFieldProvider() { return entityType -> { IndexDescriptor indexDescriptor = getIndexDescriptor(entityType); if (indexDescriptor == null) { return IndexedFieldProvider.NO_INDEXING; } re... |
### Question:
ReflectionHelper { public static PropertyAccessor getAccessor(Class<?> clazz, String propertyName) throws ReflectiveOperationException { if (propertyName == null || propertyName.length() == 0) { throw new IllegalArgumentException("Property name cannot be null or empty"); } if (propertyName.indexOf('.') !=... |
### Question:
Interval { public boolean contains(K value) { return (includeLower ? low.compareTo(value) <= 0 : low.compareTo(value) < 0) && (includeUpper ? up.compareTo(value) >= 0 : up.compareTo(value) > 0); } Interval(K low, boolean includeLower, K up, boolean includeUpper); static K getMinusInf(); static K getPlusIn... |
### Question:
DoubleStat { Double getSum() { if (count == 0) { return null; } double tmp = sum + sumCompensation; if (Double.isNaN(tmp) && Double.isInfinite(simpleSum)) { return simpleSum; } else { return tmp; } } }### Answer:
@Test public void testEmptySum() { DoubleStat sum = new DoubleStat(); assertNull(sum.getSu... |
### Question:
DoubleStat { Double getAvg() { return count == 0 ? null : getSum() / count; } }### Answer:
@Test public void testEmptyAvg() { DoubleStat avg = new DoubleStat(); assertNull(avg.getAvg()); } |
### Question:
EmptyIntSet extends AbstractImmutableIntSet { @Override public IntStream intStream() { return IntStream.empty(); } static IntSet getInstance(); @Override boolean contains(int i); @Override boolean containsAll(IntSet set); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Objec... |
### Question:
EmptyIntSet extends AbstractImmutableIntSet { @Override public boolean equals(Object obj) { if (obj instanceof Set) { return ((Set) obj).size() == 0; } return false; } static IntSet getInstance(); @Override boolean contains(int i); @Override boolean containsAll(IntSet set); @Override int size(); @Overrid... |
### Question:
Configuration { public int maxRetries() { return maxRetries; } Configuration(ExecutorFactoryConfiguration asyncExecutorFactory, Supplier<FailoverRequestBalancingStrategy> balancingStrategyFactory, ClassLoader classLoader,
ClientIntelligence clientIntelligence, ConnectionPoolConfigu... |
### Question:
Configuration { public SecurityConfiguration security() { return security; } Configuration(ExecutorFactoryConfiguration asyncExecutorFactory, Supplier<FailoverRequestBalancingStrategy> balancingStrategyFactory, ClassLoader classLoader,
ClientIntelligence clientIntelligence, Connect... |
### Question:
RocksDBStore implements NonBlockingStore<K, V> { @Override public CompletionStage<Void> write(int segment, MarshallableEntry<? extends K, ? extends V> entry) { return handler.write(segment, entry); } @Override CompletionStage<Void> start(InitializationContext ctx); @Override CompletionStage<Void> stop();... |
### Question:
L1ConfigurationBuilder extends AbstractClusteringConfigurationChildBuilder implements Builder<L1Configuration>, ConfigurationBuilderInfo { public L1ConfigurationBuilder enable() { attributes.attribute(ENABLED).set(true); return this; } L1ConfigurationBuilder(ClusteringConfigurationBuilder builder); @Overr... |
### Question:
DependencyGraph { public List<T> topologicalSort() throws CyclicDependencyException { lock.readLock().lock(); try { ArrayList<T> result = new ArrayList<>(); Deque<T> noIncomingEdges = new ArrayDeque<>(); Map<T, Integer> temp = new HashMap<>(); for (Map.Entry<T, Set<T>> incoming : incomingEdges.entrySet())... |
### Question:
DependencyGraph { public void removeDependency(T from, T to) { lock.writeLock().lock(); try { Set<T> dependencies = outgoingEdges.get(from); if (dependencies == null || !dependencies.contains(to)) { throw new IllegalArgumentException("Inexistent dependency"); } dependencies.remove(to); incomingEdges.get(t... |
### Question:
DependencyGraph { public void addDependency(T from, T to) { if (from == null || to == null || from.equals(to)) { throw new IllegalArgumentException("Invalid parameters"); } lock.writeLock().lock(); try { if (addOutgoingEdge(from, to)) { addIncomingEdge(to, from); } } finally { lock.writeLock().unlock(); }... |
### Question:
GridFile extends File { @Override public boolean createNewFile() throws IOException { if (exists()) return false; if (!checkParentDirs(getAbsolutePath(), false)) throw new IOException("Cannot create file " + getAbsolutePath() + " (parent dir does not exist)"); metadataCache.put(getAbsolutePath(), new Meta... |
### Question:
EmptyIntSet extends AbstractImmutableIntSet { @Override public int size() { return 0; } static IntSet getInstance(); @Override boolean contains(int i); @Override boolean containsAll(IntSet set); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override PrimitiveIt... |
### Question:
GridFile extends File { @Override public String getPath() { return path; } GridFile(String pathname, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(String parent, String child, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(File p... |
### Question:
GridFile extends File { @Override public void deleteOnExit() { throw new UnsupportedOperationException("Not implemented"); } GridFile(String pathname, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(String parent, String child, Cache<String, Metadata> metadataCache, in... |
### Question:
GridFile extends File { @Override public boolean renameTo(File dest) { throw new UnsupportedOperationException("Not implemented"); } GridFile(String pathname, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(String parent, String child, Cache<String, Metadata> metadataC... |
### Question:
GridFile extends File { @Override public String getCanonicalPath() throws IOException { throw new UnsupportedOperationException("Not implemented"); } GridFile(String pathname, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(String parent, String child, Cache<String, Me... |
### Question:
GridFile extends File { @Override public File getCanonicalFile() throws IOException { throw new UnsupportedOperationException("Not implemented"); } GridFile(String pathname, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(String parent, String child, Cache<String, Meta... |
### Question:
GridFile extends File { @Override public URL toURL() throws MalformedURLException { throw new UnsupportedOperationException("Not implemented"); } GridFile(String pathname, Cache<String, Metadata> metadataCache, int chunkSize, GridFilesystem fs); GridFile(String parent, String child, Cache<String, Metada... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.