blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21172e43c02a260103015c882415d6d1e0d70090
|
d988416113114b32c3281178ccef34359b35f3f0
|
/app/src/main/java/th/co/thiensurat/toss_installer/utils/Constance.java
|
7349a66b4629fae069d97481c2b830e8ce38db09
|
[] |
no_license
|
tsrmobile/Toss_Installer
|
722a62512ad83994bbc2f508e782d3f672b8caec
|
e9bc0212dc330121b80744393e7d9848eb5563a0
|
refs/heads/master
| 2021-09-15T10:14:07.607379 | 2018-05-30T09:52:01 | 2018-05-30T09:52:03 | 111,386,906 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,760 |
java
|
package th.co.thiensurat.toss_installer.utils;
import android.Manifest;
/**
* Created by teerayut.k on 10/16/2017.
*/
public class Constance {
public static String DBNAME = "toss_installer.sqlite";
public static String TABLE_JOB = "job";
public static String TABLE_ADDRESS = "Address";
public static String TABLE_IMAGE = "image";
public static String TABLE_PRODUCT = "product";
public static String TABLE_INSTALL_ITEM = "install_item";
public static String TABLE_PROVINCE = "Province";
public static String TABLE_DISTRICT = "Amphur";
public static String TABLE_SUB_DISTRICT = "District";
public static String TABLE_STEP = "step";
public static String TABLE_PAYMENT = "payment";
public static String TABLE_DEPOSIT = "deposit";
public static int DB_CURRENT_VERSION = 38;
public static final String STEP_1 = "step_1";
public static final String STEP_2 = "step_2";
public static final String STEP_3 = "step_3";
public static final String STEP_4 = "step_4";
public static final String STEP_5 = "step_5";
public static final String STEP_6 = "step_6";
public static final String STEP_7 = "step_7";
public static final String printContactStatus = "productPrintContact";
public static final String printInstallStatus = "productPrintInstall";
public static String PRODUCT_STATUS_WAIT = "รอการติดตั้ง";
public static String PRODUCT_STATUS_READY = "พร้อมติดตั้ง";
public static String PRODUCT_STATUS_INSTALLED = "ติดตั้งแล้ว";
public static String IMAGE_TYPE_INSTALL = "install";
public static String IMAGE_TYPE_CARD = "card";
public static String IMAGE_TYPE_HOME = "home";
public static String IMAGE_TYPE_CHECKIN = "checkin";
public static int REQUEST_SETTINGS = 1;
public static int REQUEST_CALL_PHONE = 2;
public static int REQUEST_JOB_DETAIL = 3;
public static int REQUEST_BLUETOOTH = 4;
public static int REQUEST_SCAN = 5;
public static int REQUEST_TAKE_PICTURE = 6;
public static int REQUEST_CAMERA = 7;
public static int REQUEST_GALLERY = 8;
public static int REQUEST_CROP_IMAGE = 9;
public static int REQUEST_INSTALLATION = 10;
public static int REQUEST_TAKE_IDCARD = 11;
public static int REQUEST_TAKE_HOME = 12;
public static int REQUEST_EXTERNAL_STORAGE = 13;
public static int REQUEST_CHECKIN_RESULT = 14;
public static int REQUEST_PRINT_CONTRACT = 15;
public static int REQUEST_BLUETOOTH_SETTINGS = 16;
public static int REQUEST_SIGNATURE = 18;
public static int REQUEST_EDIT_DETAIL = 19;
public static int REQUEST_LOCATION = 20;
public static int REQUEST_STEPVIEW= 21;
public static int REQUEST_TIMELINE = 22;
public static int REQUEST_BACKUP = 23;
public static int REQUEST_APP_SETTINGS = 24;
public static int REQUEST_JOB = 25;
public static int REQUEST_IMPORT_ITEM = 26;
public static int REQUEST_ITEM_BALANCE = 27;
public static int REQUEST_PAYMENT = 28;
public static int REQUEST_PAYMENT_PAGE = 29;
public static int REQUEST_PAYMENT_DETAIL = 30;
public static int REQUEST_PAYMENT_ITEM_LIST = 31;
public static int REQUEST_DEPOSTI_CHANNEL = 32;
public static int REQUEST_DEPOSTI = 33;
public static int REQUEST_NEW_DETAIL = 34;
public static int REQUEST_CHOICE_INSTALL = 35;
public static int REQUEST_OLD_INSTALL = 36;
public static int REQUEST_NEW_INSTALL = 37;
public static int REQUEST_DELIVERY = 38;
public static final int REQUEST_PERMISSIONS = 99;
public static final String UUID = "00001101-0000-1000-8000-00805F9B34FB";
public static final String DATEPICKER_TAG = "datepicker";
public static final String KEY_EMPID = "EMPID";
public static final String KEY_TITLE = "TITLE";
public static final String KEY_FIRSTNAME = "FIRSTNAME";
public static final String KEY_LASTNAME = "LASTNAME";
public static final String KEY_POSITION = "POSITION";
public static final String KEY_DEPARTMENT = "DEPARTMENT";
public static final String KEY_EMPLOYEE_TYPE = "EMPLOYEETYPE";
public static final String KEY_SESSION = "SESSION";
public static final String KEY_SERIAL = "SERIAL";
public static final String KEY_PRODUCT_CODE = "PRODUCT_CODE";
public static final String KEY_SORT_ID = "KEY_SORT_ID";
public static final String KEY_SORT_PAYMENT_ID = "KEY_SORT_PAYMENT_ID";
public static final String KEY_CONTNO = "KEY_CONTNO";
public static final String KEY_SERIAL_ITEM = "KEY_SERIAL_ITEM";
//public static final String KEY_PRODUCT_CODE = "KEY_PRODUCT_CODE";
public static final String KEY_CUSTOMER_SIGN_PATH = "KEY_CUSTOMER_SIGN_PATH";
public static final String KEY_ORDER_ID = "KEY_ORDER_ID";
public static final String KEY_JOB_ITEM = "KEY_JOB_ITEM";
public static final String KEY_JOB_ADDR = "KEY_JOB_ADDR";
public static final String KEY_JOB_PRODUCT = "KEY_JOB_PRODUCT";
public static final String KEY_PRODUCT_PAYTYPE = "KEY_PRODUCT_PAYTYPE";
public static final String KEY_PRODUCT_RECEIVE = "KEY_PRODUCT_RECEIVE";
public static final String KEY_CHANNEL = "KEY_CHANNEL";
public static final String KEY_CHANNEL_NAME = "KEY_CHANNEL_NAME";
public static final String KEY_RECEIVER = "KEY_RECEIVER";
public static final String KEY_REF = "KEY_REF";
public static final String KEY_LAT = "KEY_LAT";
public static final String KEY_LON = "KEY_LON";
public static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
public static final String[] PERMISSIONS_LOCATION = {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
};
public static final int BANK_LIMIT = 50000;
public static final int HEAD_OFFICE_LIMIT = 50000;
public static final int COUNTER_SERVICE_LIMIT = 50000;
public static final String[] arrBranch = { "กรุณาเลือกสาขา"
, "สำนักงานใหญ่"
, "สาขานครราชสีมา"
, "สาขาเชียงใหม่"
, "สาขาพิษณุโลก"
, "สาขาชลบุรี"
, "สาขาเพชรบุรี"
, "สาขาระยอง"
, "สาขาราชบุรี"
, "สาขาปราจีนบุรี"
, "สาขาขอนแก่น"
, "สาขานครสวรรค์"
, "สาขาจันทบุรี"
, "สาขานครศรีธรรมราช"
, "สาขาอุบลราชธานี"
, "สาขาอุดรธานี"
, "ศูนย์ร้อยเอ็ด"
, "สาขาสงขลา"
, "สาขาฉะเชิงเทรา"
, "สาขาลพบุรี"
, "สาขานครปฐม"
, "สาขาสมุทรปราการ"
, "สาขาภูเก็ต"
, "สาขาปทุมธานี"
, "สาขาสุราษฎร์"
, "สาขามุกดาหาร"
, "สาขาบุรีรัมย์"
, "สาขาหาดใหญ่"
, "สาขาลำปาง"
, "สาขาเชียงราย"
, "สาขาเพชรบุรณ์"
, "สาขาตรัง"
};
}
|
[
"[email protected]"
] | |
f6618f249f0a8f14f4dd71c9cb789ae105796f89
|
1c04e8c95e1dbbe33ab6f30a2c2de127dbd857ec
|
/TestDB/gen/com/quytech/testdb/BuildConfig.java
|
687a871a6eccf9de1a73046004561101911ae9b4
|
[] |
no_license
|
vishwaverma/TestApp
|
9478fd51488e00574428742ebc083dc584d0af95
|
2e51495c0938f076c6c08939e212b4f9ebb344f9
|
refs/heads/master
| 2021-01-01T15:54:33.087115 | 2015-01-30T17:04:29 | 2015-01-30T17:04:29 | 30,081,351 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 160 |
java
|
/** Automatically generated file. DO NOT MODIFY */
package com.quytech.testdb;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
|
[
"[email protected]"
] | |
7fd755bff48fc9a5f68b75be1838f9f8c1cb4de6
|
793dcfc4632273a70b5dfa3f62b42745d2798b0e
|
/PracticeSet2/app/src/main/java/com/example/harsh/practiceset2/MainActivity.java
|
b4b071106d0cb26c756066dd8c2481aae5bb93c1
|
[] |
no_license
|
abstruse020/Ambulance_app
|
a0610bf4b0d04d7f2f042af135c7dcbffab3e5a9
|
84ab654e1aa81ce3627f00df6b6b735554748df5
|
refs/heads/master
| 2020-06-20T20:05:26.358497 | 2019-07-16T16:36:39 | 2019-07-16T16:36:39 | 197,230,922 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,473 |
java
|
package com.example.harsh.practiceset2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// PASTE CODE YOU WANT TO TEST HERE
int raspberryPrice = 5;
display1("1 box: $" + raspberryPrice);
raspberryPrice = 10;
display2("2 boxes: $" + (raspberryPrice));
display3("3 boxes: $" + (raspberryPrice * 3));
}
/**
* Display methods that allow the text to appear on the screen. Don't worry if you don't know
* how these work yet. We'll be covering them in lesson 3.
*/
public void display(String text) {
TextView t = (TextView) findViewById(R.id.display_text_view);
t.setText(text);
}
public void display(int text) {
TextView t = (TextView) findViewById(R.id.display_text_view);
t.setText(text + "this is the int one");
}
public void display1(String text) {
display(text);
}
public void display2(String text) {
TextView t = (TextView) findViewById(R.id.display_text_view_2);
t.setText(text);
}
public void display3(String text) {
TextView t = (TextView) findViewById(R.id.display_text_view_3);
t.setText(text);
}
}
|
[
"[email protected]"
] | |
c8bdc28c3fc57a06b820a54686493e5233f9c396
|
257dc3ff247a2ac57117de73ee9eecd32a7fbb32
|
/app/src/main/java/com/example/javachat/MessageActivity.java
|
1c85f52372ca5d99ca56f0365b579c2c645a4748
|
[] |
no_license
|
volkankahraman/JavaChat
|
ed358b15ffc2a58b725c259f98c35a79d856a292
|
d8ee5c10b272b3e16f437969f22002cdc4416db2
|
refs/heads/master
| 2020-09-24T05:11:17.092934 | 2019-12-22T17:08:52 | 2019-12-22T17:08:52 | 225,670,695 | 1 | 0 | null | 2019-12-08T16:35:52 | 2019-12-03T16:50:51 |
Java
|
UTF-8
|
Java
| false | false | 8,724 |
java
|
package com.example.javachat;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.example.javachat.Adapter.MessageAdapter;
import com.example.javachat.Fragments.APIService;
import com.example.javachat.Model.Chat;
import com.example.javachat.Model.User;
import com.example.javachat.Notifications.Client;
import com.example.javachat.Notifications.Data;
import com.example.javachat.Notifications.MyResponse;
import com.example.javachat.Notifications.Sender;
import com.example.javachat.Notifications.Token;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MessageActivity extends AppCompatActivity {
CircleImageView profile_image;
TextView username;
ImageButton btnSend;
EditText text_send;
MessageAdapter messageAdapter;
List<Chat> mChat;
RecyclerView recyclerView;
FirebaseUser firebaseUser;
DatabaseReference reference;
String userid;
Intent intent;
APIService apiService;
boolean notify = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
apiService = Client.getClient("https://fcm.googleapis.com/").create(APIService.class);
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
linearLayoutManager.setStackFromEnd(true);
recyclerView.setLayoutManager(linearLayoutManager);
profile_image = findViewById(R.id.profile_image);
username = findViewById(R.id.username);
text_send = findViewById(R.id.textSend);
btnSend = findViewById(R.id.btnSend);
intent = getIntent();
final String userid = intent.getStringExtra("userid");
firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notify = true;
String msg = text_send.getText().toString();
if(!msg.equals("")){
sendMessage(firebaseUser.getUid(), userid, msg);
}else{
Toast.makeText(MessageActivity.this, "Boş mesaj yollayamazsın!", Toast.LENGTH_SHORT).show();
}
text_send.setText("");
}
});
reference = FirebaseDatabase.getInstance().getReference("Users").child(userid);
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
User user = dataSnapshot.getValue(User.class);
username.setText(user.getUsername());
if(user.getImageUrl().equals("default")){
profile_image.setImageResource(R.mipmap.ic_launcher);
}else{
Glide.with(MessageActivity.this).load(user.getImageUrl()).into(profile_image);
}
readMessages(firebaseUser.getUid(), userid, user.getImageUrl());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void sendMessage(String sender, final String receiver, String message){
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("sender", sender);
hashMap.put("receiver", receiver);
hashMap.put("message", message);
reference.child("Chats").push().setValue(hashMap);
final String msg = message;
reference = FirebaseDatabase.getInstance().getReference("Users").child(firebaseUser.getUid());
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
User user = dataSnapshot.getValue(User.class);
if (notify){
SendNotification(receiver,user.getUsername(),msg);
}
notify = false;
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void SendNotification(String receiver, final String username, final String msg){
DatabaseReference tokens = FirebaseDatabase.getInstance().getReference("tokens");
Query query = tokens.orderByKey().equalTo(receiver);
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot snapshot: dataSnapshot.getChildren()){
Token token = snapshot.getValue(Token.class);
Data data = new Data(firebaseUser.getUid(),R.mipmap.ic_launcher,username+":"+msg,"Yeni Mesaj",
userid
);
Sender sender = new Sender(data, token.getToken());
apiService.sendNotification(sender)
.enqueue(new Callback<MyResponse>() {
@Override
public void onResponse(Call<MyResponse> call, Response<MyResponse> response) {
if (response.code() == 200){
if (response.body().succes == 1){
Toast.makeText(MessageActivity.this, "Hata!", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onFailure(Call<MyResponse> call, Throwable t) {
}
});
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void readMessages(final String myId, final String userId, final String imageURL){
mChat = new ArrayList<>();
reference = FirebaseDatabase.getInstance().getReference("Chats");
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
mChat.clear();
for (DataSnapshot snapshot: dataSnapshot.getChildren()){
Chat chat = snapshot.getValue(Chat.class);
if(chat.getReceiver().equals(myId) && chat.getSender().equals(userId) || chat.getReceiver().equals(userId) &&
chat.getSender().equals(myId)){
mChat.add(chat);
}
messageAdapter = new MessageAdapter(MessageActivity.this, mChat, imageURL);
recyclerView.setAdapter(messageAdapter);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
|
[
"[email protected]"
] | |
e8ef6ccd142677f682c902534bd26229c8d1fade
|
272f86a208e49678c8eee3b232b6ba2cf10a9a68
|
/CameraTest/app/src/main/java/com/example/morrisvanegas/cameratest/MainActivity.java
|
0be51dfbd3f6931ef09e952f0cbe79e885483a2b
|
[] |
no_license
|
morrisvanegas/RedHairingAndroidApp
|
d43789204308d9d5545e336c7b92d9989846b22e
|
f5da0c0cc7c1bd83f0eb7460cda010dd93acd5a7
|
refs/heads/master
| 2021-01-10T06:08:21.342913 | 2016-12-21T16:39:22 | 2016-12-21T16:39:22 | 54,177,357 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,231 |
java
|
package com.example.morrisvanegas.cameratest;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.hardware.Camera;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.os.Handler;
import android.widget.ImageView;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MainActivity extends Activity {
private Camera mCamera = null;
private CameraView mCameraView = null;
//Image stuff
private Integer images[] = {R.drawable.scary2, R.drawable.scary2};
private int currImage = 1;
//Photo stuff
static final int REQUEST_IMAGE_CAPTURE = 1;
static final int REQUEST_TAKE_PHOTO = 1;
String mCurrentPhotoPath;
//Wait 5 seconds with black bg
private Handler mHandler = new Handler();
//sound
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MediaPlayer mediaPlayer = MediaPlayer.create(MainActivity.this, R.raw.horror);
mediaPlayer.start(); // no need to call prepare(); create() does that for you
mHandler.postDelayed(new Runnable() {
public void run() {
displayImage();
//doStuff();
MediaPlayer mp = MediaPlayer.create(MainActivity.this, R.raw.scream);
mp.start(); // no need to call prepare(); create() does that for you
//takePhoto();
}
}, 20000);
}
private void displayImage(){
final ImageView imageView = (ImageView) findViewById(R.id.imageDisplay);
imageView.setImageResource(images[currImage]);
mHandler.postDelayed(new Runnable() {
public void run() {
//imageView.setImageResource(0);
imageView.setVisibility(View.GONE);
}
}, 3000);
}
private void takePhoto(){
dispatchTakePictureIntent();
}
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File
}
// Continue only if the File was successfully created
if (photoFile != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
final ImageView imageView = (ImageView) findViewById(R.id.imageDisplay);
imageView.setImageBitmap(imageBitmap);
}
}
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName,
".jpg",
storageDir
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = "file:" + image.getAbsolutePath();
return image;
}
private void doStuff(){
try {
mCamera = Camera.open(1);//you can use open(int) to use different cameras
} catch (Exception e) {
Log.d("ERROR", "Failed to get camera: " + e.getMessage());
}
if (mCamera != null) {
mCameraView = new CameraView(this, mCamera);//create a SurfaceView to show camera data
FrameLayout camera_view = (FrameLayout) findViewById(R.id.camera_view);
camera_view.addView(mCameraView);//add the SurfaceView to the layout
}
//btn to close the application
ImageButton imgClose = (ImageButton) findViewById(R.id.imgClose);
imgClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
System.exit(0);
}
});
}
}
|
[
"[email protected]"
] | |
7fddd86234b5f242cfba0ba8648c9e0ef88868d6
|
21ca26dabb9029873af227d4a67e8e01329a4b07
|
/MGateway/src/main/java/com/septemberhx/mgateway/routing/MPathRquest.java
|
44c5444470536e1dea90889dd92b4856d3bc4c0e
|
[] |
no_license
|
HITliulei/MSystemEvolution
|
b34089e0fab052d228f002fc8b0f79d42c053d2b
|
fb3da4351d5d77b37e03c5cafb6d58d44a24265f
|
refs/heads/master
| 2023-06-09T08:54:08.605286 | 2021-06-29T13:01:56 | 2021-06-29T13:01:56 | 266,460,916 | 0 | 0 | null | 2020-05-27T06:57:05 | 2020-05-24T03:13:50 |
Java
|
UTF-8
|
Java
| false | false | 6,952 |
java
|
package com.septemberhx.mgateway.routing;
import com.septemberhx.common.bean.agent.MInstanceInfoBean;
import com.septemberhx.common.bean.instance.MDeployVersion;
import com.septemberhx.common.service.MService;
import com.septemberhx.common.service.MSvcVersion;
import com.septemberhx.common.service.dependency.BaseSvcDependency;
import com.septemberhx.mgateway.client.ConnectToCenter;
import com.septemberhx.mgateway.client.ConnectToClient;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* Created by Lei on 2019/12/18 15:42
*/
@Component
public class MPathRquest {
private static Logger logger = LogManager.getLogger(MPathRquest.class);
public List<MInstanceInfoBean> getExammpleByVersion(ConnectToCenter connectToCenter,ConnectToClient connectToClient,String serviceId, String requestVersion, String requestname, String hostIp ){
String node = connectToCenter.getNode(hostIp, serviceId);
List<MInstanceInfoBean> result = new ArrayList<>();
List<MInstanceInfoBean> localResult = new ArrayList<>();
String requestServiceId = requestname + "_" + requestVersion;
List<MInstanceInfoBean> mInstanceInfoBeans = connectToClient.instanceInfoListByNameAndVersion(requestServiceId).getInfoBeanList();
if(!mInstanceInfoBeans.isEmpty()){
for(MInstanceInfoBean mInstanceInfoBean: mInstanceInfoBeans){
String dependencyNode =mInstanceInfoBean.getDockerInfo().getNodeLabel();
if(dependencyNode.equals(node)){
localResult.add(mInstanceInfoBean);
}else{
result.add(mInstanceInfoBean);
}
}
}
if(localResult.isEmpty()){
if(result.isEmpty()){
System.out.println("没有满足的实例,进行部署");
List<String> nodeList = new ConnectToClient().getAllNode();
MDeployVersion mDeployVersion = new MDeployVersion(requestname, requestVersion, nodeList.get(new Random().nextInt(nodeList.size())));
connectToCenter.deployOneInstance(mDeployVersion);
System.out.println("部署成功,可以在再次进行部署");
return null;
}else{
return result;
}
}
return localResult;
}
public List<MInstanceInfoBean> getExammpleByWithoutVersion(ConnectToCenter connectToCenter,ConnectToClient connectToClient, String serviceName, String serviceVersion, String requestURI , String hostIp){
String node = connectToCenter.getNode(hostIp, serviceName+"_"+serviceVersion);
String requstName = requestURI.split("/")[1];
System.out.println("没有版本请求的微服务名称为" + requstName);
String request = requestURI.replaceFirst("/"+requstName,"");
if(request.contains("\\?")){
request = request.split("\\?")[0];
}
Set<MSvcVersion> versionsFor = new HashSet<>();
if(serviceVersion != null && serviceName!= null){
MService mService = connectToCenter.getServiceByNameAndVersion(serviceName,serviceVersion);
Map<String,Map<String, BaseSvcDependency>> map = mService.getMSvcDepDesc().getDependencyMaps();
for(String dependencyName:map.keySet()){
Map<String, BaseSvcDependency> baseSvcDependencyMap = map.get(dependencyName);
for(String dependencyId:baseSvcDependencyMap.keySet()){
BaseSvcDependency baseSvcDependency = baseSvcDependencyMap.get(dependencyId);
if(baseSvcDependency.getServiceName()!=null
&& requstName.equalsIgnoreCase(baseSvcDependency.getServiceName())
&& request.contains(baseSvcDependency.getPatternUrl())){
if(baseSvcDependency.getVersionSet()!=null){
versionsFor.addAll(baseSvcDependency.getVersionSet());
}else{
versionsFor.addAll(getVersionByPath(connectToCenter, requstName, request));
}
}
}
}
}else{ //客户端请求 寻找可实行的版本
versionsFor.addAll(getVersionByPath(connectToCenter, requstName,request));
}
Set<String> versions = new HashSet<>();
for(MSvcVersion mSvcVersion:versionsFor){
versions.add(mSvcVersion.toString());
}
System.out.println("可行的版本集合为" + versions);
List<MInstanceInfoBean> result = new ArrayList<>();
List<MInstanceInfoBean> localResult = new ArrayList<>();
List<MInstanceInfoBean> mInstanceInfoBeans = connectToClient.getListInstanceInfoByName(requstName).getInfoBeanList();
if(!mInstanceInfoBeans.isEmpty()){
for(MInstanceInfoBean mInstanceInfoBean:mInstanceInfoBeans){
if(versions.contains(MSvcVersion.fromStr(mInstanceInfoBean.getServiceVersion()).toString())){
String requestNode = mInstanceInfoBean.getDockerInfo().getNodeLabel();
if(requestNode.equals(node)){
localResult.add(mInstanceInfoBean);
}else{
result.add(mInstanceInfoBean);
}
}
}
}
if(localResult.isEmpty()){
if(result.isEmpty()){
System.out.println("没有满足的实例,进行部署");
List<String> nodeList = new ConnectToClient().getAllNode();
MDeployVersion mDeployVersion = new MDeployVersion(requstName, versions.toArray()[0].toString(), nodeList.get(new Random().nextInt(nodeList.size())));
connectToCenter.deployOneInstance(mDeployVersion);
System.out.println("部署成功,可以在再次进行部署");
return null;
}
return result;
}
return localResult;
}
public Set<MSvcVersion> getVersionByPath(ConnectToCenter connectToCenter,String requestName, String request){
System.out.println("寻找可行的版本" + request);
Set<MSvcVersion> set = new HashSet<>();
List<MService> list = connectToCenter.getServiceByName(requestName);
for(MService mService :list){
if(mService.getServiceName().equalsIgnoreCase(requestName)){
for(String string: mService.getServiceInterfaceMap().keySet()){
System.out.println("测试的接口为" + string);
if(request.contains(string)){
set.add(mService.getServiceVersion());
break;
}
}
}
}
return set;
}
}
|
[
"[email protected]"
] | |
73a7615bd294c3843bedd51e505dd7f5024f3c39
|
2edb7a53cb48ab884ec354816674aad393e811fc
|
/SAXParsingExample/src/com/technotalkative/saxparsing/adapter/myAdapter.java
|
91b281a2b1afae30377e8c4a5aa1da1e30383d36
|
[] |
no_license
|
kisekiymah/Android-SAX-Parsing
|
014f9d935155588b7350b320cca797ae860183ff
|
3a23d6891fe50232b0cd1d8dc9ec221676101454
|
refs/heads/master
| 2021-01-16T08:54:51.910790 | 2013-04-14T17:00:02 | 2013-04-14T17:00:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,192 |
java
|
package com.technotalkative.saxparsing.adapter;
import java.util.ArrayList;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.technotalkative.saxparsing.R;
public class myAdapter extends BaseAdapter
{
ArrayList<String> listItem;
ArrayList<String> listManufacturer;
ArrayList<String> listModel;
ArrayList<String> listCost;
Activity activity;
public myAdapter(Activity activity, ArrayList<String> listItem,ArrayList<String> listManufacturer,
ArrayList<String> listModel, ArrayList<String> listCost) {
super();
this.listItem = listItem;
this.listManufacturer = listManufacturer;
this.listModel = listModel;
this.listCost = listCost;
this.activity = activity;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return listItem.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
private class ViewHolder
{
TextView txtViewItem;
TextView txtViewManu;
TextView txtViewModel;
TextView txtViewCost;
}
@Override
public View getView(int position, View view, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder item;
LayoutInflater inflater = activity.getLayoutInflater();
if(view==null)
{
view = inflater.inflate(R.layout.lview_row, null);
item = new ViewHolder();
item.txtViewItem = (TextView) view.findViewById(R.id.txtItem);
item.txtViewManu = (TextView) view.findViewById(R.id.txtManufacturer);
item.txtViewModel = (TextView) view.findViewById(R.id.txtModel);
item.txtViewCost = (TextView) view.findViewById(R.id.txtCost);
view.setTag(item);
}
else
{
item = (ViewHolder) view.getTag();
}
item.txtViewItem.setText(listItem.get(position));
item.txtViewManu.setText(listManufacturer.get(position));
item.txtViewModel.setText(listModel.get(position));
item.txtViewCost.setText(listCost.get(position));
return view;
}
}
|
[
"[email protected]"
] | |
443eb860d7ab05a76c44511aaebf8afaf91578f3
|
0a75a84e8e9d8962d94341e63e3a4e3526cd5feb
|
/ClassesConstructors/Person/src/App.java
|
5322b34b7b65957d1a8a35e3ca602ddcce23913f
|
[] |
no_license
|
Rhysoshea/learning_java
|
be612c421afda73d1cff178905f67d7e4ad08178
|
3e7ba9302560887859d4f9ff9f04e752ba101745
|
refs/heads/master
| 2023-06-16T07:58:26.626818 | 2021-07-08T07:50:17 | 2021-07-08T07:50:17 | 293,044,542 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 756 |
java
|
public class App {
public static void main(String[] args) throws Exception {
Person person = new Person();
person.setFirstName(""); // firstName is set to empty string
person.setLastName(""); // lastName is set to empty string
person.setAge(10);
System.out.println("fullName= " + person.getFullName());
System.out.println("teen= " + person.isTeen());
person.setFirstName("John"); // firstName is set to John
person.setAge(18);
System.out.println("fullName= " + person.getFullName());
System.out.println("teen= " + person.isTeen());
person.setLastName("Smith"); // lastName is set to Smith
System.out.println("fullName= " + person.getFullName());
}
}
|
[
"[email protected]"
] | |
fda12161c489c9b2f59749db5b34a51ff86893e8
|
eb8d0ddf2cf278afd25d8749ab77c3ad52a70000
|
/src/App/MenuAdministrateur.java
|
9022ee6c90aaa35c9af98a7330644ffb13d0de89
|
[] |
no_license
|
imadfouad/GestionLocation
|
42c609a91947675bd07531e766b371b304b7b991
|
66248aebd778e6f63c1045a63a017ce58ec89b67
|
refs/heads/master
| 2022-08-02T07:42:03.876585 | 2020-05-31T10:21:39 | 2020-05-31T10:21:39 | 268,255,754 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,929 |
java
|
package App;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.Font;
public class MenuAdministrateur extends JFrame {
private JPanel contentPane;
Connection cnx = null ;
ResultSet resultat = null;
PreparedStatement prepared = null;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MenuAdministrateur frame = new MenuAdministrateur();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MenuAdministrateur() {
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 1000, 500);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel_2 = new JLabel("Utilisateurs");
lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_2.setBounds(307, 197, 89, 14);
contentPane.add(lblNewLabel_2);
JLabel lblNewLabel_3 = new JLabel("Clients");
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_3.setBounds(458, 197, 53, 14);
contentPane.add(lblNewLabel_3);
JLabel lblNewLabel_4 = new JLabel("V\u00E9hicules");
lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_4.setBounds(584, 198, 72, 14);
contentPane.add(lblNewLabel_4);
JLabel lblNewLabel_5 = new JLabel("R\u00E9servations");
lblNewLabel_5.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_5.setBounds(306, 318, 90, 14);
contentPane.add(lblNewLabel_5);
JLabel lblNewLabel_6 = new JLabel("Contrats");
lblNewLabel_6.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_6.setBounds(449, 317, 74, 14);
contentPane.add(lblNewLabel_6);
JLabel lblNewLabel_7 = new JLabel("Factures");
lblNewLabel_7.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_7.setBounds(591, 317, 68, 14);
contentPane.add(lblNewLabel_7);
JLabel lblNewLabel_8 = new JLabel("Parkings");
lblNewLabel_8.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_8.setBounds(317, 442, 65, 14);
contentPane.add(lblNewLabel_8);
JLabel lblNewLabel_9 = new JLabel("Sanctions");
lblNewLabel_9.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_9.setBounds(454, 442, 65, 14);
contentPane.add(lblNewLabel_9);
JLabel lblNewLabel_10 = new JLabel("Statistiques");
lblNewLabel_10.setFont(new Font("Tahoma", Font.BOLD, 12));
lblNewLabel_10.setBounds(580, 442, 88, 14);
contentPane.add(lblNewLabel_10);
JButton btnNewButton = new JButton("");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionClients obj = new GestionClients();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\Your-Consulting-Client-Avatar-Customer-Profile-Template-A.jpg"));
btnNewButton.setBounds(425, 91, 110, 105);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
VerificationAdmin obj = new VerificationAdmin();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_1.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\unnamed (3).png"));
btnNewButton_1.setBounds(286, 91, 110, 105);
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("");
btnNewButton_2.setBackground(Color.WHITE);
btnNewButton_2.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\icon-voiture-lrg.png"));
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionVehicules obj = new GestionVehicules();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_2.setBounds(558, 91, 110, 105);
contentPane.add(btnNewButton_2);
JButton btnNewButton_3 = new JButton("");
btnNewButton_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionReservations obj = new GestionReservations();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_3.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\Capture.PNG"));
btnNewButton_3.setBackground(Color.WHITE);
btnNewButton_3.setBounds(286, 212, 110, 105);
contentPane.add(btnNewButton_3);
JButton btnNewButton_4 = new JButton("");
btnNewButton_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionContrats obj = new GestionContrats();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_4.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\depositphotos_61121081-stock-illustration-agreement-icon-contract.jpg"));
btnNewButton_4.setBounds(425, 212, 110, 105);
contentPane.add(btnNewButton_4);
JButton btnNewButton_5 = new JButton("");
btnNewButton_5.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\Icon_47-512.png"));
btnNewButton_5.setBounds(558, 333, 110, 105);
contentPane.add(btnNewButton_5);
JButton btnNewButton_6 = new JButton("");
btnNewButton_6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionParkings obj = new GestionParkings();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_6.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\12827711_1_1_190104_064612-w417-h417.jpg"));
btnNewButton_6.setBounds(286, 333, 110, 105);
contentPane.add(btnNewButton_6);
JButton btnNewButton_7 = new JButton("");
btnNewButton_7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionSanctions obj = new GestionSanctions();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_7.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\GDPR_32-512.png"));
btnNewButton_7.setBounds(425, 331, 110, 105);
contentPane.add(btnNewButton_7);
JButton btnNewButton_8 = new JButton("");
btnNewButton_8.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionFactures obj = new GestionFactures();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
dispose();
}
});
btnNewButton_8.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\invoice-vector-icon (1).jpg"));
btnNewButton_8.setBounds(558, 212, 110, 105);
contentPane.add(btnNewButton_8);
JLabel lblNewLabel_1 = new JLabel("");
lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\Titre.jpg"));
lblNewLabel_1.setBounds(0, 0, 1000, 80);
contentPane.add(lblNewLabel_1);
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon("C:\\Users\\gamer\\Desktop\\Gestion location\\content-e1472587975551.jpg"));
lblNewLabel.setBounds(5, 5, 974, 451);
contentPane.add(lblNewLabel);
cnx = ConnexionMysql.ConnexionDb();
}
}
|
[
"[email protected]"
] | |
78412f78504b48d5f079057bc295f950c1cdd434
|
8aa0e14dcd48acc2f11b187fd9d18f0d45673d92
|
/src/test/java/com/autodesk/crm/organization/DeleteOrganization_POM.java
|
766557e16ace470f97a32e3317168b6b7edbc69c
|
[] |
no_license
|
manasgupta017/autodesk_maven_project
|
34e02209518b32d99edc6a8dcccac185f7f5903d
|
b0c362e51b6a89309d5b0665ad18de01ec34dc53
|
refs/heads/master
| 2021-07-12T11:02:23.652814 | 2020-03-10T05:47:49 | 2020-03-10T05:47:49 | 244,305,855 | 0 | 0 | null | 2021-04-26T20:00:41 | 2020-03-02T07:20:59 |
Java
|
UTF-8
|
Java
| false | false | 748 |
java
|
package com.autodesk.crm.organization;
import java.io.IOException;
import org.apache.poi.EncryptedDocumentException;
import org.testng.annotations.Test;
import com.autodesk.crm.features.LoginFeature;
import com.autodesk.crm.features.OrganizationFeature;
import com.vtiger.crm.generics.BaseLib;
public class DeleteOrganization_POM extends BaseLib
{
@Test
public void selectParticularNameDelete() throws EncryptedDocumentException, IOException
{
LoginFeature lf = new LoginFeature(driver);
lf.login();
lf.verifyHomePage();
OrganizationFeature of = new OrganizationFeature(driver);
of.clickOnOrganization();
of.verifyOrgPage();
of.searchForCompanyAccToOrganizationName();
of.deleteOrganization();
of.verifyDelOrg();
}
}
|
[
"[email protected]"
] | |
d52dae6ae696827aab904ea664b218690adfb7d8
|
ead787338790624598696d450ab10267aae69ca1
|
/master-lambda/LambdaExpression/ref/WorkInter.java
|
ca7ee3bb458365ad27bdade19f8031c4d8153cf3
|
[] |
no_license
|
akashfit2max/learnings
|
9ae156cdeead296e7c6923dd59436fbfe37817c9
|
3e45f3599ac55c030b22bc502e5536273b3d88bf
|
refs/heads/lambda_expression
| 2023-08-23T23:46:21.319992 | 2021-10-29T05:35:50 | 2021-10-29T05:35:50 | 400,572,679 | 0 | 0 | null | 2021-08-29T05:33:49 | 2021-08-27T16:32:07 |
Java
|
UTF-8
|
Java
| false | false | 157 |
java
|
package ref;
@FunctionalInterface
public interface WorkInter {
// ye banai h bss lambda function dikhane k lie
public abstract void doTask();
}
|
[
"akash@LAPTOP-8F3BRJOB"
] |
akash@LAPTOP-8F3BRJOB
|
badfcaa7df5844253beff15950467e3a3311fb31
|
57b2b56b29463272541b9c8374d0433ca11344fb
|
/together/src/dig/GetClassHierarchyNodeByID.java
|
297ec41c96e924e61e3f1f75a868105fcad52f36
|
[] |
no_license
|
sesuncedu/owl1-1
|
0e827c23a4882e90cbe354d9a94351baf049d9a5
|
73b9957feb3eaead5359e08e9684004367f1b6e7
|
refs/heads/master
| 2021-01-10T20:57:36.522369 | 2013-05-01T08:49:58 | 2013-05-01T08:49:58 | 41,332,137 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 249 |
java
|
/* Generated by Together */
package dig;
import owl.*;
public class GetClassHierarchyNodeByID extends RequestToOntology {
/**
* @supplierCardinality 1
* @clientRole nodeID
* @directed*/
public String nodeID;
}
|
[
"borismotik@c762a732-0a2c-0410-af75-4186e90c83c4"
] |
borismotik@c762a732-0a2c-0410-af75-4186e90c83c4
|
c3ec47f1e02280e2b07a1cc6b4ef0d85cf06fea6
|
fe49198469b938a320692bd4be82134541e5e8eb
|
/scenarios/web/large/gradle/ClassLib001/src/main/java/ClassLib001/Class077.java
|
8849f67c034d8a11c47134fdf9b3470b5e9f52dd
|
[] |
no_license
|
mikeharder/dotnet-cli-perf
|
6207594ded2d860fe699fd7ef2ca2ae2ac822d55
|
2c0468cb4de9a5124ef958b315eade7e8d533410
|
refs/heads/master
| 2022-12-10T17:35:02.223404 | 2018-09-18T01:00:26 | 2018-09-18T01:00:26 | 105,824,840 | 2 | 6 | null | 2022-12-07T19:28:44 | 2017-10-04T22:21:19 |
C#
|
UTF-8
|
Java
| false | false | 122 |
java
|
package ClassLib001;
public class Class077 {
public static String property() {
return "ClassLib001";
}
}
|
[
"[email protected]"
] | |
571da8c456ff5d10dfdd68ac333272bab0bca9d4
|
ea381a48234048900f7f6d7063b2607f6e3b7d63
|
/src/main/java/com/lapool/data/fb/FBSummary.java
|
37cb009dfe1cd6b08e2362c29779ed2525cf1d53
|
[
"MIT"
] |
permissive
|
akshat666/lapool_core
|
42bdd0ee0aa3ffb9de03f646f67e9edcfe21d7ab
|
5550b3dcdedb7c5b2a91d8144ab5a8a517c0e0a6
|
refs/heads/master
| 2023-03-06T12:58:21.414871 | 2023-02-25T20:48:44 | 2023-02-25T20:48:44 | 280,853,428 | 0 | 0 |
MIT
| 2023-02-25T20:46:45 | 2020-07-19T11:41:51 |
Java
|
UTF-8
|
Java
| false | false | 494 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.lapool.data.fb;
/**
*
* @author akshat
*/
public class FBSummary {
private String total_count;
public String getTotal_count() {
return total_count;
}
public void setTotal_count(String total_count) {
this.total_count = total_count;
}
}
|
[
"[email protected]"
] | |
d8cc40aeaf7131cbfe045f30722a549f1b81ff29
|
89db86937d8ff7e2b823119b929c78c64028b503
|
/src/main/java/Fundamentals/Collections/SortComparator.java
|
d2090d8637fa9c96b127931f5937531b17107c25
|
[] |
no_license
|
owel09/JavaPractice
|
2ea8e959cce10ae96164095b716bbe8128061ca0
|
53a26ee5327e2529ea86376cc9441d94fe57f798
|
refs/heads/master
| 2023-09-02T10:08:18.045431 | 2021-10-28T09:55:42 | 2021-10-28T09:55:42 | 332,353,276 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,462 |
java
|
package Fundamentals.Collections;/*
*Created by owel on 27/12/2019 7:01 AM
*Comparator - yung magdedefine ng logic kung paano sila magsosort
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class SortComparator {
public static void main(String[] args) {
List<Integer> owelList = new ArrayList<>();
owelList.add(785);
owelList.add(234);
owelList.add(451);
owelList.add(343);
owelList.add(452);
System.out.println(owelList);
System.out.println("--------------------------------");
//NORMAL SORTING USING THE LIST
//Gumamit ako ng Collections class na may sort method
Collections.sort(owelList);
//enhanced for loop para maprint siya na walang braces at pababa
for(int i : owelList){
System.out.println(i);
}
System.out.println("--------------------------------");
//SORTING THE LAST DIGIT USING COMPARATOR AND MODULUS
Comparator<Integer> integerComparator = new ComparatorImple();
/*
declaring Comparator Interface para maging class at maging object
kailangan gumawa ka ng class CompImple tapos dun mo Implement yun mga
methods ng comparator
*/
Collections.sort(owelList,integerComparator);
for(int x : owelList){
System.out.println(x);
}
}
}
|
[
"[email protected]"
] | |
087bbb23b36f7e8be6d73b1c5eb7f5784d20a67e
|
087a323a957546b120959a29d90f6e4e70e8b89c
|
/app/java/net/openid/appauthdemo/TokenActivity.java
|
6aed545a0e89e72df9ce6f4b21d4ee4f4bbe497e
|
[
"Apache-2.0"
] |
permissive
|
profiq/dynepic-android-app
|
e4607bafb2c1aa98d6b40edbf1c679d549a0f2dc
|
0b11514edfca42e142da3f19e465c388531cf3a5
|
refs/heads/master
| 2020-03-24T07:20:19.638625 | 2019-10-19T12:19:55 | 2019-10-19T12:19:55 | 142,561,443 | 0 | 0 |
Apache-2.0
| 2019-10-19T12:19:56 | 2018-07-27T10:06:54 |
Java
|
UTF-8
|
Java
| false | false | 19,538 |
java
|
/*
* Copyright 2015 The AppAuth for Android Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openid.appauthdemo;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.MainThread;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import net.openid.appauth.AppAuthConfiguration;
import net.openid.appauth.AuthState;
import net.openid.appauth.AuthorizationException;
import net.openid.appauth.AuthorizationResponse;
import net.openid.appauth.AuthorizationService;
import net.openid.appauth.AuthorizationServiceDiscovery;
import net.openid.appauth.ClientAuthentication;
import net.openid.appauth.ClientSecretPost;
import net.openid.appauth.TokenRequest;
import net.openid.appauth.TokenResponse;
import org.joda.time.format.DateTimeFormat;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;
import okio.Okio;
/**
* Displays the authorized state of the user. This activity is provided with the outcome of the
* authorization flow, which it uses to negotiate the final authorized state,
* by performing an authorization code exchange if necessary. After this, the activity provides
* additional post-authorization operations if available, such as fetching user info and refreshing
* access tokens.
*/
public class TokenActivity extends AppCompatActivity {
private static final String TAG = "TokenActivity";
private static final String KEY_USER_INFO = "userInfo";
private AuthorizationService mAuthService;
private AuthStateManager mStateManager;
private final AtomicReference<JSONObject> mUserInfoJson = new AtomicReference<>();
private ExecutorService mExecutor;
private Configuration mConfiguration;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mStateManager = AuthStateManager.getInstance(this);
mExecutor = Executors.newSingleThreadExecutor();
mConfiguration = Configuration.getInstance(this);
Configuration config = Configuration.getInstance(this);
if (config.hasConfigurationChanged()) {
Toast.makeText(
this,
"Configuration change detected",
Toast.LENGTH_SHORT)
.show();
signOut();
return;
}
mAuthService = new AuthorizationService(
this,
new AppAuthConfiguration.Builder()
.setConnectionBuilder(config.getConnectionBuilder())
.build());
setContentView(R.layout.activity_token);
displayLoading("Restoring state...");
if (savedInstanceState != null) {
try {
mUserInfoJson.set(new JSONObject(savedInstanceState.getString(KEY_USER_INFO)));
} catch (JSONException ex) {
Log.e(TAG, "Failed to parse saved user info JSON, discarding", ex);
}
}
}
@Override
protected void onStart() {
super.onStart();
if (mExecutor.isShutdown()) {
mExecutor = Executors.newSingleThreadExecutor();
}
if (mStateManager.getCurrent().isAuthorized()) {
displayAuthorized();
return;
}
// the stored AuthState is incomplete, so check if we are currently receiving the result of
// the authorization flow from the browser.
AuthorizationResponse response = AuthorizationResponse.fromIntent(getIntent());
AuthorizationException ex = AuthorizationException.fromIntent(getIntent());
if (response != null || ex != null) {
mStateManager.updateAfterAuthorization(response, ex);
}
if (response != null && response.authorizationCode != null) {
// authorization code exchange is required
mStateManager.updateAfterAuthorization(response, ex);
exchangeAuthorizationCode(response);
} else if (ex != null) {
displayNotAuthorized("Authorization flow failed: " + ex.getMessage());
} else {
displayNotAuthorized("No authorization state retained - reauthorization required");
}
}
@Override
protected void onSaveInstanceState(Bundle state) {
super.onSaveInstanceState(state);
// user info is retained to survive activity restarts, such as when rotating the
// device or switching apps. This isn't essential, but it helps provide a less
// jarring UX when these events occur - data does not just disappear from the view.
if (mUserInfoJson.get() != null) {
state.putString(KEY_USER_INFO, mUserInfoJson.toString());
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mAuthService.dispose();
mExecutor.shutdownNow();
}
@MainThread
private void displayNotAuthorized(String explanation) {
findViewById(R.id.not_authorized).setVisibility(View.VISIBLE);
findViewById(R.id.authorized).setVisibility(View.GONE);
findViewById(R.id.loading_container).setVisibility(View.GONE);
((TextView)findViewById(R.id.explanation)).setText(explanation);
findViewById(R.id.reauth).setOnClickListener((View view) -> signOut());
}
@MainThread
private void displayLoading(String message) {
findViewById(R.id.loading_container).setVisibility(View.VISIBLE);
findViewById(R.id.authorized).setVisibility(View.GONE);
findViewById(R.id.not_authorized).setVisibility(View.GONE);
((TextView)findViewById(R.id.loading_description)).setText(message);
}
@MainThread
private void displayAuthorized() {
findViewById(R.id.authorized).setVisibility(View.VISIBLE);
findViewById(R.id.not_authorized).setVisibility(View.GONE);
findViewById(R.id.loading_container).setVisibility(View.GONE);
AuthState state = mStateManager.getCurrent();
TextView refreshTokenInfoView = (TextView) findViewById(R.id.refresh_token_info);
refreshTokenInfoView.setText((state.getRefreshToken() == null)
? R.string.no_refresh_token_returned
: R.string.refresh_token_returned);
TextView idTokenInfoView = (TextView) findViewById(R.id.id_token_info);
idTokenInfoView.setText((state.getIdToken()) == null
? R.string.no_id_token_returned
: R.string.id_token_returned);
TextView accessTokenInfoView = (TextView) findViewById(R.id.access_token_info);
if (state.getAccessToken() == null) {
accessTokenInfoView.setText(R.string.no_access_token_returned);
} else {
Long expiresAt = state.getAccessTokenExpirationTime();
if (expiresAt == null) {
accessTokenInfoView.setText(R.string.no_access_token_expiry);
} else if (expiresAt < System.currentTimeMillis()) {
accessTokenInfoView.setText(R.string.access_token_expired);
} else {
String template = getResources().getString(R.string.access_token_expires_at);
accessTokenInfoView.setText(String.format(template,
DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss ZZ").print(expiresAt)));
}
}
Button refreshTokenButton = (Button) findViewById(R.id.refresh_token);
refreshTokenButton.setVisibility(state.getRefreshToken() != null
? View.VISIBLE
: View.GONE);
refreshTokenButton.setOnClickListener((View view) -> refreshAccessToken());
Button viewProfileButton = (Button) findViewById(R.id.view_profile);
AuthorizationServiceDiscovery discoveryDoc =
state.getAuthorizationServiceConfiguration().discoveryDoc;
if ((discoveryDoc == null || discoveryDoc.getUserinfoEndpoint() == null)
&& mConfiguration.getUserInfoEndpointUri() == null) {
viewProfileButton.setVisibility(View.GONE);
} else {
viewProfileButton.setVisibility(View.VISIBLE);
viewProfileButton.setOnClickListener((View view) -> fetchUserInfo());
}
((Button)findViewById(R.id.sign_out)).setOnClickListener((View view) -> signOut());
View userInfoCard = findViewById(R.id.userinfo_card);
JSONObject userInfo = mUserInfoJson.get();
if (userInfo == null) {
userInfoCard.setVisibility(View.INVISIBLE);
} else {
try {
String name = "-";
if (userInfo.has("firstName")) {
name = userInfo.getString("firstName");
}
if (userInfo.has("lastName")) {
name += " " + userInfo.getString("lastName");
}
((TextView) findViewById(R.id.userinfo_name)).setText(name);
String username = "";
if (userInfo.has("handle")) {
username = userInfo.getString("handle");
}
((TextView) findViewById(R.id.username_value)).setText(username);
String userType = "";
if (userInfo.has("userType")) {
userType = userInfo.getString("userType");
}
((TextView) findViewById(R.id.user_type_value)).setText(userType);
String accountType = "";
if (userInfo.has("accountType")) {
accountType = userInfo.getString("accountType");
}
((TextView) findViewById(R.id.account_type_value)).setText(accountType);
String country = "";
if (userInfo.has("country")) {
country = userInfo.getString("country");
}
((TextView) findViewById(R.id.country_value)).setText(country);
// Need more work on this one
// if (userInfo.has("profilePic")) {
// GlideApp.with(TokenActivity.this)
// .load((mConfiguration.mProfilePictureEndpointUri().toString()))
// .fitCenter()
// .into((ImageView) findViewById(R.id.userinfo_profile));
// }
((TextView) findViewById(R.id.userinfo_json)).setText(mUserInfoJson.toString());
userInfoCard.setVisibility(View.VISIBLE);
} catch (JSONException ex) {
Log.e(TAG, "Failed to read userinfo JSON", ex);
}
}
}
@MainThread
private void refreshAccessToken() {
displayLoading("Refreshing access token");
performTokenRequest(
mStateManager.getCurrent().createTokenRefreshRequest(),
this::handleAccessTokenResponse);
}
@MainThread
private void exchangeAuthorizationCode(AuthorizationResponse authorizationResponse) {
displayLoading("Exchanging authorization code");
performTokenRequest(
authorizationResponse.createTokenExchangeRequest(),
this::handleCodeExchangeResponse);
}
@MainThread
private void performTokenRequest(
TokenRequest request,
AuthorizationService.TokenResponseCallback callback) {
ClientAuthentication clientAuthentication;
if (Configuration.getInstance(TokenActivity.this).getClientSecret() != null) {
clientAuthentication = new ClientSecretPost(Configuration.getInstance(TokenActivity.this).getClientSecret());
} else {
try {
clientAuthentication = mStateManager.getCurrent().getClientAuthentication();
} catch (ClientAuthentication.UnsupportedAuthenticationMethod ex) {
Log.d(TAG, "Token request cannot be made, client authentication for the token "
+ "endpoint could not be constructed (%s)", ex);
displayNotAuthorized("Client authentication method is unsupported");
return;
}
}
mAuthService.performTokenRequest(
request,
clientAuthentication,
callback);
}
//
// @MainThread
// private void performTokenRequest(
// TokenRequest request,
// AuthorizationService.TokenResponseCallback callback) {
// ClientAuthentication clientAuthentication;
// try {
// clientAuthentication = mStateManager.getCurrent().getClientAuthentication();
// } catch (ClientAuthentication.UnsupportedAuthenticationMethod ex) {
// Log.d(TAG, "Token request cannot be made, client authentication for the token "
// + "endpoint could not be constructed (%s)", ex);
// displayNotAuthorized("Client authentication method is unsupported");
// return;
// }
//
// mAuthService.performTokenRequest(
// request,
// clientAuthentication,
// callback);
// }
@WorkerThread
private void handleAccessTokenResponse(
@Nullable TokenResponse tokenResponse,
@Nullable AuthorizationException authException) {
mStateManager.updateAfterTokenResponse(tokenResponse, authException);
runOnUiThread(this::displayAuthorized);
}
@WorkerThread
private void handleCodeExchangeResponse(
@Nullable TokenResponse tokenResponse,
@Nullable AuthorizationException authException) {
mStateManager.updateAfterTokenResponse(tokenResponse, authException);
if (!mStateManager.getCurrent().isAuthorized()) {
final String message = "Authorization Code exchange failed"
+ ((authException != null) ? authException.error : null);
// WrongThread inference is incorrect for lambdas
//noinspection WrongThread
runOnUiThread(() -> displayNotAuthorized(message));
} else {
runOnUiThread(this::displayAuthorized);
}
}
/**
* Demonstrates the use of {@link AuthState#performActionWithFreshTokens} to retrieve
* user info from the IDP's user info endpoint. This callback will negotiate a new access
* token / id token for use in a follow-up action, or provide an error if this fails.
*/
@MainThread
private void fetchUserInfo() {
displayLoading("Fetching user info");
ClientAuthentication clientAuthentication;
if (Configuration.getInstance(TokenActivity.this).getClientSecret() != null) {
clientAuthentication = new ClientSecretPost(Configuration.getInstance(TokenActivity.this).getClientSecret());
} else {
try {
clientAuthentication = mStateManager.getCurrent().getClientAuthentication();
} catch (ClientAuthentication.UnsupportedAuthenticationMethod ex) {
Log.d(TAG, "Token request cannot be made, client authentication for the token "
+ "endpoint could not be constructed (%s)", ex);
displayNotAuthorized("Client authentication method is unsupported");
return;
}
}
mStateManager.getCurrent().performActionWithFreshTokens(mAuthService, clientAuthentication, this::fetchUserInfo);
}
@MainThread
private void fetchUserInfo(String accessToken, String idToken, AuthorizationException ex) {
if (ex != null) {
Log.e(TAG, "Token refresh failed when fetching user info");
mUserInfoJson.set(null);
runOnUiThread(this::displayAuthorized);
return;
}
AuthorizationServiceDiscovery discovery =
mStateManager.getCurrent()
.getAuthorizationServiceConfiguration()
.discoveryDoc;
URL userInfoEndpoint;
try {
userInfoEndpoint =
mConfiguration.getUserInfoEndpointUri() != null
? new URL(mConfiguration.getUserInfoEndpointUri().toString())
: new URL(discovery.getUserinfoEndpoint().toString());
} catch (MalformedURLException urlEx) {
Log.e(TAG, "Failed to construct user info endpoint URL", urlEx);
mUserInfoJson.set(null);
runOnUiThread(this::displayAuthorized);
return;
}
mExecutor.submit(() -> {
try {
HttpURLConnection conn =
(HttpURLConnection) userInfoEndpoint.openConnection();
conn.setRequestProperty("Authorization", "Bearer " + accessToken);
conn.setInstanceFollowRedirects(false);
String response = Okio.buffer(Okio.source(conn.getInputStream()))
.readString(Charset.forName("UTF-8"));
mUserInfoJson.set(new JSONObject(response));
} catch (IOException ioEx) {
Log.e(TAG, "Network error when querying userinfo endpoint", ioEx);
showSnackbar("Fetching user info failed");
} catch (JSONException jsonEx) {
Log.e(TAG, "Failed to parse userinfo response");
showSnackbar("Failed to parse user info");
}
runOnUiThread(this::displayAuthorized);
});
}
@MainThread
private void showSnackbar(String message) {
Snackbar.make(findViewById(R.id.coordinator),
message,
Snackbar.LENGTH_SHORT)
.show();
}
@MainThread
private void signOut() {
// discard the authorization and token state, but retain the configuration and
// dynamic client registration (if applicable), to save from retrieving them again.
AuthState currentState = mStateManager.getCurrent();
AuthState clearedState =
new AuthState(currentState.getAuthorizationServiceConfiguration());
if (currentState.getLastRegistrationResponse() != null) {
clearedState.update(currentState.getLastRegistrationResponse());
}
mStateManager.replace(clearedState);
Intent mainIntent = new Intent(this, LoginActivity.class);
mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(mainIntent);
finish();
}
}
|
[
"[email protected]"
] | |
4776544218b7faa37a170f6a292d9421860dc0a1
|
83cc00ad5bcccc581a20988655dbecbfc6643fb8
|
/src/main/java/integration/engine/JobCheckChangedDocument.java
|
64ee7af727042d2020f4851a39cd5326c3f22fc8
|
[
"Apache-2.0"
] |
permissive
|
SNET-Entrance/Entrance-Backend
|
e353124adcbdfeb5dfdc2ce507b1d92f965644fd
|
6e736eb6de2da307b4475c607bd723adbd269ad4
|
refs/heads/master
| 2020-12-25T06:45:40.595042 | 2017-03-17T11:14:04 | 2017-03-17T11:14:04 | 65,019,564 | 3 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 343 |
java
|
package integration.engine;
import java.util.TimerTask;
public class JobCheckChangedDocument extends TimerTask {
private final JobQueue jobQueue;
public JobCheckChangedDocument(JobQueue jobQueue) {
this.jobQueue = jobQueue;
}
@Override
public void run() {
jobQueue.evaluateDocumentsForQueue();
}
}
|
[
"[email protected]"
] | |
7919ef58b3d20d4e45433afbc1c21122295be236
|
f7e2b181fd66faad3ff4dad31c946f6b4a62834b
|
/ilibrary/src/ilibrary/Searchaction.java
|
89a6e1645fce1dbb90f6a1c809abddc1200c7931
|
[] |
no_license
|
xsy1996/lab2
|
86f5a2720fee1aaf305c0f9cffa5cb5790b0869a
|
96f4a41842ec8e3e77c399cf711b100ba8835da6
|
refs/heads/master
| 2021-05-04T06:21:07.837674 | 2016-10-17T04:13:07 | 2016-10-17T04:13:07 | 71,059,153 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 864 |
java
|
package ilibrary;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
public class Searchaction extends ActionSupport{
private Author author=new Author();
private List<Book> booklst;
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
public List<Book> getBooklst() {
return booklst;
}
public void setBooklst(List<Book> booklst) {
this.booklst = booklst;
}
public String search_as_author(){
Service t=new Service();
List<Book> lsttemp;
System.out.println(author.getName());
lsttemp=t.get_book_as_author(author.getName());
setBooklst(lsttemp);
for(int i=0;i<booklst.size();i++)
System.out.println(booklst.get(i).getTitle());
return SUCCESS;
}
public String execute() throws Exception {
return SUCCESS;
}
}
|
[
"[email protected]"
] | |
c43b1c13da033c4024e8b82cae6213a42fa1e8b1
|
ac3520396149c69d05d16b870886e9c88d1df5fa
|
/math/src/test/java/io/smallrye/mutiny/math/MedianOperatorTest.java
|
fd3c55254770b3df497e82673890898e90e67824
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
smallrye/smallrye-mutiny
|
fd610001996d6a7d63e5f482aa713724adc982ce
|
5724074347b968891af26465389094b57b1ebb83
|
refs/heads/main
| 2023-08-18T07:38:22.133027 | 2023-08-17T11:00:18 | 2023-08-17T11:00:18 | 198,222,234 | 703 | 130 |
Apache-2.0
| 2023-09-13T10:23:39 | 2019-07-22T12:48:27 |
Java
|
UTF-8
|
Java
| false | false | 4,451 |
java
|
package io.smallrye.mutiny.math;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.helpers.test.AssertSubscriber;
import io.smallrye.mutiny.infrastructure.Infrastructure;
public class MedianOperatorTest {
@Test
public void testWithEmpty() {
AssertSubscriber<Double> subscriber = Multi.createFrom().<Integer> empty()
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(10));
subscriber
.awaitCompletion()
.assertHasNotReceivedAnyItem();
}
@Test
public void testWithNever() {
AssertSubscriber<Double> subscriber = Multi.createFrom().<Long> nothing()
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(10));
subscriber.cancel();
subscriber.assertNotTerminated();
Assertions.assertEquals(0, subscriber.getItems().size());
}
@Test
public void testWithIntegerItems() {
AssertSubscriber<Double> subscriber = Multi.createFrom().items(1, 2, 3, 4, 5, 6)
.runSubscriptionOn(Infrastructure.getDefaultExecutor())
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(3));
subscriber.awaitItems(3)
.assertItems(1.0, 1.5, 2.0)
.request(10)
.awaitCompletion()
.assertItems(1.0, 1.5, 2.0, 2.5, 3.0, 3.5);
}
@Test
public void testWithIntegerItemsShuffled() {
AssertSubscriber<Double> subscriber = Multi.createFrom().items(6, 1, 2, 5, 3, 1)
.runSubscriptionOn(Infrastructure.getDefaultExecutor())
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(3));
subscriber.awaitItems(3)
.assertItems(6.0, 3.5, 2.0)
.request(10)
.awaitCompletion()
.assertItems(6.0, 3.5, 2.0, 3.5, 3.0, 2.5);
}
@Test
public void testLatest() {
List<Integer> list = Arrays.asList(3, 4, 1, 2, 6, 7, 9, 2, 4, 5, 2, 7, 9, 10, 2, 5, 3, 4, 3, 8, 4, 7, 9);
Collections.shuffle(list);
double median = Multi.createFrom().iterable(list)
.runSubscriptionOn(Infrastructure.getDefaultExecutor())
.plug(Math.median())
.collect().last()
.await().indefinitely();
Assertions.assertEquals(4.0, median);
}
@Test
public void testWithLongItems() {
AssertSubscriber<Double> subscriber = Multi.createFrom().items(6L, 1L, 2L, 5L, 3L, 1L)
.runSubscriptionOn(Infrastructure.getDefaultExecutor())
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(3));
subscriber.awaitItems(3)
.assertItems(6.0, 3.5, 2.0)
.request(10)
.awaitCompletion()
.assertItems(6.0, 3.5, 2.0, 3.5, 3.0, 2.5);
}
@Test
public void testWithDoubleItems() {
AssertSubscriber<Double> subscriber = Multi.createFrom().items(6.0, 1.0, 2.0, 5.0, 3.0, 1.0)
.runSubscriptionOn(Infrastructure.getDefaultExecutor())
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(3));
subscriber.awaitItems(3)
.assertItems(6.0, 3.5, 2.0)
.request(10)
.awaitCompletion()
.assertItems(6.0, 3.5, 2.0, 3.5, 3.0, 2.5);
}
@RepeatedTest(1000)
public void testWithItemsAndFailure() {
AssertSubscriber<Double> subscriber = Multi.createBy().concatenating().streams(
Multi.createFrom().items(6, 1, 2, 5, 3, 1),
Multi.createFrom().failure(new Exception("boom")))
.runSubscriptionOn(Infrastructure.getDefaultExecutor())
.plug(Math.median())
.subscribe().withSubscriber(AssertSubscriber.create(3));
subscriber.awaitItems(3)
.assertItems(6.0, 3.5, 2.0)
.request(10)
.awaitFailure()
.assertItems(6.0, 3.5, 2.0, 3.5, 3.0, 2.5);
}
}
|
[
"[email protected]"
] | |
ba3456874591cb9d7227519c6a6b099d83ce6a49
|
bb6523830687f643433798385fe57f788900cb25
|
/app/src/main/java/com/utouu/settingitem/MyApplication.java
|
8fa32973ac2169db0d59c82a057fe1d48444bb08
|
[] |
no_license
|
vincentpanqi/SettingItemView
|
f87d3f23d7698d66da3fb9aacd73f778e4bc022b
|
9d80174d07e22f342630aa8940e26073ea47b0c7
|
refs/heads/master
| 2021-05-02T06:04:28.955794 | 2016-11-01T06:12:51 | 2016-11-01T06:12:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 553 |
java
|
package com.utouu.settingitem;
import android.app.Application;
import com.squareup.leakcanary.LeakCanary;
/**
* Created by chenxin on 2016/10/21.
* Fuction:
* Desc:
*/
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);
}
}
|
[
"[email protected]"
] | |
fad61cf1f82e6fe723b4f1e6a072d7f626010fe0
|
2d53d6f8d3e0e389bba361813e963514fdef3950
|
/Open_redirect/CWE601_Open_Redirect__Servlet_getParameter_Servlet_52a.java
|
1b8fdd66c01df9ac5727b9f789d68514858f1f6c
|
[] |
no_license
|
apobletts/ml-testing
|
6a1b95b995fdfbdd68f87da5f98bd969b0457234
|
ee6bb9fe49d9ec074543b7ff715e910110bea939
|
refs/heads/master
| 2021-05-10T22:55:57.250937 | 2018-01-26T20:50:15 | 2018-01-26T20:50:15 | 118,268,553 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,221 |
java
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE601_Open_Redirect__Servlet_getParameter_Servlet_52a.java
Label Definition File: CWE601_Open_Redirect__Servlet.label.xml
Template File: sources-sink-52a.tmpl.java
*/
/*
* @description
* CWE: 601 Open Redirect
* BadSource: getParameter_Servlet Read data from a querystring using getParameter()
* GoodSource: A hardcoded string
* Sinks:
* BadSink : place redirect string directly into redirect api call
* Flow Variant: 52 Data flow: data passed as an argument from one method to another to another in three different classes in the same package
*
* */
package testcases.CWE601_Open_Redirect;
import testcasesupport.*;
import javax.servlet.http.*;
public class CWE601_Open_Redirect__Servlet_getParameter_Servlet_52a extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
/* PRAETORIAN: Read data from a querystring using getParameter */
data = request.getParameter("name");
(new CWE601_Open_Redirect__Servlet_getParameter_Servlet_52b()).badSink(data , request, response);
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B(request, response);
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
/* FIX: Use a hardcoded string */
data = "foo";
(new CWE601_Open_Redirect__Servlet_getParameter_Servlet_52b()).goodG2BSink(data , request, response);
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
|
[
"[email protected]"
] | |
f96df27db1f22f00544a441c4e7ebffe795b2ca5
|
dc931599f5bab680e2a9a47c8771cffefab0ca3c
|
/Client/test/nju/lighting/bl/initbl/InitHelperTest.java
|
e3c15c0befc1db89149f2ffba12edd2c478a776d
|
[] |
no_license
|
gmt123456/SEIIAssignment
|
57cbf5d44c31c6c08fc56033990e5646b60562a1
|
3a2e0761353ce5f0948ea621a3ee35c270a12f9d
|
refs/heads/master
| 2020-03-28T01:22:35.974400 | 2018-01-13T04:27:14 | 2018-01-13T04:27:14 | 147,499,427 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,130 |
java
|
package nju.lighting.bl.initbl;
import nju.lighting.bl.userbl.LoginTestHelper;
import nju.lighting.blservice.initblservice.InitializationBLService;
import nju.lighting.vo.InitVO;
import org.junit.Before;
import org.junit.Test;
import shared.Result;
import shared.ResultMessage;
import java.util.List;
import static org.junit.Assert.*;
/**
* Created on 2017/12/6.
* Description:
* @author Liao
*/
public class InitHelperTest {
@Before
public void setUp() throws Exception {
LoginTestHelper.loginAuthorizedUser();
}
@Test
public void createInitTest() throws Exception {
InitHelper helper = InitHelper.INSTANCE;
Result<InitVO> res = helper.createInit();
assertEquals(ResultMessage.SUCCESS, res.getResultMessage());
assertNotNull(res.getValue());
}
@Test
public void getInitInfoTest() throws Exception {
InitializationBLService blService = new InitController();
List<InitVO> voList = blService.getInitInfo();
assertNotEquals(0, voList.size());
assertEquals("BbidA", voList.get(0).getUserVO().getUsername());
}
}
|
[
"[email protected]"
] | |
724285225f6d0be6d8bbd40655b49cecf7789292
|
1789c9d5f72d18f640f25ea7cc4b0d448dbbbca1
|
/app/src/main/java/com/hk/meditechadmin/MainActivity.java
|
786acf5161367722810727a513667991b104c1fd
|
[] |
no_license
|
Rafid-tawhid/Admin
|
154df6004af64b1848b426b583d82c850d782bd3
|
e429f48a249de86698ba08f14dbde0ea294b0186
|
refs/heads/master
| 2023-06-03T14:05:57.215270 | 2021-06-17T10:43:51 | 2021-06-17T10:43:51 | 377,795,336 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,340 |
java
|
package com.hk.meditechadmin;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.hk.meditechadmin.databinding.ActivityMainBinding;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
import uk.co.deanwild.materialshowcaseview.ShowcaseConfig;
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;
private static final String SHOWCASE_ID = "sequence example";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
//permission
getPermission();
//button activity
binding.addPationtId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, PhoneNoActivity.class)); //testing purpose need to change
}
});
binding.updatePatientId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, PhoneUpdateActivity.class)); //testing purpose need to change
}
});
binding.guideLineId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//show apps guideline
startActivity(new Intent(MainActivity.this,GuideLineActivity.class));
}
});
binding.aboutId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//show no internet Dialog
final AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
final View alertView = LayoutInflater.from(MainActivity.this).inflate(R.layout.about_dialogue, null);
alertDialog.setCancelable(true);
Button okBtn = alertView.findViewById(R.id.okButton);
okBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
}
});
alertDialog.setView(alertView);
alertDialog.show();
}
});
showCaseView();
}
private void showCaseView() {
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(500); // half second between each showcase view
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(MainActivity.this, SHOWCASE_ID);
sequence.setOnItemShownListener(new MaterialShowcaseSequence.OnSequenceItemShownListener() {
@Override
public void onShow(MaterialShowcaseView itemView, int position) {
Toast.makeText(itemView.getContext(), "Item #" + position, Toast.LENGTH_SHORT).show();
}
});
sequence.setConfig(config);
sequence.addSequenceItem(binding.addPationtId, "Adding for new patient data", "Close");
sequence.addSequenceItem(
new MaterialShowcaseView.Builder(MainActivity.this)
.setSkipText("SKIP")
.setTarget(binding.updatePatientId)
.setDismissText("Close")
.setContentText("Update existing patient data")
.withCircleShape()
.build()
);
sequence.addSequenceItem(
new MaterialShowcaseView.Builder(MainActivity.this)
.setTarget(binding.guideLineId)
.setDismissText("Close")
.setContentText("Find out apps guideline")
.withCircleShape()
.build()
);
sequence.start();
}
private void getPermission() {
String[] permissions = {Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED
&& checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
&& checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(permissions, 0);
} else {
}
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}
|
[
"[email protected]"
] | |
d60e30d4fa33ea09aeb127726cb1d67bab18b175
|
83bcef0127818cfb75a94590925bd5cb36da6753
|
/src/test/groovy/org/gradle/util/TestFile.java
|
b9ccc3123e24b297f805eb1a2eaba2290e36a861
|
[] |
no_license
|
kenshoo/application-plugin-extended
|
8ff320b7bfbbee2dace0431b5805e3062ccef73f
|
a055dc6ba4ae65836e915d714364ebf3d103476f
|
refs/heads/master
| 2020-12-03T05:26:53.258210 | 2014-11-27T15:37:52 | 2014-11-27T15:37:52 | 27,134,572 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,021 |
java
|
/*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.util;
import groovy.lang.Closure;
import org.apache.commons.io.FileUtils;
import org.apache.tools.ant.taskdefs.Tar;
import org.apache.tools.ant.taskdefs.Zip;
import org.gradle.api.UncheckedIOException;
import org.gradle.api.file.DeleteAction;
import org.gradle.api.internal.file.IdentityFileResolver;
import org.gradle.api.internal.file.copy.DeleteActionImpl;
import org.hamcrest.Matcher;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.*;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import static org.junit.Assert.*;
public class TestFile extends File implements TestFileContext {
private boolean useNativeTools;
public TestFile(File file, Object... path) {
super(join(file, path).getAbsolutePath());
}
public TestFile(URI uri) {
this(new File(uri));
}
public TestFile(String path) {
this(new File(path));
}
public TestFile(URL url) {
this(toUri(url));
}
public TestFile getTestDir() {
return this;
}
public TestFile usingNativeTools() {
useNativeTools = true;
return this;
}
private static URI toUri(URL url) {
try {
return url.toURI();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
private static File join(File file, Object[] path) {
File current = file.getAbsoluteFile();
for (Object p : path) {
current = new File(current, p.toString());
}
return GFileUtils.canonicalise(current);
}
public TestFile file(Object... path) {
try {
return new TestFile(this, path);
} catch (RuntimeException e) {
throw new UncheckedIOException(String.format("Could not locate file '%s' relative to '%s'.", Arrays.toString(path), this), e);
}
}
public List<TestFile> files(Object... paths) {
List<TestFile> files = new ArrayList<TestFile>();
for (Object path : paths) {
files.add(file(path));
}
return files;
}
public TestFile writelns(String... lines) {
return writelns(Arrays.asList(lines));
}
public TestFile write(Object content) {
try {
FileUtils.writeStringToFile(this, content.toString());
} catch (IOException e) {
throw new UncheckedIOException(String.format("Could not write to test file '%s'", this), e);
}
return this;
}
public TestFile leftShift(Object content) {
getParentFile().mkdirs();
return write(content);
}
public String getText() {
assertIsFile();
try {
return FileUtils.readFileToString(this);
} catch (IOException e) {
throw new UncheckedIOException(String.format("Could not read from test file '%s'", this), e);
}
}
public Map<String, String> getProperties() {
assertIsFile();
Properties properties = new Properties();
try {
FileInputStream inStream = new FileInputStream(this);
try {
properties.load(inStream);
} finally {
inStream.close();
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Map<String, String> map = new HashMap<String, String>();
for (Object key : properties.keySet()) {
map.put(key.toString(), properties.getProperty(key.toString()));
}
return map;
}
public Manifest getManifest() {
assertIsFile();
try {
JarFile jarFile = new JarFile(this);
try {
return jarFile.getManifest();
} finally {
jarFile.close();
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
public List<String> linesThat(Matcher<? super String> matcher) {
try {
BufferedReader reader = new BufferedReader(new FileReader(this));
try {
List<String> lines = new ArrayList<String>();
String line;
while ((line = reader.readLine()) != null) {
if (matcher.matches(line)) {
lines.add(line);
}
}
return lines;
} finally {
reader.close();
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
public void unzipTo(File target) {
assertIsFile();
new TestFileHelper(this).unzipTo(target, useNativeTools);
}
public void untarTo(File target) {
assertIsFile();
new TestFileHelper(this).untarTo(target, useNativeTools);
}
public void copyTo(File target) {
if (isDirectory()) {
try {
FileUtils.copyDirectory(this, target);
} catch (IOException e) {
throw new UncheckedIOException(String.format("Could not copy test directory '%s' to '%s'", this,
target), e);
}
} else {
try {
FileUtils.copyFile(this, target);
} catch (IOException e) {
throw new UncheckedIOException(String.format("Could not copy test file '%s' to '%s'", this, target), e);
}
}
}
public void copyFrom(File target) {
new TestFile(target).copyTo(this);
}
public void copyFrom(URL resource) {
try {
FileUtils.copyURLToFile(resource, this);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
public TestFile touch() {
try {
FileUtils.touch(this);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
assertIsFile();
return this;
}
/**
* Creates a directory structure specified by the given closure.
* <pre>
* dir.create {
* subdir1 {
* file 'somefile.txt'
* }
* subdir2 { nested { file 'someFile' } }
* }
* </pre>
*/
public TestFile create(Closure structure) {
assertTrue(isDirectory() || mkdirs());
new TestDirHelper(this).apply(structure);
return this;
}
@Override
public TestFile getParentFile() {
return super.getParentFile() == null ? null : new TestFile(super.getParentFile());
}
@Override
public String toString() {
return getPath();
}
public TestFile writelns(Iterable<String> lines) {
Formatter formatter = new Formatter();
for (String line : lines) {
formatter.format("%s%n", line);
}
return write(formatter);
}
public TestFile assertExists() {
assertTrue(String.format("%s does not exist", this), exists());
return this;
}
public TestFile assertIsFile() {
assertTrue(String.format("%s is not a file", this), isFile());
return this;
}
public TestFile assertIsDir() {
assertTrue(String.format("%s is not a directory", this), isDirectory());
return this;
}
public TestFile assertDoesNotExist() {
assertFalse(String.format("%s should not exist", this), exists());
return this;
}
public TestFile assertContents(Matcher<String> matcher) {
assertThat(getText(), matcher);
return this;
}
public TestFile assertIsCopyOf(TestFile other) {
assertIsFile();
other.assertIsFile();
assertEquals(other.length(), this.length());
assertTrue(Arrays.equals(HashUtilM3.createHash(this), HashUtilM3.createHash(other)));
return this;
}
private String getPermissions() {
assertExists();
return new TestFileHelper(this).getPermissions();
}
public TestFile setPermissions(String permissions) {
assertExists();
new TestFileHelper(this).setPermissions(permissions);
return this;
}
/**
* Asserts that this file contains exactly the given set of descendants.
*/
public TestFile assertHasDescendants(String... descendants) {
Set<String> actual = new TreeSet<String>();
assertIsDir();
visit(actual, "", this);
Set<String> expected = new TreeSet<String>(Arrays.asList(descendants));
Set<String> extras = new TreeSet<String>(actual);
extras.removeAll(expected);
Set<String> missing = new TreeSet<String>(expected);
missing.removeAll(actual);
assertEquals(String.format("Extra files: %s, missing files: %s, expected: %s", extras, missing, expected), expected, actual);
return this;
}
public TestFile assertIsEmptyDir() {
if (exists()) {
assertIsDir();
assertHasDescendants();
}
return this;
}
private void visit(Set<String> names, String prefix, File file) {
for (File child : file.listFiles()) {
if (child.isFile()) {
names.add(prefix + child.getName());
} else if (child.isDirectory()) {
visit(names, prefix + child.getName() + "/", child);
}
}
}
public boolean isSelfOrDescendent(File file) {
if (file.getAbsolutePath().equals(getAbsolutePath())) {
return true;
}
return file.getAbsolutePath().startsWith(getAbsolutePath() + File.separatorChar);
}
public TestFile createDir() {
assertTrue(isDirectory() || mkdirs());
return this;
}
public TestFile createDir(Object path) {
return new TestFile(this, path).createDir();
}
public TestFile deleteDir() {
DeleteAction delete = new DeleteActionImpl(new IdentityFileResolver());
delete.delete(this);
return this;
}
/**
* Attempts to delete this directory, ignoring failures to do so.
* @return this
*/
public TestFile maybeDeleteDir() {
try {
deleteDir();
} catch (UncheckedIOException e) {
// Ignore
}
return this;
}
public TestFile createFile() {
new TestFile(getParentFile()).createDir();
try {
assertTrue(isFile() || createNewFile());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return this;
}
public TestFile createFile(Object path) {
return file(path).createFile();
}
public TestFile zipTo(TestFile zipFile) {
Zip zip = new Zip();
zip.setBasedir(this);
zip.setDestFile(zipFile);
AntUtil.execute(zip);
return this;
}
public TestFile tarTo(TestFile zipFile) {
Tar tar = new Tar();
tar.setBasedir(this);
tar.setDestFile(zipFile);
AntUtil.execute(tar);
return this;
}
public Snapshot snapshot() {
assertIsFile();
return new Snapshot();
}
public void assertHasChangedSince(Snapshot snapshot) {
Snapshot now = snapshot();
assertTrue(now.modTime != snapshot.modTime || !Arrays.equals(now.hash, snapshot.hash));
}
public void assertHasNotChangedSince(Snapshot snapshot) {
Snapshot now = snapshot();
assertEquals(String.format("last modified time of %s has changed", this), snapshot.modTime, now.modTime);
assertArrayEquals(String.format("contents of %s has changed", this), snapshot.hash, now.hash);
}
public void writeProperties(Map<?, ?> properties) {
Properties props = new Properties();
props.putAll(properties);
try {
FileOutputStream stream = new FileOutputStream(this);
try {
props.store(stream, "comment");
} finally {
stream.close();
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
public class Snapshot {
private final long modTime;
private final byte[] hash;
public Snapshot() {
modTime = lastModified();
hash = HashUtilM3.createHash(TestFile.this);
}
}
}
|
[
"[email protected]"
] | |
c4b351ece3ad968351962f26026db9517bb84b74
|
ee32133c38272a9ad9d4d3212110c0a20b2db019
|
/app/src/androidTest/java/com/tvt11/timemanagingapp/ExampleInstrumentedTest.java
|
32173dae90d710ba8b1301efd0e9e74a1ef45e17
|
[
"MIT"
] |
permissive
|
vitran96/time_managing_app
|
765d72aeab4ad15cea5dbbc2540fd5b30bf8e9b3
|
2ae75754ccfef5c0b02276476dc245743046287d
|
refs/heads/master
| 2022-01-05T22:09:21.333986 | 2019-05-10T12:07:07 | 2019-05-10T12:07:07 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,088 |
java
|
package com.tvt11.timemanagingapp;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import com.tvt11.timemanagingapp.model.Timer;
import com.tvt11.timemanagingapp.repo.TimerRepository;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
Context context;
TimerRepository timerRepository;
List<Timer> timers;
@Before
public void setUp() {
context = InstrumentationRegistry.getTargetContext();
timerRepository = new TimerRepository(context);
timers = new ArrayList<>();
timers.add(new Timer("Sleep", "05:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Eat", "01:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Exercise", "01:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Study", "04:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Gaming", "06:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Rest", "04:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Other", "04:00:00", "2019-05-03", true, false, ""));
timers.add(new Timer("Sleep", "08:00:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Eat", "00:30:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Exercise", "02:00:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Study", "05:00:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Gaming", "02:00:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Rest", "04:00:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Other", "02:30:00", "2019-05-04", true, false, ""));
timers.add(new Timer("Sleep", "06:00:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Eat", "01:20:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Exercise", "01:00:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Study", "06:00:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Gaming", "02:00:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Rest", "04:00:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Other", "03:40:00", "2019-05-05", true, false, ""));
timers.add(new Timer("Sleep", "07:00:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Eat", "01:30:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Exercise", "01:00:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Study", "07:00:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Gaming", "02:00:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Rest", "04:00:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Other", "01:30:00", "2019-05-06", true, false, ""));
timers.add(new Timer("Sleep", "06:00:00", "2019-05-07", true, false, ""));
timers.add(new Timer("Eat", "01:00:00", "2019-05-07", true, false, ""));
timers.add(new Timer("Exercise", "02:00:00", "2019-05-07", true, false, ""));
timers.add(new Timer("Study", "06:00:00", "2019-05-07", true, false, ""));
timers.add(new Timer("Gaming", "02:00:00", "2019-05-07", true, false, ""));
timers.add(new Timer("Rest", "04:00:00", "2019-05-07", true, false, ""));
timers.add(new Timer("Other", "03:00:00", "2019-05-07", true, false, ""));
}
@Test
public void insertTimersToDB() {
timerRepository.nukeTable();
await().until(() -> timerRepository.getAllTimers().size() == 0);
for(Timer timer: timers)
timerRepository.insertTask(timer);
await().until(() -> timerRepository.getAllTimers().size() >= timers.size());
List<Timer> timersInDB = timerRepository.getFinishedTimers();
assertEquals(timers.size(), timersInDB.size());
}
@Test
public void nukeDBTable() {
timerRepository.nukeTable();
await().until(() -> timerRepository.getAllTimers().size() == 0);
assertEquals(0, timerRepository.getAllTimers().size());
}
@Ignore
public void testDB1() {
List<Timer> timers = timerRepository.getScheduledTimers();
assertEquals(10, timers.size());
}
@Ignore
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.tvt11.timemanagingapp", appContext.getPackageName());
}
@Ignore
public void createTimer() {
//
}
}
|
[
"[email protected]"
] | |
7daf866544c6bcfa7ae26b232c084126dfa4f017
|
ab798962f06639e80daf4b35472e3a6b46c539be
|
/src/main/java/com/act5admin/Service/CacheServiceImpl.java
|
26d6c78c3aa7d77b23774e72c1f51c5d482e9d90
|
[] |
no_license
|
miyamz/admintest
|
54bc00849a61aaf32ef3946a12f8040b7d7f708c
|
ff0f59fa585005e3bc3dee70274ea862b267ad49
|
refs/heads/main
| 2023-01-03T15:39:03.956593 | 2020-10-30T10:18:50 | 2020-10-30T10:18:50 | 308,593,791 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 874 |
java
|
package com.act5admin.Service;
import java.util.List;
import com.act5admin.Entity.ManagementDB.ServerInfoEntity;
import com.act5admin.Repository.ManagementDB.ServerInfoRepository;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;
@EnableCaching
@Service("cacheService")
public class CacheServiceImpl implements CacheService {
private static final Logger log = LogManager.getLogger(CacheServiceImpl.class);
@Autowired
private ServerInfoRepository serverInfoRepo;
@Cacheable(value="serverData")
public List<ServerInfoEntity> getServerList() {
return serverInfoRepo.findAll();
}
}
|
[
"[email protected]"
] | |
e9293a8123b4fdc09d6b324c00bc4dbefb088f00
|
68e568c13051b364efbd2fce81b48cbd12e612cd
|
/src/main/java/com/gujunbin/service/FlagService.java
|
bddc4648fccdf2c99fd164e49c7ec8a0bff6b578
|
[] |
no_license
|
gujunbin/myBlog
|
641061a296fbd42c79b70b35bb1915a9e6f6222d
|
ce30f5a5f728a112e081a160cc598c28a28bd3d0
|
refs/heads/master
| 2022-10-06T15:14:53.763332 | 2020-06-10T16:40:58 | 2020-06-10T16:40:58 | 264,072,855 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 496 |
java
|
package com.gujunbin.service;
import com.gujunbin.po.Flag;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface FlagService {
Flag saveFlag(Flag type);
Flag getFlag(Long id);
Flag getFlagByName(String name);
Page<Flag> listFlag(Pageable pageable);
List<Flag> listFlag();
List<Flag> listFlagTop(Integer size);
Flag updateFlag(Long id,Flag type);
void deleteFlag(Long id);
}
|
[
"[email protected]"
] | |
0c4f66336b4d0479054252263c780834eeaec181
|
16af6a50604f269d9a851de74035c43867d58d7d
|
/Arduinobluetoothcontroller_v1.3_apkpure.com_source_from_JADX/android/support/design/widget/bl.java
|
9cc3caff8a4addffc09e2f38c3f2dc4d8afdb98e
|
[] |
no_license
|
Siva6261/prescription-system-with-firebird-5
|
3c63079d6a726628390ace4366481cbb4fe7094b
|
8db690548809c65d3893922c5653acadb726c106
|
refs/heads/master
| 2020-03-22T13:15:41.392698 | 2018-07-07T15:43:10 | 2018-07-07T15:43:10 | 140,094,787 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 416 |
java
|
package android.support.design.widget;
class bl implements bz {
final /* synthetic */ Snackbar f392a;
bl(Snackbar snackbar) {
this.f392a = snackbar;
}
public void mo105a() {
Snackbar.f284a.sendMessage(Snackbar.f284a.obtainMessage(0, this.f392a));
}
public void mo106a(int i) {
Snackbar.f284a.sendMessage(Snackbar.f284a.obtainMessage(1, i, 0, this.f392a));
}
}
|
[
"[email protected]"
] | |
5e58707fdea9b46b92214220aebacd863adde4d5
|
ea23c1351554a51eb10765507149ee45cf5dbbaf
|
/modules/core/src/com/company/tmbkt/core/app/reassignment/commands/TrawlApplicationReassignmentCommand.java
|
579dfdc374c3059571736ce3bc882fce64fa3aff
|
[] |
no_license
|
irkvlad/tmbk-t
|
923a803cb5f7f014bd3d98586c072e70bd0d5710
|
175bf1bfdfb7f2583a097f2a656d4fc914598b05
|
refs/heads/master
| 2023-02-26T08:33:01.841691 | 2021-02-09T06:17:53 | 2021-02-09T06:17:53 | 317,466,954 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 899 |
java
|
/*
* Copyright (c) 2020 com.company.tmbkt.core.app.reassignment.commands
*/
package com.company.tmbkt.core.app.reassignment.commands;
import com.haulmont.thesis.core.app.reassignment.commands.AbstractDocReassignmentCommand;
import javax.annotation.ManagedBean;
import javax.annotation.PostConstruct;
import com.company.tmbkt.entity.TrawlApplication;
/**
* @author Владимир Лощилов
*/
@ManagedBean(TrawlApplicationReassignmentCommand.NAME)
public class TrawlApplicationReassignmentCommand extends AbstractDocReassignmentCommand<TrawlApplication> {
protected static final String NAME = "trawlapplication_reassignment_command";
@PostConstruct
protected void postInit() {
type = "TrawlApplication";
docQuery = String.format(DOC_QUERY_TEMPLATE, "tmbkt$TrawlApplication");
}
@Override
public String getName() {
return NAME;
}
}
|
[
"[email protected]"
] | |
6610e62121b7b1b732bdfdc1d2c14d53c0d56b41
|
e4092cc8b5234d50343452608fadbdd1460737e4
|
/Battlecode 2013/StrategyPlayer2/NavigationController.java
|
8dbe8c83bddcfe806270e8461c7323a7c63d4a41
|
[] |
no_license
|
pcattori/Battlecode-2013-IAP-MIT
|
cd8602acef0849dc3a3147f40265ef385f55d1e2
|
1e029663e9fd36578eb491657ce5f4acf376eba5
|
refs/heads/master
| 2021-01-21T03:41:23.125257 | 2013-12-17T18:36:31 | 2013-12-17T18:36:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,240 |
java
|
package StrategyPlayer2;
import java.util.Random;
//import java.util.*;
import java.util.Arrays;
import battlecode.common.*;
/**
*
* @author brando
* Caution: Do not create NavigationController instances inside run method because instance variables won't be remembered
* as expected and unexpected behavior might occur. Instead, NavigationController should be a instance of SoldierPlayer.
*
*/
public class NavigationController {
private RobotController rc;
private int previousMove = -1;
//private int lastIndex = 0;
//private int cycleBreakerCounter = 0;
private MapLocation[] previousFour = new MapLocation[4];
private Team myTeam;
private int[][] mapIntDistribution;
private Random dice;
NavigationController(RobotController rc){
this.rc = rc;
this.myTeam = rc.getTeam();
this.mapIntDistribution = new int[rc.getMapWidth()][rc.getMapHeight()];
this.dice = new Random(Clock.getRoundNum());
}
public void progressMove(MapLocation whereToGo) throws GameActionException{
MapLocation currentLocation = rc.getLocation();
int dist = currentLocation.distanceSquaredTo(whereToGo);
if (dist>0 && rc.isActive()){
Direction toTarget = currentLocation.directionTo(whereToGo);
int[] directionOffsets = {-2,2,-1,1,0};
Direction potentialDirectionMovement; //direction of where we are going to move
MapLocation newLocation;
int offset;
for (int i = 5; --i>= 0;){
offset = directionOffsets[i];
potentialDirectionMovement = Direction.values()[(toTarget.ordinal()+offset+8)%8];
newLocation = rc.getLocation().add(potentialDirectionMovement);
Team mineAtPotentialNewLocation = rc.senseMine(newLocation);
if (rc.canMove(potentialDirectionMovement) && this.shouldMakeMoveRand(newLocation, currentLocation)
&& (mineAtPotentialNewLocation == myTeam || mineAtPotentialNewLocation == null)){
rc.move(potentialDirectionMovement);
//this.previousFour[lastIndex] = currentLocation;
//lastIndex = (lastIndex + 1)%4;
try{
try{
this.mapIntDistribution[newLocation.x][newLocation.y]++;
} catch (Exception e){
this.mapIntDistribution[newLocation.x][newLocation.y] = 1;
}
} catch (Exception e){
}
//rc.setIndicatorString(0,Arrays.toString(this.previousFour));
//rc.setIndicatorString(1,"locationBeforeMove: "+currentLocation);
//rc.setIndicatorString(2,"to Target Direction: "+toTarget.toString());
return;
}
}
for (int i = 5; --i>= 0;){
offset = directionOffsets[i];
potentialDirectionMovement = Direction.values()[(toTarget.ordinal()+offset+8)%8];
if(rc.canMove(potentialDirectionMovement) ){
newLocation = currentLocation.add(toTarget);
this.defuseFirstorThenMove(potentialDirectionMovement);
//this.previousFour[lastIndex] = currentLocation;
//lastIndex = (lastIndex + 1)%4;
try{
try{
this.mapIntDistribution[newLocation.x][newLocation.y]++;
} catch (Exception e){
this.mapIntDistribution[newLocation.x][newLocation.y] = 1;
}
} catch (Exception e){
}
//rc.setIndicatorString(0,Arrays.toString(this.previousFour));
//rc.setIndicatorString(1,"locationBeforeMove: "+currentLocation);
//rc.setIndicatorString(2,"to Target Direction: "+toTarget.toString());
return;
}
}
}
}
public void evalMove(MapLocation currentLocation, MapLocation whereToGo) throws GameActionException{//New pathing algorithm
//SHOULD WE CONSIDER NOT MOVING??
if (rc.isActive()){
try{
this.mapIntDistribution[currentLocation.x][currentLocation.y]+=1;
} catch (Exception e){
this.mapIntDistribution[currentLocation.x][currentLocation.y]=1;
}
int[] dirOffsets = {0,1,2,3,4,5,6,7};
int bestScore = -1;
Direction bestDir = null;
for (int offset : dirOffsets){
Direction dir = Direction.values()[offset];
if (rc.canMove(dir)){
int score = this.evalDirection(currentLocation,dir,whereToGo, currentLocation.directionTo(whereToGo), this.movesAway(currentLocation, whereToGo));
if (bestDir == null){
bestScore = score;
bestDir = dir;
} else if (score < bestScore){
bestScore = score;
bestDir = dir;
}
}
}
if (bestDir != null){
rc.setIndicatorString(0,"Best score: "+bestScore+", Direction to target: "+currentLocation.directionTo(whereToGo));
MapLocation moveSquare = currentLocation.add(bestDir);
if (this.mineHazard(moveSquare)){
rc.defuseMine(moveSquare);
} else{
rc.move(bestDir);
}
}
}
}
public int movesAway(MapLocation start, MapLocation target){
return Math.max(Math.abs(target.x-start.x), Math.abs(target.y-start.y));
}
public int evalDirection(MapLocation currentLocation, Direction dir, MapLocation goal, Direction dirToGoal,int currentMovesToGoal){
boolean hasDefusion = rc.hasUpgrade(Upgrade.DEFUSION);
MapLocation square = currentLocation.add(dir);
int directionPenalty;
int dirDiff = Math.abs(dir.ordinal() - dirToGoal.ordinal());
if (dirDiff <= 2){
directionPenalty = this.movesAway(square,goal) - currentMovesToGoal;
} else{
directionPenalty = hasDefusion?5:12;
}
int minePenalty;
if (hasDefusion){
minePenalty = this.mineHazard(square)?5:0;
} else{
minePenalty = this.mineHazard(square)?12:0;
}
int visitPenalty = 2*this.mapIntDistribution[square.x][square.y]*(hasDefusion?5:12);
return directionPenalty+minePenalty+visitPenalty;
}
protected boolean mineHazard(MapLocation location) {
Team mine = rc.senseMine(location);
return (mine == Team.NEUTRAL || mine == myTeam.opponent());
}
@SuppressWarnings("unused")
private boolean beenThereAlready(MapLocation new_location) {
try{
for (MapLocation prevLoc: this.previousFour){
if (prevLoc.equals(new_location)){
return true;
}
}
}catch(Exception e){
return false;
}
return false;
}
@SuppressWarnings("unused")
private boolean isPreviousLocation(MapLocation new_location){
try{
if(new_location.equals(previousFour[0])){
return true;
}
} catch (Exception e){
return false;
}
return false;
}
private void defuseFirstorThenMove(Direction dir) throws GameActionException{
MapLocation ahead = rc.getLocation().add(dir);
if(rc.canMove(dir) && rc.senseMine(ahead)!= null && rc.senseMine(ahead) != rc.getTeam()){
rc.defuseMine(ahead);
}else{
if(rc.canMove(dir)){
rc.move(dir);
}
}
}
private void moveOrDefuse(Direction dir) throws GameActionException{
MapLocation ahead = rc.getLocation().add(dir);
if(rc.canMove(dir) && rc.senseMine(ahead)!= null && rc.senseMine(ahead) != rc.getTeam()){
rc.defuseMine(ahead);
}else{
if(rc.canMove(dir)){
rc.move(dir);
}
}
}
/**
*
* @param whereToGo
* @throws GameActionException
* The original/old version of progressMove.
*/
@SuppressWarnings("unused")
private void progressMoveOld(MapLocation whereToGo) throws GameActionException{
rc.setIndicatorString(1, "Swarm target: "+whereToGo.toString());
int dist = rc.getLocation().distanceSquaredTo(whereToGo);
if (dist>0 && rc.isActive()){
Direction toTarget = rc.getLocation().directionTo(whereToGo);
int[] directionOffsets = {0,1,-1,2,-2};
Direction move;
MapLocation ahead;
for (int offset: directionOffsets){
move = Direction.values()[(toTarget.ordinal()+offset+8)%8];
ahead = rc.getLocation().add(move);
Team mine = rc.senseMine(ahead);
int move_num = move.ordinal();
if (rc.canMove(move) && (mine == rc.getTeam() || mine == null) && move_num != (previousMove+4)%8){
previousMove = move_num;
rc.move(move);
return;
}
}
previousMove = -1;
if(rc.canMove(toTarget) || rc.senseMine(rc.getLocation())==rc.getTeam()){
moveOrDefuse(toTarget);
}
}
}
@SuppressWarnings("unused")
private boolean makeMoveDeterministic(MapLocation potentialNewLocation){
try{
int numberOfTimesBeenOnLocation = this.mapIntDistribution[potentialNewLocation.x][potentialNewLocation.y];
if (numberOfTimesBeenOnLocation < 2){
return true;
}
return false;
} catch (Exception e){
return true;
}
}
/**
*
* @param potentialNewLocation
* @param currentLocation
* @return true if the robot should move to potentialNewLocation (with high probability).
* If the new location has NOT been considered before, then move to that location with probability 1.
*/
private boolean shouldMakeMoveRand(MapLocation potentialNewLocation, MapLocation currentLocation) {
try{
int newLocNum = this.mapIntDistribution[potentialNewLocation.x][potentialNewLocation.y];
// if (newLocNum <= 0){
// return true;
// }
int currLocNum = this.mapIntDistribution[currentLocation.x][currentLocation.y];
int sum = newLocNum + currLocNum;
//Double randomNumber = this.dice.nextDouble() * sum;
int randomNumber = this.dice.nextInt(sum+1);
if (newLocNum >= currLocNum ){
//newLocNum is max
if (randomNumber <= newLocNum){
return true;
}else{
return false;
}
}else{
//currLocNum is max
if (randomNumber <= currLocNum){
return true;
}else{
return false;
}
}
} catch (Exception e){
return true;
}
}
}
|
[
"[email protected]"
] | |
7f8f1e435c53b2a170afdf4e1e2f5d0693cbdf26
|
89f3bfc48f8bc0ba8894d1051e5e57b3fc7e340e
|
/ingelog/EV3backend-master/src/etats/EtatModeAutomatique.java
|
5940bbdc5ab4694aa8b7eb7e61f98073a9ffa500
|
[] |
no_license
|
ThomasDemoulin/ingelog
|
997d33e5fd1ca0f89816969e64c8bd72f515fbe5
|
002b7a8c567965708f8931f51b8a87fa172adba1
|
refs/heads/master
| 2021-05-21T17:48:36.442411 | 2020-06-08T16:10:43 | 2020-06-08T16:10:43 | 252,741,284 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 148 |
java
|
package etats;
public class EtatModeAutomatique implements EtatRobot {
@Override
public String getEtat() {
return "mode automatique";
}
}
|
[
"[email protected]"
] | |
1f7e20867e3f7cf294b78c68121dd7b2a5f30aa8
|
bf6840bab28f2a0cb7467b51e315fb43550ee283
|
/sword/src/main/java/org/dspace/sword/AbstractSwordContentIngester.java
|
7d3f9e1436d7903ceaad149fbdb29313c907fc3e
|
[] |
no_license
|
richardrodgers/mds
|
7c195d0e214f222d09d9c25ce419fb83d1549ea3
|
649bce5fec767ab641b2879f8fee470184a76002
|
refs/heads/master
| 2020-12-30T10:10:46.606962 | 2014-10-15T20:29:23 | 2014-10-15T20:29:23 | 3,308,583 | 9 | 4 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,678 |
java
|
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.sword;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat;
import org.dspace.content.Bundle;
import org.dspace.content.Collection;
import org.dspace.content.MDValue;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.core.Utils;
import org.swordapp.server.Deposit;
import org.swordapp.server.SwordAuthException;
import org.swordapp.server.SwordError;
import org.swordapp.server.SwordServerException;
import java.io.IOException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringTokenizer;
public abstract class AbstractSwordContentIngester implements SwordContentIngester
{
public DepositResult ingest(Context context, Deposit deposit, DSpaceObject dso, VerboseDescription verboseDescription)
throws DSpaceSwordException, SwordError, SwordAuthException, SwordServerException
{
return this.ingest(context, deposit, dso, verboseDescription, null);
}
public DepositResult ingest(Context context, Deposit deposit, DSpaceObject dso, VerboseDescription verboseDescription, DepositResult result)
throws DSpaceSwordException, SwordError, SwordAuthException, SwordServerException
{
if (dso instanceof Collection)
{
return this.ingestToCollection(context, deposit, (Collection) dso, verboseDescription, result);
}
else if (dso instanceof Item)
{
return this.ingestToItem(context, deposit, (Item) dso, verboseDescription, result);
}
return null;
}
public abstract DepositResult ingestToCollection(Context context, Deposit deposit, Collection collection, VerboseDescription verboseDescription, DepositResult result)
throws DSpaceSwordException, SwordError, SwordAuthException, SwordServerException;
public abstract DepositResult ingestToItem(Context context, Deposit deposit, Item item, VerboseDescription verboseDescription, DepositResult result)
throws DSpaceSwordException, SwordError, SwordAuthException, SwordServerException;
protected BitstreamFormat getFormat(Context context, String fileName)
throws SQLException
{
String fext = null;
int lastDot = fileName.lastIndexOf(".");
if (lastDot > -1)
{
fext = fileName.substring(lastDot + 1);
}
if (fext == null)
{
return null;
}
for (BitstreamFormat format : BitstreamFormat.findAll(context))
{
String[] extensions = format.getExtensions();
for (String ext : extensions)
{
if (ext.equals(fext))
{
return format;
}
}
}
return null;
}
/**
* Add the current date to the item metadata. This looks up
* the field in which to store this metadata in the configuration
* sword.updated.field
*
* @param item
* @throws DSpaceSwordException
*/
protected void setUpdatedDate(Item item, VerboseDescription verboseDescription)
throws DSpaceSwordException
{
String field = ConfigurationManager.getProperty("swordv2-server", "updated.field");
if (field == null || "".equals(field))
{
throw new DSpaceSwordException("No configuration, or configuration is invalid for: sword.updated.field");
}
MDValue dc = this.configToDC(field, null);
item.clearMetadata(dc.getSchema(), dc.getElement(), dc.getQualifier(), MDValue.ANY);
item.addMetadata(dc.getSchema(), dc.getElement(), dc.getQualifier(), null, Utils.asISO8601(new Date()));
verboseDescription.append("Updated date added to response from item metadata where available");
}
/**
* Store the given slug value (which is used for suggested identifiers,
* and which DSpace ignores) in the item metadata. This looks up the
* field in which to store this metadata in the configuration
* sword.slug.field
*
* @param item
* @param slugVal
* @throws DSpaceSwordException
*/
protected void setSlug(Item item, String slugVal, VerboseDescription verboseDescription)
throws DSpaceSwordException
{
// if there isn't a slug value, don't set it
if (slugVal == null)
{
return;
}
String field = ConfigurationManager.getProperty("swordv2-server", "slug.field");
if (field == null || "".equals(field))
{
throw new DSpaceSwordException("No configuration, or configuration is invalid for: sword.slug.field");
}
MDValue dc = this.configToDC(field, null);
item.clearMetadata(dc.getSchema(), dc.getElement(), dc.getQualifier(), MDValue.ANY);
item.addMetadata(dc.getSchema(), dc.getElement(), dc.getQualifier(), null, slugVal);
verboseDescription.append("Slug value set in response where available");
}
/**
* Utility method to turn given metadata fields of the form
* schema.element.qualifier into MDValue objects which can be
* used to access metadata in items.
*
* The def parameter should be null, * or "" depending on how
* you intend to use the MDValue object.
*
* @param config
* @param def
*/
protected MDValue configToDC(String config, String def)
{
String schema = def;
String element = def;
String qualifier = def;
StringTokenizer stz = new StringTokenizer(config, ".");
schema = stz.nextToken();
element = stz.nextToken();
if (stz.hasMoreTokens())
{
qualifier = stz.nextToken();
}
return new MDValue(schema, element, qualifier, null, null);
}
}
|
[
"[email protected]"
] | |
6f4faa3b980332d201d262f2a3443f50b6b5afdb
|
0601e6ccd9495eeb4803e06516b0157db0201dd4
|
/app/src/main/java/com/minhtetoo/tedapp/fragments/PlayListFragment.java
|
3f27bced89b1fc82d9f6a8b480be53565a764ebb
|
[
"Apache-2.0"
] |
permissive
|
minhtetoo131/TED-APP
|
369e2695f7db54bd15ad9502da1212dbef5145e5
|
bec60cfd11c64e61a560801315fefc52a89a14a7
|
refs/heads/master
| 2021-05-05T05:36:48.679599 | 2018-02-03T09:22:52 | 2018-02-03T09:22:52 | 118,692,294 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,158 |
java
|
package com.minhtetoo.tedapp.fragments;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.minhtetoo.tedapp.R;
import com.minhtetoo.tedapp.adapters.CategoryRecyclerAdapter;
import com.minhtetoo.tedapp.adapters.PlayListRecyclerAdapter;
import com.minhtetoo.tedapp.data.model.ViewModel;
import com.minhtetoo.tedapp.data.vo.TedPlayListVO;
import java.util.List;
/**
* Created by min on 1/24/2018.
*/
public class PlayListFragment extends Fragment {
private ViewModel mTedModel;
private PlayListRecyclerAdapter mPlaylistRecyclerAdapter;
public PlayListFragment() {
}
public static PlayListFragment getPlayListFragInstance(){
PlayListFragment playListFragment = new PlayListFragment();
return playListFragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View playlistFragment = inflater.inflate(R.layout.fragment_playlist,container,false);
RecyclerView playListRecyclerView = playlistFragment.findViewById(R.id.rv_play_list);
playListRecyclerView.setLayoutManager(new GridLayoutManager(getContext(),2));
mPlaylistRecyclerAdapter = new PlayListRecyclerAdapter(getContext());
playListRecyclerView.setAdapter(mPlaylistRecyclerAdapter);
mTedModel = ViewModelProviders.of(this).get(ViewModel.class);
mTedModel.loadTedPlayList();
mTedModel.initDatabase(getContext());
mTedModel.getTedPlayList().observe(this, new Observer<List<TedPlayListVO>>() {
@Override
public void onChanged(@Nullable List<TedPlayListVO> tedPlaylistVOS) {
}
});
return playlistFragment ;
}
}
|
[
"[email protected]"
] | |
4e2659218407ae92b2d6fe637a0c6238e9317399
|
252890500ea914c50e46ca2e658fe8e2ea227cfd
|
/后端示例/cloudPayAdmin/src/main/java/cloudPayAdmin/util/ParamHelper.java
|
a736833e53e6fcf0f62e372da7474fd3b0d854d4
|
[] |
no_license
|
cjl26/luchong
|
29bfc1459f682cd38816681c37bb811f1a2407b0
|
18cfdb3e8c06838d8dfec822263323ba6a53199b
|
refs/heads/master
| 2021-05-01T21:10:43.381844 | 2018-02-19T05:02:06 | 2018-02-19T05:02:06 | 120,972,227 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,516 |
java
|
package cloudPayAdmin.util;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ParamHelper {
protected final static Logger logger = LoggerFactory.getLogger(ParamHelper.class);
/**
* 获取一个对象的所有字段及其值,放到map对象中
* @param obj
* @param params
* @return
*/
public static boolean getFiledValues(Object obj, SortedMap<String, String> params){
if(obj==null)return false;
Class claz = obj.getClass();
while(!claz.getName().endsWith(".Object")){
Field [] fields = claz.getDeclaredFields();
for(Field fd : fields){
try{
getFieldValues(fd, claz, obj, params);
}catch(Exception ex){
}
}
claz = claz.getSuperclass();
}
return true;
}
private static void getFieldValues(Field fd, Class claz, Object obj, SortedMap<String, String> params) throws Exception {
String fdName = fd.getName();
String firstLetter = fdName.substring(0,1).toUpperCase();
String getMethodName = "get" + firstLetter + fdName.substring(1);
Method getMethod = claz.getMethod(getMethodName, new Class[]{});
Object value = getMethod.invoke(obj,new Object[]{});
params.put(fdName, value.toString());
}
/**
* 计算参数签名值
* @param signParams 参数列表
* @param paramSignKey 签名密钥
* @param charsetname 字符编码
* @return 签名值
*/
public static String genMd5Sign(SortedMap<String, String> signParams, String paramSignKey, String charsetname)
{
StringBuffer sb = new StringBuffer();
Set es = signParams.entrySet();
Iterator it = es.iterator();
while (it.hasNext())
{
Map.Entry entry = (Map.Entry) it.next();
String k = (String) entry.getKey();
String v = (String) entry.getValue();
if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k))
{
sb.append(k + "=" + v + "&");
}
}
sb.append("key=" + paramSignKey);
String toSignString = sb.toString();
String sign = MD5Util.MD5Encode(toSignString, charsetname).toUpperCase();
logger.info("toSignString: " + toSignString);
logger.info("sign output: " + sign);
return sign;
}
/**
* 计算参数签名值
* @param obj 对象
* @param paramSignKey 签名密钥
* @param charsetname 字符编码
* @return 签名值
*/
public static String genMd5Sign(Object obj, String paramSignKey, String charset){
SortedMap<String, String> params = new TreeMap<String, String>();
if(ParamHelper.getFiledValues(obj, params)){
String sign = genMd5Sign(params, paramSignKey, charset);
return sign;
}
return "";
}
public static String getNonceStr() {
Random random = new Random();
return MD5Util.MD5Encode(String.valueOf(random.nextInt(10000)), "UTF-8");
}
/**
* 取出一个指定长度大小的随机正整数.
*
* @param length
* int 设定所取出随机数的长度。length小于11
* @return int 返回生成的随机数。
*/
public static int buildRandom(int length) {
int num = 1;
double random = Math.random();
if (random < 0.1) {
random = random + 0.1;
}
for (int i = 0; i < length; i++) {
num = num * 10;
}
return (int) ((random * num));
}
}
|
[
"Jinlong"
] |
Jinlong
|
11d428fb8d2aca5a6ec87fe0f6e9b264cd0a34f1
|
8268d4dc2291d4a913964406fa0762e00f2e453e
|
/src/main/java/com/navtech/service/impl/StudentServiceImpl.java
|
d512996b5a30489a614dfb9f92fa991aa09236f4
|
[] |
no_license
|
JainNaveen94/Spring-Hiberbnate-Practise-Project
|
a37b159ba929b8602076ed26b0b1bd5bf8b06736
|
f09bc50481d71f0a1c0e96afb9275d7a474ebe5f
|
refs/heads/master
| 2021-01-03T01:22:10.978082 | 2020-02-14T20:35:18 | 2020-02-14T20:35:18 | 239,853,990 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,675 |
java
|
package com.navtech.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import com.navtech.custome.exception.StudentNotFoundException;
import com.navtech.dao.StudentDAO;
import com.navtech.models.Certificate;
import com.navtech.models.Course;
import com.navtech.models.Student;
import com.navtech.service.CertificateService;
import com.navtech.service.CourseService;
import com.navtech.service.StudentService;
@Service
public class StudentServiceImpl implements StudentService {
/* */
@Autowired
private StudentDAO studentDao;
@Autowired
private CertificateService certificateService;
@Autowired
private CourseService courseService;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Override
public Student addStudent(Student student) {
student.setPassword(bCryptPasswordEncoder.encode(student.getPassword()));
return this.studentDao.addStudent(student);
}
@Override
public String issueCertificateToStudent(String certificateId, String username) {
List<Student> students = this.studentDao.getAllTheStudents();
Certificate certificate = this.certificateService.getCertificate(certificateId);
if(students.size() > 0 && certificate != null) {
for(Student studentObj: students) {
if(studentObj.getUsername().equalsIgnoreCase(username)) {
studentObj.getCertificateList().add(certificate);
certificate.setStudent(studentObj);
boolean studentUpdated = this.studentDao.updateStudent(studentObj);
if(studentUpdated) {
return "Certificate With CertificateID :: " + certificateId
+ " is Successfully issued to " + studentObj.getUsername();
} else {
return "Certificate With CertificateID :: " + certificateId
+ " is Not issued to " + studentObj.getUsername() + " due to Some Internal Error.";
}
}
}
} else if(students.size() <= 0) {
return "Certificate With CertificateID :: " + certificateId
+ " is not Issued due to Invalid " + username;
} else {
return "Certificate With CertificateID :: " + certificateId
+ " is not valid Certificate ID";
}
return "Internal Server Error Occured";
}
@Override
public List<Certificate> getCertificateListOfStudent(String username) {
Student student = this.getStudentFromStudentList(username);
if(student != null) {
return student.getCertificateList();
} else {
throw new StudentNotFoundException(username + " is not a Valid User");
}
}
@Override
public Student getStudentFromStudentList(String username) {
List<Student> students = this.studentDao.getAllTheStudents();
if(students.size() > 0) {
for(Student studentObj: students) {
if(studentObj.getUsername().equals(username)) {
return studentObj;
}
}
}
return null;
}
@Override
public String enrolledForTheCourse(String studentUserName, String courseName) {
Student student = this.getStudentFromStudentList(studentUserName);
if(student != null) {
Course course = this.courseService.getCourseFromCourseName(courseName);
if(course != null) {
course.getStudents().add(student);
student.getCourses().add(course);
boolean result = this.studentDao.updateStudent(student);
if(result) {
return studentUserName + " Enrolled For the Course " + courseName + " Successfully";
} else {
return "Internal Server Error Please try Again";
}
} else {
return courseName + " is not a Valid Course.";
}
} else {
return studentUserName + " is not Exist into the System.";
}
}
}
|
[
"[email protected]"
] | |
1058c26ce42335cad0e34fc11e243b7c92a53c71
|
8adaa9ad73564c898f552e2d0d715ee657e10b4e
|
/src/edu/tju/ina/seeworld/struts/action/multimedia/MultimediaAction.java
|
182854767d2caab97bcedf3582cda983d7931463
|
[] |
no_license
|
zeplios/SeeWorld
|
9bc294765068d390742b9cbc22a7deff899b6578
|
891088e90ceb7d6bd53d7928e26e255a94679101
|
refs/heads/master
| 2020-05-18T17:15:41.427908 | 2015-08-09T14:10:39 | 2015-08-09T14:10:39 | 40,438,177 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,304 |
java
|
package edu.tju.ina.seeworld.struts.action.multimedia;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import com.opensymphony.xwork2.ModelDriven;
import edu.tju.ina.seeworld.exception.SeeWorldException;
import edu.tju.ina.seeworld.logic.IUserLogic;
import edu.tju.ina.seeworld.logic.MovieLogic;
import edu.tju.ina.seeworld.logic.INewThingsLogic;
import edu.tju.ina.seeworld.logic.SerialLogic;
import edu.tju.ina.seeworld.logic.SingleSerialLogic;
import edu.tju.ina.seeworld.logic.VideoLogic;
import edu.tju.ina.seeworld.po.resource.Movie;
import edu.tju.ina.seeworld.po.resource.Serial;
import edu.tju.ina.seeworld.po.resource.SingleSerial;
import edu.tju.ina.seeworld.po.resource.Video;
import edu.tju.ina.seeworld.po.user.User;
import edu.tju.ina.seeworld.struts.action.common.BaseAction;
import edu.tju.ina.seeworld.util.Constant;
import edu.tju.ina.seeworld.util.IDAssistant;
import edu.tju.ina.seeworld.util.VOPOTransformator;
import edu.tju.ina.seeworld.util.enums.MultimediaType;
import edu.tju.ina.seeworld.vo.MovieVOForView;
import edu.tju.ina.seeworld.vo.MultimediaVOForView;
import edu.tju.ina.seeworld.vo.SerialVOForView;
import edu.tju.ina.seeworld.vo.SingleSerialVOForView;
import edu.tju.ina.seeworld.vo.VideoVOForView;
/**
* 本类处理所有的观看请求,核心方法为playAction,根据传入的multimedia的id和resourceId进入播放页
* 根据resource的不同跳转结果如下
* MOVIE:跳转到movie的播放页,返回代表当前播放电影的movie对象和相关电影列表relativeMovies
* VIDEO:跳转到video的播放页,返回代表当前播放视频的video对象和相关视频列表relativeVideos
* SERIAL:跳转到serial的列表页,返回代表当前剧集的对象serial和相关剧集列表relativeSerials
* SINGLESERIAL:跳转到单集的播放页,返回代表单集的singleserial对象
* default:跳转到首页
* @author zhfch
*
*/
public class MultimediaAction extends BaseAction implements ModelDriven<MultimediaVOForView> {
private static final long serialVersionUID = -4392193229193054755L;
/* 必须在playAction中赋值,用来指定跳转到哪个view页,z */
private MultimediaType type;
private MultimediaVOForView model;
private List<MovieVOForView> relativeMovies;
private List<VideoVOForView> relativeVideos;
private List<SerialVOForView> relativeSerials;
private MovieLogic movieLogic;
private VideoLogic videoLogic;
private SerialLogic serialLogic;
private SingleSerialLogic singleSerialLogic;
private INewThingsLogic newThingsLogic;
private IUserLogic userLogic;
private IDAssistant iDAssistant;
private VOPOTransformator vOPOTransformator;
private Integer id;
private String resourceId;
public String playAction() {
try {
User u = userLogic.findByUserName(getCurrentUsername()).get(0);
String resourceName = iDAssistant.getResourceName(resourceId);
if (StringUtils.equalsIgnoreCase(
resourceName, MultimediaType.Movie.toString())) {
type = MultimediaType.Movie;
Movie m = movieLogic.getMovieById(id);
m.setClickCount(m.getClickCount() + 1);
movieLogic.update(m);
List<Movie> list = movieLogic.getRelativeMovies(id);
relativeMovies = vOPOTransformator
.transferMovieToVOForViewList(list);
newThingsLogic.addViewNewThings(u, id, m.getResource());
model = new MovieVOForView(m);
} else if (StringUtils.equalsIgnoreCase(
resourceName, MultimediaType.Video.toString())) {
type = MultimediaType.Video;
Video v = videoLogic.getVideoById(id);
v.setClickCount(v.getClickCount() + 1);
videoLogic.update(v);
newThingsLogic.addViewNewThings(u, id, v.getResource());
List<Video> list = videoLogic.getRelativeVideos(id);
relativeVideos = vOPOTransformator
.transferVideoToVOForViewList(list);
model = new VideoVOForView(v);
} else if (StringUtils.equalsIgnoreCase(
resourceName, MultimediaType.Serial.toString())) {
type = MultimediaType.Serial;
} else if (StringUtils.equalsIgnoreCase(
resourceName, MultimediaType.SingleSerial.toString())) {
type = MultimediaType.SingleSerial;
SingleSerial ss = singleSerialLogic.findByID(id);
ss.setClickCount(ss.getClickCount() + 1);
Serial s = ss.getSerial();
Integer serialId = (Integer) session.get(Constant.CURRENT_SERIAL_ID_IN_SESSION);
if (serialId == null || !serialId.equals(s.getId())){
s.setClickCount(s.getClickCount() + 1);
session.put(Constant.CURRENT_SERIAL_ID_IN_SESSION, s.getId());
serialLogic.update(s);
}
singleSerialLogic.update(ss);
newThingsLogic.addViewNewThings(u, id, s.getResource());
model = new SingleSerialVOForView(ss);
} else
return TO_MAIN_PAGE;
} catch (SeeWorldException e) {
e.printStackTrace();
}
return PLAYMULTIMEDIA;
}
public List<MovieVOForView> getRelativeMovies() {
return relativeMovies;
}
public List<VideoVOForView> getRelativeVideos() {
return relativeVideos;
}
public List<SerialVOForView> getRelativeSerials() {
return relativeSerials;
}
public void setMovieLogic(MovieLogic movieLogic) {
this.movieLogic = movieLogic;
}
public void setVideoLogic(VideoLogic videoLogic) {
this.videoLogic = videoLogic;
}
public void setSerialLogic(SerialLogic serialLogic) {
this.serialLogic = serialLogic;
}
public void setSingleSerialLogic(SingleSerialLogic singleSerialLogic) {
this.singleSerialLogic = singleSerialLogic;
}
public void setNewThingsLogic(INewThingsLogic newThingsLogic) {
this.newThingsLogic = newThingsLogic;
}
public void setUserLogic(IUserLogic userLogic) {
this.userLogic = userLogic;
}
public void setiDAssistant(IDAssistant iDAssistant) {
this.iDAssistant = iDAssistant;
}
public void setvOPOTransformator(VOPOTransformator vOPOTransformator) {
this.vOPOTransformator = vOPOTransformator;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getType() {
return type.toString();
}
public MultimediaVOForView getModel() {
// TODO Auto-generated method stub
return model;
}
}
|
[
"[email protected]"
] | |
f163c426e19269e444066dd669b22e90c1e79d4b
|
c94f888541c0c430331110818ed7f3d6b27b788a
|
/commonrcsmart/java/src/main/java/com/antgroup/antchain/openapi/commonrcsmart/models/RcSmartResponse.java
|
20d1e2b4fed5debae9e36c3dabb74f5e1de283e1
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
alipay/antchain-openapi-prod-sdk
|
48534eb78878bd708a0c05f2fe280ba9c41d09ad
|
5269b1f55f1fc19cf0584dc3ceea821d3f8f8632
|
refs/heads/master
| 2023-09-03T07:12:04.166131 | 2023-09-01T08:56:15 | 2023-09-01T08:56:15 | 275,521,177 | 9 | 10 |
MIT
| 2021-03-25T02:35:20 | 2020-06-28T06:22:14 |
PHP
|
UTF-8
|
Java
| false | false | 1,683 |
java
|
// This file is auto-generated, don't edit it. Thanks.
package com.antgroup.antchain.openapi.commonrcsmart.models;
import com.aliyun.tea.*;
public class RcSmartResponse extends TeaModel {
// 结果码
@NameInMap("code")
@Validation(required = true)
public String code;
// 返回码描述
@NameInMap("msg")
@Validation(required = true)
public String msg;
// 业务处理结果码
@NameInMap("sub_code")
public String subCode;
// 返回的提示信息
@NameInMap("sub_msg")
public String subMsg;
// 可否重试
@NameInMap("retry")
public Boolean retry;
public static RcSmartResponse build(java.util.Map<String, ?> map) throws Exception {
RcSmartResponse self = new RcSmartResponse();
return TeaModel.build(map, self);
}
public RcSmartResponse setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public RcSmartResponse setMsg(String msg) {
this.msg = msg;
return this;
}
public String getMsg() {
return this.msg;
}
public RcSmartResponse setSubCode(String subCode) {
this.subCode = subCode;
return this;
}
public String getSubCode() {
return this.subCode;
}
public RcSmartResponse setSubMsg(String subMsg) {
this.subMsg = subMsg;
return this;
}
public String getSubMsg() {
return this.subMsg;
}
public RcSmartResponse setRetry(Boolean retry) {
this.retry = retry;
return this;
}
public Boolean getRetry() {
return this.retry;
}
}
|
[
"[email protected]"
] | |
a1f77c46ab7e6e00fccc5b7d897a51881fa8f1bf
|
1eb9b656ec1f79c8691b746644bccc6b80bb735b
|
/modules/junit4/junit4-core/src/test/java/org/testifyproject/junit4/ComplexCollaboratorProviderTest.java
|
e1e8ae984fefa21ec5464dcbcea41b1c8b7cc976
|
[
"Apache-2.0"
] |
permissive
|
testify-project/testify
|
caf1dc3648c9f2e4b368f0e8e48614ec5c521e9b
|
31588b3574d0b3194edf653825113885e83cb8e7
|
refs/heads/develop
| 2023-07-07T04:05:37.880031 | 2018-08-21T22:24:05 | 2018-08-21T22:24:05 | 78,854,439 | 10 | 1 |
Apache-2.0
| 2023-06-27T14:19:09 | 2017-01-13T14:05:35 |
Java
|
UTF-8
|
Java
| false | false | 1,392 |
java
|
/*
* Copyright 2016-2017 Testify Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.testifyproject.junit4;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.testifyproject.annotation.CollaboratorProvider;
import org.testifyproject.annotation.Sut;
import org.testifyproject.junit4.fixture.collaborator.ComplexCollaboratorProvider;
import org.testifyproject.junit4.fixture.collaborator.ComplexCollaboratorType;
/**
*
* @author saden
*/
@CollaboratorProvider(ComplexCollaboratorProvider.class)
@RunWith(UnitTest.class)
public class ComplexCollaboratorProviderTest {
@Sut(factoryMethod = "builder")
ComplexCollaboratorType sut;
@Test
public void verifyInjections() {
assertThat(sut).isNotNull();
assertThat(sut.getMessage()).isNotEmpty();
}
}
|
[
"[email protected]"
] | |
5919bbc66289d67cd812c6bb7774b887af667451
|
547bfa05a221d3bc87b98ba57258c1ed59f07ab1
|
/app/src/main/java/ru/melandra/weather/ui/fragments/WeatherFragment.java
|
99c3f7a48dd0dcb8fd6e6511adc8de4f6c9be81c
|
[] |
no_license
|
DenSamara1978/Weather
|
ef64ba950f3596d868772e867bedfa19f385fa0b
|
b17171f29eda020c75c69a876eeee302c13ed8bd
|
refs/heads/master
| 2021-06-02T10:41:51.937234 | 2020-06-12T21:22:07 | 2020-06-12T21:22:07 | 254,326,505 | 0 | 0 | null | 2020-06-12T21:22:08 | 2020-04-09T09:23:15 |
Java
|
UTF-8
|
Java
| false | false | 6,910 |
java
|
package ru.melandra.weather.ui.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import ru.melandra.weather.datasources.RequestLocationReciever;
import ru.melandra.weather.datasources.WeatherDayData;
import ru.melandra.weather.global.App;
import ru.melandra.weather.global.NetInteraction;
import ru.melandra.weather.datasources.RequestWeatherReciever;
import ru.melandra.weather.datasources.WeatherDayDataSource;
import ru.melandra.weather.datasources.WeatherDaySourceBuilder;
import ru.melandra.weather.global.Constants;
import ru.melandra.weather.global.GlobalSettings;
import ru.melandra.weather.R;
import ru.melandra.weather.global.Weather;
import ru.melandra.weather.ui.adapters.WeatherDayAdapter;
public class WeatherFragment extends Fragment implements Constants, RequestWeatherReciever, RequestLocationReciever
{
private TextView cityNameLabel;
private RecyclerView threeDaysList;
private TextView temperatureView;
private TextView humidityView;
private ImageView cloudinessView;
private ImageView windView;
private ImageView targetView;
private final static int REQUEST_CODE = 1;
private AlertDialog alert;
public WeatherFragment ()
{
// Required empty public constructor
}
public static WeatherFragment create ( String cityName ) {
WeatherFragment fragment = new WeatherFragment ();
Bundle args = new Bundle ();
args.putString ( cityNameParam, cityName );
fragment.setArguments ( args );
return fragment;
}
@Override
public View onCreateView ( LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState )
{
View view = inflater.inflate ( R.layout.fragment_weather, container, false );
cityNameLabel = view.findViewById ( R.id.cityView );
Button aboutButton = view.findViewById ( R.id.contextAboutCityButton );
threeDaysList = view.findViewById ( R.id.threeDaysList );
temperatureView = view.findViewById ( R.id.temperatureView );
humidityView = view.findViewById ( R.id.humidityView );
cloudinessView = view.findViewById ( R.id.cloudinessView );
windView = view.findViewById ( R.id.windDirectionView );
targetView = view.findViewById ( R.id.targetView );
String cityName = ( getArguments () == null ) ? GlobalSettings.getInstance ().getCityName () : getCurrentCityName ();
cityNameLabel.setText ( cityName );
temperatureView.setText ( "-" );
humidityView.setText ( "-" );
aboutButton.setOnClickListener ( new View.OnClickListener ()
{
@Override
public void onClick ( View view )
{
Intent intent = new Intent ( Intent.ACTION_VIEW, Uri.parse ("https://ru.wikipedia.org/wiki/" + cityNameLabel.getText ()));
startActivity ( intent );
}
} );
initThreeDaysList ();
initErrorDialog ();
final RequestLocationReciever fragment = this;
targetView.setOnClickListener ( new View.OnClickListener ()
{
@Override
public void onClick ( View v )
{
App.getInstance ().requestLocation ( getActivity (), fragment);
}
} );
NetInteraction.getInstance ().requestCurrentWeatherByCityname ( cityName, this );
return view;
}
private void initErrorDialog () {
AlertDialog.Builder builder = new AlertDialog.Builder ( getContext ());
builder.setTitle ( getString( R.string.important_message) )
.setMessage ( getString( R.string.connection_error) )
.setPositiveButton ( getString( R.string.ok), new DialogInterface.OnClickListener ()
{
@Override
public void onClick ( DialogInterface dialogInterface, int i )
{
}
} );
alert = builder.create ();
}
public String getCurrentCityName () {
Bundle args = getArguments ();
return ( args != null ) ? args.getString ( cityNameParam, "" ) : "";
}
private void initThreeDaysList () {
threeDaysList.setHasFixedSize ( true );
threeDaysList.setLayoutManager ( new LinearLayoutManager ( getContext (), RecyclerView.VERTICAL, false));
WeatherDayDataSource data = new WeatherDaySourceBuilder ().build ();
threeDaysList.setAdapter ( new WeatherDayAdapter ( data ));
Context context = getContext ();
DividerItemDecoration itemDecoration = new DividerItemDecoration ( context, LinearLayoutManager.VERTICAL );
itemDecoration.setDrawable ( context.getDrawable(R.drawable.separator ));
threeDaysList.addItemDecoration(itemDecoration);
}
private void displayWeather ( WeatherDayData weather ) {
cityNameLabel.setText ( weather.getCityName ());
temperatureView.setText ( Weather.getTemperature ( weather.getTemperature () ) );
humidityView.setText(String.format("%d%%", weather.getHumidity ()));
NetInteraction.getInstance ().loadImage ( cloudinessView );
}
@Override
public void onResult ( final WeatherDayData weather )
{
Activity activity = getActivity ();
if ( activity != null )
activity.runOnUiThread ( new Runnable ()
{
@Override
public void run ()
{
displayWeather ( weather );
}
} );
}
@Override
public void onError ( Throwable thr )
{
Activity activity = getActivity ();
if ( activity != null )
activity.runOnUiThread ( new Runnable ()
{
@Override
public void run ()
{
alert.show ();
}
} );
}
@Override
public void onResult ( Location location )
{
NetInteraction.getInstance ().requestCurrentWeatherByCoord ( location, this );
}
}
|
[
"[email protected]"
] | |
5e70c561668ac3b9c67be80c268e3934b2066cd7
|
c885ef92397be9d54b87741f01557f61d3f794f3
|
/results/JacksonDatabind-111/com.fasterxml.jackson.databind.deser.impl.FieldProperty/BBC-F0-opt-40/tests/18/com/fasterxml/jackson/databind/deser/impl/FieldProperty_ESTest.java
|
49d918e3e4359af614de606325356ccfd93c0918
|
[
"CC-BY-4.0",
"MIT"
] |
permissive
|
pderakhshanfar/EMSE-BBC-experiment
|
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
|
fea1a92c2e7ba7080b8529e2052259c9b697bbda
|
refs/heads/main
| 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null |
UTF-8
|
Java
| false | false | 1,176 |
java
|
/*
* This file was automatically generated by EvoSuite
* Thu Oct 21 11:36:34 GMT 2021
*/
package com.fasterxml.jackson.databind.deser.impl;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.fasterxml.jackson.databind.deser.impl.FieldProperty;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class FieldProperty_ESTest extends FieldProperty_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
FieldProperty fieldProperty0 = null;
try {
fieldProperty0 = new FieldProperty((FieldProperty) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase", e);
}
}
}
|
[
"[email protected]"
] | |
6eb4c8dc1b55d6b6cd88cebc23f3b5d68e4a8ef1
|
19490fcc6f396eeb35a9234da31e7b615abf6d04
|
/JDownloader/src/jd/plugins/decrypter/MxiLnkCom.java
|
77be0bc60ee94e3935c358649d3076a815de9c04
|
[] |
no_license
|
amicom/my-project
|
ef72026bb91694e74bc2dafd209a1efea9deb285
|
951c67622713fd89448ffe6e0983fe3f934a7faa
|
refs/heads/master
| 2021-01-02T09:15:45.828528 | 2015-09-06T15:57:01 | 2015-09-06T15:57:01 | 41,953,961 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,147 |
java
|
//jDownloader - Downloadmanager
//Copyright (C) 2009 JD-Team [email protected]
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.plugins.decrypter;
import java.util.ArrayList;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterException;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForDecrypt;
@DecrypterPlugin(revision = "$Revision: 20698 $", interfaceVersion = 2, names = { "maxi-link.com" }, urls = { "http://[\\w\\.]*?maxi-link\\.com/[a-z0-9]+/.*?\\.html" }, flags = { 0 })
public class MxiLnkCom extends PluginForDecrypt {
public MxiLnkCom(PluginWrapper wrapper) {
super(wrapper);
}
private static final String CAPTCHATEXT = "/c/";
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
String parameter = param.toString();
br.getPage(parameter);
if (br.containsHTML("class=\"size\">0 o</span><br")) {
logger.info("Link offline: " + parameter);
return decryptedLinks;
}
if (!br.containsHTML(CAPTCHATEXT)) {
logger.warning("Couldn't find the captchatext, stopping...");
return null;
}
for (int i = 0; i <= 3; i++) {
String captchaurl = br.getRegex("Please enter code :<br />[\t\n\r ]+<img src=\"(/.*?)\"").getMatch(0);
if (captchaurl == null) captchaurl = br.getRegex("\"(/c/\\d+\\.png)\"").getMatch(0);
if (captchaurl == null) return null;
captchaurl = "http://en.maxi-link.com" + captchaurl;
br.postPage(parameter, "open=Open&c=" + getCaptchaCode(captchaurl, param));
if (br.containsHTML(CAPTCHATEXT)) continue;
break;
}
if (br.containsHTML(CAPTCHATEXT)) throw new DecrypterException(DecrypterException.CAPTCHA);
String finallink = br.getRegex(">Download : <a href=\"(.*?)\"").getMatch(0);
if (finallink == null) finallink = br.getRegex("class=\"u\">(.*?)</a>").getMatch(0);
if (finallink == null) {
logger.warning("finallink could not be found...");
return null;
}
decryptedLinks.add(createDownloadlink(finallink));
return decryptedLinks;
}
/* NO OVERRIDE!! */
public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {
return true;
}
}
|
[
"[email protected]"
] | |
cac2a6a4666be15dfd9ebd0b74cc0f6166037b60
|
6b72776ce826b22efdf7534e8f86c21332f1a897
|
/src/org/darkstorm/minecraft/darkmod/hooks/client/GuiButton.java
|
23a1645e229b75298cc33b7c472191ca17e58f7a
|
[] |
no_license
|
DarkStorm652/DarkMod
|
e2019cca13f46020ee15389b7e1725594beb040f
|
4ee1f4e6a933d1928b02b6868aefcbf3c331e6b1
|
refs/heads/master
| 2021-01-02T22:30:58.546298 | 2012-04-30T20:25:22 | 2012-04-30T20:25:22 | 1,762,805 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 491 |
java
|
package org.darkstorm.minecraft.darkmod.hooks.client;
public interface GuiButton {
public int getX();
public void setX(int x);
public int getY();
public void setY(int y);
public int getHeight();
public void setHeight(int height);
public int getWidth();
public void setWidth(int width);
public String getText();
public void setText(String text);
public int getID();
public void setID(int id);
public boolean isEnabled();
public void setEnabled(boolean enabled);
}
|
[
"[email protected]"
] | |
ac337448dfabc3b3ea8b37b3c1810e0d703b2ae0
|
99fe3613bde138bf89ad5690b33a68456c285502
|
/src/Myframe.java
|
9fbb51cb2daf66fe9dc4ceed9ff73f8079c15844
|
[] |
no_license
|
MR-Wang13/Personnel-management-system-in-Java-
|
2c1e6f845518a9ae05268adee2f40239630c8e18
|
39d69b6c315f81e6d6608cca15a3b4f8752b850d
|
refs/heads/master
| 2021-01-17T17:09:52.441223 | 2016-06-16T01:22:19 | 2016-06-16T01:22:19 | 61,251,930 | 0 | 0 | null | null | null | null |
GB18030
|
Java
| false | false | 2,472 |
java
|
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import javax.swing.JEditorPane;
import javax.swing.JTextField;
import java.awt.Color;
import java.awt.Font;
import java.awt.SystemColor;
import java.sql.SQLException;
import javax.swing.UIManager;
public class Myframe extends JFrame{
String s1=null;
Myframe(String s1){
this.s1=s1;
initGUI();
}
private void initGUI() {
// TODO Auto-generated method stub
final JFrame mf=new JFrame("人事管理系统");
mf.setLocation(660,340);
mf.setBackground(Color.BLUE);
JPanel jp=new JPanel();
jp.setBackground(Color.GRAY);
JButton cha=new JButton("人事变动");
cha.setBounds(161, 221, 150, 30);
cha.setForeground(Color.GREEN);
JButton ser=new JButton("\u5458\u5DE5\u7BA1\u7406");
ser.setBounds(161, 164, 150, 30);
ser.setForeground(Color.GREEN);
ser.setBackground(Color.WHITE);
jp.setLayout(null);
jp.add(ser);
jp.add(cha);
mf.getContentPane().add(jp);
JButton btnNewButton = new JButton("\u4FEE\u6539\u5BC6\u7801");
btnNewButton.setForeground(Color.GREEN);
btnNewButton.setBounds(161, 280, 150, 30);
btnNewButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
try {
mf.setVisible(false);
new Passwd(s1);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
jp.add(btnNewButton);
JLabel lblNewLabel = new JLabel(new ImageIcon("D:\\sqltest\\fm3.png"));
lblNewLabel.setBounds(0, 0, 492, 466);
jp.add(lblNewLabel);
mf.setVisible(true);
mf.setSize(500, 500);
ser.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
mf.setVisible(false);
new Mf4(s1);
}
});
cha.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
mf.setVisible(false);
new Mf3();
}
});
}
}
|
[
"Administrator@520-002"
] |
Administrator@520-002
|
9212e031fcc8bd10cdf94fdb0add536f4b9cc03a
|
1ce055f928f5731eb407a5f7bece453defc8e0d3
|
/back-end/src/main/java/com/social/security/JwtAuthenticationTokenFilter.java
|
fee43fc6791c76ab9a704255b60a93d0707c64e2
|
[
"MIT"
] |
permissive
|
lumeen/CurierApp2
|
e4f9d6dc75c9eb8d66b6e233c9ec373122f5bc4f
|
fd041dfd68c53f6340135f3415ba98b1d1d62f04
|
refs/heads/master
| 2020-03-20T08:25:37.592402 | 2018-08-05T20:38:57 | 2018-08-05T20:38:57 | 137,308,471 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,935 |
java
|
package com.social.security;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
private final Log loggerr = LogFactory.getLog(this.getClass());
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Value("${jwt.header}")
private String tokenHeader;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
String authToken = request.getHeader(this.tokenHeader);
System.out.println(request.getHeader(this.tokenHeader));
if(authToken != null && authToken.startsWith("Bearer ")) {
authToken = authToken.substring(7);
}
String username = jwtTokenUtil.getUsernameFromToken(authToken);
logger.info("checking authentication for user " + username);
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
// It is not compelling necessary to load the use details from the database. You could also store the information
// in the token and read it from it. It's up to you ;)
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
// For simple validation it is completely sufficient to just check the token integrity. You don't have to call
// the database compellingly. Again it's up to you ;)
if (jwtTokenUtil.validateToken(authToken, userDetails)) {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
logger.info("authenticated user " + username + ", setting security context");
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
chain.doFilter(request, response);
}
}
|
[
"[email protected]"
] | |
055fa1f5628205c24e065b4d95160598eb9063ba
|
a6d35fa2b11fe7098ce0ab93cb98b4d31eada17f
|
/app/src/main/java/com/rinkaze/wanandroid/model/NaviModel.java
|
31bf79523b94f7f95f236afeba9b413d90827e46
|
[] |
no_license
|
Rinkaze/WanAndroid
|
98cf1ab999dccc30e6a03ccee07cb1963de8d1b6
|
930cf1ba4c05544934d599d2038b64ba43fda216
|
refs/heads/master
| 2020-05-25T02:59:03.847748 | 2019-05-24T11:13:45 | 2019-05-24T11:13:45 | 187,589,663 | 0 | 0 | null | 2019-05-21T09:13:54 | 2019-05-20T07:28:01 |
Java
|
UTF-8
|
Java
| false | false | 1,411 |
java
|
package com.rinkaze.wanandroid.model;
import com.rinkaze.wanandroid.base.BaseModel;
import com.rinkaze.wanandroid.icallback.ICallBack;
import com.rinkaze.wanandroid.net.BaseObserver;
import com.rinkaze.wanandroid.net.HttpUtils;
import com.rinkaze.wanandroid.net.RxUtils;
import com.rinkaze.wanandroid.servicelist.ServiceList;
import com.rinkaze.wanandroid.ui.navigation.bean.Navi_Tab_Bean;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
public class NaviModel extends BaseModel {
public void initNaviTab(final ICallBack<Navi_Tab_Bean> iCallBack){
ServiceList apiserver = HttpUtils.getInstance().getApiserver(ServiceList.url, ServiceList.class);
Observable<Navi_Tab_Bean> naviTab = apiserver.getNaviTab();
naviTab.compose(RxUtils.<Navi_Tab_Bean>rxObserableSchedulerHelper())
.subscribe(new BaseObserver<Navi_Tab_Bean>() {
@Override
public void onNext(Navi_Tab_Bean navi_tab_bean) {
iCallBack.Success(navi_tab_bean);
}
@Override
public void error(String msg) {
iCallBack.Fain(msg);
}
@Override
protected void subscribe(Disposable d) {
addDisposable(d);
}
});
}
}
|
[
"[email protected]"
] | |
d95bff4fda3760fc8c933f7c90ceb594932d6f1f
|
35348f6624d46a1941ea7e286af37bb794bee5b7
|
/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/properties/UnsupportedMapDB.java
|
384a33b3bb5acf564018dc93a6e1c2f9f69ba0e2
|
[
"Apache-2.0",
"GPL-1.0-or-later",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
StarCrossPortal/ghidracraft
|
7af6257c63a2bb7684e4c2ad763a6ada23297fa3
|
a960e81ff6144ec8834e187f5097dfcf64758e18
|
refs/heads/master
| 2023-08-23T20:17:26.250961 | 2021-10-22T00:53:49 | 2021-10-22T00:53:49 | 359,644,138 | 80 | 19 |
Apache-2.0
| 2021-10-20T03:59:55 | 2021-04-20T01:14:29 |
Java
|
UTF-8
|
Java
| false | false | 2,414 |
java
|
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.program.database.properties;
import java.io.IOException;
import ghidra.program.database.map.AddressMap;
import ghidra.program.model.address.Address;
import ghidra.program.util.ChangeManager;
import ghidra.util.exception.*;
import ghidra.util.prop.PropertyVisitor;
import ghidra.util.task.TaskMonitor;
import db.DBHandle;
import db.util.ErrorHandler;
/**
* This class provides a dummy map for an unsupported map.
*/
public class UnsupportedMapDB extends PropertyMapDB {
/**
* Construct a dummy property map.
* @param dbHandle database handle.
* @param openMode the mode that the program was openned in.
* @param errHandler database error handler.
* @param changeMgr change manager for event notification
* @param addrMap address map.
* @param name property name.
* @param monitor progress monitor that is only used when upgrading
* @throws VersionException if the database version is not the expected version.
* @throws CancelledException if the user cancels the upgrade operation.
* @throws IOException if a database io error occurs.
*/
UnsupportedMapDB(DBHandle dbHandle, int openMode, ErrorHandler errHandler,
ChangeManager changeMgr, AddressMap addrMap, String name, TaskMonitor monitor)
throws VersionException, CancelledException, IOException {
super(dbHandle, errHandler, changeMgr, addrMap, name);
checkMapVersion(openMode, monitor);
}
/**
* @see ghidra.program.model.util.PropertyMap#applyValue(ghidra.util.prop.PropertyVisitor, ghidra.program.model.address.Address)
*/
public void applyValue(PropertyVisitor visitor, Address addr) {
throw new AssertException();
}
/**
* @see ghidra.program.model.util.PropertyMap#getObject(ghidra.program.model.address.Address)
*/
public Object getObject(Address addr) {
return null;
}
}
|
[
"[email protected]"
] | |
d0503541819ef1eaa7c2c0d09fb073e9f25407ab
|
78f284cd59ae5795f0717173f50e0ebe96228e96
|
/factura-negocio/src/cl/stotomas/factura/negocio/ia_9/copy2/copy2/TestingHab.java
|
dc77b977eb3bace59c9d9e1705013ce59b151e50
|
[] |
no_license
|
Pattricio/Factura
|
ebb394e525dfebc97ee2225ffc5fca10962ff477
|
eae66593ac653f85d05071b6ccb97fb1e058502d
|
refs/heads/master
| 2020-03-16T03:08:45.822070 | 2018-05-07T15:29:25 | 2018-05-07T15:29:25 | 132,481,305 | 0 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 2,150 |
java
|
package cl.stotomas.factura.negocio.ia_9.copy2.copy2;
import java.util.*;
public class TestingHab {
private int id;
private String nombre;
private String apellido;
private int edad;
/**
* Constructor vacío
*/
public TestingHab()
{
id = 1;
nombre = "Edward";
apellido = "Dammus";
edad = 22;
}
/**
* Constructor con parametros
*/
public TestingHab(int id, String nombre, String apellido, int edad)
{
this.id = id;
this.nombre = nombre;
this.apellido = apellido;
setEdad(edad);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
/**
* Método que acepte que la edad debe ser mayor a 15
*/
public void edadMayor(int edad)
{
if(edad > 15)
{
System.out.println("Admitido");
}
else
{
System.out.println("Edad debe ser mayor a 15");
}
}
/**
* Método que me valide el segundo nombre
*/
public void validarNombre(String nombre)
{
StringTokenizer token = new StringTokenizer(nombre);
if(token.countTokens() == 2)
{
System.out.println("Ingresaste 2 nombres");
}else
{
System.out.println("Error");
}
}
/**
* Método que me pregunte por la edad y por el nombre
*/
public void NombreEdad(String nombre, int edad)
{
System.out.println("Cual es tu nombre y tu edad");
if(nombre.equals(nombre))
{
System.out.println("Su nombre es: " +getNombre());
}else if(edad == 13)
{
this.edad = 100; // cambia la edad a 100
System.out.println("Su edad es:" +getEdad());
}
}
/**
* Instanciar una persona
*/
public void Persona(Object o)
{
if(o.getClass() == TestingHab.class)
{
System.out.println(o);
}
}
}
|
[
"Adriana Molano@DESKTOP-GQ96FK8"
] |
Adriana Molano@DESKTOP-GQ96FK8
|
2410dbf3482220c61fb7f3c581d26f3638872289
|
8d0dbaae418b58eb3e4abd3fb627baa59f6c7792
|
/src/edu/milhama/latihanmvcjdbc/event/PelangganListener.java
|
ae5b8be3b9c1df844921154f9438c72e40824c86
|
[] |
no_license
|
ilham377/LatihanMVCDAO
|
26e2d931179a2b6fba04b66e5d0e656ab2a473f3
|
afaafb0045188527ff75ba1aa4ee070fd24530aa
|
refs/heads/master
| 2020-12-13T03:48:05.167736 | 2020-01-16T11:24:55 | 2020-01-16T11:24:55 | 234,304,976 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 635 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.milhama.latihanmvcjdbc.event;
import edu.milhama.latihanmvcjdbc.entity.Pelanggan;
import edu.milhama.latihanmvcjdbc.model.PelangganModel;
/**
*
* Nama : Muhammad Ilham Apriyadi
* Kelas : IF2
* NIM : 10118045
*/
public interface PelangganListener {
public void onChange(PelangganModel model);
public void onInsert(Pelanggan pelanggan);
public void onUpdate(Pelanggan pelanggan);
public void onDelete();
}
|
[
"[email protected]"
] | |
d0ede03e5f84cb02ec09d22d176ba557fa8a33dc
|
a4b2a59e89fd261756be9decc225b1542e638af0
|
/app/src/main/java/widget/BubbleLinearLayout.java
|
b0f18734f680b94fd7a094b8380bd54a3032813c
|
[] |
no_license
|
Easoncheng0405/MyApplication
|
f40498d5e3453fc34db6613925c227fbb27acad4
|
12af65ce11bb5a43b57d5bb7e4bc1cbbc6e45cb7
|
refs/heads/master
| 2021-01-19T13:18:58.937808 | 2017-09-14T14:18:44 | 2017-09-14T14:18:44 | 97,940,128 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,040 |
java
|
package widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.example.chengjie.myapplication.R;
/**
* 作者:Rance on 2016/12/15 10:49
* 邮箱:[email protected]
* 自定义聊天气泡LinearLayout
*/
public class BubbleLinearLayout extends LinearLayout {
private BubbleDrawable bubbleDrawable;
private float mArrowWidth;
private float mAngle;
private float mArrowHeight;
private float mArrowPosition;
private BubbleDrawable.ArrowLocation mArrowLocation;
private int bubbleColor;
public BubbleLinearLayout(Context context) {
super(context);
initView(null);
}
public BubbleLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
initView(attrs);
}
private void initView(AttributeSet attrs){
if (attrs != null){
TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.BubbleView);
mArrowWidth = array.getDimension(R.styleable.BubbleView_arrowWidth,
BubbleDrawable.Builder.DEFAULT_ARROW_WITH);
mArrowHeight = array.getDimension(R.styleable.BubbleView_arrowHeight,
BubbleDrawable.Builder.DEFAULT_ARROW_HEIGHT);
mAngle = array.getDimension(R.styleable.BubbleView_angle,
BubbleDrawable.Builder.DEFAULT_ANGLE);
mArrowPosition = array.getDimension(R.styleable.BubbleView_arrowPosition,
BubbleDrawable.Builder.DEFAULT_ARROW_POSITION);
bubbleColor = array.getColor(R.styleable.BubbleView_bubbleColor,
BubbleDrawable.Builder.DEFAULT_BUBBLE_COLOR);
int location = array.getInt(R.styleable.BubbleView_arrowLocation, 0);
mArrowLocation = BubbleDrawable.ArrowLocation.mapIntToValue(location);
array.recycle();
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (w > 0 && h > 0){
setUp(w, h);
}
}
private void setUp(int left, int right, int top, int bottom){
if (right < left || bottom < top)
return;
RectF rectF = new RectF(left, top, right, bottom);
bubbleDrawable = new BubbleDrawable.Builder()
.rect(rectF)
.arrowLocation(mArrowLocation)
.bubbleType(BubbleDrawable.BubbleType.COLOR)
.angle(mAngle)
.arrowHeight(mArrowHeight)
.arrowWidth(mArrowWidth)
.arrowPosition(mArrowPosition)
.bubbleColor(bubbleColor)
.build();
}
private void setUp(int width, int height){
setUp(getPaddingLeft(), + width - getPaddingRight(),
getPaddingTop(), height - getPaddingBottom());
setBackgroundDrawable(bubbleDrawable);
}
}
|
[
"[email protected]"
] | |
b6f09755facc78c55ba2b746891052dcd376188e
|
97a8ccf79c6aa82db990e4743bb2f1a0ceeef3f9
|
/src/main/java/com/demo/functionalProgram/collector/MyCollector2.java
|
ae14819166bd9784a19ed111a1d2bf8f54dd6b68
|
[] |
no_license
|
ylx977/simpleDemo
|
929335875efc94747a65d2dbab353e084b57add5
|
b1ec7a784758542f3a67c8694817b3fddd03216f
|
refs/heads/master
| 2020-04-19T19:28:59.153109 | 2019-02-19T09:01:33 | 2019-02-19T09:01:33 | 168,389,879 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,493 |
java
|
package com.demo.functionalProgram.collector;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collector.Characteristics;
import com.demo.functionalProgram.sombean.Bean1;
import com.demo.functionalProgram.sombean.Bean2;
public class MyCollector2 implements Collector<Integer, Map<Integer,List<Integer>>, List<Bean2<Integer>>>{
@Override
public Supplier<Map<Integer,List<Integer>>> supplier() {
return HashMap::new;
}
private void pack(Map<Integer,List<Integer>> map, Integer element){
Integer key = element%3;
if(map.containsKey(key)){
List<Integer> list = map.get(key);
list.add(element);
}else{
List<Integer> list = new ArrayList<>();
list.add(element);
map.put(key, list);
}
}
@Override
public BiConsumer<Map<Integer,List<Integer>>, Integer> accumulator() {
return (map,element)->{
if(element%3==0){
pack(map,element);
}else if(element%3==1){
pack(map,element);
}else{
pack(map,element);
}
};
}
@Override
public BinaryOperator<Map<Integer,List<Integer>>> combiner() {
return (map1,map2)->{
Set<Integer> keySet = map1.keySet();
Set<Integer> keySet2 = map2.keySet();
keySet.addAll(keySet2);
for(Integer key : keySet){
List<Integer> list1 = map1.get(key);
List<Integer> list2 = map2.get(key);
if(list1==null && list2!=null){
map1.put(key, list2);
}else if(list1!=null && list2==null){
map1.put(key, list1);
}else{
list1.addAll(list2);
map1.put(key, list1);
}
}
return map1;
};
}
@Override
public Function<Map<Integer,List<Integer>>, List<Bean2<Integer>>> finisher() {
return map->{
Set<Integer> keySet = map.keySet();
List<Bean2<Integer>> list = new ArrayList();
for(Integer key : keySet){
Bean2 bean = new Bean2();
bean.setKey(key);
bean.setAccumulator(map.get(key));
list.add(bean);
}
return list;
};
}
@Override
public Set<Characteristics> characteristics() {
return Collections.unmodifiableSet(EnumSet.of(Characteristics.UNORDERED));
}
}
|
[
"[email protected]"
] | |
e826258fae6ad4e105dc0a577a3fc6b6c5a9862d
|
847989a47e27c7bea7467d1b82a56fdc6f236430
|
/java01_basic/src/ForEx03.java
|
a7c97c44c073eaf845f269e622980bafd9fc38ae
|
[] |
no_license
|
bisnin0/Bitcamp1
|
2b59cf003ef85dbfc86fcb3612b638265323c6a7
|
0293253c1c6e79cd8747235be4a2d6b9bb3a82e9
|
refs/heads/main
| 2023-02-04T05:14:04.024716 | 2020-12-24T10:22:43 | 2020-12-24T10:22:43 | 324,128,483 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 436 |
java
|
import java.util.Scanner;
class ForEx03
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.print("단입력=");
int dan = scan.nextInt();
for(int i=2 ; i<10; i++){// 2,3,4,5,6,7,8,9
int result = dan * i;
System.out.println(dan+" * "+i+" = "+result);
}
}
}
/*
입력받은 단을 출력하는 하는 프로그램
실행
단입력=5
5 * 2 = 10
5 * 3 = 15
:
:
5 * 9 = 45
*/
|
[
"[email protected]"
] | |
0deaf38cdd164fe4b3910c4c09a871a8daa3302f
|
82a294c8a9067716ff4fa1af947966f9b159fd8f
|
/java/org/broadinstitute/hellbender/tools/walkers/genotyper/afcalc/GeneralPloidyExactAFCalculator.java
|
69613f72a7e60a6995a51ef7d441635335e0a1fc
|
[] |
no_license
|
hxzhu9819/Variant_Calling
|
7b7e1bbc31c5699f71884f166a9840ff45c7773e
|
57f542668bd69e315304cc13a6e2fca198139ea2
|
refs/heads/master
| 2020-05-23T08:34:33.059933 | 2019-08-07T02:32:12 | 2019-08-07T02:32:12 | 186,689,031 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 16,566 |
java
|
package org.broadinstitute.hellbender.tools.walkers.genotyper.afcalc;
import com.google.common.annotations.VisibleForTesting;
import htsjdk.variant.variantcontext.*;
import org.broadinstitute.hellbender.exceptions.GATKException;
import org.broadinstitute.hellbender.tools.walkers.genotyper.GenotypeAlleleCounts;
import org.broadinstitute.hellbender.tools.walkers.genotyper.GenotypeLikelihoodCalculator;
import org.broadinstitute.hellbender.tools.walkers.genotyper.GenotypeLikelihoodCalculators;
import org.broadinstitute.hellbender.utils.MathUtils;
import org.broadinstitute.hellbender.utils.Utils;
import org.broadinstitute.hellbender.utils.variant.GATKVariantContextUtils;
import java.util.*;
public final class GeneralPloidyExactAFCalculator extends ExactAFCalculator {
private static final boolean VERBOSE = false;
private static final GenotypeLikelihoodCalculators GL_CALCS = new GenotypeLikelihoodCalculators();
@Override
protected AFCalculationResult computeLog10PNonRef(final VariantContext vc, final int defaultPloidy, final double[] log10AlleleFrequencyPriors, final StateTracker stateTracker) {
System.err.print("Xiao:tools/walkers/genotyper/afcalc/GeneralPloidyExactAFCalculator.java: choose this computeLog10PNonRef\n");
Utils.nonNull(vc, "vc is null");
Utils.nonNull(log10AlleleFrequencyPriors, "log10AlleleFrequencyPriors is null");
Utils.nonNull(stateTracker, "stateTracker is null");
combineSinglePools(vc.getGenotypes(), defaultPloidy, vc.getNAlleles(), log10AlleleFrequencyPriors);
return getResultFromFinalState(vc, log10AlleleFrequencyPriors, stateTracker);
}
/**
* Simple wrapper class to hold values of combined pool likelihoods.
* For fast hashing and fast retrieval, there's a hash map that shadows main list.
*
*/
private static final class CombinedPoolLikelihoods {
private final List<ExactACset> alleleCountSetList;
private final Map<ExactACcounts,ExactACset> conformationMap;
private double maxLikelihood;
CombinedPoolLikelihoods() {
// final int numElements = GenotypeLikelihoods.numLikelihoods();
alleleCountSetList = new LinkedList<>();
conformationMap = new LinkedHashMap<>();
maxLikelihood = Double.NEGATIVE_INFINITY;
}
public void add(final ExactACset set) {
alleleCountSetList.add(set);
conformationMap.put(set.getACcounts(), set);
final double likelihood = set.getLog10Likelihoods()[0];
if (likelihood > maxLikelihood ) {
maxLikelihood = likelihood;
}
}
public boolean hasConformation(final int[] ac) {
return conformationMap.containsKey(new ExactACcounts(ac));
}
public double getLikelihoodOfConformation(final int[] ac) {
return conformationMap.get(new ExactACcounts(ac)).getLog10Likelihoods()[0];
}
public double getGLOfACZero() {
return alleleCountSetList.get(0).getLog10Likelihoods()[0]; // AC 0 is always at beginning of list
}
public int getLength() {
return alleleCountSetList.size();
}
}
/**
* Simple non-optimized version that combines GLs from several pools and produces global AF distribution.
* @param GLs Inputs genotypes context with per-pool GLs
* @param numAlleles Number of alternate alleles
* @param log10AlleleFrequencyPriors Frequency priors
*/
@VisibleForTesting
void combineSinglePools(final GenotypesContext GLs,
final int defaultPloidy,
final int numAlleles,
final double[] log10AlleleFrequencyPriors) {
// Combine each pool incrementally - likelihoods will be renormalized at each step
// first element: zero ploidy, e.g. trivial degenerate distribution
final int numAltAlleles = numAlleles - 1;
final int[] zeroCounts = new int[numAlleles];
final ExactACset set = new ExactACset(1, new ExactACcounts(zeroCounts));
set.getLog10Likelihoods()[0] = 0.0;
final StateTracker stateTracker = getStateTracker(false,numAltAlleles);
int combinedPloidy = 0;
CombinedPoolLikelihoods combinedPoolLikelihoods = new CombinedPoolLikelihoods();
combinedPoolLikelihoods.add(set);
for (final Genotype genotype : GLs.iterateInSampleNameOrder()) {
// recover gls and check if they qualify.
if (!genotype.hasPL()) {
continue;
}
final double[] gls = genotype.getLikelihoods().getAsVector();
if (!GATKVariantContextUtils.isInformative(gls)) {
System.err.print("Xiao:tools/walkers/genotyper/afcalc/GeneralPloidyExactAFCalculator.java/combineSinglePools: enter isInformatives but not modified\n");
continue;
}
stateTracker.reset();
final int declaredPloidy = genotype.getPloidy();
final int ploidy = declaredPloidy < 1 ? defaultPloidy : declaredPloidy;
// they do qualify so we proceed.
combinedPoolLikelihoods = fastCombineMultiallelicPool(combinedPoolLikelihoods, gls,
combinedPloidy, ploidy, numAlleles, log10AlleleFrequencyPriors, stateTracker);
combinedPloidy = ploidy + combinedPloidy; // total number of chromosomes in combinedLikelihoods
}
if (combinedPloidy == 0) {
stateTracker.setLog10LikelihoodOfAFzero(0.0);
}
}
private CombinedPoolLikelihoods fastCombineMultiallelicPool(final CombinedPoolLikelihoods originalPool,
final double[] newGL,
final int originalPloidy,
final int newGLPloidy,
final int numAlleles,
final double[] log10AlleleFrequencyPriors,
final StateTracker stateTracker) {
final Deque<ExactACset> ACqueue = new LinkedList<>();
// mapping of ExactACset indexes to the objects
final Map<ExactACcounts, ExactACset> indexesToACset = new LinkedHashMap<>();
final CombinedPoolLikelihoods newPool = new CombinedPoolLikelihoods();
// add AC=0 to the queue
final int[] zeroCounts = new int[numAlleles];
final int newPloidy = originalPloidy + newGLPloidy;
zeroCounts[0] = newPloidy;
final ExactACset zeroSet = new ExactACset(1, new ExactACcounts(zeroCounts));
ACqueue.add(zeroSet);
indexesToACset.put(zeroSet.getACcounts(), zeroSet);
// keep processing while we have AC conformations that need to be calculated
while ( !ACqueue.isEmpty() ) {
// compute log10Likelihoods
final ExactACset ACset = ACqueue.remove();
calculateACConformationAndUpdateQueue(ACset, newPool, originalPool, newGL, log10AlleleFrequencyPriors, originalPloidy, newGLPloidy, ACqueue, indexesToACset, stateTracker);
// clean up memory
indexesToACset.remove(ACset.getACcounts());
if ( VERBOSE ) {
System.out.printf(" *** removing used set=%s%n", ACset.getACcounts());
}
}
return newPool;
}
/**
*
* @param set ExactACset holding conformation to be computed
* @param newPool New pool likelihood holder
* @param originalPool Original likelihood holder
* @param newGL New pool GL vector to combine
* @param log10AlleleFrequencyPriors Prior object
* @param originalPloidy Total ploidy of original combined pool
* @param newGLPloidy Ploidy of GL vector
* @param ACqueue Queue of conformations to compute
* @param indexesToACset AC indices of objects in queue
* @return max log likelihood
*/
private double calculateACConformationAndUpdateQueue(final ExactACset set,
final CombinedPoolLikelihoods newPool,
final CombinedPoolLikelihoods originalPool,
final double[] newGL,
final double[] log10AlleleFrequencyPriors,
final int originalPloidy,
final int newGLPloidy,
final Deque<ExactACset> ACqueue,
final Map<ExactACcounts, ExactACset> indexesToACset,
final StateTracker stateTracker) {
// compute likelihood in "set" of new set based on original likelihoods
final int numAlleles = set.getACcounts().getCounts().length;
final int newPloidy = set.getACsum();
final double log10LofK = computeLofK(set, originalPool, newGL, log10AlleleFrequencyPriors, numAlleles, originalPloidy, newGLPloidy, stateTracker);
// add to new pool
if (!Double.isInfinite(log10LofK)) {
newPool.add(set);
}
if ( stateTracker.abort(log10LofK, set.getACcounts(), true, true) ) {
return log10LofK;
}
// iterate over higher frequencies if possible
// by convention, ACcounts contained in set have full vector of possible pool ac counts including ref count.
// so, if first element is zero, it automatically means we have no wiggle since we're in a corner of the conformation space
final int ACwiggle = set.getACcounts().getCounts()[0];
if ( ACwiggle == 0 ) // all alternate alleles already sum to 2N so we cannot possibly go to higher frequencies
{
return log10LofK;
}
// add conformations for other cases
for ( int allele = 1; allele < numAlleles; allele++ ) {
final int[] ACcountsClone = set.getACcounts().getCounts().clone();
ACcountsClone[allele]++;
// is this a valid conformation?
final int altSum = (int)MathUtils.sum(ACcountsClone) - ACcountsClone[0];
ACcountsClone[0] = newPloidy - altSum;
if (ACcountsClone[0] < 0) {
continue;
}
updateACset(ACcountsClone, ACqueue, indexesToACset);
}
return log10LofK;
}
/**
* Compute likelihood of a particular AC conformation and update AFresult object
* @param set Set of AC counts to compute
* @param firstGLs Original pool likelihoods before combining
* @param secondGL New GL vector with additional pool
* @param log10AlleleFrequencyPriors Allele frequency priors
* @param numAlleles Number of alleles (including ref)
* @param ploidy1 Ploidy of original pool (combined)
* @param ploidy2 Ploidy of new pool
* @return log-likelihood of requested conformation
*/
private double computeLofK(final ExactACset set,
final CombinedPoolLikelihoods firstGLs,
final double[] secondGL,
final double[] log10AlleleFrequencyPriors,
final int numAlleles, final int ploidy1, final int ploidy2, final StateTracker stateTracker) {
final int newPloidy = ploidy1 + ploidy2;
// sanity check
int totalAltK = set.getACsum();
if (newPloidy != totalAltK) {
throw new GATKException("BUG: inconsistent sizes of set.getACsum and passed ploidy values");
}
totalAltK -= set.getACcounts().getCounts()[0];
// totalAltK has sum of alt alleles of conformation now
// special case for k = 0 over all k
if ( totalAltK == 0 ) { // all-ref case
final double log10Lof0 = firstGLs.getGLOfACZero() + secondGL[HOM_REF_INDEX];
set.getLog10Likelihoods()[0] = log10Lof0;
stateTracker.setLog10LikelihoodOfAFzero(log10Lof0);
stateTracker.setLog10PosteriorOfAFzero(log10Lof0 + log10AlleleFrequencyPriors[0]);
return log10Lof0;
} else {
// initialize result with denominator
// ExactACset holds by convention the conformation of all alleles, and the sum of all allele count is just the ploidy.
// To compute n!/k1!k2!k3!... we need to compute first n!/(k2!k3!...) and then further divide by k1! where k1=ploidy-sum_k_i
final int[] currentCount = set.getACcounts().getCounts();
final double denom = -MathUtils.log10MultinomialCoefficient(newPloidy, currentCount);
final GenotypeLikelihoodCalculator glCalc = GL_CALCS.getInstance(ploidy2, numAlleles);
for (int PLIndex = 0; PLIndex < glCalc.genotypeCount(); PLIndex++) {
final GenotypeAlleleCounts alleleCounts = glCalc.genotypeAlleleCountsAt(PLIndex);
final int[] acCount2 = alleleCounts.alleleCountsByIndex(numAlleles - 1);
final int[] acCount1 = MathUtils.vectorDiff(currentCount, acCount2);
// see if conformation is valid and if original pool had this conformation
// for conformation to be valid, all elements of g2 have to be <= elements of current AC set
if (isValidConformation(acCount1,ploidy1) && firstGLs.hasConformation(acCount1)) {
final double gl2 = secondGL[PLIndex];
if (!Double.isInfinite(gl2)) {
final double firstGL = firstGLs.getLikelihoodOfConformation(acCount1);
final double num1 = MathUtils.log10MultinomialCoefficient(ploidy1, acCount1);
final double num2 = MathUtils.log10MultinomialCoefficient(ploidy2, acCount2);
final double sum = firstGL + gl2 + num1 + num2;
set.getLog10Likelihoods()[0] = MathUtils.approximateLog10SumLog10(set.getLog10Likelihoods()[0], sum);
}
}
}
set.getLog10Likelihoods()[0] += denom;
}
double log10LofK = set.getLog10Likelihoods()[0];
// update the MLE if necessary
final int[] altCounts = Arrays.copyOfRange(set.getACcounts().getCounts(), 1, set.getACcounts().getCounts().length);
// TODO -- GUILLERMO THIS CODE MAY PRODUCE POSITIVE LIKELIHOODS OR -INFINITY
stateTracker.updateMLEifNeeded(Math.max(log10LofK, -Double.MAX_VALUE), altCounts);
// apply the priors over each alternate allele
for (final int ACcount : altCounts ) {
if ( ACcount > 0 ) {
log10LofK += log10AlleleFrequencyPriors[ACcount];
}
}
// TODO -- GUILLERMO THIS CODE MAY PRODUCE POSITIVE LIKELIHOODS OR -INFINITY
stateTracker.updateMAPifNeeded(Math.max(log10LofK, -Double.MAX_VALUE), altCounts);
return log10LofK;
}
//Small helper routine - is a particular AC conformation vector valid? ie are all elements non-negative and sum to ploidy?
private static boolean isValidConformation(final int[] alleleCounts, final int ploidy) {
return (Arrays.stream(alleleCounts).noneMatch(ac -> ac < 0) && MathUtils.sum(alleleCounts) == ploidy);
}
private static void updateACset(final int[] newSetCounts,
final Deque<ExactACset> ACqueue,
final Map<ExactACcounts, ExactACset> indexesToACset) {
final ExactACcounts index = new ExactACcounts(newSetCounts);
if ( !indexesToACset.containsKey(index) ) {
final ExactACset newSet = new ExactACset(1, index);
indexesToACset.put(index, newSet);
ACqueue.add(newSet);
}
}
}
|
[
"[email protected]"
] | |
33c1cd1f0750b57c37ed4d009f36c828488b1f32
|
d4ea4298517827d56b490b924c65c83c42f21cfc
|
/src/main/java/com/indeed/vw/wrapper/learner/VWBase.java
|
2471c2fc4f74d501463758906e2f59cc3271e657
|
[
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ljha-CS/vowpal-wabbit-java
|
9a97d4c2f2d5f9de2e5a0fbeebc597cf91c18c5d
|
98ab89be3f22304302de7c05e83c4503a5965398
|
refs/heads/master
| 2022-12-05T04:16:32.916053 | 2020-08-18T23:10:50 | 2020-08-18T23:10:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,200 |
java
|
package com.indeed.vw.wrapper.learner;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* The base class for VW predictors. This class is responsible for:
*
* <ol>
* <li>Keeping track of VW on the <em>C</em> side.</li>
* <li>Closing the VW predictor and cleaning up the memory on the <em>C</em> side.</li>
* <li>Bookkeeping, such as keeping the <em>C</em> memory pointer.</li>
* </ol>
*
*
*/
abstract class VWBase implements VWLearner {
private boolean isOpen;
/**
* Load tests have shown that a Lock is faster than synchronized (this).
* It was originally hypothesized that {@link java.util.concurrent.locks.ReadWriteLock} would be a better
* alternative, but at this time this is not possible cause of <a href="https://mail.google.com/mail/u/0/?ui=2&ik=cdb4bef19b&view=lg&msg=14dfe18a4f82a199#14dfe18a4f82a199_5a">this</a>.
*/
final Lock lock;
protected final long nativePointer;
// It would appear that performing multiple passes from the JNI layer is not thread safe even across multiple models.
// Because of this we need a GLOBAL lock to do mulitiple passes.
private final static Lock globalLock = new ReentrantLock();
/**
* Create a new VW instance that is ready to either create predictions or learn based on examples.
* This allows the user to instead of using the prepackaged JNI layer to load their own external JNI layer.
* This means that if a user wants to use this code with an OS that is not supported they would follow the following steps:<br>
* 1. Download VW<br>
* 2. Build VW for the OS they wish to support<br>
* 3. Call either {@link System#load(String)} or {@link System#loadLibrary(String)}<br>
* If a user wishes to use the prepackaged JNI libraries (which is encouraged) then no additional steps need to be taken.
*/
VWBase(final long nativePointer) {
isOpen = true;
lock = new ReentrantLock();
this.nativePointer = nativePointer;
}
/**
* Close the VW instance. close or closeAsync MUST be called in order to free up the native memory.
* After this is called no future calls to this object are permitted. Calling any combination of
* <code>closer().call()</code> and <code>close()</code> multiple times should have no effect after
* the first call is made. This is consistent with the guarantees in the Closable interface.
*/
@Override
final public void close() throws IOException {
try {
closer().call();
}
catch (Exception e) {
throw new IOException("An exception occurred while attempting to close VW Model with native pointer " +
nativePointer, e);
}
}
@Override
final public Callable<Boolean> closer() {
return new Closer();
}
final boolean isOpen() {
return isOpen;
}
/**
* Save the model in the VW instance.
*/
public void saveModel(File filename) {
lock.lock();
try {
if (isOpen()) {
VWLearners.saveModel(nativePointer, filename.getPath());
} else {
throw new IllegalStateException("Already closed.");
}
}
finally {
lock.unlock();
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
VWBase vwBase = (VWBase) o;
return nativePointer == vwBase.nativePointer;
}
@Override
public int hashCode() {
return (int) (nativePointer ^ (nativePointer >>> 32));
}
private class Closer implements Callable<Boolean> {
private Closer() {}
/**
* <p>
* Close the underlying VW model.
* </p>
*
* <p>
* May throw an unchecked exception if the underlying native code throws an Exception.
* </p>
* @return <code>true</code> if model was open and an attempt is made to close the model.
* A return value of <code>false</code> indicates an attempt to close the model was
* made previously. This is consistent with other languages where a <code>true</code>
* return value indicates success.
*/
@Override
public Boolean call() {
lock.lock();
try {
final boolean attemptingToClose = isOpen;
if (isOpen) {
isOpen = false;
VWBase.globalLock.lock();
try {
VWLearners.performRemainingPasses(nativePointer);
}
finally {
globalLock.unlock();
}
VWLearners.closeInstance(nativePointer);
}
return attemptingToClose;
}
finally {
lock.unlock();
}
}
}
}
|
[
"[email protected]"
] | |
f007387e1f60ca8ce815688917f6eeca538d6986
|
399d7da2ed3d37b986076927530dab2e31063da9
|
/Overlapper/app/src/main/java/edu/mylanecckanec/overlapper/MainActivity.java
|
a587eca942748b85248bbc99f797816094bcc46a
|
[] |
no_license
|
cassidykane/Overlapper
|
8624110f59351c1499343867a7c596cdecef2c3b
|
ce14fd417ccc05ff1d866cb98d56a84844ba525c
|
refs/heads/master
| 2020-09-30T09:16:11.136517 | 2019-12-11T07:51:26 | 2019-12-11T07:51:26 | 227,257,961 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,223 |
java
|
package edu.mylanecckanec.overlapper;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private EditText firstUrlEditText;
private EditText secondUrlEditText;
private Spinner firstUrlSpinner;
private Spinner secondUrlSpinner;
private Button firstUrlSaveButton;
private Button secondUrlSaveButton;
private Button combineButton;
private SharedPreferences savedValues;
private Map<String, ?> savedUrlStorageMap;
private Map<String, String> savedUrlMap;
public static final String FIRST_URL = "firstUrl";
public static final String SECOND_URL = "secondUrl";
public static final int REQ_ID = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firstUrlEditText = (EditText) findViewById(R.id.firstUrlEditText);
secondUrlEditText = (EditText) findViewById(R.id.secondUrlEditText);
firstUrlSpinner = (Spinner) findViewById(R.id.firstUrlSpinner);
secondUrlSpinner = (Spinner) findViewById(R.id.secondUrlSpinner);
firstUrlSaveButton = (Button) findViewById(R.id.firstUrlSaveButton);
secondUrlSaveButton = (Button) findViewById(R.id.secondUrlSaveButton);
combineButton = (Button) findViewById(R.id.combineButton);
savedUrlMap = new HashMap<String, String>();
savedValues = getSharedPreferences("SavedValues",MODE_PRIVATE);
updateSavedUrls();
renderSavedUrls();
}
@Override
public void onPause() {
Editor editor = savedValues.edit();
String firstUrl = firstUrlEditText.getText().toString();
String secondUrl = secondUrlEditText.getText().toString();
if (!firstUrl.isEmpty())
editor.putString("firstUrl",firstUrl);
if (!secondUrl.isEmpty())
editor.putString("secondUrl",secondUrl);
editor.commit();
super.onPause();
}
@Override
public void onResume() {
super.onResume();
firstUrlEditText.setText(savedValues.getString("firstUrl",""));
firstUrlEditText.setText(savedValues.getString("secondUrl",""));
}
public void saveUrlClick(final View button) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Enter a URL name");
final EditText nameEditText = new EditText(this);
nameEditText.setInputType(InputType.TYPE_CLASS_TEXT);
builder.setView(nameEditText);
builder.setPositiveButton("Save", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String urlName = nameEditText.getText().toString();
String url;
if (button.getId() == R.id.firstUrlSaveButton) {
url = firstUrlEditText.getText().toString();
}
else {
url = secondUrlEditText.getText().toString();
}
saveUrl(urlName,url);
updateSavedUrls();
renderSavedUrls();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
public void saveUrl(String name, String url){
Editor editor = savedValues.edit();
editor.putString(name,url);
editor.commit();
}
public void renderSavedUrls() {
List<String> urlNames = new ArrayList<>(savedUrlMap.keySet());
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, urlNames);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
firstUrlSpinner.setAdapter(adapter);
firstUrlSpinner.setOnItemSelectedListener(this);
secondUrlSpinner.setAdapter(adapter);
secondUrlSpinner.setOnItemSelectedListener(this);
}
public void updateSavedUrls(){
//savedUrlStorageMap.clear();
savedUrlStorageMap = savedValues.getAll();
for (Map.Entry<String,?> item : savedUrlStorageMap.entrySet()) {
savedUrlMap.put(item.getKey(),item.getValue().toString());
}
}
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
String urlName = parent.getItemAtPosition(pos).toString();
String url = savedValues.getString(urlName, "no URL found");//savedUrlMap.get(urlName);
if (parent.getId() == R.id.firstUrlSpinner) {
firstUrlEditText.setText(url);
} else {
secondUrlEditText.setText(url);
}
}
public void onNothingSelected(AdapterView<?> parent) {
// do nothing
}
public void combineClick(View view) {
String firstUrl = firstUrlEditText.getText().toString();
String secondUrl = secondUrlEditText.getText().toString();
if (!firstUrl.isEmpty() && !secondUrl.isEmpty()) {
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
intent.putExtra(FIRST_URL, firstUrl);
intent.putExtra(SECOND_URL, secondUrl);
startActivityForResult(intent,REQ_ID);
}
}
}
|
[
"kanec.my.lanecc.edu"
] |
kanec.my.lanecc.edu
|
094050f78d781c356e3b5d40d49fcec81967f2e8
|
0987b15d7679f6116dde1d01a012b3a5ec6036a8
|
/SiteDog/src/main/java/com/relic/app/sitedog/security/StatelessAuthenticationFilter.java
|
3379495560e2247a9f55d452d4669c3306aed8a3
|
[] |
no_license
|
PhoenixJohnson/relic_cycle
|
0a6af573f5a96b9ea142bd9a434fab0d4b532c85
|
afd00a767802d262bcc03f7b41a527dcf1180c2a
|
refs/heads/master
| 2021-01-10T16:01:43.377836 | 2015-11-09T08:30:45 | 2015-11-09T08:30:45 | 36,669,138 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,280 |
java
|
package com.relic.app.sitedog.security;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* Created by Jason on 6/19/15.
*/
public class StatelessAuthenticationFilter extends GenericFilterBean {
private final TokenAuthenticationService authenticationService;
public StatelessAuthenticationFilter(TokenAuthenticationService authenticationService) {
this.authenticationService = authenticationService;
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
Authentication authentication = authenticationService.getAuthentication(httpRequest);
SecurityContextHolder.getContext().setAuthentication(authentication);
filterChain.doFilter(servletRequest, servletResponse);
}
}
|
[
"[email protected]"
] | |
f305c9c0de32d8de2b6cbeac0df06de685c750a7
|
b642afadf5a2a3427e6f1221106f01a8f5b0417b
|
/think-fast-game/src/main/java/br/com/senac/ccs/thinkfast/Screen.java
|
aa977a949c01e5d1214b24aba074dd703fd435cb
|
[] |
no_license
|
livrarisam/senac-ccs
|
f1eebdd947cb32436665b95390d1a0f05fc0d436
|
9caa13a722637b5754d009e5f09b837c51df2b0c
|
refs/heads/master
| 2020-12-25T13:33:50.684117 | 2012-10-17T01:53:47 | 2012-10-17T01:53:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 112 |
java
|
package br.com.senac.ccs.thinkfast;
public interface Screen {
public void show(Result result);
}
|
[
"samuel@samuel-HP-G42-Notebook-PC.(none)"
] |
samuel@samuel-HP-G42-Notebook-PC.(none)
|
eb5b43ab9d4f59c469f617c98fe990b79f747dec
|
91b0fd85e21a8b2f7336cd610ec014b9d0db435a
|
/stat/src/com/mycompany/myapp/action.java
|
f11a57ec6c2defac868ea17c5e23e18524c692c6
|
[] |
no_license
|
PopManOO/andr
|
da0c24bedb3665b1d39431b4af6f102efdaab4b8
|
a9aa407538818385cc9fa181244ed670cd9ec986
|
refs/heads/master
| 2016-09-05T16:52:19.500686 | 2014-02-10T19:13:59 | 2014-02-10T19:13:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 365 |
java
|
package com.mycompany.myapp;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.content.*;
public class action extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO: Implement this method
super.onCreate(savedInstanceState);
setContentView(R.layout.trame);
}
}
|
[
"[email protected]"
] | |
1a54562d19db7afeddd0f44e97d34cea23d40143
|
daff0978f3b8016812aa47df735c779a1d15cae0
|
/yention_wechat/src/main/java/com/yention/yention_wechat/bean/Tag.java
|
b676a59dc63a8df72e99b5a9018febcb02f2f54b
|
[] |
no_license
|
mayaoman/yention_wechat
|
d1e27eaf892ab128ddf6b7f30e876d59b1c8b932
|
d34c0280e2463af60a721eca4ead1a44d44929d8
|
refs/heads/master
| 2020-05-04T15:03:11.841245 | 2019-05-05T13:30:12 | 2019-05-05T13:30:12 | 179,221,928 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 589 |
java
|
package com.yention.yention_wechat.bean;
/**
* @Package com.yention.yention_wechat.bean
* @ClassName: Tag
* @Description: TODO(这里用一句话描述这个类的作用)
* @author 孙刚
* @date 2019年4月12日 上午2:15:52
*/
public class Tag {
private String id ;//标签id,由微信分配
private String name;//标签名,UTF8编码
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
[
"孙刚@192.168.1.106"
] |
孙刚@192.168.1.106
|
521c1aca4544992cb93653062a3be7caf8a6b960
|
90c31527726805bcde63ef3eed91f1f9662300fc
|
/ProyectoPSP/src/com/psp/escuela/AlumnoResponse.java
|
a6ca236c757fc27e13c6f64b14dc5814b8824a0e
|
[] |
no_license
|
PedroLizcano/proyectoPSP
|
9a8b337bdf84fe9d96f56ae5d640e569024e3b92
|
8e047c29d0efa19db8022f5939416e5281a9256c
|
refs/heads/master
| 2022-04-10T01:53:05.374456 | 2020-02-26T19:47:20 | 2020-02-26T19:47:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,476 |
java
|
package com.psp.escuela;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="greet" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"greet"
})
@XmlRootElement(name = "alumnoResponse")
public class AlumnoResponse {
@XmlElement(required = true)
protected String greet;
/**
* Obtiene el valor de la propiedad greet.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGreet() {
return greet;
}
/**
* Define el valor de la propiedad greet.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGreet(String value) {
this.greet = value;
}
}
|
[
"[email protected]"
] | |
d456bd97d7ea6dce2da74e3716e14f950610a97c
|
540a1314712049d3eb1eb204b30415ecfb360045
|
/hola mundo/src/SobrecargaMetodos/SobrecargaMetodos.java
|
e5faab8cbf8f0bbafc9895e4f853a5477866cc4e
|
[] |
no_license
|
DarioQuiroz/miCursoJva
|
1c8efbb1c6ea7b1ef5b8786f6c90c9c95eaac5bb
|
e630e21ca17a933861142cceab67944df66a0995
|
refs/heads/master
| 2020-04-13T12:33:23.156183 | 2019-01-08T00:02:21 | 2019-01-08T00:02:21 | 163,205,888 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 784 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package SobrecargaMetodos;
/**
*
* @author dquiroz
*/
public class SobrecargaMetodos {
public static void main(String[] args) {
System.out.println("Resultado 1 "+Operaciones.summar(3, 4));
System.out.println("resultado 2 "+Operaciones.summar(5, 4.1));
System.out.println("resultado 3 "+Operaciones.summar(7.1, 3));
System.out.println("resultado 4 "+Operaciones.summar(2.2, 6.8));
System.out.println("resultado 5 "+Operaciones.summar(3, 1L));
System.out.println("resultado 6 "+Operaciones.summar(3F, 'A'));
}
}
|
[
"[email protected]"
] | |
030a61f8d5fde93dd4f36ffb83a264676025abe6
|
f03fb9b2ae12857d351a3eab581b297d95ac05f2
|
/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIPieMenuItem.java
|
db9036ed720b2c588ee26e130b98c6f776637a96
|
[
"Zlib"
] |
permissive
|
Renanse/Ardor3D
|
8db6cc198196bd682bb94ff8158b07f66a2c80f4
|
7df2f1d0ccae867663ef9b511a443dee029112b0
|
refs/heads/master
| 2023-07-09T03:46:14.553764 | 2023-07-04T16:42:46 | 2023-07-04T16:42:46 | 6,205,252 | 182 | 72 |
NOASSERTION
| 2023-06-01T15:20:56 | 2012-10-13T17:03:04 |
Java
|
UTF-8
|
Java
| false | false | 2,353 |
java
|
/**
* Copyright (c) 2008-2021 Bird Dog Games, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <https://git.io/fjRmv>.
*/
package com.ardor3d.extension.ui;
import com.ardor3d.extension.ui.event.ActionListener;
import com.ardor3d.extension.ui.util.SubTex;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.util.MathUtils;
/**
*
*/
public class UIPieMenuItem extends UIMenuItem {
protected int _subMenuSize = 0;
public UIPieMenuItem(final String text) {
this(text, null);
}
public UIPieMenuItem(final String text, final SubTex icon) {
this(text, icon, true, null);
}
public UIPieMenuItem(final String text, final SubTex icon, final boolean closeMenuOnSelect,
final ActionListener listener) {
super(text, icon, closeMenuOnSelect, listener);
}
public UIPieMenuItem(final String text, final SubTex icon, final UIPieMenu subMenu, final int size) {
super(text, icon, false, null);
_subMenu = subMenu;
_subMenuSize = size;
addActionListener(event -> showSubMenu());
}
@Override
protected void showSubMenu() {
final UIHud hud = getHud();
if (hud == null) {
return;
}
boolean setup = false;
final Vector3 showAt = new Vector3(getWorldTranslation());
final UIPieMenu subMenu = (UIPieMenu) _subMenu;
if (getParent() instanceof UIPieMenu) {
final UIPieMenu pie = (UIPieMenu) getParent();
if (pie.getCenterItem() != this) {
subMenu.setOuterRadius(pie.getOuterRadius() + _subMenuSize);
subMenu.setInnerRadius(pie.getOuterRadius());
subMenu.setTotalArcLength(pie.getSliceRadians());
subMenu.setStartAngle(pie.getSliceIndex(this) * pie.getSliceRadians() + pie.getStartAngle());
showAt.set(pie.getWorldTranslation());
hud.closePopupMenusAfter(pie);
setup = true;
}
}
if (!setup) {
subMenu.setOuterRadius(_subMenuSize);
subMenu.setInnerRadius(0);
subMenu.setTotalArcLength(MathUtils.TWO_PI);
subMenu.setStartAngle(0);
}
subMenu.updateMinimumSizeFromContents();
subMenu.layout();
hud.showSubPopupMenu(subMenu);
subMenu.showAt((int) showAt.getX(), (int) showAt.getY());
}
}
|
[
"[email protected]"
] | |
6149ee2d8d065d2a0177d197a72f5882a6616d16
|
2416b3bfa17e0abb214132b25a8fab195b634740
|
/Project3/src/main/java/MessageModel.java
|
642b5016431df951e7dfea2c327315bf17724d7c
|
[] |
no_license
|
AveryHyman/Project-3
|
5cd9341c20bffba6918762810cf40d13e1b9cd89
|
afe69ea224042583416d5f31d44c91fa3a15495a
|
refs/heads/master
| 2023-06-11T04:01:07.264805 | 2019-12-13T23:09:27 | 2019-12-13T23:09:27 | 227,936,575 | 0 | 0 | null | 2023-05-23T20:11:38 | 2019-12-13T23:06:56 |
Java
|
UTF-8
|
Java
| false | false | 1,160 |
java
|
public class MessageModel {
public static final int LOGIN = 0;
public static final int LOGOUT = 1;
public static final int GET_USER = 10;
public static final int PUT_USER = 11;
public static final int SEARCH_PURCHASE = 700;
public static final int GET_PRODUCT = 100;
public static final int PUT_PRODUCT = 101;
public static final int GET_PURCHASE = 400;
public static final int PUT_PURCHASE = 401;
public static final int GET_CUSTOMER = 200;
public static final int PUT_CUSTOMER = 201;
public static final int GET_PURCHASE_LIST = 500;
public static final int SEARCH_PRODUCT = 600;
public static final int OPERATION_OK = 1000; // server responses!
public static final int OPERATION_FAILED = 1001;
public int code;
public int ssid;
public String data;
public MessageModel() {
code = 0;
data = null;
}
public MessageModel(int code, String data) {
this.code = code;
this.data = data;
}
public MessageModel(int code, int ssid, String data) {
this.code = code;
this.ssid = code;
this.data = data;
}
}
|
[
"[email protected]"
] | |
fde34edba48161c5048e1f2dd4e3fa721bbf2596
|
e7cceecf7e42831752a12cd59f89287ef2570fbf
|
/springPractice/ch9_1/src/main/java/com/acvrock/web/HomeController.java
|
dcc48fb837d5fc90982a127e088cfb403afadd55
|
[] |
no_license
|
Acvrock/Exercise-code
|
65d28be3727995fc5a4260bf14d311b7242c2c06
|
871a6daa36b19893196089bfca2fd0f3cea4640d
|
refs/heads/master
| 2021-12-28T13:03:43.522975 | 2021-12-11T04:54:17 | 2021-12-11T04:54:17 | 60,443,655 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 459 |
java
|
package com.acvrock.web;
import com.acvrock.domain.Msg;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/")
public String index(Model model){
Msg msg = new Msg("测试标题","测试内容","额外信息,只对管理员显示");
model.addAttribute("msg", msg);
return "home";
}
}
|
[
"[email protected]"
] | |
4352ed496c7c0bf1250717fa82a4161ad53c0f6b
|
69c1256baec48b66365b5ec8faec5d6318b0eb21
|
/Mage.Sets/src/mage/sets/lorwyn/WeedStrangle.java
|
1e154253f45fc11da315f5dc72393c62f659c84e
|
[] |
no_license
|
gbraad/mage
|
3b84eefe4845258f6250a7ff692e1f2939864355
|
18ce6a0305db6ebc0d34054af03fdb0ba88b5a3b
|
refs/heads/master
| 2022-09-28T17:31:38.653921 | 2015-04-04T22:28:22 | 2015-04-04T22:28:22 | 33,435,029 | 1 | 0 | null | 2022-09-01T23:39:50 | 2015-04-05T08:25:58 |
Java
|
UTF-8
|
Java
| false | false | 3,976 |
java
|
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ClashEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class WeedStrangle extends CardImpl {
public WeedStrangle(UUID ownerId) {
super(ownerId, 147, "Weed Strangle", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{B}{B}");
this.expansionSetCode = "LRW";
this.color.setBlack(true);
// Destroy target creature. Clash with an opponent. If you win, you gain life equal to that creature's toughness.
this.getSpellAbility().addEffect(new WeedStrangleEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public WeedStrangle(final WeedStrangle card) {
super(card);
}
@Override
public WeedStrangle copy() {
return new WeedStrangle(this);
}
}
class WeedStrangleEffect extends OneShotEffect {
public WeedStrangleEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target creature. Clash with an opponent. If you win, you gain life equal to that creature's toughness";
}
public WeedStrangleEffect(final WeedStrangleEffect effect) {
super(effect);
}
@Override
public WeedStrangleEffect copy() {
return new WeedStrangleEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && creature != null) {
creature.destroy(source.getSourceId(), game, false);
if (ClashEffect.getInstance().apply(game, source)) {
controller.gainLife(creature.getToughness().getValue(), game);
}
return true;
}
return false;
}
}
|
[
"[email protected]"
] | |
33744b3e6e70a5e250aa701a35e163b3eb2da13c
|
e349165658dac76120c81fa46dbdb38e10d65fe9
|
/basic-webaop/src/main/java/org/haozf/basic/user/dao/impl/User2Dao.java
|
0615cda30f8266a62385987e6a77dd4b5303f86b
|
[] |
no_license
|
haozhengfeng/basic-parent
|
4cc9bb9dff5f4fc750334bf4dcb5f3816c6094ce
|
872c937d39d35d17deb8c0a306c3f1a26462a7e5
|
refs/heads/master
| 2021-01-11T00:14:42.971730 | 2018-06-02T02:10:57 | 2018-06-02T02:10:57 | 70,553,732 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 496 |
java
|
package org.haozf.basic.user.dao.impl;
import org.haozf.basic.dao.HibernateBaseDaoBySQL;
import org.haozf.basic.model.Pager;
import org.haozf.basic.user.dao.IUser2Dao;
import org.haozf.basic.user.model.User2;
import org.springframework.stereotype.Repository;
@Repository("user2Dao")
public class User2Dao extends HibernateBaseDaoBySQL<User2> implements IUser2Dao {
@Override
public Pager<User2> find() {
return findBySql(" select * from t_user ", User2.class, false);
}
}
|
[
"[email protected]"
] | |
1cb8de48fd5018af0257ee828514f0f5b8c53ca7
|
098002b3b78e724d90cef12905b6d5e2ea467d9f
|
/sources/com/google/android/gms/internal/measurement/zzbe.java
|
323e13eadb084a2ace9d70ff9ef2eb2e86164839
|
[] |
no_license
|
chaitanyks/android
|
0a5456f4fcb84b7cd9ae22d5e15b1f12e714be82
|
d3f98fc1208ddf0534bfa22cb81445b0be15ea72
|
refs/heads/main
| 2023-03-01T03:43:05.554071 | 2021-02-09T07:00:54 | 2021-02-09T07:00:54 | 337,319,041 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 932 |
java
|
package com.google.android.gms.internal.measurement;
import android.app.Activity;
import android.os.RemoteException;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.internal.measurement.zzx;
/* compiled from: com.google.android.gms:play-services-measurement-sdk-api@@17.2.2 */
final class zzbe extends zzx.zza {
private final /* synthetic */ Activity zzc;
private final /* synthetic */ zzx.zzd zzd;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
zzbe(zzx.zzd zzd2, Activity activity) {
super(zzx.this);
this.zzd = zzd2;
this.zzc = activity;
}
/* access modifiers changed from: package-private */
@Override // com.google.android.gms.internal.measurement.zzx.zza
public final void zza() throws RemoteException {
zzx.this.zzr.onActivityStarted(ObjectWrapper.wrap(this.zzc), this.zzb);
}
}
|
[
"[email protected]"
] | |
6cea82161a4842e4804e3042b32be5fa835ae258
|
6786ceb757f7452db7bf8900c9fb38517606f7e7
|
/troubleshooting-apps/solutions/energy-meter/src/main/java/com/redhat/energy/records/WindTurbineStats.java
|
5a93125b291f031892975d5f335e9f373f4fd9ca
|
[
"Apache-2.0"
] |
permissive
|
svboettger/AD482-apps
|
1fde70713d9866b1152bdf7d7830a82168e6814a
|
1e9c8a118a19303af4aa6a7cf9419d3db47ace30
|
refs/heads/main
| 2023-09-04T09:06:24.623533 | 2021-10-25T11:17:15 | 2021-10-25T11:17:15 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 291 |
java
|
package com.redhat.energy.records;
public class WindTurbineStats {
public Integer turbineId;
public Long count;
public WindTurbineStats() {}
public WindTurbineStats(Integer turbineId, Long count) {
this.turbineId = turbineId;
this.count = count;
}
}
|
[
"[email protected]"
] | |
5efb07936c5e61d8d2d3ab3456da968415938a00
|
e87f985fdd9177e92966f8b2e85b6e57662e7cf6
|
/jOOQ-test/src/org/jooq/test/postgres/generatedclasses/tables/pojos/TBooleans.java
|
8ccfe8f6dd1e9a7481501c67003767086987cdc9
|
[
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
ben-manes/jOOQ
|
5ef43f8ea8c5c942dc0b2e0669cc927dca6f2ff7
|
9f160d5e869de1a9d66408d90718148f76c5e000
|
refs/heads/master
| 2023-09-05T03:27:56.109520 | 2013-08-26T09:48:14 | 2013-08-26T10:05:05 | 12,375,424 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,942 |
java
|
/**
* This class is generated by jOOQ
*/
package org.jooq.test.postgres.generatedclasses.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class TBooleans implements java.io.Serializable {
private static final long serialVersionUID = -1859819346;
private final java.lang.Integer id;
private final org.jooq.test._.converters.Boolean_10 oneZero;
private final org.jooq.test._.converters.Boolean_TF_LC trueFalseLc;
private final org.jooq.test._.converters.Boolean_TF_UC trueFalseUc;
private final org.jooq.test._.converters.Boolean_YES_NO_LC yesNoLc;
private final org.jooq.test._.converters.Boolean_YES_NO_UC yesNoUc;
private final org.jooq.test._.converters.Boolean_YN_LC yNLc;
private final org.jooq.test._.converters.Boolean_YN_UC yNUc;
private final java.lang.Boolean vcBoolean;
private final java.lang.Boolean cBoolean;
private final java.lang.Boolean nBoolean;
public TBooleans(
java.lang.Integer id,
org.jooq.test._.converters.Boolean_10 oneZero,
org.jooq.test._.converters.Boolean_TF_LC trueFalseLc,
org.jooq.test._.converters.Boolean_TF_UC trueFalseUc,
org.jooq.test._.converters.Boolean_YES_NO_LC yesNoLc,
org.jooq.test._.converters.Boolean_YES_NO_UC yesNoUc,
org.jooq.test._.converters.Boolean_YN_LC yNLc,
org.jooq.test._.converters.Boolean_YN_UC yNUc,
java.lang.Boolean vcBoolean,
java.lang.Boolean cBoolean,
java.lang.Boolean nBoolean
) {
this.id = id;
this.oneZero = oneZero;
this.trueFalseLc = trueFalseLc;
this.trueFalseUc = trueFalseUc;
this.yesNoLc = yesNoLc;
this.yesNoUc = yesNoUc;
this.yNLc = yNLc;
this.yNUc = yNUc;
this.vcBoolean = vcBoolean;
this.cBoolean = cBoolean;
this.nBoolean = nBoolean;
}
public java.lang.Integer getId() {
return this.id;
}
public org.jooq.test._.converters.Boolean_10 getOneZero() {
return this.oneZero;
}
public org.jooq.test._.converters.Boolean_TF_LC getTrueFalseLc() {
return this.trueFalseLc;
}
public org.jooq.test._.converters.Boolean_TF_UC getTrueFalseUc() {
return this.trueFalseUc;
}
public org.jooq.test._.converters.Boolean_YES_NO_LC getYesNoLc() {
return this.yesNoLc;
}
public org.jooq.test._.converters.Boolean_YES_NO_UC getYesNoUc() {
return this.yesNoUc;
}
public org.jooq.test._.converters.Boolean_YN_LC getYNLc() {
return this.yNLc;
}
public org.jooq.test._.converters.Boolean_YN_UC getYNUc() {
return this.yNUc;
}
public java.lang.Boolean getVcBoolean() {
return this.vcBoolean;
}
public java.lang.Boolean getCBoolean() {
return this.cBoolean;
}
public java.lang.Boolean getNBoolean() {
return this.nBoolean;
}
}
|
[
"[email protected]"
] | |
a5bb6583c7908763793dc342254367c917c94246
|
f354e358fb96e44df0af33ccc705a42068177dcf
|
/src/test/java/carwale/qa/testcases/NewCarsPageTest.java
|
97a4feedf228a87475c4d47d29214230e266a69f
|
[] |
no_license
|
Kuldeepdahra/Carwale
|
bc3b26ab5d3e8d38a6202bd9144c2f6c661346f3
|
66e0a5bc60210c5a10331c2b512dcd8449512960
|
refs/heads/master
| 2022-07-27T21:34:35.420233 | 2019-10-15T09:41:05 | 2019-10-15T09:41:05 | 208,771,707 | 0 | 0 | null | 2022-06-29T17:38:58 | 2019-09-16T10:22:55 |
HTML
|
UTF-8
|
Java
| false | false | 732 |
java
|
package carwale.qa.testcases;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import carwale.base.TestBase;
import carwale.qa.pages.Homepage;
import carwale.qa.pages.NewCarsPage;
public class NewCarsPageTest extends TestBase{
Homepage homepage;
NewCarsPage newCarsPage;
public NewCarsPageTest() {
super();
}
@BeforeMethod
public void setUp(){
initialisation();
homepage=new Homepage();
newCarsPage=homepage.clickOnNewCarsLink();
}
@Test
public void verifyNewCarsHeadingTest(){
Assert.assertTrue(newCarsPage.verifyNewCarsHeading());
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
}
|
[
"[email protected]"
] | |
8329ca6738cb97fc2dcbe0e53779e03ff46c4d80
|
acff813f2fdc0af9a7c068e8ab6c3737a5ef0739
|
/1ºTRIMESTRE/Actividades/Ficheros/Ficheros/src/Ejercicio008Serializable/Ejercicio008Serializado.java
|
2dc07191116f24117189a46dd6ebd1599b43a045
|
[] |
no_license
|
lauriiShii/ACCESO-A-DATOS
|
d8bd1457371920459d047c06d3823c10cb84611a
|
49a14449700d84d445533e2c230680cd32715311
|
refs/heads/master
| 2020-03-21T13:38:21.794693 | 2018-07-03T22:01:11 | 2018-07-03T22:01:11 | 138,616,528 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,645 |
java
|
package Ejercicio008Serializable;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
/**
Queremos hacer una agenda telefónica con los siguientes datos:
• Nombre del contacto
• Teléfono
• Dirección
• Código postal (número entero)
• Fecha de nacimiento
• Si le debo dinero (booleano)
• Cuánto le debo(número decimal)
Realiza un programa que almacene los datos en un fichero binario. A continuación, lee el fichero y
muestra el contenido por consola. Hacer dos versiones:
• Sin serialización de objeto*
• Con serialización de objeto
**/
public class Ejercicio008Serializado {
public static void main(String[] args) {
Contacto p1 = new Contacto("Manue", "4578", "SanPedro", 11300, false, 0f);
Contacto p2 = new Contacto("Rosa", "4578", "SanPedro", 11300, false, 0f);
ObjectInputStream leerOb;
ObjectOutput escribirOb;
try {
escribirOb = new ObjectOutputStream(new FileOutputStream("binarioSerializable.dat"));
leerOb = new ObjectInputStream(new FileInputStream("binarioSerializable.dat"));
escribirOb.writeObject(p1);
escribirOb.writeObject(p2);
escribirOb.close();
try {
while (true)
System.out.println(leerOb.readObject().toString());
} catch (EOFException e){
} catch (ClassNotFoundException e){
}
leerOb.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
}
|
[
"[email protected]"
] | |
0c1926cf765b7e8ef2e93de7176bdfd81e227fd7
|
2696da5606396031f9bb11752bc1074368aef306
|
/app/src/androidTest/java/com/app/music/musicapp/ExampleInstrumentedTest.java
|
f362d5404fe112372723e8e35da1404b47bb8fa9
|
[] |
no_license
|
denzellfern777/MusicApp
|
44446a71fec2f668c72d67883c2beb42fabd2a4f
|
2b5ba9482b8e33310b552a47d2fcb0034bf533e9
|
refs/heads/master
| 2020-03-13T03:15:56.585146 | 2018-04-26T04:49:54 | 2018-04-26T04:49:54 | 130,940,844 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 728 |
java
|
package com.app.music.musicapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.app.music.musicapp", appContext.getPackageName());
}
}
|
[
"Denzell7@$"
] |
Denzell7@$
|
f28b3a7b78e5d698d3f7a44d0474fff970bce096
|
acea3dfe6c827b8092ff185d7d40cff43cbdffa7
|
/springmyabatisplus-1 Maven Webapp/src/main/java/com/chinasoft/service/Test.java
|
d25190f9b6293e6b04c6a486f5606d107fb97123
|
[] |
no_license
|
KingBestZhang/github
|
5ee23793b444f6a974e8d682e5d3cdc1885cf38b
|
6383adfc8b3b728fa78bb966440c236698cba31e
|
refs/heads/master
| 2020-04-16T15:08:46.410403 | 2019-02-12T09:56:15 | 2019-02-12T09:56:15 | 165,692,741 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 457 |
java
|
package com.chinasoft.service;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("springconfig.xml");
UserService userDao = (UserService) context.getBean("service");
System.out.println(userDao);
System.out.println(userDao.selectById());
}
}
|
[
"[email protected]"
] | |
5166230c52832c9542fa67bf0529bce9750236b4
|
b0ec91b43376b40b7b7c0c54b56cc14750d203d6
|
/DailyFlash/October/DailyFlash_05October/Program4/P4.java
|
7aa3063a25333dce398f153418c18f8fd2c99385
|
[] |
no_license
|
himanshuparmar121/Sortedmap
|
a8c1e8df24cd4b85f4beacac926feb3bf9fd0c89
|
c55b9d1ed038311a679ca943f29054906b425458
|
refs/heads/master
| 2023-03-07T00:31:34.845702 | 2021-02-09T17:26:43 | 2021-02-09T17:26:43 | 281,379,432 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 334 |
java
|
/* WAJP to insert an element (specific position) into an array.
* Input:
* Enter number of rows: 10
* Original Array: {25, 14, 56, 15, 36, 77, 18, 29, 49};
* Enter index at which you want to add element(index): 2
* Enter number to add(new Number): 5
*
* Output:
* New Array: {25, 14, 5, 56, 15, 36, 56, 77, 18, 29, 49};
*/
|
[
"[email protected]"
] | |
789b4794cf9f4c0ac1240c8e0953f88ec337025a
|
447520f40e82a060368a0802a391697bc00be96f
|
/apks/playstore_apps/com_ubercab/source/asy.java
|
ae11571b158bd62815f659b595f8f4445f84cd61
|
[
"Apache-2.0",
"GPL-1.0-or-later"
] |
permissive
|
iantal/AndroidPermissions
|
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
|
d623b732734243590b5f004d167e542e2e2ae249
|
refs/heads/master
| 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 |
Apache-2.0
| 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null |
UTF-8
|
Java
| false | false | 1,962 |
java
|
import android.content.Context;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class asy
{
private boolean a;
private String b;
private String c;
private String d;
private String[] e;
public asy() {}
public static asy a(JSONObject paramJSONObject)
{
Object localObject = paramJSONObject;
if (paramJSONObject == null) {
localObject = new JSONObject();
}
paramJSONObject = new asy();
int i = 0;
paramJSONObject.a = ((JSONObject)localObject).optBoolean("enabled", false);
paramJSONObject.b = aqp.a((JSONObject)localObject, "googleAuthorizationFingerprint", null);
paramJSONObject.c = aqp.a((JSONObject)localObject, "environment", null);
paramJSONObject.d = aqp.a((JSONObject)localObject, "displayName", "");
localObject = ((JSONObject)localObject).optJSONArray("supportedNetworks");
if (localObject != null) {
paramJSONObject.e = new String[((JSONArray)localObject).length()];
}
for (;;)
{
if (i < ((JSONArray)localObject).length()) {}
try
{
paramJSONObject.e[i] = ((JSONArray)localObject).getString(i);
i += 1;
continue;
paramJSONObject.e = new String[0];
return paramJSONObject;
}
catch (JSONException localJSONException)
{
for (;;) {}
}
}
}
public String a()
{
return this.b;
}
public boolean a(Context paramContext)
{
boolean bool2 = false;
try
{
Class.forName(gcq.class.getName());
boolean bool1 = bool2;
if (this.a)
{
int i = czh.a().a(paramContext);
bool1 = bool2;
if (i == 0) {
bool1 = true;
}
}
return bool1;
}
catch (ClassNotFoundException|NoClassDefFoundError paramContext) {}
return false;
}
public String b()
{
return this.c;
}
public String[] c()
{
return this.e;
}
}
|
[
"[email protected]"
] | |
0e617f8a2333b82492ceb3ef0ccd12cc3141a969
|
2f9bef1d527c537778d597515ef893044bfce955
|
/DecryptRSA.java
|
9a3e5b23a504145ea365adf0f1878cac0824bd26
|
[] |
no_license
|
haomoy/cs4351
|
95d4f58b94796d5f309f83e1b819eb1c0455943e
|
04627ba97a434a3f85eaad3d8e2733e92f6cbd69
|
refs/heads/master
| 2020-09-08T16:02:25.938143 | 2019-11-16T22:29:29 | 2019-11-16T22:29:29 | 221,178,891 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,983 |
java
|
//package cs4351;
import java.io.*;
import java.security.*;
import java.util.Base64;
import java.util.Scanner;
import javax.crypto.*;
class DecryptRSA {
public static void main(String[] args) {
// This program reads an RSA private key from a file
// and an encrypted message, decrypts the message
// and prints it.
// Written by Luc Longpre for Computer Security, Spring 2019
File file;
PrivateKey privKey;
Cipher cipher;
byte[] decryptedByteArray;
String encryptedString, decryptedString;
// get the private key from file
privKey = PemUtils.readPrivateKey("RSAprivateKey.pem","RSA");
// get the encrypted Message
try {
file = new File("encryptedMessage.txt");
Scanner input = new Scanner(file);
encryptedString = input.nextLine();
System.out.println("The encrypted string is: " + encryptedString);
} catch (Exception e) {
System.out.println("Could not open encryptedMessage file");
return;
}
decryptedByteArray = decrypt(privKey, Base64.getDecoder().decode(encryptedString));
decryptedString = new String(decryptedByteArray);
System.out.println("The decrypted string is: " + decryptedString);
}
public static byte[] decrypt(PrivateKey privKey, byte[] encryptedByteArray) {
// decrypts a byte array using a private key
// and returns the decryption as a byte array
try {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.DECRYPT_MODE, privKey);
return cipher.doFinal(encryptedByteArray);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) {
System.out.println("error while decrypting the message");
return null;
}
}
}
|
[
"[email protected]"
] | |
5a1729845a3694ff586be695b720a6328760e171
|
24db71c5a37289cda8fd7876cf7d17f183da1693
|
/src/main/java/com/github/dkellenb/formulaevaluator/term/operator/bigdecimal/BigDecimalOperator.java
|
2e79aba2fbbbfa529ecb312f1e88f28f14731069
|
[
"Apache-2.0"
] |
permissive
|
dkellenb/formula-evaluator
|
972ae6bac897293d9942db8c975b83620b8de41b
|
6b5290da07c10227c328367db43d237727a4e188
|
refs/heads/master
| 2020-12-04T06:35:48.980962 | 2020-10-13T05:06:00 | 2020-10-13T05:06:00 | 67,152,215 | 13 | 1 |
Apache-2.0
| 2020-10-13T05:04:21 | 2016-09-01T17:30:10 |
Java
|
UTF-8
|
Java
| false | false | 665 |
java
|
package com.github.dkellenb.formulaevaluator.term.operator.bigdecimal;
import java.math.BigDecimal;
import com.github.dkellenb.formulaevaluator.term.operator.OperatorTerm;
/**
* Tagging interface for all BigDecimal operators.
*/
interface BigDecimalOperator extends OperatorTerm<BigDecimal> {
/**
* Zero.
* @return zero
*/
default BigDecimal zero() {
return BigDecimal.ZERO;
}
/**
* One.
* @return one
*/
default BigDecimal one() {
return BigDecimal.ONE;
}
/**
* Returns the result class.
*
* @return the result class.
*/
default Class<BigDecimal> getResultClass() {
return BigDecimal.class;
}
}
|
[
"[email protected]"
] | |
f09dbb7d3f2e6b53ffb5ad0c680426683fb81f29
|
98fe543fb37b1e1bfd219ef51b08f186e6c4995e
|
/SpringIoc/src/com/dawit/annotations/autowireApproch/College.java
|
324ee269ccbacf7f4b1d2fa7a78d6a30e0283341
|
[] |
no_license
|
anonymousdomain/SpringFrameWork-full-tutorial
|
8451a816a79be9674acd365e63c3b622139aaa6b
|
f79358f3f9ed1d3c8b31f0284de9c6d199ce568b
|
refs/heads/master
| 2022-12-03T13:35:04.188529 | 2020-08-15T10:37:55 | 2020-08-15T10:37:55 | 287,726,567 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 968 |
java
|
package com.dawit.annotations.autowireApproch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/*if u do not provide bean name in componenet then the class name will be bean name by defualt
* @Component
* @Component("bean_name")
*/
@Component
public class College {
private Principal principal;
private Teacher teacher;
@Autowired
public void setPrincipal(Principal principal) {
this.principal = principal;
}
@Autowired
@Qualifier("pythonTeacher")
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
@Autowired
public College(Principal principal) {
this.principal = principal;
System.out.println("constructor called\n");
}
public void test() {
principal.PrincipalInfo();
System.out.println("Debrebrhan university college of enginnering\n");
teacher.teach();
}
}
|
[
"[email protected]"
] | |
a62dc35f3f1e87f85751f7ac9bff546a02da94c7
|
35029f02d7573415d6fc558cfeeb19c7bfa1e3cc
|
/gs-accessing-data-jpa-complete/src/main/java/hello/model/Customer1085.java
|
8cdf22816e9fb9f0b2bbfdd0c4eb64cb9553bb8e
|
[] |
no_license
|
MirekSz/spring-boot-slow-startup
|
e06fe9d4f3831ee1e79cf3735f6ceb8c50340cbe
|
3b1e9e4ebd4a95218b142b7eb397d0eaa309e771
|
refs/heads/master
| 2021-06-25T22:50:21.329236 | 2017-02-19T19:08:24 | 2017-02-19T19:08:24 | 59,591,530 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 711 |
java
|
package hello.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Customer1085 {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private long id;
private String firstName;
private String lastName;
protected Customer1085() {}
public Customer1085(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
@Override
public String toString() {
return String.format(
"Customer1085[id=%d, firstName='%s', lastName='%s']",
id, firstName, lastName);
}
}
|
[
"miro1994"
] |
miro1994
|
fbd2d7e9675f4303dd1b1c08ff50c0caf5bfc522
|
5f17d863c4b9b79905759b358c3c3c63fa27e9ec
|
/hb-04-one-to-many-uni/src/com/love2code/hibernate/demo/DeleteDemo.java
|
173ef5a09ce15b349fb8d4ae539fe0cd3fb49806
|
[] |
no_license
|
CoderNaren/Framework
|
f82c5f7714ef20bf73b550e61df185471809093e
|
4d40ed16e140f82cc2f6e9b785c7a3a3f7de5c1d
|
refs/heads/master
| 2020-04-09T03:21:25.535018 | 2019-02-19T18:55:11 | 2019-02-19T18:55:11 | 159,974,016 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 70 |
java
|
package com.love2code.hibernate.demo;
public class DeleteDemo
{
}
|
[
"[email protected]"
] | |
bb9490ebe418e2d3145a9c39baf7d7ea56c76182
|
2eb31221512905dcdcb0dfbf0aba7b8e2f06cea4
|
/doitjava/src/chapter15/DataStreanTest.java
|
dd9003a69761a0a8e4f64d5092d1e1d710dc0016
|
[] |
no_license
|
shinseongjune/doitjava
|
c0e1cd2579bfb7cc48760e75598069d98f406d9a
|
791114b9bbd8d492b94491f154609ebe426415c6
|
refs/heads/master
| 2022-12-30T16:00:12.133757 | 2020-10-17T00:22:36 | 2020-10-17T00:22:36 | 286,651,677 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 943 |
java
|
package chapter15;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class DataStreanTest {
public static void main(String[] args) {
try(FileOutputStream fos = new FileOutputStream("data.txt");
DataOutputStream dos = new DataOutputStream(fos)) {
dos.writeByte(100);
dos.writeChar('A');
dos.writeInt(10);
dos.writeFloat(3.14f);
dos.writeUTF("Test");
} catch(IOException e) {
e.printStackTrace();
}
try(FileInputStream fis = new FileInputStream("data.txt");
DataInputStream dis = new DataInputStream(fis)) {
System.out.println(dis.readByte());
System.out.println(dis.readChar());
System.out.println(dis.readInt());
System.out.println(dis.readFloat());
System.out.println(dis.readUTF());
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
5b8b9a95505b54a4a3e445e62d95d3d32f05b9fb
|
e0a01027ead6aaf1a4bcface5eeebc27ad942d10
|
/osc-service-api/src/main/java/org/osc/core/broker/service/request/VirtualizationConnectorRequest.java
|
184bafadd227eed166e1ca3d87419e6db9422f47
|
[
"Apache-2.0"
] |
permissive
|
arvindn05/osc-core
|
238db6997aba0d47fd0147ac885fadcede82bfc1
|
fe6a145623066c030008a753f618eca6a7c919ac
|
refs/heads/master
| 2021-07-01T19:48:49.926616 | 2018-07-12T23:53:14 | 2018-07-12T23:54:48 | 95,853,862 | 0 | 0 |
Apache-2.0
| 2018-02-07T03:06:31 | 2017-06-30T05:56:20 |
Java
|
UTF-8
|
Java
| false | false | 2,131 |
java
|
/*******************************************************************************
* Copyright (c) Intel Corporation
* Copyright (c) 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package org.osc.core.broker.service.request;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.osc.core.broker.service.dto.VirtualizationConnectorDto;
@XmlRootElement(name = "virtualizationConnectorRequest")
@XmlAccessorType(XmlAccessType.FIELD)
public class VirtualizationConnectorRequest extends VirtualizationConnectorDto implements Request {
private boolean skipRemoteValidation;
private boolean forceAddSSLCertificates;
public VirtualizationConnectorRequest() {
}
public boolean isSkipRemoteValidation() {
return this.skipRemoteValidation;
}
public void setSkipRemoteValidation(boolean skipRemoteValidation) {
this.skipRemoteValidation = skipRemoteValidation;
}
public boolean isForceAddSSLCertificates() {
return this.forceAddSSLCertificates;
}
public void setForceAddSSLCertificates(boolean forceAddSSLCertificates) {
this.forceAddSSLCertificates = forceAddSSLCertificates;
}
@Override
public String toString() {
return "VirtualizationConnectorRequest{" +
"skipRemoteValidation=" + this.skipRemoteValidation +
", forceAddSSLCertificates=" + this.forceAddSSLCertificates +
'}';
}
}
|
[
"[email protected]"
] | |
8e90750ecbada8de55018c6e9eeaff458ee97da1
|
a66a812e2fba0eeff5af5432f3a47027a744ad7c
|
/app/src/main/java/com/example/nikita/authentication/Activity/activity/LoginActivity.java
|
1403d21d0b074cb038e29b550686bb071dc9efe0
|
[] |
no_license
|
Nikitaprajapati012/Authentication
|
fef1243bc29984093ae205d2ef0061e1110b349e
|
e2fb2c367dc9510cfefc79a93728df2b3c616894
|
refs/heads/master
| 2021-01-20T04:00:10.432325 | 2017-08-25T07:47:10 | 2017-08-25T07:47:10 | 101,379,670 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,432 |
java
|
package com.example.nikita.authentication.Activity.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.example.nikita.authentication.Activity.presenter.LoginPresenter;
import com.example.nikita.authentication.Activity.presenter.LoginPresenterImpl;
import com.example.nikita.authentication.Activity.view.LoginView;
import com.example.nikita.authentication.R;
public class LoginActivity extends AppCompatActivity implements LoginView, View.OnClickListener {
public EditText edEmail, edPassword;
public TextView txtSubmit;
public String strEmail, strPassword;
public LoginPresenter presenter;
public LoginView activityView;
public ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
findViewId();
init();
getValues();
}
// TODO: 24/8/17 get data which empty by user.
private void getValues() {
strEmail = edEmail.getText().toString().trim();
strPassword = edPassword.getText().toString().trim();
}
// TODO: 24/8/17 initilization
private void init() {
presenter = new LoginPresenterImpl(this);
txtSubmit.setOnClickListener(this);
}
// TODO: 24/8/17 bind the widget
private void findViewId() {
edEmail = (EditText) findViewById(R.id.activity_login_edemail);
edPassword = (EditText) findViewById(R.id.activity_login_edpassword);
txtSubmit = (TextView) findViewById(R.id.activity_login_txtsubmit);
progressBar = (ProgressBar) findViewById(R.id.activity_login_progressbar);
}
@Override
public void onShowToast(String msg) {
Toast.makeText(this, "" + msg, Toast.LENGTH_SHORT).show();
}
@Override
public void launchHomeActivity() {
Log.d("launchHomeActivity", "@@--Enter--");
onShowToast(getApplicationContext().getResources().getString(R.string.loginsucess));
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
}
@Override
public void showProgress() {
progressBar.setVisibility(View.VISIBLE);
}
@Override
public void hideProgress() {
progressBar.setVisibility(View.GONE);
}
@Override
public void setUsernameError() {
edEmail.setError(getApplicationContext().getResources().getString(R.string.emailempty));
}
@Override
public void setWrongUsernameError() {
edEmail.setError(getApplicationContext().getResources().getString(R.string.invalidemail));
}
@Override
public void setPasswordError() {
edPassword.setError(getApplicationContext().getResources().getString(R.string.pwdempty));
}
@Override
public void setWrongPasswordError() {
edPassword.setError(getApplicationContext().getResources().getString(R.string.validpwd));
}
@Override
public Context getActivityContext() {
return null;
}
@Override
public void onClick(View v) {
presenter.validateCredentials(strEmail, strPassword);
}
}
|
[
"[email protected]"
] | |
d6c55b29b20486cd6a615cd6d0f36402b3c7c5f5
|
38bca914220311560fc0ad4cd4f13537f5dd9ab3
|
/src/con/ping/thread/TestCallable.java
|
da0f715ce359a90616809a2a537f9fa398cfbf3d
|
[] |
no_license
|
xiaopingzh/JavaBaseTest
|
0fe16dc36982c78b11737a92fbd80ab23cfbfcab
|
5de55f7528185054137aa987885296844d462318
|
refs/heads/master
| 2021-01-01T03:32:32.866244 | 2019-02-22T03:14:23 | 2019-02-22T03:14:23 | 59,095,573 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 291 |
java
|
package con.ping.thread;
import java.util.concurrent.Callable;
/**
* 继承Callable
* @author
*
* 2016年1月19日 下午5:07:18
*/
public class TestCallable implements Callable<String>{
@Override
public String call() throws Exception {
return this.getClass().getName();
}
}
|
[
"[email protected]"
] | |
cc11a4a67acfe3d4f7eb22d8ce257b04aa1645a7
|
c20624a660e6125ed8bb992a213869a647163c02
|
/backend/src/test/java/com/prilax/lm/ServerApplicationTests.java
|
bc30b49d512a1152ecad8b430596e943d756c7fb
|
[] |
no_license
|
Priyokumar/lender
|
671f2a551f7f58a4a4e11282a96d9947c0565801
|
ab64281c8427f96f5143a0c8c93fde11f6a56a8e
|
refs/heads/main
| 2023-06-01T01:04:27.666670 | 2021-06-27T11:33:20 | 2021-06-27T11:33:20 | 358,139,917 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 205 |
java
|
package com.prilax.lm;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ServerApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
60e2a9de078c97996d8882fa93ffdf96770158e6
|
7008758de753a198901897b1f5080731e4659338
|
/src/ThreadClass.java
|
7903b8354ae53596243c84e7e779bc38836e7721
|
[] |
no_license
|
WonjaeJeon/IPScannerEx
|
02a7b03a00395f62e98ae2f22b5d6764f3de5d69
|
2b5471cdd580ad0602d915493b17677a0e7fd38c
|
refs/heads/master
| 2020-03-21T04:40:47.198064 | 2018-06-24T23:38:13 | 2018-06-24T23:38:13 | 138,122,103 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 653 |
java
|
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
public class ThreadClass extends Thread{
int port, row;
String ip;
ThreadClass(int port, String ip, int i) {
this.port = port;
row = i;
this.ip = ip;
}
public void run() {
try {
Socket socket = new Socket();
socket.connect(new InetSocketAddress(ip, port), 200);
socket.close();
IPScannerEx.stats[row][4] = port;
} catch (SocketException | SocketTimeoutException e) {
} catch (IOException e1) {
e1.printStackTrace();
}
IPScannerEx.jTable.repaint();
}
}
|
[
"[email protected]"
] | |
b82713519833ae4db1346fd0b7fa778f3942d78d
|
3ee1c41f1fc133d77ac2681842bc9eefebad38ae
|
/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java
|
a767246f128a4ee9d7b745bd5e734b8cc40a3f08
|
[
"Apache-2.0"
] |
permissive
|
onapdemo/sdc
|
b225395934e07b36f96ba46ab04be533d755c521
|
3f1fee2ca76332b48e6f36662b32f2b5096c25e7
|
refs/heads/master
| 2020-03-17T21:17:00.804170 | 2018-05-21T06:47:17 | 2018-05-21T06:47:17 | 133,952,212 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,765 |
java
|
package org.openecomp.core.migration.convertors;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
import org.openecomp.core.migration.store.ElementHandler;
import org.openecomp.core.model.types.ServiceTemplate;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.model.impl.zusammen.ElementType;
import org.openecomp.sdc.model.impl.zusammen.StructureElement;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author katyr
* @since April 23, 2017
*/
public class VspServiceTemplateConvertor
{
private static Set<String> serviceTemplatesLoaded = new HashSet<>();
public static CollaborationElement[] convertServiceTemplateToElement(ServiceTemplate serviceTemplate) {
CollaborationElement[] serviceTemplateElements;
List<String> serviceTemplateNamespace = getServiceTemplateNamespace();
int index = 0;
String serviceTemplatesEntityId = StructureElement.Templates.name();
String uniqueId = serviceTemplate.getVspId()+"_"+serviceTemplate.getVersion().toString();
if (serviceTemplatesLoaded.contains(uniqueId)) {
serviceTemplateElements = new CollaborationElement[1];
} else {
serviceTemplatesLoaded.add(uniqueId);
String vspServiceModelEntityId = StructureElement.ServiceModel.name();
serviceTemplateElements = new CollaborationElement[3];
serviceTemplateElements[index] = ElementHandler.getElementEntity(
serviceTemplate.getVspId(),
serviceTemplate.getVersion().toString(),
vspServiceModelEntityId,
serviceTemplateNamespace,
ElementHandler.getServiceModelElementInfo(vspServiceModelEntityId,serviceTemplate),
null,
null,
null);
index++;
serviceTemplateNamespace.add(vspServiceModelEntityId);
serviceTemplateElements[index] = ElementHandler.getElementEntity(
serviceTemplate.getVspId(), serviceTemplate.getVersion().toString(), serviceTemplatesEntityId,
serviceTemplateNamespace,
ElementHandler.getStructuralElementInfo(StructureElement.Templates.name()),
null,
null,
null);
index++;
}
serviceTemplateNamespace.add(serviceTemplatesEntityId);
String elementId = serviceTemplate.getVspId()+"_"+serviceTemplate.getVersion().toString()
+"_"+serviceTemplate.getName();
serviceTemplateElements[index] = ElementHandler.getElementEntity(
serviceTemplate.getVspId(), serviceTemplate.getVersion().toString(), elementId,
serviceTemplateNamespace,
getServiceTemplateInfo(serviceTemplate),
null,
null,
FileUtils.toByteArray(serviceTemplate.getContent()));
return serviceTemplateElements;
}
private static Info getServiceTemplateInfo(ServiceTemplate serviceTemplateEntity) {
Info info = new Info();
info.setName(serviceTemplateEntity.getName());
info.addProperty("type", ElementType.Servicetemplate.name());
info.addProperty("base", serviceTemplateEntity.getBaseName());
return info;
}
private static List<String> getServiceTemplateNamespace() {
return ElementHandler.getElementPath();
}
public static ElementEntityContext convertServiceTemplateToElementContext(ServiceTemplate
serviceTemplateEntity) {
return new ElementEntityContext("GLOBAL_USER", new
ElementContext(serviceTemplateEntity.getVspId(), serviceTemplateEntity.getVersion().toString()));
}
}
|
[
"[email protected]"
] | |
6a0b8aa9d61a90a3d2b2d645fc2e2300eb44e489
|
bf876d6f4f5e4dd4439c80108ee05d029bcb9994
|
/app/src/main/java/dev/dworks/apps/anexplorer/StandaloneActivity.java
|
6de5dbc22879d59b6386fdf916863e25a603934b
|
[
"Apache-2.0"
] |
permissive
|
wahidmounir/AnExplorer
|
8651d1656fce8d5c5f1f72dc47819e5301c2b8f7
|
aacdf07c1f9cc7440e384a66a3fc6ee36ec4b5f7
|
refs/heads/master
| 2020-03-29T12:04:45.003243 | 2018-09-06T06:50:23 | 2018-09-06T06:50:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 32,861 |
java
|
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.dworks.apps.anexplorer;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ComponentName;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Point;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnActionExpandListener;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.SearchView;
import android.widget.SearchView.OnQueryTextListener;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Executor;
import dev.dworks.apps.anexplorer.fragment.CreateDirectoryFragment;
import dev.dworks.apps.anexplorer.fragment.DirectoryFragment;
import dev.dworks.apps.anexplorer.fragment.RootsFragment;
import dev.dworks.apps.anexplorer.fragment.SaveFragment;
import dev.dworks.apps.anexplorer.libcore.io.IoUtils;
import dev.dworks.apps.anexplorer.misc.ContentProviderClientCompat;
import dev.dworks.apps.anexplorer.misc.MimePredicate;
import dev.dworks.apps.anexplorer.misc.ProviderExecutor;
import dev.dworks.apps.anexplorer.misc.RootsCache;
import dev.dworks.apps.anexplorer.misc.Utils;
import dev.dworks.apps.anexplorer.model.DocumentInfo;
import dev.dworks.apps.anexplorer.model.DocumentStack;
import dev.dworks.apps.anexplorer.model.DocumentsContract;
import dev.dworks.apps.anexplorer.model.DurableUtils;
import dev.dworks.apps.anexplorer.model.RootInfo;
import dev.dworks.apps.anexplorer.provider.RecentsProvider;
import dev.dworks.apps.anexplorer.provider.RecentsProvider.ResumeColumns;
import dev.dworks.apps.anexplorer.setting.SettingsActivity;
import dev.dworks.apps.anexplorer.ui.DirectoryContainerView;
import static dev.dworks.apps.anexplorer.fragment.DirectoryFragment.ANIM_DOWN;
import static dev.dworks.apps.anexplorer.fragment.DirectoryFragment.ANIM_NONE;
import static dev.dworks.apps.anexplorer.fragment.DirectoryFragment.ANIM_SIDE;
import static dev.dworks.apps.anexplorer.fragment.DirectoryFragment.ANIM_UP;
public class StandaloneActivity extends BaseActivity {
public static final String TAG = "StandaloneActivity";
private static final String EXTRA_STATE = "state";
private static final int CODE_FORWARD = 42;
private SearchView mSearchView;
private Toolbar mToolbar;
private Spinner mToolbarStack;
private Toolbar mRootsToolbar;
private ActionBarDrawerToggle mDrawerToggle;
private DirectoryContainerView mDirectoryContainer;
private boolean mIgnoreNextNavigation;
private boolean mIgnoreNextClose;
private boolean mIgnoreNextCollapse;
private boolean mSearchExpanded;
private RootsCache mRoots;
private State mState;
@Override
public void onCreate(Bundle icicle) {
if(Utils.hasLollipop()){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
}
else if(Utils.hasKitKat()){
setTheme(R.style.DocumentsTheme_Translucent);
}
setUpStatusBar();
// Debug.waitForDebugger();
super.onCreate(icicle);
mRoots = DocumentsApplication.getRootsCache(this);
setResult(Activity.RESULT_CANCELED);
setContentView(R.layout.activity);
final Context context = this;
final Resources res = getResources();
// Strongly define our horizontal dimension; we leave vertical as
final WindowManager.LayoutParams a = getWindow().getAttributes();
final Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
// a.width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
getWindow().setAttributes(a);
mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
if (icicle != null) {
mState = icicle.getParcelable(EXTRA_STATE);
} else {
buildDefaultState();
}
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitleTextAppearance(context,
android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
mToolbarStack = (Spinner) findViewById(R.id.stack);
mToolbarStack.setOnItemSelectedListener(mStackListener);
mRootsToolbar = (Toolbar) findViewById(R.id.roots_toolbar);
if (mRootsToolbar != null) {
mRootsToolbar.setTitleTextAppearance(context,
android.R.style.TextAppearance_DeviceDefault_Widget_ActionBar_Title);
}
setSupportActionBar(mToolbar);
RootsFragment.show(getFragmentManager(), null);
if (!mState.restored) {
new RestoreStackTask().execute();
} else {
onCurrentDirectoryChanged(ANIM_NONE);
}
}
@Override
public String getTag() {
return null;
}
private void buildDefaultState() {
mState = new State();
final Intent intent = getIntent();
mState.action = State.ACTION_MANAGE_ALL;
mState.acceptMimes = new String[] { "*/*" };
mState.allowMultiple = true;
mState.acceptMimes = new String[] { intent.getType() };
mState.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false);
mState.forceAdvanced = intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
mState.showAdvanced = mState.forceAdvanced
| SettingsActivity.getDisplayAdvancedDevices(this);
mState.showSize = true;
}
private class RestoreRootTask extends AsyncTask<Void, Void, RootInfo> {
private Uri mRootUri;
public RestoreRootTask(Uri rootUri) {
mRootUri = rootUri;
}
@Override
protected RootInfo doInBackground(Void... params) {
final String rootId = DocumentsContract.getRootId(mRootUri);
return mRoots.getRootOneshot(mRootUri.getAuthority(), rootId);
}
@Override
protected void onPostExecute(RootInfo root) {
if (isDestroyed()) return;
mState.restored = true;
if (root != null) {
onRootPicked(root, true);
} else {
Log.w(TAG, "Failed to find root: " + mRootUri);
finish();
}
}
}
private class RestoreStackTask extends AsyncTask<Void, Void, Void> {
private volatile boolean mRestoredStack;
private volatile boolean mExternal;
@Override
protected Void doInBackground(Void... params) {
// Restore last stack for calling package
final String packageName = getCallingPackageMaybeExtra();
final Cursor cursor = getContentResolver()
.query(RecentsProvider.buildResume(packageName), null, null, null, null);
try {
if (cursor.moveToFirst()) {
mExternal = cursor.getInt(cursor.getColumnIndex(ResumeColumns.EXTERNAL)) != 0;
final byte[] rawStack = cursor.getBlob(
cursor.getColumnIndex(ResumeColumns.STACK));
DurableUtils.readFromArray(rawStack, mState.stack);
mRestoredStack = true;
}
} catch (IOException e) {
Log.w(TAG, "Failed to resume: " + e);
} finally {
IoUtils.closeQuietly(cursor);
}
if (mRestoredStack) {
// Update the restored stack to ensure we have freshest data
final Collection<RootInfo> matchingRoots = mRoots.getMatchingRootsBlocking(mState);
try {
mState.stack.updateRoot(matchingRoots);
mState.stack.updateDocuments(getContentResolver());
} catch (FileNotFoundException e) {
Log.w(TAG, "Failed to restore stack: " + e);
mState.stack.reset();
mRestoredStack = false;
}
}
return null;
}
@Override
protected void onPostExecute(Void result) {
if (isDestroyed()) return;
mState.restored = true;
onCurrentDirectoryChanged(ANIM_NONE);
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
if (mDrawerToggle != null) {
mDrawerToggle.syncState();
}
updateActionBar();
}
@Override
public void setRootsDrawerOpen(boolean open) {
Log.w(TAG, "Trying to change state of roots drawer to > " + (open ? "open" : "closed"));
// throw new UnsupportedOperationException();
}
public void updateActionBar() {
final RootInfo root = getCurrentRoot();
mToolbar.setNavigationIcon(
root != null ? root.loadToolbarIcon(mToolbar.getContext()) : null);
mToolbar.setNavigationContentDescription(R.string.drawer_open);
mToolbar.setNavigationOnClickListener(null);
if (mSearchExpanded) {
mToolbar.setTitle(null);
mToolbarStack.setVisibility(View.GONE);
mToolbarStack.setAdapter(null);
} else {
if (mState.stack.size() <= 1) {
mToolbar.setTitle(root.title);
mToolbarStack.setVisibility(View.GONE);
mToolbarStack.setAdapter(null);
} else {
mToolbar.setTitle(null);
mToolbarStack.setVisibility(View.VISIBLE);
mToolbarStack.setAdapter(mStackAdapter);
mIgnoreNextNavigation = true;
mToolbarStack.setSelection(mStackAdapter.getCount() - 1);
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.activity, menu);
for (int i = 0; i < menu.size(); i++) {
final MenuItem item = menu.getItem(i);
switch (item.getItemId()) {
default:
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
}
final MenuItem searchMenu = menu.findItem(R.id.menu_search);
mSearchView = (SearchView) searchMenu.getActionView();
mSearchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
mSearchExpanded = true;
mState.currentSearch = query;
mSearchView.clearFocus();
onCurrentDirectoryChanged(ANIM_NONE);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
searchMenu.setOnActionExpandListener(new OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
mSearchExpanded = true;
updateActionBar();
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
mSearchExpanded = false;
if (mIgnoreNextCollapse) {
mIgnoreNextCollapse = false;
return true;
}
mState.currentSearch = null;
onCurrentDirectoryChanged(ANIM_NONE);
return true;
}
});
mSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
mSearchExpanded = false;
if (mIgnoreNextClose) {
mIgnoreNextClose = false;
return false;
}
mState.currentSearch = null;
onCurrentDirectoryChanged(ANIM_NONE);
return false;
}
});
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
final FragmentManager fm = getFragmentManager();
final RootInfo root = getCurrentRoot();
final DocumentInfo cwd = getCurrentDirectory();
final MenuItem createDir = menu.findItem(R.id.menu_create_dir);
final MenuItem search = menu.findItem(R.id.menu_search);
final MenuItem sort = menu.findItem(R.id.menu_sort);
final MenuItem sortSize = menu.findItem(R.id.menu_sort_size);
final MenuItem grid = menu.findItem(R.id.menu_grid);
final MenuItem list = menu.findItem(R.id.menu_list);
sort.setVisible(cwd != null);
grid.setVisible(mState.derivedMode != State.MODE_GRID);
list.setVisible(mState.derivedMode != State.MODE_LIST);
if (mState.currentSearch != null) {
// Search uses backend ranking; no sorting
sort.setVisible(false);
search.expandActionView();
mSearchView.setIconified(false);
mSearchView.clearFocus();
mSearchView.setQuery(mState.currentSearch, false);
} else {
mIgnoreNextClose = true;
mSearchView.setIconified(true);
mSearchView.clearFocus();
mIgnoreNextCollapse = true;
search.collapseActionView();
}
// Only sort by size when visible
sortSize.setVisible(mState.showSize);
search.setVisible(true);
createDir.setVisible(true);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
final int id = item.getItemId();
if (id == android.R.id.home) {
onBackPressed();
return true;
} else if (id == R.id.menu_create_dir) {
CreateDirectoryFragment.show(getSupportFragmentManager());
return true;
} else if (id == R.id.menu_search) {
return false;
} else if (id == R.id.menu_sort_name) {
setUserSortOrder(State.SORT_ORDER_DISPLAY_NAME);
return true;
} else if (id == R.id.menu_sort_date) {
setUserSortOrder(State.SORT_ORDER_LAST_MODIFIED);
return true;
} else if (id == R.id.menu_sort_size) {
setUserSortOrder(State.SORT_ORDER_SIZE);
return true;
} else if (id == R.id.menu_grid) {
setUserMode(State.MODE_GRID);
return true;
} else if (id == R.id.menu_list) {
setUserMode(State.MODE_LIST);
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
@Override
public void onStateChanged() {
supportInvalidateOptionsMenu();
}
/**
* Set state sort order based on explicit user action.
*/
private void setUserSortOrder(int sortOrder) {
mState.userSortOrder = sortOrder;
Fragment fragment = DirectoryFragment.get(getFragmentManager());
if(fragment instanceof DirectoryFragment) {
final DirectoryFragment directory = (DirectoryFragment) fragment;
directory.onUserSortOrderChanged();
}
}
/**
* Set state mode based on explicit user action.
*/
private void setUserMode(int mode) {
mState.userMode = mode;
Fragment fragment = DirectoryFragment.get(getFragmentManager());
if(fragment instanceof DirectoryFragment) {
final DirectoryFragment directory = (DirectoryFragment) fragment;
directory.onUserModeChanged();
}
}
@Override
public void setPending(boolean pending) {
final SaveFragment save = SaveFragment.get(getFragmentManager());
if (save != null) {
save.setPending(pending);
}
}
@Override
public void onBackPressed() {
if (!mState.stackTouched) {
super.onBackPressed();
return;
}
final int size = mState.stack.size();
if (size > 1) {
mState.stack.pop();
onCurrentDirectoryChanged(ANIM_UP);
} else {
super.onBackPressed();
}
}
@Override
protected void onSaveInstanceState(Bundle state) {
super.onSaveInstanceState(state);
state.putParcelable(EXTRA_STATE, mState);
}
@Override
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
}
private BaseAdapter mStackAdapter = new BaseAdapter() {
@Override
public int getCount() {
return mState.stack.size();
}
@Override
public DocumentInfo getItem(int position) {
return mState.stack.get(mState.stack.size() - position - 1);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_subdir_title, parent, false);
}
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
final DocumentInfo doc = getItem(position);
if (position == 0) {
final RootInfo root = getCurrentRoot();
title.setText(root.title);
} else {
title.setText(doc.displayName);
}
return convertView;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_subdir, parent, false);
}
final ImageView subdir = (ImageView) convertView.findViewById(R.id.subdir);
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
final DocumentInfo doc = getItem(position);
if (position == 0) {
final RootInfo root = getCurrentRoot();
title.setText(root.title);
subdir.setVisibility(View.GONE);
} else {
title.setText(doc.displayName);
subdir.setVisibility(View.VISIBLE);
}
return convertView;
}
};
private OnItemSelectedListener mStackListener = new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (mIgnoreNextNavigation) {
mIgnoreNextNavigation = false;
return;
}
while (mState.stack.size() > position + 1) {
mState.stackTouched = true;
mState.stack.pop();
}
onCurrentDirectoryChanged(ANIM_UP);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
// Ignored
}
};
@Override
public RootInfo getCurrentRoot() {
if (mState.stack.root != null) {
return mState.stack.root;
} else {
return mRoots.getHomeRoot();
}
}
public RootInfo getDownloadRoot() {
return mRoots.getDownloadRoot();
}
@Override
public boolean getActionMode() {
return false;
}
@Override
public void setActionMode(boolean actionMode) {
}
@Override
public void setUpStatusBar() {
}
@Override
public void setUpDefaultStatusBar() {
}
@Override
public boolean isShowAsDialog() {
return false;
}
@Override
public void upadateActionItems(RecyclerView mCurrentView) {
}
@Override
public void setInfoDrawerOpen(boolean open) {
}
@Override
public void again() {
}
public DocumentInfo getCurrentDirectory() {
return mState.stack.peek();
}
private String getCallingPackageMaybeExtra() {
final String extra = getIntent().getStringExtra(DocumentsContract.EXTRA_PACKAGE_NAME);
return (extra != null) ? extra : getCallingPackage();
}
public Executor getCurrentExecutor() {
final DocumentInfo cwd = getCurrentDirectory();
if (cwd != null && cwd.authority != null) {
return ProviderExecutor.forAuthority(cwd.authority);
} else {
return AsyncTask.THREAD_POOL_EXECUTOR;
}
}
@Override
public State getDisplayState() {
return mState;
}
private void onCurrentDirectoryChanged(int anim) {
final FragmentManager fm = getFragmentManager();
final RootInfo root = getCurrentRoot();
final DocumentInfo cwd = getCurrentDirectory();
mDirectoryContainer.setDrawDisappearingFirst(anim == ANIM_DOWN);
if (cwd == null) {
DirectoryFragment.showRecentsOpen(fm, anim);
// Start recents in grid when requesting visual things
final boolean visualMimes = MimePredicate.mimeMatches(
MimePredicate.VISUAL_MIMES, mState.acceptMimes);
mState.userMode = visualMimes ? State.MODE_GRID : State.MODE_LIST;
mState.derivedMode = mState.userMode;
} else {
if (mState.currentSearch != null) {
// Ongoing search
DirectoryFragment.showSearch(fm, root, cwd, mState.currentSearch, anim);
} else {
// Normal boring directory
DirectoryFragment.showNormal(fm, root, cwd, anim);
}
}
final RootsFragment roots = RootsFragment.get(fm);
if (roots != null) {
roots.onCurrentRootChanged();
}
updateActionBar();
supportInvalidateOptionsMenu();
dumpStack();
}
@Override
public void onStackPicked(DocumentStack stack) {
try {
// Update the restored stack to ensure we have freshest data
stack.updateDocuments(getContentResolver());
mState.stack = stack;
mState.stackTouched = true;
onCurrentDirectoryChanged(ANIM_SIDE);
} catch (FileNotFoundException e) {
Log.w(TAG, "Failed to restore stack: " + e);
}
}
@Override
public void onRootPicked(RootInfo root, boolean closeDrawer) {
// Clear entire backstack and start in new root
mState.stack.root = root;
mState.stack.clear();
mState.stackTouched = true;
if (!mRoots.isRecentsRoot(root)) {
new PickRootTask(root).executeOnExecutor(getCurrentExecutor());
} else {
onCurrentDirectoryChanged(ANIM_SIDE);
}
}
private class PickRootTask extends AsyncTask<Void, Void, DocumentInfo> {
private RootInfo mRoot;
public PickRootTask(RootInfo root) {
mRoot = root;
}
@Override
protected DocumentInfo doInBackground(Void... params) {
try {
final Uri uri = DocumentsContract.buildDocumentUri(
mRoot.authority, mRoot.documentId);
return DocumentInfo.fromUri(getContentResolver(), uri);
} catch (FileNotFoundException e) {
Log.w(TAG, "Failed to find root", e);
return null;
}
}
@Override
protected void onPostExecute(DocumentInfo result) {
if (result != null) {
mState.stack.push(result);
mState.stackTouched = true;
onCurrentDirectoryChanged(ANIM_SIDE);
}
}
}
@Override
public void onAppPicked(ResolveInfo info) {
final Intent intent = new Intent(getIntent());
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_FORWARD_RESULT);
intent.setComponent(new ComponentName(
info.activityInfo.applicationInfo.packageName, info.activityInfo.name));
startActivityForResult(intent, CODE_FORWARD);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, "onActivityResult() code=" + resultCode);
// Only relay back results when not canceled; otherwise stick around to
// let the user pick another app/backend.
if (requestCode == CODE_FORWARD && resultCode != RESULT_CANCELED) {
// Remember that we last picked via external app
final String packageName = getCallingPackageMaybeExtra();
final ContentValues values = new ContentValues();
values.put(ResumeColumns.EXTERNAL, 1);
getContentResolver().insert(RecentsProvider.buildResume(packageName), values);
// Pass back result to original caller
setResult(resultCode, data);
finish();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void onDocumentPicked(DocumentInfo doc) {
final FragmentManager fm = getFragmentManager();
if (doc.isDirectory()) {
mState.stack.push(doc);
mState.stackTouched = true;
onCurrentDirectoryChanged(ANIM_DOWN);
} else {
// Fall back to viewing
final Intent view = new Intent(Intent.ACTION_VIEW);
view.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
view.setData(doc.derivedUri);
try {
startActivity(view);
} catch (ActivityNotFoundException ex2) {
Toast.makeText(this, R.string.toast_no_application, Toast.LENGTH_SHORT).show();
}
}
}
public void onDocumentsPicked(List<DocumentInfo> docs) {
// TODO
}
@Override
public void onSaveRequested(DocumentInfo replaceTarget) {
new ExistingFinishTask(replaceTarget.derivedUri).executeOnExecutor(getCurrentExecutor());
}
@Override
public void onSaveRequested(String mimeType, String displayName) {
new CreateFinishTask(mimeType, displayName).executeOnExecutor(getCurrentExecutor());
}
@Override
public boolean isCreateSupported() {
return false;
}
@Override
public void onPickRequested(DocumentInfo pickTarget) {
final Uri viaUri = DocumentsContract.buildTreeDocumentUri(pickTarget.authority,
pickTarget.documentId);
new PickFinishTask(viaUri).executeOnExecutor(getCurrentExecutor());
}
private void saveStackBlocking() {
final ContentResolver resolver = getContentResolver();
final ContentValues values = new ContentValues();
final byte[] rawStack = DurableUtils.writeToArrayOrNull(mState.stack);
// Remember location for next app launch
final String packageName = getCallingPackageMaybeExtra();
values.clear();
values.put(ResumeColumns.STACK, rawStack);
values.put(ResumeColumns.EXTERNAL, 0);
resolver.insert(RecentsProvider.buildResume(packageName), values);
}
private void onFinished(Uri... uris) {
Log.d(TAG, "onFinished() " + Arrays.toString(uris));
final Intent intent = new Intent();
if (uris.length == 1) {
intent.setData(uris[0]);
} else if (uris.length > 1) {
final ClipData clipData = new ClipData(
null, mState.acceptMimes, new ClipData.Item(uris[0]));
for (int i = 1; i < uris.length; i++) {
clipData.addItem(new ClipData.Item(uris[i]));
}
if(Utils.hasJellyBean()){
intent.setClipData(clipData);
}
else{
intent.setData(uris[0]);
}
}
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
setResult(Activity.RESULT_OK, intent);
finish();
}
private class CreateFinishTask extends AsyncTask<Void, Void, Uri> {
private final String mMimeType;
private final String mDisplayName;
public CreateFinishTask(String mimeType, String displayName) {
mMimeType = mimeType;
mDisplayName = displayName;
}
@Override
protected void onPreExecute() {
setPending(true);
}
@Override
protected Uri doInBackground(Void... params) {
final ContentResolver resolver = getContentResolver();
final DocumentInfo cwd = getCurrentDirectory();
ContentProviderClient client = null;
Uri childUri = null;
try {
client = DocumentsApplication.acquireUnstableProviderOrThrow(
resolver, cwd.derivedUri.getAuthority());
childUri = DocumentsContract.createDocument(
resolver, cwd.derivedUri, mMimeType, mDisplayName);
} catch (Exception e) {
Log.w(TAG, "Failed to create document", e);
} finally {
ContentProviderClientCompat.releaseQuietly(client);
}
if (childUri != null) {
saveStackBlocking();
}
return childUri;
}
@Override
protected void onPostExecute(Uri result) {
if (result != null) {
onFinished(result);
} else {
Toast.makeText(StandaloneActivity.this, R.string.save_error, Toast.LENGTH_SHORT)
.show();
}
setPending(false);
}
}
private class ExistingFinishTask extends AsyncTask<Void, Void, Void> {
private final Uri[] mUris;
public ExistingFinishTask(Uri... uris) {
mUris = uris;
}
@Override
protected Void doInBackground(Void... params) {
saveStackBlocking();
return null;
}
@Override
protected void onPostExecute(Void result) {
onFinished(mUris);
}
}
private class PickFinishTask extends AsyncTask<Void, Void, Void> {
private final Uri mUri;
public PickFinishTask(Uri uri) {
mUri = uri;
}
@Override
protected Void doInBackground(Void... params) {
saveStackBlocking();
return null;
}
@Override
protected void onPostExecute(Void result) {
onFinished(mUri);
}
}
private void dumpStack() {
Log.d(TAG, "Current stack: ");
Log.d(TAG, " * " + mState.stack.root);
for (DocumentInfo doc : mState.stack) {
Log.d(TAG, " +-- " + doc);
}
}
public static BaseActivity get(Fragment fragment) {
return (BaseActivity) fragment.getActivity();
}
}
|
[
"[email protected]"
] | |
91a697bca71e8d44801a0dc8f8be73ce15572b59
|
91e806fcdbcaa656cc44a4960c32f4c5ec5ea060
|
/shihuo/app/src/main/java/com/shihuo/shihuo/Activities/shop/models/GoodsPropertyModel.java
|
fa6eaf7c83370bd78d978c21efd2a6f7ecb7c2a9
|
[] |
no_license
|
qiujiaheng2000/shihuo
|
4a0b5ae9d2aa4a6267cdc87bde86acfd5d476456
|
46c7ac66e8f67fbdb8f79ebbda7f456103073069
|
refs/heads/master
| 2021-01-13T07:20:07.673997 | 2017-02-28T17:03:30 | 2017-02-28T17:03:30 | 71,627,348 | 0 | 3 | null | 2017-02-13T03:12:39 | 2016-10-22T08:42:23 |
Java
|
UTF-8
|
Java
| false | false | 710 |
java
|
package com.shihuo.shihuo.Activities.shop.models;
import com.google.gson.Gson;
/**
* Created by cm_qiujiaheng on 2016/12/5.
* 商品属性规格模型
*/
public class GoodsPropertyModel {
public float prePrice;//原价
public float curPrice;//现价
public int stockNum;//库存
public String specName;//规格名称
public GoodsPropertyModel(float prePrice, float curPrice, int stockNum, String specName) {
this.prePrice = prePrice;
this.curPrice = curPrice;
this.stockNum = stockNum;
this.specName = specName;
}
public String toJsonStr() {
Gson gson = new Gson();
return gson.toJson(this, GoodsPropertyModel.class);
}
}
|
[
"[email protected]"
] | |
363da9bad81d43f48c179cad4bae99ac5e549e04
|
acb7910d79d5d19b3758d5a42aec2917f04d6188
|
/src/main/java/by/epam/onlinepharmacy/model/dao/UserDao.java
|
a471c9f97aed2c4a9c24c16b8ee7a81c91437f6b
|
[] |
no_license
|
Realovka/epam-online-pharmacy
|
f396c49f0ae03b30d70c865c07ebeb0e45967f22
|
53ce931076f1a9c028c32b9c3fdb1cab8ab11691
|
refs/heads/master
| 2023-08-21T07:56:51.923566 | 2021-10-30T05:58:41 | 2021-10-30T05:58:41 | 393,155,616 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,625 |
java
|
package by.epam.onlinepharmacy.model.dao;
import by.epam.onlinepharmacy.entity.Status;
import by.epam.onlinepharmacy.entity.User;
import by.epam.onlinepharmacy.exception.DaoException;
import java.util.List;
import java.util.Optional;
/**
* The interface User dao.
*/
public interface UserDao {
/**
* Create user int.
*
* @param user the user
* @return the int
* @throws DaoException the dao exception
*/
int createUser(User user) throws DaoException;
/**
* Create code activation.
*
* @param userId the user id
* @param code the code
* @throws DaoException the dao exception
*/
void createCodeActivation(long userId, String code) throws DaoException;
/**
* Find id for verification customer long.
*
* @param code the code
* @return the long
* @throws DaoException the dao exception
*/
long findIdForVerificationCustomer(String code) throws DaoException;
/**
* Find by login optional.
*
* @param login the login
* @return the optional
* @throws DaoException the dao exception
*/
Optional<User> findByLogin(String login) throws DaoException;
/**
* Find by id optional.
*
* @param id the id
* @return the optional
* @throws DaoException the dao exception
*/
Optional<User> findById(long id) throws DaoException;
/**
* Find user by login and password optional.
*
* @param login the login
* @param password the password
* @return the optional
* @throws DaoException the dao exception
*/
Optional<User> findUserByLoginAndPassword(String login, String password) throws DaoException;
/**
* Find all pharmacists list.
*
* @return the list
* @throws DaoException the dao exception
*/
List<User> findAllPharmacists() throws DaoException;
/**
* Update user status int.
*
* @param id the id
* @param status the status
* @return the int
* @throws DaoException the dao exception
*/
int updateUserStatus(long id, Status status) throws DaoException;
/**
* Find inactive pharmacists list.
*
* @return the list
* @throws DaoException the dao exception
*/
List<User> findInactivePharmacists() throws DaoException;
/**
* Update login int.
*
* @param id the id
* @param login the login
* @return the int
* @throws DaoException the dao exception
*/
int updateLogin(long id, String login) throws DaoException;
/**
* Update first name int.
*
* @param id the id
* @param firstName the first name
* @return the int
* @throws DaoException the dao exception
*/
int updateFirstName(long id, String firstName) throws DaoException;
/**
* Update last name int.
*
* @param id the id
* @param lastName the last name
* @return the int
* @throws DaoException the dao exception
*/
int updateLastName(long id, String lastName) throws DaoException;
/**
* Update email int.
*
* @param id the id
* @param email the email
* @return the int
* @throws DaoException the dao exception
*/
int updateEmail(long id, String email) throws DaoException;
/**
* Update telephone int.
*
* @param id the id
* @param telephone the telephone
* @return the int
* @throws DaoException the dao exception
*/
int updateTelephone(long id, String telephone) throws DaoException;
}
|
[
"[email protected]"
] | |
cabdb7c0eeee3eb588c5b185fd8ea8e8a73e2bf5
|
64cf41ad2f244af7bb3573ad95d340742c9b50f1
|
/WS_SOAP_Client/src/main/java/com/pg/ws/stub/calculator/CalculatorServiceImplService.java
|
8babeebb7ea62a4c1118cca22de58f22f177742f
|
[] |
no_license
|
pradhapganesanjava/pgworkspacejee
|
b5ed14393f89667d6c9864284c6a405d923a2c80
|
c043f17d7fc1cd026868fe653ff5d9c9e65de7ef
|
refs/heads/master
| 2021-01-10T04:38:25.197099 | 2017-11-22T10:35:05 | 2017-11-22T10:35:05 | 51,185,870 | 0 | 0 | null | 2017-11-22T10:35:06 | 2016-02-06T02:18:31 |
Java
|
UTF-8
|
Java
| false | false | 3,004 |
java
|
package com.pg.ws.stub.calculator;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;
import javax.jws.HandlerChain;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.6 in JDK 6
* Generated source version: 2.1
*
*/
@WebServiceClient(name = "CalculatorServiceImplService", targetNamespace = "http://calculator.demo.service.ws.pg.com/", wsdlLocation = "file:/A:/projects/pgworkspacejee/WS_SOAP_Client/src/main/resources/wsdl/calculator/CalculatorServiceImplService.wsdl")
@HandlerChain(file="config//calculator-handler-chain.xml")
public class CalculatorServiceImplService
extends Service
{
private final static URL CALCULATORSERVICEIMPLSERVICE_WSDL_LOCATION;
private final static Logger logger = Logger.getLogger(com.pg.ws.stub.calculator.CalculatorServiceImplService.class.getName());
static {
URL url = null;
try {
URL baseUrl;
baseUrl = com.pg.ws.stub.calculator.CalculatorServiceImplService.class.getResource(".");
url = new URL(baseUrl, "file:/A:/projects/pgworkspacejee/WS_SOAP_Client/src/main/resources/wsdl/calculator/CalculatorServiceImplService.wsdl");
} catch (MalformedURLException e) {
logger.warning("Failed to create URL for the wsdl Location: 'file:/A:/projects/pgworkspacejee/WS_SOAP_Client/src/main/resources/wsdl/calculator/CalculatorServiceImplService.wsdl', retrying as a local file");
logger.warning(e.getMessage());
}
CALCULATORSERVICEIMPLSERVICE_WSDL_LOCATION = url;
}
public CalculatorServiceImplService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public CalculatorServiceImplService() {
super(CALCULATORSERVICEIMPLSERVICE_WSDL_LOCATION, new QName("http://calculator.demo.service.ws.pg.com/", "CalculatorServiceImplService"));
}
/**
*
* @return
* returns CalculatorService
*/
@WebEndpoint(name = "CalculatorServiceImplPort")
public CalculatorService getCalculatorServiceImplPort() {
return super.getPort(new QName("http://calculator.demo.service.ws.pg.com/", "CalculatorServiceImplPort"), CalculatorService.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns CalculatorService
*/
@WebEndpoint(name = "CalculatorServiceImplPort")
public CalculatorService getCalculatorServiceImplPort(WebServiceFeature... features) {
return super.getPort(new QName("http://calculator.demo.service.ws.pg.com/", "CalculatorServiceImplPort"), CalculatorService.class, features);
}
}
|
[
"[email protected]"
] | |
57cf21b0a1c4ccef5d01e5933add5c206ce5b93c
|
e8e48a96f2aba9040f4f55ab61efaab1a9eb6a23
|
/interviewbit/Graph/SortedListToBST.java
|
7ba15b4b0b5b326f123994ff8d915ed99d52188c
|
[] |
no_license
|
arnabs542/algorithmic-problems
|
67342172c2035d9ffb2ee2bf0f1901e651dcce12
|
5d19d2e9cddc20e8a6949ac38fe6fb73dfc81bf4
|
refs/heads/master
| 2021-12-14T05:41:50.177195 | 2017-04-15T07:42:41 | 2017-04-15T07:42:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,296 |
java
|
/*Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
A height balanced BST : a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
Example :
Given A : 1 -> 2 -> 3
A height balanced BST :
2
/ \
1 3
*/
/**
* Definition for singly-linked list.
* class ListNode {
* public int val;
* public ListNode next;
* ListNode(int x) { val = x; next = null; }
* }
*/
public class Solution {
ListNode node;
int getLength(ListNode node){
int len = 0;
while(node != null){
len++;
node = node.next;
}
return len;
}
public TreeNode sortedListToBST(ListNode head) {
if(head == null)
return null;
int n = getLength(head);
this.node = head;
return inorder(0, n-1);
}
public TreeNode inorder(int start, int end){
if(end < start)
return null;
int mid = (start + end)/2;
TreeNode left = inorder(start, mid-1);
TreeNode root = new TreeNode(node.val);
root.left = left;
node = node.next;
root.right = inorder(mid+1, end);
return root;
}
}
|
[
"[email protected]"
] | |
6a01e30e36c7f0cb4e00566a29c0360f0774ee3a
|
a50bf249d038fb97138be21bcdd381623faf7eb7
|
/FJ21-JDBC/Java SE/br/com/caelum/jdbc/teste/TestaInsereFuncionario.java
|
e22ec93d70fbe02be72644ff8dca8e4fc7dde114
|
[] |
no_license
|
JucaRei/Fj-21-Workspace
|
2a18e772aaaff3ff2da35459bdf179db0bb17e74
|
24b46580dd05ab66f0a6cbd834b6d6f65d4ca937
|
refs/heads/master
| 2021-08-07T09:26:26.439573 | 2017-11-07T23:18:13 | 2017-11-07T23:18:13 | 109,540,416 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 563 |
java
|
package br.com.caelum.jdbc.teste;
import br.com.caelum.jdbc.dao.FuncionarioDao;
import br.com.caelum.jdbc.modelo.Funcionario;
public class TestaInsereFuncionario {
public static void main(String[] args) {
Funcionario funcionario = new Funcionario();
funcionario.setId(123l);
funcionario.setNome("Juca");
funcionario.setUsuario("jucax");
funcionario.setSenha("200291");
//grave nessa conexão!!!
FuncionarioDao Dao = new FuncionarioDao();
//metodo elegante
Dao.adiciona(funcionario);
System.out.println("Gravado!");
}
}
|
[
"[email protected]"
] | |
c780bd16991e642901c2a3163d3b83e0de0a6106
|
e6541846c0af183faa339ccfd7a7aa65d5bbc15e
|
/eureka-server/src/main/java/cn/figo/cloud/EurekaServerApplication.java
|
58854b5461a747f54c53e87cf37a9c1f8cd595bc
|
[] |
no_license
|
MesterHuang/spring-cloud
|
49d104904a62bc884f2bf2ec63aa7e6fd40e2fa8
|
e6add89451043ad764611d4a39ebfda7f53b7380
|
refs/heads/master
| 2020-03-18T13:55:41.260363 | 2018-05-25T07:27:25 | 2018-05-25T07:27:25 | 134,818,129 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 489 |
java
|
package cn.figo.cloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* 启动一个服务注册中心,添加 注解@EnableEurekaServer
*/
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
|
[
"[email protected]"
] | |
01713782102430383ab42eadb2643d281865d7db
|
1cae2b217d5ca8a71b394628d689258ea9dfcee8
|
/src/main/java/org/jenkinsci/plugins/cloud_management/tools/ChefSetupCommand.java
|
278e3c39f18ff10d07e57b8f3fd4a88f18d6be6f
|
[
"MIT"
] |
permissive
|
scubism/cloud_management
|
e1bb3672068acb4e4b83cd7c0252bb3405933ba4
|
7f4e3bfd2d570b5d8e913ed7b512ee892d213788
|
refs/heads/master
| 2020-04-05T23:35:20.945899 | 2012-12-06T13:49:58 | 2012-12-06T13:49:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,244 |
java
|
package org.jenkinsci.plugins.cloud_management.tools;
/**
*
* @author Satoshi Akama
*/
public class ChefSetupCommand extends AbstractSetupCommand {
protected String hostname;
protected String region;
protected String availability_zone;
protected String ami;
protected String instance_type;
protected Boolean require_sudo;
public ChefSetupCommand() {
}
@Override
public boolean isCommandEnable(boolean useEc2, boolean useElb) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean launchEc2Instance(String ami) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean stopEc2Instance(String ami_id) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean terminateEc2Instance(String ami_id) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean associateElasticIp(String ip) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean releaseElasticIp(String ip) {
// TODO Auto-generated method stub
return false;
}
}
|
[
"[email protected]"
] | |
2425d1b110995cfb6ea4bad932252607f842466a
|
647ed260a2610f09aed718dfe47d0d61287d15b1
|
/Group1605/.svn/pristine/f0/f071c6646415e8afddd62ce19ae54c3b1c473e3b.svn-base
|
2da323606d1c85de05ab3ef749f344a3bcbc146b
|
[] |
no_license
|
luosir15678912823/myProject
|
fb1ff6b1e7e878f3cc6c00ddc0d25a056a4bcabf
|
304fd138309bf51213b54391735f2206690d6d24
|
refs/heads/master
| 2020-07-24T14:34:09.650973 | 2016-11-23T10:45:00 | 2016-11-23T10:45:00 | 73,788,832 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,488 |
package com.nightly.lovetravel.bean;
import cn.bmob.v3.BmobObject;
/**
* Created by Administrator on 2016-11-07.
*/
public class ContentBean extends BmobObject{
AttractionsBean.ShowapiResBodyBean.PagebeanBean.ContentlistBean contentlistBean;
String userId;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public AttractionsBean.ShowapiResBodyBean.PagebeanBean.ContentlistBean getContentlistBean() {
return contentlistBean;
}
public void setContentlistBean(AttractionsBean.ShowapiResBodyBean.PagebeanBean.ContentlistBean contentlistBean) {
this.contentlistBean = contentlistBean;
}
// private String proId;
// private String summary;
// private String cityId;
//
// private AttractionsBean.ShowapiResBodyBean.PagebeanBean.ContentlistBean.LocationBean location;
// private String cityName;
// private String areaId;
// private String id;
// private String content;
// private String proName;
// private String price;
// private String areaName;
// private String address;
// private String name;
// private String attention;
// private String coupon;
// private String opentime;
// private List<AttractionsBean.ShowapiResBodyBean.PagebeanBean.ContentlistBean.PriceListBean> priceList;
// private List<AttractionsBean.ShowapiResBodyBean.PagebeanBean.ContentlistBean.PicListBean> picList;
}
|
[
"[email protected]"
] | ||
9056c165786aa5c72b4ca19eb5e7d130b539eaaa
|
43611ef07651626ff71c61a15ae1d4602054480a
|
/src/main/java/demo/GraphOperator/forInsert/AddOperator.java
|
c171c342188c8a74c62653701a26fba83a0a40ff
|
[] |
no_license
|
woodwolfzhu/GraphMaintenance
|
2001105b307dbdac8fc17b67b2d72b48724bbf7c
|
5571d262c57b656eb536297ac6ae797749918469
|
refs/heads/master
| 2021-08-05T20:48:49.825401 | 2020-01-20T09:40:12 | 2020-01-20T09:40:12 | 225,752,654 | 0 | 0 | null | 2020-10-13T17:57:02 | 2019-12-04T01:33:15 |
Java
|
UTF-8
|
Java
| false | false | 1,862 |
java
|
package demo.GraphOperator.forInsert;
import demo.Graph.Graph;
import demo.Graph.NormalGraph;
import demo.Graph.Quintuple;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class AddOperator extends Operator {
public static Graph getResult(Graph R, Graph S) {
// 新的topGraph,对应NormalGraph中的topGraph
HashMap<String, HashMap> resultR = R.getTopGraph();
// 获得graphS 的Iterator
Iterator graphIteratorS = S.getGraphIterator();
while (graphIteratorS.hasNext()) {
Map.Entry entry = (Map.Entry) graphIteratorS.next();
String startName = (String) entry.getKey();
// 获得同样以某个节点为起点的点的Map,形式为<String,Quintuple>(<终点名,对应的五元组>
HashMap bottomMapS = (HashMap) entry.getValue();
HashMap bottomMapR = resultR.get(startName);
// 如果S中有R中不存在的元素,则将其放入S中,起点不存在
if (bottomMapR == null) {
resultR.put(startName, bottomMapS);
continue;
}
Iterator bottomIteratorS = bottomMapS.entrySet().iterator();
String endName = null;
while (bottomIteratorS.hasNext()) {
Map.Entry bottomEntryS = (Map.Entry) bottomIteratorS.next();
endName = (String) bottomEntryS.getKey();
// 如果S中有R中不存在的元素,则将其放入S中,终点不存在
if (bottomMapR.get(endName) == null) {
Quintuple quintupleR = (Quintuple) bottomEntryS.getValue();
bottomMapR.put(endName, quintupleR);
}
}
resultR.put(startName, bottomMapR);
}
return new NormalGraph(resultR);
}
}
|
[
"[email protected]"
] | |
f47535d035f25ccd16ddfcbfda70941f54bc9902
|
9fb7c6b7273d14160eacd257812cf1c9af5fe283
|
/AnCal/src/pl/magot/vetch/ancal/reminder/AlarmDataViewItem.java
|
2c2592dcbaac4a8e5d1db269f5b9018c1abe1a01
|
[] |
no_license
|
guolinaileen/Android-Calendar
|
341b64d4f7bccf95d8018656128a92789ede51b5
|
5caf4aff86b585123a2ab2fb5dd679f7e6f2b3d9
|
refs/heads/master
| 2020-12-24T14:26:21.194836 | 2013-08-29T22:58:41 | 2013-08-29T22:58:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,576 |
java
|
package pl.magot.vetch.ancal.reminder;
import pl.magot.vetch.ancal.R;
import pl.magot.vetch.ancal.Utils;
public class AlarmDataViewItem
{
//fields
public static final int iOrderAppts = 0;
public static final int iOrderTasks = 1;
//fields
private long lID = -1;
protected String sSubject = "";
private int iOrder = -1;
private int iHour = 0;
private int iMinute = 0;
private int iDurationInMinutes = 0;
protected boolean bAlarm = false;
protected long lPriority = -1;
private long lRepeatDaysBitMask = 0;
//methods
public AlarmDataViewItem(long lID, String sSubject, int iOrder, boolean bAlarm)
{
this.lID = lID;
this.sSubject = sSubject;
this.iOrder = iOrder;
this.bAlarm = bAlarm;
}
public void Set(int iHour, int iMinute, int iDurationInMinutes)
{
this.iHour = iHour;
this.iMinute = iMinute;
this.iDurationInMinutes = iDurationInMinutes;
}
public void Set(long lPriority)
{
this.lPriority = lPriority;
}
public int TimeAsSeconds()
{
return (iMinute * 60) + (iHour * 3600);
}
public long GetID()
{
return lID;
}
public int GetOrder()
{
return this.iOrder;
}
public int GetDuration()
{
return iDurationInMinutes;
}
public void SetRepeatDays(long lDaysData)
{
lRepeatDaysBitMask = lDaysData;
}
//returns true if 0, +1, +2, and so on day back is active
public boolean GetVisibleDay(int iDay)
{
long bitMask = 0x01L << iDay;
return ((lRepeatDaysBitMask & bitMask) != 0);
}
public int GetOverdueDays()
{
long bitMask = 0x01L;
for (int iDayOffset = 0; iDayOffset < 7; iDayOffset++)
{
if ((lRepeatDaysBitMask & bitMask) == bitMask)
return iDayOffset;
bitMask <<= 1;
}
return 0;
}
public boolean IsOverdue()
{
long bitMask = 0x01L;
return ((lRepeatDaysBitMask & bitMask) == 0);
}
public int GetTimeKey()
{
return (iHour * 100) + iMinute;
}
public String GetTimeAsText(boolean b24HourMode)
{
String s = "";
String sm = "AM";
if (iHour >= 12)
sm = "PM";
int iDisplayHour = iHour;
if (iDisplayHour == 0)
iDisplayHour = 12;
if (iDisplayHour > 12)
iDisplayHour -= 12;
//format time
if (b24HourMode)
{
s = String.format("%1$d:%2$02d", iHour, iMinute);
} else {
s = String.format("%1$d:%2$02d %3$s", iDisplayHour, iMinute, sm);
}
return s;
}
public String GetText(Utils utils, boolean b24HourMode)
{
final int iOverdueDays = GetOverdueDays();
String s = "";
String sText = new String(sSubject);
sText = sText.replace("\n", " ");
sText = Utils.CapitalizeFirstLetter(sText);
//appt info
if (iOrder == iOrderAppts)
{
if (iOverdueDays == 0)
{
String sTime = GetTimeAsText(b24HourMode);
s = String.format("%1$s. %2$s", sTime, sText);
} else {
String sOverdueText = utils.GetResStr(R.string.msgDaysOverdue);
s = String.format("%1$s. (%2$d %3$s)", sText, iOverdueDays, sOverdueText);
if (iOverdueDays == 1)
{
sOverdueText = utils.GetResStr(R.string.msgDayOverdue);
s = String.format("%1$s. (%2$s)", sText, sOverdueText);
}
}
}
//task info
if (iOrder == iOrderTasks)
{
s = String.format("%2$s. (%1$d)", lPriority, sText);
}
return s;
}
public String GetHashString()
{
String s = "";
s += Long.toString(lID);
s += sSubject;
s += Integer.toString(iOrder);
s += Integer.toString(iHour);
s += Integer.toString(iMinute);
s += Boolean.toString(bAlarm);
s += Long.toString(lPriority);
s += Long.toString(lRepeatDaysBitMask);
return s;
}
}
|
[
"[email protected]"
] | |
574dbaba61d28430e75a6724fb9fab42ae1912d3
|
b4390298e3549d476d849d8d33a10bd0a6920cdd
|
/1_ProgramList12/src/gridbag/FontFrame.java
|
ad51b7cce7501910ae3b39f51a792244002c0219
|
[] |
no_license
|
ZeromaXHe/CoreJava_ProgramList
|
cb058431c72ddb3cba1672c256f2dffd635cdc8b
|
1f511f97ba9698482509205cb3d970e352e74a3b
|
refs/heads/master
| 2020-05-20T14:29:41.696057 | 2019-05-22T12:45:45 | 2019-05-22T12:45:45 | 185,621,966 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,763 |
java
|
//I 12-10: 524 (541 / 728)
//程序清单12-10显示了字体对话框示例的框架类
package gridbag;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
public class FontFrame extends JFrame{
public static final int TEXT_ROWS = 10;
public static final int TEXT_COLUMNS = 20;
private JComboBox<String> face;
private JComboBox<Integer> size;
private JCheckBox bold;
private JCheckBox italic;
private JTextArea sample;
public static void main(String[] args) {
EventQueue.invokeLater(()->{
JFrame frame = new FontFrame();
frame.setTitle("FontFrameTest");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
});
}
public FontFrame(){
GridBagLayout layout = new GridBagLayout();
setLayout(layout);
ActionListener listener = event -> updateSample();
//construct components
JLabel faceLabel = new JLabel("Face: ");
face = new JComboBox<>(new String[]{"Serif","SansSerif","Monospaced","Dialog","DialogInput"});
face.addActionListener(listener);
JLabel sizeLabel = new JLabel("Size: ");
size = new JComboBox<>(new Integer[]{8,10,12,15,18,24,36,48});
size.addActionListener(listener);
bold = new JCheckBox("Bold");
bold.addActionListener(listener);
italic = new JCheckBox("Italic");
italic.addActionListener(listener);
sample = new JTextArea(TEXT_ROWS,TEXT_COLUMNS);
sample.setText("The quick brown fox jumps over the lazy dog");
sample.setEditable(false);
sample.setLineWrap(true);
sample.setBorder(BorderFactory.createEtchedBorder());
//add components to grid, using GBC convenience class
add(faceLabel, new GBC(0,0).setAnchor(GBC.EAST));
add(face, new GBC(1,0).setFill(GBC.HORIZONTAL).setWeight(100,0).setInsets(1));
add(sizeLabel,new GBC(0,1).setAnchor(GBC.EAST));
add(size, new GBC(1,1).setFill(GBC.HORIZONTAL).setWeight(100,0).setInsets(1));
add(bold, new GBC(0,2,2,1).setAnchor(GBC.CENTER).setWeight(100,100));
add(italic, new GBC(0,3,2,1).setAnchor(GBC.CENTER).setWeight(100,100));
add(sample, new GBC(2,0,1,4).setFill(GBC.BOTH).setWeight(100,100));
pack();
updateSample();
}
public void updateSample(){
String fontFace = (String) face.getSelectedItem();
int fontStyle = (bold.isSelected()? Font.BOLD:0)+(italic.isSelected()?Font.ITALIC:0);
int fontSize = size.getItemAt(size.getSelectedIndex());
Font font = new Font(fontFace, fontStyle, fontSize);
sample.setFont(font);
sample.repaint();
}
}
|
[
"[email protected]"
] | |
38ab234eaf8823ed2f40817d8a4bd7d1009b3d26
|
992bcba6b9df9d333cd9107c9c5780439e40ac24
|
/es/src/main/java/read/Es_Read_02.java
|
f099ebfdded602d0a4669cd5cd6b72bfd49c4130
|
[] |
no_license
|
xy-yee/gmall-0108
|
f172a34cc85f496a74abc5b8cbfe98199124be3b
|
5bf82a092f6d8eadcdf86b21216d26c2222e489d
|
refs/heads/master
| 2023-05-08T14:29:00.353343 | 2021-06-01T03:43:01 | 2021-06-01T03:43:01 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,617 |
java
|
package read;
import com.sun.xml.internal.bind.v2.TODO;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestClientFactory;
import io.searchbox.client.config.HttpClientConfig;
import io.searchbox.core.Search;
import io.searchbox.core.SearchResult;
import io.searchbox.core.search.aggregation.MaxAggregation;
import io.searchbox.core.search.aggregation.MetricAggregation;
import io.searchbox.core.search.aggregation.TermsAggregation;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.max.MaxAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class Es_Read_02 {
public static void main(String[] args) throws IOException {
//1.创建连接工厂
JestClientFactory jestClientFactory = new JestClientFactory();
//2.设置连接属性
HttpClientConfig httpClientConfig = new HttpClientConfig.Builder("http://hadoop102:9200").build();
jestClientFactory.setHttpClientConfig(httpClientConfig);
//3.获取连接
JestClient jestClient = jestClientFactory.getObject();
//4.读数据
//TODO 相当于查询语句最外成{}
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
//TODO bool
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
//TODO term
TermQueryBuilder termQueryBuilder = new TermQueryBuilder("sex", "女");
//TODO filter
boolQueryBuilder.filter(termQueryBuilder);
//TODO must
TermQueryBuilder termQueryBuilder1 = new TermQueryBuilder("favo", "球");
boolQueryBuilder.must(termQueryBuilder1);
//TODO query
sourceBuilder.query(boolQueryBuilder);
//TODO 聚合组 aggs
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("groupByClass").field("class_id");
MaxAggregationBuilder maxAggregationBuilder = AggregationBuilders.max("groupByAge").field("age");
sourceBuilder.aggregation(aggregationBuilder.subAggregation(maxAggregationBuilder));
//TODO from
sourceBuilder.from(0);
//TODO size
sourceBuilder.size(2);
Search search = new Search.Builder(sourceBuilder.toString())
.addIndex("student")
.addType("_doc")
.build();
//5.执行查询语句
SearchResult result = jestClient.execute(search);
//5.1获取命中数据条数
Long total = result.getTotal();
System.out.println("命中"+total+"条数据");
//5.2获取明细数据
List<SearchResult.Hit<Map, Void>> hits = result.getHits(Map.class);
//5.2.3遍历存放明细数据的list集合,获取每一条明细数据
for (SearchResult.Hit<Map, Void> hit : hits) {
//a.获取索引名
String index = hit.index;
System.out.println(index);
//b.获取类型名
String type = hit.type;
System.out.println(type);
//c.获取文档id
String id = hit.id;
System.out.println(id);
//d.从source获取具体数据
Map source = hit.source;
for (Object o : source.keySet()) {
System.out.println(o+":"+source.get(o));
}
}
//5.3获取聚合组数据
MetricAggregation aggregations = result.getAggregations();
//5.3.1获取按照班级分组的聚合组数据
TermsAggregation groupByClass = aggregations.getTermsAggregation("groupByClass");
List<TermsAggregation.Entry> buckets = groupByClass.getBuckets();
for (TermsAggregation.Entry bucket : buckets) {
//获取key
String key = bucket.getKey();
System.out.println("key:"+key);
//获取相同分组下数据个数
Long count = bucket.getCount();
System.out.println("doc_count:"+count);
//获取嵌套聚合组数据(同班级下年龄最大的)
MaxAggregation groupByAge = bucket.getMaxAggregation("groupByAge");
Double maxAge = groupByAge.getMax();
System.out.println("value:"+maxAge);
}
//关闭连接
jestClient.shutdownClient();
}
}
|
[
"[email protected]"
] | |
349b60cbed51d05308f3baa37624cc1923a22841
|
26fbaaf4414d9df7739f3c5e92cce4a2e90c6143
|
/src/fitnesse/responders/testHistory/TableListComparer.java
|
c8db4db7498bd3eeca0bff46e83a604beb4584b7
|
[] |
no_license
|
TotoroFitnesse/FitNesse-CloudTest
|
1da587e775ed13d11c097ae3131aa54a15a277ef
|
419df513eb1b860fbf918aee1ba3cde458e72143
|
refs/heads/master
| 2020-05-17T12:38:59.586765 | 2015-09-19T12:38:34 | 2015-09-19T12:38:34 | 42,380,286 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,029 |
java
|
package fitnesse.responders.testHistory;
import fitnesse.testsystems.slim.HtmlTableScanner;
import fitnesse.testsystems.slim.Table;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import static fitnesse.responders.testHistory.HistoryComparer.MatchedPair;
public class TableListComparer {
private HtmlTableScanner leftHandScanner;
private HtmlTableScanner rightHandScanner;
protected ArrayList<MatchedPair> tableMatches;
public TableListComparer(HtmlTableScanner leftHandScanner, HtmlTableScanner rightHandScanner) {
this.leftHandScanner = leftHandScanner;
this.rightHandScanner = rightHandScanner;
tableMatches = new ArrayList<MatchedPair>();
}
public void compareAllTables() {
for (int leftTableIndex = 0; leftTableIndex < leftHandScanner.getTableCount(); leftTableIndex++) {
for (int rightTableIndex = 0; rightTableIndex < rightHandScanner.getTableCount(); rightTableIndex++) {
double score = compareTables(leftTableIndex, rightTableIndex);
saveMatch(leftTableIndex, rightTableIndex, score);
}
}
sortMatchesByScore();
saveOnlyTheBestMatches();
sortMatchesByTableIndex();
}
private double compareTables(int leftTableIndex, int rightTableIndex) {
Table table1 = leftHandScanner.getTable(leftTableIndex);
Table table2 = rightHandScanner.getTable(rightTableIndex);
return compareTables(table1, table2);
}
double compareTables(Table table1, Table table2) {
return new TableComparer(table1, table2).compareRowsOfTables();
}
public boolean theTablesMatch(double score) {
return score >= HistoryComparer.MIN_MATCH_SCORE;
}
public void saveMatch(int leftTableIndex, int rightTableIndex, double score) {
if (!theTablesMatch(score))
return;
tableMatches.add(new MatchedPair(leftTableIndex, rightTableIndex, score));
}
public void saveOnlyTheBestMatches() {
for (int matchIndex = 0; matchIndex < tableMatches.size(); matchIndex++) {
for (int secondMatchIndex = matchIndex + 1; secondMatchIndex < tableMatches.size(); secondMatchIndex++) {
if (tableMatches.get(matchIndex).first == tableMatches.get(secondMatchIndex).first) {
tableMatches.remove(secondMatchIndex);
secondMatchIndex--;
} else if (tableMatches.get(matchIndex).second == tableMatches.get(secondMatchIndex).second) {
tableMatches.remove(secondMatchIndex);
secondMatchIndex--;
}
}
}
}
public void sortMatchesByScore() {
Collections.sort(tableMatches, new Comparator<MatchedPair>() {
public int compare(MatchedPair match1, MatchedPair match2) {
if (match1.matchScore > match2.matchScore)
return -1;
else if (match1.matchScore < match2.matchScore)
return 1;
else
return 0;
}
});
}
public void sortMatchesByTableIndex() {
Collections.sort(tableMatches, new Comparator<MatchedPair>() {
public int compare(MatchedPair match1, MatchedPair match2) {
if (match1.first > match2.first)
return 1;
else if (match1.first < match2.first)
return -1;
else
return 0;
}
});
}
static class TableComparer {
private Table table1;
private Table table2;
private int table1rows;
private int table2rows;
public TableComparer(Table table1, Table table2) {
this.table1 = table1;
this.table2 = table2;
table1rows = table1.getRowCount();
table2rows = table2.getRowCount();
}
public double compareRowsOfTables() {
if (table1rows != table2rows)
return 0;
return scoreRowContent() + scoreRowTopology() + scoreTableTopology();
}
private double scoreTableTopology() {
int cellCountForTable1 = 0;
int cellCountForTable2 = 0;
for (int row = 0; row < table1rows; row++) {
if (!isCalledScenario(table1, row)) {
cellCountForTable1 += table1.getColumnCountInRow(row);
}
if (!isCalledScenario(table2, row)) {
cellCountForTable2 += table2.getColumnCountInRow(row);
}
}
if (cellCountForTable1 == cellCountForTable2)
return .1;
else
return 0.0;
}
private double scoreRowContent() {
double colScore = 0.0;
int rowCount = 0;
for (int row = 0; row < table1rows; row++) {
if (!isCalledScenario(table1, row) || !isCalledScenario(table2, row)) {
colScore += compareCellsInRow(row);
rowCount++;
}
}
return (colScore) / rowCount;
}
private double scoreRowTopology() {
double score = 0.0;
for (int row = 0; row < table1rows; row++) {
int table1Cols = isCalledScenario(table1, row) ? 0 : table1.getColumnCountInRow(row);
int table2Cols = isCalledScenario(table2, row) ? 0 : table2.getColumnCountInRow(row);
if (table1Cols == table2Cols)
score += .1 * (2.0 / (table1rows + table2rows));
}
return score;
}
private double compareCellsInRow(int row) {
double score = 0;
int table1Cols = table1.getColumnCountInRow(row);
int table2Cols = table2.getColumnCountInRow(row);
int minNumberOfCols = Math.min(table1Cols, table2Cols);
for (int col = 0; col < minNumberOfCols; col++)
score += calculateScoreForCell(row, col);
score = score / (table1Cols + table2Cols);
return score;
}
private double calculateScoreForCell(int row, int col) {
return scoreCellPassFailResult(row, col) + scoreCellContent(row, col);
}
private double scoreCellContent(int row, int col) {
String content1 = table1.getCellContents(col, row);
String content2 = table2.getCellContents(col, row);
if (contentMatches(content1, content2))
return 1;
else
return 0;
}
private boolean contentMatches(String content1, String content2) {
return areEqualAndNotScenarioCalls(content1, content2) || bothAreScenarioCalls(content1, content2);
}
private boolean bothAreScenarioCalls(String content1, String content2) {
return isCalledScenario(content1) && isCalledScenario(content2);
}
private boolean areEqualAndNotScenarioCalls(String content1, String content2) {
return !isCalledScenario(content1) && !isCalledScenario(content2) && content1.equals(content2);
}
private double scoreCellPassFailResult(int row, int col) {
String content1 = table1.getCellContents(col, row);
String content2 = table2.getCellContents(col, row);
return content1.equals(content2) ? 1 : 0;
}
private boolean isCalledScenario(Table table, int row) {
if (table.getColumnCountInRow(row) == 1) {
String content = table.getCellContents(0, row);
return content.contains("<table>");
}
return false;
}
private boolean isCalledScenario(String content1) {
return content1.contains("<table>");
}
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.