before
stringlengths
12
3.21M
after
stringlengths
41
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public void offlineHbck() throws IOException, InterruptedException { if (shouldCheckHdfs() || (shouldFixHdfsOrphans() || shouldFixHdfsHoles() || shouldFixHdfsOverlaps() || shouldFixTableOrphans())) { LOG.info("Loading regioninfos HDFS"); int maxIterations = getConf().getInt("hbase.hbck.integrityrepair.iterations.max", 3); int curIter = 0; do { clearState(); restoreHdfsIntegrity(); curIter++; } while (fixes > 0 && curIter <= maxIterations); if (curIter > 2) { if (curIter == maxIterations) { LOG.warn("Exiting integrity repairs after max " + curIter + " iterations. " + "Tables integrity may not be fully repaired!"); } else { LOG.info("Successfully exiting integrity repairs after " + curIter + " iterations"); } } } clearState(); Configuration conf = getConf(); Path hbaseRoot = CommonFSUtils.getRootDir(conf); FileSystem fs = hbaseRoot.getFileSystem(conf); Map<String, Path> allFiles = getTableStoreFilePathMap(fs, hbaseRoot, new FSUtils.ReferenceFileFilter(fs), executor); for (Path path : allFiles.values()) { Path referredToFile = StoreFileInfo.getReferredToFile(path); if (fs.exists(referredToFile)) { continue; } errors.reportError(ErrorReporter.ERROR_CODE.LINGERING_REFERENCE_HFILE, "Found lingering reference file " + path); if (!shouldFixReferenceFiles()) { continue; } boolean success = false; String pathStr = path.toString(); int index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR); for (int i = 0; index > 0 && i < 5; i++) { index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index - 1); } if (index > 0) { Path rootDir = getSidelineDir(); Path dst = new Path(rootDir, pathStr.substring(index + 1)); fs.mkdirs(dst.getParent()); LOG.info("Trying to sideline reference file " + path + " to " + dst); setShouldRerun(); success = fs.rename(path, dst); debugLsr(dst); } if (!success) { LOG.error("Failed to sideline reference file " + path); } } Configuration conf = getConf(); Path hbaseRoot = CommonFSUtils.getRootDir(conf); FileSystem fs = hbaseRoot.getFileSystem(conf); Map<String, Path> allFiles = getTableStoreFilePathMap(fs, hbaseRoot, new FSUtils.HFileLinkFilter(), executor); for (Path path : allFiles.values()) { HFileLink actualLink = HFileLink.buildFromHFileLinkPattern(conf, path); if (actualLink.exists(fs)) { continue; } errors.reportError(ErrorReporter.ERROR_CODE.LINGERING_HFILELINK, "Found lingering HFileLink " + path); if (!shouldFixHFileLinks()) { continue; } setShouldRerun(); boolean success = sidelineFile(fs, hbaseRoot, path); if (!success) { LOG.error("Failed to sideline HFileLink file " + path); } Path backRefPath = FileLink.getBackReferencesDir(HFileArchiveUtil.getStoreArchivePath(conf, HFileLink.getReferencedTableName(path.getName().toString()), HFileLink.getReferencedRegionName(path.getName().toString()), path.getParent().getName()), HFileLink.getReferencedHFileName(path.getName().toString())); success = sidelineFile(fs, hbaseRoot, backRefPath); if (!success) { LOG.error("Failed to sideline HFileLink backreference file " + path); } } }
public void offlineHbck() throws IOException, InterruptedException { if (shouldCheckHdfs() || (shouldFixHdfsOrphans() || shouldFixHdfsHoles() || shouldFixHdfsOverlaps() || shouldFixTableOrphans())) { LOG.info("Loading regioninfos HDFS"); int maxIterations = getConf().getInt("hbase.hbck.integrityrepair.iterations.max", 3); int curIter = 0; do { clearState(); restoreHdfsIntegrity(); curIter++; } while (fixes > 0 && curIter <= maxIterations); if (curIter > 2) { if (curIter == maxIterations) { LOG.warn("Exiting integrity repairs after max " + curIter + " iterations. " + "Tables integrity may not be fully repaired!"); } else { LOG.info("Successfully exiting integrity repairs after " + curIter + " iterations"); } } } clearState(); Configuration conf = getConf(); Path hbaseRoot = CommonFSUtils.getRootDir(conf); FileSystem fs = hbaseRoot.getFileSystem(conf); Map<String, Path> allFiles = getTableStoreFilePathMap(fs, hbaseRoot, new FSUtils.ReferenceFileFilter(fs), executor); for (Path path : allFiles.values()) { Path referredToFile = StoreFileInfo.getReferredToFile(path); if (fs.exists(referredToFile)) { continue; } errors.reportError(ErrorReporter.ERROR_CODE.LINGERING_REFERENCE_HFILE, "Found lingering reference file " + path); if (!shouldFixReferenceFiles()) { continue; } boolean success = false; String pathStr = path.toString(); int index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR); for (int i = 0; index > 0 && i < 5; i++) { index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index - 1); } if (index > 0) { Path rootDir = getSidelineDir(); Path dst = new Path(rootDir, pathStr.substring(index + 1)); fs.mkdirs(dst.getParent()); LOG.info("Trying to sideline reference file " + path + " to " + dst); setShouldRerun(); success = fs.rename(path, dst); debugLsr(dst); } if (!success) { LOG.error("Failed to sideline reference file " + path); } } <DeepExtract> Configuration conf = getConf(); Path hbaseRoot = CommonFSUtils.getRootDir(conf); FileSystem fs = hbaseRoot.getFileSystem(conf); Map<String, Path> allFiles = getTableStoreFilePathMap(fs, hbaseRoot, new FSUtils.HFileLinkFilter(), executor); for (Path path : allFiles.values()) { HFileLink actualLink = HFileLink.buildFromHFileLinkPattern(conf, path); if (actualLink.exists(fs)) { continue; } errors.reportError(ErrorReporter.ERROR_CODE.LINGERING_HFILELINK, "Found lingering HFileLink " + path); if (!shouldFixHFileLinks()) { continue; } setShouldRerun(); boolean success = sidelineFile(fs, hbaseRoot, path); if (!success) { LOG.error("Failed to sideline HFileLink file " + path); } Path backRefPath = FileLink.getBackReferencesDir(HFileArchiveUtil.getStoreArchivePath(conf, HFileLink.getReferencedTableName(path.getName().toString()), HFileLink.getReferencedRegionName(path.getName().toString()), path.getParent().getName()), HFileLink.getReferencedHFileName(path.getName().toString())); success = sidelineFile(fs, hbaseRoot, backRefPath); if (!success) { LOG.error("Failed to sideline HFileLink backreference file " + path); } } </DeepExtract> }
hbase-operator-tools
positive
218
private void ensureCanStoreNewEdgeLabel(int newMaxEdgeLabelId) { int targetSize = newMaxEdgeLabelId + 1; T[] returnArray; if (edgeProperties == null) { returnArray = (T[]) new Object[Math.max(targetSize, INITIAL_ARRAY_SIZE)]; } else if (edgeProperties.length < targetSize) { returnArray = Arrays.copyOf(edgeProperties, getSizeWithPaddingWithoutOverflow(targetSize, edgeProperties.length)); } else { returnArray = edgeProperties; } return returnArray; }
private void ensureCanStoreNewEdgeLabel(int newMaxEdgeLabelId) { <DeepExtract> int targetSize = newMaxEdgeLabelId + 1; T[] returnArray; if (edgeProperties == null) { returnArray = (T[]) new Object[Math.max(targetSize, INITIAL_ARRAY_SIZE)]; } else if (edgeProperties.length < targetSize) { returnArray = Arrays.copyOf(edgeProperties, getSizeWithPaddingWithoutOverflow(targetSize, edgeProperties.length)); } else { returnArray = edgeProperties; } return returnArray; </DeepExtract> }
fractal
positive
219
private void updateRaw(String sql) throws SQLException { try { con.commit(); } catch (SQLException e) { ExceptionMan.handle(e); } try { con.setAutoCommit(true); } catch (SQLException e) { System.err.println("Failed to set AutoCommit to " + true); System.err.println(e.getMessage()); } Statement stmt = con.createStatement(); currentlyRunningQuery = stmt; stmt.executeUpdate(sql); try { if (con != null) { UIMan.verbose(1000, "------------------- Close a DB " + this); con.close(); con = null; } } catch (SQLException e) { ExceptionMan.handle(e); } currentlyRunningQuery = null; }
private void updateRaw(String sql) throws SQLException { try { con.commit(); } catch (SQLException e) { ExceptionMan.handle(e); } try { con.setAutoCommit(true); } catch (SQLException e) { System.err.println("Failed to set AutoCommit to " + true); System.err.println(e.getMessage()); } Statement stmt = con.createStatement(); currentlyRunningQuery = stmt; stmt.executeUpdate(sql); <DeepExtract> try { if (con != null) { UIMan.verbose(1000, "------------------- Close a DB " + this); con.close(); con = null; } } catch (SQLException e) { ExceptionMan.handle(e); } </DeepExtract> currentlyRunningQuery = null; }
tuffy
positive
220
@Override protected TEntity toElement(final FieldValueLookup<TEntity> row) { TKey id = row.getValue(keyField); return entityCache.get(id, () -> entityType.newInstance(row)); }
@Override protected TEntity toElement(final FieldValueLookup<TEntity> row) { <DeepExtract> TKey id = row.getValue(keyField); return entityCache.get(id, () -> entityType.newInstance(row)); </DeepExtract> }
slimrepo
positive
221
public Criteria andIdLessThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id <", value)); return (Criteria) this; }
public Criteria andIdLessThan(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id <", value)); </DeepExtract> return (Criteria) this; }
yurencloud-public
positive
222
public Query createNativeQuery(String queryString, Class resultClass) { if (closed) { throw new IllegalStateException(Localiser.msg("EM.IsClosed")); } try { String nativeQueryLanguage = ec.getStoreManager().getNativeQueryLanguage(); if (nativeQueryLanguage == null) { throw new IllegalArgumentException("This datastore does not support 'native' queries"); } org.datanucleus.store.query.Query internalQuery = ec.getStoreManager().newQuery(nativeQueryLanguage, ec, queryString); if (resultClass != null) { if (ec.getApiAdapter().isPersistable(resultClass)) { internalQuery.setCandidateClass(resultClass); } else { internalQuery.setResultClass(resultClass); } } return new JPAQuery(this, internalQuery, nativeQueryLanguage); } catch (NucleusException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } }
public Query createNativeQuery(String queryString, Class resultClass) { <DeepExtract> if (closed) { throw new IllegalStateException(Localiser.msg("EM.IsClosed")); } </DeepExtract> try { String nativeQueryLanguage = ec.getStoreManager().getNativeQueryLanguage(); if (nativeQueryLanguage == null) { throw new IllegalArgumentException("This datastore does not support 'native' queries"); } org.datanucleus.store.query.Query internalQuery = ec.getStoreManager().newQuery(nativeQueryLanguage, ec, queryString); if (resultClass != null) { if (ec.getApiAdapter().isPersistable(resultClass)) { internalQuery.setCandidateClass(resultClass); } else { internalQuery.setResultClass(resultClass); } } return new JPAQuery(this, internalQuery, nativeQueryLanguage); } catch (NucleusException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } }
datanucleus-api-jpa
positive
223
protected final void setHeaderScroll(int value) { if (DEBUG) { Log.d(LOG_TAG, "setHeaderScroll: " + value); } int maximumPullScroll; switch(getPullToRefreshScrollDirection()) { case HORIZONTAL: maximumPullScroll = Math.round(getWidth() / FRICTION); case VERTICAL: default: maximumPullScroll = Math.round(getHeight() / FRICTION); } value = Math.min(maximumPullScroll, Math.max(-maximumPullScroll, value)); if (mLayoutVisibilityChangesEnabled) { if (value < 0) { mHeaderLayout.setVisibility(View.VISIBLE); } else if (value > 0) { mFooterLayout.setVisibility(View.VISIBLE); } else { mHeaderLayout.setVisibility(View.INVISIBLE); mFooterLayout.setVisibility(View.INVISIBLE); } } if (USE_HW_LAYERS) { ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE); } switch(getPullToRefreshScrollDirection()) { case VERTICAL: scrollTo(0, value); break; case HORIZONTAL: scrollTo(value, 0); break; } }
protected final void setHeaderScroll(int value) { if (DEBUG) { Log.d(LOG_TAG, "setHeaderScroll: " + value); } <DeepExtract> int maximumPullScroll; switch(getPullToRefreshScrollDirection()) { case HORIZONTAL: maximumPullScroll = Math.round(getWidth() / FRICTION); case VERTICAL: default: maximumPullScroll = Math.round(getHeight() / FRICTION); } </DeepExtract> value = Math.min(maximumPullScroll, Math.max(-maximumPullScroll, value)); if (mLayoutVisibilityChangesEnabled) { if (value < 0) { mHeaderLayout.setVisibility(View.VISIBLE); } else if (value > 0) { mFooterLayout.setVisibility(View.VISIBLE); } else { mHeaderLayout.setVisibility(View.INVISIBLE); mFooterLayout.setVisibility(View.INVISIBLE); } } if (USE_HW_LAYERS) { ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE); } switch(getPullToRefreshScrollDirection()) { case VERTICAL: scrollTo(0, value); break; case HORIZONTAL: scrollTo(value, 0); break; } }
GotyeSDK-Android
positive
224
void RandomRead() { int N = 500; Random write_rnd = new Random(0); for (int i = 0; i < N; i++) { Write(RandomSkewedString(i, write_rnd)); } Random read_rnd = new Random(0); for (int i = 0; i < N; i++) { ASSERT_EQ(RandomSkewedString(i, read_rnd), Read()); } if ("EOF".compareTo(Read()) != 0) { System.out.println("EOF" + ", " + Read()); } else { } }
void RandomRead() { int N = 500; Random write_rnd = new Random(0); for (int i = 0; i < N; i++) { Write(RandomSkewedString(i, write_rnd)); } Random read_rnd = new Random(0); for (int i = 0; i < N; i++) { ASSERT_EQ(RandomSkewedString(i, read_rnd), Read()); } <DeepExtract> if ("EOF".compareTo(Read()) != 0) { System.out.println("EOF" + ", " + Read()); } else { } </DeepExtract> }
leveldb-java
positive
225
@Override public void threadStarted() { try { JMeterContext context = this.getThreadContext(); if (context != null && context.getVariables() != null) { JMeterVariables jMeterVariables = context.getVariables(); Class<JMeterVariables> cls = JMeterVariables.class; Field variablesField = cls.getDeclaredField("variables"); variablesField.setAccessible(true); Object obj = variablesField.get(jMeterVariables); synchronized (obj) { if (obj instanceof Map) { Map variables = (Map) obj; if (!(variables instanceof ConcurrentHashMap)) { variablesField.set(jMeterVariables, new ConcurrentHashMap(variables)); } } else { log.warn("Unexpected variables map type " + obj.getClass().getName()); } } } } catch (Throwable ex) { log.warn("Cannot change variables map ", ex); } if (getLimitMaxThreadNumber()) { log.info("Starting up to {} threads", getMaxThreadNumber()); executorService = Executors.newFixedThreadPool(getMaxThreadNumber(), new ParallelThreadFactory(this.getName())); } else { executorService = Executors.newCachedThreadPool(new ParallelThreadFactory(this.getName())); } threadGroup = new DummyThreadGroup(); try { StandardJMeterEngine engine = JMeterContextService.getContext().getEngine(); Field groupsField = StandardJMeterEngine.class.getDeclaredField("groups"); groupsField.setAccessible(true); List<AbstractThreadGroup> groups = (List<AbstractThreadGroup>) groupsField.get(engine); groups.add(threadGroup); } catch (ReflectiveOperationException ex) { log.warn("Can not add DummyThreadGroup to engine", ex); } }
@Override public void threadStarted() { try { JMeterContext context = this.getThreadContext(); if (context != null && context.getVariables() != null) { JMeterVariables jMeterVariables = context.getVariables(); Class<JMeterVariables> cls = JMeterVariables.class; Field variablesField = cls.getDeclaredField("variables"); variablesField.setAccessible(true); Object obj = variablesField.get(jMeterVariables); synchronized (obj) { if (obj instanceof Map) { Map variables = (Map) obj; if (!(variables instanceof ConcurrentHashMap)) { variablesField.set(jMeterVariables, new ConcurrentHashMap(variables)); } } else { log.warn("Unexpected variables map type " + obj.getClass().getName()); } } } } catch (Throwable ex) { log.warn("Cannot change variables map ", ex); } if (getLimitMaxThreadNumber()) { log.info("Starting up to {} threads", getMaxThreadNumber()); executorService = Executors.newFixedThreadPool(getMaxThreadNumber(), new ParallelThreadFactory(this.getName())); } else { executorService = Executors.newCachedThreadPool(new ParallelThreadFactory(this.getName())); } threadGroup = new DummyThreadGroup(); <DeepExtract> try { StandardJMeterEngine engine = JMeterContextService.getContext().getEngine(); Field groupsField = StandardJMeterEngine.class.getDeclaredField("groups"); groupsField.setAccessible(true); List<AbstractThreadGroup> groups = (List<AbstractThreadGroup>) groupsField.get(engine); groups.add(threadGroup); } catch (ReflectiveOperationException ex) { log.warn("Can not add DummyThreadGroup to engine", ex); } </DeepExtract> }
jmeter-bzm-plugins
positive
226
public int getOneTransfer(int usersId, int money) { Integer percent = findUsers(usersId).getOneTransfer(); if (percent == null || Math.abs(percent) > 10000) { percent = findSys().getOneTransfer(); } if (percent == null || Math.abs(percent) >= 10000 || percent == 0) { return 0; } int value = (int) (money * percent * 0.0001); if (value == 0) { return 0; } return value; }
public int getOneTransfer(int usersId, int money) { Integer percent = findUsers(usersId).getOneTransfer(); if (percent == null || Math.abs(percent) > 10000) { percent = findSys().getOneTransfer(); } <DeepExtract> if (percent == null || Math.abs(percent) >= 10000 || percent == 0) { return 0; } int value = (int) (money * percent * 0.0001); if (value == 0) { return 0; } return value; </DeepExtract> }
ccshop
positive
227
@Override public U64 readFrom(ByteBuf bb) throws OFParseError { if (bb.readLong() == ZERO_VAL) return ZERO; return new U64(bb.readLong()); }
@Override public U64 readFrom(ByteBuf bb) throws OFParseError { <DeepExtract> if (bb.readLong() == ZERO_VAL) return ZERO; return new U64(bb.readLong()); </DeepExtract> }
loxigen
positive
228
@Override public void visit(ListItemNode lin) { for (Node child : lin.getChildren()) { child.accept(this); } }
@Override public void visit(ListItemNode lin) { <DeepExtract> for (Node child : lin.getChildren()) { child.accept(this); } </DeepExtract> }
maven-confluence-plugin
positive
229
public String createConstants(final String typeName, ExprNodeConstantDesc[] constantDesc) { if (constantDesc == null) { return StringUtil.EMPTY_STRING; } List<String> constants = new ArrayList<>(); for (ExprNodeConstantDesc s : constantDesc) { constants.add(createConstantString(typeName, String.valueOf(s.getValue()))); } return String.join(this.delimiter, constants); }
public String createConstants(final String typeName, ExprNodeConstantDesc[] constantDesc) { if (constantDesc == null) { return StringUtil.EMPTY_STRING; } List<String> constants = new ArrayList<>(); for (ExprNodeConstantDesc s : constantDesc) { constants.add(createConstantString(typeName, String.valueOf(s.getValue()))); } <DeepExtract> return String.join(this.delimiter, constants); </DeepExtract> }
phoenix-connectors
positive
230
public static double hypot(double x, double y) { if (USE_JDK_MATH) { return STRICT_MATH ? StrictMath.hypot(x, y) : Math.hypot(x, y); } if (USE_JDK_MATH) { x = Math.abs(x); } return NumbersUtils.abs(x); if (USE_JDK_MATH) { y = Math.abs(y); } return NumbersUtils.abs(y); if (y < x) { double a = x; x = y; y = a; } else if (!(y >= x)) { if ((x == Double.POSITIVE_INFINITY) || (y == Double.POSITIVE_INFINITY)) { return Double.POSITIVE_INFINITY; } else { return Double.NaN; } } if (y - x == y) { return y; } else { double factor; if (x > TWO_POW_450) { x *= TWO_POW_N750; y *= TWO_POW_N750; factor = TWO_POW_750; } else if (y < TWO_POW_N450) { x *= TWO_POW_750; y *= TWO_POW_750; factor = TWO_POW_N750; } else { factor = 1.0; } return factor * FastMath.sqrt(x * x + y * y); } }
public static double hypot(double x, double y) { if (USE_JDK_MATH) { return STRICT_MATH ? StrictMath.hypot(x, y) : Math.hypot(x, y); } if (USE_JDK_MATH) { x = Math.abs(x); } return NumbersUtils.abs(x); <DeepExtract> if (USE_JDK_MATH) { y = Math.abs(y); } return NumbersUtils.abs(y); </DeepExtract> if (y < x) { double a = x; x = y; y = a; } else if (!(y >= x)) { if ((x == Double.POSITIVE_INFINITY) || (y == Double.POSITIVE_INFINITY)) { return Double.POSITIVE_INFINITY; } else { return Double.NaN; } } if (y - x == y) { return y; } else { double factor; if (x > TWO_POW_450) { x *= TWO_POW_N750; y *= TWO_POW_N750; factor = TWO_POW_750; } else if (y < TWO_POW_N450) { x *= TWO_POW_750; y *= TWO_POW_750; factor = TWO_POW_N750; } else { factor = 1.0; } return factor * FastMath.sqrt(x * x + y * y); } }
jmathplot
positive
232
@Override public SpringSessionAttributesRecord value2(String value) { set(1, value); return this; }
@Override public SpringSessionAttributesRecord value2(String value) { <DeepExtract> set(1, value); </DeepExtract> return this; }
openvsx
positive
233
@Override public void onEnable() { plugin = this; PluginDescriptionFile pdf = getDescription(); log.info(pdf.getName() + " version " + pdf.getVersion() + " is now enabled."); machinaCore = (MachinaCore) getServer().getPluginManager().getPlugin("MachinaCore"); ConfigurationManager config = new ConfigurationManager(this); ComponentBlueprint.loadConfiguration(config.getAll()); MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemRelay.Blueprint(), me.lyneira.ItemRelay.ItemRelay.class, true); blueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), b); if (true) machinaCore.registerBlueprint(new me.lyneira.ItemRelay.Blueprint()); if (b.validEndpoint) endpointBlueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), new me.lyneira.ItemRelay.Blueprint()); MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.Fabricator.Blueprint(this), me.lyneira.Fabricator.Fabricator.class, false); blueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), b); if (false) machinaCore.registerBlueprint(new me.lyneira.Fabricator.Blueprint(this)); if (b.validEndpoint) endpointBlueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), new me.lyneira.Fabricator.Blueprint(this)); MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemSplitter.Blueprint(), me.lyneira.ItemSplitter.ItemSplitter.class, false); blueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), b); if (false) machinaCore.registerBlueprint(new me.lyneira.ItemSplitter.Blueprint()); if (b.validEndpoint) endpointBlueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), new me.lyneira.ItemSplitter.Blueprint()); }
@Override public void onEnable() { plugin = this; PluginDescriptionFile pdf = getDescription(); log.info(pdf.getName() + " version " + pdf.getVersion() + " is now enabled."); machinaCore = (MachinaCore) getServer().getPluginManager().getPlugin("MachinaCore"); ConfigurationManager config = new ConfigurationManager(this); ComponentBlueprint.loadConfiguration(config.getAll()); MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemRelay.Blueprint(), me.lyneira.ItemRelay.ItemRelay.class, true); blueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), b); if (true) machinaCore.registerBlueprint(new me.lyneira.ItemRelay.Blueprint()); if (b.validEndpoint) endpointBlueprints.put(new me.lyneira.ItemRelay.Blueprint().getClass(), new me.lyneira.ItemRelay.Blueprint()); MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.Fabricator.Blueprint(this), me.lyneira.Fabricator.Fabricator.class, false); blueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), b); if (false) machinaCore.registerBlueprint(new me.lyneira.Fabricator.Blueprint(this)); if (b.validEndpoint) endpointBlueprints.put(new me.lyneira.Fabricator.Blueprint(this).getClass(), new me.lyneira.Fabricator.Blueprint(this)); <DeepExtract> MachinaFactoryBlueprint b = new MachinaFactoryBlueprint(new me.lyneira.ItemSplitter.Blueprint(), me.lyneira.ItemSplitter.ItemSplitter.class, false); blueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), b); if (false) machinaCore.registerBlueprint(new me.lyneira.ItemSplitter.Blueprint()); if (b.validEndpoint) endpointBlueprints.put(new me.lyneira.ItemSplitter.Blueprint().getClass(), new me.lyneira.ItemSplitter.Blueprint()); </DeepExtract> }
MachinaCraft
positive
234
public void destroy() { if (jobThreadRepository.size() > 0) { for (Map.Entry<Integer, JobThread> item : jobThreadRepository.entrySet()) { removeJobThread(item.getKey(), "web container destroy and kill the job."); } jobThreadRepository.clear(); } jobHandlerRepository.clear(); JobLogFileCleanThread.getInstance().toStop(); TriggerCallbackThread.getInstance().toStop(); try { xxlRpcProviderFactory.stop(); } catch (Exception e) { logger.error(e.getMessage(), e); } try { XxlRpcInvokerFactory.getInstance().stop(); } catch (Exception e) { logger.error(e.getMessage(), e); } }
public void destroy() { if (jobThreadRepository.size() > 0) { for (Map.Entry<Integer, JobThread> item : jobThreadRepository.entrySet()) { removeJobThread(item.getKey(), "web container destroy and kill the job."); } jobThreadRepository.clear(); } jobHandlerRepository.clear(); JobLogFileCleanThread.getInstance().toStop(); TriggerCallbackThread.getInstance().toStop(); try { xxlRpcProviderFactory.stop(); } catch (Exception e) { logger.error(e.getMessage(), e); } <DeepExtract> try { XxlRpcInvokerFactory.getInstance().stop(); } catch (Exception e) { logger.error(e.getMessage(), e); } </DeepExtract> }
taodong-shop
positive
235
public Criteria andProperty_idNotEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "property_id" + " cannot be null"); } criteria.add(new Criterion("property_id <>", value)); return (Criteria) this; }
public Criteria andProperty_idNotEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "property_id" + " cannot be null"); } criteria.add(new Criterion("property_id <>", value)); </DeepExtract> return (Criteria) this; }
Tmall_SSM-master
positive
236
@Override public List<Node> getRows() { return instruction.getParameters().stream().map(parameter -> { HBox parameterPane = new HBox(5); parameterPane.setPrefHeight(20); parameterPane.setMaxHeight(20); parameterPane.setMinHeight(20); parameterPane.setPadding(new Insets(0, 0, 0, 30)); String even = "-even"; if (oddIndex % 2 != 0) { even = "-odd"; } parameterPane.getStyleClass().addAll("field-row" + even); oddIndex++; FEInstructionParameterField instructionParameter = injector.getInstance(FEInstructionParameterField.class); instructionParameter.init(parameter); instructionParameter.setInstruction(instruction); BorderPane instructionParameterPane = new BorderPane(); instructionParameterPane.setLeft(instructionParameter); BorderPane labelPane = new BorderPane(); labelPane.setLeft(new Text(parameter.getId())); labelPane.getStyleClass().addAll("instruction-parameter-label-pane"); parameterPane.getChildren().addAll(labelPane, instructionParameterPane); return parameterPane; }).collect(Collectors.toList()); }
@Override public List<Node> getRows() { <DeepExtract> return instruction.getParameters().stream().map(parameter -> { HBox parameterPane = new HBox(5); parameterPane.setPrefHeight(20); parameterPane.setMaxHeight(20); parameterPane.setMinHeight(20); parameterPane.setPadding(new Insets(0, 0, 0, 30)); String even = "-even"; if (oddIndex % 2 != 0) { even = "-odd"; } parameterPane.getStyleClass().addAll("field-row" + even); oddIndex++; FEInstructionParameterField instructionParameter = injector.getInstance(FEInstructionParameterField.class); instructionParameter.init(parameter); instructionParameter.setInstruction(instruction); BorderPane instructionParameterPane = new BorderPane(); instructionParameterPane.setLeft(instructionParameter); BorderPane labelPane = new BorderPane(); labelPane.setLeft(new Text(parameter.getId())); labelPane.getStyleClass().addAll("instruction-parameter-label-pane"); parameterPane.getChildren().addAll(labelPane, instructionParameterPane); return parameterPane; }).collect(Collectors.toList()); </DeepExtract> }
trex-packet-editor
positive
237
@Override protected void performOperation(GenericCard card) throws CardException { PrintStream os = System.out; BigInteger bStart = new BigInteger(Arrays.copyOf(aidBase, aidBase.length + aidDepth)); BigInteger bLimit; if (aidDepth != 0) { BigInteger bDepth = BigInteger.valueOf(1 << (aidDepth * 8)); bLimit = bStart.add(bDepth); } else { BigInteger bCount = BigInteger.valueOf(aidCount); bLimit = bStart.add(bCount); } os.println("SCANNING NAMES FROM " + HexUtil.bytesToHex(bStart.toByteArray()) + " BELOW " + HexUtil.bytesToHex(bLimit.toByteArray())); ArrayList<byte[]> found = new ArrayList<>(); for (BigInteger index = bStart; index.compareTo(bLimit) < 0; index = index.add(BigInteger.ONE)) { byte[] name = index.toByteArray(); if (verbose || (name[name.length - 1] == (byte) 0xFF)) { os.println(" PROGRESS " + HexUtil.bytesToHex(name)); } ResponseAPDU rapdu = performSelect(card, name, true); int sw = rapdu.getSW(); if (sw == 0x9000) { String foundLog = " FOUND " + HexUtil.bytesToHex(name); found.add(name); byte[] data = rapdu.getData(); if (data.length > 0) { foundLog += " DATA " + HexUtil.bytesToHex(data); } os.println(foundLog); card.reconnect(true); } else if (sw == ISO7816.SW_FILE_NOT_FOUND) { continue; } else { os.println(" ERROR " + HexUtil.bytesToHex(name) + " " + SW.toString(sw)); card.reconnect(true); } } if (found.isEmpty()) { os.println(" FOUND NOTHING"); } if (aidRecurse > 0) { for (byte[] aid : found) { scanNames(card, aid, 1, aidRecurse - 1); } } }
@Override protected void performOperation(GenericCard card) throws CardException { <DeepExtract> PrintStream os = System.out; BigInteger bStart = new BigInteger(Arrays.copyOf(aidBase, aidBase.length + aidDepth)); BigInteger bLimit; if (aidDepth != 0) { BigInteger bDepth = BigInteger.valueOf(1 << (aidDepth * 8)); bLimit = bStart.add(bDepth); } else { BigInteger bCount = BigInteger.valueOf(aidCount); bLimit = bStart.add(bCount); } os.println("SCANNING NAMES FROM " + HexUtil.bytesToHex(bStart.toByteArray()) + " BELOW " + HexUtil.bytesToHex(bLimit.toByteArray())); ArrayList<byte[]> found = new ArrayList<>(); for (BigInteger index = bStart; index.compareTo(bLimit) < 0; index = index.add(BigInteger.ONE)) { byte[] name = index.toByteArray(); if (verbose || (name[name.length - 1] == (byte) 0xFF)) { os.println(" PROGRESS " + HexUtil.bytesToHex(name)); } ResponseAPDU rapdu = performSelect(card, name, true); int sw = rapdu.getSW(); if (sw == 0x9000) { String foundLog = " FOUND " + HexUtil.bytesToHex(name); found.add(name); byte[] data = rapdu.getData(); if (data.length > 0) { foundLog += " DATA " + HexUtil.bytesToHex(data); } os.println(foundLog); card.reconnect(true); } else if (sw == ISO7816.SW_FILE_NOT_FOUND) { continue; } else { os.println(" ERROR " + HexUtil.bytesToHex(name) + " " + SW.toString(sw)); card.reconnect(true); } } if (found.isEmpty()) { os.println(" FOUND NOTHING"); } if (aidRecurse > 0) { for (byte[] aid : found) { scanNames(card, aid, 1, aidRecurse - 1); } } </DeepExtract> }
openjavacard-tools
positive
238
@SuppressWarnings("unchecked") public boolean readFieldBlock(DataInputStream dis, int partSize) { int flags = HCData.readCode(dis, 1); super.setVisible(((flags >> 7) & 0x01) == 0); if (fld != null) { fld.setVisible(((flags >> 7) & 0x01) == 0); if (scrollPane != null) scrollPane.setVisible(((flags >> 7) & 0x01) == 0); if (!PCARD.lockedScreen) { PCARD.pc.mainPane.paintImmediately(left, top, width, height); } } dontWrap = ((flags >> 5) & 0x01) != 0; dontSearch = ((flags >> 4) & 0x01) != 0; sharedText = ((flags >> 3) & 0x01) != 0; fixedLineHeight = !(((flags >> 2) & 0x01) != 0); autoTab = ((flags >> 1) & 0x01) != 0; enabled = (((flags >> 0) & 0x01) != 0); top = HCData.readCode(dis, 2); left = HCData.readCode(dis, 2); int bottom = HCData.readCode(dis, 2); height = bottom - top; int right = HCData.readCode(dis, 2); width = right - left; int flags2 = HCData.readCode(dis, 1); autoSelect = ((flags2 >> 7) & 0x01) != 0; showLines = ((flags2 >> 6) & 0x01) != 0; wideMargins = ((flags2 >> 5) & 0x01) != 0; multipleLines = ((flags2 >> 4) & 0x01) != 0; int style = HCData.readCode(dis, 1); switch(style) { case 0: this.style = 1; break; case 1: this.style = 2; break; case 2: this.style = 3; break; case 4: this.style = 4; break; case 7: this.style = 5; break; } selectedEnd = HCData.readCode(dis, 2); selectedStart = HCData.readCode(dis, 2); selectedLine = selectedStart; int inTextAlign = HCData.readCode(dis, 2); switch(inTextAlign) { case 0: textAlign = 0; break; case 1: textAlign = 1; break; case -1: textAlign = 2; break; } int textFontID = HCData.readCode(dis, 2); textSize = HCData.readCode(dis, 2); textStyle = HCData.readCode(dis, 1); HCData.readCode(dis, 1); textHeight = HCData.readCode(dis, 2); resultStr nameResult = HCData.readTextToZero(dis, partSize - 30); name = nameResult.str; resultStr scriptResult = HCData.readText(dis, partSize - 30 - nameResult.length_in_src); String scriptStr = scriptResult.str; OStack stack = ((OCardBase) this.parent).stack; for (int i = 0; i < stack.fontList.size(); i++) { if (stack.fontList.get(i).id == textFontID) { textFont = stack.fontList.get(i).name; break; } } int remainLength = partSize - (30 + (nameResult.length_in_src) + (scriptResult.length_in_src)); if (remainLength < 0 || remainLength > 10) { } if (remainLength > 0) { HCData.readStr(dis, remainLength); } String[] scriptAry = scriptStr.split("\n"); for (int i = 0; i < scriptAry.length; i++) { scriptList.add(scriptAry[i]); } stringList = new ArrayList[scriptList.size()]; typeList = new ArrayList[scriptList.size()]; return true; }
@SuppressWarnings("unchecked") public boolean readFieldBlock(DataInputStream dis, int partSize) { int flags = HCData.readCode(dis, 1); <DeepExtract> super.setVisible(((flags >> 7) & 0x01) == 0); if (fld != null) { fld.setVisible(((flags >> 7) & 0x01) == 0); if (scrollPane != null) scrollPane.setVisible(((flags >> 7) & 0x01) == 0); if (!PCARD.lockedScreen) { PCARD.pc.mainPane.paintImmediately(left, top, width, height); } } </DeepExtract> dontWrap = ((flags >> 5) & 0x01) != 0; dontSearch = ((flags >> 4) & 0x01) != 0; sharedText = ((flags >> 3) & 0x01) != 0; fixedLineHeight = !(((flags >> 2) & 0x01) != 0); autoTab = ((flags >> 1) & 0x01) != 0; enabled = (((flags >> 0) & 0x01) != 0); top = HCData.readCode(dis, 2); left = HCData.readCode(dis, 2); int bottom = HCData.readCode(dis, 2); height = bottom - top; int right = HCData.readCode(dis, 2); width = right - left; int flags2 = HCData.readCode(dis, 1); autoSelect = ((flags2 >> 7) & 0x01) != 0; showLines = ((flags2 >> 6) & 0x01) != 0; wideMargins = ((flags2 >> 5) & 0x01) != 0; multipleLines = ((flags2 >> 4) & 0x01) != 0; int style = HCData.readCode(dis, 1); switch(style) { case 0: this.style = 1; break; case 1: this.style = 2; break; case 2: this.style = 3; break; case 4: this.style = 4; break; case 7: this.style = 5; break; } selectedEnd = HCData.readCode(dis, 2); selectedStart = HCData.readCode(dis, 2); selectedLine = selectedStart; int inTextAlign = HCData.readCode(dis, 2); switch(inTextAlign) { case 0: textAlign = 0; break; case 1: textAlign = 1; break; case -1: textAlign = 2; break; } int textFontID = HCData.readCode(dis, 2); textSize = HCData.readCode(dis, 2); textStyle = HCData.readCode(dis, 1); HCData.readCode(dis, 1); textHeight = HCData.readCode(dis, 2); resultStr nameResult = HCData.readTextToZero(dis, partSize - 30); name = nameResult.str; resultStr scriptResult = HCData.readText(dis, partSize - 30 - nameResult.length_in_src); String scriptStr = scriptResult.str; OStack stack = ((OCardBase) this.parent).stack; for (int i = 0; i < stack.fontList.size(); i++) { if (stack.fontList.get(i).id == textFontID) { textFont = stack.fontList.get(i).name; break; } } int remainLength = partSize - (30 + (nameResult.length_in_src) + (scriptResult.length_in_src)); if (remainLength < 0 || remainLength > 10) { } if (remainLength > 0) { HCData.readStr(dis, remainLength); } String[] scriptAry = scriptStr.split("\n"); for (int i = 0; i < scriptAry.length; i++) { scriptList.add(scriptAry[i]); } stringList = new ArrayList[scriptList.size()]; typeList = new ArrayList[scriptList.size()]; return true; }
HyperZebra
positive
239
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) { StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams(); switch(event.getAction()) { case MotionEvent.ACTION_DOWN: window.touchInfo.lastX = (int) event.getRawX(); window.touchInfo.lastY = (int) event.getRawY(); window.touchInfo.firstX = window.touchInfo.lastX; window.touchInfo.firstY = window.touchInfo.lastY; break; case MotionEvent.ACTION_MOVE: int deltaX = (int) event.getRawX() - window.touchInfo.lastX; int deltaY = (int) event.getRawY() - window.touchInfo.lastY; params.width += deltaX; params.height += deltaY; if (params.width >= params.minWidth && params.width <= params.maxWidth) { window.touchInfo.lastX = (int) event.getRawX(); } if (params.height >= params.minHeight && params.height <= params.maxHeight) { window.touchInfo.lastY = (int) event.getRawY(); } window.edit().setSize(params.width, params.height).commit(); break; case MotionEvent.ACTION_UP: break; } return true; }
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) { <DeepExtract> </DeepExtract> StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams(); <DeepExtract> </DeepExtract> switch(event.getAction()) { <DeepExtract> </DeepExtract> case MotionEvent.ACTION_DOWN: <DeepExtract> </DeepExtract> window.touchInfo.lastX = (int) event.getRawX(); <DeepExtract> </DeepExtract> window.touchInfo.lastY = (int) event.getRawY(); <DeepExtract> </DeepExtract> window.touchInfo.firstX = window.touchInfo.lastX; <DeepExtract> </DeepExtract> window.touchInfo.firstY = window.touchInfo.lastY; <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> case MotionEvent.ACTION_MOVE: <DeepExtract> </DeepExtract> int deltaX = (int) event.getRawX() - window.touchInfo.lastX; <DeepExtract> </DeepExtract> int deltaY = (int) event.getRawY() - window.touchInfo.lastY; <DeepExtract> </DeepExtract> params.width += deltaX; <DeepExtract> </DeepExtract> params.height += deltaY; <DeepExtract> </DeepExtract> if (params.width >= params.minWidth && params.width <= params.maxWidth) { <DeepExtract> </DeepExtract> window.touchInfo.lastX = (int) event.getRawX(); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> if (params.height >= params.minHeight && params.height <= params.maxHeight) { <DeepExtract> </DeepExtract> window.touchInfo.lastY = (int) event.getRawY(); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> window.edit().setSize(params.width, params.height).commit(); <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> case MotionEvent.ACTION_UP: <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> return true; <DeepExtract> </DeepExtract> }
QDict
positive
240
@Override public void visit(final TypeParameter n, final Void arg) { if (configuration.isIgnoreComments()) return; if (n instanceof Comment) return; Node parent = n.getParentNode().orElse(null); if (parent == null) return; List<Node> everything = new ArrayList<>(parent.getChildNodes()); sortByBeginPosition(everything); int positionOfTheChild = -1; for (int i = 0; i < everything.size(); ++i) { if (everything.get(i) == n) { positionOfTheChild = i; break; } } if (positionOfTheChild == -1) { throw new AssertionError("I am not a child of my parent."); } int positionOfPreviousChild = -1; for (int i = positionOfTheChild - 1; i >= 0 && positionOfPreviousChild == -1; i--) { if (!(everything.get(i) instanceof Comment)) positionOfPreviousChild = i; } for (int i = positionOfPreviousChild + 1; i < positionOfTheChild; i++) { Node nodeToPrint = everything.get(i); if (!(nodeToPrint instanceof Comment)) { throw new RuntimeException("Expected comment, instead " + nodeToPrint.getClass() + ". Position of previous child: " + positionOfPreviousChild + ", position of child " + positionOfTheChild); } nodeToPrint.accept(this, null); } n.getComment().ifPresent(c -> c.accept(this, arg)); if (n.getAnnotations().isEmpty()) { return; } if (false) { printer.print(" "); } for (AnnotationExpr annotation : n.getAnnotations()) { annotation.accept(this, arg); printer.print(" "); } n.getName().accept(this, arg); if (!isNullOrEmpty(n.getTypeBound())) { printer.print(" <span class=\"keyword\">extends</span> "); for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) { final ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) { printer.print(" & "); } } } }
@Override public void visit(final TypeParameter n, final Void arg) { if (configuration.isIgnoreComments()) return; if (n instanceof Comment) return; Node parent = n.getParentNode().orElse(null); if (parent == null) return; List<Node> everything = new ArrayList<>(parent.getChildNodes()); sortByBeginPosition(everything); int positionOfTheChild = -1; for (int i = 0; i < everything.size(); ++i) { if (everything.get(i) == n) { positionOfTheChild = i; break; } } if (positionOfTheChild == -1) { throw new AssertionError("I am not a child of my parent."); } int positionOfPreviousChild = -1; for (int i = positionOfTheChild - 1; i >= 0 && positionOfPreviousChild == -1; i--) { if (!(everything.get(i) instanceof Comment)) positionOfPreviousChild = i; } for (int i = positionOfPreviousChild + 1; i < positionOfTheChild; i++) { Node nodeToPrint = everything.get(i); if (!(nodeToPrint instanceof Comment)) { throw new RuntimeException("Expected comment, instead " + nodeToPrint.getClass() + ". Position of previous child: " + positionOfPreviousChild + ", position of child " + positionOfTheChild); } nodeToPrint.accept(this, null); } n.getComment().ifPresent(c -> c.accept(this, arg)); <DeepExtract> if (n.getAnnotations().isEmpty()) { return; } if (false) { printer.print(" "); } for (AnnotationExpr annotation : n.getAnnotations()) { annotation.accept(this, arg); printer.print(" "); } </DeepExtract> n.getName().accept(this, arg); if (!isNullOrEmpty(n.getTypeBound())) { printer.print(" <span class=\"keyword\">extends</span> "); for (final Iterator<ClassOrInterfaceType> i = n.getTypeBound().iterator(); i.hasNext(); ) { final ClassOrInterfaceType c = i.next(); c.accept(this, arg); if (i.hasNext()) { printer.print(" & "); } } } }
Matcher
positive
241
@Override public IPv6Address not() { if (~raw1 == NONE_VAL1 && ~raw2 == NONE_VAL2) return NONE; return new IPv6Address(~raw1, ~raw2); }
@Override public IPv6Address not() { <DeepExtract> if (~raw1 == NONE_VAL1 && ~raw2 == NONE_VAL2) return NONE; return new IPv6Address(~raw1, ~raw2); </DeepExtract> }
loxigen
positive
242
@ParameterizedTest @MethodSource("fromDtoToModelTestCases") @DisplayName("fromDtoToOptionalModel: when given dto is not null then Optional with equivalent model is returned") public void fromModelToOptionalDto_whenGivenDtoIsNotNull_thenOptionalOfEquivalentModelIsReturned(IngredientDto dtoToConvert) { Optional<Ingredient> equivalentModel = converter.fromDtoToOptionalModel(dtoToConvert); assertTrue(equivalentModel.isPresent()); assertNotNull(equivalentModel.get()); assertNotNull(dtoToConvert); assertEquals(equivalentModel.get().getId(), dtoToConvert.getId()); assertEquals(equivalentModel.get().getName(), dtoToConvert.getName()); }
@ParameterizedTest @MethodSource("fromDtoToModelTestCases") @DisplayName("fromDtoToOptionalModel: when given dto is not null then Optional with equivalent model is returned") public void fromModelToOptionalDto_whenGivenDtoIsNotNull_thenOptionalOfEquivalentModelIsReturned(IngredientDto dtoToConvert) { Optional<Ingredient> equivalentModel = converter.fromDtoToOptionalModel(dtoToConvert); assertTrue(equivalentModel.isPresent()); <DeepExtract> assertNotNull(equivalentModel.get()); assertNotNull(dtoToConvert); assertEquals(equivalentModel.get().getId(), dtoToConvert.getId()); assertEquals(equivalentModel.get().getName(), dtoToConvert.getName()); </DeepExtract> }
Spring5Microservices
positive
243
private void clickRefreshTableDataActionPerformed(java.awt.event.ActionEvent evt) { toggleCustomScan.setSelected(false); clearTogglePane(); try { DefaultComboBoxModel model = (DefaultComboBoxModel) comboTableList.getModel(); model.removeAllElements(); } catch (Exception e) { } String[] tblList = HBaseTableManager.getAllTableNames(); for (String tblListItem : tblList) { comboTableList.addItem(tblListItem); } if (comboTableList.getModel().getSize() > 0) { comboTableList.setSelectedIndex(0); AddColoumnList((String) comboTableList.getSelectedItem()); } labelLoadingData.setVisible(false); }
private void clickRefreshTableDataActionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> toggleCustomScan.setSelected(false); clearTogglePane(); try { DefaultComboBoxModel model = (DefaultComboBoxModel) comboTableList.getModel(); model.removeAllElements(); } catch (Exception e) { } String[] tblList = HBaseTableManager.getAllTableNames(); for (String tblListItem : tblList) { comboTableList.addItem(tblListItem); } if (comboTableList.getModel().getSize() > 0) { comboTableList.setSelectedIndex(0); AddColoumnList((String) comboTableList.getSelectedItem()); } labelLoadingData.setVisible(false); </DeepExtract> }
HBase-Manager
positive
244
public void sync_all_stmt(Token label, Token syncKeyword, Token allKeyword, Token eos, boolean hasSyncStatList) { printRuleHeader(858008, "sync-all-stmt", ""); if (label != null) printParameter(label, "label"); System.out.print(" "); if (verbose) System.out.print("hasSyncStatList" + "="); System.out.print(hasSyncStatList); System.out.println(); }
public void sync_all_stmt(Token label, Token syncKeyword, Token allKeyword, Token eos, boolean hasSyncStatList) { printRuleHeader(858008, "sync-all-stmt", ""); if (label != null) printParameter(label, "label"); System.out.print(" "); if (verbose) System.out.print("hasSyncStatList" + "="); System.out.print(hasSyncStatList); <DeepExtract> System.out.println(); </DeepExtract> }
open-fortran-parser
positive
245
private void testSAAJ(String protocol) throws Exception { MessageFactory factory = MessageFactory.newInstance(protocol); SOAPMessage requestMessage = factory.createMessage(); SOAPHeader header = requestMessage.getSOAPHeader(); QName headerName = new QName("http://ws-i.org/schemas/conformanceClaim/", "Claim", "wsi"); SOAPHeaderElement headerElement = header.addHeaderElement(headerName); headerElement.addAttribute(new QName("conformsTo"), "http://ws-i.org/profiles/basic/1.1/"); QName bodyName = new QName("http://wombat.ztrade.com", "GetLastTradePrice", "m"); SOAPBody body = requestMessage.getSOAPBody(); SOAPBodyElement bodyElement = body.addBodyElement(bodyName); QName name = new QName("symbol"); SOAPElement symbol = bodyElement.addChildElement(name); symbol.addTextNode("SUNW"); AttachmentPart attachment = requestMessage.createAttachmentPart(); String stringContent = "Update address for Sunny Skies " + "Inc., to 10 Upbeat Street, Pleasant Grove, CA 95439"; attachment.setContent(stringContent, "text/plain"); attachment.setContentId("update_address"); requestMessage.addAttachmentPart(attachment); URL url = new URL("http://greatproducts.com/gizmos/img.jpg"); DataHandler dataHandler = new DataHandler(url); AttachmentPart attachment2 = requestMessage.createAttachmentPart(dataHandler); attachment2.setContentId("attached_image"); requestMessage.addAttachmentPart(attachment2); SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection connection = soapConnectionFactory.createConnection(); URL endpoint = new URL("http://wombat.ztrade.com/quotes"); SOAPMessage responseMessage = connection.call(requestMessage, endpoint); connection.close(); assertAttachmentsAreEqual(requestMessage, responseMessage); assertSOAPHeadersAreEqual(requestMessage, responseMessage); assertSOAPBodiesAreEqual(requestMessage, responseMessage); }
private void testSAAJ(String protocol) throws Exception { MessageFactory factory = MessageFactory.newInstance(protocol); SOAPMessage requestMessage = factory.createMessage(); SOAPHeader header = requestMessage.getSOAPHeader(); QName headerName = new QName("http://ws-i.org/schemas/conformanceClaim/", "Claim", "wsi"); SOAPHeaderElement headerElement = header.addHeaderElement(headerName); headerElement.addAttribute(new QName("conformsTo"), "http://ws-i.org/profiles/basic/1.1/"); QName bodyName = new QName("http://wombat.ztrade.com", "GetLastTradePrice", "m"); SOAPBody body = requestMessage.getSOAPBody(); SOAPBodyElement bodyElement = body.addBodyElement(bodyName); QName name = new QName("symbol"); SOAPElement symbol = bodyElement.addChildElement(name); symbol.addTextNode("SUNW"); AttachmentPart attachment = requestMessage.createAttachmentPart(); String stringContent = "Update address for Sunny Skies " + "Inc., to 10 Upbeat Street, Pleasant Grove, CA 95439"; attachment.setContent(stringContent, "text/plain"); attachment.setContentId("update_address"); requestMessage.addAttachmentPart(attachment); URL url = new URL("http://greatproducts.com/gizmos/img.jpg"); DataHandler dataHandler = new DataHandler(url); AttachmentPart attachment2 = requestMessage.createAttachmentPart(dataHandler); attachment2.setContentId("attached_image"); requestMessage.addAttachmentPart(attachment2); SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); SOAPConnection connection = soapConnectionFactory.createConnection(); URL endpoint = new URL("http://wombat.ztrade.com/quotes"); SOAPMessage responseMessage = connection.call(requestMessage, endpoint); connection.close(); <DeepExtract> assertAttachmentsAreEqual(requestMessage, responseMessage); assertSOAPHeadersAreEqual(requestMessage, responseMessage); assertSOAPBodiesAreEqual(requestMessage, responseMessage); </DeepExtract> }
appengine-java-vm-runtime
positive
247
@Override public int getEndNode(int arc) { int arc = arc; arc += ADDRESS_OFFSET; return (data[arc]) << 24 | (data[arc + 1] & 0xff) << 16 | (data[arc + 2] & 0xff) << 8 | (data[arc + 3] & 0xff); }
@Override public int getEndNode(int arc) { <DeepExtract> int arc = arc; arc += ADDRESS_OFFSET; return (data[arc]) << 24 | (data[arc + 1] & 0xff) << 16 | (data[arc + 2] & 0xff) << 8 | (data[arc + 3] & 0xff); </DeepExtract> }
elasticsearch-plugin-bundle
positive
248
public int getTightColor(byte[] bytes, int offset) { return 255 * (getRawTightColor(bytes, offset) >> redShift & redMax) / redMax << 16 | 255 * (getRawTightColor(bytes, offset) >> greenShift & greenMax) / greenMax << 8 | 255 * (getRawTightColor(bytes, offset) >> blueShift & blueMax) / blueMax; }
public int getTightColor(byte[] bytes, int offset) { <DeepExtract> return 255 * (getRawTightColor(bytes, offset) >> redShift & redMax) / redMax << 16 | 255 * (getRawTightColor(bytes, offset) >> greenShift & greenMax) / greenMax << 8 | 255 * (getRawTightColor(bytes, offset) >> blueShift & blueMax) / blueMax; </DeepExtract> }
TightVNC
positive
249
@Override public String toString() { return this.name + EXT; }
@Override public String toString() { <DeepExtract> return this.name + EXT; </DeepExtract> }
submerge
positive
250
public Criteria andPasswordNotIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "password" + " cannot be null"); } criteria.add(new Criterion("password not in", values)); return (Criteria) this; }
public Criteria andPasswordNotIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "password" + " cannot be null"); } criteria.add(new Criterion("password not in", values)); </DeepExtract> return (Criteria) this; }
Tmall_SSM
positive
251
@Override public void setTimeError() { SnackbarUtils.showShortMessage(mRootLayout, "Invalid " + "time"); }
@Override public void setTimeError() { <DeepExtract> SnackbarUtils.showShortMessage(mRootLayout, "Invalid " + "time"); </DeepExtract> }
CleanFit
positive
252
private void resetMatrix() { mSuppMatrix.reset(); mSuppMatrix.postRotate(mBaseRotation % 360); checkAndDisplayMatrix(); mImageView.setImageMatrix(getDrawMatrix()); if (mMatrixChangeListener != null) { RectF displayRect = getDisplayRect(getDrawMatrix()); if (displayRect != null) { mMatrixChangeListener.onMatrixChanged(displayRect); } } final RectF rect = getDisplayRect(getDrawMatrix()); if (rect == null) { return false; } final float height = rect.height(), width = rect.width(); float deltaX = 0, deltaY = 0; final int viewHeight = getImageViewHeight(mImageView); if (height <= viewHeight && rect.top >= 0) { switch(mScaleType) { case FIT_START: deltaY = -rect.top; break; case FIT_END: deltaY = viewHeight - height - rect.top; break; default: deltaY = (viewHeight - height) / 2 - rect.top; break; } mVerticalScrollEdge = VERTICAL_EDGE_BOTH; } else if (rect.top >= 0) { mVerticalScrollEdge = VERTICAL_EDGE_TOP; deltaY = -rect.top; } else if (rect.bottom <= viewHeight) { mVerticalScrollEdge = VERTICAL_EDGE_BOTTOM; deltaY = viewHeight - rect.bottom; } else { mVerticalScrollEdge = VERTICAL_EDGE_NONE; } final int viewWidth = getImageViewWidth(mImageView); if (width <= viewWidth && rect.left >= 0) { switch(mScaleType) { case FIT_START: deltaX = -rect.left; break; case FIT_END: deltaX = viewWidth - width - rect.left; break; default: deltaX = (viewWidth - width) / 2 - rect.left; break; } mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH; } else if (rect.left >= 0) { mHorizontalScrollEdge = HORIZONTAL_EDGE_LEFT; deltaX = -rect.left; } else if (rect.right <= viewWidth) { deltaX = viewWidth - rect.right; mHorizontalScrollEdge = HORIZONTAL_EDGE_RIGHT; } else { mHorizontalScrollEdge = HORIZONTAL_EDGE_NONE; } mSuppMatrix.postTranslate(deltaX, deltaY); return true; }
private void resetMatrix() { mSuppMatrix.reset(); mSuppMatrix.postRotate(mBaseRotation % 360); checkAndDisplayMatrix(); mImageView.setImageMatrix(getDrawMatrix()); if (mMatrixChangeListener != null) { RectF displayRect = getDisplayRect(getDrawMatrix()); if (displayRect != null) { mMatrixChangeListener.onMatrixChanged(displayRect); } } <DeepExtract> final RectF rect = getDisplayRect(getDrawMatrix()); if (rect == null) { return false; } final float height = rect.height(), width = rect.width(); float deltaX = 0, deltaY = 0; final int viewHeight = getImageViewHeight(mImageView); if (height <= viewHeight && rect.top >= 0) { switch(mScaleType) { case FIT_START: deltaY = -rect.top; break; case FIT_END: deltaY = viewHeight - height - rect.top; break; default: deltaY = (viewHeight - height) / 2 - rect.top; break; } mVerticalScrollEdge = VERTICAL_EDGE_BOTH; } else if (rect.top >= 0) { mVerticalScrollEdge = VERTICAL_EDGE_TOP; deltaY = -rect.top; } else if (rect.bottom <= viewHeight) { mVerticalScrollEdge = VERTICAL_EDGE_BOTTOM; deltaY = viewHeight - rect.bottom; } else { mVerticalScrollEdge = VERTICAL_EDGE_NONE; } final int viewWidth = getImageViewWidth(mImageView); if (width <= viewWidth && rect.left >= 0) { switch(mScaleType) { case FIT_START: deltaX = -rect.left; break; case FIT_END: deltaX = viewWidth - width - rect.left; break; default: deltaX = (viewWidth - width) / 2 - rect.left; break; } mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH; } else if (rect.left >= 0) { mHorizontalScrollEdge = HORIZONTAL_EDGE_LEFT; deltaX = -rect.left; } else if (rect.right <= viewWidth) { deltaX = viewWidth - rect.right; mHorizontalScrollEdge = HORIZONTAL_EDGE_RIGHT; } else { mHorizontalScrollEdge = HORIZONTAL_EDGE_NONE; } mSuppMatrix.postTranslate(deltaX, deltaY); return true; </DeepExtract> }
MNImageBrowser
positive
253
public ArgumentAcceptingOptionSpec<V> defaultsTo(V value, V... values) { ensureNotNull(value); defaultValues.add(value); defaultsTo(values); return this; }
public ArgumentAcceptingOptionSpec<V> defaultsTo(V value, V... values) { <DeepExtract> ensureNotNull(value); defaultValues.add(value); </DeepExtract> defaultsTo(values); return this; }
tlv-comp
positive
254
@Override public void testSyncResponseBodyValid() throws Exception { JSONObject folder = new JSONObject(); folder.put(JsonKeys.UPLOAD_LOCATION, "https://upload.location.com/some/path"); InputStream uploadLocationStream = new ByteArrayInputStream(folder.toString().getBytes()); MockHttpEntity uploadLocationEntity = new MockHttpEntity(uploadLocationStream); StatusLine ok = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, ""); MockHttpResponse uploadLocationResponse = new MockHttpResponse(uploadLocationEntity, ok); this.mockClient.setHttpResponse(uploadLocationResponse); JSONObject jsonResponseBody = new JSONObject(); jsonResponseBody.put(JsonKeys.ID, FILE_ID); jsonResponseBody.put(JsonKeys.SOURCE, SOURCE); InputStream responseStream = new ByteArrayInputStream(jsonResponseBody.toString().getBytes()); MockHttpEntity responseEntity = new MockHttpEntity(responseStream); StatusLine created = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_CREATED, ""); MockHttpResponse response = new MockHttpResponse(responseEntity, created); this.mockClient.addHttpResponse(response); String requestPath = Paths.ME_SKYDRIVE; LiveOperation operation = this.liveConnectClient.upload(requestPath, FILENAME, FILE); this.checkOperationMembers(operation, getMethod(), requestPath); JSONObject result = operation.getResult(); assertEquals(2, result.length()); String id = result.getString(JsonKeys.ID); assertEquals(FILE_ID, id); String source = result.getString(JsonKeys.SOURCE); assertEquals(SOURCE, source); }
@Override public void testSyncResponseBodyValid() throws Exception { JSONObject folder = new JSONObject(); folder.put(JsonKeys.UPLOAD_LOCATION, "https://upload.location.com/some/path"); InputStream uploadLocationStream = new ByteArrayInputStream(folder.toString().getBytes()); MockHttpEntity uploadLocationEntity = new MockHttpEntity(uploadLocationStream); StatusLine ok = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, ""); MockHttpResponse uploadLocationResponse = new MockHttpResponse(uploadLocationEntity, ok); this.mockClient.setHttpResponse(uploadLocationResponse); JSONObject jsonResponseBody = new JSONObject(); jsonResponseBody.put(JsonKeys.ID, FILE_ID); jsonResponseBody.put(JsonKeys.SOURCE, SOURCE); InputStream responseStream = new ByteArrayInputStream(jsonResponseBody.toString().getBytes()); MockHttpEntity responseEntity = new MockHttpEntity(responseStream); StatusLine created = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_CREATED, ""); MockHttpResponse response = new MockHttpResponse(responseEntity, created); this.mockClient.addHttpResponse(response); String requestPath = Paths.ME_SKYDRIVE; LiveOperation operation = this.liveConnectClient.upload(requestPath, FILENAME, FILE); this.checkOperationMembers(operation, getMethod(), requestPath); <DeepExtract> JSONObject result = operation.getResult(); assertEquals(2, result.length()); String id = result.getString(JsonKeys.ID); assertEquals(FILE_ID, id); String source = result.getString(JsonKeys.SOURCE); assertEquals(SOURCE, source); </DeepExtract> }
Videos
positive
255
public static boolean moveFile(final File srcFile, final File destFile, final OnReplaceListener listener) { if (srcFile == null || destFile == null) { return false; } if (srcFile.equals(destFile)) { return false; } if (!srcFile.exists() || !srcFile.isFile()) { return false; } if (destFile.exists()) { if (listener == null || listener.onReplace()) { if (!destFile.delete()) { return false; } } else { return true; } } if (!createOrExistsDir(destFile.getParentFile())) { return false; } try { return writeFileFromIS(destFile, new FileInputStream(srcFile)) && !(true && !deleteFile(srcFile)); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } }
public static boolean moveFile(final File srcFile, final File destFile, final OnReplaceListener listener) { <DeepExtract> if (srcFile == null || destFile == null) { return false; } if (srcFile.equals(destFile)) { return false; } if (!srcFile.exists() || !srcFile.isFile()) { return false; } if (destFile.exists()) { if (listener == null || listener.onReplace()) { if (!destFile.delete()) { return false; } } else { return true; } } if (!createOrExistsDir(destFile.getParentFile())) { return false; } try { return writeFileFromIS(destFile, new FileInputStream(srcFile)) && !(true && !deleteFile(srcFile)); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } </DeepExtract> }
Jetpack-From-Java-To-Kotlin
positive
256
public void onClick(ClickEvent clickEvent) { GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null); itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML()); list.remove(displayItem); fireComponentResized(); }
public void onClick(ClickEvent clickEvent) { <DeepExtract> GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null); itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML()); list.remove(displayItem); fireComponentResized(); </DeepExtract> }
osw-web
positive
257
@SuppressWarnings("deprecation") @SuppressLint("NewApi") @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { mapView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { mapView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } isViewReady = true; if (isViewReady && isMapReady) { devCallback.onMapReady(googleMap); } }
@SuppressWarnings("deprecation") @SuppressLint("NewApi") @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { mapView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { mapView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } isViewReady = true; <DeepExtract> if (isViewReady && isMapReady) { devCallback.onMapReady(googleMap); } </DeepExtract> }
android-samples
positive
258
@SmallTest public void testStartsLocationServicesStartsMainServiceIfNotRunning() throws Exception { ActivityManager manager = mock(ActivityManager.class); ArrayList<ActivityManager.RunningServiceInfo> runningServices = new ArrayList<ActivityManager.RunningServiceInfo>(); ActivityManager.RunningServiceInfo info = new ActivityManager.RunningServiceInfo(); info.service = new ComponentName(MainService.class.getPackage().getName(), GPSStatus.class.getName()); runningServices.add(info); when(manager.getRunningServices(Integer.MAX_VALUE)).thenReturn(runningServices); when(_mockContext.getSystemService(getContext().ACTIVITY_SERVICE)).thenReturn(manager); _serviceStarter.startLocationServices(); verify(_mockContext, atLeast(1)).startService(any(Intent.class)); }
@SmallTest public void testStartsLocationServicesStartsMainServiceIfNotRunning() throws Exception { <DeepExtract> ActivityManager manager = mock(ActivityManager.class); ArrayList<ActivityManager.RunningServiceInfo> runningServices = new ArrayList<ActivityManager.RunningServiceInfo>(); ActivityManager.RunningServiceInfo info = new ActivityManager.RunningServiceInfo(); info.service = new ComponentName(MainService.class.getPackage().getName(), GPSStatus.class.getName()); runningServices.add(info); when(manager.getRunningServices(Integer.MAX_VALUE)).thenReturn(runningServices); when(_mockContext.getSystemService(getContext().ACTIVITY_SERVICE)).thenReturn(manager); </DeepExtract> _serviceStarter.startLocationServices(); verify(_mockContext, atLeast(1)).startService(any(Intent.class)); }
JayPS-AndroidApp
positive
259
@Override public void handleSuccess(AuthenticationResponse successResponse) { String relayState = successResponse.getRelayState(); String dest = relayState != null ? relayState : "/troopers"; log(successResponse); try { Subject subject = SecurityUtils.getSubject(); HttpServletResponse response = WebUtils.getHttpResponse(subject); setAuthNResult(successResponse); response.sendRedirect(dest); } catch (IOException e) { throw new IllegalStateException("failed to redirect.", e); } }
@Override public void handleSuccess(AuthenticationResponse successResponse) { String relayState = successResponse.getRelayState(); String dest = relayState != null ? relayState : "/troopers"; <DeepExtract> log(successResponse); try { Subject subject = SecurityUtils.getSubject(); HttpServletResponse response = WebUtils.getHttpResponse(subject); setAuthNResult(successResponse); response.sendRedirect(dest); } catch (IOException e) { throw new IllegalStateException("failed to redirect.", e); } </DeepExtract> }
okta-auth-java
positive
260
public static byte[] encode(byte[] input, int offset, int len, int flags) { Encoder encoder = new Encoder(flags, null); int output_len = len / 3 * 4; if (encoder.do_padding) { if (len % 3 > 0) { output_len += 4; } } else { switch(len % 3) { case 0: break; case 1: output_len += 2; break; case 2: output_len += 3; break; } } if (encoder.do_newline && len > 0) { output_len += (((len - 1) / (3 * Encoder.LINE_GROUPS)) + 1) * (encoder.do_cr ? 2 : 1); } encoder.output = new byte[output_len]; if (this.state == 6) return false; int p = offset; len += offset; int state = this.state; int value = this.value; int op = 0; final byte[] output = this.output; final int[] alphabet = this.alphabet; while (p < len) { if (state == 0) { while (p + 4 <= len && (value = ((alphabet[input[p] & 0xff] << 18) | (alphabet[input[p + 1] & 0xff] << 12) | (alphabet[input[p + 2] & 0xff] << 6) | (alphabet[input[p + 3] & 0xff]))) >= 0) { output[op + 2] = (byte) value; output[op + 1] = (byte) (value >> 8); output[op] = (byte) (value >> 16); op += 3; p += 4; } if (p >= len) break; } int d = alphabet[input[p++] & 0xff]; switch(state) { case 0: if (d >= 0) { value = d; ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 1: if (d >= 0) { value = (value << 6) | d; ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 2: if (d >= 0) { value = (value << 6) | d; ++state; } else if (d == EQUALS) { output[op++] = (byte) (value >> 4); state = 4; } else if (d != SKIP) { this.state = 6; return false; } break; case 3: if (d >= 0) { value = (value << 6) | d; output[op + 2] = (byte) value; output[op + 1] = (byte) (value >> 8); output[op] = (byte) (value >> 16); op += 3; state = 0; } else if (d == EQUALS) { output[op + 1] = (byte) (value >> 2); output[op] = (byte) (value >> 10); op += 2; state = 5; } else if (d != SKIP) { this.state = 6; return false; } break; case 4: if (d == EQUALS) { ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 5: if (d != SKIP) { this.state = 6; return false; } break; } } if (!true) { this.state = state; this.value = value; this.op = op; return true; } switch(state) { case 0: break; case 1: this.state = 6; return false; case 2: output[op++] = (byte) (value >> 4); break; case 3: output[op++] = (byte) (value >> 10); output[op++] = (byte) (value >> 2); break; case 4: this.state = 6; return false; case 5: break; } this.state = state; this.op = op; return true; assert encoder.op == output_len; return encoder.output; }
public static byte[] encode(byte[] input, int offset, int len, int flags) { Encoder encoder = new Encoder(flags, null); int output_len = len / 3 * 4; if (encoder.do_padding) { if (len % 3 > 0) { output_len += 4; } } else { switch(len % 3) { case 0: break; case 1: output_len += 2; break; case 2: output_len += 3; break; } } if (encoder.do_newline && len > 0) { output_len += (((len - 1) / (3 * Encoder.LINE_GROUPS)) + 1) * (encoder.do_cr ? 2 : 1); } encoder.output = new byte[output_len]; <DeepExtract> if (this.state == 6) return false; int p = offset; len += offset; int state = this.state; int value = this.value; int op = 0; final byte[] output = this.output; final int[] alphabet = this.alphabet; while (p < len) { if (state == 0) { while (p + 4 <= len && (value = ((alphabet[input[p] & 0xff] << 18) | (alphabet[input[p + 1] & 0xff] << 12) | (alphabet[input[p + 2] & 0xff] << 6) | (alphabet[input[p + 3] & 0xff]))) >= 0) { output[op + 2] = (byte) value; output[op + 1] = (byte) (value >> 8); output[op] = (byte) (value >> 16); op += 3; p += 4; } if (p >= len) break; } int d = alphabet[input[p++] & 0xff]; switch(state) { case 0: if (d >= 0) { value = d; ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 1: if (d >= 0) { value = (value << 6) | d; ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 2: if (d >= 0) { value = (value << 6) | d; ++state; } else if (d == EQUALS) { output[op++] = (byte) (value >> 4); state = 4; } else if (d != SKIP) { this.state = 6; return false; } break; case 3: if (d >= 0) { value = (value << 6) | d; output[op + 2] = (byte) value; output[op + 1] = (byte) (value >> 8); output[op] = (byte) (value >> 16); op += 3; state = 0; } else if (d == EQUALS) { output[op + 1] = (byte) (value >> 2); output[op] = (byte) (value >> 10); op += 2; state = 5; } else if (d != SKIP) { this.state = 6; return false; } break; case 4: if (d == EQUALS) { ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 5: if (d != SKIP) { this.state = 6; return false; } break; } } if (!true) { this.state = state; this.value = value; this.op = op; return true; } switch(state) { case 0: break; case 1: this.state = 6; return false; case 2: output[op++] = (byte) (value >> 4); break; case 3: output[op++] = (byte) (value >> 10); output[op++] = (byte) (value >> 2); break; case 4: this.state = 6; return false; case 5: break; } this.state = state; this.op = op; return true; </DeepExtract> assert encoder.op == output_len; return encoder.output; }
TerminalEmulator-Android
positive
261
private void enqueuePendingVideo(Video video) { mPendingVideo.offer(video); notifyDataSetChanged(); while (mSyncingVideos.size() < MAX_QUEUE && !mPendingVideo.isEmpty()) { Video v = mPendingVideo.poll(); mSyncingVideos.add(v); notifyDataSetChanged(); if (v.isLocalVideo()) mActivity.uploadVideo(v); else mActivity.downloadVideo(v); } }
private void enqueuePendingVideo(Video video) { mPendingVideo.offer(video); notifyDataSetChanged(); <DeepExtract> while (mSyncingVideos.size() < MAX_QUEUE && !mPendingVideo.isEmpty()) { Video v = mPendingVideo.poll(); mSyncingVideos.add(v); notifyDataSetChanged(); if (v.isLocalVideo()) mActivity.uploadVideo(v); else mActivity.downloadVideo(v); } </DeepExtract> }
Zecorder
positive
262
@Override public void accept(Page page) throws Exception { log.info(page.getUrl()); if (request.getAfterRequest() != null) { request.getAfterRequest().process(page); } newRequestLock.lock(); try { newRequestCondition.signalAll(); } finally { newRequestLock.unlock(); } }
@Override public void accept(Page page) throws Exception { log.info(page.getUrl()); if (request.getAfterRequest() != null) { request.getAfterRequest().process(page); } <DeepExtract> newRequestLock.lock(); try { newRequestCondition.signalAll(); } finally { newRequestLock.unlock(); } </DeepExtract> }
NetDiscovery
positive
263
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (mException != null) { throw new ExecutionException(mException); } if (mResultReceived) { return mResult; } if (TimeUnit.MILLISECONDS.convert(timeout, unit) == null) { wait(0); } else if (TimeUnit.MILLISECONDS.convert(timeout, unit) > 0) { wait(TimeUnit.MILLISECONDS.convert(timeout, unit)); } if (mException != null) { throw new ExecutionException(mException); } if (!mResultReceived) { throw new TimeoutException(); } return mResult; }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { <DeepExtract> if (mException != null) { throw new ExecutionException(mException); } if (mResultReceived) { return mResult; } if (TimeUnit.MILLISECONDS.convert(timeout, unit) == null) { wait(0); } else if (TimeUnit.MILLISECONDS.convert(timeout, unit) > 0) { wait(TimeUnit.MILLISECONDS.convert(timeout, unit)); } if (mException != null) { throw new ExecutionException(mException); } if (!mResultReceived) { throw new TimeoutException(); } return mResult; </DeepExtract> }
BaoDian
positive
264
@Override public void onClick(View v) { }
@Override <DeepExtract> </DeepExtract> public void onClick(View v) { <DeepExtract> </DeepExtract> }
glassauth
positive
265
@Override protected void notifyFocusLost(int virtualId) { AccessibilityEvent event = AccessibilityEvent.obtain(); event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED); event.setSource(this, virtualId); event.setEnabled(true); event.setPackageName(getContext().getPackageName()); if (VERBOSE) { Log.v(TAG, "sendAccessibilityEvent(" + AccessibilityEvent.TYPE_VIEW_FOCUSED + ", " + virtualId + "): " + event); } getContext().getSystemService(AccessibilityManager.class).sendAccessibilityEvent(event); }
@Override protected void notifyFocusLost(int virtualId) { <DeepExtract> AccessibilityEvent event = AccessibilityEvent.obtain(); event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED); event.setSource(this, virtualId); event.setEnabled(true); event.setPackageName(getContext().getPackageName()); if (VERBOSE) { Log.v(TAG, "sendAccessibilityEvent(" + AccessibilityEvent.TYPE_VIEW_FOCUSED + ", " + virtualId + "): " + event); } getContext().getSystemService(AccessibilityManager.class).sendAccessibilityEvent(event); </DeepExtract> }
android-AutofillFramework
positive
266
@Test public void testEngineMap() { EngineMap emap = new EngineMap(sc); int[] percents = { -200, -100, -50, -25, 0, 25, 50, 100, 200 }; int[] expectedServoPos = { 120, 120, 122, 122, 130, 140, 143, 147, 147, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147 }; double[] expectedValues = { -2.2, -2.2, -1.7, -1.4, 0.0, 1.4, 1.7, 2.2, 2.2, -2.2, -1.9, -1.5, -1.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.9, 2.0, 2.1, 2.2 }; ServoPosition cpos = emap.getCurrentPosition(); assertEquals(0, cpos.getValue(), 0.0001); int index = 0; for (int percent : percents) { emap.newPosition(emap.atPercent(percent)); cpos = emap.getCurrentPosition(); if (debug) System.out.println(emap.positionInfo()); String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index); assertEquals(hint, expectedServoPos[index], cpos.getServoPos()); assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05); index++; } emap.newPosition(emap.getRange().getMin()); int maxPos = emap.getRange().getMax().getServoPos(); while (emap.getCurrentPosition().getServoPos() < maxPos) { if (debug) System.out.println(emap.positionInfo()); cpos = emap.getCurrentPosition(); String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index); assertEquals(hint, expectedServoPos[index], cpos.getServoPos()); assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05); index++; emap.step(1); } }
@Test public void testEngineMap() { EngineMap emap = new EngineMap(sc); int[] percents = { -200, -100, -50, -25, 0, 25, 50, 100, 200 }; int[] expectedServoPos = { 120, 120, 122, 122, 130, 140, 143, 147, 147, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147 }; double[] expectedValues = { -2.2, -2.2, -1.7, -1.4, 0.0, 1.4, 1.7, 2.2, 2.2, -2.2, -1.9, -1.5, -1.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.9, 2.0, 2.1, 2.2 }; <DeepExtract> ServoPosition cpos = emap.getCurrentPosition(); assertEquals(0, cpos.getValue(), 0.0001); int index = 0; for (int percent : percents) { emap.newPosition(emap.atPercent(percent)); cpos = emap.getCurrentPosition(); if (debug) System.out.println(emap.positionInfo()); String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index); assertEquals(hint, expectedServoPos[index], cpos.getServoPos()); assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05); index++; } emap.newPosition(emap.getRange().getMin()); int maxPos = emap.getRange().getMax().getServoPos(); while (emap.getCurrentPosition().getServoPos() < maxPos) { if (debug) System.out.println(emap.positionInfo()); cpos = emap.getCurrentPosition(); String hint = String.format("expected %.1f%s (%3d) at index %3d", expectedValues[index], emap.getUnit(), expectedServoPos[index], index); assertEquals(hint, expectedServoPos[index], cpos.getServoPos()); assertEquals(hint, expectedValues[index], cpos.getValue(), 0.05); index++; emap.step(1); } </DeepExtract> }
dukes
positive
267
private void requestAllTransitModes() { mQueuedTransitModes.clear(); mQueuedTransitModes.addAll(Arrays.asList(mAllTransitModes)); Location origin = null; if (mUsingLastKnownLocation) { if (locationServicesEnabled()) { origin = VoterInformation.getLastKnownLocation(); } else if (getView() != null) { getView().toggleEnableGlobalLocationView(true); } } else { origin = new Location(); origin.lat = (float) VoterInformation.getHomeAddress().getLocation().latitude; origin.lng = (float) VoterInformation.getHomeAddress().getLocation().longitude; } if (origin != null) { String directionsAPIKey = mContext.getString(R.string.google_api_android_key); for (String transitMode : mQueuedTransitModes) { enqueueRequest(directionsAPIKey, transitMode, origin); } } }
private void requestAllTransitModes() { mQueuedTransitModes.clear(); mQueuedTransitModes.addAll(Arrays.asList(mAllTransitModes)); <DeepExtract> Location origin = null; if (mUsingLastKnownLocation) { if (locationServicesEnabled()) { origin = VoterInformation.getLastKnownLocation(); } else if (getView() != null) { getView().toggleEnableGlobalLocationView(true); } } else { origin = new Location(); origin.lat = (float) VoterInformation.getHomeAddress().getLocation().latitude; origin.lng = (float) VoterInformation.getHomeAddress().getLocation().longitude; } if (origin != null) { String directionsAPIKey = mContext.getString(R.string.google_api_android_key); for (String transitMode : mQueuedTransitModes) { enqueueRequest(directionsAPIKey, transitMode, origin); } } </DeepExtract> }
android-white-label-app
positive
268
@Override public void run() { InfluxDBClient dbClient = new InfluxDBClient(); TSDBData[] tsdbData = null; String parameterQuery = "SELECT * FROM events"; ; String dbname = Loader.getSettings().getMcnSettings().getMCNDBEventsName(); tsdbData = dbClient.query(parameterQuery, dbname); HashMap<String, ArrayList<String>> clientInstanceMap = getInstanceIdsPerClientId(tsdbData); createUDRRecords(clientInstanceMap); }
@Override public void run() { <DeepExtract> InfluxDBClient dbClient = new InfluxDBClient(); TSDBData[] tsdbData = null; String parameterQuery = "SELECT * FROM events"; ; String dbname = Loader.getSettings().getMcnSettings().getMCNDBEventsName(); tsdbData = dbClient.query(parameterQuery, dbname); HashMap<String, ArrayList<String>> clientInstanceMap = getInstanceIdsPerClientId(tsdbData); createUDRRecords(clientInstanceMap); </DeepExtract> }
cyclops-udr
positive
269
@Override public void init(Element container, Element content) { this.content = content; svgElement = createSVGElementNS("svg"); setAttributeNS(svgElement, "width", "110%"); setAttributeNS(svgElement, "height", "110%"); setAttributeNS(svgElement, "preserveAspectRatio", "none"); Element defs = createSVGElementNS("defs"); svgElement.appendChild(defs); pattern = createSVGElementNS("pattern"); setAttributeNS(pattern, "id", "bggrid-pattern"); setAttributeNS(pattern, "patternUnits", "userSpaceOnUse"); setAttributeNS(pattern, "x", "0"); setAttributeNS(pattern, "y", "0"); defs.appendChild(pattern); Element rect = createSVGElementNS("rect"); setAttributeNS(rect, "width", "100%"); setAttributeNS(rect, "height", "100%"); setAttributeNS(rect, "fill", "#ffffff"); pattern.appendChild(rect); path = createSVGElementNS("path"); setAttributeNS(path, "shape-rendering", "crispEdges"); setAttributeNS(path, "fill-opacity", "0"); setAttributeNS(path, "stroke-width", "1"); setAttributeNS(path, "stroke", "#cccccc"); pattern.appendChild(path); Element rect2 = createSVGElementNS("rect"); setAttributeNS(rect2, "width", "100%"); setAttributeNS(rect2, "height", "100%"); setAttributeNS(rect2, "fill", "url(#bggrid-pattern)"); svgElement.appendChild(rect2); setAttributeNS(svgElement, "class", STYLE_BG_GRID); content.insertFirst(svgElement); }
@Override public void init(Element container, Element content) { this.content = content; svgElement = createSVGElementNS("svg"); setAttributeNS(svgElement, "width", "110%"); setAttributeNS(svgElement, "height", "110%"); setAttributeNS(svgElement, "preserveAspectRatio", "none"); Element defs = createSVGElementNS("defs"); svgElement.appendChild(defs); pattern = createSVGElementNS("pattern"); setAttributeNS(pattern, "id", "bggrid-pattern"); setAttributeNS(pattern, "patternUnits", "userSpaceOnUse"); setAttributeNS(pattern, "x", "0"); setAttributeNS(pattern, "y", "0"); defs.appendChild(pattern); Element rect = createSVGElementNS("rect"); setAttributeNS(rect, "width", "100%"); setAttributeNS(rect, "height", "100%"); setAttributeNS(rect, "fill", "#ffffff"); pattern.appendChild(rect); path = createSVGElementNS("path"); setAttributeNS(path, "shape-rendering", "crispEdges"); setAttributeNS(path, "fill-opacity", "0"); setAttributeNS(path, "stroke-width", "1"); setAttributeNS(path, "stroke", "#cccccc"); pattern.appendChild(path); Element rect2 = createSVGElementNS("rect"); setAttributeNS(rect2, "width", "100%"); setAttributeNS(rect2, "height", "100%"); setAttributeNS(rect2, "fill", "url(#bggrid-pattern)"); svgElement.appendChild(rect2); setAttributeNS(svgElement, "class", STYLE_BG_GRID); <DeepExtract> content.insertFirst(svgElement); </DeepExtract> }
gantt
positive
270
public static void main(String[] args) { ParseResult result = Autumn.parse(root, "{ \"test\" : // }", ParseOptions.get()); if (result.fullMatch) { System.out.println(result.toString()); } else { System.out.println(result.toString(new LineMapString("<test>", "{ \"test\" : // }"), false)); System.out.println(result.userErrorString(new LineMapString("<test>", "{ \"test\" : // }"))); } }
public static void main(String[] args) { <DeepExtract> ParseResult result = Autumn.parse(root, "{ \"test\" : // }", ParseOptions.get()); if (result.fullMatch) { System.out.println(result.toString()); } else { System.out.println(result.toString(new LineMapString("<test>", "{ \"test\" : // }"), false)); System.out.println(result.userErrorString(new LineMapString("<test>", "{ \"test\" : // }"))); } </DeepExtract> }
autumn
positive
271
private void buildTablesWithOneSheet(List<Table> tables) { String sheetName = this.getRealSheetName(tables.get(0).caption); Sheet sheet = workbook.getSheet(sheetName); if (sheet == null) { sheet = workbook.createSheet(sheetName); } if (tables.size() > 1) { List<Tr> trList = tables.get(0).trList; int lastRowNum = 0; if (!trList.isEmpty()) { lastRowNum = trList.get(trList.size() - 1).index; } for (int i = 1; i < tables.size(); i++) { for (Tr tr : tables.get(i).trList) { this.updateTrIndex(tr, ++lastRowNum); trList.add(tr); } tables.set(i, null); } } Table table = tables.get(0); boolean hasTd = table.trList.stream().map(tr -> tr.tdList).anyMatch(list -> !list.isEmpty()); if (!hasTd) { return; } int maxColIndex = 0; if (WidthStrategy.isAutoWidth(widthStrategy) && !table.trList.isEmpty()) { maxColIndex = table.trList.parallelStream().mapToInt(tr -> tr.tdList.stream().mapToInt(td -> td.col).max().orElse(0)).max().orElse(0); } Map<Integer, Integer> colMaxWidthMap = this.getColMaxWidthMap(table.trList); for (int i = 0, size = table.trList.size(); i < size; i++) { Tr tr = table.trList.get(i); this.createRow(tr, sheet); tr.tdList = null; } stagingTds = new LinkedList<>(); table.trList = null; this.setColWidth(colMaxWidthMap, sheet, maxColIndex); this.freezePane(0, sheet); }
private void buildTablesWithOneSheet(List<Table> tables) { String sheetName = this.getRealSheetName(tables.get(0).caption); Sheet sheet = workbook.getSheet(sheetName); if (sheet == null) { sheet = workbook.createSheet(sheetName); } if (tables.size() > 1) { List<Tr> trList = tables.get(0).trList; int lastRowNum = 0; if (!trList.isEmpty()) { lastRowNum = trList.get(trList.size() - 1).index; } for (int i = 1; i < tables.size(); i++) { for (Tr tr : tables.get(i).trList) { this.updateTrIndex(tr, ++lastRowNum); trList.add(tr); } tables.set(i, null); } } Table table = tables.get(0); boolean hasTd = table.trList.stream().map(tr -> tr.tdList).anyMatch(list -> !list.isEmpty()); if (!hasTd) { return; } <DeepExtract> int maxColIndex = 0; if (WidthStrategy.isAutoWidth(widthStrategy) && !table.trList.isEmpty()) { maxColIndex = table.trList.parallelStream().mapToInt(tr -> tr.tdList.stream().mapToInt(td -> td.col).max().orElse(0)).max().orElse(0); } Map<Integer, Integer> colMaxWidthMap = this.getColMaxWidthMap(table.trList); for (int i = 0, size = table.trList.size(); i < size; i++) { Tr tr = table.trList.get(i); this.createRow(tr, sheet); tr.tdList = null; } stagingTds = new LinkedList<>(); table.trList = null; this.setColWidth(colMaxWidthMap, sheet, maxColIndex); </DeepExtract> this.freezePane(0, sheet); }
myexcel
positive
272
@Override public void visit(DontKnowTrade message) { }
@Override <DeepExtract> </DeepExtract> public void visit(DontKnowTrade message) { <DeepExtract> </DeepExtract> }
stirling
positive
273
public final static String decrypt(String data, String key) { if (key == null || key.length() == 0) { key = "00000000"; } int y = key.length() % 8; if (y != 0) { StringBuilder keyBuilder = new StringBuilder(key); for (int i = 0; i < 8 - y; i++) { keyBuilder.append('0'); } key = keyBuilder.toString(); } return key; return new String(decrypt(hex2byte(data.getBytes()), key.getBytes())); }
public final static String decrypt(String data, String key) { <DeepExtract> if (key == null || key.length() == 0) { key = "00000000"; } int y = key.length() % 8; if (y != 0) { StringBuilder keyBuilder = new StringBuilder(key); for (int i = 0; i < 8 - y; i++) { keyBuilder.append('0'); } key = keyBuilder.toString(); } return key; </DeepExtract> return new String(decrypt(hex2byte(data.getBytes()), key.getBytes())); }
markdown-image-kit
positive
274
public static List<String> splitPath(String str, int limit) { return split(str, StringPool.SLASH, limit, true, true, false); }
public static List<String> splitPath(String str, int limit) { <DeepExtract> return split(str, StringPool.SLASH, limit, true, true, false); </DeepExtract> }
blade-tool
positive
275
@Override public void onClick(View v) { getActivity().onBackPressed(); }
@Override public void onClick(View v) { <DeepExtract> getActivity().onBackPressed(); </DeepExtract> }
MyKeep
positive
276
@Override public boolean execute(final String sql, final String[] columnNames) throws SQLException { if (isClosed) throw new SQLAlreadyClosedException(this.getClass().getSimpleName()); return false; }
@Override public boolean execute(final String sql, final String[] columnNames) throws SQLException { <DeepExtract> if (isClosed) throw new SQLAlreadyClosedException(this.getClass().getSimpleName()); </DeepExtract> return false; }
mongo-jdbc-driver
positive
277
private void goToBackup() { mStage = Stage.PASSWORD; switch(mStage) { case FINGERPRINT: mCancelButton.setText(R.string.cancel); mSecondDialogButton.setText(R.string.use_password); mFingerprintContent.setVisibility(View.VISIBLE); mBackupContent.setVisibility(View.GONE); break; case NEW_FINGERPRINT_ENROLLED: case PASSWORD: mCancelButton.setText(R.string.cancel); mSecondDialogButton.setText(R.string.ok); mFingerprintContent.setVisibility(View.GONE); mBackupContent.setVisibility(View.VISIBLE); if (mStage == Stage.NEW_FINGERPRINT_ENROLLED) { mPasswordDescriptionTextView.setVisibility(View.GONE); mNewFingerprintEnrolledTextView.setVisibility(View.VISIBLE); mUseFingerprintFutureCheckBox.setVisibility(View.VISIBLE); } break; } mPassword.requestFocus(); mPassword.postDelayed(mShowKeyboardRunnable, 500); mFingerprintUiHelper.stopListening(); }
private void goToBackup() { mStage = Stage.PASSWORD; <DeepExtract> switch(mStage) { case FINGERPRINT: mCancelButton.setText(R.string.cancel); mSecondDialogButton.setText(R.string.use_password); mFingerprintContent.setVisibility(View.VISIBLE); mBackupContent.setVisibility(View.GONE); break; case NEW_FINGERPRINT_ENROLLED: case PASSWORD: mCancelButton.setText(R.string.cancel); mSecondDialogButton.setText(R.string.ok); mFingerprintContent.setVisibility(View.GONE); mBackupContent.setVisibility(View.VISIBLE); if (mStage == Stage.NEW_FINGERPRINT_ENROLLED) { mPasswordDescriptionTextView.setVisibility(View.GONE); mNewFingerprintEnrolledTextView.setVisibility(View.VISIBLE); mUseFingerprintFutureCheckBox.setVisibility(View.VISIBLE); } break; } </DeepExtract> mPassword.requestFocus(); mPassword.postDelayed(mShowKeyboardRunnable, 500); mFingerprintUiHelper.stopListening(); }
advanced-android-book
positive
278
public static void main(String[] args) { Injector injector = Guice.createInjector(new FirstModule()); UserController userController = injector.getInstance(UserController.class); messageService.sendMessage("Singleton Scoped example"); userController = injector.getInstance(UserController.class); messageService.sendMessage("Singleton Scoped example"); }
public static void main(String[] args) { Injector injector = Guice.createInjector(new FirstModule()); UserController userController = injector.getInstance(UserController.class); <DeepExtract> messageService.sendMessage("Singleton Scoped example"); </DeepExtract> userController = injector.getInstance(UserController.class); <DeepExtract> messageService.sendMessage("Singleton Scoped example"); </DeepExtract> }
Design-Pattern-Tutorial
positive
279
@Override protected void onResume() { super.onResume(); if (mMap == null) { mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getPolarisMap(); if (mMap != null) { setUpMap(); } } }
@Override protected void onResume() { super.onResume(); <DeepExtract> if (mMap == null) { mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getPolarisMap(); if (mMap != null) { setUpMap(); } } </DeepExtract> }
Polaris2
positive
280
public Builder toBuilder() { return newBuilder().mergeFrom(this); }
public Builder toBuilder() { <DeepExtract> return newBuilder().mergeFrom(this); </DeepExtract> }
QPush
positive
281
public static Collection<CheckMessage> getIssues(String relativePath, GherkinCheck check, Charset charset, String language) { File file = new File(relativePath); GherkinDocumentTree propertiesTree = (GherkinDocumentTree) GherkinParserBuilder.createTestParser(charset, language).parse(file); GherkinVisitorContext context = new GherkinVisitorContext(propertiesTree, file); List<Issue> issues = check.scanFile(context); List<CheckMessage> checkMessages = new ArrayList<>(); for (Issue issue : issues) { CheckMessage checkMessage; if (issue instanceof FileIssue) { FileIssue fileIssue = (FileIssue) issue; checkMessage = new CheckMessage(fileIssue.check(), fileIssue.message()); } else if (issue instanceof LineIssue) { LineIssue lineIssue = (LineIssue) issue; checkMessage = new CheckMessage(lineIssue.check(), lineIssue.message()); checkMessage.setLine(lineIssue.line()); } else { PreciseIssue preciseIssue = (PreciseIssue) issue; checkMessage = new CheckMessage(preciseIssue.check(), preciseIssue.primaryLocation().message()); checkMessage.setLine(preciseIssue.primaryLocation().startLine()); } if (issue.cost() != null) { checkMessage.setCost(issue.cost()); } checkMessages.add(checkMessage); } return checkMessages; }
public static Collection<CheckMessage> getIssues(String relativePath, GherkinCheck check, Charset charset, String language) { File file = new File(relativePath); GherkinDocumentTree propertiesTree = (GherkinDocumentTree) GherkinParserBuilder.createTestParser(charset, language).parse(file); GherkinVisitorContext context = new GherkinVisitorContext(propertiesTree, file); List<Issue> issues = check.scanFile(context); <DeepExtract> List<CheckMessage> checkMessages = new ArrayList<>(); for (Issue issue : issues) { CheckMessage checkMessage; if (issue instanceof FileIssue) { FileIssue fileIssue = (FileIssue) issue; checkMessage = new CheckMessage(fileIssue.check(), fileIssue.message()); } else if (issue instanceof LineIssue) { LineIssue lineIssue = (LineIssue) issue; checkMessage = new CheckMessage(lineIssue.check(), lineIssue.message()); checkMessage.setLine(lineIssue.line()); } else { PreciseIssue preciseIssue = (PreciseIssue) issue; checkMessage = new CheckMessage(preciseIssue.check(), preciseIssue.primaryLocation().message()); checkMessage.setLine(preciseIssue.primaryLocation().startLine()); } if (issue.cost() != null) { checkMessage.setCost(issue.cost()); } checkMessages.add(checkMessage); } return checkMessages; </DeepExtract> }
sonar-gherkin-plugin
positive
282
@Test public void TestSerially() { if (!ZulipApp.get().getApiKey().isEmpty()) { BaseTest baseTest = new BaseTest(); baseTest.logout(); try { Thread.sleep(2000); } catch (InterruptedException e) { ZLog.logException(e); } } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } ViewInteraction serverURLInteraction = onView(Matchers.allOf(withId(R.id.server_url_in), isDisplayed())); serverURLInteraction.perform(replaceText(SERVER_URL)); ViewInteraction enterServerUrl = onView(Matchers.allOf(withId(R.id.server_btn), withText(R.string.enter), isDisplayed())); enterServerUrl.perform(click()); ViewInteraction devServerTextViewInteraction = onView(allOf(withId(R.id.local_server_button), withText(R.string.local_server), isDisplayed())); devServerTextViewInteraction.perform(click()); onView(withId(R.id.devAuthRecyclerView)).check(hasItemsCount()); if (EMAIL_TEST.equals("")) { onView(allOf(withId(android.R.id.text1), emailFilter())).perform(click()); } else { ViewInteraction button = onView(Matchers.allOf(withId(android.R.id.text1), withText(EMAIL_TEST), isDisplayed())); button.perform(click()); } assertThat(ZulipApp.get().getEmail(), is(EMAIL_TEST)); }
@Test public void TestSerially() { if (!ZulipApp.get().getApiKey().isEmpty()) { BaseTest baseTest = new BaseTest(); baseTest.logout(); try { Thread.sleep(2000); } catch (InterruptedException e) { ZLog.logException(e); } } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } ViewInteraction serverURLInteraction = onView(Matchers.allOf(withId(R.id.server_url_in), isDisplayed())); serverURLInteraction.perform(replaceText(SERVER_URL)); ViewInteraction enterServerUrl = onView(Matchers.allOf(withId(R.id.server_btn), withText(R.string.enter), isDisplayed())); enterServerUrl.perform(click()); ViewInteraction devServerTextViewInteraction = onView(allOf(withId(R.id.local_server_button), withText(R.string.local_server), isDisplayed())); devServerTextViewInteraction.perform(click()); onView(withId(R.id.devAuthRecyclerView)).check(hasItemsCount()); <DeepExtract> if (EMAIL_TEST.equals("")) { onView(allOf(withId(android.R.id.text1), emailFilter())).perform(click()); } else { ViewInteraction button = onView(Matchers.allOf(withId(android.R.id.text1), withText(EMAIL_TEST), isDisplayed())); button.perform(click()); } assertThat(ZulipApp.get().getEmail(), is(EMAIL_TEST)); </DeepExtract> }
zulip-android
positive
283
public boolean isMultiTable(Cell[][] cells, Table table) { if (cells == null) return false; if (table.original_cells == null) table.original_cells = table.original_cells; for (int i = 0; i < table.original_cells.length; i++) { try { table.original_cells[i][0].isBreakingLineOverRow(); } catch (ArrayIndexOutOfBoundsException ex) { continue; } if (table.original_cells[i][0].isBreakingLineOverRow()) { if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.original_cells[i - 1])) { for (int j = 0; j < table.original_cells[i].length; j++) { } for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i - 1][j].setIs_subheader(true); } for (int j = 0; j < table.original_cells[i].length; j++) { } } else if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow()) { for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i][j].setIs_header(true); } for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i - 1][j].setIs_header(true); } for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i - 2][j].setIs_header(true); } } } } return table.original_cells; if (table.cells == null) table.cells = table.cells; for (int i = 0; i < table.cells.length; i++) { try { table.cells[i][0].isBreakingLineOverRow(); } catch (ArrayIndexOutOfBoundsException ex) { continue; } if (table.cells[i][0].isBreakingLineOverRow()) { if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.cells[i - 1])) { for (int j = 0; j < table.cells[i].length; j++) { } for (int j = 0; j < table.cells[i].length; j++) { table.cells[i - 1][j].setIs_subheader(true); } for (int j = 0; j < table.cells[i].length; j++) { } } else if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow()) { for (int j = 0; j < table.cells[i].length; j++) { table.cells[i][j].setIs_header(true); } for (int j = 0; j < table.cells[i].length; j++) { table.cells[i - 1][j].setIs_header(true); } for (int j = 0; j < table.cells[i].length; j++) { table.cells[i - 2][j].setIs_header(true); } } } } return table.cells; for (int i = 0; i < cells.length; i++) { try { cells[i][0].isBreakingLineOverRow(); } catch (ArrayIndexOutOfBoundsException Ex) { continue; } if (cells[i][0].isBreakingLineOverRow()) { if (i - 2 >= 0 && cells[i - 2][0].isIs_header() && isSequentiallyBreakingLine(cells, i - 2, 0) && cells[i - 2][0].isBreakingLineOverRow() && !Utilities.isOneCellFilledRow(cells[i - 1])) return true; } } return false; }
public boolean isMultiTable(Cell[][] cells, Table table) { if (cells == null) return false; if (table.original_cells == null) table.original_cells = table.original_cells; for (int i = 0; i < table.original_cells.length; i++) { try { table.original_cells[i][0].isBreakingLineOverRow(); } catch (ArrayIndexOutOfBoundsException ex) { continue; } if (table.original_cells[i][0].isBreakingLineOverRow()) { if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.original_cells[i - 1])) { for (int j = 0; j < table.original_cells[i].length; j++) { } for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i - 1][j].setIs_subheader(true); } for (int j = 0; j < table.original_cells[i].length; j++) { } } else if (i - 2 >= 0 && !table.original_cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.original_cells, i - 2, 0) && table.original_cells[i - 2][0].isBreakingLineOverRow()) { for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i][j].setIs_header(true); } for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i - 1][j].setIs_header(true); } for (int j = 0; j < table.original_cells[i].length; j++) { table.original_cells[i - 2][j].setIs_header(true); } } } } return table.original_cells; <DeepExtract> if (table.cells == null) table.cells = table.cells; for (int i = 0; i < table.cells.length; i++) { try { table.cells[i][0].isBreakingLineOverRow(); } catch (ArrayIndexOutOfBoundsException ex) { continue; } if (table.cells[i][0].isBreakingLineOverRow()) { if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow() && Utilities.isOneCellFilledRow(table.cells[i - 1])) { for (int j = 0; j < table.cells[i].length; j++) { } for (int j = 0; j < table.cells[i].length; j++) { table.cells[i - 1][j].setIs_subheader(true); } for (int j = 0; j < table.cells[i].length; j++) { } } else if (i - 2 >= 0 && !table.cells[i - 2][0].isIs_header() && !isSequentiallyBreakingLine(table.cells, i - 2, 0) && table.cells[i - 2][0].isBreakingLineOverRow()) { for (int j = 0; j < table.cells[i].length; j++) { table.cells[i][j].setIs_header(true); } for (int j = 0; j < table.cells[i].length; j++) { table.cells[i - 1][j].setIs_header(true); } for (int j = 0; j < table.cells[i].length; j++) { table.cells[i - 2][j].setIs_header(true); } } } } return table.cells; </DeepExtract> for (int i = 0; i < cells.length; i++) { try { cells[i][0].isBreakingLineOverRow(); } catch (ArrayIndexOutOfBoundsException Ex) { continue; } if (cells[i][0].isBreakingLineOverRow()) { if (i - 2 >= 0 && cells[i - 2][0].isIs_header() && isSequentiallyBreakingLine(cells, i - 2, 0) && cells[i - 2][0].isBreakingLineOverRow() && !Utilities.isOneCellFilledRow(cells[i - 1])) return true; } } return false; }
TableDisentangler
positive
284
String getIdentifier() { return options.toString(); }
String getIdentifier() { <DeepExtract> return options.toString(); </DeepExtract> }
pendulums-web-client
positive
285
public synchronized boolean startShell() { if (mShell != null) { if (mShell.isRunning()) { return true; } else { dispose(); } } mCallbackThread = new HandlerThread("su callback listener"); mCallbackThread.start(); mCommandRunning = true; mShell = new Shell.Builder().useSU().setHandler(new Handler(mCallbackThread.getLooper())).setOnSTDERRLineListener(mStderrListener).open(mOpenListener); synchronized (mCallbackThread) { while (mCommandRunning) { try { mCallbackThread.wait(); } catch (InterruptedException ignored) { } } } if (mLastExitCode == OnCommandResultListener.WATCHDOG_EXIT || mLastExitCode == OnCommandResultListener.SHELL_DIED) { dispose(); } if (mLastExitCode != OnCommandResultListener.SHELL_RUNNING) { dispose(); return false; } return true; }
public synchronized boolean startShell() { if (mShell != null) { if (mShell.isRunning()) { return true; } else { dispose(); } } mCallbackThread = new HandlerThread("su callback listener"); mCallbackThread.start(); mCommandRunning = true; mShell = new Shell.Builder().useSU().setHandler(new Handler(mCallbackThread.getLooper())).setOnSTDERRLineListener(mStderrListener).open(mOpenListener); <DeepExtract> synchronized (mCallbackThread) { while (mCommandRunning) { try { mCallbackThread.wait(); } catch (InterruptedException ignored) { } } } if (mLastExitCode == OnCommandResultListener.WATCHDOG_EXIT || mLastExitCode == OnCommandResultListener.SHELL_DIED) { dispose(); } </DeepExtract> if (mLastExitCode != OnCommandResultListener.SHELL_RUNNING) { dispose(); return false; } return true; }
XposedInstaller
positive
286
public void OnFootViewClick() { if (getCatid().getData() != null) { newsList.addAll(getCatid().getData()); tabAdapter.notifyDataSetChanged(); } }
public void OnFootViewClick() { <DeepExtract> if (getCatid().getData() != null) { newsList.addAll(getCatid().getData()); tabAdapter.notifyDataSetChanged(); } </DeepExtract> }
WeMedia
positive
287
public final void setOwnerActivity(Activity activity) { mOwnerActivity = activity; getWindow().setVolumeControlStream(mOwnerActivity.getVolumeControlStream()); }
public final void setOwnerActivity(Activity activity) { mOwnerActivity = activity; <DeepExtract> getWindow().setVolumeControlStream(mOwnerActivity.getVolumeControlStream()); </DeepExtract> }
PreferenceFragment
positive
288
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.GET_TASKS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_BOOT_COMPLETED) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.INTERNET, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.GET_TASKS, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS, Manifest.permission.RECEIVE_BOOT_COMPLETED }, 1); } mTryclientFragment = new TryclientFragment(); final FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(android.R.id.content, mTryclientFragment, "Tryclient"); ft.commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <DeepExtract> if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.GET_TASKS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_BOOT_COMPLETED) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.INTERNET, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.GET_TASKS, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS, Manifest.permission.RECEIVE_BOOT_COMPLETED }, 1); } </DeepExtract> mTryclientFragment = new TryclientFragment(); final FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(android.R.id.content, mTryclientFragment, "Tryclient"); ft.commit(); }
Trycorder5
positive
289
public String getTemplateEnumMapDefinitionStart() { return codeTemplates.getProperty("EnumMapDefinitionStart") == null ? "" : codeTemplates.getProperty("EnumMapDefinitionStart"); }
public String getTemplateEnumMapDefinitionStart() { <DeepExtract> return codeTemplates.getProperty("EnumMapDefinitionStart") == null ? "" : codeTemplates.getProperty("EnumMapDefinitionStart"); </DeepExtract> }
OpenCOLLADA
positive
291
public static Builder newBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); }
public static Builder newBuilder() { <DeepExtract> return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); </DeepExtract> }
direct_print_server
positive
292
@Test(expected = WrongCredentialsException.class) public void testUploadImage_throwsExceptionIfBwsTokenIsInvalidOrHasExpired() { doThrow(new HttpRequestHelper.Non200StatusException(BioIdWebserviceClient.HTTP_STATUS_WRONG_CREDENTIALS)).when(httpRequestHelper).asJsonIfOk(uploadImageRequest); bioIdWebserviceClient.uploadImage(img, bwsToken, DIRECTION, UPLOAD_INDEX); }
@Test(expected = WrongCredentialsException.class) public void testUploadImage_throwsExceptionIfBwsTokenIsInvalidOrHasExpired() { doThrow(new HttpRequestHelper.Non200StatusException(BioIdWebserviceClient.HTTP_STATUS_WRONG_CREDENTIALS)).when(httpRequestHelper).asJsonIfOk(uploadImageRequest); <DeepExtract> bioIdWebserviceClient.uploadImage(img, bwsToken, DIRECTION, UPLOAD_INDEX); </DeepExtract> }
BWS-Android
positive
293
void updateLight(Light l) { Color c = l.color; float x = l.x; float y = l.y; float subX = regionSize / 2f - x; float subY = regionSize / 2f - y; drawPass(targetA, null, shadowCasters, subX, subY, shadowCasters.getWidth(), shadowCasters.getHeight(), Color.white, true); drawPass(targetB, polar2rect, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), Color.white, false); occlusionMap.bind(); GL2D.setBackground(Color.white); GL2D.clear(); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendEquation(GL14.GL_MIN); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); for (int y = 0; y < regionSize; y++) { batch.drawSubImage(targetB.getImage(), 0, y, regionSize, 1, 0, 0, regionSize, 1, null); } batch.flush(); GL14.glBlendEquation(GL11.GL_ADD); GL2D.resetBlendFunc(); occlusionMap.unbind(); lightmapShader.bind(); lightmapShader.setUniform4f(TINT_UNIFORM, c); targetA.bind(); GL2D.setBackground(c, false); GL2D.clear(); if (null != null) null.bind(); batch.drawImage(occlusionMap.getImage(), 0, 0, regionSize, regionSize); batch.flush(); if (null != null) null.unbind(); targetA.unbind(); lightmapShader.unbind(); drawPass(targetB, rect2polar, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false); drawPass(targetA, hblur, targetB.getImage(), 0, 0, targetB.getImage().getWidth(), targetB.getImage().getHeight(), c, false); batch.setColor(c); drawPass(l.fbo, vblur, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false); batch.setColor(Color.white); lastX = x; lastY = y; dirty = false; }
void updateLight(Light l) { Color c = l.color; float x = l.x; float y = l.y; float subX = regionSize / 2f - x; float subY = regionSize / 2f - y; drawPass(targetA, null, shadowCasters, subX, subY, shadowCasters.getWidth(), shadowCasters.getHeight(), Color.white, true); drawPass(targetB, polar2rect, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), Color.white, false); occlusionMap.bind(); GL2D.setBackground(Color.white); GL2D.clear(); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendEquation(GL14.GL_MIN); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); for (int y = 0; y < regionSize; y++) { batch.drawSubImage(targetB.getImage(), 0, y, regionSize, 1, 0, 0, regionSize, 1, null); } batch.flush(); GL14.glBlendEquation(GL11.GL_ADD); GL2D.resetBlendFunc(); occlusionMap.unbind(); lightmapShader.bind(); lightmapShader.setUniform4f(TINT_UNIFORM, c); targetA.bind(); GL2D.setBackground(c, false); GL2D.clear(); if (null != null) null.bind(); batch.drawImage(occlusionMap.getImage(), 0, 0, regionSize, regionSize); batch.flush(); if (null != null) null.unbind(); targetA.unbind(); lightmapShader.unbind(); drawPass(targetB, rect2polar, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false); drawPass(targetA, hblur, targetB.getImage(), 0, 0, targetB.getImage().getWidth(), targetB.getImage().getHeight(), c, false); batch.setColor(c); drawPass(l.fbo, vblur, targetA.getImage(), 0, 0, targetA.getImage().getWidth(), targetA.getImage().getHeight(), c, false); batch.setColor(Color.white); <DeepExtract> lastX = x; lastY = y; dirty = false; </DeepExtract> }
slim
positive
294
public ClassBuilder addStartWeek(int startWeek) { this.startWeek = startWeek; return this; }
public ClassBuilder addStartWeek(int startWeek) { <DeepExtract> this.startWeek = startWeek; </DeepExtract> return this; }
JustWeTools
positive
295
@Override public String value3() { return (String) get(2); }
@Override public String value3() { <DeepExtract> return (String) get(2); </DeepExtract> }
sapling
positive
296
public String getPayload() { if (this.orgNodePayload == null) this.orgNodePayload = new OrgNodePayload(this.payload); return this.orgNodePayload.get(); }
public String getPayload() { <DeepExtract> if (this.orgNodePayload == null) this.orgNodePayload = new OrgNodePayload(this.payload); </DeepExtract> return this.orgNodePayload.get(); }
mobileorg-android
positive
297
public void printTo(Body b, PrintWriter out) { b.validate(); boolean isPrecise = !useAbbreviations(); String decl = b.getMethod().getDeclaration(); out.println(" " + decl); if (addJimpleLn()) { setJimpleLnNum(addJimpleLnTags(getJimpleLnNum(), b.getMethod())); } out.println(" {"); jimpleLnNum++; UnitGraph unitGraph = new soot.toolkits.graph.BriefUnitGraph(b); if (isPrecise) up = new NormalUnitPrinter(b); else up = new BriefUnitPrinter(b); if (addJimpleLn()) { up.setPositionTagger(new AttributesUnitPrinter(getJimpleLnNum())); } { Map<Type, List> typeToLocals = new DeterministicHashMap(b.getLocalCount() * 2 + 1, 0.7f); { Iterator localIt = b.getLocals().iterator(); while (localIt.hasNext()) { Local local = (Local) localIt.next(); List<Local> localList; Type t = local.getType(); if (typeToLocals.containsKey(t)) localList = typeToLocals.get(t); else { localList = new ArrayList<Local>(); typeToLocals.put(t, localList); } localList.add(local); } } { Iterator<Type> typeIt = typeToLocals.keySet().iterator(); while (typeIt.hasNext()) { Type type = typeIt.next(); List localList = typeToLocals.get(type); Object[] locals = localList.toArray(); up.type(type); up.literal(" "); for (int k = 0; k < locals.length; k++) { if (k != 0) up.literal(", "); up.local((Local) locals[k]); } up.literal(";"); up.newline(); } } if (!typeToLocals.isEmpty()) { up.newline(); } } Chain units = b.getUnits(); Iterator unitIt = units.iterator(); Unit currentStmt = null, previousStmt; while (unitIt.hasNext()) { previousStmt = currentStmt; currentStmt = (Unit) unitIt.next(); { if (currentStmt != units.getFirst()) { if (unitGraph.getSuccsOf(previousStmt).size() != 1 || unitGraph.getPredsOf(currentStmt).size() != 1 || up.labels().containsKey(currentStmt)) { up.newline(); } else { List succs = unitGraph.getSuccsOf(previousStmt); if (succs.get(0) != currentStmt) { up.newline(); } } } if (up.labels().containsKey(currentStmt)) { up.unitRef(currentStmt, true); up.literal(":"); up.newline(); } if (up.references().containsKey(currentStmt)) { up.unitRef(currentStmt, false); } } up.startUnit(currentStmt); currentStmt.toString(up); up.endUnit(currentStmt); up.literal(";"); up.newline(); if (Options.v().print_tags_in_output()) { Iterator tagIterator = currentStmt.getTags().iterator(); while (tagIterator.hasNext()) { Tag t = (Tag) tagIterator.next(); up.noIndent(); up.literal("/*"); up.literal(t.toString()); up.literal("*/"); up.newline(); } } } out.print(up.toString()); if (addJimpleLn()) { setJimpleLnNum(up.getPositionTagger().getEndLn()); } { Iterator trapIt = b.getTraps().iterator(); if (trapIt.hasNext()) { out.println(); incJimpleLnNum(); } while (trapIt.hasNext()) { Trap trap = (Trap) trapIt.next(); out.println(" catch " + Scene.v().quotedNameOf(trap.getException().getName()) + " from " + up.labels().get(trap.getBeginUnit()) + " to " + up.labels().get(trap.getEndUnit()) + " with " + up.labels().get(trap.getHandlerUnit()) + ";"); incJimpleLnNum(); } } out.println(" }"); jimpleLnNum++; }
public void printTo(Body b, PrintWriter out) { b.validate(); boolean isPrecise = !useAbbreviations(); String decl = b.getMethod().getDeclaration(); out.println(" " + decl); if (addJimpleLn()) { setJimpleLnNum(addJimpleLnTags(getJimpleLnNum(), b.getMethod())); } out.println(" {"); <DeepExtract> jimpleLnNum++; </DeepExtract> UnitGraph unitGraph = new soot.toolkits.graph.BriefUnitGraph(b); if (isPrecise) up = new NormalUnitPrinter(b); else up = new BriefUnitPrinter(b); if (addJimpleLn()) { up.setPositionTagger(new AttributesUnitPrinter(getJimpleLnNum())); } { Map<Type, List> typeToLocals = new DeterministicHashMap(b.getLocalCount() * 2 + 1, 0.7f); { Iterator localIt = b.getLocals().iterator(); while (localIt.hasNext()) { Local local = (Local) localIt.next(); List<Local> localList; Type t = local.getType(); if (typeToLocals.containsKey(t)) localList = typeToLocals.get(t); else { localList = new ArrayList<Local>(); typeToLocals.put(t, localList); } localList.add(local); } } { Iterator<Type> typeIt = typeToLocals.keySet().iterator(); while (typeIt.hasNext()) { Type type = typeIt.next(); List localList = typeToLocals.get(type); Object[] locals = localList.toArray(); up.type(type); up.literal(" "); for (int k = 0; k < locals.length; k++) { if (k != 0) up.literal(", "); up.local((Local) locals[k]); } up.literal(";"); up.newline(); } } if (!typeToLocals.isEmpty()) { up.newline(); } } Chain units = b.getUnits(); Iterator unitIt = units.iterator(); Unit currentStmt = null, previousStmt; while (unitIt.hasNext()) { previousStmt = currentStmt; currentStmt = (Unit) unitIt.next(); { if (currentStmt != units.getFirst()) { if (unitGraph.getSuccsOf(previousStmt).size() != 1 || unitGraph.getPredsOf(currentStmt).size() != 1 || up.labels().containsKey(currentStmt)) { up.newline(); } else { List succs = unitGraph.getSuccsOf(previousStmt); if (succs.get(0) != currentStmt) { up.newline(); } } } if (up.labels().containsKey(currentStmt)) { up.unitRef(currentStmt, true); up.literal(":"); up.newline(); } if (up.references().containsKey(currentStmt)) { up.unitRef(currentStmt, false); } } up.startUnit(currentStmt); currentStmt.toString(up); up.endUnit(currentStmt); up.literal(";"); up.newline(); if (Options.v().print_tags_in_output()) { Iterator tagIterator = currentStmt.getTags().iterator(); while (tagIterator.hasNext()) { Tag t = (Tag) tagIterator.next(); up.noIndent(); up.literal("/*"); up.literal(t.toString()); up.literal("*/"); up.newline(); } } } out.print(up.toString()); if (addJimpleLn()) { setJimpleLnNum(up.getPositionTagger().getEndLn()); } { Iterator trapIt = b.getTraps().iterator(); if (trapIt.hasNext()) { out.println(); incJimpleLnNum(); } while (trapIt.hasNext()) { Trap trap = (Trap) trapIt.next(); out.println(" catch " + Scene.v().quotedNameOf(trap.getException().getName()) + " from " + up.labels().get(trap.getBeginUnit()) + " to " + up.labels().get(trap.getEndUnit()) + " with " + up.labels().get(trap.getHandlerUnit()) + ";"); incJimpleLnNum(); } } out.println(" }"); <DeepExtract> jimpleLnNum++; </DeepExtract> }
acteve
positive
298
@OnClick(R.id.todo_list_activity_button_add) public void onClickAddButton() { Item item = new Item(this.editText.getText().toString(), this.spinner.getSelectedItemPosition(), USER_ID); this.editText.setText(""); this.itemViewModel.createItem(item); }
@OnClick(R.id.todo_list_activity_button_add) public void onClickAddButton() { <DeepExtract> Item item = new Item(this.editText.getText().toString(), this.spinner.getSelectedItemPosition(), USER_ID); this.editText.setText(""); this.itemViewModel.createItem(item); </DeepExtract> }
OpenClassrooms---Parcours-Android
positive
299
public Criteria andUserIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "user" + " cannot be null"); } criteria.add(new Criterion("user in", values)); return (Criteria) this; }
public Criteria andUserIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "user" + " cannot be null"); } criteria.add(new Criterion("user in", values)); </DeepExtract> return (Criteria) this; }
Hospital
positive
300
private int parseAction() { Integer result; if (readIf("CASCADE")) { result = ConstraintReferential.CASCADE; } else if (readIf("RESTRICT")) { result = ConstraintReferential.RESTRICT; } else { result = null; } if (result != null) { return result; } if (readIf("NO")) { read("ACTION"); return ConstraintReferential.RESTRICT; } if (currentTokenQuoted || !equalsToken("SET", currentToken)) { addExpected("SET"); throw getSyntaxError(); } read(); if (readIf("NULL")) { return ConstraintReferential.SET_NULL; } if (currentTokenQuoted || !equalsToken("DEFAULT", currentToken)) { addExpected("DEFAULT"); throw getSyntaxError(); } read(); return ConstraintReferential.SET_DEFAULT; }
private int parseAction() { Integer result; if (readIf("CASCADE")) { result = ConstraintReferential.CASCADE; } else if (readIf("RESTRICT")) { result = ConstraintReferential.RESTRICT; } else { result = null; } if (result != null) { return result; } if (readIf("NO")) { read("ACTION"); return ConstraintReferential.RESTRICT; } if (currentTokenQuoted || !equalsToken("SET", currentToken)) { addExpected("SET"); throw getSyntaxError(); } read(); if (readIf("NULL")) { return ConstraintReferential.SET_NULL; } <DeepExtract> if (currentTokenQuoted || !equalsToken("DEFAULT", currentToken)) { addExpected("DEFAULT"); throw getSyntaxError(); } read(); </DeepExtract> return ConstraintReferential.SET_DEFAULT; }
Lealone-Plugins
positive
301
public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { try { BeanFactory.add(srcBean); } catch (IntrospectionException | ClassNotFoundException e) { e.printStackTrace(); } try { BeanFactory.add(destBean); } catch (IntrospectionException | ClassNotFoundException e) { e.printStackTrace(); } if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } }
public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { try { BeanFactory.add(srcBean); } catch (IntrospectionException | ClassNotFoundException e) { e.printStackTrace(); } <DeepExtract> try { BeanFactory.add(destBean); } catch (IntrospectionException | ClassNotFoundException e) { e.printStackTrace(); } </DeepExtract> if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } }
opslabJutil
positive
302
public Criteria andToidIn(List<Long> values) { if (values == null) { throw new RuntimeException("Value for " + "toid" + " cannot be null"); } criteria.add(new Criterion("toId in", values)); return (Criteria) this; }
public Criteria andToidIn(List<Long> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "toid" + " cannot be null"); } criteria.add(new Criterion("toId in", values)); </DeepExtract> return (Criteria) this; }
webim
positive
303
@Override public int reasonOffset() { if (buffer() == null) { throw new IllegalStateException("Flyweight has not been wrapped/populated yet with a ByteBuffer."); } int payloadLength = limit() - offset(); if (payloadLength > 2) { return offset() + 2; } return -1; }
@Override public int reasonOffset() { <DeepExtract> if (buffer() == null) { throw new IllegalStateException("Flyweight has not been wrapped/populated yet with a ByteBuffer."); } </DeepExtract> int payloadLength = limit() - offset(); if (payloadLength > 2) { return offset() + 2; } return -1; }
netx
positive
304
public void writeVarInt(int input) { while ((input & -128) != 0) { this.writeByte(input & 127 | 128); input >>>= 7; } return byteBuf.writeByte(input); }
public void writeVarInt(int input) { while ((input & -128) != 0) { this.writeByte(input & 127 | 128); input >>>= 7; } <DeepExtract> return byteBuf.writeByte(input); </DeepExtract> }
BetterProxy
positive
305
private void setPlugin(String name, CmdIn cmd) { Plugin plugin = pluginService.get(name); for (Input input : plugin.getInputs()) { String value = cmd.getInputs().get(input.getName()); if (!StringHelper.hasValue(value) && input.hasDefaultValue()) { cmd.getInputs().put(input.getName(), input.getValue()); continue; } if (!input.verify(value)) { throw new ArgumentException("The illegal input {0} for plugin {1}", input.getName(), plugin.getName()); } } cmd.setPlugin(name); cmd.setAllowFailure(plugin.isAllowFailure()); cmd.addEnvFilters(plugin.getExports()); PluginBody body = plugin.getBody(); if (body instanceof ScriptBody) { String script = ((ScriptBody) body).getScript(); cmd.addScript(script); return; } if (body instanceof ParentBody) { ParentBody parentData = (ParentBody) body; Plugin parent = pluginService.get(parentData.getName()); if (!(parent.getBody() instanceof ScriptBody)) { throw new NotAvailableException("Script not found on parent plugin"); } String scriptFromParent = ((ScriptBody) parent.getBody()).getScript(); cmd.addInputs(parentData.getEnvs()); cmd.addScript(scriptFromParent); verifyPluginInput(cmd.getInputs(), parent); } }
private void setPlugin(String name, CmdIn cmd) { Plugin plugin = pluginService.get(name); <DeepExtract> for (Input input : plugin.getInputs()) { String value = cmd.getInputs().get(input.getName()); if (!StringHelper.hasValue(value) && input.hasDefaultValue()) { cmd.getInputs().put(input.getName(), input.getValue()); continue; } if (!input.verify(value)) { throw new ArgumentException("The illegal input {0} for plugin {1}", input.getName(), plugin.getName()); } } </DeepExtract> cmd.setPlugin(name); cmd.setAllowFailure(plugin.isAllowFailure()); cmd.addEnvFilters(plugin.getExports()); PluginBody body = plugin.getBody(); if (body instanceof ScriptBody) { String script = ((ScriptBody) body).getScript(); cmd.addScript(script); return; } if (body instanceof ParentBody) { ParentBody parentData = (ParentBody) body; Plugin parent = pluginService.get(parentData.getName()); if (!(parent.getBody() instanceof ScriptBody)) { throw new NotAvailableException("Script not found on parent plugin"); } String scriptFromParent = ((ScriptBody) parent.getBody()).getScript(); cmd.addInputs(parentData.getEnvs()); cmd.addScript(scriptFromParent); verifyPluginInput(cmd.getInputs(), parent); } }
flow-platform-x
positive
306
public void putGJString3(String s) { writeByte(0, offset++); checkCapacityPosition(getOffset() + s.length() + 1); System.arraycopy(s.getBytes(), 0, getBuffer(), getOffset(), s.length()); setOffset(getOffset() + s.length()); writeByte(0); writeByte(0, offset++); }
public void putGJString3(String s) { <DeepExtract> writeByte(0, offset++); </DeepExtract> checkCapacityPosition(getOffset() + s.length() + 1); System.arraycopy(s.getBytes(), 0, getBuffer(), getOffset(), s.length()); setOffset(getOffset() + s.length()); writeByte(0); <DeepExtract> writeByte(0, offset++); </DeepExtract> }
Interface-tool
positive
307
public static void main(String[] args) { Node head1 = new Node(1); head1.next = new Node(2); head1.next.next = new Node(3); head1.next.next.next = new Node(4); head1.next.next.next.next = new Node(5); head1.next.next.next.next.next = head1; if (head1 == null) { return; } System.out.print("Circular List: " + head1.value + " "); Node cur = head1.next; while (cur != head1) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head1.value); if (head1 == null || head1.next == head1 || 3 < 1) { head1 = head1; } Node last = head1; while (last.next != head1) { last = last.next; } int count = 0; while (head1 != last) { if (++count == 3) { last.next = head1.next; count = 0; } else { last = last.next; } head1 = last.next; } return head1; if (head1 == null) { return; } System.out.print("Circular List: " + head1.value + " "); Node cur = head1.next; while (cur != head1) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head1.value); Node head2 = new Node(1); head2.next = new Node(2); head2.next.next = new Node(3); head2.next.next.next = new Node(4); head2.next.next.next.next = new Node(5); head2.next.next.next.next.next = head2; if (head2 == null) { return; } System.out.print("Circular List: " + head2.value + " "); Node cur = head2.next; while (cur != head2) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head2.value); if (head2 == null || head2.next == head2 || 3 < 1) { head2 = head2; } Node cur = head2.next; int tmp = 1; while (cur != head2) { tmp++; cur = cur.next; } tmp = getLive(tmp, 3); while (--tmp != 0) { head2 = head2.next; } head2.next = head2; return head2; if (head2 == null) { return; } System.out.print("Circular List: " + head2.value + " "); Node cur = head2.next; while (cur != head2) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head2.value); }
public static void main(String[] args) { Node head1 = new Node(1); head1.next = new Node(2); head1.next.next = new Node(3); head1.next.next.next = new Node(4); head1.next.next.next.next = new Node(5); head1.next.next.next.next.next = head1; if (head1 == null) { return; } System.out.print("Circular List: " + head1.value + " "); Node cur = head1.next; while (cur != head1) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head1.value); if (head1 == null || head1.next == head1 || 3 < 1) { head1 = head1; } Node last = head1; while (last.next != head1) { last = last.next; } int count = 0; while (head1 != last) { if (++count == 3) { last.next = head1.next; count = 0; } else { last = last.next; } head1 = last.next; } return head1; if (head1 == null) { return; } System.out.print("Circular List: " + head1.value + " "); Node cur = head1.next; while (cur != head1) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head1.value); Node head2 = new Node(1); head2.next = new Node(2); head2.next.next = new Node(3); head2.next.next.next = new Node(4); head2.next.next.next.next = new Node(5); head2.next.next.next.next.next = head2; <DeepExtract> if (head2 == null) { return; } System.out.print("Circular List: " + head2.value + " "); Node cur = head2.next; while (cur != head2) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head2.value); </DeepExtract> if (head2 == null || head2.next == head2 || 3 < 1) { head2 = head2; } Node cur = head2.next; int tmp = 1; while (cur != head2) { tmp++; cur = cur.next; } tmp = getLive(tmp, 3); while (--tmp != 0) { head2 = head2.next; } head2.next = head2; return head2; <DeepExtract> if (head2 == null) { return; } System.out.print("Circular List: " + head2.value + " "); Node cur = head2.next; while (cur != head2) { System.out.print(cur.value + " "); cur = cur.next; } System.out.println("-> " + head2.value); </DeepExtract> }
ZuoChengyun
positive
308
@Override public void onDrawing(Canvas c) { super.onDrawing(c); final int currentStack = ((GameEngineTwentyInARow) mGameEngine).getCurrentStack(); final String currentStackStr = String.valueOf(currentStack); final int stackLength = currentStackStr.length(); final int radius = Math.max(mScreenWidth / (12 - stackLength), mScreenHeight / (12 - stackLength)); useTransparentBlackPainter(); c.drawOval(new RectF(-radius, mScreenHeight - radius, radius, mScreenHeight + radius), mPaint); useWhitePainter(); mPaint.getTextBounds(currentStackStr, 0, currentStackStr.length(), mBounds); c.drawText(currentStackStr, mBounds.width() / 2 + radius / 4, mScreenHeight - radius / 4, mPaint); }
@Override public void onDrawing(Canvas c) { super.onDrawing(c); <DeepExtract> final int currentStack = ((GameEngineTwentyInARow) mGameEngine).getCurrentStack(); final String currentStackStr = String.valueOf(currentStack); final int stackLength = currentStackStr.length(); final int radius = Math.max(mScreenWidth / (12 - stackLength), mScreenHeight / (12 - stackLength)); useTransparentBlackPainter(); c.drawOval(new RectF(-radius, mScreenHeight - radius, radius, mScreenHeight + radius), mPaint); useWhitePainter(); mPaint.getTextBounds(currentStackStr, 0, currentStackStr.length(), mBounds); c.drawText(currentStackStr, mBounds.width() / 2 + radius / 4, mScreenHeight - radius / 4, mPaint); </DeepExtract> }
ChaseWhisplyProject
positive
309
public void showErrorView(String message) { if (!TextUtils.isEmpty(message)) { BaseVaryViewSetter.setText(mErrorView, R.id.error_tips_show, message); } mViewHelper.showCaseLayout(mErrorView); if (mLoadingProgress != null && mLoadingProgress.isSpinning()) { mLoadingProgress.stopSpinning(); } }
public void showErrorView(String message) { if (!TextUtils.isEmpty(message)) { BaseVaryViewSetter.setText(mErrorView, R.id.error_tips_show, message); } mViewHelper.showCaseLayout(mErrorView); <DeepExtract> if (mLoadingProgress != null && mLoadingProgress.isSpinning()) { mLoadingProgress.stopSpinning(); } </DeepExtract> }
RAD
positive
310
public static Integer[] sort(Integer[] a, Integer length) { if (length - 0 <= 1) { return a; } else { } int left_start = 0; int left_end = (0 + length) / 2; int right_start = left_end; int right_end = length; mergesort_r(left_start, left_end, a); mergesort_r(right_start, right_end, a); merge(a, left_start, left_end, right_start, right_end); return a; return a; }
public static Integer[] sort(Integer[] a, Integer length) { <DeepExtract> if (length - 0 <= 1) { return a; } else { } int left_start = 0; int left_end = (0 + length) / 2; int right_start = left_end; int right_end = length; mergesort_r(left_start, left_end, a); mergesort_r(right_start, right_end, a); merge(a, left_start, left_end, right_start, right_end); return a; </DeepExtract> return a; }
gin
positive
311
private void addRecord(int index, org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord value) { value.getClass(); com.google.protobuf.Internal.ProtobufList<org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord> tmp = record_; if (!tmp.isModifiable()) { record_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp); } record_.add(index, value); }
private void addRecord(int index, org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord value) { value.getClass(); <DeepExtract> com.google.protobuf.Internal.ProtobufList<org.tosl.coronawarncompanion.gmsreadout.ContactRecordsProtos.ScanRecord> tmp = record_; if (!tmp.isModifiable()) { record_ = com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp); } </DeepExtract> record_.add(index, value); }
corona-warn-companion-android
positive
312
@Override public void onServicesDiscoveredBase(BleDevice bleDevice, BluetoothGatt gatt, int status) { if (Looper.myLooper() != Looper.getMainLooper()) { mHandler.post(() -> onServicesDiscovered(bleDevice, gatt, status)); } else { () -> onServicesDiscovered(bleDevice, gatt, status).run(); } }
@Override public void onServicesDiscoveredBase(BleDevice bleDevice, BluetoothGatt gatt, int status) { <DeepExtract> if (Looper.myLooper() != Looper.getMainLooper()) { mHandler.post(() -> onServicesDiscovered(bleDevice, gatt, status)); } else { () -> onServicesDiscovered(bleDevice, gatt, status).run(); } </DeepExtract> }
BLELib
positive
313
void WriteEndMarker(int posState) throws IOException { if (!_writeEndMark) return; if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumLowLenSymbols) { _isMatch.Encode(_choice, 0, 0); _lowCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState); } else { (_state << Base.kNumPosStatesBitsMax) + posState -= Base.kNumLowLenSymbols; _isMatch.Encode(_choice, 0, 1); if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumMidLenSymbols) { _isMatch.Encode(_choice, 1, 0); _midCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState); } else { _isMatch.Encode(_choice, 1, 1); _highCoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState - Base.kNumMidLenSymbols); } } if (_state < Base.kNumLowLenSymbols) { _isRep.Encode(_choice, 0, 0); _lowCoder[0].Encode(_isRep, _state); } else { _state -= Base.kNumLowLenSymbols; _isRep.Encode(_choice, 0, 1); if (_state < Base.kNumMidLenSymbols) { _isRep.Encode(_choice, 1, 0); _midCoder[0].Encode(_isRep, _state); } else { _isRep.Encode(_choice, 1, 1); _highCoder.Encode(_isRep, _state - Base.kNumMidLenSymbols); } } _state = Base.StateUpdateMatch(_state); int len = Base.kMatchMinLen; if (len - Base.kMatchMinLen < Base.kNumLowLenSymbols) { _rangeEncoder.Encode(_choice, 0, 0); _lowCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen); } else { len - Base.kMatchMinLen -= Base.kNumLowLenSymbols; _rangeEncoder.Encode(_choice, 0, 1); if (len - Base.kMatchMinLen < Base.kNumMidLenSymbols) { _rangeEncoder.Encode(_choice, 1, 0); _midCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen); } else { _rangeEncoder.Encode(_choice, 1, 1); _highCoder.Encode(_rangeEncoder, len - Base.kMatchMinLen - Base.kNumMidLenSymbols); } } int posSlot = (1 << Base.kNumPosSlotBits) - 1; int lenToPosState = Base.GetLenToPosState(len); int context = 1; for (int i = 7; i >= 0; i--) { int bit = ((posSlot >> i) & 1); _rangeEncoder.Encode(m_Encoders, context, bit); context = (context << 1) | bit; } int footerBits = 30; int posReduced = (1 << footerBits) - 1; _rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits); _posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask); }
void WriteEndMarker(int posState) throws IOException { if (!_writeEndMark) return; if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumLowLenSymbols) { _isMatch.Encode(_choice, 0, 0); _lowCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState); } else { (_state << Base.kNumPosStatesBitsMax) + posState -= Base.kNumLowLenSymbols; _isMatch.Encode(_choice, 0, 1); if ((_state << Base.kNumPosStatesBitsMax) + posState < Base.kNumMidLenSymbols) { _isMatch.Encode(_choice, 1, 0); _midCoder[1].Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState); } else { _isMatch.Encode(_choice, 1, 1); _highCoder.Encode(_isMatch, (_state << Base.kNumPosStatesBitsMax) + posState - Base.kNumMidLenSymbols); } } if (_state < Base.kNumLowLenSymbols) { _isRep.Encode(_choice, 0, 0); _lowCoder[0].Encode(_isRep, _state); } else { _state -= Base.kNumLowLenSymbols; _isRep.Encode(_choice, 0, 1); if (_state < Base.kNumMidLenSymbols) { _isRep.Encode(_choice, 1, 0); _midCoder[0].Encode(_isRep, _state); } else { _isRep.Encode(_choice, 1, 1); _highCoder.Encode(_isRep, _state - Base.kNumMidLenSymbols); } } _state = Base.StateUpdateMatch(_state); int len = Base.kMatchMinLen; if (len - Base.kMatchMinLen < Base.kNumLowLenSymbols) { _rangeEncoder.Encode(_choice, 0, 0); _lowCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen); } else { len - Base.kMatchMinLen -= Base.kNumLowLenSymbols; _rangeEncoder.Encode(_choice, 0, 1); if (len - Base.kMatchMinLen < Base.kNumMidLenSymbols) { _rangeEncoder.Encode(_choice, 1, 0); _midCoder[posState].Encode(_rangeEncoder, len - Base.kMatchMinLen); } else { _rangeEncoder.Encode(_choice, 1, 1); _highCoder.Encode(_rangeEncoder, len - Base.kMatchMinLen - Base.kNumMidLenSymbols); } } int posSlot = (1 << Base.kNumPosSlotBits) - 1; int lenToPosState = Base.GetLenToPosState(len); <DeepExtract> int context = 1; for (int i = 7; i >= 0; i--) { int bit = ((posSlot >> i) & 1); _rangeEncoder.Encode(m_Encoders, context, bit); context = (context << 1) | bit; } </DeepExtract> int footerBits = 30; int posReduced = (1 << footerBits) - 1; _rangeEncoder.EncodeDirectBits(posReduced >> Base.kNumAlignBits, footerBits - Base.kNumAlignBits); _posAlignEncoder.ReverseEncode(_rangeEncoder, posReduced & Base.kAlignMask); }
jarchive
positive
314
@Override public void onPrepared() { mCurrentPlayState = STATE_PREPARED; if (mVideoController != null) mVideoController.setPlayState(STATE_PREPARED); if (mOnVideoViewStateChangeListeners != null) { for (int i = 0, z = mOnVideoViewStateChangeListeners.size(); i < z; i++) { OnVideoViewStateChangeListener listener = mOnVideoViewStateChangeListeners.get(i); if (listener != null) { listener.onPlayStateChanged(STATE_PREPARED); } } } if (mCurrentPosition > 0) { seekTo(mCurrentPosition); } }
@Override public void onPrepared() { <DeepExtract> mCurrentPlayState = STATE_PREPARED; if (mVideoController != null) mVideoController.setPlayState(STATE_PREPARED); if (mOnVideoViewStateChangeListeners != null) { for (int i = 0, z = mOnVideoViewStateChangeListeners.size(); i < z; i++) { OnVideoViewStateChangeListener listener = mOnVideoViewStateChangeListeners.get(i); if (listener != null) { listener.onPlayStateChanged(STATE_PREPARED); } } } </DeepExtract> if (mCurrentPosition > 0) { seekTo(mCurrentPosition); } }
dkplayer
positive
315
public void release() { if (null != mediaPlayer) { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } mediaPlayer.reset(); } if (null != mediaPlayer) { mediaPlayer.release(); mediaPlayer = null; } }
public void release() { <DeepExtract> if (null != mediaPlayer) { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } mediaPlayer.reset(); } </DeepExtract> if (null != mediaPlayer) { mediaPlayer.release(); mediaPlayer = null; } }
bigapple
positive
316
public static int width(Component component) { Dimension dim = component.minimumSize(); return dim.width; }
public static int width(Component component) { <DeepExtract> Dimension dim = component.minimumSize(); return dim.width; </DeepExtract> }
javancss
positive
317
@Override protected void draw(Graphics g) { if (bFirstDraw) { bFirstDraw = false; Dimension size = this.getSize(); _origin.x = size.width / 2; _origin.y = size.height / 2; } final Dimension originPointerSize = new Dimension(26, 3); super.draw(g); g.setColor(Color.LIGHT_GRAY); g.drawLine(0, _origin.y, getSize().width, _origin.y); g.drawLine(_origin.x, 0, _origin.x, getSize().height); g.setColor(Color.RED); int x = _origin.x; if (x < 0) x = 0; else if (x >= getSize().width) x = getSize().width - originPointerSize.height; int y = _origin.y; if (y < 0) y = 0; else if (y >= getSize().height) y = getSize().height - originPointerSize.height; if (_origin.y <= 0 || _origin.y >= getSize().height) { g.fillRect(x - (originPointerSize.width / 2), y, originPointerSize.width, originPointerSize.height); } if (_origin.x <= 0 || _origin.x >= getSize().width) { g.fillRect(x, y - (originPointerSize.width / 2), originPointerSize.height, originPointerSize.width); } if (onionSkins == null) return; float alpha = 1.0f; for (int i = 0; i < onionSkins.length; ++i) { alpha /= 3.0f; AnimationCell cell = onionSkins[i]; ArrayList<GraphicObject> graphics = cell.getGraphicList(); for (int j = 0; j < graphics.size(); ++j) { GraphicObject graphic = graphics.get(j); this.drawGraphicRotated(graphic, g, _origin, _zoom, alpha); } } }
@Override protected void draw(Graphics g) { if (bFirstDraw) { bFirstDraw = false; Dimension size = this.getSize(); _origin.x = size.width / 2; _origin.y = size.height / 2; } final Dimension originPointerSize = new Dimension(26, 3); super.draw(g); g.setColor(Color.LIGHT_GRAY); g.drawLine(0, _origin.y, getSize().width, _origin.y); g.drawLine(_origin.x, 0, _origin.x, getSize().height); g.setColor(Color.RED); int x = _origin.x; if (x < 0) x = 0; else if (x >= getSize().width) x = getSize().width - originPointerSize.height; int y = _origin.y; if (y < 0) y = 0; else if (y >= getSize().height) y = getSize().height - originPointerSize.height; if (_origin.y <= 0 || _origin.y >= getSize().height) { g.fillRect(x - (originPointerSize.width / 2), y, originPointerSize.width, originPointerSize.height); } if (_origin.x <= 0 || _origin.x >= getSize().width) { g.fillRect(x, y - (originPointerSize.width / 2), originPointerSize.height, originPointerSize.width); } <DeepExtract> if (onionSkins == null) return; float alpha = 1.0f; for (int i = 0; i < onionSkins.length; ++i) { alpha /= 3.0f; AnimationCell cell = onionSkins[i]; ArrayList<GraphicObject> graphics = cell.getGraphicList(); for (int j = 0; j < graphics.size(); ++j) { GraphicObject graphic = graphics.get(j); this.drawGraphicRotated(graphic, g, _origin, _zoom, alpha); } } </DeepExtract> }
darkFunction-Editor
positive
319
public Integer negate(Integer x) { Objects.requireNonNull(x); int y = x.intValue(); if (y < 0 || y >= size) throw new IllegalArgumentException("Not an element of this field: " + y); return y; }
public Integer negate(Integer x) { <DeepExtract> Objects.requireNonNull(x); int y = x.intValue(); if (y < 0 || y >= size) throw new IllegalArgumentException("Not an element of this field: " + y); return y; </DeepExtract> }
Nayuki-web-published-code
positive
320
private void removeSegment(int i, int j) { int[] segments = m_segments[i]; int jmax; for (int i = segments.length - 1; i >= 0; i--) { if (segments[i] != NoneSegment) { jmax = i; } } throw new Error("Invalid segments state"); for (int n = j; n < jmax; n++) { segments[n] = segments[n + 1]; } segments[jmax] = NoneSegment; if (j == 0) { m_ymin[i]++; } }
private void removeSegment(int i, int j) { int[] segments = m_segments[i]; <DeepExtract> int jmax; for (int i = segments.length - 1; i >= 0; i--) { if (segments[i] != NoneSegment) { jmax = i; } } throw new Error("Invalid segments state"); </DeepExtract> for (int n = j; n < jmax; n++) { segments[n] = segments[n + 1]; } segments[jmax] = NoneSegment; if (j == 0) { m_ymin[i]++; } }
CubicChunks
positive
321