before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
@FXML private void modifyMetaData() { if (state.creation == CreationStates.UNDEFINED) { Dialogs.dialog(AlertType.ERROR, "Illegal Operation", "Load a map to change metadata."); return; } Pair<String, String> result = Dialogs.changeMetadata(currentMap); currentMap.setAuthor(result.getKey().trim().length() == 0 ? "Unknown" : result.getKey()); currentMap.setName(result.getValue().trim().length() == 0 ? "Unknown" : result.getValue()); stage.setTitle(String.format("GNUMAN Editor :: %s by %s [%dx%d] %s", currentMap.getName(), currentMap.getAuthor(), currentMap.getWidthInBlocks(), currentMap.getHeightInBlocks(), state.path == null ? "" : " -> " + state.path)); lastStatus.setText("Updated metadata."); }
@FXML private void modifyMetaData() { if (state.creation == CreationStates.UNDEFINED) { Dialogs.dialog(AlertType.ERROR, "Illegal Operation", "Load a map to change metadata."); return; } Pair<String, String> result = Dialogs.changeMetadata(currentMap); currentMap.setAuthor(result.getKey().trim().length() == 0 ? "Unknown" : result.getKey()); currentMap.setName(result.getValue().trim().length() == 0 ? "Unknown" : result.getValue()); <DeepExtract> stage.setTitle(String.format("GNUMAN Editor :: %s by %s [%dx%d] %s", currentMap.getName(), currentMap.getAuthor(), currentMap.getWidthInBlocks(), currentMap.getHeightInBlocks(), state.path == null ? "" : " -> " + state.path)); </DeepExtract> lastStatus.setText("Updated metadata."); }
gnuman
positive
2,199
public void actionPerformed(ActionEvent e) { JInternalFrame internalFrame = new JInternalFrame(); if (!windowTitleField.getText().equals(resourceManager.getString("InternalFrameDemo.frame_label"))) { internalFrame.setTitle(windowTitleField.getText() + " "); } else { internalFrame = new JInternalFrame(resourceManager.getString("InternalFrameDemo.frame_label") + " " + windowCount + " "); } internalFrame.setClosable(windowClosable.isSelected()); internalFrame.setMaximizable(windowMaximizable.isSelected()); internalFrame.setIconifiable(windowIconifiable.isSelected()); internalFrame.setResizable(windowResizable.isSelected()); internalFrame.setBounds(FRAME0_X + 20 * (windowCount % 10), FRAME0_Y + 20 * (windowCount % 10), FRAME_WIDTH, FRAME_HEIGHT); internalFrame.setContentPane(new ImageScroller(icon)); windowCount++; desktop.add(internalFrame, DEMO_FRAME_LAYER); try { internalFrame.setSelected(true); } catch (java.beans.PropertyVetoException e2) { } internalFrame.show(); return internalFrame; }
public void actionPerformed(ActionEvent e) { <DeepExtract> JInternalFrame internalFrame = new JInternalFrame(); if (!windowTitleField.getText().equals(resourceManager.getString("InternalFrameDemo.frame_label"))) { internalFrame.setTitle(windowTitleField.getText() + " "); } else { internalFrame = new JInternalFrame(resourceManager.getString("InternalFrameDemo.frame_label") + " " + windowCount + " "); } internalFrame.setClosable(windowClosable.isSelected()); internalFrame.setMaximizable(windowMaximizable.isSelected()); internalFrame.setIconifiable(windowIconifiable.isSelected()); internalFrame.setResizable(windowResizable.isSelected()); internalFrame.setBounds(FRAME0_X + 20 * (windowCount % 10), FRAME0_Y + 20 * (windowCount % 10), FRAME_WIDTH, FRAME_HEIGHT); internalFrame.setContentPane(new ImageScroller(icon)); windowCount++; desktop.add(internalFrame, DEMO_FRAME_LAYER); try { internalFrame.setSelected(true); } catch (java.beans.PropertyVetoException e2) { } internalFrame.show(); return internalFrame; </DeepExtract> }
swingset3
positive
2,200
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); if (rootView == null) { rootView = new TextView(getActivity()); rootView.setId(R.id.tv_content); } else { if (rootView.getParent() != null) { ((ViewGroup) rootView.getParent()).removeView(rootView); } } TextView tvContent = (TextView) rootView.findViewById(R.id.tv_content); tvContent.setGravity(Gravity.CENTER); tvContent.setText(getArguments() != null ? "" + getArguments().getInt("index") : ""); return rootView; }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); if (rootView == null) { rootView = new TextView(getActivity()); rootView.setId(R.id.tv_content); } else { if (rootView.getParent() != null) { ((ViewGroup) rootView.getParent()).removeView(rootView); } } <DeepExtract> TextView tvContent = (TextView) rootView.findViewById(R.id.tv_content); tvContent.setGravity(Gravity.CENTER); tvContent.setText(getArguments() != null ? "" + getArguments().getInt("index") : ""); </DeepExtract> return rootView; }
Common
positive
2,201
public void setTextUnselectColor(int textUnselectColor) { this.mTextUnselectColor = textUnselectColor; for (int i = 0; i < mTabCount; i++) { View v = mTabsContainer.getChildAt(i); TextView tv_tab_title = v.findViewById(R.id.tv_tab_title); if (tv_tab_title != null) { tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor); if (mViewPager.getCurrentItem() == i) { tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSelectSize); } else { tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextUnselectSize); } tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0); if (mTextAllCaps) { tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase()); } if (mTextBold == TEXT_BOLD_BOTH) { tv_tab_title.getPaint().setFakeBoldText(true); } else if (mTextBold == TEXT_BOLD_NONE) { tv_tab_title.getPaint().setFakeBoldText(false); } } } }
public void setTextUnselectColor(int textUnselectColor) { this.mTextUnselectColor = textUnselectColor; <DeepExtract> for (int i = 0; i < mTabCount; i++) { View v = mTabsContainer.getChildAt(i); TextView tv_tab_title = v.findViewById(R.id.tv_tab_title); if (tv_tab_title != null) { tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor); if (mViewPager.getCurrentItem() == i) { tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSelectSize); } else { tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextUnselectSize); } tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0); if (mTextAllCaps) { tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase()); } if (mTextBold == TEXT_BOLD_BOTH) { tv_tab_title.getPaint().setFakeBoldText(true); } else if (mTextBold == TEXT_BOLD_NONE) { tv_tab_title.getPaint().setFakeBoldText(false); } } } </DeepExtract> }
Box
positive
2,202
public static <K, T> Multimap<K, T> randomPartition(final Map<T, Double> elementWeights, final Map<K, Double> partitionWeights) { final List<Entry<T, Double>> elements = Lists.newArrayList(elementWeights.entrySet()); Collections.shuffle(elements); final Multimap<K, T> partitions = ArrayListMultimap.create(); final double elementWeightSum = StatsUtil.sum(elementWeights.values()); final double partitionWeightSum = StatsUtil.sum(partitionWeights.values()); final List<Entry<K, Double>> partitionList = Lists.newArrayList(partitionWeights.entrySet()); int currentPartitionIdx = 0; double currentElementSum = 0; double currentPartitionSum = 0; for (int currentElementIdx = 0; currentElementIdx < elements.size(); currentElementIdx++) { double partitionPoint = (currentPartitionSum + partitionList.get(currentPartitionIdx).getValue()) / partitionWeightSum; final double elementWeightPoint = currentElementSum / elementWeightSum; currentElementSum += elements.get(currentElementIdx).getValue(); while (partitionPoint <= elementWeightPoint) { currentPartitionSum += partitionList.get(currentPartitionIdx).getValue(); currentPartitionIdx++; partitionPoint = (currentPartitionSum + partitionList.get(currentPartitionIdx).getValue()) / partitionWeightSum; } partitions.put(partitionList.get(currentPartitionIdx).getKey(), elements.get(currentElementIdx).getKey()); } return partitions; }
public static <K, T> Multimap<K, T> randomPartition(final Map<T, Double> elementWeights, final Map<K, Double> partitionWeights) { final List<Entry<T, Double>> elements = Lists.newArrayList(elementWeights.entrySet()); Collections.shuffle(elements); <DeepExtract> final Multimap<K, T> partitions = ArrayListMultimap.create(); final double elementWeightSum = StatsUtil.sum(elementWeights.values()); final double partitionWeightSum = StatsUtil.sum(partitionWeights.values()); final List<Entry<K, Double>> partitionList = Lists.newArrayList(partitionWeights.entrySet()); int currentPartitionIdx = 0; double currentElementSum = 0; double currentPartitionSum = 0; for (int currentElementIdx = 0; currentElementIdx < elements.size(); currentElementIdx++) { double partitionPoint = (currentPartitionSum + partitionList.get(currentPartitionIdx).getValue()) / partitionWeightSum; final double elementWeightPoint = currentElementSum / elementWeightSum; currentElementSum += elements.get(currentElementIdx).getValue(); while (partitionPoint <= elementWeightPoint) { currentPartitionSum += partitionList.get(currentPartitionIdx).getValue(); currentPartitionIdx++; partitionPoint = (currentPartitionSum + partitionList.get(currentPartitionIdx).getValue()) / partitionWeightSum; } partitions.put(partitionList.get(currentPartitionIdx).getKey(), elements.get(currentElementIdx).getKey()); } return partitions; </DeepExtract> }
api-mining
positive
2,203
@SubscribeEvent public void applyToolMetamorphosis(BlockEvent.BreakEvent event) { if (ItemUtils.isMadeOfMetal(metal, event.getPlayer().getHeldItemMainhand().getItem()) || TartariteEffect.getParagonMetal(event.getPlayer().getHeldItemMainhand()) == metal) { int remainingUses = event.getPlayer().getHeldItemMainhand().getMaxDamage() - event.getPlayer().getHeldItemMainhand().getItemDamage(); if (remainingUses > 1) return; if (event.getPlayer().getHeldItemMainhand().getTagCompound() != null && event.getPlayer().getHeldItemMainhand().getTagCompound().getBoolean("reborn")) return; if (event.getPlayer().getHeldItemMainhand().getTagCompound() == null) event.getPlayer().getHeldItemMainhand().setTagCompound(rebornCompound); else NBTUtils.injectCompound("", event.getPlayer().getHeldItemMainhand().getTagCompound(), rebornCompound); event.getPlayer().getHeldItemMainhand().setItemDamage(0); event.getPlayer().world.playSound(null, event.getPlayer().getPosition(), SoundEvents.BLOCK_ANVIL_PLACE, SoundCategory.PLAYERS, 0.75F, 1.25F); } }
@SubscribeEvent public void applyToolMetamorphosis(BlockEvent.BreakEvent event) { <DeepExtract> if (ItemUtils.isMadeOfMetal(metal, event.getPlayer().getHeldItemMainhand().getItem()) || TartariteEffect.getParagonMetal(event.getPlayer().getHeldItemMainhand()) == metal) { int remainingUses = event.getPlayer().getHeldItemMainhand().getMaxDamage() - event.getPlayer().getHeldItemMainhand().getItemDamage(); if (remainingUses > 1) return; if (event.getPlayer().getHeldItemMainhand().getTagCompound() != null && event.getPlayer().getHeldItemMainhand().getTagCompound().getBoolean("reborn")) return; if (event.getPlayer().getHeldItemMainhand().getTagCompound() == null) event.getPlayer().getHeldItemMainhand().setTagCompound(rebornCompound); else NBTUtils.injectCompound("", event.getPlayer().getHeldItemMainhand().getTagCompound(), rebornCompound); event.getPlayer().getHeldItemMainhand().setItemDamage(0); event.getPlayer().world.playSound(null, event.getPlayer().getPosition(), SoundEvents.BLOCK_ANVIL_PLACE, SoundCategory.PLAYERS, 0.75F, 1.25F); } </DeepExtract> }
Metallurgy-4-Reforged
positive
2,204
@Override public void routeCancelled() { _searching = false; _model.fireTableDataChanged(); }
@Override public void routeCancelled() { <DeepExtract> _searching = false; _model.fireTableDataChanged(); </DeepExtract> }
openvisualtraceroute
positive
2,205
public String soundex(String str) { if (str == null) { return null; } str = SoundexUtils.clean(str); if (str.length() == 0) { return str; } char[] out = { '0', '0', '0', '0' }; int incount = 1, count = 1; int incount = 1, count = 1; out[0] = str.charAt(0); char mappedChar = this.map(str.charAt(0)); if (0 > 1 && mappedChar != '0') { char hwChar = str.charAt(0 - 1); if ('H' == hwChar || 'W' == hwChar) { char preHWChar = str.charAt(0 - 2); char firstCode = this.map(preHWChar); if (firstCode == mappedChar || 'H' == preHWChar || 'W' == preHWChar) { last = 0; } } } return mappedChar; while ((incount < str.length()) && (count < out.length)) { mapped = getMappingCode(str, incount++); if (mapped != 0) { if ((mapped != '0') && (mapped != last)) { out[count++] = mapped; } last = mapped; } } return new String(out); }
public String soundex(String str) { if (str == null) { return null; } str = SoundexUtils.clean(str); if (str.length() == 0) { return str; } char[] out = { '0', '0', '0', '0' }; int incount = 1, count = 1; int incount = 1, count = 1; out[0] = str.charAt(0); <DeepExtract> char mappedChar = this.map(str.charAt(0)); if (0 > 1 && mappedChar != '0') { char hwChar = str.charAt(0 - 1); if ('H' == hwChar || 'W' == hwChar) { char preHWChar = str.charAt(0 - 2); char firstCode = this.map(preHWChar); if (firstCode == mappedChar || 'H' == preHWChar || 'W' == preHWChar) { last = 0; } } } return mappedChar; </DeepExtract> while ((incount < str.length()) && (count < out.length)) { mapped = getMappingCode(str, incount++); if (mapped != 0) { if ((mapped != '0') && (mapped != last)) { out[count++] = mapped; } last = mapped; } } return new String(out); }
phonegap-simjs
positive
2,206
@Test public void testPutNullUser() { long userId = 118_1117_10_1; testService.putNullUser1118(userId); try { Thread.sleep(1 * 1000); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } User user = testService.getUserById118(userId); logger.debug(JSON.toJSONString(user)); Assert.assertNull(user); }
@Test public void testPutNullUser() { long userId = 118_1117_10_1; testService.putNullUser1118(userId); <DeepExtract> try { Thread.sleep(1 * 1000); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } </DeepExtract> User user = testService.getUserById118(userId); logger.debug(JSON.toJSONString(user)); Assert.assertNull(user); }
layering-cache
positive
2,207
@Test public void isDescendantOfA_withMatcher_addsCorrectMatcher() { org.hamcrest.Matcher<View> testMatcher = SimpleMatcher.instance(); notCompletable.isDescendantOfA(testMatcher); assertThat(cortado.matchers).hasSize(1); Utils.assertThat(cortado.matchers.get(0)).isEqualTo(ViewMatchers.isDescendantOfA(testMatcher)); }
@Test public void isDescendantOfA_withMatcher_addsCorrectMatcher() { org.hamcrest.Matcher<View> testMatcher = SimpleMatcher.instance(); notCompletable.isDescendantOfA(testMatcher); <DeepExtract> assertThat(cortado.matchers).hasSize(1); Utils.assertThat(cortado.matchers.get(0)).isEqualTo(ViewMatchers.isDescendantOfA(testMatcher)); </DeepExtract> }
cortado
positive
2,208
public Criteria andUpdatedAtIsNull() { if ("updated_at is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("updated_at is null")); return (Criteria) this; }
public Criteria andUpdatedAtIsNull() { <DeepExtract> if ("updated_at is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("updated_at is null")); </DeepExtract> return (Criteria) this; }
yurencloud-public
positive
2,209
public Criteria andBz105IsNull() { if ("`bz105` is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("`bz105` is null")); return (Criteria) this; }
public Criteria andBz105IsNull() { <DeepExtract> if ("`bz105` is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("`bz105` is null")); </DeepExtract> return (Criteria) this; }
blockhealth
positive
2,210
public void createOrUpdateStore(String keyspaceName, String store, Map<String, Object> properties) { Store existingStore = server.getKeyspaces().get(keyspaceName).getStores().get(store); if (existingStore == null) { server.getKeyspaces().get(keyspaceName).createStore(store, properties); } else { existingStore.getStoreMetadata().setProperties(properties); } Map<String, KeyspaceAndStoreMetaData> meta = new HashMap<>(); for (Map.Entry<String, Keyspace> entry : server.getKeyspaces().entrySet()) { KeyspaceAndStoreMetaData kfmd = new KeyspaceAndStoreMetaData(); kfmd.setKeyspaceMetaData(entry.getValue().getKeyspaceMetaData()); for (Map.Entry<String, Store> cfEntry : entry.getValue().getStores().entrySet()) { kfmd.getColumnFamilies().put(cfEntry.getKey(), cfEntry.getValue().getStoreMetadata()); } meta.put(entry.getKey(), kfmd); } persist(meta); }
public void createOrUpdateStore(String keyspaceName, String store, Map<String, Object> properties) { Store existingStore = server.getKeyspaces().get(keyspaceName).getStores().get(store); if (existingStore == null) { server.getKeyspaces().get(keyspaceName).createStore(store, properties); } else { existingStore.getStoreMetadata().setProperties(properties); } <DeepExtract> Map<String, KeyspaceAndStoreMetaData> meta = new HashMap<>(); for (Map.Entry<String, Keyspace> entry : server.getKeyspaces().entrySet()) { KeyspaceAndStoreMetaData kfmd = new KeyspaceAndStoreMetaData(); kfmd.setKeyspaceMetaData(entry.getValue().getKeyspaceMetaData()); for (Map.Entry<String, Store> cfEntry : entry.getValue().getStores().entrySet()) { kfmd.getColumnFamilies().put(cfEntry.getKey(), cfEntry.getValue().getStoreMetadata()); } meta.put(entry.getKey(), kfmd); } persist(meta); </DeepExtract> }
nibiru
positive
2,211
public static void setServer(String host, int port) throws NullPointerException, IllegalArgumentException, UnknownHostException { if (DISCOVERY_ADDRESSES.containsValue(EXTERNAL_SERVER)) { Iterator<InetSocketAddress> addresses = DISCOVERY_ADDRESSES.keySet().iterator(); while (addresses.hasNext()) { InetSocketAddress address = addresses.next(); boolean type = DISCOVERY_ADDRESSES.get(address).booleanValue(); if (type == EXTERNAL_SERVER) { addresses.remove(); DiscoveredServer forgotten = DISCOVERED.remove(address); if (forgotten != null) { callEvent(listener -> listener.onServerForgotten(forgotten)); } } } LOGGER.debug("Cleared external servers from discovery"); } if (host == null) { throw new NullPointerException("IP address cannot be null"); } else if (port < 0x0000 || port > 0xFFFF) { throw new IllegalArgumentException("Port must be in between 0-65535"); } addServer(new InetSocketAddress(host, port)); }
public static void setServer(String host, int port) throws NullPointerException, IllegalArgumentException, UnknownHostException { if (DISCOVERY_ADDRESSES.containsValue(EXTERNAL_SERVER)) { Iterator<InetSocketAddress> addresses = DISCOVERY_ADDRESSES.keySet().iterator(); while (addresses.hasNext()) { InetSocketAddress address = addresses.next(); boolean type = DISCOVERY_ADDRESSES.get(address).booleanValue(); if (type == EXTERNAL_SERVER) { addresses.remove(); DiscoveredServer forgotten = DISCOVERED.remove(address); if (forgotten != null) { callEvent(listener -> listener.onServerForgotten(forgotten)); } } } LOGGER.debug("Cleared external servers from discovery"); } <DeepExtract> if (host == null) { throw new NullPointerException("IP address cannot be null"); } else if (port < 0x0000 || port > 0xFFFF) { throw new IllegalArgumentException("Port must be in between 0-65535"); } addServer(new InetSocketAddress(host, port)); </DeepExtract> }
JRakNet
positive
2,212
public void setStartEndTrim(float startAngle, float endAngle) { mStartTrim = startAngle; invalidateSelf(); mEndTrim = endAngle; invalidateSelf(); }
public void setStartEndTrim(float startAngle, float endAngle) { mStartTrim = startAngle; invalidateSelf(); <DeepExtract> mEndTrim = endAngle; invalidateSelf(); </DeepExtract> }
XRefreshView
positive
2,213
public JQuery not(NotCommand command) { return add(new AddCommand(command)); return this; }
public JQuery not(NotCommand command) { <DeepExtract> return add(new AddCommand(command)); </DeepExtract> return this; }
abmash
positive
2,214
private String getAuthCode(String clientId) { Response<IdentityTokens, ResponseZerokitError> response = zerokit.getIdentityTokens(clientId).execute(); Assert.assertFalse(response.isError() ? response.getError().toString() : "", response.isError()); return response.getResult().getAuthorizationCode(); }
private String getAuthCode(String clientId) { Response<IdentityTokens, ResponseZerokitError> response = zerokit.getIdentityTokens(clientId).execute(); <DeepExtract> Assert.assertFalse(response.isError() ? response.getError().toString() : "", response.isError()); </DeepExtract> return response.getResult().getAuthorizationCode(); }
ZeroKit-Android-SDK
positive
2,215
@Test public void withJoinedTableAndDiscriminator_saveOverExistingEntityOfDifferentType_deletesOrphanRows() { photon.registerAggregate(Shape.class).withPrimaryKeyAutoIncrement().withJoinedTable(Circle.class, JoinType.LeftOuterJoin).withPrimaryKeyAutoIncrement().addAsJoinedTable().withJoinedTable(Rectangle.class, JoinType.LeftOuterJoin).withPrimaryKeyAutoIncrement().addAsJoinedTable().withChild("colorHistory", ShapeColorHistory.class).withPrimaryKeyAutoIncrement().withParentTable("Shape", "shapeId").addAsChild().withChild("corners", CornerCoordinates.class).withParentTable("Rectangle").withForeignKeyToParent("shapeId", ColumnDataType.INTEGER).addAsChild().withClassDiscriminator(valueMap -> { if (valueMap.get("Circle_id") != null) { return Circle.class; } else if (valueMap.get("Rectangle_id") != null) { return Rectangle.class; } else { return Shape.class; } }).register(); try (PhotonTransaction transaction = photon.beginTransaction()) { Rectangle rectangle = new Rectangle(1, "blue", 1, 11, 12, null); transaction.save(rectangle); transaction.commit(); } try (PhotonTransaction transaction = photon.beginTransaction()) { Rectangle rectangle = transaction.query(Rectangle.class).fetchById(1); assertNotNull(rectangle); assertEquals(11, rectangle.getWidth()); assertEquals(12, rectangle.getHeight()); assertEquals("blue", rectangle.getColor()); } }
@Test public void withJoinedTableAndDiscriminator_saveOverExistingEntityOfDifferentType_deletesOrphanRows() { <DeepExtract> photon.registerAggregate(Shape.class).withPrimaryKeyAutoIncrement().withJoinedTable(Circle.class, JoinType.LeftOuterJoin).withPrimaryKeyAutoIncrement().addAsJoinedTable().withJoinedTable(Rectangle.class, JoinType.LeftOuterJoin).withPrimaryKeyAutoIncrement().addAsJoinedTable().withChild("colorHistory", ShapeColorHistory.class).withPrimaryKeyAutoIncrement().withParentTable("Shape", "shapeId").addAsChild().withChild("corners", CornerCoordinates.class).withParentTable("Rectangle").withForeignKeyToParent("shapeId", ColumnDataType.INTEGER).addAsChild().withClassDiscriminator(valueMap -> { if (valueMap.get("Circle_id") != null) { return Circle.class; } else if (valueMap.get("Rectangle_id") != null) { return Rectangle.class; } else { return Shape.class; } }).register(); </DeepExtract> try (PhotonTransaction transaction = photon.beginTransaction()) { Rectangle rectangle = new Rectangle(1, "blue", 1, 11, 12, null); transaction.save(rectangle); transaction.commit(); } try (PhotonTransaction transaction = photon.beginTransaction()) { Rectangle rectangle = transaction.query(Rectangle.class).fetchById(1); assertNotNull(rectangle); assertEquals(11, rectangle.getWidth()); assertEquals(12, rectangle.getHeight()); assertEquals("blue", rectangle.getColor()); } }
photon
positive
2,216
public static void setGlobalInt(ITestDevice device, String name, int value) throws DeviceNotAvailableException { deleteSetting(device, GROUP_GLOBAL, name); device.executeShellCommand("content insert" + " --uri content://settings/" + GROUP_GLOBAL + " --bind name:s:" + name + " --bind value:i:" + value); }
public static void setGlobalInt(ITestDevice device, String name, int value) throws DeviceNotAvailableException { <DeepExtract> deleteSetting(device, GROUP_GLOBAL, name); device.executeShellCommand("content insert" + " --uri content://settings/" + GROUP_GLOBAL + " --bind name:s:" + name + " --bind value:i:" + value); </DeepExtract> }
CrashMonkey4Android
positive
2,217
public synchronized MessageMetaWrapper<StandardMessage> send(StandardMessage msg) { LOGGER.finer("sent: " + msg.toString() + " to chip"); antChipInterface.send(msg.encode()); synchronized (antLoggers) { for (AntLogger logger : antLoggers) { try { LogDataContainer data = new LogDataContainer(Direction.SENT, msg); logger.log(data); } catch (Exception e) { LOGGER.severe("error logging data"); } } } return new MessageMetaWrapper<StandardMessage>(msg); }
public synchronized MessageMetaWrapper<StandardMessage> send(StandardMessage msg) { LOGGER.finer("sent: " + msg.toString() + " to chip"); antChipInterface.send(msg.encode()); <DeepExtract> synchronized (antLoggers) { for (AntLogger logger : antLoggers) { try { LogDataContainer data = new LogDataContainer(Direction.SENT, msg); logger.log(data); } catch (Exception e) { LOGGER.severe("error logging data"); } } } </DeepExtract> return new MessageMetaWrapper<StandardMessage>(msg); }
JFormica
positive
2,219
@Test public void testGetBigDecimal() { BigDecimal bigDecimal = testService.getBigDecimal(225); Assert.assertNotNull(bigDecimal); bigDecimal = testService.getBigDecimal(225); Assert.assertNotNull(bigDecimal); try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } testService.getBigDecimal(225); }
@Test public void testGetBigDecimal() { BigDecimal bigDecimal = testService.getBigDecimal(225); Assert.assertNotNull(bigDecimal); bigDecimal = testService.getBigDecimal(225); Assert.assertNotNull(bigDecimal); <DeepExtract> try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } </DeepExtract> testService.getBigDecimal(225); }
layering-cache
positive
2,221
@Override public void mouseUp(MouseEvent e) { ffrewHandler.cancel(); updateTimers(); }
@Override public void mouseUp(MouseEvent e) { <DeepExtract> ffrewHandler.cancel(); updateTimers(); </DeepExtract> }
janos
positive
2,222
public Key delMax() { Key max = pq[1]; Key temp = pq[1]; pq[1] = pq[N--]; pq[N--] = temp; pq[N + 1] = null; while (2 * 1 <= N) { int j = 2 * 1; if (j + 1 <= N && less(j, j + 1)) { ++j; } if (!less(1, j)) break; exch(1, j); 1 = j; } return max; }
public Key delMax() { Key max = pq[1]; Key temp = pq[1]; pq[1] = pq[N--]; pq[N--] = temp; pq[N + 1] = null; <DeepExtract> while (2 * 1 <= N) { int j = 2 * 1; if (j + 1 <= N && less(j, j + 1)) { ++j; } if (!less(1, j)) break; exch(1, j); 1 = j; } </DeepExtract> return max; }
Algorithm-fourth-edition
positive
2,223
private void init() { inputRadioButton.setSelected(true); inputTextField.setText(getSelectedTableCellValue().toString()); numberingFormatTextField.setText(DEFAULT_NUMBERING_FORMAT); numberingFromTextField.setText("1"); inputTextField.setEnabled(inputRadioButton.isSelected()); replaceFromTextField.setEnabled(replaceRadioButton.isSelected()); replaceToTextField.setEnabled(replaceRadioButton.isSelected()); if (replaceRadioButton.isSelected()) { UiUtil.focus(replaceFromTextField); } numberingFormatTextField.setEnabled(numberingRadioButton.isSelected()); numberingFromTextField.setEnabled(numberingRadioButton.isSelected()); if (numberingRadioButton.isSelected()) { UiUtil.focus(numberingFormatTextField); } }
private void init() { inputRadioButton.setSelected(true); inputTextField.setText(getSelectedTableCellValue().toString()); numberingFormatTextField.setText(DEFAULT_NUMBERING_FORMAT); numberingFromTextField.setText("1"); <DeepExtract> inputTextField.setEnabled(inputRadioButton.isSelected()); replaceFromTextField.setEnabled(replaceRadioButton.isSelected()); replaceToTextField.setEnabled(replaceRadioButton.isSelected()); if (replaceRadioButton.isSelected()) { UiUtil.focus(replaceFromTextField); } numberingFormatTextField.setEnabled(numberingRadioButton.isSelected()); numberingFromTextField.setEnabled(numberingRadioButton.isSelected()); if (numberingRadioButton.isSelected()) { UiUtil.focus(numberingFormatTextField); } </DeepExtract> }
integrated-security-testing-environment
positive
2,225
public String getTrainDataPath() { String configRealPath = (new File(configFile).exists()) ? configFile : configPath; File realFile = new File(configRealPath); CheckUtils.check(realFile.exists(), "config file(%s) doesn't exist!", configRealPath); Config config = ConfigFactory.parseFile(realFile); for (Map.Entry<String, Object> entry : customParamsMap.entrySet()) { config = config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(entry.getValue())); } return config; return config.getString("data.train.data_path"); }
public String getTrainDataPath() { String configRealPath = (new File(configFile).exists()) ? configFile : configPath; File realFile = new File(configRealPath); CheckUtils.check(realFile.exists(), "config file(%s) doesn't exist!", configRealPath); Config config = ConfigFactory.parseFile(realFile); <DeepExtract> for (Map.Entry<String, Object> entry : customParamsMap.entrySet()) { config = config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(entry.getValue())); } return config; </DeepExtract> return config.getString("data.train.data_path"); }
ytk-learn
positive
2,226
public void createNewState(int maxAmountLogs) { while (botStats.size() >= maxAmountLogs) { botStats.removeFirst(); } botStats.addLast(new BotStats()); running = true; }
public void createNewState(int maxAmountLogs) { while (botStats.size() >= maxAmountLogs) { botStats.removeFirst(); } botStats.addLast(new BotStats()); <DeepExtract> running = true; </DeepExtract> }
opendb
positive
2,227
@Override public void initProgramHandle() { super.initProgramHandle(); mUniformConvolutionMatrix = GLES20.glGetUniformLocation(mProgramHandle, "convolutionMatrix"); mConvolutionKernel = new float[] { -1.0f, 0.0f, 1.0f, -2.0f, 0.0f, 2.0f, -1.0f, 0.0f, 1.0f }; setUniformMatrix3f(mUniformConvolutionMatrix, mConvolutionKernel); }
@Override public void initProgramHandle() { super.initProgramHandle(); mUniformConvolutionMatrix = GLES20.glGetUniformLocation(mProgramHandle, "convolutionMatrix"); <DeepExtract> mConvolutionKernel = new float[] { -1.0f, 0.0f, 1.0f, -2.0f, 0.0f, 2.0f, -1.0f, 0.0f, 1.0f }; setUniformMatrix3f(mUniformConvolutionMatrix, mConvolutionKernel); </DeepExtract> }
VideoClipEditViewTest
positive
2,229
public Criteria andExpectReturnTimeIsNotNull() { if ("expect_return_time is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("expect_return_time is not null")); return (Criteria) this; }
public Criteria andExpectReturnTimeIsNotNull() { <DeepExtract> if ("expect_return_time is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("expect_return_time is not null")); </DeepExtract> return (Criteria) this; }
SSM_BookSystem
positive
2,230
public static int writeOggPageHeader(byte[] buf, int offset, int headerType, long granulepos, int streamSerialNumber, int pageCount, int packetCount, byte[] packetSizes) { byte[] str = "OggS".getBytes(); System.arraycopy(str, 0, buf, offset, str.length); buf[offset + 4] = 0; buf[offset + 5] = (byte) headerType; buf[offset + 6] = (byte) (0xff & granulepos); buf[offset + 6 + 1] = (byte) (0xff & (granulepos >>> 8)); buf[offset + 6 + 2] = (byte) (0xff & (granulepos >>> 16)); buf[offset + 6 + 3] = (byte) (0xff & (granulepos >>> 24)); buf[offset + 6 + 4] = (byte) (0xff & (granulepos >>> 32)); buf[offset + 6 + 5] = (byte) (0xff & (granulepos >>> 40)); buf[offset + 6 + 6] = (byte) (0xff & (granulepos >>> 48)); buf[offset + 6 + 7] = (byte) (0xff & (granulepos >>> 56)); buf[offset + 14] = (byte) (0xff & streamSerialNumber); buf[offset + 14 + 1] = (byte) (0xff & (streamSerialNumber >>> 8)); buf[offset + 14 + 2] = (byte) (0xff & (streamSerialNumber >>> 16)); buf[offset + 14 + 3] = (byte) (0xff & (streamSerialNumber >>> 24)); buf[offset + 18] = (byte) (0xff & pageCount); buf[offset + 18 + 1] = (byte) (0xff & (pageCount >>> 8)); buf[offset + 18 + 2] = (byte) (0xff & (pageCount >>> 16)); buf[offset + 18 + 3] = (byte) (0xff & (pageCount >>> 24)); buf[offset + 22] = (byte) (0xff & 0); buf[offset + 22 + 1] = (byte) (0xff & (0 >>> 8)); buf[offset + 22 + 2] = (byte) (0xff & (0 >>> 16)); buf[offset + 22 + 3] = (byte) (0xff & (0 >>> 24)); buf[offset + 26] = (byte) packetCount; System.arraycopy(packetSizes, 0, buf, offset + 27, packetCount); return packetCount + 27; }
public static int writeOggPageHeader(byte[] buf, int offset, int headerType, long granulepos, int streamSerialNumber, int pageCount, int packetCount, byte[] packetSizes) { byte[] str = "OggS".getBytes(); System.arraycopy(str, 0, buf, offset, str.length); buf[offset + 4] = 0; buf[offset + 5] = (byte) headerType; buf[offset + 6] = (byte) (0xff & granulepos); buf[offset + 6 + 1] = (byte) (0xff & (granulepos >>> 8)); buf[offset + 6 + 2] = (byte) (0xff & (granulepos >>> 16)); buf[offset + 6 + 3] = (byte) (0xff & (granulepos >>> 24)); buf[offset + 6 + 4] = (byte) (0xff & (granulepos >>> 32)); buf[offset + 6 + 5] = (byte) (0xff & (granulepos >>> 40)); buf[offset + 6 + 6] = (byte) (0xff & (granulepos >>> 48)); buf[offset + 6 + 7] = (byte) (0xff & (granulepos >>> 56)); buf[offset + 14] = (byte) (0xff & streamSerialNumber); buf[offset + 14 + 1] = (byte) (0xff & (streamSerialNumber >>> 8)); buf[offset + 14 + 2] = (byte) (0xff & (streamSerialNumber >>> 16)); buf[offset + 14 + 3] = (byte) (0xff & (streamSerialNumber >>> 24)); buf[offset + 18] = (byte) (0xff & pageCount); buf[offset + 18 + 1] = (byte) (0xff & (pageCount >>> 8)); buf[offset + 18 + 2] = (byte) (0xff & (pageCount >>> 16)); buf[offset + 18 + 3] = (byte) (0xff & (pageCount >>> 24)); <DeepExtract> buf[offset + 22] = (byte) (0xff & 0); buf[offset + 22 + 1] = (byte) (0xff & (0 >>> 8)); buf[offset + 22 + 2] = (byte) (0xff & (0 >>> 16)); buf[offset + 22 + 3] = (byte) (0xff & (0 >>> 24)); </DeepExtract> buf[offset + 26] = (byte) packetCount; System.arraycopy(packetSizes, 0, buf, offset + 27, packetCount); return packetCount + 27; }
LEHomeMobile_android
positive
2,231
int nextInt() { int ival = 0; boolean isgn = false; while (b >= 0 && b <= 32) read(); if (b == '-') { isgn = true; read(); } for (; b > 32; read()) ival = ival * 10 + b - 48; return isgn ? -ival : ival; }
int nextInt() { int ival = 0; boolean isgn = false; <DeepExtract> while (b >= 0 && b <= 32) read(); </DeepExtract> if (b == '-') { isgn = true; read(); } for (; b > 32; read()) ival = ival * 10 + b - 48; return isgn ? -ival : ival; }
pc-code
positive
2,232
private static void drawButton(Graphics2D g, String text, Rectangle bounds) { g.setFont(Renderer.font_main); g.setComposite(AlphaComposite.SrcOver.derive(0.5f)); g.setColor(Renderer.color_text); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); g.setComposite(AlphaComposite.SrcOver.derive(1.0f)); g.setColor(Renderer.color_shadow); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); Renderer.drawShadowText(g, text, bounds.x + (bounds.width / 2), bounds.y + (bounds.height / 2), Renderer.color_text, true); }
private static void drawButton(Graphics2D g, String text, Rectangle bounds) { g.setFont(Renderer.font_main); g.setComposite(AlphaComposite.SrcOver.derive(0.5f)); g.setColor(Renderer.color_text); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); <DeepExtract> g.setComposite(AlphaComposite.SrcOver.derive(1.0f)); </DeepExtract> g.setColor(Renderer.color_shadow); g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); Renderer.drawShadowText(g, text, bounds.x + (bounds.width / 2), bounds.y + (bounds.height / 2), Renderer.color_text, true); }
rscplus
positive
2,234
@Test public void variable() { run("variable", false); }
@Test public void variable() { <DeepExtract> run("variable", false); </DeepExtract> }
jade4j
positive
2,235
public void setCover(String path, String mediaPath) { ContentValues values = new ContentValues(); values.put(ALBUM_COVER_PATH, mediaPath); SQLiteDatabase db = this.getWritableDatabase(); db.update(TABLE_ALBUMS, values, ALBUM_PATH + "=?", new String[] { path }); db.close(); }
public void setCover(String path, String mediaPath) { ContentValues values = new ContentValues(); values.put(ALBUM_COVER_PATH, mediaPath); <DeepExtract> SQLiteDatabase db = this.getWritableDatabase(); db.update(TABLE_ALBUMS, values, ALBUM_PATH + "=?", new String[] { path }); db.close(); </DeepExtract> }
leafpicrevived
positive
2,237
public Criteria andBookIntroductionNotLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "bookIntroduction" + " cannot be null"); } criteria.add(new Criterion("book_introduction not like", value)); return (Criteria) this; }
public Criteria andBookIntroductionNotLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "bookIntroduction" + " cannot be null"); } criteria.add(new Criterion("book_introduction not like", value)); </DeepExtract> return (Criteria) this; }
springboot-BMSystem
positive
2,238
@Override public void onSyncCanceled() { if (currentSyncCampaign != null) { currentSyncCampaign.cancel(); } }
@Override public void onSyncCanceled() { <DeepExtract> if (currentSyncCampaign != null) { currentSyncCampaign.cancel(); } </DeepExtract> }
agit
positive
2,239
public boolean putAndRequestPreBlocks(BlockFullInfo blockInfo) { Block block = blockInfo.getBlock(); long blockHeight = block.getHeight(); LOGGER.info("Orphan block cache, map size: {}, height: {}", orphanBlockMap.size(), blockHeight); orphanBlockMap.add(blockChainService.getMaxHeight(), blockInfo); List<BlockFullInfo> blockFullInfos = new LinkedList<>(orphanBlockMap.values()); for (BlockFullInfo blockFullInfo : blockFullInfos) { Block block = blockFullInfo.getBlock(); String prevBlockHash = block.getPrevBlockHash(); if (StringUtils.isEmpty(prevBlockHash) || isContains(prevBlockHash)) { continue; } eventBus.post(new SyncBlockEvent(block.getHeight() - 1L, block.getPrevBlockHash(), blockFullInfo.getSourceId())); } return true; }
public boolean putAndRequestPreBlocks(BlockFullInfo blockInfo) { Block block = blockInfo.getBlock(); long blockHeight = block.getHeight(); LOGGER.info("Orphan block cache, map size: {}, height: {}", orphanBlockMap.size(), blockHeight); orphanBlockMap.add(blockChainService.getMaxHeight(), blockInfo); <DeepExtract> List<BlockFullInfo> blockFullInfos = new LinkedList<>(orphanBlockMap.values()); for (BlockFullInfo blockFullInfo : blockFullInfos) { Block block = blockFullInfo.getBlock(); String prevBlockHash = block.getPrevBlockHash(); if (StringUtils.isEmpty(prevBlockHash) || isContains(prevBlockHash)) { continue; } eventBus.post(new SyncBlockEvent(block.getHeight() - 1L, block.getPrevBlockHash(), blockFullInfo.getSourceId())); } </DeepExtract> return true; }
Swiftglobal
positive
2,240
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = findViewById(R.id.lab1_list); datas = new ArrayList<>(); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, datas); listView.setAdapter(adapter); IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent batteryStatus = registerReceiver(null, filter); int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1); boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING; if (isCharging) { int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB; boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC; if (usbCharge) { addListItem("Battery is USB Charging"); } else if (acCharge) { addListItem("Battery is AC Charging"); } } else { addListItem("Battery State is not Charging"); } int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float batteryPct = (level / (float) scale) * 100; datas.add("Current Battery : " + batteryPct + "%"); adapter.notifyDataSetChanged(); if (ContextCompat.checkSelfPermission(this, Manifest.permission.PROCESS_OUTGOING_CALLS) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CALL_LOG) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.PROCESS_OUTGOING_CALLS, Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_CALL_LOG }, 100); } registerReceiver(brOn, new IntentFilter(Intent.ACTION_SCREEN_ON)); registerReceiver(brOff, new IntentFilter(Intent.ACTION_SCREEN_OFF)); registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_POWER_CONNECTED)); registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_POWER_DISCONNECTED)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = findViewById(R.id.lab1_list); datas = new ArrayList<>(); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, datas); listView.setAdapter(adapter); IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent batteryStatus = registerReceiver(null, filter); int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1); boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING; if (isCharging) { int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB; boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC; if (usbCharge) { addListItem("Battery is USB Charging"); } else if (acCharge) { addListItem("Battery is AC Charging"); } } else { addListItem("Battery State is not Charging"); } int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float batteryPct = (level / (float) scale) * 100; <DeepExtract> datas.add("Current Battery : " + batteryPct + "%"); adapter.notifyDataSetChanged(); </DeepExtract> if (ContextCompat.checkSelfPermission(this, Manifest.permission.PROCESS_OUTGOING_CALLS) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CALL_LOG) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.PROCESS_OUTGOING_CALLS, Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_CALL_LOG }, 100); } registerReceiver(brOn, new IntentFilter(Intent.ACTION_SCREEN_ON)); registerReceiver(brOff, new IntentFilter(Intent.ACTION_SCREEN_OFF)); registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_POWER_CONNECTED)); registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_POWER_DISCONNECTED)); }
kkangs_android_2019
positive
2,241
@NonNull public Query setRuleContexts(String... ruleContexts) { return (Query) super.set(KEY_RULE_CONTEXTS, buildJSONArray(ruleContexts)); }
@NonNull public Query setRuleContexts(String... ruleContexts) { <DeepExtract> return (Query) super.set(KEY_RULE_CONTEXTS, buildJSONArray(ruleContexts)); </DeepExtract> }
algoliasearch-client-android
positive
2,242
@Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return DEFAULT_INSTANCE; }
@Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { <DeepExtract> return DEFAULT_INSTANCE; </DeepExtract> }
dl_inference
positive
2,243
public Criteria andScopeOfApplicationTypeNotEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "scopeOfApplicationType" + " cannot be null"); } criteria.add(new Criterion("scope_of_application_type <>", value)); return (Criteria) this; }
public Criteria andScopeOfApplicationTypeNotEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "scopeOfApplicationType" + " cannot be null"); } criteria.add(new Criterion("scope_of_application_type <>", value)); </DeepExtract> return (Criteria) this; }
oauth2-resource
positive
2,245
public SrcTree generateWithRuntimeClassPath(File srcRootDir, Charset srcCharset) throws IllegalTestScriptException { if (!srcRootDir.exists()) { throw new IllegalArgumentException("directory does not exist: " + srcRootDir.getAbsolutePath()); } Collection<File> srcFileCollection = FileUtils.listFiles(srcRootDir, new String[] { "java" }, true); List<File> srcFileList = new ArrayList<>(srcFileCollection); String[] srcFilePaths = new String[srcFileList.size()]; for (int i = 0; i < srcFileList.size(); i++) { srcFilePaths[i] = srcFileList.get(i).getAbsolutePath(); } List<String> classPathList = new ArrayList<>(64); String classPathStr = System.getProperty("java.class.path"); String[] classPathArray = classPathStr.split(Pattern.quote(File.pathSeparator)); for (String classPath : classPathArray) { if (classPath == null || classPath.trim().equals("")) { continue; } String classPathWithoutPrefix; if (classPath.startsWith("file:")) { classPathWithoutPrefix = classPath.substring(5); } else { classPathWithoutPrefix = classPath; } String absClassPath = new File(classPathWithoutPrefix).getAbsolutePath(); if (absClassPath.endsWith(".jar")) { if (!classPathList.contains(absClassPath)) { classPathList.add(absClassPath); addToClassPathListFromJarManifest(classPathList, new File(absClassPath)); } } else if (absClassPath.endsWith(".zip")) { if (!classPathList.contains(absClassPath)) { classPathList.add(absClassPath); } } else { File classPathFile = new File(absClassPath); if (classPathFile.isDirectory()) { Collection<File> subDirCollection = FileUtils.listFilesAndDirs(classPathFile, FileFilterUtils.directoryFileFilter(), FileFilterUtils.trueFileFilter()); for (File subDir : subDirCollection) { if (!classPathList.contains(subDir.getAbsolutePath())) { classPathList.add(subDir.getAbsolutePath()); } } } } } for (String classPath : classPathList) { logger.info("classPath: " + classPath); } CollectRootRequestor rootRequestor = new CollectRootRequestor(); parseAST(srcFilePaths, srcCharset, classPathList.toArray(new String[0]), rootRequestor); CollectSubRequestor subRequestor = new CollectSubRequestor(rootRequestor.getRootClassTable()); parseAST(srcFilePaths, srcCharset, classPathList.toArray(new String[0]), subRequestor); AdditionalTestDocsSetter setter = new AdditionalTestDocsSetter(rootRequestor.getRootClassTable(), subRequestor.getSubClassTable(), rootRequestor.getRootMethodTable(), subRequestor.getSubMethodTable()); setter.set(additionalTestDocs); CollectCodeRequestor codeRequestor = new CollectCodeRequestor(subRequestor.getSubClassTable(), rootRequestor.getRootMethodTable(), subRequestor.getSubMethodTable(), subRequestor.getFieldTable()); parseAST(srcFilePaths, srcCharset, classPathList.toArray(new String[0]), codeRequestor); SrcTree result = new SrcTree(); result.setRootClassTable(rootRequestor.getRootClassTable()); result.setSubClassTable(subRequestor.getSubClassTable()); result.setRootMethodTable(rootRequestor.getRootMethodTable()); result.setSubMethodTable(subRequestor.getSubMethodTable()); result.setFieldTable(subRequestor.getFieldTable()); return result; }
public SrcTree generateWithRuntimeClassPath(File srcRootDir, Charset srcCharset) throws IllegalTestScriptException { if (!srcRootDir.exists()) { throw new IllegalArgumentException("directory does not exist: " + srcRootDir.getAbsolutePath()); } Collection<File> srcFileCollection = FileUtils.listFiles(srcRootDir, new String[] { "java" }, true); List<File> srcFileList = new ArrayList<>(srcFileCollection); String[] srcFilePaths = new String[srcFileList.size()]; for (int i = 0; i < srcFileList.size(); i++) { srcFilePaths[i] = srcFileList.get(i).getAbsolutePath(); } List<String> classPathList = new ArrayList<>(64); String classPathStr = System.getProperty("java.class.path"); String[] classPathArray = classPathStr.split(Pattern.quote(File.pathSeparator)); for (String classPath : classPathArray) { if (classPath == null || classPath.trim().equals("")) { continue; } String classPathWithoutPrefix; if (classPath.startsWith("file:")) { classPathWithoutPrefix = classPath.substring(5); } else { classPathWithoutPrefix = classPath; } String absClassPath = new File(classPathWithoutPrefix).getAbsolutePath(); if (absClassPath.endsWith(".jar")) { if (!classPathList.contains(absClassPath)) { classPathList.add(absClassPath); addToClassPathListFromJarManifest(classPathList, new File(absClassPath)); } } else if (absClassPath.endsWith(".zip")) { if (!classPathList.contains(absClassPath)) { classPathList.add(absClassPath); } } else { File classPathFile = new File(absClassPath); if (classPathFile.isDirectory()) { Collection<File> subDirCollection = FileUtils.listFilesAndDirs(classPathFile, FileFilterUtils.directoryFileFilter(), FileFilterUtils.trueFileFilter()); for (File subDir : subDirCollection) { if (!classPathList.contains(subDir.getAbsolutePath())) { classPathList.add(subDir.getAbsolutePath()); } } } } } for (String classPath : classPathList) { logger.info("classPath: " + classPath); } <DeepExtract> CollectRootRequestor rootRequestor = new CollectRootRequestor(); parseAST(srcFilePaths, srcCharset, classPathList.toArray(new String[0]), rootRequestor); CollectSubRequestor subRequestor = new CollectSubRequestor(rootRequestor.getRootClassTable()); parseAST(srcFilePaths, srcCharset, classPathList.toArray(new String[0]), subRequestor); AdditionalTestDocsSetter setter = new AdditionalTestDocsSetter(rootRequestor.getRootClassTable(), subRequestor.getSubClassTable(), rootRequestor.getRootMethodTable(), subRequestor.getSubMethodTable()); setter.set(additionalTestDocs); CollectCodeRequestor codeRequestor = new CollectCodeRequestor(subRequestor.getSubClassTable(), rootRequestor.getRootMethodTable(), subRequestor.getSubMethodTable(), subRequestor.getFieldTable()); parseAST(srcFilePaths, srcCharset, classPathList.toArray(new String[0]), codeRequestor); SrcTree result = new SrcTree(); result.setRootClassTable(rootRequestor.getRootClassTable()); result.setSubClassTable(subRequestor.getSubClassTable()); result.setRootMethodTable(rootRequestor.getRootMethodTable()); result.setSubMethodTable(subRequestor.getSubMethodTable()); result.setFieldTable(subRequestor.getFieldTable()); return result; </DeepExtract> }
sahagin-java
positive
2,246
public static void main(String[] args) throws IOException { File eventDir = new File("output/2013-06-06-15-14-21"); File outputFile = new File("e.pptx"); File pptxSkeletonDir; try { pptxSkeletonDir = createSkeletonDir(); generateFiles(pptxSkeletonDir, eventDir); Zip.zipDir(pptxSkeletonDir, outputFile); } catch (IOException e) { e.printStackTrace(); } }
public static void main(String[] args) throws IOException { File eventDir = new File("output/2013-06-06-15-14-21"); File outputFile = new File("e.pptx"); <DeepExtract> File pptxSkeletonDir; try { pptxSkeletonDir = createSkeletonDir(); generateFiles(pptxSkeletonDir, eventDir); Zip.zipDir(pptxSkeletonDir, outputFile); } catch (IOException e) { e.printStackTrace(); } </DeepExtract> }
sikuli-slides
positive
2,247
public static Color getFillColor(StyleGroup group, int id) { int r = group.getFillColor(id).getRed(); int g = group.getFillColor(id).getGreen(); int b = group.getFillColor(id).getBlue(); int a = group.getFillColor(id).getAlpha(); double opacity = a / 255.0; return Color.rgb(r, g, b, opacity); }
public static Color getFillColor(StyleGroup group, int id) { <DeepExtract> int r = group.getFillColor(id).getRed(); int g = group.getFillColor(id).getGreen(); int b = group.getFillColor(id).getBlue(); int a = group.getFillColor(id).getAlpha(); double opacity = a / 255.0; return Color.rgb(r, g, b, opacity); </DeepExtract> }
gs-ui-javafx
positive
2,248
protected void finishJob(final CassandraFrameworkProtos.ClusterJobStatus currentClusterJob, final Protos.TaskInfo taskInfo, final Tuple2<Protos.SlaveID, String> currentSlave, CassandraFrameworkProtos.NodeJobStatus nodeJobStatus, final CassandraFrameworkProtos.ClusterJobType clusterJobType) { nodeJobStatus = CassandraFrameworkProtos.NodeJobStatus.newBuilder().setJobType(clusterJobType).setExecutorId(executorIdValue(taskInfo)).setTaskId(taskIdValue(taskInfo)).setRunning(false).setStartedTimestamp(nodeJobStatus.getStartedTimestamp()).setFinishedTimestamp(System.currentTimeMillis()).addAllProcessedKeyspaces(Arrays.asList(CassandraFrameworkProtos.ClusterJobKeyspaceStatus.newBuilder().setDuration(1).setKeyspace("foo").setStatus("FOO").build(), CassandraFrameworkProtos.ClusterJobKeyspaceStatus.newBuilder().setDuration(1).setKeyspace("bar").setStatus("BAR").build(), CassandraFrameworkProtos.ClusterJobKeyspaceStatus.newBuilder().setDuration(1).setKeyspace("baz").setStatus("BAZ").build())).build(); scheduler.statusUpdate(driver, Protos.TaskStatus.newBuilder().setExecutorId(executorId(taskInfo)).setHealthy(true).setSlaveId(taskInfo.getSlaveId()).setSource(Protos.TaskStatus.Source.SOURCE_EXECUTOR).setTaskId(taskInfo.getTaskId()).setTimestamp(System.currentTimeMillis()).setState(Protos.TaskState.TASK_FINISHED).setData(CassandraFrameworkProtos.SlaveStatusDetails.newBuilder().setStatusDetailsType(CassandraFrameworkProtos.SlaveStatusDetails.StatusDetailsType.NODE_JOB_STATUS).setNodeJobStatus(nodeJobStatus).build().toByteString()).build()); scheduler.frameworkMessage(driver, Protos.ExecutorID.newBuilder().setValue(currentClusterJob.getCurrentNode().getExecutorId()).build(), currentSlave._1, CassandraFrameworkProtos.SlaveStatusDetails.newBuilder().setStatusDetailsType(CassandraFrameworkProtos.SlaveStatusDetails.StatusDetailsType.NODE_JOB_STATUS).setNodeJobStatus(nodeJobStatus).build().toByteArray()); }
protected void finishJob(final CassandraFrameworkProtos.ClusterJobStatus currentClusterJob, final Protos.TaskInfo taskInfo, final Tuple2<Protos.SlaveID, String> currentSlave, CassandraFrameworkProtos.NodeJobStatus nodeJobStatus, final CassandraFrameworkProtos.ClusterJobType clusterJobType) { nodeJobStatus = CassandraFrameworkProtos.NodeJobStatus.newBuilder().setJobType(clusterJobType).setExecutorId(executorIdValue(taskInfo)).setTaskId(taskIdValue(taskInfo)).setRunning(false).setStartedTimestamp(nodeJobStatus.getStartedTimestamp()).setFinishedTimestamp(System.currentTimeMillis()).addAllProcessedKeyspaces(Arrays.asList(CassandraFrameworkProtos.ClusterJobKeyspaceStatus.newBuilder().setDuration(1).setKeyspace("foo").setStatus("FOO").build(), CassandraFrameworkProtos.ClusterJobKeyspaceStatus.newBuilder().setDuration(1).setKeyspace("bar").setStatus("BAR").build(), CassandraFrameworkProtos.ClusterJobKeyspaceStatus.newBuilder().setDuration(1).setKeyspace("baz").setStatus("BAZ").build())).build(); <DeepExtract> scheduler.statusUpdate(driver, Protos.TaskStatus.newBuilder().setExecutorId(executorId(taskInfo)).setHealthy(true).setSlaveId(taskInfo.getSlaveId()).setSource(Protos.TaskStatus.Source.SOURCE_EXECUTOR).setTaskId(taskInfo.getTaskId()).setTimestamp(System.currentTimeMillis()).setState(Protos.TaskState.TASK_FINISHED).setData(CassandraFrameworkProtos.SlaveStatusDetails.newBuilder().setStatusDetailsType(CassandraFrameworkProtos.SlaveStatusDetails.StatusDetailsType.NODE_JOB_STATUS).setNodeJobStatus(nodeJobStatus).build().toByteString()).build()); </DeepExtract> scheduler.frameworkMessage(driver, Protos.ExecutorID.newBuilder().setValue(currentClusterJob.getCurrentNode().getExecutorId()).build(), currentSlave._1, CassandraFrameworkProtos.SlaveStatusDetails.newBuilder().setStatusDetailsType(CassandraFrameworkProtos.SlaveStatusDetails.StatusDetailsType.NODE_JOB_STATUS).setNodeJobStatus(nodeJobStatus).build().toByteArray()); }
cassandra-mesos-deprecated
positive
2,249
@Override public void onCreate(Bundle savedInstanceState) { setTheme(Themes.getTheme(((Application) getApplication()).getThemeIndex())); super.onCreate(savedInstanceState); setContentView(R.layout.layout_license); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); LinearLayout files = (LinearLayout) findViewById(R.id.linear_license_files); List<String> apacheFiles = getFileNames(); String marker = getMarkerString(); for (String apacheFile : apacheFiles) { TextView name = new TextView(this); name.setText(String.format("%s %s", marker, apacheFile)); files.addView(name); } }
@Override public void onCreate(Bundle savedInstanceState) { setTheme(Themes.getTheme(((Application) getApplication()).getThemeIndex())); super.onCreate(savedInstanceState); setContentView(R.layout.layout_license); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); <DeepExtract> LinearLayout files = (LinearLayout) findViewById(R.id.linear_license_files); List<String> apacheFiles = getFileNames(); String marker = getMarkerString(); for (String apacheFile : apacheFiles) { TextView name = new TextView(this); name.setText(String.format("%s %s", marker, apacheFile)); files.addView(name); } </DeepExtract> }
SmileEssence
positive
2,250
@Override public void onNext(Response<ScoreGroup[], CourseData> courseDataResponse) { ScoreGroup[] scoreGroups = courseDataResponse.data(); if (scoreGroups == null || scoreGroups.length == 0) { return; } this.scores = scoreGroups; this.notifyDataSetChanged(); for (int i = 0; i < adapter.getGroupCount(); i++) { list.expandGroup(i); } noData = false; message().hide(); }
@Override public void onNext(Response<ScoreGroup[], CourseData> courseDataResponse) { ScoreGroup[] scoreGroups = courseDataResponse.data(); if (scoreGroups == null || scoreGroups.length == 0) { return; } <DeepExtract> this.scores = scoreGroups; this.notifyDataSetChanged(); </DeepExtract> for (int i = 0; i < adapter.getGroupCount(); i++) { list.expandGroup(i); } noData = false; message().hide(); }
CCULife
positive
2,252
public void setAutoLayout(String layout) { this.layout = layout; if (layout == null) return; if (layout.equals("circle")) doCircleLayout(); if (layout.equals("stack")) doStackLayout(); if (layout.equals("hierarchical")) doHierarchicalLayout(); }
public void setAutoLayout(String layout) { this.layout = layout; <DeepExtract> if (layout == null) return; if (layout.equals("circle")) doCircleLayout(); if (layout.equals("stack")) doStackLayout(); if (layout.equals("hierarchical")) doHierarchicalLayout(); </DeepExtract> }
armitage
positive
2,253
@Test public void testUnknownOverrideBuildSystemNoBuilders() throws Exception { CDepYml config = new CDepYml(); System.out.printf(new Yaml().dump(config)); File yaml = new File(".test-files/testUnknownOverrideBuildSystem/cdep.yml"); File[] files = yaml.getParentFile().listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { deleteDirectory(f); } else { f.delete(); } } } yaml.getParentFile().delete(); yaml.getParentFile().mkdirs(); Files.write("dependencies:\n" + "- compile: com.github.jomof:sqlite:3.16.2-rev45\n", yaml, StandardCharsets.UTF_8); File modulesFolder = new File(yaml.getParentFile(), "my-modules"); try { main("-wf", yaml.getParent(), "-gmf", modulesFolder.getAbsolutePath(), "--builder", "unknown-build-system"); fail("Expected failure"); } catch (CDepRuntimeException e) { assertThat(e).hasMessage("Builder unknown-build-system is not recognized."); } }
@Test public void testUnknownOverrideBuildSystemNoBuilders() throws Exception { CDepYml config = new CDepYml(); System.out.printf(new Yaml().dump(config)); File yaml = new File(".test-files/testUnknownOverrideBuildSystem/cdep.yml"); <DeepExtract> File[] files = yaml.getParentFile().listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { deleteDirectory(f); } else { f.delete(); } } } yaml.getParentFile().delete(); </DeepExtract> yaml.getParentFile().mkdirs(); Files.write("dependencies:\n" + "- compile: com.github.jomof:sqlite:3.16.2-rev45\n", yaml, StandardCharsets.UTF_8); File modulesFolder = new File(yaml.getParentFile(), "my-modules"); try { main("-wf", yaml.getParent(), "-gmf", modulesFolder.getAbsolutePath(), "--builder", "unknown-build-system"); fail("Expected failure"); } catch (CDepRuntimeException e) { assertThat(e).hasMessage("Builder unknown-build-system is not recognized."); } }
cdep
positive
2,254
@Override public Void call() throws StreamingException, InterruptedException { batch.clear(); abortTxn(); return null; }
@Override public Void call() throws StreamingException, InterruptedException { <DeepExtract> batch.clear(); abortTxn(); </DeepExtract> return null; }
JavaBigData
positive
2,256
public Criteria andPidNotEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "pid" + " cannot be null"); } criteria.add(new Criterion("pid <>", value)); return (Criteria) this; }
public Criteria andPidNotEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "pid" + " cannot be null"); } criteria.add(new Criterion("pid <>", value)); </DeepExtract> return (Criteria) this; }
Gotrip
positive
2,257
protected void test(String queryString, String filename, String varName, String... uriStrings) { final int l = uriStrings.length; for (int i = 0; i < l; i++) { assertTrue("The result set contains only " + i + " elements instead of " + l + ".", execute(queryString, filename).hasNext()); final QuerySolution s = execute(queryString, filename).next(); assertTrue(s.contains(varName)); assertTrue(s.get(varName).isURIResource()); assertEquals(uriStrings[i], s.get(varName).asResource().getURI()); } int x = 0; while (execute(queryString, filename).hasNext()) { execute(queryString, filename).next(); x++; } assertEquals(0, x); }
protected void test(String queryString, String filename, String varName, String... uriStrings) { <DeepExtract> final int l = uriStrings.length; for (int i = 0; i < l; i++) { assertTrue("The result set contains only " + i + " elements instead of " + l + ".", execute(queryString, filename).hasNext()); final QuerySolution s = execute(queryString, filename).next(); assertTrue(s.contains(varName)); assertTrue(s.get(varName).isURIResource()); assertEquals(uriStrings[i], s.get(varName).asResource().getURI()); } int x = 0; while (execute(queryString, filename).hasNext()) { execute(queryString, filename).next(); x++; } assertEquals(0, x); </DeepExtract> }
RDFstarTools
positive
2,258
public void initializeViews() { mPrimaryLabel = (TextView) findViewById(R.id.primary_label); mSecondaryLabel = (TextView) findViewById(R.id.secondary_label); }
public void initializeViews() { mPrimaryLabel = (TextView) findViewById(R.id.primary_label); <DeepExtract> mSecondaryLabel = (TextView) findViewById(R.id.secondary_label); </DeepExtract> }
watershed
positive
2,259
public void setTargetUserIdentifier(final String uid) { if (TargetName.USERID == null) throw new IllegalArgumentException("Target must have a name"); switch(TargetName.USERID) { case APID: this.apId = uid; this.targetType = Target.ENTITY; break; case CUSTOMERID: this.customerId = uid; this.targetType = Target.ENTITY; break; case EUID: this.entityUserId = uid; this.targetType = Target.ENTITYUSER; break; case ICCID: this.iccid = uid; this.targetType = Target.SIMCARD; break; case IMSI: this.imsi = uid; this.targetType = Target.SIMCARD; break; case MSISDN: this.msisdn = uid; if (this.operation.toLowerCase().endsWith(SIMCARD_OP)) { this.targetType = Target.SIMCARD; } else { this.targetType = Target.MOBILEUSER; } break; case MSSPURI: this.msspUri = uid; this.targetType = Target.ENTITY; break; case NASID: this.nasId = uid; this.targetType = Target.ENTITY; break; case SPID: this.spId = uid; this.targetType = Target.ENTITY; break; case CAURI: this.caUri = uid; this.targetType = Target.ENTITY; break; case USERID: this.userIdentifier = uid; this.targetType = Target.MOBILEUSER; break; } }
public void setTargetUserIdentifier(final String uid) { <DeepExtract> if (TargetName.USERID == null) throw new IllegalArgumentException("Target must have a name"); switch(TargetName.USERID) { case APID: this.apId = uid; this.targetType = Target.ENTITY; break; case CUSTOMERID: this.customerId = uid; this.targetType = Target.ENTITY; break; case EUID: this.entityUserId = uid; this.targetType = Target.ENTITYUSER; break; case ICCID: this.iccid = uid; this.targetType = Target.SIMCARD; break; case IMSI: this.imsi = uid; this.targetType = Target.SIMCARD; break; case MSISDN: this.msisdn = uid; if (this.operation.toLowerCase().endsWith(SIMCARD_OP)) { this.targetType = Target.SIMCARD; } else { this.targetType = Target.MOBILEUSER; } break; case MSSPURI: this.msspUri = uid; this.targetType = Target.ENTITY; break; case NASID: this.nasId = uid; this.targetType = Target.ENTITY; break; case SPID: this.spId = uid; this.targetType = Target.ENTITY; break; case CAURI: this.caUri = uid; this.targetType = Target.ENTITY; break; case USERID: this.userIdentifier = uid; this.targetType = Target.MOBILEUSER; break; } </DeepExtract> }
laverca
positive
2,260
public synchronized PointF getPageSize(int pageNum) { if (pageNum > pageCount - 1) pageNum = pageCount - 1; else if (pageNum < 0) pageNum = 0; if (pageNum != currentPage) { currentPage = pageNum; if (page != null) page.destroy(); page = null; if (displayList != null) displayList.destroy(); displayList = null; page = doc.loadPage(pageNum); Rect b = page.getBounds(); pageWidth = b.x1 - b.x0; pageHeight = b.y1 - b.y0; } return new PointF(pageWidth, pageHeight); }
public synchronized PointF getPageSize(int pageNum) { <DeepExtract> if (pageNum > pageCount - 1) pageNum = pageCount - 1; else if (pageNum < 0) pageNum = 0; if (pageNum != currentPage) { currentPage = pageNum; if (page != null) page.destroy(); page = null; if (displayList != null) displayList.destroy(); displayList = null; page = doc.loadPage(pageNum); Rect b = page.getBounds(); pageWidth = b.x1 - b.x0; pageHeight = b.y1 - b.y0; } </DeepExtract> return new PointF(pageWidth, pageHeight); }
AndroidMuPDF
positive
2,261
public static ScriptSnippet getInstance(String fileOrDir, String url, String action) { File f = new File(fileOrDir); if (!f.exists()) return null; String fileName = ""; if (f.isDirectory()) { fileName = getScriptFilename(fileOrDir, url); } else { fileName = fileOrDir; } try { u = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); return null; } String path = u.getPath(); if ("".equals(path)) path = "/"; Document document; SAXReader reader = new SAXReader(); reader.setValidation(false); try { document = reader.read(new File(fileName)); } catch (Exception e) { e.printStackTrace(); document = null; } @SuppressWarnings("unchecked") List<Element> eUrlList = document.getRootElement().elements(); for (int i = 0; i < eUrlList.size(); i++) { Element eUrl = eUrlList.get(i); String match = eUrl.attributeValue("match"); String r = match; Pattern p = Pattern.compile(r); Matcher m = p.matcher(path); if (m.find()) { @SuppressWarnings("unchecked") List<Element> eScriptList = eUrl.elements(); for (int j = 0; j < eScriptList.size(); j++) { Element eScript = eScriptList.get(j); String scriptAction = eScript.attributeValue("action"); if (scriptAction != null && scriptAction.equals(action)) { String engineName = eScript.attributeValue("engine"); String code = evaluateCode(eScript.getText()); return new ScriptSnippet(engineName, code); } } } } return null; }
public static ScriptSnippet getInstance(String fileOrDir, String url, String action) { File f = new File(fileOrDir); if (!f.exists()) return null; String fileName = ""; if (f.isDirectory()) { fileName = getScriptFilename(fileOrDir, url); } else { fileName = fileOrDir; } try { u = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); return null; } String path = u.getPath(); if ("".equals(path)) path = "/"; <DeepExtract> Document document; SAXReader reader = new SAXReader(); reader.setValidation(false); try { document = reader.read(new File(fileName)); } catch (Exception e) { e.printStackTrace(); document = null; } </DeepExtract> @SuppressWarnings("unchecked") List<Element> eUrlList = document.getRootElement().elements(); for (int i = 0; i < eUrlList.size(); i++) { Element eUrl = eUrlList.get(i); String match = eUrl.attributeValue("match"); String r = match; Pattern p = Pattern.compile(r); Matcher m = p.matcher(path); if (m.find()) { @SuppressWarnings("unchecked") List<Element> eScriptList = eUrl.elements(); for (int j = 0; j < eScriptList.size(); j++) { Element eScript = eScriptList.get(j); String scriptAction = eScript.attributeValue("action"); if (scriptAction != null && scriptAction.equals(action)) { String engineName = eScript.attributeValue("engine"); String code = evaluateCode(eScript.getText()); return new ScriptSnippet(engineName, code); } } } } return null; }
crawl-anywhere
positive
2,263
@Override public void onSurfaceChanged() { if (!isCameraOpened() || !mPreview.isReady() || mImageReader == null) { return; } Size previewSize = chooseOptimalSize(); mPreview.setBufferSize(previewSize.getWidth(), previewSize.getHeight()); Surface surface = mPreview.getSurface(); try { mPreviewRequestBuilder = mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); mPreviewRequestBuilder.addTarget(surface); mCamera.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface()), mSessionCallback, null); } catch (CameraAccessException e) { throw new RuntimeException("Failed to start camera session"); } }
@Override public void onSurfaceChanged() { <DeepExtract> if (!isCameraOpened() || !mPreview.isReady() || mImageReader == null) { return; } Size previewSize = chooseOptimalSize(); mPreview.setBufferSize(previewSize.getWidth(), previewSize.getHeight()); Surface surface = mPreview.getSurface(); try { mPreviewRequestBuilder = mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); mPreviewRequestBuilder.addTarget(surface); mCamera.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface()), mSessionCallback, null); } catch (CameraAccessException e) { throw new RuntimeException("Failed to start camera session"); } </DeepExtract> }
MediaPicker
positive
2,264
public void simulate(long seed, int demandsCount, double alpha, int erlang, boolean replicaPreservation, SimulationTask task) throws IllegalAccessException, ClassNotFoundException, InstantiationException { SimulationMenuController.finished = false; SimulationMenuController.cancelled = false; MainWindowController mainWindowController = ResizableCanvas.getParentController(); Project project = ApplicationResources.getProject(); Network network = project.getNetwork(); this.totalVolume = 0; this.spectrumBlockedVolume = 0; this.regeneratorsBlockedVolume = 0; this.linkFailureBlockedVolume = 0; this.regsPerAllocation = 0; this.allocations = 0; this.unhandledVolume = 0; mainWindowController.totalVolume = 0; mainWindowController.spectrumBlockedVolume = 0; mainWindowController.regeneratorsBlockedVolume = 0; mainWindowController.linkFailureBlockedVolume = 0; for (NetworkNode n : network.getNodes()) { n.clearOccupied(); for (NetworkNode n2 : network.getNodes()) if (network.containsLink(n, n2)) { NetworkLink networkLink = network.getLink(n, n2); for (Core core : networkLink.getCores()) { core.slicesUp = new Spectrum(Core.NUMBER_OF_SLICES); core.slicesDown = new Spectrum(Core.NUMBER_OF_SLICES); } } } Logger.setLoggerLevel(Logger.LoggerLevel.DEBUG); generator.setErlang(erlang); generator.setSeed(seed); generator.setReplicaPreservation(replicaPreservation); network.setSeed(seed); Random linkCutter = new Random(seed); try { ResizableCanvas.getParentController().updateGraph(); for (; generator.getGeneratedDemandsCount() < demandsCount; ) { SimulationMenuController.started = true; Demand demand = generator.next(); if (linkCutter.nextDouble() < alpha / erlang) for (Demand reallocate : network.cutLink()) if (reallocate.reallocate()) handleDemand(reallocate); else { linkFailureBlockedVolume += reallocate.getVolume(); ResizableCanvas.getParentController().linkFailureBlockedVolume += reallocate.getVolume(); } else { handleDemand(demand); if (demand instanceof AnycastDemand) handleDemand(generator.next()); } network.update(); pause(); if (SimulationMenuController.cancelled) { Logger.info(LocaleUtils.translate("simulation_cancelled")); break; } task.updateProgress(generator.getGeneratedDemandsCount(), demandsCount); } } catch (NetworkException e) { Logger.info(LocaleUtils.translate("network_exception_label") + " " + LocaleUtils.translate(e.getMessage())); for (; generator.getGeneratedDemandsCount() < demandsCount; ) { Demand demand = generator.next(); unhandledVolume += demand.getVolume(); if (demand instanceof AnycastDemand) unhandledVolume += generator.next().getVolume(); task.updateProgress(generator.getGeneratedDemandsCount(), demandsCount); } totalVolume += unhandledVolume; ResizableCanvas.getParentController().totalVolume += unhandledVolume; } network.waitForDemandsDeath(); ResizableCanvas.getParentController().stopUpdateGraph(); ResizableCanvas.getParentController().resetGraph(); SimulationMenuController.finished = true; FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/ca/bcit/jfx/res/views/SimulationMenu.fxml"), Settings.getCurrentResources()); SimulationMenuController simulationMenuController = fxmlLoader.<SimulationMenuController>getController(); if (simulationMenuController != null) simulationMenuController.disableClearSimulationButton(); Logger.info(LocaleUtils.translate("blocked_spectrum_label") + " " + (spectrumBlockedVolume / totalVolume) * 100 + "%"); Logger.info(LocaleUtils.translate("blocked_regenerators_label") + " " + (regeneratorsBlockedVolume / totalVolume) * 100 + "%"); Logger.info(LocaleUtils.translate("blocked_link_failure_label") + " " + (linkFailureBlockedVolume / totalVolume) * 100 + "%"); File resultsDirectory = new File(RESULTS_DATA_DIR_NAME); if (!resultsDirectory.isDirectory()) resultsDirectory.mkdir(); File resultsProjectDirectory = new File(RESULTS_DATA_DIR_NAME + "/" + ApplicationResources.getProject().getName().toUpperCase()); if (isMultipleSimulations()) if (!resultsProjectDirectory.isDirectory()) resultsProjectDirectory.mkdir(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(new SimulationSummary(generator.getName(), erlang, seed, alpha, demandsCount, totalVolume, spectrumBlockedVolume, regeneratorsBlockedVolume, linkFailureBlockedVolume, unhandledVolume, regsPerAllocation, allocations, network.getDemandAllocationAlgorithm().getName())); try { resultsDataFileName = ApplicationResources.getProject().getName().toUpperCase() + new SimpleDateFormat("_yyyy_MM_dd_HH_mm_ss").format(new Date()) + ".json"; TaskReadyProgressBar.addResultsDataFileName(resultsDataFileName); FileWriter resultsDataWriter = new FileWriter(new File(isMultipleSimulations() ? resultsProjectDirectory : resultsDirectory, resultsDataFileName)); resultsDataWriter.write(json); resultsDataWriter.close(); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(2000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } }
public void simulate(long seed, int demandsCount, double alpha, int erlang, boolean replicaPreservation, SimulationTask task) throws IllegalAccessException, ClassNotFoundException, InstantiationException { SimulationMenuController.finished = false; SimulationMenuController.cancelled = false; <DeepExtract> MainWindowController mainWindowController = ResizableCanvas.getParentController(); Project project = ApplicationResources.getProject(); Network network = project.getNetwork(); this.totalVolume = 0; this.spectrumBlockedVolume = 0; this.regeneratorsBlockedVolume = 0; this.linkFailureBlockedVolume = 0; this.regsPerAllocation = 0; this.allocations = 0; this.unhandledVolume = 0; mainWindowController.totalVolume = 0; mainWindowController.spectrumBlockedVolume = 0; mainWindowController.regeneratorsBlockedVolume = 0; mainWindowController.linkFailureBlockedVolume = 0; for (NetworkNode n : network.getNodes()) { n.clearOccupied(); for (NetworkNode n2 : network.getNodes()) if (network.containsLink(n, n2)) { NetworkLink networkLink = network.getLink(n, n2); for (Core core : networkLink.getCores()) { core.slicesUp = new Spectrum(Core.NUMBER_OF_SLICES); core.slicesDown = new Spectrum(Core.NUMBER_OF_SLICES); } } } </DeepExtract> Logger.setLoggerLevel(Logger.LoggerLevel.DEBUG); generator.setErlang(erlang); generator.setSeed(seed); generator.setReplicaPreservation(replicaPreservation); network.setSeed(seed); Random linkCutter = new Random(seed); try { ResizableCanvas.getParentController().updateGraph(); for (; generator.getGeneratedDemandsCount() < demandsCount; ) { SimulationMenuController.started = true; Demand demand = generator.next(); if (linkCutter.nextDouble() < alpha / erlang) for (Demand reallocate : network.cutLink()) if (reallocate.reallocate()) handleDemand(reallocate); else { linkFailureBlockedVolume += reallocate.getVolume(); ResizableCanvas.getParentController().linkFailureBlockedVolume += reallocate.getVolume(); } else { handleDemand(demand); if (demand instanceof AnycastDemand) handleDemand(generator.next()); } network.update(); pause(); if (SimulationMenuController.cancelled) { Logger.info(LocaleUtils.translate("simulation_cancelled")); break; } task.updateProgress(generator.getGeneratedDemandsCount(), demandsCount); } } catch (NetworkException e) { Logger.info(LocaleUtils.translate("network_exception_label") + " " + LocaleUtils.translate(e.getMessage())); for (; generator.getGeneratedDemandsCount() < demandsCount; ) { Demand demand = generator.next(); unhandledVolume += demand.getVolume(); if (demand instanceof AnycastDemand) unhandledVolume += generator.next().getVolume(); task.updateProgress(generator.getGeneratedDemandsCount(), demandsCount); } totalVolume += unhandledVolume; ResizableCanvas.getParentController().totalVolume += unhandledVolume; } network.waitForDemandsDeath(); ResizableCanvas.getParentController().stopUpdateGraph(); ResizableCanvas.getParentController().resetGraph(); SimulationMenuController.finished = true; FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/ca/bcit/jfx/res/views/SimulationMenu.fxml"), Settings.getCurrentResources()); SimulationMenuController simulationMenuController = fxmlLoader.<SimulationMenuController>getController(); if (simulationMenuController != null) simulationMenuController.disableClearSimulationButton(); Logger.info(LocaleUtils.translate("blocked_spectrum_label") + " " + (spectrumBlockedVolume / totalVolume) * 100 + "%"); Logger.info(LocaleUtils.translate("blocked_regenerators_label") + " " + (regeneratorsBlockedVolume / totalVolume) * 100 + "%"); Logger.info(LocaleUtils.translate("blocked_link_failure_label") + " " + (linkFailureBlockedVolume / totalVolume) * 100 + "%"); File resultsDirectory = new File(RESULTS_DATA_DIR_NAME); if (!resultsDirectory.isDirectory()) resultsDirectory.mkdir(); File resultsProjectDirectory = new File(RESULTS_DATA_DIR_NAME + "/" + ApplicationResources.getProject().getName().toUpperCase()); if (isMultipleSimulations()) if (!resultsProjectDirectory.isDirectory()) resultsProjectDirectory.mkdir(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(new SimulationSummary(generator.getName(), erlang, seed, alpha, demandsCount, totalVolume, spectrumBlockedVolume, regeneratorsBlockedVolume, linkFailureBlockedVolume, unhandledVolume, regsPerAllocation, allocations, network.getDemandAllocationAlgorithm().getName())); try { resultsDataFileName = ApplicationResources.getProject().getName().toUpperCase() + new SimpleDateFormat("_yyyy_MM_dd_HH_mm_ss").format(new Date()) + ".json"; TaskReadyProgressBar.addResultsDataFileName(resultsDataFileName); FileWriter resultsDataWriter = new FileWriter(new File(isMultipleSimulations() ? resultsProjectDirectory : resultsDirectory, resultsDataFileName)); resultsDataWriter.write(json); resultsDataWriter.close(); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(2000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } }
ceons
positive
2,265
public static String normalize(String filename, boolean unixSeparator) { char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR; if (filename == null) { return null; } int size = filename.length(); if (size == 0) { return filename; } int prefix = getPrefixLength(filename); if (prefix < 0) { return null; } char[] array = new char[size + 2]; filename.getChars(0, filename.length(), array, 0); char otherSeparator = separator == SYSTEM_SEPARATOR ? OTHER_SEPARATOR : SYSTEM_SEPARATOR; for (int i = 0; i < array.length; i++) { if (array[i] == otherSeparator) { array[i] = separator; } } boolean lastIsDirectory = true; if (array[size - 1] != separator) { array[size++] = separator; lastIsDirectory = false; } for (int i = prefix + 1; i < size; i++) { if (array[i] == separator && array[i - 1] == separator) { System.arraycopy(array, i, array, i - 1, size - i); size--; i--; } } for (int i = prefix + 1; i < size; i++) { if (array[i] == separator && array[i - 1] == '.' && (i == prefix + 1 || array[i - 2] == separator)) { if (i == size - 1) { lastIsDirectory = true; } System.arraycopy(array, i + 1, array, i - 1, size - i); size -= 2; i--; } } outer: for (int i = prefix + 2; i < size; i++) { if (array[i] == separator && array[i - 1] == '.' && array[i - 2] == '.' && (i == prefix + 2 || array[i - 3] == separator)) { if (i == prefix + 2) { return null; } if (i == size - 1) { lastIsDirectory = true; } int j; for (j = i - 4; j >= prefix; j--) { if (array[j] == separator) { System.arraycopy(array, i + 1, array, j + 1, size - i); size -= i - j; i = j + 1; continue outer; } } System.arraycopy(array, i + 1, array, prefix, size - i); size -= i + 1 - prefix; i = prefix + 1; } } if (size <= 0) { return ""; } if (size <= prefix) { return new String(array, 0, size); } if (lastIsDirectory && true) { return new String(array, 0, size); } return new String(array, 0, size - 1); }
public static String normalize(String filename, boolean unixSeparator) { char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR; <DeepExtract> if (filename == null) { return null; } int size = filename.length(); if (size == 0) { return filename; } int prefix = getPrefixLength(filename); if (prefix < 0) { return null; } char[] array = new char[size + 2]; filename.getChars(0, filename.length(), array, 0); char otherSeparator = separator == SYSTEM_SEPARATOR ? OTHER_SEPARATOR : SYSTEM_SEPARATOR; for (int i = 0; i < array.length; i++) { if (array[i] == otherSeparator) { array[i] = separator; } } boolean lastIsDirectory = true; if (array[size - 1] != separator) { array[size++] = separator; lastIsDirectory = false; } for (int i = prefix + 1; i < size; i++) { if (array[i] == separator && array[i - 1] == separator) { System.arraycopy(array, i, array, i - 1, size - i); size--; i--; } } for (int i = prefix + 1; i < size; i++) { if (array[i] == separator && array[i - 1] == '.' && (i == prefix + 1 || array[i - 2] == separator)) { if (i == size - 1) { lastIsDirectory = true; } System.arraycopy(array, i + 1, array, i - 1, size - i); size -= 2; i--; } } outer: for (int i = prefix + 2; i < size; i++) { if (array[i] == separator && array[i - 1] == '.' && array[i - 2] == '.' && (i == prefix + 2 || array[i - 3] == separator)) { if (i == prefix + 2) { return null; } if (i == size - 1) { lastIsDirectory = true; } int j; for (j = i - 4; j >= prefix; j--) { if (array[j] == separator) { System.arraycopy(array, i + 1, array, j + 1, size - i); size -= i - j; i = j + 1; continue outer; } } System.arraycopy(array, i + 1, array, prefix, size - i); size -= i + 1 - prefix; i = prefix + 1; } } if (size <= 0) { return ""; } if (size <= prefix) { return new String(array, 0, size); } if (lastIsDirectory && true) { return new String(array, 0, size); } return new String(array, 0, size - 1); </DeepExtract> }
rexxar-android
positive
2,266
public static com.conveyal.transitwand.TransitWandProtos.Upload.Route.Stop parseFrom(java.io.InputStream input) throws java.io.IOException { com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; }
public static com.conveyal.transitwand.TransitWandProtos.Upload.Route.Stop parseFrom(java.io.InputStream input) throws java.io.IOException { <DeepExtract> com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; </DeepExtract> }
transit-wand
positive
2,267
public void write(org.apache.storm.thrift.protocol.TProtocol oprot, getStormConf_result struct) throws TException { oprot.writeStructBegin(STRUCT_DESC); if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); oprot.writeString(struct.success); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void write(org.apache.storm.thrift.protocol.TProtocol oprot, getStormConf_result struct) throws TException { <DeepExtract> </DeepExtract> oprot.writeStructBegin(STRUCT_DESC); <DeepExtract> </DeepExtract> if (struct.success != null) { <DeepExtract> </DeepExtract> oprot.writeFieldBegin(SUCCESS_FIELD_DESC); <DeepExtract> </DeepExtract> oprot.writeString(struct.success); <DeepExtract> </DeepExtract> oprot.writeFieldEnd(); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> oprot.writeFieldStop(); <DeepExtract> </DeepExtract> oprot.writeStructEnd(); <DeepExtract> </DeepExtract> }
storm-yarn
positive
2,268
public static void main(String[] args) { Quadrilatero r1 = new Rect(); Quadrilatero r2 = new Square(); Square s1 = new Square(); System.out.format("b=%d h=%d ; ", 4, 5); r1.setBase(4); r1.setHeight(5); System.out.println(r1); System.out.format("b=%d h=%d ; ", 5, 5); s1.setBase(5); s1.setHeight(5); System.out.println(s1); }
public static void main(String[] args) { Quadrilatero r1 = new Rect(); Quadrilatero r2 = new Square(); Square s1 = new Square(); System.out.format("b=%d h=%d ; ", 4, 5); r1.setBase(4); r1.setHeight(5); System.out.println(r1); <DeepExtract> System.out.format("b=%d h=%d ; ", 5, 5); s1.setBase(5); s1.setHeight(5); System.out.println(s1); </DeepExtract> }
uniud
positive
2,269
private void checkInputError() { mBtnLogin.setEnabled(false); mTvVerify.setEnabled(false); if (false) { mTvVerify.setTextColor(FontBlack); } else { mTvVerify.setTextColor(FontGray); } if (!StringUtil.isPhone(String.valueOf(mEtPhone.getText()))) { return; } mTvVerify.setEnabled(true); if (true) { mTvVerify.setTextColor(FontBlack); } else { mTvVerify.setTextColor(FontGray); } if (StringUtil.isEmpty(String.valueOf(mEtVerify.getText()))) { return; } if (!mCbAgree.isChecked()) { return; } mBtnLogin.setEnabled(true); }
private void checkInputError() { mBtnLogin.setEnabled(false); mTvVerify.setEnabled(false); if (false) { mTvVerify.setTextColor(FontBlack); } else { mTvVerify.setTextColor(FontGray); } if (!StringUtil.isPhone(String.valueOf(mEtPhone.getText()))) { return; } <DeepExtract> mTvVerify.setEnabled(true); if (true) { mTvVerify.setTextColor(FontBlack); } else { mTvVerify.setTextColor(FontGray); } </DeepExtract> if (StringUtil.isEmpty(String.valueOf(mEtVerify.getText()))) { return; } if (!mCbAgree.isChecked()) { return; } mBtnLogin.setEnabled(true); }
Electrocar-master
positive
2,270
@Override public void run() { super.setRefreshing(refreshing); if (refreshing) { if (mOnMyRefreshListener != null) mOnMyRefreshListener.onRefresh(); } }
@Override public void run() { <DeepExtract> super.setRefreshing(refreshing); if (refreshing) { if (mOnMyRefreshListener != null) mOnMyRefreshListener.onRefresh(); } </DeepExtract> }
MyRecyclerView
positive
2,271
@Override public void onErrorResponse(VolleyError error) { swipeRefreshLayout.setRefreshing(false); if (nextItemList != null && nextItemList.isEmpty()) { reloadBtn.setVisibility(View.VISIBLE); swipeRefreshLayout.setVisibility(View.GONE); stickyListHeadersListView.setVisibility(View.GONE); } ToastUtils.show(activity, error.getMessage()); }
@Override public void onErrorResponse(VolleyError error) { <DeepExtract> swipeRefreshLayout.setRefreshing(false); if (nextItemList != null && nextItemList.isEmpty()) { reloadBtn.setVisibility(View.VISIBLE); swipeRefreshLayout.setVisibility(View.GONE); stickyListHeadersListView.setVisibility(View.GONE); } </DeepExtract> ToastUtils.show(activity, error.getMessage()); }
36krReader
positive
2,272
@Test public void breakendEvaluationDifferentDuplicationOrientations() throws IOException { File wd = tmpFolder.newFolder("tmp"); String truthVcf = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "truth.vcf").toString(); String vcfForCompare = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "compare.vcf").toString(); String expectedFalseNegative = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_FN.vcf").toString(); String expectedFalsePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_FP.vcf").toString(); String expectedTruePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_TP.vcf").toString(); String expectedUnknownFalsePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_unknown_FP.vcf").toString(); String expectedUnknownTruePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_unknown_TP.vcf").toString(); Path outputFalseNegative = Paths.get(wd.getCanonicalPath(), "test_FN.vcf"); Path outputFalsePositive = Paths.get(wd.getCanonicalPath(), "test_FP.vcf"); Path outputTruePositive = Paths.get(wd.getCanonicalPath(), "test_TP.vcf"); Path outputUnknownFalsePositive = Paths.get(wd.getCanonicalPath(), "test_unknown_FP.vcf"); Path outputUnknownTruePositive = Paths.get(wd.getCanonicalPath(), "test_unknown_TP.vcf"); Path outputJson = Paths.get(wd.getCanonicalPath(), "test_report.json"); String[] args = new String[] { "-true_vcf", truthVcf, "-prefix", Paths.get(wd.getCanonicalPath(), "test").toString(), vcfForCompare }; VCFcompare.main(ArrayUtils.addAll(args, new String[] { "-wig", "100" })); if (updateVCF) { Files.copy(outputFalseNegative, Paths.get(expectedFalseNegative), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputFalsePositive, Paths.get(expectedFalsePositive), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputTruePositive, Paths.get(expectedTruePositive), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputUnknownTruePositive, Paths.get(expectedUnknownTruePositive), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputUnknownFalsePositive, Paths.get(expectedUnknownFalsePositive), StandardCopyOption.REPLACE_EXISTING); } assertTrue(FileUtils.contentEquals(outputFalseNegative.toFile(), new File(expectedFalseNegative))); assertTrue(FileUtils.contentEquals(outputFalsePositive.toFile(), new File(expectedFalsePositive))); assertTrue(FileUtils.contentEquals(outputTruePositive.toFile(), new File(expectedTruePositive))); assertTrue(FileUtils.contentEquals(outputUnknownFalsePositive.toFile(), new File(expectedUnknownFalsePositive))); assertTrue(FileUtils.contentEquals(outputUnknownTruePositive.toFile(), new File(expectedUnknownTruePositive))); }
@Test public void breakendEvaluationDifferentDuplicationOrientations() throws IOException { <DeepExtract> File wd = tmpFolder.newFolder("tmp"); String truthVcf = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "truth.vcf").toString(); String vcfForCompare = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "compare.vcf").toString(); String expectedFalseNegative = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_FN.vcf").toString(); String expectedFalsePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_FP.vcf").toString(); String expectedTruePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_TP.vcf").toString(); String expectedUnknownFalsePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_unknown_FP.vcf").toString(); String expectedUnknownTruePositive = new File("src/test/resources/validationTest/breakendTests/nonreciprocalWithDifferentOrientationsAndLargeWiggle", "test_unknown_TP.vcf").toString(); Path outputFalseNegative = Paths.get(wd.getCanonicalPath(), "test_FN.vcf"); Path outputFalsePositive = Paths.get(wd.getCanonicalPath(), "test_FP.vcf"); Path outputTruePositive = Paths.get(wd.getCanonicalPath(), "test_TP.vcf"); Path outputUnknownFalsePositive = Paths.get(wd.getCanonicalPath(), "test_unknown_FP.vcf"); Path outputUnknownTruePositive = Paths.get(wd.getCanonicalPath(), "test_unknown_TP.vcf"); Path outputJson = Paths.get(wd.getCanonicalPath(), "test_report.json"); String[] args = new String[] { "-true_vcf", truthVcf, "-prefix", Paths.get(wd.getCanonicalPath(), "test").toString(), vcfForCompare }; VCFcompare.main(ArrayUtils.addAll(args, new String[] { "-wig", "100" })); if (updateVCF) { Files.copy(outputFalseNegative, Paths.get(expectedFalseNegative), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputFalsePositive, Paths.get(expectedFalsePositive), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputTruePositive, Paths.get(expectedTruePositive), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputUnknownTruePositive, Paths.get(expectedUnknownTruePositive), StandardCopyOption.REPLACE_EXISTING); Files.copy(outputUnknownFalsePositive, Paths.get(expectedUnknownFalsePositive), StandardCopyOption.REPLACE_EXISTING); } assertTrue(FileUtils.contentEquals(outputFalseNegative.toFile(), new File(expectedFalseNegative))); assertTrue(FileUtils.contentEquals(outputFalsePositive.toFile(), new File(expectedFalsePositive))); assertTrue(FileUtils.contentEquals(outputTruePositive.toFile(), new File(expectedTruePositive))); assertTrue(FileUtils.contentEquals(outputUnknownFalsePositive.toFile(), new File(expectedUnknownFalsePositive))); assertTrue(FileUtils.contentEquals(outputUnknownTruePositive.toFile(), new File(expectedUnknownTruePositive))); </DeepExtract> }
varsim
positive
2,273
@Override public void onClick(View v) { if (getActivity() instanceof DrawerLayoutActivity) { DrawerLayoutActivity myActivity = (DrawerLayoutActivity) getActivity(); myActivity.removeSlide(); } }
@Override public void onClick(View v) { <DeepExtract> if (getActivity() instanceof DrawerLayoutActivity) { DrawerLayoutActivity myActivity = (DrawerLayoutActivity) getActivity(); myActivity.removeSlide(); } </DeepExtract> }
AndroidAll
positive
2,274
public static void glBindFramebuffer(int target, int frameBuffer) { if (!isContextCompatible()) throw new IllegalStateException("The context should be created before invoking the GL functions"); nglBindFramebuffer(target, WebGLObjectMap.get().toFramebuffer(frameBuffer)); }
public static void glBindFramebuffer(int target, int frameBuffer) { <DeepExtract> if (!isContextCompatible()) throw new IllegalStateException("The context should be created before invoking the GL functions"); </DeepExtract> nglBindFramebuffer(target, WebGLObjectMap.get().toFramebuffer(frameBuffer)); }
WebGL4J
positive
2,275
public Criteria andNameIsNull() { if ("name is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("name is null")); return (Criteria) this; }
public Criteria andNameIsNull() { <DeepExtract> if ("name is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("name is null")); </DeepExtract> return (Criteria) this; }
ehealth_start
positive
2,276
public void addMessages(Msg messages) { if (getMessages() != null) { throw new BuildException(Messages.getString("AntConfig.duplicate.element") + ": " + "messages"); } setMessages(messages); }
public void addMessages(Msg messages) { <DeepExtract> if (getMessages() != null) { throw new BuildException(Messages.getString("AntConfig.duplicate.element") + ": " + "messages"); } </DeepExtract> setMessages(messages); }
CardDAVSyncOutlook
positive
2,277
@Path("/maintenance") @GET public ConfigurationChangeResult getMaintenanceStatus() { HttpProxyServer server = (HttpProxyServer) context.getAttribute("server"); return new ConfigurationChangeResult(server.getCurrentConfiguration().isMaintenanceModeEnabled(), ""); }
@Path("/maintenance") @GET public ConfigurationChangeResult getMaintenanceStatus() { HttpProxyServer server = (HttpProxyServer) context.getAttribute("server"); <DeepExtract> return new ConfigurationChangeResult(server.getCurrentConfiguration().isMaintenanceModeEnabled(), ""); </DeepExtract> }
carapaceproxy
positive
2,278
@Override public String component2() { return (String) get(1); }
@Override public String component2() { <DeepExtract> return (String) get(1); </DeepExtract> }
sapling
positive
2,279
void startAnimation(int from, int to) { this.isAnimating = true; this.mFrom = from; this.mTo = to; this.mFrame = mVelocity; if (mTo > mFrom) { this.mFrame = Math.abs(this.mVelocity); } else if (mTo < mFrom) { this.mFrame = -Math.abs(this.mVelocity); } else { this.isAnimating = false; this.mOnAnimateListener.onAnimateComplete(); return; } this.mOnAnimateListener.onAnimationStart(); if (!isAnimating) { return; } calcNextFrame(); mOnAnimateListener.onFrameUpdate(mFrame); if (mOnAnimateListener.continueAnimating()) { requireNextFrame(); } else { stopAnimation(); mOnAnimateListener.onAnimateComplete(); return; } }
void startAnimation(int from, int to) { this.isAnimating = true; this.mFrom = from; this.mTo = to; this.mFrame = mVelocity; if (mTo > mFrom) { this.mFrame = Math.abs(this.mVelocity); } else if (mTo < mFrom) { this.mFrame = -Math.abs(this.mVelocity); } else { this.isAnimating = false; this.mOnAnimateListener.onAnimateComplete(); return; } this.mOnAnimateListener.onAnimationStart(); <DeepExtract> if (!isAnimating) { return; } calcNextFrame(); mOnAnimateListener.onFrameUpdate(mFrame); if (mOnAnimateListener.continueAnimating()) { requireNextFrame(); } else { stopAnimation(); mOnAnimateListener.onAnimateComplete(); return; } </DeepExtract> }
XDesktopHelper
positive
2,280
private boolean validateInferenceServerData() { boolean valid = true; if (inferenceAddressField.getText().isBlank()) { inferenceAddressField.pseudoClassStateChanged(invalidValuePseudoClass, true); valid = false; } else { inferenceAddressField.pseudoClassStateChanged(invalidValuePseudoClass, false); } if (!NumberUtils.isParsable(inferencePortField.getText())) { inferencePortField.pseudoClassStateChanged(invalidValuePseudoClass, true); valid = false; } else { inferencePortField.pseudoClassStateChanged(invalidValuePseudoClass, false); } return valid; }
private boolean validateInferenceServerData() { <DeepExtract> boolean valid = true; if (inferenceAddressField.getText().isBlank()) { inferenceAddressField.pseudoClassStateChanged(invalidValuePseudoClass, true); valid = false; } else { inferenceAddressField.pseudoClassStateChanged(invalidValuePseudoClass, false); } if (!NumberUtils.isParsable(inferencePortField.getText())) { inferencePortField.pseudoClassStateChanged(invalidValuePseudoClass, true); valid = false; } else { inferencePortField.pseudoClassStateChanged(invalidValuePseudoClass, false); } return valid; </DeepExtract> }
BoundingBoxEditor
positive
2,281
public MimeType mimeType(String name) { T res = mimeTypes.get(name); if (res == null) { try { res = MimeType.class.newInstance(); mimeTypes.put(name, res); } catch (Exception e) { throw new RamlCheckerException("Could not create instance of " + MimeType.class, e); } } return res; }
public MimeType mimeType(String name) { <DeepExtract> T res = mimeTypes.get(name); if (res == null) { try { res = MimeType.class.newInstance(); mimeTypes.put(name, res); } catch (Exception e) { throw new RamlCheckerException("Could not create instance of " + MimeType.class, e); } } return res; </DeepExtract> }
raml-tester
positive
2,282
public List<Case> doInHibernate(Session session) throws HibernateException, SQLException { Query qu = session.createQuery("select c from Case c,CaseTag tc " + " where c.id = tc.caseId and tc.tagId = :tagId "); qu.setLong("tagId", tag.getId()); setPage(qu, pageIndex, pageSize); return getHibernateTemplate().find("from CaseTag"); }
public List<Case> doInHibernate(Session session) throws HibernateException, SQLException { Query qu = session.createQuery("select c from Case c,CaseTag tc " + " where c.id = tc.caseId and tc.tagId = :tagId "); qu.setLong("tagId", tag.getId()); setPage(qu, pageIndex, pageSize); <DeepExtract> return getHibernateTemplate().find("from CaseTag"); </DeepExtract> }
zkfiddle
positive
2,283
@Override public void setImageResource(int resId) { super.setImageResource(resId); if (getDrawable() == null) { mBitmap = null; } if (getDrawable() instanceof BitmapDrawable) { mBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); } try { Bitmap bitmap; if (getDrawable() instanceof ColorDrawable) { bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); } else { bitmap = Bitmap.createBitmap(getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight(), BITMAP_CONFIG); } Canvas canvas = new Canvas(bitmap); getDrawable().setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); getDrawable().draw(canvas); mBitmap = bitmap; } catch (OutOfMemoryError e) { mBitmap = null; } if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); }
@Override public void setImageResource(int resId) { super.setImageResource(resId); if (getDrawable() == null) { mBitmap = null; } if (getDrawable() instanceof BitmapDrawable) { mBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); } try { Bitmap bitmap; if (getDrawable() instanceof ColorDrawable) { bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); } else { bitmap = Bitmap.createBitmap(getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight(), BITMAP_CONFIG); } Canvas canvas = new Canvas(bitmap); getDrawable().setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); getDrawable().draw(canvas); mBitmap = bitmap; } catch (OutOfMemoryError e) { mBitmap = null; } <DeepExtract> if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); </DeepExtract> }
MusicPlayerdemo
positive
2,284
public Criteria andVersionIsNotNull() { if ("version is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("version is not null")); return (Criteria) this; }
public Criteria andVersionIsNotNull() { <DeepExtract> if ("version is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("version is not null")); </DeepExtract> return (Criteria) this; }
common-admin
positive
2,285
protected JLanguageTool newLanguageTool() { new JLanguageTool(resolveLanguage()).getAllRules().stream().filter(rule -> !rule.isDictionaryBasedSpellingRule()).forEach(nonDictionaryBasedSpellingRule -> new JLanguageTool(resolveLanguage()).disableRule(nonDictionaryBasedSpellingRule.getId())); return new JLanguageTool(resolveLanguage()); }
protected JLanguageTool newLanguageTool() { <DeepExtract> new JLanguageTool(resolveLanguage()).getAllRules().stream().filter(rule -> !rule.isDictionaryBasedSpellingRule()).forEach(nonDictionaryBasedSpellingRule -> new JLanguageTool(resolveLanguage()).disableRule(nonDictionaryBasedSpellingRule.getId())); return new JLanguageTool(resolveLanguage()); </DeepExtract> }
contacts-application
positive
2,286
public void enableLineBlending() { GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); GL11.glEnable(2848); GL11.glHint(3154, 4354); }
public void enableLineBlending() { <DeepExtract> GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); </DeepExtract> GL11.glEnable(2848); GL11.glHint(3154, 4354); }
Aer-Client
positive
2,288
public Vector rotateAroundY(double angle) { double angleCos = Math.cos(angle); double angleSin = Math.sin(angle); double x = angleCos * getX() + angleSin * getZ(); double z = -angleSin * getX() + angleCos * getZ(); this.z = z; return this; }
public Vector rotateAroundY(double angle) { double angleCos = Math.cos(angle); double angleSin = Math.sin(angle); double x = angleCos * getX() + angleSin * getZ(); double z = -angleSin * getX() + angleCos * getZ(); <DeepExtract> this.z = z; return this; </DeepExtract> }
Limbo
positive
2,289
@Test public void testSchemolution() throws AvroBaseException, IOException { AvroBase<User, byte[]> userHAB = AvroBaseFactory.createAvroBase(new HABModule(), HAB.class, AvroFormat.JSON); User saved = new User(); saved.firstName = $("Sam"); saved.lastName = $("Pullara"); saved.birthday = $("1212"); saved.gender = GenderType.MALE; saved.email = $("spullara@yahoo.com"); saved.description = $("CTO of RightTime, Inc. and one of the founders of BagCheck"); saved.title = $("Engineer"); saved.image = $("http://farm1.static.flickr.com/1/buddyicons/32354567@N00.jpg"); saved.location = $("Los Altos, CA"); saved.mobile = $("4155551212"); saved.password = ByteBuffer.wrap($("").getBytes()); byte[] row = Bytes.toBytes("spullara"); userHAB.put(row, saved); Row<User, byte[]> loaded = userHAB.get(row); assertEquals(saved, loaded.value); HTablePool pool = new HTablePool(); HTableInterface table = pool.getTable(TABLE); try { Get get = new Get(row); byte[] DATA = Bytes.toBytes("d"); get.addColumn(COLUMN_FAMILY, DATA); Result result = table.get(get); assertTrue(Bytes.toString(result.getValue(COLUMN_FAMILY, DATA)).startsWith("{")); } finally { pool.putTable(table); } byte[] row = Bytes.toBytes("spullara"); HTablePool pool = new HTablePool(); HTableInterface userTable = pool.getTable(TABLE); try { Get get = new Get(row); Result userRow = userTable.get(get); byte[] schemaKey = userRow.getValue(COLUMN_FAMILY, Bytes.toBytes("s")); HTableInterface schemaTable = pool.getTable(SCHEMA_TABLE); Schema actual; try { Result schemaRow = schemaTable.get(new Get(schemaKey)); actual = Schema.parse(Bytes.toString(schemaRow.getValue(Bytes.toBytes("avro"), Bytes.toBytes("s")))); } finally { pool.putTable(schemaTable); } DecoderFactory decoderFactory = new DecoderFactory(); JsonDecoder jd = decoderFactory.jsonDecoder(actual, Bytes.toString(userRow.getValue(COLUMN_FAMILY, Bytes.toBytes("d")))); InputStream stream = getClass().getResourceAsStream("/src/test/avro/User2.avsc"); Schema expected = Schema.parse(stream); { SpecificDatumReader<User> sdr = new SpecificDatumReader<User>(); sdr.setSchema(actual); sdr.setExpected(expected); User loaded = sdr.read(null, jd); assertEquals("Sam", loaded.firstName.toString()); assertEquals(null, loaded.mobile); } } finally { pool.putTable(userTable); } }
@Test public void testSchemolution() throws AvroBaseException, IOException { <DeepExtract> AvroBase<User, byte[]> userHAB = AvroBaseFactory.createAvroBase(new HABModule(), HAB.class, AvroFormat.JSON); User saved = new User(); saved.firstName = $("Sam"); saved.lastName = $("Pullara"); saved.birthday = $("1212"); saved.gender = GenderType.MALE; saved.email = $("spullara@yahoo.com"); saved.description = $("CTO of RightTime, Inc. and one of the founders of BagCheck"); saved.title = $("Engineer"); saved.image = $("http://farm1.static.flickr.com/1/buddyicons/32354567@N00.jpg"); saved.location = $("Los Altos, CA"); saved.mobile = $("4155551212"); saved.password = ByteBuffer.wrap($("").getBytes()); byte[] row = Bytes.toBytes("spullara"); userHAB.put(row, saved); Row<User, byte[]> loaded = userHAB.get(row); assertEquals(saved, loaded.value); HTablePool pool = new HTablePool(); HTableInterface table = pool.getTable(TABLE); try { Get get = new Get(row); byte[] DATA = Bytes.toBytes("d"); get.addColumn(COLUMN_FAMILY, DATA); Result result = table.get(get); assertTrue(Bytes.toString(result.getValue(COLUMN_FAMILY, DATA)).startsWith("{")); } finally { pool.putTable(table); } </DeepExtract> byte[] row = Bytes.toBytes("spullara"); HTablePool pool = new HTablePool(); HTableInterface userTable = pool.getTable(TABLE); try { Get get = new Get(row); Result userRow = userTable.get(get); byte[] schemaKey = userRow.getValue(COLUMN_FAMILY, Bytes.toBytes("s")); HTableInterface schemaTable = pool.getTable(SCHEMA_TABLE); Schema actual; try { Result schemaRow = schemaTable.get(new Get(schemaKey)); actual = Schema.parse(Bytes.toString(schemaRow.getValue(Bytes.toBytes("avro"), Bytes.toBytes("s")))); } finally { pool.putTable(schemaTable); } DecoderFactory decoderFactory = new DecoderFactory(); JsonDecoder jd = decoderFactory.jsonDecoder(actual, Bytes.toString(userRow.getValue(COLUMN_FAMILY, Bytes.toBytes("d")))); InputStream stream = getClass().getResourceAsStream("/src/test/avro/User2.avsc"); Schema expected = Schema.parse(stream); { SpecificDatumReader<User> sdr = new SpecificDatumReader<User>(); sdr.setSchema(actual); sdr.setExpected(expected); User loaded = sdr.read(null, jd); assertEquals("Sam", loaded.firstName.toString()); assertEquals(null, loaded.mobile); } } finally { pool.putTable(userTable); } }
havrobase
positive
2,290
@Override public MrrtReportTemplate parse(String mrrtTemplate) throws IOException { validator.validate(mrrtTemplate); final Document doc = Jsoup.parse(mrrtTemplate, ""); final MrrtReportTemplate result = new MrrtReportTemplate(); final Elements metaTags = doc.getElementsByTag("meta"); result.setPath(doc.baseUri()); result.setCharset(metaTags.attr("charset")); for (Element metaTag : metaTags) { final String name = metaTag.attr("name"); final String content = metaTag.attr("content"); switch(name) { case DCTERMS_TITLE: result.setDcTermsTitle(content); break; case DCTERMS_DESCRIPTION: result.setDcTermsDescription(content); break; case DCTERMS_IDENTIFIER: result.setDcTermsIdentifier(content); break; case DCTERMS_TYPE: result.setDcTermsType(content); break; case DCTERMS_LANGUAGE: result.setDcTermsLanguage(content); break; case DCTERMS_PUBLISHER: result.setDcTermsPublisher(content); break; case DCTERMS_RIGHTS: result.setDcTermsRights(content); break; case DCTERMS_LICENSE: result.setDcTermsLicense(content); break; case DCTERMS_DATE: result.setDcTermsDate(content); break; case DCTERMS_CREATOR: result.setDcTermsCreator(content); break; default: log.debug("Unhandled meta tag " + name); } } try { addTermsToTemplate(result, doc.getElementsByTag("script").get(0).toString()); } catch (ParserConfigurationException | SAXException e) { throw new APIException("radiology.report.template.parser.error", null, e); } return result; }
@Override public MrrtReportTemplate parse(String mrrtTemplate) throws IOException { validator.validate(mrrtTemplate); final Document doc = Jsoup.parse(mrrtTemplate, ""); final MrrtReportTemplate result = new MrrtReportTemplate(); <DeepExtract> final Elements metaTags = doc.getElementsByTag("meta"); result.setPath(doc.baseUri()); result.setCharset(metaTags.attr("charset")); for (Element metaTag : metaTags) { final String name = metaTag.attr("name"); final String content = metaTag.attr("content"); switch(name) { case DCTERMS_TITLE: result.setDcTermsTitle(content); break; case DCTERMS_DESCRIPTION: result.setDcTermsDescription(content); break; case DCTERMS_IDENTIFIER: result.setDcTermsIdentifier(content); break; case DCTERMS_TYPE: result.setDcTermsType(content); break; case DCTERMS_LANGUAGE: result.setDcTermsLanguage(content); break; case DCTERMS_PUBLISHER: result.setDcTermsPublisher(content); break; case DCTERMS_RIGHTS: result.setDcTermsRights(content); break; case DCTERMS_LICENSE: result.setDcTermsLicense(content); break; case DCTERMS_DATE: result.setDcTermsDate(content); break; case DCTERMS_CREATOR: result.setDcTermsCreator(content); break; default: log.debug("Unhandled meta tag " + name); } } </DeepExtract> try { addTermsToTemplate(result, doc.getElementsByTag("script").get(0).toString()); } catch (ParserConfigurationException | SAXException e) { throw new APIException("radiology.report.template.parser.error", null, e); } return result; }
openmrs-module-radiology
positive
2,291
public String bs() { @SuppressWarnings("unchecked") List<List<String>> buzzwordLists = (List<List<String>>) faker.fakeValuesService().fetchObject("company.bs"); List<String> words = new ArrayList<String>(); for (List<String> list : buzzwordLists) { words.add(list.get(faker.random().nextInt(list.size()))); } return join(words, " "); }
public String bs() { @SuppressWarnings("unchecked") List<List<String>> buzzwordLists = (List<List<String>>) faker.fakeValuesService().fetchObject("company.bs"); <DeepExtract> List<String> words = new ArrayList<String>(); for (List<String> list : buzzwordLists) { words.add(list.get(faker.random().nextInt(list.size()))); } return join(words, " "); </DeepExtract> }
javafaker
positive
2,293
@Override public void onAnimationEnd(final Animator animator) { expandingLayout.setVisibility(View.GONE); cardView.setExpanded(false); if (listView instanceof CardListView) { CardListView cardListView = (CardListView) listView; if (cardListView.mAdapter != null) { cardListView.mAdapter.notifyDataSetChanged(); } else if (cardListView.mCursorAdapter != null) { } } Card card = cardView.getCard(); if (card.getOnCollapseAnimatorEndListener() != null) card.getOnCollapseAnimatorEndListener().onCollapseEnd(card); }
@Override public void onAnimationEnd(final Animator animator) { expandingLayout.setVisibility(View.GONE); cardView.setExpanded(false); <DeepExtract> if (listView instanceof CardListView) { CardListView cardListView = (CardListView) listView; if (cardListView.mAdapter != null) { cardListView.mAdapter.notifyDataSetChanged(); } else if (cardListView.mCursorAdapter != null) { } } </DeepExtract> Card card = cardView.getCard(); if (card.getOnCollapseAnimatorEndListener() != null) card.getOnCollapseAnimatorEndListener().onCollapseEnd(card); }
BabySay
positive
2,294
public void setAuthMethod(AuthMethod method) { SharedPreferences.Editor editor = mPrefs.edit(); if (method.toString() != null) { editor.putString(AUTH_METHOD, method.toString()); } else { editor.remove(AUTH_METHOD); } editor.apply(); }
public void setAuthMethod(AuthMethod method) { <DeepExtract> SharedPreferences.Editor editor = mPrefs.edit(); if (method.toString() != null) { editor.putString(AUTH_METHOD, method.toString()); } else { editor.remove(AUTH_METHOD); } editor.apply(); </DeepExtract> }
natrium-android-wallet
positive
2,295
@Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.tab_song); myApplication = (MyApplication) getApplication(); myHandler = new MyHandler(); myApplication.setTabSongActivity(this); radioGroup = (RadioGroup) findViewById(R.id.songinfo_radiogroup); radioButtonLocal = (RadioButton) findViewById(R.id.radioButtonLocal); radioButtonSinger = (RadioButton) findViewById(R.id.radioButtonSinger); radioButtonFolder = (RadioButton) findViewById(R.id.radioButtonFolder); pre = (ImageButton) findViewById(R.id.pre); play = (ImageButton) findViewById(R.id.play_or_pause); next = (ImageButton) findViewById(R.id.next); song = (ImageButton) findViewById(R.id.mini_image); song_name = (TextView) findViewById(R.id.song_name); singer_name = (TextView) findViewById(R.id.singer_name); tab_mini = (LinearLayout) findViewById(R.id.song); song.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(TabSongActivity.this, PlayActivity.class); startActivity(intent); } }); tab_mini.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(TabSongActivity.this, PlayActivity.class); startActivity(intent); } }); tabHost = getTabHost(); tabHost.addTab(tabHost.newTabSpec("L").setIndicator("L").setContent(new Intent(TabSongActivity.this, SongInfoLocal.class))); tabHost.addTab(tabHost.newTabSpec("S").setIndicator("S").setContent(new Intent(TabSongActivity.this, SongInfoSingerMain.class))); tabHost.addTab(tabHost.newTabSpec("F").setIndicator("F").setContent(new Intent(TabSongActivity.this, SongInfoFolderMain.class))); tabHost.setCurrentTab(0); radioGroup.setOnCheckedChangeListener(this); pre.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { preClick(); } catch (IOException e) { e.printStackTrace(); } } }); play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playClick(); } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { nextClick(); } catch (IOException e) { e.printStackTrace(); } } }); musicPlayerService = myApplication.musicPlayerService; if (musicPlayerService != null && musicPlayerService.mediaPlayer != null) { if (musicPlayerService.mediaPlayer.isPlaying()) { changeToPause(); } } }
@Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.tab_song); myApplication = (MyApplication) getApplication(); myHandler = new MyHandler(); myApplication.setTabSongActivity(this); <DeepExtract> radioGroup = (RadioGroup) findViewById(R.id.songinfo_radiogroup); radioButtonLocal = (RadioButton) findViewById(R.id.radioButtonLocal); radioButtonSinger = (RadioButton) findViewById(R.id.radioButtonSinger); radioButtonFolder = (RadioButton) findViewById(R.id.radioButtonFolder); pre = (ImageButton) findViewById(R.id.pre); play = (ImageButton) findViewById(R.id.play_or_pause); next = (ImageButton) findViewById(R.id.next); song = (ImageButton) findViewById(R.id.mini_image); song_name = (TextView) findViewById(R.id.song_name); singer_name = (TextView) findViewById(R.id.singer_name); tab_mini = (LinearLayout) findViewById(R.id.song); </DeepExtract> song.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(TabSongActivity.this, PlayActivity.class); startActivity(intent); } }); tab_mini.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(TabSongActivity.this, PlayActivity.class); startActivity(intent); } }); tabHost = getTabHost(); tabHost.addTab(tabHost.newTabSpec("L").setIndicator("L").setContent(new Intent(TabSongActivity.this, SongInfoLocal.class))); tabHost.addTab(tabHost.newTabSpec("S").setIndicator("S").setContent(new Intent(TabSongActivity.this, SongInfoSingerMain.class))); tabHost.addTab(tabHost.newTabSpec("F").setIndicator("F").setContent(new Intent(TabSongActivity.this, SongInfoFolderMain.class))); tabHost.setCurrentTab(0); radioGroup.setOnCheckedChangeListener(this); pre.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { preClick(); } catch (IOException e) { e.printStackTrace(); } } }); play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playClick(); } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { nextClick(); } catch (IOException e) { e.printStackTrace(); } } }); musicPlayerService = myApplication.musicPlayerService; if (musicPlayerService != null && musicPlayerService.mediaPlayer != null) { if (musicPlayerService.mediaPlayer.isPlaying()) { changeToPause(); } } }
MyMusicPlayer
positive
2,296
public void init() { if (inited) { return; } inited = true; customers = new ArrayList<Customer>(); orders = new ArrayList<Order>(); products = new ArrayList<Product>(); c("John Doe", "123 Willow Road", "Menlo Park", "USA", "650-734-2187"); c("Mary Lane", "75 State Street", "Atlanta", "USA", "302-145-8765"); c("Charlie Yeh", "5 Nathan Road", "Kowlon", "Hong Kong", "11-7565-2323"); p("Eagle", "book", 12.50, 100); p("Coming Home", "dvd", 8.00, 50); p("Greatest Hits", "cd", 6.5, 200); p("History of Golf", "book", 11.0, 30); p("Toy Story", "dvd", 10.00, 1000); p("iSee", "book", 12.50, 150); o(100, new Date(2010, 2, 18), 20.80); o(100, new Date(2011, 5, 3), 34.50); o(100, new Date(2011, 8, 2), 210.75); o(101, new Date(2011, 1, 15), 50.23); o(101, new Date(2012, 1, 3), 126.77); o(102, new Date(2011, 4, 15), 101.20); }
public void init() { if (inited) { return; } inited = true; customers = new ArrayList<Customer>(); orders = new ArrayList<Order>(); products = new ArrayList<Product>(); c("John Doe", "123 Willow Road", "Menlo Park", "USA", "650-734-2187"); c("Mary Lane", "75 State Street", "Atlanta", "USA", "302-145-8765"); c("Charlie Yeh", "5 Nathan Road", "Kowlon", "Hong Kong", "11-7565-2323"); p("Eagle", "book", 12.50, 100); p("Coming Home", "dvd", 8.00, 50); p("Greatest Hits", "cd", 6.5, 200); p("History of Golf", "book", 11.0, 30); p("Toy Story", "dvd", 10.00, 1000); p("iSee", "book", 12.50, 150); <DeepExtract> o(100, new Date(2010, 2, 18), 20.80); o(100, new Date(2011, 5, 3), 34.50); o(100, new Date(2011, 8, 2), 210.75); o(101, new Date(2011, 1, 15), 50.23); o(101, new Date(2012, 1, 3), 126.77); o(102, new Date(2011, 4, 15), 101.20); </DeepExtract> }
el-spec
positive
2,297
public boolean newStatement(T lhs, IPAAbstractOperator<T> operator, T op1, T op2, boolean toWorkList, boolean eager) { IPAGeneralStatement<T> s = new Statement(lhs, operator, op1, op2); if (getFixedPointSystem().containsStatement(s)) { return false; } if (lhs != null) { lhs.setOrderNumber(nextOrderNumber++); } nCreated++; getFixedPointSystem().addStatement(s); if (eager) { byte code = s.evaluate(); if (verbose) { nEvaluated++; if (nEvaluated % getVerboseInterval() == 0) { performVerboseAction(); } if (nEvaluated % getPeriodicMaintainInterval() == 0) { periodicMaintenance(); } } if (isChanged(code)) { updateWorkList(s); } } else if (toWorkList) { addToWorkList(s); } topologicalCounter++; return true; }
public boolean newStatement(T lhs, IPAAbstractOperator<T> operator, T op1, T op2, boolean toWorkList, boolean eager) { IPAGeneralStatement<T> s = new Statement(lhs, operator, op1, op2); if (getFixedPointSystem().containsStatement(s)) { return false; } if (lhs != null) { lhs.setOrderNumber(nextOrderNumber++); } nCreated++; getFixedPointSystem().addStatement(s); <DeepExtract> if (eager) { byte code = s.evaluate(); if (verbose) { nEvaluated++; if (nEvaluated % getVerboseInterval() == 0) { performVerboseAction(); } if (nEvaluated % getPeriodicMaintainInterval() == 0) { periodicMaintenance(); } } if (isChanged(code)) { updateWorkList(s); } } else if (toWorkList) { addToWorkList(s); } </DeepExtract> topologicalCounter++; return true; }
Incremental_Points_to_Analysis
positive
2,298
public LSOLayer addBitmapLayer(LSOAsset asset, long atCompUs) { if (renderer == null) { renderer = new LSOAexSegmentPlayerRender(getContext()); setupSuccess = false; } if (renderer != null && setup()) { return renderer.addBitmapLayer(asset, atCompUs); } else { return null; } }
public LSOLayer addBitmapLayer(LSOAsset asset, long atCompUs) { <DeepExtract> if (renderer == null) { renderer = new LSOAexSegmentPlayerRender(getContext()); setupSuccess = false; } </DeepExtract> if (renderer != null && setup()) { return renderer.addBitmapLayer(asset, atCompUs); } else { return null; } }
video-edit-sdk-android
positive
2,299
public static void showIndefiniteSnackbar(View parent, CharSequence text, @ColorInt int textColor, @ColorInt int bgColor, CharSequence actionText, int actionTextColor, View.OnClickListener listener) { SpannableString spannableString = new SpannableString(text); ForegroundColorSpan colorSpan = new ForegroundColorSpan(textColor); spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, spannableString, Snackbar.LENGTH_INDEFINITE)); Snackbar snackbar = snackbarWeakReference.get(); View view = snackbar.getView(); view.setBackgroundColor(bgColor); if (actionText != null && actionText.length() > 0 && listener != null) { snackbar.setActionTextColor(actionTextColor); snackbar.setAction(actionText, listener); } snackbar.show(); }
public static void showIndefiniteSnackbar(View parent, CharSequence text, @ColorInt int textColor, @ColorInt int bgColor, CharSequence actionText, int actionTextColor, View.OnClickListener listener) { <DeepExtract> SpannableString spannableString = new SpannableString(text); ForegroundColorSpan colorSpan = new ForegroundColorSpan(textColor); spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, spannableString, Snackbar.LENGTH_INDEFINITE)); Snackbar snackbar = snackbarWeakReference.get(); View view = snackbar.getView(); view.setBackgroundColor(bgColor); if (actionText != null && actionText.length() > 0 && listener != null) { snackbar.setActionTextColor(actionTextColor); snackbar.setAction(actionText, listener); } snackbar.show(); </DeepExtract> }
HBase
positive
2,300
public static String getStatcatPrologue() { String ret = "Division I"; String propertyValue = getPropertiesFile().getProperty("statcat.prologue"); if (propertyValue != null) { ret = propertyValue; } if (ret == null) { throw new RuntimeException("You must specify a value for property '" + "statcat.prologue" + "' in " + PROPERTIES_FILE_NAME + "!"); } return ret; }
public static String getStatcatPrologue() { <DeepExtract> String ret = "Division I"; String propertyValue = getPropertiesFile().getProperty("statcat.prologue"); if (propertyValue != null) { ret = propertyValue; } if (ret == null) { throw new RuntimeException("You must specify a value for property '" + "statcat.prologue" + "' in " + PROPERTIES_FILE_NAME + "!"); } return ret; </DeepExtract> }
developerWorks
positive
2,301
void start() { if (0 != currentSpeedLevelIndex) { currentSpeedLevelIndex = 0; int speed = SPEED_LEVEL_SPEEDS[0]; timer.changeSpeed(isFF ? speed : -speed); ui.onFFRewindSpeed(SPEED_LEVELS[0]); } timer.run(); }
void start() { <DeepExtract> if (0 != currentSpeedLevelIndex) { currentSpeedLevelIndex = 0; int speed = SPEED_LEVEL_SPEEDS[0]; timer.changeSpeed(isFF ? speed : -speed); ui.onFFRewindSpeed(SPEED_LEVELS[0]); } </DeepExtract> timer.run(); }
homerplayer
positive
2,302
public Criteria andGenderGreaterThanOrEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "gender" + " cannot be null"); } criteria.add(new Criterion("gender >=", value)); return (Criteria) this; }
public Criteria andGenderGreaterThanOrEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "gender" + " cannot be null"); } criteria.add(new Criterion("gender >=", value)); </DeepExtract> return (Criteria) this; }
SSM_BookSystem
positive
2,303
@Override protected void onStartup() { if (triggered.compareAndSet(false, true)) { getTargetQueue().execute(this); } }
@Override protected void onStartup() { <DeepExtract> if (triggered.compareAndSet(false, true)) { getTargetQueue().execute(this); } </DeepExtract> }
hawtdispatch
positive
2,304
private static void bc(DB db) throws Exception { RKv SET = db.getrKv(); long startTime = System.currentTimeMillis(); w_times -> set(SET, 1000000).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "SET" + ":" + ((1000000 * 1.0 / (endTime - startTime)) * 1000 + " per second")); long startTime = System.currentTimeMillis(); w_times -> get(SET, 1000000).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "GET" + ":" + ((1000000 * 1.0 / (endTime - startTime)) * 1000 + " per second")); long startTime = System.currentTimeMillis(); w_times -> getNoTTL(SET, 1000000).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "GETNOTTL" + ":" + ((1000000 * 1.0 / (endTime - startTime)) * 1000 + " per second")); RKv kv = db.getrKv(); long startTime = System.currentTimeMillis(); w_times -> incr(kv, w_times).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "incr" + ":" + ((100 * 10000.0) / (endTime - startTime)) * 1000 + " per second"); }
private static void bc(DB db) throws Exception { RKv SET = db.getrKv(); long startTime = System.currentTimeMillis(); w_times -> set(SET, 1000000).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "SET" + ":" + ((1000000 * 1.0 / (endTime - startTime)) * 1000 + " per second")); long startTime = System.currentTimeMillis(); w_times -> get(SET, 1000000).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "GET" + ":" + ((1000000 * 1.0 / (endTime - startTime)) * 1000 + " per second")); long startTime = System.currentTimeMillis(); w_times -> getNoTTL(SET, 1000000).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "GETNOTTL" + ":" + ((1000000 * 1.0 / (endTime - startTime)) * 1000 + " per second")); RKv kv = db.getrKv(); <DeepExtract> long startTime = System.currentTimeMillis(); w_times -> incr(kv, w_times).call(100); long endTime = System.currentTimeMillis(); System.out.println("benchmark " + "incr" + ":" + ((100 * 10000.0) / (endTime - startTime)) * 1000 + " per second"); </DeepExtract> }
KitDB
positive
2,305
public static Builder builder() { VideoFrameRateParams.Builder.setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); VideoScaleParams.Builder.setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); VideoSizeParams.Builder.setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); return setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); }
public static Builder builder() { <DeepExtract> VideoFrameRateParams.Builder.setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); VideoScaleParams.Builder.setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); VideoSizeParams.Builder.setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); return setOnlyClassDefaults(new AutoValue_CameraParams.Builder()); </DeepExtract> }
FFmpegVideoRecorder
positive
2,306
public void onDownloadFileFailure(String name) { if (BuildConfig.DEBUG) Log.d(TAG, "onDownloadFileFailure"); mFirebaseAnalytics.logEvent(MainConsts.FIREBASE_CUSTOM_EVENT_DOWNLOAD_FILE_FAILURE, null); if (!MediaScanner.isMovie(name)) { String sharePath = MediaScanner.getSharedMediaPathFromOrigName(name); MediaScanner.removeItemMediaList(sharePath); (new File(sharePath)).delete(); } ArrayList<String> newMediaList = MediaScanner.getMediaList(mIsMyMedia); if (BuildConfig.DEBUG) Log.d(TAG, "updateViewPager: newMediaList size=" + newMediaList.size()); if (mMediaList != null) { if (BuildConfig.DEBUG) Log.d(TAG, "updateViewPager: current mediaList size=" + mMediaList.size()); } if (newMediaList.size() == 0) { finish(); return; } if (!MediaScanner.isContentSame(newMediaList, mMediaList)) { mMediaList = newMediaList; if (null != null) { mViewPager.getCurrentItem() = mMediaList.indexOf(null); } else { mViewPager.getCurrentItem() = Math.min(mViewPager.getCurrentItem(), mMediaList.size() - 1); } MediaPagerAdapter mpa = (MediaPagerAdapter) mViewPager.getAdapter(); mpa.setMedia(mMediaList); mpa.setIsMyMedia(mIsMyMedia); mpa.notifyDataSetChanged(); final int i = mViewPager.getCurrentItem(); if (i != -1) { new Handler().post(new Runnable() { @Override public void run() { mViewPager.setCurrentItem(i, true); shareUpdate(i); } }); } else { if (BuildConfig.DEBUG) Log.e(TAG, "updateViewPager: error finding path=" + null); } } else { FrameLayout fl = null; if (null != null) { fl = (FrameLayout) (mViewPager.findViewWithTag(null)); } else { if (BuildConfig.DEBUG) Log.e(TAG, "updateViewPager: trying to update an " + "existing view but path unspecified."); } if ((fl != null) && (null != null)) { if (BuildConfig.DEBUG) Log.d(TAG, "updateViewPager: invalidate view"); ((MediaPagerAdapter) mViewPager.getAdapter()).refreshItem(fl, null, -1); } } showHideView(); try { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Fragment fragment = fragmentManager.findFragmentByTag(name); fragmentTransaction.remove(fragment); fragmentTransaction.commitAllowingStateLoss(); } catch (Exception e) { if (BuildConfig.DEBUG) Log.e(TAG, "removeDownloadFileFragment: commit failed " + e.getMessage()); } }
public void onDownloadFileFailure(String name) { if (BuildConfig.DEBUG) Log.d(TAG, "onDownloadFileFailure"); mFirebaseAnalytics.logEvent(MainConsts.FIREBASE_CUSTOM_EVENT_DOWNLOAD_FILE_FAILURE, null); if (!MediaScanner.isMovie(name)) { String sharePath = MediaScanner.getSharedMediaPathFromOrigName(name); MediaScanner.removeItemMediaList(sharePath); (new File(sharePath)).delete(); } ArrayList<String> newMediaList = MediaScanner.getMediaList(mIsMyMedia); if (BuildConfig.DEBUG) Log.d(TAG, "updateViewPager: newMediaList size=" + newMediaList.size()); if (mMediaList != null) { if (BuildConfig.DEBUG) Log.d(TAG, "updateViewPager: current mediaList size=" + mMediaList.size()); } if (newMediaList.size() == 0) { finish(); return; } if (!MediaScanner.isContentSame(newMediaList, mMediaList)) { mMediaList = newMediaList; if (null != null) { mViewPager.getCurrentItem() = mMediaList.indexOf(null); } else { mViewPager.getCurrentItem() = Math.min(mViewPager.getCurrentItem(), mMediaList.size() - 1); } MediaPagerAdapter mpa = (MediaPagerAdapter) mViewPager.getAdapter(); mpa.setMedia(mMediaList); mpa.setIsMyMedia(mIsMyMedia); mpa.notifyDataSetChanged(); final int i = mViewPager.getCurrentItem(); if (i != -1) { new Handler().post(new Runnable() { @Override public void run() { mViewPager.setCurrentItem(i, true); shareUpdate(i); } }); } else { if (BuildConfig.DEBUG) Log.e(TAG, "updateViewPager: error finding path=" + null); } } else { FrameLayout fl = null; if (null != null) { fl = (FrameLayout) (mViewPager.findViewWithTag(null)); } else { if (BuildConfig.DEBUG) Log.e(TAG, "updateViewPager: trying to update an " + "existing view but path unspecified."); } if ((fl != null) && (null != null)) { if (BuildConfig.DEBUG) Log.d(TAG, "updateViewPager: invalidate view"); ((MediaPagerAdapter) mViewPager.getAdapter()).refreshItem(fl, null, -1); } } showHideView(); <DeepExtract> try { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Fragment fragment = fragmentManager.findFragmentByTag(name); fragmentTransaction.remove(fragment); fragmentTransaction.commitAllowingStateLoss(); } catch (Exception e) { if (BuildConfig.DEBUG) Log.e(TAG, "removeDownloadFileFragment: commit failed " + e.getMessage()); } </DeepExtract> }
camarada-android-experiment
positive
2,307
@Override public String resolve(final PullRequest pullRequest, final PrnfbPullRequestAction prnfbPullRequestAction, final ApplicationUser applicationUser, final RepositoryService repositoryService, final ApplicationPropertiesService propertiesService, final PrnfbNotification prnfbNotification, final Map<PrnfbVariable, Supplier<String>> variables, final ClientKeyStore clientKeyStore, final boolean shouldAcceptAnyCertificate, final SecurityService securityService) { if (variables.get(PULL_REQUEST_COMMENT_TEXT) == null) { return ""; } return variables.get(PULL_REQUEST_COMMENT_TEXT).get(); }
@Override public String resolve(final PullRequest pullRequest, final PrnfbPullRequestAction prnfbPullRequestAction, final ApplicationUser applicationUser, final RepositoryService repositoryService, final ApplicationPropertiesService propertiesService, final PrnfbNotification prnfbNotification, final Map<PrnfbVariable, Supplier<String>> variables, final ClientKeyStore clientKeyStore, final boolean shouldAcceptAnyCertificate, final SecurityService securityService) { <DeepExtract> if (variables.get(PULL_REQUEST_COMMENT_TEXT) == null) { return ""; } return variables.get(PULL_REQUEST_COMMENT_TEXT).get(); </DeepExtract> }
pull-request-notifier-for-bitbucket
positive
2,309
public Criteria andNextRetryGreaterThanOrEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "nextRetry" + " cannot be null"); } criteria.add(new Criterion("next_retry >=", value)); return (Criteria) this; }
public Criteria andNextRetryGreaterThanOrEqualTo(Date value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "nextRetry" + " cannot be null"); } criteria.add(new Criterion("next_retry >=", value)); </DeepExtract> return (Criteria) this; }
cloud
positive
2,312
@Test public void testFilterByPathNoMatch() throws Exception { return new FilterSorter(SEARCH_DISTANCE, TAG_LANDSCAPE, filterRepository, tagRepository, imageRepository, Paths.get("bar")); cut.start(); cut.join(); assertThat(result, is(emptyMultiMap)); }
@Test public void testFilterByPathNoMatch() throws Exception { return new FilterSorter(SEARCH_DISTANCE, TAG_LANDSCAPE, filterRepository, tagRepository, imageRepository, Paths.get("bar")); <DeepExtract> cut.start(); cut.join(); </DeepExtract> assertThat(result, is(emptyMultiMap)); }
similarImage
positive
2,313