blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a71da2cbaccfac28ed5ef8bc696c79e52e21f2f7 | 2,001,454,827,339 | 6ad0f67a8a3acc2b2245e434b5109062ff7fa512 | /comm.example.jdbc/src/comm/jdbc/CustomerJDBC.java | 226d1131509ddfee94e52953b77f601cc2e51441 | []
| no_license | Tanishka08/projects | https://github.com/Tanishka08/projects | 6a4498557f115e1fafc71dab50932aeb780694ac | cb4bc0d11d4ac620b64c14d16dfe9c322842d8c2 | refs/heads/master | 2023-01-11T20:47:30.764000 | 2020-02-29T11:12:17 | 2020-02-29T11:12:17 | 235,723,555 | 0 | 0 | null | false | 2023-01-07T21:10:32 | 2020-01-23T04:38:09 | 2020-02-29T11:12:28 | 2023-01-07T21:10:32 | 1,753 | 0 | 0 | 71 | Java | false | false | package comm.jdbc;
public class CustomerJDBC {
private int employee_id;
private String last_Name;
private String first_Name;
private String email;
public CustomerJDBC(String last_Name, String first_Name, String email) {
super();
this.last_Name = last_Name;
this.first_Name = first_Name;
this.email = email;
}
}
| UTF-8 | Java | 345 | java | CustomerJDBC.java | Java | []
| null | []
| package comm.jdbc;
public class CustomerJDBC {
private int employee_id;
private String last_Name;
private String first_Name;
private String email;
public CustomerJDBC(String last_Name, String first_Name, String email) {
super();
this.last_Name = last_Name;
this.first_Name = first_Name;
this.email = email;
}
}
| 345 | 0.689855 | 0.689855 | 16 | 19.5625 | 17.891928 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.625 | false | false | 8 |
23fdc541a9c7fd1589fbb709c8e6106e71896ddb | 15,195,594,337,576 | 423b7840ad5838bcbac10ed60229d8d303fd2d32 | /src/main/java/com/feit/feep/core/loader/IFeepConfigLoader.java | 26b830ffe5687d347e64642c483c4903229f8b6d | []
| no_license | FutureElement/FEEP | https://github.com/FutureElement/FEEP | a62985287c58cad9199b8b1f20485147001a4813 | 4ae3b87d41795572feefcdbdac51c235e5f31ce6 | refs/heads/master | 2020-05-16T20:30:36.574000 | 2015-12-23T08:18:56 | 2015-12-23T08:18:56 | 34,054,958 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.feit.feep.core.loader;
import com.feit.feep.nosql.entity.NoSqlDBConfig;
import com.feit.feep.dbms.entity.datasource.DBInfo;
import com.feit.feep.mvc.fileupload.UploadConfig;
public interface IFeepConfigLoader {
String getTitle();
DBInfo getDBInfo();
boolean isDevMode();
String getTempPath();
UploadConfig getUploadConfig();
String getContextPath();
int getDefaultPageSize();
boolean isAddUserToCache();
NoSqlDBConfig getNoSqlDBConfig();
}
| UTF-8 | Java | 499 | java | IFeepConfigLoader.java | Java | []
| null | []
| package com.feit.feep.core.loader;
import com.feit.feep.nosql.entity.NoSqlDBConfig;
import com.feit.feep.dbms.entity.datasource.DBInfo;
import com.feit.feep.mvc.fileupload.UploadConfig;
public interface IFeepConfigLoader {
String getTitle();
DBInfo getDBInfo();
boolean isDevMode();
String getTempPath();
UploadConfig getUploadConfig();
String getContextPath();
int getDefaultPageSize();
boolean isAddUserToCache();
NoSqlDBConfig getNoSqlDBConfig();
}
| 499 | 0.737475 | 0.737475 | 26 | 18.192308 | 18.132036 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 8 |
93c0790e132c0892ea4b0c9bcf48aec55b159021 | 33,947,421,543,568 | 6ca47ca8ac264d0c18b475e57fe2600ece024f1c | /app/src/main/java/com/csr/gaiacontrol/activities/TWSActivity.java | b5884e7573c693ce92ffd844f0c47ac60d01b920 | []
| no_license | almoliu/Gaia-demo | https://github.com/almoliu/Gaia-demo | de96be1c0645a6fb29b7f48426d16c1cbd456507 | c953209b71934a81e62d0f6acefcdb7bae3ba23e | refs/heads/master | 2021-01-22T07:57:28.788000 | 2017-05-31T01:17:39 | 2017-05-31T01:17:39 | 92,587,277 | 5 | 3 | null | false | 2017-05-31T01:17:40 | 2017-05-27T09:13:24 | 2017-05-31T01:14:28 | 2017-05-31T01:17:39 | 0 | 0 | 0 | 0 | Java | null | null | /**************************************************************************************************
* Copyright 2015 Qualcomm Technologies International, Ltd. *
**************************************************************************************************/
package com.csr.gaiacontrol.activities;
import java.lang.ref.WeakReference;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.Toast;
import com.csr.gaia.library.Gaia;
import com.csr.gaia.library.GaiaError;
import com.csr.gaia.library.GaiaLink;
import com.csr.gaia.library.GaiaPacket;
import com.csr.gaiacontrol.R;
import com.csr.gaiacontrol.fragments.SpeakerFragment;
import com.csr.gaiacontrol.utils.Utils;
public class TWSActivity extends ModelActivity implements SpeakerFragment.ISpeakerFragmentListener {
/**
* For the debug mode, the tag to display for logs.
*/
private static final String TAG = "TWSActivity";
/**
* The fragment to define the channel and the volume for the master speaker.
*/
private SpeakerFragment mMasterSpeakerFragment;
/**
* The fragment to define the channel and the volume for the slave speaker.
*/
private SpeakerFragment mSlaveSpeakerFragment;
/**
* The value to send to the speaker when a message concerns the master speaker.
*/
private static final int MASTER_SPEAKER = 0x00;
/**
* The value to send to the speaker when a message concerns the slave speaker.
*/
private static final int SLAVE_SPEAKER = 0x01;
/**
* The maximum volume value for a speaker.
*/
private static final int MAX_VOLUME = 127;
@Override
public void sendVolume(int speaker, int volume) {
sendGaiaPacket(Gaia.COMMAND_SET_TWS_VOLUME, speaker, volume * MAX_VOLUME / 100);
}
@Override
public void sendChannel(int speaker, int channel) {
sendGaiaPacket(Gaia.COMMAND_SET_TWS_AUDIO_ROUTING, speaker, channel);
switch (speaker) {
case MASTER_SPEAKER:
askForSlaveChannel();
break;
case SLAVE_SPEAKER:
askForMasterChannel();
}
}
@Override
protected Handler getGaiaHandler() {
return new GaiaHandler(this);
}
@Override
protected void onResume() {
super.onResume();
askForMasterVolume();
askForMasterChannel();
askForSlaveVolume();
askForSlaveChannel();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tws);
this.init();
}
/**
* To request the states for the master speaker about its volume.
*/
private void askForMasterVolume() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_VOLUME, MASTER_SPEAKER);
}
/**
* To request the states for the master speaker about its channel.
*/
private void askForMasterChannel() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_AUDIO_ROUTING, MASTER_SPEAKER);
}
/**
* To request the states for the slave speaker about its volume.
*/
private void askForSlaveVolume() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_VOLUME, SLAVE_SPEAKER);
}
/**
* To request the states for the slave speaker about its channel.
*/
private void askForSlaveChannel() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_AUDIO_ROUTING, SLAVE_SPEAKER);
}
/**
* To initialise objects used in this activity.
*/
private void init() {
// manage the action bar
this.setSupportActionBar((Toolbar) findViewById(R.id.tb_menu));
//noinspection ConstantConditions
this.getSupportActionBar().setLogo(R.drawable.ic_speaker_small);
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mMasterSpeakerFragment = (SpeakerFragment) getSupportFragmentManager().findFragmentById(R.id.f_master_speaker);
mMasterSpeakerFragment.setSpeakerValue(MASTER_SPEAKER);
mSlaveSpeakerFragment = (SpeakerFragment) getSupportFragmentManager().findFragmentById(R.id.f_slave_speaker);
mSlaveSpeakerFragment.setSpeakerValue(SLAVE_SPEAKER);
}
/**
* To manage packets from Gaia device which are "PACKET" directly by the library.
*
* @param packet
* The message coming from the handler which calls this method.
*/
private void handlePacket(GaiaPacket packet) {
boolean validate;
switch (packet.getCommand()) {
case Gaia.COMMAND_GET_TWS_AUDIO_ROUTING:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_GET_TWS_AUDIO_ROUTING\" packet with a " + validate + " status.");
if (validate)
receiveGetChannel(packet);
break;
case Gaia.COMMAND_GET_TWS_VOLUME:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_GET_TWS_AUDIO_ROUTING\" packet with a " + validate + " status.");
if (validate)
receiveGetVolume(packet);
break;
case Gaia.COMMAND_SET_TWS_AUDIO_ROUTING:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_SET_TWS_AUDIO_ROUTING\" packet with a " + validate + " status.");
break;
case Gaia.COMMAND_SET_TWS_VOLUME:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_SET_TWS_VOLUME\" packet with a " + validate + " status.");
break;
default:
if (DEBUG)
Log.d(TAG, "Received packet - command: " + Utils.getIntToHexadecimal(packet.getCommandId())
+ " - payload: " + Utils.getStringFromBytes(packet.getPayload()));
}
}
/**
* When we receive a successful packet for the GET AUDIO ROUTING command.
*/
private void receiveGetChannel(GaiaPacket packet) {
int speaker = packet.getByte(1);
int channel = packet.getByte(2);
switch (speaker) {
case MASTER_SPEAKER:
mMasterSpeakerFragment.setChannel(channel);
break;
case SLAVE_SPEAKER:
mSlaveSpeakerFragment.setChannel(channel);
break;
}
}
/**
* When we receive a successful packet for the GET VOLUME command.
*/
private void receiveGetVolume(GaiaPacket packet) {
int speaker = packet.getByte(1);
int volume = packet.getByte(2);
switch (speaker) {
case MASTER_SPEAKER:
mMasterSpeakerFragment.setVolume(volume);
break;
case SLAVE_SPEAKER:
mSlaveSpeakerFragment.setVolume(volume);
break;
}
}
/**
* To manage errors information catching inside the handler and coming from the library.
*
* @param error
* The error coming from the library formatting as a <code>GaiaError<</code>.
*/
private void handleError(GaiaError error) {
switch (error.getType()) {
case SENDING_FAILED:
String message;
if (error.getCommand() > 0) {
message = "Send command " + error.getCommand() + " failed";
}
else {
message = "Send command failed";
}
if (DEBUG)
Log.w(TAG, message + ": " + error.getStringException());
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
break;
}
}
/**
* To check the status of an acknowledgement packet.
*
* @param packet
* the packet to check.
*
* @return true if the status is SUCCESS and the packet is an acknowledgment, false otherwise.
*/
private boolean checkStatus(GaiaPacket packet) {
if (!packet.isAcknowledgement()) {
return false;
}
switch (packet.getStatus()) {
case SUCCESS:
return true;
case NOT_SUPPORTED:
case INCORRECT_STATE:
case AUTHENTICATING:
case INSUFFICIENT_RESOURCES:
case INVALID_PARAMETER:
case NOT_AUTHENTICATED:
default:
if (DEBUG)
Log.w(TAG, "Status " + packet.getStatus().toString() + " with the command " + packet.getCommand());
}
return false;
}
/**
* The class which allows to manage messages from Gaia devices.
*/
private static class GaiaHandler extends Handler {
/**
* The reference to this activity.
*/
final WeakReference<TWSActivity> mActivity;
/**
* The constructor for this activity.
*
* @param activity
* this activity.
*/
public GaiaHandler(TWSActivity activity) {
super();
mActivity = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
TWSActivity parentActivity = mActivity.get();
String handleMessage = "Handle a message from Gaia: ";
GaiaLink.Message message = GaiaLink.Message.valueOf(msg.what);
if (message == null) {
if (DEBUG)
Log.d(TAG, handleMessage + "NULL");
return;
}
switch (message) {
case PACKET:
GaiaPacket packet = (GaiaPacket) msg.obj;
parentActivity.handlePacket(packet);
break;
case DISCONNECTED:
if (DEBUG)
Log.d(TAG, handleMessage + "DISCONNECTED");
Toast.makeText(parentActivity, R.string.toast_disconnected, Toast.LENGTH_SHORT).show();
parentActivity.finish();
break;
case ERROR:
if (DEBUG)
Log.d(TAG, handleMessage + "ERROR");
GaiaError error = (GaiaError) msg.obj;
parentActivity.handleError(error);
break;
case STREAM:
if (DEBUG)
Log.d(TAG, handleMessage + "STREAM");
break;
default:
if (DEBUG)
Log.d(TAG, handleMessage + "UNKNOWN MESSAGE: " + msg);
break;
}
}
}
}
| UTF-8 | Java | 10,712 | java | TWSActivity.java | Java | []
| null | []
| /**************************************************************************************************
* Copyright 2015 Qualcomm Technologies International, Ltd. *
**************************************************************************************************/
package com.csr.gaiacontrol.activities;
import java.lang.ref.WeakReference;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.Toast;
import com.csr.gaia.library.Gaia;
import com.csr.gaia.library.GaiaError;
import com.csr.gaia.library.GaiaLink;
import com.csr.gaia.library.GaiaPacket;
import com.csr.gaiacontrol.R;
import com.csr.gaiacontrol.fragments.SpeakerFragment;
import com.csr.gaiacontrol.utils.Utils;
public class TWSActivity extends ModelActivity implements SpeakerFragment.ISpeakerFragmentListener {
/**
* For the debug mode, the tag to display for logs.
*/
private static final String TAG = "TWSActivity";
/**
* The fragment to define the channel and the volume for the master speaker.
*/
private SpeakerFragment mMasterSpeakerFragment;
/**
* The fragment to define the channel and the volume for the slave speaker.
*/
private SpeakerFragment mSlaveSpeakerFragment;
/**
* The value to send to the speaker when a message concerns the master speaker.
*/
private static final int MASTER_SPEAKER = 0x00;
/**
* The value to send to the speaker when a message concerns the slave speaker.
*/
private static final int SLAVE_SPEAKER = 0x01;
/**
* The maximum volume value for a speaker.
*/
private static final int MAX_VOLUME = 127;
@Override
public void sendVolume(int speaker, int volume) {
sendGaiaPacket(Gaia.COMMAND_SET_TWS_VOLUME, speaker, volume * MAX_VOLUME / 100);
}
@Override
public void sendChannel(int speaker, int channel) {
sendGaiaPacket(Gaia.COMMAND_SET_TWS_AUDIO_ROUTING, speaker, channel);
switch (speaker) {
case MASTER_SPEAKER:
askForSlaveChannel();
break;
case SLAVE_SPEAKER:
askForMasterChannel();
}
}
@Override
protected Handler getGaiaHandler() {
return new GaiaHandler(this);
}
@Override
protected void onResume() {
super.onResume();
askForMasterVolume();
askForMasterChannel();
askForSlaveVolume();
askForSlaveChannel();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tws);
this.init();
}
/**
* To request the states for the master speaker about its volume.
*/
private void askForMasterVolume() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_VOLUME, MASTER_SPEAKER);
}
/**
* To request the states for the master speaker about its channel.
*/
private void askForMasterChannel() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_AUDIO_ROUTING, MASTER_SPEAKER);
}
/**
* To request the states for the slave speaker about its volume.
*/
private void askForSlaveVolume() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_VOLUME, SLAVE_SPEAKER);
}
/**
* To request the states for the slave speaker about its channel.
*/
private void askForSlaveChannel() {
sendGaiaPacket(Gaia.COMMAND_GET_TWS_AUDIO_ROUTING, SLAVE_SPEAKER);
}
/**
* To initialise objects used in this activity.
*/
private void init() {
// manage the action bar
this.setSupportActionBar((Toolbar) findViewById(R.id.tb_menu));
//noinspection ConstantConditions
this.getSupportActionBar().setLogo(R.drawable.ic_speaker_small);
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mMasterSpeakerFragment = (SpeakerFragment) getSupportFragmentManager().findFragmentById(R.id.f_master_speaker);
mMasterSpeakerFragment.setSpeakerValue(MASTER_SPEAKER);
mSlaveSpeakerFragment = (SpeakerFragment) getSupportFragmentManager().findFragmentById(R.id.f_slave_speaker);
mSlaveSpeakerFragment.setSpeakerValue(SLAVE_SPEAKER);
}
/**
* To manage packets from Gaia device which are "PACKET" directly by the library.
*
* @param packet
* The message coming from the handler which calls this method.
*/
private void handlePacket(GaiaPacket packet) {
boolean validate;
switch (packet.getCommand()) {
case Gaia.COMMAND_GET_TWS_AUDIO_ROUTING:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_GET_TWS_AUDIO_ROUTING\" packet with a " + validate + " status.");
if (validate)
receiveGetChannel(packet);
break;
case Gaia.COMMAND_GET_TWS_VOLUME:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_GET_TWS_AUDIO_ROUTING\" packet with a " + validate + " status.");
if (validate)
receiveGetVolume(packet);
break;
case Gaia.COMMAND_SET_TWS_AUDIO_ROUTING:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_SET_TWS_AUDIO_ROUTING\" packet with a " + validate + " status.");
break;
case Gaia.COMMAND_SET_TWS_VOLUME:
validate = checkStatus(packet);
if (DEBUG)
Log.i(TAG, "Received \"COMMAND_SET_TWS_VOLUME\" packet with a " + validate + " status.");
break;
default:
if (DEBUG)
Log.d(TAG, "Received packet - command: " + Utils.getIntToHexadecimal(packet.getCommandId())
+ " - payload: " + Utils.getStringFromBytes(packet.getPayload()));
}
}
/**
* When we receive a successful packet for the GET AUDIO ROUTING command.
*/
private void receiveGetChannel(GaiaPacket packet) {
int speaker = packet.getByte(1);
int channel = packet.getByte(2);
switch (speaker) {
case MASTER_SPEAKER:
mMasterSpeakerFragment.setChannel(channel);
break;
case SLAVE_SPEAKER:
mSlaveSpeakerFragment.setChannel(channel);
break;
}
}
/**
* When we receive a successful packet for the GET VOLUME command.
*/
private void receiveGetVolume(GaiaPacket packet) {
int speaker = packet.getByte(1);
int volume = packet.getByte(2);
switch (speaker) {
case MASTER_SPEAKER:
mMasterSpeakerFragment.setVolume(volume);
break;
case SLAVE_SPEAKER:
mSlaveSpeakerFragment.setVolume(volume);
break;
}
}
/**
* To manage errors information catching inside the handler and coming from the library.
*
* @param error
* The error coming from the library formatting as a <code>GaiaError<</code>.
*/
private void handleError(GaiaError error) {
switch (error.getType()) {
case SENDING_FAILED:
String message;
if (error.getCommand() > 0) {
message = "Send command " + error.getCommand() + " failed";
}
else {
message = "Send command failed";
}
if (DEBUG)
Log.w(TAG, message + ": " + error.getStringException());
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
break;
}
}
/**
* To check the status of an acknowledgement packet.
*
* @param packet
* the packet to check.
*
* @return true if the status is SUCCESS and the packet is an acknowledgment, false otherwise.
*/
private boolean checkStatus(GaiaPacket packet) {
if (!packet.isAcknowledgement()) {
return false;
}
switch (packet.getStatus()) {
case SUCCESS:
return true;
case NOT_SUPPORTED:
case INCORRECT_STATE:
case AUTHENTICATING:
case INSUFFICIENT_RESOURCES:
case INVALID_PARAMETER:
case NOT_AUTHENTICATED:
default:
if (DEBUG)
Log.w(TAG, "Status " + packet.getStatus().toString() + " with the command " + packet.getCommand());
}
return false;
}
/**
* The class which allows to manage messages from Gaia devices.
*/
private static class GaiaHandler extends Handler {
/**
* The reference to this activity.
*/
final WeakReference<TWSActivity> mActivity;
/**
* The constructor for this activity.
*
* @param activity
* this activity.
*/
public GaiaHandler(TWSActivity activity) {
super();
mActivity = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
TWSActivity parentActivity = mActivity.get();
String handleMessage = "Handle a message from Gaia: ";
GaiaLink.Message message = GaiaLink.Message.valueOf(msg.what);
if (message == null) {
if (DEBUG)
Log.d(TAG, handleMessage + "NULL");
return;
}
switch (message) {
case PACKET:
GaiaPacket packet = (GaiaPacket) msg.obj;
parentActivity.handlePacket(packet);
break;
case DISCONNECTED:
if (DEBUG)
Log.d(TAG, handleMessage + "DISCONNECTED");
Toast.makeText(parentActivity, R.string.toast_disconnected, Toast.LENGTH_SHORT).show();
parentActivity.finish();
break;
case ERROR:
if (DEBUG)
Log.d(TAG, handleMessage + "ERROR");
GaiaError error = (GaiaError) msg.obj;
parentActivity.handleError(error);
break;
case STREAM:
if (DEBUG)
Log.d(TAG, handleMessage + "STREAM");
break;
default:
if (DEBUG)
Log.d(TAG, handleMessage + "UNKNOWN MESSAGE: " + msg);
break;
}
}
}
}
| 10,712 | 0.568801 | 0.566748 | 325 | 31.959999 | 27.940073 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.418462 | false | false | 8 |
56cc92177af7275b7109f36542ad4095f24f099f | 15,444,702,413,677 | 6ec5f0ce9269782b4f26a549f55be5a49f09074e | /MyApplication/app/src/main/java/com/example/licencep/myapplication/paris_places.java | c32443d4153e766d9a42a3b84cf10b7b498d3de1 | []
| no_license | tdunglas/Android | https://github.com/tdunglas/Android | ecd0bb4bc7f91626ee21b82930a7f7a015cd62b1 | 35e0467b1f2e4f6d2982a540c829b58c7cdd7f94 | refs/heads/master | 2020-03-07T10:41:50.861000 | 2018-03-30T14:35:57 | 2018-03-30T14:35:57 | 127,437,707 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.licencep.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
public class paris_places extends AppCompatActivity implements TextWatcher{
ArrayAdapter<String> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_paris_places);
setTitle("PARIS SPECIAL PLACES");
ArrayList<String> items = new ArrayList<String>();
ListView listView = (ListView)findViewById(R.id.paris_list_zone);
EditText search = (EditText)findViewById(R.id.paris_research);
items.add("Arc de Triomphe");
items.add("Tour Eiffel");
items.add("Notre Dame de Paris");
items.add("Musee du Louvre");
items.add("Jardin des tuileries");
items.add("Butte Monmartre");
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
listView.setAdapter(adapter);
search.addTextChangedListener(this);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
adapter.getFilter().filter(s);
}
@Override
public void afterTextChanged(Editable s) {
}
}
| UTF-8 | Java | 1,584 | java | paris_places.java | Java | [
{
"context": "iewById(R.id.paris_research);\n\n items.add(\"Arc de Triomphe\");\n items.add(\"Tour Eiffel\");\n item",
"end": 880,
"score": 0.9997485876083374,
"start": 865,
"tag": "NAME",
"value": "Arc de Triomphe"
},
{
"context": " items.add(\"Arc de Triomphe\");\n items.add(\"Tour Eiffel\");\n items.add(\"Notre Dame de Paris\");\n ",
"end": 914,
"score": 0.956904947757721,
"start": 903,
"tag": "NAME",
"value": "Tour Eiffel"
},
{
"context": " items.add(\"Tour Eiffel\");\n items.add(\"Notre Dame de Paris\");\n items.add(\"Musee du Louvre\");\n ",
"end": 956,
"score": 0.9981507658958435,
"start": 937,
"tag": "NAME",
"value": "Notre Dame de Paris"
},
{
"context": "ms.add(\"Notre Dame de Paris\");\n items.add(\"Musee du Louvre\");\n items.add(\"Jardin des tuileries\");\n ",
"end": 994,
"score": 0.997089147567749,
"start": 979,
"tag": "NAME",
"value": "Musee du Louvre"
},
{
"context": " items.add(\"Musee du Louvre\");\n items.add(\"Jardin des tuileries\");\n items.add(\"Butte Monmartre\");\n\n ",
"end": 1037,
"score": 0.9988522529602051,
"start": 1017,
"tag": "NAME",
"value": "Jardin des tuileries"
},
{
"context": "s.add(\"Jardin des tuileries\");\n items.add(\"Butte Monmartre\");\n\n adapter = new ArrayAdapter<String>(th",
"end": 1075,
"score": 0.999397873878479,
"start": 1060,
"tag": "NAME",
"value": "Butte Monmartre"
}
]
| null | []
| package com.example.licencep.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
public class paris_places extends AppCompatActivity implements TextWatcher{
ArrayAdapter<String> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_paris_places);
setTitle("PARIS SPECIAL PLACES");
ArrayList<String> items = new ArrayList<String>();
ListView listView = (ListView)findViewById(R.id.paris_list_zone);
EditText search = (EditText)findViewById(R.id.paris_research);
items.add("<NAME>");
items.add("<NAME>");
items.add("<NAME>");
items.add("<NAME>");
items.add("<NAME>");
items.add("<NAME>");
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
listView.setAdapter(adapter);
search.addTextChangedListener(this);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
adapter.getFilter().filter(s);
}
@Override
public void afterTextChanged(Editable s) {
}
}
| 1,525 | 0.698232 | 0.69697 | 56 | 27.285715 | 25.83375 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607143 | false | false | 8 |
74f5b553f14cfbf36f6def58c79ace9c4cc40102 | 23,063,974,415,277 | 76e1dea018c6996db2afc54528fcc2a8abc56c80 | /mpdLibAsync/src/main/java/util/HttpRequest.java | 37ed1d27e17afdb476a1eb024af0e497c88c2ef6 | []
| no_license | isel-leic-mpd/MPD-1718v-LI41N | https://github.com/isel-leic-mpd/MPD-1718v-LI41N | 13b91855afd14804f6b521c6c92618cccaeee6be | 0ef394a3100fb4ec2840a11e612114ddc9a20754 | refs/heads/master | 2018-09-22T14:09:29.352000 | 2018-06-06T19:32:54 | 2018-06-06T19:32:54 | 123,345,251 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package util;
import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.BoundRequestBuilder;
import org.asynchttpclient.Dsl;
import org.asynchttpclient.Response;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import static util.Logging.log;
public class HttpRequest implements IRequest {
private static final AsyncHttpClient asyncHttpClient = Dsl.asyncHttpClient();
@Override
public CompletableFuture<String> getBody(String url, Map<String, String> headers) {
log("getBody for {0}", url);
final BoundRequestBuilder boundRequestBuilder = asyncHttpClient.prepareGet(url);
headers
.entrySet()
.stream()
.forEach(e -> boundRequestBuilder.addHeader(e.getKey(), e.getValue()));
return boundRequestBuilder
.execute().toCompletableFuture()
.thenApply(r -> {
log("responseBody for {0}", url);
return r;
})
.thenApply(Response::getResponseBody);
}
}
| UTF-8 | Java | 1,085 | java | HttpRequest.java | Java | []
| null | []
| package util;
import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.BoundRequestBuilder;
import org.asynchttpclient.Dsl;
import org.asynchttpclient.Response;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import static util.Logging.log;
public class HttpRequest implements IRequest {
private static final AsyncHttpClient asyncHttpClient = Dsl.asyncHttpClient();
@Override
public CompletableFuture<String> getBody(String url, Map<String, String> headers) {
log("getBody for {0}", url);
final BoundRequestBuilder boundRequestBuilder = asyncHttpClient.prepareGet(url);
headers
.entrySet()
.stream()
.forEach(e -> boundRequestBuilder.addHeader(e.getKey(), e.getValue()));
return boundRequestBuilder
.execute().toCompletableFuture()
.thenApply(r -> {
log("responseBody for {0}", url);
return r;
})
.thenApply(Response::getResponseBody);
}
}
| 1,085 | 0.645161 | 0.643318 | 37 | 28.324324 | 26.704645 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540541 | false | false | 8 |
9398370661dc5328ff87a7c64f0aa78d71f2815c | 25,933,012,596,879 | 3e7a21661e86c209e9397ab269bc21115d4a7c47 | /src/com/penoder/utils/FormatUtil.java | a46e8fd528771c45b0fbee98616c97814617d902 | []
| no_license | Penoder/Ridiculous | https://github.com/Penoder/Ridiculous | 4960a9b6775537a94a373c7b9ee0f8c9f68bf7c3 | 8279e267e49c78d509793d69abc3ba28aa39ced8 | refs/heads/master | 2021-07-07T19:31:04.989000 | 2017-09-18T15:54:31 | 2017-09-18T15:54:31 | 103,411,992 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.penoder.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
* 此类用来判断一些文件等是属于什么格式的,例如照片、音频、视频等
* 以及对中文文件名进行编码,解码操作
*
* @author Penoder
*
*/
public class FormatUtil {
/**
* 用于判断文件是不是图片类型
*
* @param fileName
* @return
*/
public static boolean isPicture(String fileName) {
return false;
}
/**
* 用于判断文件是不是音频类型
*
* @param fileName
* @return
*/
public static boolean isAudio(String fileName) {
fileName = fileName.toLowerCase(); // 转为小写字母
if (fileName.contains(".mp3") || fileName.contains(".wav") || fileName.contains(".ape")) {
return true;
}
return false;
}
/**
* 用于判断文件是不是视频类型
*
* @param fileName
* @return
*/
public static boolean isVideo(String fileName) {
fileName = fileName.toLowerCase(); // 转为小写字母
if (fileName.contains(".flv") || fileName.contains(".mp4") || fileName.contains(".avi")) {
return true;
}
return false;
}
/**
* 采用 URLEncoder 编码,将中文以 UTF-8 的形式编码
*
* @param decodeStr
* @return
*/
public static String encodeUTF8(String decodeStr) {
if (decodeStr == null || "".equals(decodeStr)) {
return null;
}
String encodeStr = null;
try {
encodeStr = URLEncoder.encode(decodeStr, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodeStr;
}
/**
* 采用 URLEncoder 编码,将中文以 gb2312(GBK) 的形式编码
*
* @param decodeStr
* @return
*/
public static String encodeGBK(String decodeStr) {
if (decodeStr == null || "".equals(decodeStr)) {
return null;
}
String encodeStr = null;
try {
encodeStr = URLEncoder.encode(decodeStr, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodeStr;
}
/**
* 采用 URLDecoder 解码,将 UTF-8 的形式解码成中文
*
* @param encodeStr
* @return
*/
public static String decodeUTF8(String encodeStr) {
if (encodeStr == null || "".equals(encodeStr)) {
return null;
}
String decodeStr = null;
try {
decodeStr = URLDecoder.decode(encodeStr, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return decodeStr;
}
/**
* 采用 URLDecoder 编码,将 gb2312 的形式解码成中文
*
* @param encodeStr
* @return
*/
public static String decodeGBK(String encodeStr) {
if (encodeStr == null || "".equals(encodeStr)) {
return null;
}
String decodeStr = null;
try {
decodeStr = URLDecoder.decode(encodeStr, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return decodeStr;
}
/**
* 获取文件的时长信息
*
* @param fileName
* @return
*/
public static Integer getFileTime(String fileName) {
return null;
}
}
| UTF-8 | Java | 3,686 | java | FormatUtil.java | Java | [
{
"context": "例如照片、音频、视频等\r\n * 以及对中文文件名进行编码,解码操作\r\n * \r\n * @author Penoder\r\n * \r\n */\r\npublic class FormatUtil {\r\n\t/**\r\n\t * 用",
"end": 345,
"score": 0.99857097864151,
"start": 338,
"tag": "USERNAME",
"value": "Penoder"
}
]
| null | []
| package com.penoder.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
* 此类用来判断一些文件等是属于什么格式的,例如照片、音频、视频等
* 以及对中文文件名进行编码,解码操作
*
* @author Penoder
*
*/
public class FormatUtil {
/**
* 用于判断文件是不是图片类型
*
* @param fileName
* @return
*/
public static boolean isPicture(String fileName) {
return false;
}
/**
* 用于判断文件是不是音频类型
*
* @param fileName
* @return
*/
public static boolean isAudio(String fileName) {
fileName = fileName.toLowerCase(); // 转为小写字母
if (fileName.contains(".mp3") || fileName.contains(".wav") || fileName.contains(".ape")) {
return true;
}
return false;
}
/**
* 用于判断文件是不是视频类型
*
* @param fileName
* @return
*/
public static boolean isVideo(String fileName) {
fileName = fileName.toLowerCase(); // 转为小写字母
if (fileName.contains(".flv") || fileName.contains(".mp4") || fileName.contains(".avi")) {
return true;
}
return false;
}
/**
* 采用 URLEncoder 编码,将中文以 UTF-8 的形式编码
*
* @param decodeStr
* @return
*/
public static String encodeUTF8(String decodeStr) {
if (decodeStr == null || "".equals(decodeStr)) {
return null;
}
String encodeStr = null;
try {
encodeStr = URLEncoder.encode(decodeStr, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodeStr;
}
/**
* 采用 URLEncoder 编码,将中文以 gb2312(GBK) 的形式编码
*
* @param decodeStr
* @return
*/
public static String encodeGBK(String decodeStr) {
if (decodeStr == null || "".equals(decodeStr)) {
return null;
}
String encodeStr = null;
try {
encodeStr = URLEncoder.encode(decodeStr, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodeStr;
}
/**
* 采用 URLDecoder 解码,将 UTF-8 的形式解码成中文
*
* @param encodeStr
* @return
*/
public static String decodeUTF8(String encodeStr) {
if (encodeStr == null || "".equals(encodeStr)) {
return null;
}
String decodeStr = null;
try {
decodeStr = URLDecoder.decode(encodeStr, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return decodeStr;
}
/**
* 采用 URLDecoder 编码,将 gb2312 的形式解码成中文
*
* @param encodeStr
* @return
*/
public static String decodeGBK(String encodeStr) {
if (encodeStr == null || "".equals(encodeStr)) {
return null;
}
String decodeStr = null;
try {
decodeStr = URLDecoder.decode(encodeStr, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return decodeStr;
}
/**
* 获取文件的时长信息
*
* @param fileName
* @return
*/
public static Integer getFileTime(String fileName) {
return null;
}
}
| 3,686 | 0.549434 | 0.544669 | 143 | 21.482517 | 19.67173 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.748252 | false | false | 8 |
a879ab6654491fc6237925b733250aeb51b1a988 | 26,345,329,444,184 | cdbe1260e9f7b2d3de29b91afd830873c8d29085 | /src/main/java/com/xiaoban/service/Qz.java | ca88a69e8c002f64fc19bf101d8fedcb5fe1f3da | []
| no_license | xiaoban008/qz | https://github.com/xiaoban008/qz | f9cc427420380f9171f4b0d306a40c1ce0378cc6 | 6861685825a055fcbe6a6a5871c582b951f64279 | refs/heads/master | 2020-11-28T19:03:07.758000 | 2019-12-24T09:43:54 | 2019-12-24T09:43:54 | 229,898,231 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xiaoban.service;
import org.openqa.selenium.WebDriver;
/*小班抢座接口*/
public interface Qz {
void run() throws Exception;
void getJs_seat();
WebDriver getWebDriver();
boolean isStart(WebDriver w) throws Exception;
void start(WebDriver driver) throws Exception;
}
| UTF-8 | Java | 304 | java | Qz.java | Java | []
| null | []
| package com.xiaoban.service;
import org.openqa.selenium.WebDriver;
/*小班抢座接口*/
public interface Qz {
void run() throws Exception;
void getJs_seat();
WebDriver getWebDriver();
boolean isStart(WebDriver w) throws Exception;
void start(WebDriver driver) throws Exception;
}
| 304 | 0.729452 | 0.729452 | 11 | 25.454546 | 16.283644 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 8 |
83e9cff382b700220ecae73b30d6ab4558dc70e8 | 26,207,890,485,279 | 02c6f555b34fb43ea881296e6006398c394716df | /Spring_AOP_By_LOC/src/com/mir00r/spring/aop/IFan.java | 9d40a6b2d4e724b216a7863924df59b3d893cb8c | []
| no_license | Mir00r/Java-Coding-Arena- | https://github.com/Mir00r/Java-Coding-Arena- | e4109895e4dd9d6660665c46fbac6b8657ef82f6 | 8d313fcd462c6eae08ddcd7b7e510662acf68184 | refs/heads/master | 2020-05-29T18:08:34.273000 | 2017-05-19T06:37:28 | 2017-05-19T06:37:28 | 51,356,669 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mir00r.spring.aop;
public interface IFan {
public abstract void Active(int level);
} | UTF-8 | Java | 100 | java | IFan.java | Java | []
| null | []
| package com.mir00r.spring.aop;
public interface IFan {
public abstract void Active(int level);
} | 100 | 0.76 | 0.74 | 6 | 15.833333 | 15.952186 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 8 |
0c634e76d4717eb5bd025c886984185165f940b6 | 12,128,987,700,717 | 2335b83701693bca2597f4dabd4dbab16054af8d | /uniserver/src/main/java/com/nomad/communication/udp/server/WorkerPool.java | c3d7f82f9ef606af82cf3770d9c4e30da02294cb | []
| no_license | aleksgor/t1 | https://github.com/aleksgor/t1 | 0af01e873234c6f3e15859155999e74ea1253a9e | 071b98b4af24669f2addd1a192dd6e2bb2e1c138 | refs/heads/master | 2022-07-10T04:30:48.528000 | 2019-09-30T13:46:49 | 2019-09-30T13:46:49 | 211,332,633 | 0 | 0 | null | false | 2022-06-29T17:40:56 | 2019-09-27T14:04:05 | 2019-09-30T13:47:20 | 2022-06-29T17:40:56 | 4,489 | 0 | 0 | 4 | Java | false | false | package com.nomad.communication.udp.server;
import java.net.DatagramSocket;
import java.util.concurrent.atomic.AtomicInteger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.nomad.communication.MessageExecutor;
import com.nomad.communication.MessageExecutorFactory;
import com.nomad.communication.udp.AbstractUDPSenderReceiver;
import com.nomad.exception.SystemException;
import com.nomad.message.CommonAnswer;
import com.nomad.message.CommonMessage;
import com.nomad.server.ServerContext;
import com.nomad.utility.pool.ObjectPoolImpl;
public class WorkerPool<K extends CommonMessage, T extends CommonAnswer> extends ObjectPoolImpl<UdpWorker<K, T>> {
protected static Logger LOGGER = LoggerFactory.getLogger(WorkerPool.class);
private final ServerContext context;
private final MessageExecutor<K, T> executor;
protected AtomicInteger index = new AtomicInteger();
private DatagramSocket socket;
protected WorkerPool(final int poolSize, final long timeout, final int checkDelay, final ServerContext context, final boolean dynamic,
final MessageExecutorFactory<K, T> workerFactory, final UdpServer<K, T> server) throws SystemException {
super(poolSize, timeout, checkDelay, context, dynamic);
this.context = context;
executor = workerFactory.getMessageExecutor(context, 0, server);
}
public void setSocket(DatagramSocket socket) {
this.socket = socket;
}
@Override
public UdpWorker<K, T> getNewPooledObject() throws SystemException {
final AbstractUDPSenderReceiver senderReceiver = new AbstractUDPSenderReceiver(socket);
final UdpWorker<K, T> worker = new UdpWorker<>(context, senderReceiver, index.incrementAndGet(), executor);
return worker;
}
/*
* public UdpWorker<K, T> getNewPooledObject(final int index, final DatagramSocket socket, final UdpMessageImpl data) throws Exception { final
* AbstractUDPSenderReceiver senderReceiver= new AbstractUDPSenderReceiver(socket); final UdpWorker<K, T> worker = new UdpWorker<>(data, context,
* senderReceiver, index, executor); return worker; }
*/
@Override
public void close() {
super.close();
executor.stop();
}
@Override
public String getPoolId() {
return null;
}
}
| UTF-8 | Java | 2,331 | java | WorkerPool.java | Java | []
| null | []
| package com.nomad.communication.udp.server;
import java.net.DatagramSocket;
import java.util.concurrent.atomic.AtomicInteger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.nomad.communication.MessageExecutor;
import com.nomad.communication.MessageExecutorFactory;
import com.nomad.communication.udp.AbstractUDPSenderReceiver;
import com.nomad.exception.SystemException;
import com.nomad.message.CommonAnswer;
import com.nomad.message.CommonMessage;
import com.nomad.server.ServerContext;
import com.nomad.utility.pool.ObjectPoolImpl;
public class WorkerPool<K extends CommonMessage, T extends CommonAnswer> extends ObjectPoolImpl<UdpWorker<K, T>> {
protected static Logger LOGGER = LoggerFactory.getLogger(WorkerPool.class);
private final ServerContext context;
private final MessageExecutor<K, T> executor;
protected AtomicInteger index = new AtomicInteger();
private DatagramSocket socket;
protected WorkerPool(final int poolSize, final long timeout, final int checkDelay, final ServerContext context, final boolean dynamic,
final MessageExecutorFactory<K, T> workerFactory, final UdpServer<K, T> server) throws SystemException {
super(poolSize, timeout, checkDelay, context, dynamic);
this.context = context;
executor = workerFactory.getMessageExecutor(context, 0, server);
}
public void setSocket(DatagramSocket socket) {
this.socket = socket;
}
@Override
public UdpWorker<K, T> getNewPooledObject() throws SystemException {
final AbstractUDPSenderReceiver senderReceiver = new AbstractUDPSenderReceiver(socket);
final UdpWorker<K, T> worker = new UdpWorker<>(context, senderReceiver, index.incrementAndGet(), executor);
return worker;
}
/*
* public UdpWorker<K, T> getNewPooledObject(final int index, final DatagramSocket socket, final UdpMessageImpl data) throws Exception { final
* AbstractUDPSenderReceiver senderReceiver= new AbstractUDPSenderReceiver(socket); final UdpWorker<K, T> worker = new UdpWorker<>(data, context,
* senderReceiver, index, executor); return worker; }
*/
@Override
public void close() {
super.close();
executor.stop();
}
@Override
public String getPoolId() {
return null;
}
}
| 2,331 | 0.744745 | 0.743458 | 61 | 37.213116 | 38.695156 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 8 |
1e3092d21b57bcca393f983b51f3cb8fc2753eda | 27,427,661,204,720 | 83c83554f668642f9074d629bf0baae4e549cb21 | /datagraph-core/src/main/java/com/datagraph/core/engine/job/JobManager.java | f20d981bf6cd3491a2d66fcc6830f0c97d2c4512 | []
| no_license | k-denny/datagraph | https://github.com/k-denny/datagraph | 99291d3cdf76bbe92980c2d10a691338e68fa1c0 | 6bb89d2ed900f4e12ba87d286ba0d21a02997a0c | refs/heads/master | 2020-12-25T09:47:11.498000 | 2016-08-07T07:25:54 | 2016-08-07T07:25:54 | 60,496,361 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.datagraph.core.engine.job;
import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.time.ExecutionTime;
import com.cronutils.parser.CronParser;
import com.datagraph.common.api.Job;
import com.datagraph.common.api.Operator;
import com.datagraph.common.cons.TASKSTATE;
import com.datagraph.common.exception.JobException;
import com.datagraph.common.Context;
import com.datagraph.core.common.operator.BaseOperator;
import com.datagraph.core.db.DaoFactory;
import com.datagraph.core.db.model.JobDao;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import org.joda.time.DateTime;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by Denny Joseph on 6/13/16.
*/
public class JobManager extends DAG implements com.datagraph.common.api.Job {
private CronParser parser;
private ExecutorService taskExec;
private ListeningExecutorService pool;
private JobInstance jobInstance;
private DaoFactory factory;
public JobManager(Context context, String appName) {
factory = DaoFactory.getInstance(context);
this.jobInstance = factory.getJobDao().findLatestByName(appName);
if(this.jobInstance == null)
this.jobInstance = new JobInstance(appName);
System.out.println(this.jobInstance);
this.parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX));
this.pool = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10));
}
public JobInstance getJobInstance() {
return jobInstance;
}
public void build() throws JobException {
for(Operator operator : jobInstance.getOperators()) {
String finalName = jobInstance.getName() + "." + operator.getName();
operator.setName(finalName);
System.out.println(operator.getName());
buildDag(operator);
}
System.out.println(this.graph);
}
private void buildDag(Operator operator) throws JobException {
for(Operator dependency : operator.getDependencies()){
addEdge(dependency, operator);
}
}
public boolean canStart() {
if(jobInstance.getState() == Job.RUNNING)
return false;
//this.state = WAIT
DateTime now = DateTime.now();
ExecutionTime executionTime = ExecutionTime.forCron(parser.parse(jobInstance.getSchedule()));
//this jobInstance never ran before
if(jobInstance.getLastTimeStarted() == 0) {
jobInstance.setLastTimeStarted(executionTime.lastExecution(now).getMillis());
jobInstance.setLastTimeEnded(jobInstance.getLastTimeStarted());
}
//System.out.println("last: " + jobInstance.getLastTimeStarted() + ":" + new DateTime(jobInstance.getLastTimeStarted()));
//Get date for next execution
DateTime nextExecution = executionTime.nextExecution(new DateTime(jobInstance.getLastTimeStarted()));
if(nextExecution.getMillis() <= now.getMillis()) {
if(jobInstance.getBackfill() == 1)
jobInstance.setLastTimeStarted(nextExecution.getMillis());
else
jobInstance.setLastTimeStarted(System.currentTimeMillis());
System.out.println(new DateTime(jobInstance.getLastTimeStarted()));
return true;
}
return false;
}
public void start() throws JobException{
System.out.println("Starting JobInstance: " + jobInstance.getName());
jobInstance.setTimeStarted(System.currentTimeMillis());
jobInstance.setState(Job.RUNNING);
Set<Operator> operators = getTop(this.graph);
JobDao jobDao = factory.getJobDao();
long id = jobDao.insert(jobInstance);
jobDao.close();
jobInstance.setId(id);
System.out.println("Dag: " + this.graph);
submit(operators);
}
private void submit(Set<Operator> operators) {
for(final Operator operator : operators) {
((BaseOperator) operator).reset();
System.out.println("Starting Operator : " + operator);
final ListenableFuture<TASKSTATE> future = this.pool.submit(operator);
future.addListener(()->{
System.out.println("Completed Operator : " + operator);
stateChange(operator);
}, MoreExecutors.directExecutor());
}
}
private void stateChange(Operator operator) {
if(operator.getState() == TASKSTATE.SUCCEEDED) {
Set<Operator> operators = getEdges(operator);
if(operators.size() > 0) {
Set<Operator> nextRun = new HashSet<>();
for (Operator eachEdge : operators) {
if (isTaskReadyToRun(eachEdge)) {
nextRun.add(eachEdge);
}
}
submit(nextRun);
} else {
jobInstance.setState(Job.SUCCEEDED);
jobInstance.setLastTimeEnded(System.currentTimeMillis());
JobDao jobDao = factory.getJobDao();
jobDao.update(jobInstance);
jobDao.close();
}
}
}
private boolean isTaskReadyToRun(Operator edge) {
boolean canRun = true;
Set<Operator> srcNodes = getDependencies(edge);
for(Operator operator : srcNodes) {
if(operator.getState() != TASKSTATE.SUCCEEDED)
return false;
}
return true;
}
@Override
public void addOperator(Operator operator) {
this.jobInstance.addOperator(operator);
}
@Override
public void setSchedule(String cronExpression) {
jobInstance.setSchedule(cronExpression);
}
}
| UTF-8 | Java | 6,014 | java | JobManager.java | Java | [
{
"context": "java.util.concurrent.Executors;\n\n/**\n * Created by Denny Joseph on 6/13/16.\n */\npublic class JobManager extends D",
"end": 954,
"score": 0.9998544454574585,
"start": 942,
"tag": "NAME",
"value": "Denny Joseph"
},
{
"context": " operator.getName();\n operator.setName(finalName);\n System.out.println(operator.get",
"end": 2049,
"score": 0.9887563586235046,
"start": 2044,
"tag": "NAME",
"value": "final"
},
{
"context": "ator.getName();\n operator.setName(finalName);\n System.out.println(operator.getName",
"end": 2053,
"score": 0.9126653075218201,
"start": 2049,
"tag": "NAME",
"value": "Name"
}
]
| null | []
| package com.datagraph.core.engine.job;
import com.cronutils.model.CronType;
import com.cronutils.model.definition.CronDefinitionBuilder;
import com.cronutils.model.time.ExecutionTime;
import com.cronutils.parser.CronParser;
import com.datagraph.common.api.Job;
import com.datagraph.common.api.Operator;
import com.datagraph.common.cons.TASKSTATE;
import com.datagraph.common.exception.JobException;
import com.datagraph.common.Context;
import com.datagraph.core.common.operator.BaseOperator;
import com.datagraph.core.db.DaoFactory;
import com.datagraph.core.db.model.JobDao;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import org.joda.time.DateTime;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by <NAME> on 6/13/16.
*/
public class JobManager extends DAG implements com.datagraph.common.api.Job {
private CronParser parser;
private ExecutorService taskExec;
private ListeningExecutorService pool;
private JobInstance jobInstance;
private DaoFactory factory;
public JobManager(Context context, String appName) {
factory = DaoFactory.getInstance(context);
this.jobInstance = factory.getJobDao().findLatestByName(appName);
if(this.jobInstance == null)
this.jobInstance = new JobInstance(appName);
System.out.println(this.jobInstance);
this.parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX));
this.pool = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10));
}
public JobInstance getJobInstance() {
return jobInstance;
}
public void build() throws JobException {
for(Operator operator : jobInstance.getOperators()) {
String finalName = jobInstance.getName() + "." + operator.getName();
operator.setName(finalName);
System.out.println(operator.getName());
buildDag(operator);
}
System.out.println(this.graph);
}
private void buildDag(Operator operator) throws JobException {
for(Operator dependency : operator.getDependencies()){
addEdge(dependency, operator);
}
}
public boolean canStart() {
if(jobInstance.getState() == Job.RUNNING)
return false;
//this.state = WAIT
DateTime now = DateTime.now();
ExecutionTime executionTime = ExecutionTime.forCron(parser.parse(jobInstance.getSchedule()));
//this jobInstance never ran before
if(jobInstance.getLastTimeStarted() == 0) {
jobInstance.setLastTimeStarted(executionTime.lastExecution(now).getMillis());
jobInstance.setLastTimeEnded(jobInstance.getLastTimeStarted());
}
//System.out.println("last: " + jobInstance.getLastTimeStarted() + ":" + new DateTime(jobInstance.getLastTimeStarted()));
//Get date for next execution
DateTime nextExecution = executionTime.nextExecution(new DateTime(jobInstance.getLastTimeStarted()));
if(nextExecution.getMillis() <= now.getMillis()) {
if(jobInstance.getBackfill() == 1)
jobInstance.setLastTimeStarted(nextExecution.getMillis());
else
jobInstance.setLastTimeStarted(System.currentTimeMillis());
System.out.println(new DateTime(jobInstance.getLastTimeStarted()));
return true;
}
return false;
}
public void start() throws JobException{
System.out.println("Starting JobInstance: " + jobInstance.getName());
jobInstance.setTimeStarted(System.currentTimeMillis());
jobInstance.setState(Job.RUNNING);
Set<Operator> operators = getTop(this.graph);
JobDao jobDao = factory.getJobDao();
long id = jobDao.insert(jobInstance);
jobDao.close();
jobInstance.setId(id);
System.out.println("Dag: " + this.graph);
submit(operators);
}
private void submit(Set<Operator> operators) {
for(final Operator operator : operators) {
((BaseOperator) operator).reset();
System.out.println("Starting Operator : " + operator);
final ListenableFuture<TASKSTATE> future = this.pool.submit(operator);
future.addListener(()->{
System.out.println("Completed Operator : " + operator);
stateChange(operator);
}, MoreExecutors.directExecutor());
}
}
private void stateChange(Operator operator) {
if(operator.getState() == TASKSTATE.SUCCEEDED) {
Set<Operator> operators = getEdges(operator);
if(operators.size() > 0) {
Set<Operator> nextRun = new HashSet<>();
for (Operator eachEdge : operators) {
if (isTaskReadyToRun(eachEdge)) {
nextRun.add(eachEdge);
}
}
submit(nextRun);
} else {
jobInstance.setState(Job.SUCCEEDED);
jobInstance.setLastTimeEnded(System.currentTimeMillis());
JobDao jobDao = factory.getJobDao();
jobDao.update(jobInstance);
jobDao.close();
}
}
}
private boolean isTaskReadyToRun(Operator edge) {
boolean canRun = true;
Set<Operator> srcNodes = getDependencies(edge);
for(Operator operator : srcNodes) {
if(operator.getState() != TASKSTATE.SUCCEEDED)
return false;
}
return true;
}
@Override
public void addOperator(Operator operator) {
this.jobInstance.addOperator(operator);
}
@Override
public void setSchedule(String cronExpression) {
jobInstance.setSchedule(cronExpression);
}
}
| 6,008 | 0.65281 | 0.651147 | 162 | 36.123455 | 26.235817 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.524691 | false | false | 8 |
5b89ffa2f34e4f97cc321e888754d65bedce9183 | 36,060,545,440,574 | 2f34b28160d861311c44494917d5e684b756a6d1 | /exercise_2019412/src/main/java/Main.java | cac8e4ce0b0d747647bac3c136102367c37cf66a | []
| no_license | liang0125/Java | https://github.com/liang0125/Java | f4cc8c053f4cd9a7f69b3b6d1e820c1927b54c55 | d4cdb7d6e62203152fd9596d84e6726cb0c7880b | refs/heads/master | 2020-04-29T05:57:45.091000 | 2019-06-24T05:51:21 | 2019-06-24T05:51:21 | 175,901,109 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Main {
/*
编译器版本: Java 1.8.0_66
请使用标准输入输出(System.in, System.out);已禁用图形、文件、网络、系统相关的操作,
如java.lang.Process , javax.swing.JFrame , Runtime.getRuntime;不要自定义包名称,
否则会报错,即不要添加package answer之类的语句;您可以写很多个类,但是必须有一个类名为Main,
并且为public属性,并且Main为唯一的public class,Main类的里面必须包含一个名字为'main'的静态方法(函数),这个方法是程序的入口
时间限制: 3S (C/C++以外的语言为: 5 S) 内存限制: 128M (C/C++以外的语言为: 640 M)
输入:
第一行,整数N(城市数量,1<n<50)
第二行,整数K(小二数量,1<k<n)
第三行,int数组hotels(每个城市的酒店数量)
输出:
每个小二需要运营的城市数量,分号隔开
输入范例:
9
3
1, 2, 3, 1, 1, 3, 2, 3, 4
输出范例:
3;4;2;
*/
/** 请完成下面这个函数,实现题目要求的功能 **/
/** 当然,你也可以不按照这个模板来作答,完全按照自己的想法来 ^-^ **/
static String citys(int n, int k, int[] hotels) {
if (n<=0||k<=0||hotels==null){
return null;
}
int sum=0;
int avg=0;
int[] mg=new int[k];
for (int i=0;i<hotels.length;i++){
sum+=hotels[i];
}
avg=sum/k;
int f=0;
int index=0;
String rs="";
int psum=0;
while (f<hotels.length) {
int flag=0;
for (int j = f; j < hotels.length; j++) {
if ((psum - avg) >= -2 && (psum - avg) <= 2) {
flag = j -f+ 1;
break;
}
else {
psum += hotels[j];
}
}
rs=rs+String.valueOf(flag);
if (index<k-1) {
rs+=";";
index++;
}
f=f+flag;
}
return rs;
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String res;
int _n;
_n = Integer.parseInt(in.nextLine().trim());
int _k;
_k = Integer.parseInt(in.nextLine().trim());
String hotelsStr = in.nextLine().trim();
String[] hotelArray = hotelsStr.split(",");
int[] _hotels = new int[hotelArray.length];
for(int _hotels_i = 0; _hotels_i < hotelArray.length; _hotels_i++) {
_hotels[_hotels_i] = Integer.parseInt(hotelArray[_hotels_i]);
}
res = citys(_n, _k, _hotels);
System.out.println(res);
}
} | UTF-8 | Java | 2,798 | java | Main.java | Java | []
| null | []
| import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Main {
/*
编译器版本: Java 1.8.0_66
请使用标准输入输出(System.in, System.out);已禁用图形、文件、网络、系统相关的操作,
如java.lang.Process , javax.swing.JFrame , Runtime.getRuntime;不要自定义包名称,
否则会报错,即不要添加package answer之类的语句;您可以写很多个类,但是必须有一个类名为Main,
并且为public属性,并且Main为唯一的public class,Main类的里面必须包含一个名字为'main'的静态方法(函数),这个方法是程序的入口
时间限制: 3S (C/C++以外的语言为: 5 S) 内存限制: 128M (C/C++以外的语言为: 640 M)
输入:
第一行,整数N(城市数量,1<n<50)
第二行,整数K(小二数量,1<k<n)
第三行,int数组hotels(每个城市的酒店数量)
输出:
每个小二需要运营的城市数量,分号隔开
输入范例:
9
3
1, 2, 3, 1, 1, 3, 2, 3, 4
输出范例:
3;4;2;
*/
/** 请完成下面这个函数,实现题目要求的功能 **/
/** 当然,你也可以不按照这个模板来作答,完全按照自己的想法来 ^-^ **/
static String citys(int n, int k, int[] hotels) {
if (n<=0||k<=0||hotels==null){
return null;
}
int sum=0;
int avg=0;
int[] mg=new int[k];
for (int i=0;i<hotels.length;i++){
sum+=hotels[i];
}
avg=sum/k;
int f=0;
int index=0;
String rs="";
int psum=0;
while (f<hotels.length) {
int flag=0;
for (int j = f; j < hotels.length; j++) {
if ((psum - avg) >= -2 && (psum - avg) <= 2) {
flag = j -f+ 1;
break;
}
else {
psum += hotels[j];
}
}
rs=rs+String.valueOf(flag);
if (index<k-1) {
rs+=";";
index++;
}
f=f+flag;
}
return rs;
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String res;
int _n;
_n = Integer.parseInt(in.nextLine().trim());
int _k;
_k = Integer.parseInt(in.nextLine().trim());
String hotelsStr = in.nextLine().trim();
String[] hotelArray = hotelsStr.split(",");
int[] _hotels = new int[hotelArray.length];
for(int _hotels_i = 0; _hotels_i < hotelArray.length; _hotels_i++) {
_hotels[_hotels_i] = Integer.parseInt(hotelArray[_hotels_i]);
}
res = citys(_n, _k, _hotels);
System.out.println(res);
}
} | 2,798 | 0.501318 | 0.481547 | 89 | 24.58427 | 19.858379 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764045 | false | false | 8 |
dd1f51adee3ec0b49bba84065ce3728bf452de83 | 18,519,899,038,550 | a61726ba4fe61ae2a08878c3304d40024f3c5667 | /SmartCityManagementSystem/src/main/java/UI/SystemAdminWorkArea/HealthCareReport.java | 40d25c76204831e85a460cefa55dd040c6c82baf | []
| no_license | asfansd/ApplicationEngineeringDevelopment | https://github.com/asfansd/ApplicationEngineeringDevelopment | 16a9828c86ce0b88823193955f1398cc4851f397 | 4b42dee5c3cbcbcadb98d635e90426bc5063400e | refs/heads/master | 2023-08-17T16:12:00.748000 | 2021-09-17T18:28:25 | 2021-09-17T18:36:58 | 407,645,219 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 UI.SystemAdminWorkArea;
import Project.SmartCity.HealthcareSystem.Hospital;
import Project.SmartCity.SmartCity;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.swing.JFrame;
/**
*
* @author latis
*/
public class HealthCareReport extends javax.swing.JPanel {
public static SmartCity business;
public static int DoctorCount = 0, PatientCount = 0;
/**
* Creates new form HealthCareReport
*/
private Map<Color, Integer> bars = new LinkedHashMap<Color, Integer>();
/**
* Creates new form HeadCountByTransportReport
*/
public void addBar(Color color, int value)
{
bars.put(color, value);
repaint();
}
@Override
protected void paintComponent(Graphics g)
{
// determine longest bar
int max = Integer.MIN_VALUE;
for (Integer value : bars.values())
{
max = Math.max(max, value);
}
// paint bars
int width = (getWidth() / bars.size()) - 2;
int x = 1;
for (Color color : bars.keySet())
{
int value = bars.get(color);
int height = (int)
((getHeight()-5) * ((double)value / max));
g.setColor(color);
g.fillRect(x, getHeight() - height, width, height);
g.setColor(Color.black);
g.drawRect(x, getHeight() - height, width, height);
x += (width + 2);
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(bars.size() * 10 + 2, 50);
}
public static void main(String[] args)
{
JFrame frame = new JFrame("Bar Chart");
HealthCareReport chart = new HealthCareReport();
chart.addBar(Color.pink, DoctorCount);
chart.addBar(Color.CYAN, PatientCount);
frame.getContentPane().add(chart);
frame.pack();
frame.setVisible(true);
frame.setSize(2000/2, 800/2);
frame.setLocation(659, 338);
}
public HealthCareReport(SmartCity business) {
this.business = business;
for(Hospital h: business.getHospitalDirectory().hospitalList){
DoctorCount = DoctorCount + h.getDoctorDirectory().doctorList.size();
PatientCount = PatientCount + h.getPatientDirectory().patientList.size();
}
System.out.println("DoctorCount - "+DoctorCount);
System.out.println("PatientCount - "+PatientCount);
main(null);
}
public HealthCareReport(){
initComponents();
jLabel3.setText("Doctors");
jLabel4.setText("Patients");
jLabel1.setText("Ratio of Doctors/Patients is - "+DoctorCount+" : "+PatientCount);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 16)); // NOI18N
jLabel3.setText("jLabel3");
jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 16)); // NOI18N
jLabel4.setText("jLabel4");
jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
jLabel1.setText("jLabel1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(167, 167, 167)
.addComponent(jLabel3)
.addGap(450, 450, 450)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jLabel1)))
.addGap(126, 126, 126))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 218, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(30, 30, 30))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 5,416 | java | HealthCareReport.java | Java | [
{
"context": ".Map;\nimport javax.swing.JFrame;\n/**\n *\n * @author latis\n */\npublic class HealthCareReport extends javax.s",
"end": 486,
"score": 0.9994471073150635,
"start": 481,
"tag": "USERNAME",
"value": "latis"
}
]
| null | []
| /*
* 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 UI.SystemAdminWorkArea;
import Project.SmartCity.HealthcareSystem.Hospital;
import Project.SmartCity.SmartCity;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.swing.JFrame;
/**
*
* @author latis
*/
public class HealthCareReport extends javax.swing.JPanel {
public static SmartCity business;
public static int DoctorCount = 0, PatientCount = 0;
/**
* Creates new form HealthCareReport
*/
private Map<Color, Integer> bars = new LinkedHashMap<Color, Integer>();
/**
* Creates new form HeadCountByTransportReport
*/
public void addBar(Color color, int value)
{
bars.put(color, value);
repaint();
}
@Override
protected void paintComponent(Graphics g)
{
// determine longest bar
int max = Integer.MIN_VALUE;
for (Integer value : bars.values())
{
max = Math.max(max, value);
}
// paint bars
int width = (getWidth() / bars.size()) - 2;
int x = 1;
for (Color color : bars.keySet())
{
int value = bars.get(color);
int height = (int)
((getHeight()-5) * ((double)value / max));
g.setColor(color);
g.fillRect(x, getHeight() - height, width, height);
g.setColor(Color.black);
g.drawRect(x, getHeight() - height, width, height);
x += (width + 2);
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(bars.size() * 10 + 2, 50);
}
public static void main(String[] args)
{
JFrame frame = new JFrame("Bar Chart");
HealthCareReport chart = new HealthCareReport();
chart.addBar(Color.pink, DoctorCount);
chart.addBar(Color.CYAN, PatientCount);
frame.getContentPane().add(chart);
frame.pack();
frame.setVisible(true);
frame.setSize(2000/2, 800/2);
frame.setLocation(659, 338);
}
public HealthCareReport(SmartCity business) {
this.business = business;
for(Hospital h: business.getHospitalDirectory().hospitalList){
DoctorCount = DoctorCount + h.getDoctorDirectory().doctorList.size();
PatientCount = PatientCount + h.getPatientDirectory().patientList.size();
}
System.out.println("DoctorCount - "+DoctorCount);
System.out.println("PatientCount - "+PatientCount);
main(null);
}
public HealthCareReport(){
initComponents();
jLabel3.setText("Doctors");
jLabel4.setText("Patients");
jLabel1.setText("Ratio of Doctors/Patients is - "+DoctorCount+" : "+PatientCount);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 16)); // NOI18N
jLabel3.setText("jLabel3");
jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 16)); // NOI18N
jLabel4.setText("jLabel4");
jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
jLabel1.setText("jLabel1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(167, 167, 167)
.addComponent(jLabel3)
.addGap(450, 450, 450)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jLabel1)))
.addGap(126, 126, 126))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 218, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(30, 30, 30))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration//GEN-END:variables
}
| 5,416 | 0.627216 | 0.606352 | 162 | 32.432098 | 26.17672 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.148148 | false | false | 8 |
1def97dbbaee53a6074f0dc411625f50644ae21d | 35,038,343,232,041 | 7460d70ad87de83b186af0045b4f1fc2234f7e1a | /src/java_test/Java_test.java | d68215c0d6c90a549459e51f1fba44009af1ac24 | []
| no_license | kjzxzzh/java_test | https://github.com/kjzxzzh/java_test | ac00585253b58cc9a93d83eb1d680a9b84552bcd | aa93d1ac0188779a3dba67f0ccfe66e6317b3a0f | refs/heads/master | 2017-11-11T16:47:24.148000 | 2017-03-06T07:54:48 | 2017-03-06T07:54:48 | 84,044,508 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package java_test;
public class Java_test {
public static void main(String[] args) {
System.out.println("1213");
}
}
| UTF-8 | Java | 136 | java | Java_test.java | Java | []
| null | []
| package java_test;
public class Java_test {
public static void main(String[] args) {
System.out.println("1213");
}
}
| 136 | 0.617647 | 0.588235 | 10 | 11.6 | 14.630106 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 8 |
f349c4445f19357896f8062b72d483a3e89668b0 | 10,101,763,128,836 | b7e98041f4708abd504642fcd6ebd2757380d700 | /app/src/main/java/com/duckhawk/duckhawk_delivery/getDistance.java | 63990e18fd4d295fa179eea99e0a26fd7bb45c2b | []
| no_license | Rittik-Biswal2000/DuckHawk-Delivery | https://github.com/Rittik-Biswal2000/DuckHawk-Delivery | 58086e0b20c3b8a8c3fd88f34e6ebf5301e48747 | f99e4db19ec4c11bdc0cc3a9f68db0a6aba95d07 | refs/heads/master | 2022-04-17T18:52:33.371000 | 2020-04-18T10:22:39 | 2020-04-18T10:22:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.duckhawk.duckhawk_delivery;
interface getDistance {
void distance(String Distance);
}
| UTF-8 | Java | 103 | java | getDistance.java | Java | []
| null | []
| package com.duckhawk.duckhawk_delivery;
interface getDistance {
void distance(String Distance);
}
| 103 | 0.776699 | 0.776699 | 5 | 19.6 | 16.463293 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 8 |
d41f0127ec773634eb280f662fb0b8c28f7c7db4 | 38,070,590,115,207 | 45cc9e3a741a4e33ccdbb4b5483cfe08fa40b12e | /app/src/main/java/com/tt/czj/ui/adapter/MessageAdapter.java | 60f2de3b000f1cc87368099c4824ea5b44bb21d2 | []
| no_license | chizijian/MyApplication | https://github.com/chizijian/MyApplication | 6444cdd40ad79a57ccd1f65f3e4dce0bc2aee64b | 023564bd6d32fc3757ef3e2a4da570e3678250c4 | refs/heads/master | 2021-01-20T08:56:46.298000 | 2017-05-19T13:36:05 | 2017-05-19T13:36:05 | 90,204,792 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tt.czj.ui.adapter;
import android.content.Context;
import android.util.Log;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tt.czj.R;
import com.tt.czj.mvp.models.Message;
import com.tt.czj.mvp.models.User;
import com.tt.czj.utils.TakePhotoUtil;
import com.tt.czj.widget.CircleImageView;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
/**
* Created by Administrator on 2017/4/05/0005.
*/
public class MessageAdapter extends BaseQuickAdapter<Message,BaseViewHolder>{
/**
* Gets context.
*
* @return the context
*/
public Context getContext() {
return context;
}
/**
* Sets context.
*
* @param context the context
*/
public void setContext(Context context) {
this.context = context;
}
private Context context;
/**
* Instantiates a new Message adapter.
*
* @param layoutResId the layout res id
* @param messages the messages
* @param context the context
*/
public MessageAdapter(int layoutResId,List<Message> messages,Context context) {
super(layoutResId, messages);
this.context=context;
Log.e(TAG, "MessageAdapter: start "+messages.size() );
}
@Override
protected void convert(final BaseViewHolder helper, final Message item) {
Log.e(TAG, "convert: start" );
// helper.setText(R.id.Message_specified,m.getMessage());
Log.e(TAG, "convert"+ item.getMessage());
BmobQuery<User> userBmobQuery= new BmobQuery<>();
userBmobQuery.addWhereEqualTo("objectId",item.getSendMessage_id());
userBmobQuery.findObjects(context, new FindListener<User>() {
@Override
public void onSuccess(List<User> list) {
for (User user:list
) {
helper.setText(com.tt.czj.R.id.Message_user_name, user.getUsername());
helper.setText(com.tt.czj.R.id.Message_specified, item.getMessage());
if (user.getPhoto() != null) {
//ImageLoader.getInstance().displayImage(user.getPhoto().getFileUrl(context), (ImageView) helper.getView(R.id.person_photo));
CircleImageView circleImageView= helper.getView(R.id.person_photo);
circleImageView.setImageUrl(user.getPhoto()
.getUrl(), TakePhotoUtil.getmImageLoader(mContext));
circleImageView.setDefaultImageResId(R.mipmap.icon_photo);
}
}
}
@Override
public void onError(int i, String s) {
}
});
}
}
| UTF-8 | Java | 2,805 | java | MessageAdapter.java | Java | []
| null | []
| package com.tt.czj.ui.adapter;
import android.content.Context;
import android.util.Log;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tt.czj.R;
import com.tt.czj.mvp.models.Message;
import com.tt.czj.mvp.models.User;
import com.tt.czj.utils.TakePhotoUtil;
import com.tt.czj.widget.CircleImageView;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
/**
* Created by Administrator on 2017/4/05/0005.
*/
public class MessageAdapter extends BaseQuickAdapter<Message,BaseViewHolder>{
/**
* Gets context.
*
* @return the context
*/
public Context getContext() {
return context;
}
/**
* Sets context.
*
* @param context the context
*/
public void setContext(Context context) {
this.context = context;
}
private Context context;
/**
* Instantiates a new Message adapter.
*
* @param layoutResId the layout res id
* @param messages the messages
* @param context the context
*/
public MessageAdapter(int layoutResId,List<Message> messages,Context context) {
super(layoutResId, messages);
this.context=context;
Log.e(TAG, "MessageAdapter: start "+messages.size() );
}
@Override
protected void convert(final BaseViewHolder helper, final Message item) {
Log.e(TAG, "convert: start" );
// helper.setText(R.id.Message_specified,m.getMessage());
Log.e(TAG, "convert"+ item.getMessage());
BmobQuery<User> userBmobQuery= new BmobQuery<>();
userBmobQuery.addWhereEqualTo("objectId",item.getSendMessage_id());
userBmobQuery.findObjects(context, new FindListener<User>() {
@Override
public void onSuccess(List<User> list) {
for (User user:list
) {
helper.setText(com.tt.czj.R.id.Message_user_name, user.getUsername());
helper.setText(com.tt.czj.R.id.Message_specified, item.getMessage());
if (user.getPhoto() != null) {
//ImageLoader.getInstance().displayImage(user.getPhoto().getFileUrl(context), (ImageView) helper.getView(R.id.person_photo));
CircleImageView circleImageView= helper.getView(R.id.person_photo);
circleImageView.setImageUrl(user.getPhoto()
.getUrl(), TakePhotoUtil.getmImageLoader(mContext));
circleImageView.setDefaultImageResId(R.mipmap.icon_photo);
}
}
}
@Override
public void onError(int i, String s) {
}
});
}
}
| 2,805 | 0.609269 | 0.604635 | 88 | 30.875 | 28.856153 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534091 | false | false | 8 |
051e6a80dd065bf828b171ce8aa819707ff16b21 | 9,002,251,452,509 | bae66546509681d04386218d621b1c1e2ae5783a | /src/main/java/cn/soft/zhaopin/base/pojo/po/MainGroup.java | 40e32797072b10df123a7a6ab146d8e15d08d731 | []
| no_license | weicong1/recruitment | https://github.com/weicong1/recruitment | d798a182bc30b25ec018fe5ca17d74780e02c15b | 10acbed31c7e478f7351474401d6f751a443634b | refs/heads/master | 2020-05-16T08:22:31.170000 | 2018-09-04T07:05:44 | 2018-09-04T07:05:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.soft.zhaopin.base.pojo.po;
public class MainGroup {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column main_group.main_group_id
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
private Integer mainGroupId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column main_group.main_group_name
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
private String mainGroupName;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column main_group.main_group_id
*
* @return the value of main_group.main_group_id
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public Integer getMainGroupId() {
return mainGroupId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column main_group.main_group_id
*
* @param mainGroupId the value for main_group.main_group_id
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public void setMainGroupId(Integer mainGroupId) {
this.mainGroupId = mainGroupId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column main_group.main_group_name
*
* @return the value of main_group.main_group_name
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public String getMainGroupName() {
return mainGroupName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column main_group.main_group_name
*
* @param mainGroupName the value for main_group.main_group_name
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public void setMainGroupName(String mainGroupName) {
this.mainGroupName = mainGroupName == null ? null : mainGroupName.trim();
}
} | UTF-8 | Java | 2,081 | java | MainGroup.java | Java | []
| null | []
| package cn.soft.zhaopin.base.pojo.po;
public class MainGroup {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column main_group.main_group_id
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
private Integer mainGroupId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column main_group.main_group_name
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
private String mainGroupName;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column main_group.main_group_id
*
* @return the value of main_group.main_group_id
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public Integer getMainGroupId() {
return mainGroupId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column main_group.main_group_id
*
* @param mainGroupId the value for main_group.main_group_id
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public void setMainGroupId(Integer mainGroupId) {
this.mainGroupId = mainGroupId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column main_group.main_group_name
*
* @return the value of main_group.main_group_name
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public String getMainGroupName() {
return mainGroupName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column main_group.main_group_name
*
* @param mainGroupName the value for main_group.main_group_name
*
* @mbg.generated Mon Sep 03 17:24:50 CST 2018
*/
public void setMainGroupName(String mainGroupName) {
this.mainGroupName = mainGroupName == null ? null : mainGroupName.trim();
}
} | 2,081 | 0.644882 | 0.610283 | 69 | 29.173914 | 27.334724 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.101449 | false | false | 8 |
b5ac3ac3ce0253b87ec2e6ff547662401245acd4 | 36,601,711,304,496 | 508c2c636b21a384b1eeedd23c6339816129eba1 | /app/src/main/java/com/colorful/constraintlayouttest/MainActivity.java | df9da212efa35d7d74f7a4358679be10e5de01fc | []
| no_license | 657571285/constraintLayoutTest | https://github.com/657571285/constraintLayoutTest | 2bce9f8286f725e39402823ee951e9c6e1bddb54 | 896752b67eb2c5be36a56f13df7fb9e0ea09266c | refs/heads/master | 2021-01-13T11:17:18.651000 | 2017-02-09T09:55:07 | 2017-02-09T09:55:07 | 81,396,078 | 0 | 1 | null | false | 2017-02-09T09:46:35 | 2017-02-09T01:45:52 | 2017-02-09T01:46:04 | 2017-02-09T09:46:34 | 88 | 0 | 1 | 0 | Java | null | null | package com.colorful.constraintlayouttest;
import android.app.Activity;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText et_zhanghao;
private EditText et_password;
private String a = "a";
private String b = "b";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button bt_login = (Button) findViewById(R.id.login);
Button bt_regist = (Button) findViewById(R.id.regist);
et_zhanghao = (EditText) findViewById(R.id.et_zhanghao);
et_password = (EditText) findViewById(R.id.et_password);
bt_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String zhanghao = et_zhanghao.getText().toString().trim();
String password = et_password.getText().toString().trim();
if(TextUtils.isEmpty(zhanghao)&&TextUtils.isEmpty(password)){
Toast.makeText(MainActivity.this,"账号密码不能为空",Toast.LENGTH_SHORT).show();
}
if(zhanghao.equals(a)&&password.equals(b)){
Toast.makeText(MainActivity.this,"登录成功",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(MainActivity.this,"登录失败",Toast.LENGTH_SHORT).show();
}
}
});
}
}
| UTF-8 | Java | 1,741 | java | MainActivity.java | Java | []
| null | []
| package com.colorful.constraintlayouttest;
import android.app.Activity;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText et_zhanghao;
private EditText et_password;
private String a = "a";
private String b = "b";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button bt_login = (Button) findViewById(R.id.login);
Button bt_regist = (Button) findViewById(R.id.regist);
et_zhanghao = (EditText) findViewById(R.id.et_zhanghao);
et_password = (EditText) findViewById(R.id.et_password);
bt_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String zhanghao = et_zhanghao.getText().toString().trim();
String password = et_password.getText().toString().trim();
if(TextUtils.isEmpty(zhanghao)&&TextUtils.isEmpty(password)){
Toast.makeText(MainActivity.this,"账号密码不能为空",Toast.LENGTH_SHORT).show();
}
if(zhanghao.equals(a)&&password.equals(b)){
Toast.makeText(MainActivity.this,"登录成功",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(MainActivity.this,"登录失败",Toast.LENGTH_SHORT).show();
}
}
});
}
}
| 1,741 | 0.641896 | 0.641311 | 44 | 37.840908 | 25.657661 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 8 |
3f5e2196a4ef234822c6fecebf0895564b1ac604 | 34,823,594,858,765 | 3b9e7f6917f4690cc1d74b10bf2608f4674ef70f | /cfx-api-shop/src/main/java/cn/cf/service/impl/B2bPriceHistoryServiceImpl.java | a8a531d679978642c9989ef5b7d8e3bab01b1d05 | []
| no_license | cckmit/cfx | https://github.com/cckmit/cfx | feb3af867ef6f8b81b4b172d9a8bfea089507e8a | c911d6f6a5f02119f28f3130f3d3d4c2cb34649d | refs/heads/main | 2023-03-18T08:23:15.618000 | 2020-12-18T06:43:14 | 2020-12-18T06:43:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.cf.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import cn.cf.entity.B2bPriceMovementEntity;
import cn.cf.service.B2bPriceHistoryService;
import cn.cf.util.DateUtil;
@Service
public class B2bPriceHistoryServiceImpl implements B2bPriceHistoryService {
@Autowired
private MongoTemplate mongoTemplate;
@Override
public List<B2bPriceMovementEntity> searchB2bPriceHistoryList(
String pk,Integer days) {
String date = DateUtil.getYearMonthDay(-days, 2);
Criteria c = new Criteria();
c.and("date").gte(date).and("movementPk").is(pk).and("isShow").is(1);
Query query = new Query(c);
query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "date")));
return mongoTemplate.find(query, B2bPriceMovementEntity.class);
}
}
| UTF-8 | Java | 1,086 | java | B2bPriceHistoryServiceImpl.java | Java | []
| null | []
| package cn.cf.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import cn.cf.entity.B2bPriceMovementEntity;
import cn.cf.service.B2bPriceHistoryService;
import cn.cf.util.DateUtil;
@Service
public class B2bPriceHistoryServiceImpl implements B2bPriceHistoryService {
@Autowired
private MongoTemplate mongoTemplate;
@Override
public List<B2bPriceMovementEntity> searchB2bPriceHistoryList(
String pk,Integer days) {
String date = DateUtil.getYearMonthDay(-days, 2);
Criteria c = new Criteria();
c.and("date").gte(date).and("movementPk").is(pk).and("isShow").is(1);
Query query = new Query(c);
query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "date")));
return mongoTemplate.find(query, B2bPriceMovementEntity.class);
}
}
| 1,086 | 0.78453 | 0.776243 | 34 | 30.941177 | 25.754431 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.323529 | false | false | 8 |
17fc32ed56eea9957484388c8b39ace736481a97 | 34,222,299,455,816 | 5813b9f6af269bbf229121b7fc338ae96094a36f | /main/Test.java | 2aa87c3e20dde2cf58b2702f15f9a9c3dfa59287 | []
| no_license | jonathanleemn/MUD | https://github.com/jonathanleemn/MUD | 16f489b43fb462efd9df3404ee7e3f40fd50c6a9 | b2fa6d5fa8bc68de611549be8f513cc80554f351 | refs/heads/master | 2020-07-12T17:25:51.388000 | 2016-11-30T22:46:58 | 2016-11-30T22:46:58 | 73,902,384 | 0 | 1 | null | false | 2020-07-07T15:48:08 | 2016-11-16T09:03:36 | 2016-11-16T09:10:09 | 2016-12-01T00:16:11 | 28 | 0 | 1 | 0 | Java | false | false | package main;
import java.util.Random;
import java.util.Scanner;
public class Test
{
public static void main(String[] args)
{
String in;
Scanner scan = new Scanner(System.in);
boolean run = false;
Random rand = new Random();
System.out.println((rand.nextInt(8) + 1) - (rand.nextInt(4) + 1));
/*
* do{ System.out.println(getRandomDescription()); in = scan.next();
* switch (in){ case "done": run = true; break; } }while (!run);
*/
}
public static int test()
{
Random rand = new Random();
int test = rand.nextInt(2) + 1;
return test;
}
public static String getRandomDescription()
{
Random rand = new Random();
String description = null;
switch (rand.nextInt(4) + 1)
{
case 1:
description = "A normal skeleton, nothing to worry about";
break;
case 2:
description = "A brittle looking skeleton";
break;
case 3:
description = "The skeleton is using his arm as a sword";
break;
case 4:
description = "A skeleton with dark bones. Better use caution";
break;
}
return description;
}
}
| UTF-8 | Java | 1,067 | java | Test.java | Java | []
| null | []
| package main;
import java.util.Random;
import java.util.Scanner;
public class Test
{
public static void main(String[] args)
{
String in;
Scanner scan = new Scanner(System.in);
boolean run = false;
Random rand = new Random();
System.out.println((rand.nextInt(8) + 1) - (rand.nextInt(4) + 1));
/*
* do{ System.out.println(getRandomDescription()); in = scan.next();
* switch (in){ case "done": run = true; break; } }while (!run);
*/
}
public static int test()
{
Random rand = new Random();
int test = rand.nextInt(2) + 1;
return test;
}
public static String getRandomDescription()
{
Random rand = new Random();
String description = null;
switch (rand.nextInt(4) + 1)
{
case 1:
description = "A normal skeleton, nothing to worry about";
break;
case 2:
description = "A brittle looking skeleton";
break;
case 3:
description = "The skeleton is using his arm as a sword";
break;
case 4:
description = "A skeleton with dark bones. Better use caution";
break;
}
return description;
}
}
| 1,067 | 0.643861 | 0.632615 | 55 | 18.4 | 20.752743 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.909091 | false | false | 8 |
d914d986eea3b561cf435cad56c5931cea345fc2 | 34,222,299,459,413 | 23a3cb87a639d39fa5181666468026a38f3cd230 | /TutoringTrainWebservice/src/main/java/edu/tutoringtrain/data/search/entry/EntrySearchCriteriaDeserializer.java | cef13dab9c4bad082ab49e5f868d7ddb685c71e5 | []
| no_license | Raphy998/tutoring-train | https://github.com/Raphy998/tutoring-train | a17594ce6a070cf84a6cb7d06c5501615b4e17c4 | 4024d02ea916fbace825cf8317b8cc9eabecfa21 | refs/heads/master | 2021-03-24T09:13:06.387000 | 2018-04-10T13:39:26 | 2018-04-10T13:39:26 | 104,450,101 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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.tutoringtrain.data.search.entry;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.fasterxml.jackson.databind.module.SimpleModule;
import edu.tutoringtrain.data.search.BooleanSearchCriteria;
import edu.tutoringtrain.data.search.DateSearchCriteria;
import edu.tutoringtrain.data.search.EntityProp;
import edu.tutoringtrain.data.search.NumberSearchCriteria;
import edu.tutoringtrain.data.search.SearchCriteria;
import edu.tutoringtrain.data.search.StringSearchCriteria;
import java.io.IOException;
/**
*
* @author Elias
*/
public class EntrySearchCriteriaDeserializer extends StdDeserializer<SearchCriteria> {
public EntrySearchCriteriaDeserializer() {
this(null);
}
public EntrySearchCriteriaDeserializer(final Class<?> vc) {
super(vc);
}
@Override
public SearchCriteria deserialize(final JsonParser parser, final DeserializationContext context)
throws IOException, JsonProcessingException {
final JsonNode node = parser.getCodec().readTree(parser);
final ObjectMapper mapper = (ObjectMapper)parser.getCodec();
//add a module to deserialize all EntityProps to UserProps since this Deserializer is only used for Users
final SimpleModule module = new SimpleModule();
module.addDeserializer(EntityProp.class, new EntryEntityPropDeserializer());
mapper.registerModule(module);
SearchCriteria sc = null;
JsonNode subNode = node.get("key");
if (subNode == null) {
throw new IOException("no key property given");
}
else {
EntryProp prop = null;
try {
prop = EntryProp.valueOf(subNode.textValue().toUpperCase());
if (null != prop.getDataType()) switch (prop.getDataType()) {
case STRING:
sc = mapper.treeToValue(node, StringSearchCriteria.class);
break;
case NUMBER:
sc = mapper.treeToValue(node, NumberSearchCriteria.class);
break;
case BOOLEAN:
sc = mapper.treeToValue(node, BooleanSearchCriteria.class);
break;
case DATE:
sc = mapper.treeToValue(node, DateSearchCriteria.class);
break;
default:
break;
}
}
catch (IllegalArgumentException ex) {
throw new IOException("invalid value '" + subNode.textValue() + "' for key");
}
catch (InvalidFormatException ex) {
ex.printStackTrace();
throw new IOException("operation '" + ex.getValue() + "' not possible on type " + prop.getDataType() + " of key " + prop);
}
}
return sc;
}
} | UTF-8 | Java | 3,561 | java | EntrySearchCriteriaDeserializer.java | Java | [
{
"context": "import java.io.IOException;\r\n\r\n/**\r\n *\r\n * @author Elias\r\n */\r\npublic class EntrySearchCriteriaDeserializer ",
"end": 1102,
"score": 0.9966943264007568,
"start": 1097,
"tag": "NAME",
"value": "Elias"
}
]
| null | []
| /*
* 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.tutoringtrain.data.search.entry;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.fasterxml.jackson.databind.module.SimpleModule;
import edu.tutoringtrain.data.search.BooleanSearchCriteria;
import edu.tutoringtrain.data.search.DateSearchCriteria;
import edu.tutoringtrain.data.search.EntityProp;
import edu.tutoringtrain.data.search.NumberSearchCriteria;
import edu.tutoringtrain.data.search.SearchCriteria;
import edu.tutoringtrain.data.search.StringSearchCriteria;
import java.io.IOException;
/**
*
* @author Elias
*/
public class EntrySearchCriteriaDeserializer extends StdDeserializer<SearchCriteria> {
public EntrySearchCriteriaDeserializer() {
this(null);
}
public EntrySearchCriteriaDeserializer(final Class<?> vc) {
super(vc);
}
@Override
public SearchCriteria deserialize(final JsonParser parser, final DeserializationContext context)
throws IOException, JsonProcessingException {
final JsonNode node = parser.getCodec().readTree(parser);
final ObjectMapper mapper = (ObjectMapper)parser.getCodec();
//add a module to deserialize all EntityProps to UserProps since this Deserializer is only used for Users
final SimpleModule module = new SimpleModule();
module.addDeserializer(EntityProp.class, new EntryEntityPropDeserializer());
mapper.registerModule(module);
SearchCriteria sc = null;
JsonNode subNode = node.get("key");
if (subNode == null) {
throw new IOException("no key property given");
}
else {
EntryProp prop = null;
try {
prop = EntryProp.valueOf(subNode.textValue().toUpperCase());
if (null != prop.getDataType()) switch (prop.getDataType()) {
case STRING:
sc = mapper.treeToValue(node, StringSearchCriteria.class);
break;
case NUMBER:
sc = mapper.treeToValue(node, NumberSearchCriteria.class);
break;
case BOOLEAN:
sc = mapper.treeToValue(node, BooleanSearchCriteria.class);
break;
case DATE:
sc = mapper.treeToValue(node, DateSearchCriteria.class);
break;
default:
break;
}
}
catch (IllegalArgumentException ex) {
throw new IOException("invalid value '" + subNode.textValue() + "' for key");
}
catch (InvalidFormatException ex) {
ex.printStackTrace();
throw new IOException("operation '" + ex.getValue() + "' not possible on type " + prop.getDataType() + " of key " + prop);
}
}
return sc;
}
} | 3,561 | 0.621174 | 0.621174 | 86 | 39.430233 | 29.747988 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.593023 | false | false | 8 |
69ec168d617e22d82e92297bb4f94a32152d6290 | 12,747,463,003,894 | 123c76574429272dd530c1f92ba6c97faba12812 | /materialscrollbar/src/main/java/com/diol/apps/materialscrollbar/MaterialScrollbar.java | f5c1983603b6884e57661cc8e4d391699676fe11 | []
| no_license | diolatzis/MaterialBus | https://github.com/diolatzis/MaterialBus | 068a2a1e136bea1a6f463af5987882ca1cc770bf | 471fdf04ce328f071c84c004ae9199ffbf6b7eaa | refs/heads/master | 2020-02-27T07:09:04.116000 | 2018-01-21T16:13:10 | 2018-01-21T16:13:10 | 83,466,650 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.diol.apps.materialscrollbar;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.GradientDrawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**
* Created by Stavros on 3/3/2017.
*/
public class MaterialScrollbar extends RelativeLayout implements View.OnTouchListener
{
//Component views
private View track;
private View handle;
private View touchHelper;
private TextView indicator;
//Characteristics
private int trackColor = R.color.divider;
private int trackWidth = 10;
private int handleColor = R.color.colorAccent;
private int handleHeight = 55;
private int indicatorColor = R.color.colorAccent;
private int indicatorSize = 80;
private int indicatorTextColor = R.color.white;
private int indicatorTextSize = 65;
private int roundedCornerRadius = 100;
private int touchHelperWidth = 40;
private TypedArray xmlAttrs;
private boolean hidden = true;
private boolean handleClicked = false;
private int scrollY = 0;
private int recyclerViewScrollHeight = -1;
private DisplayMetrics dm;
//Associated objects
private RecyclerView rv;
private int rvId;
//Programmatic constructor
public MaterialScrollbar(Context context, int rvId)
{
super(context);
this.rvId = rvId;
dm = context.getResources().getDisplayMetrics();
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,indicatorSize)+Utils.dpToPx(dm,15)+Utils.dpToPx(dm,trackWidth), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(ALIGN_PARENT_RIGHT);
setLayoutParams(params);
addView(createTrack(context));
addView(createHandle(context));
addView(createIndicator(context));
addView(createTouchHelper(context));
}
//XML constructor without style
public MaterialScrollbar(Context context, AttributeSet attributeSet)
{
this(context, attributeSet, 0);
}
//XML constructor with style;
public MaterialScrollbar(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
setUpProps(context,attrs);
addView(createTrack(context));
addView(createHandle(context));
addView(createIndicator(context));
addView(createTouchHelper(context));
}
//Get XML attributes and set them
private void setUpProps(Context context, AttributeSet attrs)
{
dm = context.getResources().getDisplayMetrics();
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,indicatorSize)+Utils.dpToPx(dm,15)+Utils.dpToPx(dm,trackWidth), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(ALIGN_PARENT_RIGHT);
setLayoutParams(params);
xmlAttrs = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.MaterialScrollbar,
0, 0);
if(!xmlAttrs.hasValue(R.styleable.MaterialScrollbar_recyclerView)){
throw new IllegalStateException("You are missing the following required attributes from a scroll bar in your XML: recyclerView");
}
rvId = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_recyclerView,0);
trackColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_trackColor,trackColor);
handleColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_handleColor,handleColor);
indicatorColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_indicatorColor,indicatorColor);
indicatorTextColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_indicatorTextColor,indicatorTextColor);
xmlAttrs.recycle();
}
private View createTrack(Context context)
{
track = new View(context);
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,trackWidth), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(ALIGN_PARENT_RIGHT);
track.setLayoutParams(params);
track.setBackgroundColor(ContextCompat.getColor(context,trackColor));
return track;
}
private View createHandle(Context context)
{
handle = new View(context);
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,trackWidth), Utils.dpToPx(dm,handleHeight));
params.addRule(ALIGN_PARENT_RIGHT);
handle.setLayoutParams(params);
handle.setBackgroundColor(ContextCompat.getColor(context, handleColor));
handle.setId(generateViewId());
handle.setFocusable(true);
handle.setOnTouchListener(this);
return handle;
}
private View createIndicator(Context context)
{
indicator = new TextView(context);
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(LEFT_OF,handle.getId());
params.setMargins(0,0,Utils.dpToPx(dm,15),0);
indicator.setLayoutParams(params);
indicator.setTextSize(TypedValue.COMPLEX_UNIT_SP,indicatorTextSize);
GradientDrawable shape = new GradientDrawable();
shape.setShape(GradientDrawable.RECTANGLE);
shape.setCornerRadii(new float[] { Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius), 0, 0, Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius) });
shape.setColor(getResources().getColor(indicatorColor));
indicator.setGravity(Gravity.CENTER);
indicator.setAlpha(0);
indicator.setPadding(Utils.dpToPx(dm,25),Utils.dpToPx(dm,0),Utils.dpToPx(dm,25),Utils.dpToPx(dm,0));
indicator.setTextColor(getResources().getColor(indicatorTextColor));
indicator.setBackground(shape);
return indicator;
}
private View createTouchHelper(Context context)
{
touchHelper = new View(context);
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,touchHelperWidth),Utils.dpToPx(dm,handleHeight));
params.addRule(LEFT_OF,handle.getId());
touchHelper.setLayoutParams(params);
touchHelper.setOnTouchListener(this);
return touchHelper;
}
@Override
protected void onAttachedToWindow()
{
super.onAttachedToWindow();
if(rvId != 0) rv = (RecyclerView) getRootView().findViewById(rvId);
setUpRecyclerView(rv);
Utils.doOnceOnGlobalLayoutOfView(this, new Runnable() {
@Override
public void run() {
hide();
}
});
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
super.onLayout(changed, l, t, r, b);
if(rv.getAdapter() == null)
{
Log.e("MaterialScrollBar","Recycler view has no adapter; skipping layout.");
return;
}
if(rv.getAdapter().getItemCount() == 0) return;
if(recyclerViewScrollHeight == -1)
{
recyclerViewScrollHeight = getRecyclerViewScrollHeight();
indicator.setText(String.valueOf(((ScrollIndicator) rv.getAdapter()).getIndication(0)));
}
if(recyclerViewScrollHeight > 0 && hidden) slideIn();
}
private void setUpRecyclerView(RecyclerView rv)
{
rv.setVerticalScrollBarEnabled(false);
rv.addOnScrollListener(new ScrollListener());
}
private void hide()
{
ObjectAnimator move = ObjectAnimator.ofFloat(this,"x",getX()+ Utils.dpToPx(dm,trackWidth));
move.setDuration(0);
move.start();
hidden = true;
}
private void slideIn()
{
ObjectAnimator move = ObjectAnimator.ofFloat(this,"x",getX()-Utils.dpToPx(dm,trackWidth));
move.setDuration(getResources().getInteger(R.integer.slide_duration));
move.setInterpolator(new DecelerateInterpolator(2));
move.start();
hidden = false;
}
private void setIndicatorY(float y)
{
if(y > 0) indicator.setY(y);
}
private int getTrackScrollHeight()
{
return track.getHeight()-handle.getHeight();
}
private int getRecyclerViewScrollHeight()
{
float avgChildHeight = 0;
for(int i = 0 ; i < rv.getChildCount() ; i++)
{
avgChildHeight += rv.getChildAt(i).getHeight();
}
avgChildHeight = avgChildHeight / (float)rv.getChildCount();
float totalHeight = avgChildHeight * rv.getAdapter().getItemCount();
return (int) (totalHeight - getHeight());
}
@Override
public boolean onTouch(View v, MotionEvent event) {
ObjectAnimator trackScaleX,handleScaleX,indicatorAlpha;
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
trackScaleX = ObjectAnimator.ofFloat(track,"scaleX",2);
trackScaleX.setInterpolator(new DecelerateInterpolator(2));
trackScaleX.setDuration(getResources().getInteger(R.integer.slide_duration));
trackScaleX.setAutoCancel(true);
trackScaleX.start();
handleScaleX = ObjectAnimator.ofFloat(handle,"scaleX",2);
handleScaleX.setInterpolator(new DecelerateInterpolator(2));
handleScaleX.setDuration(getResources().getInteger(R.integer.slide_duration));
handleScaleX.setAutoCancel(true);
handleScaleX.start();
indicator.setText(String.valueOf(((ScrollIndicator) rv.getAdapter()).getIndication(((LinearLayoutManager)rv.getLayoutManager()).findFirstVisibleItemPosition())));
indicatorAlpha = ObjectAnimator.ofFloat(indicator,"alpha",1);
indicatorAlpha.setDuration(getResources().getInteger(R.integer.fade_duration));
indicatorAlpha.start();
handleClicked = true;
rv.stopScroll();
break;
case MotionEvent.ACTION_UP:
trackScaleX = ObjectAnimator.ofFloat(track,"scaleX",1);
trackScaleX.setInterpolator(new DecelerateInterpolator(2));
trackScaleX.setDuration(getResources().getInteger(R.integer.fade_duration));
trackScaleX.setAutoCancel(true);
trackScaleX.start();
handleScaleX = ObjectAnimator.ofFloat(handle,"scaleX",1);
handleScaleX.setInterpolator(new DecelerateInterpolator(2));
handleScaleX.setDuration(getResources().getInteger(R.integer.fade_duration));
handleScaleX.setAutoCancel(true);
handleScaleX.start();
indicatorAlpha = ObjectAnimator.ofFloat(indicator,"alpha",0);
indicatorAlpha.setDuration(getResources().getInteger(R.integer.fade_duration));
indicatorAlpha.start();
handleClicked = false;
break;
case MotionEvent.ACTION_MOVE:
int[] localPoint = {0,0};
getLocationOnScreen(localPoint);
float localY = event.getRawY() - localPoint[1];
//don't allow to draw out of the relative layout
if(localY < handle.getHeight()/2f || localY > getHeight() - handle.getHeight()/2f) break;
//set the center of the handle to the click
handle.setY(localY - handle.getHeight()/2f);
touchHelper.setY(localY - handle.getHeight()/2f);
setIndicatorY(localY - indicator.getHeight());
float percentScroll = ((handle.getY())/ getTrackScrollHeight());
int childTo = (int)(percentScroll*rv.getAdapter().getItemCount());
if(childTo == rv.getAdapter().getItemCount()) childTo --;
rv.scrollToPosition(childTo);
indicator.setText(String.valueOf(((ScrollIndicator) rv.getAdapter()).getIndication(childTo)));
scrollY = ((LinearLayoutManager)rv.getLayoutManager()).findFirstVisibleItemPosition()*rv.getChildAt(0).getHeight();
break;
}
return true;
}
class ScrollListener extends RecyclerView.OnScrollListener
{
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
scrollY += dy;
if(handleClicked || recyclerViewScrollHeight == -1) return;
float times = (float)recyclerViewScrollHeight/(float)(getTrackScrollHeight());
handle.setY((float)scrollY/times);
touchHelper.setY((float)scrollY/times);
setIndicatorY((float)scrollY/times - handle.getHeight());
}
}
//Setters
public void setTrackColor(int trackColor){ this.trackColor = trackColor;}
public void setIndicatorColor(int indicatorColor){this.indicatorColor = indicatorColor;}
public void setHandleColor(int handleColor){this.handleColor = handleColor;}
public void setIndicatorTextColor(int indicatorTextColor){this.indicatorTextColor = indicatorTextColor;}
public interface ScrollIndicator
{
char getIndication(int position);
}
}
| UTF-8 | Java | 13,793 | java | MaterialScrollbar.java | Java | [
{
"context": "mport android.widget.TextView;\n\n\n/**\n * Created by Stavros on 3/3/2017.\n */\n\npublic class MaterialScrollbar ",
"end": 752,
"score": 0.9890021681785583,
"start": 745,
"tag": "NAME",
"value": "Stavros"
}
]
| null | []
| package com.diol.apps.materialscrollbar;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.GradientDrawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**
* Created by Stavros on 3/3/2017.
*/
public class MaterialScrollbar extends RelativeLayout implements View.OnTouchListener
{
//Component views
private View track;
private View handle;
private View touchHelper;
private TextView indicator;
//Characteristics
private int trackColor = R.color.divider;
private int trackWidth = 10;
private int handleColor = R.color.colorAccent;
private int handleHeight = 55;
private int indicatorColor = R.color.colorAccent;
private int indicatorSize = 80;
private int indicatorTextColor = R.color.white;
private int indicatorTextSize = 65;
private int roundedCornerRadius = 100;
private int touchHelperWidth = 40;
private TypedArray xmlAttrs;
private boolean hidden = true;
private boolean handleClicked = false;
private int scrollY = 0;
private int recyclerViewScrollHeight = -1;
private DisplayMetrics dm;
//Associated objects
private RecyclerView rv;
private int rvId;
//Programmatic constructor
public MaterialScrollbar(Context context, int rvId)
{
super(context);
this.rvId = rvId;
dm = context.getResources().getDisplayMetrics();
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,indicatorSize)+Utils.dpToPx(dm,15)+Utils.dpToPx(dm,trackWidth), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(ALIGN_PARENT_RIGHT);
setLayoutParams(params);
addView(createTrack(context));
addView(createHandle(context));
addView(createIndicator(context));
addView(createTouchHelper(context));
}
//XML constructor without style
public MaterialScrollbar(Context context, AttributeSet attributeSet)
{
this(context, attributeSet, 0);
}
//XML constructor with style;
public MaterialScrollbar(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
setUpProps(context,attrs);
addView(createTrack(context));
addView(createHandle(context));
addView(createIndicator(context));
addView(createTouchHelper(context));
}
//Get XML attributes and set them
private void setUpProps(Context context, AttributeSet attrs)
{
dm = context.getResources().getDisplayMetrics();
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,indicatorSize)+Utils.dpToPx(dm,15)+Utils.dpToPx(dm,trackWidth), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(ALIGN_PARENT_RIGHT);
setLayoutParams(params);
xmlAttrs = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.MaterialScrollbar,
0, 0);
if(!xmlAttrs.hasValue(R.styleable.MaterialScrollbar_recyclerView)){
throw new IllegalStateException("You are missing the following required attributes from a scroll bar in your XML: recyclerView");
}
rvId = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_recyclerView,0);
trackColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_trackColor,trackColor);
handleColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_handleColor,handleColor);
indicatorColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_indicatorColor,indicatorColor);
indicatorTextColor = xmlAttrs.getResourceId(R.styleable.MaterialScrollbar_indicatorTextColor,indicatorTextColor);
xmlAttrs.recycle();
}
private View createTrack(Context context)
{
track = new View(context);
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,trackWidth), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(ALIGN_PARENT_RIGHT);
track.setLayoutParams(params);
track.setBackgroundColor(ContextCompat.getColor(context,trackColor));
return track;
}
private View createHandle(Context context)
{
handle = new View(context);
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,trackWidth), Utils.dpToPx(dm,handleHeight));
params.addRule(ALIGN_PARENT_RIGHT);
handle.setLayoutParams(params);
handle.setBackgroundColor(ContextCompat.getColor(context, handleColor));
handle.setId(generateViewId());
handle.setFocusable(true);
handle.setOnTouchListener(this);
return handle;
}
private View createIndicator(Context context)
{
indicator = new TextView(context);
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(LEFT_OF,handle.getId());
params.setMargins(0,0,Utils.dpToPx(dm,15),0);
indicator.setLayoutParams(params);
indicator.setTextSize(TypedValue.COMPLEX_UNIT_SP,indicatorTextSize);
GradientDrawable shape = new GradientDrawable();
shape.setShape(GradientDrawable.RECTANGLE);
shape.setCornerRadii(new float[] { Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius), 0, 0, Utils.dpToPx(dm,roundedCornerRadius), Utils.dpToPx(dm,roundedCornerRadius) });
shape.setColor(getResources().getColor(indicatorColor));
indicator.setGravity(Gravity.CENTER);
indicator.setAlpha(0);
indicator.setPadding(Utils.dpToPx(dm,25),Utils.dpToPx(dm,0),Utils.dpToPx(dm,25),Utils.dpToPx(dm,0));
indicator.setTextColor(getResources().getColor(indicatorTextColor));
indicator.setBackground(shape);
return indicator;
}
private View createTouchHelper(Context context)
{
touchHelper = new View(context);
LayoutParams params = new LayoutParams(Utils.dpToPx(dm,touchHelperWidth),Utils.dpToPx(dm,handleHeight));
params.addRule(LEFT_OF,handle.getId());
touchHelper.setLayoutParams(params);
touchHelper.setOnTouchListener(this);
return touchHelper;
}
@Override
protected void onAttachedToWindow()
{
super.onAttachedToWindow();
if(rvId != 0) rv = (RecyclerView) getRootView().findViewById(rvId);
setUpRecyclerView(rv);
Utils.doOnceOnGlobalLayoutOfView(this, new Runnable() {
@Override
public void run() {
hide();
}
});
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
super.onLayout(changed, l, t, r, b);
if(rv.getAdapter() == null)
{
Log.e("MaterialScrollBar","Recycler view has no adapter; skipping layout.");
return;
}
if(rv.getAdapter().getItemCount() == 0) return;
if(recyclerViewScrollHeight == -1)
{
recyclerViewScrollHeight = getRecyclerViewScrollHeight();
indicator.setText(String.valueOf(((ScrollIndicator) rv.getAdapter()).getIndication(0)));
}
if(recyclerViewScrollHeight > 0 && hidden) slideIn();
}
private void setUpRecyclerView(RecyclerView rv)
{
rv.setVerticalScrollBarEnabled(false);
rv.addOnScrollListener(new ScrollListener());
}
private void hide()
{
ObjectAnimator move = ObjectAnimator.ofFloat(this,"x",getX()+ Utils.dpToPx(dm,trackWidth));
move.setDuration(0);
move.start();
hidden = true;
}
private void slideIn()
{
ObjectAnimator move = ObjectAnimator.ofFloat(this,"x",getX()-Utils.dpToPx(dm,trackWidth));
move.setDuration(getResources().getInteger(R.integer.slide_duration));
move.setInterpolator(new DecelerateInterpolator(2));
move.start();
hidden = false;
}
private void setIndicatorY(float y)
{
if(y > 0) indicator.setY(y);
}
private int getTrackScrollHeight()
{
return track.getHeight()-handle.getHeight();
}
private int getRecyclerViewScrollHeight()
{
float avgChildHeight = 0;
for(int i = 0 ; i < rv.getChildCount() ; i++)
{
avgChildHeight += rv.getChildAt(i).getHeight();
}
avgChildHeight = avgChildHeight / (float)rv.getChildCount();
float totalHeight = avgChildHeight * rv.getAdapter().getItemCount();
return (int) (totalHeight - getHeight());
}
@Override
public boolean onTouch(View v, MotionEvent event) {
ObjectAnimator trackScaleX,handleScaleX,indicatorAlpha;
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
trackScaleX = ObjectAnimator.ofFloat(track,"scaleX",2);
trackScaleX.setInterpolator(new DecelerateInterpolator(2));
trackScaleX.setDuration(getResources().getInteger(R.integer.slide_duration));
trackScaleX.setAutoCancel(true);
trackScaleX.start();
handleScaleX = ObjectAnimator.ofFloat(handle,"scaleX",2);
handleScaleX.setInterpolator(new DecelerateInterpolator(2));
handleScaleX.setDuration(getResources().getInteger(R.integer.slide_duration));
handleScaleX.setAutoCancel(true);
handleScaleX.start();
indicator.setText(String.valueOf(((ScrollIndicator) rv.getAdapter()).getIndication(((LinearLayoutManager)rv.getLayoutManager()).findFirstVisibleItemPosition())));
indicatorAlpha = ObjectAnimator.ofFloat(indicator,"alpha",1);
indicatorAlpha.setDuration(getResources().getInteger(R.integer.fade_duration));
indicatorAlpha.start();
handleClicked = true;
rv.stopScroll();
break;
case MotionEvent.ACTION_UP:
trackScaleX = ObjectAnimator.ofFloat(track,"scaleX",1);
trackScaleX.setInterpolator(new DecelerateInterpolator(2));
trackScaleX.setDuration(getResources().getInteger(R.integer.fade_duration));
trackScaleX.setAutoCancel(true);
trackScaleX.start();
handleScaleX = ObjectAnimator.ofFloat(handle,"scaleX",1);
handleScaleX.setInterpolator(new DecelerateInterpolator(2));
handleScaleX.setDuration(getResources().getInteger(R.integer.fade_duration));
handleScaleX.setAutoCancel(true);
handleScaleX.start();
indicatorAlpha = ObjectAnimator.ofFloat(indicator,"alpha",0);
indicatorAlpha.setDuration(getResources().getInteger(R.integer.fade_duration));
indicatorAlpha.start();
handleClicked = false;
break;
case MotionEvent.ACTION_MOVE:
int[] localPoint = {0,0};
getLocationOnScreen(localPoint);
float localY = event.getRawY() - localPoint[1];
//don't allow to draw out of the relative layout
if(localY < handle.getHeight()/2f || localY > getHeight() - handle.getHeight()/2f) break;
//set the center of the handle to the click
handle.setY(localY - handle.getHeight()/2f);
touchHelper.setY(localY - handle.getHeight()/2f);
setIndicatorY(localY - indicator.getHeight());
float percentScroll = ((handle.getY())/ getTrackScrollHeight());
int childTo = (int)(percentScroll*rv.getAdapter().getItemCount());
if(childTo == rv.getAdapter().getItemCount()) childTo --;
rv.scrollToPosition(childTo);
indicator.setText(String.valueOf(((ScrollIndicator) rv.getAdapter()).getIndication(childTo)));
scrollY = ((LinearLayoutManager)rv.getLayoutManager()).findFirstVisibleItemPosition()*rv.getChildAt(0).getHeight();
break;
}
return true;
}
class ScrollListener extends RecyclerView.OnScrollListener
{
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
scrollY += dy;
if(handleClicked || recyclerViewScrollHeight == -1) return;
float times = (float)recyclerViewScrollHeight/(float)(getTrackScrollHeight());
handle.setY((float)scrollY/times);
touchHelper.setY((float)scrollY/times);
setIndicatorY((float)scrollY/times - handle.getHeight());
}
}
//Setters
public void setTrackColor(int trackColor){ this.trackColor = trackColor;}
public void setIndicatorColor(int indicatorColor){this.indicatorColor = indicatorColor;}
public void setHandleColor(int handleColor){this.handleColor = handleColor;}
public void setIndicatorTextColor(int indicatorTextColor){this.indicatorTextColor = indicatorTextColor;}
public interface ScrollIndicator
{
char getIndication(int position);
}
}
| 13,793 | 0.662727 | 0.65729 | 387 | 34.640827 | 35.229668 | 280 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.788114 | false | false | 8 |
eb0c44693de33ec17fad158cca0fd61ec607dc28 | 34,857,954,617,041 | 80639cb11b293ac1bca5709d38b3db9cdee8117f | /src/main/java/web/CreditCardController.java | d5202da894d404f8b13b3efd781ceef59af27072 | []
| no_license | badr-ghazouan/E-commerce-Spring5MVC-Angular5 | https://github.com/badr-ghazouan/E-commerce-Spring5MVC-Angular5 | 8a2e854e45ea4e9f0bb2d1742d0df3597efdf6cd | d1bb1d8b17479e14190aefbb65734ce7c9068adb | refs/heads/master | 2020-03-23T07:30:35.529000 | 2018-01-18T14:24:45 | 2018-01-18T14:24:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package web;
import entities.CreditCard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import repositories.CreditCardRepository;
import java.util.List;
public class CreditCardController {
@Autowired
CreditCardRepository creditCardRepository;
@RequestMapping(value = "/creditCard/",
method = RequestMethod.POST,
consumes = "application/json",
produces = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public CreditCard saveCreditCard(@RequestBody CreditCard creditCard)
{
return creditCardRepository.save(creditCard);
}
@RequestMapping(value = "/creditCard/{id}",
method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public void findCreditCard(@PathVariable("id") Long id)
{
creditCardRepository.findById(id);
}
@RequestMapping(value = "/creditCard/",
method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public List<CreditCard> findCreditCardes()
{
return creditCardRepository.findAll();
}
@RequestMapping(value = "/creditCard/{id}",
method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
public void updateCreditCard(@PathVariable("id") long id,
@RequestBody CreditCard creditCard)
{
CreditCard currentCreditCard = creditCardRepository.getOne(id);
currentCreditCard.setCreditCardExpiryDate(creditCard.getCreditCardExpiryDate());
currentCreditCard.setCreditCardNumber(creditCard.getCreditCardNumber());
currentCreditCard.setCreditCardType(creditCard.getCreditCardType());
creditCardRepository.save(currentCreditCard);
}
@RequestMapping(value = "/creditCard/{id}",
method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteCreditCard(@PathVariable("id") Long id)
{
creditCardRepository.deleteById(id);
}
@RequestMapping(value = "/creditCard/",
method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteAllCreditCardes()
{
creditCardRepository.deleteAll();
}
}
| UTF-8 | Java | 2,303 | java | CreditCardController.java | Java | []
| null | []
| package web;
import entities.CreditCard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import repositories.CreditCardRepository;
import java.util.List;
public class CreditCardController {
@Autowired
CreditCardRepository creditCardRepository;
@RequestMapping(value = "/creditCard/",
method = RequestMethod.POST,
consumes = "application/json",
produces = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public CreditCard saveCreditCard(@RequestBody CreditCard creditCard)
{
return creditCardRepository.save(creditCard);
}
@RequestMapping(value = "/creditCard/{id}",
method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public void findCreditCard(@PathVariable("id") Long id)
{
creditCardRepository.findById(id);
}
@RequestMapping(value = "/creditCard/",
method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public List<CreditCard> findCreditCardes()
{
return creditCardRepository.findAll();
}
@RequestMapping(value = "/creditCard/{id}",
method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
public void updateCreditCard(@PathVariable("id") long id,
@RequestBody CreditCard creditCard)
{
CreditCard currentCreditCard = creditCardRepository.getOne(id);
currentCreditCard.setCreditCardExpiryDate(creditCard.getCreditCardExpiryDate());
currentCreditCard.setCreditCardNumber(creditCard.getCreditCardNumber());
currentCreditCard.setCreditCardType(creditCard.getCreditCardType());
creditCardRepository.save(currentCreditCard);
}
@RequestMapping(value = "/creditCard/{id}",
method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteCreditCard(@PathVariable("id") Long id)
{
creditCardRepository.deleteById(id);
}
@RequestMapping(value = "/creditCard/",
method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteAllCreditCardes()
{
creditCardRepository.deleteAll();
}
}
| 2,303 | 0.693878 | 0.693878 | 73 | 30.547945 | 24.251558 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.369863 | false | false | 8 |
934bf8595997961a08ad867382b263d48d3c215c | 30,846,455,190,526 | 6ab5acc8b43155171adf938d956cc3983281afe4 | /src/main/java/com/byaj/killchainapp/models/Gamedata.java | f938fed1b863171a2dd30cb4a2d3da7a06538faa | []
| no_license | LearnByCoding/killchainapp | https://github.com/LearnByCoding/killchainapp | 705a0fec3fc97465384e00b3895b2a2dbda6ece2 | 638a520ed6ca2a04cbe6ab6d402504e46edaaf70 | refs/heads/master | 2020-03-06T21:41:47.187000 | 2018-04-04T13:24:44 | 2018-04-04T13:24:44 | 127,084,227 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.byaj.killchainapp.models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Entity
public class Gamedata {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String gameid;
private Boolean isBegun;
private Boolean isDone;
private String log;
public Gamedata() {
}
public Gamedata(String gameid, Boolean isBegun, Boolean isDone, String log) {
this.gameid = gameid;
this.isBegun = isBegun;
this.isDone = isDone;
this.log = log;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getGameid() {
return gameid;
}
public void setGameid(String gameid) {
this.gameid = gameid;
}
public Boolean getBegun() {
return isBegun;
}
public void setBegun(Boolean begun) {
isBegun = begun;
}
public Boolean getDone() {
return isDone;
}
public void setDone(Boolean done) {
isDone = done;
}
public String getLog() {
return log;
}
public void setLog(String log) {
this.log = log;
}
@Override
public String toString() {
return "Gamedata{" +
"id=" + id +
", gameid='" + gameid + '\'' +
", isBegun=" + isBegun +
", isDone=" + isDone +
", log='" + log + '\'' +
'}';
}
}
| UTF-8 | Java | 1,615 | java | Gamedata.java | Java | []
| null | []
| package com.byaj.killchainapp.models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Entity
public class Gamedata {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String gameid;
private Boolean isBegun;
private Boolean isDone;
private String log;
public Gamedata() {
}
public Gamedata(String gameid, Boolean isBegun, Boolean isDone, String log) {
this.gameid = gameid;
this.isBegun = isBegun;
this.isDone = isDone;
this.log = log;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getGameid() {
return gameid;
}
public void setGameid(String gameid) {
this.gameid = gameid;
}
public Boolean getBegun() {
return isBegun;
}
public void setBegun(Boolean begun) {
isBegun = begun;
}
public Boolean getDone() {
return isDone;
}
public void setDone(Boolean done) {
isDone = done;
}
public String getLog() {
return log;
}
public void setLog(String log) {
this.log = log;
}
@Override
public String toString() {
return "Gamedata{" +
"id=" + id +
", gameid='" + gameid + '\'' +
", isBegun=" + isBegun +
", isDone=" + isDone +
", log='" + log + '\'' +
'}';
}
}
| 1,615 | 0.554799 | 0.554799 | 81 | 18.938272 | 16.143909 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.407407 | false | false | 8 |
6c0313c01f4a82c6c652b56c280c13983f00f1a5 | 20,538,533,667,221 | ca021ff2fb3d5abdaf7f65fbaab776e869ccd7a5 | /src/facebook1/RemoveInvalidParentheses1.java | 4cf14aa8f1c612cef588d518c6e60672c6703ce3 | []
| no_license | teddywang1992/leetcode | https://github.com/teddywang1992/leetcode | 56ab4c072c9f0f2db31a0721294b1619a12856cd | 7d676f2e67a1a2ba073a5c11fc5f17e8c6b77e69 | refs/heads/master | 2021-01-22T18:07:23.152000 | 2018-11-24T22:46:09 | 2018-11-24T22:46:09 | 100,737,117 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package facebook1;
public class RemoveInvalidParentheses1 {
}
| UTF-8 | Java | 64 | java | RemoveInvalidParentheses1.java | Java | []
| null | []
| package facebook1;
public class RemoveInvalidParentheses1 {
}
| 64 | 0.8125 | 0.78125 | 5 | 11.8 | 15.676734 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 8 |
6b71cbf9fcde8c6672c20d2f459b0da18b8edc38 | 11,647,951,355,926 | 28c189bfaf64c8e1d5e4d62dde3036aa7d0e6b9e | /design-patterns/src/main/java/visitor/IVisitor.java | ba2c57b02e8616aa14b9e39bc44d74a339914087 | []
| no_license | hp21/coding-spikes | https://github.com/hp21/coding-spikes | 4daf7a52d76e69bbf908b148dbe531c1682d26d3 | f2fb1f58fd10adb980acd28f52d3a83341bce2b6 | refs/heads/master | 2021-01-15T15:36:50.598000 | 2018-04-20T13:11:42 | 2018-04-20T13:11:42 | 8,555,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package visitor;
/**
* Created with IntelliJ IDEA. User: hp21 Date: 2013.11.04. Time: 12:33 To
* change this template use File | Settings | File Templates.
*/
public interface IVisitor {
public void visit(Node node);
}
| UTF-8 | Java | 228 | java | IVisitor.java | Java | [
{
"context": "visitor;\n\n/**\n * Created with IntelliJ IDEA. User: hp21 Date: 2013.11.04. Time: 12:33 To\n * change this t",
"end": 63,
"score": 0.999578058719635,
"start": 59,
"tag": "USERNAME",
"value": "hp21"
}
]
| null | []
| package visitor;
/**
* Created with IntelliJ IDEA. User: hp21 Date: 2013.11.04. Time: 12:33 To
* change this template use File | Settings | File Templates.
*/
public interface IVisitor {
public void visit(Node node);
}
| 228 | 0.697368 | 0.635965 | 10 | 21.799999 | 25.568731 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 8 |
c742bf0ab138e8b796dbd4b7ed4710cf36f39b18 | 18,880,676,272,951 | 781c35970cb72158c2dbade2205f289d5b2dc58d | /app/src/main/java/com/example/toyproject/Model/retrofit2/Translate.java | 29617e61b24e27836111d2251b620fe19e793556 | []
| no_license | sdf7895/TranlateToyProject | https://github.com/sdf7895/TranlateToyProject | a8cadefff4b5497422988617f036647158a604ee | 191abd4a1d75cf15326906c08cee0317353ecc79 | refs/heads/master | 2020-09-12T09:16:26.338000 | 2019-11-18T04:35:53 | 2019-11-18T04:35:53 | 222,379,498 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.toyproject.Model.retrofit2;
import android.content.Context;
import android.widget.Toast;
import com.example.toyproject.MainActivity;
import com.example.toyproject.Model.retrofit2.retrofit2Interface.PapagoService;
import com.example.toyproject.Model.retrofit2.retrofit2Interface.TranslateService;
import com.example.toyproject.Present.TotalPresent;
import java.util.HashMap;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class Translate implements TranslateService {
private Retrofit retrofit;
private TotalPresent.GetData present;
public Translate(TotalPresent.GetData present) {
this.present = present;
}
@Override
public void translatedata(String setLanguage,String change, String text){
retrofit = new Retrofit.Builder()
.baseUrl(PapagoService.URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
PapagoService papagoService = retrofit.create(PapagoService.class);
HashMap<String,Object> param = new HashMap<>();
param.put("source",setLanguage);
param.put("target",change);
param.put("text",text);
papagoService.getResult(param).enqueue(new Callback<Result>() {
@Override
public void onResponse(Call<Result> call, Response<Result> response) {
if(response.isSuccessful()){
Result result = response.body();
Message message = result.getMessage();
DetailData detailData = message.getDetailData();
present.getData(text,detailData.getTranslatedText());
}
}
@Override
public void onFailure(Call<Result> call, Throwable t) {
}
});
}
}
| UTF-8 | Java | 1,927 | java | Translate.java | Java | []
| null | []
| package com.example.toyproject.Model.retrofit2;
import android.content.Context;
import android.widget.Toast;
import com.example.toyproject.MainActivity;
import com.example.toyproject.Model.retrofit2.retrofit2Interface.PapagoService;
import com.example.toyproject.Model.retrofit2.retrofit2Interface.TranslateService;
import com.example.toyproject.Present.TotalPresent;
import java.util.HashMap;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class Translate implements TranslateService {
private Retrofit retrofit;
private TotalPresent.GetData present;
public Translate(TotalPresent.GetData present) {
this.present = present;
}
@Override
public void translatedata(String setLanguage,String change, String text){
retrofit = new Retrofit.Builder()
.baseUrl(PapagoService.URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
PapagoService papagoService = retrofit.create(PapagoService.class);
HashMap<String,Object> param = new HashMap<>();
param.put("source",setLanguage);
param.put("target",change);
param.put("text",text);
papagoService.getResult(param).enqueue(new Callback<Result>() {
@Override
public void onResponse(Call<Result> call, Response<Result> response) {
if(response.isSuccessful()){
Result result = response.body();
Message message = result.getMessage();
DetailData detailData = message.getDetailData();
present.getData(text,detailData.getTranslatedText());
}
}
@Override
public void onFailure(Call<Result> call, Throwable t) {
}
});
}
}
| 1,927 | 0.667878 | 0.662688 | 58 | 32.224136 | 25.96685 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62069 | false | false | 8 |
d9ff6c3369f0d11a48eaf82421b3bde8be7acb8a | 8,976,481,704,473 | d598664bc3da140407caaf39af5a6fc6b998c308 | /EjerciciosT3/src/Ejercicios_con_Vectores/ejercicio7.java | 7a18d0c905796c5a987b8b96a4a85b75cb6fc5d7 | []
| no_license | DEMarquez/programacion2014-2015 | https://github.com/DEMarquez/programacion2014-2015 | ff2f15e117037ed5a2c300dabadc7c08eec71c80 | c3822da8754013ce3b226606523aa9fa22ff674f | refs/heads/master | 2021-01-01T19:42:43.120000 | 2015-01-24T18:22:15 | 2015-01-24T18:22:15 | 29,784,379 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Ejercicios_con_Vectores;
import java.util.*;
public class ejercicio7 {
public static void main(String args[]) {
int vector[];
int N, repeticion = 0;
int minimo = 0;
Scanner teclado = new Scanner(System.in);
System.out.println("introduzca numero de valores del vector");
N = teclado.nextInt();
vector = new int[N];
for (int i = 0; i < N; i++) {
System.out.println("introduce valores del vector");
vector[i] = teclado.nextInt();
if (i == 0) {
minimo = vector[i];// damos valor a minimo no se puede hacer
// antes
}
if (vector[i] < minimo) {// guardamos valor minimo en la variable
// minimo
minimo = vector[i];
}
}//for inicializar
// repetido
for (int j = 0; j < N; j++) {
if (vector[j] == minimo) {// guardamos los valores repetidos en un
// contador
repeticion++;
}
}
if (repeticion > 1) {// asignamos las veces que se puede repetir el
// valor repetido
System.out.println("hay un valor minimo repetido " + repeticion
+ " veces es el " + minimo);
}
}
}
| UTF-8 | Java | 1,146 | java | ejercicio7.java | Java | []
| null | []
| package Ejercicios_con_Vectores;
import java.util.*;
public class ejercicio7 {
public static void main(String args[]) {
int vector[];
int N, repeticion = 0;
int minimo = 0;
Scanner teclado = new Scanner(System.in);
System.out.println("introduzca numero de valores del vector");
N = teclado.nextInt();
vector = new int[N];
for (int i = 0; i < N; i++) {
System.out.println("introduce valores del vector");
vector[i] = teclado.nextInt();
if (i == 0) {
minimo = vector[i];// damos valor a minimo no se puede hacer
// antes
}
if (vector[i] < minimo) {// guardamos valor minimo en la variable
// minimo
minimo = vector[i];
}
}//for inicializar
// repetido
for (int j = 0; j < N; j++) {
if (vector[j] == minimo) {// guardamos los valores repetidos en un
// contador
repeticion++;
}
}
if (repeticion > 1) {// asignamos las veces que se puede repetir el
// valor repetido
System.out.println("hay un valor minimo repetido " + repeticion
+ " veces es el " + minimo);
}
}
}
| 1,146 | 0.570681 | 0.564572 | 53 | 19.622641 | 21.469791 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.54717 | false | false | 8 |
f76eee428302be571dccaf04c9747e767ddcf75c | 24,507,083,400,593 | c45a67944f362ae667f5e9f47cb178a934a18af6 | /app/src/main/java/com/child/go/go_child/model/Cases.java | cb66b85c01a86087a11b95fcc8fdac17c775086d | []
| no_license | Sashaachi/Go_Child-App | https://github.com/Sashaachi/Go_Child-App | 73e784a0670485d69062a1dbedba0bd686db5e95 | 24d9392fbcfd7ee3b3c7492ccf85e2198ebf98ec | refs/heads/master | 2020-04-28T02:25:17.868000 | 2018-04-23T17:16:45 | 2018-04-23T17:16:45 | 174,897,639 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.child.go.go_child.model;
/**
* Created by sefu on 4/19/18.
*/
public class Cases {
private String caseName,caseDescription;
public Cases() {
}
public Cases(String caseName, String caseDescription) {
this.caseName = caseName;
this.caseDescription = caseDescription;
}
public String getCaseName() {
return caseName;
}
public void setCaseName(String caseName) {
this.caseName = caseName;
}
public String getCaseDescription() {
return caseDescription;
}
public void setCaseDescription(String caseDescription) {
this.caseDescription = caseDescription;
}
}
| UTF-8 | Java | 673 | java | Cases.java | Java | [
{
"context": "ge com.child.go.go_child.model;\n\n/**\n * Created by sefu on 4/19/18.\n */\n\npublic class Cases {\n private",
"end": 60,
"score": 0.9993900656700134,
"start": 56,
"tag": "USERNAME",
"value": "sefu"
}
]
| null | []
| package com.child.go.go_child.model;
/**
* Created by sefu on 4/19/18.
*/
public class Cases {
private String caseName,caseDescription;
public Cases() {
}
public Cases(String caseName, String caseDescription) {
this.caseName = caseName;
this.caseDescription = caseDescription;
}
public String getCaseName() {
return caseName;
}
public void setCaseName(String caseName) {
this.caseName = caseName;
}
public String getCaseDescription() {
return caseDescription;
}
public void setCaseDescription(String caseDescription) {
this.caseDescription = caseDescription;
}
}
| 673 | 0.650817 | 0.643388 | 33 | 19.39394 | 19.62364 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.30303 | false | false | 8 |
9a52a88b9fc1926fdde583dbbd82081cd0650c2a | 3,702,261,858,408 | c6d78bea313402633eb9bef8b401d60c1aaf230a | /payment-transfer-module/src/main/java/com/payment/transfer/module/mapper/AccountMapper.java | 6e9d3d6f008be3976c4fbbc4c296c1230307a1ac | []
| no_license | bing1012001/amqp-rabbitMQ-demo | https://github.com/bing1012001/amqp-rabbitMQ-demo | 21cc3d87c04757d29e1148f2dc804909e2c084e1 | dbb954d5db1527f702e604874c33c5baa154046d | refs/heads/master | 2021-05-20T10:29:05.568000 | 2020-04-17T05:05:48 | 2020-04-17T05:05:48 | 252,249,629 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.payment.transfer.module.mapper;
import com.payment.transfer.module.entity.Account;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@Mapper
public interface AccountMapper {
@Update("UPDATE account SET amount = #{amount}, update_time = #{updateTime}")
public int updateAccount(Account account);
@Insert("INSERT INTO account (user_id, amount, update_time) VALUES (#{userId}, #{amount}, #{updateTime})")
public int AddNewAccount(Account account);
@Select("SELECT * FROM account WHERE user_id = #{userId}")
public Account getAccountInfo(String userId);
}
| UTF-8 | Java | 725 | java | AccountMapper.java | Java | []
| null | []
| package com.payment.transfer.module.mapper;
import com.payment.transfer.module.entity.Account;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@Mapper
public interface AccountMapper {
@Update("UPDATE account SET amount = #{amount}, update_time = #{updateTime}")
public int updateAccount(Account account);
@Insert("INSERT INTO account (user_id, amount, update_time) VALUES (#{userId}, #{amount}, #{updateTime})")
public int AddNewAccount(Account account);
@Select("SELECT * FROM account WHERE user_id = #{userId}")
public Account getAccountInfo(String userId);
}
| 725 | 0.750345 | 0.750345 | 21 | 33.523811 | 29.973988 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 8 |
9664bfad047a6302c4ac5664819b7d7dbd3ae189 | 893,353,211,318 | 8d466583574663248d9197c83d490f8de6914f01 | /Olya.Levitskaya/Calculator/src/test/FractionTest.java | 1369f2d56958536e87d16c4435f87accab21d217 | []
| no_license | andrey-malets/usuoop | https://github.com/andrey-malets/usuoop | 186b421080d7ff1fbaed2b230f2f2c77eb081138 | 5ae5876f3622ab8a4598a67a414d544c4d6a7bcb | refs/heads/master | 2021-01-25T10:15:48.239000 | 2011-06-18T08:03:42 | 2011-06-18T08:03:42 | 32,697,629 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import junit.framework.TestCase;
import java.util.Random;
import calculator.datatypes.fraction.FractionValueParser;
import calculator.Calculator;
import calculator.DivisionByZeroException;
import calculator.OperationNotSupportedException;
import calculator.ParseValueException;
public class FractionTest extends TestCase{
public static int generingNum(int range)
{
Random random = new Random();
int res = random.nextInt(range);
return res;
}
public static int NOD(int a,int b)
{
while (b !=0)
{
int tmp = a%b;
a = b;
b = tmp;
}
return a;
}
public static String generingFraction() {
final int range = 100;
int aInt = generingNum(range);
int bInt = generingNum(range);
int nod = NOD(aInt,bInt);
if (nod != 1) {
aInt /= nod;
bInt /= nod;
}
String fraction = String.format("%s/%s", aInt, bInt);
return fraction;
}
public void testKommutAdd() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(a, "+", b),calculator.calculate(b, "+", a));
}
public void testAssotAdd() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
String c = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(calculator.calculate(a, "+", b), "+", c),calculator.calculate(a, "+", calculator.calculate(b, "+", c)));
}
public void testSub() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
String c = calculator.calculate(a, "-", b);
String d = calculator.calculate(b, "+", c);
assertEquals(d,a);
}
public void testKommutMul() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(a, "*", b),calculator.calculate(b, "*", a));
}
public void testAssotMul() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
String c = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(calculator.calculate(a, "*", b), "*", c),calculator.calculate(a, "*", calculator.calculate(b, "*", c)));
}
public void testNeitralElDiv() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
int neitral = 1;
String neitralS = String.format("%s/%s", neitral, neitral);
Calculator calculator = new Calculator(new FractionValueParser());
String res = calculator.calculate(a, "/", neitralS);
assertEquals(res,a);
}
}
| UTF-8 | Java | 3,354 | java | FractionTest.java | Java | []
| null | []
| package test;
import junit.framework.TestCase;
import java.util.Random;
import calculator.datatypes.fraction.FractionValueParser;
import calculator.Calculator;
import calculator.DivisionByZeroException;
import calculator.OperationNotSupportedException;
import calculator.ParseValueException;
public class FractionTest extends TestCase{
public static int generingNum(int range)
{
Random random = new Random();
int res = random.nextInt(range);
return res;
}
public static int NOD(int a,int b)
{
while (b !=0)
{
int tmp = a%b;
a = b;
b = tmp;
}
return a;
}
public static String generingFraction() {
final int range = 100;
int aInt = generingNum(range);
int bInt = generingNum(range);
int nod = NOD(aInt,bInt);
if (nod != 1) {
aInt /= nod;
bInt /= nod;
}
String fraction = String.format("%s/%s", aInt, bInt);
return fraction;
}
public void testKommutAdd() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(a, "+", b),calculator.calculate(b, "+", a));
}
public void testAssotAdd() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
String c = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(calculator.calculate(a, "+", b), "+", c),calculator.calculate(a, "+", calculator.calculate(b, "+", c)));
}
public void testSub() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
String c = calculator.calculate(a, "-", b);
String d = calculator.calculate(b, "+", c);
assertEquals(d,a);
}
public void testKommutMul() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(a, "*", b),calculator.calculate(b, "*", a));
}
public void testAssotMul() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
String b = generingFraction();
String c = generingFraction();
Calculator calculator = new Calculator(new FractionValueParser());
assertEquals(calculator.calculate(calculator.calculate(a, "*", b), "*", c),calculator.calculate(a, "*", calculator.calculate(b, "*", c)));
}
public void testNeitralElDiv() throws ParseValueException, DivisionByZeroException, OperationNotSupportedException{
String a = generingFraction();
int neitral = 1;
String neitralS = String.format("%s/%s", neitral, neitral);
Calculator calculator = new Calculator(new FractionValueParser());
String res = calculator.calculate(a, "/", neitralS);
assertEquals(res,a);
}
}
| 3,354 | 0.692308 | 0.690519 | 93 | 34.064518 | 33.987919 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.064516 | false | false | 8 |
20b41f26fd6bf1023ad37040a96bf3cd8dcc1cd5 | 16,432,544,931,286 | 0f8e2a932678247a25d3358ed29dd80096655e19 | /app/src/main/java/com/example/matheus/casadocodigocomlibs/event/AutorEvent.java | 85ce0fb7c0749cf2c0f3f0de516b7f8bed17c475 | []
| no_license | MathBrandino/CasaDoCodigo59 | https://github.com/MathBrandino/CasaDoCodigo59 | 917bc6bd22320963ffc27979aac8ea6230d43f22 | f9e0b2f5e5c89a7316b9e3e17326767a470ffb9a | refs/heads/master | 2020-05-21T19:51:10.016000 | 2017-05-25T22:37:26 | 2017-05-25T22:37:26 | 62,263,545 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.matheus.casadocodigocomlibs.event;
import com.example.matheus.casadocodigocomlibs.model.Autor;
import java.util.ArrayList;
/**
* Created by matheus on 05/07/16.
*/
public class AutorEvent {
public final ArrayList<Autor> autores;
public AutorEvent(ArrayList<Autor> autores) {
this.autores = autores;
}
}
| UTF-8 | Java | 350 | java | AutorEvent.java | Java | [
{
"context": "r;\n\nimport java.util.ArrayList;\n\n/**\n * Created by matheus on 05/07/16.\n */\npublic class AutorEvent {\n pu",
"end": 171,
"score": 0.9723191857337952,
"start": 164,
"tag": "USERNAME",
"value": "matheus"
}
]
| null | []
| package com.example.matheus.casadocodigocomlibs.event;
import com.example.matheus.casadocodigocomlibs.model.Autor;
import java.util.ArrayList;
/**
* Created by matheus on 05/07/16.
*/
public class AutorEvent {
public final ArrayList<Autor> autores;
public AutorEvent(ArrayList<Autor> autores) {
this.autores = autores;
}
}
| 350 | 0.728571 | 0.711429 | 17 | 19.588236 | 21.079845 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false | 8 |
25ab1e689249d3afc5fbb1945edce11599c460c4 | 23,837,068,502,923 | 6cefc2482eec58a88442cc7a9c612f49e05b141c | /src/main/java/com/imooc/test/Test.java | 4a1716defdb2dcc4f0e6e07916c30bc91d3404f2 | []
| no_license | jialianghao/git_test_maven | https://github.com/jialianghao/git_test_maven | 8ff5391c74e8a22ff4f90c9e883905e1e6d09764 | f2b1c650d3735239e2057170d50aa4f4667d9814 | refs/heads/master | 2020-06-02T08:46:46.517000 | 2019-06-10T09:42:22 | 2019-06-10T09:42:22 | 191,105,066 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.imooc.test;
/*
* 测试类
*/
public class Test {
//小明新提交代码 sun 本地修改代码
//小明新提交代码2 sun还未pull 但是sun已经在本地开发了代码 sun在次行本地修改代码了
}
| UTF-8 | Java | 255 | java | Test.java | Java | []
| null | []
| package com.imooc.test;
/*
* 测试类
*/
public class Test {
//小明新提交代码 sun 本地修改代码
//小明新提交代码2 sun还未pull 但是sun已经在本地开发了代码 sun在次行本地修改代码了
}
| 255 | 0.608696 | 0.602484 | 9 | 15.777778 | 17.749979 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false | 8 |
7d15b1bfefd508dcadb5bcc4b3b1e2af13698989 | 12,060,268,169,388 | b42d4c17056d73e42a5b34c3bebc327b1ba2755a | /TicketLibrary/src/androidTest/java/com/yelloco/ticketlibrary/OperationListUT.java | 59b52e05b3506a8955a25e2480e2f374bd230e51 | []
| no_license | Amr92/NBEApp | https://github.com/Amr92/NBEApp | 287fe7db2f5e56b36b2c63166f44fdfedd8b97a5 | 7b0a9a50ffcded7742e158d1f15cecfbe613bffa | refs/heads/master | 2023-06-16T09:04:34.601000 | 2021-07-09T16:28:58 | 2021-07-09T16:28:58 | 384,493,794 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yelloco.ticketlibrary;
import android.content.Context;
import android.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import es.redsys.paysys.Operative.Managers.RedCLSTransactionData;
import static es.redsys.paysys.Utils.RedCLSCifradoUtil.TAG;
import static org.junit.Assert.assertEquals;
public class OperationListUT {
Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
private final String MERCHANT_NAME = "PRUEBAS REDSYS";
private final String FUC = "999160151";
private final String TERMINAL_ID = "14";
OperationListTicketGeneration operationListTicketGeneration = new OperationListTicketGeneration(context);
public OperationListUT() throws IOException {
}
private List<RedCLSTransactionData> transactionDataSamples = new ArrayList<>();
@Test
public void TestOperationList(){
RedCLSTransactionData magStripeTransactionData = TransactionDataSamples.CT_MAGNETIC_STRIPE.getTransactionData(10, "");
RedCLSTransactionData ctlsTransactionData = TransactionDataSamples.CTLS_EMV_11.getTransactionData(10, "");
transactionDataSamples.add(magStripeTransactionData);
transactionDataSamples.add(ctlsTransactionData);
operationListTicketGeneration.parse(
MERCHANT_NAME,
FUC,
TERMINAL_ID,
"2020-09-08 21:04:21.0",
"2020-08-06 21:04:21.0",
"2020-09-06 21:04:21.0",
"2",
"4",
transactionDataSamples
);
Log.d(TAG, "TestOperationList: " + operationListTicketGeneration.getHTML());
assertEquals(MERCHANT_NAME, operationListTicketGeneration.getMerchantName());
assertEquals(FUC, operationListTicketGeneration.getMerchantNumber());
assertEquals(TERMINAL_ID, operationListTicketGeneration.getTPVNumber());
assertEquals("08.09.2020", operationListTicketGeneration.getTransactionDate());
assertEquals("21:04", operationListTicketGeneration.getTransactionTime());
assertEquals("Operation List", operationListTicketGeneration.getTicketLabel());
assertEquals("06.08.2020", operationListTicketGeneration.getFromDate());
assertEquals("06.09.2020", operationListTicketGeneration.getToDate());
assertEquals("2", operationListTicketGeneration.getCurrentPage());
assertEquals("4", operationListTicketGeneration.getTotalPages());
//first card
assertEquals(TransactionDataSamples.CT_MAGNETIC_STRIPE.getDate(magStripeTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(0).getOperationDate());
assertEquals(TransactionDataSamples.CT_MAGNETIC_STRIPE.getTime(magStripeTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(0).getOperationTime());
assertEquals(magStripeTransactionData.getOrder(),operationListTicketGeneration.getAllOperationList().get(0).getOrderId());
assertEquals(OperationResult.AUTH.getResponse(), operationListTicketGeneration.getAllOperationList().get(0).getOperationType());
assertEquals(magStripeTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(0).getOperationResult());
assertEquals(magStripeTransactionData.getAmount(), operationListTicketGeneration.getAllOperationList().get(0).getAmount());
assertEquals(CurrencyCodeUtils.getCurrencyString(context, magStripeTransactionData.getCurrency()), operationListTicketGeneration.getAllOperationList().get(0).getCurrency());
assertEquals(magStripeTransactionData.getCardClient(), operationListTicketGeneration.getAllOperationList().get(0).getCardNumber());
assertEquals(magStripeTransactionData.getAutorizationNumber(), operationListTicketGeneration.getAllOperationList().get(0).getAuthNumber());
assertEquals(magStripeTransactionData.getReferenciaOperacion(), operationListTicketGeneration.getAllOperationList().get(0).getReference());
assertEquals(magStripeTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(0).getOperationResult());
//second card
assertEquals(TransactionDataSamples.CTLS_EMV_11.getDate(ctlsTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(1).getOperationDate());
assertEquals(TransactionDataSamples.CTLS_EMV_11.getTime(ctlsTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(1).getOperationTime());
assertEquals(ctlsTransactionData.getOrder(),operationListTicketGeneration.getAllOperationList().get(1).getOrderId());
assertEquals(OperationResult.AUTH.getResponse(), operationListTicketGeneration.getAllOperationList().get(1).getOperationType());
assertEquals(ctlsTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(1).getOperationResult());
assertEquals(ctlsTransactionData.getAmount(), operationListTicketGeneration.getAllOperationList().get(1).getAmount());
assertEquals(CurrencyCodeUtils.getCurrencyString(context, ctlsTransactionData.getCurrency()), operationListTicketGeneration.getAllOperationList().get(1).getCurrency());
assertEquals(ctlsTransactionData.getCardClient(), operationListTicketGeneration.getAllOperationList().get(1).getCardNumber());
assertEquals(ctlsTransactionData.getAutorizationNumber(), operationListTicketGeneration.getAllOperationList().get(1).getAuthNumber());
assertEquals(ctlsTransactionData.getReferenciaOperacion(), operationListTicketGeneration.getAllOperationList().get(1).getReference());
assertEquals(ctlsTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(1).getOperationResult());
}
}
| UTF-8 | Java | 5,981 | java | OperationListUT.java | Java | [
{
"context": "text();\n private final String MERCHANT_NAME = \"PRUEBAS REDSYS\";\n private final String FUC = \"999",
"end": 594,
"score": 0.7338241934776306,
"start": 592,
"tag": "NAME",
"value": "PR"
}
]
| null | []
| package com.yelloco.ticketlibrary;
import android.content.Context;
import android.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import es.redsys.paysys.Operative.Managers.RedCLSTransactionData;
import static es.redsys.paysys.Utils.RedCLSCifradoUtil.TAG;
import static org.junit.Assert.assertEquals;
public class OperationListUT {
Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
private final String MERCHANT_NAME = "PRUEBAS REDSYS";
private final String FUC = "999160151";
private final String TERMINAL_ID = "14";
OperationListTicketGeneration operationListTicketGeneration = new OperationListTicketGeneration(context);
public OperationListUT() throws IOException {
}
private List<RedCLSTransactionData> transactionDataSamples = new ArrayList<>();
@Test
public void TestOperationList(){
RedCLSTransactionData magStripeTransactionData = TransactionDataSamples.CT_MAGNETIC_STRIPE.getTransactionData(10, "");
RedCLSTransactionData ctlsTransactionData = TransactionDataSamples.CTLS_EMV_11.getTransactionData(10, "");
transactionDataSamples.add(magStripeTransactionData);
transactionDataSamples.add(ctlsTransactionData);
operationListTicketGeneration.parse(
MERCHANT_NAME,
FUC,
TERMINAL_ID,
"2020-09-08 21:04:21.0",
"2020-08-06 21:04:21.0",
"2020-09-06 21:04:21.0",
"2",
"4",
transactionDataSamples
);
Log.d(TAG, "TestOperationList: " + operationListTicketGeneration.getHTML());
assertEquals(MERCHANT_NAME, operationListTicketGeneration.getMerchantName());
assertEquals(FUC, operationListTicketGeneration.getMerchantNumber());
assertEquals(TERMINAL_ID, operationListTicketGeneration.getTPVNumber());
assertEquals("08.09.2020", operationListTicketGeneration.getTransactionDate());
assertEquals("21:04", operationListTicketGeneration.getTransactionTime());
assertEquals("Operation List", operationListTicketGeneration.getTicketLabel());
assertEquals("06.08.2020", operationListTicketGeneration.getFromDate());
assertEquals("06.09.2020", operationListTicketGeneration.getToDate());
assertEquals("2", operationListTicketGeneration.getCurrentPage());
assertEquals("4", operationListTicketGeneration.getTotalPages());
//first card
assertEquals(TransactionDataSamples.CT_MAGNETIC_STRIPE.getDate(magStripeTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(0).getOperationDate());
assertEquals(TransactionDataSamples.CT_MAGNETIC_STRIPE.getTime(magStripeTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(0).getOperationTime());
assertEquals(magStripeTransactionData.getOrder(),operationListTicketGeneration.getAllOperationList().get(0).getOrderId());
assertEquals(OperationResult.AUTH.getResponse(), operationListTicketGeneration.getAllOperationList().get(0).getOperationType());
assertEquals(magStripeTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(0).getOperationResult());
assertEquals(magStripeTransactionData.getAmount(), operationListTicketGeneration.getAllOperationList().get(0).getAmount());
assertEquals(CurrencyCodeUtils.getCurrencyString(context, magStripeTransactionData.getCurrency()), operationListTicketGeneration.getAllOperationList().get(0).getCurrency());
assertEquals(magStripeTransactionData.getCardClient(), operationListTicketGeneration.getAllOperationList().get(0).getCardNumber());
assertEquals(magStripeTransactionData.getAutorizationNumber(), operationListTicketGeneration.getAllOperationList().get(0).getAuthNumber());
assertEquals(magStripeTransactionData.getReferenciaOperacion(), operationListTicketGeneration.getAllOperationList().get(0).getReference());
assertEquals(magStripeTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(0).getOperationResult());
//second card
assertEquals(TransactionDataSamples.CTLS_EMV_11.getDate(ctlsTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(1).getOperationDate());
assertEquals(TransactionDataSamples.CTLS_EMV_11.getTime(ctlsTransactionData.getOperationDate()), operationListTicketGeneration.getAllOperationList().get(1).getOperationTime());
assertEquals(ctlsTransactionData.getOrder(),operationListTicketGeneration.getAllOperationList().get(1).getOrderId());
assertEquals(OperationResult.AUTH.getResponse(), operationListTicketGeneration.getAllOperationList().get(1).getOperationType());
assertEquals(ctlsTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(1).getOperationResult());
assertEquals(ctlsTransactionData.getAmount(), operationListTicketGeneration.getAllOperationList().get(1).getAmount());
assertEquals(CurrencyCodeUtils.getCurrencyString(context, ctlsTransactionData.getCurrency()), operationListTicketGeneration.getAllOperationList().get(1).getCurrency());
assertEquals(ctlsTransactionData.getCardClient(), operationListTicketGeneration.getAllOperationList().get(1).getCardNumber());
assertEquals(ctlsTransactionData.getAutorizationNumber(), operationListTicketGeneration.getAllOperationList().get(1).getAuthNumber());
assertEquals(ctlsTransactionData.getReferenciaOperacion(), operationListTicketGeneration.getAllOperationList().get(1).getReference());
assertEquals(ctlsTransactionData.getResult(), operationListTicketGeneration.getAllOperationList().get(1).getOperationResult());
}
}
| 5,981 | 0.772613 | 0.75255 | 93 | 63.311829 | 57.752899 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.075269 | false | false | 8 |
19db18c7e094e216215a819825fe0cdab77fc403 | 10,110,353,029,489 | e2d9b1e9b6818cd119c08a024eb3b00a5c4b509b | /training/src/com/csit/action/PotCourseAction.java | 2dcf4aa7918da374fd55d8dfdd3a83c0b5cc761f | []
| no_license | dampce32/training | https://github.com/dampce32/training | a340c3e5cf5cae4828942102a2418102a37e8f06 | b66e2fe038396fa075d56c5312bef3fe2b262d99 | refs/heads/master | 2021-01-10T12:43:02.072000 | 2016-01-11T07:11:29 | 2016-01-11T07:11:54 | 49,405,807 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.csit.action;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.csit.model.PotCourse;
import com.csit.service.PotCourseService;
import com.csit.vo.ServiceResult;
import com.opensymphony.xwork2.ModelDriven;
/**
*
* @Description:咨询课程Action
* @Copyright: 福州骏华信息有限公司 (c)2013
* @Created Date : 2013-2-28
* @author jcf
* @vesion 1.0
*/
@Controller
@Scope("prototype")
public class PotCourseAction extends BaseAction implements ModelDriven<PotCourse> {
private static final long serialVersionUID = -4648466664583512735L;
private static final Logger logger = Logger.getLogger(PotCourseAction.class);
private PotCourse model = new PotCourse();
@Resource
private PotCourseService potCourseService;
@Override
public PotCourse getModel() {
return model;
}
/**
*
* @Description: 保存咨询课程
* @Create: 2013-2-28 上午10:03:01
* @author jcf
* @update logs
*/
public void save() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.save(model);
} catch (Exception e) {
result.setMessage("保存咨询课程失败");
logger.error("保存咨询课程失败", e);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: 删除咨询课程
* @Create: 2013-2-28 上午10:04:40
* @author jcf
* @update logs
*/
public void delete() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.delete(model);
} catch (Exception e) {
if (e instanceof org.springframework.dao.DataIntegrityViolationException) {
result.setMessage("该记录已被使用,不能删除");
} else {
result.setMessage("删除咨询课程失败");
logger.error("删除咨询课程失败", e);
}
result.setIsSuccess(false);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: 分页查询咨询课程
* @Create: 2013-2-28 上午10:04:51
* @author jcf
* @update logs
*/
public void query() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.query(model, page, rows);
} catch (Exception e) {
result.setMessage("查询咨询课程失败");
logger.error("查询咨询课程失败", e);
result.setIsSuccess(false);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: 统计咨询课程
* @Create: 2013-2-28 上午10:05:07
* @author jcf
* @update logs
*/
public void getTotalCount() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.getTotalCount(model);
} catch (Exception e) {
result.setMessage("统计咨询课程失败");
logger.error("统计咨询课程失败", e);
result.setIsSuccess(false);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: combobox查询
* @Create: 2013-2-28 上午10:05:18
* @author jcf
* @update logs
*/
public void queryCombobox() {
String jsonString = potCourseService.queryCombobox();
ajaxJson(jsonString);
}
/**
*
* @Description: 修改状态
* @Create: 2013-2-28 下午03:59:15
* @author jcf
* @update logs
*/
public void updateStatus(){
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.updateStatus(model.getPotCourseId(), model.getStatus());
} catch (Exception e) {
result.setMessage("修改咨询课程状态失败");
logger.error("修改咨询课程状态失败", e);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
}
| UTF-8 | Java | 3,881 | java | PotCourseAction.java | Java | [
{
"context": " (c)2013\r\n * @Created Date : 2013-2-28\r\n * @author jcf\r\n * @vesion 1.0\r\n */\r\n@Controller\r\n@Scope(\"protot",
"end": 481,
"score": 0.9996776580810547,
"start": 478,
"tag": "USERNAME",
"value": "jcf"
},
{
"context": "课程\r\n\t * @Create: 2013-2-28 上午10:03:01\r\n\t * @author jcf\r\n\t * @update logs\r\n\t */\r\n\tpublic void save() {\r\n\t",
"end": 1034,
"score": 0.9996802806854248,
"start": 1031,
"tag": "USERNAME",
"value": "jcf"
},
{
"context": "课程\r\n\t * @Create: 2013-2-28 上午10:04:40\r\n\t * @author jcf\r\n\t * @update logs\r\n\t */\r\n\tpublic void delete() {\r",
"end": 1446,
"score": 0.9996862411499023,
"start": 1443,
"tag": "USERNAME",
"value": "jcf"
},
{
"context": "课程\r\n\t * @Create: 2013-2-28 上午10:04:51\r\n\t * @author jcf\r\n\t * @update logs\r\n\t */\r\n\tpublic void query() {\r\n",
"end": 2037,
"score": 0.9996781349182129,
"start": 2034,
"tag": "USERNAME",
"value": "jcf"
},
{
"context": "课程\r\n\t * @Create: 2013-2-28 上午10:05:07\r\n\t * @author jcf\r\n\t * @update logs\r\n\t */\r\n\tpublic void getTotalCou",
"end": 2495,
"score": 0.9996753931045532,
"start": 2492,
"tag": "USERNAME",
"value": "jcf"
},
{
"context": "查询\r\n\t * @Create: 2013-2-28 上午10:05:18\r\n\t * @author jcf\r\n\t * @update logs\r\n\t */\r\n\tpublic void queryCombob",
"end": 2961,
"score": 0.9996834993362427,
"start": 2958,
"tag": "USERNAME",
"value": "jcf"
},
{
"context": "状态\r\n\t * @Create: 2013-2-28 下午03:59:15\r\n\t * @author jcf\r\n\t * @update logs\r\n\t */\r\n\tpublic void updateStatu",
"end": 3191,
"score": 0.9996824264526367,
"start": 3188,
"tag": "USERNAME",
"value": "jcf"
}
]
| null | []
| package com.csit.action;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.csit.model.PotCourse;
import com.csit.service.PotCourseService;
import com.csit.vo.ServiceResult;
import com.opensymphony.xwork2.ModelDriven;
/**
*
* @Description:咨询课程Action
* @Copyright: 福州骏华信息有限公司 (c)2013
* @Created Date : 2013-2-28
* @author jcf
* @vesion 1.0
*/
@Controller
@Scope("prototype")
public class PotCourseAction extends BaseAction implements ModelDriven<PotCourse> {
private static final long serialVersionUID = -4648466664583512735L;
private static final Logger logger = Logger.getLogger(PotCourseAction.class);
private PotCourse model = new PotCourse();
@Resource
private PotCourseService potCourseService;
@Override
public PotCourse getModel() {
return model;
}
/**
*
* @Description: 保存咨询课程
* @Create: 2013-2-28 上午10:03:01
* @author jcf
* @update logs
*/
public void save() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.save(model);
} catch (Exception e) {
result.setMessage("保存咨询课程失败");
logger.error("保存咨询课程失败", e);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: 删除咨询课程
* @Create: 2013-2-28 上午10:04:40
* @author jcf
* @update logs
*/
public void delete() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.delete(model);
} catch (Exception e) {
if (e instanceof org.springframework.dao.DataIntegrityViolationException) {
result.setMessage("该记录已被使用,不能删除");
} else {
result.setMessage("删除咨询课程失败");
logger.error("删除咨询课程失败", e);
}
result.setIsSuccess(false);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: 分页查询咨询课程
* @Create: 2013-2-28 上午10:04:51
* @author jcf
* @update logs
*/
public void query() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.query(model, page, rows);
} catch (Exception e) {
result.setMessage("查询咨询课程失败");
logger.error("查询咨询课程失败", e);
result.setIsSuccess(false);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: 统计咨询课程
* @Create: 2013-2-28 上午10:05:07
* @author jcf
* @update logs
*/
public void getTotalCount() {
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.getTotalCount(model);
} catch (Exception e) {
result.setMessage("统计咨询课程失败");
logger.error("统计咨询课程失败", e);
result.setIsSuccess(false);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
/**
*
* @Description: combobox查询
* @Create: 2013-2-28 上午10:05:18
* @author jcf
* @update logs
*/
public void queryCombobox() {
String jsonString = potCourseService.queryCombobox();
ajaxJson(jsonString);
}
/**
*
* @Description: 修改状态
* @Create: 2013-2-28 下午03:59:15
* @author jcf
* @update logs
*/
public void updateStatus(){
ServiceResult result = new ServiceResult(false);
try {
result = potCourseService.updateStatus(model.getPotCourseId(), model.getStatus());
} catch (Exception e) {
result.setMessage("修改咨询课程状态失败");
logger.error("修改咨询课程状态失败", e);
}
String jsonString = result.toJSON();
ajaxJson(jsonString);
}
}
| 3,881 | 0.65995 | 0.628603 | 150 | 21.82 | 18.616863 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.7 | false | false | 8 |
ec8103660219c93ac72fd606b6f792d4ca80b9c3 | 29,850,022,721,031 | a6a360e7efb4c92f923f6ec086fb2a90336899f9 | /src/main/java/net/skeagle/vrncore/utils/storage/api/StoreableObject.java | 14832c81eedac2cb7779cd1b24bb66e38e91c136 | []
| no_license | UseAName21/vrncorereloaded | https://github.com/UseAName21/vrncorereloaded | 19192bd125cd1f6d9e7f8d5c3c49feae68a39306 | f5fa6d2fe7c4d52963b535b7ee04708ff4401eb1 | refs/heads/master | 2023-02-20T07:40:09.299000 | 2021-01-25T05:50:08 | 2021-01-25T05:50:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.skeagle.vrncore.utils.storage.api;
public abstract class StoreableObject<T> {
protected T deserialize() {
return null;
}
protected Object serialize() {
return null;
}
}
| UTF-8 | Java | 216 | java | StoreableObject.java | Java | []
| null | []
| package net.skeagle.vrncore.utils.storage.api;
public abstract class StoreableObject<T> {
protected T deserialize() {
return null;
}
protected Object serialize() {
return null;
}
}
| 216 | 0.643519 | 0.643519 | 12 | 17 | 16.782928 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 8 |
ad6df77f9957c6985bb83e0a51c6a4a99717e31d | 30,425,548,375,975 | 7fb5fc9bdd9643e06ba9769820020496dded2da1 | /amigosservices/customer/src/main/java/com/github/chMatvey/customer/CustomerApplication.java | c4f183725d1b0017fc906b91e26c5c3d359d219f | []
| no_license | chMatvey/computer-science | https://github.com/chMatvey/computer-science | e8a078bf984429b7bf67b2f1319b3d44658ef2b6 | 98e5d64f70c60cf4af9e3c62210b8e3dbabf348f | refs/heads/master | 2023-07-10T21:44:38.281000 | 2023-06-24T10:32:03 | 2023-06-24T10:32:03 | 178,741,310 | 0 | 0 | null | false | 2020-12-14T11:08:38 | 2019-03-31T20:56:10 | 2020-10-22T14:18:19 | 2020-12-14T11:08:37 | 926 | 0 | 0 | 0 | Kotlin | false | false | package com.github.chMatvey.customer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
@SpringBootApplication(
scanBasePackages = {
"com.github.chMatvey.customer",
"com.github.chMatvey.amqp"
}
)
@EnableEurekaClient
@EnableFeignClients(basePackages = "com.github.chMatvey.clients")
@PropertySources({
@PropertySource("classpath:clients-${spring.profiles.active}.properties")
})
public class CustomerApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerApplication.class, args);
}
}
| UTF-8 | Java | 915 | java | CustomerApplication.java | Java | [
{
"context": "chMatvey.customer\",\n \"com.github.chMatvey.amqp\"\n }\n)\n@EnableEurekaClient\n@EnableF",
"end": 550,
"score": 0.6286225318908691,
"start": 547,
"tag": "USERNAME",
"value": "Mat"
}
]
| null | []
| package com.github.chMatvey.customer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
@SpringBootApplication(
scanBasePackages = {
"com.github.chMatvey.customer",
"com.github.chMatvey.amqp"
}
)
@EnableEurekaClient
@EnableFeignClients(basePackages = "com.github.chMatvey.clients")
@PropertySources({
@PropertySource("classpath:clients-${spring.profiles.active}.properties")
})
public class CustomerApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerApplication.class, args);
}
}
| 915 | 0.769399 | 0.769399 | 26 | 34.192307 | 26.256163 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 8 |
6b952415362f72d69f847650f487bdea5dc1e0ec | 31,928,786,880,422 | bcf7187ff3f33cf1870ea87aa2a93b978b655013 | /app/src/main/java/com/vaxapp/clockreminder/presentation/reminders/RemindersListActivity.java | 862254096462d5f7241c7d63d284052d1427f221 | [
"MIT"
]
| permissive | valllllll2000/ClockReminder | https://github.com/valllllll2000/ClockReminder | a2cf5cd7572bc6020b3b7ee4b5647a9909ed59ae | 8b63a774849947293f5449ca414aa9bd718ae9dd | refs/heads/master | 2021-01-17T16:41:43.926000 | 2017-02-25T15:36:59 | 2017-02-25T15:36:59 | 83,141,218 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vaxapp.clockreminder.presentation.reminders;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import butterknife.Bind;
import butterknife.ButterKnife;
import com.vaxapp.clockreminder.R;
import com.vaxapp.clockreminder.presentation.BaseActivity;
import com.vaxapp.clockreminder.presentation.add.AddReminderActivity;
public class RemindersListActivity extends BaseActivity implements RemindersListView {
@Bind(R.id.reminder_rv)
RecyclerView reminderRv;
@Bind(R.id.toolbar)
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setUpToolBar();
}
private void setUpToolBar() {
setSupportActionBar(toolbar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_item_add) {
startActivity(new Intent(this, AddReminderActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
| UTF-8 | Java | 1,444 | java | RemindersListActivity.java | Java | []
| null | []
| package com.vaxapp.clockreminder.presentation.reminders;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import butterknife.Bind;
import butterknife.ButterKnife;
import com.vaxapp.clockreminder.R;
import com.vaxapp.clockreminder.presentation.BaseActivity;
import com.vaxapp.clockreminder.presentation.add.AddReminderActivity;
public class RemindersListActivity extends BaseActivity implements RemindersListView {
@Bind(R.id.reminder_rv)
RecyclerView reminderRv;
@Bind(R.id.toolbar)
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setUpToolBar();
}
private void setUpToolBar() {
setSupportActionBar(toolbar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_item_add) {
startActivity(new Intent(this, AddReminderActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
| 1,444 | 0.716759 | 0.715374 | 50 | 27.879999 | 21.842747 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54 | false | false | 8 |
1b6fb4bae33a37cc49693471d4f3852cdf10b49f | 16,664,473,145,661 | 53fb4e0b4dec5219a168cb9f1b26149a7f5ef21d | /collegemanagement/src/journal.java | 45242d7a95beb7a0e07a1f8873b48b52777ad516 | []
| no_license | Ninja-Technician/collegemanagement | https://github.com/Ninja-Technician/collegemanagement | 17f1f176d3069bb611448d9f387bfcc66f0aa7fe | 23946beae89cd1a4e84bea7c74a1737c8389d6e5 | refs/heads/master | 2020-09-01T14:48:41.571000 | 2019-11-01T12:55:39 | 2019-11-01T12:55:39 | 218,983,900 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class journal implements ActionListener
{
Frame f1;
Panel p1;
Label l,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15;
JButton b1;
ImageIcon im;
journal()
{
f1=new Frame("Journals...");
f1.setBounds(200,40,700, 600);
p1=new Panel();
l=new Label("NAME OF JOURNALS");
l.setBounds(300,40,150,25);
p1.add(l);
l.setBackground(Color.lightGray);
l1=new Label(" 1) Business Economics");
l1.setBounds(120,80,350,25);
p1.add(l1);
l1.setBackground(Color.lightGray);
l2=new Label(" 2) Down to Earth");
l2.setBounds(120,110,370,25);
p1.add(l2);
l2.setBackground(Color.lightGray);
l3=new Label(" 3) Entrepreneurship and Regional Development");
l3.setBounds(120,140,270,25);
p1.add(l3);
l3.setBackground(Color.lightGray);
l4=new Label(" 4) Jul. of Advanced Research in Comp. Engg.-2/Yr");
l4.setBounds(120,170,200,25);
p1.add(l4);
l4.setBackground(Color.lightGray);
l5=new Label(" 5) IEEE-Trans on Multimedia");
l5.setBounds(120,200,270,25);
p1.add(l5);
l5.setBackground(Color.lightGray);
l6=new Label(" 6) Information System Frontiers");
l6.setBounds(120,230,270,25);
p1.add(l6);
l6.setBackground(Color.lightGray);
l7=new Label(" 7) Intnl. Journal of Intelligent Information Processing");
l7.setBounds(120,260,250,25);
p1.add(l7);
l7.setBackground(Color.lightGray);
l8=new Label(" 8) Mobile Computing - IEEE Transactions on");
l8.setBounds(120,290,270,25);
p1.add(l8);
l8.setBackground(Color.lightGray);
l9=new Label(" 9) Computer Graphics and Applications");
l9.setBounds(120,320,270,25);
p1.add(l9);
l9.setBackground(Color.lightGray);
l10=new Label(" 10) Information and Security");
l10.setBounds(120,350,240,25);
p1.add(l10);
l10.setBackground(Color.lightGray);
l11=new Label(" 11) Forbes Asia");
l11.setBounds(120,380,150,25);
p1.add(l11);
l11.setBackground(Color.lightGray);
l12=new Label(" 12) Global Business Review");
l12.setBounds(120,410,240,25);
p1.add(l12);
l12.setBackground(Color.lightGray);
l13=new Label(" 13) Journal of Human Values");
l13.setBounds(120,440,240,25);
p1.add(l13);
l13.setBackground(Color.lightGray);
l14=new Label(" 14) Psychology & Developing Societies");
l14.setBounds(120,470,300,25);
p1.add(l14);
l14.setBackground(Color.lightGray);
l15=new Label(" 15) Seminar Magazine");
l15.setBounds(120,500,270,25);
p1.add(l15);
l15.setBackground(Color.lightGray);
im=new ImageIcon("C:\\Users\\Hp\\Documents\\NetBeansProjects\\collegemanagement\\src\\images\\back5.png");
b1=new JButton("Back",im);
b1.setBounds(550,500,100,25);
p1.add(b1);
p1.setLayout(null);
f1.add(p1);
f1.setSize(700,600);
f1.setVisible(true);
f1.setResizable(false);
f1.setBackground(Color.lightGray);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
Library lib=new Library();
f1.setVisible(false);
}
}
public static void main(String args[])
{
journal ca=new journal();
}
} | UTF-8 | Java | 3,094 | java | journal.java | Java | []
| null | []
| import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class journal implements ActionListener
{
Frame f1;
Panel p1;
Label l,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15;
JButton b1;
ImageIcon im;
journal()
{
f1=new Frame("Journals...");
f1.setBounds(200,40,700, 600);
p1=new Panel();
l=new Label("NAME OF JOURNALS");
l.setBounds(300,40,150,25);
p1.add(l);
l.setBackground(Color.lightGray);
l1=new Label(" 1) Business Economics");
l1.setBounds(120,80,350,25);
p1.add(l1);
l1.setBackground(Color.lightGray);
l2=new Label(" 2) Down to Earth");
l2.setBounds(120,110,370,25);
p1.add(l2);
l2.setBackground(Color.lightGray);
l3=new Label(" 3) Entrepreneurship and Regional Development");
l3.setBounds(120,140,270,25);
p1.add(l3);
l3.setBackground(Color.lightGray);
l4=new Label(" 4) Jul. of Advanced Research in Comp. Engg.-2/Yr");
l4.setBounds(120,170,200,25);
p1.add(l4);
l4.setBackground(Color.lightGray);
l5=new Label(" 5) IEEE-Trans on Multimedia");
l5.setBounds(120,200,270,25);
p1.add(l5);
l5.setBackground(Color.lightGray);
l6=new Label(" 6) Information System Frontiers");
l6.setBounds(120,230,270,25);
p1.add(l6);
l6.setBackground(Color.lightGray);
l7=new Label(" 7) Intnl. Journal of Intelligent Information Processing");
l7.setBounds(120,260,250,25);
p1.add(l7);
l7.setBackground(Color.lightGray);
l8=new Label(" 8) Mobile Computing - IEEE Transactions on");
l8.setBounds(120,290,270,25);
p1.add(l8);
l8.setBackground(Color.lightGray);
l9=new Label(" 9) Computer Graphics and Applications");
l9.setBounds(120,320,270,25);
p1.add(l9);
l9.setBackground(Color.lightGray);
l10=new Label(" 10) Information and Security");
l10.setBounds(120,350,240,25);
p1.add(l10);
l10.setBackground(Color.lightGray);
l11=new Label(" 11) Forbes Asia");
l11.setBounds(120,380,150,25);
p1.add(l11);
l11.setBackground(Color.lightGray);
l12=new Label(" 12) Global Business Review");
l12.setBounds(120,410,240,25);
p1.add(l12);
l12.setBackground(Color.lightGray);
l13=new Label(" 13) Journal of Human Values");
l13.setBounds(120,440,240,25);
p1.add(l13);
l13.setBackground(Color.lightGray);
l14=new Label(" 14) Psychology & Developing Societies");
l14.setBounds(120,470,300,25);
p1.add(l14);
l14.setBackground(Color.lightGray);
l15=new Label(" 15) Seminar Magazine");
l15.setBounds(120,500,270,25);
p1.add(l15);
l15.setBackground(Color.lightGray);
im=new ImageIcon("C:\\Users\\Hp\\Documents\\NetBeansProjects\\collegemanagement\\src\\images\\back5.png");
b1=new JButton("Back",im);
b1.setBounds(550,500,100,25);
p1.add(b1);
p1.setLayout(null);
f1.add(p1);
f1.setSize(700,600);
f1.setVisible(true);
f1.setResizable(false);
f1.setBackground(Color.lightGray);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
Library lib=new Library();
f1.setVisible(false);
}
}
public static void main(String args[])
{
journal ca=new journal();
}
} | 3,094 | 0.68552 | 0.567227 | 128 | 23.179688 | 19.349754 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.742188 | false | false | 8 |
0173a648bf8e764f6fe798ff5233abdcca244d24 | 13,632,226,245,236 | eb70c1b311c82a282fd744eb89b983a26a939ea0 | /src/main/java/com/arjjs/ccm/modules/pbs/sys/web/FrontMobileController.java | f1c04f9f9b1e487e51155263be9eb2165f388b91 | []
| no_license | arjccm/arjccm_std | https://github.com/arjccm/arjccm_std | dbf0e11fbc536cc3222628d2e96d03b319adacd3 | 10c58d5db58fbfa95d4f8ba6b6490276ad464486 | refs/heads/master | 2022-12-23T16:56:49.462000 | 2021-02-03T07:51:11 | 2021-02-03T07:51:11 | 239,068,652 | 2 | 4 | null | false | 2022-12-16T15:24:51 | 2020-02-08T04:25:37 | 2021-02-03T07:52:01 | 2022-12-16T15:24:48 | 464,849 | 0 | 4 | 22 | JavaScript | false | false | /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.arjjs.ccm.modules.pbs.sys.web;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.arjjs.ccm.common.utils.StringUtils;
import com.arjjs.ccm.common.web.BaseController;
import com.arjjs.ccm.modules.sys.entity.Office;
import com.arjjs.ccm.modules.sys.entity.Role;
import com.arjjs.ccm.modules.sys.entity.User;
import com.arjjs.ccm.modules.pbs.sys.service.SystemServiceEx;
import com.arjjs.ccm.modules.sys.utils.UserUtils;
import com.google.common.collect.Lists;
/**
* 登录Controller
*
* @author lc
* @version 2018-03-27
*/
@Controller
@RequestMapping(value = "${frontPath}/sys/Mobile")
public class FrontMobileController extends BaseController {
@Autowired
private SystemServiceEx systemService;
// 显示 主页内容
@RequestMapping(value = { "index", "" })
public String pbsvotelist(HttpServletRequest request, HttpServletResponse response, Model model) {
// 进入网址首页
return "/index";
}
// 跳转网页 -无数据加载
@RequestMapping(value = "pageTurn")
public String pageTurn(@RequestParam(required = false) String pageTo, HttpServletRequest request,
HttpServletResponse response, Model model) {
// 进入跳转网页
return pageTo;
}
// 进行注册页面
@RequestMapping(value = "register")
public String register(User user, HttpServletRequest request, HttpServletResponse response, Model model) {
// 进入跳转网页
return "/modules/sys/register";
}
@ResponseBody
@RequestMapping(value = "save")
public String save(User user, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
// 修正引用赋值问题,不知道为何,Company和Office引用的一个实例地址,修改了一个,另外一个跟着修改。
user.setCompany(new Office("wx001"));
user.setOffice(new Office("wx001"));
// 如果新密码为空,则不更换密码
if (StringUtils.isNotBlank(user.getNewPassword())) {
user.setPassword(SystemServiceEx.entryptPassword(user.getNewPassword()));
}
// 验证对象 是否 合法
if (!beanValidator(model, user)) {
Map<String, Object> validatorMap = model.asMap();
return validatorMap.get("message").toString();
}
// 验证对象 是否登录
if (systemService.getUserByLoginName(user.getLoginName()) != null) {
return "注册失败,登录名已存在";
}
// 验证对象 的 手机号 与 email
if (systemService.getUserByLoginName(user.getLoginName()) != null) {
return "注册失败,手机号 或 email 已存在";
}
// 角色数据有效性验证,过滤不在授权内的角色
// 新增对象
List<Role> roleNList = Lists.newArrayList();
// 默认获取全部的 用户信息
Role roleDto = new Role();
List<Role> roleList = systemService.findRole(roleDto);
// 传入的对象 角色
List<String> roleIdList = user.getRoleIdList();
// 变更当前的用户角色
for (Role r : roleList) {
if (roleIdList.contains(r.getId())) {
roleNList.add(r);
}
}
// 设置 用户 列表
user.setRoleList(roleNList);
// 保存用户信息
systemService.registerUser(user);
// 清除当前用户缓存
if (user.getLoginName().equals(UserUtils.getUser().getLoginName())) {
UserUtils.clearCache();
// UserUtils.getCacheMap().clear();
}
addMessage(redirectAttributes, "保存用户'" + user.getLoginName() + "'成功");
return "sucess";
}
} | UTF-8 | Java | 3,994 | java | FrontMobileController.java | Java | [
{
"context": "ight © 2012-2016 <a href=\"https://github.com/thinkgem/jeesite\">JeeSite</a> All rights reserved.\n */\npac",
"end": 70,
"score": 0.9979456067085266,
"start": 62,
"tag": "USERNAME",
"value": "thinkgem"
},
{
"context": "collect.Lists;\n\n/**\n * 登录Controller\n * \n * @author lc\n * @version 2018-03-27\n */\n@Controller\n@RequestMa",
"end": 1133,
"score": 0.9975582957267761,
"start": 1131,
"tag": "USERNAME",
"value": "lc"
}
]
| null | []
| /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.arjjs.ccm.modules.pbs.sys.web;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.arjjs.ccm.common.utils.StringUtils;
import com.arjjs.ccm.common.web.BaseController;
import com.arjjs.ccm.modules.sys.entity.Office;
import com.arjjs.ccm.modules.sys.entity.Role;
import com.arjjs.ccm.modules.sys.entity.User;
import com.arjjs.ccm.modules.pbs.sys.service.SystemServiceEx;
import com.arjjs.ccm.modules.sys.utils.UserUtils;
import com.google.common.collect.Lists;
/**
* 登录Controller
*
* @author lc
* @version 2018-03-27
*/
@Controller
@RequestMapping(value = "${frontPath}/sys/Mobile")
public class FrontMobileController extends BaseController {
@Autowired
private SystemServiceEx systemService;
// 显示 主页内容
@RequestMapping(value = { "index", "" })
public String pbsvotelist(HttpServletRequest request, HttpServletResponse response, Model model) {
// 进入网址首页
return "/index";
}
// 跳转网页 -无数据加载
@RequestMapping(value = "pageTurn")
public String pageTurn(@RequestParam(required = false) String pageTo, HttpServletRequest request,
HttpServletResponse response, Model model) {
// 进入跳转网页
return pageTo;
}
// 进行注册页面
@RequestMapping(value = "register")
public String register(User user, HttpServletRequest request, HttpServletResponse response, Model model) {
// 进入跳转网页
return "/modules/sys/register";
}
@ResponseBody
@RequestMapping(value = "save")
public String save(User user, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
// 修正引用赋值问题,不知道为何,Company和Office引用的一个实例地址,修改了一个,另外一个跟着修改。
user.setCompany(new Office("wx001"));
user.setOffice(new Office("wx001"));
// 如果新密码为空,则不更换密码
if (StringUtils.isNotBlank(user.getNewPassword())) {
user.setPassword(SystemServiceEx.entryptPassword(user.getNewPassword()));
}
// 验证对象 是否 合法
if (!beanValidator(model, user)) {
Map<String, Object> validatorMap = model.asMap();
return validatorMap.get("message").toString();
}
// 验证对象 是否登录
if (systemService.getUserByLoginName(user.getLoginName()) != null) {
return "注册失败,登录名已存在";
}
// 验证对象 的 手机号 与 email
if (systemService.getUserByLoginName(user.getLoginName()) != null) {
return "注册失败,手机号 或 email 已存在";
}
// 角色数据有效性验证,过滤不在授权内的角色
// 新增对象
List<Role> roleNList = Lists.newArrayList();
// 默认获取全部的 用户信息
Role roleDto = new Role();
List<Role> roleList = systemService.findRole(roleDto);
// 传入的对象 角色
List<String> roleIdList = user.getRoleIdList();
// 变更当前的用户角色
for (Role r : roleList) {
if (roleIdList.contains(r.getId())) {
roleNList.add(r);
}
}
// 设置 用户 列表
user.setRoleList(roleNList);
// 保存用户信息
systemService.registerUser(user);
// 清除当前用户缓存
if (user.getLoginName().equals(UserUtils.getUser().getLoginName())) {
UserUtils.clearCache();
// UserUtils.getCacheMap().clear();
}
addMessage(redirectAttributes, "保存用户'" + user.getLoginName() + "'成功");
return "sucess";
}
} | 3,994 | 0.740146 | 0.733953 | 121 | 28.363636 | 26.865751 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.603306 | false | false | 8 |
3acdd37cf6dedfff13dba139f0c23e9dfe581d5d | 12,618,613,982,883 | 4c397df188d8de077304441e281678801b7f0db9 | /le-auth/src/main/java/com/le/config/filter/LoginFilter.java | 7c87af40ff2566da173395f272e3131f21dc43f8 | []
| no_license | Ale-CN/le-cloud | https://github.com/Ale-CN/le-cloud | 3fa07495a6cdc739c49d17f088113660d2a96d13 | e44a9f5c29cbd86d1c3ed15653c57a0d21512dc7 | refs/heads/master | 2023-05-06T14:22:51.284000 | 2021-05-28T09:34:46 | 2021-05-28T09:34:46 | 371,650,617 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.le.config.filter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class LoginFilter extends UsernamePasswordAuthenticationFilter {
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
return super.attemptAuthentication(request, response);
}
}
| UTF-8 | Java | 702 | java | LoginFilter.java | Java | []
| null | []
| package com.le.config.filter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class LoginFilter extends UsernamePasswordAuthenticationFilter {
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
return super.attemptAuthentication(request, response);
}
}
| 702 | 0.844729 | 0.844729 | 21 | 32.42857 | 37.321732 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 8 |
3343a4dfe23947846c40e9b86b25de73268a608c | 644,245,161,706 | 36b66bd9b4030760e19e35417e414f5471a57be2 | /src/jena/examples/vocabulary/DC.java | 7b13c0b5871d9a83c581a4665aeb07d2b90c89b6 | []
| no_license | 09oguri/JenaExample | https://github.com/09oguri/JenaExample | b75a9b4e2f6c93ffe38d9161ebaaf2b51c0f326c | f9594b31ee0f1901a51b9705c1a4997bfb52aee8 | refs/heads/master | 2021-03-12T19:58:30.753000 | 2014-10-27T02:41:48 | 2014-10-27T02:41:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jena.examples.vocabulary;
/* CVS $Id: $ */
import com.hp.hpl.jena.rdf.model.*;
/**
* Vocabulary definitions from DC.rdf
*
* @author Auto-generated by schemagen on 12 9 2014 17:20
*/
public class DC {
/**
* <p>
* The RDF model that holds the vocabulary terms
* </p>
*/
private static Model m_model = ModelFactory.createDefaultModel();
/**
* <p>
* The namespace of the vocabulary as a string
* </p>
*/
public static final String NS = "http://purl.org/dc/terms/";
/**
* <p>
* The namespace of the vocabulary as a string
* </p>
*
* @see #NS
*/
public static String getURI() {
return NS;
}
/**
* <p>
* The namespace of the vocabulary as a resource
* </p>
*/
public static final Resource NAMESPACE = m_model.createResource(NS);
/**
* <p>
* A summary of the resource.
* </p>
*/
public static final Property abstract_ = m_model
.createProperty("http://purl.org/dc/terms/abstract");
/**
* <p>
* Information about who can access the resource or an indication of its
* security status.
* </p>
*/
public static final Property accessRights = m_model
.createProperty("http://purl.org/dc/terms/accessRights");
/**
* <p>
* The method by which items are added to a collection.
* </p>
*/
public static final Property accrualMethod = m_model
.createProperty("http://purl.org/dc/terms/accrualMethod");
/**
* <p>
* The frequency with which items are added to a collection.
* </p>
*/
public static final Property accrualPeriodicity = m_model
.createProperty("http://purl.org/dc/terms/accrualPeriodicity");
/**
* <p>
* The policy governing the addition of items to a collection.
* </p>
*/
public static final Property accrualPolicy = m_model
.createProperty("http://purl.org/dc/terms/accrualPolicy");
/**
* <p>
* An alternative name for the resource.
* </p>
*/
public static final Property alternative = m_model
.createProperty("http://purl.org/dc/terms/alternative");
/**
* <p>
* A class of entity for whom the resource is intended or useful.
* </p>
*/
public static final Property audience = m_model
.createProperty("http://purl.org/dc/terms/audience");
/**
* <p>
* Date (often a range) that the resource became or will become available.
* </p>
*/
public static final Property available = m_model
.createProperty("http://purl.org/dc/terms/available");
/**
* <p>
* A bibliographic reference for the resource.
* </p>
*/
public static final Property bibliographicCitation = m_model
.createProperty("http://purl.org/dc/terms/bibliographicCitation");
/**
* <p>
* An established standard to which the described resource conforms.
* </p>
*/
public static final Property conformsTo = m_model
.createProperty("http://purl.org/dc/terms/conformsTo");
/**
* <p>
* An entity responsible for making contributions to the resource.
* </p>
*/
public static final Property contributor = m_model
.createProperty("http://purl.org/dc/terms/contributor");
/**
* <p>
* The spatial or temporal topic of the resource, the spatial applicability
* of the resource, or the jurisdiction under which the resource is
* relevant.
* </p>
*/
public static final Property coverage = m_model
.createProperty("http://purl.org/dc/terms/coverage");
/**
* <p>
* Date of creation of the resource.
* </p>
*/
public static final Property created = m_model
.createProperty("http://purl.org/dc/terms/created");
/**
* <p>
* An entity primarily responsible for making the resource.
* </p>
*/
public static final Property creator = m_model
.createProperty("http://purl.org/dc/terms/creator");
/**
* <p>
* A point or period of time associated with an event in the lifecycle of
* the resource.
* </p>
*/
public static final Property date = m_model.createProperty("http://purl.org/dc/terms/date");
/**
* <p>
* Date of acceptance of the resource.
* </p>
*/
public static final Property dateAccepted = m_model
.createProperty("http://purl.org/dc/terms/dateAccepted");
/**
* <p>
* Date of copyright.
* </p>
*/
public static final Property dateCopyrighted = m_model
.createProperty("http://purl.org/dc/terms/dateCopyrighted");
/**
* <p>
* Date of submission of the resource.
* </p>
*/
public static final Property dateSubmitted = m_model
.createProperty("http://purl.org/dc/terms/dateSubmitted");
/**
* <p>
* An account of the resource.
* </p>
*/
public static final Property description = m_model
.createProperty("http://purl.org/dc/terms/description");
/**
* <p>
* A class of entity, defined in terms of progression through an educational
* or training context, for which the described resource is intended.
* </p>
*/
public static final Property educationLevel = m_model
.createProperty("http://purl.org/dc/terms/educationLevel");
/**
* <p>
* The size or duration of the resource.
* </p>
*/
public static final Property extent = m_model.createProperty("http://purl.org/dc/terms/extent");
/**
* <p>
* The file format, physical medium, or dimensions of the resource.
* </p>
*/
public static final Property format = m_model.createProperty("http://purl.org/dc/terms/format");
/**
* <p>
* A related resource that is substantially the same as the pre-existing
* described resource, but in another format.
* </p>
*/
public static final Property hasFormat = m_model
.createProperty("http://purl.org/dc/terms/hasFormat");
/**
* <p>
* A related resource that is included either physically or logically in the
* described resource.
* </p>
*/
public static final Property hasPart = m_model
.createProperty("http://purl.org/dc/terms/hasPart");
/**
* <p>
* A related resource that is a version, edition, or adaptation of the
* described resource.
* </p>
*/
public static final Property hasVersion = m_model
.createProperty("http://purl.org/dc/terms/hasVersion");
/**
* <p>
* An unambiguous reference to the resource within a given context.
* </p>
*/
public static final Property identifier = m_model
.createProperty("http://purl.org/dc/terms/identifier");
/**
* <p>
* A process, used to engender knowledge, attitudes and skills, that the
* described resource is designed to support.
* </p>
*/
public static final Property instructionalMethod = m_model
.createProperty("http://purl.org/dc/terms/instructionalMethod");
/**
* <p>
* A related resource that is substantially the same as the described
* resource, but in another format.
* </p>
*/
public static final Property isFormatOf = m_model
.createProperty("http://purl.org/dc/terms/isFormatOf");
/**
* <p>
* A related resource in which the described resource is physically or
* logically included.
* </p>
*/
public static final Property isPartOf = m_model
.createProperty("http://purl.org/dc/terms/isPartOf");
/**
* <p>
* A related resource that references, cites, or otherwise points to the
* described resource.
* </p>
*/
public static final Property isReferencedBy = m_model
.createProperty("http://purl.org/dc/terms/isReferencedBy");
/**
* <p>
* A related resource that supplants, displaces, or supersedes the described
* resource.
* </p>
*/
public static final Property isReplacedBy = m_model
.createProperty("http://purl.org/dc/terms/isReplacedBy");
/**
* <p>
* A related resource that requires the described resource to support its
* function, delivery, or coherence.
* </p>
*/
public static final Property isRequiredBy = m_model
.createProperty("http://purl.org/dc/terms/isRequiredBy");
/**
* <p>
* A related resource of which the described resource is a version, edition,
* or adaptation.
* </p>
*/
public static final Property isVersionOf = m_model
.createProperty("http://purl.org/dc/terms/isVersionOf");
/**
* <p>
* Date of formal issuance (e.g., publication) of the resource.
* </p>
*/
public static final Property issued = m_model.createProperty("http://purl.org/dc/terms/issued");
/**
* <p>
* A language of the resource.
* </p>
*/
public static final Property language = m_model
.createProperty("http://purl.org/dc/terms/language");
/**
* <p>
* A legal document giving official permission to do something with the
* resource.
* </p>
*/
public static final Property license = m_model
.createProperty("http://purl.org/dc/terms/license");
/**
* <p>
* An entity that mediates access to the resource and for whom the resource
* is intended or useful.
* </p>
*/
public static final Property mediator = m_model
.createProperty("http://purl.org/dc/terms/mediator");
/**
* <p>
* The material or physical carrier of the resource.
* </p>
*/
public static final Property medium = m_model.createProperty("http://purl.org/dc/terms/medium");
/**
* <p>
* Date on which the resource was changed.
* </p>
*/
public static final Property modified = m_model
.createProperty("http://purl.org/dc/terms/modified");
/**
* <p>
* A statement of any changes in ownership and custody of the resource since
* its creation that are significant for its authenticity, integrity, and
* interpretation.
* </p>
*/
public static final Property provenance = m_model
.createProperty("http://purl.org/dc/terms/provenance");
/**
* <p>
* An entity responsible for making the resource available.
* </p>
*/
public static final Property publisher = m_model
.createProperty("http://purl.org/dc/terms/publisher");
/**
* <p>
* A related resource that is referenced, cited, or otherwise pointed to by
* the described resource.
* </p>
*/
public static final Property references = m_model
.createProperty("http://purl.org/dc/terms/references");
/**
* <p>
* A related resource.
* </p>
*/
public static final Property relation = m_model
.createProperty("http://purl.org/dc/terms/relation");
/**
* <p>
* A related resource that is supplanted, displaced, or superseded by the
* described resource.
* </p>
*/
public static final Property replaces = m_model
.createProperty("http://purl.org/dc/terms/replaces");
/**
* <p>
* A related resource that is required by the described resource to support
* its function, delivery, or coherence.
* </p>
*/
public static final Property requires = m_model
.createProperty("http://purl.org/dc/terms/requires");
/**
* <p>
* Information about rights held in and over the resource.
* </p>
*/
public static final Property rights = m_model.createProperty("http://purl.org/dc/terms/rights");
/**
* <p>
* A person or organization owning or managing rights over the resource.
* </p>
*/
public static final Property rightsHolder = m_model
.createProperty("http://purl.org/dc/terms/rightsHolder");
/**
* <p>
* A related resource from which the described resource is derived.
* </p>
*/
public static final Property source = m_model.createProperty("http://purl.org/dc/terms/source");
/**
* <p>
* Spatial characteristics of the resource.
* </p>
*/
public static final Property spatial = m_model
.createProperty("http://purl.org/dc/terms/spatial");
/**
* <p>
* The topic of the resource.
* </p>
*/
public static final Property subject = m_model
.createProperty("http://purl.org/dc/terms/subject");
/**
* <p>
* A list of subunits of the resource.
* </p>
*/
public static final Property tableOfContents = m_model
.createProperty("http://purl.org/dc/terms/tableOfContents");
/**
* <p>
* Temporal characteristics of the resource.
* </p>
*/
public static final Property temporal = m_model
.createProperty("http://purl.org/dc/terms/temporal");
/**
* <p>
* A name given to the resource.
* </p>
*/
public static final Property title = m_model.createProperty("http://purl.org/dc/terms/title");
/**
* <p>
* The nature or genre of the resource.
* </p>
*/
public static final Property type = m_model.createProperty("http://purl.org/dc/terms/type");
/**
* <p>
* Date (often a range) of validity of a resource.
* </p>
*/
public static final Property valid = m_model.createProperty("http://purl.org/dc/terms/valid");
/**
* <p>
* A resource that acts or has the power to act.
* </p>
*/
public static final Resource Agent = m_model.createResource("http://purl.org/dc/terms/Agent");
/**
* <p>
* The set of classes specified by the DCMI Type Vocabulary, used to
* categorize the nature or genre of the resource.
* </p>
*/
public static final Resource DCMIType = m_model
.createResource("http://purl.org/dc/terms/DCMIType");
/**
* <p>
* The set of conceptual resources specified by the Dewey Decimal
* Classification.
* </p>
*/
public static final Resource DDC = m_model.createResource("http://purl.org/dc/terms/DDC");
/**
* <p>
* The set of media types specified by the Internet Assigned Numbers
* Authority.
* </p>
*/
public static final Resource IMT = m_model.createResource("http://purl.org/dc/terms/IMT");
/**
* <p>
* The set of conceptual resources specified by the Library of Congress
* Classification.
* </p>
*/
public static final Resource LCC = m_model.createResource("http://purl.org/dc/terms/LCC");
/**
* <p>
* The set of labeled concepts specified by the Library of Congress Subject
* Headings.
* </p>
*/
public static final Resource LCSH = m_model.createResource("http://purl.org/dc/terms/LCSH");
/**
* <p>
* The set of labeled concepts specified by the Medical Subject Headings.
* </p>
*/
public static final Resource MESH = m_model.createResource("http://purl.org/dc/terms/MESH");
/**
* <p>
* The set of conceptual resources specified by the National Library of
* Medicine Classification.
* </p>
*/
public static final Resource NLM = m_model.createResource("http://purl.org/dc/terms/NLM");
/**
* <p>
* The set of places specified by the Getty Thesaurus of Geographic Names.
* </p>
*/
public static final Resource TGN = m_model.createResource("http://purl.org/dc/terms/TGN");
/**
* <p>
* The set of conceptual resources specified by the Universal Decimal
* Classification.
* </p>
*/
public static final Resource UDC = m_model.createResource("http://purl.org/dc/terms/UDC");
/**
* <p>
* The set of regions in space defined by their geographic coordinates
* according to the DCMI Box Encoding Scheme.
* </p>
*/
public static final Resource Box = m_model.createResource("http://purl.org/dc/terms/Box");
/**
* <p>
* The set of codes listed in ISO 3166-1 for the representation of names of
* countries.
* </p>
*/
public static final Resource ISO3166 = m_model
.createResource("http://purl.org/dc/terms/ISO3166");
/**
* <p>
* The three-letter alphabetic codes listed in ISO639-2 for the
* representation of names of languages.
* </p>
*/
public static final Resource ISO639_2 = m_model
.createResource("http://purl.org/dc/terms/ISO639-2");
/**
* <p>
* The set of three-letter codes listed in ISO 639-3 for the representation
* of names of languages.
* </p>
*/
public static final Resource ISO639_3 = m_model
.createResource("http://purl.org/dc/terms/ISO639-3");
/**
* <p>
* The set of time intervals defined by their limits according to the DCMI
* Period Encoding Scheme.
* </p>
*/
public static final Resource Period = m_model.createResource("http://purl.org/dc/terms/Period");
/**
* <p>
* The set of points in space defined by their geographic coordinates
* according to the DCMI Point Encoding Scheme.
* </p>
*/
public static final Resource Point = m_model.createResource("http://purl.org/dc/terms/Point");
/**
* <p>
* The set of tags, constructed according to RFC 1766, for the
* identification of languages.
* </p>
*/
public static final Resource RFC1766 = m_model
.createResource("http://purl.org/dc/terms/RFC1766");
/**
* <p>
* The set of tags constructed according to RFC 3066 for the identification
* of languages.
* </p>
*/
public static final Resource RFC3066 = m_model
.createResource("http://purl.org/dc/terms/RFC3066");
/**
* <p>
* The set of tags constructed according to RFC 4646 for the identification
* of languages.
* </p>
*/
public static final Resource RFC4646 = m_model
.createResource("http://purl.org/dc/terms/RFC4646");
/**
* <p>
* The set of tags constructed according to RFC 5646 for the identification
* of languages.
* </p>
*/
public static final Resource RFC5646 = m_model
.createResource("http://purl.org/dc/terms/RFC5646");
/**
* <p>
* The set of identifiers constructed according to the generic syntax for
* Uniform Resource Identifiers as specified by the Internet Engineering
* Task Force.
* </p>
*/
public static final Resource URI = m_model.createResource("http://purl.org/dc/terms/URI");
/**
* <p>
* The set of dates and times constructed according to the W3C Date and Time
* Formats Specification.
* </p>
*/
public static final Resource W3CDTF = m_model.createResource("http://purl.org/dc/terms/W3CDTF");
}
| UTF-8 | Java | 17,238 | java | DC.java | Java | [
{
"context": "tions from DC.rdf\n * \n * @author Auto-generated by schemagen on 12 9 2014 17:20\n */\npublic class DC {\n\t/**\n\t *",
"end": 174,
"score": 0.994067370891571,
"start": 165,
"tag": "USERNAME",
"value": "schemagen"
}
]
| null | []
| package jena.examples.vocabulary;
/* CVS $Id: $ */
import com.hp.hpl.jena.rdf.model.*;
/**
* Vocabulary definitions from DC.rdf
*
* @author Auto-generated by schemagen on 12 9 2014 17:20
*/
public class DC {
/**
* <p>
* The RDF model that holds the vocabulary terms
* </p>
*/
private static Model m_model = ModelFactory.createDefaultModel();
/**
* <p>
* The namespace of the vocabulary as a string
* </p>
*/
public static final String NS = "http://purl.org/dc/terms/";
/**
* <p>
* The namespace of the vocabulary as a string
* </p>
*
* @see #NS
*/
public static String getURI() {
return NS;
}
/**
* <p>
* The namespace of the vocabulary as a resource
* </p>
*/
public static final Resource NAMESPACE = m_model.createResource(NS);
/**
* <p>
* A summary of the resource.
* </p>
*/
public static final Property abstract_ = m_model
.createProperty("http://purl.org/dc/terms/abstract");
/**
* <p>
* Information about who can access the resource or an indication of its
* security status.
* </p>
*/
public static final Property accessRights = m_model
.createProperty("http://purl.org/dc/terms/accessRights");
/**
* <p>
* The method by which items are added to a collection.
* </p>
*/
public static final Property accrualMethod = m_model
.createProperty("http://purl.org/dc/terms/accrualMethod");
/**
* <p>
* The frequency with which items are added to a collection.
* </p>
*/
public static final Property accrualPeriodicity = m_model
.createProperty("http://purl.org/dc/terms/accrualPeriodicity");
/**
* <p>
* The policy governing the addition of items to a collection.
* </p>
*/
public static final Property accrualPolicy = m_model
.createProperty("http://purl.org/dc/terms/accrualPolicy");
/**
* <p>
* An alternative name for the resource.
* </p>
*/
public static final Property alternative = m_model
.createProperty("http://purl.org/dc/terms/alternative");
/**
* <p>
* A class of entity for whom the resource is intended or useful.
* </p>
*/
public static final Property audience = m_model
.createProperty("http://purl.org/dc/terms/audience");
/**
* <p>
* Date (often a range) that the resource became or will become available.
* </p>
*/
public static final Property available = m_model
.createProperty("http://purl.org/dc/terms/available");
/**
* <p>
* A bibliographic reference for the resource.
* </p>
*/
public static final Property bibliographicCitation = m_model
.createProperty("http://purl.org/dc/terms/bibliographicCitation");
/**
* <p>
* An established standard to which the described resource conforms.
* </p>
*/
public static final Property conformsTo = m_model
.createProperty("http://purl.org/dc/terms/conformsTo");
/**
* <p>
* An entity responsible for making contributions to the resource.
* </p>
*/
public static final Property contributor = m_model
.createProperty("http://purl.org/dc/terms/contributor");
/**
* <p>
* The spatial or temporal topic of the resource, the spatial applicability
* of the resource, or the jurisdiction under which the resource is
* relevant.
* </p>
*/
public static final Property coverage = m_model
.createProperty("http://purl.org/dc/terms/coverage");
/**
* <p>
* Date of creation of the resource.
* </p>
*/
public static final Property created = m_model
.createProperty("http://purl.org/dc/terms/created");
/**
* <p>
* An entity primarily responsible for making the resource.
* </p>
*/
public static final Property creator = m_model
.createProperty("http://purl.org/dc/terms/creator");
/**
* <p>
* A point or period of time associated with an event in the lifecycle of
* the resource.
* </p>
*/
public static final Property date = m_model.createProperty("http://purl.org/dc/terms/date");
/**
* <p>
* Date of acceptance of the resource.
* </p>
*/
public static final Property dateAccepted = m_model
.createProperty("http://purl.org/dc/terms/dateAccepted");
/**
* <p>
* Date of copyright.
* </p>
*/
public static final Property dateCopyrighted = m_model
.createProperty("http://purl.org/dc/terms/dateCopyrighted");
/**
* <p>
* Date of submission of the resource.
* </p>
*/
public static final Property dateSubmitted = m_model
.createProperty("http://purl.org/dc/terms/dateSubmitted");
/**
* <p>
* An account of the resource.
* </p>
*/
public static final Property description = m_model
.createProperty("http://purl.org/dc/terms/description");
/**
* <p>
* A class of entity, defined in terms of progression through an educational
* or training context, for which the described resource is intended.
* </p>
*/
public static final Property educationLevel = m_model
.createProperty("http://purl.org/dc/terms/educationLevel");
/**
* <p>
* The size or duration of the resource.
* </p>
*/
public static final Property extent = m_model.createProperty("http://purl.org/dc/terms/extent");
/**
* <p>
* The file format, physical medium, or dimensions of the resource.
* </p>
*/
public static final Property format = m_model.createProperty("http://purl.org/dc/terms/format");
/**
* <p>
* A related resource that is substantially the same as the pre-existing
* described resource, but in another format.
* </p>
*/
public static final Property hasFormat = m_model
.createProperty("http://purl.org/dc/terms/hasFormat");
/**
* <p>
* A related resource that is included either physically or logically in the
* described resource.
* </p>
*/
public static final Property hasPart = m_model
.createProperty("http://purl.org/dc/terms/hasPart");
/**
* <p>
* A related resource that is a version, edition, or adaptation of the
* described resource.
* </p>
*/
public static final Property hasVersion = m_model
.createProperty("http://purl.org/dc/terms/hasVersion");
/**
* <p>
* An unambiguous reference to the resource within a given context.
* </p>
*/
public static final Property identifier = m_model
.createProperty("http://purl.org/dc/terms/identifier");
/**
* <p>
* A process, used to engender knowledge, attitudes and skills, that the
* described resource is designed to support.
* </p>
*/
public static final Property instructionalMethod = m_model
.createProperty("http://purl.org/dc/terms/instructionalMethod");
/**
* <p>
* A related resource that is substantially the same as the described
* resource, but in another format.
* </p>
*/
public static final Property isFormatOf = m_model
.createProperty("http://purl.org/dc/terms/isFormatOf");
/**
* <p>
* A related resource in which the described resource is physically or
* logically included.
* </p>
*/
public static final Property isPartOf = m_model
.createProperty("http://purl.org/dc/terms/isPartOf");
/**
* <p>
* A related resource that references, cites, or otherwise points to the
* described resource.
* </p>
*/
public static final Property isReferencedBy = m_model
.createProperty("http://purl.org/dc/terms/isReferencedBy");
/**
* <p>
* A related resource that supplants, displaces, or supersedes the described
* resource.
* </p>
*/
public static final Property isReplacedBy = m_model
.createProperty("http://purl.org/dc/terms/isReplacedBy");
/**
* <p>
* A related resource that requires the described resource to support its
* function, delivery, or coherence.
* </p>
*/
public static final Property isRequiredBy = m_model
.createProperty("http://purl.org/dc/terms/isRequiredBy");
/**
* <p>
* A related resource of which the described resource is a version, edition,
* or adaptation.
* </p>
*/
public static final Property isVersionOf = m_model
.createProperty("http://purl.org/dc/terms/isVersionOf");
/**
* <p>
* Date of formal issuance (e.g., publication) of the resource.
* </p>
*/
public static final Property issued = m_model.createProperty("http://purl.org/dc/terms/issued");
/**
* <p>
* A language of the resource.
* </p>
*/
public static final Property language = m_model
.createProperty("http://purl.org/dc/terms/language");
/**
* <p>
* A legal document giving official permission to do something with the
* resource.
* </p>
*/
public static final Property license = m_model
.createProperty("http://purl.org/dc/terms/license");
/**
* <p>
* An entity that mediates access to the resource and for whom the resource
* is intended or useful.
* </p>
*/
public static final Property mediator = m_model
.createProperty("http://purl.org/dc/terms/mediator");
/**
* <p>
* The material or physical carrier of the resource.
* </p>
*/
public static final Property medium = m_model.createProperty("http://purl.org/dc/terms/medium");
/**
* <p>
* Date on which the resource was changed.
* </p>
*/
public static final Property modified = m_model
.createProperty("http://purl.org/dc/terms/modified");
/**
* <p>
* A statement of any changes in ownership and custody of the resource since
* its creation that are significant for its authenticity, integrity, and
* interpretation.
* </p>
*/
public static final Property provenance = m_model
.createProperty("http://purl.org/dc/terms/provenance");
/**
* <p>
* An entity responsible for making the resource available.
* </p>
*/
public static final Property publisher = m_model
.createProperty("http://purl.org/dc/terms/publisher");
/**
* <p>
* A related resource that is referenced, cited, or otherwise pointed to by
* the described resource.
* </p>
*/
public static final Property references = m_model
.createProperty("http://purl.org/dc/terms/references");
/**
* <p>
* A related resource.
* </p>
*/
public static final Property relation = m_model
.createProperty("http://purl.org/dc/terms/relation");
/**
* <p>
* A related resource that is supplanted, displaced, or superseded by the
* described resource.
* </p>
*/
public static final Property replaces = m_model
.createProperty("http://purl.org/dc/terms/replaces");
/**
* <p>
* A related resource that is required by the described resource to support
* its function, delivery, or coherence.
* </p>
*/
public static final Property requires = m_model
.createProperty("http://purl.org/dc/terms/requires");
/**
* <p>
* Information about rights held in and over the resource.
* </p>
*/
public static final Property rights = m_model.createProperty("http://purl.org/dc/terms/rights");
/**
* <p>
* A person or organization owning or managing rights over the resource.
* </p>
*/
public static final Property rightsHolder = m_model
.createProperty("http://purl.org/dc/terms/rightsHolder");
/**
* <p>
* A related resource from which the described resource is derived.
* </p>
*/
public static final Property source = m_model.createProperty("http://purl.org/dc/terms/source");
/**
* <p>
* Spatial characteristics of the resource.
* </p>
*/
public static final Property spatial = m_model
.createProperty("http://purl.org/dc/terms/spatial");
/**
* <p>
* The topic of the resource.
* </p>
*/
public static final Property subject = m_model
.createProperty("http://purl.org/dc/terms/subject");
/**
* <p>
* A list of subunits of the resource.
* </p>
*/
public static final Property tableOfContents = m_model
.createProperty("http://purl.org/dc/terms/tableOfContents");
/**
* <p>
* Temporal characteristics of the resource.
* </p>
*/
public static final Property temporal = m_model
.createProperty("http://purl.org/dc/terms/temporal");
/**
* <p>
* A name given to the resource.
* </p>
*/
public static final Property title = m_model.createProperty("http://purl.org/dc/terms/title");
/**
* <p>
* The nature or genre of the resource.
* </p>
*/
public static final Property type = m_model.createProperty("http://purl.org/dc/terms/type");
/**
* <p>
* Date (often a range) of validity of a resource.
* </p>
*/
public static final Property valid = m_model.createProperty("http://purl.org/dc/terms/valid");
/**
* <p>
* A resource that acts or has the power to act.
* </p>
*/
public static final Resource Agent = m_model.createResource("http://purl.org/dc/terms/Agent");
/**
* <p>
* The set of classes specified by the DCMI Type Vocabulary, used to
* categorize the nature or genre of the resource.
* </p>
*/
public static final Resource DCMIType = m_model
.createResource("http://purl.org/dc/terms/DCMIType");
/**
* <p>
* The set of conceptual resources specified by the Dewey Decimal
* Classification.
* </p>
*/
public static final Resource DDC = m_model.createResource("http://purl.org/dc/terms/DDC");
/**
* <p>
* The set of media types specified by the Internet Assigned Numbers
* Authority.
* </p>
*/
public static final Resource IMT = m_model.createResource("http://purl.org/dc/terms/IMT");
/**
* <p>
* The set of conceptual resources specified by the Library of Congress
* Classification.
* </p>
*/
public static final Resource LCC = m_model.createResource("http://purl.org/dc/terms/LCC");
/**
* <p>
* The set of labeled concepts specified by the Library of Congress Subject
* Headings.
* </p>
*/
public static final Resource LCSH = m_model.createResource("http://purl.org/dc/terms/LCSH");
/**
* <p>
* The set of labeled concepts specified by the Medical Subject Headings.
* </p>
*/
public static final Resource MESH = m_model.createResource("http://purl.org/dc/terms/MESH");
/**
* <p>
* The set of conceptual resources specified by the National Library of
* Medicine Classification.
* </p>
*/
public static final Resource NLM = m_model.createResource("http://purl.org/dc/terms/NLM");
/**
* <p>
* The set of places specified by the Getty Thesaurus of Geographic Names.
* </p>
*/
public static final Resource TGN = m_model.createResource("http://purl.org/dc/terms/TGN");
/**
* <p>
* The set of conceptual resources specified by the Universal Decimal
* Classification.
* </p>
*/
public static final Resource UDC = m_model.createResource("http://purl.org/dc/terms/UDC");
/**
* <p>
* The set of regions in space defined by their geographic coordinates
* according to the DCMI Box Encoding Scheme.
* </p>
*/
public static final Resource Box = m_model.createResource("http://purl.org/dc/terms/Box");
/**
* <p>
* The set of codes listed in ISO 3166-1 for the representation of names of
* countries.
* </p>
*/
public static final Resource ISO3166 = m_model
.createResource("http://purl.org/dc/terms/ISO3166");
/**
* <p>
* The three-letter alphabetic codes listed in ISO639-2 for the
* representation of names of languages.
* </p>
*/
public static final Resource ISO639_2 = m_model
.createResource("http://purl.org/dc/terms/ISO639-2");
/**
* <p>
* The set of three-letter codes listed in ISO 639-3 for the representation
* of names of languages.
* </p>
*/
public static final Resource ISO639_3 = m_model
.createResource("http://purl.org/dc/terms/ISO639-3");
/**
* <p>
* The set of time intervals defined by their limits according to the DCMI
* Period Encoding Scheme.
* </p>
*/
public static final Resource Period = m_model.createResource("http://purl.org/dc/terms/Period");
/**
* <p>
* The set of points in space defined by their geographic coordinates
* according to the DCMI Point Encoding Scheme.
* </p>
*/
public static final Resource Point = m_model.createResource("http://purl.org/dc/terms/Point");
/**
* <p>
* The set of tags, constructed according to RFC 1766, for the
* identification of languages.
* </p>
*/
public static final Resource RFC1766 = m_model
.createResource("http://purl.org/dc/terms/RFC1766");
/**
* <p>
* The set of tags constructed according to RFC 3066 for the identification
* of languages.
* </p>
*/
public static final Resource RFC3066 = m_model
.createResource("http://purl.org/dc/terms/RFC3066");
/**
* <p>
* The set of tags constructed according to RFC 4646 for the identification
* of languages.
* </p>
*/
public static final Resource RFC4646 = m_model
.createResource("http://purl.org/dc/terms/RFC4646");
/**
* <p>
* The set of tags constructed according to RFC 5646 for the identification
* of languages.
* </p>
*/
public static final Resource RFC5646 = m_model
.createResource("http://purl.org/dc/terms/RFC5646");
/**
* <p>
* The set of identifiers constructed according to the generic syntax for
* Uniform Resource Identifiers as specified by the Internet Engineering
* Task Force.
* </p>
*/
public static final Resource URI = m_model.createResource("http://purl.org/dc/terms/URI");
/**
* <p>
* The set of dates and times constructed according to the W3C Date and Time
* Formats Specification.
* </p>
*/
public static final Resource W3CDTF = m_model.createResource("http://purl.org/dc/terms/W3CDTF");
}
| 17,238 | 0.664288 | 0.658545 | 679 | 24.387335 | 27.976824 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.189985 | false | false | 8 |
edaba77f374a8773b11ce7d470561541bdc2cf83 | 5,875,515,330,544 | ff46f9860cdb4a25a8ccfeae91fac692f5d05bd6 | /src/mbfussball/services/RegistrationServiceBean.java | fcafd92fe43b8efdd5a366176446aba10af410ee | []
| no_license | tik9/fb | https://github.com/tik9/fb | b8622e4ffbc2bf0b0df58130ff68dd5b05cace70 | d224a951394986133b67e330dc2b6b0389bc24d2 | refs/heads/master | 2017-06-29T19:21:34.106000 | 2017-06-27T16:23:18 | 2017-06-27T16:23:18 | 95,022,419 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mbfussball.services;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import mbfussball.modell.User;
@Stateless
public class RegistrationServiceBean implements RegistrationService{
@Inject
private EntityManager entityManager;
/**
* Da es wegen der Beziehung zwischen den User - Group - User_Group Tabellen,
* JPA-Probleme gab, habe ich hier diese Abkürzung verwendet,
* um das Datenmodell nicht mehr ändern zu müssen.
*/
@Override
public String doRegisterUser(User user) {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(user.getUPassword().getBytes());
byte byteData[] = md.digest();
//convert the byte to hex format method 1
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
user.setUPassword(sb.toString());
PreparedStatement stmInsertUser = null;
PreparedStatement stmInsertUser_Group = null;
String strIns = "insert into user" +
"(user_name, " +
"u_password,"+
"u_nachname,"+
"u_vorname,"+
"u_email)"+
"values (?,?,?,?,?)";
String strInsUG = "insert into user_group" +
"(user_name, " +
"group_name)"+
"values (?,?)";
// entityManager.persist(user);
java.sql.Connection con = entityManager.unwrap(java.sql.Connection.class);
con.setAutoCommit(false);
stmInsertUser = con.prepareStatement(strIns);
stmInsertUser.setString(1, user.getUserName());
stmInsertUser.setString(2, user.getUPassword());
stmInsertUser.setString(3, user.getUNachname());
stmInsertUser.setString(4, user.getUVorname());
stmInsertUser.setString(5, user.getUEmail());
stmInsertUser.executeUpdate();
stmInsertUser_Group = con.prepareStatement(strInsUG);
stmInsertUser_Group.setString(1, user.getUserName());
stmInsertUser_Group.setString(2, "user");
stmInsertUser_Group.executeUpdate();
con.commit();
con.close();
return "succes";
} catch (NoSuchAlgorithmException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return "fehler";
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "fehler";
}
}
@Override
public void doDeleteUser(User user) {
entityManager.remove(user);
}
}
| UTF-8 | Java | 2,605 | java | RegistrationServiceBean.java | Java | []
| null | []
| package mbfussball.services;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import mbfussball.modell.User;
@Stateless
public class RegistrationServiceBean implements RegistrationService{
@Inject
private EntityManager entityManager;
/**
* Da es wegen der Beziehung zwischen den User - Group - User_Group Tabellen,
* JPA-Probleme gab, habe ich hier diese Abkürzung verwendet,
* um das Datenmodell nicht mehr ändern zu müssen.
*/
@Override
public String doRegisterUser(User user) {
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(user.getUPassword().getBytes());
byte byteData[] = md.digest();
//convert the byte to hex format method 1
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
user.setUPassword(sb.toString());
PreparedStatement stmInsertUser = null;
PreparedStatement stmInsertUser_Group = null;
String strIns = "insert into user" +
"(user_name, " +
"u_password,"+
"u_nachname,"+
"u_vorname,"+
"u_email)"+
"values (?,?,?,?,?)";
String strInsUG = "insert into user_group" +
"(user_name, " +
"group_name)"+
"values (?,?)";
// entityManager.persist(user);
java.sql.Connection con = entityManager.unwrap(java.sql.Connection.class);
con.setAutoCommit(false);
stmInsertUser = con.prepareStatement(strIns);
stmInsertUser.setString(1, user.getUserName());
stmInsertUser.setString(2, user.getUPassword());
stmInsertUser.setString(3, user.getUNachname());
stmInsertUser.setString(4, user.getUVorname());
stmInsertUser.setString(5, user.getUEmail());
stmInsertUser.executeUpdate();
stmInsertUser_Group = con.prepareStatement(strInsUG);
stmInsertUser_Group.setString(1, user.getUserName());
stmInsertUser_Group.setString(2, "user");
stmInsertUser_Group.executeUpdate();
con.commit();
con.close();
return "succes";
} catch (NoSuchAlgorithmException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return "fehler";
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "fehler";
}
}
@Override
public void doDeleteUser(User user) {
entityManager.remove(user);
}
}
| 2,605 | 0.686923 | 0.678462 | 88 | 28.545454 | 20.663929 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.829545 | false | false | 8 |
6405a35514c775eda693c78f31deedaec34b7de2 | 5,875,515,328,133 | afa60c91c26c13647b8fe9c568ab0d5cf737ce2b | /src/main/java/image_vectorization/ImageStreamer.java | 44340a29c80de641b45bc52e0b34e01ac76e3e7f | []
| no_license | ehallmark/ImageRecognition | https://github.com/ehallmark/ImageRecognition | 764d66a31bbf9b242b1148e29b87f071dd06cf59 | 9434122d53ba1492edf02d119eb393bc7bc02243 | refs/heads/master | 2021-01-17T10:24:58.434000 | 2017-05-28T15:38:28 | 2017-05-28T15:38:28 | 84,014,680 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.java.image_vectorization;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/**
* Created by Evan on 3/11/2017.
*/
public class ImageStreamer {
public static BufferedImage loadImage(URL url) {
try {
BufferedImage image = ImageIO.read(url);
return image;
} catch(Exception ioe) {
System.out.println("Unable to find: "+url.toString());
return null;
}
}
}
| UTF-8 | Java | 544 | java | ImageStreamer.java | Java | [
{
"context": "putStream;\nimport java.net.URL;\n\n/**\n * Created by Evan on 3/11/2017.\n */\npublic class ImageStreamer {\n ",
"end": 207,
"score": 0.9969487190246582,
"start": 203,
"tag": "NAME",
"value": "Evan"
}
]
| null | []
| package main.java.image_vectorization;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/**
* Created by Evan on 3/11/2017.
*/
public class ImageStreamer {
public static BufferedImage loadImage(URL url) {
try {
BufferedImage image = ImageIO.read(url);
return image;
} catch(Exception ioe) {
System.out.println("Unable to find: "+url.toString());
return null;
}
}
}
| 544 | 0.641544 | 0.628676 | 22 | 23.727272 | 18.020649 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 8 |
468cfc3f1bc44ece048acc0ee4fd88c6c0e9719f | 506,806,186,409 | 09e57b8c988601f9731c8daf8d2ef6446371cccd | /bt-core/src/main/java/bt/net/PeerConnectionFactory.java | a210fd90440e1e171b9962501042d30442de5381 | [
"Apache-2.0"
]
| permissive | yuwu/bt | https://github.com/yuwu/bt | 3e4e16177ab408400f473ce6619c9ab7b44b9596 | ecc536f8b9ab94c701e1ed19eb2f67428ab42f49 | refs/heads/master | 2021-01-21T12:31:37.615000 | 2017-08-30T17:56:34 | 2017-08-30T17:56:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bt.net;
import bt.metainfo.TorrentId;
import bt.protocol.Message;
import bt.protocol.handler.MessageHandler;
import bt.runtime.Config;
import bt.torrent.TorrentRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.channels.SocketChannel;
import java.util.Objects;
class PeerConnectionFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(PeerConnectionFactory.class);
private SocketChannelFactory socketChannelFactory;
private MSEHandshakeProcessor cryptoHandshakeProcessor;
public PeerConnectionFactory(MessageHandler<Message> messageHandler,
SocketChannelFactory socketChannelFactory,
TorrentRegistry torrentRegistry,
Config config) {
this.socketChannelFactory = socketChannelFactory;
this.cryptoHandshakeProcessor = new MSEHandshakeProcessor(torrentRegistry, messageHandler,
config.getEncryptionPolicy(), getBufferSize(config.getMaxTransferBlockSize()), config.getMsePrivateKeySize());
}
private static int getBufferSize(long maxTransferBlockSize) {
if (maxTransferBlockSize > ((Integer.MAX_VALUE - 13) / 2)) {
throw new IllegalArgumentException("Transfer block size is too large: " + maxTransferBlockSize);
}
return (int) (maxTransferBlockSize) * 2;
}
public DefaultPeerConnection createOutgoingConnection(Peer peer, TorrentId torrentId) throws IOException {
Objects.requireNonNull(peer);
InetAddress inetAddress = peer.getInetAddress();
int port = peer.getPort();
SocketChannel channel = null;
try {
channel = socketChannelFactory.getChannel(inetAddress, port);
return createConnection(peer, torrentId, channel, false);
} catch (IOException e) {
closeQuietly(channel);
throw new IOException("Failed to create peer connection (" + inetAddress + ":" + port + ")", e);
}
}
public DefaultPeerConnection createIncomingConnection(Peer peer, SocketChannel channel) throws IOException {
try {
return createConnection(peer, null, channel, true);
} catch (IOException e) {
closeQuietly(channel);
throw e;
}
}
private DefaultPeerConnection createConnection(Peer peer, TorrentId torrentId, SocketChannel channel, boolean incoming) throws IOException {
// sanity check
if (!incoming && torrentId == null) {
throw new IllegalStateException("Requested outgoing connection without torrent ID. Peer: " + peer);
}
channel.configureBlocking(false);
MessageReaderWriter readerWriter = incoming ?
cryptoHandshakeProcessor.negotiateIncoming(peer, channel)
: cryptoHandshakeProcessor.negotiateOutgoing(peer, channel, torrentId);
return new DefaultPeerConnection(peer, channel, readerWriter);
}
private void closeQuietly(SocketChannel channel) {
if (channel != null && channel.isOpen()) {
try {
channel.close();
} catch (IOException e1) {
try {
LOGGER.warn("Failed to close outgoing channel: " + channel.getRemoteAddress(), e1);
} catch (IOException e2) {
// ignore
}
}
}
}
}
| UTF-8 | Java | 3,522 | java | PeerConnectionFactory.java | Java | []
| null | []
| package bt.net;
import bt.metainfo.TorrentId;
import bt.protocol.Message;
import bt.protocol.handler.MessageHandler;
import bt.runtime.Config;
import bt.torrent.TorrentRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.channels.SocketChannel;
import java.util.Objects;
class PeerConnectionFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(PeerConnectionFactory.class);
private SocketChannelFactory socketChannelFactory;
private MSEHandshakeProcessor cryptoHandshakeProcessor;
public PeerConnectionFactory(MessageHandler<Message> messageHandler,
SocketChannelFactory socketChannelFactory,
TorrentRegistry torrentRegistry,
Config config) {
this.socketChannelFactory = socketChannelFactory;
this.cryptoHandshakeProcessor = new MSEHandshakeProcessor(torrentRegistry, messageHandler,
config.getEncryptionPolicy(), getBufferSize(config.getMaxTransferBlockSize()), config.getMsePrivateKeySize());
}
private static int getBufferSize(long maxTransferBlockSize) {
if (maxTransferBlockSize > ((Integer.MAX_VALUE - 13) / 2)) {
throw new IllegalArgumentException("Transfer block size is too large: " + maxTransferBlockSize);
}
return (int) (maxTransferBlockSize) * 2;
}
public DefaultPeerConnection createOutgoingConnection(Peer peer, TorrentId torrentId) throws IOException {
Objects.requireNonNull(peer);
InetAddress inetAddress = peer.getInetAddress();
int port = peer.getPort();
SocketChannel channel = null;
try {
channel = socketChannelFactory.getChannel(inetAddress, port);
return createConnection(peer, torrentId, channel, false);
} catch (IOException e) {
closeQuietly(channel);
throw new IOException("Failed to create peer connection (" + inetAddress + ":" + port + ")", e);
}
}
public DefaultPeerConnection createIncomingConnection(Peer peer, SocketChannel channel) throws IOException {
try {
return createConnection(peer, null, channel, true);
} catch (IOException e) {
closeQuietly(channel);
throw e;
}
}
private DefaultPeerConnection createConnection(Peer peer, TorrentId torrentId, SocketChannel channel, boolean incoming) throws IOException {
// sanity check
if (!incoming && torrentId == null) {
throw new IllegalStateException("Requested outgoing connection without torrent ID. Peer: " + peer);
}
channel.configureBlocking(false);
MessageReaderWriter readerWriter = incoming ?
cryptoHandshakeProcessor.negotiateIncoming(peer, channel)
: cryptoHandshakeProcessor.negotiateOutgoing(peer, channel, torrentId);
return new DefaultPeerConnection(peer, channel, readerWriter);
}
private void closeQuietly(SocketChannel channel) {
if (channel != null && channel.isOpen()) {
try {
channel.close();
} catch (IOException e1) {
try {
LOGGER.warn("Failed to close outgoing channel: " + channel.getRemoteAddress(), e1);
} catch (IOException e2) {
// ignore
}
}
}
}
}
| 3,522 | 0.655877 | 0.653322 | 91 | 37.703297 | 34.703926 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.681319 | false | false | 8 |
8bcc4dfbe02694c09ddd03f9f2203f706b082658 | 32,650,341,415,248 | 65a983fe24523b51c830d75626ddbad4bc4ce55b | /monese-test/src/main/java/com/monese/dto/responses/Account.java | f267089ac613e60eb6637d188ef861ac6b2a0c54 | []
| no_license | mgl-interview/monese | https://github.com/mgl-interview/monese | af34a8b19b9569f501586805cd8a66e2752a4bc5 | c491300e4384b6e68a54e13cf95e4c8c525cc3d8 | refs/heads/master | 2020-07-22T23:33:22.910000 | 2019-09-09T17:50:49 | 2019-09-09T17:50:49 | 207,368,530 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.monese.dto.responses;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.monese.entity.AccountEntity;
import java.util.UUID;
public class Account {
@JsonCreator
public Account(
@JsonProperty("account_id") UUID accountId,
@JsonProperty("account_type") AccountEntity.AccountType accountType,
@JsonProperty("balance") long balance) {
this.accountId = accountId;
this.accountType = accountType;
this.balance = balance;
}
public final UUID accountId;
public final AccountEntity.AccountType accountType;
public final long balance;
}
| UTF-8 | Java | 684 | java | Account.java | Java | []
| null | []
| package com.monese.dto.responses;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.monese.entity.AccountEntity;
import java.util.UUID;
public class Account {
@JsonCreator
public Account(
@JsonProperty("account_id") UUID accountId,
@JsonProperty("account_type") AccountEntity.AccountType accountType,
@JsonProperty("balance") long balance) {
this.accountId = accountId;
this.accountType = accountType;
this.balance = balance;
}
public final UUID accountId;
public final AccountEntity.AccountType accountType;
public final long balance;
}
| 684 | 0.723684 | 0.723684 | 25 | 26.360001 | 21.633085 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52 | false | false | 8 |
2deac68b871d6ad653c03b40e8cb68dba6f4fc86 | 27,307,402,078,312 | 4425ec3eb89ea65021020d995b62050b6ca1cad8 | /joyCart/src/test/java/shoppingCart/shopCartDaoTest.java | d4d9b1ed0dd3662094e018c23592d43f9b49a58e | []
| no_license | d07880201/FinalProject | https://github.com/d07880201/FinalProject | e8b84c1ff7182f2bd0aa1086a653bd26065d1943 | 580aeed8bd060831281980db53395b76d85895ef | refs/heads/master | 2020-06-03T06:09:41.508000 | 2019-06-12T09:54:38 | 2019-06-12T09:54:38 | 191,474,051 | 0 | 0 | null | false | 2020-07-17T07:01:34 | 2019-06-12T01:19:37 | 2019-06-12T09:54:42 | 2020-07-17T07:01:33 | 10,858 | 0 | 0 | 4 | Java | false | false | package shoppingCart;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import config.TestSpringConfig;
import model.ShoppingCartBean;
import model.dao.ShoppingCartImp;
public class shopCartDaoTest {
private SessionFactory factory;
private ApplicationContext ctx;
private ShoppingCartImp cart;
private Transaction tx;
@Before
public void setUp() throws Exception {
ctx = new AnnotationConfigApplicationContext(TestSpringConfig.class);
cart= (ShoppingCartImp) ctx.getBean("shoppingCartImp");
factory= (SessionFactory) ctx.getBean("sessionFactory");
tx= factory.getCurrentSession().beginTransaction();
}
@After
public void tearDown() throws Exception {
tx.commit();
factory.close();
}
@Test
public void findPKTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setProductSpec("S");
System.out.println(cart.findPK(bean));
}
@Test
public void findAllItemTest() {
ShoppingCartBean bean = new ShoppingCartBean();
System.out.println(cart.findAllItem(1));
}
@Test
public void insertTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(2);
bean.setProductId(2);
bean.setQuantity(33);
bean.setProductSpec("S");
System.out.println(cart.insert(bean));
}
@Test
public void deleteTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(2);
bean.setProductId(2);
bean.setProductSpec("S");
System.out.println(cart.delete(bean));
}
@Test
public void findOneItemTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setProductSpec("S");
System.out.println(cart.findOneItem(bean));
}
@Test
public void updateQuantityTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setQuantity(66);
bean.setProductSpec("S");
System.out.println(cart.updateQuantity(bean));
}
@Test
public void updateSpecTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setProductSpec("S");
System.out.println(cart.updateProductSpec(bean,"L"));
}
@Test
public void justTest() {
System.out.println(cart.findMemberAllItem(1));
}
@Test
public void deleteCartNoTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setCartNo(78);
System.out.println(cart.deleteCartNo(bean));
}
@Test
public void deleteMemberAllItemTest() {
System.out.println(cart.deleteMemberAllItem(1));
}
}
| UTF-8 | Java | 2,905 | java | shopCartDaoTest.java | Java | []
| null | []
| package shoppingCart;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import config.TestSpringConfig;
import model.ShoppingCartBean;
import model.dao.ShoppingCartImp;
public class shopCartDaoTest {
private SessionFactory factory;
private ApplicationContext ctx;
private ShoppingCartImp cart;
private Transaction tx;
@Before
public void setUp() throws Exception {
ctx = new AnnotationConfigApplicationContext(TestSpringConfig.class);
cart= (ShoppingCartImp) ctx.getBean("shoppingCartImp");
factory= (SessionFactory) ctx.getBean("sessionFactory");
tx= factory.getCurrentSession().beginTransaction();
}
@After
public void tearDown() throws Exception {
tx.commit();
factory.close();
}
@Test
public void findPKTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setProductSpec("S");
System.out.println(cart.findPK(bean));
}
@Test
public void findAllItemTest() {
ShoppingCartBean bean = new ShoppingCartBean();
System.out.println(cart.findAllItem(1));
}
@Test
public void insertTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(2);
bean.setProductId(2);
bean.setQuantity(33);
bean.setProductSpec("S");
System.out.println(cart.insert(bean));
}
@Test
public void deleteTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(2);
bean.setProductId(2);
bean.setProductSpec("S");
System.out.println(cart.delete(bean));
}
@Test
public void findOneItemTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setProductSpec("S");
System.out.println(cart.findOneItem(bean));
}
@Test
public void updateQuantityTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setQuantity(66);
bean.setProductSpec("S");
System.out.println(cart.updateQuantity(bean));
}
@Test
public void updateSpecTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setMemberId(1);
bean.setProductId(1);
bean.setProductSpec("S");
System.out.println(cart.updateProductSpec(bean,"L"));
}
@Test
public void justTest() {
System.out.println(cart.findMemberAllItem(1));
}
@Test
public void deleteCartNoTest() {
ShoppingCartBean bean = new ShoppingCartBean();
bean.setCartNo(78);
System.out.println(cart.deleteCartNo(bean));
}
@Test
public void deleteMemberAllItemTest() {
System.out.println(cart.deleteMemberAllItem(1));
}
}
| 2,905 | 0.709811 | 0.702582 | 116 | 23.043104 | 18.811401 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.87931 | false | false | 8 |
efdd40341b0651898bb07f0e14931f1161f4bbd4 | 27,659,589,403,834 | c87ac0e2f1a0b005a516227be66eb266baede778 | /src/main/java/kr/kieran/captcha/engine/EngineCommand.java | 6657d57c414b22451a876031078a84340a0eaf75 | []
| no_license | Workinq/Captcha | https://github.com/Workinq/Captcha | 9bea79653012813b727320777a2a71db0df5c2ba | 934bae63a5aa5117caab2e06ca053fc6c1c8d7f0 | refs/heads/master | 2023-08-19T07:37:04.092000 | 2021-09-23T14:58:04 | 2021-09-23T14:58:04 | 283,778,797 | 0 | 0 | null | false | 2021-09-23T14:58:05 | 2020-07-30T13:10:58 | 2021-09-23T14:40:02 | 2021-09-23T14:58:04 | 17 | 0 | 0 | 0 | Java | false | false | package kr.kieran.captcha.engine;
import com.massivecraft.massivecore.Engine;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class EngineCommand extends Engine
{
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
private static EngineCommand i = new EngineCommand();
public static EngineCommand get() { return i; }
// -------------------------------------------- //
// COMMAND LISTENERS
// -------------------------------------------- //
@EventHandler
public void command(PlayerCommandPreprocessEvent event)
{
String message = event.getMessage().toLowerCase();
if (!message.startsWith("/captcha")) return;
String[] args = message.split(" ");
if (args.length < 2) return;
if (!this.isInt(args[1])) return;
List<String> command = new ArrayList<>(Arrays.asList(args));
command.add(1, "complete");
event.setMessage(String.join(" ", command).trim());
}
private boolean isInt(String text)
{
try
{
Integer.parseInt(text);
return true;
}
catch (NumberFormatException e)
{
return false;
}
}
}
| UTF-8 | Java | 1,400 | java | EngineCommand.java | Java | []
| null | []
| package kr.kieran.captcha.engine;
import com.massivecraft.massivecore.Engine;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class EngineCommand extends Engine
{
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
private static EngineCommand i = new EngineCommand();
public static EngineCommand get() { return i; }
// -------------------------------------------- //
// COMMAND LISTENERS
// -------------------------------------------- //
@EventHandler
public void command(PlayerCommandPreprocessEvent event)
{
String message = event.getMessage().toLowerCase();
if (!message.startsWith("/captcha")) return;
String[] args = message.split(" ");
if (args.length < 2) return;
if (!this.isInt(args[1])) return;
List<String> command = new ArrayList<>(Arrays.asList(args));
command.add(1, "complete");
event.setMessage(String.join(" ", command).trim());
}
private boolean isInt(String text)
{
try
{
Integer.parseInt(text);
return true;
}
catch (NumberFormatException e)
{
return false;
}
}
}
| 1,400 | 0.533571 | 0.531429 | 52 | 25.923077 | 21.785534 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.423077 | false | false | 8 |
6243803c7d754c8127642ca1f9433e2a74263d3a | 23,742,579,280,353 | c8fa5eb161b80915d662538574e154bd9909deb4 | /src/chat/tests/ControllerTest.java | 15b332c1f56f0e712403f14b6cad07c334c43448 | [
"MIT"
]
| permissive | SAarronB/ChatBot | https://github.com/SAarronB/ChatBot | 8d5c3ad47104011f88466a73f2ec4be959f697fe | 2f0dfe190c74de27ed0552a29fa46dbda2873c09 | refs/heads/master | 2020-04-01T10:59:39.484000 | 2019-04-23T15:34:59 | 2019-04-23T15:34:59 | 153,141,686 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chat.tests;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import chat.controller.ChatController;
public class ControllerTest
{
private ChatController testController;
@Before
public void setUp() throws Exception
{
testController = new ChatController();
}
@After
public void tearDown() throws Exception
{
testController = null;
}
@Test
public void testChatController()
{
assertNotNull("Chatbot data member not initialized", testController.getChatbot());
}
@Test
public void testInteractWithChatbot()
{
assertNotNull("Stub method used, implement with code", testController.interactWithChatbot(""));
assertNotNull("Null should not ever be returned", testController.interactWithChatbot(null));
}
@Test
public void testUseChatbotCheckers()
{
assertTrue("Spooky tester method not implemented", testController.useChatbotCheckers("spooky").contains("Halloween"));
}
@Test
public void testGetChatbot()
{
assertNotNull("Chatbot data member not initialized", testController.getChatbot());
}
}
| UTF-8 | Java | 1,099 | java | ControllerTest.java | Java | []
| null | []
| package chat.tests;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import chat.controller.ChatController;
public class ControllerTest
{
private ChatController testController;
@Before
public void setUp() throws Exception
{
testController = new ChatController();
}
@After
public void tearDown() throws Exception
{
testController = null;
}
@Test
public void testChatController()
{
assertNotNull("Chatbot data member not initialized", testController.getChatbot());
}
@Test
public void testInteractWithChatbot()
{
assertNotNull("Stub method used, implement with code", testController.interactWithChatbot(""));
assertNotNull("Null should not ever be returned", testController.interactWithChatbot(null));
}
@Test
public void testUseChatbotCheckers()
{
assertTrue("Spooky tester method not implemented", testController.useChatbotCheckers("spooky").contains("Halloween"));
}
@Test
public void testGetChatbot()
{
assertNotNull("Chatbot data member not initialized", testController.getChatbot());
}
}
| 1,099 | 0.760692 | 0.760692 | 52 | 20.134615 | 28.623571 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.134615 | false | false | 8 |
f6328624d1e64de1bf2dcef76ca008c421d12e44 | 18,502,719,112,620 | 866b1e2a22d73e5040146c1c3c116fef088508e0 | /src/test/java/se/fredsberg/euler/problem/Problem007Test.java | db295a8c2af5aa6b1a8ea42fdc86b159417b5b85 | []
| no_license | GhostRabbit/Euler | https://github.com/GhostRabbit/Euler | bcb5a2128cb3922d816a7fe94a86923a58073cf7 | 43c50b1dc1a6244760511b52771a22e67f76b6c6 | refs/heads/master | 2016-08-04T09:00:16.951000 | 2012-01-08T13:01:23 | 2012-01-08T13:01:23 | 2,533,386 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package se.fredsberg.euler.problem;
import static org.fest.assertions.Assertions.*;
import org.junit.Test;
public class Problem007Test {
@Test
public void solve() {
assertThat(new Problem007().solve()).isEqualTo(104743);
}
}
| UTF-8 | Java | 249 | java | Problem007Test.java | Java | []
| null | []
| package se.fredsberg.euler.problem;
import static org.fest.assertions.Assertions.*;
import org.junit.Test;
public class Problem007Test {
@Test
public void solve() {
assertThat(new Problem007().solve()).isEqualTo(104743);
}
}
| 249 | 0.698795 | 0.650602 | 13 | 18.153847 | 19.953199 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 8 |
557a0ec29c908f3be425c14fa231f01d733c1e68 | 5,059,471,476,231 | c4962503a080a37b5945929d05ff496fbb6f79f0 | /set-43/Eight/src/eight/BarGraphM.java | 8b270a2b723c0713293e6cccf0ebfa8bbfaf7697 | []
| no_license | abhilashmendhe/Internship-program-1 | https://github.com/abhilashmendhe/Internship-program-1 | 37c9d16703a2a040481098587553fa829bdd9bf0 | 1e1f81fe40f38f6ce916b197e3fd361e4d44ce0b | refs/heads/master | 2020-03-25T05:23:27.093000 | 2019-03-27T02:34:48 | 2019-03-27T02:34:48 | 143,444,361 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 eight;
import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JApplet;
/**
*
* @author abhilash
*/
public class BarGraphM extends JApplet {
/**
* Initialization method that will be called after the applet is loaded into
* the browser.
*/
public void init() {
// TODO start asynchronous download of heavy resources
}
public void paint(Graphics g)
{
g.setColor(Color.black);
// y-axis
g.drawLine(400, 160, 400, 800);
g.drawLine(400, 160, 410, 170);
g.drawLine(400, 160, 390, 170);
g.drawString("0", 370, 820);
g.drawString("10", 370, 740);
g.drawString("20", 370, 680);
g.drawString("30", 370, 620);
g.drawString("40", 370, 560);
g.drawString("50", 370, 500);
g.drawString("60", 370, 440);
g.drawString("70", 370, 380);
g.drawString("80", 370, 320);
g.drawString("90", 370, 260);
g.drawString("100", 370, 200);
// x-axis
g.drawLine(400, 800, 1080, 800);
g.drawLine(1080, 800, 1070, 790);
g.drawLine(1080, 800, 1070, 810);
g.drawString("Maths", 520, 830);
g.drawString("Physics", 640, 830);
g.drawString("Chemistry", 760, 830);
g.drawString("Biology", 880, 830);
g.drawString("Electronics", 1000, 830);
g.setColor(Color.red);
g.drawString("Subjects", 760, 860);
g.setColor(Color.red);
g.drawString("Marks", 290, 500);
g.setColor(Color.black);
g.drawString("External", 1200, 500);
g.drawString("Internal", 1200, 530);
g.setColor(Color.orange);
g.fillRect(1260, 485, 20, 20);
g.setColor(Color.blue);
g.fillRect(1260, 515, 20, 20);
// int cellspace = 120;
// for(int i=0; i<6; i++)
// {
// g.drawString(str, i, i);
// }
ArrayList<Integer> marksext = new ArrayList<Integer>();
marksext.add(100);
marksext.add(100);
marksext.add(100);
marksext.add(100);
marksext.add(100);
ArrayList<Integer> subject = new ArrayList<Integer>();
subject.add(520);
subject.add(640);
subject.add(760);
subject.add(880);
subject.add(1000);
ArrayList<Integer> marksint = new ArrayList<Integer>();
marksint.add(50);
marksint.add(50);
marksint.add(50);
marksint.add(50);
marksint.add(50);
for(int i=0; i<5; i++)
{
int y = 800-(marksext.get(i)*6);
g.setColor(Color.orange);
g.fillRect( subject.get(i), y, 20, 800-y);
// g.setColor(Color.black);
// g.drawString("External", subject.get(i)-20, y-20);
int intm = 800-(marksint.get(i)*6);
g.setColor(Color.blue);
g.fillRect(subject.get(i)+20, intm, 20, 800-intm);
// g.setColor(Color.black);
// g.drawString("Internal", subject.get(i)+30, intm-20);
}
}
// TODO overwrite start(), stop() and destroy() methods
}
| UTF-8 | Java | 3,470 | java | BarGraphM.java | Java | [
{
"context": "st;\nimport javax.swing.JApplet;\n\n/**\n *\n * @author abhilash\n */\npublic class BarGraphM extends JApplet {\n\n ",
"end": 333,
"score": 0.8459212779998779,
"start": 325,
"tag": "NAME",
"value": "abhilash"
}
]
| null | []
| /*
* 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 eight;
import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JApplet;
/**
*
* @author abhilash
*/
public class BarGraphM extends JApplet {
/**
* Initialization method that will be called after the applet is loaded into
* the browser.
*/
public void init() {
// TODO start asynchronous download of heavy resources
}
public void paint(Graphics g)
{
g.setColor(Color.black);
// y-axis
g.drawLine(400, 160, 400, 800);
g.drawLine(400, 160, 410, 170);
g.drawLine(400, 160, 390, 170);
g.drawString("0", 370, 820);
g.drawString("10", 370, 740);
g.drawString("20", 370, 680);
g.drawString("30", 370, 620);
g.drawString("40", 370, 560);
g.drawString("50", 370, 500);
g.drawString("60", 370, 440);
g.drawString("70", 370, 380);
g.drawString("80", 370, 320);
g.drawString("90", 370, 260);
g.drawString("100", 370, 200);
// x-axis
g.drawLine(400, 800, 1080, 800);
g.drawLine(1080, 800, 1070, 790);
g.drawLine(1080, 800, 1070, 810);
g.drawString("Maths", 520, 830);
g.drawString("Physics", 640, 830);
g.drawString("Chemistry", 760, 830);
g.drawString("Biology", 880, 830);
g.drawString("Electronics", 1000, 830);
g.setColor(Color.red);
g.drawString("Subjects", 760, 860);
g.setColor(Color.red);
g.drawString("Marks", 290, 500);
g.setColor(Color.black);
g.drawString("External", 1200, 500);
g.drawString("Internal", 1200, 530);
g.setColor(Color.orange);
g.fillRect(1260, 485, 20, 20);
g.setColor(Color.blue);
g.fillRect(1260, 515, 20, 20);
// int cellspace = 120;
// for(int i=0; i<6; i++)
// {
// g.drawString(str, i, i);
// }
ArrayList<Integer> marksext = new ArrayList<Integer>();
marksext.add(100);
marksext.add(100);
marksext.add(100);
marksext.add(100);
marksext.add(100);
ArrayList<Integer> subject = new ArrayList<Integer>();
subject.add(520);
subject.add(640);
subject.add(760);
subject.add(880);
subject.add(1000);
ArrayList<Integer> marksint = new ArrayList<Integer>();
marksint.add(50);
marksint.add(50);
marksint.add(50);
marksint.add(50);
marksint.add(50);
for(int i=0; i<5; i++)
{
int y = 800-(marksext.get(i)*6);
g.setColor(Color.orange);
g.fillRect( subject.get(i), y, 20, 800-y);
// g.setColor(Color.black);
// g.drawString("External", subject.get(i)-20, y-20);
int intm = 800-(marksint.get(i)*6);
g.setColor(Color.blue);
g.fillRect(subject.get(i)+20, intm, 20, 800-intm);
// g.setColor(Color.black);
// g.drawString("Internal", subject.get(i)+30, intm-20);
}
}
// TODO overwrite start(), stop() and destroy() methods
}
| 3,470 | 0.529107 | 0.436888 | 120 | 27.916666 | 18.447485 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.275 | false | false | 8 |
7ed812a97726e5deb798a5b187b6bc39169c4c69 | 13,872,744,368,018 | d33b4453fa2e6b2514fa2dd30194dd599f6f2a31 | /app/src/main/java/com/zjk/fireflynews/module/video/model/VideoInteractor.java | 20f1947900036787f92bbc83ea6c1c3372d0f5e6 | [
"Apache-2.0"
]
| permissive | ONARAINYDAY/FireFlyNews | https://github.com/ONARAINYDAY/FireFlyNews | 26c5ed0971900c52e6c00270dbf3d98455639700 | de1afabd81ad0599e9b300c0efa05dae4c23c4d9 | refs/heads/master | 2020-02-26T15:31:08.777000 | 2017-02-21T02:15:56 | 2017-02-21T02:15:56 | 69,554,061 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zjk.fireflynews.module.video.model;
import com.zjk.fireflynews.callback.RequestCallback;
import rx.Subscription;
/**
* Created by FireFly on 2016/9/30 14:29.
*/
public interface VideoInteractor<T> {
Subscription asyncData(RequestCallback<T> requestCallback);
}
| UTF-8 | Java | 281 | java | VideoInteractor.java | Java | [
{
"context": "llback;\nimport rx.Subscription;\n\n/**\n * Created by FireFly on 2016/9/30 14:29.\n */\npublic interface VideoInt",
"end": 152,
"score": 0.9994667768478394,
"start": 145,
"tag": "USERNAME",
"value": "FireFly"
}
]
| null | []
| package com.zjk.fireflynews.module.video.model;
import com.zjk.fireflynews.callback.RequestCallback;
import rx.Subscription;
/**
* Created by FireFly on 2016/9/30 14:29.
*/
public interface VideoInteractor<T> {
Subscription asyncData(RequestCallback<T> requestCallback);
}
| 281 | 0.775801 | 0.736655 | 11 | 24.545454 | 23.066559 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 8 |
1369f955c9be0402b7278c62d9d1b230dd16a78a | 26,353,919,329,163 | d3f47cbfaaffbb360279de1225f3ad2278051a37 | /src/main/java/com/yinghuaicc/stars/service/region/dto/response/FindBuildingByProjectIdResponseDTO.java | 46329f33545caa6c25a530d2262453886a94f55e | []
| no_license | fanlongfei0212/stars | https://github.com/fanlongfei0212/stars | 5cc2fb535db8e499b42405c3ba0ad95de1e80d8b | b270e025e796170120ab31727748aa4ffe035a36 | refs/heads/master | 2018-10-22T18:24:41.593000 | 2018-08-05T21:30:29 | 2018-08-05T21:30:29 | 141,307,046 | 0 | 2 | null | false | 2018-08-15T09:38:11 | 2018-07-17T15:13:04 | 2018-08-05T21:30:31 | 2018-08-15T03:07:16 | 2,431 | 0 | 2 | 1 | Java | false | null | package com.yinghuaicc.stars.service.region.dto.response;
/**
* @Author:Fly
* @Date:Create in 2018/7/11 下午10:49
* @Description: 根据项目查询楼栋
* @Modified:
*/
public class FindBuildingByProjectIdResponseDTO {
//楼栋id
private String id;
//楼栋名称
private String name;
public String getId() {
return id;
}
public FindBuildingByProjectIdResponseDTO setId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public FindBuildingByProjectIdResponseDTO setName(String name) {
this.name = name;
return this;
}
}
| UTF-8 | Java | 665 | java | FindBuildingByProjectIdResponseDTO.java | Java | [
{
"context": "tars.service.region.dto.response;\n\n/**\n * @Author:Fly\n * @Date:Create in 2018/7/11 下午10:49\n * @Descript",
"end": 77,
"score": 0.5388789772987366,
"start": 74,
"tag": "NAME",
"value": "Fly"
}
]
| null | []
| package com.yinghuaicc.stars.service.region.dto.response;
/**
* @Author:Fly
* @Date:Create in 2018/7/11 下午10:49
* @Description: 根据项目查询楼栋
* @Modified:
*/
public class FindBuildingByProjectIdResponseDTO {
//楼栋id
private String id;
//楼栋名称
private String name;
public String getId() {
return id;
}
public FindBuildingByProjectIdResponseDTO setId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public FindBuildingByProjectIdResponseDTO setName(String name) {
this.name = name;
return this;
}
}
| 665 | 0.630332 | 0.612954 | 34 | 17.617647 | 18.504395 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.264706 | false | false | 8 |
d31fe4a00d2690139d0685298b266474fad437b6 | 6,476,810,715,241 | bac2005f3b2a1bc11d1d61fac4f9d1c745376888 | /thread-one/src/main/java/com/abu/cas/CASdemo.java | 5e66430edede97d1958c5ed6e7b1dd11acc6a142 | []
| no_license | abu131415/juc | https://github.com/abu131415/juc | c5c0da31a69ae4f171802ae9b85884bd36ca8c36 | 05326fe8972b35347b900f65d66a6e8a9d51202c | refs/heads/master | 2022-04-20T15:53:09.143000 | 2020-03-20T07:33:53 | 2020-03-20T07:33:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.abu.cas;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 比较并交换
*/
public class CASdemo {
public static void main(String[] args) {
AtomicInteger atomicInteger = new AtomicInteger(5);
boolean flag = atomicInteger.compareAndSet(5, 100);
System.out.println(flag);
System.out.println(atomicInteger.get());
System.out.println("===========");
boolean flag02 = atomicInteger.compareAndSet(5, 2020);
System.out.println(flag02);
System.out.println(atomicInteger.get());
}
}
| UTF-8 | Java | 574 | java | CASdemo.java | Java | []
| null | []
| package com.abu.cas;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 比较并交换
*/
public class CASdemo {
public static void main(String[] args) {
AtomicInteger atomicInteger = new AtomicInteger(5);
boolean flag = atomicInteger.compareAndSet(5, 100);
System.out.println(flag);
System.out.println(atomicInteger.get());
System.out.println("===========");
boolean flag02 = atomicInteger.compareAndSet(5, 2020);
System.out.println(flag02);
System.out.println(atomicInteger.get());
}
}
| 574 | 0.641844 | 0.617021 | 23 | 23.52174 | 22.932547 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521739 | false | false | 8 |
69d478e33301f0bc5cd13686aab3b998a089b366 | 13,537,736,918,830 | bb4d859dd593a4173ac74dd17cb33984e624f6ed | /parrot-library/src/main/java/com/limpygnome/parrot/library/crypto/CryptoFactory.java | 18893d1b457db08f8f403af101393bd6f7b148bf | [
"MIT"
]
| permissive | limpygnome/parrot-manager | https://github.com/limpygnome/parrot-manager | a02c9c81cead1913a08d23bed3db64e13c30fa5d | da66f1d9ecc3d196f755256bacd88646543ec1b9 | refs/heads/develop | 2021-07-07T14:27:03.626000 | 2018-12-01T11:29:05 | 2018-12-01T11:29:05 | 82,032,697 | 1 | 0 | MIT | false | 2021-05-20T23:51:49 | 2017-02-15T07:30:52 | 2018-12-01T11:29:21 | 2021-05-20T23:51:49 | 72,904 | 1 | 0 | 16 | Java | false | false | package com.limpygnome.parrot.library.crypto;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom;
import java.security.spec.KeySpec;
/**
* Supports creating crypto-related instances of objects.
*/
public class CryptoFactory
{
// The length of secret keys
private static final int KEY_LENGTH = 256;
// The type of secret key
private static final String SECRET_KEY_TYPE = "PBKDF2WithHmacSHA256";
// THe minimum length of random bytes for a salt
private static final int SALT_LENGTH_MIN = 32;
// The maximum length of random bytes for a salt
private static final int SALT_LENGTH_MAX = 64;
// RNG to generate random bytes for IVs
private SecureRandom random;
public CryptoFactory()
{
random = new SecureRandom();
}
CryptoFactory(SecureRandom random)
{
this.random = random;
}
/**
* @return random set of bytes of variable length
*/
public byte[] generateRandomSalt()
{
int saltLength = SALT_LENGTH_MIN + random.nextInt(SALT_LENGTH_MAX - SALT_LENGTH_MIN + 1);
byte[] salt = new byte[saltLength];
random.nextBytes(salt);
return salt;
}
/**
* Creates a PBKDF2, with SHA-256 HMAC, secret key from the given parameters.
*
* @param password password
* @param salt salt
* @param rounds rounds/permutations
* @return an instance
* @throws Exception when unable to make an instance
*/
public SecretKey createSecretKey(char[] password, byte[] salt, int rounds) throws Exception
{
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(SECRET_KEY_TYPE);
KeySpec keySpec = new PBEKeySpec(password, salt, rounds, KEY_LENGTH);
SecretKey tmp = secretKeyFactory.generateSecret(keySpec);
SecretKey secretKey = new SecretKeySpec(tmp.getEncoded(), "AES");
return secretKey;
}
}
| UTF-8 | Java | 2,042 | java | CryptoFactory.java | Java | [
{
"context": "package com.limpygnome.parrot.library.crypto;\n\nimport javax.crypto.Secre",
"end": 22,
"score": 0.5124684572219849,
"start": 17,
"tag": "USERNAME",
"value": "gnome"
},
{
"context": " private static final String SECRET_KEY_TYPE = \"PBKDF2WithHmacSHA256\";\n\n // THe minimum length of random bytes for ",
"end": 541,
"score": 0.9993276000022888,
"start": 521,
"tag": "KEY",
"value": "PBKDF2WithHmacSHA256"
},
{
"context": "he given parameters.\n *\n * @param password password\n * @param salt salt\n * @param rounds roun",
"end": 1437,
"score": 0.9841745495796204,
"start": 1429,
"tag": "PASSWORD",
"value": "password"
}
]
| null | []
| package com.limpygnome.parrot.library.crypto;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom;
import java.security.spec.KeySpec;
/**
* Supports creating crypto-related instances of objects.
*/
public class CryptoFactory
{
// The length of secret keys
private static final int KEY_LENGTH = 256;
// The type of secret key
private static final String SECRET_KEY_TYPE = "PBKDF2WithHmacSHA256";
// THe minimum length of random bytes for a salt
private static final int SALT_LENGTH_MIN = 32;
// The maximum length of random bytes for a salt
private static final int SALT_LENGTH_MAX = 64;
// RNG to generate random bytes for IVs
private SecureRandom random;
public CryptoFactory()
{
random = new SecureRandom();
}
CryptoFactory(SecureRandom random)
{
this.random = random;
}
/**
* @return random set of bytes of variable length
*/
public byte[] generateRandomSalt()
{
int saltLength = SALT_LENGTH_MIN + random.nextInt(SALT_LENGTH_MAX - SALT_LENGTH_MIN + 1);
byte[] salt = new byte[saltLength];
random.nextBytes(salt);
return salt;
}
/**
* Creates a PBKDF2, with SHA-256 HMAC, secret key from the given parameters.
*
* @param password <PASSWORD>
* @param salt salt
* @param rounds rounds/permutations
* @return an instance
* @throws Exception when unable to make an instance
*/
public SecretKey createSecretKey(char[] password, byte[] salt, int rounds) throws Exception
{
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(SECRET_KEY_TYPE);
KeySpec keySpec = new PBEKeySpec(password, salt, rounds, KEY_LENGTH);
SecretKey tmp = secretKeyFactory.generateSecret(keySpec);
SecretKey secretKey = new SecretKeySpec(tmp.getEncoded(), "AES");
return secretKey;
}
}
| 2,044 | 0.680215 | 0.67238 | 70 | 28.171429 | 26.366089 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.442857 | false | false | 8 |
20b59dd6f5d0b5268d4c7cce79c5087d7867a16a | 15,341,623,187,848 | fcc14d635c003d0a9d275628e6be34a88b50b6db | /src/main/java/com/json/node/JudgeNode.java | 7f4c821cf56e011a0a4a7ee6b110d9673c313d82 | []
| no_license | sheldonfa/javaTest | https://github.com/sheldonfa/javaTest | aeeb7ddb6163b1cac45f3b0a494ab08c50ef1af2 | a478ed86d9b76038b1abf644800afbb99e45814c | refs/heads/master | 2020-12-24T09:23:00.083000 | 2017-06-13T07:16:22 | 2017-06-13T07:16:22 | 73,296,559 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.json.node;
import com.json.flow.FlowEntity;
import com.json.line.Line;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fangxin
* @date 2017/6/6.
*/
public class JudgeNode extends Node {
// 上级line
private Line fromLine;
// 下级lines
private List<Line> toLines;
public Map<String,Node> getNext(Node node, FlowEntity flowEntity) {
Map<String, Node> map = new HashMap<>();
List<Line> toLines = this.getToLines();
Line fromLine = this.getFromLine();
OperaNode fromNode = (OperaNode) flowEntity.getNodes().get(fromLine.getFromNode());
Integer count = fromNode.getCount();
for(Line line: toLines){
// 判断符合判断的路径
if(line.getCondition().getValue().equals(count)){
map.put(line.getToNode(), flowEntity.getNodes().get(line.getToNode()));
}
}
return map;
}
}
| UTF-8 | Java | 967 | java | JudgeNode.java | Java | [
{
"context": "a.util.List;\nimport java.util.Map;\n\n/**\n * @author fangxin\n * @date 2017/6/6.\n */\npublic class JudgeNode ext",
"end": 179,
"score": 0.9986719489097595,
"start": 172,
"tag": "USERNAME",
"value": "fangxin"
}
]
| null | []
| package com.json.node;
import com.json.flow.FlowEntity;
import com.json.line.Line;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fangxin
* @date 2017/6/6.
*/
public class JudgeNode extends Node {
// 上级line
private Line fromLine;
// 下级lines
private List<Line> toLines;
public Map<String,Node> getNext(Node node, FlowEntity flowEntity) {
Map<String, Node> map = new HashMap<>();
List<Line> toLines = this.getToLines();
Line fromLine = this.getFromLine();
OperaNode fromNode = (OperaNode) flowEntity.getNodes().get(fromLine.getFromNode());
Integer count = fromNode.getCount();
for(Line line: toLines){
// 判断符合判断的路径
if(line.getCondition().getValue().equals(count)){
map.put(line.getToNode(), flowEntity.getNodes().get(line.getToNode()));
}
}
return map;
}
}
| 967 | 0.622742 | 0.616366 | 35 | 25.885714 | 23.58301 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false | 8 |
6123e5ff46514524a3bdaf77a492997bfd18b47d | 68,719,478,516 | 0ac5f345f5fae860dcde038ad69fa600134cda56 | /BlackJack_app/src/Game.java | 9990e028ab7660e0b42ed2f862465cad984da5d2 | []
| no_license | salarenko/BlackJack | https://github.com/salarenko/BlackJack | 47ec9cc9bca54cbbf0c1e7ef78e5f5909ec06c41 | 25ddd8bed963cae10f805e34f31bcdb804f75a58 | refs/heads/master | 2021-01-21T20:47:12.327000 | 2017-05-24T10:36:11 | 2017-05-24T10:36:11 | 92,280,559 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import Basic.deck;
import Middle.Croupier;
import Middle.Player;
/**
* Created by msala on 19-Mar-17.
*/
public class Game {
public Game(int player_money) {
_croupier = new Croupier();
_player = new Player(player_money);
_deck = new deck();
}
public Player _player;
public Croupier _croupier;
public deck _deck;
public void setup_game(){
_croupier.restart();
_player.restart();
_deck.generate_stack();
_deck.shuffle_cards();
_player.get_card(_deck.get_card());
_deck.remove();
_player.get_card(_deck.get_card());
_deck.remove();
_croupier.get_card(_deck.get_card());
_deck.remove();
_croupier.set_hidden_card(_deck.get_card());
_deck.remove();
_player.manage_money(0,10); //Pay 10 to join game
}
}
| UTF-8 | Java | 865 | java | Game.java | Java | [
{
"context": "Croupier;\nimport Middle.Player;\n\n/**\n * Created by msala on 19-Mar-17.\n */\npublic class Game {\n public ",
"end": 89,
"score": 0.9996238946914673,
"start": 84,
"tag": "USERNAME",
"value": "msala"
}
]
| null | []
| import Basic.deck;
import Middle.Croupier;
import Middle.Player;
/**
* Created by msala on 19-Mar-17.
*/
public class Game {
public Game(int player_money) {
_croupier = new Croupier();
_player = new Player(player_money);
_deck = new deck();
}
public Player _player;
public Croupier _croupier;
public deck _deck;
public void setup_game(){
_croupier.restart();
_player.restart();
_deck.generate_stack();
_deck.shuffle_cards();
_player.get_card(_deck.get_card());
_deck.remove();
_player.get_card(_deck.get_card());
_deck.remove();
_croupier.get_card(_deck.get_card());
_deck.remove();
_croupier.set_hidden_card(_deck.get_card());
_deck.remove();
_player.manage_money(0,10); //Pay 10 to join game
}
}
| 865 | 0.56185 | 0.551445 | 32 | 26.03125 | 14.944657 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.71875 | false | false | 8 |
7f9c12293aa08d9404a334e21485874cd912587c | 4,243,427,695,464 | e185d310aa5c5dc797aa43fdee0330bb97d4fced | /src/week1/day2/Exercise9.java | 2b5ca715b5f312b20ab4a067c7b52a6e56b4873d | []
| no_license | Ligit2/bootcamp | https://github.com/Ligit2/bootcamp | e38f8cb5634c7f4bc554e122d2e81f13b1699121 | 2fc772146e791509004a9996cb12f77c44e59af4 | refs/heads/master | 2023-06-02T19:01:54.466000 | 2021-06-28T09:00:47 | 2021-06-28T09:00:47 | 379,973,047 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package week1.day2;
import java.util.Scanner;
//Given arithmetic sequence Sn = 3n*n - 12n
//print the sum S10
//print the sum S15
public class Exercise9 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int Sum = 3*10*10-12*10;
System.out.println(Sum);
Sum = 3*15*15-12*15;
System.out.println(Sum);
}
}
| UTF-8 | Java | 389 | java | Exercise9.java | Java | []
| null | []
| package week1.day2;
import java.util.Scanner;
//Given arithmetic sequence Sn = 3n*n - 12n
//print the sum S10
//print the sum S15
public class Exercise9 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int Sum = 3*10*10-12*10;
System.out.println(Sum);
Sum = 3*15*15-12*15;
System.out.println(Sum);
}
}
| 389 | 0.624679 | 0.552699 | 16 | 23.3125 | 15.295909 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 8 |
56a0c29f8e285e803a82a30e27223b2ac9cfc40b | 30,193,620,092,443 | 3370c7dc40dbc3c59f90ef72b06e191900473e10 | /nico-noaoc/src/main/java/org/nico/aoc/scan/annotations/Label.java | 3c7795f3dda83d70daf79116cdf5640a99789cba | [
"Apache-2.0"
]
| permissive | ainilili/no-framework | https://github.com/ainilili/no-framework | ef024dfaa8f1c5402229b25f1b382e3681161cc0 | 44a56dc1b885d9e3293e910df68392b3bf95e7c3 | refs/heads/master | 2020-03-21T10:22:59.742000 | 2018-10-16T11:50:35 | 2018-10-16T11:50:35 | 138,448,244 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.nico.aoc.scan.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.nico.aoc.scan.entity.LabelType;
/**
* Representing this property is an injection property.
*
* @author nico
* @version createTime:2018年1月21日 下午2:10:49
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Label {
LabelType type() default LabelType.BYALL;
String name() default "";
}
| UTF-8 | Java | 603 | java | Label.java | Java | [
{
"context": " property is an injection property.\n * \n * @author nico\n * @version createTime:2018年1月21日 下午2:10:49\n */\n@",
"end": 365,
"score": 0.9992467164993286,
"start": 361,
"tag": "USERNAME",
"value": "nico"
}
]
| null | []
| package org.nico.aoc.scan.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.nico.aoc.scan.entity.LabelType;
/**
* Representing this property is an injection property.
*
* @author nico
* @version createTime:2018年1月21日 下午2:10:49
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Label {
LabelType type() default LabelType.BYALL;
String name() default "";
}
| 603 | 0.77665 | 0.756345 | 25 | 22.639999 | 18.277594 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48 | false | false | 8 |
9cc36efa080ae717dba01d7adab2b1e039640dbe | 30,734,785,977,813 | c4ea8881adb266aed6e5ae772bcaa9f5fc84e6b1 | /app/src/main/java/com/example/ncyu/login/visitor_choose_test.java | 71bfefb4a27e281c4ac541f4c7780b76bae62aff | []
| no_license | EJmushroom/dementia | https://github.com/EJmushroom/dementia | b34b590f583a2c2622fcf57d487193c1939a9b4b | 7d60b7ec73a9d09cf5dcb9e806a8db343af8f049 | refs/heads/master | 2020-04-21T23:06:32.189000 | 2019-06-24T15:18:15 | 2019-06-24T15:18:15 | 169,935,240 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.ncyu.login;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.ncyu.login.mDataObject.scale;
import com.example.ncyu.login.mListView.CustomAdapter;
import com.example.ncyu.login.mMySQL.Downloader;
import com.example.ncyu.login.MyDBHelper;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
public class visitor_choose_test extends AppCompatActivity{
String urlAddress="http://ej30827.000webhostapp.com/scale_select.php";
ListView lv_visitor_test;
Button btn_Vstart,btn_Vcancel;
int whichScale=-1;
String StartTime;
private SQLiteDatabase db;
private MyDBHelper dbHelper;
Cursor c;
boolean skipMessage;
AlertDialog.Builder alert;
public CheckBox dontShowAgain;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_visitor_choose_test);
lv_visitor_test=(ListView)findViewById(R.id.lv_visitor_test);
btn_Vstart=(Button)findViewById(R.id.btn_Vstart);
btn_Vcancel=(Button)findViewById(R.id.btn_Vcancel);
Downloader d=new Downloader(visitor_choose_test.this,urlAddress,lv_visitor_test);
d.execute();
//建立SQLiteOpenHelper 物件
dbHelper = new MyDBHelper(this);
db = dbHelper.getWritableDatabase();//開啟資料庫
dbHelper.onCreate(db);
//db.execSQL("DROP TABLE IF EXISTS moca");
// 宣告對話框
CKDiagbox();
// 如果沒有勾選"不再顯示",則顯示對話框 !isCheckboxStateEnabled()
if (!isCheckboxStateEnabled()) {
alert.show();
}
//按下開始測驗後
btn_Vstart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CustomAdapter test=new CustomAdapter();
whichScale=test.getI()+1;
if(whichScale>=1 && whichScale<=5) {
//取得開始測驗時間
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
Calendar c = Calendar.getInstance();
StartTime = df.format(c.getTime());
ContentValues cv = new ContentValues();
cv.put("scaleID", whichScale);
cv.put("start_test_time", StartTime);
long testID = db.insert("test", null, cv);
Toast.makeText(visitor_choose_test.this, "量表編號:"+ toString().valueOf(testID), Toast.LENGTH_SHORT).show();
if (whichScale == 1) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, ad8.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
} else if (whichScale == 2) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, cdr.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
} else if (whichScale == 3) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, mmse.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
}
else if (whichScale == 4) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, moca.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
}
else if (whichScale == 5) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, npiq1.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
}
}
else {
Toast.makeText(visitor_choose_test.this, "請先選擇量表種類!", Toast.LENGTH_SHORT).show();
}
}
});
//按下取消按鈕後
btn_Vcancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(visitor_choose_test.this,visitor_function.class));
visitor_choose_test.this.finish();
}
});
}
public void CKDiagbox() {
alert = new AlertDialog.Builder(this);
LayoutInflater adbInflater = LayoutInflater.from(this);
View checkboxLayout = adbInflater.inflate(R.layout.checkbox, null);
dontShowAgain = (CheckBox) checkboxLayout.findViewById(R.id.skip);
alert.setView(checkboxLayout);
alert.setIcon(R.drawable.information);
alert.setTitle(R.string.settitle);
alert.setIcon(android.R.drawable.ic_dialog_alert);
alert.setMessage(R.string.advise);
alert.setPositiveButton("確定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
boolean checkBoxResult = false;
if (dontShowAgain.isChecked()) {
checkBoxResult = true;
}
setCheckboxState(checkBoxResult);
// 關閉對話框
// finish();
}
});
}
public void setCheckboxState(boolean chk) {
// 記錄勾選方塊是否被打勾
SharedPreferences settings = getSharedPreferences("visitor_showit", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("visitor_skipMessage", chk);
editor.commit();
}
public boolean isCheckboxStateEnabled() {
// 讀取勾選方塊是否被打勾,預設值是未打勾(fasle)
SharedPreferences settings = getSharedPreferences("visitor_showit", 0);
skipMessage = settings.getBoolean("visitor_skipMessage", false);
return skipMessage;
}
//返回鍵
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
{
String[] column={"_id","frequency"};
c = dbHelper.getReadableDatabase().query("guest", column, "_id = 1", null, null, null, null);
c.moveToFirst();
//訪客已有經驗
Intent in;
if(c.getInt(1)==1) {
//new一個intent物件,並指定Activity切換的class
in = new Intent(visitor_choose_test.this, visitor_function.class);
}
else {
in = new Intent(visitor_choose_test.this, visitor_question.class);
}
startActivity(in);
visitor_choose_test.this.finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
| UTF-8 | Java | 10,312 | java | visitor_choose_test.java | Java | []
| null | []
| package com.example.ncyu.login;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.ncyu.login.mDataObject.scale;
import com.example.ncyu.login.mListView.CustomAdapter;
import com.example.ncyu.login.mMySQL.Downloader;
import com.example.ncyu.login.MyDBHelper;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
public class visitor_choose_test extends AppCompatActivity{
String urlAddress="http://ej30827.000webhostapp.com/scale_select.php";
ListView lv_visitor_test;
Button btn_Vstart,btn_Vcancel;
int whichScale=-1;
String StartTime;
private SQLiteDatabase db;
private MyDBHelper dbHelper;
Cursor c;
boolean skipMessage;
AlertDialog.Builder alert;
public CheckBox dontShowAgain;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_visitor_choose_test);
lv_visitor_test=(ListView)findViewById(R.id.lv_visitor_test);
btn_Vstart=(Button)findViewById(R.id.btn_Vstart);
btn_Vcancel=(Button)findViewById(R.id.btn_Vcancel);
Downloader d=new Downloader(visitor_choose_test.this,urlAddress,lv_visitor_test);
d.execute();
//建立SQLiteOpenHelper 物件
dbHelper = new MyDBHelper(this);
db = dbHelper.getWritableDatabase();//開啟資料庫
dbHelper.onCreate(db);
//db.execSQL("DROP TABLE IF EXISTS moca");
// 宣告對話框
CKDiagbox();
// 如果沒有勾選"不再顯示",則顯示對話框 !isCheckboxStateEnabled()
if (!isCheckboxStateEnabled()) {
alert.show();
}
//按下開始測驗後
btn_Vstart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CustomAdapter test=new CustomAdapter();
whichScale=test.getI()+1;
if(whichScale>=1 && whichScale<=5) {
//取得開始測驗時間
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
Calendar c = Calendar.getInstance();
StartTime = df.format(c.getTime());
ContentValues cv = new ContentValues();
cv.put("scaleID", whichScale);
cv.put("start_test_time", StartTime);
long testID = db.insert("test", null, cv);
Toast.makeText(visitor_choose_test.this, "量表編號:"+ toString().valueOf(testID), Toast.LENGTH_SHORT).show();
if (whichScale == 1) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, ad8.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
} else if (whichScale == 2) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, cdr.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
} else if (whichScale == 3) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, mmse.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
}
else if (whichScale == 4) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, moca.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
}
else if (whichScale == 5) {
//new一個intent物件,並指定Activity切換的class
Intent in = new Intent(visitor_choose_test.this, npiq1.class);
//new一個Bundle物件,並將要傳遞的資料傳入
Bundle bundle = new Bundle();
bundle.putString("identity", "guest");
bundle.putString("testID", toString().valueOf(testID));
//將Bundle物件assign給intent
in.putExtras(bundle);
startActivity(in);
//歸零
test.setI(-1);
visitor_choose_test.this.finish();
}
}
else {
Toast.makeText(visitor_choose_test.this, "請先選擇量表種類!", Toast.LENGTH_SHORT).show();
}
}
});
//按下取消按鈕後
btn_Vcancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(visitor_choose_test.this,visitor_function.class));
visitor_choose_test.this.finish();
}
});
}
public void CKDiagbox() {
alert = new AlertDialog.Builder(this);
LayoutInflater adbInflater = LayoutInflater.from(this);
View checkboxLayout = adbInflater.inflate(R.layout.checkbox, null);
dontShowAgain = (CheckBox) checkboxLayout.findViewById(R.id.skip);
alert.setView(checkboxLayout);
alert.setIcon(R.drawable.information);
alert.setTitle(R.string.settitle);
alert.setIcon(android.R.drawable.ic_dialog_alert);
alert.setMessage(R.string.advise);
alert.setPositiveButton("確定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
boolean checkBoxResult = false;
if (dontShowAgain.isChecked()) {
checkBoxResult = true;
}
setCheckboxState(checkBoxResult);
// 關閉對話框
// finish();
}
});
}
public void setCheckboxState(boolean chk) {
// 記錄勾選方塊是否被打勾
SharedPreferences settings = getSharedPreferences("visitor_showit", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("visitor_skipMessage", chk);
editor.commit();
}
public boolean isCheckboxStateEnabled() {
// 讀取勾選方塊是否被打勾,預設值是未打勾(fasle)
SharedPreferences settings = getSharedPreferences("visitor_showit", 0);
skipMessage = settings.getBoolean("visitor_skipMessage", false);
return skipMessage;
}
//返回鍵
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
{
String[] column={"_id","frequency"};
c = dbHelper.getReadableDatabase().query("guest", column, "_id = 1", null, null, null, null);
c.moveToFirst();
//訪客已有經驗
Intent in;
if(c.getInt(1)==1) {
//new一個intent物件,並指定Activity切換的class
in = new Intent(visitor_choose_test.this, visitor_function.class);
}
else {
in = new Intent(visitor_choose_test.this, visitor_question.class);
}
startActivity(in);
visitor_choose_test.this.finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
| 10,312 | 0.547692 | 0.54441 | 253 | 37.537548 | 24.990345 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.735178 | false | false | 8 |
caa446510557aeb3783f88669078fb1cdffc762c | 31,001,073,950,846 | 71c244860b94338891aa147b68b1a4b14bc31a15 | /ArrayList类实现/src/Main.java | 9bb3b46b5c83fe1605c698bec4333330584d7743 | []
| no_license | KronosOceanus/algorithm | https://github.com/KronosOceanus/algorithm | ab7ca3793ec007a0c8f5a22a110d2fa85ef24929 | 24595b9d88407ec7384a4b6efa78bf9285a8e323 | refs/heads/master | 2021-08-19T15:48:31.766000 | 2021-07-06T23:36:14 | 2021-07-06T23:36:14 | 189,804,070 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ListIterator;
public class Main {
public static void main(String[] args) {
MyArrayList<Integer> list = new MyArrayList<>();
for (int i=0;i<10;i++){
list.add(i);
}
System.out.println("长度====" + list.size());
System.out.println("是否为空====" + list.isEmpty());
//容量测试
for (int i=10;i<100;i++){
list.add(i);
}
list.ensureCapacity(150);
list.remove(98);
list.trimToSize();
System.out.println("扩容之后====");
for (int i=0;i<list.size();i++){
System.out.print(list.get(i) + "\t");
}
System.out.println();
//迭代器测试
ListIterator<Integer> iterator = list.iterator();
int i=0;
System.out.println("迭代器迭代====");
while(iterator.hasNext()){
i++;
System.out.print(iterator.next() + "\t");
if (i == 5){
System.out.println("====迭代器添加50====");
iterator.add(50);
System.out.print("====访问前一个元素(再设置为25)==== ");
System.out.println(iterator.previous());
iterator.set(25);
/** 迭代器失效,抛出异常
iterator.remove();
*/
}
}
}
}
| UTF-8 | Java | 1,407 | java | Main.java | Java | []
| null | []
| import java.util.ListIterator;
public class Main {
public static void main(String[] args) {
MyArrayList<Integer> list = new MyArrayList<>();
for (int i=0;i<10;i++){
list.add(i);
}
System.out.println("长度====" + list.size());
System.out.println("是否为空====" + list.isEmpty());
//容量测试
for (int i=10;i<100;i++){
list.add(i);
}
list.ensureCapacity(150);
list.remove(98);
list.trimToSize();
System.out.println("扩容之后====");
for (int i=0;i<list.size();i++){
System.out.print(list.get(i) + "\t");
}
System.out.println();
//迭代器测试
ListIterator<Integer> iterator = list.iterator();
int i=0;
System.out.println("迭代器迭代====");
while(iterator.hasNext()){
i++;
System.out.print(iterator.next() + "\t");
if (i == 5){
System.out.println("====迭代器添加50====");
iterator.add(50);
System.out.print("====访问前一个元素(再设置为25)==== ");
System.out.println(iterator.previous());
iterator.set(25);
/** 迭代器失效,抛出异常
iterator.remove();
*/
}
}
}
}
| 1,407 | 0.450499 | 0.43208 | 50 | 25.059999 | 18.971991 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.58 | false | false | 8 |
1b92661e249eb8ca82cb0b1f697f37e49fa868a5 | 1,090,921,703,231 | 66aad9f921ae195d51bd3f71d5267a69ed4d063a | /fpcms/util/src/main/java/com/fpcms/common/random_gen_article/RandomArticle.java | 48287fc03dd0c06a5b14fc35c4778205924ee8d8 | []
| no_license | carriercomm/fpcms | https://github.com/carriercomm/fpcms | 9d0a2559accdb19ffbbc2c2cb0fc6923e760c797 | cee2b51287943898bf29a196e8b15297e0d0a779 | refs/heads/master | 2021-01-18T18:57:14.384000 | 2015-12-01T01:53:43 | 2015-12-01T01:53:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fpcms.common.random_gen_article;
import java.util.Date;
/**
* 代表随机生成的一篇文章
*
* @author badqiu
*
*/
public class RandomArticle {
private String keyword;
private String faipiaoKeyword;
private String finalSearchKeyword;
private String content;
private String perfectKeyword; //推荐使用的keyword
private Date dateCreated;
public RandomArticle() {
}
public RandomArticle(String keyword, String faipiaoKeyword,
String finalSearchKeyword, String content) {
super();
this.keyword = keyword;
this.faipiaoKeyword = faipiaoKeyword;
this.finalSearchKeyword = finalSearchKeyword;
this.content = content;
dateCreated = new Date();
}
public String getPerfectKeyword() {
return perfectKeyword;
}
public void setPerfectKeyword(String perfectKeyword) {
this.perfectKeyword = perfectKeyword;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getFaipiaoKeyword() {
return faipiaoKeyword;
}
public void setFaipiaoKeyword(String faipiaoKeyword) {
this.faipiaoKeyword = faipiaoKeyword;
}
public String getFinalSearchKeyword() {
return finalSearchKeyword;
}
public void setFinalSearchKeyword(String finalSearchKeyword) {
this.finalSearchKeyword = finalSearchKeyword;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
@Override
public String toString() {
return "RandomArticle [keyword=" + keyword + ", faipiaoKeyword="
+ faipiaoKeyword + ", finalSearchKeyword=" + finalSearchKeyword
+ ", content=" + content + "]";
}
} | UTF-8 | Java | 1,826 | java | RandomArticle.java | Java | [
{
"context": "java.util.Date;\n\n/**\n * 代表随机生成的一篇文章\n * \n * @author badqiu\n * \n */\npublic class RandomArticle {\n\tprivate Str",
"end": 110,
"score": 0.9995434880256653,
"start": 104,
"tag": "USERNAME",
"value": "badqiu"
}
]
| null | []
| package com.fpcms.common.random_gen_article;
import java.util.Date;
/**
* 代表随机生成的一篇文章
*
* @author badqiu
*
*/
public class RandomArticle {
private String keyword;
private String faipiaoKeyword;
private String finalSearchKeyword;
private String content;
private String perfectKeyword; //推荐使用的keyword
private Date dateCreated;
public RandomArticle() {
}
public RandomArticle(String keyword, String faipiaoKeyword,
String finalSearchKeyword, String content) {
super();
this.keyword = keyword;
this.faipiaoKeyword = faipiaoKeyword;
this.finalSearchKeyword = finalSearchKeyword;
this.content = content;
dateCreated = new Date();
}
public String getPerfectKeyword() {
return perfectKeyword;
}
public void setPerfectKeyword(String perfectKeyword) {
this.perfectKeyword = perfectKeyword;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getFaipiaoKeyword() {
return faipiaoKeyword;
}
public void setFaipiaoKeyword(String faipiaoKeyword) {
this.faipiaoKeyword = faipiaoKeyword;
}
public String getFinalSearchKeyword() {
return finalSearchKeyword;
}
public void setFinalSearchKeyword(String finalSearchKeyword) {
this.finalSearchKeyword = finalSearchKeyword;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
@Override
public String toString() {
return "RandomArticle [keyword=" + keyword + ", faipiaoKeyword="
+ faipiaoKeyword + ", finalSearchKeyword=" + finalSearchKeyword
+ ", content=" + content + "]";
}
} | 1,826 | 0.738573 | 0.738573 | 87 | 19.632183 | 19.327257 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.390805 | false | false | 8 |
fcef0b357e06f780b52960580b3a78470ab4fe5c | 11,665,131,190,216 | dc466145017005d276dde87e25917cc7114ddb98 | /mysplid-spider/src/main/java/com/test/json/group/JsonGroup.java | 8ae292c1e82458c9fbbbe6409d9376f628aaa898 | []
| no_license | HackQsxj/MySpider-Java | https://github.com/HackQsxj/MySpider-Java | 1cc3c7a4d06f795838eaf19b8ba751b651533dae | 354e41e21bb212fab6c697dc48ab2f0bfe509d9a | refs/heads/master | 2022-12-21T16:00:31.104000 | 2020-05-06T12:56:20 | 2020-05-06T12:56:20 | 222,871,009 | 1 | 1 | null | false | 2022-12-16T07:15:54 | 2019-11-20T06:54:02 | 2021-07-29T20:51:41 | 2022-12-16T07:15:51 | 69 | 1 | 0 | 10 | Java | false | false | package com.test.json.group;
/**
* @author zc
* 得到微群的基本信息列表
*/
public class JsonGroup {
private String code;//返回码 10000时正常
private Data data;//数据信息
private String msg;//返回的消息值 :操作成功时表示成功获取
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
| UTF-8 | Java | 579 | java | JsonGroup.java | Java | [
{
"context": "package com.test.json.group;\n/**\n * @author zc\n * 得到微群的基本信息列表\n */\npublic class JsonGroup {\n\tpriv",
"end": 46,
"score": 0.9996246695518494,
"start": 44,
"tag": "USERNAME",
"value": "zc"
}
]
| null | []
| package com.test.json.group;
/**
* @author zc
* 得到微群的基本信息列表
*/
public class JsonGroup {
private String code;//返回码 10000时正常
private Data data;//数据信息
private String msg;//返回的消息值 :操作成功时表示成功获取
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
| 579 | 0.670659 | 0.660679 | 29 | 16.275862 | 12.414943 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.310345 | false | false | 8 |
e03272bd73fdb3e6e59149ffe7f7c11bbaad8ef3 | 24,627,342,488,912 | 150a5debca4e84a3b47834c5b3c548b67f6ac4c0 | /PetClinic/src/main/java/com/qa/pet/PetClinicHomepage.java | 24b957ad5002154a7eba3ceb94b81cfff2a8844e | []
| no_license | emallsop/AdvancedAutomationTestingAssessment | https://github.com/emallsop/AdvancedAutomationTestingAssessment | 9777aeb0033623adb45ab0194c2bef12614a15f9 | 7c3b75180b03f2c41759a51f301bff7fb340a84f | refs/heads/master | 2020-04-02T18:20:31.779000 | 2018-10-25T15:50:54 | 2018-10-25T15:50:54 | 154,696,487 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qa.pet;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class PetClinicHomepage {
@FindBy(xpath = "/html/body/app-root/app-welcome/h1")
private WebElement welcome;
@FindBy(xpath = "/html/body/app-root/div[1]/nav/div/ul/li[2]/a")
private WebElement ownersButton;
@FindBy(xpath = "/html/body/app-root/div[1]/nav/div/ul/li[2]/ul/li[2]/a")
private WebElement newOwnerButton;
public WebElement getWelcome() {
return welcome;
}
public WebElement ownersButton() {
return ownersButton;
}
public WebElement newOwnerButton() {
return newOwnerButton;
}
}
| UTF-8 | Java | 633 | java | PetClinicHomepage.java | Java | []
| null | []
| package com.qa.pet;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class PetClinicHomepage {
@FindBy(xpath = "/html/body/app-root/app-welcome/h1")
private WebElement welcome;
@FindBy(xpath = "/html/body/app-root/div[1]/nav/div/ul/li[2]/a")
private WebElement ownersButton;
@FindBy(xpath = "/html/body/app-root/div[1]/nav/div/ul/li[2]/ul/li[2]/a")
private WebElement newOwnerButton;
public WebElement getWelcome() {
return welcome;
}
public WebElement ownersButton() {
return ownersButton;
}
public WebElement newOwnerButton() {
return newOwnerButton;
}
}
| 633 | 0.723539 | 0.71406 | 31 | 19.419355 | 20.998884 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.096774 | false | false | 8 |
a46ec7bb9e26292b31fd21c8bfa6df60dbea9c6f | 29,102,698,410,035 | 596c17d27c97c8bd0e7f0b0955c10743b602da2f | /Assignment1.notepad/Assignment1.java | 908d0af05d0af5173086926a7224496b0ed76134 | []
| no_license | kyungah1230/Assignment1. | https://github.com/kyungah1230/Assignment1. | a819c0c86a5a48a63a409ae8ac3631e187e3f2e4 | 0af577767b5137191bdf90381058e94c0cb9a5cd | refs/heads/master | 2020-04-05T22:52:49.224000 | 2014-09-10T19:19:50 | 2014-09-10T19:19:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class Assignment1 {
public static void main(String[] args) {
double weight;
double height;
double age;
int Man;
int Woman;
//Prompt the user for weight, height, and age.
System.out.println("Enter weight in pounds");
Scanner wt=new Scanner(System.in);
weight=wt.nextInt();
System.out.println("Enter height in inches");
Scanner ht=new Scanner(System.in);
height=ht.nextInt();
System.out.println("Enter age");
Scanner ag=new Scanner(System.in);
age=ag.nextInt();
//Calculate the BMP for both men and women and divide by 230.
Man= (int)(66+(6.3*weight)+(12.9*height)-(6.8 * age))/230;
Woman = (int)(655 + (4.3 * weight) + (4.7 * height) - (4.7 * age))/230;
System.out.println("If you are a woman, you should eat "+Woman+
" chocolate bars to maintain your weight."+"\nIf you are a man, you should eat "
+Man +" chocolate bars to maintain your weight.");
}
} | UTF-8 | Java | 954 | java | Assignment1.java | Java | []
| null | []
|
import java.util.Scanner;
public class Assignment1 {
public static void main(String[] args) {
double weight;
double height;
double age;
int Man;
int Woman;
//Prompt the user for weight, height, and age.
System.out.println("Enter weight in pounds");
Scanner wt=new Scanner(System.in);
weight=wt.nextInt();
System.out.println("Enter height in inches");
Scanner ht=new Scanner(System.in);
height=ht.nextInt();
System.out.println("Enter age");
Scanner ag=new Scanner(System.in);
age=ag.nextInt();
//Calculate the BMP for both men and women and divide by 230.
Man= (int)(66+(6.3*weight)+(12.9*height)-(6.8 * age))/230;
Woman = (int)(655 + (4.3 * weight) + (4.7 * height) - (4.7 * age))/230;
System.out.println("If you are a woman, you should eat "+Woman+
" chocolate bars to maintain your weight."+"\nIf you are a man, you should eat "
+Man +" chocolate bars to maintain your weight.");
}
} | 954 | 0.657233 | 0.627883 | 35 | 26.228571 | 23.930956 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.285714 | false | false | 8 |
4400d44dda56b79a5f218f08f3202066a18331ae | 2,405,181,696,489 | 98c1c4513332f16c44f7f03ebd659982ae4dc7d4 | /fruitmall-biz/src/main/java/com/xzy/fruitmall/biz/CityService.java | 902575a31d153354be9a563577ef76a4a0ff9ceb | []
| no_license | bbbyxxx/sgg | https://github.com/bbbyxxx/sgg | bbedf82c2ec95968ac0b3d9ef8ea9f13e30db097 | 4460e1348e7d3ee6832d5ed22a18107f15364c9f | refs/heads/master | 2022-07-01T22:54:41.444000 | 2020-02-19T08:45:16 | 2020-02-19T08:45:16 | 241,569,556 | 0 | 0 | null | false | 2022-06-17T02:55:10 | 2020-02-19T08:26:09 | 2020-02-19T08:45:24 | 2022-06-17T02:55:10 | 203 | 0 | 0 | 1 | Java | false | false | package com.xzy.fruitmall.biz;
import com.xzy.fruitmall.entity.CityInfo;
import java.util.List;
public interface CityService {
List<CityInfo> findCitiesById(int provinceId);
}
| UTF-8 | Java | 183 | java | CityService.java | Java | []
| null | []
| package com.xzy.fruitmall.biz;
import com.xzy.fruitmall.entity.CityInfo;
import java.util.List;
public interface CityService {
List<CityInfo> findCitiesById(int provinceId);
}
| 183 | 0.781421 | 0.781421 | 9 | 19.333334 | 18.565201 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 8 |
c0d3c2cb7533006ed948e8c12205f5c503840799 | 6,957,847,037,597 | ead5a617b23c541865a6b57cf8cffcc1137352f2 | /decompiled/sources/org/p153a/C3682b.java | af493e1d296e35193dff490b4fc2763e1d28c5af | []
| no_license | erred/uva-ssn | https://github.com/erred/uva-ssn | 73a6392a096b38c092482113e322fdbf9c3c4c0e | 4fb8ea447766a735289b96e2510f5a8d93345a8c | refs/heads/master | 2022-02-26T20:52:50.515000 | 2019-10-14T12:30:33 | 2019-10-14T12:30:33 | 210,376,140 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.p153a;
/* renamed from: org.a.b */
/* compiled from: Publisher */
public interface C3682b<T> {
/* renamed from: a */
void mo538a(C3683c<? super T> cVar);
}
| UTF-8 | Java | 177 | java | C3682b.java | Java | []
| null | []
| package org.p153a;
/* renamed from: org.a.b */
/* compiled from: Publisher */
public interface C3682b<T> {
/* renamed from: a */
void mo538a(C3683c<? super T> cVar);
}
| 177 | 0.632768 | 0.553672 | 8 | 21.125 | 13.195051 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 8 |
21c503338d15d4889cfaa1c160f400b8f03cce59 | 19,602,230,763,696 | b23873245c4e69df4ad7f4e5ddcad19ba9236046 | /Chain/src/GUI/ceoPanel.java | 46569daaf3e1c6f8674a292dd258f9c367b1a1f9 | []
| no_license | salimtop/chain-store-management-system | https://github.com/salimtop/chain-store-management-system | f2d8596ca87c21e949378a94f2bb78bc9d81a185 | 50a879479050108bab152597d11bdb37ee689492 | refs/heads/master | 2022-11-21T07:47:40.825000 | 2020-07-14T09:02:25 | 2020-07-14T09:02:25 | 276,670,008 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GUI;
import GUI.login;
import chainmanagement.Employee;
import chainmanagement.Message;
import chainmanagement.Store;
import java.awt.Color;
import java.awt.Component;
import static java.awt.event.MouseEvent.BUTTON1;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import org.jdesktop.swingx.border.DropShadowBorder;
/*
* 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.
*/
/**
*
* @author ACK
*/
public class ceoPanel extends javax.swing.JFrame {
/**
* Creates new form ceoPanel
*/
Employee infoPerson=new Employee();
Employee firePerson=new Employee();
Employee ceo;
ArrayList<Employee> sv=new ArrayList<>();
ArrayList<Employee> all= new ArrayList<>();
ArrayList<Store> allStore= new ArrayList<>();
Store refStore=new Store();
ArrayList<Message> myMess = new ArrayList<>();
Timer timer1 = new Timer();
Timer timer2 = new Timer();
Timer timer3 = new Timer();
Timer slideTimer1 = new Timer();
Timer slideTimer2 = new Timer();
boolean in;
boolean clicked;
boolean new_message;
boolean inbox_bool;
boolean market_bool;
boolean sv_bool;
boolean info_bool = true;
public ceoPanel(Employee e) {
initComponents();
infoPerson=e;
ceo = e;
messTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
svTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//jTable3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//inbox_init();
jLabel16.setVisible(false);
fireRes.setVisible(false);
//addResult.setVisible(false);
pos_info.setForeground(new Color(255,204,51));
setBackground(new Color(0,0,0,0));
jPanel1.setBackground(new Color(0,0,0,0));
DropShadowBorder shadow = new DropShadowBorder();
shadow.setShadowColor(Color.BLACK);
shadow.setShowLeftShadow(true);
shadow.setShowRightShadow(true);
shadow.setShowBottomShadow(true);
shadow.setShowTopShadow(true);
shadow.setShadowSize(6);
jPanel1.setBorder(shadow);
fillInfo();
}
private void fillInfo(){
svfireid.addItem("NONE");
myMess = Message.getAll_Messages(infoPerson.getId());
allStore=refStore.getAll();
all=infoPerson.getAll();
for(int i=0;i<all.size();i++){
if(all.get(i).getId()!=infoPerson.getId() && all.get(i).getStatus().equalsIgnoreCase("sv")){
sv.add(all.get(i));
svfireid.addItem(all.get(i).getId()+"");
}
}
/*addName.setText("");
addSName.setText("");
addPlace.setText("");
addSalary.setText("");*/
ceoID.setText(infoPerson.getId()+"");
ceoName.setText(infoPerson.getName());
ceoSName.setText(infoPerson.getSurname());
ceoStart.setText(infoPerson.getStarting());
ceoSalary.setText(infoPerson.getSalary()+"");
DefaultTableModel svlist=(DefaultTableModel)svTable.getModel();
for(int i=0;i<sv.size();i++){
svlist.addRow(new Object[]{sv.get(i).getId(),
sv.get(i).getName(),
sv.get(i).getSurname()});
}
DefaultTableModel messList = (DefaultTableModel)messTable.getModel();
for (int i = 0; i < myMess.size(); i++) {
Message control = myMess.get(i);
if(control.isChecked()){
messList.addRow(new Object[]{
((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName(),
myMess.get(i).getSubject()
});
}
else{
messList.addRow(new Object[]{
("🔴"+((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName()).toString(),
myMess.get(i).getSubject()
});
}
}
all = infoPerson.getAll();
for(int i=0;i<all.size();i++){
if(infoPerson.getId()!=all.get(i).getId())
sendID.addItem(all.get(i).getId()+"");
}
//Fulfill Supervise CB
allStore = refStore.getAll();
for (int i = 0; i < allStore.size(); i++) {
markList.addItem(allStore.get(i).getStoreID()+"/"+allStore.get(i).getName());
}
}
private void setClear(){
DefaultTableModel svlist=(DefaultTableModel)svTable.getModel();
//svlist.setRowCount(0); //for some reason this two are duplicating themselves
//svTable.removeRowSelectionInterval(0, svlist.getRowCount()-1); //when used
myMess = Message.getAll_Messages(infoPerson.getId());
allStore=refStore.getAll();
all=infoPerson.getAll();
for(int i=0;i<all.size();i++){
if(all.get(i).getId()!=infoPerson.getId() && all.get(i).getStatus().equalsIgnoreCase("sv")){
sv.add(all.get(i));
}
}
DefaultTableModel messList = (DefaultTableModel)messTable.getModel();
messList.setRowCount(0);
for (int i = 0; i < myMess.size(); i++) {
Message control = myMess.get(i);
if(control.isChecked()){
messList.addRow(new Object[]{
((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName(),
myMess.get(i).getSubject()
});
}
else{
messList.addRow(new Object[]{
("🔴"+((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName()).toString(),
myMess.get(i).getSubject()
});
}
}
/*for(int i=0;i<sv.size();i++){
svlist.addRow(new Object[]{sv.get(i).getId(),
sv.get(i).getName(),
sv.get(i).getSurname()});
}*/
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jDialog1 = new javax.swing.JDialog();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
LogoutButton = new javax.swing.JLabel();
rightButton = new javax.swing.JLabel();
pos_info = new javax.swing.JLabel();
pos_sv = new javax.swing.JLabel();
pos_inbox = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
pos_market = new javax.swing.JLabel();
jPanelSlider1 = new diu.swe.habib.JPanelSlider.JPanelSlider();
info = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
ceoID = new javax.swing.JLabel();
ceoName = new javax.swing.JLabel();
ceoSName = new javax.swing.JLabel();
ceoStart = new javax.swing.JLabel();
ceoSalary = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
svList = new javax.swing.JPanel();
jTabbedPane2 = new javax.swing.JTabbedPane();
jScrollPane4 = new javax.swing.JScrollPane();
svTable = new javax.swing.JTable();
addWorker = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jLabel29 = new javax.swing.JLabel();
addSalary = new javax.swing.JTextField();
addSName = new javax.swing.JTextField();
addName = new javax.swing.JTextField();
addPlace = new javax.swing.JTextField();
addSV = new javax.swing.JButton();
jLabel18 = new javax.swing.JLabel();
addResult = new javax.swing.JLabel();
deleteWorker = new javax.swing.JPanel();
svfireid = new javax.swing.JComboBox<>();
jLabel32 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
jLabel35 = new javax.swing.JLabel();
svfirecomp = new javax.swing.JLabel();
svfirename = new javax.swing.JLabel();
svfiresname = new javax.swing.JLabel();
svfirebutton = new javax.swing.JButton();
fireRes = new javax.swing.JLabel();
inbox = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
messTable = new javax.swing.JTable();
showMessBut = new javax.swing.JButton();
sendMessBut = new javax.swing.JButton();
showMessage = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
showMess = new javax.swing.JTextArea();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
fromLabel = new javax.swing.JLabel();
subjectLabel = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
jLabel20 = new javax.swing.JLabel();
marketList = new javax.swing.JPanel();
markList = new javax.swing.JComboBox<>();
supervise = new javax.swing.JButton();
jLabel21 = new javax.swing.JLabel();
sendMessage = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
sendID = new javax.swing.JComboBox<>();
showID = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setPreferredSize(new java.awt.Dimension(879, 802));
jPanel2.setBackground(new java.awt.Color(66, 133, 245));
jPanel2.setForeground(new java.awt.Color(255, 255, 255));
jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Chain Marketing Management System CEO Panel");
jPanel2.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(44, 17, 642, 54));
LogoutButton.setBackground(new java.awt.Color(48, 117, 233));
LogoutButton.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
LogoutButton.setForeground(new java.awt.Color(255, 255, 255));
LogoutButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
LogoutButton.setText("Logout");
LogoutButton.setOpaque(true);
LogoutButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
LogoutButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
LogoutButtonMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
LogoutButtonMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
LogoutButtonMouseReleased(evt);
}
});
jPanel2.add(LogoutButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(750, 20, 93, 47));
rightButton.setBackground(new java.awt.Color(48, 117, 233));
rightButton.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
rightButton.setForeground(new java.awt.Color(255, 255, 255));
rightButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
rightButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/right_arrow.png"))); // NOI18N
rightButton.setOpaque(true);
rightButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
rightButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
rightButtonMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
rightButtonMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
rightButtonMouseReleased(evt);
}
});
jPanel2.add(rightButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 90, -1, -1));
pos_info.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_info.setForeground(new java.awt.Color(255, 255, 255));
pos_info.setText("Info");
jPanel2.add(pos_info, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 100, -1, -1));
pos_sv.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_sv.setForeground(new java.awt.Color(255, 255, 255));
pos_sv.setText("SV list");
jPanel2.add(pos_sv, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 100, -1, -1));
pos_inbox.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_inbox.setForeground(new java.awt.Color(255, 255, 255));
pos_inbox.setText("Inbox");
jPanel2.add(pos_inbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 100, -1, -1));
jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/warning.png"))); // NOI18N
jPanel2.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 90, -1, -1));
pos_market.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_market.setForeground(new java.awt.Color(255, 255, 255));
pos_market.setText("Market List");
jPanel2.add(pos_market, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 100, -1, -1));
jPanelSlider1.setBorder(null);
jPanelSlider1.setPreferredSize(new java.awt.Dimension(879, 697));
info.setBackground(new java.awt.Color(255, 255, 255));
info.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/69636.png"))); // NOI18N
jLabel11.setText("Photo");
jLabel12.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel12.setForeground(new java.awt.Color(48, 117, 233));
jLabel12.setText("ID :");
jLabel13.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel13.setForeground(new java.awt.Color(48, 117, 233));
jLabel13.setText("Name :");
jLabel14.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel14.setForeground(new java.awt.Color(48, 117, 233));
jLabel14.setText("Work period :");
jLabel15.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel15.setForeground(new java.awt.Color(48, 117, 233));
jLabel15.setText("Salary :");
jLabel19.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel19.setForeground(new java.awt.Color(48, 117, 233));
jLabel19.setText("Surname :");
ceoID.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoID.setForeground(new java.awt.Color(48, 117, 233));
ceoID.setPreferredSize(new java.awt.Dimension(120, 20));
ceoName.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoName.setForeground(new java.awt.Color(48, 117, 233));
ceoName.setPreferredSize(new java.awt.Dimension(120, 20));
ceoSName.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoSName.setForeground(new java.awt.Color(48, 117, 233));
ceoSName.setPreferredSize(new java.awt.Dimension(120, 20));
ceoStart.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoStart.setForeground(new java.awt.Color(48, 117, 233));
ceoStart.setPreferredSize(new java.awt.Dimension(120, 20));
ceoSalary.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoSalary.setForeground(new java.awt.Color(48, 117, 233));
ceoSalary.setPreferredSize(new java.awt.Dimension(120, 20));
jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout infoLayout = new javax.swing.GroupLayout(info);
info.setLayout(infoLayout);
infoLayout.setHorizontalGroup(
infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(infoLayout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(78, 78, 78)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel13)
.addComponent(jLabel19)
.addComponent(jLabel14)
.addComponent(jLabel15))
.addGap(33, 33, 33)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ceoSalary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoSName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(384, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, infoLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17)
.addContainerGap())
);
infoLayout.setVerticalGroup(
infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(infoLayout.createSequentialGroup()
.addGap(66, 66, 66)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(infoLayout.createSequentialGroup()
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(ceoID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(ceoName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19)
.addComponent(ceoSName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ceoStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ceoSalary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15)))
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 167, Short.MAX_VALUE)
.addComponent(jLabel17)
.addContainerGap())
);
jPanelSlider1.add(info, "card3");
svList.setBackground(new java.awt.Color(255, 255, 255));
svList.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
jTabbedPane2.setBackground(new java.awt.Color(66, 133, 245));
jTabbedPane2.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
svTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID", "Name", "Surname"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane4.setViewportView(svTable);
jTabbedPane2.addTab("On Work", jScrollPane4);
addWorker.setBackground(new java.awt.Color(255, 255, 255));
addWorker.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel10.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel10.setForeground(new java.awt.Color(48, 117, 233));
jLabel10.setText("Market ID :");
addWorker.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 180, -1, -1));
jLabel28.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel28.setForeground(new java.awt.Color(48, 117, 233));
jLabel28.setText("Surname :");
addWorker.add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 130, -1, -1));
jLabel29.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel29.setForeground(new java.awt.Color(48, 117, 233));
jLabel29.setText("Name :");
addWorker.add(jLabel29, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 80, -1, -1));
addWorker.add(addSalary, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 240, 90, -1));
addWorker.add(addSName, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 130, 90, -1));
addWorker.add(addName, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 80, 90, -1));
addWorker.add(addPlace, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 180, 90, -1));
addSV.setBackground(new java.awt.Color(48, 117, 233));
addSV.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
addSV.setForeground(new java.awt.Color(255, 255, 255));
addSV.setText("ADD");
addSV.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addSVActionPerformed(evt);
}
});
addWorker.add(addSV, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 330, 180, 60));
jLabel18.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel18.setForeground(new java.awt.Color(48, 117, 233));
jLabel18.setText("Salary :");
addWorker.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 240, 60, -1));
addResult.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
addResult.setForeground(new java.awt.Color(46, 117, 233));
addWorker.add(addResult, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 290, 180, 30));
jTabbedPane2.addTab("Add SV", addWorker);
deleteWorker.setBackground(new java.awt.Color(255, 255, 255));
deleteWorker.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
svfireid.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
svfireidActionPerformed(evt);
}
});
deleteWorker.add(svfireid, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 40, 131, -1));
jLabel32.setText("Compensation :");
deleteWorker.add(jLabel32, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 180, -1, 30));
jLabel33.setText("ID :");
deleteWorker.add(jLabel33, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 40, -1, 20));
jLabel34.setText("Name :");
deleteWorker.add(jLabel34, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 80, -1, 30));
jLabel35.setText("Surname :");
deleteWorker.add(jLabel35, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 130, -1, 30));
svfirecomp.setText(" ");
deleteWorker.add(svfirecomp, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 180, 130, 30));
svfirename.setText(" ");
deleteWorker.add(svfirename, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 80, 130, 30));
svfiresname.setText(" ");
deleteWorker.add(svfiresname, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 130, 130, 30));
svfirebutton.setBackground(new java.awt.Color(48, 117, 233));
svfirebutton.setFont(new java.awt.Font("Segoe UI", 1, 48)); // NOI18N
svfirebutton.setForeground(new java.awt.Color(255, 255, 255));
svfirebutton.setText("FIRE !!!");
svfirebutton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
svfirebuttonActionPerformed(evt);
}
});
deleteWorker.add(svfirebutton, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 240, 240, 70));
fireRes.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
fireRes.setForeground(new java.awt.Color(48, 117, 233));
deleteWorker.add(fireRes, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 340, 260, 30));
jTabbedPane2.addTab("Delete SV", deleteWorker);
javax.swing.GroupLayout svListLayout = new javax.swing.GroupLayout(svList);
svList.setLayout(svListLayout);
svListLayout.setHorizontalGroup(
svListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane2)
);
svListLayout.setVerticalGroup(
svListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane2)
);
jPanelSlider1.add(svList, "card3");
inbox.setBackground(new java.awt.Color(255, 255, 255));
inbox.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
inbox.setPreferredSize(new java.awt.Dimension(879, 462));
messTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"From", "Subject"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(messTable);
showMessBut.setText("Show Message");
showMessBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showMessButActionPerformed(evt);
}
});
sendMessBut.setText("Send Message");
sendMessBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendMessButActionPerformed(evt);
}
});
javax.swing.GroupLayout inboxLayout = new javax.swing.GroupLayout(inbox);
inbox.setLayout(inboxLayout);
inboxLayout.setHorizontalGroup(
inboxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(inboxLayout.createSequentialGroup()
.addComponent(showMessBut, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(sendMessBut, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE))
);
inboxLayout.setVerticalGroup(
inboxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(inboxLayout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
.addGroup(inboxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(showMessBut, javax.swing.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE)
.addComponent(sendMessBut, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
jPanelSlider1.add(inbox, "card2");
showMessage.setBackground(new java.awt.Color(255, 255, 255));
showMessage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
showMessage.setPreferredSize(new java.awt.Dimension(875, 501));
showMess.setEditable(false);
showMess.setColumns(20);
showMess.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N
showMess.setRows(5);
jScrollPane3.setViewportView(showMess);
jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel5.setForeground(new java.awt.Color(48, 117, 233));
jLabel5.setText("Message :");
jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel6.setForeground(new java.awt.Color(48, 117, 233));
jLabel6.setText("Subject :");
jLabel7.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel7.setForeground(new java.awt.Color(48, 117, 233));
jLabel7.setText("From :");
fromLabel.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
subjectLabel.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
jButton5.setBackground(new java.awt.Color(66, 133, 245));
jButton5.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jButton5.setForeground(new java.awt.Color(255, 255, 255));
jButton5.setText("Go Back");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout showMessageLayout = new javax.swing.GroupLayout(showMessage);
showMessage.setLayout(showMessageLayout);
showMessageLayout.setHorizontalGroup(
showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(40, 40, 40)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fromLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(650, 650, 650)
.addComponent(jButton5))))
.addGroup(showMessageLayout.createSequentialGroup()
.addComponent(jLabel6)
.addGap(27, 27, 27)
.addComponent(subjectLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(showMessageLayout.createSequentialGroup()
.addComponent(jLabel5)
.addGap(19, 19, 19)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
.addComponent(jLabel20)))
.addContainerGap())
);
showMessageLayout.setVerticalGroup(
showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(fromLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5))
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(13, 13, 13)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(subjectLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(46, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, showMessageLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20)
.addContainerGap())))
);
jPanelSlider1.add(showMessage, "card2");
marketList.setBackground(new java.awt.Color(255, 255, 255));
marketList.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
marketList.setPreferredSize(new java.awt.Dimension(875, 501));
markList.setFont(new java.awt.Font("Segoe UI", 0, 36)); // NOI18N
markList.setToolTipText("");
markList.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
markListActionPerformed(evt);
}
});
supervise.setBackground(new java.awt.Color(48, 117, 233));
supervise.setFont(new java.awt.Font("Segoe UI", 1, 60)); // NOI18N
supervise.setForeground(new java.awt.Color(255, 255, 255));
supervise.setText("Supervise");
supervise.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
superviseActionPerformed(evt);
}
});
jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout marketListLayout = new javax.swing.GroupLayout(marketList);
marketList.setLayout(marketListLayout);
marketListLayout.setHorizontalGroup(
marketListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(marketListLayout.createSequentialGroup()
.addGap(270, 270, 270)
.addGroup(marketListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(marketListLayout.createSequentialGroup()
.addComponent(supervise, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
.addComponent(jLabel21))
.addComponent(markList, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
marketListLayout.setVerticalGroup(
marketListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(marketListLayout.createSequentialGroup()
.addGap(60, 60, 60)
.addComponent(markList, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90)
.addComponent(supervise, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
.addComponent(jLabel21)
.addContainerGap())
);
jPanelSlider1.add(marketList, "card2");
sendMessage.setBackground(new java.awt.Color(255, 255, 255));
sendMessage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
sendMessage.setPreferredSize(new java.awt.Dimension(879, 462));
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Segoe UI", 0, 12)); // NOI18N
jTextArea1.setRows(5);
jScrollPane2.setViewportView(jTextArea1);
jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel2.setForeground(new java.awt.Color(48, 117, 233));
jLabel2.setText("Subject :");
jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel3.setForeground(new java.awt.Color(48, 117, 233));
jLabel3.setText("To :");
jTextField2.setFont(new java.awt.Font("Segoe UI", 0, 12)); // NOI18N
jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel4.setForeground(new java.awt.Color(48, 117, 233));
jLabel4.setText("Message :");
jButton3.setBackground(new java.awt.Color(66, 133, 245));
jButton3.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jButton3.setForeground(new java.awt.Color(255, 255, 255));
jButton3.setText("Send");
jButton4.setBackground(new java.awt.Color(66, 133, 245));
jButton4.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jButton4.setForeground(new java.awt.Color(255, 255, 255));
jButton4.setText("Go Back");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
sendID.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendIDActionPerformed(evt);
}
});
jLabel22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout sendMessageLayout = new javax.swing.GroupLayout(sendMessage);
sendMessage.setLayout(sendMessageLayout);
sendMessageLayout.setHorizontalGroup(
sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel22)
.addContainerGap())
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(46, 46, 46)
.addComponent(sendID, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(20, 20, 20)
.addComponent(showID, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(410, 410, 410)
.addComponent(jButton4))
.addGroup(sendMessageLayout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(17, 17, 17)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(sendMessageLayout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(9, 9, 9)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 28, Short.MAX_VALUE))
);
sendMessageLayout.setVerticalGroup(
sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(sendID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(showID, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4))
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(13, 13, 13)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addComponent(jButton3)
.addGap(0, 25, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, sendMessageLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel22)
.addContainerGap())))
);
jPanelSlider1.add(sendMessage, "card2");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanelSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, 501, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 902, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 636, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void LogoutButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMouseEntered
buttonEnter(LogoutButton);
}//GEN-LAST:event_LogoutButtonMouseEntered
private void LogoutButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMouseExited
buttonExit(LogoutButton);
}//GEN-LAST:event_LogoutButtonMouseExited
private void LogoutButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMousePressed
if(evt.getButton() == BUTTON1)
buttonPress(LogoutButton);
}//GEN-LAST:event_LogoutButtonMousePressed
private void LogoutButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMouseReleased
buttonRelease(LogoutButton);
if(clicked && in){
login p = new login();
p.setVisible(true);
clicked = false;
this.dispose();
}
}//GEN-LAST:event_LogoutButtonMouseReleased
private void rightButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMouseEntered
if(rightButton.isEnabled())
buttonEnter(rightButton);
}//GEN-LAST:event_rightButtonMouseEntered
private void rightButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMouseExited
if(rightButton.isEnabled())
buttonExit(rightButton);
}//GEN-LAST:event_rightButtonMouseExited
private void rightButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMousePressed
if(evt.getButton() == BUTTON1 && rightButton.isEnabled())
buttonPress(rightButton);
}//GEN-LAST:event_rightButtonMousePressed
private void rightButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMouseReleased
if(rightButton.isEnabled())
buttonRelease(rightButton);
if(in){
if(clicked && info_bool){
jPanelSlider1.nextPanel(10,svList, jPanelSlider1.right);
pos_sv.setForeground(new Color(255,204,51));
pos_info.setForeground(Color.white);
sv_bool = true;
info_bool=false;
}
else if(clicked && sv_bool){
jPanelSlider1.nextPanel(10,marketList, jPanelSlider1.right);
pos_market.setForeground(new Color(255,204,51));
pos_sv.setForeground(Color.white);
market_bool = true;
sv_bool=false;
}
else if(clicked && market_bool){
jPanelSlider1.nextPanel(10,inbox, jPanelSlider1.right);
pos_inbox.setForeground(new Color(255,204,51));
pos_market.setForeground(Color.white);
inbox_bool = true;
market_bool=false;
}
else if(clicked && inbox_bool){
jPanelSlider1.nextPanel(10,info, jPanelSlider1.right);
pos_info.setForeground(new Color(255,204,51));
pos_inbox.setForeground(Color.white);
info_bool = true;
inbox_bool=false;
}
}
clicked = false;
}//GEN-LAST:event_rightButtonMouseReleased
private void showMessButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showMessButActionPerformed
try{
rightButton.setEnabled(false);
fromLabel.setText(messTable.getValueAt(messTable.getSelectedRow(), 0).toString());
subjectLabel.setText(messTable.getValueAt(messTable.getSelectedRow(), 1).toString());
jPanelSlider1.nextPanel(10, showMessage , jPanelSlider1.left);}
catch(ArrayIndexOutOfBoundsException e){
JOptionPane.showMessageDialog(jDialog1,
"You have to select a row to see a message",
"Error",
JOptionPane.WARNING_MESSAGE);
}
Message find = myMess.get(messTable.getSelectedRow());
if(find != null){
find.updateCheck();
showMess.setText(myMess.get(messTable.getSelectedRow()).getContext());
setClear();
}
}//GEN-LAST:event_showMessButActionPerformed
private void sendMessButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendMessButActionPerformed
rightButton.setEnabled(false);
jPanelSlider1.nextPanel(10, sendMessage, jPanelSlider1.left);
}//GEN-LAST:event_sendMessButActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
rightButton.setEnabled(true);
jPanelSlider1.nextPanel(10, inbox, jPanelSlider1.right);
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
rightButton.setEnabled(true);
jPanelSlider1.nextPanel(10, inbox, jPanelSlider1.right);
}//GEN-LAST:event_jButton4ActionPerformed
private void addSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSVActionPerformed
if(!(addName.getText().equalsIgnoreCase("")||addName.getText().equals(null))&&!(addSName.getText().equalsIgnoreCase("")||addSName.getText().equals(null))&&!(addPlace.getText().equalsIgnoreCase("")||addPlace.getText().equals(null))&&!(addSalary.getText().equalsIgnoreCase("")||addSalary.getText().equals(null))){
boolean flag=false;
boolean af=false;
DefaultTableModel a=(DefaultTableModel)svTable.getModel();
for(int i=0;i<allStore.size();i++){
if(Integer.parseInt(addPlace.getText())==allStore.get(i).getStoreID()){
flag=true;
}
}
if(flag){
Employee add=new Employee(addName.getText(),addSName.getText(),Integer.parseInt(addPlace.getText()));
add.setSalary(Double.parseDouble(addSalary.getText()));
add.setStatus("SV");
af=add.add_item(add);
if(af){addResult.setText("SUCCESS!!");
addName.setText("");
addSName.setText("");
addPlace.setText("");
addSalary.setText("");
svfireid.addItem(add.getId()+"");
a.addRow(new Object[]{add.getId(),
add.getName(),
add.getSurname()});
sendID.addItem(add.getId()+"");
setClear();
}
else {addResult.setText("FAILURE!!Fill All Fields!");}
}else{
addResult.setText("No Matching MarketID!");
}
}else{
addResult.setText("All fields Must be filled!");
}
}//GEN-LAST:event_addSVActionPerformed
private void svfireidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_svfireidActionPerformed
if(!svfireid.getSelectedItem().toString().equalsIgnoreCase(null)&&!svfireid.getSelectedItem().toString().equalsIgnoreCase("NONE")&&!svfireid.getSelectedItem().toString().equalsIgnoreCase("")){
firePerson=(Employee)infoPerson.get_item(Integer.parseInt(svfireid.getSelectedItem().toString()));
svfirename.setText(firePerson.getName());
svfiresname.setText(firePerson.getSurname());
svfirecomp.setText(firePerson.getSalary()+"");
}else{
svfirename.setText("");
svfiresname.setText("");
svfirecomp.setText("");
firePerson=new Employee();
}
}//GEN-LAST:event_svfireidActionPerformed
private void svfirebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_svfirebuttonActionPerformed
DefaultTableModel a=(DefaultTableModel)svTable.getModel();
if(!svfireid.getSelectedItem().toString().equalsIgnoreCase("NONE")){
all=infoPerson.delete_item(all, Integer.parseInt(svfireid.getSelectedItem().toString()));
fireRes.setText("FIRED!!");
//sendID.remove(sendID);
int fired = Integer.parseInt(svfireid.getSelectedItem().toString());
System.out.println(fired);
svfireid.removeItemAt(svfireid.getSelectedIndex());
for(int i=0;i<a.getRowCount();i++){
Employee r=(Employee)infoPerson.get_item(Integer.parseInt(svfireid.getSelectedItem().toString()));
if((Integer.parseInt(a.getValueAt(i, 0).toString()))==r.getId()){
a.removeRow(i+1);
}
}
int cbsize = sendID.getItemCount();
for (int i = 0; i < cbsize; i++) {
int prs = Integer.parseInt(sendID.getItemAt(i).toString());
if(prs == fired){
System.out.println("checked");
sendID.removeItemAt(i);
}
}
setClear();
}else{
fireRes.setText("FAILURE!");
}
}//GEN-LAST:event_svfirebuttonActionPerformed
private void sendIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendIDActionPerformed
// TODO add your handling code here:
showID.setText(((Employee)infoPerson.get_item(Integer.parseInt(sendID.getSelectedItem().toString()))).getName()+" "+((Employee)infoPerson.get_item(Integer.parseInt(sendID.getSelectedItem().toString()))).getSurname());
}//GEN-LAST:event_sendIDActionPerformed
private void markListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_markListActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_markListActionPerformed
private void superviseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_superviseActionPerformed
// TODO add your handling code here:
int supID = Integer.parseInt(markList.getSelectedItem().toString().split("/")[0]);
ceoSupervisorPanel shift = new ceoSupervisorPanel(Store.findStore(allStore, supID), ceo);
shift.setVisible(true);
this.dispose();
}//GEN-LAST:event_superviseActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel LogoutButton;
private javax.swing.JTextField addName;
private javax.swing.JTextField addPlace;
private javax.swing.JLabel addResult;
private javax.swing.JTextField addSName;
private javax.swing.JButton addSV;
private javax.swing.JTextField addSalary;
private javax.swing.JPanel addWorker;
private javax.swing.JLabel ceoID;
private javax.swing.JLabel ceoName;
private javax.swing.JLabel ceoSName;
private javax.swing.JLabel ceoSalary;
private javax.swing.JLabel ceoStart;
private javax.swing.JPanel deleteWorker;
private javax.swing.JLabel fireRes;
private javax.swing.JLabel fromLabel;
private javax.swing.JPanel inbox;
private javax.swing.JPanel info;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JDialog jDialog1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private diu.swe.habib.JPanelSlider.JPanelSlider jPanelSlider1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField2;
private javax.swing.JComboBox<String> markList;
private javax.swing.JPanel marketList;
private javax.swing.JTable messTable;
private javax.swing.JLabel pos_inbox;
private javax.swing.JLabel pos_info;
private javax.swing.JLabel pos_market;
private javax.swing.JLabel pos_sv;
private javax.swing.JLabel rightButton;
private javax.swing.JComboBox<String> sendID;
private javax.swing.JButton sendMessBut;
private javax.swing.JPanel sendMessage;
private javax.swing.JLabel showID;
private javax.swing.JTextArea showMess;
private javax.swing.JButton showMessBut;
private javax.swing.JPanel showMessage;
private javax.swing.JLabel subjectLabel;
private javax.swing.JButton supervise;
private javax.swing.JPanel svList;
private javax.swing.JTable svTable;
private javax.swing.JButton svfirebutton;
private javax.swing.JLabel svfirecomp;
private javax.swing.JComboBox<String> svfireid;
private javax.swing.JLabel svfirename;
private javax.swing.JLabel svfiresname;
// End of variables declaration//GEN-END:variables
void buttonExit(Component c){
timer1.cancel();
timer3.cancel();
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() >= 48) {
c.setBackground(new Color(c.getBackground().getRed()-1,c.getBackground().getGreen()-1,c.getBackground().getBlue()));
}
else if(c.getBackground().getRed() < 48){
c.setBackground(new Color(c.getBackground().getRed()+1,c.getBackground().getGreen()+1,c.getBackground().getBlue()));
}
}
};
in = false;
timer2 = new Timer();
timer2.scheduleAtFixedRate(task1, 0, 20);
}
void buttonEnter(Component c){
timer3.cancel();
timer2.cancel();
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() <= 60) {
c.setBackground(new Color(c.getBackground().getRed()+1,c.getBackground().getGreen()+1,c.getBackground().getBlue()));
}
}
};
in = true;
timer1 = new Timer();
timer1.scheduleAtFixedRate(task1, 0, 20);
}
void buttonPress(Component c){
timer1.cancel();
timer2.cancel();
clicked = true;
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() >= 28) {
c.setBackground(new Color(c.getBackground().getRed()-1,c.getBackground().getGreen()-1,c.getBackground().getBlue()));
}
}
};
timer3 = new Timer();
timer3.scheduleAtFixedRate(task1, 0, 20);
}
void buttonRelease(Component c){
if(in){
timer2.cancel();
timer3.cancel();
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() <= 60) {
c.setBackground(new Color(c.getBackground().getRed()+1,c.getBackground().getGreen()+1,c.getBackground().getBlue()));
}
}
};
timer1 = new Timer();
timer1.scheduleAtFixedRate(task1, 0, 20);
}
}
}
| UTF-8 | Java | 65,770 | java | ceoPanel.java | Java | [
{
"context": "the template in the editor.\n */\n\n/**\n *\n * @author ACK\n */\npublic class ceoPanel extends javax.swing.JFr",
"end": 760,
"score": 0.6843234300613403,
"start": 757,
"tag": "USERNAME",
"value": "ACK"
}
]
| null | []
| package GUI;
import GUI.login;
import chainmanagement.Employee;
import chainmanagement.Message;
import chainmanagement.Store;
import java.awt.Color;
import java.awt.Component;
import static java.awt.event.MouseEvent.BUTTON1;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import org.jdesktop.swingx.border.DropShadowBorder;
/*
* 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.
*/
/**
*
* @author ACK
*/
public class ceoPanel extends javax.swing.JFrame {
/**
* Creates new form ceoPanel
*/
Employee infoPerson=new Employee();
Employee firePerson=new Employee();
Employee ceo;
ArrayList<Employee> sv=new ArrayList<>();
ArrayList<Employee> all= new ArrayList<>();
ArrayList<Store> allStore= new ArrayList<>();
Store refStore=new Store();
ArrayList<Message> myMess = new ArrayList<>();
Timer timer1 = new Timer();
Timer timer2 = new Timer();
Timer timer3 = new Timer();
Timer slideTimer1 = new Timer();
Timer slideTimer2 = new Timer();
boolean in;
boolean clicked;
boolean new_message;
boolean inbox_bool;
boolean market_bool;
boolean sv_bool;
boolean info_bool = true;
public ceoPanel(Employee e) {
initComponents();
infoPerson=e;
ceo = e;
messTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
svTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//jTable3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//inbox_init();
jLabel16.setVisible(false);
fireRes.setVisible(false);
//addResult.setVisible(false);
pos_info.setForeground(new Color(255,204,51));
setBackground(new Color(0,0,0,0));
jPanel1.setBackground(new Color(0,0,0,0));
DropShadowBorder shadow = new DropShadowBorder();
shadow.setShadowColor(Color.BLACK);
shadow.setShowLeftShadow(true);
shadow.setShowRightShadow(true);
shadow.setShowBottomShadow(true);
shadow.setShowTopShadow(true);
shadow.setShadowSize(6);
jPanel1.setBorder(shadow);
fillInfo();
}
private void fillInfo(){
svfireid.addItem("NONE");
myMess = Message.getAll_Messages(infoPerson.getId());
allStore=refStore.getAll();
all=infoPerson.getAll();
for(int i=0;i<all.size();i++){
if(all.get(i).getId()!=infoPerson.getId() && all.get(i).getStatus().equalsIgnoreCase("sv")){
sv.add(all.get(i));
svfireid.addItem(all.get(i).getId()+"");
}
}
/*addName.setText("");
addSName.setText("");
addPlace.setText("");
addSalary.setText("");*/
ceoID.setText(infoPerson.getId()+"");
ceoName.setText(infoPerson.getName());
ceoSName.setText(infoPerson.getSurname());
ceoStart.setText(infoPerson.getStarting());
ceoSalary.setText(infoPerson.getSalary()+"");
DefaultTableModel svlist=(DefaultTableModel)svTable.getModel();
for(int i=0;i<sv.size();i++){
svlist.addRow(new Object[]{sv.get(i).getId(),
sv.get(i).getName(),
sv.get(i).getSurname()});
}
DefaultTableModel messList = (DefaultTableModel)messTable.getModel();
for (int i = 0; i < myMess.size(); i++) {
Message control = myMess.get(i);
if(control.isChecked()){
messList.addRow(new Object[]{
((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName(),
myMess.get(i).getSubject()
});
}
else{
messList.addRow(new Object[]{
("🔴"+((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName()).toString(),
myMess.get(i).getSubject()
});
}
}
all = infoPerson.getAll();
for(int i=0;i<all.size();i++){
if(infoPerson.getId()!=all.get(i).getId())
sendID.addItem(all.get(i).getId()+"");
}
//Fulfill Supervise CB
allStore = refStore.getAll();
for (int i = 0; i < allStore.size(); i++) {
markList.addItem(allStore.get(i).getStoreID()+"/"+allStore.get(i).getName());
}
}
private void setClear(){
DefaultTableModel svlist=(DefaultTableModel)svTable.getModel();
//svlist.setRowCount(0); //for some reason this two are duplicating themselves
//svTable.removeRowSelectionInterval(0, svlist.getRowCount()-1); //when used
myMess = Message.getAll_Messages(infoPerson.getId());
allStore=refStore.getAll();
all=infoPerson.getAll();
for(int i=0;i<all.size();i++){
if(all.get(i).getId()!=infoPerson.getId() && all.get(i).getStatus().equalsIgnoreCase("sv")){
sv.add(all.get(i));
}
}
DefaultTableModel messList = (DefaultTableModel)messTable.getModel();
messList.setRowCount(0);
for (int i = 0; i < myMess.size(); i++) {
Message control = myMess.get(i);
if(control.isChecked()){
messList.addRow(new Object[]{
((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName(),
myMess.get(i).getSubject()
});
}
else{
messList.addRow(new Object[]{
("🔴"+((Employee)infoPerson.get_item(myMess.get(i).getFromID())).getName()).toString(),
myMess.get(i).getSubject()
});
}
}
/*for(int i=0;i<sv.size();i++){
svlist.addRow(new Object[]{sv.get(i).getId(),
sv.get(i).getName(),
sv.get(i).getSurname()});
}*/
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jDialog1 = new javax.swing.JDialog();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
LogoutButton = new javax.swing.JLabel();
rightButton = new javax.swing.JLabel();
pos_info = new javax.swing.JLabel();
pos_sv = new javax.swing.JLabel();
pos_inbox = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
pos_market = new javax.swing.JLabel();
jPanelSlider1 = new diu.swe.habib.JPanelSlider.JPanelSlider();
info = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
ceoID = new javax.swing.JLabel();
ceoName = new javax.swing.JLabel();
ceoSName = new javax.swing.JLabel();
ceoStart = new javax.swing.JLabel();
ceoSalary = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
svList = new javax.swing.JPanel();
jTabbedPane2 = new javax.swing.JTabbedPane();
jScrollPane4 = new javax.swing.JScrollPane();
svTable = new javax.swing.JTable();
addWorker = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jLabel29 = new javax.swing.JLabel();
addSalary = new javax.swing.JTextField();
addSName = new javax.swing.JTextField();
addName = new javax.swing.JTextField();
addPlace = new javax.swing.JTextField();
addSV = new javax.swing.JButton();
jLabel18 = new javax.swing.JLabel();
addResult = new javax.swing.JLabel();
deleteWorker = new javax.swing.JPanel();
svfireid = new javax.swing.JComboBox<>();
jLabel32 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
jLabel35 = new javax.swing.JLabel();
svfirecomp = new javax.swing.JLabel();
svfirename = new javax.swing.JLabel();
svfiresname = new javax.swing.JLabel();
svfirebutton = new javax.swing.JButton();
fireRes = new javax.swing.JLabel();
inbox = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
messTable = new javax.swing.JTable();
showMessBut = new javax.swing.JButton();
sendMessBut = new javax.swing.JButton();
showMessage = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
showMess = new javax.swing.JTextArea();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
fromLabel = new javax.swing.JLabel();
subjectLabel = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
jLabel20 = new javax.swing.JLabel();
marketList = new javax.swing.JPanel();
markList = new javax.swing.JComboBox<>();
supervise = new javax.swing.JButton();
jLabel21 = new javax.swing.JLabel();
sendMessage = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
sendID = new javax.swing.JComboBox<>();
showID = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setPreferredSize(new java.awt.Dimension(879, 802));
jPanel2.setBackground(new java.awt.Color(66, 133, 245));
jPanel2.setForeground(new java.awt.Color(255, 255, 255));
jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Chain Marketing Management System CEO Panel");
jPanel2.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(44, 17, 642, 54));
LogoutButton.setBackground(new java.awt.Color(48, 117, 233));
LogoutButton.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
LogoutButton.setForeground(new java.awt.Color(255, 255, 255));
LogoutButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
LogoutButton.setText("Logout");
LogoutButton.setOpaque(true);
LogoutButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
LogoutButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
LogoutButtonMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
LogoutButtonMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
LogoutButtonMouseReleased(evt);
}
});
jPanel2.add(LogoutButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(750, 20, 93, 47));
rightButton.setBackground(new java.awt.Color(48, 117, 233));
rightButton.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
rightButton.setForeground(new java.awt.Color(255, 255, 255));
rightButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
rightButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/right_arrow.png"))); // NOI18N
rightButton.setOpaque(true);
rightButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
rightButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
rightButtonMouseExited(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
rightButtonMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
rightButtonMouseReleased(evt);
}
});
jPanel2.add(rightButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 90, -1, -1));
pos_info.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_info.setForeground(new java.awt.Color(255, 255, 255));
pos_info.setText("Info");
jPanel2.add(pos_info, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 100, -1, -1));
pos_sv.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_sv.setForeground(new java.awt.Color(255, 255, 255));
pos_sv.setText("SV list");
jPanel2.add(pos_sv, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 100, -1, -1));
pos_inbox.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_inbox.setForeground(new java.awt.Color(255, 255, 255));
pos_inbox.setText("Inbox");
jPanel2.add(pos_inbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 100, -1, -1));
jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/warning.png"))); // NOI18N
jPanel2.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 90, -1, -1));
pos_market.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
pos_market.setForeground(new java.awt.Color(255, 255, 255));
pos_market.setText("Market List");
jPanel2.add(pos_market, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 100, -1, -1));
jPanelSlider1.setBorder(null);
jPanelSlider1.setPreferredSize(new java.awt.Dimension(879, 697));
info.setBackground(new java.awt.Color(255, 255, 255));
info.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/69636.png"))); // NOI18N
jLabel11.setText("Photo");
jLabel12.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel12.setForeground(new java.awt.Color(48, 117, 233));
jLabel12.setText("ID :");
jLabel13.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel13.setForeground(new java.awt.Color(48, 117, 233));
jLabel13.setText("Name :");
jLabel14.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel14.setForeground(new java.awt.Color(48, 117, 233));
jLabel14.setText("Work period :");
jLabel15.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel15.setForeground(new java.awt.Color(48, 117, 233));
jLabel15.setText("Salary :");
jLabel19.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
jLabel19.setForeground(new java.awt.Color(48, 117, 233));
jLabel19.setText("Surname :");
ceoID.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoID.setForeground(new java.awt.Color(48, 117, 233));
ceoID.setPreferredSize(new java.awt.Dimension(120, 20));
ceoName.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoName.setForeground(new java.awt.Color(48, 117, 233));
ceoName.setPreferredSize(new java.awt.Dimension(120, 20));
ceoSName.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoSName.setForeground(new java.awt.Color(48, 117, 233));
ceoSName.setPreferredSize(new java.awt.Dimension(120, 20));
ceoStart.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoStart.setForeground(new java.awt.Color(48, 117, 233));
ceoStart.setPreferredSize(new java.awt.Dimension(120, 20));
ceoSalary.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
ceoSalary.setForeground(new java.awt.Color(48, 117, 233));
ceoSalary.setPreferredSize(new java.awt.Dimension(120, 20));
jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout infoLayout = new javax.swing.GroupLayout(info);
info.setLayout(infoLayout);
infoLayout.setHorizontalGroup(
infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(infoLayout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(78, 78, 78)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel13)
.addComponent(jLabel19)
.addComponent(jLabel14)
.addComponent(jLabel15))
.addGap(33, 33, 33)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ceoSalary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoSName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ceoID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(384, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, infoLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel17)
.addContainerGap())
);
infoLayout.setVerticalGroup(
infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(infoLayout.createSequentialGroup()
.addGap(66, 66, 66)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(infoLayout.createSequentialGroup()
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(ceoID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(ceoName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19)
.addComponent(ceoSName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ceoStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14))
.addGap(20, 20, 20)
.addGroup(infoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ceoSalary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15)))
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 167, Short.MAX_VALUE)
.addComponent(jLabel17)
.addContainerGap())
);
jPanelSlider1.add(info, "card3");
svList.setBackground(new java.awt.Color(255, 255, 255));
svList.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
jTabbedPane2.setBackground(new java.awt.Color(66, 133, 245));
jTabbedPane2.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
svTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID", "Name", "Surname"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane4.setViewportView(svTable);
jTabbedPane2.addTab("On Work", jScrollPane4);
addWorker.setBackground(new java.awt.Color(255, 255, 255));
addWorker.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel10.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel10.setForeground(new java.awt.Color(48, 117, 233));
jLabel10.setText("Market ID :");
addWorker.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 180, -1, -1));
jLabel28.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel28.setForeground(new java.awt.Color(48, 117, 233));
jLabel28.setText("Surname :");
addWorker.add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 130, -1, -1));
jLabel29.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel29.setForeground(new java.awt.Color(48, 117, 233));
jLabel29.setText("Name :");
addWorker.add(jLabel29, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 80, -1, -1));
addWorker.add(addSalary, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 240, 90, -1));
addWorker.add(addSName, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 130, 90, -1));
addWorker.add(addName, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 80, 90, -1));
addWorker.add(addPlace, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 180, 90, -1));
addSV.setBackground(new java.awt.Color(48, 117, 233));
addSV.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
addSV.setForeground(new java.awt.Color(255, 255, 255));
addSV.setText("ADD");
addSV.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addSVActionPerformed(evt);
}
});
addWorker.add(addSV, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 330, 180, 60));
jLabel18.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel18.setForeground(new java.awt.Color(48, 117, 233));
jLabel18.setText("Salary :");
addWorker.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 240, 60, -1));
addResult.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
addResult.setForeground(new java.awt.Color(46, 117, 233));
addWorker.add(addResult, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 290, 180, 30));
jTabbedPane2.addTab("Add SV", addWorker);
deleteWorker.setBackground(new java.awt.Color(255, 255, 255));
deleteWorker.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
svfireid.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
svfireidActionPerformed(evt);
}
});
deleteWorker.add(svfireid, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 40, 131, -1));
jLabel32.setText("Compensation :");
deleteWorker.add(jLabel32, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 180, -1, 30));
jLabel33.setText("ID :");
deleteWorker.add(jLabel33, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 40, -1, 20));
jLabel34.setText("Name :");
deleteWorker.add(jLabel34, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 80, -1, 30));
jLabel35.setText("Surname :");
deleteWorker.add(jLabel35, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 130, -1, 30));
svfirecomp.setText(" ");
deleteWorker.add(svfirecomp, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 180, 130, 30));
svfirename.setText(" ");
deleteWorker.add(svfirename, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 80, 130, 30));
svfiresname.setText(" ");
deleteWorker.add(svfiresname, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 130, 130, 30));
svfirebutton.setBackground(new java.awt.Color(48, 117, 233));
svfirebutton.setFont(new java.awt.Font("Segoe UI", 1, 48)); // NOI18N
svfirebutton.setForeground(new java.awt.Color(255, 255, 255));
svfirebutton.setText("FIRE !!!");
svfirebutton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
svfirebuttonActionPerformed(evt);
}
});
deleteWorker.add(svfirebutton, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 240, 240, 70));
fireRes.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
fireRes.setForeground(new java.awt.Color(48, 117, 233));
deleteWorker.add(fireRes, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 340, 260, 30));
jTabbedPane2.addTab("Delete SV", deleteWorker);
javax.swing.GroupLayout svListLayout = new javax.swing.GroupLayout(svList);
svList.setLayout(svListLayout);
svListLayout.setHorizontalGroup(
svListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane2)
);
svListLayout.setVerticalGroup(
svListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane2)
);
jPanelSlider1.add(svList, "card3");
inbox.setBackground(new java.awt.Color(255, 255, 255));
inbox.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
inbox.setPreferredSize(new java.awt.Dimension(879, 462));
messTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"From", "Subject"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(messTable);
showMessBut.setText("Show Message");
showMessBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showMessButActionPerformed(evt);
}
});
sendMessBut.setText("Send Message");
sendMessBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendMessButActionPerformed(evt);
}
});
javax.swing.GroupLayout inboxLayout = new javax.swing.GroupLayout(inbox);
inbox.setLayout(inboxLayout);
inboxLayout.setHorizontalGroup(
inboxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(inboxLayout.createSequentialGroup()
.addComponent(showMessBut, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(sendMessBut, javax.swing.GroupLayout.PREFERRED_SIZE, 430, javax.swing.GroupLayout.PREFERRED_SIZE))
);
inboxLayout.setVerticalGroup(
inboxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(inboxLayout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
.addGroup(inboxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(showMessBut, javax.swing.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE)
.addComponent(sendMessBut, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
jPanelSlider1.add(inbox, "card2");
showMessage.setBackground(new java.awt.Color(255, 255, 255));
showMessage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
showMessage.setPreferredSize(new java.awt.Dimension(875, 501));
showMess.setEditable(false);
showMess.setColumns(20);
showMess.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N
showMess.setRows(5);
jScrollPane3.setViewportView(showMess);
jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel5.setForeground(new java.awt.Color(48, 117, 233));
jLabel5.setText("Message :");
jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel6.setForeground(new java.awt.Color(48, 117, 233));
jLabel6.setText("Subject :");
jLabel7.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel7.setForeground(new java.awt.Color(48, 117, 233));
jLabel7.setText("From :");
fromLabel.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
subjectLabel.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
jButton5.setBackground(new java.awt.Color(66, 133, 245));
jButton5.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jButton5.setForeground(new java.awt.Color(255, 255, 255));
jButton5.setText("Go Back");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout showMessageLayout = new javax.swing.GroupLayout(showMessage);
showMessage.setLayout(showMessageLayout);
showMessageLayout.setHorizontalGroup(
showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(40, 40, 40)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fromLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(650, 650, 650)
.addComponent(jButton5))))
.addGroup(showMessageLayout.createSequentialGroup()
.addComponent(jLabel6)
.addGap(27, 27, 27)
.addComponent(subjectLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(showMessageLayout.createSequentialGroup()
.addComponent(jLabel5)
.addGap(19, 19, 19)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
.addComponent(jLabel20)))
.addContainerGap())
);
showMessageLayout.setVerticalGroup(
showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(fromLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5))
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(13, 13, 13)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(subjectLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(showMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addGroup(showMessageLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(46, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, showMessageLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel20)
.addContainerGap())))
);
jPanelSlider1.add(showMessage, "card2");
marketList.setBackground(new java.awt.Color(255, 255, 255));
marketList.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
marketList.setPreferredSize(new java.awt.Dimension(875, 501));
markList.setFont(new java.awt.Font("Segoe UI", 0, 36)); // NOI18N
markList.setToolTipText("");
markList.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
markListActionPerformed(evt);
}
});
supervise.setBackground(new java.awt.Color(48, 117, 233));
supervise.setFont(new java.awt.Font("Segoe UI", 1, 60)); // NOI18N
supervise.setForeground(new java.awt.Color(255, 255, 255));
supervise.setText("Supervise");
supervise.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
superviseActionPerformed(evt);
}
});
jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout marketListLayout = new javax.swing.GroupLayout(marketList);
marketList.setLayout(marketListLayout);
marketListLayout.setHorizontalGroup(
marketListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(marketListLayout.createSequentialGroup()
.addGap(270, 270, 270)
.addGroup(marketListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(marketListLayout.createSequentialGroup()
.addComponent(supervise, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
.addComponent(jLabel21))
.addComponent(markList, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
marketListLayout.setVerticalGroup(
marketListLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(marketListLayout.createSequentialGroup()
.addGap(60, 60, 60)
.addComponent(markList, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90)
.addComponent(supervise, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
.addComponent(jLabel21)
.addContainerGap())
);
jPanelSlider1.add(marketList, "card2");
sendMessage.setBackground(new java.awt.Color(255, 255, 255));
sendMessage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 133, 245), 10));
sendMessage.setPreferredSize(new java.awt.Dimension(879, 462));
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Segoe UI", 0, 12)); // NOI18N
jTextArea1.setRows(5);
jScrollPane2.setViewportView(jTextArea1);
jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel2.setForeground(new java.awt.Color(48, 117, 233));
jLabel2.setText("Subject :");
jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel3.setForeground(new java.awt.Color(48, 117, 233));
jLabel3.setText("To :");
jTextField2.setFont(new java.awt.Font("Segoe UI", 0, 12)); // NOI18N
jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jLabel4.setForeground(new java.awt.Color(48, 117, 233));
jLabel4.setText("Message :");
jButton3.setBackground(new java.awt.Color(66, 133, 245));
jButton3.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jButton3.setForeground(new java.awt.Color(255, 255, 255));
jButton3.setText("Send");
jButton4.setBackground(new java.awt.Color(66, 133, 245));
jButton4.setFont(new java.awt.Font("Segoe UI", 1, 13)); // NOI18N
jButton4.setForeground(new java.awt.Color(255, 255, 255));
jButton4.setText("Go Back");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
sendID.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendIDActionPerformed(evt);
}
});
jLabel22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/bluelogo.png"))); // NOI18N
javax.swing.GroupLayout sendMessageLayout = new javax.swing.GroupLayout(sendMessage);
sendMessage.setLayout(sendMessageLayout);
sendMessageLayout.setHorizontalGroup(
sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel22)
.addContainerGap())
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(46, 46, 46)
.addComponent(sendID, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(20, 20, 20)
.addComponent(showID, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(410, 410, 410)
.addComponent(jButton4))
.addGroup(sendMessageLayout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(17, 17, 17)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(sendMessageLayout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(9, 9, 9)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 28, Short.MAX_VALUE))
);
sendMessageLayout.setVerticalGroup(
sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(sendID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(showID, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4))
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(sendMessageLayout.createSequentialGroup()
.addGap(13, 13, 13)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(sendMessageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addComponent(jButton3)
.addGap(0, 25, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, sendMessageLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel22)
.addContainerGap())))
);
jPanelSlider1.add(sendMessage, "card2");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanelSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, 501, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 902, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 636, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void LogoutButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMouseEntered
buttonEnter(LogoutButton);
}//GEN-LAST:event_LogoutButtonMouseEntered
private void LogoutButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMouseExited
buttonExit(LogoutButton);
}//GEN-LAST:event_LogoutButtonMouseExited
private void LogoutButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMousePressed
if(evt.getButton() == BUTTON1)
buttonPress(LogoutButton);
}//GEN-LAST:event_LogoutButtonMousePressed
private void LogoutButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutButtonMouseReleased
buttonRelease(LogoutButton);
if(clicked && in){
login p = new login();
p.setVisible(true);
clicked = false;
this.dispose();
}
}//GEN-LAST:event_LogoutButtonMouseReleased
private void rightButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMouseEntered
if(rightButton.isEnabled())
buttonEnter(rightButton);
}//GEN-LAST:event_rightButtonMouseEntered
private void rightButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMouseExited
if(rightButton.isEnabled())
buttonExit(rightButton);
}//GEN-LAST:event_rightButtonMouseExited
private void rightButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMousePressed
if(evt.getButton() == BUTTON1 && rightButton.isEnabled())
buttonPress(rightButton);
}//GEN-LAST:event_rightButtonMousePressed
private void rightButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rightButtonMouseReleased
if(rightButton.isEnabled())
buttonRelease(rightButton);
if(in){
if(clicked && info_bool){
jPanelSlider1.nextPanel(10,svList, jPanelSlider1.right);
pos_sv.setForeground(new Color(255,204,51));
pos_info.setForeground(Color.white);
sv_bool = true;
info_bool=false;
}
else if(clicked && sv_bool){
jPanelSlider1.nextPanel(10,marketList, jPanelSlider1.right);
pos_market.setForeground(new Color(255,204,51));
pos_sv.setForeground(Color.white);
market_bool = true;
sv_bool=false;
}
else if(clicked && market_bool){
jPanelSlider1.nextPanel(10,inbox, jPanelSlider1.right);
pos_inbox.setForeground(new Color(255,204,51));
pos_market.setForeground(Color.white);
inbox_bool = true;
market_bool=false;
}
else if(clicked && inbox_bool){
jPanelSlider1.nextPanel(10,info, jPanelSlider1.right);
pos_info.setForeground(new Color(255,204,51));
pos_inbox.setForeground(Color.white);
info_bool = true;
inbox_bool=false;
}
}
clicked = false;
}//GEN-LAST:event_rightButtonMouseReleased
private void showMessButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showMessButActionPerformed
try{
rightButton.setEnabled(false);
fromLabel.setText(messTable.getValueAt(messTable.getSelectedRow(), 0).toString());
subjectLabel.setText(messTable.getValueAt(messTable.getSelectedRow(), 1).toString());
jPanelSlider1.nextPanel(10, showMessage , jPanelSlider1.left);}
catch(ArrayIndexOutOfBoundsException e){
JOptionPane.showMessageDialog(jDialog1,
"You have to select a row to see a message",
"Error",
JOptionPane.WARNING_MESSAGE);
}
Message find = myMess.get(messTable.getSelectedRow());
if(find != null){
find.updateCheck();
showMess.setText(myMess.get(messTable.getSelectedRow()).getContext());
setClear();
}
}//GEN-LAST:event_showMessButActionPerformed
private void sendMessButActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendMessButActionPerformed
rightButton.setEnabled(false);
jPanelSlider1.nextPanel(10, sendMessage, jPanelSlider1.left);
}//GEN-LAST:event_sendMessButActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
rightButton.setEnabled(true);
jPanelSlider1.nextPanel(10, inbox, jPanelSlider1.right);
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
rightButton.setEnabled(true);
jPanelSlider1.nextPanel(10, inbox, jPanelSlider1.right);
}//GEN-LAST:event_jButton4ActionPerformed
private void addSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSVActionPerformed
if(!(addName.getText().equalsIgnoreCase("")||addName.getText().equals(null))&&!(addSName.getText().equalsIgnoreCase("")||addSName.getText().equals(null))&&!(addPlace.getText().equalsIgnoreCase("")||addPlace.getText().equals(null))&&!(addSalary.getText().equalsIgnoreCase("")||addSalary.getText().equals(null))){
boolean flag=false;
boolean af=false;
DefaultTableModel a=(DefaultTableModel)svTable.getModel();
for(int i=0;i<allStore.size();i++){
if(Integer.parseInt(addPlace.getText())==allStore.get(i).getStoreID()){
flag=true;
}
}
if(flag){
Employee add=new Employee(addName.getText(),addSName.getText(),Integer.parseInt(addPlace.getText()));
add.setSalary(Double.parseDouble(addSalary.getText()));
add.setStatus("SV");
af=add.add_item(add);
if(af){addResult.setText("SUCCESS!!");
addName.setText("");
addSName.setText("");
addPlace.setText("");
addSalary.setText("");
svfireid.addItem(add.getId()+"");
a.addRow(new Object[]{add.getId(),
add.getName(),
add.getSurname()});
sendID.addItem(add.getId()+"");
setClear();
}
else {addResult.setText("FAILURE!!Fill All Fields!");}
}else{
addResult.setText("No Matching MarketID!");
}
}else{
addResult.setText("All fields Must be filled!");
}
}//GEN-LAST:event_addSVActionPerformed
private void svfireidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_svfireidActionPerformed
if(!svfireid.getSelectedItem().toString().equalsIgnoreCase(null)&&!svfireid.getSelectedItem().toString().equalsIgnoreCase("NONE")&&!svfireid.getSelectedItem().toString().equalsIgnoreCase("")){
firePerson=(Employee)infoPerson.get_item(Integer.parseInt(svfireid.getSelectedItem().toString()));
svfirename.setText(firePerson.getName());
svfiresname.setText(firePerson.getSurname());
svfirecomp.setText(firePerson.getSalary()+"");
}else{
svfirename.setText("");
svfiresname.setText("");
svfirecomp.setText("");
firePerson=new Employee();
}
}//GEN-LAST:event_svfireidActionPerformed
private void svfirebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_svfirebuttonActionPerformed
DefaultTableModel a=(DefaultTableModel)svTable.getModel();
if(!svfireid.getSelectedItem().toString().equalsIgnoreCase("NONE")){
all=infoPerson.delete_item(all, Integer.parseInt(svfireid.getSelectedItem().toString()));
fireRes.setText("FIRED!!");
//sendID.remove(sendID);
int fired = Integer.parseInt(svfireid.getSelectedItem().toString());
System.out.println(fired);
svfireid.removeItemAt(svfireid.getSelectedIndex());
for(int i=0;i<a.getRowCount();i++){
Employee r=(Employee)infoPerson.get_item(Integer.parseInt(svfireid.getSelectedItem().toString()));
if((Integer.parseInt(a.getValueAt(i, 0).toString()))==r.getId()){
a.removeRow(i+1);
}
}
int cbsize = sendID.getItemCount();
for (int i = 0; i < cbsize; i++) {
int prs = Integer.parseInt(sendID.getItemAt(i).toString());
if(prs == fired){
System.out.println("checked");
sendID.removeItemAt(i);
}
}
setClear();
}else{
fireRes.setText("FAILURE!");
}
}//GEN-LAST:event_svfirebuttonActionPerformed
private void sendIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendIDActionPerformed
// TODO add your handling code here:
showID.setText(((Employee)infoPerson.get_item(Integer.parseInt(sendID.getSelectedItem().toString()))).getName()+" "+((Employee)infoPerson.get_item(Integer.parseInt(sendID.getSelectedItem().toString()))).getSurname());
}//GEN-LAST:event_sendIDActionPerformed
private void markListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_markListActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_markListActionPerformed
private void superviseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_superviseActionPerformed
// TODO add your handling code here:
int supID = Integer.parseInt(markList.getSelectedItem().toString().split("/")[0]);
ceoSupervisorPanel shift = new ceoSupervisorPanel(Store.findStore(allStore, supID), ceo);
shift.setVisible(true);
this.dispose();
}//GEN-LAST:event_superviseActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel LogoutButton;
private javax.swing.JTextField addName;
private javax.swing.JTextField addPlace;
private javax.swing.JLabel addResult;
private javax.swing.JTextField addSName;
private javax.swing.JButton addSV;
private javax.swing.JTextField addSalary;
private javax.swing.JPanel addWorker;
private javax.swing.JLabel ceoID;
private javax.swing.JLabel ceoName;
private javax.swing.JLabel ceoSName;
private javax.swing.JLabel ceoSalary;
private javax.swing.JLabel ceoStart;
private javax.swing.JPanel deleteWorker;
private javax.swing.JLabel fireRes;
private javax.swing.JLabel fromLabel;
private javax.swing.JPanel inbox;
private javax.swing.JPanel info;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JDialog jDialog1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private diu.swe.habib.JPanelSlider.JPanelSlider jPanelSlider1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField2;
private javax.swing.JComboBox<String> markList;
private javax.swing.JPanel marketList;
private javax.swing.JTable messTable;
private javax.swing.JLabel pos_inbox;
private javax.swing.JLabel pos_info;
private javax.swing.JLabel pos_market;
private javax.swing.JLabel pos_sv;
private javax.swing.JLabel rightButton;
private javax.swing.JComboBox<String> sendID;
private javax.swing.JButton sendMessBut;
private javax.swing.JPanel sendMessage;
private javax.swing.JLabel showID;
private javax.swing.JTextArea showMess;
private javax.swing.JButton showMessBut;
private javax.swing.JPanel showMessage;
private javax.swing.JLabel subjectLabel;
private javax.swing.JButton supervise;
private javax.swing.JPanel svList;
private javax.swing.JTable svTable;
private javax.swing.JButton svfirebutton;
private javax.swing.JLabel svfirecomp;
private javax.swing.JComboBox<String> svfireid;
private javax.swing.JLabel svfirename;
private javax.swing.JLabel svfiresname;
// End of variables declaration//GEN-END:variables
void buttonExit(Component c){
timer1.cancel();
timer3.cancel();
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() >= 48) {
c.setBackground(new Color(c.getBackground().getRed()-1,c.getBackground().getGreen()-1,c.getBackground().getBlue()));
}
else if(c.getBackground().getRed() < 48){
c.setBackground(new Color(c.getBackground().getRed()+1,c.getBackground().getGreen()+1,c.getBackground().getBlue()));
}
}
};
in = false;
timer2 = new Timer();
timer2.scheduleAtFixedRate(task1, 0, 20);
}
void buttonEnter(Component c){
timer3.cancel();
timer2.cancel();
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() <= 60) {
c.setBackground(new Color(c.getBackground().getRed()+1,c.getBackground().getGreen()+1,c.getBackground().getBlue()));
}
}
};
in = true;
timer1 = new Timer();
timer1.scheduleAtFixedRate(task1, 0, 20);
}
void buttonPress(Component c){
timer1.cancel();
timer2.cancel();
clicked = true;
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() >= 28) {
c.setBackground(new Color(c.getBackground().getRed()-1,c.getBackground().getGreen()-1,c.getBackground().getBlue()));
}
}
};
timer3 = new Timer();
timer3.scheduleAtFixedRate(task1, 0, 20);
}
void buttonRelease(Component c){
if(in){
timer2.cancel();
timer3.cancel();
TimerTask task1 = new TimerTask() {
@Override
public void run() {
if (c.getBackground().getRed() <= 60) {
c.setBackground(new Color(c.getBackground().getRed()+1,c.getBackground().getGreen()+1,c.getBackground().getBlue()));
}
}
};
timer1 = new Timer();
timer1.scheduleAtFixedRate(task1, 0, 20);
}
}
}
| 65,770 | 0.62408 | 0.595067 | 1,374 | 46.863174 | 35.692181 | 319 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9869 | false | false | 8 |
8308a599b1d7911cde0db3efa78a2c24b88890a1 | 19,602,230,765,482 | 5f11bb1fa4a480b205b201dd3002cf22b5d49094 | /src/main/java/com/qinwei/deathnote/beans/bean/RootBeanDefinition.java | d6956703979b30add358418e290c009c781c77f4 | [
"Apache-2.0"
]
| permissive | qinweiVae/deathnote | https://github.com/qinweiVae/deathnote | 4f2ddfbbf9f6731e340a2efd3600feede235eee6 | 00323313562d8407e05d879407643d0767ffa00d | refs/heads/master | 2022-07-07T09:22:01.160000 | 2021-07-20T02:50:10 | 2021-07-20T02:50:10 | 186,126,556 | 0 | 0 | Apache-2.0 | false | 2022-06-17T02:09:49 | 2019-05-11T11:49:50 | 2021-07-20T02:50:12 | 2022-06-17T02:09:49 | 863 | 0 | 0 | 6 | Java | false | false | package com.qinwei.deathnote.beans.bean;
import java.lang.reflect.Member;
import java.util.HashSet;
import java.util.Set;
/**
* @author qinwei
* @date 2019-05-24
*/
public class RootBeanDefinition extends AbstractBeanDefinition {
private final Object lock = new Object();
private BeanDefinitionHolder decoratedDefinition;
private Set<Member> externallyConfigMembers;
private Set<String> externallyInitMethods;
private Set<String> externallyDestroyMethods;
public RootBeanDefinition() {
}
public RootBeanDefinition(Class<?> beanClass) {
setBeanClass(beanClass);
}
public RootBeanDefinition(String beanClassName) {
setBeanClassName(beanClassName);
}
public RootBeanDefinition(BeanDefinition beanDefinition) {
setBeanClassName(beanDefinition.getBeanClassName());
setFactoryBeanName(beanDefinition.getFactoryBeanName());
setFactoryMethod(beanDefinition.getFactoryMethod());
setScope(beanDefinition.getScope());
setAbstract(beanDefinition.isAbstract());
setDependsOn(beanDefinition.getDependsOn());
setPrimary(beanDefinition.isPrimary());
setInitMethodName(beanDefinition.getInitMethodName());
setDestroyMethodName(beanDefinition.getDestroyMethodName());
setPropertyValues(beanDefinition.getPropertyValues());
if (beanDefinition instanceof AbstractBeanDefinition) {
if (((AbstractBeanDefinition) beanDefinition).hasBeanClass()) {
setBeanClass(beanDefinition.getBeanClass());
}
Boolean lazyInit = ((AbstractBeanDefinition) beanDefinition).getLazyInit();
if (lazyInit != null) {
setLazyInit(lazyInit);
}
}
}
public BeanDefinitionHolder getDecoratedDefinition() {
return decoratedDefinition;
}
public void setDecoratedDefinition(BeanDefinitionHolder decoratedDefinition) {
this.decoratedDefinition = decoratedDefinition;
}
public void registerExternallyConfigMember(Member configMember) {
synchronized (lock) {
if (externallyConfigMembers == null) {
externallyConfigMembers = new HashSet<>(1);
}
externallyConfigMembers.add(configMember);
}
}
public boolean isExternallyConfigMember(Member configMember) {
synchronized (lock) {
return externallyConfigMembers != null && externallyConfigMembers.contains(configMember);
}
}
public void registerExternallyInitMethod(String initMethod) {
synchronized (lock) {
if (externallyInitMethods == null) {
externallyInitMethods = new HashSet<>(1);
}
externallyInitMethods.add(initMethod);
}
}
public boolean isExternallyInitMethod(String initMethod) {
synchronized (lock) {
return externallyInitMethods != null && externallyInitMethods.contains(initMethod);
}
}
public void registerExternallyDestroyMethod(String destroyMethod) {
synchronized (lock) {
if (externallyDestroyMethods == null) {
externallyDestroyMethods = new HashSet<>(1);
}
externallyDestroyMethods.add(destroyMethod);
}
}
public boolean isExternallyDestroyMethod(String destroyMethod) {
synchronized (lock) {
return externallyDestroyMethods != null && externallyDestroyMethods.contains(destroyMethod);
}
}
@Override
protected RootBeanDefinition cloneBeanDefinition() {
return new RootBeanDefinition(this);
}
}
| UTF-8 | Java | 3,673 | java | RootBeanDefinition.java | Java | [
{
"context": "til.HashSet;\nimport java.util.Set;\n\n/**\n * @author qinwei\n * @date 2019-05-24\n */\npublic class RootBeanDefi",
"end": 145,
"score": 0.9995169639587402,
"start": 139,
"tag": "USERNAME",
"value": "qinwei"
}
]
| null | []
| package com.qinwei.deathnote.beans.bean;
import java.lang.reflect.Member;
import java.util.HashSet;
import java.util.Set;
/**
* @author qinwei
* @date 2019-05-24
*/
public class RootBeanDefinition extends AbstractBeanDefinition {
private final Object lock = new Object();
private BeanDefinitionHolder decoratedDefinition;
private Set<Member> externallyConfigMembers;
private Set<String> externallyInitMethods;
private Set<String> externallyDestroyMethods;
public RootBeanDefinition() {
}
public RootBeanDefinition(Class<?> beanClass) {
setBeanClass(beanClass);
}
public RootBeanDefinition(String beanClassName) {
setBeanClassName(beanClassName);
}
public RootBeanDefinition(BeanDefinition beanDefinition) {
setBeanClassName(beanDefinition.getBeanClassName());
setFactoryBeanName(beanDefinition.getFactoryBeanName());
setFactoryMethod(beanDefinition.getFactoryMethod());
setScope(beanDefinition.getScope());
setAbstract(beanDefinition.isAbstract());
setDependsOn(beanDefinition.getDependsOn());
setPrimary(beanDefinition.isPrimary());
setInitMethodName(beanDefinition.getInitMethodName());
setDestroyMethodName(beanDefinition.getDestroyMethodName());
setPropertyValues(beanDefinition.getPropertyValues());
if (beanDefinition instanceof AbstractBeanDefinition) {
if (((AbstractBeanDefinition) beanDefinition).hasBeanClass()) {
setBeanClass(beanDefinition.getBeanClass());
}
Boolean lazyInit = ((AbstractBeanDefinition) beanDefinition).getLazyInit();
if (lazyInit != null) {
setLazyInit(lazyInit);
}
}
}
public BeanDefinitionHolder getDecoratedDefinition() {
return decoratedDefinition;
}
public void setDecoratedDefinition(BeanDefinitionHolder decoratedDefinition) {
this.decoratedDefinition = decoratedDefinition;
}
public void registerExternallyConfigMember(Member configMember) {
synchronized (lock) {
if (externallyConfigMembers == null) {
externallyConfigMembers = new HashSet<>(1);
}
externallyConfigMembers.add(configMember);
}
}
public boolean isExternallyConfigMember(Member configMember) {
synchronized (lock) {
return externallyConfigMembers != null && externallyConfigMembers.contains(configMember);
}
}
public void registerExternallyInitMethod(String initMethod) {
synchronized (lock) {
if (externallyInitMethods == null) {
externallyInitMethods = new HashSet<>(1);
}
externallyInitMethods.add(initMethod);
}
}
public boolean isExternallyInitMethod(String initMethod) {
synchronized (lock) {
return externallyInitMethods != null && externallyInitMethods.contains(initMethod);
}
}
public void registerExternallyDestroyMethod(String destroyMethod) {
synchronized (lock) {
if (externallyDestroyMethods == null) {
externallyDestroyMethods = new HashSet<>(1);
}
externallyDestroyMethods.add(destroyMethod);
}
}
public boolean isExternallyDestroyMethod(String destroyMethod) {
synchronized (lock) {
return externallyDestroyMethods != null && externallyDestroyMethods.contains(destroyMethod);
}
}
@Override
protected RootBeanDefinition cloneBeanDefinition() {
return new RootBeanDefinition(this);
}
}
| 3,673 | 0.671386 | 0.668391 | 114 | 31.219297 | 27.751959 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 8 |
a529d61bbdca794f541c1f20978cdb59e21d2903 | 1,065,151,928,546 | 3a8c55736cb78e26f3e1db622d77e949029fde3a | /src/com/ordertaker/service/impl/LoginServiceImpl.java | 69851e9ab9e00bc483841df1918bc5e8e8a30411 | []
| no_license | arneillepascual/Order-Taker | https://github.com/arneillepascual/Order-Taker | e475fc392f31b14e44ab6ab6a4290cf1c75ac4a5 | 9826031600be5ffa4ee426c3f2cb0ef071936b07 | refs/heads/master | 2020-03-29T21:34:07.218000 | 2018-09-26T21:03:20 | 2018-09-26T21:03:20 | 150,374,185 | 0 | 0 | null | true | 2018-09-26T05:43:23 | 2018-09-26T05:43:21 | 2018-09-26T05:36:30 | 2018-09-26T05:36:29 | 0 | 0 | 0 | 0 | null | false | null | package com.ordertaker.service.impl;
import com.ordertaker.service.LoginService;
public class LoginServiceImpl implements LoginService {
}
| UTF-8 | Java | 149 | java | LoginServiceImpl.java | Java | []
| null | []
| package com.ordertaker.service.impl;
import com.ordertaker.service.LoginService;
public class LoginServiceImpl implements LoginService {
}
| 149 | 0.791946 | 0.791946 | 7 | 19.285715 | 22.575045 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 8 |
54b181ad5c23de68f7f9793183405edc791ef3a3 | 4,930,622,496,777 | 61a4d2e9155c40d784b04bde97dcfe8883a08585 | /src/kontrollstrukturer2/oppgave2.java | 437570b94b2b05fba766ed8e24c810d4ad0202d0 | []
| no_license | krissmed/DAPE1400-Ukesoppgaver | https://github.com/krissmed/DAPE1400-Ukesoppgaver | 57d0e6d63edb72f5c34d2305e92f71d6f038cd77 | f066e155a53fad5ba0c7580b18eb06210b112209 | refs/heads/master | 2023-02-12T01:43:57.182000 | 2021-01-08T10:17:20 | 2021-01-08T10:17:20 | 314,557,259 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kontrollstrukturer2;
public class oppgave2 {
public static void main(String[] args) {
int sum = 0;
for(int i=0;i<10;i++){
sum += i;
}
System.out.print(sum);
}
}
| UTF-8 | Java | 222 | java | oppgave2.java | Java | []
| null | []
| package kontrollstrukturer2;
public class oppgave2 {
public static void main(String[] args) {
int sum = 0;
for(int i=0;i<10;i++){
sum += i;
}
System.out.print(sum);
}
}
| 222 | 0.518018 | 0.490991 | 11 | 19.181818 | 13.313139 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 8 |
7ce37829f06d94a74d3fb519513ad2c486c6ba63 | 20,040,317,405,409 | 9f8792f9601a01f8c222d2016856466a9215855c | /core/src/main/java/io/github/spleefx/perk/AcidicSnowballsPerk.java | c7c45646c5602bee4c0050415e9d0d7e7acf4ee3 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
]
| permissive | The-HyperZone/SpleefX | https://github.com/The-HyperZone/SpleefX | e68c9a1eab4e03e3c93b34a82de30eb13e61da29 | 4a658ca33be0c12964742b50b5adc9caff0f7186 | refs/heads/master | 2023-02-14T05:12:54.544000 | 2020-07-09T11:12:26 | 2020-07-09T11:12:26 | 285,593,093 | 1 | 0 | Apache-2.0 | true | 2020-08-06T14:30:46 | 2020-08-06T14:30:46 | 2020-07-29T19:55:31 | 2020-08-04T14:30:42 | 1,046 | 0 | 0 | 0 | null | false | false | /*
* * Copyright 2020 github.com/ReflxctionDev
*
* 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 io.github.spleefx.perk;
import com.google.gson.annotations.Expose;
import io.github.spleefx.arena.ArenaPlayer;
import io.github.spleefx.arena.ArenaStage;
import io.github.spleefx.arena.api.GameArena;
import io.github.spleefx.compatibility.CompatibilityHandler;
import io.github.spleefx.extension.ItemHolder;
import io.github.spleefx.extension.standard.splegg.SpleggExtension.ProjectileType;
import io.github.spleefx.util.game.Metas;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Set;
/**
* A snowball that removes blocks it gets shoot in
*/
@SuppressWarnings("Convert2MethodRef")
public class AcidicSnowballsPerk extends GamePerk implements Listener {
private static final String METADATA = "acidic_snowball";
@Expose
private ProjectileType projectileType;
@Expose
private int projectileItemSlot;
@Expose
private ItemHolder projectileItem;
@Expose
private Set<Material> nonDestroyableBlocks = new HashSet<>();
@Expose
private Set<Action> clickTypes = new HashSet<>();
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if (!e.hasItem()) return;
Player p = e.getPlayer();
ArenaPlayer player = ArenaPlayer.adapt(e.getPlayer());
if (clickTypes == null || !clickTypes.contains(e.getAction())) return;
GameArena arena = player.getCurrentArena();
if (arena == null) return;
if (arena.getEngine().getArenaStage() != ArenaStage.ACTIVE) return;
if (!canUse(player.getCurrentArena().getExtension())) return;
if (!CompatibilityHandler.either(() -> p.getInventory().getItemInMainHand(), () -> p.getItemInHand()).isSimilar(projectileItem.factory().create())) return;
onActivate(player);
e.setCancelled(true);
}
/**
* Gives this perk to the specified player
*
* @param player Player to give
*/
@Override
public void giveToPlayer(ArenaPlayer player) {
super.giveToPlayer(player);
player.getPlayer().getInventory().setItem(projectileItemSlot, projectileItem.factory().create());
}
/**
* Invoked when the perk is activated
*
* @param player The player that activated this perk
*/
@Override
public void onActivate(ArenaPlayer player) {
Player p = player.getPlayer();
ItemStack m = CompatibilityHandler.either(() -> p.getInventory().getItemInMainHand(), () -> p.getItemInHand());
m.setAmount(m.getAmount() - 1);
Projectile projectile = p.launchProjectile(projectileType.getProjectileClass());
Metas.set(projectile, METADATA, player);
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
if (!(event.getEntity() instanceof Projectile)) return;
Projectile projectile = event.getEntity();
if (!projectile.hasMetadata(METADATA)) return;
ArenaPlayer shooter = Metas.get(projectile, METADATA);
if (shooter.getCurrentArena() == null) return;
if (!canUse(shooter.getCurrentArena().getExtension())) return;
Block hitBlock = CompatibilityHandler.getHitBlock(null, event);
GameArena arena = shooter.getCurrentArena();
if (hitBlock != null)
if (arena.getEngine().getArenaStage() == ArenaStage.ACTIVE)
if (!nonDestroyableBlocks.contains(hitBlock.getType()))
if (CompatibilityHandler.getWorldGuardHook().canBreak(shooter.getPlayer(), hitBlock))
hitBlock.setType(Material.AIR);
projectile.remove();
}
} | UTF-8 | Java | 4,552 | java | AcidicSnowballsPerk.java | Java | [
{
"context": "/*\n * * Copyright 2020 github.com/ReflxctionDev\n *\n * Licensed under the Apache License, Version ",
"end": 47,
"score": 0.9991368055343628,
"start": 34,
"tag": "USERNAME",
"value": "ReflxctionDev"
}
]
| null | []
| /*
* * Copyright 2020 github.com/ReflxctionDev
*
* 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 io.github.spleefx.perk;
import com.google.gson.annotations.Expose;
import io.github.spleefx.arena.ArenaPlayer;
import io.github.spleefx.arena.ArenaStage;
import io.github.spleefx.arena.api.GameArena;
import io.github.spleefx.compatibility.CompatibilityHandler;
import io.github.spleefx.extension.ItemHolder;
import io.github.spleefx.extension.standard.splegg.SpleggExtension.ProjectileType;
import io.github.spleefx.util.game.Metas;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Set;
/**
* A snowball that removes blocks it gets shoot in
*/
@SuppressWarnings("Convert2MethodRef")
public class AcidicSnowballsPerk extends GamePerk implements Listener {
private static final String METADATA = "acidic_snowball";
@Expose
private ProjectileType projectileType;
@Expose
private int projectileItemSlot;
@Expose
private ItemHolder projectileItem;
@Expose
private Set<Material> nonDestroyableBlocks = new HashSet<>();
@Expose
private Set<Action> clickTypes = new HashSet<>();
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if (!e.hasItem()) return;
Player p = e.getPlayer();
ArenaPlayer player = ArenaPlayer.adapt(e.getPlayer());
if (clickTypes == null || !clickTypes.contains(e.getAction())) return;
GameArena arena = player.getCurrentArena();
if (arena == null) return;
if (arena.getEngine().getArenaStage() != ArenaStage.ACTIVE) return;
if (!canUse(player.getCurrentArena().getExtension())) return;
if (!CompatibilityHandler.either(() -> p.getInventory().getItemInMainHand(), () -> p.getItemInHand()).isSimilar(projectileItem.factory().create())) return;
onActivate(player);
e.setCancelled(true);
}
/**
* Gives this perk to the specified player
*
* @param player Player to give
*/
@Override
public void giveToPlayer(ArenaPlayer player) {
super.giveToPlayer(player);
player.getPlayer().getInventory().setItem(projectileItemSlot, projectileItem.factory().create());
}
/**
* Invoked when the perk is activated
*
* @param player The player that activated this perk
*/
@Override
public void onActivate(ArenaPlayer player) {
Player p = player.getPlayer();
ItemStack m = CompatibilityHandler.either(() -> p.getInventory().getItemInMainHand(), () -> p.getItemInHand());
m.setAmount(m.getAmount() - 1);
Projectile projectile = p.launchProjectile(projectileType.getProjectileClass());
Metas.set(projectile, METADATA, player);
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
if (!(event.getEntity() instanceof Projectile)) return;
Projectile projectile = event.getEntity();
if (!projectile.hasMetadata(METADATA)) return;
ArenaPlayer shooter = Metas.get(projectile, METADATA);
if (shooter.getCurrentArena() == null) return;
if (!canUse(shooter.getCurrentArena().getExtension())) return;
Block hitBlock = CompatibilityHandler.getHitBlock(null, event);
GameArena arena = shooter.getCurrentArena();
if (hitBlock != null)
if (arena.getEngine().getArenaStage() == ArenaStage.ACTIVE)
if (!nonDestroyableBlocks.contains(hitBlock.getType()))
if (CompatibilityHandler.getWorldGuardHook().canBreak(shooter.getPlayer(), hitBlock))
hitBlock.setType(Material.AIR);
projectile.remove();
}
} | 4,552 | 0.703207 | 0.701011 | 121 | 36.628098 | 29.566603 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.578512 | false | false | 8 |
bf30f2e8ab11f72cef651b69777aabda50b8cc2e | 28,930,899,763,152 | 500b104bc8ed57d5daead3df2b20738059b7ef9a | /profilers/src/com/android/tools/profilers/cpu/CpuTraceArt.java | eb0b6c8ebb1ccbd7ef040324c9e4c9966abfc575 | []
| no_license | RepoForks/android-2 | https://github.com/RepoForks/android-2 | a9eb30effe202ef0b1ae7ff44d1b24ffde863aff | a69a3102b8bde36f434d72bb30bfe7e7628cf4ef | refs/heads/master | 2021-09-01T05:40:37.325000 | 2017-12-21T16:54:18 | 2017-12-21T16:54:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2016 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 com.android.tools.profilers.cpu;
import com.android.tools.adtui.model.HNode;
import com.android.tools.perflib.vmtrace.Call;
import com.android.tools.perflib.vmtrace.ClockType;
import com.android.tools.perflib.vmtrace.ThreadInfo;
import com.android.tools.perflib.vmtrace.VmTraceData;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class CpuTraceArt {
/**
* Tree representation of ART trace (generated from perflib tree).
* Keys are thread ids and values are their respective {@link HNode}
*/
Map<ThreadInfo, HNode<MethodModel>> myNodes;
public void parse(VmTraceData data) throws IOException {
myNodes = new HashMap<>();
// Convert perflib tree to HNode tree.
for (ThreadInfo threadInfo : data.getThreads()) {
if (threadInfo.getTopLevelCall() == null) {
continue;
}
myNodes.put(threadInfo, convertCallsToNode(data, threadInfo.getTopLevelCall(), 0));
}
}
private HNode<MethodModel> convertCallsToNode(VmTraceData data, Call call, int depth) {
HNode<MethodModel> node = new HNode<>();
// ART stores timestamp in a compressed fashion: All timestamp are 32 bits relative to a startTime.
// We need to reconstruct the full timestamp by adding each of them to startTime.
node.setStart((call.getEntryTime(ClockType.GLOBAL, TimeUnit.MICROSECONDS) + data.getStartTimeUs()));
node.setEnd((call.getExitTime(ClockType.GLOBAL, TimeUnit.MICROSECONDS) + data.getStartTimeUs()));
node.setDepth(depth);
MethodModel method = new MethodModel();
method.setName(data.getMethod(call.getMethodId()).methodName);
method.setNamespace(data.getMethod(call.getMethodId()).className);
node.setData(method);
for (Call callee : call.getCallees()) {
node.addHNode(convertCallsToNode(data, callee, depth + 1));
}
return node;
}
public Map<ThreadInfo, HNode<MethodModel>> getThreadsGraph() {
return myNodes;
}
}
| UTF-8 | Java | 2,619 | java | CpuTraceArt.java | Java | []
| null | []
| /*
* Copyright (C) 2016 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 com.android.tools.profilers.cpu;
import com.android.tools.adtui.model.HNode;
import com.android.tools.perflib.vmtrace.Call;
import com.android.tools.perflib.vmtrace.ClockType;
import com.android.tools.perflib.vmtrace.ThreadInfo;
import com.android.tools.perflib.vmtrace.VmTraceData;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class CpuTraceArt {
/**
* Tree representation of ART trace (generated from perflib tree).
* Keys are thread ids and values are their respective {@link HNode}
*/
Map<ThreadInfo, HNode<MethodModel>> myNodes;
public void parse(VmTraceData data) throws IOException {
myNodes = new HashMap<>();
// Convert perflib tree to HNode tree.
for (ThreadInfo threadInfo : data.getThreads()) {
if (threadInfo.getTopLevelCall() == null) {
continue;
}
myNodes.put(threadInfo, convertCallsToNode(data, threadInfo.getTopLevelCall(), 0));
}
}
private HNode<MethodModel> convertCallsToNode(VmTraceData data, Call call, int depth) {
HNode<MethodModel> node = new HNode<>();
// ART stores timestamp in a compressed fashion: All timestamp are 32 bits relative to a startTime.
// We need to reconstruct the full timestamp by adding each of them to startTime.
node.setStart((call.getEntryTime(ClockType.GLOBAL, TimeUnit.MICROSECONDS) + data.getStartTimeUs()));
node.setEnd((call.getExitTime(ClockType.GLOBAL, TimeUnit.MICROSECONDS) + data.getStartTimeUs()));
node.setDepth(depth);
MethodModel method = new MethodModel();
method.setName(data.getMethod(call.getMethodId()).methodName);
method.setNamespace(data.getMethod(call.getMethodId()).className);
node.setData(method);
for (Call callee : call.getCallees()) {
node.addHNode(convertCallsToNode(data, callee, depth + 1));
}
return node;
}
public Map<ThreadInfo, HNode<MethodModel>> getThreadsGraph() {
return myNodes;
}
}
| 2,619 | 0.73005 | 0.725468 | 72 | 35.375 | 30.644665 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.569444 | false | false | 8 |
1be4f02f50896c055bc526a60ef53886d43e41b8 | 30,107,720,814,841 | f1ae20067b125b58a5885fc174cafdcf52dbb25b | /app/src/main/java/id/co/wow/jumantik/Laporan/LaporanSliderAdapter.java | 059c3db393d799a1f08b26cb5b217b8da7291be4 | []
| no_license | gilangbujana/jumantik | https://github.com/gilangbujana/jumantik | 31289f4808e5f65550130c2dc69862aebd70867c | 1d60b9b98479613945e730c9af79a11a222fa563 | refs/heads/master | 2022-03-25T01:24:12.069000 | 2020-01-08T03:21:47 | 2020-01-08T03:21:47 | 231,274,018 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package id.co.wow.jumantik.Laporan;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.smarteist.autoimageslider.SliderViewAdapter;
import java.util.ArrayList;
import id.co.wow.jumantik.R;
public class LaporanSliderAdapter extends RecyclerView.Adapter<LaporanSliderAdapter.LaporanSliderAdapterVH> {
private Context context;
private ArrayList<String> arrRadioButton;
public LaporanSliderAdapter(Context context){
this.context = context;
arrRadioButton = new ArrayList<>();
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
}
@NonNull
@Override
public LaporanSliderAdapterVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_pernyataan, null);
return new LaporanSliderAdapterVH(inflate);
}
@Override
public void onBindViewHolder(LaporanSliderAdapterVH viewHolder, final int position) {
int id = viewHolder.rg_jentik.getCheckedRadioButtonId();
if(id==R.id.rb_aedes){
arrRadioButton.set(position,""+1);
}else if(id==R.id.rb_nonaedes){
arrRadioButton.set(position,""+2);
}else{
arrRadioButton.set(position,""+3);
}
switch (position){
case 0: viewHolder.tv_tmpt_laporan.setText("1. Bak Mandi"); break;
case 1: viewHolder.tv_tmpt_laporan.setText("2. Bak WC"); break;
case 2: viewHolder.tv_tmpt_laporan.setText("3. Tempayan"); break;
case 3: viewHolder.tv_tmpt_laporan.setText("4. Ember"); break;
case 4: viewHolder.tv_tmpt_laporan.setText("5. Dispenser"); break;
case 5: viewHolder.tv_tmpt_laporan.setText("6. Pot/vas Bunga"); break;
case 6: viewHolder.tv_tmpt_laporan.setText("7. Kolam/Aquarium"); break;
case 7: viewHolder.tv_tmpt_laporan.setText("8. Ban Bekas"); break;
case 8: viewHolder.tv_tmpt_laporan.setText("9. Botol/Kaleng Bekas"); break;
case 9: viewHolder.tv_tmpt_laporan.setText("10. Lain-lain"); break;
}
viewHolder.rg_jentik.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if(i==R.id.rb_aedes){
arrRadioButton.set(position,""+1);
}else if(i==R.id.rb_nonaedes){
arrRadioButton.set(position,""+2);
}else{
arrRadioButton.set(position,""+3);
}
}
});
}
@Override
public int getItemCount() {
return 10;
}
public ArrayList<String> getArrRadioButton(){
return this.arrRadioButton;
}
class LaporanSliderAdapterVH extends RecyclerView.ViewHolder{
View itemView;
TextView tv_tmpt_laporan;
RadioGroup rg_jentik;
public LaporanSliderAdapterVH(View itemView) {
super(itemView);
rg_jentik = itemView.findViewById(R.id.radiogrup_jentik);
tv_tmpt_laporan = itemView.findViewById(R.id.tv_tmpt_laporan);
this.itemView = itemView;
}
}
}
| UTF-8 | Java | 3,733 | java | LaporanSliderAdapter.java | Java | []
| null | []
| package id.co.wow.jumantik.Laporan;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.smarteist.autoimageslider.SliderViewAdapter;
import java.util.ArrayList;
import id.co.wow.jumantik.R;
public class LaporanSliderAdapter extends RecyclerView.Adapter<LaporanSliderAdapter.LaporanSliderAdapterVH> {
private Context context;
private ArrayList<String> arrRadioButton;
public LaporanSliderAdapter(Context context){
this.context = context;
arrRadioButton = new ArrayList<>();
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
arrRadioButton.add("");
}
@NonNull
@Override
public LaporanSliderAdapterVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_pernyataan, null);
return new LaporanSliderAdapterVH(inflate);
}
@Override
public void onBindViewHolder(LaporanSliderAdapterVH viewHolder, final int position) {
int id = viewHolder.rg_jentik.getCheckedRadioButtonId();
if(id==R.id.rb_aedes){
arrRadioButton.set(position,""+1);
}else if(id==R.id.rb_nonaedes){
arrRadioButton.set(position,""+2);
}else{
arrRadioButton.set(position,""+3);
}
switch (position){
case 0: viewHolder.tv_tmpt_laporan.setText("1. Bak Mandi"); break;
case 1: viewHolder.tv_tmpt_laporan.setText("2. Bak WC"); break;
case 2: viewHolder.tv_tmpt_laporan.setText("3. Tempayan"); break;
case 3: viewHolder.tv_tmpt_laporan.setText("4. Ember"); break;
case 4: viewHolder.tv_tmpt_laporan.setText("5. Dispenser"); break;
case 5: viewHolder.tv_tmpt_laporan.setText("6. Pot/vas Bunga"); break;
case 6: viewHolder.tv_tmpt_laporan.setText("7. Kolam/Aquarium"); break;
case 7: viewHolder.tv_tmpt_laporan.setText("8. Ban Bekas"); break;
case 8: viewHolder.tv_tmpt_laporan.setText("9. Botol/Kaleng Bekas"); break;
case 9: viewHolder.tv_tmpt_laporan.setText("10. Lain-lain"); break;
}
viewHolder.rg_jentik.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if(i==R.id.rb_aedes){
arrRadioButton.set(position,""+1);
}else if(i==R.id.rb_nonaedes){
arrRadioButton.set(position,""+2);
}else{
arrRadioButton.set(position,""+3);
}
}
});
}
@Override
public int getItemCount() {
return 10;
}
public ArrayList<String> getArrRadioButton(){
return this.arrRadioButton;
}
class LaporanSliderAdapterVH extends RecyclerView.ViewHolder{
View itemView;
TextView tv_tmpt_laporan;
RadioGroup rg_jentik;
public LaporanSliderAdapterVH(View itemView) {
super(itemView);
rg_jentik = itemView.findViewById(R.id.radiogrup_jentik);
tv_tmpt_laporan = itemView.findViewById(R.id.tv_tmpt_laporan);
this.itemView = itemView;
}
}
}
| 3,733 | 0.63461 | 0.626842 | 109 | 33.247707 | 28.385019 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.688073 | false | false | 8 |
2e468725c07fbc6ebc698b310d8092d8a906e6fc | 19,241,453,506,954 | 97f61fd341618ba24934ee9f53d32bc739f5e9f6 | /src/main/java/com/rudyii/hsw/services/firebase/FirebaseGlobalSettingsService.java | fbf71a0fd8d290a13e4ce2abb80b290cb44eaa4a | []
| no_license | j-a-c-k/homesystemserver | https://github.com/j-a-c-k/homesystemserver | fcd4cd16698a3c292de3a4729cf6b07a660e053b | 98b24c3140b21801b56bb3250b9155050379bd7d | refs/heads/master | 2023-04-30T21:08:25.144000 | 2023-04-14T19:10:16 | 2023-04-14T19:10:16 | 162,630,856 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rudyii.hsw.services.firebase;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.ValueEventListener;
import com.rudyii.hs.common.objects.settings.GlobalSettings;
import com.rudyii.hsw.database.FirebaseDatabaseProvider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import static com.rudyii.hs.common.names.FirebaseNameSpaces.SETTINGS_GLOBAL;
import static com.rudyii.hs.common.names.FirebaseNameSpaces.SETTINGS_ROOT;
@Slf4j
@Service
@RequiredArgsConstructor
public class FirebaseGlobalSettingsService {
private final FirebaseDatabaseProvider firebaseDatabaseProvider;
private GlobalSettings globalSettings = GlobalSettings.builder().build();
@PostConstruct
public void buildRefreshSettings() {
firebaseDatabaseProvider.getRootReference().child(SETTINGS_ROOT).child(SETTINGS_GLOBAL).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
GlobalSettings globalSettings = dataSnapshot.getValue(GlobalSettings.class);
setGlobalSettings(globalSettings);
} else {
firebaseDatabaseProvider.getRootReference().child(SETTINGS_ROOT).child(SETTINGS_GLOBAL).setValueAsync(globalSettings);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
log.error("Failed to update GlobalSettings ", databaseError.toException());
}
});
}
public GlobalSettings getGlobalSettings() {
return globalSettings;
}
private void setGlobalSettings(GlobalSettings globalSettings) {
this.globalSettings = globalSettings;
}
}
| UTF-8 | Java | 1,975 | java | FirebaseGlobalSettingsService.java | Java | []
| null | []
| package com.rudyii.hsw.services.firebase;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.ValueEventListener;
import com.rudyii.hs.common.objects.settings.GlobalSettings;
import com.rudyii.hsw.database.FirebaseDatabaseProvider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import static com.rudyii.hs.common.names.FirebaseNameSpaces.SETTINGS_GLOBAL;
import static com.rudyii.hs.common.names.FirebaseNameSpaces.SETTINGS_ROOT;
@Slf4j
@Service
@RequiredArgsConstructor
public class FirebaseGlobalSettingsService {
private final FirebaseDatabaseProvider firebaseDatabaseProvider;
private GlobalSettings globalSettings = GlobalSettings.builder().build();
@PostConstruct
public void buildRefreshSettings() {
firebaseDatabaseProvider.getRootReference().child(SETTINGS_ROOT).child(SETTINGS_GLOBAL).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
GlobalSettings globalSettings = dataSnapshot.getValue(GlobalSettings.class);
setGlobalSettings(globalSettings);
} else {
firebaseDatabaseProvider.getRootReference().child(SETTINGS_ROOT).child(SETTINGS_GLOBAL).setValueAsync(globalSettings);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
log.error("Failed to update GlobalSettings ", databaseError.toException());
}
});
}
public GlobalSettings getGlobalSettings() {
return globalSettings;
}
private void setGlobalSettings(GlobalSettings globalSettings) {
this.globalSettings = globalSettings;
}
}
| 1,975 | 0.727595 | 0.726076 | 51 | 37.725491 | 33.957344 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431373 | false | false | 8 |
503f4f1fb09f1e048e6192cd2597a0a7931abb62 | 32,006,096,329,430 | ee9c1b7f9c1c739eec70d366aa2c80677990c0d2 | /src/main/java/com/mycab/driver/repository/VehicleLocationRepository.java | bb4aac758200127a2de8625f3fd5a790d4199990 | []
| no_license | mekkah/mycab-drivers | https://github.com/mekkah/mycab-drivers | 82ca512061a1dbef7c29d7463640b46b9fb08467 | 87bfe6b583fb8e5bd72b8fd979f0a7efd658fd8d | refs/heads/master | 2017-12-22T00:41:16.517000 | 2017-03-05T22:08:16 | 2017-03-05T22:08:16 | 72,840,490 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mycab.driver.repository;
import com.mycab.driver.model.VehicleLocation;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List;
/**
* Created by emeka on 03/12/2016.
*/
public interface VehicleLocationRepository extends MongoRepository<VehicleLocation, String> {
}
| UTF-8 | Java | 318 | java | VehicleLocationRepository.java | Java | [
{
"context": "sitory;\n\nimport java.util.List;\n\n/**\n * Created by emeka on 03/12/2016.\n */\npublic interface VehicleLocati",
"end": 201,
"score": 0.9996144771575928,
"start": 196,
"tag": "USERNAME",
"value": "emeka"
}
]
| null | []
| package com.mycab.driver.repository;
import com.mycab.driver.model.VehicleLocation;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List;
/**
* Created by emeka on 03/12/2016.
*/
public interface VehicleLocationRepository extends MongoRepository<VehicleLocation, String> {
}
| 318 | 0.805031 | 0.779874 | 13 | 23.461538 | 29.159021 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 8 |
d4c2c2f26ff169c6c0af4e78f6845c2a3990b2fa | 32,006,096,331,877 | f2bc017f0ba5945a3e50811defb8ee8f6acb35d9 | /src/main/java/com/lineWrap/LineWrap.java | 7194416ec6e6291f800e20884a014d0289e5371a | []
| no_license | JerryZer0/jerry_dojo | https://github.com/JerryZer0/jerry_dojo | ed3f157a0b8e51db2b5b0e386c8024ebd426c849 | b5935d7a0f47fa1fb11b96d47cf0bccd512b5ab7 | refs/heads/master | 2020-04-14T15:03:09.221000 | 2019-02-19T13:23:04 | 2019-02-19T13:23:04 | 163,915,059 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lineWrap;
public class LineWrap {
private String text;
private int length;
// private String currentText;
public LineWrap(String text, int length) {
this.text = text;
this.length = length;
}
public String wrapLine() {
StringBuilder space = new StringBuilder(" ");
if (text.length() > length) {
if (text.charAt(length) != ' ') {
int i = length-1;
while (text.charAt(i) != ' ') {
space.append(" ");
i--;
}
return text.substring(0, i) + space + "\n" + text.substring(i+1);
}
return text.substring(0, length) + "\n" + text.substring(length);
}
return text;
}
}
| UTF-8 | Java | 680 | java | LineWrap.java | Java | []
| null | []
| package com.lineWrap;
public class LineWrap {
private String text;
private int length;
// private String currentText;
public LineWrap(String text, int length) {
this.text = text;
this.length = length;
}
public String wrapLine() {
StringBuilder space = new StringBuilder(" ");
if (text.length() > length) {
if (text.charAt(length) != ' ') {
int i = length-1;
while (text.charAt(i) != ' ') {
space.append(" ");
i--;
}
return text.substring(0, i) + space + "\n" + text.substring(i+1);
}
return text.substring(0, length) + "\n" + text.substring(length);
}
return text;
}
}
| 680 | 0.561765 | 0.555882 | 29 | 22.448277 | 19.445036 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.551724 | false | false | 8 |
d3c533f5d76eb52f4a0db48f84fa74c402449dc0 | 9,234,179,728,419 | c7d120a1353a88dfada252bb910eee5764328c5e | /Izbori/src/ui/ListaUI.java | 03b586d700b80f44309ad8a8c06e144b14b39500 | []
| no_license | bogaroskidejan/repositoryJWD | https://github.com/bogaroskidejan/repositoryJWD | 3548437ae58d4acc46849463d099346f5f0f0856 | 24b2781c1fd336bbfa126aa0478c8f3cc23e7923 | refs/heads/master | 2021-05-10T21:45:06.703000 | 2018-01-20T15:32:39 | 2018-01-20T15:32:39 | 118,237,112 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ui;
import java.util.List;
import utils.PomocnaKlasa;
import model.Lista;
import model.Stranka;
import dao.ListaDAO;
public class ListaUI {
public static void ispisiSveListeSaStrankama() {
List<Lista> sveListe = ListaDAO.getAll(IzboriUI.getConn());
System.out.println();
System.out.printf("%-11s %-37s %-10s %-10s %-30s", "ID", "Izborni Slogan", "ID Stranke", "Skracenica", "Naziv") ;
System.out.println();
System.out.println("========== ==================================== ========== ========== ====================================");
for (Lista itVal: sveListe) {
System.out.printf("%-11s %-38s ",
itVal.getId(),
itVal.getSlogan());
System.out.println();
for(Stranka itStr: itVal.getStranke()){
System.out.printf("%-11s %-37s %-10s %-10s %-40s", " "," ",
itStr.getId(),
itStr.getSkracenica(),
itStr.getNaziv());
System.out.println();
}
System.out.println("---------- ------------------------------------ ---------- ---------- ------------------------------------");
}
}
public static void glasanje() {
Lista ls = pronadjiListu();
if (ls != null) {
int trenutniBroj= ls.getBrojGlasova();
ls.setBrojGlasova(trenutniBroj+1);
ListaDAO.update(IzboriUI.getConn(), ls);
System.out.println("Uspesno ste glasali za listu: " +ls.getSlogan());
}
}
private static Lista pronadjiListu() {
Lista retVal = null;
System.out.print("Unesi ID Liste:");
int id = utils.PomocnaKlasa.ocitajCeoBroj();
retVal = ListaDAO.getListaByID(IzboriUI.getConn(), id);
if (retVal == null)
System.out.println("Lista sa ID " + id
+ " ne postoji u evidenciji");
return retVal;
}
public static void ispisiStatistikuGlasanja() {
System.out.print("Unesi Broj clanova unije:");
double broj = PomocnaKlasa.ocitajRealanBroj();
List<Lista> sveListe = ListaDAO.getAll(IzboriUI.getConn());
double ukupanBroj = ListaDAO.ukupanBrojGlasova(IzboriUI.getConn());
System.out.println();
System.out.printf("broj clanova koji je izasao na glasanj: %.0f %n", ukupanBroj);
System.out.printf("broj nevazecih listica: %.0f %n " , (broj*0.8-ukupanBroj));
System.out.println();
System.out.printf("%-11s %-37s %-10s %-18s %-27s %-15s", "R.br", "Izborni Slogan", "Broj gls.", "Nosilac Liste", "Procenat glasova u odnosu na" , "Procenat glasova u odnosu na") ;
System.out.println();
System.out.printf("%-11s %-37s %-10s %-18s %-27s %-15s", "", "", "", "", "ukupan broj clanova" , "broj osvojenih glasova") ;
System.out.println();
System.out.println("========== ==================================== ========== ================== ============================= =============================");
for (Lista itVal: sveListe) {
String lice =itVal.getsLice();
if(itVal.getsLice()==null){
lice = " ";}
System.out.printf("%-11s %-37s %-10s %-18s %-28.2f %-15.2f ",
itVal.getId(),
itVal.getSlogan(),
itVal.getBrojGlasova(),
lice,
(itVal.getBrojGlasova()/broj)* 100,
(itVal.getBrojGlasova()/ukupanBroj)* 100);
System.out.println();
System.out.println("---------- ------------------------------------ ---------- ------------------ ----------------------------- -----------------------------");
}
}
}
| UTF-8 | Java | 3,372 | java | ListaUI.java | Java | [
{
"context": "(\"%-11s %-37s %-10s %-18s %-27s %-15s\", \"R.br\", \"Izborni Slogan\", \"Broj gls.\", \"Nosilac Liste\", \"Procenat glasova",
"end": 2343,
"score": 0.9992411732673645,
"start": 2329,
"tag": "NAME",
"value": "Izborni Slogan"
},
{
"context": " %-15s\", \"R.br\", \"Izborni Slogan\", \"Broj gls.\", \"Nosilac Liste\", \"Procenat glasova u odnosu na\" , \"Procenat glas",
"end": 2373,
"score": 0.9892675280570984,
"start": 2360,
"tag": "NAME",
"value": "Nosilac Liste"
}
]
| null | []
| package ui;
import java.util.List;
import utils.PomocnaKlasa;
import model.Lista;
import model.Stranka;
import dao.ListaDAO;
public class ListaUI {
public static void ispisiSveListeSaStrankama() {
List<Lista> sveListe = ListaDAO.getAll(IzboriUI.getConn());
System.out.println();
System.out.printf("%-11s %-37s %-10s %-10s %-30s", "ID", "Izborni Slogan", "ID Stranke", "Skracenica", "Naziv") ;
System.out.println();
System.out.println("========== ==================================== ========== ========== ====================================");
for (Lista itVal: sveListe) {
System.out.printf("%-11s %-38s ",
itVal.getId(),
itVal.getSlogan());
System.out.println();
for(Stranka itStr: itVal.getStranke()){
System.out.printf("%-11s %-37s %-10s %-10s %-40s", " "," ",
itStr.getId(),
itStr.getSkracenica(),
itStr.getNaziv());
System.out.println();
}
System.out.println("---------- ------------------------------------ ---------- ---------- ------------------------------------");
}
}
public static void glasanje() {
Lista ls = pronadjiListu();
if (ls != null) {
int trenutniBroj= ls.getBrojGlasova();
ls.setBrojGlasova(trenutniBroj+1);
ListaDAO.update(IzboriUI.getConn(), ls);
System.out.println("Uspesno ste glasali za listu: " +ls.getSlogan());
}
}
private static Lista pronadjiListu() {
Lista retVal = null;
System.out.print("Unesi ID Liste:");
int id = utils.PomocnaKlasa.ocitajCeoBroj();
retVal = ListaDAO.getListaByID(IzboriUI.getConn(), id);
if (retVal == null)
System.out.println("Lista sa ID " + id
+ " ne postoji u evidenciji");
return retVal;
}
public static void ispisiStatistikuGlasanja() {
System.out.print("Unesi Broj clanova unije:");
double broj = PomocnaKlasa.ocitajRealanBroj();
List<Lista> sveListe = ListaDAO.getAll(IzboriUI.getConn());
double ukupanBroj = ListaDAO.ukupanBrojGlasova(IzboriUI.getConn());
System.out.println();
System.out.printf("broj clanova koji je izasao na glasanj: %.0f %n", ukupanBroj);
System.out.printf("broj nevazecih listica: %.0f %n " , (broj*0.8-ukupanBroj));
System.out.println();
System.out.printf("%-11s %-37s %-10s %-18s %-27s %-15s", "R.br", "<NAME>", "Broj gls.", "<NAME>", "Procenat glasova u odnosu na" , "Procenat glasova u odnosu na") ;
System.out.println();
System.out.printf("%-11s %-37s %-10s %-18s %-27s %-15s", "", "", "", "", "ukupan broj clanova" , "broj osvojenih glasova") ;
System.out.println();
System.out.println("========== ==================================== ========== ================== ============================= =============================");
for (Lista itVal: sveListe) {
String lice =itVal.getsLice();
if(itVal.getsLice()==null){
lice = " ";}
System.out.printf("%-11s %-37s %-10s %-18s %-28.2f %-15.2f ",
itVal.getId(),
itVal.getSlogan(),
itVal.getBrojGlasova(),
lice,
(itVal.getBrojGlasova()/broj)* 100,
(itVal.getBrojGlasova()/ukupanBroj)* 100);
System.out.println();
System.out.println("---------- ------------------------------------ ---------- ------------------ ----------------------------- -----------------------------");
}
}
}
| 3,357 | 0.529953 | 0.508304 | 93 | 34.258064 | 38.087872 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.096774 | false | false | 8 |
0a5c0ac6d07cccf658d036439cc8f506da3812a3 | 3,109,556,350,658 | ff1f60ff4bd69ccbe4c59aedf9c8d2b321732df4 | /src/test/java/com/testes/TesteCliente.java | 6b89770ef6d1f0abc8c00689be3ec6658235eef7 | []
| no_license | edsonlima95/sistema-odontologico | https://github.com/edsonlima95/sistema-odontologico | a7b4cd0c67d205e3d8a43a3911c4847020be1699 | ecf29809ca081eeec705c431e27b26d30c93dbac | refs/heads/master | 2021-03-27T14:31:57.643000 | 2017-12-04T14:57:39 | 2017-12-04T14:57:39 | 113,044,578 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.testes;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.projetoodonto.model.Consulta;
import com.projetoodonto.model.Convenio;
import com.projetoodonto.model.Dente;
public class TesteCliente {
private static EntityManagerFactory factory;
private EntityManager manager;
@BeforeClass
public static void init() {
factory = Persistence.createEntityManagerFactory("ProjetoOdonto");
}
@Before
public void setUp() {
this.manager = this.factory.createEntityManager();
}
@After
public void tearDown() {
this.manager.close();
}
/*@Test
public void calcularPorcentagem() {
BigDecimal soma = this.manager.createQuery("select sum(p.valorPagamento) from Pagamento p", BigDecimal.class)
.getSingleResult();
List<Pagamento> pagamento = this.manager
.createQuery("select p from Pagamento p group by p.tipoPagamento order by p.tipoPagamento asc", Pagamento.class).getResultList();
for (Pagamento pag : pagamento) {
* Pega o valor de cada pagamento individual no campo -> pag.getValorPagamento()
* depois divide cada um pela soma de todos eles e
* arredonda para 2 casas depois da virgula -> .divide(soma,2,RoundingMode.HALF_EVEN)
* depois multiplica por 100 para da o resultado -> .multiply(new BigDecimal("100")).intValue();
* e retorna como Integer para as duas casas depois da virgula sair.
Integer porcentagem = pag.getValorPagamento().divide(soma, 2, RoundingMode.HALF_EVEN)
.multiply(new BigDecimal("100")).intValue();
System.out.println(pag.getTipoPagamento() + " - " + porcentagem + "%");
}
}*/
@Test
public void buscarDentes() {
List<Dente> dentes = this.manager.createQuery("select d from Dente d",Dente.class).getResultList();
for(Dente d : dentes) {
System.out.println(d.getNumeroDente());
}
}
@Test
public void teste() {
Calendar dataInicial = Calendar.getInstance();
Calendar dataFinal = Calendar.getInstance();
dataInicial.set(2017,Calendar.NOVEMBER, 06);
dataFinal.set(Calendar.YEAR,Calendar.MONTH+1);
Date dataI = dataInicial.getTime();
Date dataF = dataFinal.getTime();
String jpql = "select SUM(c.valorPagamento) from Consulta c where c.dataConsulta between :dataI and :dataF";
BigDecimal consultasValorTotal = this.manager.createQuery(jpql,BigDecimal.class)
.setParameter("dataI",dataI)
.setParameter("dataI",dataF)
.getSingleResult();
System.out.println(consultasValorTotal);
}
}
| UTF-8 | Java | 2,830 | java | TesteCliente.java | Java | []
| null | []
| package com.testes;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.projetoodonto.model.Consulta;
import com.projetoodonto.model.Convenio;
import com.projetoodonto.model.Dente;
public class TesteCliente {
private static EntityManagerFactory factory;
private EntityManager manager;
@BeforeClass
public static void init() {
factory = Persistence.createEntityManagerFactory("ProjetoOdonto");
}
@Before
public void setUp() {
this.manager = this.factory.createEntityManager();
}
@After
public void tearDown() {
this.manager.close();
}
/*@Test
public void calcularPorcentagem() {
BigDecimal soma = this.manager.createQuery("select sum(p.valorPagamento) from Pagamento p", BigDecimal.class)
.getSingleResult();
List<Pagamento> pagamento = this.manager
.createQuery("select p from Pagamento p group by p.tipoPagamento order by p.tipoPagamento asc", Pagamento.class).getResultList();
for (Pagamento pag : pagamento) {
* Pega o valor de cada pagamento individual no campo -> pag.getValorPagamento()
* depois divide cada um pela soma de todos eles e
* arredonda para 2 casas depois da virgula -> .divide(soma,2,RoundingMode.HALF_EVEN)
* depois multiplica por 100 para da o resultado -> .multiply(new BigDecimal("100")).intValue();
* e retorna como Integer para as duas casas depois da virgula sair.
Integer porcentagem = pag.getValorPagamento().divide(soma, 2, RoundingMode.HALF_EVEN)
.multiply(new BigDecimal("100")).intValue();
System.out.println(pag.getTipoPagamento() + " - " + porcentagem + "%");
}
}*/
@Test
public void buscarDentes() {
List<Dente> dentes = this.manager.createQuery("select d from Dente d",Dente.class).getResultList();
for(Dente d : dentes) {
System.out.println(d.getNumeroDente());
}
}
@Test
public void teste() {
Calendar dataInicial = Calendar.getInstance();
Calendar dataFinal = Calendar.getInstance();
dataInicial.set(2017,Calendar.NOVEMBER, 06);
dataFinal.set(Calendar.YEAR,Calendar.MONTH+1);
Date dataI = dataInicial.getTime();
Date dataF = dataFinal.getTime();
String jpql = "select SUM(c.valorPagamento) from Consulta c where c.dataConsulta between :dataI and :dataF";
BigDecimal consultasValorTotal = this.manager.createQuery(jpql,BigDecimal.class)
.setParameter("dataI",dataI)
.setParameter("dataI",dataF)
.getSingleResult();
System.out.println(consultasValorTotal);
}
}
| 2,830 | 0.714134 | 0.70742 | 91 | 29.098902 | 30.20336 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.912088 | false | false | 8 |
7c89fad7c5d82ff7ab76b97ef742f22d382077bd | 2,456,721,313,649 | 3cb1055c6310c456b9c9ed7b2a52c6af7291024c | /app/src/main/java/com/meetferrytan/mvpdaggerstore/presentation/example/GithubUserSearchActivity.java | a1440671207a348cc93729fcb0c28cda1cff4bc6 | []
| no_license | ferrytan/mvp-dagger-store | https://github.com/ferrytan/mvp-dagger-store | 8a15ef1d0864ad1ac3c453d2463968c82179b774 | 67178790fef66c272af35e5cc90e92bec3dd88d4 | refs/heads/master | 2021-09-02T16:11:57.704000 | 2018-01-03T15:00:03 | 2018-01-03T15:00:03 | 111,070,269 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.meetferrytan.mvpdaggerstore.presentation.example;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.text.method.ScrollingMovementMethod;
import android.widget.EditText;
import android.widget.TextView;
import com.meetferrytan.mvpdaggerstore.R;
import com.meetferrytan.mvpdaggerstore.data.entity.User;
import com.meetferrytan.mvpdaggerstore.presentation.base.BaseMvpActivity;
import com.meetferrytan.mvpdaggerstore.presentation.example.userdetail.UserDetailFragment;
import com.meetferrytan.mvpdaggerstore.util.format.DateTimeFormatUtil;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.OnClick;
import dagger.android.AndroidInjection;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
public class GithubUserSearchActivity extends BaseMvpActivity<GithubUserSearchPresenter, GithubUserSearchContract.View>
implements GithubUserSearchContract.View, HasSupportFragmentInjector {
public static final String CONTENT_LOG = "log";
@BindView(R.id.txvLog) TextView txvLog;
@BindView(R.id.edtUsername) EditText edtUsername;
@BindView(R.id.toolbar) Toolbar toolbar;
@Inject DispatchingAndroidInjector<Fragment> fragmentInjector;
private UserDetailFragment mUserDetailFragment;
private String mLastQuery;
@Override
public int setLayoutRes() {
return R.layout.activity_example;
}
@Override
public void processIntentExtras(Bundle extras) {
}
@Override
public void startingUpActivity(Bundle savedInstanceState) {
setSupportActionBar(toolbar);
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(CONTENT_LOG)) {
txvLog.setText(savedInstanceState.getString(CONTENT_LOG));
}
}
txvLog.setMovementMethod(new ScrollingMovementMethod());
mUserDetailFragment = UserDetailFragment.newInstance();
getSupportFragmentManager().beginTransaction().replace(R.id.frameLayout, mUserDetailFragment).commit();
}
@Override
public void inject() {
AndroidInjection.inject(this);
}
@Override
public GithubUserSearchContract.View getViewImpl() {
return this;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(CONTENT_LOG, txvLog.getText().toString());
}
@Override
public void showError(int processCode, int errorCode, String message) {
// Switch process by static integers from GithubUserSearchPresenter
switch (processCode) {
case GithubUserSearchPresenter.PROCESS_GET_USER_DETAIL:
appendLog(getCurrentDateTime() + " Error: " + message + "\n");
break;
}
}
@Override
public void showLoading(int processCode, boolean show) {
// Switch process by static integers from GithubUserSearchPresenter
switch (processCode) {
case GithubUserSearchPresenter.PROCESS_GET_USER_DETAIL:
if (show) {
appendLog(getCurrentDateTime() + " Loading Github User \"" + mLastQuery + "\"\n");
} else {
appendLog(getCurrentDateTime() + " Done fetching user data\n");
}
break;
}
}
@OnClick(R.id.btnGetUserDetail)
public void getUserDetail() {
mLastQuery = edtUsername.getText().toString();
if (!"".equals(mLastQuery)) {
getPresenter().getUserDetail(mLastQuery);
}
}
private String getCurrentDateTime() {
return DateTimeFormatUtil.millisToDateFormat(System.currentTimeMillis(), "dd-MM HH:mm:ss.SSS");
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
return fragmentInjector;
}
@Override
public void showUserDetail(User user) {
appendLog(getCurrentDateTime() + " User fetched: " + user.getId() + "-" + user.getName() + "\n");
mUserDetailFragment.updateUserInfo(user);
}
private void appendLog(String text) {
txvLog.append(text);
int textBottom = txvLog.getLineHeight() * (txvLog.getLineCount());
int textViewHeight = txvLog.getHeight();
if (textBottom > textViewHeight) {
txvLog.scrollTo(0, textBottom - textViewHeight);
}
}
}
| UTF-8 | Java | 4,537 | java | GithubUserSearchActivity.java | Java | []
| null | []
| package com.meetferrytan.mvpdaggerstore.presentation.example;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.text.method.ScrollingMovementMethod;
import android.widget.EditText;
import android.widget.TextView;
import com.meetferrytan.mvpdaggerstore.R;
import com.meetferrytan.mvpdaggerstore.data.entity.User;
import com.meetferrytan.mvpdaggerstore.presentation.base.BaseMvpActivity;
import com.meetferrytan.mvpdaggerstore.presentation.example.userdetail.UserDetailFragment;
import com.meetferrytan.mvpdaggerstore.util.format.DateTimeFormatUtil;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.OnClick;
import dagger.android.AndroidInjection;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
public class GithubUserSearchActivity extends BaseMvpActivity<GithubUserSearchPresenter, GithubUserSearchContract.View>
implements GithubUserSearchContract.View, HasSupportFragmentInjector {
public static final String CONTENT_LOG = "log";
@BindView(R.id.txvLog) TextView txvLog;
@BindView(R.id.edtUsername) EditText edtUsername;
@BindView(R.id.toolbar) Toolbar toolbar;
@Inject DispatchingAndroidInjector<Fragment> fragmentInjector;
private UserDetailFragment mUserDetailFragment;
private String mLastQuery;
@Override
public int setLayoutRes() {
return R.layout.activity_example;
}
@Override
public void processIntentExtras(Bundle extras) {
}
@Override
public void startingUpActivity(Bundle savedInstanceState) {
setSupportActionBar(toolbar);
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(CONTENT_LOG)) {
txvLog.setText(savedInstanceState.getString(CONTENT_LOG));
}
}
txvLog.setMovementMethod(new ScrollingMovementMethod());
mUserDetailFragment = UserDetailFragment.newInstance();
getSupportFragmentManager().beginTransaction().replace(R.id.frameLayout, mUserDetailFragment).commit();
}
@Override
public void inject() {
AndroidInjection.inject(this);
}
@Override
public GithubUserSearchContract.View getViewImpl() {
return this;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(CONTENT_LOG, txvLog.getText().toString());
}
@Override
public void showError(int processCode, int errorCode, String message) {
// Switch process by static integers from GithubUserSearchPresenter
switch (processCode) {
case GithubUserSearchPresenter.PROCESS_GET_USER_DETAIL:
appendLog(getCurrentDateTime() + " Error: " + message + "\n");
break;
}
}
@Override
public void showLoading(int processCode, boolean show) {
// Switch process by static integers from GithubUserSearchPresenter
switch (processCode) {
case GithubUserSearchPresenter.PROCESS_GET_USER_DETAIL:
if (show) {
appendLog(getCurrentDateTime() + " Loading Github User \"" + mLastQuery + "\"\n");
} else {
appendLog(getCurrentDateTime() + " Done fetching user data\n");
}
break;
}
}
@OnClick(R.id.btnGetUserDetail)
public void getUserDetail() {
mLastQuery = edtUsername.getText().toString();
if (!"".equals(mLastQuery)) {
getPresenter().getUserDetail(mLastQuery);
}
}
private String getCurrentDateTime() {
return DateTimeFormatUtil.millisToDateFormat(System.currentTimeMillis(), "dd-MM HH:mm:ss.SSS");
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
return fragmentInjector;
}
@Override
public void showUserDetail(User user) {
appendLog(getCurrentDateTime() + " User fetched: " + user.getId() + "-" + user.getName() + "\n");
mUserDetailFragment.updateUserInfo(user);
}
private void appendLog(String text) {
txvLog.append(text);
int textBottom = txvLog.getLineHeight() * (txvLog.getLineCount());
int textViewHeight = txvLog.getHeight();
if (textBottom > textViewHeight) {
txvLog.scrollTo(0, textBottom - textViewHeight);
}
}
}
| 4,537 | 0.692528 | 0.691867 | 129 | 34.170544 | 28.92174 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.465116 | false | false | 8 |
73f53183afbed480e98ae49abda5360da3ba471c | 12,558,484,390,412 | 7f6002d48f1aa2cf6bdef246de6f2c8bdc94dec8 | /app/src/main/java/com/example/zll/util/PhotoUtils.java | 0047467676234b6040eca9985c631d85389985b0 | []
| no_license | LiLiTaBaBa/PhotoUtils | https://github.com/LiLiTaBaBa/PhotoUtils | dd0a027346c95c906cfea479471c237767907aa1 | 7dfe0e9e17e157549709fc964826e5d9cfbcc0f7 | refs/heads/master | 2019-07-08T23:02:55.952000 | 2017-04-27T08:05:18 | 2017-04-27T08:05:18 | 89,572,285 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.zll.util;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.List;
import kr.co.namee.permissiongen.PermissionGen;
/**
* 图片处理以及选择的工具类
* Created by Jun on 2017/4/27 0027.
*/
public class PhotoUtils {
/**
* 打印的tag
*/
private final String tag = PhotoUtils.class.getSimpleName();
/**
* 图片是否可以裁剪
*/
private boolean isCrop = false;
/***设置iSCrop*/
public void setIsCrop(boolean isCrop) {
this.isCrop = isCrop;
}
/**
* 裁剪后存放的位置
*/
public static final String CROP_FILE_NAME = "crop_file.jpg";
/**
* 图片路径
*/
private static final String CROP_FILE_PATH = Environment.getExternalStorageDirectory() +
File.separator + CROP_FILE_NAME;
/**
* PhotoUtils对象
*/
private OnPhotoResultListener onPhotoResultListener;
/**
* 构造函数
*/
public PhotoUtils(OnPhotoResultListener onPhotoResultListener) {
this.onPhotoResultListener = onPhotoResultListener;
}
/**
* 裁剪图片成功后返回
*/
public static final int INTENT_CROP = 2;
/**
* 拍照成功后返回
*/
public static final int INTENT_TAKE = 3;
/**
* 拍照成功后返回
*/
public static final int INTENT_SELECT = 4;
/*** 拍照成功后返回2*/
public static final int INTENT_TAKE_2 = 5;
/*** 拍照**/
public void takePicture(Activity activity) {
try {
//每次选择图片吧之前的图片删除
clearCropFile(buildUri(activity));
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
intent.putExtra(MediaStore.EXTRA_OUTPUT, buildUri(activity));
if (!isIntentAvailable(activity, intent)) {
return;
}
activity.startActivityForResult(intent, INTENT_TAKE);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 拍照
*
* @param
* @return
*/
public void takePicture_2(Fragment activity) {
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED)) {
Intent getImageByCamera = new Intent("android.media.action.IMAGE_CAPTURE");
getImageByCamera.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
activity.startActivityForResult(getImageByCamera, INTENT_TAKE_2);
}
}
/***
* 选择一张图片
* 图片类型,这里是image/*,当然也可以设置限制
* 如:image/jpeg等
*
* @param activity Activity
*/
@SuppressLint("InlinedApi")
public void selectPicture(Activity activity) {
try {
//每次选择图片吧之前的图片删除
clearCropFile(buildUri(activity));
Intent intent = new Intent(Intent.ACTION_PICK, null);
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
if (!isIntentAvailable(activity, intent)) {
return;
}
activity.startActivityForResult(intent, INTENT_SELECT);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 构建uri
*
* @param activity
* @return
*/
private Uri buildUri(Activity activity) {
if (CommonUtils.checkSDCard()) {
return Uri.fromFile(Environment.getExternalStorageDirectory()).buildUpon().appendPath(CROP_FILE_NAME).build();
} else {
return Uri.fromFile(activity.getCacheDir()).buildUpon().appendPath(CROP_FILE_NAME).build();
}
}
/**
* @param intent
* @return
*/
protected boolean isIntentAvailable(Activity activity, Intent intent) {
PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
private boolean corp(Activity activity, Uri uri) {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(uri, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", 200);
cropIntent.putExtra("outputY", 200);
cropIntent.putExtra("return-data", false);
cropIntent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
Uri cropuri = buildUri(activity);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, cropuri);
if (!isIntentAvailable(activity, cropIntent)) {
return false;
} else {
try {
activity.startActivityForResult(cropIntent, INTENT_CROP);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
/**
* 返回结果处理
*
* @param requestCode
* @param resultCode
* @param data
*/
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
if (onPhotoResultListener == null) {
Log.e(tag, "onPhotoResultListener is not null");
return;
}
switch (requestCode) {
//拍照
case INTENT_TAKE:
if (new File(buildUri(activity).getPath()).exists()) {
if (isCrop) {
if (corp(activity, buildUri(activity))) {
return;
}
onPhotoResultListener.onPhotoCancel();
} else {
onPhotoResultListener.onPhotoResult(CROP_FILE_NAME);
}
}
break;
//选择图片
case INTENT_SELECT:
if (data != null && data.getData() != null) {
Uri imageUri = getUri(data, activity);
if (isCrop) {
if (corp(activity, imageUri)) {
return;
}
} else {
onPhotoResultListener.onPhotoResult(getPathByUri(imageUri, activity));
}
}
onPhotoResultListener.onPhotoCancel();
break;
//截图
case INTENT_CROP:
if (resultCode == Activity.RESULT_OK && new File(buildUri(activity).getPath()).exists()) {
onPhotoResultListener.onPhotoResult(CROP_FILE_NAME);
}
break;
}
}
/**
* 通过Uri生成path
*
* @param imageUri
* @param activity
* @return
*/
private String getPathByUri(Uri imageUri, Activity activity) {
Bitmap bitmap = null;
if (imageUri != null && !TextUtils.isEmpty(imageUri.getPath())) {
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = activity.getContentResolver().query(imageUri,
filePathColumn, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
bitmap = BitmapFactory.decodeFile(picturePath);
}
}
String name = System.currentTimeMillis() + ".jpg";
saveBitmap(bitmap, name);
return name;
}
/**
* 删除文件
*
* @param uri
* @return
*/
public boolean clearCropFile(Uri uri) {
if (uri == null) {
return false;
}
File file = new File(uri.getPath());
if (file.exists()) {
boolean result = file.delete();
if (result) {
Log.i(tag, "Cached crop file cleared.");
} else {
Log.e(tag, "Failed to clear cached crop file.");
}
return result;
} else {
Log.w(tag, "Trying to clear cached crop file but it does not exist.");
}
return false;
}
/**
* [回调监听类]
*/
public interface OnPhotoResultListener {
void onPhotoResult(String path);
void onPhotoCancel();
}
public OnPhotoResultListener getOnPhotoResultListener() {
return onPhotoResultListener;
}
public void setOnPhotoResultListener(OnPhotoResultListener onPhotoResultListener) {
this.onPhotoResultListener = onPhotoResultListener;
}
/**
* 读取图片的旋转的角度
*
* @param path 图片绝对路径
* @return 图片的旋转角度
*/
private int getBitmapDegree(String path) {
int degree = 0;
try {
//从指定路径下读取图片,并获取其EXIF信息
ExifInterface exifInterface = new ExifInterface(path);
//获取图片的旋转信息
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return degree;
}
/**
* 将图片按照某个角度进行旋转
*
* @param bm 需要旋转的图片
* @param degree 旋转角度
* @return 旋转后的图片
*/
public static Bitmap rotateBitmapByDegree(Bitmap bm, int degree) {
Bitmap returnBm = null;
//根据旋转角度,生成旋转矩阵
Matrix matrix = new Matrix();
matrix.postRotate(degree);
try {
//将原始图片按照旋转矩阵进行旋转,并得到新的图片
returnBm = Bitmap.createBitmap(bm, 0, 0,
bm.getWidth(), bm.getHeight(), matrix, true);
} catch (OutOfMemoryError
e) {
}
if (returnBm == null) {
returnBm = bm;
}
if (bm != returnBm) {
bm.recycle();
}
return returnBm;
}
/**
* 解决小米手机上获取图片路径为null的情况
*
* @param intent
* @return
*/
public Uri getUri(android.content.Intent intent, Context context) {
Uri uri = intent.getData();
String type = intent.getType();
if (uri.getScheme().equals("file") && (type.contains("image/"))) {
String path = uri.getEncodedPath();
if (path != null) {
path = Uri.decode(path);
ContentResolver cr = context.getContentResolver();
StringBuffer buff = new StringBuffer();
buff.append("(").append(MediaStore.Images.ImageColumns.DATA).append("=")
.append("'" + path + "'").append(")");
Cursor cur = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Images.ImageColumns._ID},
buff.toString(), null, null);
int index = 0;
for (cur.moveToFirst(); !cur.isAfterLast(); cur.moveToNext()) {
index = cur.getColumnIndex(MediaStore.Images.ImageColumns._ID);
// set _id value
index = cur.getInt(index);
}
if (index == 0) {
// do nothing
} else {
Uri uri_temp = Uri
.parse("content://media/external/images/media/"
+ index);
if (uri_temp != null) {
uri = uri_temp;
}
}
}
}
return uri;
}
/**
* 设置bitmap
*
* @param bitmap
*/
public void saveBitmap(Bitmap bitmap, String url) {
ImageUtils.saveBitmap(bitmap, url);
bitmap.recycle();
}
}
| UTF-8 | Java | 13,397 | java | PhotoUtils.java | Java | [
{
"context": ".PermissionGen;\n\n/**\n * 图片处理以及选择的工具类\n * Created by Jun on 2017/4/27 0027.\n */\n\npublic class PhotoUtils {",
"end": 852,
"score": 0.7161833643913269,
"start": 849,
"tag": "NAME",
"value": "Jun"
}
]
| null | []
| package com.example.zll.util;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.List;
import kr.co.namee.permissiongen.PermissionGen;
/**
* 图片处理以及选择的工具类
* Created by Jun on 2017/4/27 0027.
*/
public class PhotoUtils {
/**
* 打印的tag
*/
private final String tag = PhotoUtils.class.getSimpleName();
/**
* 图片是否可以裁剪
*/
private boolean isCrop = false;
/***设置iSCrop*/
public void setIsCrop(boolean isCrop) {
this.isCrop = isCrop;
}
/**
* 裁剪后存放的位置
*/
public static final String CROP_FILE_NAME = "crop_file.jpg";
/**
* 图片路径
*/
private static final String CROP_FILE_PATH = Environment.getExternalStorageDirectory() +
File.separator + CROP_FILE_NAME;
/**
* PhotoUtils对象
*/
private OnPhotoResultListener onPhotoResultListener;
/**
* 构造函数
*/
public PhotoUtils(OnPhotoResultListener onPhotoResultListener) {
this.onPhotoResultListener = onPhotoResultListener;
}
/**
* 裁剪图片成功后返回
*/
public static final int INTENT_CROP = 2;
/**
* 拍照成功后返回
*/
public static final int INTENT_TAKE = 3;
/**
* 拍照成功后返回
*/
public static final int INTENT_SELECT = 4;
/*** 拍照成功后返回2*/
public static final int INTENT_TAKE_2 = 5;
/*** 拍照**/
public void takePicture(Activity activity) {
try {
//每次选择图片吧之前的图片删除
clearCropFile(buildUri(activity));
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
intent.putExtra(MediaStore.EXTRA_OUTPUT, buildUri(activity));
if (!isIntentAvailable(activity, intent)) {
return;
}
activity.startActivityForResult(intent, INTENT_TAKE);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 拍照
*
* @param
* @return
*/
public void takePicture_2(Fragment activity) {
String state = Environment.getExternalStorageState();
if (state.equals(Environment.MEDIA_MOUNTED)) {
Intent getImageByCamera = new Intent("android.media.action.IMAGE_CAPTURE");
getImageByCamera.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
activity.startActivityForResult(getImageByCamera, INTENT_TAKE_2);
}
}
/***
* 选择一张图片
* 图片类型,这里是image/*,当然也可以设置限制
* 如:image/jpeg等
*
* @param activity Activity
*/
@SuppressLint("InlinedApi")
public void selectPicture(Activity activity) {
try {
//每次选择图片吧之前的图片删除
clearCropFile(buildUri(activity));
Intent intent = new Intent(Intent.ACTION_PICK, null);
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
if (!isIntentAvailable(activity, intent)) {
return;
}
activity.startActivityForResult(intent, INTENT_SELECT);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 构建uri
*
* @param activity
* @return
*/
private Uri buildUri(Activity activity) {
if (CommonUtils.checkSDCard()) {
return Uri.fromFile(Environment.getExternalStorageDirectory()).buildUpon().appendPath(CROP_FILE_NAME).build();
} else {
return Uri.fromFile(activity.getCacheDir()).buildUpon().appendPath(CROP_FILE_NAME).build();
}
}
/**
* @param intent
* @return
*/
protected boolean isIntentAvailable(Activity activity, Intent intent) {
PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
private boolean corp(Activity activity, Uri uri) {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(uri, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", 200);
cropIntent.putExtra("outputY", 200);
cropIntent.putExtra("return-data", false);
cropIntent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
Uri cropuri = buildUri(activity);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, cropuri);
if (!isIntentAvailable(activity, cropIntent)) {
return false;
} else {
try {
activity.startActivityForResult(cropIntent, INTENT_CROP);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
/**
* 返回结果处理
*
* @param requestCode
* @param resultCode
* @param data
*/
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
if (onPhotoResultListener == null) {
Log.e(tag, "onPhotoResultListener is not null");
return;
}
switch (requestCode) {
//拍照
case INTENT_TAKE:
if (new File(buildUri(activity).getPath()).exists()) {
if (isCrop) {
if (corp(activity, buildUri(activity))) {
return;
}
onPhotoResultListener.onPhotoCancel();
} else {
onPhotoResultListener.onPhotoResult(CROP_FILE_NAME);
}
}
break;
//选择图片
case INTENT_SELECT:
if (data != null && data.getData() != null) {
Uri imageUri = getUri(data, activity);
if (isCrop) {
if (corp(activity, imageUri)) {
return;
}
} else {
onPhotoResultListener.onPhotoResult(getPathByUri(imageUri, activity));
}
}
onPhotoResultListener.onPhotoCancel();
break;
//截图
case INTENT_CROP:
if (resultCode == Activity.RESULT_OK && new File(buildUri(activity).getPath()).exists()) {
onPhotoResultListener.onPhotoResult(CROP_FILE_NAME);
}
break;
}
}
/**
* 通过Uri生成path
*
* @param imageUri
* @param activity
* @return
*/
private String getPathByUri(Uri imageUri, Activity activity) {
Bitmap bitmap = null;
if (imageUri != null && !TextUtils.isEmpty(imageUri.getPath())) {
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = activity.getContentResolver().query(imageUri,
filePathColumn, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
bitmap = BitmapFactory.decodeFile(picturePath);
}
}
String name = System.currentTimeMillis() + ".jpg";
saveBitmap(bitmap, name);
return name;
}
/**
* 删除文件
*
* @param uri
* @return
*/
public boolean clearCropFile(Uri uri) {
if (uri == null) {
return false;
}
File file = new File(uri.getPath());
if (file.exists()) {
boolean result = file.delete();
if (result) {
Log.i(tag, "Cached crop file cleared.");
} else {
Log.e(tag, "Failed to clear cached crop file.");
}
return result;
} else {
Log.w(tag, "Trying to clear cached crop file but it does not exist.");
}
return false;
}
/**
* [回调监听类]
*/
public interface OnPhotoResultListener {
void onPhotoResult(String path);
void onPhotoCancel();
}
public OnPhotoResultListener getOnPhotoResultListener() {
return onPhotoResultListener;
}
public void setOnPhotoResultListener(OnPhotoResultListener onPhotoResultListener) {
this.onPhotoResultListener = onPhotoResultListener;
}
/**
* 读取图片的旋转的角度
*
* @param path 图片绝对路径
* @return 图片的旋转角度
*/
private int getBitmapDegree(String path) {
int degree = 0;
try {
//从指定路径下读取图片,并获取其EXIF信息
ExifInterface exifInterface = new ExifInterface(path);
//获取图片的旋转信息
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return degree;
}
/**
* 将图片按照某个角度进行旋转
*
* @param bm 需要旋转的图片
* @param degree 旋转角度
* @return 旋转后的图片
*/
public static Bitmap rotateBitmapByDegree(Bitmap bm, int degree) {
Bitmap returnBm = null;
//根据旋转角度,生成旋转矩阵
Matrix matrix = new Matrix();
matrix.postRotate(degree);
try {
//将原始图片按照旋转矩阵进行旋转,并得到新的图片
returnBm = Bitmap.createBitmap(bm, 0, 0,
bm.getWidth(), bm.getHeight(), matrix, true);
} catch (OutOfMemoryError
e) {
}
if (returnBm == null) {
returnBm = bm;
}
if (bm != returnBm) {
bm.recycle();
}
return returnBm;
}
/**
* 解决小米手机上获取图片路径为null的情况
*
* @param intent
* @return
*/
public Uri getUri(android.content.Intent intent, Context context) {
Uri uri = intent.getData();
String type = intent.getType();
if (uri.getScheme().equals("file") && (type.contains("image/"))) {
String path = uri.getEncodedPath();
if (path != null) {
path = Uri.decode(path);
ContentResolver cr = context.getContentResolver();
StringBuffer buff = new StringBuffer();
buff.append("(").append(MediaStore.Images.ImageColumns.DATA).append("=")
.append("'" + path + "'").append(")");
Cursor cur = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Images.ImageColumns._ID},
buff.toString(), null, null);
int index = 0;
for (cur.moveToFirst(); !cur.isAfterLast(); cur.moveToNext()) {
index = cur.getColumnIndex(MediaStore.Images.ImageColumns._ID);
// set _id value
index = cur.getInt(index);
}
if (index == 0) {
// do nothing
} else {
Uri uri_temp = Uri
.parse("content://media/external/images/media/"
+ index);
if (uri_temp != null) {
uri = uri_temp;
}
}
}
}
return uri;
}
/**
* 设置bitmap
*
* @param bitmap
*/
public void saveBitmap(Bitmap bitmap, String url) {
ImageUtils.saveBitmap(bitmap, url);
bitmap.recycle();
}
}
| 13,397 | 0.542282 | 0.538143 | 423 | 29.276596 | 24.276707 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.477541 | false | false | 8 |
006924fa085d32ec3bb7bdde4436a83cee51db82 | 2,911,987,888,904 | 02891d95884e416986fadfaebc9e439ed1376140 | /src/edu/tufts/eecs/graphtheory/collapsiblegraph/graphedge/SkeletonGraphEdge.java | 9617db3525ff88a41789ab87adbcd37cd7d3d65c | []
| no_license | RecursiveRepository/CollapsibleGraph | https://github.com/RecursiveRepository/CollapsibleGraph | 658e548583c6762efcb1dd3269f9ed38222b535f | 40ebe77399419d7d940ec707d7d0618e4d81a74f | refs/heads/master | 2021-01-18T14:05:59.442000 | 2011-07-31T17:01:48 | 2011-07-31T17:01:48 | 3,403,857 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.tufts.eecs.graphtheory.collapsiblegraph.graphedge;
import edu.tufts.eecs.graphtheory.collapsiblegraph.graphnode.GraphNode;
/**
* This class is a skeleton, barebones implementation of the GraphEdge interface.
* This could easily be subclassed to include other features such as edge weight.
* @author Jeremy
*/
public class SkeletonGraphEdge implements GraphEdge {
private GraphNode sourceNode;
private GraphNode targetNode;
private int hashCode;
/**
*
* @param sourceNode the source GraphNode of this edge
* @param targetNode the target GraphNode of this edge
*/
public SkeletonGraphEdge(GraphNode sourceNode, GraphNode targetNode) {
this.sourceNode = sourceNode;
this.targetNode = targetNode;
generateHashCode();
}
/**
*
* @param sourceNode the source GraphNode of this Edge
*/
public void setSource(GraphNode sourceNode) {
this.sourceNode=sourceNode;
generateHashCode();
}
/**
*
* @param targetNode the target GraphNode of this Edge
*/
public void setTarget(GraphNode targetNode) {
this.targetNode=targetNode;
generateHashCode();
}
public GraphNode getSource() {
return sourceNode;
}
public GraphNode getTarget() {
return targetNode;
}
//Hashcode is going to be called a lot. Better we calculate once and return the saved value
private void generateHashCode() {
hashCode = (sourceNode.getName()+targetNode.getName()).hashCode();
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SkeletonGraphEdge other = (SkeletonGraphEdge) obj;
if (this.sourceNode != other.sourceNode && (this.sourceNode == null || !this.sourceNode.equals(other.sourceNode))) {
return false;
}
if (this.targetNode != other.targetNode && (this.targetNode == null || !this.targetNode.equals(other.targetNode))) {
return false;
}
if (this.hashCode != other.hashCode) {
return false;
}
return true;
}
}
| UTF-8 | Java | 2,427 | java | SkeletonGraphEdge.java | Java | [
{
"context": "de other features such as edge weight.\r\n * @author Jeremy\r\n */\r\npublic class SkeletonGraphEdge implements G",
"end": 329,
"score": 0.9995156526565552,
"start": 323,
"tag": "NAME",
"value": "Jeremy"
}
]
| null | []
| package edu.tufts.eecs.graphtheory.collapsiblegraph.graphedge;
import edu.tufts.eecs.graphtheory.collapsiblegraph.graphnode.GraphNode;
/**
* This class is a skeleton, barebones implementation of the GraphEdge interface.
* This could easily be subclassed to include other features such as edge weight.
* @author Jeremy
*/
public class SkeletonGraphEdge implements GraphEdge {
private GraphNode sourceNode;
private GraphNode targetNode;
private int hashCode;
/**
*
* @param sourceNode the source GraphNode of this edge
* @param targetNode the target GraphNode of this edge
*/
public SkeletonGraphEdge(GraphNode sourceNode, GraphNode targetNode) {
this.sourceNode = sourceNode;
this.targetNode = targetNode;
generateHashCode();
}
/**
*
* @param sourceNode the source GraphNode of this Edge
*/
public void setSource(GraphNode sourceNode) {
this.sourceNode=sourceNode;
generateHashCode();
}
/**
*
* @param targetNode the target GraphNode of this Edge
*/
public void setTarget(GraphNode targetNode) {
this.targetNode=targetNode;
generateHashCode();
}
public GraphNode getSource() {
return sourceNode;
}
public GraphNode getTarget() {
return targetNode;
}
//Hashcode is going to be called a lot. Better we calculate once and return the saved value
private void generateHashCode() {
hashCode = (sourceNode.getName()+targetNode.getName()).hashCode();
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SkeletonGraphEdge other = (SkeletonGraphEdge) obj;
if (this.sourceNode != other.sourceNode && (this.sourceNode == null || !this.sourceNode.equals(other.sourceNode))) {
return false;
}
if (this.targetNode != other.targetNode && (this.targetNode == null || !this.targetNode.equals(other.targetNode))) {
return false;
}
if (this.hashCode != other.hashCode) {
return false;
}
return true;
}
}
| 2,427 | 0.60651 | 0.60651 | 84 | 26.892857 | 27.831987 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.345238 | false | false | 8 |
fb82734f8d64d1bbf372daccc3178f7c73909d1d | 23,819,888,653,651 | 07aaff9106e9aaf101f09c27af4003d99c910a0e | /src/ANXCamera/sources/com/google/zxing/pdf417/detector/Detector.java | 58f5b3963f9a083c89a3de7b9167d32df5f20f4c | []
| no_license | cvamoose/ANXMiuiCamera10 | https://github.com/cvamoose/ANXMiuiCamera10 | 312e6b55e4c0216bd6b0522777cf8337b4569c65 | b324f1228bd5db9f21bc9c3c5d32399cacfb01da | refs/heads/master | 2020-04-13T10:46:12.347000 | 2018-12-24T15:04:35 | 2018-12-24T15:04:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.google.zxing.pdf417.detector;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public final class Detector {
private static final int BARCODE_MIN_HEIGHT = 10;
private static final int[] INDEXES_START_PATTERN;
private static final int[] INDEXES_STOP_PATTERN = new int[]{6, 2, 7, 3};
private static final float MAX_AVG_VARIANCE = 0.42f;
private static final float MAX_INDIVIDUAL_VARIANCE = 0.8f;
private static final int MAX_PATTERN_DRIFT = 5;
private static final int MAX_PIXEL_DRIFT = 3;
private static final int ROW_STEP = 5;
private static final int SKIPPED_ROW_COUNT_MAX = 25;
private static final int[] START_PATTERN = new int[]{8, 1, 1, 1, 1, 1, 1, 3};
private static final int[] STOP_PATTERN = new int[]{7, 1, 1, 3, 1, 1, 1, 2, 1};
static {
int[] iArr = new int[4];
iArr[1] = 4;
iArr[2] = 1;
iArr[3] = 5;
INDEXES_START_PATTERN = iArr;
}
private Detector() {
}
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintType, ?> map, boolean multiple) throws NotFoundException {
BitMatrix bitMatrix = image.getBlackMatrix();
List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
if (barcodeCoordinates.isEmpty()) {
bitMatrix = bitMatrix.clone();
bitMatrix.rotate180();
barcodeCoordinates = detect(multiple, bitMatrix);
}
return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}
private static List<ResultPoint[]> detect(boolean multiple, BitMatrix bitMatrix) {
List<ResultPoint[]> barcodeCoordinates = new ArrayList();
int row = 0;
int column = 0;
boolean foundBarcodeInRow = false;
while (row < bitMatrix.getHeight()) {
ResultPoint[] vertices = findVertices(bitMatrix, row, column);
if (vertices[0] != null || vertices[3] != null) {
foundBarcodeInRow = true;
barcodeCoordinates.add(vertices);
if (!multiple) {
break;
} else if (vertices[2] != null) {
column = (int) vertices[2].getX();
row = (int) vertices[2].getY();
} else {
column = (int) vertices[4].getX();
row = (int) vertices[4].getY();
}
} else if (!foundBarcodeInRow) {
break;
} else {
for (ResultPoint[] column2 : barcodeCoordinates) {
if (column2[1] != null) {
row = (int) Math.max((float) row, column2[1].getY());
}
if (column2[3] != null) {
row = Math.max(row, (int) column2[3].getY());
}
}
row += 5;
foundBarcodeInRow = false;
column = 0;
}
}
return barcodeCoordinates;
}
private static ResultPoint[] findVertices(BitMatrix matrix, int startRow, int startColumn) {
int height = matrix.getHeight();
int width = matrix.getWidth();
ResultPoint[] result = new ResultPoint[8];
copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN), INDEXES_START_PATTERN);
if (result[4] != null) {
startColumn = (int) result[4].getX();
startRow = (int) result[4].getY();
}
copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, STOP_PATTERN), INDEXES_STOP_PATTERN);
return result;
}
private static void copyToResult(ResultPoint[] result, ResultPoint[] tmpResult, int[] destinationIndexes) {
for (int i = 0; i < destinationIndexes.length; i++) {
result[destinationIndexes[i]] = tmpResult[i];
}
}
/* JADX WARNING: Removed duplicated region for block: B:14:0x0058 */
/* JADX WARNING: Removed duplicated region for block: B:31:0x00d9 */
private static com.google.zxing.ResultPoint[] findRowsWithPattern(com.google.zxing.common.BitMatrix r18, int r19, int r20, int r21, int r22, int[] r23) {
/*
r0 = r19;
r1 = 4;
r1 = new com.google.zxing.ResultPoint[r1];
r2 = 0;
r10 = r23;
r3 = r10.length;
r11 = new int[r3];
r12 = r21;
L_0x000d:
r13 = 0;
r14 = 1;
if (r12 < r0) goto L_0x0012;
L_0x0011:
goto L_0x0054;
L_0x0012:
r7 = 0;
r3 = r18;
r4 = r22;
r5 = r12;
r6 = r20;
r8 = r10;
r9 = r11;
r3 = findGuardPattern(r3, r4, r5, r6, r7, r8, r9);
if (r3 == 0) goto L_0x00e5;
L_0x0022:
r15 = r3;
L_0x0023:
if (r12 > 0) goto L_0x0026;
L_0x0025:
goto L_0x003c;
L_0x0026:
r12 = r12 + -1;
r7 = 0;
r3 = r18;
r4 = r22;
r5 = r12;
r6 = r20;
r8 = r10;
r9 = r11;
r3 = findGuardPattern(r3, r4, r5, r6, r7, r8, r9);
if (r3 == 0) goto L_0x003a;
L_0x0038:
r15 = r3;
goto L_0x0023;
L_0x003a:
r12 = r12 + r14;
L_0x003c:
r3 = new com.google.zxing.ResultPoint;
r4 = r15[r13];
r4 = (float) r4;
r5 = (float) r12;
r3.<init>(r4, r5);
r1[r13] = r3;
r3 = new com.google.zxing.ResultPoint;
r4 = r15[r14];
r4 = (float) r4;
r5 = (float) r12;
r3.<init>(r4, r5);
r1[r14] = r3;
r2 = 1;
L_0x0054:
r3 = r12 + 1;
if (r2 == 0) goto L_0x00d3;
L_0x0058:
r4 = 0;
r15 = 2;
r5 = new int[r15];
r6 = r1[r13];
r6 = r6.getX();
r6 = (int) r6;
r5[r13] = r6;
r6 = r1[r14];
r6 = r6.getX();
r6 = (int) r6;
r5[r14] = r6;
r9 = r3;
r8 = r4;
r16 = r5;
L_0x0072:
if (r9 < r0) goto L_0x0078;
L_0x0074:
r15 = r8;
r17 = r9;
goto L_0x00af;
L_0x0078:
r4 = r16[r13];
r7 = 0;
r3 = r18;
r5 = r9;
r6 = r20;
r15 = r8;
r8 = r10;
r17 = r9;
r9 = r11;
r3 = findGuardPattern(r3, r4, r5, r6, r7, r8, r9);
if (r3 == 0) goto L_0x00aa;
L_0x008b:
r4 = r16[r13];
r5 = r3[r13];
r4 = r4 - r5;
r4 = java.lang.Math.abs(r4);
r5 = 5;
if (r4 >= r5) goto L_0x00aa;
L_0x0097:
r4 = r16[r14];
r6 = r3[r14];
r4 = r4 - r6;
r4 = java.lang.Math.abs(r4);
if (r4 >= r5) goto L_0x00aa;
L_0x00a2:
r4 = r3;
r5 = 0;
r16 = r4;
r8 = r5;
r5 = 2;
goto L_0x00cf;
L_0x00aa:
r4 = 25;
if (r15 <= r4) goto L_0x00cc;
L_0x00af:
r8 = r15 + 1;
r3 = r17 - r8;
r4 = new com.google.zxing.ResultPoint;
r5 = r16[r13];
r5 = (float) r5;
r6 = (float) r3;
r4.<init>(r5, r6);
r5 = 2;
r1[r5] = r4;
r4 = 3;
r5 = new com.google.zxing.ResultPoint;
r6 = r16[r14];
r6 = (float) r6;
r7 = (float) r3;
r5.<init>(r6, r7);
r1[r4] = r5;
goto L_0x00d3;
L_0x00cc:
r5 = 2;
r8 = r15 + 1;
L_0x00cf:
r9 = r17 + 1;
r15 = r5;
goto L_0x0072;
L_0x00d3:
r4 = r3 - r12;
r5 = 10;
if (r4 >= r5) goto L_0x00e4;
L_0x00d9:
r4 = 0;
L_0x00da:
r5 = r1.length;
if (r4 < r5) goto L_0x00de;
L_0x00dd:
goto L_0x00e4;
L_0x00de:
r5 = 0;
r1[r4] = r5;
r4 = r4 + 1;
goto L_0x00da;
L_0x00e4:
return r1;
L_0x00e5:
r12 = r12 + 5;
goto L_0x000d;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.detector.Detector.findRowsWithPattern(com.google.zxing.common.BitMatrix, int, int, int, int, int[]):com.google.zxing.ResultPoint[]");
}
private static int[] findGuardPattern(BitMatrix matrix, int column, int row, int width, boolean whiteFirst, int[] pattern, int[] counters) {
int pixelDrift;
BitMatrix bitMatrix = matrix;
int i = row;
int[] iArr = pattern;
Object obj = counters;
int i2 = 0;
Arrays.fill(obj, 0, obj.length, 0);
int patternLength = iArr.length;
int isWhite = whiteFirst;
int patternStart = column;
int pixelDrift2 = 0;
while (bitMatrix.get(patternStart, i) && patternStart > 0) {
pixelDrift = pixelDrift2 + 1;
if (pixelDrift2 >= 3) {
break;
}
patternStart--;
pixelDrift2 = pixelDrift;
}
pixelDrift = patternStart;
int counterPosition = 0;
while (pixelDrift < width) {
int i3;
if ((bitMatrix.get(pixelDrift, i) ^ isWhite) != 0) {
obj[counterPosition] = obj[counterPosition] + 1;
i3 = i2;
} else {
if (counterPosition != patternLength - 1) {
i3 = 0;
counterPosition++;
} else if (patternMatchVariance(obj, iArr, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
return new int[]{patternStart, pixelDrift};
} else {
i3 = 0;
patternStart += obj[0] + obj[1];
System.arraycopy(obj, 2, obj, 0, patternLength - 2);
obj[patternLength - 2] = null;
obj[patternLength - 1] = null;
counterPosition--;
}
boolean z = true;
obj[counterPosition] = 1;
if (isWhite != 0) {
z = i3;
}
isWhite = z;
}
pixelDrift++;
i2 = i3;
}
if (counterPosition != patternLength - 1 || patternMatchVariance(obj, iArr, MAX_INDIVIDUAL_VARIANCE) >= MAX_AVG_VARIANCE) {
return null;
}
return new int[]{patternStart, pixelDrift - 1};
}
private static float patternMatchVariance(int[] counters, int[] pattern, float maxIndividualVariance) {
int i;
int numCounters = counters.length;
int total = 0;
int patternLength = 0;
for (i = 0; i < numCounters; i++) {
total += counters[i];
patternLength += pattern[i];
}
if (total < patternLength) {
return Float.POSITIVE_INFINITY;
}
float unitBarWidth = ((float) total) / ((float) patternLength);
float maxIndividualVariance2 = maxIndividualVariance * unitBarWidth;
maxIndividualVariance = 0.0f;
for (i = 0; i < numCounters; i++) {
int counter = counters[i];
float scaledPattern = ((float) pattern[i]) * unitBarWidth;
float variance = ((float) counter) > scaledPattern ? ((float) counter) - scaledPattern : scaledPattern - ((float) counter);
if (variance > maxIndividualVariance2) {
return Float.POSITIVE_INFINITY;
}
maxIndividualVariance += variance;
}
return maxIndividualVariance / ((float) total);
}
}
| UTF-8 | Java | 11,766 | java | Detector.java | Java | []
| null | []
| package com.google.zxing.pdf417.detector;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public final class Detector {
private static final int BARCODE_MIN_HEIGHT = 10;
private static final int[] INDEXES_START_PATTERN;
private static final int[] INDEXES_STOP_PATTERN = new int[]{6, 2, 7, 3};
private static final float MAX_AVG_VARIANCE = 0.42f;
private static final float MAX_INDIVIDUAL_VARIANCE = 0.8f;
private static final int MAX_PATTERN_DRIFT = 5;
private static final int MAX_PIXEL_DRIFT = 3;
private static final int ROW_STEP = 5;
private static final int SKIPPED_ROW_COUNT_MAX = 25;
private static final int[] START_PATTERN = new int[]{8, 1, 1, 1, 1, 1, 1, 3};
private static final int[] STOP_PATTERN = new int[]{7, 1, 1, 3, 1, 1, 1, 2, 1};
static {
int[] iArr = new int[4];
iArr[1] = 4;
iArr[2] = 1;
iArr[3] = 5;
INDEXES_START_PATTERN = iArr;
}
private Detector() {
}
public static PDF417DetectorResult detect(BinaryBitmap image, Map<DecodeHintType, ?> map, boolean multiple) throws NotFoundException {
BitMatrix bitMatrix = image.getBlackMatrix();
List<ResultPoint[]> barcodeCoordinates = detect(multiple, bitMatrix);
if (barcodeCoordinates.isEmpty()) {
bitMatrix = bitMatrix.clone();
bitMatrix.rotate180();
barcodeCoordinates = detect(multiple, bitMatrix);
}
return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);
}
private static List<ResultPoint[]> detect(boolean multiple, BitMatrix bitMatrix) {
List<ResultPoint[]> barcodeCoordinates = new ArrayList();
int row = 0;
int column = 0;
boolean foundBarcodeInRow = false;
while (row < bitMatrix.getHeight()) {
ResultPoint[] vertices = findVertices(bitMatrix, row, column);
if (vertices[0] != null || vertices[3] != null) {
foundBarcodeInRow = true;
barcodeCoordinates.add(vertices);
if (!multiple) {
break;
} else if (vertices[2] != null) {
column = (int) vertices[2].getX();
row = (int) vertices[2].getY();
} else {
column = (int) vertices[4].getX();
row = (int) vertices[4].getY();
}
} else if (!foundBarcodeInRow) {
break;
} else {
for (ResultPoint[] column2 : barcodeCoordinates) {
if (column2[1] != null) {
row = (int) Math.max((float) row, column2[1].getY());
}
if (column2[3] != null) {
row = Math.max(row, (int) column2[3].getY());
}
}
row += 5;
foundBarcodeInRow = false;
column = 0;
}
}
return barcodeCoordinates;
}
private static ResultPoint[] findVertices(BitMatrix matrix, int startRow, int startColumn) {
int height = matrix.getHeight();
int width = matrix.getWidth();
ResultPoint[] result = new ResultPoint[8];
copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN), INDEXES_START_PATTERN);
if (result[4] != null) {
startColumn = (int) result[4].getX();
startRow = (int) result[4].getY();
}
copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, STOP_PATTERN), INDEXES_STOP_PATTERN);
return result;
}
private static void copyToResult(ResultPoint[] result, ResultPoint[] tmpResult, int[] destinationIndexes) {
for (int i = 0; i < destinationIndexes.length; i++) {
result[destinationIndexes[i]] = tmpResult[i];
}
}
/* JADX WARNING: Removed duplicated region for block: B:14:0x0058 */
/* JADX WARNING: Removed duplicated region for block: B:31:0x00d9 */
private static com.google.zxing.ResultPoint[] findRowsWithPattern(com.google.zxing.common.BitMatrix r18, int r19, int r20, int r21, int r22, int[] r23) {
/*
r0 = r19;
r1 = 4;
r1 = new com.google.zxing.ResultPoint[r1];
r2 = 0;
r10 = r23;
r3 = r10.length;
r11 = new int[r3];
r12 = r21;
L_0x000d:
r13 = 0;
r14 = 1;
if (r12 < r0) goto L_0x0012;
L_0x0011:
goto L_0x0054;
L_0x0012:
r7 = 0;
r3 = r18;
r4 = r22;
r5 = r12;
r6 = r20;
r8 = r10;
r9 = r11;
r3 = findGuardPattern(r3, r4, r5, r6, r7, r8, r9);
if (r3 == 0) goto L_0x00e5;
L_0x0022:
r15 = r3;
L_0x0023:
if (r12 > 0) goto L_0x0026;
L_0x0025:
goto L_0x003c;
L_0x0026:
r12 = r12 + -1;
r7 = 0;
r3 = r18;
r4 = r22;
r5 = r12;
r6 = r20;
r8 = r10;
r9 = r11;
r3 = findGuardPattern(r3, r4, r5, r6, r7, r8, r9);
if (r3 == 0) goto L_0x003a;
L_0x0038:
r15 = r3;
goto L_0x0023;
L_0x003a:
r12 = r12 + r14;
L_0x003c:
r3 = new com.google.zxing.ResultPoint;
r4 = r15[r13];
r4 = (float) r4;
r5 = (float) r12;
r3.<init>(r4, r5);
r1[r13] = r3;
r3 = new com.google.zxing.ResultPoint;
r4 = r15[r14];
r4 = (float) r4;
r5 = (float) r12;
r3.<init>(r4, r5);
r1[r14] = r3;
r2 = 1;
L_0x0054:
r3 = r12 + 1;
if (r2 == 0) goto L_0x00d3;
L_0x0058:
r4 = 0;
r15 = 2;
r5 = new int[r15];
r6 = r1[r13];
r6 = r6.getX();
r6 = (int) r6;
r5[r13] = r6;
r6 = r1[r14];
r6 = r6.getX();
r6 = (int) r6;
r5[r14] = r6;
r9 = r3;
r8 = r4;
r16 = r5;
L_0x0072:
if (r9 < r0) goto L_0x0078;
L_0x0074:
r15 = r8;
r17 = r9;
goto L_0x00af;
L_0x0078:
r4 = r16[r13];
r7 = 0;
r3 = r18;
r5 = r9;
r6 = r20;
r15 = r8;
r8 = r10;
r17 = r9;
r9 = r11;
r3 = findGuardPattern(r3, r4, r5, r6, r7, r8, r9);
if (r3 == 0) goto L_0x00aa;
L_0x008b:
r4 = r16[r13];
r5 = r3[r13];
r4 = r4 - r5;
r4 = java.lang.Math.abs(r4);
r5 = 5;
if (r4 >= r5) goto L_0x00aa;
L_0x0097:
r4 = r16[r14];
r6 = r3[r14];
r4 = r4 - r6;
r4 = java.lang.Math.abs(r4);
if (r4 >= r5) goto L_0x00aa;
L_0x00a2:
r4 = r3;
r5 = 0;
r16 = r4;
r8 = r5;
r5 = 2;
goto L_0x00cf;
L_0x00aa:
r4 = 25;
if (r15 <= r4) goto L_0x00cc;
L_0x00af:
r8 = r15 + 1;
r3 = r17 - r8;
r4 = new com.google.zxing.ResultPoint;
r5 = r16[r13];
r5 = (float) r5;
r6 = (float) r3;
r4.<init>(r5, r6);
r5 = 2;
r1[r5] = r4;
r4 = 3;
r5 = new com.google.zxing.ResultPoint;
r6 = r16[r14];
r6 = (float) r6;
r7 = (float) r3;
r5.<init>(r6, r7);
r1[r4] = r5;
goto L_0x00d3;
L_0x00cc:
r5 = 2;
r8 = r15 + 1;
L_0x00cf:
r9 = r17 + 1;
r15 = r5;
goto L_0x0072;
L_0x00d3:
r4 = r3 - r12;
r5 = 10;
if (r4 >= r5) goto L_0x00e4;
L_0x00d9:
r4 = 0;
L_0x00da:
r5 = r1.length;
if (r4 < r5) goto L_0x00de;
L_0x00dd:
goto L_0x00e4;
L_0x00de:
r5 = 0;
r1[r4] = r5;
r4 = r4 + 1;
goto L_0x00da;
L_0x00e4:
return r1;
L_0x00e5:
r12 = r12 + 5;
goto L_0x000d;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.pdf417.detector.Detector.findRowsWithPattern(com.google.zxing.common.BitMatrix, int, int, int, int, int[]):com.google.zxing.ResultPoint[]");
}
private static int[] findGuardPattern(BitMatrix matrix, int column, int row, int width, boolean whiteFirst, int[] pattern, int[] counters) {
int pixelDrift;
BitMatrix bitMatrix = matrix;
int i = row;
int[] iArr = pattern;
Object obj = counters;
int i2 = 0;
Arrays.fill(obj, 0, obj.length, 0);
int patternLength = iArr.length;
int isWhite = whiteFirst;
int patternStart = column;
int pixelDrift2 = 0;
while (bitMatrix.get(patternStart, i) && patternStart > 0) {
pixelDrift = pixelDrift2 + 1;
if (pixelDrift2 >= 3) {
break;
}
patternStart--;
pixelDrift2 = pixelDrift;
}
pixelDrift = patternStart;
int counterPosition = 0;
while (pixelDrift < width) {
int i3;
if ((bitMatrix.get(pixelDrift, i) ^ isWhite) != 0) {
obj[counterPosition] = obj[counterPosition] + 1;
i3 = i2;
} else {
if (counterPosition != patternLength - 1) {
i3 = 0;
counterPosition++;
} else if (patternMatchVariance(obj, iArr, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
return new int[]{patternStart, pixelDrift};
} else {
i3 = 0;
patternStart += obj[0] + obj[1];
System.arraycopy(obj, 2, obj, 0, patternLength - 2);
obj[patternLength - 2] = null;
obj[patternLength - 1] = null;
counterPosition--;
}
boolean z = true;
obj[counterPosition] = 1;
if (isWhite != 0) {
z = i3;
}
isWhite = z;
}
pixelDrift++;
i2 = i3;
}
if (counterPosition != patternLength - 1 || patternMatchVariance(obj, iArr, MAX_INDIVIDUAL_VARIANCE) >= MAX_AVG_VARIANCE) {
return null;
}
return new int[]{patternStart, pixelDrift - 1};
}
private static float patternMatchVariance(int[] counters, int[] pattern, float maxIndividualVariance) {
int i;
int numCounters = counters.length;
int total = 0;
int patternLength = 0;
for (i = 0; i < numCounters; i++) {
total += counters[i];
patternLength += pattern[i];
}
if (total < patternLength) {
return Float.POSITIVE_INFINITY;
}
float unitBarWidth = ((float) total) / ((float) patternLength);
float maxIndividualVariance2 = maxIndividualVariance * unitBarWidth;
maxIndividualVariance = 0.0f;
for (i = 0; i < numCounters; i++) {
int counter = counters[i];
float scaledPattern = ((float) pattern[i]) * unitBarWidth;
float variance = ((float) counter) > scaledPattern ? ((float) counter) - scaledPattern : scaledPattern - ((float) counter);
if (variance > maxIndividualVariance2) {
return Float.POSITIVE_INFINITY;
}
maxIndividualVariance += variance;
}
return maxIndividualVariance / ((float) total);
}
}
| 11,766 | 0.507394 | 0.444926 | 361 | 31.592798 | 26.634239 | 229 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.00277 | false | false | 8 |
6dec85034d4992d5b62bee3b1c73c0f00d784a2b | 23,819,888,651,087 | 2ca6084dbc64530e4a5d84ef4d8329a0c21baf63 | /Biblioteka/src/domen/Referenca.java | d8d5478531bc37d5851928b937190490b4f8d922 | []
| no_license | lukakljajevic/projektovanje-softvera | https://github.com/lukakljajevic/projektovanje-softvera | d97e3eae49fab8ad0b77cb295b93e5737bdc3992 | c376e7f8340f3d1a8e36040b9246027e9ae9fc71 | refs/heads/master | 2020-03-28T06:44:06.263000 | 2018-09-07T17:47:59 | 2018-09-07T17:47:59 | 147,856,085 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 domen;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Luka
*/
public class Referenca implements IDomen {
private int referencaID;
private String naslov;
private int godina;
private List<Nastavnik> listaNastavnika;
private List<SpoljniAutor> listaSpoljnihAutora;
public Referenca() {
listaNastavnika = new ArrayList<>();
listaSpoljnihAutora = new ArrayList<>();
}
public Referenca(int referencaID, String naziv, int godina, List<Nastavnik> listaNastavnika, List<SpoljniAutor> listaSpoljnihAutora) {
this.referencaID = referencaID;
this.naslov = naziv;
this.godina = godina;
this.listaNastavnika = listaNastavnika;
this.listaSpoljnihAutora = listaSpoljnihAutora;
}
public int getReferencaID() {
return referencaID;
}
public void setReferencaID(int referencaID) {
this.referencaID = referencaID;
}
public String getNaslov() {
return naslov;
}
public void setNaslov(String naslov) {
this.naslov = naslov;
}
public int getGodina() {
return godina;
}
public void setGodina(int godina) {
this.godina = godina;
}
public List<Nastavnik> getListaNastavnika() {
return listaNastavnika;
}
public void setListaNastavnika(List<Nastavnik> listaNastavnika) {
this.listaNastavnika = listaNastavnika;
}
public List<SpoljniAutor> getListaSpoljnihAutora() {
return listaSpoljnihAutora;
}
public void setListaSpoljnihAutora(List<SpoljniAutor> listaSpoljnihAutora) {
this.listaSpoljnihAutora = listaSpoljnihAutora;
}
@Override
public String getTableName() {
return "referenca";
}
@Override
public String getWhereEqualsColumnsSingle() {
return "WHERE referencaID = " + referencaID;
}
@Override
public String getWhereEqualsColumnsMultiple() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getWhereLikeColumnsSingle() {
return "WHERE naslov LIKE '%" + naslov + "%'";
}
@Override
public String getWhereLikeColumnsMultiple() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getJoinColumnsBasic() {
return "JOIN `referenca-nastavnik` ON referencaID = referencaIDPK JOIN `nastavnik` ON nastavnikIDPK = nastavnikID";
}
@Override
public String getJoinColumnsAll() {
return "LEFT JOIN `referenca-nastavnik` ON referencaID = referencaIDPK LEFT JOIN `nastavnik` ON nastavnikIDPK = nastavnikID LEFT JOIN `referenca-spoljniautor` ON referencaID = referencaIDP LEFT JOIN `spoljni-autor` ON autorIDPK = autorID";
}
@Override
public String getInsertColumns() {
return "(naslov, godina)";
}
@Override
public String getInsertValues() {
return "('" + naslov + "', " + godina + ")";
}
@Override
public String getUpdateColumnsAndValues() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public IDomen getOne(ResultSet rs) throws Exception {
Referenca vrati = new Referenca();
int brojac = 0;
while (rs.next()) {
brojac++;
if (brojac == 1) {
vrati.setReferencaID(rs.getInt("referencaID"));
}
Nastavnik n = new Nastavnik();
n.setNastavnikID(rs.getInt("nastavnikID"));
n.setImePrezime(rs.getString("imePrezime"));
vrati.getListaNastavnika().add(n);
}
return vrati;
}
@Override
public List<IDomen> getAllBasic(ResultSet rs) throws Exception {
List<IDomen> vrati = new ArrayList<>();
Referenca r = new Referenca();
while (rs.next()) {
r.setReferencaID(rs.getInt("referencaID"));
r.setNaslov(rs.getString("naslov"));
r.setGodina(rs.getInt("godina"));
int nastavnikID = rs.getInt("nastavnikID");
if (nastavnikID > 0) {
Nastavnik n = new Nastavnik();
n.setNastavnikID(nastavnikID);
n.setImePrezime(rs.getString("imePrezime"));
n.setInstitucija(rs.getString("institucija"));
n.setNaucnaOblast(rs.getString("naucnaOblast"));
if (!sadrziNastavnika(r, n)) {
r.getListaNastavnika().add(n);
}
}
int autorID = rs.getInt("autorID");
if (autorID > 0) {
SpoljniAutor sa = new SpoljniAutor();
sa.setAutorID(rs.getInt("autorID"));
sa.setImePrezime(rs.getString("imePrezimeAutora"));
if (!sadrziAutora(r, sa)) {
r.getListaSpoljnihAutora().add(sa);
}
}
if (rs.next()) {
Referenca sledecaReferenca = new Referenca();
sledecaReferenca.setReferencaID(rs.getInt("referencaID"));
sledecaReferenca.setNaslov(rs.getString("naslov"));
sledecaReferenca.setGodina(rs.getInt("godina"));
if (sledecaReferenca.getReferencaID() != r.getReferencaID()) {
vrati.add(r);
r = new Referenca();
}
rs.previous();
} else {
vrati.add(r);
}
}
rs.close();
return vrati;
}
@Override
public List<IDomen> getAllFull(ResultSet rs) throws Exception {
List<IDomen> vrati = new ArrayList<>();
Referenca r = new Referenca();
while (rs.next()) {
r.setReferencaID(rs.getInt("referencaID"));
r.setNaslov(rs.getString("naslov"));
r.setGodina(rs.getInt("godina"));
int nastavnikID = rs.getInt("nastavnikID");
if (nastavnikID > 0) {
Nastavnik n = new Nastavnik();
n.setNastavnikID(nastavnikID);
n.setImePrezime(rs.getString("imePrezime"));
if (!sadrziNastavnika(r, n)) {
r.getListaNastavnika().add(n);
}
}
int autorID = rs.getInt("autorID");
if (autorID > 0) {
SpoljniAutor sa = new SpoljniAutor(autorID, rs.getString("imePrezimeAutora"));
if (!sadrziAutora(r, sa)) {
r.getListaSpoljnihAutora().add(sa);
}
}
if (rs.next()) {
int referencaIDSledeca = rs.getInt("referencaID");
if (r.getReferencaID() != referencaIDSledeca) {
vrati.add(r);
r = new Referenca();
}
rs.previous();
}
}
vrati.add(r);
rs.close();
return vrati;
}
public String vratiAutore() {
String vrati = "";
for (SpoljniAutor autor : listaSpoljnihAutora) {
vrati += autor.getImePrezime() + ", ";
}
if (vrati != "") {
vrati = vrati.substring(0, vrati.length() - 2);
}
return vrati;
}
public String vratiNastavnike() {
String vrati = "";
for (Nastavnik nastavnik : listaNastavnika) {
vrati += nastavnik.getImePrezime() + ", ";
}
if (!vrati.equals("")) {
vrati = vrati.substring(0, vrati.length() - 2);
}
return vrati;
}
private boolean sadrziNastavnika(Referenca r, Nastavnik n) {
for (Nastavnik nas : r.getListaNastavnika()) {
if (nas.getNastavnikID() == n.getNastavnikID()) {
return true;
}
}
return false;
}
private boolean sadrziAutora(Referenca r, SpoljniAutor sa) {
for (SpoljniAutor spoljniAutor : r.getListaSpoljnihAutora()) {
if (spoljniAutor.getAutorID() == sa.getAutorID()) {
return true;
}
}
return false;
}
@Override
public int getAfterInsert(ResultSet rs) throws Exception {
int id = 0;
while (rs.next()) {
id = rs.getInt(1);
}
return id;
}
@Override
public String getOrderByColumns() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getWhereEqualsColumnsSingle2() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| UTF-8 | Java | 9,181 | java | Referenca.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n *\n * @author Luka\n */\npublic class Referenca implements IDomen {\n\n ",
"end": 302,
"score": 0.9903796911239624,
"start": 298,
"tag": "NAME",
"value": "Luka"
}
]
| null | []
| /*
* 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 domen;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Luka
*/
public class Referenca implements IDomen {
private int referencaID;
private String naslov;
private int godina;
private List<Nastavnik> listaNastavnika;
private List<SpoljniAutor> listaSpoljnihAutora;
public Referenca() {
listaNastavnika = new ArrayList<>();
listaSpoljnihAutora = new ArrayList<>();
}
public Referenca(int referencaID, String naziv, int godina, List<Nastavnik> listaNastavnika, List<SpoljniAutor> listaSpoljnihAutora) {
this.referencaID = referencaID;
this.naslov = naziv;
this.godina = godina;
this.listaNastavnika = listaNastavnika;
this.listaSpoljnihAutora = listaSpoljnihAutora;
}
public int getReferencaID() {
return referencaID;
}
public void setReferencaID(int referencaID) {
this.referencaID = referencaID;
}
public String getNaslov() {
return naslov;
}
public void setNaslov(String naslov) {
this.naslov = naslov;
}
public int getGodina() {
return godina;
}
public void setGodina(int godina) {
this.godina = godina;
}
public List<Nastavnik> getListaNastavnika() {
return listaNastavnika;
}
public void setListaNastavnika(List<Nastavnik> listaNastavnika) {
this.listaNastavnika = listaNastavnika;
}
public List<SpoljniAutor> getListaSpoljnihAutora() {
return listaSpoljnihAutora;
}
public void setListaSpoljnihAutora(List<SpoljniAutor> listaSpoljnihAutora) {
this.listaSpoljnihAutora = listaSpoljnihAutora;
}
@Override
public String getTableName() {
return "referenca";
}
@Override
public String getWhereEqualsColumnsSingle() {
return "WHERE referencaID = " + referencaID;
}
@Override
public String getWhereEqualsColumnsMultiple() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getWhereLikeColumnsSingle() {
return "WHERE naslov LIKE '%" + naslov + "%'";
}
@Override
public String getWhereLikeColumnsMultiple() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getJoinColumnsBasic() {
return "JOIN `referenca-nastavnik` ON referencaID = referencaIDPK JOIN `nastavnik` ON nastavnikIDPK = nastavnikID";
}
@Override
public String getJoinColumnsAll() {
return "LEFT JOIN `referenca-nastavnik` ON referencaID = referencaIDPK LEFT JOIN `nastavnik` ON nastavnikIDPK = nastavnikID LEFT JOIN `referenca-spoljniautor` ON referencaID = referencaIDP LEFT JOIN `spoljni-autor` ON autorIDPK = autorID";
}
@Override
public String getInsertColumns() {
return "(naslov, godina)";
}
@Override
public String getInsertValues() {
return "('" + naslov + "', " + godina + ")";
}
@Override
public String getUpdateColumnsAndValues() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public IDomen getOne(ResultSet rs) throws Exception {
Referenca vrati = new Referenca();
int brojac = 0;
while (rs.next()) {
brojac++;
if (brojac == 1) {
vrati.setReferencaID(rs.getInt("referencaID"));
}
Nastavnik n = new Nastavnik();
n.setNastavnikID(rs.getInt("nastavnikID"));
n.setImePrezime(rs.getString("imePrezime"));
vrati.getListaNastavnika().add(n);
}
return vrati;
}
@Override
public List<IDomen> getAllBasic(ResultSet rs) throws Exception {
List<IDomen> vrati = new ArrayList<>();
Referenca r = new Referenca();
while (rs.next()) {
r.setReferencaID(rs.getInt("referencaID"));
r.setNaslov(rs.getString("naslov"));
r.setGodina(rs.getInt("godina"));
int nastavnikID = rs.getInt("nastavnikID");
if (nastavnikID > 0) {
Nastavnik n = new Nastavnik();
n.setNastavnikID(nastavnikID);
n.setImePrezime(rs.getString("imePrezime"));
n.setInstitucija(rs.getString("institucija"));
n.setNaucnaOblast(rs.getString("naucnaOblast"));
if (!sadrziNastavnika(r, n)) {
r.getListaNastavnika().add(n);
}
}
int autorID = rs.getInt("autorID");
if (autorID > 0) {
SpoljniAutor sa = new SpoljniAutor();
sa.setAutorID(rs.getInt("autorID"));
sa.setImePrezime(rs.getString("imePrezimeAutora"));
if (!sadrziAutora(r, sa)) {
r.getListaSpoljnihAutora().add(sa);
}
}
if (rs.next()) {
Referenca sledecaReferenca = new Referenca();
sledecaReferenca.setReferencaID(rs.getInt("referencaID"));
sledecaReferenca.setNaslov(rs.getString("naslov"));
sledecaReferenca.setGodina(rs.getInt("godina"));
if (sledecaReferenca.getReferencaID() != r.getReferencaID()) {
vrati.add(r);
r = new Referenca();
}
rs.previous();
} else {
vrati.add(r);
}
}
rs.close();
return vrati;
}
@Override
public List<IDomen> getAllFull(ResultSet rs) throws Exception {
List<IDomen> vrati = new ArrayList<>();
Referenca r = new Referenca();
while (rs.next()) {
r.setReferencaID(rs.getInt("referencaID"));
r.setNaslov(rs.getString("naslov"));
r.setGodina(rs.getInt("godina"));
int nastavnikID = rs.getInt("nastavnikID");
if (nastavnikID > 0) {
Nastavnik n = new Nastavnik();
n.setNastavnikID(nastavnikID);
n.setImePrezime(rs.getString("imePrezime"));
if (!sadrziNastavnika(r, n)) {
r.getListaNastavnika().add(n);
}
}
int autorID = rs.getInt("autorID");
if (autorID > 0) {
SpoljniAutor sa = new SpoljniAutor(autorID, rs.getString("imePrezimeAutora"));
if (!sadrziAutora(r, sa)) {
r.getListaSpoljnihAutora().add(sa);
}
}
if (rs.next()) {
int referencaIDSledeca = rs.getInt("referencaID");
if (r.getReferencaID() != referencaIDSledeca) {
vrati.add(r);
r = new Referenca();
}
rs.previous();
}
}
vrati.add(r);
rs.close();
return vrati;
}
public String vratiAutore() {
String vrati = "";
for (SpoljniAutor autor : listaSpoljnihAutora) {
vrati += autor.getImePrezime() + ", ";
}
if (vrati != "") {
vrati = vrati.substring(0, vrati.length() - 2);
}
return vrati;
}
public String vratiNastavnike() {
String vrati = "";
for (Nastavnik nastavnik : listaNastavnika) {
vrati += nastavnik.getImePrezime() + ", ";
}
if (!vrati.equals("")) {
vrati = vrati.substring(0, vrati.length() - 2);
}
return vrati;
}
private boolean sadrziNastavnika(Referenca r, Nastavnik n) {
for (Nastavnik nas : r.getListaNastavnika()) {
if (nas.getNastavnikID() == n.getNastavnikID()) {
return true;
}
}
return false;
}
private boolean sadrziAutora(Referenca r, SpoljniAutor sa) {
for (SpoljniAutor spoljniAutor : r.getListaSpoljnihAutora()) {
if (spoljniAutor.getAutorID() == sa.getAutorID()) {
return true;
}
}
return false;
}
@Override
public int getAfterInsert(ResultSet rs) throws Exception {
int id = 0;
while (rs.next()) {
id = rs.getInt(1);
}
return id;
}
@Override
public String getOrderByColumns() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getWhereEqualsColumnsSingle2() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| 9,181 | 0.571942 | 0.570526 | 310 | 28.616129 | 29.927187 | 247 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.448387 | false | false | 8 |
7bd070293e2134b7dcacea34acf6201365933df4 | 20,478,404,106,345 | c04a0468c0fecba5873737a2760c3b37dd7ea5c5 | /src/ANXGallery/sources/com/miui/gallery/editor/photo/app/sticker/HeaderHolder.java | 034ffc680b75d646357daaf87f33069051bc4fb2 | []
| no_license | tbigmimi/ANXMiuiApps | https://github.com/tbigmimi/ANXMiuiApps | 37d83616250c35569672186d479e22e7d47f25a0 | cbce8c31f64f5fa3e1b1da00b9f806b096ea0a68 | refs/heads/master | 2021-10-24T18:31:30.128000 | 2019-03-27T14:06:49 | 2019-03-27T14:06:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.miui.gallery.editor.photo.app.sticker;
import android.content.Context;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
import android.widget.TextView;
import com.miui.gallery.editor.photo.core.common.model.StickerCategory;
import miui.cloud.backup.data.KeyStringSettingItem;
public class HeaderHolder extends ViewHolder {
private TextView mTitle;
public HeaderHolder(View itemView) {
super(itemView);
if (itemView instanceof TextView) {
this.mTitle = (TextView) itemView;
}
}
void bind(StickerCategory category) {
if (this.mTitle != null) {
Context context = this.mTitle.getContext();
int nameResId = context.getResources().getIdentifier(category.name, KeyStringSettingItem.TYPE, "com.miui.gallery");
if (nameResId != 0) {
this.mTitle.setText(context.getString(nameResId));
}
}
}
}
| UTF-8 | Java | 970 | java | HeaderHolder.java | Java | []
| null | []
| package com.miui.gallery.editor.photo.app.sticker;
import android.content.Context;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
import android.widget.TextView;
import com.miui.gallery.editor.photo.core.common.model.StickerCategory;
import miui.cloud.backup.data.KeyStringSettingItem;
public class HeaderHolder extends ViewHolder {
private TextView mTitle;
public HeaderHolder(View itemView) {
super(itemView);
if (itemView instanceof TextView) {
this.mTitle = (TextView) itemView;
}
}
void bind(StickerCategory category) {
if (this.mTitle != null) {
Context context = this.mTitle.getContext();
int nameResId = context.getResources().getIdentifier(category.name, KeyStringSettingItem.TYPE, "com.miui.gallery");
if (nameResId != 0) {
this.mTitle.setText(context.getString(nameResId));
}
}
}
}
| 970 | 0.680412 | 0.678351 | 29 | 32.448277 | 27.707321 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517241 | false | false | 8 |
3031f3a12069813a9ba88a7e220c639851b7f105 | 7,155,415,550,562 | d4110a1df723f516033a74a29075856c40158658 | /GoodsService/src/test/java/xmu/oomall/Mapper/ProductMapperTest.java | c09c6edc65a687449e15b5493467805900a55367 | []
| no_license | hanzeingithub/oomall | https://github.com/hanzeingithub/oomall | daf925c5972b7710fcb8520150b93be6fc9bc2ed | 7bef29367813889cff607efd73e0fc8927f40664 | refs/heads/master | 2023-05-12T15:17:22.150000 | 2020-04-10T13:29:55 | 2020-04-10T13:29:55 | 254,624,813 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //package xmu.oomall.Mapper;
//
//import xmu.oomall.domain.goods.ProductPo;
//import xmu.oomall.mapper.ProductMapper;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringRunner;
//
//import java.time.LocalDateTime;
//import java.util.LinkedList;
//import java.util.List;
//
//
///**
// * ProductMapperTest
// *
// * @author YangHong
// * @date 2019-12-07
// */
//@RunWith(SpringRunner.class)
//@SpringBootTest
//public class ProductMapperTest {
// private static final Logger logger = LoggerFactory.getLogger(ProductMapperTest.class);
// @Autowired
// private ProductMapper productMapper;
// @Test
// public void insertTest(){
// ProductPo product = new ProductPo();
//
// product.setGoodsId(1);
// product.setGmtCreate(LocalDateTime.now());
// product.setSpecifications("有种原因是因为产生了一个*map.out.xml空文件,删掉就好");
// List<ProductPo> products = new LinkedList<>();
// products.add(product);
// products.add(product);
//
// // 一次插两条
// productMapper.insertProduct(products);
// logger.info(products.toString());
//
// // 一次插一条
// products = new LinkedList<>();
// product.setId(1);
// products.add(product);
// productMapper.insertProduct(products);
// logger.info(product.toString());
// }
//
// @Test
// public void updateTest(){
// ProductPo product = new ProductPo();
// product.setGmtModified(LocalDateTime.now());
// product.setGoodsId(1);
// product.setSpecifications("this is a update test");
// product.setId(1);
// productMapper.updateProduct(product);
// logger.info(product.toString());
// }
//
// @Test
// public void getTest(){
// //根据id查product
// List<ProductPo> products = productMapper.listProductsByGoodsId("id", 1);
// logger.info(products.toString());
//
// //根据商品id查products
// products = productMapper.listProductsByGoodsId("goods_id", 1);
// logger.info(products.toString());
// }
// @Test
// public void deleteTest(){
// // 批量删除,一次删一条
// List<Integer> ids = new LinkedList<>();
// ids.add(1);
// productMapper.deleteProductById(ids);
// logger.info("delete 1");
// }
//}
| UTF-8 | Java | 2,690 | java | ProductMapperTest.java | Java | [
{
"context": "\n///**\r\n// * ProductMapperTest\r\n// *\r\n// * @author YangHong\r\n// * @date 2019-12-07\r\n// */\r\n//@RunWith(SpringR",
"end": 604,
"score": 0.999488890171051,
"start": 596,
"tag": "NAME",
"value": "YangHong"
}
]
| null | []
| //package xmu.oomall.Mapper;
//
//import xmu.oomall.domain.goods.ProductPo;
//import xmu.oomall.mapper.ProductMapper;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringRunner;
//
//import java.time.LocalDateTime;
//import java.util.LinkedList;
//import java.util.List;
//
//
///**
// * ProductMapperTest
// *
// * @author YangHong
// * @date 2019-12-07
// */
//@RunWith(SpringRunner.class)
//@SpringBootTest
//public class ProductMapperTest {
// private static final Logger logger = LoggerFactory.getLogger(ProductMapperTest.class);
// @Autowired
// private ProductMapper productMapper;
// @Test
// public void insertTest(){
// ProductPo product = new ProductPo();
//
// product.setGoodsId(1);
// product.setGmtCreate(LocalDateTime.now());
// product.setSpecifications("有种原因是因为产生了一个*map.out.xml空文件,删掉就好");
// List<ProductPo> products = new LinkedList<>();
// products.add(product);
// products.add(product);
//
// // 一次插两条
// productMapper.insertProduct(products);
// logger.info(products.toString());
//
// // 一次插一条
// products = new LinkedList<>();
// product.setId(1);
// products.add(product);
// productMapper.insertProduct(products);
// logger.info(product.toString());
// }
//
// @Test
// public void updateTest(){
// ProductPo product = new ProductPo();
// product.setGmtModified(LocalDateTime.now());
// product.setGoodsId(1);
// product.setSpecifications("this is a update test");
// product.setId(1);
// productMapper.updateProduct(product);
// logger.info(product.toString());
// }
//
// @Test
// public void getTest(){
// //根据id查product
// List<ProductPo> products = productMapper.listProductsByGoodsId("id", 1);
// logger.info(products.toString());
//
// //根据商品id查products
// products = productMapper.listProductsByGoodsId("goods_id", 1);
// logger.info(products.toString());
// }
// @Test
// public void deleteTest(){
// // 批量删除,一次删一条
// List<Integer> ids = new LinkedList<>();
// ids.add(1);
// productMapper.deleteProductById(ids);
// logger.info("delete 1");
// }
//}
| 2,690 | 0.612481 | 0.605162 | 82 | 29.658537 | 20.556417 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.573171 | false | false | 8 |
3a0cb978f3ecfbd2d902dc7a9102c9679d75e696 | 1,623,497,683,907 | f382e144890cad83aabb43a25f9b998a9bf2310d | /IOTData/src/main/java/com/iot/model/ImgData.java | 5325f5d850ebb3b5d9e096f798f6cf6b932d171c | []
| no_license | zhoukuansky/IOTData | https://github.com/zhoukuansky/IOTData | 20fd694985548503599eb6b862fea2d7a1884341 | b7241cc0232f4228b5eff8c1fc9e06afec7cbb11 | refs/heads/master | 2022-08-27T14:53:08.890000 | 2022-08-13T18:18:47 | 2022-08-13T18:18:47 | 245,964,846 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iot.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class ImgData {
private Integer id;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer sensorId;
private String img;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public Date getCreateTime() {
return createTime;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public Date getUpdateTime() {
return updateTime;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getSensorId() {
return sensorId;
}
public void setSensorId(Integer sensorId) {
this.sensorId = sensorId;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
} | UTF-8 | Java | 1,401 | java | ImgData.java | Java | []
| null | []
| package com.iot.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class ImgData {
private Integer id;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer sensorId;
private String img;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public Date getCreateTime() {
return createTime;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public Date getUpdateTime() {
return updateTime;
}
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getSensorId() {
return sensorId;
}
public void setSensorId(Integer sensorId) {
this.sensorId = sensorId;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
} | 1,401 | 0.618844 | 0.614561 | 61 | 21.983606 | 21.303806 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.393443 | false | false | 8 |
a8d44e5d25ec6c084253d3b2dd6bc4eb1d20829e | 23,398,981,841,507 | 6b12fff8e4747a4fad782e7b4e7060fcd7b8782d | /common/src/eu/portavita/coverage/SingleFileCoverage.java | 01c90002e916edd55065cd123e96edc34f235849 | []
| no_license | jasperavisser/php_code_coverage | https://github.com/jasperavisser/php_code_coverage | 53a8d512b1a3b528284d883c1e47d8df94f3390a | 2a6cf9de0d339d768c8399187d854e534a22c6b7 | refs/heads/master | 2016-05-29T11:52:22.800000 | 2013-01-19T19:25:36 | 2013-01-19T19:25:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eu.portavita.coverage;
import java.util.Map.Entry;
import java.util.TreeMap;
/**
* List of lines that are covered in a single file.
*/
@SuppressWarnings("serial")
public class SingleFileCoverage extends TreeMap<Integer, Boolean> {
/**
* Absorbs another coverage dump into this one, merging the results per line.
* If a line is covered in either dump, it is covered in the result.
*
* @param other Another coverage dump.
*/
public void absorb(SingleFileCoverage other) {
for (Entry<Integer, Boolean> entry : other.entrySet()) {
Integer lineNumber = entry.getKey();
Boolean oldValue = get(lineNumber);
if (oldValue == null || oldValue == false) {
put(lineNumber, entry.getValue());
}
}
}
@Override
public String toString() {
String result = "";
for (Entry<Integer, Boolean> entry : entrySet()) {
result += entry.getKey() + ": " + (entry.getValue() ? "yes" : "no") + "\n";
}
return result;
}
}
| UTF-8 | Java | 952 | java | SingleFileCoverage.java | Java | []
| null | []
| package eu.portavita.coverage;
import java.util.Map.Entry;
import java.util.TreeMap;
/**
* List of lines that are covered in a single file.
*/
@SuppressWarnings("serial")
public class SingleFileCoverage extends TreeMap<Integer, Boolean> {
/**
* Absorbs another coverage dump into this one, merging the results per line.
* If a line is covered in either dump, it is covered in the result.
*
* @param other Another coverage dump.
*/
public void absorb(SingleFileCoverage other) {
for (Entry<Integer, Boolean> entry : other.entrySet()) {
Integer lineNumber = entry.getKey();
Boolean oldValue = get(lineNumber);
if (oldValue == null || oldValue == false) {
put(lineNumber, entry.getValue());
}
}
}
@Override
public String toString() {
String result = "";
for (Entry<Integer, Boolean> entry : entrySet()) {
result += entry.getKey() + ": " + (entry.getValue() ? "yes" : "no") + "\n";
}
return result;
}
}
| 952 | 0.669118 | 0.669118 | 36 | 25.444445 | 24.573523 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.638889 | false | false | 8 |
3321f50c5b3e009f911026a103f08549e68f2a10 | 1,992,864,872,301 | e78939180933a7459994062cb964cc0dc45d9842 | /repository/src/test/Pramid_Number.java | 34857d8e5c0cd66f76fa79afed77efede1182bcd | []
| no_license | sugmar25/eclipsconnect | https://github.com/sugmar25/eclipsconnect | c23107d106c40276f70470080953d6f85c9449b2 | 9a176ef13191210f6e876680dea64bec0cb51ba0 | refs/heads/master | 2023-02-04T09:14:56.177000 | 2020-12-19T02:33:36 | 2020-12-19T02:33:36 | 258,342,733 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
public class Pramid_Number {
public static void main( String[] args )
{
int input =17;
int num=1;
for(int i=1;i<input;i++) {
for(int j=0;j<i;j++) {
System.out.print(num+" ");
if(num==input)
break;
num=num+1;
}
System.out.println();
if(num==input)
break;
}
}
}
| UTF-8 | Java | 393 | java | Pramid_Number.java | Java | []
| null | []
| package test;
public class Pramid_Number {
public static void main( String[] args )
{
int input =17;
int num=1;
for(int i=1;i<input;i++) {
for(int j=0;j<i;j++) {
System.out.print(num+" ");
if(num==input)
break;
num=num+1;
}
System.out.println();
if(num==input)
break;
}
}
}
| 393 | 0.450382 | 0.435115 | 23 | 16 | 10.882774 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.173913 | false | false | 8 |
4bf971334b617037aa6bf4aa3b387db6c6c2db4e | 5,437,428,632,079 | 4399e6d029d2a9b91931bbe2c1fef887fcde2d44 | /LanPlaylistServer/src/main/java/net/kokkeli/resources/models/ViewModel.java | 35f554449b37349111592e712aeb343e9d11e545 | []
| no_license | Hekku2/k-lan-playlist-server | https://github.com/Hekku2/k-lan-playlist-server | 0aa14c1027f17d82e711f98f22d17ff4c6db533c | b213e19d9db5a85208ae7226ef6a15e27db5000f | refs/heads/master | 2021-01-17T14:42:22.103000 | 2015-03-04T17:23:30 | 2015-03-04T17:23:30 | 6,462,695 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.kokkeli.resources.models;
/**
* Abstract parent for all view models.
* @author Hekku2
*
*/
public abstract class ViewModel {
}
| UTF-8 | Java | 153 | java | ViewModel.java | Java | [
{
"context": "* Abstract parent for all view models.\r\n * @author Hekku2\r\n *\r\n */\r\npublic abstract class ViewModel {\r\n}\r\n",
"end": 104,
"score": 0.9996268153190613,
"start": 98,
"tag": "USERNAME",
"value": "Hekku2"
}
]
| null | []
| package net.kokkeli.resources.models;
/**
* Abstract parent for all view models.
* @author Hekku2
*
*/
public abstract class ViewModel {
}
| 153 | 0.666667 | 0.660131 | 9 | 15 | 15.867507 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false | 8 |
7fe2f512835d59a575a29a6389f443b3d825731e | 22,393,959,517,950 | e12ffed967b5f66a059a59e664d542c1deafb8bd | /src/TapeEquilibrium/Soultion.java | f70e41d1c46f9bfc9a62860a31d015da6f3aef2e | []
| no_license | ygddabong/CodilityCodingTest | https://github.com/ygddabong/CodilityCodingTest | 362667eb7d2f88d38ac637acf51d8efbdfbe58e5 | c870dd29f6701bf785a9843245dbdd6f3a574f72 | refs/heads/master | 2022-11-15T13:58:57.289000 | 2020-07-16T09:03:07 | 2020-07-16T09:03:07 | 280,094,656 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package TapeEquilibrium;
class Solution {
public int solution(int[] A) {
int sum_top = 0;
int sum_bottom = 0;
int integerMax = Integer.MAX_VALUE;
for (int i = 0; i < A.length; i++) {
sum_bottom += A[i];
}
for (int p = 1; p < A.length; p++) {
sum_top += A[p - 1];
sum_bottom -= A[p - 1];
int diff = Math.abs(sum_top - sum_bottom);
if (diff < integerMax) {
integerMax = diff;
}
}
return integerMax;
}
} | UTF-8 | Java | 443 | java | Soultion.java | Java | []
| null | []
| package TapeEquilibrium;
class Solution {
public int solution(int[] A) {
int sum_top = 0;
int sum_bottom = 0;
int integerMax = Integer.MAX_VALUE;
for (int i = 0; i < A.length; i++) {
sum_bottom += A[i];
}
for (int p = 1; p < A.length; p++) {
sum_top += A[p - 1];
sum_bottom -= A[p - 1];
int diff = Math.abs(sum_top - sum_bottom);
if (diff < integerMax) {
integerMax = diff;
}
}
return integerMax;
}
} | 443 | 0.559819 | 0.546275 | 23 | 18.304348 | 13.948461 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.347826 | false | false | 8 |
fe001784ebc9b8a0eabfb3e387d4e3bb50b6b003 | 15,814,069,627,345 | 5212b70653244de2738c4bce2db888a23085688b | /src/Client.java | c727d3b1c8c9730cfc097d7f4c16a15b3a83baec | []
| no_license | Mvishnu9/DistributedTicTacToe | https://github.com/Mvishnu9/DistributedTicTacToe | f5c9e9960e87261754dafc731750c819ac3900c7 | fb7ff20cfbfb12a9fe462d207afbc12c6f322ca4 | refs/heads/master | 2020-03-27T11:09:11.067000 | 2018-09-02T15:24:10 | 2018-09-02T15:24:10 | 146,468,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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.
*/
import java.io.*;
import java.net.MalformedURLException;
import java.rmi.*;
import java.util.*;
import java.net.*;
/**
*
* @author vishnum
*/
public class Client
{
RMI_interface board;
Scanner sc;
String id;
private Socket socket = null;
private DataInputStream dis = null;
private InetAddress ip = null;
int gamestate = 0;
int player = 0;
public Client(String address, int port) throws NotBoundException, MalformedURLException, RemoteException
{
try
{
ip = InetAddress.getByName("localhost");
socket = new Socket();
socket.connect(new InetSocketAddress(address, port), 1000);
dis = new DataInputStream(socket.getInputStream());
id = dis.readUTF();
String pl = dis.readUTF();
player = Integer.valueOf(pl);
board = (RMI_interface)Naming.lookup(id);
sc = new Scanner(System.in);
}
catch(SocketTimeoutException ste)
{
System.out.println("Connection timed out, please verify if the Server is running at the given ip and port");
return;
}
catch(IOException i)
{
System.out.println(i);
}
}
public void StartGame() throws RemoteException, IOException
{
System.out.println("Please wait. Searching for players.");
String starter = dis.readUTF();
if(starter.equalsIgnoreCase("start"));
{
boolean flag = false;
int move;
gamestate = 0;
while(gamestate == 0)
{
System.out.println(board.getBoard());
if(board.getPlayer() != player)
{
System.out.println("Please wait for opponent's turn");
while(board.getPlayer() != player)
{
}
}
boolean valid = false;
gamestate = board.GameOver();
if(gamestate!=0)
break;
long start = System.currentTimeMillis();
long end = start + 10*1000;
while(!valid && (System.currentTimeMillis() < end))
{
System.out.println(board.getBoard());
move = -1;
while(move>9 || move<0 && (System.currentTimeMillis() < end))
{
gamestate = board.GameOver();
if(gamestate!=0)
{
break;
}
System.out.printf("Player %d - Please select a square where you want to place your token - %c \n", player, (player==0)?'x':'o');
move = sc.nextInt();
}
if(flag)
break;
valid = board.Move(player, move);
if(!valid)
{
System.out.println("Invalid Move ");
}
}
if(flag)
break;
if(System.currentTimeMillis() > end)
{
board.SetLoss(player);
}
gamestate = board.GameOver();
}
System.out.println(board.getBoard());
if(gamestate == 3)
{
System.out.println("Game was a draw");
}
else
{
System.out.printf("Game over, Winner is Player %d having the token %c \n", gamestate-1,((gamestate-1)==0)?'x':'o');
}
}
}
public static void main(String[] args)
{
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter IP Address of server to connect to -");
String ip = "";
try
{
ip = reader.readLine();
}
catch(IOException i)
{
System.out.println(i);
}
String port = "";
int portno = 5000;
System.out.println("Enter port of server to connect to -");
try
{
port = reader.readLine();
portno = Integer.parseInt(port);
}
catch(IOException i)
{
System.out.println(i);
}
try
{
Client cl = new Client(ip, portno);
cl.StartGame();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
| UTF-8 | Java | 4,913 | java | Client.java | Java | [
{
"context": " java.util.*;\nimport java.net.*;\n/**\n *\n * @author vishnum\n */\npublic class Client \n{\n \n RMI_interface",
"end": 326,
"score": 0.9991044402122498,
"start": 319,
"tag": "USERNAME",
"value": "vishnum"
}
]
| null | []
| /*
* 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.
*/
import java.io.*;
import java.net.MalformedURLException;
import java.rmi.*;
import java.util.*;
import java.net.*;
/**
*
* @author vishnum
*/
public class Client
{
RMI_interface board;
Scanner sc;
String id;
private Socket socket = null;
private DataInputStream dis = null;
private InetAddress ip = null;
int gamestate = 0;
int player = 0;
public Client(String address, int port) throws NotBoundException, MalformedURLException, RemoteException
{
try
{
ip = InetAddress.getByName("localhost");
socket = new Socket();
socket.connect(new InetSocketAddress(address, port), 1000);
dis = new DataInputStream(socket.getInputStream());
id = dis.readUTF();
String pl = dis.readUTF();
player = Integer.valueOf(pl);
board = (RMI_interface)Naming.lookup(id);
sc = new Scanner(System.in);
}
catch(SocketTimeoutException ste)
{
System.out.println("Connection timed out, please verify if the Server is running at the given ip and port");
return;
}
catch(IOException i)
{
System.out.println(i);
}
}
public void StartGame() throws RemoteException, IOException
{
System.out.println("Please wait. Searching for players.");
String starter = dis.readUTF();
if(starter.equalsIgnoreCase("start"));
{
boolean flag = false;
int move;
gamestate = 0;
while(gamestate == 0)
{
System.out.println(board.getBoard());
if(board.getPlayer() != player)
{
System.out.println("Please wait for opponent's turn");
while(board.getPlayer() != player)
{
}
}
boolean valid = false;
gamestate = board.GameOver();
if(gamestate!=0)
break;
long start = System.currentTimeMillis();
long end = start + 10*1000;
while(!valid && (System.currentTimeMillis() < end))
{
System.out.println(board.getBoard());
move = -1;
while(move>9 || move<0 && (System.currentTimeMillis() < end))
{
gamestate = board.GameOver();
if(gamestate!=0)
{
break;
}
System.out.printf("Player %d - Please select a square where you want to place your token - %c \n", player, (player==0)?'x':'o');
move = sc.nextInt();
}
if(flag)
break;
valid = board.Move(player, move);
if(!valid)
{
System.out.println("Invalid Move ");
}
}
if(flag)
break;
if(System.currentTimeMillis() > end)
{
board.SetLoss(player);
}
gamestate = board.GameOver();
}
System.out.println(board.getBoard());
if(gamestate == 3)
{
System.out.println("Game was a draw");
}
else
{
System.out.printf("Game over, Winner is Player %d having the token %c \n", gamestate-1,((gamestate-1)==0)?'x':'o');
}
}
}
public static void main(String[] args)
{
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter IP Address of server to connect to -");
String ip = "";
try
{
ip = reader.readLine();
}
catch(IOException i)
{
System.out.println(i);
}
String port = "";
int portno = 5000;
System.out.println("Enter port of server to connect to -");
try
{
port = reader.readLine();
portno = Integer.parseInt(port);
}
catch(IOException i)
{
System.out.println(i);
}
try
{
Client cl = new Client(ip, portno);
cl.StartGame();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
| 4,913 | 0.460615 | 0.454916 | 164 | 28.957317 | 24.964451 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52439 | false | false | 8 |
ef86dc6cf1e7f4e12ea73ab00d66fe52118e5b7e | 18,537,078,891,746 | fe13621c0b8ea72a00834fe8b981246c6823d1e6 | /src/main/java/com/generactive/service/util/HierarchyValidator.java | 1d7b0ee0d8a4c7a6dae8834f498ad97a89fdaf24 | []
| no_license | GevorgBagratunyan/Generactive-Servlets | https://github.com/GevorgBagratunyan/Generactive-Servlets | f2a61d9c587f3e78201b98f2d54ee797188043d7 | d82a9774ec0ddfca7901361117f90b92e006d060 | refs/heads/master | 2023-08-24T16:43:27.179000 | 2021-10-12T14:44:56 | 2021-10-12T14:44:56 | 399,614,493 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.generactive.service.util;
import com.generactive.model.Group;
import com.generactive.repository.GroupRepository;
import org.springframework.stereotype.Component;
import java.util.NoSuchElementException;
@Component
public class HierarchyValidator {
private static GroupRepository repository;
public HierarchyValidator(GroupRepository repository) {
this.repository = repository;
}
public static boolean isValid(Group group, Long parentIdToSet) {
if(group.getSubGroups().isEmpty()) {
return true;
}
Integer parentLvlToSet = 0;
getLvl(parentIdToSet, parentLvlToSet);
Integer currentParentLvl = 0;
getLvl(group.getParent().getId(), currentParentLvl);
if(parentLvlToSet==currentParentLvl) {
return true;
} else return false;
}
private static void getLvl(Long id, Integer lvl) {
Group group = repository.findById(id)
.orElseThrow(NoSuchElementException::new);
if(group.getParent()!=null){
lvl++;
Long parentId = group.getParent().getId();
getLvl(parentId, lvl);
}
}
}
| UTF-8 | Java | 1,187 | java | HierarchyValidator.java | Java | []
| null | []
| package com.generactive.service.util;
import com.generactive.model.Group;
import com.generactive.repository.GroupRepository;
import org.springframework.stereotype.Component;
import java.util.NoSuchElementException;
@Component
public class HierarchyValidator {
private static GroupRepository repository;
public HierarchyValidator(GroupRepository repository) {
this.repository = repository;
}
public static boolean isValid(Group group, Long parentIdToSet) {
if(group.getSubGroups().isEmpty()) {
return true;
}
Integer parentLvlToSet = 0;
getLvl(parentIdToSet, parentLvlToSet);
Integer currentParentLvl = 0;
getLvl(group.getParent().getId(), currentParentLvl);
if(parentLvlToSet==currentParentLvl) {
return true;
} else return false;
}
private static void getLvl(Long id, Integer lvl) {
Group group = repository.findById(id)
.orElseThrow(NoSuchElementException::new);
if(group.getParent()!=null){
lvl++;
Long parentId = group.getParent().getId();
getLvl(parentId, lvl);
}
}
}
| 1,187 | 0.654591 | 0.652906 | 44 | 25.977272 | 21.72921 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.522727 | false | false | 8 |
0b8f92030dbce3440dd0452aeb5b365f7b394122 | 644,245,123,233 | 8d7b8e5a6a238ad09cd25983428fa9e66f6ed3dd | /src/com/rackspacecloud/android/TabViewActivity.java | 6f7e24f661303cf37c22fa9cf47b7688d8499c40 | [
"MIT"
]
| permissive | joejulian/android-rackspacecloud | https://github.com/joejulian/android-rackspacecloud | 5d66ddaa6c83d069bc31d3340467786fbb1e2fd7 | 345b235bd554ffbd9299f7e76faae15085378ee8 | refs/heads/master | 2016-09-05T16:38:07.255000 | 2012-11-14T22:14:57 | 2012-11-14T22:14:57 | 6,699,705 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.rackspacecloud.android;
import java.util.Calendar;
import android.app.Dialog;
import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TabHost;
import android.widget.Toast;
import com.rackspace.cloud.android.R;
/**
* @author Mike Mayo - mike.mayo@rackspace.com - twitter.com/greenisus
*
*/
public class TabViewActivity extends TabActivity {
protected AndroidCloudApplication app;
private final int PASSWORD_PROMPT = 123;
private boolean loggedIn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabs = getTabHost();
TabHost.TabSpec spec = tabs.newTabSpec("tab1");
spec.setContent(new Intent(this, ListServersActivity.class));
spec.setIndicator("Cloud Servers", getResources().getDrawable(R.drawable.cloudservers_icon));
tabs.addTab(spec);
spec = tabs.newTabSpec("tab2");
spec.setContent(new Intent(this, ListContainerActivity.class));
spec.setIndicator("Cloud Files", getResources().getDrawable(R.drawable.cloudfiles));
tabs.addTab(spec);
spec = tabs.newTabSpec("tab3");
spec.setContent(new Intent(this, ListLoadBalancersActivity.class));
spec.setIndicator("Load Balancers", getResources().getDrawable(R.drawable.load_balancers_icon));
tabs.addTab(spec);
}
@Override
protected void onPause(){
super.onPause();
Calendar cal = Calendar.getInstance();
AndroidCloudApplication.lastPause = cal.getTimeInMillis();
}
@Override
protected void onResume(){
super.onResume();
Calendar cal = Calendar.getInstance();
long curTime = cal.getTimeInMillis();
if(curTime - AndroidCloudApplication.lastPause > 5000){
verifyPassword();
}
}
/*
* if the application is password protected,
* the user must provide the password before
* gaining access
*/
private void verifyPassword(){
PasswordManager pwManager = new PasswordManager(getSharedPreferences(
Preferences.SHARED_PREFERENCES_NAME, MODE_PRIVATE));
if(pwManager.hasPassword() && !loggedIn){
createCustomDialog(PASSWORD_PROMPT);
}
}
private boolean rightPassword(String password){
PasswordManager pwManager = new PasswordManager(getSharedPreferences(
Preferences.SHARED_PREFERENCES_NAME, MODE_PRIVATE));
return pwManager.verifyEnteredPassword(password);
}
/*
* forces the user to enter a correct password
* before they gain access to application data
*/
private void createCustomDialog(int id) {
final Dialog dialog = new Dialog(TabViewActivity.this);
switch (id) {
case PASSWORD_PROMPT:
dialog.setContentView(R.layout.passworddialog);
dialog.setTitle("Enter your password:");
dialog.setCancelable(false);
Button button = (Button) dialog.findViewById(R.id.submit_password);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v){
EditText passwordText = ((EditText)dialog.findViewById(R.id.submit_password_text));
if(!rightPassword(passwordText.getText().toString())){
passwordText.setText("");
showToast("Password was incorrect.");
loggedIn = false;
}
else{
dialog.dismiss();
loggedIn = true;
}
}
});
dialog.show();
}
}
protected void showToast(String message) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, message, duration);
toast.show();
}
}
| UTF-8 | Java | 3,614 | java | TabViewActivity.java | Java | [
{
"context": "ort com.rackspace.cloud.android.R;\n\n/**\n * @author Mike Mayo - mike.mayo@rackspace.com - twitter.com/greenisus",
"end": 479,
"score": 0.9998703598976135,
"start": 470,
"tag": "NAME",
"value": "Mike Mayo"
},
{
"context": "space.cloud.android.R;\n\n/**\n * @author Mike Mayo - mike.mayo@rackspace.com - twitter.com/greenisus\n *\n */\npublic class TabVi",
"end": 505,
"score": 0.9999308586120605,
"start": 482,
"tag": "EMAIL",
"value": "mike.mayo@rackspace.com"
},
{
"context": "Mike Mayo - mike.mayo@rackspace.com - twitter.com/greenisus\n *\n */\npublic class TabViewActivity extends TabAc",
"end": 529,
"score": 0.9977298378944397,
"start": 520,
"tag": "USERNAME",
"value": "greenisus"
},
{
"context": "ication app;\n\tprivate final int PASSWORD_PROMPT = 123;\n\tprivate boolean loggedIn;\n\t\n\t@Override\n\tpublic ",
"end": 669,
"score": 0.8484821915626526,
"start": 666,
"tag": "PASSWORD",
"value": "123"
}
]
| null | []
| /**
*
*/
package com.rackspacecloud.android;
import java.util.Calendar;
import android.app.Dialog;
import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TabHost;
import android.widget.Toast;
import com.rackspace.cloud.android.R;
/**
* @author <NAME> - <EMAIL> - twitter.com/greenisus
*
*/
public class TabViewActivity extends TabActivity {
protected AndroidCloudApplication app;
private final int PASSWORD_PROMPT = 123;
private boolean loggedIn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabs = getTabHost();
TabHost.TabSpec spec = tabs.newTabSpec("tab1");
spec.setContent(new Intent(this, ListServersActivity.class));
spec.setIndicator("Cloud Servers", getResources().getDrawable(R.drawable.cloudservers_icon));
tabs.addTab(spec);
spec = tabs.newTabSpec("tab2");
spec.setContent(new Intent(this, ListContainerActivity.class));
spec.setIndicator("Cloud Files", getResources().getDrawable(R.drawable.cloudfiles));
tabs.addTab(spec);
spec = tabs.newTabSpec("tab3");
spec.setContent(new Intent(this, ListLoadBalancersActivity.class));
spec.setIndicator("Load Balancers", getResources().getDrawable(R.drawable.load_balancers_icon));
tabs.addTab(spec);
}
@Override
protected void onPause(){
super.onPause();
Calendar cal = Calendar.getInstance();
AndroidCloudApplication.lastPause = cal.getTimeInMillis();
}
@Override
protected void onResume(){
super.onResume();
Calendar cal = Calendar.getInstance();
long curTime = cal.getTimeInMillis();
if(curTime - AndroidCloudApplication.lastPause > 5000){
verifyPassword();
}
}
/*
* if the application is password protected,
* the user must provide the password before
* gaining access
*/
private void verifyPassword(){
PasswordManager pwManager = new PasswordManager(getSharedPreferences(
Preferences.SHARED_PREFERENCES_NAME, MODE_PRIVATE));
if(pwManager.hasPassword() && !loggedIn){
createCustomDialog(PASSWORD_PROMPT);
}
}
private boolean rightPassword(String password){
PasswordManager pwManager = new PasswordManager(getSharedPreferences(
Preferences.SHARED_PREFERENCES_NAME, MODE_PRIVATE));
return pwManager.verifyEnteredPassword(password);
}
/*
* forces the user to enter a correct password
* before they gain access to application data
*/
private void createCustomDialog(int id) {
final Dialog dialog = new Dialog(TabViewActivity.this);
switch (id) {
case PASSWORD_PROMPT:
dialog.setContentView(R.layout.passworddialog);
dialog.setTitle("Enter your password:");
dialog.setCancelable(false);
Button button = (Button) dialog.findViewById(R.id.submit_password);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v){
EditText passwordText = ((EditText)dialog.findViewById(R.id.submit_password_text));
if(!rightPassword(passwordText.getText().toString())){
passwordText.setText("");
showToast("Password was incorrect.");
loggedIn = false;
}
else{
dialog.dismiss();
loggedIn = true;
}
}
});
dialog.show();
}
}
protected void showToast(String message) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, message, duration);
toast.show();
}
}
| 3,595 | 0.734643 | 0.731876 | 129 | 27.015503 | 23.879538 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.193799 | false | false | 8 |
eda03ebc7cec23200b92e48b8f4d2204b63199ae | 25,666,724,602,477 | baed98c2e5945910c52a2d16304046b509eb8ed8 | /Breakout.java | 798c358ffd616503c2f0d226e84f436b0938af20 | []
| no_license | Sensiunk/BreakoutStarterLatest1 | https://github.com/Sensiunk/BreakoutStarterLatest1 | 5438368c52308f8a1847ca4b7278203890a3c4f9 | 2d537bffc79a493ca856012861595560cbad6ba6 | refs/heads/master | 2022-11-05T13:17:15.194000 | 2020-06-14T03:48:38 | 2020-06-14T03:48:38 | 271,940,954 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package breakoutstarter;
import Engine.Game;
import Engine.GameController;
import Engine.Sprite;
import java.util.Random;
import java.util.ArrayList;
// The entry point for the breakout game. Implements game controller so we can get
// notified after each frame is drawn.
public class Breakout implements GameController {
// The width of the window.
public static int windowWidth = 512;
// The height of the window.
public static int windowHeight = 512;
// The game object that controls the running of the game.
public Game game;
// The ball sprite.
public Ball ball;
public Paddle paddle;
public DeathBar deathBar;
public Score score;
public Lives lives;
public Levels level;
public PowerUp power = new PowerUp(0,0);
// Starts the game.
public void Start() {
// Create the ball sprite and add it to the games sprites.
ball = new Ball();
game.addSprite(ball);
paddle = new Paddle();
game.addSprite(paddle);
createBlocks();
deathBar = new DeathBar();
game.addSprite(deathBar);
score = new Score(0);
game.addSprite(score);
lives = new Lives(3);
game.addSprite(lives);
level = new Levels();
game.addSprite(level);
// Run the main game loop
game.runGameLoop();
}
public void createBlocks() {
for (int x = 10; x < windowWidth; x += 73) {
for (int y = 30; y < windowHeight / 5; y += 30) {
game.addSprite(new Block(x, y, 60, 20));
}
}
}
// Run each frame after the sprites have been updated.
public void UpdateOccurred() {
if (lives.livesVal > 0) {
// Nothing needed here. You will need to add logic to check the state of the
// game here.
Sprite collidedSprite = game.checkCollision(ball);
Sprite collidedPower = game.checkCollision(power);
if (collidedSprite != null) {
if (collidedSprite.getClass() == Paddle.class) {
float midBall = ball.xPos + ball.width / 2;
float midPaddle = paddle.xPos + paddle.width / 2;
if (midBall > midPaddle - 10 && midBall < midPaddle + 10) {
ball.dx = 0;
}
else if (midBall < midPaddle) {
ball.dx = -1 * Math.abs(ball.dy);
}
else {
ball.dx = Math.abs(ball.dy);
}
ball.dy = -1 * ball.dy;
}
// if (game.checkCollision(power,paddle).getClass() == Paddle.class) {
// ball.increaseSpeed();
// }
if (collidedSprite.getClass() == Block.class) {
for (Sprite block : game.getSprites()) {
if (collidedSprite.equals(block)) {
int counter = (int) (Math.random() * 5 +1);
if (block.getYPos() == 30) {
score.changeScore(5);
} else if (block.getYPos() == 60) {
score.changeScore(3);
} else if (block.getYPos() == 90) {
score.changeScore(1);
}
float midBall = block.xPos + block.width / 2;
float midBlock = block.xPos + block.width / 2;
if (midBall > midBlock - 10 && midBall < midBlock + 10) {
ball.dx = 0;
}
else if (midBall < midBlock) {
ball.dx = -1 * Math.abs(ball.dy);
}
else {
ball.dx = Math.abs(ball.dy);
}
ball.dy = -1 * ball.dy;
if (counter == 3) {
power.setXPos((int)block.getXPos());
power.setYPos((int)block.getYPos());
game.addSprite(power);
}
game.removeSprite(block);
game.addBlock(block);
if (!game.doBlocksExist()) {
if(level.getLevel() < 2) {
level.changeLevels(1);
game.resetLevel();
} else {
ball.resetPosition();
paddle.resetPosition();
return;
}
}
}
}
}
if (collidedSprite.getClass() == DeathBar.class) {
ball.resetPosition();
lives.changeLives(1);
}
}
} else if (lives.livesVal <= 0) {
ball.resetPosition();
paddle.resetPosition();
return;
}
}
}
| UTF-8 | Java | 4,064 | java | Breakout.java | Java | []
| null | []
| package breakoutstarter;
import Engine.Game;
import Engine.GameController;
import Engine.Sprite;
import java.util.Random;
import java.util.ArrayList;
// The entry point for the breakout game. Implements game controller so we can get
// notified after each frame is drawn.
public class Breakout implements GameController {
// The width of the window.
public static int windowWidth = 512;
// The height of the window.
public static int windowHeight = 512;
// The game object that controls the running of the game.
public Game game;
// The ball sprite.
public Ball ball;
public Paddle paddle;
public DeathBar deathBar;
public Score score;
public Lives lives;
public Levels level;
public PowerUp power = new PowerUp(0,0);
// Starts the game.
public void Start() {
// Create the ball sprite and add it to the games sprites.
ball = new Ball();
game.addSprite(ball);
paddle = new Paddle();
game.addSprite(paddle);
createBlocks();
deathBar = new DeathBar();
game.addSprite(deathBar);
score = new Score(0);
game.addSprite(score);
lives = new Lives(3);
game.addSprite(lives);
level = new Levels();
game.addSprite(level);
// Run the main game loop
game.runGameLoop();
}
public void createBlocks() {
for (int x = 10; x < windowWidth; x += 73) {
for (int y = 30; y < windowHeight / 5; y += 30) {
game.addSprite(new Block(x, y, 60, 20));
}
}
}
// Run each frame after the sprites have been updated.
public void UpdateOccurred() {
if (lives.livesVal > 0) {
// Nothing needed here. You will need to add logic to check the state of the
// game here.
Sprite collidedSprite = game.checkCollision(ball);
Sprite collidedPower = game.checkCollision(power);
if (collidedSprite != null) {
if (collidedSprite.getClass() == Paddle.class) {
float midBall = ball.xPos + ball.width / 2;
float midPaddle = paddle.xPos + paddle.width / 2;
if (midBall > midPaddle - 10 && midBall < midPaddle + 10) {
ball.dx = 0;
}
else if (midBall < midPaddle) {
ball.dx = -1 * Math.abs(ball.dy);
}
else {
ball.dx = Math.abs(ball.dy);
}
ball.dy = -1 * ball.dy;
}
// if (game.checkCollision(power,paddle).getClass() == Paddle.class) {
// ball.increaseSpeed();
// }
if (collidedSprite.getClass() == Block.class) {
for (Sprite block : game.getSprites()) {
if (collidedSprite.equals(block)) {
int counter = (int) (Math.random() * 5 +1);
if (block.getYPos() == 30) {
score.changeScore(5);
} else if (block.getYPos() == 60) {
score.changeScore(3);
} else if (block.getYPos() == 90) {
score.changeScore(1);
}
float midBall = block.xPos + block.width / 2;
float midBlock = block.xPos + block.width / 2;
if (midBall > midBlock - 10 && midBall < midBlock + 10) {
ball.dx = 0;
}
else if (midBall < midBlock) {
ball.dx = -1 * Math.abs(ball.dy);
}
else {
ball.dx = Math.abs(ball.dy);
}
ball.dy = -1 * ball.dy;
if (counter == 3) {
power.setXPos((int)block.getXPos());
power.setYPos((int)block.getYPos());
game.addSprite(power);
}
game.removeSprite(block);
game.addBlock(block);
if (!game.doBlocksExist()) {
if(level.getLevel() < 2) {
level.changeLevels(1);
game.resetLevel();
} else {
ball.resetPosition();
paddle.resetPosition();
return;
}
}
}
}
}
if (collidedSprite.getClass() == DeathBar.class) {
ball.resetPosition();
lives.changeLives(1);
}
}
} else if (lives.livesVal <= 0) {
ball.resetPosition();
paddle.resetPosition();
return;
}
}
}
| 4,064 | 0.564222 | 0.549951 | 175 | 21.222857 | 19.009216 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.657143 | false | false | 8 |
460afb2f420a405062423537e2687e5d406d6356 | 27,831,388,126,104 | d9f521853ae745cf40dc9903a5ca84b276e6bbd3 | /wechat_manager/src/main/java/com/sinosoft/wx/pojo/InsuranceProductWrap.java | b63889df4771d280a2969d4915c4cd353af6d483 | []
| no_license | rainbowSixPlus/TestDemo | https://github.com/rainbowSixPlus/TestDemo | 57aafb37c1e6e882926bba6a467cb7216e4d75b5 | 869219b816b1f75e59ea68c415c7e22ce55bf533 | refs/heads/master | 2021-01-23T23:46:11.173000 | 2018-02-24T12:33:15 | 2018-02-24T12:33:15 | 122,734,932 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* 文件名:InsuranceProductWrap.java
*
* 版本日期:2017年5月26日
*
* Copyright 中科软科技股份有限公司
*
*/
package com.sinosoft.wx.pojo;
import com.github.pagehelper.PageInfo;
/**
*
* <p>项目名称:wechat_manager
* <p>类名称:InsuranceProductWrap.java
* <p>类描述:保险产品主表pojo包装类
* <p>备注信息:
* <p>创建人:limin
* <p>创建时间:2017-5-26 14:57:30
* <p>修改人:limin
* <p>修改时间:2017-5-26 14:57:34
* <p>修改备注:
*
*
*/
public class InsuranceProductWrap {
private InsuranceProduct insuranceProduct;
private PageInfo<InsuranceProduct> pageList ;
public InsuranceProduct getInsuranceProduct() {
return insuranceProduct;
}
public void setInsuranceProduct(InsuranceProduct insuranceProduct) {
this.insuranceProduct = insuranceProduct;
}
public PageInfo<InsuranceProduct> getPageList() {
return pageList;
}
public void setPageList(PageInfo<InsuranceProduct> pageList) {
this.pageList = pageList;
}
}
| UTF-8 | Java | 1,120 | java | InsuranceProductWrap.java | Java | [
{
"context": "\r\n * <p>类描述:保险产品主表pojo包装类\r\n * <p>备注信息:\r\n * <p>创建人:limin\r\n * <p>创建时间:2017-5-26 14:57:30\r\n * <p>修改人:limin\r\n",
"end": 306,
"score": 0.9963405728340149,
"start": 301,
"tag": "USERNAME",
"value": "limin"
},
{
"context": "人:limin\r\n * <p>创建时间:2017-5-26 14:57:30\r\n * <p>修改人:limin\r\n * <p>修改时间:2017-5-26 14:57:34\r\n * <p>修改备注:\r\n * \r",
"end": 354,
"score": 0.9984517693519592,
"start": 349,
"tag": "USERNAME",
"value": "limin"
}
]
| null | []
| /**
* 文件名:InsuranceProductWrap.java
*
* 版本日期:2017年5月26日
*
* Copyright 中科软科技股份有限公司
*
*/
package com.sinosoft.wx.pojo;
import com.github.pagehelper.PageInfo;
/**
*
* <p>项目名称:wechat_manager
* <p>类名称:InsuranceProductWrap.java
* <p>类描述:保险产品主表pojo包装类
* <p>备注信息:
* <p>创建人:limin
* <p>创建时间:2017-5-26 14:57:30
* <p>修改人:limin
* <p>修改时间:2017-5-26 14:57:34
* <p>修改备注:
*
*
*/
public class InsuranceProductWrap {
private InsuranceProduct insuranceProduct;
private PageInfo<InsuranceProduct> pageList ;
public InsuranceProduct getInsuranceProduct() {
return insuranceProduct;
}
public void setInsuranceProduct(InsuranceProduct insuranceProduct) {
this.insuranceProduct = insuranceProduct;
}
public PageInfo<InsuranceProduct> getPageList() {
return pageList;
}
public void setPageList(PageInfo<InsuranceProduct> pageList) {
this.pageList = pageList;
}
}
| 1,120 | 0.657787 | 0.623975 | 60 | 14.25 | 17.911472 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566667 | false | false | 8 |
dbead3a0fffc191c3c1c4b0f9b01d78aa45c9a58 | 8,856,222,570,117 | 18484c21eb0c9ba42cf33012a5d5455b9a463521 | /user/service/src/main/java/com/yryz/quanhu/user/service/OatuhWeixin.java | c6f64c935c8e0895045561d842ef98817a206e55 | []
| no_license | PurpleEyeEmilia/quanhu2.0-server | https://github.com/PurpleEyeEmilia/quanhu2.0-server | 0ec3a11a99107e86930449f3c85a14937f4a4daa | 4cbb7cfdafd2a8d083df097de456bf9dc35139c2 | HEAD | 2019-03-20T22:54:39.398000 | 2018-03-09T11:38:40 | 2018-03-09T11:38:40 | 124,056,372 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yryz.quanhu.user.service;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.yryz.common.constant.ExceptionEnum;
import com.yryz.common.exception.QuanhuException;
import com.yryz.common.utils.JsonUtils;
import com.yryz.quanhu.user.contants.RegType;
import com.yryz.quanhu.user.contants.ThirdConstants;
import com.yryz.quanhu.user.utils.HTTPWeb;
import com.yryz.quanhu.user.vo.ThirdUser;
import com.yryz.quanhu.user.vo.WxToken;
import com.yryz.quanhu.user.vo.WxUser;
/**
* 微信第三方登录校验<br/>
* 1.获取微信用户信息<br/>
* 2.获取微信web第三方登录认证地址<br/>
* 3.获取微信web第三方登录token
*
* @author danshiyu
* @version 2017-11-09
*/
public class OatuhWeixin {
private static final Logger logger = LoggerFactory.getLogger(OatuhWeixin.class);
/**
* 获取微信用户信息
*
* @param openId
* @param token
* @return
* @throws Exception
* @Description
*/
public static ThirdUser getUser(String openId, String token){
ThirdUser user = new ThirdUser();
String url = ThirdConstants.WX_GET_USER_URL;
Map<String, Object> map = new HashMap<>(2);
map.put("access_token", token);
map.put("openid", openId);
WxUser wxUser = null;
try {
String result = HTTPWeb.get(url, map);
logger.info("[weixin_getUser]-->params:{},result:{}",map.toString(),result);
if (result != null) {
wxUser = JsonUtils.fromJson(result, WxUser.class);
}
if (wxUser != null && wxUser.getErrcode() == 0) {
String name = null;
if (StringUtils.isBlank(wxUser.getNickname())) {
name = openId;
} else {
name = wxUser.getNickname();
}
user.setGender(String.valueOf(wxUser.getSex()));
user.setNickName(name);
user.setHeadImg(wxUser.getHeadimgurl());
user.setLocation("");
user.setThirdId(wxUser.getUnionid());
user.setToken(token);
}
} catch (Exception e) {
logger.info("[weixin_getUser]-->params:{},result:{}",map.toString(),e.getMessage());
logger.error("[oauth weix]", e);
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :" + e.getLocalizedMessage());
}
if (wxUser == null || wxUser.getErrcode() != 0) {
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :");
}
return user;
}
/**
* 得到微信请求code url
*
* @param returnUrl
* 第三方回调本地地址
* @param returnHost
* 己方web端host
* @return
* @Description
*/
public static String getQrUrl(String appKey,String returnUrl, String returnHost,String notifyUrl) {
String url = ThirdConstants.WX_OPEN_URL;
StringBuffer buffer = new StringBuffer();
buffer.append(url);
buffer.append("?appid=").append(appKey);
buffer.append("&redirect_uri=").append(returnHost).append(notifyUrl);
buffer.append("&response_type=code");
buffer.append("&scope=snsapi_login");
buffer.append("&state=").append(RegType.WEIXIN.getText());
buffer.append("_").append(returnUrl);
return buffer.toString();
}
/**
* 获取微信授权地址
* @param apiUrl
* @param returnUrl
* @param appId
* @param activityChannelCode
* @return
*/
public static String getWxOauthUrl(String wxOauthAppKey,String returnHost,String returnUrl,String activityChannelCode,String notifyUrl) {
String url = ThirdConstants.WX_OPEN_OAUTH_URL;
// state 过长 微信会报 长度超长
StringBuffer buffer = new StringBuffer();
buffer.append(url);
buffer.append("?appid=").append(wxOauthAppKey);
buffer.append("&redirect_uri=").append(returnHost).append(notifyUrl);
buffer.append("&response_type=code");
buffer.append("&scope=snsapi_userinfo");
buffer.append("&state=").append(RegType.WEIXIN_OAUTH.getText());
buffer.append("_").append(returnUrl);
buffer.append("_").append(activityChannelCode);
return buffer.toString();
}
/**
* 获取微信token
*
* @param code
* 用户授权后得到code
* @return
* @throws Exception
*/
public static WxToken getToken(String appKey,String appSecret,String code) {
String url = ThirdConstants.WX_GET_TOKEN_URL;
Map<String, Object> map = new HashMap<>(4);
map.put("appid", appKey);
map.put("secret", appSecret);
map.put("code", code);
map.put("grant_type", "authorization_code");
WxToken token = null;
try {
String result = HTTPWeb.get(url, map);
logger.info("[weixin_getToken]-->params:{},result:{}",map.toString(),result);
if (result != null) {
token = JsonUtils.fromJson(result, WxToken.class);
}
} catch (Exception e) {
logger.info("[weixin_getToken]-->params:{},result:{}",map.toString(),e.getMessage());
logger.error("[oauth weix]", e);
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :" + e.getLocalizedMessage());
}
if (token == null || token.getErrcode() != 0) {
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :");
}
return token;
}
}
| UTF-8 | Java | 5,266 | java | OatuhWeixin.java | Java | [
{
"context": "方登录认证地址<br/>\n * 3.获取微信web第三方登录token\n * \n * @author danshiyu\n * @version 2017-11-09\n */\npublic class OatuhWeix",
"end": 706,
"score": 0.9994263052940369,
"start": 698,
"tag": "USERNAME",
"value": "danshiyu"
}
]
| null | []
| package com.yryz.quanhu.user.service;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.yryz.common.constant.ExceptionEnum;
import com.yryz.common.exception.QuanhuException;
import com.yryz.common.utils.JsonUtils;
import com.yryz.quanhu.user.contants.RegType;
import com.yryz.quanhu.user.contants.ThirdConstants;
import com.yryz.quanhu.user.utils.HTTPWeb;
import com.yryz.quanhu.user.vo.ThirdUser;
import com.yryz.quanhu.user.vo.WxToken;
import com.yryz.quanhu.user.vo.WxUser;
/**
* 微信第三方登录校验<br/>
* 1.获取微信用户信息<br/>
* 2.获取微信web第三方登录认证地址<br/>
* 3.获取微信web第三方登录token
*
* @author danshiyu
* @version 2017-11-09
*/
public class OatuhWeixin {
private static final Logger logger = LoggerFactory.getLogger(OatuhWeixin.class);
/**
* 获取微信用户信息
*
* @param openId
* @param token
* @return
* @throws Exception
* @Description
*/
public static ThirdUser getUser(String openId, String token){
ThirdUser user = new ThirdUser();
String url = ThirdConstants.WX_GET_USER_URL;
Map<String, Object> map = new HashMap<>(2);
map.put("access_token", token);
map.put("openid", openId);
WxUser wxUser = null;
try {
String result = HTTPWeb.get(url, map);
logger.info("[weixin_getUser]-->params:{},result:{}",map.toString(),result);
if (result != null) {
wxUser = JsonUtils.fromJson(result, WxUser.class);
}
if (wxUser != null && wxUser.getErrcode() == 0) {
String name = null;
if (StringUtils.isBlank(wxUser.getNickname())) {
name = openId;
} else {
name = wxUser.getNickname();
}
user.setGender(String.valueOf(wxUser.getSex()));
user.setNickName(name);
user.setHeadImg(wxUser.getHeadimgurl());
user.setLocation("");
user.setThirdId(wxUser.getUnionid());
user.setToken(token);
}
} catch (Exception e) {
logger.info("[weixin_getUser]-->params:{},result:{}",map.toString(),e.getMessage());
logger.error("[oauth weix]", e);
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :" + e.getLocalizedMessage());
}
if (wxUser == null || wxUser.getErrcode() != 0) {
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :");
}
return user;
}
/**
* 得到微信请求code url
*
* @param returnUrl
* 第三方回调本地地址
* @param returnHost
* 己方web端host
* @return
* @Description
*/
public static String getQrUrl(String appKey,String returnUrl, String returnHost,String notifyUrl) {
String url = ThirdConstants.WX_OPEN_URL;
StringBuffer buffer = new StringBuffer();
buffer.append(url);
buffer.append("?appid=").append(appKey);
buffer.append("&redirect_uri=").append(returnHost).append(notifyUrl);
buffer.append("&response_type=code");
buffer.append("&scope=snsapi_login");
buffer.append("&state=").append(RegType.WEIXIN.getText());
buffer.append("_").append(returnUrl);
return buffer.toString();
}
/**
* 获取微信授权地址
* @param apiUrl
* @param returnUrl
* @param appId
* @param activityChannelCode
* @return
*/
public static String getWxOauthUrl(String wxOauthAppKey,String returnHost,String returnUrl,String activityChannelCode,String notifyUrl) {
String url = ThirdConstants.WX_OPEN_OAUTH_URL;
// state 过长 微信会报 长度超长
StringBuffer buffer = new StringBuffer();
buffer.append(url);
buffer.append("?appid=").append(wxOauthAppKey);
buffer.append("&redirect_uri=").append(returnHost).append(notifyUrl);
buffer.append("&response_type=code");
buffer.append("&scope=snsapi_userinfo");
buffer.append("&state=").append(RegType.WEIXIN_OAUTH.getText());
buffer.append("_").append(returnUrl);
buffer.append("_").append(activityChannelCode);
return buffer.toString();
}
/**
* 获取微信token
*
* @param code
* 用户授权后得到code
* @return
* @throws Exception
*/
public static WxToken getToken(String appKey,String appSecret,String code) {
String url = ThirdConstants.WX_GET_TOKEN_URL;
Map<String, Object> map = new HashMap<>(4);
map.put("appid", appKey);
map.put("secret", appSecret);
map.put("code", code);
map.put("grant_type", "authorization_code");
WxToken token = null;
try {
String result = HTTPWeb.get(url, map);
logger.info("[weixin_getToken]-->params:{},result:{}",map.toString(),result);
if (result != null) {
token = JsonUtils.fromJson(result, WxToken.class);
}
} catch (Exception e) {
logger.info("[weixin_getToken]-->params:{},result:{}",map.toString(),e.getMessage());
logger.error("[oauth weix]", e);
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :" + e.getLocalizedMessage());
}
if (token == null || token.getErrcode() != 0) {
throw new QuanhuException(ExceptionEnum.BusiException.getCode(), ExceptionEnum.BusiException.getShowMsg(), "AuthWeixin Error :");
}
return token;
}
}
| 5,266 | 0.692202 | 0.68846 | 170 | 28.870588 | 29.509235 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.211765 | false | false | 8 |
b4c3982ceb84ff7605a13524adcfe49db22acda0 | 2,654,289,838,593 | 3201b31249a31a61b047db6a6f898d205f5ceba7 | /Arrays/MinNumberOfSwaps2.java | 011f92be2b976e190c364f1664d05b2a849258e3 | []
| no_license | Stephen-mcdonagh/hackerrank | https://github.com/Stephen-mcdonagh/hackerrank | 15a03d81020524b334f146592930c71eb82ca83c | 3b1ae933a067cf8e0a440a7a8166823e29646132 | refs/heads/main | 2023-01-22T08:47:47.327000 | 2020-11-11T17:14:18 | 2020-11-11T17:14:18 | 311,285,236 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
public class MinNumberOfSwaps2 {
//ARRAY QUESTION 3 MINIMUM SWAPS
//Given an unordered array -> find minimum swaps for ascending order
static int minimumNumberOfSwaps(int [] unorderedArray){
int numSwaps = 0;
int size = unorderedArray.length -1;
for(int i =0; i < size; i++){
if(i < unorderedArray[i] -1){
swap(unorderedArray,i, Math.min(size,unorderedArray[i]-1));
numSwaps++;
i--;
}
}
return numSwaps;
}
private static void swap(int[] array, int i, int j) {
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
//Write some tests here
public static void main (String args[])
{
}
} | UTF-8 | Java | 780 | java | MinNumberOfSwaps2.java | Java | []
| null | []
| import java.util.*;
public class MinNumberOfSwaps2 {
//ARRAY QUESTION 3 MINIMUM SWAPS
//Given an unordered array -> find minimum swaps for ascending order
static int minimumNumberOfSwaps(int [] unorderedArray){
int numSwaps = 0;
int size = unorderedArray.length -1;
for(int i =0; i < size; i++){
if(i < unorderedArray[i] -1){
swap(unorderedArray,i, Math.min(size,unorderedArray[i]-1));
numSwaps++;
i--;
}
}
return numSwaps;
}
private static void swap(int[] array, int i, int j) {
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
//Write some tests here
public static void main (String args[])
{
}
} | 780 | 0.551282 | 0.542308 | 31 | 24.193548 | 21.303368 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.677419 | false | false | 8 |
12a643a8bf17b8bd2f3539adce9118d5143067ac | 670,014,963,189 | a0729c8fae8f05191dd8fa5cb9cf31060125a3f8 | /Jass/src/BusinessLayer/ClientComparator.java | 5cd9a3abd57d741bce9547aad471c2b5278102e5 | []
| no_license | Domi89/TerryAndAllen | https://github.com/Domi89/TerryAndAllen | 008de3859d3a4b840ce40e29dfee316895735bf6 | b89e00c29c89817bc2771350ac9b3e78da2ed90c | refs/heads/master | 2021-03-03T22:58:36.988000 | 2020-05-24T18:18:10 | 2020-05-24T18:18:10 | 245,991,719 | 1 | 1 | null | false | 2020-05-24T11:18:19 | 2020-03-09T09:20:07 | 2020-05-23T19:08:26 | 2020-05-24T11:18:18 | 1,938 | 0 | 1 | 0 | Java | false | false | package BusinessLayer;
import java.util.Comparator;
import serializedClasses.Card;
import serializedClasses.Client;
import serializedClasses.Suit;
public class ClientComparator implements Comparator<Client> {
public ClientComparator() {
}
public int compare(Client o1, Client o2) {
if(o1.getPointsSmall() > o2.getPointsSmall()) {
return 1;
}
if(o1.getPointsSmall() < o2.getPointsSmall()) {
return -1;
}
return 0;
}
}
| UTF-8 | Java | 450 | java | ClientComparator.java | Java | []
| null | []
| package BusinessLayer;
import java.util.Comparator;
import serializedClasses.Card;
import serializedClasses.Client;
import serializedClasses.Suit;
public class ClientComparator implements Comparator<Client> {
public ClientComparator() {
}
public int compare(Client o1, Client o2) {
if(o1.getPointsSmall() > o2.getPointsSmall()) {
return 1;
}
if(o1.getPointsSmall() < o2.getPointsSmall()) {
return -1;
}
return 0;
}
}
| 450 | 0.717778 | 0.697778 | 28 | 15.071428 | 18.277481 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.142857 | false | false | 8 |
a09c496b604bddb2477020499e3857d06e1703f6 | 30,270,929,562,293 | 86eb9c4f52e1d94408cf82463c35aa9ef92dde91 | /src/main/java/com/theuberlab/controllers/ApiController.java | 6977ce814676868a1bfa362c21f9928f26e95760 | []
| no_license | omadawn/aznparsticator | https://github.com/omadawn/aznparsticator | c25cec31035da66cd8e6a7e80c3dd4ee20882208 | 1ce43c57f4364c563c1b13c531d6806665a3a6e7 | refs/heads/master | 2020-02-26T16:06:38.379000 | 2016-10-15T22:04:35 | 2016-10-15T22:04:35 | 71,011,201 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.theuberlab.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author TheSporkboy
*/
@RestController
public class ApiController {
/**
* Answers requests for the root of the application.
*
* @return
*/
@RequestMapping(value = "/")
public String index() {
return "<!DOCTYPE HTML>" +
"<html>\n" +
" <head>\n" +
" <title>AZN Servers JSON Parsticator. The parser for servers.json</title>\n" +
" </head>\n" +
" <body>\n" +
" <p>AZN Servers JSON Parsticator. The parser for servers.json.</p>" +
" </body>\n" +
" </html>" +
"";
}
}
| UTF-8 | Java | 745 | java | ApiController.java | Java | [
{
"context": "eb.bind.annotation.RestController;\n\n/**\n * @Author TheSporkboy\n */\n@RestController\npublic class ApiController {\n",
"end": 190,
"score": 0.9996029138565063,
"start": 179,
"tag": "USERNAME",
"value": "TheSporkboy"
}
]
| null | []
| package com.theuberlab.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author TheSporkboy
*/
@RestController
public class ApiController {
/**
* Answers requests for the root of the application.
*
* @return
*/
@RequestMapping(value = "/")
public String index() {
return "<!DOCTYPE HTML>" +
"<html>\n" +
" <head>\n" +
" <title>AZN Servers JSON Parsticator. The parser for servers.json</title>\n" +
" </head>\n" +
" <body>\n" +
" <p>AZN Servers JSON Parsticator. The parser for servers.json.</p>" +
" </body>\n" +
" </html>" +
"";
}
}
| 745 | 0.58255 | 0.58255 | 30 | 23.833334 | 24.47459 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.7 | false | false | 8 |
e5475dc9f90ddf5e3c61a68c3564a12ba4d744da | 23,338,852,290,706 | 2546206faac30bc9f73864114347bde0ba426538 | /app/src/main/java/com/exploitation/healthcareapp/MyTipsListFragment.java | ccbc956d7cb0ce1ff3688d7cde907975ec8af598 | []
| no_license | tanvir14012/HealthCareApp | https://github.com/tanvir14012/HealthCareApp | 768d1b20cd1947b955423ea9761dd71841dd4274 | 51fbee871564855bade6b18ed55d6f507cfdd797 | refs/heads/master | 2020-06-13T14:29:05.334000 | 2019-07-03T18:12:54 | 2019-07-03T18:12:54 | 194,687,140 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.exploitation.healthcareapp;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.futuremind.recyclerviewfastscroll.FastScroller;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class MyTipsListFragment extends Fragment {
private RecyclerView mRecyclerView;
private FastScroller fastScroller;
private ReceipeAdapter mAdapter;
private String catagoryName;
public MyTipsListFragment() {
// Required empty public constructor
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
catagoryName = getActivity().getIntent().getStringExtra(MyTipsList.MYTIPS_CATAGORY_EXTRA);
setHasOptionsMenu(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.mytips_list_plus :
return true;
case R.id.mytips_list_edit :
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.mytips_catagory_item_menu, menu);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.list_receipe_fragment,container,false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.list_receipe_fragment_layout);
fastScroller = (FastScroller) view.findViewById(R.id.fastscroll);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
/** getActivity() in a Fragment returns the Activity the Fragment is currently associated with. Recyclerview
requires a LayoutManager to work **/
mRecyclerView.addItemDecoration(new DividerItemDecoration(mRecyclerView.getContext(),DividerItemDecoration.VERTICAL));
mAdapter = new ReceipeAdapter(getActivity());
mRecyclerView.setAdapter(mAdapter);
fastScroller.setRecyclerView(mRecyclerView);
return view;
}
private class ReceipeHolder extends RecyclerView.ViewHolder {
private ImageView imageView;
private TextView textView;
private Receipe mReceipe;
public ReceipeHolder( LayoutInflater inflater, ViewGroup container) {
super(inflater.inflate(R.layout.list_receipe_item, container,false)); /** this
way layout of list_receipt_item is added to work with Recyclerview**/
imageView =(ImageView) itemView.findViewById(R.id.imageView3); /* As the layout is inflated
in super class, itemView(super class's View element) is used */
textView = (TextView) itemView.findViewById(R.id.textView3);
itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), SingleReceipeActivity.class);
intent.putExtra("receipeId", mReceipe.getId()); /** The extra is put on SingleReceipeActivity activity
and can be retrived from there **/
intent.putExtra("catagoryId",getActivity().getIntent().getIntExtra(ListReceipeFragmentActivity.INTENT_KEY,0));
startActivity(intent);
}
});
}
public void onBind(Receipe receipe) { /* User defined, modifies values of list_receipt_item
when it's called from onBindViewHolder(..) of Adapter */
imageView.setImageResource(getActivity().getResources().getIdentifier(receipe.getCaption(),"drawable",getActivity().getPackageName()));
textView.setText(String.valueOf(receipe.getId()+1)+". " + getString(getActivity().getResources().getIdentifier(receipe.getName(),"string",getActivity().getPackageName())));
mReceipe = receipe ; /** Here we got the receipe obj associated with respective View, useful when a view is clicked */
}
}
private class ReceipeAdapter extends RecyclerView.Adapter<MyTipsListFragment.ReceipeHolder> {
private List<Receipe> receipeS;
public ReceipeAdapter(Context context) {
receipeS = new ArrayList<Receipe>();
}
@Override
public ReceipeHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ReceipeHolder(LayoutInflater.from(getActivity()), parent);
}
@Override
public void onBindViewHolder(ReceipeHolder holder, int position) {
holder.onBind(receipeS.get(position));
}
@Override
public int getItemCount() {
return receipeS.size();
}
}
}
| UTF-8 | Java | 5,526 | java | MyTipsListFragment.java | Java | []
| null | []
| package com.exploitation.healthcareapp;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.futuremind.recyclerviewfastscroll.FastScroller;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class MyTipsListFragment extends Fragment {
private RecyclerView mRecyclerView;
private FastScroller fastScroller;
private ReceipeAdapter mAdapter;
private String catagoryName;
public MyTipsListFragment() {
// Required empty public constructor
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
catagoryName = getActivity().getIntent().getStringExtra(MyTipsList.MYTIPS_CATAGORY_EXTRA);
setHasOptionsMenu(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.mytips_list_plus :
return true;
case R.id.mytips_list_edit :
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.mytips_catagory_item_menu, menu);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.list_receipe_fragment,container,false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.list_receipe_fragment_layout);
fastScroller = (FastScroller) view.findViewById(R.id.fastscroll);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
/** getActivity() in a Fragment returns the Activity the Fragment is currently associated with. Recyclerview
requires a LayoutManager to work **/
mRecyclerView.addItemDecoration(new DividerItemDecoration(mRecyclerView.getContext(),DividerItemDecoration.VERTICAL));
mAdapter = new ReceipeAdapter(getActivity());
mRecyclerView.setAdapter(mAdapter);
fastScroller.setRecyclerView(mRecyclerView);
return view;
}
private class ReceipeHolder extends RecyclerView.ViewHolder {
private ImageView imageView;
private TextView textView;
private Receipe mReceipe;
public ReceipeHolder( LayoutInflater inflater, ViewGroup container) {
super(inflater.inflate(R.layout.list_receipe_item, container,false)); /** this
way layout of list_receipt_item is added to work with Recyclerview**/
imageView =(ImageView) itemView.findViewById(R.id.imageView3); /* As the layout is inflated
in super class, itemView(super class's View element) is used */
textView = (TextView) itemView.findViewById(R.id.textView3);
itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), SingleReceipeActivity.class);
intent.putExtra("receipeId", mReceipe.getId()); /** The extra is put on SingleReceipeActivity activity
and can be retrived from there **/
intent.putExtra("catagoryId",getActivity().getIntent().getIntExtra(ListReceipeFragmentActivity.INTENT_KEY,0));
startActivity(intent);
}
});
}
public void onBind(Receipe receipe) { /* User defined, modifies values of list_receipt_item
when it's called from onBindViewHolder(..) of Adapter */
imageView.setImageResource(getActivity().getResources().getIdentifier(receipe.getCaption(),"drawable",getActivity().getPackageName()));
textView.setText(String.valueOf(receipe.getId()+1)+". " + getString(getActivity().getResources().getIdentifier(receipe.getName(),"string",getActivity().getPackageName())));
mReceipe = receipe ; /** Here we got the receipe obj associated with respective View, useful when a view is clicked */
}
}
private class ReceipeAdapter extends RecyclerView.Adapter<MyTipsListFragment.ReceipeHolder> {
private List<Receipe> receipeS;
public ReceipeAdapter(Context context) {
receipeS = new ArrayList<Receipe>();
}
@Override
public ReceipeHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ReceipeHolder(LayoutInflater.from(getActivity()), parent);
}
@Override
public void onBindViewHolder(ReceipeHolder holder, int position) {
holder.onBind(receipeS.get(position));
}
@Override
public int getItemCount() {
return receipeS.size();
}
}
}
| 5,526 | 0.682772 | 0.681325 | 143 | 37.643356 | 35.925411 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.601399 | false | false | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.