before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public HashMap<Long, String> loadIdSymbolMapFromTable() { HashMap<Long, String> map = new HashMap<Long, String>(); String sql = "SELECT * FROM " + Config.relConstants; ResultSet rs; if (Config.exiting_mode) ExceptionMan.die(""); try { Statement stmt = con.createStatement(ResultSet.HOLD_CURSORS_OVER_COMMIT, 1); currentlyRunningQuery = stmt; stmt.setFetchSize(100000); ResultSet rs = stmt.executeQuery(sql); currentlyRunningQuery = null; rs = rs; } catch (SQLException e) { UIMan.error(sql); ExceptionMan.handle(e); rs = null; } try { while (rs.next()) { String word = rs.getString("string"); long id = rs.getLong("id"); map.put(id, word); } rs.close(); } catch (SQLException e) { ExceptionMan.handle(e); } return map; }
public HashMap<Long, String> loadIdSymbolMapFromTable() { HashMap<Long, String> map = new HashMap<Long, String>(); String sql = "SELECT * FROM " + Config.relConstants; <DeepExtract> ResultSet rs; if (Config.exiting_mode) ExceptionMan.die(""); try { Statement stmt = con.createStatement(ResultSet.HOLD_CURSORS_OVER_COMMIT, 1); currentlyRunningQuery = stmt; stmt.setFetchSize(100000); ResultSet rs = stmt.executeQuery(sql); currentlyRunningQuery = null; rs = rs; } catch (SQLException e) { UIMan.error(sql); ExceptionMan.handle(e); rs = null; } </DeepExtract> try { while (rs.next()) { String word = rs.getString("string"); long id = rs.getLong("id"); map.put(id, word); } rs.close(); } catch (SQLException e) { ExceptionMan.handle(e); } return map; }
tuffy
positive
2,084
public Criteria andNameGreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "name" + " cannot be null"); } criteria.add(new Criterion("name >", value)); return (Criteria) this; }
public Criteria andNameGreaterThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "name" + " cannot be null"); } criteria.add(new Criterion("name >", value)); </DeepExtract> return (Criteria) this; }
health_online
positive
2,086
@Override public void onClick(View view) { fragment.addToQuickPlaylist(track); }
@Override public void onClick(View view) { <DeepExtract> fragment.addToQuickPlaylist(track); </DeepExtract> }
IdealMedia
positive
2,087
private void begin() { Lib.debug(dbgThread, "Beginning thread: " + toString()); Lib.assertTrue(this == currentThread); Lib.debug(dbgThread, "Running thread: " + currentThread.toString()); Lib.assertTrue(Machine.interrupt().disabled()); Lib.assertTrue(this == currentThread); Lib.assertTrue(tcb == TCB.currentTCB()); Machine.autoGrader().runningThread(this); status = statusRunning; if (toBeDestroyed != null) { toBeDestroyed.tcb.destroy(); toBeDestroyed.tcb = null; toBeDestroyed = null; } Machine.interrupt().enable(); }
private void begin() { Lib.debug(dbgThread, "Beginning thread: " + toString()); Lib.assertTrue(this == currentThread); <DeepExtract> Lib.debug(dbgThread, "Running thread: " + currentThread.toString()); Lib.assertTrue(Machine.interrupt().disabled()); Lib.assertTrue(this == currentThread); Lib.assertTrue(tcb == TCB.currentTCB()); Machine.autoGrader().runningThread(this); status = statusRunning; if (toBeDestroyed != null) { toBeDestroyed.tcb.destroy(); toBeDestroyed.tcb = null; toBeDestroyed = null; } </DeepExtract> Machine.interrupt().enable(); }
CS162
positive
2,088
private void drawInfluence(Graphics2D g, int influenceX, int influenceY, double influence) { if (Math.abs(influence) < 0.01) { return; } if (influence > 0) { g.setColor(COLOR_INFLUENCE_BLACK); } else { g.setColor(COLOR_INFLUENCE_WHITE); } int radius = (int) (stoneRadius * 0.5 * Math.abs(influence)); g.fillRect(influenceX - radius, influenceY - radius, 2 * radius + 1, 2 * radius + 1); }
private void drawInfluence(Graphics2D g, int influenceX, int influenceY, double influence) { if (Math.abs(influence) < 0.01) { return; } if (influence > 0) { g.setColor(COLOR_INFLUENCE_BLACK); } else { g.setColor(COLOR_INFLUENCE_WHITE); } int radius = (int) (stoneRadius * 0.5 * Math.abs(influence)); <DeepExtract> g.fillRect(influenceX - radius, influenceY - radius, 2 * radius + 1, 2 * radius + 1); </DeepExtract> }
mylizzie
positive
2,089
public List<PLUSEdge> getEdgesByString(String pattern) { ArrayList<PLUSEdge> ret = new ArrayList<PLUSEdge>(); for (String key : edges.keySet()) if (key.contains(pattern)) ret.add(edges.get(key)); return ret; }
public List<PLUSEdge> getEdgesByString(String pattern) { <DeepExtract> ArrayList<PLUSEdge> ret = new ArrayList<PLUSEdge>(); for (String key : edges.keySet()) if (key.contains(pattern)) ret.add(edges.get(key)); return ret; </DeepExtract> }
plus
positive
2,090
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mListener != null) { mListener.onItemSelected(mItems.get(position)); } if (mPopupWindow != null && mPopupWindow.isShowing()) { mPopupWindow.dismiss(); } }
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mListener != null) { mListener.onItemSelected(mItems.get(position)); } <DeepExtract> if (mPopupWindow != null && mPopupWindow.isShowing()) { mPopupWindow.dismiss(); } </DeepExtract> }
UltraExplorer
positive
2,091
public static void main(final String[] args) { logger.entry(); initVertex(); ; refreshDoc(); logger.exit(); }
public static void main(final String[] args) { <DeepExtract> logger.entry(); initVertex(); ; refreshDoc(); logger.exit(); </DeepExtract> }
light
positive
2,092
public String getZhiShui() { int offset = 4 - Solar.fromJulianDay(getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex(); if (offset < 0) { offset += 12; } return "几龙治水".replaceFirst("几", LunarUtil.NUMBER[offset + 1]); }
public String getZhiShui() { <DeepExtract> int offset = 4 - Solar.fromJulianDay(getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex(); if (offset < 0) { offset += 12; } return "几龙治水".replaceFirst("几", LunarUtil.NUMBER[offset + 1]); </DeepExtract> }
lunar-java
positive
2,093
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); JmcInit.start(this); setContentView(R.layout.jconnect_droid_feedback); baseConfig = new BaseConfig(this); feedbackServiceBinder = new RemoteFeedbackServiceBinder(this); if (baseConfig.hasError()) { Toast.makeText(getApplicationContext(), baseConfig.getError(), Toast.LENGTH_LONG).show(); finish(); return; } feedbackServiceBinder.init(); final Button submit = (Button) findViewById(R.id.submit_button); submit.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { final String feedback = getTextFromView(FeedbackActivity.this, R.id.feedback_text); createIssue(feedback); finish(); } }); audioRecordingDialog = AudioRecordingDialog.forRecordingInTempDir(this, "recording.mp3"); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); JmcInit.start(this); setContentView(R.layout.jconnect_droid_feedback); baseConfig = new BaseConfig(this); feedbackServiceBinder = new RemoteFeedbackServiceBinder(this); if (baseConfig.hasError()) { Toast.makeText(getApplicationContext(), baseConfig.getError(), Toast.LENGTH_LONG).show(); finish(); return; } feedbackServiceBinder.init(); final Button submit = (Button) findViewById(R.id.submit_button); submit.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { final String feedback = getTextFromView(FeedbackActivity.this, R.id.feedback_text); createIssue(feedback); finish(); } }); <DeepExtract> audioRecordingDialog = AudioRecordingDialog.forRecordingInTempDir(this, "recording.mp3"); </DeepExtract> }
Impeller
positive
2,094
private void initDefaultConfig() { this.maxCacheSize = 10 * 1024 * 1024; return this; if (30 <= 0) throw new IllegalArgumentException("connectTimeout must be > 0"); this.connectTimeout = 30; return this; if (30 <= 0) throw new IllegalArgumentException("readTimeout must be > 0"); this.readTimeout = 30; return this; if (30 <= 0) throw new IllegalArgumentException("writeTimeout must be > 0"); this.writeTimeout = 30; return this; this.retryOnConnectionFailure = true; return this; if (0 < 0) throw new IllegalArgumentException("cacheSurvivalTime must be >= 0"); this.cacheSurvivalTime = 0; return this; this.cacheType = FORCE_NETWORK; return this; if (null != null) this.networkInterceptors = null; return this; if (null != null) this.interceptors = null; return this; if (null != null) this.resultInterceptors = null; return this; if (null != null) { this.exceptionInterceptors = null; } return this; this.showHttpLog = true; return this; this.showLifecycleLog = false; return this; this.downloadFileDir = Environment.getExternalStorageDirectory().getPath() + "/okHttp_download/"; return this; if (null != new File(Environment.getExternalStorageDirectory().getPath() + "/okHttp_cache")) this.cachedDir = new File(Environment.getExternalStorageDirectory().getPath() + "/okHttp_cache"); return this; this.isGzip = false; return this; this.responseEncoding = Encoding.UTF_8; return this; this.requestEncoding = Encoding.UTF_8; return this; }
private void initDefaultConfig() { this.maxCacheSize = 10 * 1024 * 1024; return this; if (30 <= 0) throw new IllegalArgumentException("connectTimeout must be > 0"); this.connectTimeout = 30; return this; if (30 <= 0) throw new IllegalArgumentException("readTimeout must be > 0"); this.readTimeout = 30; return this; if (30 <= 0) throw new IllegalArgumentException("writeTimeout must be > 0"); this.writeTimeout = 30; return this; this.retryOnConnectionFailure = true; return this; if (0 < 0) throw new IllegalArgumentException("cacheSurvivalTime must be >= 0"); this.cacheSurvivalTime = 0; return this; this.cacheType = FORCE_NETWORK; return this; if (null != null) this.networkInterceptors = null; return this; if (null != null) this.interceptors = null; return this; if (null != null) this.resultInterceptors = null; return this; if (null != null) { this.exceptionInterceptors = null; } return this; this.showHttpLog = true; return this; this.showLifecycleLog = false; return this; this.downloadFileDir = Environment.getExternalStorageDirectory().getPath() + "/okHttp_download/"; return this; if (null != new File(Environment.getExternalStorageDirectory().getPath() + "/okHttp_cache")) this.cachedDir = new File(Environment.getExternalStorageDirectory().getPath() + "/okHttp_cache"); return this; this.isGzip = false; return this; this.responseEncoding = Encoding.UTF_8; return this; <DeepExtract> this.requestEncoding = Encoding.UTF_8; return this; </DeepExtract> }
OkHttp3
positive
2,095
public Criteria andIncomeNumEqualTo(Long value) { if (value == null) { throw new RuntimeException("Value for " + "incomeNum" + " cannot be null"); } criteria.add(new Criterion("income_num =", value)); return (Criteria) this; }
public Criteria andIncomeNumEqualTo(Long value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "incomeNum" + " cannot be null"); } criteria.add(new Criterion("income_num =", value)); </DeepExtract> return (Criteria) this; }
Maven_SSM
positive
2,096
private void loadTextures() { texture = new Texture(Gdx.files.internal("images/atlas.png")); TextureRegion[][] tmpLeftRight = TextureRegion.split(texture, texture.getWidth() / 2, texture.getHeight()); TextureRegion[][] tmpMain = tmpLeftRight[0][0].split(tmpLeftRight[0][0].getRegionWidth(), tmpLeftRight[0][0].getRegionHeight() / 2); TextureRegion[][] tmpTop = tmpMain[0][0].split(tmpMain[0][0].getRegionWidth() / 2, tmpMain[0][0].getRegionHeight()); TextureRegion[][] tmp = tmpTop[0][0].split(tmpTop[0][0].getRegionWidth() / 8, tmpTop[0][0].getRegionHeight() / 16); textureRegions.put("Door", tmp[0][0]); textureRegions.put("HardBrick", tmp[0][1]); textureRegions.put("wallpass", tmp[0][2]); textureRegions.put("flames", tmp[0][3]); textureRegions.put("bombs", tmp[1][0]); textureRegions.put("speed", tmp[1][1]); textureRegions.put("detonator", tmp[1][2]); textureRegions.put("bombpass", tmp[1][3]); textureRegions.put("flamepass", tmp[8][7]); textureRegions.put("mystery", tmp[9][7]); loadBrickAnimation(tmp); loadBombAnimation(tmp); loadBoomAnimation(tmp); loadBaloomAnimation(tmp); loadDollAnimation(tmp); loadOnealAnimation(tmp); loadMinvoAnimation(tmp); loadPassAnimation(tmp); loadPontanAnimation(tmp); loadOvapiAnimation(tmp); loadKondoriaAnimation(tmp); TextureRegion[][] tmpBomber = tmpTop[0][1].split(tmpTop[0][1].getRegionWidth(), tmpTop[0][1].getRegionHeight() / 2); loadBombermanAnimation(tmpBomber[0][0].split(tmpBomber[0][0].getRegionWidth() / 8, tmpBomber[0][0].getRegionHeight() / 8)); TextureRegion[][] controls = tmpLeftRight[0][1].split(tmpLeftRight[0][1].getRegionWidth(), tmpLeftRight[0][1].getRegionHeight() / 2); textureRegions.put("navigation-arrows", controls[0][0]); TextureRegion[][] controls2 = controls[1][0].split(controls[1][0].getRegionWidth() / 2, controls[1][0].getRegionHeight() / 2); textureRegions.put("khob", controls2[0][1]); arrowLeft = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); arrowLeft.rotate90(true); arrowLeft.rotate90(true); arrowLeft.rotate90(true); arrowRight = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); arrowRight.rotate90(true); arrowDown = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); arrowDown.rotate90(true); arrowDown.rotate90(true); arrowUp = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); textureRegions.put("home", (controls2[1][0].split(controls2[1][0].getRegionWidth() / 2, controls2[1][0].getRegionHeight() / 2))[0][0]); textureRegions.put("resume", (controls2[1][0].split(controls2[1][0].getRegionWidth() / 2, controls2[1][0].getRegionHeight() / 2))[0][1]); textureRegions.put("fon", (controls2[1][0].split(controls2[1][0].getRegionWidth(), controls2[1][0].getRegionHeight() / 2))[1][0]); TextureRegion[][] tmpBot = tmpMain[1][0].split(tmpMain[1][0].getRegionWidth() / 2, tmpMain[1][0].getRegionHeight()); TextureRegion[][] tmpFont = tmpBot[0][0].split(tmpBot[0][0].getRegionWidth() / 4, tmpBot[0][0].getRegionHeight() / 8); textureRegions.put("1", tmpFont[0][0]); textureRegions.put("2", tmpFont[0][1]); textureRegions.put("3", tmpFont[0][2]); textureRegions.put("4", tmpFont[0][3]); textureRegions.put("5", tmpFont[1][0]); textureRegions.put("6", tmpFont[1][1]); textureRegions.put("7", tmpFont[1][2]); textureRegions.put("8", tmpFont[1][3]); textureRegions.put("9", tmpFont[2][0]); textureRegions.put("0", tmpFont[2][1]); textureRegions.put("t", tmpFont[3][0]); textureRegions.put("i", tmpFont[3][1]); textureRegions.put("m", tmpFont[3][2]); textureRegions.put("e", tmpFont[3][3]); textureRegions.put("l", tmpFont[4][0]); textureRegions.put("f", tmpFont[4][1]); textureRegions.put("cG", tmpFont[7][2]); textureRegions.put("iG", tmpFont[7][1]); textureRegions.put("sG", tmpFont[7][0]); textureRegions.put("tG", tmpFont[5][0]); textureRegions.put("aG", tmpFont[5][1]); textureRegions.put("gG", tmpFont[5][2]); textureRegions.put("eG", tmpFont[5][3]); textureRegions.put("bG", tmpFont[6][0]); textureRegions.put("oG", tmpFont[6][1]); textureRegions.put("nG", tmpFont[6][2]); textureRegions.put("uG", tmpFont[6][3]); }
private void loadTextures() { <DeepExtract> texture = new Texture(Gdx.files.internal("images/atlas.png")); TextureRegion[][] tmpLeftRight = TextureRegion.split(texture, texture.getWidth() / 2, texture.getHeight()); TextureRegion[][] tmpMain = tmpLeftRight[0][0].split(tmpLeftRight[0][0].getRegionWidth(), tmpLeftRight[0][0].getRegionHeight() / 2); TextureRegion[][] tmpTop = tmpMain[0][0].split(tmpMain[0][0].getRegionWidth() / 2, tmpMain[0][0].getRegionHeight()); TextureRegion[][] tmp = tmpTop[0][0].split(tmpTop[0][0].getRegionWidth() / 8, tmpTop[0][0].getRegionHeight() / 16); textureRegions.put("Door", tmp[0][0]); textureRegions.put("HardBrick", tmp[0][1]); textureRegions.put("wallpass", tmp[0][2]); textureRegions.put("flames", tmp[0][3]); textureRegions.put("bombs", tmp[1][0]); textureRegions.put("speed", tmp[1][1]); textureRegions.put("detonator", tmp[1][2]); textureRegions.put("bombpass", tmp[1][3]); textureRegions.put("flamepass", tmp[8][7]); textureRegions.put("mystery", tmp[9][7]); loadBrickAnimation(tmp); loadBombAnimation(tmp); loadBoomAnimation(tmp); loadBaloomAnimation(tmp); loadDollAnimation(tmp); loadOnealAnimation(tmp); loadMinvoAnimation(tmp); loadPassAnimation(tmp); loadPontanAnimation(tmp); loadOvapiAnimation(tmp); loadKondoriaAnimation(tmp); TextureRegion[][] tmpBomber = tmpTop[0][1].split(tmpTop[0][1].getRegionWidth(), tmpTop[0][1].getRegionHeight() / 2); loadBombermanAnimation(tmpBomber[0][0].split(tmpBomber[0][0].getRegionWidth() / 8, tmpBomber[0][0].getRegionHeight() / 8)); TextureRegion[][] controls = tmpLeftRight[0][1].split(tmpLeftRight[0][1].getRegionWidth(), tmpLeftRight[0][1].getRegionHeight() / 2); textureRegions.put("navigation-arrows", controls[0][0]); TextureRegion[][] controls2 = controls[1][0].split(controls[1][0].getRegionWidth() / 2, controls[1][0].getRegionHeight() / 2); textureRegions.put("khob", controls2[0][1]); arrowLeft = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); arrowLeft.rotate90(true); arrowLeft.rotate90(true); arrowLeft.rotate90(true); arrowRight = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); arrowRight.rotate90(true); arrowDown = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); arrowDown.rotate90(true); arrowDown.rotate90(true); arrowUp = new com.badlogic.gdx.graphics.g2d.Sprite(controls2[0][0].split(controls2[0][0].getRegionWidth() / 2, controls2[0][0].getRegionHeight() / 2)[0][0]); textureRegions.put("home", (controls2[1][0].split(controls2[1][0].getRegionWidth() / 2, controls2[1][0].getRegionHeight() / 2))[0][0]); textureRegions.put("resume", (controls2[1][0].split(controls2[1][0].getRegionWidth() / 2, controls2[1][0].getRegionHeight() / 2))[0][1]); textureRegions.put("fon", (controls2[1][0].split(controls2[1][0].getRegionWidth(), controls2[1][0].getRegionHeight() / 2))[1][0]); TextureRegion[][] tmpBot = tmpMain[1][0].split(tmpMain[1][0].getRegionWidth() / 2, tmpMain[1][0].getRegionHeight()); TextureRegion[][] tmpFont = tmpBot[0][0].split(tmpBot[0][0].getRegionWidth() / 4, tmpBot[0][0].getRegionHeight() / 8); textureRegions.put("1", tmpFont[0][0]); textureRegions.put("2", tmpFont[0][1]); textureRegions.put("3", tmpFont[0][2]); textureRegions.put("4", tmpFont[0][3]); textureRegions.put("5", tmpFont[1][0]); textureRegions.put("6", tmpFont[1][1]); textureRegions.put("7", tmpFont[1][2]); textureRegions.put("8", tmpFont[1][3]); textureRegions.put("9", tmpFont[2][0]); textureRegions.put("0", tmpFont[2][1]); textureRegions.put("t", tmpFont[3][0]); textureRegions.put("i", tmpFont[3][1]); textureRegions.put("m", tmpFont[3][2]); textureRegions.put("e", tmpFont[3][3]); textureRegions.put("l", tmpFont[4][0]); textureRegions.put("f", tmpFont[4][1]); textureRegions.put("cG", tmpFont[7][2]); textureRegions.put("iG", tmpFont[7][1]); textureRegions.put("sG", tmpFont[7][0]); textureRegions.put("tG", tmpFont[5][0]); textureRegions.put("aG", tmpFont[5][1]); textureRegions.put("gG", tmpFont[5][2]); textureRegions.put("eG", tmpFont[5][3]); textureRegions.put("bG", tmpFont[6][0]); textureRegions.put("oG", tmpFont[6][1]); textureRegions.put("nG", tmpFont[6][2]); textureRegions.put("uG", tmpFont[6][3]); </DeepExtract> }
libgdx
positive
2,097
private void initialise(double[] data, double[] xCategories, String[] toolTipLabels, String xLabel, String yLabel, String graphTitle) { this.data = data; this.xCategories = xCategories; this.toolTipLabels = toolTipLabels; this.xLabel = xLabel; this.yLabel = yLabel; this.graphTitle = graphTitle; double[] minmax = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; if (this.data.length == 1) { if (this.data[0] >= 0) { minmax[0] = 0.0d; minmax[1] = this.data[0]; } else { minmax[0] = this.data[0]; minmax[1] = 0.0d; } return; } for (int i = 0; i < this.data.length; i++) { if (minmax[0] > this.data[i]) { minmax[0] = this.data[i]; } else if (minmax[1] < this.data[i]) { minmax[1] = this.data[i]; } } if (minmax[0] > 0) minmax[0] = 0.0d; minY = minmax[0]; maxY = minmax[1] + minmax[1] * 0.1; int base = 1; double[] divisions = new double[] { 0.5, 1, 2, 2.5, 5 }; while (true) { for (int d = 0; d < divisions.length; d++) { double tester = base * divisions[d]; if (maxY / tester <= 10) { yInterval = tester; } } base *= 10; } minmax = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; if (this.xCategories.length == 1) { if (this.xCategories[0] >= 0) { minmax[0] = 0.0d; minmax[1] = this.xCategories[0]; } else { minmax[0] = this.xCategories[0]; minmax[1] = 0.0d; } return; } for (int i = 0; i < this.xCategories.length; i++) { if (minmax[0] > this.xCategories[i]) { minmax[0] = this.xCategories[i]; } else if (minmax[1] < this.xCategories[i]) { minmax[1] = this.xCategories[i]; } } if (minmax[0] > 0) minmax[0] = 0.0d; minX = minmax[0]; maxX = minmax[1] + minmax[1] * 0.1; int base = 1; double[] divisions = new double[] { 0.5, 1, 2, 2.5, 5 }; while (true) { for (int d = 0; d < divisions.length; d++) { double tester = base * divisions[d]; if (maxX / tester <= 10) { xInterval = tester; } } base *= 10; } label.setHorizontalAlignment(JLabel.CENTER); label.setOpaque(true); label.setBackground(Color.WHITE); label.setBorder(UIManager.getBorder("ToolTip.border")); if (!GraphicsEnvironment.isHeadless()) { toolTip = new JWindow(); toolTip.add(label); tipster = new Tipster(this); addMouseMotionListener(tipster); } setOpaque(true); }
private void initialise(double[] data, double[] xCategories, String[] toolTipLabels, String xLabel, String yLabel, String graphTitle) { this.data = data; this.xCategories = xCategories; this.toolTipLabels = toolTipLabels; this.xLabel = xLabel; this.yLabel = yLabel; this.graphTitle = graphTitle; double[] minmax = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; if (this.data.length == 1) { if (this.data[0] >= 0) { minmax[0] = 0.0d; minmax[1] = this.data[0]; } else { minmax[0] = this.data[0]; minmax[1] = 0.0d; } return; } for (int i = 0; i < this.data.length; i++) { if (minmax[0] > this.data[i]) { minmax[0] = this.data[i]; } else if (minmax[1] < this.data[i]) { minmax[1] = this.data[i]; } } if (minmax[0] > 0) minmax[0] = 0.0d; minY = minmax[0]; maxY = minmax[1] + minmax[1] * 0.1; int base = 1; double[] divisions = new double[] { 0.5, 1, 2, 2.5, 5 }; while (true) { for (int d = 0; d < divisions.length; d++) { double tester = base * divisions[d]; if (maxY / tester <= 10) { yInterval = tester; } } base *= 10; } minmax = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; if (this.xCategories.length == 1) { if (this.xCategories[0] >= 0) { minmax[0] = 0.0d; minmax[1] = this.xCategories[0]; } else { minmax[0] = this.xCategories[0]; minmax[1] = 0.0d; } return; } for (int i = 0; i < this.xCategories.length; i++) { if (minmax[0] > this.xCategories[i]) { minmax[0] = this.xCategories[i]; } else if (minmax[1] < this.xCategories[i]) { minmax[1] = this.xCategories[i]; } } if (minmax[0] > 0) minmax[0] = 0.0d; minX = minmax[0]; maxX = minmax[1] + minmax[1] * 0.1; <DeepExtract> int base = 1; double[] divisions = new double[] { 0.5, 1, 2, 2.5, 5 }; while (true) { for (int d = 0; d < divisions.length; d++) { double tester = base * divisions[d]; if (maxX / tester <= 10) { xInterval = tester; } } base *= 10; } </DeepExtract> label.setHorizontalAlignment(JLabel.CENTER); label.setOpaque(true); label.setBackground(Color.WHITE); label.setBorder(UIManager.getBorder("ToolTip.border")); if (!GraphicsEnvironment.isHeadless()) { toolTip = new JWindow(); toolTip.add(label); tipster = new Tipster(this); addMouseMotionListener(tipster); } setOpaque(true); }
BamQC
positive
2,098
public void read(org.apache.thrift.protocol.TProtocol iprot, add_args struct) throws org.apache.thrift.TException { iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch(schemeField.id) { case 1: if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.user = new User(); struct.user.read(iprot); struct.setUserIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); if (user != null) { user.validate(); } }
public void read(org.apache.thrift.protocol.TProtocol iprot, add_args struct) throws org.apache.thrift.TException { iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch(schemeField.id) { case 1: if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.user = new User(); struct.user.read(iprot); struct.setUserIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); <DeepExtract> if (user != null) { user.validate(); } </DeepExtract> }
thrift-example
positive
2,099
protected void selectOverflowIcon() { if (mCard == null) return; CardHeader header = mCard.getCardHeader(); if (header != null) { this.selected = true; header.setOverflowSelected(true); } CardView cardView = mCard.getCardView(); if (cardView != null) { if (cardView.getInternalHeaderLayout() != null && cardView.getInternalHeaderLayout().getImageButtonOverflow() != null) cardView.getInternalHeaderLayout().getImageButtonOverflow().setSelected(true); } }
protected void selectOverflowIcon() { <DeepExtract> if (mCard == null) return; CardHeader header = mCard.getCardHeader(); if (header != null) { this.selected = true; header.setOverflowSelected(true); } CardView cardView = mCard.getCardView(); if (cardView != null) { if (cardView.getInternalHeaderLayout() != null && cardView.getInternalHeaderLayout().getImageButtonOverflow() != null) cardView.getInternalHeaderLayout().getImageButtonOverflow().setSelected(true); } </DeepExtract> }
BabySay
positive
2,100
public Set<R> modifiableSet() { TreeSet<R> copy = new TreeSet<R>(set.comparator()); for (R range : set) { add(range); } return copy; }
public Set<R> modifiableSet() { TreeSet<R> copy = new TreeSet<R>(set.comparator()); <DeepExtract> for (R range : set) { add(range); } </DeepExtract> return copy; }
commons-ip-math
positive
2,101
public static void setTranslucentForImageViewInFragment(Activity activity, int statusBarAlpha, View needOffsetView) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return; } setTransparentForWindow(activity); addTranslucentView(activity, statusBarAlpha); if (needOffsetView != null) { Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET); if (haveSetOffset != null && (Boolean) haveSetOffset) { return; } ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin); needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { clearPreviousSetting(activity); } }
public static void setTranslucentForImageViewInFragment(Activity activity, int statusBarAlpha, View needOffsetView) { <DeepExtract> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return; } setTransparentForWindow(activity); addTranslucentView(activity, statusBarAlpha); if (needOffsetView != null) { Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET); if (haveSetOffset != null && (Boolean) haveSetOffset) { return; } ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin); needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true); } </DeepExtract> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { clearPreviousSetting(activity); } }
AndroidRapidDevelopLibrarys
positive
2,102
static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(CLContext context, B directBuffer, int flags, int glObject) { CLGLBuffer.checkBuffer(directBuffer, flags); CL cl = getCL(context); int[] result = new int[1]; CLGL clgli = (CLGL) cl; long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, glObject, result, 0); CLImageInfoAccessor accessor = new CLImageInfoAccessor(getCL(context), id); CLImageFormat format = createUninitializedImageFormat(); accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); int width = (int) accessor.getLong(CL_IMAGE_WIDTH); int height = (int) accessor.getLong(CL_IMAGE_HEIGHT); return new CLGLImage2d<B>(context, directBuffer, format, accessor, width, height, id, glObject, flags); }
static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(CLContext context, B directBuffer, int flags, int glObject) { CLGLBuffer.checkBuffer(directBuffer, flags); CL cl = getCL(context); int[] result = new int[1]; CLGL clgli = (CLGL) cl; long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, glObject, result, 0); <DeepExtract> CLImageInfoAccessor accessor = new CLImageInfoAccessor(getCL(context), id); CLImageFormat format = createUninitializedImageFormat(); accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); int width = (int) accessor.getLong(CL_IMAGE_WIDTH); int height = (int) accessor.getLong(CL_IMAGE_HEIGHT); return new CLGLImage2d<B>(context, directBuffer, format, accessor, width, height, id, glObject, flags); </DeepExtract> }
jocl
positive
2,103
public SearchResponse matchQuery(MatchEntity entity) throws Exception { SearchRequest searchRequest = new SearchRequest(entity.getIndexName()); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().trackTotalHits(true); for (Map.Entry<String, Object> m : entity.getMap().entrySet()) { if (StringUtils.isNotEmpty(m.getKey()) && m.getValue() != null) { String key = m.getKey(); String value = String.valueOf(m.getValue()); searchSourceBuilder.query(QueryBuilders.matchQuery(key, value)); } } searchSourceBuilder.highlighter(SearchTools.getHighlightBuilder(entity.getHighlight())); searchSourceBuilder.from(entity.getFrom()); searchSourceBuilder.size(entity.getPageSize()); searchRequest.source(searchSourceBuilder); searchResponse = client.search(searchRequest, RequestOptions.DEFAULT); SearchTools.setHighResultForClientUI(searchResponse, entity.getHighlight()); return searchResponse; }
public SearchResponse matchQuery(MatchEntity entity) throws Exception { SearchRequest searchRequest = new SearchRequest(entity.getIndexName()); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().trackTotalHits(true); <DeepExtract> for (Map.Entry<String, Object> m : entity.getMap().entrySet()) { if (StringUtils.isNotEmpty(m.getKey()) && m.getValue() != null) { String key = m.getKey(); String value = String.valueOf(m.getValue()); searchSourceBuilder.query(QueryBuilders.matchQuery(key, value)); } } </DeepExtract> searchSourceBuilder.highlighter(SearchTools.getHighlightBuilder(entity.getHighlight())); searchSourceBuilder.from(entity.getFrom()); searchSourceBuilder.size(entity.getPageSize()); searchRequest.source(searchSourceBuilder); searchResponse = client.search(searchRequest, RequestOptions.DEFAULT); SearchTools.setHighResultForClientUI(searchResponse, entity.getHighlight()); return searchResponse; }
spring-cloud-alibaba
positive
2,104
@Override public Collection<CacheObject<V>> values() { if (validTime == -1) { return 0; } int count = 0; for (Entry<K, CacheObject<V>> entry : cache.entrySet()) { if (entry != null && isExpired(entry.getValue())) { cache.remove(entry.getKey()); count++; } } return count; return cache.values(); }
@Override public Collection<CacheObject<V>> values() { <DeepExtract> if (validTime == -1) { return 0; } int count = 0; for (Entry<K, CacheObject<V>> entry : cache.entrySet()) { if (entry != null && isExpired(entry.getValue())) { cache.remove(entry.getKey()); count++; } } return count; </DeepExtract> return cache.values(); }
android-common
positive
2,105
public boolean block(int i, int x, int y) { int hi = 0; while (i != father[i]) { help[hi++] = i; i = father[i]; } for (hi--; hi >= 0; hi--) { father[help[hi]] = i; } return i; return (xmin[i] <= 0 && xmax[i] >= x) || (ymin[i] <= 0 && ymax[i] >= y) || (xmin[i] <= 0 && ymin[i] <= 0) || (xmax[i] >= x && ymax[i] >= y); }
public boolean block(int i, int x, int y) { <DeepExtract> int hi = 0; while (i != father[i]) { help[hi++] = i; i = father[i]; } for (hi--; hi >= 0; hi--) { father[help[hi]] = i; } return i; </DeepExtract> return (xmin[i] <= 0 && xmax[i] >= x) || (ymin[i] <= 0 && ymax[i] >= y) || (xmin[i] <= 0 && ymin[i] <= 0) || (xmax[i] >= x && ymax[i] >= y); }
publicclass2020
positive
2,107
public void addToHome(UserApp app) { Factor factor = app.toFactor(); userFactors.add(factor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) factor.setShortcuts(getShortcutsFromFactor(factor)); factor.setOrder(userFactors.indexOf(factor)); new Thread(() -> { daoReference.insert(factor); adapter.addFactorBroadcast(userFactors.indexOf(factor)); adapter.activity.runOnUiThread(() -> adapter.notifyItemInserted(factor.getOrder())); }).start(); new Thread(() -> { for (Factor f : userFactors) { f.setOrder(userFactors.indexOf(f)); daoReference.updateFactorOrder(f.getPackageName(), f.getOrder()); } }).start(); }
public void addToHome(UserApp app) { Factor factor = app.toFactor(); userFactors.add(factor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) factor.setShortcuts(getShortcutsFromFactor(factor)); factor.setOrder(userFactors.indexOf(factor)); new Thread(() -> { daoReference.insert(factor); adapter.addFactorBroadcast(userFactors.indexOf(factor)); adapter.activity.runOnUiThread(() -> adapter.notifyItemInserted(factor.getOrder())); }).start(); <DeepExtract> new Thread(() -> { for (Factor f : userFactors) { f.setOrder(userFactors.indexOf(f)); daoReference.updateFactorOrder(f.getPackageName(), f.getOrder()); } }).start(); </DeepExtract> }
Factor_Launcher_Reboot
positive
2,108
public void writeString(String str) { FsService.writeMonitor(false, str); try { strBytes = str.getBytes(encoding); } catch (UnsupportedEncodingException e) { Log.e(TAG, "Unsupported encoding: " + encoding); strBytes = str.getBytes(); } try { BufferedOutputStream out = new BufferedOutputStream(cmdSocket.getOutputStream(), Defaults.dataChunkSize); out.write(strBytes); out.flush(); localDataSocket.reportTraffic(strBytes.length); } catch (IOException e) { Log.i(TAG, "Exception writing socket"); closeSocket(); return; } }
public void writeString(String str) { FsService.writeMonitor(false, str); try { strBytes = str.getBytes(encoding); } catch (UnsupportedEncodingException e) { Log.e(TAG, "Unsupported encoding: " + encoding); strBytes = str.getBytes(); } <DeepExtract> try { BufferedOutputStream out = new BufferedOutputStream(cmdSocket.getOutputStream(), Defaults.dataChunkSize); out.write(strBytes); out.flush(); localDataSocket.reportTraffic(strBytes.length); } catch (IOException e) { Log.i(TAG, "Exception writing socket"); closeSocket(); return; } </DeepExtract> }
iTransfer
positive
2,109
@SuppressWarnings("rawtypes") @Override public List getSerListFromCtObjChart(final Object ctObjChart) { if (ctObjChart instanceof CTPieChart) { return ((CTPieChart) ctObjChart).getSerList(); } return emptySerlist; }
@SuppressWarnings("rawtypes") @Override public List getSerListFromCtObjChart(final Object ctObjChart) { if (ctObjChart instanceof CTPieChart) { return ((CTPieChart) ctObjChart).getSerList(); } <DeepExtract> return emptySerlist; </DeepExtract> }
TieFaces
positive
2,111
public SoMap toKebabCase() { SoMap so = new SoMap(); for (String key : this.keySet()) { so.set(wordEachKebabCase(key), this.get(key)); } if (so != null) { for (String key : so.keySet()) { this.set(key, so.get(key)); } } return this; return this; }
public SoMap toKebabCase() { SoMap so = new SoMap(); for (String key : this.keySet()) { so.set(wordEachKebabCase(key), this.get(key)); } <DeepExtract> if (so != null) { for (String key : so.keySet()) { this.set(key, so.get(key)); } } return this; </DeepExtract> return this; }
sa-plus
positive
2,113
@Override public void onAnimationRepeat(Animation animation) { mStartingStartTrim = mStartTrim; mStartingEndTrim = mEndTrim; mStartingRotation = mRotation; mColorIndex = (mColorIndex + 1) % (mColors.length); mStartTrim = ring.getEndTrim(); invalidateSelf(); if (mFinishing) { mFinishing = false; animation.setDuration(ANIMATION_DURATION); ring.setShowArrow(false); } else { mRotationCount = (mRotationCount + 1) % (NUM_POINTS); } }
@Override public void onAnimationRepeat(Animation animation) { mStartingStartTrim = mStartTrim; mStartingEndTrim = mEndTrim; mStartingRotation = mRotation; mColorIndex = (mColorIndex + 1) % (mColors.length); <DeepExtract> mStartTrim = ring.getEndTrim(); invalidateSelf(); </DeepExtract> if (mFinishing) { mFinishing = false; animation.setDuration(ANIMATION_DURATION); ring.setShowArrow(false); } else { mRotationCount = (mRotationCount + 1) % (NUM_POINTS); } }
Keep_Nice
positive
2,114
public void preRunConfigure(Double sigmaThreshold, Granularity granularity, Integer granularityRange) { if (p == null) { log.error("Egads properties have not been set! Attempting to load from file."); p = DetectorConfig.fromFile(); if (p == null) { init(); } } p.setProperty("AUTO_SENSITIVITY_SD", sigmaThreshold.toString()); String window1 = "1", window2 = "1"; switch(granularity) { case MINUTE: window2 = String.valueOf(Math.round(60.0f / granularityRange)); break; case HOUR: window1 = String.valueOf(Math.round(24.0f / granularityRange)); window2 = String.valueOf(Math.round(168.0f / granularityRange)); break; case DAY: window2 = String.valueOf(Math.round(7.0f / granularityRange)); break; case WEEK: window2 = String.valueOf(Math.round(4.0f / granularityRange)); break; case MONTH: window2 = String.valueOf(Math.round(12.0f / granularityRange)); p.setProperty("PERIOD", "-1"); break; default: break; } p.setProperty(BASE_WINDOWS, window1 + Constants.COMMA_DELIMITER + window2); log.info("Updated BASE_WINDOWS: {}", p.getProperty(BASE_WINDOWS)); if (p != null && p.getProperty(DetectorConfig.AD_MODEL).equals(DetectorConfig.AnomalyDetectionModel.NaiveModel.toString())) { p.setProperty(THRESHOLD, THRESHOLD_VAL); } }
public void preRunConfigure(Double sigmaThreshold, Granularity granularity, Integer granularityRange) { if (p == null) { log.error("Egads properties have not been set! Attempting to load from file."); p = DetectorConfig.fromFile(); if (p == null) { init(); } } p.setProperty("AUTO_SENSITIVITY_SD", sigmaThreshold.toString()); String window1 = "1", window2 = "1"; switch(granularity) { case MINUTE: window2 = String.valueOf(Math.round(60.0f / granularityRange)); break; case HOUR: window1 = String.valueOf(Math.round(24.0f / granularityRange)); window2 = String.valueOf(Math.round(168.0f / granularityRange)); break; case DAY: window2 = String.valueOf(Math.round(7.0f / granularityRange)); break; case WEEK: window2 = String.valueOf(Math.round(4.0f / granularityRange)); break; case MONTH: window2 = String.valueOf(Math.round(12.0f / granularityRange)); p.setProperty("PERIOD", "-1"); break; default: break; } p.setProperty(BASE_WINDOWS, window1 + Constants.COMMA_DELIMITER + window2); log.info("Updated BASE_WINDOWS: {}", p.getProperty(BASE_WINDOWS)); <DeepExtract> if (p != null && p.getProperty(DetectorConfig.AD_MODEL).equals(DetectorConfig.AnomalyDetectionModel.NaiveModel.toString())) { p.setProperty(THRESHOLD, THRESHOLD_VAL); } </DeepExtract> }
sherlock
positive
2,115
public static Bitmap scaleImageTo(Bitmap org, int newWidth, int newHeight) { if (org == null) { return null; } Matrix matrix = new Matrix(); matrix.postScale((float) newWidth / org.getWidth(), (float) newHeight / org.getHeight()); return Bitmap.createBitmap(org, 0, 0, org.getWidth(), org.getHeight(), matrix, true); }
public static Bitmap scaleImageTo(Bitmap org, int newWidth, int newHeight) { <DeepExtract> if (org == null) { return null; } Matrix matrix = new Matrix(); matrix.postScale((float) newWidth / org.getWidth(), (float) newHeight / org.getHeight()); return Bitmap.createBitmap(org, 0, 0, org.getWidth(), org.getHeight(), matrix, true); </DeepExtract> }
BaiSiBuDeLi
positive
2,116
public static void toggleCombatMenuShown() { COMBAT_MENU_SHOWN.put(currentProfile, !COMBAT_MENU_SHOWN.get(currentProfile)); if (COMBAT_MENU_SHOWN.get(currentProfile)) { Client.displayMessage("@cya@Combat style is now shown", Client.CHAT_NONE); } else { Client.displayMessage("@cya@Combat style is now hidden", Client.CHAT_NONE); } updateInjectedVariables(); if (currentProfile.equals("custom")) { save("custom"); } }
public static void toggleCombatMenuShown() { COMBAT_MENU_SHOWN.put(currentProfile, !COMBAT_MENU_SHOWN.get(currentProfile)); if (COMBAT_MENU_SHOWN.get(currentProfile)) { Client.displayMessage("@cya@Combat style is now shown", Client.CHAT_NONE); } else { Client.displayMessage("@cya@Combat style is now hidden", Client.CHAT_NONE); } <DeepExtract> updateInjectedVariables(); if (currentProfile.equals("custom")) { save("custom"); } </DeepExtract> }
rscplus
positive
2,117
@Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { switch(RomUtils.getRomName()) { case RomUtils.ROM_MIUI: applyMiuiPermission(context); break; case RomUtils.ROM_EMUI: applyHuaweiPermission(context); break; case RomUtils.ROM_VIVO: applyVivoPermission(context); break; case RomUtils.ROM_OPPO: applyOppoPermission(context); break; case RomUtils.ROM_QIKU: apply360Permission(context); break; case RomUtils.ROM_SMARTISAN: applySmartisanPermission(context); break; case RomUtils.ROM_COOLPAD: applyCoolpadPermission(context); break; case RomUtils.ROM_ZTE: applyZTEPermission(context); break; case RomUtils.ROM_LENOVO: applyLenovoPermission(context); break; case RomUtils.ROM_LETV: applyLetvPermission(context); break; default: Toast.makeText(context, TOAST_HINT, Toast.LENGTH_LONG).show(); } } else { if (RomUtils.isMeizuRom()) { applyMeizuPermission(context); } else { applyCommonPermission(context); } } dialog.dismiss(); }
@Override public void onClick(DialogInterface dialog, int which) { <DeepExtract> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { switch(RomUtils.getRomName()) { case RomUtils.ROM_MIUI: applyMiuiPermission(context); break; case RomUtils.ROM_EMUI: applyHuaweiPermission(context); break; case RomUtils.ROM_VIVO: applyVivoPermission(context); break; case RomUtils.ROM_OPPO: applyOppoPermission(context); break; case RomUtils.ROM_QIKU: apply360Permission(context); break; case RomUtils.ROM_SMARTISAN: applySmartisanPermission(context); break; case RomUtils.ROM_COOLPAD: applyCoolpadPermission(context); break; case RomUtils.ROM_ZTE: applyZTEPermission(context); break; case RomUtils.ROM_LENOVO: applyLenovoPermission(context); break; case RomUtils.ROM_LETV: applyLetvPermission(context); break; default: Toast.makeText(context, TOAST_HINT, Toast.LENGTH_LONG).show(); } } else { if (RomUtils.isMeizuRom()) { applyMeizuPermission(context); } else { applyCommonPermission(context); } } </DeepExtract> dialog.dismiss(); }
ndileber
positive
2,119
@Deprecated public void setColorScheme(@ColorRes int... colors) { final Context context = getContext(); int[] colorRes = new int[colors.length]; for (int i = 0; i < colors.length; i++) { colorRes[i] = ContextCompat.getColor(context, colors[i]); } setColorSchemeColors(colorRes); }
@Deprecated public void setColorScheme(@ColorRes int... colors) { <DeepExtract> final Context context = getContext(); int[] colorRes = new int[colors.length]; for (int i = 0; i < colors.length; i++) { colorRes[i] = ContextCompat.getColor(context, colors[i]); } setColorSchemeColors(colorRes); </DeepExtract> }
SamsungOneUi
positive
2,120
public void testValuesRemoveAll() { try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { return; } Collection<V> valueCollection = map.values(); Set<V> valuesToRemove = singleton(valueCollection.iterator().next()); if (supportsRemove) { valueCollection.removeAll(valuesToRemove); for (V value : valuesToRemove) { assertTrue(!valueCollection.contains(value)); } for (V value : valueCollection) { assertTrue(!valuesToRemove.contains(value)); } } else { try { valueCollection.removeAll(valuesToRemove); fail("Expected UnsupportedOperationException."); } catch (UnsupportedOperationException e) { } } Set<K> keySet = map.keySet(); Collection<V> valueCollection = map.values(); Set<Entry<K, V>> entrySet = map.entrySet(); assertEquals(map.size() == 0, map.isEmpty()); assertEquals(map.size(), keySet.size()); assertEquals(keySet.size() == 0, keySet.isEmpty()); assertEquals(!keySet.isEmpty(), keySet.iterator().hasNext()); int expectedKeySetHash = 0; for (K key : keySet) { V value = map.get(key); expectedKeySetHash += key != null ? key.hashCode() : 0; assertTrue(map.containsKey(key)); assertTrue(map.containsValue(value)); assertTrue(valueCollection.contains(value)); assertTrue(valueCollection.containsAll(Collections.singleton(value))); assertTrue(entrySet.contains(mapEntry(key, value))); assertTrue(allowsNullKeys || (key != null)); } assertEquals(expectedKeySetHash, keySet.hashCode()); assertEquals(map.size(), valueCollection.size()); assertEquals(valueCollection.size() == 0, valueCollection.isEmpty()); assertEquals(!valueCollection.isEmpty(), valueCollection.iterator().hasNext()); for (V value : valueCollection) { assertTrue(map.containsValue(value)); assertTrue(allowsNullValues || (value != null)); } assertEquals(map.size(), entrySet.size()); assertEquals(entrySet.size() == 0, entrySet.isEmpty()); assertEquals(!entrySet.isEmpty(), entrySet.iterator().hasNext()); assertTrue(!entrySet.contains("foo")); boolean supportsValuesHashCode = supportsValuesHashCode(map); if (supportsValuesHashCode) { int expectedEntrySetHash = 0; for (Entry<K, V> entry : entrySet) { assertTrue(map.containsKey(entry.getKey())); assertTrue(map.containsValue(entry.getValue())); int expectedHash = (entry.getKey() == null ? 0 : entry.getKey().hashCode()) ^ (entry.getValue() == null ? 0 : entry.getValue().hashCode()); assertEquals(expectedHash, entry.hashCode()); expectedEntrySetHash += expectedHash; } assertEquals(expectedEntrySetHash, entrySet.hashCode()); assertTrue(entrySet.containsAll(new HashSet<Entry<K, V>>(entrySet))); assertTrue(entrySet.equals(new HashSet<Entry<K, V>>(entrySet))); } Object[] entrySetToArray1 = entrySet.toArray(); assertEquals(map.size(), entrySetToArray1.length); assertTrue(Arrays.asList(entrySetToArray1).containsAll(entrySet)); Entry<?, ?>[] entrySetToArray2 = new Entry<?, ?>[map.size() + 2]; entrySetToArray2[map.size()] = mapEntry("foo", 1); assertSame(entrySetToArray2, entrySet.toArray(entrySetToArray2)); assertNull(entrySetToArray2[map.size()]); assertTrue(Arrays.asList(entrySetToArray2).containsAll(entrySet)); Object[] valuesToArray1 = valueCollection.toArray(); assertEquals(map.size(), valuesToArray1.length); assertTrue(Arrays.asList(valuesToArray1).containsAll(valueCollection)); Object[] valuesToArray2 = new Object[map.size() + 2]; valuesToArray2[map.size()] = "foo"; assertSame(valuesToArray2, valueCollection.toArray(valuesToArray2)); assertNull(valuesToArray2[map.size()]); assertTrue(Arrays.asList(valuesToArray2).containsAll(valueCollection)); if (supportsValuesHashCode) { int expectedHash = 0; for (Entry<K, V> entry : entrySet) { expectedHash += entry.hashCode(); } assertEquals(expectedHash, map.hashCode()); } assertMoreInvariants(map); }
public void testValuesRemoveAll() { try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { return; } Collection<V> valueCollection = map.values(); Set<V> valuesToRemove = singleton(valueCollection.iterator().next()); if (supportsRemove) { valueCollection.removeAll(valuesToRemove); for (V value : valuesToRemove) { assertTrue(!valueCollection.contains(value)); } for (V value : valueCollection) { assertTrue(!valuesToRemove.contains(value)); } } else { try { valueCollection.removeAll(valuesToRemove); fail("Expected UnsupportedOperationException."); } catch (UnsupportedOperationException e) { } } <DeepExtract> Set<K> keySet = map.keySet(); Collection<V> valueCollection = map.values(); Set<Entry<K, V>> entrySet = map.entrySet(); assertEquals(map.size() == 0, map.isEmpty()); assertEquals(map.size(), keySet.size()); assertEquals(keySet.size() == 0, keySet.isEmpty()); assertEquals(!keySet.isEmpty(), keySet.iterator().hasNext()); int expectedKeySetHash = 0; for (K key : keySet) { V value = map.get(key); expectedKeySetHash += key != null ? key.hashCode() : 0; assertTrue(map.containsKey(key)); assertTrue(map.containsValue(value)); assertTrue(valueCollection.contains(value)); assertTrue(valueCollection.containsAll(Collections.singleton(value))); assertTrue(entrySet.contains(mapEntry(key, value))); assertTrue(allowsNullKeys || (key != null)); } assertEquals(expectedKeySetHash, keySet.hashCode()); assertEquals(map.size(), valueCollection.size()); assertEquals(valueCollection.size() == 0, valueCollection.isEmpty()); assertEquals(!valueCollection.isEmpty(), valueCollection.iterator().hasNext()); for (V value : valueCollection) { assertTrue(map.containsValue(value)); assertTrue(allowsNullValues || (value != null)); } assertEquals(map.size(), entrySet.size()); assertEquals(entrySet.size() == 0, entrySet.isEmpty()); assertEquals(!entrySet.isEmpty(), entrySet.iterator().hasNext()); assertTrue(!entrySet.contains("foo")); boolean supportsValuesHashCode = supportsValuesHashCode(map); if (supportsValuesHashCode) { int expectedEntrySetHash = 0; for (Entry<K, V> entry : entrySet) { assertTrue(map.containsKey(entry.getKey())); assertTrue(map.containsValue(entry.getValue())); int expectedHash = (entry.getKey() == null ? 0 : entry.getKey().hashCode()) ^ (entry.getValue() == null ? 0 : entry.getValue().hashCode()); assertEquals(expectedHash, entry.hashCode()); expectedEntrySetHash += expectedHash; } assertEquals(expectedEntrySetHash, entrySet.hashCode()); assertTrue(entrySet.containsAll(new HashSet<Entry<K, V>>(entrySet))); assertTrue(entrySet.equals(new HashSet<Entry<K, V>>(entrySet))); } Object[] entrySetToArray1 = entrySet.toArray(); assertEquals(map.size(), entrySetToArray1.length); assertTrue(Arrays.asList(entrySetToArray1).containsAll(entrySet)); Entry<?, ?>[] entrySetToArray2 = new Entry<?, ?>[map.size() + 2]; entrySetToArray2[map.size()] = mapEntry("foo", 1); assertSame(entrySetToArray2, entrySet.toArray(entrySetToArray2)); assertNull(entrySetToArray2[map.size()]); assertTrue(Arrays.asList(entrySetToArray2).containsAll(entrySet)); Object[] valuesToArray1 = valueCollection.toArray(); assertEquals(map.size(), valuesToArray1.length); assertTrue(Arrays.asList(valuesToArray1).containsAll(valueCollection)); Object[] valuesToArray2 = new Object[map.size() + 2]; valuesToArray2[map.size()] = "foo"; assertSame(valuesToArray2, valueCollection.toArray(valuesToArray2)); assertNull(valuesToArray2[map.size()]); assertTrue(Arrays.asList(valuesToArray2).containsAll(valueCollection)); if (supportsValuesHashCode) { int expectedHash = 0; for (Entry<K, V> entry : entrySet) { expectedHash += entry.hashCode(); } assertEquals(expectedHash, map.hashCode()); } assertMoreInvariants(map); </DeepExtract> }
JDBM3
positive
2,122
public String listVolumes() throws NotAuthorizedException, NotFoundException, ServerException, ServiceUnAvailableOrInternalError, IOException, MalformedURLException, ProtocolException, ParseException, CertificateException { String gapiver = U.getGlanceEndpointAPIVER(); String napiver = U.getNeutronEndpointAPIVER(); if (U.getVerifyServerCert()) { X509Certificate cert = null; cert = (X509Certificate) (CertificateFactory.getInstance("X.509")).generateCertificate(new FileInputStream(U.getCAFile())); if (RESTClient.checkServerCert(U.getIdentityEndpoint(), cert.getIssuerX500Principal().getName()) == false) throw new CertificateException("Couldn't verify server's certificate. Please verify the correct CA selected."); } long exp_time = U.getTokenExpireTime(); if (exp_time <= Utils.now() + 5) { String payload = null; if (U.useV3()) payload = "{ \"auth\": { \"identity\": { \"methods\": [\"password\"],\"password\": { \"user\": { \"name\": \"" + U.getUserName() + "\",\"domain\": { \"id\": \"default\" }, \"password\": \"" + U.getPassword() + "\" } } }, \"scope\": { \"project\": { \"name\": \"" + U.getTenantName() + "\", \"domain\": { \"id\": \"default\" } }}}}"; else payload = "{\"auth\": {\"tenantName\": \"" + U.getTenantName() + "\", \"passwordCredentials\": {\"username\": \"" + U.getUserName() + "\", \"password\": \"" + U.getPassword() + "\"}}}"; String identityEP = U.getIdentityEndpoint(); if (U.useV3()) identityEP += "/auth"; identityEP += "/tokens"; Pair<String, String> jsonBuffer_Token = RESTClient.requestToken(U.useSSL(), identityEP, payload); String pwd = U.getPassword(); String edp = U.getIdentityEndpoint(); boolean ssl = U.useSSL(); boolean verifyServerCert = U.getVerifyServerCert(); String CAFile = U.getCAFile(); U = User.parse(jsonBuffer_Token.first, U.useV3(), jsonBuffer_Token.second); U.setPassword(pwd); U.setSSL(ssl); U.setCAFile(CAFile); U.setGlanceEndpointAPIVER(gapiver); U.setNeutronEndpointAPIVER(napiver); U.toFile(Configuration.getInstance().getValue("FILESDIR", Defaults.DEFAULTFILESDIR)); } String cinderEP = null; if (U.getCinder2Endpoint() != null) cinderEP = U.getCinder2Endpoint(); else cinderEP = U.getCinder1Endpoint(); Vector<Pair<String, String>> vp = new Vector<Pair<String, String>>(); Pair<String, String> p = new Pair<String, String>("X-Auth-Project-Id", U.getTenantName()); vp.add(p); return RESTClient.sendGETRequest(U.useSSL(), cinderEP + "/volumes/detail", U.getToken(), vp); }
public String listVolumes() throws NotAuthorizedException, NotFoundException, ServerException, ServiceUnAvailableOrInternalError, IOException, MalformedURLException, ProtocolException, ParseException, CertificateException { <DeepExtract> String gapiver = U.getGlanceEndpointAPIVER(); String napiver = U.getNeutronEndpointAPIVER(); if (U.getVerifyServerCert()) { X509Certificate cert = null; cert = (X509Certificate) (CertificateFactory.getInstance("X.509")).generateCertificate(new FileInputStream(U.getCAFile())); if (RESTClient.checkServerCert(U.getIdentityEndpoint(), cert.getIssuerX500Principal().getName()) == false) throw new CertificateException("Couldn't verify server's certificate. Please verify the correct CA selected."); } long exp_time = U.getTokenExpireTime(); if (exp_time <= Utils.now() + 5) { String payload = null; if (U.useV3()) payload = "{ \"auth\": { \"identity\": { \"methods\": [\"password\"],\"password\": { \"user\": { \"name\": \"" + U.getUserName() + "\",\"domain\": { \"id\": \"default\" }, \"password\": \"" + U.getPassword() + "\" } } }, \"scope\": { \"project\": { \"name\": \"" + U.getTenantName() + "\", \"domain\": { \"id\": \"default\" } }}}}"; else payload = "{\"auth\": {\"tenantName\": \"" + U.getTenantName() + "\", \"passwordCredentials\": {\"username\": \"" + U.getUserName() + "\", \"password\": \"" + U.getPassword() + "\"}}}"; String identityEP = U.getIdentityEndpoint(); if (U.useV3()) identityEP += "/auth"; identityEP += "/tokens"; Pair<String, String> jsonBuffer_Token = RESTClient.requestToken(U.useSSL(), identityEP, payload); String pwd = U.getPassword(); String edp = U.getIdentityEndpoint(); boolean ssl = U.useSSL(); boolean verifyServerCert = U.getVerifyServerCert(); String CAFile = U.getCAFile(); U = User.parse(jsonBuffer_Token.first, U.useV3(), jsonBuffer_Token.second); U.setPassword(pwd); U.setSSL(ssl); U.setCAFile(CAFile); U.setGlanceEndpointAPIVER(gapiver); U.setNeutronEndpointAPIVER(napiver); U.toFile(Configuration.getInstance().getValue("FILESDIR", Defaults.DEFAULTFILESDIR)); } </DeepExtract> String cinderEP = null; if (U.getCinder2Endpoint() != null) cinderEP = U.getCinder2Endpoint(); else cinderEP = U.getCinder1Endpoint(); Vector<Pair<String, String>> vp = new Vector<Pair<String, String>>(); Pair<String, String> p = new Pair<String, String>("X-Auth-Project-Id", U.getTenantName()); vp.add(p); return RESTClient.sendGETRequest(U.useSSL(), cinderEP + "/volumes/detail", U.getToken(), vp); }
DroidStack
positive
2,123
public static int createProgram(final int vertexShader, final int pixelShader) throws GLException { final int program = glCreateProgram(); Log.d(TAG, "createProgram: ...program:" + program, new RuntimeException("sssss")); checkGlError("createProgram"); if (program == 0) { throw new RuntimeException("Could not create program"); } GLES20.glAttachShader(program, vertexShader); if (!BuildConfig.DEBUG) return; int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { } GLES20.glAttachShader(program, pixelShader); if (!BuildConfig.DEBUG) return; int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { } GLES20.glLinkProgram(program); final int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GL_LINK_STATUS, linkStatus, 0); if (!BuildConfig.DEBUG) return; int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { } if (linkStatus[0] != GL_TRUE) { GLES20.glDeleteProgram(program); throw new RuntimeException("Could not link program"); } return program; }
public static int createProgram(final int vertexShader, final int pixelShader) throws GLException { final int program = glCreateProgram(); Log.d(TAG, "createProgram: ...program:" + program, new RuntimeException("sssss")); checkGlError("createProgram"); if (program == 0) { throw new RuntimeException("Could not create program"); } GLES20.glAttachShader(program, vertexShader); <DeepExtract> if (!BuildConfig.DEBUG) return; int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { } </DeepExtract> GLES20.glAttachShader(program, pixelShader); <DeepExtract> if (!BuildConfig.DEBUG) return; int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { } </DeepExtract> GLES20.glLinkProgram(program); final int[] linkStatus = new int[1]; GLES20.glGetProgramiv(program, GL_LINK_STATUS, linkStatus, 0); <DeepExtract> if (!BuildConfig.DEBUG) return; int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { } </DeepExtract> if (linkStatus[0] != GL_TRUE) { GLES20.glDeleteProgram(program); throw new RuntimeException("Could not link program"); } return program; }
VideoClipEditViewTest
positive
2,124
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (mStatus == Status.CLOSE) { mTarget = mFrontView; } else { mTarget = mBehindView; } if (null == mTarget) { return false; } if (!isEnabled()) { return false; } final int aciton = MotionEventCompat.getActionMasked(ev); boolean shouldIntercept = false; switch(aciton) { case MotionEvent.ACTION_DOWN: { mInitMotionX = ev.getX(); mInitMotionY = ev.getY(); shouldIntercept = false; break; } case MotionEvent.ACTION_MOVE: { final float x = ev.getX(); final float y = ev.getY(); final float xDiff = x - mInitMotionX; final float yDiff = y - mInitMotionY; if (canChildScrollVertically((int) yDiff)) { shouldIntercept = false; } else { final float xDiffabs = Math.abs(xDiff); final float yDiffabs = Math.abs(yDiff); if (yDiffabs > mTouchSlop && yDiffabs >= xDiffabs && !(mStatus == Status.CLOSE && yDiff > 0 || mStatus == Status.OPEN && yDiff < 0)) { shouldIntercept = true; } } break; } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { shouldIntercept = false; break; } } return shouldIntercept; }
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { <DeepExtract> if (mStatus == Status.CLOSE) { mTarget = mFrontView; } else { mTarget = mBehindView; } </DeepExtract> if (null == mTarget) { return false; } if (!isEnabled()) { return false; } final int aciton = MotionEventCompat.getActionMasked(ev); boolean shouldIntercept = false; switch(aciton) { case MotionEvent.ACTION_DOWN: { mInitMotionX = ev.getX(); mInitMotionY = ev.getY(); shouldIntercept = false; break; } case MotionEvent.ACTION_MOVE: { final float x = ev.getX(); final float y = ev.getY(); final float xDiff = x - mInitMotionX; final float yDiff = y - mInitMotionY; if (canChildScrollVertically((int) yDiff)) { shouldIntercept = false; } else { final float xDiffabs = Math.abs(xDiff); final float yDiffabs = Math.abs(yDiff); if (yDiffabs > mTouchSlop && yDiffabs >= xDiffabs && !(mStatus == Status.CLOSE && yDiff > 0 || mStatus == Status.OPEN && yDiff < 0)) { shouldIntercept = true; } } break; } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { shouldIntercept = false; break; } } return shouldIntercept; }
shop-front-android
positive
2,125
public Criteria andCommentThreadIdIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "commentThreadId" + " cannot be null"); } criteria.add(new Criterion("comment_thread_id in", values)); return (Criteria) this; }
public Criteria andCommentThreadIdIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "commentThreadId" + " cannot be null"); } criteria.add(new Criterion("comment_thread_id in", values)); </DeepExtract> return (Criteria) this; }
ReptilianDemo
positive
2,126
public void createSync(@Nonnull final DeviceInfo deviceInfo, @Nonnull final String nativeLibraryPath) throws ProducerException { Preconditions.checkNotNull(deviceInfo); Preconditions.checkState(!isInitialized()); mDeviceInfo = deviceInfo; synchronized (mSyncObject) { if (!mLibraryInitialized) { initializeLibrary(nativeLibraryPath); mLibraryInitialized = true; } mClientHandle = createKinesisVideoClient(deviceInfo); } try { if (!mReadyLatch.await(KinesisVideoProducer.READY_TIMEOUT_IN_MILLISECONDS, TimeUnit.MILLISECONDS)) { throw new ProducerException("Kinesis Video producer creation time out", 0); } } catch (final InterruptedException ex) { throw new ProducerException(ex); } }
public void createSync(@Nonnull final DeviceInfo deviceInfo, @Nonnull final String nativeLibraryPath) throws ProducerException { <DeepExtract> Preconditions.checkNotNull(deviceInfo); Preconditions.checkState(!isInitialized()); mDeviceInfo = deviceInfo; synchronized (mSyncObject) { if (!mLibraryInitialized) { initializeLibrary(nativeLibraryPath); mLibraryInitialized = true; } mClientHandle = createKinesisVideoClient(deviceInfo); } </DeepExtract> try { if (!mReadyLatch.await(KinesisVideoProducer.READY_TIMEOUT_IN_MILLISECONDS, TimeUnit.MILLISECONDS)) { throw new ProducerException("Kinesis Video producer creation time out", 0); } } catch (final InterruptedException ex) { throw new ProducerException(ex); } }
amazon-kinesis-video-streams-producer-sdk-java
positive
2,128
@SuppressWarnings({ "unused", "WeakerAccess" }) public void debugl(String message) { Log.println(DEBUG, getTag(), message); }
@SuppressWarnings({ "unused", "WeakerAccess" }) public void debugl(String message) { <DeepExtract> Log.println(DEBUG, getTag(), message); </DeepExtract> }
weechat-android
positive
2,129
@Override public void handleArrowAction(Snipe snipe) { Block targetBlock = getTargetBlock(); ToolkitProperties toolkitProperties = snipe.getToolkitProperties(); SnipeMessenger messenger = snipe.createMessenger(); if (this.seedPercent < SEED_PERCENT_MIN || this.seedPercent > SEED_PERCENT_MAX) { messenger.sendMessage(ChatColor.BLUE + "Seed percent set to: 10%"); this.seedPercent = SEED_PERCENT_DEFAULT; } if (this.growPercent < GROW_PERCENT_MIN || this.growPercent > GROW_PERCENT_MAX) { messenger.sendMessage(ChatColor.BLUE + "Growth percent set to: 10%"); this.growPercent = GROW_PERCENT_DEFAULT; } if (this.splatterRecursions < SPLATTER_RECURSIONS_PERCENT_MIN || this.splatterRecursions > SPLATTER_RECURSIONS_PERCENT_MAX) { messenger.sendMessage(ChatColor.BLUE + "Recursions set to: 3"); this.splatterRecursions = SPLATTER_RECURSIONS_PERCENT_DEFAULT; } int brushSize = toolkitProperties.getBrushSize(); int[][][] splat = new int[2 * brushSize + 1][2 * brushSize + 1][2 * brushSize + 1]; for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { if (this.generator.nextInt(SEED_PERCENT_MAX + 1) <= this.seedPercent) { splat[x][y][z] = 1; } } } } int gref = this.growPercent; int[][][] tempSplat = new int[2 * brushSize + 1][2 * brushSize + 1][2 * brushSize + 1]; for (int r = 0; r < this.splatterRecursions; r++) { this.growPercent = gref - ((gref / this.splatterRecursions) * (r)); for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { tempSplat[x][y][z] = splat[x][y][z]; int growcheck = 0; if (splat[x][y][z] == 0) { if (x != 0 && splat[x - 1][y][z] == 1) { growcheck++; } if (y != 0 && splat[x][y - 1][z] == 1) { growcheck++; } if (z != 0 && splat[x][y][z - 1] == 1) { growcheck++; } if (x != 2 * brushSize && splat[x + 1][y][z] == 1) { growcheck++; } if (y != 2 * brushSize && splat[x][y + 1][z] == 1) { growcheck++; } if (z != 2 * brushSize && splat[x][y][z + 1] == 1) { growcheck++; } } if (growcheck >= 1 && this.generator.nextInt(GROW_PERCENT_MAX + 1) <= this.growPercent) { tempSplat[x][y][z] = 1; } } } } for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { if (2 * brushSize + 1 >= 0) { System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, 2 * brushSize + 1); } } } } this.growPercent = gref; for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { if (splat[Math.max(x - 1, 0)][y][z] == 1 && splat[Math.min(x + 1, 2 * brushSize)][y][z] == 1 && splat[x][Math.max(0, y - 1)][z] == 1 && splat[x][Math.min(2 * brushSize, y + 1)][z] == 1) { splat[x][y][z] = 1; } } } } for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { if (splat[x][y][z] == 1) { this.performer.perform(targetBlock.getRelative(-brushSize + x, -brushSize + z, -brushSize + y)); } } } } Sniper sniper = snipe.getSniper(); sniper.storeUndo(this.performer.getUndo()); }
@Override public void handleArrowAction(Snipe snipe) { Block targetBlock = getTargetBlock(); <DeepExtract> ToolkitProperties toolkitProperties = snipe.getToolkitProperties(); SnipeMessenger messenger = snipe.createMessenger(); if (this.seedPercent < SEED_PERCENT_MIN || this.seedPercent > SEED_PERCENT_MAX) { messenger.sendMessage(ChatColor.BLUE + "Seed percent set to: 10%"); this.seedPercent = SEED_PERCENT_DEFAULT; } if (this.growPercent < GROW_PERCENT_MIN || this.growPercent > GROW_PERCENT_MAX) { messenger.sendMessage(ChatColor.BLUE + "Growth percent set to: 10%"); this.growPercent = GROW_PERCENT_DEFAULT; } if (this.splatterRecursions < SPLATTER_RECURSIONS_PERCENT_MIN || this.splatterRecursions > SPLATTER_RECURSIONS_PERCENT_MAX) { messenger.sendMessage(ChatColor.BLUE + "Recursions set to: 3"); this.splatterRecursions = SPLATTER_RECURSIONS_PERCENT_DEFAULT; } int brushSize = toolkitProperties.getBrushSize(); int[][][] splat = new int[2 * brushSize + 1][2 * brushSize + 1][2 * brushSize + 1]; for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { if (this.generator.nextInt(SEED_PERCENT_MAX + 1) <= this.seedPercent) { splat[x][y][z] = 1; } } } } int gref = this.growPercent; int[][][] tempSplat = new int[2 * brushSize + 1][2 * brushSize + 1][2 * brushSize + 1]; for (int r = 0; r < this.splatterRecursions; r++) { this.growPercent = gref - ((gref / this.splatterRecursions) * (r)); for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { tempSplat[x][y][z] = splat[x][y][z]; int growcheck = 0; if (splat[x][y][z] == 0) { if (x != 0 && splat[x - 1][y][z] == 1) { growcheck++; } if (y != 0 && splat[x][y - 1][z] == 1) { growcheck++; } if (z != 0 && splat[x][y][z - 1] == 1) { growcheck++; } if (x != 2 * brushSize && splat[x + 1][y][z] == 1) { growcheck++; } if (y != 2 * brushSize && splat[x][y + 1][z] == 1) { growcheck++; } if (z != 2 * brushSize && splat[x][y][z + 1] == 1) { growcheck++; } } if (growcheck >= 1 && this.generator.nextInt(GROW_PERCENT_MAX + 1) <= this.growPercent) { tempSplat[x][y][z] = 1; } } } } for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { if (2 * brushSize + 1 >= 0) { System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, 2 * brushSize + 1); } } } } this.growPercent = gref; for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { if (splat[Math.max(x - 1, 0)][y][z] == 1 && splat[Math.min(x + 1, 2 * brushSize)][y][z] == 1 && splat[x][Math.max(0, y - 1)][z] == 1 && splat[x][Math.min(2 * brushSize, y + 1)][z] == 1) { splat[x][y][z] = 1; } } } } for (int x = 2 * brushSize; x >= 0; x--) { for (int y = 2 * brushSize; y >= 0; y--) { for (int z = 2 * brushSize; z >= 0; z--) { if (splat[x][y][z] == 1) { this.performer.perform(targetBlock.getRelative(-brushSize + x, -brushSize + z, -brushSize + y)); } } } } Sniper sniper = snipe.getSniper(); sniper.storeUndo(this.performer.getUndo()); </DeepExtract> }
FastAsyncVoxelSniper
positive
2,131
public View getVerticalScrollRepresentative() { int tallestHeight = 0; View tallestView = null; for (final View view : mViews) { final int height = view.getHeight(); if (height > tallestHeight) { tallestHeight = height; tallestView = view; } } return tallestView; }
public View getVerticalScrollRepresentative() { <DeepExtract> int tallestHeight = 0; View tallestView = null; for (final View view : mViews) { final int height = view.getHeight(); if (height > tallestHeight) { tallestHeight = height; tallestView = view; } } return tallestView; </DeepExtract> }
parchment
positive
2,132
public <T> T delete(Class<T> reqres) { HttpURLConnection conn = null; try { conn = initializeConnection(uri, "DELETE"); if (null != null) { prepareRequestEntity(null, conn); } return runRequest(uri, getJavaType(reqres), conn); } catch (IOException e) { return throwLocalException(e); } finally { IOUtils.disconnectQuietly(conn); } }
public <T> T delete(Class<T> reqres) { <DeepExtract> HttpURLConnection conn = null; try { conn = initializeConnection(uri, "DELETE"); if (null != null) { prepareRequestEntity(null, conn); } return runRequest(uri, getJavaType(reqres), conn); } catch (IOException e) { return throwLocalException(e); } finally { IOUtils.disconnectQuietly(conn); } </DeepExtract> }
intercom-java
positive
2,133
private void enableVpnService(@Nullable View view) { PreferenceHelper.setAbBlockMethod(requireContext(), UNDEFINED); this.binding.rootCardView.setCardBackgroundColor(this.cardColor); this.binding.vpnCardView.setCardBackgroundColor(this.cardColor); if (false) { blockNext(); new MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.welcome_root_missing_title).setMessage(R.string.welcome_root_missile_description).setPositiveButton(R.string.button_close, null).create().show(); } Context context = getContext(); if (context == null) { return; } Intent prepareIntent = VpnService.prepare(context); if (prepareIntent == null) { notifyVpnEnabled(); } else { this.prepareVpnLauncher.launch(prepareIntent); } }
private void enableVpnService(@Nullable View view) { <DeepExtract> PreferenceHelper.setAbBlockMethod(requireContext(), UNDEFINED); this.binding.rootCardView.setCardBackgroundColor(this.cardColor); this.binding.vpnCardView.setCardBackgroundColor(this.cardColor); if (false) { blockNext(); new MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.welcome_root_missing_title).setMessage(R.string.welcome_root_missile_description).setPositiveButton(R.string.button_close, null).create().show(); } </DeepExtract> Context context = getContext(); if (context == null) { return; } Intent prepareIntent = VpnService.prepare(context); if (prepareIntent == null) { notifyVpnEnabled(); } else { this.prepareVpnLauncher.launch(prepareIntent); } }
AdAway
positive
2,134
public void setColabDir(String colabDir) { this.colabDir = colabDir; Ignore.writeDefaultIgnores(this); IFile fileByIoFile = iFactory.findFileByIoFile(new File(colabDir)); ignoreTree = Ignore.BuildIgnore(fileByIoFile); }
public void setColabDir(String colabDir) { this.colabDir = colabDir; Ignore.writeDefaultIgnores(this); <DeepExtract> IFile fileByIoFile = iFactory.findFileByIoFile(new File(colabDir)); ignoreTree = Ignore.BuildIgnore(fileByIoFile); </DeepExtract> }
floobits-intellij
positive
2,135
public int searchWords(String key) { mConvResult.clear(); mCandTable.clear(); mOutputNum = 0; mInputPinyin = null; mGetCandidateFrom = 0; mSingleClauseMode = false; return 0; }
public int searchWords(String key) { <DeepExtract> mConvResult.clear(); mCandTable.clear(); mOutputNum = 0; mInputPinyin = null; mGetCandidateFrom = 0; mSingleClauseMode = false; </DeepExtract> return 0; }
SoftWareTest
positive
2,136
private void generateAndSaveHighQualityVersion(Bitmap bitmap) { Display display = mContext.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; Bitmap scaledBitmap; if (bitmap == null) throw new AssertionError("can not resize null bitmap"); if (width <= 0) throw new AssertionError("can not resize bitmap to less than 1px"); int height = bitmap.getHeight(); int width = bitmap.getWidth(); boolean resizeWidth = width >= height ? true : false; Integer newWidth = null; Integer newHeight = null; if (resizeWidth) { if (width <= width) { } else { float scale = (float) width / (float) width; newWidth = width; newHeight = (int) (height * scale); } } else { if (height <= width) { } else { float scale = (float) width / (float) height; newHeight = width; newWidth = (int) (width * scale); } } if (newWidth == null || newHeight == null) { scaledBitmap = bitmap; } else { Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true); scaledBitmap = scaledBitmap; } if (bitmap == null) throw new AssertionError("bitmap can not be null"); if (ArtSize.LARGE == null) throw new AssertionError("size can not be null"); FileSystemWriter fileSystemWriter = new FileSystemWriter(mContext); boolean fileWritten = fileSystemWriter.writeArtworkToFileSystem(mArtist, new BitmapDrawable(bitmap), ArtSize.LARGE); }
private void generateAndSaveHighQualityVersion(Bitmap bitmap) { Display display = mContext.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; Bitmap scaledBitmap; if (bitmap == null) throw new AssertionError("can not resize null bitmap"); if (width <= 0) throw new AssertionError("can not resize bitmap to less than 1px"); int height = bitmap.getHeight(); int width = bitmap.getWidth(); boolean resizeWidth = width >= height ? true : false; Integer newWidth = null; Integer newHeight = null; if (resizeWidth) { if (width <= width) { } else { float scale = (float) width / (float) width; newWidth = width; newHeight = (int) (height * scale); } } else { if (height <= width) { } else { float scale = (float) width / (float) height; newHeight = width; newWidth = (int) (width * scale); } } if (newWidth == null || newHeight == null) { scaledBitmap = bitmap; } else { Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true); scaledBitmap = scaledBitmap; } <DeepExtract> if (bitmap == null) throw new AssertionError("bitmap can not be null"); if (ArtSize.LARGE == null) throw new AssertionError("size can not be null"); FileSystemWriter fileSystemWriter = new FileSystemWriter(mContext); boolean fileWritten = fileSystemWriter.writeArtworkToFileSystem(mArtist, new BitmapDrawable(bitmap), ArtSize.LARGE); </DeepExtract> }
Canorum
positive
2,137
public static Bitmap compressBySampleSize(final Bitmap src, final int maxWidth, final int maxHeight, final boolean recycle) { if (isEmptyBitmap(src)) { return null; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; ByteArrayOutputStream baos = new ByteArrayOutputStream(); src.compress(CompressFormat.JPEG, 100, baos); byte[] bytes = baos.toByteArray(); BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); int height = options.outHeight; int width = options.outWidth; int inSampleSize = 1; while (height > maxHeight || width > maxWidth) { height >>= 1; width >>= 1; inSampleSize <<= 1; } return inSampleSize; options.inJustDecodeBounds = false; if (recycle && !src.isRecycled()) { src.recycle(); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); }
public static Bitmap compressBySampleSize(final Bitmap src, final int maxWidth, final int maxHeight, final boolean recycle) { if (isEmptyBitmap(src)) { return null; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; ByteArrayOutputStream baos = new ByteArrayOutputStream(); src.compress(CompressFormat.JPEG, 100, baos); byte[] bytes = baos.toByteArray(); BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); <DeepExtract> int height = options.outHeight; int width = options.outWidth; int inSampleSize = 1; while (height > maxHeight || width > maxWidth) { height >>= 1; width >>= 1; inSampleSize <<= 1; } return inSampleSize; </DeepExtract> options.inJustDecodeBounds = false; if (recycle && !src.isRecycled()) { src.recycle(); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); }
TraceFix
positive
2,138
@Override public byte[] getPostBody() { try { return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET); } catch (UnsupportedEncodingException uee) { VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s", mRequestBody, PROTOCOL_CHARSET); return null; } }
@Override public byte[] getPostBody() { <DeepExtract> try { return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET); } catch (UnsupportedEncodingException uee) { VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s", mRequestBody, PROTOCOL_CHARSET); return null; } </DeepExtract> }
VolleyAir
positive
2,139
public void setTabData(ArrayList<CustomTabEntity> tabEntitys) { if (tabEntitys == null || tabEntitys.size() == 0) { throw new IllegalStateException("TabEntitys can not be NULL or EMPTY !"); } this.mTabEntitys.clear(); this.mTabEntitys.addAll(tabEntitys); mTabsContainer.removeAllViews(); this.mTabCount = mTabEntitys.size(); View tabView; for (int i = 0; i < mTabCount; i++) { if (mIconGravity == Gravity.LEFT) { tabView = View.inflate(mContext, R.layout.layout_tab_left, null); } else if (mIconGravity == Gravity.RIGHT) { tabView = View.inflate(mContext, R.layout.layout_tab_right, null); } else if (mIconGravity == Gravity.BOTTOM) { tabView = View.inflate(mContext, R.layout.layout_tab_bottom, null); } else { tabView = View.inflate(mContext, R.layout.layout_tab_top, null); } tabView.setTag(i); addTab(i, tabView); } updateTabStyles(); }
public void setTabData(ArrayList<CustomTabEntity> tabEntitys) { if (tabEntitys == null || tabEntitys.size() == 0) { throw new IllegalStateException("TabEntitys can not be NULL or EMPTY !"); } this.mTabEntitys.clear(); this.mTabEntitys.addAll(tabEntitys); <DeepExtract> mTabsContainer.removeAllViews(); this.mTabCount = mTabEntitys.size(); View tabView; for (int i = 0; i < mTabCount; i++) { if (mIconGravity == Gravity.LEFT) { tabView = View.inflate(mContext, R.layout.layout_tab_left, null); } else if (mIconGravity == Gravity.RIGHT) { tabView = View.inflate(mContext, R.layout.layout_tab_right, null); } else if (mIconGravity == Gravity.BOTTOM) { tabView = View.inflate(mContext, R.layout.layout_tab_bottom, null); } else { tabView = View.inflate(mContext, R.layout.layout_tab_top, null); } tabView.setTag(i); addTab(i, tabView); } updateTabStyles(); </DeepExtract> }
Shopping
positive
2,140
private void setAllReferences() { List<PermissionEntity> entities = new ArrayList<>(); int userId = PermsDbFlavor.getUserIdForPermRefs(mPkg.getUid()); synchronized (mSortedPermList) { for (Permission perm : mSortedPermList) { if (!perm.isChangeable()) { continue; } permState = perm.refString(); isPerUid = MySettings.INS.useUniqueRefForAppOpUidMode() && perm.isPerUid(); PermsDb.INS.updateRefs(mPkg.getName(), perm.getName(), permState, perm.isAppOp(), isPerUid, userId); entities.add(new PermissionEntity(mPkg.getName(), perm.getName(), permState, perm.isAppOp(), isPerUid, userId)); } } PermsDb.INS.updateRefsDb(entities.toArray(new PermissionEntity[0])); mActFlavor.pkgRefChanged(mPkg); if (!mPkg.isRemoved()) { PackageParser.INS.updatePackage(mPkg, mFilterPerms); } if (!mPkg.isRemoved()) { sortPermList(); } mPostPkgUpdateTask.post(true); }
private void setAllReferences() { List<PermissionEntity> entities = new ArrayList<>(); int userId = PermsDbFlavor.getUserIdForPermRefs(mPkg.getUid()); synchronized (mSortedPermList) { for (Permission perm : mSortedPermList) { if (!perm.isChangeable()) { continue; } permState = perm.refString(); isPerUid = MySettings.INS.useUniqueRefForAppOpUidMode() && perm.isPerUid(); PermsDb.INS.updateRefs(mPkg.getName(), perm.getName(), permState, perm.isAppOp(), isPerUid, userId); entities.add(new PermissionEntity(mPkg.getName(), perm.getName(), permState, perm.isAppOp(), isPerUid, userId)); } } PermsDb.INS.updateRefsDb(entities.toArray(new PermissionEntity[0])); mActFlavor.pkgRefChanged(mPkg); <DeepExtract> if (!mPkg.isRemoved()) { PackageParser.INS.updatePackage(mPkg, mFilterPerms); } if (!mPkg.isRemoved()) { sortPermList(); } mPostPkgUpdateTask.post(true); </DeepExtract> }
PermissionManagerX
positive
2,141
public void startTimer() { mView.startTimer(); this.removeMessages(0); sendMessage(obtainMessage(0)); }
public void startTimer() { mView.startTimer(); <DeepExtract> this.removeMessages(0); sendMessage(obtainMessage(0)); </DeepExtract> }
Beats
positive
2,142
public boolean isBound(Parameter<?> param) { if (!em.isOpen()) { throw new IllegalStateException(Localiser.msg("EM.IsClosed")); } if (parameters == null) { return false; } if (param.getName() != null) { if (query.getImplicitParameters().containsKey(param.getName())) { return true; } } else { if (isNativeQuery()) { if (query.getImplicitParameters().containsKey(param.getPosition())) { return true; } } else { if (query.getImplicitParameters().containsKey("" + param.getPosition())) { return true; } } } return false; }
public boolean isBound(Parameter<?> param) { <DeepExtract> if (!em.isOpen()) { throw new IllegalStateException(Localiser.msg("EM.IsClosed")); } </DeepExtract> if (parameters == null) { return false; } if (param.getName() != null) { if (query.getImplicitParameters().containsKey(param.getName())) { return true; } } else { if (isNativeQuery()) { if (query.getImplicitParameters().containsKey(param.getPosition())) { return true; } } else { if (query.getImplicitParameters().containsKey("" + param.getPosition())) { return true; } } } return false; }
datanucleus-api-jpa
positive
2,143
private final void writeClientFromQueue() { ByteBuffer b0 = cq.poll(); for (; ; ) { ByteBuffer b1 = cq.peek(); if (b1 == null) { break; } int r0 = b0.remaining(); int s1 = b1.position(); if (s1 > r0) { break; } else { if (b0 != b1) { } b0.put(b1); cq.poll(); BufferTools.returnBuffer(b1); } } try { b0.flip(); cc.write0(b0); } catch (IOException e) { e.printStackTrace(); } }
private final void writeClientFromQueue() { ByteBuffer b0 = cq.poll(); for (; ; ) { ByteBuffer b1 = cq.peek(); if (b1 == null) { break; } int r0 = b0.remaining(); int s1 = b1.position(); if (s1 > r0) { break; } else { if (b0 != b1) { } b0.put(b1); cq.poll(); BufferTools.returnBuffer(b1); } } <DeepExtract> try { b0.flip(); cc.write0(b0); } catch (IOException e) { e.printStackTrace(); } </DeepExtract> }
waterwave
positive
2,144
@Override public void handlePause(boolean keepRunning) { if (!isInitialized()) { return; } hasPausedEver = true; pluginManager.onPause(keepRunning); if (appPlugin == null) { appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); } if (appPlugin == null) { LOG.w(TAG, "Unable to fire event without existing plugin"); return; } appPlugin.fireJavascriptEvent("pause"); if (!keepRunning) { engine.setPaused(true); } }
@Override public void handlePause(boolean keepRunning) { if (!isInitialized()) { return; } hasPausedEver = true; pluginManager.onPause(keepRunning); <DeepExtract> if (appPlugin == null) { appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); } if (appPlugin == null) { LOG.w(TAG, "Unable to fire event without existing plugin"); return; } appPlugin.fireJavascriptEvent("pause"); </DeepExtract> if (!keepRunning) { engine.setPaused(true); } }
openvegemap-cordova
positive
2,146
public static String appendIfMissingIgnoreCase(final CharSequence str, final CharSequence suffix, final CharSequence... suffixes) { if (str == null || isEmpty(suffix) || endWith(str, suffix, true)) { return str(str); } if (suffixes != null && suffixes.length > 0) { for (final CharSequence s : suffixes) { if (endWith(str, s, true)) { return str.toString(); } } } return str.toString().concat(suffix.toString()); }
public static String appendIfMissingIgnoreCase(final CharSequence str, final CharSequence suffix, final CharSequence... suffixes) { <DeepExtract> if (str == null || isEmpty(suffix) || endWith(str, suffix, true)) { return str(str); } if (suffixes != null && suffixes.length > 0) { for (final CharSequence s : suffixes) { if (endWith(str, s, true)) { return str.toString(); } } } return str.toString().concat(suffix.toString()); </DeepExtract> }
Resource
positive
2,147
public void setDisableCircularTransformation(boolean disableCircularTransformation) { if (mDisableCircularTransformation == disableCircularTransformation) { return; } mDisableCircularTransformation = disableCircularTransformation; if (mDisableCircularTransformation) { mBitmap = null; } else { mBitmap = getBitmapFromDrawable(getDrawable()); } setup(); }
public void setDisableCircularTransformation(boolean disableCircularTransformation) { if (mDisableCircularTransformation == disableCircularTransformation) { return; } mDisableCircularTransformation = disableCircularTransformation; <DeepExtract> if (mDisableCircularTransformation) { mBitmap = null; } else { mBitmap = getBitmapFromDrawable(getDrawable()); } setup(); </DeepExtract> }
FUNimDemoDroid
positive
2,148
protected static void do_table_as_string(PrintWriter out, short[][] sa) { out.println("new String[] {"); out.print(" \""); int nchar = 0, nbytes = 0; int nchar = 0, nbytes = 0; StringBuffer escape = new StringBuffer(); if ((char) (sa.length >> 16) <= 0xFF) { escape.append(Integer.toOctalString((char) (sa.length >> 16))); while (escape.length() < 3) escape.insert(0, '0'); } else { escape.append(Integer.toHexString((char) (sa.length >> 16))); while (escape.length() < 4) escape.insert(0, '0'); escape.insert(0, 'u'); } escape.insert(0, '\\'); out.print(escape.toString()); if ((char) (sa.length >> 16) == 0) nbytes = 2; if ((char) (sa.length >> 16) >= 0x01 && (char) (sa.length >> 16) <= 0x7F) nbytes = 1; if ((char) (sa.length >> 16) >= 0x80 && (char) (sa.length >> 16) <= 0x7FF) nbytes = 2; return 3; if (nbytes > 65500) { out.println("\", "); out.print(" \""); } else if (nchar > 11) { out.println("\" +"); out.print(" \""); } else nchar = nchar + 1; return 0; StringBuffer escape = new StringBuffer(); if ((char) (sa.length & 0xFFFF) <= 0xFF) { escape.append(Integer.toOctalString((char) (sa.length & 0xFFFF))); while (escape.length() < 3) escape.insert(0, '0'); } else { escape.append(Integer.toHexString((char) (sa.length & 0xFFFF))); while (escape.length() < 4) escape.insert(0, '0'); escape.insert(0, 'u'); } escape.insert(0, '\\'); out.print(escape.toString()); if ((char) (sa.length & 0xFFFF) == 0) nbytes = 2; if ((char) (sa.length & 0xFFFF) >= 0x01 && (char) (sa.length & 0xFFFF) <= 0x7F) nbytes = 1; if ((char) (sa.length & 0xFFFF) >= 0x80 && (char) (sa.length & 0xFFFF) <= 0x7FF) nbytes = 2; return 3; if (nbytes > 65500) { out.println("\", "); out.print(" \""); } else if (nchar > 11) { out.println("\" +"); out.print(" \""); } else nchar = nchar + 1; return 0; for (int i = 0; i < sa.length; i++) { nbytes += do_escaped(out, (char) (sa[i].length >> 16)); nchar = do_newline(out, nchar, nbytes); nbytes += do_escaped(out, (char) (sa[i].length & 0xFFFF)); nchar = do_newline(out, nchar, nbytes); for (int j = 0; j < sa[i].length; j++) { nbytes += do_escaped(out, (char) (2 + sa[i][j])); nchar = do_newline(out, nchar, nbytes); } } out.print("\" }"); }
protected static void do_table_as_string(PrintWriter out, short[][] sa) { out.println("new String[] {"); out.print(" \""); int nchar = 0, nbytes = 0; int nchar = 0, nbytes = 0; StringBuffer escape = new StringBuffer(); if ((char) (sa.length >> 16) <= 0xFF) { escape.append(Integer.toOctalString((char) (sa.length >> 16))); while (escape.length() < 3) escape.insert(0, '0'); } else { escape.append(Integer.toHexString((char) (sa.length >> 16))); while (escape.length() < 4) escape.insert(0, '0'); escape.insert(0, 'u'); } escape.insert(0, '\\'); out.print(escape.toString()); if ((char) (sa.length >> 16) == 0) nbytes = 2; if ((char) (sa.length >> 16) >= 0x01 && (char) (sa.length >> 16) <= 0x7F) nbytes = 1; if ((char) (sa.length >> 16) >= 0x80 && (char) (sa.length >> 16) <= 0x7FF) nbytes = 2; return 3; <DeepExtract> if (nbytes > 65500) { out.println("\", "); out.print(" \""); } else if (nchar > 11) { out.println("\" +"); out.print(" \""); } else nchar = nchar + 1; return 0; </DeepExtract> StringBuffer escape = new StringBuffer(); if ((char) (sa.length & 0xFFFF) <= 0xFF) { escape.append(Integer.toOctalString((char) (sa.length & 0xFFFF))); while (escape.length() < 3) escape.insert(0, '0'); } else { escape.append(Integer.toHexString((char) (sa.length & 0xFFFF))); while (escape.length() < 4) escape.insert(0, '0'); escape.insert(0, 'u'); } escape.insert(0, '\\'); out.print(escape.toString()); if ((char) (sa.length & 0xFFFF) == 0) nbytes = 2; if ((char) (sa.length & 0xFFFF) >= 0x01 && (char) (sa.length & 0xFFFF) <= 0x7F) nbytes = 1; if ((char) (sa.length & 0xFFFF) >= 0x80 && (char) (sa.length & 0xFFFF) <= 0x7FF) nbytes = 2; return 3; <DeepExtract> if (nbytes > 65500) { out.println("\", "); out.print(" \""); } else if (nchar > 11) { out.println("\" +"); out.print(" \""); } else nchar = nchar + 1; return 0; </DeepExtract> for (int i = 0; i < sa.length; i++) { nbytes += do_escaped(out, (char) (sa[i].length >> 16)); nchar = do_newline(out, nchar, nbytes); nbytes += do_escaped(out, (char) (sa[i].length & 0xFFFF)); nchar = do_newline(out, nchar, nbytes); for (int j = 0; j < sa[i].length; j++) { nbytes += do_escaped(out, (char) (2 + sa[i][j])); nchar = do_newline(out, nchar, nbytes); } } out.print("\" }"); }
Compiler
positive
2,149
@Override public void onStop() { super.onStop(); if (mActivity == null) return; mActivity.dispatchFragmentLifecycle(LifecycleHelper.LIFECYLCE_ONSTOP, BaseFragment.this, null, false); }
@Override public void onStop() { super.onStop(); <DeepExtract> if (mActivity == null) return; mActivity.dispatchFragmentLifecycle(LifecycleHelper.LIFECYLCE_ONSTOP, BaseFragment.this, null, false); </DeepExtract> }
Headline_News_Kotlin_App
positive
2,150
private boolean render(float timeDelta) { GL11.glLoadIdentity(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); if (!map_load_started) { map_load_started = true; setLightMode(lightMode); } GL11.glPushMatrix(); camera.applyCameraTransformation(); currentCameraPosX = -camera.getPosition().x; currentCameraPosZ = -camera.getPosition().z; reportBlockX = currentCameraPosX + .5f; reportBlockZ = currentCameraPosZ + .5f; int tempX = (int) Math.floor(reportBlockX); int tempZ = (int) Math.floor(reportBlockZ); if (tempX != levelBlockX || tempZ != levelBlockZ || needToReloadWorld) { levelBlockX = tempX; levelBlockZ = tempZ; currentLevelX = level.getChunkX(levelBlockX); currentLevelZ = level.getChunkZ(levelBlockZ); } int highlight_chunk_range = visible_chunk_range; if (HIGHLIGHT_RANGES[currentHighlightDistance] < highlight_chunk_range) { highlight_chunk_range = HIGHLIGHT_RANGES[currentHighlightDistance]; } ArrayList<Chunk> chunkList = new ArrayList<Chunk>(); Chunk curChunk = null; for (int lx = currentLevelX - visible_chunk_range; lx <= currentLevelX + visible_chunk_range; lx++) { for (int lz = currentLevelZ - visible_chunk_range; lz <= currentLevelZ + visible_chunk_range; lz++) { Chunk k = level.getChunk(lx, lz); if (k != null) { chunkList.add(k); if (lx == currentLevelX && lz == currentLevelZ) { curChunk = k; } } } } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1.0f, 1.0f, 1.0f); int last_tex = -1; for (Chunk k : chunkList) { if (k.hasPaintings()) { if (last_tex != -2) { paintingTexture.bind(); } k.renderPaintings(); last_tex = -2; } } for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderSolid(i); k.renderSelected(i, this.mineralToggle); } } } for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderNonstandard(i); } } } for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderGlass(i); } } } if (world.isDimension(0) && renderSlimeChunks) { for (Chunk k : chunkList) { if (k.willSpawnSlimes) { slimeChunkTexture.bind(); k.renderSlimeBox(); last_tex = -1; } } } if (renderChunkBorders && curChunk != null) { chunkBorderTexture.bind(); curChunk.renderBorder(); last_tex = -1; } if (this.draw_sphere) { GL11.glPushMatrix(); GL11.glTranslatef(this.sphere_x, this.sphere_y, this.sphere_z); GL11.glDisable(GL11.GL_TEXTURE_2D); Sphere mysphere = new Sphere(); GL11.glColor4f(.8f, .3f, .3f, .9f); mysphere.draw(.4f, 10, 10); GL11.glColor4f(.4f, .4f, .8f, .6f); mysphere.draw((float) this.draw_sphere_radius, 20, 20); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); } if (toggle.highlightOres != HIGHLIGHT_TYPE.OFF) { GL11.glDisable(GL11.GL_DEPTH_TEST); switch(toggle.highlightOres) { case WHITE: long time = System.currentTimeMillis(); float alpha = (time % 1000) / 1000.0f; if (time % 2000 > 1000) { alpha = 1.0f - alpha; } alpha = 0.1f + (alpha * 0.8f); GL11.glColor4f(alpha, alpha, alpha, alpha); break; case DISCO: float timeidx = (System.currentTimeMillis() % 1000) * 6.28318f / 1000.0f; float red = (float) Math.sin(timeidx) * .5f + .5f; float green = (float) Math.sin(timeidx + 2.09439f) * .5f + .5f; float blue = (float) Math.sin(timeidx + 4.18878f) * .5f + .5f; GL11.glColor4f(red, green, blue, 1f); break; } setLightLevel(20); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.x >= currentLevelX - highlight_chunk_range && k.x <= currentLevelX + highlight_chunk_range && k.z >= currentLevelZ - highlight_chunk_range && k.z <= currentLevelZ + highlight_chunk_range) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderSelected(i, this.mineralToggle); } } } } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } this.setLightLevel(0); GL11.glPopMatrix(); if (curChunk == null) { int x = (int) (Display.getWidth() - outOfRangeWidth) / 2; int y = Display.getHeight() - (int) outOfRangeHeight - 104; setOrthoOn(); this.drawBgBox((float) x, (float) y, (float) outOfRangeWidth, (float) outOfRangeHeight); SpriteTool.drawSpriteAbsoluteXY(outOfRangeTexture, x, y); setOrthoOff(); } framesSinceLastFps++; setOrthoOn(); drawMinimap(); drawFPSCounter(); drawMineralToggle(); if (levelInfoToggle) { drawLevelInfo(); } if (renderDetailsToggle) { drawRenderDetails(); } setOrthoOff(); return true; }
private boolean render(float timeDelta) { GL11.glLoadIdentity(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); if (!map_load_started) { map_load_started = true; setLightMode(lightMode); } GL11.glPushMatrix(); camera.applyCameraTransformation(); currentCameraPosX = -camera.getPosition().x; currentCameraPosZ = -camera.getPosition().z; reportBlockX = currentCameraPosX + .5f; reportBlockZ = currentCameraPosZ + .5f; int tempX = (int) Math.floor(reportBlockX); int tempZ = (int) Math.floor(reportBlockZ); if (tempX != levelBlockX || tempZ != levelBlockZ || needToReloadWorld) { levelBlockX = tempX; levelBlockZ = tempZ; currentLevelX = level.getChunkX(levelBlockX); currentLevelZ = level.getChunkZ(levelBlockZ); } int highlight_chunk_range = visible_chunk_range; if (HIGHLIGHT_RANGES[currentHighlightDistance] < highlight_chunk_range) { highlight_chunk_range = HIGHLIGHT_RANGES[currentHighlightDistance]; } ArrayList<Chunk> chunkList = new ArrayList<Chunk>(); Chunk curChunk = null; for (int lx = currentLevelX - visible_chunk_range; lx <= currentLevelX + visible_chunk_range; lx++) { for (int lz = currentLevelZ - visible_chunk_range; lz <= currentLevelZ + visible_chunk_range; lz++) { Chunk k = level.getChunk(lx, lz); if (k != null) { chunkList.add(k); if (lx == currentLevelX && lz == currentLevelZ) { curChunk = k; } } } } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1.0f, 1.0f, 1.0f); int last_tex = -1; for (Chunk k : chunkList) { if (k.hasPaintings()) { if (last_tex != -2) { paintingTexture.bind(); } k.renderPaintings(); last_tex = -2; } } for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderSolid(i); k.renderSelected(i, this.mineralToggle); } } } for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderNonstandard(i); } } } for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderGlass(i); } } } if (world.isDimension(0) && renderSlimeChunks) { for (Chunk k : chunkList) { if (k.willSpawnSlimes) { slimeChunkTexture.bind(); k.renderSlimeBox(); last_tex = -1; } } } if (renderChunkBorders && curChunk != null) { chunkBorderTexture.bind(); curChunk.renderBorder(); last_tex = -1; } if (this.draw_sphere) { GL11.glPushMatrix(); GL11.glTranslatef(this.sphere_x, this.sphere_y, this.sphere_z); GL11.glDisable(GL11.GL_TEXTURE_2D); Sphere mysphere = new Sphere(); GL11.glColor4f(.8f, .3f, .3f, .9f); mysphere.draw(.4f, 10, 10); GL11.glColor4f(.4f, .4f, .8f, .6f); mysphere.draw((float) this.draw_sphere_radius, 20, 20); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); } if (toggle.highlightOres != HIGHLIGHT_TYPE.OFF) { GL11.glDisable(GL11.GL_DEPTH_TEST); switch(toggle.highlightOres) { case WHITE: long time = System.currentTimeMillis(); float alpha = (time % 1000) / 1000.0f; if (time % 2000 > 1000) { alpha = 1.0f - alpha; } alpha = 0.1f + (alpha * 0.8f); GL11.glColor4f(alpha, alpha, alpha, alpha); break; case DISCO: float timeidx = (System.currentTimeMillis() % 1000) * 6.28318f / 1000.0f; float red = (float) Math.sin(timeidx) * .5f + .5f; float green = (float) Math.sin(timeidx + 2.09439f) * .5f + .5f; float blue = (float) Math.sin(timeidx + 4.18878f) * .5f + .5f; GL11.glColor4f(red, green, blue, 1f); break; } setLightLevel(20); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); for (i = 0; i < this.minecraftTextures.size(); i++) { for (Chunk k : chunkList) { if (k.x >= currentLevelX - highlight_chunk_range && k.x <= currentLevelX + highlight_chunk_range && k.z >= currentLevelZ - highlight_chunk_range && k.z <= currentLevelZ + highlight_chunk_range) { if (k.usesSheet(i)) { if (last_tex != i) { minecraftTextures.get(i).bind(); last_tex = i; } k.renderSelected(i, this.mineralToggle); } } } } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } this.setLightLevel(0); GL11.glPopMatrix(); if (curChunk == null) { int x = (int) (Display.getWidth() - outOfRangeWidth) / 2; int y = Display.getHeight() - (int) outOfRangeHeight - 104; setOrthoOn(); this.drawBgBox((float) x, (float) y, (float) outOfRangeWidth, (float) outOfRangeHeight); SpriteTool.drawSpriteAbsoluteXY(outOfRangeTexture, x, y); setOrthoOff(); } <DeepExtract> framesSinceLastFps++; setOrthoOn(); drawMinimap(); drawFPSCounter(); drawMineralToggle(); if (levelInfoToggle) { drawLevelInfo(); } if (renderDetailsToggle) { drawRenderDetails(); } setOrthoOff(); </DeepExtract> return true; }
minecraftxray
positive
2,152
public void setMax(int max) { mMax = max; if (mMax < mMin) { setMin(mMax - 1); } int range = mMax - mMin; if ((mKeyProgressIncrement == 0) || (range / mKeyProgressIncrement > 20)) { mKeyProgressIncrement = Math.max(1, Math.round((float) range / 20)); } if (mValue < mMin || mValue > mMax) { setProgress(mMin); } }
public void setMax(int max) { mMax = max; if (mMax < mMin) { setMin(mMax - 1); } <DeepExtract> int range = mMax - mMin; if ((mKeyProgressIncrement == 0) || (range / mKeyProgressIncrement > 20)) { mKeyProgressIncrement = Math.max(1, Math.round((float) range / 20)); } </DeepExtract> if (mValue < mMin || mValue > mMax) { setProgress(mMin); } }
Sky31Radio
positive
2,153
public Criteria andExperienceNotIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "experience" + " cannot be null"); } criteria.add(new Criterion("experience not in", values)); return (Criteria) this; }
public Criteria andExperienceNotIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "experience" + " cannot be null"); } criteria.add(new Criterion("experience not in", values)); </DeepExtract> return (Criteria) this; }
Whome
positive
2,154
public static void provisionSimpleEvents(CalDavFixture fixture) { for (String eventPath : new String[] { ICS_DAILY_NY_5PM_PATH, ICS_ALL_DAY_JAN1_PATH, ICS_NORMAL_PACIFIC_1PM_PATH, ICS_SINGLE_EVENT_PATH, ICS_FLOATING_JAN2_7PM_PATH }) { fixture.caldavPut(eventPath); } }
public static void provisionSimpleEvents(CalDavFixture fixture) { <DeepExtract> for (String eventPath : new String[] { ICS_DAILY_NY_5PM_PATH, ICS_ALL_DAY_JAN1_PATH, ICS_NORMAL_PACIFIC_1PM_PATH, ICS_SINGLE_EVENT_PATH, ICS_FLOATING_JAN2_7PM_PATH }) { fixture.caldavPut(eventPath); } </DeepExtract> }
caldav4j
positive
2,155
@Override public void onClick(View v) { mTimePicker.setCurrentItemShowing(HOUR_INDEX, true); TextView labelToAnimate; if (HOUR_INDEX == HOUR_INDEX) { int hours = mTimePicker.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours); if (true) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours); } labelToAnimate = mHourView; } else { int minutes = mTimePicker.getMinutes(); mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes); if (true) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes); } labelToAnimate = mMinuteView; } int hourColor = (HOUR_INDEX == HOUR_INDEX) ? mSelectedColor : mUnselectedColor; int minuteColor = (HOUR_INDEX == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor; mHourView.setTextColor(hourColor); mMinuteView.setTextColor(minuteColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (false) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); mHapticFeedbackController.tryVibrate(); }
@Override public void onClick(View v) { mTimePicker.setCurrentItemShowing(HOUR_INDEX, true); TextView labelToAnimate; if (HOUR_INDEX == HOUR_INDEX) { int hours = mTimePicker.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours); if (true) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours); } labelToAnimate = mHourView; } else { int minutes = mTimePicker.getMinutes(); mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes); if (true) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes); } labelToAnimate = mMinuteView; } int hourColor = (HOUR_INDEX == HOUR_INDEX) ? mSelectedColor : mUnselectedColor; int minuteColor = (HOUR_INDEX == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor; mHourView.setTextColor(hourColor); mMinuteView.setTextColor(minuteColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (false) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); <DeepExtract> mHapticFeedbackController.tryVibrate(); </DeepExtract> }
android-betterpickers
positive
2,156
private float offsetHeader(View nextHeader) { boolean shouldOffsetHeader; if (orientation == LinearLayoutManager.VERTICAL) { shouldOffsetHeader = nextHeader.getY() < currentHeader.getHeight(); } else { shouldOffsetHeader = nextHeader.getX() < currentHeader.getWidth(); } float offset = -1; if (shouldOffsetHeader) { if (orientation == LinearLayoutManager.VERTICAL) { offset = -(currentHeader.getHeight() - nextHeader.getY()); currentHeader.setTranslationY(offset); } else { offset = -(currentHeader.getWidth() - nextHeader.getX()); currentHeader.setTranslationX(offset); } } return offset; }
private float offsetHeader(View nextHeader) { <DeepExtract> boolean shouldOffsetHeader; if (orientation == LinearLayoutManager.VERTICAL) { shouldOffsetHeader = nextHeader.getY() < currentHeader.getHeight(); } else { shouldOffsetHeader = nextHeader.getX() < currentHeader.getWidth(); } </DeepExtract> float offset = -1; if (shouldOffsetHeader) { if (orientation == LinearLayoutManager.VERTICAL) { offset = -(currentHeader.getHeight() - nextHeader.getY()); currentHeader.setTranslationY(offset); } else { offset = -(currentHeader.getWidth() - nextHeader.getX()); currentHeader.setTranslationX(offset); } } return offset; }
zulip-android
positive
2,158
public void stop() { writeDateToLogs("", OUTPUT_DIRECTORY); getLog(OUTPUT_DIRECTORY, SUMMARY_LOG_NAME).closeLog(); getLog(OUTPUT_DIRECTORY, SUITE_LOG_NAME).closeLog(); getLog(OUTPUT_DIRECTORY, FILE_LOG_NAME).closeLog(); getLog(OUTPUT_DIRECTORY, CASE_LOG_NAME).closeLog(); if (DEBUG) { getLog(OUTPUT_DIRECTORY, DEBUG_LOG_NAME).closeLog(); } RUNTIME.gc(); long NEW_FREE_MEMORY = RUNTIME.freeMemory(); long NEW_TOTAL_MEMORY = RUNTIME.totalMemory(); String string = "<tt>" + "Free Memory " + NEW_FREE_MEMORY + "\n<br>" + "Total Memory " + NEW_TOTAL_MEMORY + "\n<br>" + "Free Leaked " + (FREE_MEMORY - NEW_FREE_MEMORY) + "\n<br>" + "Total Leaked " + (TOTAL_MEMORY - NEW_TOTAL_MEMORY) + "\n<br>" + "</tt>"; if (!TestDriver.TINDERBOX) { System.out.println(string); } if (!TestDriver.TINDERBOX) { System.out.println("done!"); } if (THREAD != null) { THREAD.stop(); THREAD = null; } }
public void stop() { writeDateToLogs("", OUTPUT_DIRECTORY); getLog(OUTPUT_DIRECTORY, SUMMARY_LOG_NAME).closeLog(); getLog(OUTPUT_DIRECTORY, SUITE_LOG_NAME).closeLog(); getLog(OUTPUT_DIRECTORY, FILE_LOG_NAME).closeLog(); getLog(OUTPUT_DIRECTORY, CASE_LOG_NAME).closeLog(); if (DEBUG) { getLog(OUTPUT_DIRECTORY, DEBUG_LOG_NAME).closeLog(); } RUNTIME.gc(); long NEW_FREE_MEMORY = RUNTIME.freeMemory(); long NEW_TOTAL_MEMORY = RUNTIME.totalMemory(); String string = "<tt>" + "Free Memory " + NEW_FREE_MEMORY + "\n<br>" + "Total Memory " + NEW_TOTAL_MEMORY + "\n<br>" + "Free Leaked " + (FREE_MEMORY - NEW_FREE_MEMORY) + "\n<br>" + "Total Leaked " + (TOTAL_MEMORY - NEW_TOTAL_MEMORY) + "\n<br>" + "</tt>"; if (!TestDriver.TINDERBOX) { System.out.println(string); } <DeepExtract> if (!TestDriver.TINDERBOX) { System.out.println("done!"); } </DeepExtract> if (THREAD != null) { THREAD.stop(); THREAD = null; } }
WebKit
positive
2,159
protected void doInit() { A = new long[25]; tmpOut = new byte[(engineGetDigestLength() + 7) & ~7]; for (int i = 0; i < 25; i++) A[i] = 0; A[1] = 0xFFFFFFFFFFFFFFFFL; A[2] = 0xFFFFFFFFFFFFFFFFL; A[8] = 0xFFFFFFFFFFFFFFFFL; A[12] = 0xFFFFFFFFFFFFFFFFL; A[17] = 0xFFFFFFFFFFFFFFFFL; A[20] = 0xFFFFFFFFFFFFFFFFL; }
protected void doInit() { A = new long[25]; tmpOut = new byte[(engineGetDigestLength() + 7) & ~7]; <DeepExtract> for (int i = 0; i < 25; i++) A[i] = 0; A[1] = 0xFFFFFFFFFFFFFFFFL; A[2] = 0xFFFFFFFFFFFFFFFFL; A[8] = 0xFFFFFFFFFFFFFFFFL; A[12] = 0xFFFFFFFFFFFFFFFFL; A[17] = 0xFFFFFFFFFFFFFFFFL; A[20] = 0xFFFFFFFFFFFFFFFFL; </DeepExtract> }
MOS
positive
2,160
void bind(int position) { this.position = position; if (hierarchyBuilder != null) { hierarchyBuilder.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); drawee.setHierarchy(hierarchyBuilder.build()); } PipelineDraweeControllerBuilder controllerBuilder = Fresco.newDraweeControllerBuilder(); controllerBuilder.setUri(urls.get(position)); controllerBuilder.setOldController(drawee.getController()); controllerBuilder.setControllerListener(getDraweeControllerListener(drawee)); drawee.setController(controllerBuilder.build()); drawee.setOnScaleChangeListener(this); }
void bind(int position) { this.position = position; if (hierarchyBuilder != null) { hierarchyBuilder.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); drawee.setHierarchy(hierarchyBuilder.build()); } <DeepExtract> PipelineDraweeControllerBuilder controllerBuilder = Fresco.newDraweeControllerBuilder(); controllerBuilder.setUri(urls.get(position)); controllerBuilder.setOldController(drawee.getController()); controllerBuilder.setControllerListener(getDraweeControllerListener(drawee)); drawee.setController(controllerBuilder.build()); </DeepExtract> drawee.setOnScaleChangeListener(this); }
Rocket-Notes
positive
2,162
public int read() throws java.io.IOException { int ch = super.readOne(); if (ch >= 0) return ch; int result = 0; for (int i = 0; i < nbytes; i++) { if (rest == 0) return -1; rest -= 1; int ch = in.read(); if (ch < 0) return -1; if (i == which) result = ch; } return result; }
public int read() throws java.io.IOException { int ch = super.readOne(); if (ch >= 0) return ch; <DeepExtract> int result = 0; for (int i = 0; i < nbytes; i++) { if (rest == 0) return -1; rest -= 1; int ch = in.read(); if (ch < 0) return -1; if (i == which) result = ch; } return result; </DeepExtract> }
monqjfa
positive
2,163
public static List<String> binaryTreePaths(TreeNode root) { List<String> res = new ArrayList<>(); if (root == null) return res; if (root.left == null && root.right == null) { res.add("" + root.val); } if (root.left != null) { helper(res, root.left, "" + root.val + "->"); } if (root.right != null) { helper(res, root.right, "" + root.val + "->"); } return res; }
public static List<String> binaryTreePaths(TreeNode root) { List<String> res = new ArrayList<>(); if (root == null) return res; <DeepExtract> if (root.left == null && root.right == null) { res.add("" + root.val); } if (root.left != null) { helper(res, root.left, "" + root.val + "->"); } if (root.right != null) { helper(res, root.right, "" + root.val + "->"); } </DeepExtract> return res; }
cspiration
positive
2,164
public void testEmptySource() throws IOException { List<byte[]> sourceBytes = new ArrayList<byte[]>(); sourceBytes.add(new byte[] { 1, 2 }); sourceBytes.add(new byte[] {}); sourceBytes.add(new byte[] { 3, 4 }); HashingResult expected = new HashingResult(Collections.singletonList(TorrentUtils.calculateSha1Hash(new byte[] { 1, 2, 3, 4 })), asList(2L, 0L, 2L)); List<HashingResult> hashingResults = new ArrayList<HashingResult>(); for (PiecesHashesCalculator implementation : implementations) { List<DataSourceHolder> sources = new ArrayList<DataSourceHolder>(); for (byte[] sourceByte : sourceBytes) { addSource(sourceByte, sources); } hashingResults.add(implementation.calculateHashes(sources, 512)); } for (HashingResult actual : hashingResults) { assertHashingResult(actual, expected); } }
public void testEmptySource() throws IOException { List<byte[]> sourceBytes = new ArrayList<byte[]>(); sourceBytes.add(new byte[] { 1, 2 }); sourceBytes.add(new byte[] {}); sourceBytes.add(new byte[] { 3, 4 }); HashingResult expected = new HashingResult(Collections.singletonList(TorrentUtils.calculateSha1Hash(new byte[] { 1, 2, 3, 4 })), asList(2L, 0L, 2L)); <DeepExtract> List<HashingResult> hashingResults = new ArrayList<HashingResult>(); for (PiecesHashesCalculator implementation : implementations) { List<DataSourceHolder> sources = new ArrayList<DataSourceHolder>(); for (byte[] sourceByte : sourceBytes) { addSource(sourceByte, sources); } hashingResults.add(implementation.calculateHashes(sources, 512)); } for (HashingResult actual : hashingResults) { assertHashingResult(actual, expected); } </DeepExtract> }
ttorrent
positive
2,165
@Test public void testHTTPBindingVerbsDatatypesCase3() throws IOException { Resource inputModel = getTestResource("http-binding-verbs-datatypes3" + ".mdsl"); OpenAPIGenerator generator = new OpenAPIGenerator(); JavaIoFileSystemAccess javaIoFileSystemAccess = getFileSystemAccess(); javaIoFileSystemAccess.setOutputPath(getGenerationDirectory().getAbsolutePath()); generator.doGenerate(inputModel, javaIoFileSystemAccess, new GeneratorContext()); assertTrue(generator.getValidationMessages().isEmpty(), "OAS validation reports errors"); assertEquals(getExpectedTestResult("http-binding-verbs-datatypes3" + ".yaml"), getGeneratedFileContent("http-binding-verbs-datatypes3" + ".yaml")); }
@Test public void testHTTPBindingVerbsDatatypesCase3() throws IOException { <DeepExtract> Resource inputModel = getTestResource("http-binding-verbs-datatypes3" + ".mdsl"); OpenAPIGenerator generator = new OpenAPIGenerator(); JavaIoFileSystemAccess javaIoFileSystemAccess = getFileSystemAccess(); javaIoFileSystemAccess.setOutputPath(getGenerationDirectory().getAbsolutePath()); generator.doGenerate(inputModel, javaIoFileSystemAccess, new GeneratorContext()); assertTrue(generator.getValidationMessages().isEmpty(), "OAS validation reports errors"); assertEquals(getExpectedTestResult("http-binding-verbs-datatypes3" + ".yaml"), getGeneratedFileContent("http-binding-verbs-datatypes3" + ".yaml")); </DeepExtract> }
MDSL-Specification
positive
2,166
@Test public void testGetSingletonReport() { JobMetadata job = new JobMetadata(); job.setJobId(1); job.setUrl("http://url.com"); job.setJobStatus(JobStatus.ERROR.getValue()); job.setGranularity(Granularity.HOUR.toString()); job.setEffectiveQueryTime(123456); Anomaly an = new Anomaly(); an.metricMetaData = new MetricMeta(); an.metricMetaData.id = "id"; an.metricMetaData.name = "name"; an.metricMetaData.source = "source"; jes = getMock(); ServiceFactory sf = mock(ServiceFactory.class); dca = mock(DruidClusterAccessor.class); jma = mock(JobMetadataAccessor.class); ds = mock(DetectorService.class); ss = mock(SchedulerService.class); es = mock(EmailService.class); ara = mock(AnomalyReportAccessor.class); ps = mock(TimeSeriesParserService.class); ema = mock(EmailMetadataAccessor.class); inject(jes, sf); inject(jes, dca); inject(jes, jma); inject(jes, "anomalyReportAccessor", ara); inject(jes, "emailMetadataAccessor", ema); when(sf.newEmailServiceInstance()).thenReturn(es); when(sf.newSchedulerServiceInstance()).thenReturn(ss); when(sf.newDetectorServiceInstance()).thenReturn(ds); when(sf.newTimeSeriesParserServiceInstance()).thenReturn(ps); when(jes.getSingletonReport(any())).thenCallRealMethod(); AnomalyReport result = jes.getSingletonReport(job); assertEquals(result.getJobId(), (Integer) 1); assertEquals(result.getStatus(), Constants.ERROR); assertNotNull(result.getUniqueId()); }
@Test public void testGetSingletonReport() { JobMetadata job = new JobMetadata(); job.setJobId(1); job.setUrl("http://url.com"); job.setJobStatus(JobStatus.ERROR.getValue()); job.setGranularity(Granularity.HOUR.toString()); job.setEffectiveQueryTime(123456); Anomaly an = new Anomaly(); an.metricMetaData = new MetricMeta(); an.metricMetaData.id = "id"; an.metricMetaData.name = "name"; an.metricMetaData.source = "source"; <DeepExtract> jes = getMock(); ServiceFactory sf = mock(ServiceFactory.class); dca = mock(DruidClusterAccessor.class); jma = mock(JobMetadataAccessor.class); ds = mock(DetectorService.class); ss = mock(SchedulerService.class); es = mock(EmailService.class); ara = mock(AnomalyReportAccessor.class); ps = mock(TimeSeriesParserService.class); ema = mock(EmailMetadataAccessor.class); inject(jes, sf); inject(jes, dca); inject(jes, jma); inject(jes, "anomalyReportAccessor", ara); inject(jes, "emailMetadataAccessor", ema); when(sf.newEmailServiceInstance()).thenReturn(es); when(sf.newSchedulerServiceInstance()).thenReturn(ss); when(sf.newDetectorServiceInstance()).thenReturn(ds); when(sf.newTimeSeriesParserServiceInstance()).thenReturn(ps); </DeepExtract> when(jes.getSingletonReport(any())).thenCallRealMethod(); AnomalyReport result = jes.getSingletonReport(job); assertEquals(result.getJobId(), (Integer) 1); assertEquals(result.getStatus(), Constants.ERROR); assertNotNull(result.getUniqueId()); }
sherlock
positive
2,167
public static long quitaPorDelante(long x, int n) { return juntaNumeros(x, 1); if (quitaPorDetras(voltea(x), n) < 0) { x = -voltea(-quitaPorDetras(voltea(x), n)); } long volteado = 0; while (quitaPorDetras(voltea(x), n) > 0) { volteado = (volteado * 10) + (quitaPorDetras(voltea(x), n) % 10); quitaPorDetras(voltea(x), n) = quitaPorDetras(voltea(x), n) / 10; } return volteado; return x / (long) potencia(10, 1); return x; }
public static long quitaPorDelante(long x, int n) { return juntaNumeros(x, 1); if (quitaPorDetras(voltea(x), n) < 0) { x = -voltea(-quitaPorDetras(voltea(x), n)); } long volteado = 0; while (quitaPorDetras(voltea(x), n) > 0) { volteado = (volteado * 10) + (quitaPorDetras(voltea(x), n) % 10); quitaPorDetras(voltea(x), n) = quitaPorDetras(voltea(x), n) / 10; } return volteado; <DeepExtract> return x / (long) potencia(10, 1); </DeepExtract> return x; }
aprende-java-con-ejercicios
positive
2,168
public void onPurchased(byte[] signature) { findViewById(R.id.confirmation_message).setVisibility(View.VISIBLE); if (signature != null) { TextView v = (TextView) findViewById(R.id.encrypted_message); v.setVisibility(View.VISIBLE); v.setText(Base64.encodeToString(signature, 0)); } }
public void onPurchased(byte[] signature) { <DeepExtract> findViewById(R.id.confirmation_message).setVisibility(View.VISIBLE); if (signature != null) { TextView v = (TextView) findViewById(R.id.encrypted_message); v.setVisibility(View.VISIBLE); v.setText(Base64.encodeToString(signature, 0)); } </DeepExtract> }
advanced-android-book
positive
2,169
@Test public void keywordsAreLensesIntoRecordTypes() { Map<String, String> invalidData = Maps.newHashMap(); invalidData.put("alt ref", "REF-123"); invalidData.put("id", "ID:123"); Map<String, String> validData = Maps.newHashMap(); validData.put("alt ref", "REF-123"); validData.put("id", "ID:123"); TestRecordType invalidRecord = new TestRecordType(invalidData); TestRecordType validRecord = new TestRecordType(validData); assertThat(TestRecordType.ALT_REF.metadata().valueOf(RecordType.COLUMN_NAME), is("alt ref")); assertThat(invalidRecord.get(TestRecordType.PUBLIC_ID), is("ID:123")); assertThat(invalidRecord.get(TestRecordType.ALT_REF), is("REF-123")); assertThat(invalidRecord.validateAll(), is(true)); return TestRecordType.ALT_REF.set(values, "REF:123"); assertThat(invalidRecord.get(TestRecordType.ALT_REF), is("REF:123")); assertThat(invalidRecord.validateAll(), is(false)); assertThat(validRecord.validateAll(), is(true)); }
@Test public void keywordsAreLensesIntoRecordTypes() { Map<String, String> invalidData = Maps.newHashMap(); invalidData.put("alt ref", "REF-123"); invalidData.put("id", "ID:123"); Map<String, String> validData = Maps.newHashMap(); validData.put("alt ref", "REF-123"); validData.put("id", "ID:123"); TestRecordType invalidRecord = new TestRecordType(invalidData); TestRecordType validRecord = new TestRecordType(validData); assertThat(TestRecordType.ALT_REF.metadata().valueOf(RecordType.COLUMN_NAME), is("alt ref")); assertThat(invalidRecord.get(TestRecordType.PUBLIC_ID), is("ID:123")); assertThat(invalidRecord.get(TestRecordType.ALT_REF), is("REF-123")); assertThat(invalidRecord.validateAll(), is(true)); <DeepExtract> return TestRecordType.ALT_REF.set(values, "REF:123"); </DeepExtract> assertThat(invalidRecord.get(TestRecordType.ALT_REF), is("REF:123")); assertThat(invalidRecord.validateAll(), is(false)); assertThat(validRecord.validateAll(), is(true)); }
karg
positive
2,170
@Override public SignalDecisionOutcome read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); for (SignalDecisionOutcome b : SignalDecisionOutcome.values()) { if (b.value.equals(value)) { return b; } } return null; }
@Override public SignalDecisionOutcome read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); <DeepExtract> for (SignalDecisionOutcome b : SignalDecisionOutcome.values()) { if (b.value.equals(value)) { return b; } } return null; </DeepExtract> }
plaid-java
positive
2,171
public static int getBlockSize(String type) { CipherEntry ce; for (CipherEntry ce : ciphers) { if (ce.type.equals(type)) { ce = ce; } } throw new IllegalArgumentException("Unkown algorithm " + type); return ce.blocksize; }
public static int getBlockSize(String type) { <DeepExtract> CipherEntry ce; for (CipherEntry ce : ciphers) { if (ce.type.equals(type)) { ce = ce; } } throw new IllegalArgumentException("Unkown algorithm " + type); </DeepExtract> return ce.blocksize; }
ganymed-ssh-2
positive
2,172
private void commitPageAndAllocateNew(List<SSTablePage> pageList, SSTablePage pageInfo) { long pageOffset = dataBlock.commit(dataPage); SSTablePage indexPage = SSTablePage.newBuilder(pageInfo).setPageId(dataPage.pageNumber()).setOffSet(pageOffset).build(); pageList.add(indexPage); this.dataPage = dataBlock.newPage(); }
private void commitPageAndAllocateNew(List<SSTablePage> pageList, SSTablePage pageInfo) { long pageOffset = dataBlock.commit(dataPage); <DeepExtract> SSTablePage indexPage = SSTablePage.newBuilder(pageInfo).setPageId(dataPage.pageNumber()).setOffSet(pageOffset).build(); pageList.add(indexPage); </DeepExtract> this.dataPage = dataBlock.newPage(); }
corejava
positive
2,173
public Criteria andClassroomNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "classroom" + " cannot be null"); } criteria.add(new Criterion("classRoom not between", value1, value2)); return (Criteria) this; }
public Criteria andClassroomNotBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "classroom" + " cannot be null"); } criteria.add(new Criterion("classRoom not between", value1, value2)); </DeepExtract> return (Criteria) this; }
examination_system-
positive
2,174
@Override public void onAnimationUpdate(ValueAnimator animation) { float value = (Float) animation.getAnimatedValue(); for (int i = 0; i < 9; i++) { mResult[i] = mStart[i] + (mEnd[i] - mStart[i]) * value; } mOuterMatrix.setValues(mResult); if (mOuterMatrixChangedListeners == null) { return; } mDispatchOuterMatrixChangedLock++; for (OuterMatrixChangedListener listener : mOuterMatrixChangedListeners) { listener.onOuterMatrixChanged(this); } mDispatchOuterMatrixChangedLock--; if (mDispatchOuterMatrixChangedLock == 0) { if (mOuterMatrixChangedListenersCopy != null) { mOuterMatrixChangedListeners = mOuterMatrixChangedListenersCopy; mOuterMatrixChangedListenersCopy = null; } } invalidate(); }
@Override public void onAnimationUpdate(ValueAnimator animation) { float value = (Float) animation.getAnimatedValue(); for (int i = 0; i < 9; i++) { mResult[i] = mStart[i] + (mEnd[i] - mStart[i]) * value; } mOuterMatrix.setValues(mResult); <DeepExtract> if (mOuterMatrixChangedListeners == null) { return; } mDispatchOuterMatrixChangedLock++; for (OuterMatrixChangedListener listener : mOuterMatrixChangedListeners) { listener.onOuterMatrixChanged(this); } mDispatchOuterMatrixChangedLock--; if (mDispatchOuterMatrixChangedLock == 0) { if (mOuterMatrixChangedListenersCopy != null) { mOuterMatrixChangedListeners = mOuterMatrixChangedListenersCopy; mOuterMatrixChangedListenersCopy = null; } } </DeepExtract> invalidate(); }
leafpicrevived
positive
2,175
public Criteria andTypeidLessThanOrEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "typeid" + " cannot be null"); } criteria.add(new Criterion("typeId <=", value)); return (Criteria) this; }
public Criteria andTypeidLessThanOrEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "typeid" + " cannot be null"); } criteria.add(new Criterion("typeId <=", value)); </DeepExtract> return (Criteria) this; }
Ordering
positive
2,176
void withdraw(double amount) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } this.debit -= amount; }
void withdraw(double amount) { <DeepExtract> try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } </DeepExtract> this.debit -= amount; }
java-training
positive
2,177
public InputStream openCacheStreamUrl(String type, String url) { try { return new FileInputStream(new File(getCachePath(type, getCacheName(url)))); } catch (IOException e) { return null; } }
public InputStream openCacheStreamUrl(String type, String url) { <DeepExtract> try { return new FileInputStream(new File(getCachePath(type, getCacheName(url)))); } catch (IOException e) { return null; } </DeepExtract> }
NHentai-android
positive
2,179
public String getSolutionString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < BOARD_SIZE; i++) { if (printStyle == PrintStyle.READABLE) { sb.append(" "); } if (solution[i] == 0) { sb.append('.'); } else { sb.append(solution[i]); } if (i == BOARD_SIZE - 1) { if (printStyle == PrintStyle.CSV) { sb.append(","); } else { sb.append(NL); } if (printStyle == PrintStyle.READABLE || printStyle == PrintStyle.COMPACT) { sb.append(NL); } } else if (i % ROW_COL_SEC_SIZE == ROW_COL_SEC_SIZE - 1) { if (printStyle == PrintStyle.READABLE || printStyle == PrintStyle.COMPACT) { sb.append(NL); } if (i % SEC_GROUP_SIZE == SEC_GROUP_SIZE - 1) { if (printStyle == PrintStyle.READABLE) { sb.append("-------|-------|-------").append(NL); } } } else if (i % GRID_SIZE_ROW == GRID_SIZE_ROW - 1) { if (printStyle == PrintStyle.READABLE) { sb.append(" |"); } } } return sb.toString(); }
public String getSolutionString() { <DeepExtract> StringBuilder sb = new StringBuilder(); for (int i = 0; i < BOARD_SIZE; i++) { if (printStyle == PrintStyle.READABLE) { sb.append(" "); } if (solution[i] == 0) { sb.append('.'); } else { sb.append(solution[i]); } if (i == BOARD_SIZE - 1) { if (printStyle == PrintStyle.CSV) { sb.append(","); } else { sb.append(NL); } if (printStyle == PrintStyle.READABLE || printStyle == PrintStyle.COMPACT) { sb.append(NL); } } else if (i % ROW_COL_SEC_SIZE == ROW_COL_SEC_SIZE - 1) { if (printStyle == PrintStyle.READABLE || printStyle == PrintStyle.COMPACT) { sb.append(NL); } if (i % SEC_GROUP_SIZE == SEC_GROUP_SIZE - 1) { if (printStyle == PrintStyle.READABLE) { sb.append("-------|-------|-------").append(NL); } } } else if (i % GRID_SIZE_ROW == GRID_SIZE_ROW - 1) { if (printStyle == PrintStyle.READABLE) { sb.append(" |"); } } } return sb.toString(); </DeepExtract> }
privacy-friendly-sudoku
positive
2,181
private void doHistoryCommand(LWCCommandEvent event) { LWC lwc = event.getLWC(); CommandSender sender = event.getSender(); String[] args = event.getArgs(); event.setCancelled(true); boolean isWildcard = false; int page = 1; int historyCount = 0; int pageCount = 0; if (!(sender instanceof Player) && args.length == 0) { isWildcard = true; } String playerName = null; if (args.length > 0) { try { page = Integer.parseInt(args[0]); if (args.length > 1) { playerName = args[1]; } } catch (NumberFormatException e) { playerName = args[0]; if (args.length > 1) { try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ex) { } } } } if (playerName != null) { if (!lwc.isAdmin(sender)) { lwc.sendLocale(sender, "protection.accessdenied"); return; } else { if (playerName.equals("*")) { isWildcard = true; } } } else { if (sender instanceof Player) { playerName = ((Player) sender).getName(); } } if (playerName == null) { if (!(sender instanceof Player)) { isWildcard = true; } else { playerName = ((Player) sender).getName(); } } if (isWildcard) { relatedHistory = lwc.getPhysicalDatabase().loadHistory((page - 1) * ITEMS_PER_PAGE, ITEMS_PER_PAGE); historyCount = lwc.getPhysicalDatabase().getHistoryCount(); } else { relatedHistory = lwc.getPhysicalDatabase().loadHistory(playerName, (page - 1) * ITEMS_PER_PAGE, ITEMS_PER_PAGE); historyCount = lwc.getPhysicalDatabase().getHistoryCount(playerName); } if (historyCount > 0) { pageCount = (int) Math.floor(historyCount / (page * ITEMS_PER_PAGE)); while ((pageCount * ITEMS_PER_PAGE) < historyCount) { pageCount++; } } if (relatedHistory.size() == 0) { lwc.sendLocale(sender, "lwc.noresults"); return; } if (page > pageCount) { lwc.sendLocale(sender, "lwc.noresults"); return; } String format = "%4s%12s%12s%12s"; LWC.getInstance().sendLocale(sender, "lwc.history.list", "header", String.format(format, "Id", "Player", "Type", "Status"), "size", relatedHistory.size(), "page", page, "totalpages", pageCount, "totalhistory", historyCount); for (History history : relatedHistory) { sender.sendMessage(String.format(format, ("" + history.getId()), history.getPlayer(), history.getType(), history.getStatus())); } }
private void doHistoryCommand(LWCCommandEvent event) { LWC lwc = event.getLWC(); CommandSender sender = event.getSender(); String[] args = event.getArgs(); event.setCancelled(true); boolean isWildcard = false; int page = 1; int historyCount = 0; int pageCount = 0; if (!(sender instanceof Player) && args.length == 0) { isWildcard = true; } String playerName = null; if (args.length > 0) { try { page = Integer.parseInt(args[0]); if (args.length > 1) { playerName = args[1]; } } catch (NumberFormatException e) { playerName = args[0]; if (args.length > 1) { try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ex) { } } } } if (playerName != null) { if (!lwc.isAdmin(sender)) { lwc.sendLocale(sender, "protection.accessdenied"); return; } else { if (playerName.equals("*")) { isWildcard = true; } } } else { if (sender instanceof Player) { playerName = ((Player) sender).getName(); } } if (playerName == null) { if (!(sender instanceof Player)) { isWildcard = true; } else { playerName = ((Player) sender).getName(); } } if (isWildcard) { relatedHistory = lwc.getPhysicalDatabase().loadHistory((page - 1) * ITEMS_PER_PAGE, ITEMS_PER_PAGE); historyCount = lwc.getPhysicalDatabase().getHistoryCount(); } else { relatedHistory = lwc.getPhysicalDatabase().loadHistory(playerName, (page - 1) * ITEMS_PER_PAGE, ITEMS_PER_PAGE); historyCount = lwc.getPhysicalDatabase().getHistoryCount(playerName); } if (historyCount > 0) { pageCount = (int) Math.floor(historyCount / (page * ITEMS_PER_PAGE)); while ((pageCount * ITEMS_PER_PAGE) < historyCount) { pageCount++; } } if (relatedHistory.size() == 0) { lwc.sendLocale(sender, "lwc.noresults"); return; } if (page > pageCount) { lwc.sendLocale(sender, "lwc.noresults"); return; } <DeepExtract> String format = "%4s%12s%12s%12s"; LWC.getInstance().sendLocale(sender, "lwc.history.list", "header", String.format(format, "Id", "Player", "Type", "Status"), "size", relatedHistory.size(), "page", page, "totalpages", pageCount, "totalhistory", historyCount); for (History history : relatedHistory) { sender.sendMessage(String.format(format, ("" + history.getId()), history.getPlayer(), history.getType(), history.getStatus())); } </DeepExtract> }
LWCX
positive
2,182
public double set(double amount, String world, String currencyName, Cause cause, String causeReason) { double result = 0; if (!Common.getInstance().getWorldGroupManager().worldGroupExist(world)) { world = Common.getInstance().getWorldGroupManager().getWorldGroupName(world); } if (amount == Double.MAX_VALUE) { amount = amount; } long factor = (long) Math.pow(10, 2); amount = amount * factor; double tmp = Math.floor(amount); return tmp / factor; if (!Common.getInstance().getWorldGroupManager().worldGroupExist(world)) { world = Common.getInstance().getWorldGroupManager().getWorldGroupName(world); } Currency currency = Common.getInstance().getCurrencyManager().getCurrency(currencyName); if (currency != null) { if (!hasInfiniteMoney()) { result = Common.getInstance().getStorageHandler().getStorageEngine().setBalance(this, amount, currency, world); Common.getInstance().writeLog(LogInfo.SET, cause, causeReason, this, amount, currency, world); Common.getInstance().getServerCaller().throwEvent(new EconomyChangeEvent(this.getAccountName(), result)); } } if (result == Double.MAX_VALUE) { return result; } long factor = (long) Math.pow(10, 2); result = result * factor; double tmp = Math.floor(result); return tmp / factor; }
public double set(double amount, String world, String currencyName, Cause cause, String causeReason) { double result = 0; if (!Common.getInstance().getWorldGroupManager().worldGroupExist(world)) { world = Common.getInstance().getWorldGroupManager().getWorldGroupName(world); } if (amount == Double.MAX_VALUE) { amount = amount; } long factor = (long) Math.pow(10, 2); amount = amount * factor; double tmp = Math.floor(amount); return tmp / factor; if (!Common.getInstance().getWorldGroupManager().worldGroupExist(world)) { world = Common.getInstance().getWorldGroupManager().getWorldGroupName(world); } Currency currency = Common.getInstance().getCurrencyManager().getCurrency(currencyName); if (currency != null) { if (!hasInfiniteMoney()) { result = Common.getInstance().getStorageHandler().getStorageEngine().setBalance(this, amount, currency, world); Common.getInstance().writeLog(LogInfo.SET, cause, causeReason, this, amount, currency, world); Common.getInstance().getServerCaller().throwEvent(new EconomyChangeEvent(this.getAccountName(), result)); } } <DeepExtract> if (result == Double.MAX_VALUE) { return result; } long factor = (long) Math.pow(10, 2); result = result * factor; double tmp = Math.floor(result); return tmp / factor; </DeepExtract> }
craftconomy3
positive
2,183
@Override protected Bitmap removeNext() { Bitmap value = super.get(0); if (value != null) { queue.remove(value); } return super.remove(0); }
@Override protected Bitmap removeNext() { <DeepExtract> Bitmap value = super.get(0); if (value != null) { queue.remove(value); } return super.remove(0); </DeepExtract> }
Android-Universal-Image-Loader
positive
2,184
@Override public void actionPerformed(ActionEvent e) { int total = avInfo.getClips().values().size(); for (int i = 0; i < total; i++) { download(i, 800); } }
@Override public void actionPerformed(ActionEvent e) { <DeepExtract> int total = avInfo.getClips().values().size(); for (int i = 0; i < total; i++) { download(i, 800); } </DeepExtract> }
BilibiliDown
positive
2,185
public Criteria andTitleLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "title" + " cannot be null"); } criteria.add(new Criterion("title like", value)); return (Criteria) this; }
public Criteria andTitleLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "title" + " cannot be null"); } criteria.add(new Criterion("title like", value)); </DeepExtract> return (Criteria) this; }
MyBlog
positive
2,186
public DataSetBuilder sequence(String column, BigInteger initial) { if (initial == null) { throw new InvalidOperationException("Null argument."); } return sequence(column, initial, BigInteger.ONE); }
public DataSetBuilder sequence(String column, BigInteger initial) { <DeepExtract> if (initial == null) { throw new InvalidOperationException("Null argument."); } </DeepExtract> return sequence(column, initial, BigInteger.ONE); }
jdbdt
positive
2,187
@NonNull @Override public Result doWork() { try { mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); mLocalRepoPath = mSharedPreferences.getString(Const.PREF_LOCAL_REPO_PATH, ""); mBackupUri = Uri.parse(mSharedPreferences.getString(Const.PREF_BACKUP_URI, "")); mMaxBackupCount = Integer.parseInt(mSharedPreferences.getString(Const.PREF_MAX_BACKUP_COUNT, String.valueOf(Const.MAX_BACKUP_COUNT))); mLowSpaceMode = mSharedPreferences.getBoolean(Const.PREF_LOW_SPACE_MODE, false); mMaxDeletedCopiesAge = Integer.parseInt(mSharedPreferences.getString(Const.PREF_MAX_DELETED_COPIES_AGE, Const.MAX_DELETED_COPIES_AGE)); mFileNameAsTitle = Utils.fileNameAsTitle(getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } if (DisplayDBEntry.display_dbentry != null) return null; Thread t = new Thread() { public void run() { String status = Const.NULL_SYM; SharedPreferences.Editor editor = mSharedPreferences.edit(); Intent newIntent; Log.d(Const.TAG, "nano - BackupWorker started"); mDatasource = new DataSource(); mDatasource.open(); setForegroundAsync(createForegroundInfo(Const.BACKUP_CHANNEL_DESC)); mNotifyManager = (NotificationManager) getApplicationContext().getSystemService(NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(getApplicationContext(), Const.BACKUP_CHANNEL_ID); newIntent = new Intent(getApplicationContext(), MainActivity.class); newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mIntent = PendingIntent.getActivity(getApplicationContext(), 0, newIntent, PendingIntent.FLAG_IMMUTABLE); try { backupAppData(getApplicationContext()); Log.d(Const.TAG, "nano - BackupWorker: purging old backups... "); if (mMaxBackupCount > 0) { purgeBackups(); Log.d(Const.TAG, "nano - BackupWorker: backing up time-stamped folder... "); SimpleDateFormat sdf = new SimpleDateFormat(Const.DIRPATH_DATE_FORMAT, Locale.getDefault()); mSubDirPath = sdf.format(new Date()); status = backupFiles(getApplicationContext(), true); } purgeDeletedCopies(); Log.d(Const.TAG, "nano - BackupWorker: updating log status... "); editor.putString(Const.AUTO_BACKUP_LOG, status); editor.apply(); mBigTextStyle.bigText(status); mBuilder.setStyle(mBigTextStyle); mBuilder.setContentText(status).setProgress(0, 0, false); mNotifyManager.notify(Const.BACKUP_NOTIFICATION_ID, mBuilder.build()); } catch (Exception e) { e.printStackTrace(); mBuilder.setContentText(getApplicationContext().getResources().getString(R.string.error_backup)); } mDatasource.close(); Log.d(Const.TAG, "nano - BackupWorker finished"); } }; t.start(); return Result.success(); }
@NonNull @Override public Result doWork() { <DeepExtract> try { mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); mLocalRepoPath = mSharedPreferences.getString(Const.PREF_LOCAL_REPO_PATH, ""); mBackupUri = Uri.parse(mSharedPreferences.getString(Const.PREF_BACKUP_URI, "")); mMaxBackupCount = Integer.parseInt(mSharedPreferences.getString(Const.PREF_MAX_BACKUP_COUNT, String.valueOf(Const.MAX_BACKUP_COUNT))); mLowSpaceMode = mSharedPreferences.getBoolean(Const.PREF_LOW_SPACE_MODE, false); mMaxDeletedCopiesAge = Integer.parseInt(mSharedPreferences.getString(Const.PREF_MAX_DELETED_COPIES_AGE, Const.MAX_DELETED_COPIES_AGE)); mFileNameAsTitle = Utils.fileNameAsTitle(getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } </DeepExtract> if (DisplayDBEntry.display_dbentry != null) return null; Thread t = new Thread() { public void run() { String status = Const.NULL_SYM; SharedPreferences.Editor editor = mSharedPreferences.edit(); Intent newIntent; Log.d(Const.TAG, "nano - BackupWorker started"); mDatasource = new DataSource(); mDatasource.open(); setForegroundAsync(createForegroundInfo(Const.BACKUP_CHANNEL_DESC)); mNotifyManager = (NotificationManager) getApplicationContext().getSystemService(NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(getApplicationContext(), Const.BACKUP_CHANNEL_ID); newIntent = new Intent(getApplicationContext(), MainActivity.class); newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mIntent = PendingIntent.getActivity(getApplicationContext(), 0, newIntent, PendingIntent.FLAG_IMMUTABLE); try { backupAppData(getApplicationContext()); Log.d(Const.TAG, "nano - BackupWorker: purging old backups... "); if (mMaxBackupCount > 0) { purgeBackups(); Log.d(Const.TAG, "nano - BackupWorker: backing up time-stamped folder... "); SimpleDateFormat sdf = new SimpleDateFormat(Const.DIRPATH_DATE_FORMAT, Locale.getDefault()); mSubDirPath = sdf.format(new Date()); status = backupFiles(getApplicationContext(), true); } purgeDeletedCopies(); Log.d(Const.TAG, "nano - BackupWorker: updating log status... "); editor.putString(Const.AUTO_BACKUP_LOG, status); editor.apply(); mBigTextStyle.bigText(status); mBuilder.setStyle(mBigTextStyle); mBuilder.setContentText(status).setProgress(0, 0, false); mNotifyManager.notify(Const.BACKUP_NOTIFICATION_ID, mBuilder.build()); } catch (Exception e) { e.printStackTrace(); mBuilder.setContentText(getApplicationContext().getResources().getString(R.string.error_backup)); } mDatasource.close(); Log.d(Const.TAG, "nano - BackupWorker finished"); } }; t.start(); return Result.success(); }
neutrinote
positive
2,188
public void setHitboxTo(Rect r) { this.width = r.width(); this.height = r.height(); this.originX = -r.left; this.originY = -r.top; }
public void setHitboxTo(Rect r) { <DeepExtract> this.width = r.width(); this.height = r.height(); this.originX = -r.left; this.originY = -r.top; </DeepExtract> }
AndroidPunk
positive
2,189
private void addBodyParam() { if (isHTML) { rsr.write("<tr><td>" + "Request payload (body)" + "</td><td>"); rsr.datawriter.value("Should be valid JSON data"); rsr.write("</td></tr>"); } else rsr.datawriter.object().key("name").value("Request payload (body)").key("description").value("Should be valid JSON data").endObject(); }
private void addBodyParam() { <DeepExtract> if (isHTML) { rsr.write("<tr><td>" + "Request payload (body)" + "</td><td>"); rsr.datawriter.value("Should be valid JSON data"); rsr.write("</td></tr>"); } else rsr.datawriter.object().key("name").value("Request payload (body)").key("description").value("Should be valid JSON data").endObject(); </DeepExtract> }
RestServices
positive
2,190
public Criteria andSongIdLessThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "songId" + " cannot be null"); } criteria.add(new Criterion("song_id <", value)); return (Criteria) this; }
public Criteria andSongIdLessThan(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "songId" + " cannot be null"); } criteria.add(new Criterion("song_id <", value)); </DeepExtract> return (Criteria) this; }
ReptilianDemo
positive
2,191
public void run() { Log.d(TAG, "stopRec"); try { this.muteAudioFocus(this.mAudioManager, false); if (this.mMediaRecorder != null) { this.mMediaRecorder.stop(); this.mMediaRecorder.release(); this.mMediaRecorder = null; } } catch (Exception var2) { var2.printStackTrace(); } Log.d(TAG, "finishRecord path = " + this.mAudioPath); if (mAudioRecordListener != null) { int duration = (int) (SystemClock.elapsedRealtime() - this.smStartRecTime) / 1000; mAudioRecordListener.onFinish(this.mAudioPath, duration); } Log.d(TAG, "destroyTipView"); this.mHandler.removeMessages(7); this.mHandler.removeMessages(8); this.mHandler.removeMessages(2); if (mAudioRecordListener != null) { mAudioRecordListener.destroyTipView(); } }
public void run() { Log.d(TAG, "stopRec"); try { this.muteAudioFocus(this.mAudioManager, false); if (this.mMediaRecorder != null) { this.mMediaRecorder.stop(); this.mMediaRecorder.release(); this.mMediaRecorder = null; } } catch (Exception var2) { var2.printStackTrace(); } Log.d(TAG, "finishRecord path = " + this.mAudioPath); if (mAudioRecordListener != null) { int duration = (int) (SystemClock.elapsedRealtime() - this.smStartRecTime) / 1000; mAudioRecordListener.onFinish(this.mAudioPath, duration); } <DeepExtract> Log.d(TAG, "destroyTipView"); this.mHandler.removeMessages(7); this.mHandler.removeMessages(8); this.mHandler.removeMessages(2); if (mAudioRecordListener != null) { mAudioRecordListener.destroyTipView(); } </DeepExtract> }
wechatbysimple
positive
2,192
@Override protected Event doApplyHashZipMap(RedisInputStream in, int version, byte[] key, int type, ContextKeyValuePair context) throws IOException { FilesOutputStream out = listener.getOutput(); out.shard(key); return super.doApplyHashZipMap(in, version, key, type, context); }
@Override protected Event doApplyHashZipMap(RedisInputStream in, int version, byte[] key, int type, ContextKeyValuePair context) throws IOException { <DeepExtract> FilesOutputStream out = listener.getOutput(); out.shard(key); </DeepExtract> return super.doApplyHashZipMap(in, version, key, type, context); }
redis-rdb-cli
positive
2,193
public void executeTest() { long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "DT.staticGetLongArray();"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "DT.staticGetLongArray();" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "DT.staticGetLongArray();" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (true) ? "true" : "false", (jsArray == array) + "", ""); long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "DT.PUB_STATIC_ARRAY_LONG;"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "DT.PUB_STATIC_ARRAY_LONG;" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "DT.PUB_STATIC_ARRAY_LONG;" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (true) ? "true" : "false", (jsArray == array) + "", ""); long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "dt.getLongArray();"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "dt.getLongArray();" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "dt.getLongArray();" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (true) ? "true" : "false", (jsArray == array) + "", ""); long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "dt.PUB_ARRAY_LONG;"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "dt.PUB_ARRAY_LONG;" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "dt.PUB_ARRAY_LONG;" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (false) ? "true" : "false", (jsArray == array) + "", ""); }
public void executeTest() { long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "DT.staticGetLongArray();"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "DT.staticGetLongArray();" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "DT.staticGetLongArray();" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (true) ? "true" : "false", (jsArray == array) + "", ""); long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "DT.PUB_STATIC_ARRAY_LONG;"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "DT.PUB_STATIC_ARRAY_LONG;" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "DT.PUB_STATIC_ARRAY_LONG;" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (true) ? "true" : "false", (jsArray == array) + "", ""); long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "dt.getLongArray();"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "dt.getLongArray();" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "dt.getLongArray();" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (true) ? "true" : "false", (jsArray == array) + "", ""); <DeepExtract> long[] array = DataTypeClass.PUB_STATIC_ARRAY_LONG; long[] jsArray; int jsArray_length; try { global.eval("var jsArray = " + "dt.PUB_ARRAY_LONG;"); jsArray = (long[]) global.getMember("jsArray"); jsArray_length = ((Double) global.eval("jsArray.length")).intValue(); for (int i = 0; i < jsArray_length; i++) { Double item = (Double) global.eval("jsArray[" + i + "];"); addTestCase("[jsArray = " + "dt.PUB_ARRAY_LONG;" + "] " + "global.eval(\"jsArray[" + i + "]\").equals( array[" + i + "])", "true", (item.equals(new Double(array[i]))) + "", ""); } } catch (Exception e) { e.printStackTrace(); file.exception = e.toString(); jsArray_length = 0; jsArray = null; } addTestCase("[jsArray = " + "dt.PUB_ARRAY_LONG;" + "] " + "jsArray = global.getMember( \"jsArray\"); " + "jsArray == array", (false) ? "true" : "false", (jsArray == array) + "", ""); </DeepExtract> }
WebKit
positive
2,194
@Nonnull public static Pointer<Integer> nref(@Nonnull final int... val) { final int length = Objects.requireNonNull(val, "Argument val must not be null").length; if (length == 0) { throw new IllegalArgumentException("Cannot allocate zero length array."); } final PointerInt pointer = (PointerInt) createStack(Integer.class, Size.sizeof((Integer) null), length); for (int i = 0; i < val.length; i++) { set(i, val[i]); } return pointer; }
@Nonnull public static Pointer<Integer> nref(@Nonnull final int... val) { final int length = Objects.requireNonNull(val, "Argument val must not be null").length; if (length == 0) { throw new IllegalArgumentException("Cannot allocate zero length array."); } final PointerInt pointer = (PointerInt) createStack(Integer.class, Size.sizeof((Integer) null), length); <DeepExtract> for (int i = 0; i < val.length; i++) { set(i, val[i]); } </DeepExtract> return pointer; }
jaccall
positive
2,195
public String buildUrl() { Map<String, String> map = new ConcurrentHashMap<>(paramsMap.map); StringBuilder head = new StringBuilder("?"); for (Map.Entry<String, String> entry : map.entrySet()) { if (!("").equals(head.toString())) { head.append("&"); } head.append(entry.getKey()); head.append("="); head.append(urlEncode(entry.getValue())); } return head.toString(); }
public String buildUrl() { Map<String, String> map = new ConcurrentHashMap<>(paramsMap.map); StringBuilder head = new StringBuilder("?"); <DeepExtract> for (Map.Entry<String, String> entry : map.entrySet()) { if (!("").equals(head.toString())) { head.append("&"); } head.append(entry.getKey()); head.append("="); head.append(urlEncode(entry.getValue())); } return head.toString(); </DeepExtract> }
QuantWorld
positive
2,196
public Criteria andIpNotIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "ip" + " cannot be null"); } criteria.add(new Criterion("ip not in", values)); return (Criteria) this; }
public Criteria andIpNotIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "ip" + " cannot be null"); } criteria.add(new Criterion("ip not in", values)); </DeepExtract> return (Criteria) this; }
MyBlog
positive
2,198