before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
public void setZ(double z) {
Point3D coords = new Point3D(0, 0, z);
if (coordinates != null) {
coords = new Point3D(this.coordinates.getX(), this.coordinates.getY(), z);
}
if (this.coordinates != null) {
this.coordinates = coords;
setChanged();
notifyObservers(ModelBoxChange.COORDINATES);
}
}
|
<DeepExtract>
if (this.coordinates != null) {
this.coordinates = coords;
setChanged();
notifyObservers(ModelBoxChange.COORDINATES);
}
</DeepExtract>
|
ObjectGraphVisualization
|
positive
|
public Bitmap miniThumbBitmap() {
return fullSizeBitmap(THUMBNAIL_TARGET_SIZE, THUMBNAIL_MAX_NUM_PIXELS, IImage.ROTATE_AS_NEEDED);
}
|
<DeepExtract>
return fullSizeBitmap(THUMBNAIL_TARGET_SIZE, THUMBNAIL_MAX_NUM_PIXELS, IImage.ROTATE_AS_NEEDED);
</DeepExtract>
|
LetsChat
|
positive
|
@Nonnull
public ItemFilter notIn(ItemSet set) {
return new Simple(mode, amount, s -> !set.contains(s));
}
|
<DeepExtract>
return new Simple(mode, amount, s -> !set.contains(s));
</DeepExtract>
|
Technicalities
|
positive
|
public static void enter(Object obj) {
System.out.println("Step 1");
System.out.println("Step 2");
synchronized (obj) {
System.out.println("Step 3 (never reached here)");
}
}
|
<DeepExtract>
</DeepExtract>
|
ijmtdp
|
positive
|
private void initUI(Bundle savedInstanceState) {
res = getResources();
initiateActionBar();
try {
stock = Inventory.getInstance().getStock();
productCatalog = Inventory.getInstance().getProductCatalog();
} catch (NoDaoSetException e) {
e.printStackTrace();
}
id = getIntent().getStringExtra("id");
product = productCatalog.getProductById(Integer.parseInt(id));
initUI(savedInstanceState);
remember = new String[3];
nameBox.setText(product.getName());
priceBox.setText(product.getUnitPrice() + "");
barcodeBox.setText(product.getBarcode());
setContentView(R.layout.layout_productdetail_main);
stockListView = (ListView) findViewById(R.id.stockListView);
nameBox = (EditText) findViewById(R.id.nameBox);
priceBox = (EditText) findViewById(R.id.priceBox);
barcodeBox = (EditText) findViewById(R.id.barcodeBox);
stockSumBox = (TextView) findViewById(R.id.stockSumBox);
submitEditButton = (Button) findViewById(R.id.submitEditButton);
submitEditButton.setVisibility(View.INVISIBLE);
cancelEditButton = (Button) findViewById(R.id.cancelEditButton);
cancelEditButton.setVisibility(View.INVISIBLE);
openEditButton = (Button) findViewById(R.id.openEditButton);
openEditButton.setVisibility(View.VISIBLE);
addProductLotButton = (Button) findViewById(R.id.addProductLotButton);
mTabHost = (TabHost) findViewById(android.R.id.tabhost);
mTabHost.setup();
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator(res.getString(R.string.product_detail)).setContent(R.id.tab1));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator(res.getString(R.string.stock)).setContent(R.id.tab2));
mTabHost.setCurrentTab(0);
popDialog = new AlertDialog.Builder(this);
inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
addProductLotButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
showAddProductLot();
}
});
openEditButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
edit();
}
});
submitEditButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
submitEdit();
}
});
cancelEditButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
cancelEdit();
}
});
}
|
<DeepExtract>
res = getResources();
initiateActionBar();
try {
stock = Inventory.getInstance().getStock();
productCatalog = Inventory.getInstance().getProductCatalog();
} catch (NoDaoSetException e) {
e.printStackTrace();
}
id = getIntent().getStringExtra("id");
product = productCatalog.getProductById(Integer.parseInt(id));
initUI(savedInstanceState);
remember = new String[3];
nameBox.setText(product.getName());
priceBox.setText(product.getUnitPrice() + "");
barcodeBox.setText(product.getBarcode());
</DeepExtract>
|
pos
|
positive
|
public void setRenderer(GLSurfaceView.Renderer renderer) {
if (mGLThread != null) {
throw new IllegalStateException("setRenderer has already been called for this instance.");
}
if (mEGLConfigChooser == null) {
mEGLConfigChooser = new SimpleEGLConfigChooser(true);
}
if (mEGLContextFactory == null) {
mEGLContextFactory = new DefaultContextFactory();
}
if (mEGLWindowSurfaceFactory == null) {
mEGLWindowSurfaceFactory = new DefaultWindowSurfaceFactory();
}
mRenderer = renderer;
mGLThread = new GLThread(mThisWeakRef);
if (LOG_EGL) {
Log.w("EglHelper", "startRecord() tid=" + Thread.currentThread().getId());
}
mEgl = (EGL10) EGLContext.getEGL();
mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
throw new RuntimeException("eglGetDisplay failed");
}
int[] version = new int[2];
if (!mEgl.eglInitialize(mEglDisplay, version)) {
throw new RuntimeException("eglInitialize failed");
}
GLTextureView view = mGLTextureViewWeakRef.get();
if (view == null) {
mEglConfig = null;
mEglContext = null;
} else {
mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
}
if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
mEglContext = null;
throwEglException("createContext");
}
if (LOG_EGL) {
Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
}
mEglSurface = null;
}
|
<DeepExtract>
if (mGLThread != null) {
throw new IllegalStateException("setRenderer has already been called for this instance.");
}
</DeepExtract>
<DeepExtract>
if (LOG_EGL) {
Log.w("EglHelper", "startRecord() tid=" + Thread.currentThread().getId());
}
mEgl = (EGL10) EGLContext.getEGL();
mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
throw new RuntimeException("eglGetDisplay failed");
}
int[] version = new int[2];
if (!mEgl.eglInitialize(mEglDisplay, version)) {
throw new RuntimeException("eglInitialize failed");
}
GLTextureView view = mGLTextureViewWeakRef.get();
if (view == null) {
mEglConfig = null;
mEglContext = null;
} else {
mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
}
if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
mEglContext = null;
throwEglException("createContext");
}
if (LOG_EGL) {
Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
}
mEglSurface = null;
</DeepExtract>
|
VideoRecorder
|
positive
|
public Parcelable onSaveInstanceState() {
SavedState savedState = new SavedState(super.onSaveInstanceState());
return this.mChecked;
return savedState;
}
|
<DeepExtract>
return this.mChecked;
</DeepExtract>
|
SamsungOneUi
|
positive
|
public int run(String[] args) throws IOException, ParseException {
JobConf conf = new JobConf(getConf(), PersistLogBuilder.class);
String line = null;
Options options = new Options();
options.addOption("i", true, "input file list");
options.addOption("o", true, "output directory");
options.addOption("r", true, "number of reducers");
CommandLineParser parser = new PosixParser();
CommandLine cmd = parser.parse(options, args);
if (!cmd.hasOption("i") || !cmd.hasOption("o")) {
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.setWidth(80);
helpFormatter.printHelp(CLI_USAGE, CLI_HEADER, options, "");
System.exit(1);
}
this.input = cmd.getOptionValue("i");
this.output = cmd.getOptionValue("o");
if (cmd.hasOption("r")) {
reducers = Integer.parseInt(cmd.getOptionValue("r"));
}
BufferedReader br = new BufferedReader(new FileReader(this.input));
int lineCount = 0;
while ((line = br.readLine()) != null) {
FileInputFormat.addInputPath(conf, new Path(line));
System.out.print("Added " + ++lineCount + " input paths.\r");
}
System.out.println();
FileOutputFormat.setOutputPath(conf, new Path(this.output));
conf.setJobName(this.input + "_" + System.currentTimeMillis());
conf.setInputFormat(ArchiveFileInputFormat.class);
conf.setMapperClass(PersistLogMapper.class);
conf.setMapOutputValueClass(Text.class);
conf.setMapOutputValueClass(Text.class);
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(Text.class);
conf.setOutputFormat(TextOutputFormat.class);
conf.setNumReduceTasks(reducers);
conf.set("mapred.reduce.tasks.speculative.execution", "false");
conf.set("mapred.output.compress", "true");
conf.set("mapred.compress.map.output", "true");
conf.setClass("mapred.output.compression.codec", GzipCodec.class, CompressionCodec.class);
JobClient client = new JobClient(conf);
client.submitJob(conf);
return 0;
}
|
<DeepExtract>
Options options = new Options();
options.addOption("i", true, "input file list");
options.addOption("o", true, "output directory");
options.addOption("r", true, "number of reducers");
CommandLineParser parser = new PosixParser();
CommandLine cmd = parser.parse(options, args);
if (!cmd.hasOption("i") || !cmd.hasOption("o")) {
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.setWidth(80);
helpFormatter.printHelp(CLI_USAGE, CLI_HEADER, options, "");
System.exit(1);
}
this.input = cmd.getOptionValue("i");
this.output = cmd.getOptionValue("o");
if (cmd.hasOption("r")) {
reducers = Integer.parseInt(cmd.getOptionValue("r"));
}
</DeepExtract>
<DeepExtract>
conf.set("mapred.reduce.tasks.speculative.execution", "false");
conf.set("mapred.output.compress", "true");
conf.set("mapred.compress.map.output", "true");
conf.setClass("mapred.output.compression.codec", GzipCodec.class, CompressionCodec.class);
</DeepExtract>
|
webarchive-discovery
|
positive
|
public void transferOwnership(Address newOwner) {
require(Msg.sender().equals(owner), "Only the owner of the contract can execute it.");
emit(new OwnershipTransferredEvent(owner, newOwner));
owner = newOwner;
}
|
<DeepExtract>
require(Msg.sender().equals(owner), "Only the owner of the contract can execute it.");
</DeepExtract>
|
nuls-contracts
|
positive
|
public Builder setFp64Contents(int index, double value) {
if (!((bitField0_ & 0x00000040) == 0x00000040)) {
fp64Contents_ = new java.util.ArrayList<Double>(fp64Contents_);
bitField0_ |= 0x00000040;
}
fp64Contents_.set(index, value);
onChanged();
return this;
}
|
<DeepExtract>
if (!((bitField0_ & 0x00000040) == 0x00000040)) {
fp64Contents_ = new java.util.ArrayList<Double>(fp64Contents_);
bitField0_ |= 0x00000040;
}
</DeepExtract>
|
dl_inference
|
positive
|
@Override
public void onActivityCreated(Bundle savedInstanceState) {
ExitApplication.getInstance().addActivity(getActivity());
super.onActivityCreated(savedInstanceState);
activity = (MainIndex) this.getActivity();
my_shoucang = (RelativeLayout) this.getView().findViewById(R.id.my_shoucang);
my_canyu = (RelativeLayout) this.getView().findViewById(R.id.my_canyu);
my_fabu = (RelativeLayout) this.getView().findViewById(R.id.my_fabu);
my_shezhi = (RelativeLayout) this.getView().findViewById(R.id.my_shezhi);
image = (CircularLoginImage) this.getView().findViewById(R.id.my_image);
myname = (TextView) this.getView().findViewById(R.id.my_name);
my_renzheng = (ImageView) this.getView().findViewById(R.id.my_renzhengsure);
my_shoucang.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, Personal_shoucang.class);
activity.startActivity(intent);
}
});
my_canyu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, Personal_canyu.class);
activity.startActivity(intent);
}
});
my_fabu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, Personal_fabu.class);
activity.startActivity(intent);
}
});
my_shezhi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!UserInfo.isEmpty()) {
Intent intent = new Intent(activity, Personal_setting.class);
activity.startActivity(intent);
} else {
Configuration.showLoginWindow(getActivity(), FragmentMine.this);
}
}
});
image.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!UserInfo.isEmpty()) {
Intent intent = new Intent();
intent.putExtra("choosephoto", UserInfo.user.getPictureurl());
intent.putExtra("phototype", 2);
intent.setClass(activity, ViewPicture.class);
startActivity(intent);
} else {
Configuration.showLoginWindow(getActivity(), FragmentMine.this);
}
}
});
}
|
<DeepExtract>
activity = (MainIndex) this.getActivity();
my_shoucang = (RelativeLayout) this.getView().findViewById(R.id.my_shoucang);
my_canyu = (RelativeLayout) this.getView().findViewById(R.id.my_canyu);
my_fabu = (RelativeLayout) this.getView().findViewById(R.id.my_fabu);
my_shezhi = (RelativeLayout) this.getView().findViewById(R.id.my_shezhi);
image = (CircularLoginImage) this.getView().findViewById(R.id.my_image);
myname = (TextView) this.getView().findViewById(R.id.my_name);
my_renzheng = (ImageView) this.getView().findViewById(R.id.my_renzhengsure);
</DeepExtract>
<DeepExtract>
my_shoucang.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, Personal_shoucang.class);
activity.startActivity(intent);
}
});
my_canyu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, Personal_canyu.class);
activity.startActivity(intent);
}
});
my_fabu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(activity, Personal_fabu.class);
activity.startActivity(intent);
}
});
my_shezhi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!UserInfo.isEmpty()) {
Intent intent = new Intent(activity, Personal_setting.class);
activity.startActivity(intent);
} else {
Configuration.showLoginWindow(getActivity(), FragmentMine.this);
}
}
});
image.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!UserInfo.isEmpty()) {
Intent intent = new Intent();
intent.putExtra("choosephoto", UserInfo.user.getPictureurl());
intent.putExtra("phototype", 2);
intent.setClass(activity, ViewPicture.class);
startActivity(intent);
} else {
Configuration.showLoginWindow(getActivity(), FragmentMine.this);
}
}
});
</DeepExtract>
|
LDXY
|
positive
|
public static void main(String[] args) {
CoinChange clz = new CoinChange();
int[] coins = { 1, 2, 3 };
if (12 <= 1) {
return 12;
}
int[] f = new int[12 + 1];
Arrays.fill(f, Integer.MAX_VALUE);
f[0] = 0;
for (int i = 1; i * i <= 12; i++) {
for (int j = 1; j <= 12; j++) {
if (j - i * i < 0)
continue;
f[j] = Math.min(f[j], f[j - i * i] + 1);
}
}
System.out.println(Arrays.toString(f));
return f[12];
List<String> res = new ArrayList<>();
helper(0, coins, 6, new StringBuilder(), res, 0, 0);
System.out.println(Arrays.toString(res.toArray()));
}
|
<DeepExtract>
if (12 <= 1) {
return 12;
}
int[] f = new int[12 + 1];
Arrays.fill(f, Integer.MAX_VALUE);
f[0] = 0;
for (int i = 1; i * i <= 12; i++) {
for (int j = 1; j <= 12; j++) {
if (j - i * i < 0)
continue;
f[j] = Math.min(f[j], f[j - i * i] + 1);
}
}
System.out.println(Arrays.toString(f));
return f[12];
</DeepExtract>
<DeepExtract>
List<String> res = new ArrayList<>();
helper(0, coins, 6, new StringBuilder(), res, 0, 0);
System.out.println(Arrays.toString(res.toArray()));
</DeepExtract>
|
interviewprep
|
positive
|
@Test
public void testThirdDslContainer() {
ClientInterface clientInterface = ElasticSearchHelper.getConfigRestClientUtil(new BaseTemplateContainerImpl("testnamespace7") {
@Override
protected Map<String, TemplateMeta> loadTemplateMetas(String namespace) {
try {
List<BaseTemplateMeta> templateMetas = SQLExecutor.queryListWithDBName(BaseTemplateMeta.class, "testdslconfig", "select * from dslconfig where namespace = ?", namespace);
if (templateMetas == null) {
return null;
} else {
Map<String, TemplateMeta> templateMetaMap = new HashMap<String, TemplateMeta>(templateMetas.size());
for (BaseTemplateMeta baseTemplateMeta : templateMetas) {
templateMetaMap.put(baseTemplateMeta.getName(), baseTemplateMeta);
}
return templateMetaMap;
}
} catch (Exception e) {
throw new DSLParserException(e);
}
}
@Override
protected long getLastModifyTime(String namespace) {
return System.currentTimeMillis();
}
});
try {
testHighlightSearch(clientInterface);
} catch (Exception e) {
logger.error("", e);
}
try {
testCRUD(clientInterface);
} catch (Exception e) {
logger.error("", e);
}
ScriptImpl7 scriptImpl7 = new ScriptImpl7(clientInterface);
scriptImpl7.updateDocumentByScriptPath();
scriptImpl7.updateDocumentByScriptQueryPath();
}
|
<DeepExtract>
ScriptImpl7 scriptImpl7 = new ScriptImpl7(clientInterface);
scriptImpl7.updateDocumentByScriptPath();
scriptImpl7.updateDocumentByScriptQueryPath();
</DeepExtract>
|
elasticsearch-example
|
positive
|
@Override
public void store(Path path, String name, BiConsumer<String, IOException> stored) throws IOException {
if (Files.size(path) > MAX_SIZE)
throw new IllegalArgumentException(path + " exceeds maximum size " + MAX_SIZE);
try {
checkAccount();
try {
B2FileVersion fileInfo = client.getFileInfoByName(bucketInfo.getBucketName(), name);
exists -> {
if (exists instanceof B2FileVersion) {
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null);
} else {
try {
final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build());
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null);
} catch (B2Exception e) {
stored.accept(null, new IOException("Failed to process Backblaze upload", e));
}
}
}.accept(fileInfo);
return;
} catch (B2Exception ex) {
if (ex.getStatus() != 404) {
throw new IOException("File existence check failed", ex);
}
}
exists -> {
if (exists instanceof B2FileVersion) {
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null);
} else {
try {
final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build());
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null);
} catch (B2Exception e) {
stored.accept(null, new IOException("Failed to process Backblaze upload", e));
}
}
}.accept(null);
} catch (B2Exception e) {
throw new IOException("Failed to check Backblaze file", e);
}
}
|
<DeepExtract>
try {
checkAccount();
try {
B2FileVersion fileInfo = client.getFileInfoByName(bucketInfo.getBucketName(), name);
exists -> {
if (exists instanceof B2FileVersion) {
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null);
} else {
try {
final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build());
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null);
} catch (B2Exception e) {
stored.accept(null, new IOException("Failed to process Backblaze upload", e));
}
}
}.accept(fileInfo);
return;
} catch (B2Exception ex) {
if (ex.getStatus() != 404) {
throw new IOException("File existence check failed", ex);
}
}
exists -> {
if (exists instanceof B2FileVersion) {
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null);
} else {
try {
final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build());
stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null);
} catch (B2Exception e) {
stored.accept(null, new IOException("Failed to process Backblaze upload", e));
}
}
}.accept(null);
} catch (B2Exception e) {
throw new IOException("Failed to check Backblaze file", e);
}
</DeepExtract>
|
unreal-archive
|
positive
|
@Override
public Node next() {
if (skip) {
skip = false;
return current;
}
Node nextNode = nextImpl();
return nextNode;
return current;
}
|
<DeepExtract>
Node nextNode = nextImpl();
return nextNode;
</DeepExtract>
|
libxml2-java
|
positive
|
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(LOGTAG, "onCreate");
super.onCreate(savedInstanceState);
vuforiaAppSession = new SampleApplicationSession(this);
LayoutInflater inflater = LayoutInflater.from(this);
mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay, null, false);
mUILayout.setVisibility(View.VISIBLE);
mUILayout.setBackgroundColor(Color.BLACK);
loadingDialogHandler.mLoadingDialogContainer = mUILayout.findViewById(R.id.loading_indicator);
loadingDialogHandler.sendEmptyMessage(LoadingDialogHandler.SHOW_LOADING_DIALOG);
addContentView(mUILayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
vuforiaAppSession.initAR(this, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mGestureDetector = new GestureDetector(this, new GestureListener());
mTextures = new Vector<Texture>();
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_Q.png", getAssets()));
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_C.png", getAssets()));
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_A.png", getAssets()));
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_R.png", getAssets()));
mIsDroidDevice = android.os.Build.MODEL.toLowerCase().startsWith("droid");
}
|
<DeepExtract>
LayoutInflater inflater = LayoutInflater.from(this);
mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay, null, false);
mUILayout.setVisibility(View.VISIBLE);
mUILayout.setBackgroundColor(Color.BLACK);
loadingDialogHandler.mLoadingDialogContainer = mUILayout.findViewById(R.id.loading_indicator);
loadingDialogHandler.sendEmptyMessage(LoadingDialogHandler.SHOW_LOADING_DIALOG);
addContentView(mUILayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
</DeepExtract>
<DeepExtract>
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_Q.png", getAssets()));
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_C.png", getAssets()));
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_A.png", getAssets()));
mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_R.png", getAssets()));
</DeepExtract>
|
Vuforia-Samples-Android-Studio
|
positive
|
@Test
public void resolveViewNameNormalDeviceTabletSitePreferenceTabletPrefix() throws Exception {
device.setDeviceType(DeviceType.NORMAL);
request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device);
request.setAttribute(SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE, SitePreference.TABLET);
viewResolver.setTabletPrefix("tablet/");
expect(delegateViewResolver.resolveViewName("tablet/" + viewName, locale)).andReturn(view);
replay(delegateViewResolver, view);
View result = viewResolver.resolveViewName(viewName, locale);
assertSame("Invalid view", view, result);
verify(delegateViewResolver, view);
}
|
<DeepExtract>
expect(delegateViewResolver.resolveViewName("tablet/" + viewName, locale)).andReturn(view);
replay(delegateViewResolver, view);
View result = viewResolver.resolveViewName(viewName, locale);
assertSame("Invalid view", view, result);
verify(delegateViewResolver, view);
</DeepExtract>
|
spring-mobile
|
positive
|
public String readString(int nbytes) throws IOException {
byte[] data = new byte[nbytes];
readFully(data, 0, data.length);
return new String(data);
}
|
<DeepExtract>
readFully(data, 0, data.length);
</DeepExtract>
|
NomadReader
|
positive
|
@Subscribe(threadMode = ThreadMode.MAIN)
public void getSign(ViewSign sign) {
user = uDao.selectOnLine();
list = cDao.selectAll(user.getUsername());
RecyclerView.LayoutManager manager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(manager);
adapter = new AddBalanceAdapter(list, this);
recyclerView.setAdapter(adapter);
position = SharePreferencesUtils.getInt(this, "PayCard", 0);
position = sign.getPosition();
recyclerView.scrollToPosition(position);
}
|
<DeepExtract>
user = uDao.selectOnLine();
list = cDao.selectAll(user.getUsername());
RecyclerView.LayoutManager manager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(manager);
adapter = new AddBalanceAdapter(list, this);
recyclerView.setAdapter(adapter);
position = SharePreferencesUtils.getInt(this, "PayCard", 0);
</DeepExtract>
|
CinemaTicket
|
positive
|
public PopNotification setBackgroundColorRes(@ColorRes int backgroundColorResId) {
this.backgroundColor = getColor(backgroundColorResId);
if (getDialogImpl() == null)
return;
runOnMain(new Runnable() {
@Override
public void run() {
if (dialogImpl != null)
dialogImpl.refreshView();
}
});
return this;
}
|
<DeepExtract>
if (getDialogImpl() == null)
return;
runOnMain(new Runnable() {
@Override
public void run() {
if (dialogImpl != null)
dialogImpl.refreshView();
}
});
</DeepExtract>
|
DialogX
|
positive
|
public DockerTest loginAsAlice() {
this.commands.add(new DockerCommand(this.deployment, "Failed to login to Artipie", List.of("docker", "login", "--username", "alice", "--password", "123", this.registry), new ContainerResultMatcher()));
return this;
}
|
<DeepExtract>
this.commands.add(new DockerCommand(this.deployment, "Failed to login to Artipie", List.of("docker", "login", "--username", "alice", "--password", "123", this.registry), new ContainerResultMatcher()));
return this;
</DeepExtract>
|
artipie
|
positive
|
@Override
public void run() {
mResults.remove(key);
}
|
<DeepExtract>
mResults.remove(key);
</DeepExtract>
|
POSA-15
|
positive
|
public RecordedProgram build() {
RecordedProgram recordedProgram = new RecordedProgram();
if (this == mRecordedProgram) {
return;
}
mAudioLanguages = mRecordedProgram.mAudioLanguages;
mBroadcastGenres = mRecordedProgram.mBroadcastGenres;
mCanonicalGenres = mRecordedProgram.mCanonicalGenres;
mChannelId = mRecordedProgram.mChannelId;
mContentRatings = mRecordedProgram.mContentRatings;
mEpisodeDisplayNumber = mRecordedProgram.mEpisodeDisplayNumber;
mEpisodeTitle = mRecordedProgram.mEpisodeTitle;
mId = mRecordedProgram.mId;
mInputId = mRecordedProgram.mInputId;
mInternalProviderData = mRecordedProgram.mInternalProviderData;
mLongDescription = mRecordedProgram.mLongDescription;
mPosterArtUri = mRecordedProgram.mPosterArtUri;
mRecordingDataBytes = mRecordedProgram.mRecordingDataBytes;
mRecordingDataUri = mRecordedProgram.mRecordingDataUri;
mRecordingDurationMillis = mRecordedProgram.mRecordingDurationMillis;
mRecordingExpireTimeUtcMillis = mRecordedProgram.mRecordingExpireTimeUtcMillis;
mSearchable = mRecordedProgram.mSearchable;
mSeasonDisplayNumber = mRecordedProgram.mSeasonDisplayNumber;
mSeasonTitle = mRecordedProgram.mSeasonTitle;
mShortDescription = mRecordedProgram.mShortDescription;
mStartTimeUtcMillis = mRecordedProgram.mStartTimeUtcMillis;
mEndTimeUtcMillis = mRecordedProgram.mEndTimeUtcMillis;
mThumbnailUri = mRecordedProgram.mThumbnailUri;
mTitle = mRecordedProgram.mTitle;
mVersionNumber = mRecordedProgram.mVersionNumber;
mVideoHeight = mRecordedProgram.mVideoHeight;
mVideoWidth = mRecordedProgram.mVideoWidth;
if (recordedProgram.getInputId() == null) {
throw new IllegalArgumentException("This recorded program does not have an Input Id");
}
if (recordedProgram.getRecordingDurationMillis() == INVALID_INT_VALUE && recordedProgram.getEndTimeUtcMillis() > 0) {
recordedProgram.mRecordingDurationMillis = recordedProgram.getEndTimeUtcMillis() - recordedProgram.getStartTimeUtcMillis();
}
return recordedProgram;
}
|
<DeepExtract>
if (this == mRecordedProgram) {
return;
}
mAudioLanguages = mRecordedProgram.mAudioLanguages;
mBroadcastGenres = mRecordedProgram.mBroadcastGenres;
mCanonicalGenres = mRecordedProgram.mCanonicalGenres;
mChannelId = mRecordedProgram.mChannelId;
mContentRatings = mRecordedProgram.mContentRatings;
mEpisodeDisplayNumber = mRecordedProgram.mEpisodeDisplayNumber;
mEpisodeTitle = mRecordedProgram.mEpisodeTitle;
mId = mRecordedProgram.mId;
mInputId = mRecordedProgram.mInputId;
mInternalProviderData = mRecordedProgram.mInternalProviderData;
mLongDescription = mRecordedProgram.mLongDescription;
mPosterArtUri = mRecordedProgram.mPosterArtUri;
mRecordingDataBytes = mRecordedProgram.mRecordingDataBytes;
mRecordingDataUri = mRecordedProgram.mRecordingDataUri;
mRecordingDurationMillis = mRecordedProgram.mRecordingDurationMillis;
mRecordingExpireTimeUtcMillis = mRecordedProgram.mRecordingExpireTimeUtcMillis;
mSearchable = mRecordedProgram.mSearchable;
mSeasonDisplayNumber = mRecordedProgram.mSeasonDisplayNumber;
mSeasonTitle = mRecordedProgram.mSeasonTitle;
mShortDescription = mRecordedProgram.mShortDescription;
mStartTimeUtcMillis = mRecordedProgram.mStartTimeUtcMillis;
mEndTimeUtcMillis = mRecordedProgram.mEndTimeUtcMillis;
mThumbnailUri = mRecordedProgram.mThumbnailUri;
mTitle = mRecordedProgram.mTitle;
mVersionNumber = mRecordedProgram.mVersionNumber;
mVideoHeight = mRecordedProgram.mVideoHeight;
mVideoWidth = mRecordedProgram.mVideoWidth;
</DeepExtract>
|
androidtv-sample-inputs
|
positive
|
@Override
protected void calculateOffsets() {
float legendRight = 0f, legendBottom = 0f;
float legendRight = 0f, legendBottom = 0f;
if (mDrawLegend && mLegend != null && mLegend.getPosition() != LegendPosition.NONE) {
if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
float spacing = Utils.convertDpToPixel(12f);
legendRight = mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace() + spacing;
mLegendLabelPaint.setTextAlign(Align.LEFT);
} else if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
if (mXLabels.getPosition() == XLabelPosition.TOP)
legendBottom = mLegendLabelPaint.getTextSize() * 3.5f;
else {
legendBottom = mLegendLabelPaint.getTextSize() * 2.5f;
}
}
mLegend.setOffsetBottom(legendBottom);
mLegend.setOffsetRight(legendRight);
}
float yleft = 0f, yright = 0f;
float yleft = 0f, yright = 0f;
String label = mYLabels.getLongestLabel();
float ylabelwidth = Utils.calcTextWidth(mYLabelPaint, label + mUnit + (mYChartMin < 0 ? "----" : "+++"));
if (mDrawYLabels) {
if (mYLabels.getPosition() == YLabelPosition.LEFT) {
yleft = ylabelwidth;
mYLabelPaint.setTextAlign(Align.RIGHT);
} else if (mYLabels.getPosition() == YLabelPosition.RIGHT) {
yright = ylabelwidth;
mYLabelPaint.setTextAlign(Align.LEFT);
} else if (mYLabels.getPosition() == YLabelPosition.BOTH_SIDED) {
yright = ylabelwidth;
yleft = ylabelwidth;
}
}
float xtop = 0f, xbottom = 0f;
float xtop = 0f, xbottom = 0f;
float xlabelheight = Utils.calcTextHeight(mXLabelPaint, "Q") * 2f;
if (mDrawXLabels) {
if (mXLabels.getPosition() == XLabelPosition.BOTTOM) {
xbottom = xlabelheight;
} else if (mXLabels.getPosition() == XLabelPosition.TOP) {
xtop = xlabelheight;
} else if (mXLabels.getPosition() == XLabelPosition.BOTH_SIDED) {
xbottom = xlabelheight;
xtop = xlabelheight;
}
}
float min = Utils.convertDpToPixel(11f);
mOffsetBottom = Math.max(min, xbottom + legendBottom);
mOffsetTop = Math.max(min, xtop);
mOffsetLeft = Math.max(min, yleft);
mOffsetRight = Math.max(min, yright + legendRight);
if (mLegend != null) {
mLegend.setOffsetTop(mOffsetTop + min / 3f);
mLegend.setOffsetLeft(mOffsetLeft);
}
prepareContentRect();
prepareMatrixValuePx();
prepareMatrixOffset();
if (mLogEnabled)
Log.i(LOG_TAG, "Matrices prepared.");
}
|
<DeepExtract>
prepareMatrixValuePx();
prepareMatrixOffset();
if (mLogEnabled)
Log.i(LOG_TAG, "Matrices prepared.");
</DeepExtract>
|
MPChartLib
|
positive
|
public void putSafeArray(SafeArray in) {
if (m_pVariant != 0) {
return getVariantType();
} else {
throw new IllegalStateException("uninitialized Variant");
}
putVariantSafeArray(in);
}
|
<DeepExtract>
if (m_pVariant != 0) {
return getVariantType();
} else {
throw new IllegalStateException("uninitialized Variant");
}
</DeepExtract>
|
jacob
|
positive
|
@Test
public void testReadAsBinary() throws Throwable {
this.requestAction = http -> {
final ByteArrayOutputStream body = new ByteArrayOutputStream();
http.<ByteBuffer>onchunk(data -> {
byte[] bytes = new byte[data.remaining()];
data.get(bytes);
body.write(bytes, 0, bytes.length);
}).onend($ -> {
threadAssertTrue(Arrays.equals(body.toByteArray(), new byte[] { 'h', 'i' }));
resume();
}).readAsBinary();
};
client.newRequest(uri()).method(HttpMethod.POST).content(new BytesContentProvider(new byte[] { 'h', 'i' }), "text/plain").send(ASYNC);
await();
}
|
<DeepExtract>
this.requestAction = http -> {
final ByteArrayOutputStream body = new ByteArrayOutputStream();
http.<ByteBuffer>onchunk(data -> {
byte[] bytes = new byte[data.remaining()];
data.get(bytes);
body.write(bytes, 0, bytes.length);
}).onend($ -> {
threadAssertTrue(Arrays.equals(body.toByteArray(), new byte[] { 'h', 'i' }));
resume();
}).readAsBinary();
};
</DeepExtract>
|
asity
|
positive
|
private static void solve(PegStack[] pegs) {
int srcPeg = 0;
int dstPeg = 2;
int numberOfDisks = pegs[0].bottomValue();
if (numberOfDisks == 0) {
return;
}
int tmpPeg = getTemporaryPeg(srcPeg, dstPeg);
move(pegs, srcPeg, tmpPeg, numberOfDisks - 1);
moveOneDisk(pegs, srcPeg, dstPeg);
move(pegs, tmpPeg, dstPeg, numberOfDisks - 1);
}
|
<DeepExtract>
if (numberOfDisks == 0) {
return;
}
int tmpPeg = getTemporaryPeg(srcPeg, dstPeg);
move(pegs, srcPeg, tmpPeg, numberOfDisks - 1);
moveOneDisk(pegs, srcPeg, dstPeg);
move(pegs, tmpPeg, dstPeg, numberOfDisks - 1);
</DeepExtract>
|
data-structures-in-java
|
positive
|
public void final_binding(Token finalKeyword) {
printRuleHeader(454, "final-binding", "");
System.out.println();
}
|
<DeepExtract>
printRuleHeader(454, "final-binding", "");
</DeepExtract>
<DeepExtract>
System.out.println();
</DeepExtract>
|
open-fortran-parser
|
positive
|
@Override
public void onClick(View v) {
if (PViewSizeUtils.onDoubleClick()) {
return;
}
Intent intent = new Intent();
intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, mSelectList);
setResult(true ? ImagePicker.REQ_PICKER_RESULT_CODE : RESULT_CANCELED, intent);
finish();
}
|
<DeepExtract>
Intent intent = new Intent();
intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, mSelectList);
setResult(true ? ImagePicker.REQ_PICKER_RESULT_CODE : RESULT_CANCELED, intent);
finish();
</DeepExtract>
|
BaseDemo
|
positive
|
public static void dragBy(final Node node, final double offsetX, final double offsetY, final double dx, final double dy) {
final double startX = node.getLayoutX() + offsetX;
final double startY = node.getLayoutY() + offsetY;
final double dragX = startX + (node.getLayoutX() + dx - node.getLayoutX());
final double dragY = startY + (node.getLayoutY() + dy - node.getLayoutY());
final MouseEvent pressed = createMouseEvent(MouseEvent.MOUSE_PRESSED, startX, startY);
final MouseEvent dragged = createMouseEvent(MouseEvent.MOUSE_DRAGGED, dragX, dragY);
final MouseEvent released = createMouseEvent(MouseEvent.MOUSE_RELEASED, dragX, dragY);
Event.fireEvent(node, pressed);
Event.fireEvent(node, dragged);
Event.fireEvent(node, released);
}
|
<DeepExtract>
final double startX = node.getLayoutX() + offsetX;
final double startY = node.getLayoutY() + offsetY;
final double dragX = startX + (node.getLayoutX() + dx - node.getLayoutX());
final double dragY = startY + (node.getLayoutY() + dy - node.getLayoutY());
final MouseEvent pressed = createMouseEvent(MouseEvent.MOUSE_PRESSED, startX, startY);
final MouseEvent dragged = createMouseEvent(MouseEvent.MOUSE_DRAGGED, dragX, dragY);
final MouseEvent released = createMouseEvent(MouseEvent.MOUSE_RELEASED, dragX, dragY);
Event.fireEvent(node, pressed);
Event.fireEvent(node, dragged);
Event.fireEvent(node, released);
</DeepExtract>
|
graph-editor
|
positive
|
@Override
public void setNString(int arg0, String arg1) throws SQLException {
if (arg0 <= 0)
throw new SQLException("Invalid position for parameter (" + arg0 + ")");
this.parameters.put(Integer.valueOf(arg0), arg1);
}
|
<DeepExtract>
if (arg0 <= 0)
throw new SQLException("Invalid position for parameter (" + arg0 + ")");
this.parameters.put(Integer.valueOf(arg0), arg1);
</DeepExtract>
|
jdbc-redis
|
positive
|
@Override
public void keyTyped(KeyEvent ev) {
if (surface != null && !surface.requestFocusInWindow()) {
surface.requestFocus();
}
ev.consume();
}
|
<DeepExtract>
if (surface != null && !surface.requestFocusInWindow()) {
surface.requestFocus();
}
</DeepExtract>
|
tvnjviewer
|
positive
|
static private String formatDouble(double dd, int minPrecision, int maxPrecision) {
BigDecimal bd = new BigDecimal(dd, MathContext.DECIMAL128);
bd = bd.setScale(maxPrecision, RoundingMode.HALF_UP);
return formatBigDecimal(bd, 2, 7);
}
|
<DeepExtract>
return formatBigDecimal(bd, 2, 7);
</DeepExtract>
|
tradelib
|
positive
|
private static void initializePackageLibraryGit(UnityProjectImportContext context, File packageDir, List<Runnable> writeCommits, Map<String, UnityAssemblyContext> asmdefs, LibraryTable.ModifiableModel librariesModModel) {
VirtualFile packageVDir = LocalFileSystem.getInstance().findFileByIoFile(packageDir);
if (packageVDir == null) {
return;
}
Map<String, UnityAssemblyContext> assemblies = new HashMap<>();
VirtualFileUtil.visitChildrenRecursively(packageVDir, new AsmDefFileVisitor(context.getProject(), UnityAssemblyType.FROM_EXTERNAL_PACKAGE, assemblies));
asmdefs.putAll(assemblies);
for (UnityAssemblyContext unityAssemblyContext : assemblies.values()) {
String libraryName = "Unity: " + packageDir.getName() + " [" + unityAssemblyContext.getName() + "]";
VirtualFile asmDirectory = unityAssemblyContext.getAsmDirectory();
if (asmDirectory == null) {
continue;
}
Library oldLibrary = librariesModModel.getLibraryByName(libraryName);
if (oldLibrary != null) {
librariesModModel.removeLibrary(oldLibrary);
}
Library library = librariesModModel.createLibrary(libraryName, UnityPackageLibraryType.ID);
Library.ModifiableModel modifiableModel = library.getModifiableModel();
unityAssemblyContext.setLibrary(library);
modifiableModel.addRoot(asmDirectory, BinariesOrderRootType.getInstance());
modifiableModel.addRoot(asmDirectory, SourcesOrderRootType.getInstance());
for (UnityAssemblyContext anotherAssembly : assemblies.values()) {
if (unityAssemblyContext == anotherAssembly || anotherAssembly.getAsmDirectory() == null) {
continue;
}
VirtualFile anotherDirectory = anotherAssembly.getAsmDirectory();
if (VirtualFileUtil.isAncestor(asmDirectory, anotherDirectory, false)) {
modifiableModel.addExcludedRoot(anotherDirectory.getUrl());
}
}
writeCommits.add(modifiableModel::commit);
}
}
|
<DeepExtract>
VirtualFile packageVDir = LocalFileSystem.getInstance().findFileByIoFile(packageDir);
if (packageVDir == null) {
return;
}
Map<String, UnityAssemblyContext> assemblies = new HashMap<>();
VirtualFileUtil.visitChildrenRecursively(packageVDir, new AsmDefFileVisitor(context.getProject(), UnityAssemblyType.FROM_EXTERNAL_PACKAGE, assemblies));
asmdefs.putAll(assemblies);
for (UnityAssemblyContext unityAssemblyContext : assemblies.values()) {
String libraryName = "Unity: " + packageDir.getName() + " [" + unityAssemblyContext.getName() + "]";
VirtualFile asmDirectory = unityAssemblyContext.getAsmDirectory();
if (asmDirectory == null) {
continue;
}
Library oldLibrary = librariesModModel.getLibraryByName(libraryName);
if (oldLibrary != null) {
librariesModModel.removeLibrary(oldLibrary);
}
Library library = librariesModModel.createLibrary(libraryName, UnityPackageLibraryType.ID);
Library.ModifiableModel modifiableModel = library.getModifiableModel();
unityAssemblyContext.setLibrary(library);
modifiableModel.addRoot(asmDirectory, BinariesOrderRootType.getInstance());
modifiableModel.addRoot(asmDirectory, SourcesOrderRootType.getInstance());
for (UnityAssemblyContext anotherAssembly : assemblies.values()) {
if (unityAssemblyContext == anotherAssembly || anotherAssembly.getAsmDirectory() == null) {
continue;
}
VirtualFile anotherDirectory = anotherAssembly.getAsmDirectory();
if (VirtualFileUtil.isAncestor(asmDirectory, anotherDirectory, false)) {
modifiableModel.addExcludedRoot(anotherDirectory.getUrl());
}
}
writeCommits.add(modifiableModel::commit);
}
</DeepExtract>
|
consulo-unity3d
|
positive
|
public Criteria andAgeBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "age" + " cannot be null");
}
criteria.add(new Criterion("age between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "age" + " cannot be null");
}
criteria.add(new Criterion("age between", value1, value2));
</DeepExtract>
|
Whome
|
positive
|
@Override
public int findColumn(String columnLabel) throws SQLException {
if (isClosed()) {
throw new SQLException("ResultSet is closed");
}
if (columnLabel == null) {
throw new SQLException("Column label is null");
}
Integer index = fieldMap.get(columnLabel.toLowerCase(ENGLISH));
if (index == null) {
throw new SQLException("Invalid column label: " + columnLabel);
}
return index;
}
|
<DeepExtract>
if (isClosed()) {
throw new SQLException("ResultSet is closed");
}
</DeepExtract>
<DeepExtract>
if (columnLabel == null) {
throw new SQLException("Column label is null");
}
Integer index = fieldMap.get(columnLabel.toLowerCase(ENGLISH));
if (index == null) {
throw new SQLException("Invalid column label: " + columnLabel);
}
return index;
</DeepExtract>
|
presto-jdbc-java6
|
positive
|
public void draw() {
if (!visible)
return;
if (bufferInvalid) {
Graphics2D g2d = buffer.g2;
bufferInvalid = false;
buffer.beginDraw();
buffer.background(buffer.color(255, 0));
buffer.noStroke();
buffer.fill(palette[BACK_COLOR]);
buffer.rect(0, 0, width, itemHeight);
if (expanded) {
buffer.fill(palette[ITEM_BACK_COLOR]);
buffer.rect(0, itemHeight, width, itemHeight * dropListActualSize);
}
float px = TPAD, py;
TextLayout line;
line = selText.getLines(g2d).getFirst().layout;
py = (itemHeight + line.getAscent() - line.getDescent()) / 2;
g2d.setColor(jpalette[FORE_COLOR]);
line.draw(g2d, px, py);
if (expanded) {
g2d.setColor(jpalette[ITEM_FORE_COLOR]);
for (int i = 0; i < dropListActualSize; i++) {
py += itemHeight;
if (currOverItem == startItem + i)
g2d.setColor(jpalette[OVER_ITEM_FORE_COLOR]);
else
g2d.setColor(jpalette[ITEM_FORE_COLOR]);
line = sitems[startItem + i].getLines(g2d).getFirst().layout;
line.draw(g2d, px, py);
}
}
buffer.endDraw();
}
winApp.pushStyle();
winApp.pushMatrix();
winApp.translate(cx, cy);
winApp.rotate(rotAngle);
winApp.pushMatrix();
winApp.translate(-halfWidth, -halfHeight);
winApp.imageMode(PApplet.CORNER);
if (alphaLevel < 255)
winApp.tint(TINT_FOR_ALPHA, alphaLevel);
winApp.image(buffer, 0, 0);
winApp.popMatrix();
if (children != null) {
for (GAbstractControl c : children) c.draw();
}
winApp.popMatrix();
winApp.popStyle();
}
|
<DeepExtract>
if (bufferInvalid) {
Graphics2D g2d = buffer.g2;
bufferInvalid = false;
buffer.beginDraw();
buffer.background(buffer.color(255, 0));
buffer.noStroke();
buffer.fill(palette[BACK_COLOR]);
buffer.rect(0, 0, width, itemHeight);
if (expanded) {
buffer.fill(palette[ITEM_BACK_COLOR]);
buffer.rect(0, itemHeight, width, itemHeight * dropListActualSize);
}
float px = TPAD, py;
TextLayout line;
line = selText.getLines(g2d).getFirst().layout;
py = (itemHeight + line.getAscent() - line.getDescent()) / 2;
g2d.setColor(jpalette[FORE_COLOR]);
line.draw(g2d, px, py);
if (expanded) {
g2d.setColor(jpalette[ITEM_FORE_COLOR]);
for (int i = 0; i < dropListActualSize; i++) {
py += itemHeight;
if (currOverItem == startItem + i)
g2d.setColor(jpalette[OVER_ITEM_FORE_COLOR]);
else
g2d.setColor(jpalette[ITEM_FORE_COLOR]);
line = sitems[startItem + i].getLines(g2d).getFirst().layout;
line.draw(g2d, px, py);
}
}
buffer.endDraw();
}
</DeepExtract>
|
hid-serial
|
positive
|
private void setToolbarTitle(long id) {
Cursor cursor = ShaderEditorApp.db.getShader(id);
if (Database.closeIfEmpty(cursor)) {
return;
}
setQualitySpinner(Database.getFloat(cursor, Database.SHADERS_QUALITY));
setToolbarTitle(cursor);
cursor.close();
}
|
<DeepExtract>
setQualitySpinner(Database.getFloat(cursor, Database.SHADERS_QUALITY));
</DeepExtract>
|
ShaderEditor
|
positive
|
public _Fields fieldForId(int fieldId) {
switch(fieldId) {
case 1:
return TRUE_AS_OF_SECS;
default:
return null;
}
}
|
<DeepExtract>
switch(fieldId) {
case 1:
return TRUE_AS_OF_SECS;
default:
return null;
}
</DeepExtract>
|
big-data-src
|
positive
|
@Override
public TypeV remove(Object key) {
if (NO_MATCH_OLD == null || TOMBSTONE == null)
throw new NullPointerException();
final Object res = putIfMatch(this, _kvs, key, TOMBSTONE, NO_MATCH_OLD);
assert !(res instanceof Prime);
assert res != null;
return res == TOMBSTONE ? null : (TypeV) res;
}
|
<DeepExtract>
if (NO_MATCH_OLD == null || TOMBSTONE == null)
throw new NullPointerException();
final Object res = putIfMatch(this, _kvs, key, TOMBSTONE, NO_MATCH_OLD);
assert !(res instanceof Prime);
assert res != null;
return res == TOMBSTONE ? null : (TypeV) res;
</DeepExtract>
|
high-scale-lib
|
positive
|
@Override
public Collection<JarContainer> load() throws DependencyException {
final List<JarContainer> result = new ArrayList<JarContainer>();
final Map<String, String> properties = new HashMap<String, String>();
final SAXBuilder sxb = new SAXBuilder();
try {
final Document document = sxb.build(new File(rootFileName));
final Element racine = document.getRootElement();
final Element eltProperties = racine.getChild("properties", racine.getNamespace());
final List<Element> eltProperty = eltProperties.getChildren();
for (final Element element : eltProperty) {
properties.put(element.getName(), element.getValue());
}
} catch (final JDOMException e) {
throw new DependencyException(e);
} catch (final IOException e) {
throw new DependencyException(e);
}
final SAXBuilder sxb = new SAXBuilder();
try {
final Document document = sxb.build(new File(destFileName));
final Element racine = document.getRootElement();
final Element eltProperties = racine.getChild("properties", racine.getNamespace());
final List<Element> eltProperty = eltProperties.getChildren();
for (final Element element : eltProperty) {
properties.put(element.getName(), element.getValue());
}
} catch (final JDOMException e) {
throw new DependencyException(e);
} catch (final IOException e) {
throw new DependencyException(e);
}
final SAXBuilder sxb = new SAXBuilder();
try {
final Document document = sxb.build(new File(destFileName));
final Element racine = document.getRootElement();
final Element eltDependencies = racine.getChild("dependencies", racine.getNamespace());
final List<Element> eltDependency = eltDependencies.getChildren("dependency", racine.getNamespace());
for (final Element element : eltDependency) {
final JarContainer jar = new JarContainer(AdapterPomXml.class);
jar.setGroupId(loadText(element, "groupId", properties));
jar.setArtifactId(loadText(element, "artifactId", properties));
jar.setVersion(loadText(element, "version", properties));
result.add(jar);
}
} catch (final JDOMException e) {
throw new DependencyException(e);
} catch (final IOException e) {
throw new DependencyException(e);
}
return result;
}
|
<DeepExtract>
final SAXBuilder sxb = new SAXBuilder();
try {
final Document document = sxb.build(new File(rootFileName));
final Element racine = document.getRootElement();
final Element eltProperties = racine.getChild("properties", racine.getNamespace());
final List<Element> eltProperty = eltProperties.getChildren();
for (final Element element : eltProperty) {
properties.put(element.getName(), element.getValue());
}
} catch (final JDOMException e) {
throw new DependencyException(e);
} catch (final IOException e) {
throw new DependencyException(e);
}
</DeepExtract>
<DeepExtract>
final SAXBuilder sxb = new SAXBuilder();
try {
final Document document = sxb.build(new File(destFileName));
final Element racine = document.getRootElement();
final Element eltProperties = racine.getChild("properties", racine.getNamespace());
final List<Element> eltProperty = eltProperties.getChildren();
for (final Element element : eltProperty) {
properties.put(element.getName(), element.getValue());
}
} catch (final JDOMException e) {
throw new DependencyException(e);
} catch (final IOException e) {
throw new DependencyException(e);
}
</DeepExtract>
|
sonos-java
|
positive
|
protected void onVisible() {
if (hasLoaded) {
return;
}
hasLoaded = true;
}
|
<DeepExtract>
</DeepExtract>
|
EnjoyLife
|
positive
|
@Override
public void onClick(View v) {
FileManager manager = new FileManager(getActivity().getApplicationContext());
File file = new File(manager.getMyQRPath());
if (!file.exists()) {
manager.saveMyQRCode(QRExchange.makeQRFriendCode(getActivity(), manager));
}
Bundle bundle = new Bundle();
bundle.putString("uri", Uri.fromFile(file).toString());
Navigation.findNavController(addFriendView).navigate(R.id.action_addFriendFragment_to_displayQRFragment, bundle);
}
|
<DeepExtract>
FileManager manager = new FileManager(getActivity().getApplicationContext());
File file = new File(manager.getMyQRPath());
if (!file.exists()) {
manager.saveMyQRCode(QRExchange.makeQRFriendCode(getActivity(), manager));
}
Bundle bundle = new Bundle();
bundle.putString("uri", Uri.fromFile(file).toString());
Navigation.findNavController(addFriendView).navigate(R.id.action_addFriendFragment_to_displayQRFragment, bundle);
</DeepExtract>
|
ndn-photo-app
|
positive
|
public MethodInfo findSuperclassImplementation(HashSet notStrippable) {
if (mReturnType == null) {
return null;
}
if (mOverriddenMethod != null) {
if (this.signature().equals(mOverriddenMethod.signature())) {
return mOverriddenMethod;
}
}
ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>();
if (containingClass().realSuperclass() != null && containingClass().realSuperclass().isAbstract()) {
queue.add(containingClass());
}
for (ClassInfo i : containingClass().realInterfaces()) {
queue.add(i);
}
for (ClassInfo i : containingClass().realInterfaces()) {
addInterfaces(i.interfaces(), queue);
}
for (ClassInfo iface : queue) {
for (MethodInfo me : iface.methods()) {
if (me.name().equals(this.name()) && me.signature().equals(this.signature()) && notStrippable.contains(me.containingClass())) {
return me;
}
}
}
return null;
}
|
<DeepExtract>
for (ClassInfo i : containingClass().realInterfaces()) {
queue.add(i);
}
for (ClassInfo i : containingClass().realInterfaces()) {
addInterfaces(i.interfaces(), queue);
}
</DeepExtract>
|
TWRP2-CM7_build
|
positive
|
@BeforeMethod
public void setup() throws Exception {
CacheConfig.setOnMaster(conf, true);
CacheConfig.setIsStrictMode(conf, true);
CacheConfig.setBookKeeperServerPort(conf, 3456);
CacheConfig.setDataTransferServerPort(conf, 2222);
CacheConfig.setBlockSize(conf, blockSize);
CacheConfig.setCacheDataDirPrefix(conf, testDirectoryPrefix + "dir");
CacheConfig.setMaxDisks(conf, 1);
CacheConfig.setIsParallelWarmupEnabled(conf, false);
CacheConfig.setCleanupFilesDuringStart(conf, false);
bookKeeperFactory = new BookKeeperFactory();
bookKeeperServer = new BookKeeperServer();
Thread thread = new Thread() {
public void run() {
bookKeeperServer.startServer(conf, new MetricRegistry());
}
};
thread.start();
while (!bookKeeperServer.isServerUp()) {
Thread.sleep(200);
log.info("Waiting for BookKeeper Server to come up");
}
fs = new MockCachingFileSystem();
fs.initialize(backendPath.toUri(), conf);
DataGen.populateFile(backendFileName);
backendFile = new File(backendFileName);
}
|
<DeepExtract>
bookKeeperServer = new BookKeeperServer();
Thread thread = new Thread() {
public void run() {
bookKeeperServer.startServer(conf, new MetricRegistry());
}
};
thread.start();
while (!bookKeeperServer.isServerUp()) {
Thread.sleep(200);
log.info("Waiting for BookKeeper Server to come up");
}
</DeepExtract>
|
rubix
|
positive
|
public void startForecastDownloader(Context context, Modes downloadMode, boolean forceBroadcast) {
UpdatesManager manager = new UpdatesManager(context);
List<Uri> uris = manager.getAllUpdateUris();
LocationDatabase locDb = this.getLocationDatabase(context);
Log.i("UpdatesReceiver", "ensuring " + uris.size() + " widgets/notifications are up to date");
UnitSet unitset = Units.getUnitSet(WeatherApp.prefs(context).getString(WeatherApp.PREF_KEY_UNITS, Units.UNITS_DEFAULT));
for (Uri uri : uris) {
ForecastLocation l = locDb.getLocation(uri);
Forecast f = new Forecast(context, l, WeatherApp.getLanguage(context));
f.setUnitSet(unitset);
ForecastDownloader d = new ForecastDownloader(f, null, downloadMode, forceBroadcast);
d.download();
}
}
|
<DeepExtract>
Log.i("UpdatesReceiver", "ensuring " + uris.size() + " widgets/notifications are up to date");
</DeepExtract>
|
CanadaWeather
|
positive
|
@Override
public void testPeriodic() {
subsystems.outputToSmartDashboard();
robotState.outputToSmartDashboard();
enabledLooper.outputToSmartDashboard();
SmartDashboard.putBoolean("Enabled", ds.isEnabled());
SmartDashboard.putNumber("Match time", ds.getMatchTime());
}
|
<DeepExtract>
subsystems.outputToSmartDashboard();
robotState.outputToSmartDashboard();
enabledLooper.outputToSmartDashboard();
SmartDashboard.putBoolean("Enabled", ds.isEnabled());
SmartDashboard.putNumber("Match time", ds.getMatchTime());
</DeepExtract>
|
2019DeepSpace
|
positive
|
public void putOption(final JSONObject option) {
cache.put(option.optString(Keys.OBJECT_ID), Solos.clone(option));
final String category = option.optString(Option.OPTION_CATEGORY);
categoryCache.remove(category);
}
|
<DeepExtract>
categoryCache.remove(category);
</DeepExtract>
|
solo
|
positive
|
public void mouseExited(java.awt.event.MouseEvent evt) {
removeVehicleButton.setBackground(new Color(51, 0, 102));
}
|
<DeepExtract>
removeVehicleButton.setBackground(new Color(51, 0, 102));
</DeepExtract>
|
vehler
|
positive
|
public static int[] crop(int[] argb, int width, Rect rect) {
rect.left = Math.max(rect.left, 0);
rect.right = Math.min(rect.right, width);
int height = argb.length / width;
rect.bottom = Math.min(rect.bottom, height);
rect.sort();
int[] image = new int[rect.width() * rect.height()];
for (int i = rect.top; i < rect.bottom; i++) {
int rowIndex = width * i;
try {
System.arraycopy(argb, rowIndex + rect.left, image, rect.width() * (i - rect.top), rect.width());
} catch (Exception e) {
e.printStackTrace();
return argb;
}
}
return image;
}
|
<DeepExtract>
rect.left = Math.max(rect.left, 0);
rect.right = Math.min(rect.right, width);
int height = argb.length / width;
rect.bottom = Math.min(rect.bottom, height);
rect.sort();
</DeepExtract>
|
FaceLoginAndroid
|
positive
|
@Override
public void changedUpdate(DocumentEvent e) {
if (!isChangedNickname) {
remoteNameText.setText(remoteHostText.getText() + COLON + remotePortText.getText());
}
}
|
<DeepExtract>
if (!isChangedNickname) {
remoteNameText.setText(remoteHostText.getText() + COLON + remotePortText.getText());
}
</DeepExtract>
|
RemoteResources
|
positive
|
@Override
public byte[] signTransaction(byte[] privateKey, byte[] unsignedTransaction) {
byte[] signature;
byte[] messageSha256 = getSha256().digest(unsignedTransaction);
if (nativeEnabled()) {
signature = nativeCurve25519.sign(messageSha256, privateKey);
} else {
signature = curve25519.sign(messageSha256, privateKey);
}
byte[] signedTransaction = new byte[unsignedTransaction.length];
System.arraycopy(unsignedTransaction, 0, signedTransaction, 0, unsignedTransaction.length);
System.arraycopy(signature, 0, signedTransaction, 96, 64);
return signedTransaction;
}
|
<DeepExtract>
byte[] signature;
byte[] messageSha256 = getSha256().digest(unsignedTransaction);
if (nativeEnabled()) {
signature = nativeCurve25519.sign(messageSha256, privateKey);
} else {
signature = curve25519.sign(messageSha256, privateKey);
}
</DeepExtract>
|
signumj
|
positive
|
public void getClients(List<TreeMap<String, Object>> list) {
query("select * from " + "clients", list);
}
|
<DeepExtract>
query("select * from " + "clients", list);
</DeepExtract>
|
MTX_HackerTools
|
positive
|
@Override
public void run() {
mLiveBanner.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
mLiveBanner.setBackgroundResource(R.drawable.live_orange_bg);
mLiveBanner.setTag(null);
mLiveBanner.setText(getString(R.string.buffering));
mLiveBanner.bringToFront();
mLiveBanner.startAnimation(AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_from_left));
mLiveBanner.setVisibility(View.VISIBLE);
}
|
<DeepExtract>
mLiveBanner.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
mLiveBanner.setBackgroundResource(R.drawable.live_orange_bg);
mLiveBanner.setTag(null);
mLiveBanner.setText(getString(R.string.buffering));
</DeepExtract>
<DeepExtract>
mLiveBanner.bringToFront();
mLiveBanner.startAnimation(AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_from_left));
mLiveBanner.setVisibility(View.VISIBLE);
</DeepExtract>
|
kickflip-android-sdk
|
positive
|
@Override
public String printTree(String indent) {
StringBuffer print = new StringBuffer();
print.append("WordElement: base=").append(getBaseForm()).append(", category=").append(getCategory().toString()).append(", ").append(super.toString()).append('\n');
ElementCategory _category = getCategory();
StringBuffer buffer = new StringBuffer("WordElement[");
buffer.append(getBaseForm()).append(':');
if (_category != null) {
buffer.append(_category.toString());
} else {
buffer.append("no category");
}
buffer.append(']');
return buffer.toString();
}
|
<DeepExtract>
ElementCategory _category = getCategory();
StringBuffer buffer = new StringBuffer("WordElement[");
buffer.append(getBaseForm()).append(':');
if (_category != null) {
buffer.append(_category.toString());
} else {
buffer.append("no category");
}
buffer.append(']');
return buffer.toString();
</DeepExtract>
|
SimpleNLG-EnFr
|
positive
|
public void newarray_int() {
if (this.count >= this.maxLength) {
throw new CompileException("Write after end of stream.");
}
write(Bytecode.NEWARRAY.getBytecode() & 0xff);
if (this.count >= this.maxLength) {
throw new CompileException("Write after end of stream.");
}
write(0x0a & 0xff);
}
|
<DeepExtract>
if (this.count >= this.maxLength) {
throw new CompileException("Write after end of stream.");
}
write(Bytecode.NEWARRAY.getBytecode() & 0xff);
</DeepExtract>
<DeepExtract>
if (this.count >= this.maxLength) {
throw new CompileException("Write after end of stream.");
}
write(0x0a & 0xff);
</DeepExtract>
|
BASICCompiler
|
positive
|
public SparseDataset fitTransform(List<List<String>> documents) {
int nrow = documents.size();
int ncol = tokenToIndex.size();
SparseDataset tfidf = new SparseDataset(ncol);
for (int rowNo = 0; rowNo < nrow; rowNo++) {
tfidf.set(rowNo, 0, 0.0);
Multiset<String> row = HashMultiset.create(documents.get(rowNo));
for (Entry<String> e : row.entrySet()) {
String token = e.getElement();
double tf = e.getCount();
if (sublinearTf) {
tf = 1 + Math.log(tf);
}
if (!tokenToIndex.containsKey(token)) {
continue;
}
int colNo = tokenToIndex.get(token);
if (applyIdf) {
double idf = idfs[colNo];
tfidf.set(rowNo, colNo, tf * idf);
} else {
tfidf.set(rowNo, colNo, tf);
}
}
}
if (normalize) {
tfidf.unitize();
}
return tfidf;
}
|
<DeepExtract>
int nrow = documents.size();
int ncol = tokenToIndex.size();
SparseDataset tfidf = new SparseDataset(ncol);
for (int rowNo = 0; rowNo < nrow; rowNo++) {
tfidf.set(rowNo, 0, 0.0);
Multiset<String> row = HashMultiset.create(documents.get(rowNo));
for (Entry<String> e : row.entrySet()) {
String token = e.getElement();
double tf = e.getCount();
if (sublinearTf) {
tf = 1 + Math.log(tf);
}
if (!tokenToIndex.containsKey(token)) {
continue;
}
int colNo = tokenToIndex.get(token);
if (applyIdf) {
double idf = idfs[colNo];
tfidf.set(rowNo, colNo, tf * idf);
} else {
tfidf.set(rowNo, colNo, tf);
}
}
}
if (normalize) {
tfidf.unitize();
}
return tfidf;
</DeepExtract>
|
mastering-java-data-science
|
positive
|
public int delete(Criteria criteria) {
String sql = criteria.toSQL();
String table = Mapping.getInstance().getTableName(criteria.getRoot().getClazz());
if (Aorm.isDebug()) {
log("delete " + table + " where: " + criteria.getWhere());
}
int count = delete(table, criteria.getWhere(), criteria.getStringArgs());
if (listeners != null) {
synchronized (listeners) {
for (SessionListener l : listeners) {
l.onChange(criteria.getRoot().getClass());
}
}
}
return count;
}
|
<DeepExtract>
if (listeners != null) {
synchronized (listeners) {
for (SessionListener l : listeners) {
l.onChange(criteria.getRoot().getClass());
}
}
}
</DeepExtract>
|
Android-ORM
|
positive
|
final public void SynchronizedStatement() {
boolean jjtc000 = true;
PsiBuilder.Marker jjtn000 = builder.mark();
IElementType actualType = builder.getTokenType();
if (actualType == SYNCHRONIZED) {
builder.advanceLexer();
} else {
if (builder.eof()) {
if (!reportEof) {
reportEof = true;
builder.error("Unexpected end of file");
}
} else {
PsiBuilder.Marker errorMarker = builder.mark();
String text = builder.getTokenText();
builder.advanceLexer();
errorMarker.error("Expected " + SYNCHRONIZED + ", but get: " + text);
}
}
return SYNCHRONIZED;
IElementType actualType = builder.getTokenType();
if (actualType == LPAREN) {
builder.advanceLexer();
} else {
if (builder.eof()) {
if (!reportEof) {
reportEof = true;
builder.error("Unexpected end of file");
}
} else {
PsiBuilder.Marker errorMarker = builder.mark();
String text = builder.getTokenText();
builder.advanceLexer();
errorMarker.error("Expected " + LPAREN + ", but get: " + text);
}
}
return LPAREN;
boolean jjtc000 = true;
PsiBuilder.Marker jjtn000 = builder.mark();
ConditionalExpression();
if (jj_2_24(2)) {
AssignmentOperator();
Expression();
} else {
;
}
{
if (jjtc000) {
jjtc000 = false;
{
jjtn000.done(JJTEXPRESSION);
}
}
}
IElementType actualType = builder.getTokenType();
if (actualType == RPAREN) {
builder.advanceLexer();
} else {
if (builder.eof()) {
if (!reportEof) {
reportEof = true;
builder.error("Unexpected end of file");
}
} else {
PsiBuilder.Marker errorMarker = builder.mark();
String text = builder.getTokenText();
builder.advanceLexer();
errorMarker.error("Expected " + RPAREN + ", but get: " + text);
}
}
return RPAREN;
boolean jjtc000 = true;
PsiBuilder.Marker jjtn000 = builder.mark();
jj_consume_token(LBRACE);
label_201: while (true) {
IElementType type_202 = getType();
if (type_202 == _LOOKAHEAD || type_202 == _IGNORE_CASE || type_202 == _PARSER_BEGIN || type_202 == _PARSER_END || type_202 == _JAVACODE || type_202 == _TOKEN || type_202 == _SPECIAL_TOKEN || type_202 == _MORE || type_202 == _SKIP || type_202 == _TOKEN_MGR_DECLS || type_202 == _EOF || type_202 == ABSTRACT || type_202 == ASSERT || type_202 == BOOLEAN || type_202 == BREAK || type_202 == BYTE || type_202 == CHAR || type_202 == CLASS || type_202 == CONTINUE || type_202 == DO || type_202 == DOUBLE || type_202 == FALSE || type_202 == FINAL || type_202 == FLOAT || type_202 == FOR || type_202 == IF || type_202 == INT || type_202 == INTERFACE || type_202 == LONG || type_202 == NATIVE || type_202 == NEW || type_202 == NULL || type_202 == PRIVATE || type_202 == PROTECTED || type_202 == PUBLIC || type_202 == RETURN || type_202 == SHORT || type_202 == STATIC || type_202 == STRICTFP || type_202 == SUPER || type_202 == SWITCH || type_202 == SYNCHRONIZED || type_202 == THIS || type_202 == THROW || type_202 == TRANSIENT || type_202 == TRUE || type_202 == TRY || type_202 == VOID || type_202 == VOLATILE || type_202 == WHILE || type_202 == INTEGER_LITERAL || type_202 == FLOATING_POINT_LITERAL || type_202 == CHARACTER_LITERAL || type_202 == STRING_LITERAL || type_202 == IDENTIFIER || type_202 == LPAREN || type_202 == LBRACE || type_202 == SEMICOLON || type_202 == INCR || type_202 == DECR || type_202 == AT) {
;
} else {
break label_201;
}
BlockStatement();
}
jj_consume_token(RBRACE);
{
if (jjtc000) {
jjtc000 = false;
{
jjtn000.done(JJTBLOCK);
}
}
}
{
if (jjtc000) {
jjtc000 = false;
{
jjtn000.done(JJTSYNCHRONIZEDSTATEMENT);
}
}
}
}
|
<DeepExtract>
IElementType actualType = builder.getTokenType();
if (actualType == SYNCHRONIZED) {
builder.advanceLexer();
} else {
if (builder.eof()) {
if (!reportEof) {
reportEof = true;
builder.error("Unexpected end of file");
}
} else {
PsiBuilder.Marker errorMarker = builder.mark();
String text = builder.getTokenText();
builder.advanceLexer();
errorMarker.error("Expected " + SYNCHRONIZED + ", but get: " + text);
}
}
return SYNCHRONIZED;
</DeepExtract>
<DeepExtract>
IElementType actualType = builder.getTokenType();
if (actualType == LPAREN) {
builder.advanceLexer();
} else {
if (builder.eof()) {
if (!reportEof) {
reportEof = true;
builder.error("Unexpected end of file");
}
} else {
PsiBuilder.Marker errorMarker = builder.mark();
String text = builder.getTokenText();
builder.advanceLexer();
errorMarker.error("Expected " + LPAREN + ", but get: " + text);
}
}
return LPAREN;
</DeepExtract>
<DeepExtract>
boolean jjtc000 = true;
PsiBuilder.Marker jjtn000 = builder.mark();
ConditionalExpression();
if (jj_2_24(2)) {
AssignmentOperator();
Expression();
} else {
;
}
{
if (jjtc000) {
jjtc000 = false;
{
jjtn000.done(JJTEXPRESSION);
}
}
}
</DeepExtract>
<DeepExtract>
IElementType actualType = builder.getTokenType();
if (actualType == RPAREN) {
builder.advanceLexer();
} else {
if (builder.eof()) {
if (!reportEof) {
reportEof = true;
builder.error("Unexpected end of file");
}
} else {
PsiBuilder.Marker errorMarker = builder.mark();
String text = builder.getTokenText();
builder.advanceLexer();
errorMarker.error("Expected " + RPAREN + ", but get: " + text);
}
}
return RPAREN;
</DeepExtract>
<DeepExtract>
boolean jjtc000 = true;
PsiBuilder.Marker jjtn000 = builder.mark();
jj_consume_token(LBRACE);
label_201: while (true) {
IElementType type_202 = getType();
if (type_202 == _LOOKAHEAD || type_202 == _IGNORE_CASE || type_202 == _PARSER_BEGIN || type_202 == _PARSER_END || type_202 == _JAVACODE || type_202 == _TOKEN || type_202 == _SPECIAL_TOKEN || type_202 == _MORE || type_202 == _SKIP || type_202 == _TOKEN_MGR_DECLS || type_202 == _EOF || type_202 == ABSTRACT || type_202 == ASSERT || type_202 == BOOLEAN || type_202 == BREAK || type_202 == BYTE || type_202 == CHAR || type_202 == CLASS || type_202 == CONTINUE || type_202 == DO || type_202 == DOUBLE || type_202 == FALSE || type_202 == FINAL || type_202 == FLOAT || type_202 == FOR || type_202 == IF || type_202 == INT || type_202 == INTERFACE || type_202 == LONG || type_202 == NATIVE || type_202 == NEW || type_202 == NULL || type_202 == PRIVATE || type_202 == PROTECTED || type_202 == PUBLIC || type_202 == RETURN || type_202 == SHORT || type_202 == STATIC || type_202 == STRICTFP || type_202 == SUPER || type_202 == SWITCH || type_202 == SYNCHRONIZED || type_202 == THIS || type_202 == THROW || type_202 == TRANSIENT || type_202 == TRUE || type_202 == TRY || type_202 == VOID || type_202 == VOLATILE || type_202 == WHILE || type_202 == INTEGER_LITERAL || type_202 == FLOATING_POINT_LITERAL || type_202 == CHARACTER_LITERAL || type_202 == STRING_LITERAL || type_202 == IDENTIFIER || type_202 == LPAREN || type_202 == LBRACE || type_202 == SEMICOLON || type_202 == INCR || type_202 == DECR || type_202 == AT) {
;
} else {
break label_201;
}
BlockStatement();
}
jj_consume_token(RBRACE);
{
if (jjtc000) {
jjtc000 = false;
{
jjtn000.done(JJTBLOCK);
}
}
}
</DeepExtract>
|
ideaCC
|
positive
|
public static int getApptVersion(File aapt) throws BrutException {
if (!aapt.isFile()) {
throw new BrutException("Could not identify aapt binary as executable.");
}
aapt.setExecutable(true);
List<String> cmd = new ArrayList<>();
cmd.add(aapt.getAbsolutePath());
cmd.add("version");
String version = OS.execAndReturn(cmd.toArray(new String[0]));
if (version == null) {
throw new BrutException("Could not execute aapt binary at location: " + aapt.getAbsolutePath());
}
if (version.startsWith("Android Asset Packaging Tool (aapt) 2:")) {
return 2;
} else if (version.startsWith("Android Asset Packaging Tool (aapt) 2.")) {
return 2;
} else if (version.startsWith("Android Asset Packaging Tool, v0.")) {
return 1;
}
throw new BrutException("aapt version could not be identified: " + version);
}
|
<DeepExtract>
if (version.startsWith("Android Asset Packaging Tool (aapt) 2:")) {
return 2;
} else if (version.startsWith("Android Asset Packaging Tool (aapt) 2.")) {
return 2;
} else if (version.startsWith("Android Asset Packaging Tool, v0.")) {
return 1;
}
throw new BrutException("aapt version could not be identified: " + version);
</DeepExtract>
|
ratel
|
positive
|
public XmlNode getParentNode() {
if (node.getParentNode() == null)
return null;
if (node.getParentNode() instanceof Element)
return new XmlElement((Element) node.getParentNode());
if (node.getParentNode() instanceof Document)
return new XmlDocument((Document) node.getParentNode());
if (node.getParentNode() instanceof Attr)
return new XmlAttribute((Attr) node.getParentNode());
if (node.getParentNode() instanceof Comment)
return new XmlComment((Comment) node.getParentNode());
if (node.getParentNode() instanceof CDATASection)
return new XmlCDataSection((CDATASection) node.getParentNode());
if (node.getParentNode() instanceof Text)
return new XmlText((Text) node.getParentNode());
return new XmlNode(node.getParentNode());
}
|
<DeepExtract>
if (node.getParentNode() == null)
return null;
if (node.getParentNode() instanceof Element)
return new XmlElement((Element) node.getParentNode());
if (node.getParentNode() instanceof Document)
return new XmlDocument((Document) node.getParentNode());
if (node.getParentNode() instanceof Attr)
return new XmlAttribute((Attr) node.getParentNode());
if (node.getParentNode() instanceof Comment)
return new XmlComment((Comment) node.getParentNode());
if (node.getParentNode() instanceof CDATASection)
return new XmlCDataSection((CDATASection) node.getParentNode());
if (node.getParentNode() instanceof Text)
return new XmlText((Text) node.getParentNode());
return new XmlNode(node.getParentNode());
</DeepExtract>
|
cs2j
|
positive
|
public com.google.cloud.solutions.samples.timeseries.dataflow.application.proto.TimeSeriesProtos.TSProto getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
|
<DeepExtract>
return DEFAULT_INSTANCE;
</DeepExtract>
|
data-timeseries-java
|
positive
|
VL eulerTrail() {
_adjq = new EQ[n];
int nOdd = 0, start = 0;
int nOdd = 0, start = 0;
for (int u = 0; u < n; u++) {
_adjq[u] = new EQ();
if (start == 0 && out[u] > 0)
start = u;
for (int i = 0; i < out[u]; i++) _adjq[u].add(edge(u, i));
}
for (int v = 0; v < n; v++) {
int diff = Math.abs(in[v] - out[v]);
if (diff > 1)
return null;
if (diff == 1) {
if (++nOdd > 2)
return null;
if (out[v] > in[v])
start = v;
}
}
_trail = new VL();
while (!_adjq[start].isEmpty()) {
E e = _adjq[start].remove();
eulerBuildTrail(e.v);
}
_trail.add(start);
Collections.reverse(_trail);
return _trail;
}
|
<DeepExtract>
while (!_adjq[start].isEmpty()) {
E e = _adjq[start].remove();
eulerBuildTrail(e.v);
}
_trail.add(start);
</DeepExtract>
|
pc-code
|
positive
|
public boolean putLongLite(String key, long value) {
if (!valid) {
throw new IllegalStateException("this should only be called when LitePrefs didn't initialize once");
}
return getLiteInterface().putLongLite(key, value);
}
|
<DeepExtract>
if (!valid) {
throw new IllegalStateException("this should only be called when LitePrefs didn't initialize once");
}
</DeepExtract>
<DeepExtract>
return getLiteInterface().putLongLite(key, value);
</DeepExtract>
|
PureNote
|
positive
|
@Override
public void act() {
isClimbing = on;
swerve.setLowPowerScalar(0.25);
}
|
<DeepExtract>
isClimbing = on;
swerve.setLowPowerScalar(0.25);
</DeepExtract>
|
2019DeepSpace
|
positive
|
public GrpcService.InferStatistics getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
|
<DeepExtract>
return DEFAULT_INSTANCE;
</DeepExtract>
|
dl_inference
|
positive
|
public Integer getMaxIntegerId() {
String id;
Query query = new Query();
query.with(Sort.by(new Order(Direction.DESC, "id")));
query.limit(1);
T data = mongoTemplate.findOne(query, dao().getClassT());
try {
id = data == null ? "0" : (String) dao().getClassT().getMethod("getId").invoke(data);
} catch (Exception e) {
id = null;
}
try {
if (StringUtils.isNoneBlank(id)) {
Integer maxId = Integer.parseInt(id);
return maxId;
}
} catch (Exception e) {
logger.error("parse num error!", e);
}
return null;
}
|
<DeepExtract>
String id;
Query query = new Query();
query.with(Sort.by(new Order(Direction.DESC, "id")));
query.limit(1);
T data = mongoTemplate.findOne(query, dao().getClassT());
try {
id = data == null ? "0" : (String) dao().getClassT().getMethod("getId").invoke(data);
} catch (Exception e) {
id = null;
}
</DeepExtract>
|
resys-one
|
positive
|
@Test
public void singleTerminalState_HasNoCycle_IsValid() {
validate(StepFunctionBuilder.stateMachine().startAt("Initial").state("Initial", StepFunctionBuilder.succeedState()));
}
|
<DeepExtract>
validate(StepFunctionBuilder.stateMachine().startAt("Initial").state("Initial", StepFunctionBuilder.succeedState()));
</DeepExtract>
|
light-workflow-4j
|
positive
|
private void updateProgressBars() {
int currentLength = envelope.getText().length();
int smsLength = envelope.getSMSLength();
int maxTextLength = envelope.getMaxTextLength();
fullProgressBar.setMaximum(maxTextLength);
int min = envelope.getPenultimateIndexOfCut(envelope.getText(), smsLength);
int max = min + smsLength;
max = Math.min(max, maxTextLength);
singleProgressBar.setMinimum(min);
singleProgressBar.setMaximum(max);
fullProgressBar.setValue(currentLength);
singleProgressBar.setValue(currentLength);
int used = fullProgressBar.getValue() - fullProgressBar.getMinimum();
if (fullProgressBar.getMaximum() == Integer.MAX_VALUE) {
fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, "∞", "∞"));
} else {
int capacity = fullProgressBar.getMaximum() - fullProgressBar.getMinimum();
int remaining = fullProgressBar.getMaximum() - fullProgressBar.getValue();
fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, capacity, remaining));
}
int used = singleProgressBar.getValue() - singleProgressBar.getMinimum();
if (singleProgressBar.getMaximum() == Integer.MAX_VALUE) {
singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, "∞", "∞"));
} else {
int capacity = singleProgressBar.getMaximum() - singleProgressBar.getMinimum();
int remaining = singleProgressBar.getMaximum() - singleProgressBar.getValue();
singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, capacity, remaining));
}
}
|
<DeepExtract>
int used = fullProgressBar.getValue() - fullProgressBar.getMinimum();
if (fullProgressBar.getMaximum() == Integer.MAX_VALUE) {
fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, "∞", "∞"));
} else {
int capacity = fullProgressBar.getMaximum() - fullProgressBar.getMinimum();
int remaining = fullProgressBar.getMaximum() - fullProgressBar.getValue();
fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, capacity, remaining));
}
</DeepExtract>
<DeepExtract>
int used = singleProgressBar.getValue() - singleProgressBar.getMinimum();
if (singleProgressBar.getMaximum() == Integer.MAX_VALUE) {
singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, "∞", "∞"));
} else {
int capacity = singleProgressBar.getMaximum() - singleProgressBar.getMinimum();
int remaining = singleProgressBar.getMaximum() - singleProgressBar.getValue();
singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, capacity, remaining));
}
</DeepExtract>
|
esmska
|
positive
|
public CellReference composeFirstSimpleTextHeaderCellReference() {
if (simpleTextHeaderRowIndex == null || firstDataColumn == null) {
return null;
}
return new CellReference(simpleTextHeaderRowIndex, firstDataColumn);
}
|
<DeepExtract>
if (simpleTextHeaderRowIndex == null || firstDataColumn == null) {
return null;
}
return new CellReference(simpleTextHeaderRowIndex, firstDataColumn);
</DeepExtract>
|
MemPOI
|
positive
|
@Override
public Cursor cursor() {
return new CursorImpl(tagSets, false);
}
|
<DeepExtract>
return new CursorImpl(tagSets, false);
</DeepExtract>
|
metrics
|
positive
|
public static com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException {
com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result).asInvalidProtocolBufferException();
}
return result;
}
|
<DeepExtract>
com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result).asInvalidProtocolBufferException();
}
return result;
</DeepExtract>
|
transit-wand
|
positive
|
public void addMatchVlanPcp(String value) {
parms.add(new Tuple<String, String>("vlan_pcp", value));
}
|
<DeepExtract>
parms.add(new Tuple<String, String>("vlan_pcp", value));
</DeepExtract>
|
warp
|
positive
|
@Override
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {
bindEntityTexture((EntityBlunderShot) entity);
GL11.glPushMatrix();
GL11.glTranslatef((float) d, (float) d1, (float) d2);
Tessellator tessellator = Tessellator.instance;
float f2 = 0.0F;
float f3 = 5F / 16F;
float f10 = 0.05625F;
GL11.glEnable(32826);
GL11.glScalef(0.04F, 0.04F, 0.04F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0D, -1D, -1D, f2, f2);
tessellator.addVertexWithUV(0D, -1D, 1D, f3, f2);
tessellator.addVertexWithUV(0D, 1D, 1D, f3, f3);
tessellator.addVertexWithUV(0D, 1D, -1D, f2, f3);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0D, 1D, -1D, f2, f2);
tessellator.addVertexWithUV(0D, 1D, 1D, f3, f2);
tessellator.addVertexWithUV(0D, -1D, 1D, f3, f3);
tessellator.addVertexWithUV(0D, -1D, -1D, f2, f3);
tessellator.draw();
for (int j = 0; j < 4; j++) {
GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-1D, -1D, 0.0D, f2, f2);
tessellator.addVertexWithUV(1D, -1D, 0.0D, f3, f2);
tessellator.addVertexWithUV(1D, 1D, 0.0D, f3, f3);
tessellator.addVertexWithUV(-1D, 1D, 0.0D, f2, f3);
tessellator.draw();
}
GL11.glDisable(32826);
GL11.glPopMatrix();
GL11.glPushMatrix();
{
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1F, 1F, 0.8F, 1F);
GL11.glLineWidth(1.0F);
tessellator.startDrawing(GL11.GL_LINES);
{
tessellator.addVertex((EntityBlunderShot) entity.posX, (EntityBlunderShot) entity.posY, (EntityBlunderShot) entity.posZ);
tessellator.addVertex((EntityBlunderShot) entity.prevPosX, (EntityBlunderShot) entity.prevPosY, (EntityBlunderShot) entity.prevPosZ);
}
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
}
GL11.glPopMatrix();
}
|
<DeepExtract>
bindEntityTexture((EntityBlunderShot) entity);
GL11.glPushMatrix();
GL11.glTranslatef((float) d, (float) d1, (float) d2);
Tessellator tessellator = Tessellator.instance;
float f2 = 0.0F;
float f3 = 5F / 16F;
float f10 = 0.05625F;
GL11.glEnable(32826);
GL11.glScalef(0.04F, 0.04F, 0.04F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0D, -1D, -1D, f2, f2);
tessellator.addVertexWithUV(0D, -1D, 1D, f3, f2);
tessellator.addVertexWithUV(0D, 1D, 1D, f3, f3);
tessellator.addVertexWithUV(0D, 1D, -1D, f2, f3);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0D, 1D, -1D, f2, f2);
tessellator.addVertexWithUV(0D, 1D, 1D, f3, f2);
tessellator.addVertexWithUV(0D, -1D, 1D, f3, f3);
tessellator.addVertexWithUV(0D, -1D, -1D, f2, f3);
tessellator.draw();
for (int j = 0; j < 4; j++) {
GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-1D, -1D, 0.0D, f2, f2);
tessellator.addVertexWithUV(1D, -1D, 0.0D, f3, f2);
tessellator.addVertexWithUV(1D, 1D, 0.0D, f3, f3);
tessellator.addVertexWithUV(-1D, 1D, 0.0D, f2, f3);
tessellator.draw();
}
GL11.glDisable(32826);
GL11.glPopMatrix();
GL11.glPushMatrix();
{
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1F, 1F, 0.8F, 1F);
GL11.glLineWidth(1.0F);
tessellator.startDrawing(GL11.GL_LINES);
{
tessellator.addVertex((EntityBlunderShot) entity.posX, (EntityBlunderShot) entity.posY, (EntityBlunderShot) entity.posZ);
tessellator.addVertex((EntityBlunderShot) entity.prevPosX, (EntityBlunderShot) entity.prevPosY, (EntityBlunderShot) entity.prevPosZ);
}
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
}
GL11.glPopMatrix();
</DeepExtract>
|
balkons-weaponmod
|
positive
|
public static void setLong(long l, byte[] buf, int o) {
buf[o] = (byte) ((int) (l & 0xffffffffL) & 255);
o++;
buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff00) >> 8);
o++;
buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff0000) >> 16);
o++;
buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff000000) >> 24);
buf[o + 4] = (byte) ((int) (l >> 32) & 255);
o + 4++;
buf[o + 4] = (byte) (((int) (l >> 32) & 0xff00) >> 8);
o + 4++;
buf[o + 4] = (byte) (((int) (l >> 32) & 0xff0000) >> 16);
o + 4++;
buf[o + 4] = (byte) (((int) (l >> 32) & 0xff000000) >> 24);
}
|
<DeepExtract>
buf[o] = (byte) ((int) (l & 0xffffffffL) & 255);
o++;
buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff00) >> 8);
o++;
buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff0000) >> 16);
o++;
buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff000000) >> 24);
</DeepExtract>
<DeepExtract>
buf[o + 4] = (byte) ((int) (l >> 32) & 255);
o + 4++;
buf[o + 4] = (byte) (((int) (l >> 32) & 0xff00) >> 8);
o + 4++;
buf[o + 4] = (byte) (((int) (l >> 32) & 0xff0000) >> 16);
o + 4++;
buf[o + 4] = (byte) (((int) (l >> 32) & 0xff000000) >> 24);
</DeepExtract>
|
deployr-rserve
|
positive
|
@Override
public void onChanged(@Nullable Utils.NetworkState networkState) {
if (networkState == Utils.NetworkState.LOADED) {
binding.statusLayout.itemLoad.setVisibility(View.GONE);
binding.baseRecyclerView.setVisibility(View.VISIBLE);
} else if (networkState == Utils.NetworkState.EMPTY) {
Toast.makeText(getContext(), getResources().getString(R.string.error_getting_data), Toast.LENGTH_SHORT).show();
} else if (networkState == Utils.NetworkState.FAILED) {
if (mAdapter.getCurrentList() == null || mAdapter.getCurrentList().size() == 0) {
binding.statusLayout.netError.setVisibility(View.VISIBLE);
binding.statusLayout.itemLoad.setVisibility(View.GONE);
Snackbar.make(binding.statusLayout.netError, getResources().getString(R.string.net_error), Snackbar.LENGTH_INDEFINITE).setAction("Retry", new View.OnClickListener() {
@Override
public void onClick(View view) {
binding.statusLayout.netError.setVisibility(View.GONE);
}
}).show();
} else {
Snackbar.make(binding.statusLayout.netError, getResources().getString(R.string.faild_to_load), Snackbar.LENGTH_LONG).setAction(getResources().getString(R.string.retry), new View.OnClickListener() {
@Override
public void onClick(View view) {
}
}).show();
}
}
}
|
<DeepExtract>
if (networkState == Utils.NetworkState.LOADED) {
binding.statusLayout.itemLoad.setVisibility(View.GONE);
binding.baseRecyclerView.setVisibility(View.VISIBLE);
} else if (networkState == Utils.NetworkState.EMPTY) {
Toast.makeText(getContext(), getResources().getString(R.string.error_getting_data), Toast.LENGTH_SHORT).show();
} else if (networkState == Utils.NetworkState.FAILED) {
if (mAdapter.getCurrentList() == null || mAdapter.getCurrentList().size() == 0) {
binding.statusLayout.netError.setVisibility(View.VISIBLE);
binding.statusLayout.itemLoad.setVisibility(View.GONE);
Snackbar.make(binding.statusLayout.netError, getResources().getString(R.string.net_error), Snackbar.LENGTH_INDEFINITE).setAction("Retry", new View.OnClickListener() {
@Override
public void onClick(View view) {
binding.statusLayout.netError.setVisibility(View.GONE);
}
}).show();
} else {
Snackbar.make(binding.statusLayout.netError, getResources().getString(R.string.faild_to_load), Snackbar.LENGTH_LONG).setAction(getResources().getString(R.string.retry), new View.OnClickListener() {
@Override
public void onClick(View view) {
}
}).show();
}
}
</DeepExtract>
|
WallBay
|
positive
|
@Override
public void onSuccess(LoginResult loginResult) {
mListener.onFbSignInSuccess();
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
Log.e("response: ", response + "");
try {
mListener.onFbProfileReceived(parseResponse(object));
} catch (Exception e) {
e.printStackTrace();
mListener.onFbSignInFail();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", mFieldString);
request.setParameters(parameters);
request.executeAsync();
}
|
<DeepExtract>
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
Log.e("response: ", response + "");
try {
mListener.onFbProfileReceived(parseResponse(object));
} catch (Exception e) {
e.printStackTrace();
mListener.onFbSignInFail();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", mFieldString);
request.setParameters(parameters);
request.executeAsync();
</DeepExtract>
|
BitcoinWallet
|
positive
|
public Call buildCall(Callback callback) {
return okHttpRequest.generateRequest(callback);
if (readTimeOut > 0 || writeTimeOut > 0 || connTimeOut > 0) {
readTimeOut = readTimeOut > 0 ? readTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS;
writeTimeOut = writeTimeOut > 0 ? writeTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS;
connTimeOut = connTimeOut > 0 ? connTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS;
clone = OkHttpUtils.getInstance().getOkHttpClient().newBuilder().readTimeout(readTimeOut, TimeUnit.MILLISECONDS).writeTimeout(writeTimeOut, TimeUnit.MILLISECONDS).connectTimeout(connTimeOut, TimeUnit.MILLISECONDS).build();
call = clone.newCall(request);
} else {
call = OkHttpUtils.getInstance().getOkHttpClient().newCall(request);
}
return call;
}
|
<DeepExtract>
return okHttpRequest.generateRequest(callback);
</DeepExtract>
|
Shopping
|
positive
|
public Criteria andUserPasswordGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "userPassword" + " cannot be null");
}
criteria.add(new Criterion("user_password >=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "userPassword" + " cannot be null");
}
criteria.add(new Criterion("user_password >=", value));
</DeepExtract>
|
LostAndFound
|
positive
|
@Override
public void onClick(View v) {
Intent intent = WelcomeActivity.getStartActivityIntent(this);
startActivity(intent);
finish();
}
|
<DeepExtract>
Intent intent = WelcomeActivity.getStartActivityIntent(this);
startActivity(intent);
finish();
</DeepExtract>
|
input-samples
|
positive
|
public RetCode natr(int startIdx, int endIdx, float[] inHigh, float[] inLow, float[] inClose, int optInTimePeriod, MInteger outBegIdx, MInteger outNBElement, double[] outReal) {
MInteger outBegIdx1 = new MInteger();
MInteger outNbElement1 = new MInteger();
double[] prevATRTemp = new double[1];
if (startIdx < 0)
return RetCode.OutOfRangeStartIndex;
if ((endIdx < 0) || (endIdx < startIdx))
return RetCode.OutOfRangeEndIndex;
if ((int) optInTimePeriod == (Integer.MIN_VALUE))
optInTimePeriod = 14;
else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000))
return RetCode.BadParam;
outBegIdx.value = 0;
outNBElement.value = 0;
if ((int) optInTimePeriod == (Integer.MIN_VALUE))
optInTimePeriod = 14;
else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000))
lookbackTotal = -1;
return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Natr.ordinal()]);
if (startIdx < lookbackTotal)
startIdx = lookbackTotal;
if (startIdx > endIdx)
return RetCode.Success;
if (optInTimePeriod <= 1) {
return trueRange(startIdx, endIdx, inHigh, inLow, inClose, outBegIdx, outNBElement, outReal);
}
tempBuffer = new double[lookbackTotal + (endIdx - startIdx) + 1];
int today, outIdx;
double val2, val3, greatest;
double tempCY, tempLT, tempHT;
if ((startIdx - lookbackTotal + 1) < 0)
retCode = RetCode.OutOfRangeStartIndex;
if ((endIdx < 0) || (endIdx < (startIdx - lookbackTotal + 1)))
retCode = RetCode.OutOfRangeEndIndex;
if ((startIdx - lookbackTotal + 1) < 1)
(startIdx - lookbackTotal + 1) = 1;
if ((startIdx - lookbackTotal + 1) > endIdx) {
outBegIdx1.value = 0;
outNbElement1.value = 0;
retCode = RetCode.Success;
}
outIdx = 0;
today = (startIdx - lookbackTotal + 1);
while (today <= endIdx) {
tempLT = inLow[today];
tempHT = inHigh[today];
tempCY = inClose[today - 1];
greatest = tempHT - tempLT;
val2 = Math.abs(tempCY - tempHT);
if (val2 > greatest)
greatest = val2;
val3 = Math.abs(tempCY - tempLT);
if (val3 > greatest)
greatest = val3;
tempBuffer[outIdx++] = greatest;
today++;
}
outNbElement1.value = outIdx;
outBegIdx1.value = (startIdx - lookbackTotal + 1);
return RetCode.Success;
if (retCode != RetCode.Success) {
return retCode;
}
double periodTotal, tempReal;
int i, outIdx, trailingIdx, lookbackTotal;
lookbackTotal = (optInTimePeriod - 1);
if (optInTimePeriod - 1 < lookbackTotal)
optInTimePeriod - 1 = lookbackTotal;
if (optInTimePeriod - 1 > optInTimePeriod - 1) {
outBegIdx1.value = 0;
outNbElement1.value = 0;
retCode = RetCode.Success;
}
periodTotal = 0;
trailingIdx = optInTimePeriod - 1 - lookbackTotal;
i = trailingIdx;
if (optInTimePeriod > 1) {
while (i < optInTimePeriod - 1) periodTotal += tempBuffer[i++];
}
outIdx = 0;
do {
periodTotal += tempBuffer[i++];
tempReal = periodTotal;
periodTotal -= tempBuffer[trailingIdx++];
prevATRTemp[outIdx++] = tempReal / optInTimePeriod;
} while (i <= optInTimePeriod - 1);
outNbElement1.value = outIdx;
outBegIdx1.value = optInTimePeriod - 1;
return RetCode.Success;
if (retCode != RetCode.Success) {
return retCode;
}
prevATR = prevATRTemp[0];
today = optInTimePeriod;
outIdx = (this.unstablePeriod[FuncUnstId.Natr.ordinal()]);
while (outIdx != 0) {
prevATR *= optInTimePeriod - 1;
prevATR += tempBuffer[today++];
prevATR /= optInTimePeriod;
outIdx--;
}
outIdx = 1;
tempValue = inClose[today];
if (!(((-(0.00000000000001)) < tempValue) && (tempValue < (0.00000000000001))))
outReal[0] = (prevATR / tempValue) * 100.0;
else
outReal[0] = 0.0;
nbATR = (endIdx - startIdx) + 1;
while (--nbATR != 0) {
prevATR *= optInTimePeriod - 1;
prevATR += tempBuffer[today++];
prevATR /= optInTimePeriod;
tempValue = inClose[today];
if (!(((-(0.00000000000001)) < tempValue) && (tempValue < (0.00000000000001))))
outReal[outIdx] = (prevATR / tempValue) * 100.0;
else
outReal[0] = 0.0;
outIdx++;
}
outBegIdx.value = startIdx;
outNBElement.value = outIdx;
return retCode;
}
|
<DeepExtract>
if ((int) optInTimePeriod == (Integer.MIN_VALUE))
optInTimePeriod = 14;
else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000))
lookbackTotal = -1;
return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Natr.ordinal()]);
</DeepExtract>
<DeepExtract>
int today, outIdx;
double val2, val3, greatest;
double tempCY, tempLT, tempHT;
if ((startIdx - lookbackTotal + 1) < 0)
retCode = RetCode.OutOfRangeStartIndex;
if ((endIdx < 0) || (endIdx < (startIdx - lookbackTotal + 1)))
retCode = RetCode.OutOfRangeEndIndex;
if ((startIdx - lookbackTotal + 1) < 1)
(startIdx - lookbackTotal + 1) = 1;
if ((startIdx - lookbackTotal + 1) > endIdx) {
outBegIdx1.value = 0;
outNbElement1.value = 0;
retCode = RetCode.Success;
}
outIdx = 0;
today = (startIdx - lookbackTotal + 1);
while (today <= endIdx) {
tempLT = inLow[today];
tempHT = inHigh[today];
tempCY = inClose[today - 1];
greatest = tempHT - tempLT;
val2 = Math.abs(tempCY - tempHT);
if (val2 > greatest)
greatest = val2;
val3 = Math.abs(tempCY - tempLT);
if (val3 > greatest)
greatest = val3;
tempBuffer[outIdx++] = greatest;
today++;
}
outNbElement1.value = outIdx;
outBegIdx1.value = (startIdx - lookbackTotal + 1);
return RetCode.Success;
</DeepExtract>
<DeepExtract>
double periodTotal, tempReal;
int i, outIdx, trailingIdx, lookbackTotal;
lookbackTotal = (optInTimePeriod - 1);
if (optInTimePeriod - 1 < lookbackTotal)
optInTimePeriod - 1 = lookbackTotal;
if (optInTimePeriod - 1 > optInTimePeriod - 1) {
outBegIdx1.value = 0;
outNbElement1.value = 0;
retCode = RetCode.Success;
}
periodTotal = 0;
trailingIdx = optInTimePeriod - 1 - lookbackTotal;
i = trailingIdx;
if (optInTimePeriod > 1) {
while (i < optInTimePeriod - 1) periodTotal += tempBuffer[i++];
}
outIdx = 0;
do {
periodTotal += tempBuffer[i++];
tempReal = periodTotal;
periodTotal -= tempBuffer[trailingIdx++];
prevATRTemp[outIdx++] = tempReal / optInTimePeriod;
} while (i <= optInTimePeriod - 1);
outNbElement1.value = outIdx;
outBegIdx1.value = optInTimePeriod - 1;
return RetCode.Success;
</DeepExtract>
|
clj-ta-lib
|
positive
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery);
ButterKnife.bind(this);
context = this;
photoSetId = getIntent().getStringExtra(PHOTO_SET);
if (TextUtils.isEmpty(photoSetId)) {
imgList = getIntent().getStringArrayListExtra(IMG_LIST);
index = getIntent().getIntExtra(INDEX, 0);
}
presenter = new GalleryPresenterImpl(this);
if (TextUtils.isEmpty(photoSetId)) {
initViewPager();
} else {
presenter.getExploreSet(photoSetId);
}
}
|
<DeepExtract>
presenter = new GalleryPresenterImpl(this);
</DeepExtract>
|
C9MJ
|
positive
|
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
executeMigrations(db, oldVersion, newVersion);
}
|
<DeepExtract>
executeMigrations(db, oldVersion, newVersion);
</DeepExtract>
|
ReActiveAndroid
|
positive
|
@Override
public List<String> action(Jedis jedis) {
return execute(new JedisAction<List<String>>() {
@Override
public List<String> action(Jedis jedis) {
return jedis.lrange(key, start, end);
}
});
}
|
<DeepExtract>
return execute(new JedisAction<List<String>>() {
@Override
public List<String> action(Jedis jedis) {
return jedis.lrange(key, start, end);
}
});
</DeepExtract>
|
springmore
|
positive
|
public void onPrepared(MediaPlayer mp) {
Log.d("onPrepared");
mCurrentState = STATE_PREPARED;
if (mOnPreparedListener != null)
mOnPreparedListener.onPrepared(mMediaPlayer);
if (mMediaController != null)
mMediaController.setEnabled(true);
return mVideoWidth;
return mVideoHeight;
return mVideoAspectRatio;
long seekToPosition = mSeekWhenPrepared;
if (seekToPosition != 0)
seekTo(seekToPosition);
if (mVideoWidth != 0 && mVideoHeight != 0) {
setVideoLayout(mVideoLayout, mAspectRatio);
if (mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) {
if (mTargetState == STATE_PLAYING) {
start();
if (mMediaController != null)
mMediaController.show();
} else if (!isPlaying() && (seekToPosition != 0 || getCurrentPosition() > 0)) {
if (mMediaController != null)
mMediaController.show(0);
}
}
} else if (mTargetState == STATE_PLAYING) {
start();
}
}
|
<DeepExtract>
return mVideoWidth;
</DeepExtract>
<DeepExtract>
return mVideoHeight;
</DeepExtract>
<DeepExtract>
return mVideoAspectRatio;
</DeepExtract>
|
FunLive
|
positive
|
@Override
public void run() {
InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
}
|
<DeepExtract>
InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
</DeepExtract>
|
FrameModel
|
positive
|
private void setBorderSettingsVisibility() {
ivBorder.setSelected(true);
if (View.VISIBLE == null)
return;
if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.VISIBLE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.VISIBLE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
if (View.VISIBLE == null)
return;
if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.VISIBLE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.VISIBLE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
if (View.VISIBLE == null)
return;
if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.VISIBLE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.VISIBLE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
if (View.GONE == null)
return;
if (selectedView == View.GONE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.GONE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.GONE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
alphaSeekBar.setOnSeekBarChangeListener(null);
alphaSeekBar.setProgress(borderOpacitySeekBarProgress);
if (alphaSeekBar == leftSeekBar)
alphaSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener);
else if (alphaSeekBar == rightSeekBar)
alphaSeekBar.setOnSeekBarChangeListener(rightSeekBarListener);
else if (alphaSeekBar == alphaSeekBar)
alphaSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener);
leftSeekBar.setOnSeekBarChangeListener(null);
leftSeekBar.setProgress(strokeSeekBarProgress);
if (leftSeekBar == leftSeekBar)
leftSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener);
else if (leftSeekBar == rightSeekBar)
leftSeekBar.setOnSeekBarChangeListener(rightSeekBarListener);
else if (leftSeekBar == alphaSeekBar)
leftSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener);
}
|
<DeepExtract>
if (View.VISIBLE == null)
return;
if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.VISIBLE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.VISIBLE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
</DeepExtract>
<DeepExtract>
if (View.VISIBLE == null)
return;
if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.VISIBLE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.VISIBLE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
</DeepExtract>
<DeepExtract>
if (View.VISIBLE == null)
return;
if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.VISIBLE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.VISIBLE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
</DeepExtract>
<DeepExtract>
if (View.GONE == null)
return;
if (selectedView == View.GONE && rlColorChooser.getVisibility() == View.VISIBLE) {
hideSettingBars();
return;
}
selectedView = View.GONE;
rlColorChooser.setVisibility(View.VISIBLE);
unselectAllItems();
final int id = View.GONE.getId();
if (id == R.id.fl_photo_overlay_text_color) {
setTextColorSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_font) {
setFontSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_border) {
setBorderSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_shadow) {
setShadowSettingsVisibility();
} else if (id == R.id.fl_photo_overlay_background) {
setBgSettingsVisibility();
}
</DeepExtract>
<DeepExtract>
alphaSeekBar.setOnSeekBarChangeListener(null);
alphaSeekBar.setProgress(borderOpacitySeekBarProgress);
if (alphaSeekBar == leftSeekBar)
alphaSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener);
else if (alphaSeekBar == rightSeekBar)
alphaSeekBar.setOnSeekBarChangeListener(rightSeekBarListener);
else if (alphaSeekBar == alphaSeekBar)
alphaSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener);
</DeepExtract>
<DeepExtract>
leftSeekBar.setOnSeekBarChangeListener(null);
leftSeekBar.setProgress(strokeSeekBarProgress);
if (leftSeekBar == leftSeekBar)
leftSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener);
else if (leftSeekBar == rightSeekBar)
leftSeekBar.setOnSeekBarChangeListener(rightSeekBarListener);
else if (leftSeekBar == alphaSeekBar)
leftSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener);
</DeepExtract>
|
Chimee
|
positive
|
@Test
public void testExecute_WhenFinderMethodIsFindingEntityWithCompositeKeyList_WhenFindingByGlobalSecondaryHashAndRangeIndexHashAndRangeKey_WhereSecondaryHashKeyIsPrimaryRangeKey() throws ParseException {
if ("playlistName" != null) {
Mockito.when(mockPlaylistEntityMetadata.isRangeKeyAware()).thenReturn(true);
}
Mockito.when(mockDynamoDBPlaylistQueryMethod.getEntityType()).thenReturn(Playlist.class);
Mockito.when(mockDynamoDBPlaylistQueryMethod.getName()).thenReturn("findByPlaylistNameAndDisplayName");
Mockito.when(mockDynamoDBPlaylistQueryMethod.getParameters()).thenReturn(mockParameters);
Mockito.when(mockParameters.getBindableParameters()).thenReturn(mockParameters);
Mockito.when(mockParameters.getNumberOfParameters()).thenReturn(2);
if ("userName" != null) {
}
for (int i = 0; i < 2; i++) {
Parameter mockParameter = Mockito.mock(Parameter.class);
Mockito.when(mockParameter.getIndex()).thenReturn(i);
Mockito.when(mockParameters.getBindableParameter(i)).thenReturn(mockParameter);
}
partTreeDynamoDBQuery = new PartTreeDynamoDBQuery<>(mockDynamoDBOperations, mockDynamoDBPlaylistQueryMethod);
Mockito.when(mockDynamoDBPlaylistQueryMethod.isCollectionQuery()).thenReturn(true);
Mockito.when(mockPlaylistEntityMetadata.isGlobalIndexHashKeyProperty("playlistName")).thenReturn(true);
Map<String, String[]> indexRangeKeySecondaryIndexNames = new HashMap<String, String[]>();
indexRangeKeySecondaryIndexNames.put("playlistName", new String[] { "PlaylistName-DisplayName-index" });
indexRangeKeySecondaryIndexNames.put("displayName", new String[] { "PlaylistName-DisplayName-index" });
Mockito.when(mockPlaylistEntityMetadata.getGlobalSecondaryIndexNamesByPropertyName()).thenReturn(indexRangeKeySecondaryIndexNames);
Mockito.when(mockPlaylistEntityMetadata.getDynamoDBTableName()).thenReturn("playlist");
Mockito.when(mockPlaylistQueryResults.get(0)).thenReturn(mockPlaylist);
Mockito.when(mockPlaylistQueryResults.size()).thenReturn(1);
Mockito.when(mockDynamoDBOperations.query(playlistClassCaptor.capture(), queryResultCaptor.capture())).thenReturn(mockPlaylistQueryResults);
Mockito.when(mockDynamoDBOperations.getOverriddenTableName(Playlist.class, "playlist")).thenReturn("playlist");
Object[] parameters = new Object[] { "SomePlaylistName", "Michael" };
Object o = partTreeDynamoDBQuery.execute(parameters);
assertEquals(mockPlaylistQueryResults, o);
assertEquals(1, mockPlaylistQueryResults.size());
assertEquals(mockPlaylist, mockPlaylistQueryResults.get(0));
assertEquals(playlistClassCaptor.getValue(), Playlist.class);
String indexName = queryResultCaptor.getValue().getIndexName();
assertNotNull(indexName);
assertEquals("PlaylistName-DisplayName-index", indexName);
assertEquals("playlist", queryResultCaptor.getValue().getTableName());
assertEquals(2, queryResultCaptor.getValue().getKeyConditions().size());
Condition globalRangeKeyCondition = queryResultCaptor.getValue().getKeyConditions().get("displayName");
assertEquals(ComparisonOperator.EQ.name(), globalRangeKeyCondition.getComparisonOperator());
assertEquals(1, globalRangeKeyCondition.getAttributeValueList().size());
assertEquals("Michael", globalRangeKeyCondition.getAttributeValueList().get(0).getS());
Condition globalHashKeyCondition = queryResultCaptor.getValue().getKeyConditions().get("playlistName");
assertEquals(ComparisonOperator.EQ.name(), globalHashKeyCondition.getComparisonOperator());
assertEquals(1, globalHashKeyCondition.getAttributeValueList().size());
assertEquals("SomePlaylistName", globalHashKeyCondition.getAttributeValueList().get(0).getS());
assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getSS());
assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getN());
assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getNS());
assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getB());
assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getBS());
assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getSS());
assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getN());
assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getNS());
assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getB());
assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getBS());
Mockito.verify(mockDynamoDBOperations).query(playlistClassCaptor.getValue(), queryResultCaptor.getValue());
}
|
<DeepExtract>
if ("playlistName" != null) {
Mockito.when(mockPlaylistEntityMetadata.isRangeKeyAware()).thenReturn(true);
}
Mockito.when(mockDynamoDBPlaylistQueryMethod.getEntityType()).thenReturn(Playlist.class);
Mockito.when(mockDynamoDBPlaylistQueryMethod.getName()).thenReturn("findByPlaylistNameAndDisplayName");
Mockito.when(mockDynamoDBPlaylistQueryMethod.getParameters()).thenReturn(mockParameters);
Mockito.when(mockParameters.getBindableParameters()).thenReturn(mockParameters);
Mockito.when(mockParameters.getNumberOfParameters()).thenReturn(2);
if ("userName" != null) {
}
for (int i = 0; i < 2; i++) {
Parameter mockParameter = Mockito.mock(Parameter.class);
Mockito.when(mockParameter.getIndex()).thenReturn(i);
Mockito.when(mockParameters.getBindableParameter(i)).thenReturn(mockParameter);
}
partTreeDynamoDBQuery = new PartTreeDynamoDBQuery<>(mockDynamoDBOperations, mockDynamoDBPlaylistQueryMethod);
</DeepExtract>
|
spring-data-dynamodb
|
positive
|
public static boolean touchValidateCaptchaCode(ServletRequest request, String captchaParamName) {
String captcha = request.getParameter(captchaParamName);
if (StringUtils.isBlank(captcha)) {
throw new ServiceException("captcha required");
}
captcha = captcha.toUpperCase();
captchaService = captchaService == null ? SpringContextHolder.getBean(DoubleCheckableCaptchaService.class) : captchaService;
String captchaId = CaptchaUtils.getCaptchaID(request);
if (true) {
return captchaService.touchValidateResponseForID(captchaId, captcha);
} else {
return captchaService.validateResponseForID(captchaId, captcha);
}
}
|
<DeepExtract>
String captcha = request.getParameter(captchaParamName);
if (StringUtils.isBlank(captcha)) {
throw new ServiceException("captcha required");
}
captcha = captcha.toUpperCase();
captchaService = captchaService == null ? SpringContextHolder.getBean(DoubleCheckableCaptchaService.class) : captchaService;
String captchaId = CaptchaUtils.getCaptchaID(request);
if (true) {
return captchaService.touchValidateResponseForID(captchaId, captcha);
} else {
return captchaService.validateResponseForID(captchaId, captcha);
}
</DeepExtract>
|
s2jh4net
|
positive
|
protected void onException(Exception e) throws RuntimeException {
e.printStackTrace();
}
|
<DeepExtract>
e.printStackTrace();
</DeepExtract>
|
RxAndroidBootstrap
|
positive
|
public static MinigamesAPI setupAPI(JavaPlugin plugin_, String minigame, Class<?> arenaclass) {
ArenasConfig arenasconfig = new ArenasConfig(plugin_);
MessagesConfig messagesconfig = new MessagesConfig(plugin_);
ClassesConfig classesconfig = new ClassesConfig(plugin_, false);
StatsConfig statsconfig = new StatsConfig(plugin_, false);
DefaultConfig.init(plugin_, false);
PluginInstance pli = new PluginInstance(plugin_, arenasconfig, messagesconfig, classesconfig, statsconfig);
pinstances.put(plugin_, pli);
ArenaListener al = new ArenaListener(plugin_, pinstances.get(plugin_), minigame);
pinstances.get(plugin_).setArenaListener(al);
Bukkit.getPluginManager().registerEvents(al, plugin_);
Classes.loadClasses(plugin_);
pli.getShopHandler().loadShopItems();
Guns.loadGuns(plugin_);
return pli;
return instance;
}
|
<DeepExtract>
ArenasConfig arenasconfig = new ArenasConfig(plugin_);
MessagesConfig messagesconfig = new MessagesConfig(plugin_);
ClassesConfig classesconfig = new ClassesConfig(plugin_, false);
StatsConfig statsconfig = new StatsConfig(plugin_, false);
DefaultConfig.init(plugin_, false);
PluginInstance pli = new PluginInstance(plugin_, arenasconfig, messagesconfig, classesconfig, statsconfig);
pinstances.put(plugin_, pli);
ArenaListener al = new ArenaListener(plugin_, pinstances.get(plugin_), minigame);
pinstances.get(plugin_).setArenaListener(al);
Bukkit.getPluginManager().registerEvents(al, plugin_);
Classes.loadClasses(plugin_);
pli.getShopHandler().loadShopItems();
Guns.loadGuns(plugin_);
return pli;
</DeepExtract>
|
MinigamesAPI
|
positive
|
private void deleteRows(ActionEvent e) {
DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel()));
int theRow = metadataTable.getSelectedRow();
int rowCount = metadataTable.getSelectedRowCount();
DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel()));
Vector modelRows = model.getDataVector();
Vector screenRows = new Vector();
for (int i = 0; i < modelRows.size(); i++) {
screenRows.add(modelRows.get(metadataTable.convertRowIndexToModel(i)));
}
Vector headings = new Vector(Arrays.asList(ResourceBundle.getBundle("translations/program_strings").getString("mduc.columnlabel"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columntag"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columndefault")));
model.setDataVector(screenRows, headings);
for (int i = 0; i < rowCount; i++) {
model.removeRow(theRow);
}
}
|
<DeepExtract>
DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel()));
Vector modelRows = model.getDataVector();
Vector screenRows = new Vector();
for (int i = 0; i < modelRows.size(); i++) {
screenRows.add(modelRows.get(metadataTable.convertRowIndexToModel(i)));
}
Vector headings = new Vector(Arrays.asList(ResourceBundle.getBundle("translations/program_strings").getString("mduc.columnlabel"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columntag"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columndefault")));
model.setDataVector(screenRows, headings);
</DeepExtract>
|
jExifToolGUI
|
positive
|
@Override
public void onResponse(Bitmap response) {
mCache.putBitmap(cacheKey, response);
BatchedImageRequest request = mInFlightRequests.remove(cacheKey);
if (request != null) {
request.mResponseBitmap = response;
batchResponse(cacheKey, request);
}
}
|
<DeepExtract>
mCache.putBitmap(cacheKey, response);
BatchedImageRequest request = mInFlightRequests.remove(cacheKey);
if (request != null) {
request.mResponseBitmap = response;
batchResponse(cacheKey, request);
}
</DeepExtract>
|
BaoDian
|
positive
|
public void onClick(View v) {
cpu.execute();
statusLabel.setText(cpu.getStatusText());
String speed = "(unknown)";
if (lastCycleCount > cpu.cycleCount)
lastCycleCount = cpu.cycleCount;
long cyclesElapsed = cpu.cycleCount - lastCycleCount;
long time = System.currentTimeMillis();
long millisElapsed = time - lastActualUpdate;
if (millisElapsed > 0) {
float hz = (float) cyclesElapsed * 1000.0f / (float) millisElapsed;
if (hz < 1000)
speed = String.format("%.0fHz", hz);
else if (hz < 1000 * 1000)
speed = String.format("%.1fkHz", hz / 1000.0f);
else if (hz < 1000 * 1000 * 1000)
speed = String.format("%.2fMHz", hz / (1000.0f * 1000.0f));
else
speed = String.format("%.2fGHz", hz / (1000.0f * 1000.0f * 1000.0f));
} else
speed = lastSpeed + " (est)";
lastActualUpdate = time;
lastCycleCount = cpu.cycleCount;
cycleLabel.setText(" Cycles: " + cpu.cycleCount + " Speed: " + speed);
ramviz.updateBuffer();
mainActivity.tabHost.postInvalidate();
}
|
<DeepExtract>
statusLabel.setText(cpu.getStatusText());
String speed = "(unknown)";
if (lastCycleCount > cpu.cycleCount)
lastCycleCount = cpu.cycleCount;
long cyclesElapsed = cpu.cycleCount - lastCycleCount;
long time = System.currentTimeMillis();
long millisElapsed = time - lastActualUpdate;
if (millisElapsed > 0) {
float hz = (float) cyclesElapsed * 1000.0f / (float) millisElapsed;
if (hz < 1000)
speed = String.format("%.0fHz", hz);
else if (hz < 1000 * 1000)
speed = String.format("%.1fkHz", hz / 1000.0f);
else if (hz < 1000 * 1000 * 1000)
speed = String.format("%.2fMHz", hz / (1000.0f * 1000.0f));
else
speed = String.format("%.2fGHz", hz / (1000.0f * 1000.0f * 1000.0f));
} else
speed = lastSpeed + " (est)";
lastActualUpdate = time;
lastCycleCount = cpu.cycleCount;
cycleLabel.setText(" Cycles: " + cpu.cycleCount + " Speed: " + speed);
ramviz.updateBuffer();
mainActivity.tabHost.postInvalidate();
</DeepExtract>
|
ADCPU-16Emu
|
positive
|
@Test
public void decodeJPEG() {
assertEquals(TestResources.png().width, TestResources.jpeg().width);
assertEquals(TestResources.png().height, TestResources.jpeg().height);
double delta = 0, max = -1, min = 1;
for (int x = 0; x < TestResources.jpeg().width; ++x) {
for (int y = 0; y < TestResources.jpeg().height; ++y) {
delta += Math.abs(TestResources.jpeg().get(x, y) - TestResources.png().get(x, y));
max = Math.max(max, TestResources.jpeg().get(x, y));
min = Math.min(min, TestResources.jpeg().get(x, y));
}
}
assertTrue(max > 0.75);
assertTrue(min < 0.1);
assertTrue(delta / (TestResources.jpeg().width * TestResources.jpeg().height) < 0.01);
}
|
<DeepExtract>
assertEquals(TestResources.png().width, TestResources.jpeg().width);
assertEquals(TestResources.png().height, TestResources.jpeg().height);
double delta = 0, max = -1, min = 1;
for (int x = 0; x < TestResources.jpeg().width; ++x) {
for (int y = 0; y < TestResources.jpeg().height; ++y) {
delta += Math.abs(TestResources.jpeg().get(x, y) - TestResources.png().get(x, y));
max = Math.max(max, TestResources.jpeg().get(x, y));
min = Math.min(min, TestResources.jpeg().get(x, y));
}
}
assertTrue(max > 0.75);
assertTrue(min < 0.1);
assertTrue(delta / (TestResources.jpeg().width * TestResources.jpeg().height) < 0.01);
</DeepExtract>
|
sourceafis-java
|
positive
|
@GetMapping("/clients/search/by-client-id/{clientId}")
CustomClient getClientByClientId(@PathVariable("clientId") String clientId) {
for (var client : CLIENTS) {
if (CustomClient::getClientId.apply(client).equals(clientId)) {
return client;
}
}
return null;
}
|
<DeepExtract>
for (var client : CLIENTS) {
if (CustomClient::getClientId.apply(client).equals(clientId)) {
return client;
}
}
return null;
</DeepExtract>
|
keycloak-extension-playground
|
positive
|
public void clear() {
if (loaded) {
messageReference.decrementReferenceCount();
}
message = null;
dropped = false;
loaded = false;
destination = null;
}
|
<DeepExtract>
if (loaded) {
messageReference.decrementReferenceCount();
}
message = null;
dropped = false;
loaded = false;
</DeepExtract>
|
pulsar-jms
|
positive
|
public void onSessionPut(HttpServletRequestEvent event, ActivityContextInterface aci) {
if (super.logger.isWarningEnabled())
super.logger.warning("Received wrong HTTP method '" + "session.PUT" + "'.");
HttpServletResponse response = event.getResponse();
response.setStatus(405);
response.setContentType("text/plain");
PrintWriter w = null;
try {
w = response.getWriter();
w.print("HTTP." + "session.PUT" + " is not supported");
w.flush();
response.flushBuffer();
} catch (IOException e) {
super.logger.severe("", e);
}
}
|
<DeepExtract>
if (super.logger.isWarningEnabled())
super.logger.warning("Received wrong HTTP method '" + "session.PUT" + "'.");
HttpServletResponse response = event.getResponse();
response.setStatus(405);
response.setContentType("text/plain");
PrintWriter w = null;
try {
w = response.getWriter();
w.print("HTTP." + "session.PUT" + " is not supported");
w.flush();
response.flushBuffer();
} catch (IOException e) {
super.logger.severe("", e);
}
</DeepExtract>
|
ussdgateway
|
positive
|
private XMLNode createLayer(Vector renderData, FDisplayListItem startItem) {
XMLNode rootNode = new XMLNode("g");
if (startItem != null) {
CXFORMALPHA aCXFORMALPHA = startItem.getCXFORMALPHA();
if (aCXFORMALPHA != null) {
if (aCXFORMALPHA.HasAddTerms()) {
if (aCXFORMALPHA.getAdd(3) > 0 && aCXFORMALPHA.getAdd(3) <= 255) {
rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getAdd(3) / 255.0f));
}
} else if (aCXFORMALPHA.HasMultTerms()) {
if (aCXFORMALPHA.getMulti(3) > 0 && aCXFORMALPHA.getMulti(3) <= 255) {
rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getMulti(3) / 255.0f));
}
}
}
}
FAffineTransform currentMatrix = null;
String myClipNodeName = null;
int clippingDepth = -1;
for (int index = 0; index < renderData.size(); index++) {
FDisplayListItem myItem = (FDisplayListItem) renderData.get(index);
if (myItem == null) {
continue;
}
String transformString = "";
if (myItem.getMatrix() != null) {
transformString = "matrix(";
transformString += myItem.getMatrix().getScaleX() + " ";
transformString += myItem.getMatrix().getRotateSkew0() + " ";
transformString += myItem.getMatrix().getRotateSkew1() + " ";
transformString += myItem.getMatrix().getScaleY() + " ";
transformString += myItem.getMatrix().getTranslateX() / 20.0f + " ";
transformString += myItem.getMatrix().getTranslateY() / 20.0f + ")";
}
if (myItem.getClipLayer()) {
XMLNode clippingNode = new XMLNode("clipPath");
clippingNode.addProperty("transform", transformString);
myClipNodeName = "clip" + currentClip;
currentClip++;
clippingNode.addProperty("id", myClipNodeName);
XMLNode clippingData = null;
Area clipArea = new Area(Clipper.clip(myItem.getObject()));
clippingData = new XMLNode("path");
PathIterator pi = clipArea.getPathIterator(null);
GeneralPath aGPath = new GeneralPath(pi.getWindingRule());
aGPath.append(pi, false);
String clippingString = parseGeneralPath(aGPath);
if (clippingString.length() < 1) {
continue;
}
clippingData.addProperty("d", parseGeneralPath(aGPath));
clippingNode.sub = clippingData;
rootNode.addChild(clippingNode);
clippingDepth = myItem.getClipDepth() - 1;
} else {
if (clippingDepth != -1) {
if (clippingDepth < index) {
myClipNodeName = null;
clippingDepth = -1;
}
}
if (myItem.isVisible()) {
XMLNode aNewNode = null;
if (myItem.getObject() instanceof FShape) {
FShape fs = (FShape) myItem.getObject();
aNewNode = createShape(fs, null, myItem);
} else if (myItem.getObject() instanceof FMorph) {
FMorph fm = (FMorph) myItem.getObject();
aNewNode = createShape(null, MorphShape.getAdvancedPathVector(fm, myItem.getRatio() / 65535.0f), myItem);
} else if (myItem.getObject() instanceof FMovieData) {
FMovieData fmd = (FMovieData) myItem.getObject();
aNewNode = createLayer(fmd.getDisplayList(), myItem);
} else if (myItem.getObject() instanceof FText) {
FText ft = (FText) myItem.getObject();
aNewNode = createText(ft, null, myItem);
ft = null;
}
if (aNewNode != null) {
if (myItem.getMatrix() != null) {
aNewNode.addProperty("transform", transformString);
}
if (myClipNodeName != null) {
XMLNode tempClip = new XMLNode("g");
tempClip.addProperty("clip-path", "url(#" + myClipNodeName + ")");
tempClip.addChild(aNewNode);
rootNode.addChild(tempClip);
} else {
rootNode.addChild(aNewNode);
}
}
}
}
}
return rootNode;
}
|
<DeepExtract>
if (startItem != null) {
CXFORMALPHA aCXFORMALPHA = startItem.getCXFORMALPHA();
if (aCXFORMALPHA != null) {
if (aCXFORMALPHA.HasAddTerms()) {
if (aCXFORMALPHA.getAdd(3) > 0 && aCXFORMALPHA.getAdd(3) <= 255) {
rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getAdd(3) / 255.0f));
}
} else if (aCXFORMALPHA.HasMultTerms()) {
if (aCXFORMALPHA.getMulti(3) > 0 && aCXFORMALPHA.getMulti(3) <= 255) {
rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getMulti(3) / 255.0f));
}
}
}
}
</DeepExtract>
|
SWFTools-Core
|
positive
|
public void processCard(CardPublicationData card, Optional<CurrentUserWithPerimeters> user, Optional<Jwt> jwt) {
if (card.getPublisherType() == null)
card.setPublisherType(PublisherTypeEnum.EXTERNAL);
if (user.isPresent() && checkAuthenticationForCardSending && !cardPermissionControlService.isCardPublisherAllowedForUser(card, user.get().getUserData().getLogin())) {
throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message(buildPublisherErrorMessage(card, user.get().getUserData().getLogin(), false)).build());
}
if (!checkIsParentCardIdExisting(card))
throw new ConstraintViolationException("The parentCardId " + card.getParentCardId() + " is not the id of any card", null);
if (!checkIsInitialParentCardUidExisting(card))
throw new ConstraintViolationException("The initialParentCardUid " + card.getInitialParentCardUid() + " is not the uid of any card", null);
Set<ConstraintViolation<CardPublicationData>> results = localValidatorFactoryBean.validate(card);
if (!results.isEmpty())
throw new ConstraintViolationException(results);
if (!checkIsEndDateAfterStartDate(card))
throw new ConstraintViolationException("constraint violation : endDate must be after startDate", null);
if (!checkIsExpirationDateAfterStartDate(card))
throw new ConstraintViolationException("constraint violation : expirationDate must be after startDate", null);
if (!checkIsAllTimeSpanEndDateAfterStartDate(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.end must be after TimeSpan.start", null);
if (!checkIsAllHoursAndMinutesFilled(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.HoursAndMinutes must be filled", null);
if (!checkIsAllDaysOfWeekValid(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.daysOfWeek must be filled with values from 1 to 7", null);
if (!checkIsAllMonthsValid(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.months must be filled with values from 0 to 11", null);
if (!checkIsDotCharacterNotInProcessAndState(card))
throw new ConstraintViolationException("constraint violation : character '.' is forbidden in process and state", null);
if (!authorizeToSendCardWithInvalidProcessState)
checkProcessStateExistsInBundles(card);
if (user.isPresent() && checkPerimeterForCardSending && !cardPermissionControlService.isUserAuthorizedToSendCard(card, user.get())) {
throw new AccessDeniedException("user not authorized, the card is rejected");
}
card.prepare(Instant.ofEpochMilli(Instant.now().toEpochMilli()));
cardTranslationService.translate(card);
if (Optional.empty().isPresent()) {
CardPublicationData oldCard = getExistingCard(card.getId());
if (oldCard != null && !cardPermissionControlService.isUserAllowedToEditCard(Optional.empty().get(), card, oldCard))
throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message("User is not the sender of the original card or user is not part of entities allowed to edit card. Card is rejected").build());
if (!cardPermissionControlService.isUserAuthorizedToSendCard(card, Optional.empty().get())) {
throw new AccessDeniedException("user not authorized, the card is rejected");
}
if (!cardPermissionControlService.isCardPublisherInUserEntities(card, Optional.empty().get()))
throw new IllegalArgumentException("Publisher is not valid, the card is rejected");
log.info("Send user card to external app with jwt present " + jwt.isPresent());
externalAppClient.sendCardToExternalApplication(card, jwt);
}
deleteChildCardsProcess(card, jwt);
if ((card.getToNotify() == null) || card.getToNotify())
cardRepositoryService.saveCard(card);
cardRepositoryService.saveCardToArchive(new ArchivedCardPublicationData(card));
if ((card.getToNotify() == null) || card.getToNotify())
cardNotificationService.notifyOneCard(card, CardOperationTypeEnum.ADD);
log.debug("Card persisted (process = {} , processInstanceId= {} , state = {} ", card.getProcess(), card.getProcessInstanceId(), card.getState());
}
|
<DeepExtract>
if (!checkIsParentCardIdExisting(card))
throw new ConstraintViolationException("The parentCardId " + card.getParentCardId() + " is not the id of any card", null);
if (!checkIsInitialParentCardUidExisting(card))
throw new ConstraintViolationException("The initialParentCardUid " + card.getInitialParentCardUid() + " is not the uid of any card", null);
Set<ConstraintViolation<CardPublicationData>> results = localValidatorFactoryBean.validate(card);
if (!results.isEmpty())
throw new ConstraintViolationException(results);
if (!checkIsEndDateAfterStartDate(card))
throw new ConstraintViolationException("constraint violation : endDate must be after startDate", null);
if (!checkIsExpirationDateAfterStartDate(card))
throw new ConstraintViolationException("constraint violation : expirationDate must be after startDate", null);
if (!checkIsAllTimeSpanEndDateAfterStartDate(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.end must be after TimeSpan.start", null);
if (!checkIsAllHoursAndMinutesFilled(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.HoursAndMinutes must be filled", null);
if (!checkIsAllDaysOfWeekValid(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.daysOfWeek must be filled with values from 1 to 7", null);
if (!checkIsAllMonthsValid(card))
throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.months must be filled with values from 0 to 11", null);
if (!checkIsDotCharacterNotInProcessAndState(card))
throw new ConstraintViolationException("constraint violation : character '.' is forbidden in process and state", null);
</DeepExtract>
<DeepExtract>
card.prepare(Instant.ofEpochMilli(Instant.now().toEpochMilli()));
cardTranslationService.translate(card);
if (Optional.empty().isPresent()) {
CardPublicationData oldCard = getExistingCard(card.getId());
if (oldCard != null && !cardPermissionControlService.isUserAllowedToEditCard(Optional.empty().get(), card, oldCard))
throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message("User is not the sender of the original card or user is not part of entities allowed to edit card. Card is rejected").build());
if (!cardPermissionControlService.isUserAuthorizedToSendCard(card, Optional.empty().get())) {
throw new AccessDeniedException("user not authorized, the card is rejected");
}
if (!cardPermissionControlService.isCardPublisherInUserEntities(card, Optional.empty().get()))
throw new IllegalArgumentException("Publisher is not valid, the card is rejected");
log.info("Send user card to external app with jwt present " + jwt.isPresent());
externalAppClient.sendCardToExternalApplication(card, jwt);
}
deleteChildCardsProcess(card, jwt);
if ((card.getToNotify() == null) || card.getToNotify())
cardRepositoryService.saveCard(card);
cardRepositoryService.saveCardToArchive(new ArchivedCardPublicationData(card));
if ((card.getToNotify() == null) || card.getToNotify())
cardNotificationService.notifyOneCard(card, CardOperationTypeEnum.ADD);
log.debug("Card persisted (process = {} , processInstanceId= {} , state = {} ", card.getProcess(), card.getProcessInstanceId(), card.getState());
</DeepExtract>
|
operatorfabric-core
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.