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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d2454ddb39527910b0c2b3f5b5356123858359d2 | 28,930,899,706,565 | a25dd63a269fa713b3b11e5a61b7378c90b8c752 | /java/OOAD/SolidPrincipleApp/src/com/techlabs/InterfaceSP/violation/Robot.java | 24082a477d2e8770eb469d335e104a4dc985690f | [] | no_license | Dnayak8866/swabhav-techlabs | https://github.com/Dnayak8866/swabhav-techlabs | 1e9a577b15683eddebfb0c18761283639c7756d9 | 26fb8a1534cb92dad8978e366bcf8ecbb21af2a1 | refs/heads/master | 2021-07-04T19:50:57.537000 | 2019-04-01T15:59:26 | 2019-04-01T15:59:26 | 143,505,133 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.techlabs.InterfaceSP.violation;
public class Robot implements Iworker {
@Override
public void startwork() {
System.out.println("Start work.....Robot");
}
@Override
public void stopWork() {
System.out.println("Stop work.....Robot");
}
@Override
public void startEat() {
throw new RuntimeException("Violating ISP......");
}
@Override
public void stopEat() {
throw new RuntimeException("Violating ISP......");
}
}
| UTF-8 | Java | 462 | java | Robot.java | Java | [] | null | [] | package com.techlabs.InterfaceSP.violation;
public class Robot implements Iworker {
@Override
public void startwork() {
System.out.println("Start work.....Robot");
}
@Override
public void stopWork() {
System.out.println("Stop work.....Robot");
}
@Override
public void startEat() {
throw new RuntimeException("Violating ISP......");
}
@Override
public void stopEat() {
throw new RuntimeException("Violating ISP......");
}
}
| 462 | 0.662338 | 0.662338 | 29 | 14.931034 | 17.820816 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.172414 | false | false | 13 |
770df63e41218dd2385dfc94090eb14ddd37846b | 11,673,721,169,547 | d1f8c84f58ce465ca1c3d98b1efe83d7c4a5a4d1 | /code/is_anagram/is_anagram.java | 029eb69fbe53c21af664634beff078700c24850f | [] | no_license | skomissopoulos/mentorship | https://github.com/skomissopoulos/mentorship | 9f282f261bcd0a36656dc9001c1efb1363c2326c | 64394df9f7ba795626bc8160d8c07018e3489bfb | refs/heads/master | 2020-08-04T02:21:56.146000 | 2019-09-30T22:36:10 | 2019-09-30T22:36:10 | 211,969,276 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Function to determine if two strings are anagrams of each other.
import java.util.Map;
import java.util.HashMap;
class Main {
public static Boolean isAnagram(String S, String T) {
// Count the characters in S and T.
// Again, note the use of Character (rather than char) and
// Integer (rather than int).
HashMap<Character, Integer> char_counts_in_S = countChars(S);
HashMap<Character, Integer> char_counts_in_T = countChars(T);
// If S and T don't contain the same number of distinct characters
// (the number of keys in their respective char_counts), then they
// can't be anagrams. hashmap.size() returns the number of keys
// in the hashmap.
if (char_counts_in_S.size() != char_counts_in_T.size()) {
return false;
}
// Now check that for each character in S, that character appears
// the same number of times in T.
// This is a special kind of for loop; it loops over the
// (key, value) pairs in the map rather than using i = 0; i < ...
for (Map.Entry<Character, Integer> entry : char_counts_in_S.entrySet()) {
Character c = entry.getKey();
Integer char_count = entry.getValue();
if (!char_counts_in_T.containsKey(c) ||
char_counts_in_T.get(c) != char_count) {
return false;
}
}
// At this point we have checked that the counts of each character
// in S are the same in T, and that S and T have the same number
// of distinct characters. Together, these conditions mean that S and
// T have exactly the same characters, and are anagrams of each other.
return true;
}
// Returns a map from each character in `S` to the number of times
// that character appears in S.
public static HashMap<Character, Integer> countChars(String S) {
HashMap<Character, Integer> char_counts = new HashMap<Character, Integer>();
for (int i = 0; i < S.length(); ++i) {
Character c = S.charAt(i);
// If char is already in the map, increment it.
// Otherwise, set its value to 1.
if (char_counts.containsKey(c)) {
Integer current_value_for_char = char_counts.get(c);
char_counts.put(c, current_value_for_char + 1);
} else {
char_counts.put(c, 1);
}
}
return char_counts;
}
public static void main(String[] args) {
String s1 = "helloworld";
String s2 = "hloolelwrd";
String s3 = "notanagram";
System.out.println(s1 + " is " + (isAnagram(s1, s2) ? "" : "not ") + "an anagram of " + s2);
System.out.println(s1 + " is " + (isAnagram(s1, s3) ? "" : "not ") + "an anagram of " + s3);
System.out.println(s2 + " is " + (isAnagram(s2, s3) ? "" : "not ") + "an anagram of " + s3);
}
}
| UTF-8 | Java | 2,719 | java | is_anagram.java | Java | [
{
"context": "tatic void main(String[] args) {\n String s1 = \"helloworld\";\n String s2 = \"hloolelwrd\";\n String s3 = \"",
"end": 2359,
"score": 0.7746890187263489,
"start": 2349,
"tag": "USERNAME",
"value": "helloworld"
}
] | null | [] | // Function to determine if two strings are anagrams of each other.
import java.util.Map;
import java.util.HashMap;
class Main {
public static Boolean isAnagram(String S, String T) {
// Count the characters in S and T.
// Again, note the use of Character (rather than char) and
// Integer (rather than int).
HashMap<Character, Integer> char_counts_in_S = countChars(S);
HashMap<Character, Integer> char_counts_in_T = countChars(T);
// If S and T don't contain the same number of distinct characters
// (the number of keys in their respective char_counts), then they
// can't be anagrams. hashmap.size() returns the number of keys
// in the hashmap.
if (char_counts_in_S.size() != char_counts_in_T.size()) {
return false;
}
// Now check that for each character in S, that character appears
// the same number of times in T.
// This is a special kind of for loop; it loops over the
// (key, value) pairs in the map rather than using i = 0; i < ...
for (Map.Entry<Character, Integer> entry : char_counts_in_S.entrySet()) {
Character c = entry.getKey();
Integer char_count = entry.getValue();
if (!char_counts_in_T.containsKey(c) ||
char_counts_in_T.get(c) != char_count) {
return false;
}
}
// At this point we have checked that the counts of each character
// in S are the same in T, and that S and T have the same number
// of distinct characters. Together, these conditions mean that S and
// T have exactly the same characters, and are anagrams of each other.
return true;
}
// Returns a map from each character in `S` to the number of times
// that character appears in S.
public static HashMap<Character, Integer> countChars(String S) {
HashMap<Character, Integer> char_counts = new HashMap<Character, Integer>();
for (int i = 0; i < S.length(); ++i) {
Character c = S.charAt(i);
// If char is already in the map, increment it.
// Otherwise, set its value to 1.
if (char_counts.containsKey(c)) {
Integer current_value_for_char = char_counts.get(c);
char_counts.put(c, current_value_for_char + 1);
} else {
char_counts.put(c, 1);
}
}
return char_counts;
}
public static void main(String[] args) {
String s1 = "helloworld";
String s2 = "hloolelwrd";
String s3 = "notanagram";
System.out.println(s1 + " is " + (isAnagram(s1, s2) ? "" : "not ") + "an anagram of " + s2);
System.out.println(s1 + " is " + (isAnagram(s1, s3) ? "" : "not ") + "an anagram of " + s3);
System.out.println(s2 + " is " + (isAnagram(s2, s3) ? "" : "not ") + "an anagram of " + s3);
}
}
| 2,719 | 0.627804 | 0.620449 | 68 | 38.985294 | 28.086784 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.705882 | false | false | 13 |
764334b0d71c1671ab8f535974dedd8de060b7a4 | 16,767,552,323,680 | 6984159cdc127548c4cd88b136a8405e5e441387 | /src/main/java/io/dbean/validator/rule/Date.java | 830082631a61b973590f5f9f72b852cbbdcb2f90 | [] | no_license | akterstack/dbean | https://github.com/akterstack/dbean | b28ca75237167a3743980f7e6aa049c6d3109f1b | 00d559f3a29492ccf6296ac4b05bcabb5d81310e | refs/heads/master | 2021-06-11T09:24:52.639000 | 2017-01-20T13:59:03 | 2017-01-20T13:59:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.dbean.validator.rule;
import io.dbean.PropertyRule;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@PropertyRule
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Date {
//TODO
}
| UTF-8 | Java | 364 | java | Date.java | Java | [] | null | [] | package io.dbean.validator.rule;
import io.dbean.PropertyRule;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@PropertyRule
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Date {
//TODO
}
| 364 | 0.807692 | 0.807692 | 15 | 23.266666 | 16.980249 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false | 13 |
6b18dbce6e3d8031059cb5a5afa28851d444b235 | 16,758,962,458,334 | f3bd20ab209de3d0824a6b813d69aaafc883b13f | /app/src/main/java/com/example/dennis/androidfinal/MainActivity.java | 2baa255b751368f49f187e6c4fb8808060e64f19 | [] | no_license | champagneabuelo/android-final-project | https://github.com/champagneabuelo/android-final-project | 518b7e82785a72c8a6652cefd53d14b0a19aea4d | e8c3fdc4c036b985f4883ebed02aaaabf0c2f31e | refs/heads/master | 2021-01-18T13:17:17.285000 | 2017-09-24T01:46:38 | 2017-09-24T01:46:38 | 80,747,790 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.dennis.androidfinal;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.util.Log;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import android.widget.ImageButton;
import android.widget.TextView;
import com.spotify.sdk.android.authentication.AuthenticationClient;
import com.spotify.sdk.android.authentication.AuthenticationRequest;
import com.spotify.sdk.android.authentication.AuthenticationResponse;
import com.spotify.sdk.android.player.Config;
import com.spotify.sdk.android.player.ConnectionStateCallback;
import com.spotify.sdk.android.player.Error;
import com.spotify.sdk.android.player.Metadata;
import com.spotify.sdk.android.player.PlaybackState;
import com.spotify.sdk.android.player.Player;
import com.spotify.sdk.android.player.PlayerEvent;
import com.spotify.sdk.android.player.Spotify;
import com.spotify.sdk.android.player.SpotifyPlayer;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
public class MainActivity extends AppCompatActivity implements
SpotifyPlayer.NotificationCallback, ConnectionStateCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
public static final Player.OperationCallback mOperationCallback = new Player.OperationCallback() {
@Override
public void onSuccess() {
Log.d("Success", "yes");
}
@Override
public void onError(Error error) {
Log.d("ERROR:", "no");
}
};
// TODO: Replace with your client ID
private static final String CLIENT_ID = "23e2f84522894565bbf47954996f8a91";
// TODO: Replace with your redirect URI
private static final String REDIRECT_URI = "android-login://callback";
public LocationManager mLocationManager;
private static final int MY_PERMISSION_ACCESS_FINE_LOCATION = 11;
public static boolean gpsBool = false;
public static boolean gpsBool2 = false;
public static float light_threshold = 10.0f;
public static boolean day_bool = false;
public static boolean night_bool = false;
public static boolean alert = true;
public boolean checkLight = false;
public static Player mPlayer;
private PlaybackState mCurrentPlaybackState;
private TextView mMetaDataArtist, mMetaDataSong, mMetaDataAlbum;
private Metadata mMetaData;
public static final List<String> DAY_THEME = Arrays.asList(
"spotify:track:0O53YcPBLyveU0jVYZpUgk",
"spotify:track:5AXxiMXRRzdvPi3QzRDJfq",
"spotify:track:6gXrEUzibufX9xYPk3HD5p",
"spotify:track:3bbUkaQYGQHkx1TJi7gPSL",
"spotify:track:3xGJuHvSxFJxxYlHj5BIoT",
"spotify:track:1y5d3k9bewTlCQ4xbPXjhN",
"spotify:track:3I7IGPFe0DoNXZI9JDYa5P",
"spotify:track:0CpxIwmIOKHOIgxupmRMNx",
"spotify:track:2aoo2jlRnM3A0NyLQqMN2f",
"spotify:track:3ZOEytgrvLwQaqXreDs2Jx"
);
public static final List<String> NIGHT_THEME = Arrays.asList(
"spotify:track:1OgyTG8JVzJghfAWm4gI3C",
"spotify:track:2BSvC0GrY7Gh373BRDgQf9",
"spotify:track:5HNCy40Ni5BZJFw1TKzRsC",
"spotify:track:6kbSo13qvSJHBjuKdGBUbb",
"spotify:track:6mFkJmJqdDVQ1REhVfGgd1",
"spotify:track:3lOoadPNLAAeDaLEtOndqa",
"spotify:track:5bDEA48Dxyxoc3K4Dt7yRE",
"spotify:track:1UImyGhodlbYnnqAennkGb",
"spotify:track:1NbwKmuZLbFWXYHNixiMcH",
"spotify:track:1AKfLYTm4RqfLKqgQmv9V2"
);
public static final List<String> FAST_THEME = Arrays.asList(
"spotify:track:1fy015PWkCjeiN0mEQ28gK",
"spotify:track:1Q2fYlSdwuutWj3QplhY9q",
"spotify:track:3uJpLFPywddM2hhqgcgzfN",
"spotify:track:2G1xOn9PhRgi63XWp2ToZx",
"spotify:track:14EORgkbXqIx5K4Haucmnb",
"spotify:track:278jOl7gFMJ9WMnUbGxWRe",
"spotify:track:5PGSwTLoqCGt5bYhQZBFlw",
"spotify:track:0lP4HYLmvowOKdsQ7CVkuq",
"spotify:track:51c94ac31swyDQj9B3Lzs3",
"spotify:track:6RJdYpFQwLyNfDc5FbjkgV"
);
public static final List<String> SLOW_THEME = Arrays.asList(
"spotify:track:4PVC260ho51c5A5Xz2FTwY",
"spotify:track:1OMdL6Ut9yYWgq05eUKGuq",
"spotify:track:5sFdMGaWXdSWYtS93KimeP",
"spotify:track:6lhhVRjJJk2He59jAtOSsm",
"spotify:track:6bbjsAJnozh2qYMS9lFQDz",
"spotify:track:6AxNrCQko6Ftb7xThkU4Wv",
"spotify:track:2mRiYprn1Ia7kVevhMvuRG",
"spotify:track:2OuACwejkbRvb8vomGmak7",
"spotify:track:6fD08OgJKEiviZ1R3h8SK8",
"spotify:track:1AIu4EHzrN7GdpeKgigZ3G"
);
// Request code that will be used to verify if the result comes from correct activity
// Can be any integer
private static final int REQUEST_CODE = 1337;
public static int tracker = 0;
public static String current = "";
// TextViews for Light Sensor testing
TextView textlight_available, textlight_reading;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageButton btn = (ImageButton)findViewById(R.id.play);
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(CLIENT_ID,
AuthenticationResponse.Type.TOKEN,
REDIRECT_URI);
builder.setScopes(new String[]{"user-read-private", "streaming"});
AuthenticationRequest request = builder.build();
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
mMetaDataAlbum = (TextView) findViewById(R.id.album);
mMetaDataArtist = (TextView) findViewById(R.id.artist);
mMetaDataSong = (TextView) findViewById(R.id.song);
mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if ( ContextCompat.checkSelfPermission( this, android.Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED ) {
ActivityCompat.requestPermissions( this, new String[] { android.Manifest.permission.ACCESS_FINE_LOCATION },
MY_PERMISSION_ACCESS_FINE_LOCATION );
}
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10*1000,
0, mLocationListener);
SensorManager sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
Sensor LightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
if (LightSensor != null) {
// textlight_available.setText("Sensor.TYPE_LIGHT Available");
sensorManager.registerListener(
LightSensorListener,
LightSensor,
SensorManager.SENSOR_DELAY_NORMAL
);
}
}
public void getLight(View view) {
checkLight = true;
}
// Event Listener for Light Sensor
private final SensorEventListener LightSensorListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
if (sensorEvent.sensor.getType() == Sensor.TYPE_LIGHT && checkLight) {
//textlight_reading.setText("Light: " + sensorEvent.values[0]);
checkLight = false;
if (sensorEvent.values[0] <= light_threshold && !night_bool) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're in a dark place. Would you like to play the Night Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
night_bool = true;
day_bool = false;
gpsBool = false;
gpsBool2 = false;
alert = true;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(index), 0, 0);
tracker = index;
current = "night";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
alert = true;
dialog.cancel();
}
});
if (alert) {
alert = false;
AlertDialog alert11 = builder1.create();
alert11.show();
}
} else if (sensorEvent.values[0] > light_threshold && !day_bool) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're in a light place. Would you like to play the Day Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
day_bool = true;
night_bool = false;
gpsBool = false;
gpsBool2 = false;
alert = true;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, DAY_THEME.get(index), 0, 0);
tracker = index;
current = "day";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
alert = true;
dialog.cancel();
}
});
if (alert) {
alert = false;
AlertDialog alert11 = builder1.create();
alert11.show();
}
}
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
// auto generated stub
}
};
private final LocationListener mLocationListener = new LocationListener() {
private Location mLastLocation;
@Override
public void onLocationChanged(Location location) {
double speed = 0;
if (this.mLastLocation != null) {
speed = Math.sqrt(Math.pow(location.getLongitude() - mLastLocation.getLongitude(), 2)
+ Math.pow(location.getLatitude() - mLastLocation.getLatitude(), 2)
) / (location.getTime() - this.mLastLocation.getTime());
}
if (location.hasSpeed()) {
speed = location.getSpeed();
}
this.mLastLocation = location;
if (speed > 1 && !gpsBool) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're moving quickly. Would you like to play the Fast Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
gpsBool = true;
day_bool = false;
night_bool = false;
gpsBool2 = false;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, FAST_THEME.get(index), 0, 0);
tracker = index;
current = "fast";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
} else if (speed <= 1 && !gpsBool2){
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're relaxing. Would you like to play the Slow Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
gpsBool2 = true;
day_bool = false;
night_bool = false;
gpsBool = false;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(index), 0, 0);
tracker = index;
current = "slow";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
System.out.println("onStatusChanged");
}
@Override
public void onProviderEnabled(String provider) {
System.out.println("onProviderEnabled");
}
@Override
public void onProviderDisabled(String provider) {
System.out.println("onProviderDisabled");
//turns off gps services
}
};
@Override
protected void onDestroy() {
Spotify.destroyPlayer(this);
super.onDestroy();
}
@Override
public void onPlaybackEvent(PlayerEvent event) {
Log.d("Event: " , "event");
mCurrentPlaybackState = mPlayer.getPlaybackState();
ImageButton btn = (ImageButton)findViewById(R.id.play);
if (mCurrentPlaybackState != null && mCurrentPlaybackState.isPlaying) {
btn.setImageResource(R.drawable.pause);
} else {
btn.setImageResource(R.drawable.play);
}
mMetaData = mPlayer.getMetadata();
if (mMetaData != null && mMetaData.currentTrack != null) {
mMetaDataArtist.setText(mMetaData.currentTrack.artistName);
mMetaDataAlbum.setText(mMetaData.currentTrack.albumName);
mMetaDataSong.setText(mMetaData.currentTrack.name);
}
}
@Override
public void onPlaybackError(Error error) {
Log.d("MainActivity", "Playback error received: " + error.name());
switch (error) {
// Handle error type as necessary
default:
break;
}
}
@Override
public void onLoggedIn() {
Log.d("MainActivity", "User logged in");
}
@Override
public void onLoggedOut() {
Log.d("MainActivity", "User logged out");
}
@Override
public void onLoginFailed(int i) {
Log.d("MainActivity", "Login failed");
}
@Override
public void onTemporaryError() {
Log.d("MainActivity", "Temporary error occurred");
}
@Override
public void onConnectionMessage(String message) {
Log.d("MainActivity", "Received connection message: " + message);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
// Check if result comes from the correct activity
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
if (response.getType() == AuthenticationResponse.Type.TOKEN) {
Config playerConfig = new Config(this, response.getAccessToken(), CLIENT_ID);
Spotify.getPlayer(playerConfig, this, new SpotifyPlayer.InitializationObserver() {
@Override
public void onInitialized(SpotifyPlayer spotifyPlayer) {
mPlayer = spotifyPlayer;
mPlayer.addConnectionStateCallback(MainActivity.this);
mPlayer.addNotificationCallback(MainActivity.this);
}
@Override
public void onError(Throwable throwable) {
Log.e("MainActivity", "Could not initialize player: " + throwable.getMessage());
}
});
}
}
}
public void showDayInfo(View view) {
Intent intent = new Intent(view.getContext(), DayInfo.class);
startActivity(intent);
}
public void showNightInfo(View view) {
Intent intent = new Intent(view.getContext(), NightInfo.class);
startActivity(intent);
}
public void showFastInfo(View view) {
Intent intent = new Intent(view.getContext(), FastInfo.class);
startActivity(intent);
}
public void showSlowInfo(View view) {
Intent intent = new Intent(view.getContext(), SlowInfo.class);
startActivity(intent);
}
public void onPauseButtonClicked(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
if (mCurrentPlaybackState != null && mCurrentPlaybackState.isPlaying) {
mPlayer.pause(mOperationCallback);
btn.setImageResource(R.drawable.play);
Log.d("pause", "pausing");
} else {
mPlayer.resume(mOperationCallback);
btn.setImageResource(R.drawable.pause);
Log.d("resume", "resuming");
}
}
public void playDay(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, DAY_THEME.get(index), 0, 0);
tracker = index;
current = "day";
night_bool = false;
day_bool = true;
gpsBool = false;
gpsBool2 = false;
}
public void playNight(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(index), 0, 0);
tracker = index;
current = "night";
night_bool = true;
day_bool = false;
gpsBool = false;
gpsBool2 = false;
}
public void playFast(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, FAST_THEME.get(index), 0, 0);
tracker = index;
current = "fast";
gpsBool = true;
day_bool = false;
night_bool = false;
gpsBool2 = false;
}
public void playSlow(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(index), 0, 0);
tracker = index;
current = "slow";
gpsBool2 = true;
day_bool = false;
night_bool = false;
gpsBool = false;
}
public void skip(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
if (current.equals("day")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, DAY_THEME.get(tracker), 0, 0);
}
if (current.equals("night")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(tracker), 0, 0);
}
if (current.equals("fast")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, FAST_THEME.get(tracker), 0, 0);
}
if (current.equals("slow")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(tracker), 0, 0);
}
}
public void rewind(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
if (current.equals("day")) {
tracker--;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, DAY_THEME.get(tracker), 0, 0);
}
if (current.equals("night")) {
tracker--;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(tracker), 0, 0);
}
if (current.equals("fast")) {
tracker++;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, FAST_THEME.get(tracker), 0, 0);
}
if (current.equals("slow")) {
tracker++;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(tracker), 0, 0);
}
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
}
| UTF-8 | Java | 25,336 | java | MainActivity.java | Java | [
{
"context": "package com.example.dennis.androidfinal;\n\nimport android.hardware.Sensor;",
"end": 23,
"score": 0.5145439505577087,
"start": 20,
"tag": "USERNAME",
"value": "den"
}
] | null | [] | package com.example.dennis.androidfinal;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.util.Log;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import android.widget.ImageButton;
import android.widget.TextView;
import com.spotify.sdk.android.authentication.AuthenticationClient;
import com.spotify.sdk.android.authentication.AuthenticationRequest;
import com.spotify.sdk.android.authentication.AuthenticationResponse;
import com.spotify.sdk.android.player.Config;
import com.spotify.sdk.android.player.ConnectionStateCallback;
import com.spotify.sdk.android.player.Error;
import com.spotify.sdk.android.player.Metadata;
import com.spotify.sdk.android.player.PlaybackState;
import com.spotify.sdk.android.player.Player;
import com.spotify.sdk.android.player.PlayerEvent;
import com.spotify.sdk.android.player.Spotify;
import com.spotify.sdk.android.player.SpotifyPlayer;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
public class MainActivity extends AppCompatActivity implements
SpotifyPlayer.NotificationCallback, ConnectionStateCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
public static final Player.OperationCallback mOperationCallback = new Player.OperationCallback() {
@Override
public void onSuccess() {
Log.d("Success", "yes");
}
@Override
public void onError(Error error) {
Log.d("ERROR:", "no");
}
};
// TODO: Replace with your client ID
private static final String CLIENT_ID = "23e2f84522894565bbf47954996f8a91";
// TODO: Replace with your redirect URI
private static final String REDIRECT_URI = "android-login://callback";
public LocationManager mLocationManager;
private static final int MY_PERMISSION_ACCESS_FINE_LOCATION = 11;
public static boolean gpsBool = false;
public static boolean gpsBool2 = false;
public static float light_threshold = 10.0f;
public static boolean day_bool = false;
public static boolean night_bool = false;
public static boolean alert = true;
public boolean checkLight = false;
public static Player mPlayer;
private PlaybackState mCurrentPlaybackState;
private TextView mMetaDataArtist, mMetaDataSong, mMetaDataAlbum;
private Metadata mMetaData;
public static final List<String> DAY_THEME = Arrays.asList(
"spotify:track:0O53YcPBLyveU0jVYZpUgk",
"spotify:track:5AXxiMXRRzdvPi3QzRDJfq",
"spotify:track:6gXrEUzibufX9xYPk3HD5p",
"spotify:track:3bbUkaQYGQHkx1TJi7gPSL",
"spotify:track:3xGJuHvSxFJxxYlHj5BIoT",
"spotify:track:1y5d3k9bewTlCQ4xbPXjhN",
"spotify:track:3I7IGPFe0DoNXZI9JDYa5P",
"spotify:track:0CpxIwmIOKHOIgxupmRMNx",
"spotify:track:2aoo2jlRnM3A0NyLQqMN2f",
"spotify:track:3ZOEytgrvLwQaqXreDs2Jx"
);
public static final List<String> NIGHT_THEME = Arrays.asList(
"spotify:track:1OgyTG8JVzJghfAWm4gI3C",
"spotify:track:2BSvC0GrY7Gh373BRDgQf9",
"spotify:track:5HNCy40Ni5BZJFw1TKzRsC",
"spotify:track:6kbSo13qvSJHBjuKdGBUbb",
"spotify:track:6mFkJmJqdDVQ1REhVfGgd1",
"spotify:track:3lOoadPNLAAeDaLEtOndqa",
"spotify:track:5bDEA48Dxyxoc3K4Dt7yRE",
"spotify:track:1UImyGhodlbYnnqAennkGb",
"spotify:track:1NbwKmuZLbFWXYHNixiMcH",
"spotify:track:1AKfLYTm4RqfLKqgQmv9V2"
);
public static final List<String> FAST_THEME = Arrays.asList(
"spotify:track:1fy015PWkCjeiN0mEQ28gK",
"spotify:track:1Q2fYlSdwuutWj3QplhY9q",
"spotify:track:3uJpLFPywddM2hhqgcgzfN",
"spotify:track:2G1xOn9PhRgi63XWp2ToZx",
"spotify:track:14EORgkbXqIx5K4Haucmnb",
"spotify:track:278jOl7gFMJ9WMnUbGxWRe",
"spotify:track:5PGSwTLoqCGt5bYhQZBFlw",
"spotify:track:0lP4HYLmvowOKdsQ7CVkuq",
"spotify:track:51c94ac31swyDQj9B3Lzs3",
"spotify:track:6RJdYpFQwLyNfDc5FbjkgV"
);
public static final List<String> SLOW_THEME = Arrays.asList(
"spotify:track:4PVC260ho51c5A5Xz2FTwY",
"spotify:track:1OMdL6Ut9yYWgq05eUKGuq",
"spotify:track:5sFdMGaWXdSWYtS93KimeP",
"spotify:track:6lhhVRjJJk2He59jAtOSsm",
"spotify:track:6bbjsAJnozh2qYMS9lFQDz",
"spotify:track:6AxNrCQko6Ftb7xThkU4Wv",
"spotify:track:2mRiYprn1Ia7kVevhMvuRG",
"spotify:track:2OuACwejkbRvb8vomGmak7",
"spotify:track:6fD08OgJKEiviZ1R3h8SK8",
"spotify:track:1AIu4EHzrN7GdpeKgigZ3G"
);
// Request code that will be used to verify if the result comes from correct activity
// Can be any integer
private static final int REQUEST_CODE = 1337;
public static int tracker = 0;
public static String current = "";
// TextViews for Light Sensor testing
TextView textlight_available, textlight_reading;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageButton btn = (ImageButton)findViewById(R.id.play);
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(CLIENT_ID,
AuthenticationResponse.Type.TOKEN,
REDIRECT_URI);
builder.setScopes(new String[]{"user-read-private", "streaming"});
AuthenticationRequest request = builder.build();
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
mMetaDataAlbum = (TextView) findViewById(R.id.album);
mMetaDataArtist = (TextView) findViewById(R.id.artist);
mMetaDataSong = (TextView) findViewById(R.id.song);
mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if ( ContextCompat.checkSelfPermission( this, android.Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED ) {
ActivityCompat.requestPermissions( this, new String[] { android.Manifest.permission.ACCESS_FINE_LOCATION },
MY_PERMISSION_ACCESS_FINE_LOCATION );
}
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10*1000,
0, mLocationListener);
SensorManager sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
Sensor LightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
if (LightSensor != null) {
// textlight_available.setText("Sensor.TYPE_LIGHT Available");
sensorManager.registerListener(
LightSensorListener,
LightSensor,
SensorManager.SENSOR_DELAY_NORMAL
);
}
}
public void getLight(View view) {
checkLight = true;
}
// Event Listener for Light Sensor
private final SensorEventListener LightSensorListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
if (sensorEvent.sensor.getType() == Sensor.TYPE_LIGHT && checkLight) {
//textlight_reading.setText("Light: " + sensorEvent.values[0]);
checkLight = false;
if (sensorEvent.values[0] <= light_threshold && !night_bool) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're in a dark place. Would you like to play the Night Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
night_bool = true;
day_bool = false;
gpsBool = false;
gpsBool2 = false;
alert = true;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(index), 0, 0);
tracker = index;
current = "night";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
alert = true;
dialog.cancel();
}
});
if (alert) {
alert = false;
AlertDialog alert11 = builder1.create();
alert11.show();
}
} else if (sensorEvent.values[0] > light_threshold && !day_bool) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're in a light place. Would you like to play the Day Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
day_bool = true;
night_bool = false;
gpsBool = false;
gpsBool2 = false;
alert = true;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, DAY_THEME.get(index), 0, 0);
tracker = index;
current = "day";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
alert = true;
dialog.cancel();
}
});
if (alert) {
alert = false;
AlertDialog alert11 = builder1.create();
alert11.show();
}
}
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
// auto generated stub
}
};
private final LocationListener mLocationListener = new LocationListener() {
private Location mLastLocation;
@Override
public void onLocationChanged(Location location) {
double speed = 0;
if (this.mLastLocation != null) {
speed = Math.sqrt(Math.pow(location.getLongitude() - mLastLocation.getLongitude(), 2)
+ Math.pow(location.getLatitude() - mLastLocation.getLatitude(), 2)
) / (location.getTime() - this.mLastLocation.getTime());
}
if (location.hasSpeed()) {
speed = location.getSpeed();
}
this.mLastLocation = location;
if (speed > 1 && !gpsBool) {
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're moving quickly. Would you like to play the Fast Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
gpsBool = true;
day_bool = false;
night_bool = false;
gpsBool2 = false;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, FAST_THEME.get(index), 0, 0);
tracker = index;
current = "fast";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
} else if (speed <= 1 && !gpsBool2){
AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this);
builder1.setMessage("It seems like you're relaxing. Would you like to play the Slow Theme?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
gpsBool2 = true;
day_bool = false;
night_bool = false;
gpsBool = false;
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(index), 0, 0);
tracker = index;
current = "slow";
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
System.out.println("onStatusChanged");
}
@Override
public void onProviderEnabled(String provider) {
System.out.println("onProviderEnabled");
}
@Override
public void onProviderDisabled(String provider) {
System.out.println("onProviderDisabled");
//turns off gps services
}
};
@Override
protected void onDestroy() {
Spotify.destroyPlayer(this);
super.onDestroy();
}
@Override
public void onPlaybackEvent(PlayerEvent event) {
Log.d("Event: " , "event");
mCurrentPlaybackState = mPlayer.getPlaybackState();
ImageButton btn = (ImageButton)findViewById(R.id.play);
if (mCurrentPlaybackState != null && mCurrentPlaybackState.isPlaying) {
btn.setImageResource(R.drawable.pause);
} else {
btn.setImageResource(R.drawable.play);
}
mMetaData = mPlayer.getMetadata();
if (mMetaData != null && mMetaData.currentTrack != null) {
mMetaDataArtist.setText(mMetaData.currentTrack.artistName);
mMetaDataAlbum.setText(mMetaData.currentTrack.albumName);
mMetaDataSong.setText(mMetaData.currentTrack.name);
}
}
@Override
public void onPlaybackError(Error error) {
Log.d("MainActivity", "Playback error received: " + error.name());
switch (error) {
// Handle error type as necessary
default:
break;
}
}
@Override
public void onLoggedIn() {
Log.d("MainActivity", "User logged in");
}
@Override
public void onLoggedOut() {
Log.d("MainActivity", "User logged out");
}
@Override
public void onLoginFailed(int i) {
Log.d("MainActivity", "Login failed");
}
@Override
public void onTemporaryError() {
Log.d("MainActivity", "Temporary error occurred");
}
@Override
public void onConnectionMessage(String message) {
Log.d("MainActivity", "Received connection message: " + message);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
// Check if result comes from the correct activity
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
if (response.getType() == AuthenticationResponse.Type.TOKEN) {
Config playerConfig = new Config(this, response.getAccessToken(), CLIENT_ID);
Spotify.getPlayer(playerConfig, this, new SpotifyPlayer.InitializationObserver() {
@Override
public void onInitialized(SpotifyPlayer spotifyPlayer) {
mPlayer = spotifyPlayer;
mPlayer.addConnectionStateCallback(MainActivity.this);
mPlayer.addNotificationCallback(MainActivity.this);
}
@Override
public void onError(Throwable throwable) {
Log.e("MainActivity", "Could not initialize player: " + throwable.getMessage());
}
});
}
}
}
public void showDayInfo(View view) {
Intent intent = new Intent(view.getContext(), DayInfo.class);
startActivity(intent);
}
public void showNightInfo(View view) {
Intent intent = new Intent(view.getContext(), NightInfo.class);
startActivity(intent);
}
public void showFastInfo(View view) {
Intent intent = new Intent(view.getContext(), FastInfo.class);
startActivity(intent);
}
public void showSlowInfo(View view) {
Intent intent = new Intent(view.getContext(), SlowInfo.class);
startActivity(intent);
}
public void onPauseButtonClicked(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
if (mCurrentPlaybackState != null && mCurrentPlaybackState.isPlaying) {
mPlayer.pause(mOperationCallback);
btn.setImageResource(R.drawable.play);
Log.d("pause", "pausing");
} else {
mPlayer.resume(mOperationCallback);
btn.setImageResource(R.drawable.pause);
Log.d("resume", "resuming");
}
}
public void playDay(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, DAY_THEME.get(index), 0, 0);
tracker = index;
current = "day";
night_bool = false;
day_bool = true;
gpsBool = false;
gpsBool2 = false;
}
public void playNight(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(index), 0, 0);
tracker = index;
current = "night";
night_bool = true;
day_bool = false;
gpsBool = false;
gpsBool2 = false;
}
public void playFast(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, FAST_THEME.get(index), 0, 0);
tracker = index;
current = "fast";
gpsBool = true;
day_bool = false;
night_bool = false;
gpsBool2 = false;
}
public void playSlow(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
Random rn = new Random();
int index = rn.nextInt(10);
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(index), 0, 0);
tracker = index;
current = "slow";
gpsBool2 = true;
day_bool = false;
night_bool = false;
gpsBool = false;
}
public void skip(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
if (current.equals("day")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, DAY_THEME.get(tracker), 0, 0);
}
if (current.equals("night")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(tracker), 0, 0);
}
if (current.equals("fast")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, FAST_THEME.get(tracker), 0, 0);
}
if (current.equals("slow")) {
tracker++;
if (tracker == 10) {
tracker = 0;
}
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(tracker), 0, 0);
}
}
public void rewind(View view) {
ImageButton btn = (ImageButton)findViewById(R.id.play);
btn.setImageResource(R.drawable.pause);
if (current.equals("day")) {
tracker--;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, DAY_THEME.get(tracker), 0, 0);
}
if (current.equals("night")) {
tracker--;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, NIGHT_THEME.get(tracker), 0, 0);
}
if (current.equals("fast")) {
tracker++;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, FAST_THEME.get(tracker), 0, 0);
}
if (current.equals("slow")) {
tracker++;
if (tracker == -1) {
tracker = 9;
}
mPlayer.playUri(mOperationCallback, SLOW_THEME.get(tracker), 0, 0);
}
}
@Override
public void onConnected(Bundle bundle) {
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
}
| 25,336 | 0.552494 | 0.539509 | 667 | 36.985008 | 27.589893 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.662669 | false | false | 13 |
c6a364cf6215b3768d918a4938ed14c6dc533b5a | 9,113,920,627,721 | cb0535f18ca126eff81d6ba2be0912bd1e7323bb | /app/src/main/java/pfg/com/viewdrawproc/MyRelativeLayout.java | 4a72b966133546e8c580603ed85b762ca796f851 | [] | no_license | pengfugen/ViewDrawProc | https://github.com/pengfugen/ViewDrawProc | 63b6612d84f497cd83cba625511ae57ce20596dd | 57047d81aa6df7505b44da4bd37e54428ca53b7c | refs/heads/master | 2020-03-27T02:22:43.983000 | 2018-08-24T08:56:15 | 2018-08-24T08:56:15 | 145,785,768 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pfg.com.viewdrawproc;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
/**
* Created by fpeng3 on 2018/8/23.
*/
public class MyRelativeLayout extends RelativeLayout {
private static final String TAG = "MyRelativeLayout";
MyRelativeLayout(Context context) {
super(context);
}
MyRelativeLayout(Context context, AttributeSet attSet) {
super(context, attSet);
}
MyRelativeLayout(Context context, AttributeSet attSet, int defStyleAttr) {
super(context, attSet, defStyleAttr);
}
MyRelativeLayout(Context context, AttributeSet attSet, int defStyleAttr, int defStyleRes) {
super(context, attSet, defStyleAttr, defStyleRes);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
String widthmode = SpecUtil.getModeString(MeasureSpec.getMode(widthMeasureSpec));
String heightmode = SpecUtil.getModeString(MeasureSpec.getMode(heightMeasureSpec));
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
MyLog.logd(TAG, "[width: "+width+" "+widthmode+", height: "+height+" "+heightmode+"]");
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
MyLog.logd(TAG, "onLayout");
super.onLayout(changed, left, top, right, bottom);
}
@Override
protected void onDraw(Canvas canvas) {
MyLog.logd(TAG, "onDraw");
super.onDraw(canvas);
//Debug.stopMethodTracing();
}
// drawChild流程走了,为什么child view的onDraw没有走进去?
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
MyLog.logd(TAG, "drawChild child:"+child.getId());
return super.drawChild(canvas, child, drawingTime);
}
}
| UTF-8 | Java | 2,084 | java | MyRelativeLayout.java | Java | [
{
"context": " android.widget.RelativeLayout;\n\n/**\n * Created by fpeng3 on 2018/8/23.\n */\n\npublic class MyRelativeLayout ",
"end": 254,
"score": 0.9996960759162903,
"start": 248,
"tag": "USERNAME",
"value": "fpeng3"
}
] | null | [] | package pfg.com.viewdrawproc;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
/**
* Created by fpeng3 on 2018/8/23.
*/
public class MyRelativeLayout extends RelativeLayout {
private static final String TAG = "MyRelativeLayout";
MyRelativeLayout(Context context) {
super(context);
}
MyRelativeLayout(Context context, AttributeSet attSet) {
super(context, attSet);
}
MyRelativeLayout(Context context, AttributeSet attSet, int defStyleAttr) {
super(context, attSet, defStyleAttr);
}
MyRelativeLayout(Context context, AttributeSet attSet, int defStyleAttr, int defStyleRes) {
super(context, attSet, defStyleAttr, defStyleRes);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
String widthmode = SpecUtil.getModeString(MeasureSpec.getMode(widthMeasureSpec));
String heightmode = SpecUtil.getModeString(MeasureSpec.getMode(heightMeasureSpec));
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
MyLog.logd(TAG, "[width: "+width+" "+widthmode+", height: "+height+" "+heightmode+"]");
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
MyLog.logd(TAG, "onLayout");
super.onLayout(changed, left, top, right, bottom);
}
@Override
protected void onDraw(Canvas canvas) {
MyLog.logd(TAG, "onDraw");
super.onDraw(canvas);
//Debug.stopMethodTracing();
}
// drawChild流程走了,为什么child view的onDraw没有走进去?
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
MyLog.logd(TAG, "drawChild child:"+child.getId());
return super.drawChild(canvas, child, drawingTime);
}
}
| 2,084 | 0.698637 | 0.694742 | 63 | 31.603174 | 29.328213 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.888889 | false | false | 13 |
33b4a79d54bd7e7c55b9a84ee097d9815a22ba49 | 3,015,067,044,413 | 7d6e38f15f159c28e991ce78425ac1ebc4c675d7 | /offtrans/app/src/main/java/de/digisocken/offtrans/EditActivity.java | 900e29dbaaf918afed2c329dd10ba6d642455af2 | [
"LGPL-2.1-or-later",
"Unlicense"
] | permissive | no-go/offlineTranslator | https://github.com/no-go/offlineTranslator | a4e4e3fbfb7444ad154df1a669d9e5bfa45449ee | 24ab93199b1f152c7360eb95c7c8bb5bd277bb66 | refs/heads/master | 2020-03-17T03:43:33.293000 | 2018-07-26T12:07:07 | 2018-07-26T12:07:07 | 133,247,922 | 2 | 2 | Unlicense | false | 2018-05-19T14:48:42 | 2018-05-13T15:08:40 | 2018-05-17T20:55:24 | 2018-05-19T14:46:56 | 15,901 | 0 | 1 | 0 | Java | false | null | package de.digisocken.offtrans;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class EditActivity extends Activity {
private Button sendButton;
private EditText editMsg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edit_activity);
sendButton = (Button) findViewById(R.id.btnOk);
editMsg = (EditText) findViewById(R.id.editMsg);
Intent intent = getIntent();
if (intent!=null) {
editMsg.setText(intent.getStringExtra("msg"));
}
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
} | UTF-8 | Java | 919 | java | EditActivity.java | Java | [] | null | [] | package de.digisocken.offtrans;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class EditActivity extends Activity {
private Button sendButton;
private EditText editMsg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edit_activity);
sendButton = (Button) findViewById(R.id.btnOk);
editMsg = (EditText) findViewById(R.id.editMsg);
Intent intent = getIntent();
if (intent!=null) {
editMsg.setText(intent.getStringExtra("msg"));
}
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
} | 919 | 0.656148 | 0.656148 | 32 | 27.75 | 18.874586 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.53125 | false | false | 13 |
70affe230a012b3d1dcce8dd2396c2fe10b59bf9 | 21,492,016,392,130 | ec70e6b6dfd7d703704f949285d845171cad7489 | /src/main/java/daw/sandrabazan/Prueba.java | a124f07ccb954760a4c3b7c3f589866de0beb695 | [] | no_license | SandraBazan/tarea4SandraBazan | https://github.com/SandraBazan/tarea4SandraBazan | 0609001664aa1bacea3646fe7e1e63a1a77f353a | c8125efd052c0bca9bbc203c7b27d5900cb4c63f | refs/heads/master | 2022-04-21T01:48:41.498000 | 2020-04-22T12:46:53 | 2020-04-22T12:46:53 | 257,894,062 | 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 daw.sandrabazan;
/**
*
* @author josel
*/
public class Prueba {
public static void main(String[] args) {
Persona p1 = new Persona();
Persona p2 = new Persona("Marzoco", "Mazorquito", "09546521F");
p1.toString();
p2.toString();
p1.getNombre();
p2.getNombre();
}
}
| UTF-8 | Java | 543 | java | Prueba.java | Java | [
{
"context": "r.\n */\npackage daw.sandrabazan;\n\n/**\n *\n * @author josel\n */\npublic class Prueba {\n public static void ",
"end": 234,
"score": 0.9948806762695312,
"start": 229,
"tag": "USERNAME",
"value": "josel"
},
{
"context": " new Persona();\n Persona p2 = new Pe... | 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 daw.sandrabazan;
/**
*
* @author josel
*/
public class Prueba {
public static void main(String[] args) {
Persona p1 = new Persona();
Persona p2 = new Persona("Marzoco", "Mazorquito", "09546521F");
p1.toString();
p2.toString();
p1.getNombre();
p2.getNombre();
}
}
| 543 | 0.593002 | 0.567219 | 24 | 21.625 | 21.929457 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
f16cde04f5df0d251053d7d0a5805a89855cdeba | 30,270,929,563,761 | 3243961bbda3564c126de5d9ee4e54a54a0ca064 | /src/main/java/com/thoughtworks/rslist/domain/RsEvent.java | 07ed2a4e259773975238059429b85f5aa17e8f2a | [] | no_license | gangy-tw/basic-api-implementation | https://github.com/gangy-tw/basic-api-implementation | 79115c2d0d71df1b8503580daa56bbea451d99ae | 0b6a8b657b7253973058562bbeef672f8532e2e2 | refs/heads/master | 2022-12-01T12:31:33.267000 | 2020-08-11T00:57:49 | 2020-08-11T00:57:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.thoughtworks.rslist.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
@Component
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RsEvent {
private int id;
@NotNull
private String eventName;
@NotNull
private String keyword;
@NotNull
private Integer userId;
private int voteNum = 0;
@JsonIgnore
public Integer getUserId() {
return userId;
}
@JsonProperty
public void setUserId(Integer userId) {
this.userId = userId;
}
}
| UTF-8 | Java | 794 | java | RsEvent.java | Java | [] | null | [] | package com.thoughtworks.rslist.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
@Component
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RsEvent {
private int id;
@NotNull
private String eventName;
@NotNull
private String keyword;
@NotNull
private Integer userId;
private int voteNum = 0;
@JsonIgnore
public Integer getUserId() {
return userId;
}
@JsonProperty
public void setUserId(Integer userId) {
this.userId = userId;
}
}
| 794 | 0.745592 | 0.744332 | 36 | 21.055555 | 15.060884 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 13 |
5618b818e1b0bff7cea6f203fdd8e738849bcddd | 14,053,133,052,079 | ff1a0394bd4f5e02ac06b6f9f6e6cf44ddc7cacb | /src/main/java/com/jobdemo/job/service/model/JobInput.java | 303280d9c82ccff66c93441c7d86f8562c22a6f8 | [] | no_license | tbialecki/job-demo | https://github.com/tbialecki/job-demo | 7ae04516557c2019c6d47c7bef491c3c7e9b1434 | 8f5ca1def4043ea06980254c9b858fe324435ed2 | refs/heads/master | 2023-01-06T10:09:36.666000 | 2020-11-09T15:53:48 | 2020-11-09T15:53:48 | 311,171,081 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jobdemo.job.service.model;
import javax.validation.constraints.NotEmpty;
import lombok.Data;
@Data
public class JobInput {
@NotEmpty
private String jobName;
@NotEmpty
private String description;
@NotEmpty
private String location;
}
| UTF-8 | Java | 273 | java | JobInput.java | Java | [] | null | [] | package com.jobdemo.job.service.model;
import javax.validation.constraints.NotEmpty;
import lombok.Data;
@Data
public class JobInput {
@NotEmpty
private String jobName;
@NotEmpty
private String description;
@NotEmpty
private String location;
}
| 273 | 0.732601 | 0.732601 | 17 | 15.058824 | 14.371011 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 13 |
d5ef77746543d1ec5e06843090732ad447515d64 | 29,798,483,163,999 | 25ea62a0c42e40979bac2bb61d529c1f5aff1eae | /src/com/aug/training/java/collectionframework/Student.java | bf6dae7567139c89ecd4907c20f9718543c97c5b | [] | no_license | czprotonn/java-oop-Chalisa | https://github.com/czprotonn/java-oop-Chalisa | fc4daeaba3885e901b5813fe8efd67ee4942e558 | bce984714e9da7365a8ae36845d989b4f08f0560 | refs/heads/master | 2021-03-12T23:26:02.482000 | 2015-07-01T08:29:48 | 2015-07-01T08:29:48 | 38,345,063 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aug.training.java.collectionframework;
import java.util.HashMap;
public class Student {
protected String id;
protected String name;
protected String degree;
protected Address address;
protected HashMap<Integer,Course> course = new HashMap<Integer,Course>();
public Student(String id,String name,String degree,Address address) {
this.id = id;
this.name = name;
this.degree = degree;
this.address = address;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDegree() {
return degree;
}
public void setDegree(String degree) {
this.degree = degree;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Course getCourse(int key) {
return this.course.get(key);
}
public void setCourse(HashMap<Integer, Course> course) {
this.course = course;
}
public void addCourse(Course course){
this.course.put(this.course.size(), course);
}
}
| UTF-8 | Java | 1,199 | java | Student.java | Java | [] | null | [] | package com.aug.training.java.collectionframework;
import java.util.HashMap;
public class Student {
protected String id;
protected String name;
protected String degree;
protected Address address;
protected HashMap<Integer,Course> course = new HashMap<Integer,Course>();
public Student(String id,String name,String degree,Address address) {
this.id = id;
this.name = name;
this.degree = degree;
this.address = address;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDegree() {
return degree;
}
public void setDegree(String degree) {
this.degree = degree;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Course getCourse(int key) {
return this.course.get(key);
}
public void setCourse(HashMap<Integer, Course> course) {
this.course = course;
}
public void addCourse(Course course){
this.course.put(this.course.size(), course);
}
}
| 1,199 | 0.665555 | 0.665555 | 63 | 17.031746 | 17.96113 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.460317 | false | false | 13 |
56001fd9680ff9b1c0102dd023fa38c066327337 | 23,854,248,415,158 | 3bc374d297fcd55cbfb22de9e5aeb357ff45e54c | /src/chapter8/observer/Subject.java | 749b62ab1113f2909316f4635c0aaebe8a94d708 | [] | no_license | yyyejianbin9527/Java8 | https://github.com/yyyejianbin9527/Java8 | 4c50c9de2b7253b38da07ce245cb48c849fe37f5 | 3cce0094c8ce32e696d470bf186cf3fe95793406 | refs/heads/master | 2020-07-24T13:33:26.366000 | 2019-09-25T07:04:58 | 2019-09-25T07:04:58 | 207,944,216 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chapter8.observer;/**
* Created by Administrator on 2019/9/23.
*/
import java.util.List;
/**
* @author yejianbin
* @version 1.0
* @ClassName Subject
* @Description 管理并通知观察者
* @Date 2019/9/23 17:06
**/
public interface Subject {
// 注册观察者
void registerObserver(Observer observer);
// 当发生某种情况时,通知观察者
void notifyObservers(String tweet);
}
| UTF-8 | Java | 423 | java | Subject.java | Java | [
{
"context": "/9/23.\n */\n\nimport java.util.List;\n\n/**\n * @author yejianbin\n * @version 1.0\n * @ClassName Subject\n * @Descrip",
"end": 125,
"score": 0.9990807175636292,
"start": 116,
"tag": "USERNAME",
"value": "yejianbin"
}
] | null | [] | package chapter8.observer;/**
* Created by Administrator on 2019/9/23.
*/
import java.util.List;
/**
* @author yejianbin
* @version 1.0
* @ClassName Subject
* @Description 管理并通知观察者
* @Date 2019/9/23 17:06
**/
public interface Subject {
// 注册观察者
void registerObserver(Observer observer);
// 当发生某种情况时,通知观察者
void notifyObservers(String tweet);
}
| 423 | 0.682927 | 0.626016 | 19 | 18.421053 | 13.800518 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | false | false | 13 |
849fc2a507a4b435aac3b4084f0eca2dc14fb647 | 21,457,656,671,092 | 2a75c22e60fc9879f603d8c7b673907fd4f6bfa9 | /presidio-core/fortscale/presidio-ml/src/main/java/fortscale/ml/model/selector/AggregatedEventContextSelectorConf.java | cf7a8f00e0fffd37387e9e90c2daf3a5fb25ea45 | [] | no_license | dfeshed/nw-ueba-saas | https://github.com/dfeshed/nw-ueba-saas | 2a55fdb67b7b312da71df9336990516fd03b41fc | 68f3aa12c0d32e06b680d5cc6ad769f4d185fe32 | refs/heads/master | 2022-04-20T20:58:46.372000 | 2020-04-20T09:27:42 | 2020-04-20T09:27:42 | 257,288,351 | 0 | 0 | null | true | 2020-04-20T13:23:51 | 2020-04-20T13:23:51 | 2020-04-20T10:27:16 | 2020-04-20T10:26:45 | 138,264 | 0 | 0 | 0 | null | false | false | package fortscale.ml.model.selector;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.util.Assert;
public class AggregatedEventContextSelectorConf implements IContextSelectorConf {
public static final String AGGREGATED_EVENT_CONTEXT_SELECTOR = "aggregated_event_context_selector";
private String aggregatedFeatureEventConfName;
@JsonCreator
public AggregatedEventContextSelectorConf(
@JsonProperty("aggregatedFeatureEventConfName") String aggregatedFeatureEventConfName) {
Assert.hasText(aggregatedFeatureEventConfName);
this.aggregatedFeatureEventConfName = aggregatedFeatureEventConfName;
}
@Override
public String getFactoryName() {
return AGGREGATED_EVENT_CONTEXT_SELECTOR;
}
public String getAggregatedFeatureEventConfName() {
return aggregatedFeatureEventConfName;
}
}
| UTF-8 | Java | 888 | java | AggregatedEventContextSelectorConf.java | Java | [] | null | [] | package fortscale.ml.model.selector;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.util.Assert;
public class AggregatedEventContextSelectorConf implements IContextSelectorConf {
public static final String AGGREGATED_EVENT_CONTEXT_SELECTOR = "aggregated_event_context_selector";
private String aggregatedFeatureEventConfName;
@JsonCreator
public AggregatedEventContextSelectorConf(
@JsonProperty("aggregatedFeatureEventConfName") String aggregatedFeatureEventConfName) {
Assert.hasText(aggregatedFeatureEventConfName);
this.aggregatedFeatureEventConfName = aggregatedFeatureEventConfName;
}
@Override
public String getFactoryName() {
return AGGREGATED_EVENT_CONTEXT_SELECTOR;
}
public String getAggregatedFeatureEventConfName() {
return aggregatedFeatureEventConfName;
}
}
| 888 | 0.84009 | 0.84009 | 28 | 30.714285 | 30.344282 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.107143 | false | false | 13 |
86b2ca08c7a59046e0c438e938423d231a2e36e9 | 17,033,840,309,151 | 9f1e197b084b12fb49cb38124079487066658471 | /src/rpc/RecommendItem.java | ac16d8469a150e503762fdaffb90a01d250a38e4 | [] | no_license | xiegudong45/Jupiter | https://github.com/xiegudong45/Jupiter | 0d8e3583adb9cfd420799f951c247172db4fc7ec | 8414677d53de1ac8838fe6e82aca1554b26bd4eb | refs/heads/master | 2022-12-02T03:57:21.479000 | 2020-08-01T13:45:32 | 2020-08-01T13:45:32 | 284,190,107 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rpc;
import algorithm.GeoRecommendation;
import entity.Item;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/recommendation")
public class RecommendItem extends HttpServlet {
private static final long serialVersionID = 1L;
public RecommendItem() {
super();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
String userId = request.getParameter("user_id");
double lat = Double.parseDouble(request.getParameter("lat"));
double lon = Double.parseDouble(request.getParameter("lon"));
// double lat = 37.38;
// double lon = -122.08;
GeoRecommendation geoRecommendation = new GeoRecommendation();
List<Item> items = geoRecommendation.recommendItems(userId, lat, lon);
JSONArray arr = new JSONArray();
try {
for (Item item : items) {
arr.put(item.toJSONObject());
}
} catch (Exception e) {
e.printStackTrace();
}
RpcHelper.writeJSONArray(response, arr);
// response.getWriter().append("Served at: ").append(request.getContextPath());
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
doGet(request, response);
}
}
| UTF-8 | Java | 1,649 | java | RecommendItem.java | Java | [] | null | [] | package rpc;
import algorithm.GeoRecommendation;
import entity.Item;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/recommendation")
public class RecommendItem extends HttpServlet {
private static final long serialVersionID = 1L;
public RecommendItem() {
super();
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
String userId = request.getParameter("user_id");
double lat = Double.parseDouble(request.getParameter("lat"));
double lon = Double.parseDouble(request.getParameter("lon"));
// double lat = 37.38;
// double lon = -122.08;
GeoRecommendation geoRecommendation = new GeoRecommendation();
List<Item> items = geoRecommendation.recommendItems(userId, lat, lon);
JSONArray arr = new JSONArray();
try {
for (Item item : items) {
arr.put(item.toJSONObject());
}
} catch (Exception e) {
e.printStackTrace();
}
RpcHelper.writeJSONArray(response, arr);
// response.getWriter().append("Served at: ").append(request.getContextPath());
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
doGet(request, response);
}
}
| 1,649 | 0.709521 | 0.703457 | 54 | 29.537037 | 23.149044 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 13 |
690dca327469d9ecaffeacdc59f101c910970d6a | 30,116,310,698,451 | 4a5cd392acd9e85296ef6d476f8708de5943f442 | /TX/poi_service/unittest/com/telenav/cserver/weather/executor/TestI18NWeatherExecutor.java | 5f4979333e2748200595ad423526e8852282de0f | [] | no_license | psupsuoooo/sdy-experiment | https://github.com/psupsuoooo/sdy-experiment | 3768a6b532105ff1ea3715dc0494f920fe05cfc2 | 5824cc1c23a197a235aef953e8e009fe0e3238f3 | refs/heads/master | 2018-04-14T19:05:46.407000 | 2018-04-08T16:21:11 | 2018-04-08T16:21:11 | 35,536,588 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.telenav.cserver.weather.executor;
import junit.framework.TestCase;
public class TestI18NWeatherExecutor extends TestCase{
private I18NWeatherResponse resp = new I18NWeatherResponse();
public void testCase(){
System.out.println("do noting now, just for pass the testing, otherwise it will report No tests found in com.telenav.cserver.adjuggler.executor.TestAdJugglerExecutor");
System.out.println("complete this test in other place");
}
private I18NWeatherRequest getI18NWeatherRequest(){
I18NWeatherRequest request = new I18NWeatherRequest();
request.setCanadianCarrier(false);
request.setLocale("en_US");
request.setLocation(null);
System.out.println(request.toString());
return request;
}
}
| UTF-8 | Java | 759 | java | TestI18NWeatherExecutor.java | Java | [] | null | [] | package com.telenav.cserver.weather.executor;
import junit.framework.TestCase;
public class TestI18NWeatherExecutor extends TestCase{
private I18NWeatherResponse resp = new I18NWeatherResponse();
public void testCase(){
System.out.println("do noting now, just for pass the testing, otherwise it will report No tests found in com.telenav.cserver.adjuggler.executor.TestAdJugglerExecutor");
System.out.println("complete this test in other place");
}
private I18NWeatherRequest getI18NWeatherRequest(){
I18NWeatherRequest request = new I18NWeatherRequest();
request.setCanadianCarrier(false);
request.setLocale("en_US");
request.setLocation(null);
System.out.println(request.toString());
return request;
}
}
| 759 | 0.758893 | 0.740448 | 23 | 31 | 36.88525 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.652174 | false | false | 13 |
ed24200ef73caefda668f843e0c26936b8b6e39b | 21,904,333,271,108 | f53173889227794ef24984adb848840c9cb7ce75 | /src/java/beans/Estabelecimento.java | 91d1119b34ef9e342134971c2150ec608f12e46e | [] | no_license | thiagocrestani/lojadapizza | https://github.com/thiagocrestani/lojadapizza | d4ff2121c9a9920cf9e9ac813803b5990a3b6836 | 527c2c529bb09b4a321a823f69855e322b5e7b66 | refs/heads/master | 2022-10-07T07:43:36.048000 | 2020-06-08T12:25:10 | 2020-06-08T12:25:10 | 270,419,416 | 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 beans;
/**
*
* @author thiagocrestani
*/
public class Estabelecimento {
private int id;
private String nome;
private String categoria;
private String foto;
private String tempoentrega;
private String temporetirada;
private float taxaentrega;
private String rua;
private int numero;
private String bairro;
private String complemento;
private String pontodereferencia;
private String cep;
private String cidade;
private String estado;
private String ufestado;
private String pais;
private String email;
private int ddd;
private String telefone;
private boolean excluir;
private boolean ativo;
private boolean entrega;
private boolean retirada;
public double latitude;
public double longitude;
public String getTemporetirada() {
return temporetirada;
}
public void setTemporetirada(String temporetirada) {
this.temporetirada = temporetirada;
}
public boolean isEntrega() {
return entrega;
}
public void setEntrega(boolean entrega) {
this.entrega = entrega;
}
public boolean isRetirada() {
return retirada;
}
public void setRetirada(boolean retirada) {
this.retirada = retirada;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public String getTelefone() {
return telefone;
}
public void setTelefone(String telefone) {
this.telefone = telefone;
}
public String getCategoria() {
return categoria;
}
public void setCategoria(String categoria) {
this.categoria = categoria;
}
public String getRua() {
return rua;
}
public void setRua(String rua) {
this.rua = rua;
}
public String getBairro() {
return bairro;
}
public void setBairro(String bairro) {
this.bairro = bairro;
}
public String getComplemento() {
return complemento;
}
public void setComplemento(String complemento) {
this.complemento = complemento;
}
public String getPontodereferencia() {
return pontodereferencia;
}
public void setPontodereferencia(String pontodereferencia) {
this.pontodereferencia = pontodereferencia;
}
public String getCep() {
return cep;
}
public void setCep(String cep) {
this.cep = cep;
}
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getUfestado() {
return ufestado;
}
public void setUfestado(String ufestado) {
this.ufestado = ufestado;
}
public String getPais() {
return pais;
}
public void setPais(String pais) {
this.pais = pais;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public int getDdd() {
return ddd;
}
public void setDdd(int ddd) {
this.ddd = ddd;
}
public boolean isExcluir() {
return excluir;
}
public void setExcluir(boolean excluir) {
this.excluir = excluir;
}
public boolean isAtivo() {
return ativo;
}
public void setAtivo(boolean ativo) {
this.ativo = ativo;
}
public String getTempoentrega() {
return tempoentrega;
}
public void setTempoentrega(String tempoentrega) {
this.tempoentrega = tempoentrega;
}
public float getTaxaentrega() {
return taxaentrega;
}
public void setTaxaentrega(float taxaentrega) {
this.taxaentrega = taxaentrega;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
}
| UTF-8 | Java | 4,928 | java | Estabelecimento.java | Java | [
{
"context": " the editor.\n */\npackage beans;\n\n/**\n *\n * @author thiagocrestani\n */\npublic class Estabelecimento {\n private in",
"end": 233,
"score": 0.9783506393432617,
"start": 219,
"tag": "USERNAME",
"value": "thiagocrestani"
}
] | 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 beans;
/**
*
* @author thiagocrestani
*/
public class Estabelecimento {
private int id;
private String nome;
private String categoria;
private String foto;
private String tempoentrega;
private String temporetirada;
private float taxaentrega;
private String rua;
private int numero;
private String bairro;
private String complemento;
private String pontodereferencia;
private String cep;
private String cidade;
private String estado;
private String ufestado;
private String pais;
private String email;
private int ddd;
private String telefone;
private boolean excluir;
private boolean ativo;
private boolean entrega;
private boolean retirada;
public double latitude;
public double longitude;
public String getTemporetirada() {
return temporetirada;
}
public void setTemporetirada(String temporetirada) {
this.temporetirada = temporetirada;
}
public boolean isEntrega() {
return entrega;
}
public void setEntrega(boolean entrega) {
this.entrega = entrega;
}
public boolean isRetirada() {
return retirada;
}
public void setRetirada(boolean retirada) {
this.retirada = retirada;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public String getTelefone() {
return telefone;
}
public void setTelefone(String telefone) {
this.telefone = telefone;
}
public String getCategoria() {
return categoria;
}
public void setCategoria(String categoria) {
this.categoria = categoria;
}
public String getRua() {
return rua;
}
public void setRua(String rua) {
this.rua = rua;
}
public String getBairro() {
return bairro;
}
public void setBairro(String bairro) {
this.bairro = bairro;
}
public String getComplemento() {
return complemento;
}
public void setComplemento(String complemento) {
this.complemento = complemento;
}
public String getPontodereferencia() {
return pontodereferencia;
}
public void setPontodereferencia(String pontodereferencia) {
this.pontodereferencia = pontodereferencia;
}
public String getCep() {
return cep;
}
public void setCep(String cep) {
this.cep = cep;
}
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getUfestado() {
return ufestado;
}
public void setUfestado(String ufestado) {
this.ufestado = ufestado;
}
public String getPais() {
return pais;
}
public void setPais(String pais) {
this.pais = pais;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public int getDdd() {
return ddd;
}
public void setDdd(int ddd) {
this.ddd = ddd;
}
public boolean isExcluir() {
return excluir;
}
public void setExcluir(boolean excluir) {
this.excluir = excluir;
}
public boolean isAtivo() {
return ativo;
}
public void setAtivo(boolean ativo) {
this.ativo = ativo;
}
public String getTempoentrega() {
return tempoentrega;
}
public void setTempoentrega(String tempoentrega) {
this.tempoentrega = tempoentrega;
}
public float getTaxaentrega() {
return taxaentrega;
}
public void setTaxaentrega(float taxaentrega) {
this.taxaentrega = taxaentrega;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
}
| 4,928 | 0.598214 | 0.598214 | 268 | 17.38806 | 16.333927 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.30597 | false | false | 13 |
7c7088bf221b4366f7733ddf490375c0dfa54786 | 14,087,492,769,833 | 3497b36727bfd273553615b832958b6ebaaa802a | /library/src/main/java/monotalk/db/exception/NoTypeSerializerFoundException.java | dd786a643d2617b79cb1aaf8d6a02c4c6eade4db | [
"Apache-2.0"
] | permissive | kemsakurai/MonoTalk | https://github.com/kemsakurai/MonoTalk | dced9f9c7a0d39bb777475bc01fe828c17345f72 | eb2d17a86d457b077858269d43bb388b9c0d1f74 | refs/heads/master | 2020-06-07T23:00:48.636000 | 2015-02-01T17:39:31 | 2015-02-01T17:39:31 | 29,528,004 | 1 | 0 | null | false | 2015-01-28T13:16:15 | 2015-01-20T12:08:00 | 2015-01-28T12:23:12 | 2015-01-28T13:16:15 | 1,200 | 0 | 0 | 0 | Java | null | null | package monotalk.db.exception;
public class NoTypeSerializerFoundException extends RuntimeException {
private static final long serialVersionUID = 2617697703721283015L;
public NoTypeSerializerFoundException(Class<?> type) {
super(String.format("Could not serialize field with class %s, no TypeConverter found.", type.getName()));
}
} | UTF-8 | Java | 357 | java | NoTypeSerializerFoundException.java | Java | [] | null | [] | package monotalk.db.exception;
public class NoTypeSerializerFoundException extends RuntimeException {
private static final long serialVersionUID = 2617697703721283015L;
public NoTypeSerializerFoundException(Class<?> type) {
super(String.format("Could not serialize field with class %s, no TypeConverter found.", type.getName()));
}
} | 357 | 0.764706 | 0.711485 | 11 | 31.545454 | 38.034348 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 13 |
81834de248fde55408593e691fe760ab4c0a5d96 | 10,222,022,222,868 | a14a7f4c082acab026f04f5141cdf1036e10ed69 | /practise_set_7/Q5.java | 16ae5c04a1171f435f70a758e7e55e618824bc6b | [] | no_license | imyogeshgaur/java_practise | https://github.com/imyogeshgaur/java_practise | 04882f89ba7af3171c1aef4e432d91810830873f | 2811cf3481b8bf24118df3843bb354a1c70281b0 | refs/heads/main | 2023-02-10T08:57:52.344000 | 2021-01-07T05:23:23 | 2021-01-07T05:23:23 | 305,073,343 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package practise_set_7;
import java.util.Scanner;
public class Q5 {
static int nfiboTerm(int num) {
if (num == 0) {
return 0;
} else if (num == 1) {
return 1;
} else {
return (nfiboTerm(num - 1) + nfiboTerm(num - 2));
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.printf("Enter the Nth term : ");
int N = sc.nextInt();
sc.close();
int res = nfiboTerm(N);
System.out.printf("The %d term of the Fibonacci Series is : %d", N, res);
}
}
| UTF-8 | Java | 615 | java | Q5.java | Java | [] | null | [] | package practise_set_7;
import java.util.Scanner;
public class Q5 {
static int nfiboTerm(int num) {
if (num == 0) {
return 0;
} else if (num == 1) {
return 1;
} else {
return (nfiboTerm(num - 1) + nfiboTerm(num - 2));
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.printf("Enter the Nth term : ");
int N = sc.nextInt();
sc.close();
int res = nfiboTerm(N);
System.out.printf("The %d term of the Fibonacci Series is : %d", N, res);
}
}
| 615 | 0.513821 | 0.500813 | 24 | 24.625 | 20.136642 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541667 | false | false | 13 |
d6c90a0de188dbdf5b364758763cba29d1ca10ef | 19,739,669,749,682 | b9cb312bcab523f89ea2a7230bede1baa9a7b261 | /app/src/main/java/com/hclz/client/base/log/LogUploadUtil.java | 3c0d23b57b1aeb5facb1f73bdfdca0cb239648b2 | [] | no_license | anan1231230/User2 | https://github.com/anan1231230/User2 | b8a26f038be24446e91517cfaf67f62b4ddccdc2 | 7299a418c981f28f13a1eb0d2f40ac8198e2b1f2 | refs/heads/master | 2020-04-06T22:08:04.370000 | 2018-11-16T07:01:29 | 2018-11-16T07:01:29 | 157,825,699 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hclz.client.base.log;
import android.content.Context;
import com.hclz.client.base.constant.ProjectConstant;
import com.hclz.client.base.http.ExceptionHttpUtil;
import com.hclz.client.base.util.SharedPreferencesUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
/**
* Created by handsome on 16/6/25.
*/
public class LogUploadUtil {
private static Context mContext;
public static void setContext(Context context) {
mContext = context;
}
public static void upload(String content) {
if (mContext == null) {
return;
}
HashMap<String, String> requestParams = new HashMap<String, String>();
final JSONObject jsonContent = new JSONObject();
try {
jsonContent.put(ProjectConstant.APP_USER_MID, SharedPreferencesUtil
.get(mContext, ProjectConstant.APP_USER_MID));
jsonContent.put("app_type", "hclz");
jsonContent.put("ios_android", "android");
jsonContent.put("content", content);
new Thread(new Runnable() {
@Override
public void run() {
ExceptionHttpUtil.sendPost("https://admin.hclz.me/api/error_log/", jsonContent.toString());
}
}).start();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,422 | java | LogUploadUtil.java | Java | [
{
"context": "ect;\n\nimport java.util.HashMap;\n\n/**\n * Created by handsome on 16/6/25.\n */\npublic class LogUploadUtil {\n\n ",
"end": 344,
"score": 0.9994044303894043,
"start": 336,
"tag": "USERNAME",
"value": "handsome"
}
] | null | [] | package com.hclz.client.base.log;
import android.content.Context;
import com.hclz.client.base.constant.ProjectConstant;
import com.hclz.client.base.http.ExceptionHttpUtil;
import com.hclz.client.base.util.SharedPreferencesUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
/**
* Created by handsome on 16/6/25.
*/
public class LogUploadUtil {
private static Context mContext;
public static void setContext(Context context) {
mContext = context;
}
public static void upload(String content) {
if (mContext == null) {
return;
}
HashMap<String, String> requestParams = new HashMap<String, String>();
final JSONObject jsonContent = new JSONObject();
try {
jsonContent.put(ProjectConstant.APP_USER_MID, SharedPreferencesUtil
.get(mContext, ProjectConstant.APP_USER_MID));
jsonContent.put("app_type", "hclz");
jsonContent.put("ios_android", "android");
jsonContent.put("content", content);
new Thread(new Runnable() {
@Override
public void run() {
ExceptionHttpUtil.sendPost("https://admin.hclz.me/api/error_log/", jsonContent.toString());
}
}).start();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
| 1,422 | 0.616034 | 0.612518 | 49 | 28.020409 | 25.139196 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 13 |
6d80de07b4d6c8cf9f6423e2a189190579782cc7 | 24,077,586,708,808 | a5bcbab8c383669c33a2ddb715fdcbc4cc15f616 | /atividade1/app/src/main/java/com/INF311/atividade1/MainActivity.java | 45b666e12d0bb788a7e0ae9a7d4f39e8d3738b59 | [] | no_license | igorgcardoso/INF311 | https://github.com/igorgcardoso/INF311 | 76454b8b018e79869d00e4bb95f9449e04ce16f2 | 80e8be89ef6434eb576d0971a62af3e05f5b63b9 | refs/heads/master | 2023-01-30T02:33:36.844000 | 2020-12-01T20:38:55 | 2020-12-01T20:38:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.INF311.atividade1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void sum(View view) {
double valor1, valor2, res;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
res = valor1 + valor2;
setText(res);
}
public void subtract(View view) {
double valor1, valor2;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
setText(valor1 - valor2);
}
public void multiply(View view) {
double valor1, valor2;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
setText(valor1 * valor2);
}
public void divide(View view) {
double valor1, valor2;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
setText(valor1 / valor2);
}
private double getValor(int id) {
EditText editText = findViewById(id);
return Double.parseDouble(editText.getText().toString());
}
} | UTF-8 | Java | 1,396 | java | MainActivity.java | Java | [] | null | [] | package com.INF311.atividade1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void sum(View view) {
double valor1, valor2, res;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
res = valor1 + valor2;
setText(res);
}
public void subtract(View view) {
double valor1, valor2;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
setText(valor1 - valor2);
}
public void multiply(View view) {
double valor1, valor2;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
setText(valor1 * valor2);
}
public void divide(View view) {
double valor1, valor2;
valor1 = getValor(R.id.valor1);
valor2 = getValor(R.id.valor2);
setText(valor1 / valor2);
}
private double getValor(int id) {
EditText editText = findViewById(id);
return Double.parseDouble(editText.getText().toString());
}
} | 1,396 | 0.636819 | 0.611032 | 64 | 20.828125 | 18.919695 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.515625 | false | false | 13 |
36bf4eb7e4b8fdda8adc6ade5f8267b675ed2252 | 20,512,763,876,835 | 6056d7012532b6ab1b488676b5ec4975e3ae3a7b | /Final Boom/src/com/anvil/android/boom/logic/scoring/StatusUpdateMessage.java | a9e06be7b6a7659eeb61a18c1a78a5d1bd9c461d | [] | no_license | CrypticRage/boom-mobile | https://github.com/CrypticRage/boom-mobile | 7940c84a77286c0fdcd721190bca087bfe0afa6f | 6d87866094124c68adc4a7d1ebda653085164561 | refs/heads/master | 2020-03-29T22:50:07.615000 | 2008-04-20T05:38:00 | 2008-04-20T05:38:00 | 32,407,095 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.anvil.android.boom.logic.scoring;
public class StatusUpdateMessage
{
public int mScoreChange;
public StatusUpdateMessage ()
{
mScoreChange = 0;
}
public StatusUpdateMessage (int points)
{
mScoreChange = points;
}
} | UTF-8 | Java | 257 | java | StatusUpdateMessage.java | Java | [] | null | [] | package com.anvil.android.boom.logic.scoring;
public class StatusUpdateMessage
{
public int mScoreChange;
public StatusUpdateMessage ()
{
mScoreChange = 0;
}
public StatusUpdateMessage (int points)
{
mScoreChange = points;
}
} | 257 | 0.696498 | 0.692607 | 16 | 14.1875 | 15.633372 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.0625 | false | false | 13 |
9e5a5b2d59f8fd75e1719ba975b4914180506e61 | 28,174,985,482,433 | 4158e45be3426f7ea4f7ba013cc211ff3163f613 | /src/main/java/com/gmail/fingrambbg/goodvibes/GoodVibes.java | 2a87e92882994b250e6a12fe5b14f54c89d61d42 | [] | no_license | CaliburnS3/GoodVibes | https://github.com/CaliburnS3/GoodVibes | 6f3c16df4a46102eecb43f9b36958df4659fa253 | aafec32a792c5b10acc8e824b4b318379fbfebbd | refs/heads/master | 2022-10-26T05:36:20.111000 | 2020-06-21T00:26:05 | 2020-06-21T00:26:05 | 273,806,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gmail.fingrambbg.goodvibes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.*;
public class GoodVibes extends JavaPlugin {
public static Plugin plugin;
List<String> encourage;
Random rand = new Random();
int cooldownTime = 10;
HashMap<Player, Long> hashy = new HashMap<Player, Long>();
private enum Phases {
ENABLE, DISABLE
}
Phases phase;
FileConfiguration config = this.getConfig();
@Override
public void onEnable() {
plugin = this;
this.getConfig();
phase = Phases.DISABLE;
encourage = new ArrayList<String>();
getLogger().info("GoodVibes enabled");
init();
}
@Override
public void onDisable() {
phase = Phases.DISABLE;
this.saveDefaultConfig();
getLogger().info("GoodVibes disabled");
}
@SuppressWarnings("unchecked")
public void init() {
encourage.clear();
encourage = (List<String>) config.getList("path.to.list");
this.getConfig().set("path.to.list", encourage);
config.options().copyDefaults(true);
saveConfig();
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player){
if (hashy.containsKey((Player) sender)) {
long secondsLeft = ((hashy.get((Player) sender) / 1000) + cooldownTime)
- (System.currentTimeMillis() / 1000);
if (secondsLeft > 0) {
// Still cooling down
sender.sendMessage(
ChatColor.GOLD + "You cant use that commands for another " + secondsLeft + " seconds!");
return true;
}
}
}
if (cmd.getName().equalsIgnoreCase("celebrate")) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equals(args[0])) {
targeted(player);
hashy.put((Player) sender, System.currentTimeMillis());
return true;
}
}
return true;
}
if (cmd.getName().equalsIgnoreCase("encourage")) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equals(args[0])) {
String temp = encourage.get(rand.nextInt(encourage.size()));
String result = temp.replace("FILLER", sender.getName().toString());
player.sendMessage(ChatColor.GOLD + result);
sender.sendMessage(ChatColor.GOLD + "To " + player.getName() + ": " + result);
hashy.put((Player) sender, System.currentTimeMillis());
return true;
}
}
return true;
}
if (cmd.getName().equalsIgnoreCase("rcelebrate")) {
int temp = rand.nextInt(Bukkit.getOnlinePlayers().size());
int count = 0;
if(Bukkit.getOnlinePlayers().size() < 1){ return true; }
for (Player player : Bukkit.getOnlinePlayers()){
if(count == temp){
targeted(player);
hashy.put((Player) sender, System.currentTimeMillis());
return true;
}
count++;
}
return true;
}
return true;
}
public void targeted(Player target) {
target.sendMessage(ChatColor.GOLD + "We appreciate you! We hope you know that!");
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (!player.equals(target)) {
player.sendMessage(ChatColor.GOLD + "To show your appreciation to " + target.getName()
+ " do /encourage " + target.getName());
}
}
}
}
| UTF-8 | Java | 3,469 | java | GoodVibes.java | Java | [
{
"context": "package com.gmail.fingrambbg.goodvibes;\n\nimport java.util.ArrayList;\nimport ja",
"end": 28,
"score": 0.9785997271537781,
"start": 18,
"tag": "USERNAME",
"value": "fingrambbg"
},
{
"context": "rage.size()));\n\t\t\t\t\tString result = temp.replace(\"FILLER\", sender.g... | null | [] | package com.gmail.fingrambbg.goodvibes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.*;
public class GoodVibes extends JavaPlugin {
public static Plugin plugin;
List<String> encourage;
Random rand = new Random();
int cooldownTime = 10;
HashMap<Player, Long> hashy = new HashMap<Player, Long>();
private enum Phases {
ENABLE, DISABLE
}
Phases phase;
FileConfiguration config = this.getConfig();
@Override
public void onEnable() {
plugin = this;
this.getConfig();
phase = Phases.DISABLE;
encourage = new ArrayList<String>();
getLogger().info("GoodVibes enabled");
init();
}
@Override
public void onDisable() {
phase = Phases.DISABLE;
this.saveDefaultConfig();
getLogger().info("GoodVibes disabled");
}
@SuppressWarnings("unchecked")
public void init() {
encourage.clear();
encourage = (List<String>) config.getList("path.to.list");
this.getConfig().set("path.to.list", encourage);
config.options().copyDefaults(true);
saveConfig();
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player){
if (hashy.containsKey((Player) sender)) {
long secondsLeft = ((hashy.get((Player) sender) / 1000) + cooldownTime)
- (System.currentTimeMillis() / 1000);
if (secondsLeft > 0) {
// Still cooling down
sender.sendMessage(
ChatColor.GOLD + "You cant use that commands for another " + secondsLeft + " seconds!");
return true;
}
}
}
if (cmd.getName().equalsIgnoreCase("celebrate")) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equals(args[0])) {
targeted(player);
hashy.put((Player) sender, System.currentTimeMillis());
return true;
}
}
return true;
}
if (cmd.getName().equalsIgnoreCase("encourage")) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equals(args[0])) {
String temp = encourage.get(rand.nextInt(encourage.size()));
String result = temp.replace("FILLER", sender.getName().toString());
player.sendMessage(ChatColor.GOLD + result);
sender.sendMessage(ChatColor.GOLD + "To " + player.getName() + ": " + result);
hashy.put((Player) sender, System.currentTimeMillis());
return true;
}
}
return true;
}
if (cmd.getName().equalsIgnoreCase("rcelebrate")) {
int temp = rand.nextInt(Bukkit.getOnlinePlayers().size());
int count = 0;
if(Bukkit.getOnlinePlayers().size() < 1){ return true; }
for (Player player : Bukkit.getOnlinePlayers()){
if(count == temp){
targeted(player);
hashy.put((Player) sender, System.currentTimeMillis());
return true;
}
count++;
}
return true;
}
return true;
}
public void targeted(Player target) {
target.sendMessage(ChatColor.GOLD + "We appreciate you! We hope you know that!");
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (!player.equals(target)) {
player.sendMessage(ChatColor.GOLD + "To show your appreciation to " + target.getName()
+ " do /encourage " + target.getName());
}
}
}
}
| 3,469 | 0.678582 | 0.674258 | 126 | 26.531746 | 23.336628 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.65873 | false | false | 13 |
a2d4d563fab99cf277e73ab63a32db170c080b28 | 20,925,080,694,611 | e7ba71f0f69b9abf1c2f29b385afb2f7d0385b63 | /src/main/java/com/consult/app/request/yunma/CloseBidRequest.java | 94fde1e32adb2828d63a29b64463b900bf5d6fb4 | [] | no_license | likaiwalkman/specialline | https://github.com/likaiwalkman/specialline | 3038d25308069bd93ee7038a36ab5944d0df0137 | 11bab856af2e53fbbdcdf63fac9b2c7c99b9c74a | refs/heads/master | 2018-01-09T21:48:36.564000 | 2015-11-23T09:39:14 | 2015-11-23T09:39:14 | 46,710,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.consult.app.request.yunma;
/**
* Created by Administrator on 2015/10/28.
*/
public class CloseBidRequest{
private Long ymCargoOrderId;
public Long getYmCargoOrderId() {
return ymCargoOrderId;
}
public void setYmCargoOrderId(Long ymCargoOrderId) {
this.ymCargoOrderId = ymCargoOrderId;
}
public static int checkParameters(CloseBidRequest req) {
if (req == null || req.getYmCargoOrderId() < 0)
return 0;
return 1;
}
}
| UTF-8 | Java | 506 | java | CloseBidRequest.java | Java | [
{
"context": " com.consult.app.request.yunma;\n\n/**\n * Created by Administrator on 2015/10/28.\n */\npublic class CloseBidRequest{\n",
"end": 71,
"score": 0.6343291997909546,
"start": 58,
"tag": "USERNAME",
"value": "Administrator"
}
] | null | [] | package com.consult.app.request.yunma;
/**
* Created by Administrator on 2015/10/28.
*/
public class CloseBidRequest{
private Long ymCargoOrderId;
public Long getYmCargoOrderId() {
return ymCargoOrderId;
}
public void setYmCargoOrderId(Long ymCargoOrderId) {
this.ymCargoOrderId = ymCargoOrderId;
}
public static int checkParameters(CloseBidRequest req) {
if (req == null || req.getYmCargoOrderId() < 0)
return 0;
return 1;
}
}
| 506 | 0.65415 | 0.632411 | 22 | 22 | 20.564754 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 13 |
6a3c3396b54990ae3d512f184b5f5233e2928bd3 | 1,030,792,173,162 | 6da3e449ca48ce0bb90d1d95d74f34f65620f0c2 | /src/test/java/com/dongdong/spring/test/alBook/unit04Recursion/Class02_MatrixMaxPath.java | 7dabc94a57b0491d11f9fd40f22bac53397da60a | [] | no_license | PangDongdon/spring-study | https://github.com/PangDongdon/spring-study | 44ae036f6bc1b948ffdd45f9f49590476f439597 | 8b504669da85b9be6c8c18548a05cb86174c3da8 | refs/heads/master | 2023-04-13T23:33:28.869000 | 2023-04-09T08:09:00 | 2023-04-09T08:09:00 | 207,733,588 | 0 | 0 | null | false | 2022-06-29T17:38:27 | 2019-09-11T05:52:20 | 2021-11-08T02:10:31 | 2022-06-29T17:38:24 | 785 | 0 | 0 | 4 | Java | false | false | package com.dongdong.spring.test.alBook.unit04Recursion;
//矩阵的最大路径
public class Class02_MatrixMaxPath {
public static int minPathSum1(int[][] arr) {
if (arr == null || arr.length < 1 || arr[0] == null || arr[0].length < 1) {
return 0;
}
int[][] dp = new int[arr.length][arr[0].length];
dp[0][0] = arr[0][0];
for (int i = 1; i < arr.length; i++) {
dp[i][0] = dp[i - 1][0] + arr[i][0];
}
for (int j = 1; j < arr[0].length; j++) {
dp[0][j] = dp[0][j - 1] + arr[0][j];
}
for (int i = 1; i < arr.length; i++) {
for (int j = 1; j < arr[0].length; j++) {
dp[i][j] = Math.min(dp[i - 1][j], dp[i][j - 1]) + arr[i][j];
}
}
return dp[arr.length - 1][arr.length - 1];
}
//空间压缩
public static int minPathSum2(int[][] m) {
if (m == null || m.length < 1 || m[0] == null || m[0].length < 1) {
return 0;
}
int more = Math.max(m.length, m[0].length);//行数与列数较大的那个为more
int less = Math.min(m.length, m[0].length);//行数与列数较大的那个为less
boolean rowmore = more == m.length;//行数是不是大于或等于列数
int[] arr = new int[less];//辅助数组的长度仅为行数与列数中的最小值
arr[0] = m[0][0];
for (int i = 1; i < less; i++) {
arr[i] = arr[i - 1] + (rowmore ? m[0][i] : m[i][0]);
}
for (int i = 1; i < more; i++) {
arr[0] = arr[0] + (rowmore ? m[0][i] : m[i][0]);
for (int j = 1; j < less; j++) {
arr[j] = Math.min(arr[j - 1], arr[j]) + (rowmore ? m[i][j] : m[j][i]);
}
}
return arr[less - 1];
}
public static void main(String[] args) {
int[][] arr = {{1, 3, 5, 9}, {8, 1, 3, 4}, {5, 0, 6, 1}, {8, 8, 4, 0}};
System.out.println(minPathSum2(arr));
}
}
| UTF-8 | Java | 1,996 | java | Class02_MatrixMaxPath.java | Java | [] | null | [] | package com.dongdong.spring.test.alBook.unit04Recursion;
//矩阵的最大路径
public class Class02_MatrixMaxPath {
public static int minPathSum1(int[][] arr) {
if (arr == null || arr.length < 1 || arr[0] == null || arr[0].length < 1) {
return 0;
}
int[][] dp = new int[arr.length][arr[0].length];
dp[0][0] = arr[0][0];
for (int i = 1; i < arr.length; i++) {
dp[i][0] = dp[i - 1][0] + arr[i][0];
}
for (int j = 1; j < arr[0].length; j++) {
dp[0][j] = dp[0][j - 1] + arr[0][j];
}
for (int i = 1; i < arr.length; i++) {
for (int j = 1; j < arr[0].length; j++) {
dp[i][j] = Math.min(dp[i - 1][j], dp[i][j - 1]) + arr[i][j];
}
}
return dp[arr.length - 1][arr.length - 1];
}
//空间压缩
public static int minPathSum2(int[][] m) {
if (m == null || m.length < 1 || m[0] == null || m[0].length < 1) {
return 0;
}
int more = Math.max(m.length, m[0].length);//行数与列数较大的那个为more
int less = Math.min(m.length, m[0].length);//行数与列数较大的那个为less
boolean rowmore = more == m.length;//行数是不是大于或等于列数
int[] arr = new int[less];//辅助数组的长度仅为行数与列数中的最小值
arr[0] = m[0][0];
for (int i = 1; i < less; i++) {
arr[i] = arr[i - 1] + (rowmore ? m[0][i] : m[i][0]);
}
for (int i = 1; i < more; i++) {
arr[0] = arr[0] + (rowmore ? m[0][i] : m[i][0]);
for (int j = 1; j < less; j++) {
arr[j] = Math.min(arr[j - 1], arr[j]) + (rowmore ? m[i][j] : m[j][i]);
}
}
return arr[less - 1];
}
public static void main(String[] args) {
int[][] arr = {{1, 3, 5, 9}, {8, 1, 3, 4}, {5, 0, 6, 1}, {8, 8, 4, 0}};
System.out.println(minPathSum2(arr));
}
}
| 1,996 | 0.436296 | 0.397216 | 53 | 34.245281 | 25.688927 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.226415 | false | false | 13 |
1e9eaeb184dde15b77af5c0a4f2b75cbda057861 | 13,271,449,005,416 | 3e3619ffce613b46f021c7eb45b6a907ff2af0e6 | /src/MyPackage_17/SpringTests.java | 0b8162a3155f37bf5c4428209f57e0da879a1192 | [] | no_license | dmitriyaux/Work_MyProject_01_Repo | https://github.com/dmitriyaux/Work_MyProject_01_Repo | c5f4503052cd09bbf49365f33eb4ead8ca271d06 | 21cf8c3b74ce1896108edefff1c9d6ca04763a72 | refs/heads/master | 2018-03-28T12:52:41.820000 | 2017-11-23T15:26:10 | 2017-11-23T15:26:10 | 87,527,044 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package MyPackage_17;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
* Created by Dmitriy on 16.05.2017.
*/
public class SpringTests {
public static void main(String[] args) {
// ApplicationContext cntxt = new ClassPathXmlApplicationContext();
ApplicationContext cntxt = new FileSystemXmlApplicationContext("SpringConfigFile.xml");
// System.out.println(cntxt.getBean("spring"));
// System.out.println(cntxt.getBean("sparta")==cntxt.getBean("sparta"));
((BB1)cntxt.getBean(BB1.class)).m();
}
}
class Spring{
public Spring() {
}
public Spring(String s) {
System.out.println("Constructor with String: "+s);
}
public Spring(int i) {
System.out.println("Constructor with int: "+i);
}
public Spring(int i, String s) {
System.out.println("Constructor with int: "+i+" and with String: "+s);
}
@Override
public String toString() {
return "This is Spring!";
}
}
class AA1{
AA1(){
System.out.println("AA1!");
}
}
class BB1{
BB1(){
System.out.println("BB1!");}
void m(){
System.out.println("X");
}
} | UTF-8 | Java | 1,331 | java | SpringTests.java | Java | [
{
"context": "ileSystemXmlApplicationContext;\n\n/**\n * Created by Dmitriy on 16.05.2017.\n */\npublic class SpringTests {\n ",
"end": 255,
"score": 0.9963670969009399,
"start": 248,
"tag": "NAME",
"value": "Dmitriy"
}
] | null | [] | package MyPackage_17;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
* Created by Dmitriy on 16.05.2017.
*/
public class SpringTests {
public static void main(String[] args) {
// ApplicationContext cntxt = new ClassPathXmlApplicationContext();
ApplicationContext cntxt = new FileSystemXmlApplicationContext("SpringConfigFile.xml");
// System.out.println(cntxt.getBean("spring"));
// System.out.println(cntxt.getBean("sparta")==cntxt.getBean("sparta"));
((BB1)cntxt.getBean(BB1.class)).m();
}
}
class Spring{
public Spring() {
}
public Spring(String s) {
System.out.println("Constructor with String: "+s);
}
public Spring(int i) {
System.out.println("Constructor with int: "+i);
}
public Spring(int i, String s) {
System.out.println("Constructor with int: "+i+" and with String: "+s);
}
@Override
public String toString() {
return "This is Spring!";
}
}
class AA1{
AA1(){
System.out.println("AA1!");
}
}
class BB1{
BB1(){
System.out.println("BB1!");}
void m(){
System.out.println("X");
}
} | 1,331 | 0.642374 | 0.62885 | 54 | 23.666666 | 25.900093 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.314815 | false | false | 13 |
aef63b8d443f9b8b62f4bd320f0f19e80e7d26fe | 26,079,041,471,675 | 6e60333a2b83e679b1b8146b6d80e353be3e9d04 | /api/src/main/java/com/fmatheus/app/controller/enumerable/MessagesEnum.java | fa67c0ee5c8627152d6bde6be3b2695da5f13cde | [] | no_license | fmatheus21/Livraria | https://github.com/fmatheus21/Livraria | 9008565f725ce1c7b5c5228caf39763ad6c199c5 | 67a4741755c3d92cdf3b7858762a29b5bc3ce875 | refs/heads/master | 2023-03-08T02:14:23.947000 | 2021-02-23T06:36:45 | 2021-02-23T06:36:45 | 340,773,132 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fmatheus.app.controller.enumerable;
import lombok.Getter;
public enum MessagesEnum {
SUCCESS_CREATE("message.success.create"),
SUCCESS_UPDATE("message.success.update"),
SUCCESS_DELETE("message.success.delete"),
ERROR_NOT_READABLE("message.error.not.readable"),
ERROR_NOT_FOUND("message.error.not.found"),
ERROR_REGISTER_EXIST("message.error.register.exist"),
ERROR_NOT_PERMISSION("message.error.not.permission"),
ERROR_BAD_REQUEST("message.error.bad.request"),
ERROR_ISBN_EXIST("message.error.isbn.exist");
@Getter
private final String description;
MessagesEnum(String description) {
this.description = description;
}
}
| UTF-8 | Java | 698 | java | MessagesEnum.java | Java | [] | null | [] | package com.fmatheus.app.controller.enumerable;
import lombok.Getter;
public enum MessagesEnum {
SUCCESS_CREATE("message.success.create"),
SUCCESS_UPDATE("message.success.update"),
SUCCESS_DELETE("message.success.delete"),
ERROR_NOT_READABLE("message.error.not.readable"),
ERROR_NOT_FOUND("message.error.not.found"),
ERROR_REGISTER_EXIST("message.error.register.exist"),
ERROR_NOT_PERMISSION("message.error.not.permission"),
ERROR_BAD_REQUEST("message.error.bad.request"),
ERROR_ISBN_EXIST("message.error.isbn.exist");
@Getter
private final String description;
MessagesEnum(String description) {
this.description = description;
}
}
| 698 | 0.716332 | 0.716332 | 24 | 28.083334 | 21.863052 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541667 | false | false | 13 |
725873bca967b6f185d1ef0fba1a3a3921f8dd23 | 9,509,057,658,367 | 3c5290babae0130934623ce9c639564e4fb4ac4e | /src/main/java/es/ual/itsi/prestashopsoap/Request.java | d042cd0b3ecfbccc9f3ea0eb608b7cc839df1c38 | [
"Apache-2.0"
] | permissive | zerasul/PrestashopDolibarESB | https://github.com/zerasul/PrestashopDolibarESB | 9bfbbe737b58d1cb6e43ecaf52ef1d786d0fcf34 | c88fbaff00b8b5c05d671e23f26aa5f712d5009f | refs/heads/master | 2016-09-10T09:00:55.264000 | 2015-02-25T09:57:36 | 2015-02-25T09:57:36 | 31,307,226 | 0 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package es.ual.itsi.prestashopsoap;
import java.util.HashMap;
import java.util.Map;
public class Request {
public static final String BEPRODUCTS="PRODUCTS";
public static final String BECLIENTS="CLIENTS";
private Map<String,Object> parameters;
private String be;
private String op;
public Request() {
this.parameters= new HashMap<String, Object>();
this.be="";
this.op="";
}
public Map<String, Object> getParameters() {
return parameters;
}
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
public String getBe() {
return be;
}
public void setBe(String be) {
this.be = be;
}
public String getOp() {
return op;
}
public void setOp(String op) {
this.op = op;
}
public String toString(){
String salida ="";
salida+= "Parameters: "+ parameters.toString()+"\n";
salida+= "be: " + be+"\n";
salida+= "op: " + op+"\n";
return salida;
}
public Object getParameter(String name){
Object value=(this.parameters.get(name)!=null)?this.parameters.get(name):"";
return value;
}
}
| UTF-8 | Java | 1,073 | java | Request.java | Java | [] | null | [] | package es.ual.itsi.prestashopsoap;
import java.util.HashMap;
import java.util.Map;
public class Request {
public static final String BEPRODUCTS="PRODUCTS";
public static final String BECLIENTS="CLIENTS";
private Map<String,Object> parameters;
private String be;
private String op;
public Request() {
this.parameters= new HashMap<String, Object>();
this.be="";
this.op="";
}
public Map<String, Object> getParameters() {
return parameters;
}
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
public String getBe() {
return be;
}
public void setBe(String be) {
this.be = be;
}
public String getOp() {
return op;
}
public void setOp(String op) {
this.op = op;
}
public String toString(){
String salida ="";
salida+= "Parameters: "+ parameters.toString()+"\n";
salida+= "be: " + be+"\n";
salida+= "op: " + op+"\n";
return salida;
}
public Object getParameter(String name){
Object value=(this.parameters.get(name)!=null)?this.parameters.get(name):"";
return value;
}
}
| 1,073 | 0.676608 | 0.676608 | 51 | 20.039215 | 18.305641 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.72549 | false | false | 13 |
caf2cfbf36cee82800ded1c48346ed4fecef6f66 | 22,797,686,473,839 | cfb4953e2e523613e4c8d513a48e55c4b7a4b01b | /usercase/src/junit/test/BookDaoTest.java | c20cdbb675e3adced69543d17991f69e73a3a1df | [] | no_license | yozzs/mygit | https://github.com/yozzs/mygit | 89cc09deea19591cba81de6254395387cbfb1ce7 | 8fb5fa7b1f408fb4d0859bd4f54d630db68d17cb | refs/heads/master | 2020-03-23T09:34:35.721000 | 2019-01-25T09:19:18 | 2019-01-25T09:19:18 | 141,396,337 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: BookDaoTest.java
package junit.test;
import org.junit.Test;
import com.youzi.dao.BookDao;
import com.youzi.dao.impl.BookDaoImpl;
public class BookDaoTest
{
public BookDaoTest()
{
}
@Test
public void testAdd()
{
BookDao dao = new BookDaoImpl();
String bookname = "浮生闲情";
String author = "陈佳煌";
String press = "阳新一中出版社";
double price = 38.90;
String imguri = "book36.jpg";
String msg1 = "秋雨丝丝洒枝头,烟缕织成愁,遥望落花满地残红,曾也枝头盈盈娉婷,装饰他人梦。如今花落簌簌,曾绚烂美好刹那芳华。看那花瓣上的珍珠,不甚清风的摆动,悄然滑落,那不舍的是离愁,尘缘已过,聚散匆匆。不需忧伤,花儿,不会因为离枝而失去芬芳;草儿,不会因为寒冬而放弃生的希望。今年花胜去年红,明年花更好,花开最美,不负这红尘人间。生命的旅途,总会有千回百转,悲喜寒凉,季节的辗转,绮丽的风景。若是懂得,这都是生活赋予的美好。";
String msg11 = "细数走过的岁月,欢乐伴着忧伤。在时光的深处中,最美的永远艳丽多彩不褪色,那些伤痛,时间久了也就模糊不清,留下的记忆也是残缺碎片。遇到不满意时,总会拿过去的好作比较,留恋过去,讨厌现在,始不知过去也是现在,现在也会过去。行走红尘人间,做个随遇而安的草木女子,让清风拂袖,心香暖怀。生命的旅途,总会有千回百转,悲喜寒凉,季节的辗转,绮丽的风景。若是懂得,这都是生活赋予的美好。";
String msg111 = "故作神游,忍不住躺在了油菜花里,生活中所有的烦恼都不存在了,跑上了云霄,跑到了你我顾虑不到而遥远的地方,动情地看着天空发呆,天空是如此的蓝,白云是多么的飘逸,耳畔窸窸窣窣的声响顿时都构成了大自然最动听的乐曲。淡淡的,清幽的花香让人不自觉地忘了自己,仿佛与天地同在,与日月同辉,悄然四顾,没有喧嚣,没有离愁,我们也成为了大自然最透明的一份子。醉了,天空醉了,我醉了,你也醉了,醉了尘世间的纷纷扰扰,醉了人世间一切是是非非、恩恩怨怨,醉了一世琉璃";
String msg1111 = "人生如戏,我们上演着悲欢离合,试过欢声笑语,也试过痛哭流涕,别人可能会以为我们表演得太夸张,其实那都是我们最真实的反应,细数走过的岁月,欢乐伴着忧伤。在时光的深处中,最美的永远艳丽多彩不褪色,那些伤痛,时间久了也就模糊不清,留下的记忆也是残缺碎片。遇到不满意时,总会拿过去的好作比较,留恋过去,讨厌现在,始不知过去也是现在,现在也会过去。行走红尘人间,做个随遇而安的草木女子,让清风拂袖,心香暖怀。生命的旅途,总会有千回百转,悲喜寒凉,季节的辗转,绮丽的风景。若是懂得,这都是生活赋予的美好。";
dao.add(bookname, author, press, price, msg111, imguri);
}
}
| GB18030 | Java | 3,346 | java | BookDaoTest.java | Java | [
{
"context": "// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://kpdus.tripod.com/jad.ht",
"end": 62,
"score": 0.999692976474762,
"start": 46,
"tag": "NAME",
"value": "Pavel Kouznetsov"
},
{
"context": ");\n\t\tString bookname = \"浮生闲情\";\n\t\tS... | null | [] | // Decompiled by Jad v1.5.8e2. Copyright 2001 <NAME>.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: BookDaoTest.java
package junit.test;
import org.junit.Test;
import com.youzi.dao.BookDao;
import com.youzi.dao.impl.BookDaoImpl;
public class BookDaoTest
{
public BookDaoTest()
{
}
@Test
public void testAdd()
{
BookDao dao = new BookDaoImpl();
String bookname = "浮生闲情";
String author = "陈佳煌";
String press = "阳新一中出版社";
double price = 38.90;
String imguri = "book36.jpg";
String msg1 = "秋雨丝丝洒枝头,烟缕织成愁,遥望落花满地残红,曾也枝头盈盈娉婷,装饰他人梦。如今花落簌簌,曾绚烂美好刹那芳华。看那花瓣上的珍珠,不甚清风的摆动,悄然滑落,那不舍的是离愁,尘缘已过,聚散匆匆。不需忧伤,花儿,不会因为离枝而失去芬芳;草儿,不会因为寒冬而放弃生的希望。今年花胜去年红,明年花更好,花开最美,不负这红尘人间。生命的旅途,总会有千回百转,悲喜寒凉,季节的辗转,绮丽的风景。若是懂得,这都是生活赋予的美好。";
String msg11 = "细数走过的岁月,欢乐伴着忧伤。在时光的深处中,最美的永远艳丽多彩不褪色,那些伤痛,时间久了也就模糊不清,留下的记忆也是残缺碎片。遇到不满意时,总会拿过去的好作比较,留恋过去,讨厌现在,始不知过去也是现在,现在也会过去。行走红尘人间,做个随遇而安的草木女子,让清风拂袖,心香暖怀。生命的旅途,总会有千回百转,悲喜寒凉,季节的辗转,绮丽的风景。若是懂得,这都是生活赋予的美好。";
String msg111 = "故作神游,忍不住躺在了油菜花里,生活中所有的烦恼都不存在了,跑上了云霄,跑到了你我顾虑不到而遥远的地方,动情地看着天空发呆,天空是如此的蓝,白云是多么的飘逸,耳畔窸窸窣窣的声响顿时都构成了大自然最动听的乐曲。淡淡的,清幽的花香让人不自觉地忘了自己,仿佛与天地同在,与日月同辉,悄然四顾,没有喧嚣,没有离愁,我们也成为了大自然最透明的一份子。醉了,天空醉了,我醉了,你也醉了,醉了尘世间的纷纷扰扰,醉了人世间一切是是非非、恩恩怨怨,醉了一世琉璃";
String msg1111 = "人生如戏,我们上演着悲欢离合,试过欢声笑语,也试过痛哭流涕,别人可能会以为我们表演得太夸张,其实那都是我们最真实的反应,细数走过的岁月,欢乐伴着忧伤。在时光的深处中,最美的永远艳丽多彩不褪色,那些伤痛,时间久了也就模糊不清,留下的记忆也是残缺碎片。遇到不满意时,总会拿过去的好作比较,留恋过去,讨厌现在,始不知过去也是现在,现在也会过去。行走红尘人间,做个随遇而安的草木女子,让清风拂袖,心香暖怀。生命的旅途,总会有千回百转,悲喜寒凉,季节的辗转,绮丽的风景。若是懂得,这都是生活赋予的美好。";
dao.add(bookname, author, press, price, msg111, imguri);
}
}
| 3,336 | 0.78803 | 0.770574 | 35 | 44.828571 | 71.224586 | 268 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.457143 | false | false | 13 |
81d182fa96d002ab3f393f6d4bf3ab0152603a8d | 2,422,361,604,881 | e6b628e14cabb57373ee68fe46044e99be4e2464 | /src/main/java/tiku/niuke/huawei/HJ70Main.java | e068757286695008bfa5623c870569c9153ec384 | [] | no_license | cqdxwjd/java_in_action | https://github.com/cqdxwjd/java_in_action | 7dd6f41c410f0b00204fe62b649a39d63d40b655 | a7c274d7886ad0fc32a025bbbec1001840ca0484 | refs/heads/master | 2022-10-07T00:13:23.656000 | 2022-08-24T09:37:28 | 2022-08-24T09:37:28 | 264,957,502 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tiku.niuke.huawei;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* @author wangjingdong
* @date 2021/11/4 11:09
* @Copyright © 云粒智慧 2018
*/
public class HJ70Main {
static class Node {
int x;
int y;
public Node(int x, int y) {
this.x = x;
this.y = y;
}
}
public static int compute(String rule, List<Node> list) {
int i = rule.lastIndexOf("(");
int j = rule.indexOf(")");
Node node1 = null;
Node node2 = null;
while (i > j) {
j = rule.indexOf(")", j + 1);
}
if (i <= 0 && rule.length() == 4) {
node1 = list.get(rule.charAt(1) - 65);
node2 = list.get(rule.charAt(2) - 65);
return node1.x * node1.y * node2.y;
} else if (i <= 0 && rule.length() > 4) {
return 0;
} else {
String sub = rule.substring(i + 1, j);
node1 = list.get(sub.charAt(0) - 65);
node2 = list.get(sub.charAt(sub.length() - 1) - 65);
int init = 0;
if (sub.length() == 2) {
init = node1.x * node1.y * node2.y;
}
char c1 = rule.charAt(i - 1);
char c2 = rule.charAt(j + 1);
if (c2 >= 65 && c2 <= 90) {
int last = j + 2;
int index = j + 1;
while (rule.charAt(last) >= 65 && rule.charAt(last) <= 90) {
index = last;
last++;
}
Node node = list.get(c2 - 65);
Node node3 = list.get(rule.charAt(index) - 65);
return init + node1.x * node.x * node3.y + compute(rule.substring(0, i) + sub + rule.substring(j + 1), list);
} else if (c1 >= 65 && c1 <= 90) {
Node node = list.get(c1 - 65);
return init + node.x * node.y * node2.y + compute(rule.substring(0, i) + sub + rule.substring(j + 1), list);
} else {
return init + compute(rule.substring(0, i) + sub + rule.substring(j + 1), list);
}
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
ArrayList<Node> list = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
list.add(new Node(sc.nextInt(), sc.nextInt()));
}
System.out.println(compute(sc.next(), list));
}
sc.close();
}
}
| UTF-8 | Java | 2,603 | java | HJ70Main.java | Java | [
{
"context": "il.List;\nimport java.util.Scanner;\n\n/**\n * @author wangjingdong\n * @date 2021/11/4 11:09\n * @Copyright © 云",
"end": 126,
"score": 0.6758967041969299,
"start": 121,
"tag": "USERNAME",
"value": "wangj"
},
{
"context": "t;\nimport java.util.Scanner;\n\n/**\n * @autho... | null | [] | package tiku.niuke.huawei;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* @author wangjingdong
* @date 2021/11/4 11:09
* @Copyright © 云粒智慧 2018
*/
public class HJ70Main {
static class Node {
int x;
int y;
public Node(int x, int y) {
this.x = x;
this.y = y;
}
}
public static int compute(String rule, List<Node> list) {
int i = rule.lastIndexOf("(");
int j = rule.indexOf(")");
Node node1 = null;
Node node2 = null;
while (i > j) {
j = rule.indexOf(")", j + 1);
}
if (i <= 0 && rule.length() == 4) {
node1 = list.get(rule.charAt(1) - 65);
node2 = list.get(rule.charAt(2) - 65);
return node1.x * node1.y * node2.y;
} else if (i <= 0 && rule.length() > 4) {
return 0;
} else {
String sub = rule.substring(i + 1, j);
node1 = list.get(sub.charAt(0) - 65);
node2 = list.get(sub.charAt(sub.length() - 1) - 65);
int init = 0;
if (sub.length() == 2) {
init = node1.x * node1.y * node2.y;
}
char c1 = rule.charAt(i - 1);
char c2 = rule.charAt(j + 1);
if (c2 >= 65 && c2 <= 90) {
int last = j + 2;
int index = j + 1;
while (rule.charAt(last) >= 65 && rule.charAt(last) <= 90) {
index = last;
last++;
}
Node node = list.get(c2 - 65);
Node node3 = list.get(rule.charAt(index) - 65);
return init + node1.x * node.x * node3.y + compute(rule.substring(0, i) + sub + rule.substring(j + 1), list);
} else if (c1 >= 65 && c1 <= 90) {
Node node = list.get(c1 - 65);
return init + node.x * node.y * node2.y + compute(rule.substring(0, i) + sub + rule.substring(j + 1), list);
} else {
return init + compute(rule.substring(0, i) + sub + rule.substring(j + 1), list);
}
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
ArrayList<Node> list = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
list.add(new Node(sc.nextInt(), sc.nextInt()));
}
System.out.println(compute(sc.next(), list));
}
sc.close();
}
}
| 2,603 | 0.451041 | 0.41596 | 78 | 32.256409 | 24.62146 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 13 |
eda018315957cae652544cb7f2d641a10c7c62b1 | 6,124,623,412,036 | c047a8320ea9b783dd9ded0d062c7e110b3ad962 | /shelfs-api/src/test/java/de/treona/shelfs/api/pluginLoader/PluginLoaderTest.java | 51e56c67d22d41c6615e1d90b267ef2e51037f34 | [
"Apache-2.0"
] | permissive | Cerberus-ik/shelfs | https://github.com/Cerberus-ik/shelfs | d888cd521fac940521b47d8225468e30b490c794 | 648d1d67b4c7f4a209d641a0cd59ebc2c9bcf942 | refs/heads/master | 2021-04-15T13:08:21.785000 | 2018-11-17T20:46:02 | 2018-11-17T20:46:02 | 126,897,185 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.treona.shelfs.api.pluginLoader;
import de.treona.shelfs.api.plugin.PluginLoader;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
class PluginLoaderTest {
PluginLoader pluginLoader;
PluginLoaderTest() {
this.pluginLoader = new PluginLoader();
}
@Test
void loadPlugin() {
}
@Test
void pluginDescriptionValidator() {
//3,5,6 should be valid
Path path = Paths.get("src", "test", "resources", "pluginDescription");
assertNotNull(path);
assertNotNull(path.toFile().listFiles());
for (File file : path.toFile().listFiles()) {
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
StringBuilder stringBuilder = new StringBuilder();
bufferedReader.lines().forEach(stringBuilder::append);
JSONObject jsonObject = new JSONObject(stringBuilder.toString());
if (this.pluginLoader.isPluginDescriptionInvalid(jsonObject)) {
if (file.getName().contains("valid")) {
fail("Should be valid: " + file.getName());
} else {
System.out.println(file.getName() + " is not valid, correct.");
continue;
}
}
if (!file.getName().contains("valid")) {
fail("Should not be valid: " + file.getName());
continue;
}
System.out.println(file.getName() + " is valid, correct.");
} catch (FileNotFoundException e) {
fail("File not found");
} catch (JSONException ignore) {
if (file.getName().contains("valid")) {
fail("Should be valid: " + file.getName());
} else {
System.out.println(file.getName() + " is not valid, correct.");
}
}
}
}
} | UTF-8 | Java | 2,338 | java | PluginLoaderTest.java | Java | [] | null | [] | package de.treona.shelfs.api.pluginLoader;
import de.treona.shelfs.api.plugin.PluginLoader;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.jupiter.api.Test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
class PluginLoaderTest {
PluginLoader pluginLoader;
PluginLoaderTest() {
this.pluginLoader = new PluginLoader();
}
@Test
void loadPlugin() {
}
@Test
void pluginDescriptionValidator() {
//3,5,6 should be valid
Path path = Paths.get("src", "test", "resources", "pluginDescription");
assertNotNull(path);
assertNotNull(path.toFile().listFiles());
for (File file : path.toFile().listFiles()) {
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
StringBuilder stringBuilder = new StringBuilder();
bufferedReader.lines().forEach(stringBuilder::append);
JSONObject jsonObject = new JSONObject(stringBuilder.toString());
if (this.pluginLoader.isPluginDescriptionInvalid(jsonObject)) {
if (file.getName().contains("valid")) {
fail("Should be valid: " + file.getName());
} else {
System.out.println(file.getName() + " is not valid, correct.");
continue;
}
}
if (!file.getName().contains("valid")) {
fail("Should not be valid: " + file.getName());
continue;
}
System.out.println(file.getName() + " is valid, correct.");
} catch (FileNotFoundException e) {
fail("File not found");
} catch (JSONException ignore) {
if (file.getName().contains("valid")) {
fail("Should be valid: " + file.getName());
} else {
System.out.println(file.getName() + " is not valid, correct.");
}
}
}
}
} | 2,338 | 0.566296 | 0.565013 | 66 | 34.439392 | 25.508839 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false | 13 |
dae25703684d5e30618fa2af714be39b39925ea6 | 35,493,609,752,891 | f766baf255197dd4c1561ae6858a67ad23dcda68 | /app/src/main/java/com/tencent/tencentmap/mapsdk/a/aj.java | a7854a7a60c1e788aadfeadbc4e2ed06d6bcd0a2 | [] | no_license | jianghan200/wxsrc6.6.7 | https://github.com/jianghan200/wxsrc6.6.7 | d83f3fbbb77235c7f2c8bc945fa3f09d9bac3849 | eb6c56587cfca596f8c7095b0854cbbc78254178 | refs/heads/master | 2020-03-19T23:40:49.532000 | 2018-06-12T06:00:50 | 2018-06-12T06:00:50 | 137,015,278 | 4 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tencent.tencentmap.mapsdk.a;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class aj
{
public static final List<Integer> a;
private ConcurrentHashMap<lb, an> b = new ConcurrentHashMap();
static
{
ArrayList localArrayList = new ArrayList();
a = localArrayList;
localArrayList.add(Integer.valueOf(5));
a.add(Integer.valueOf(10));
a.add(Integer.valueOf(50));
a.add(Integer.valueOf(100));
a.add(Integer.valueOf(200));
a.add(Integer.valueOf(500));
a.add(Integer.valueOf(1000));
a.add(Integer.valueOf(2000));
a.add(Integer.valueOf(3000));
}
public an a(lb paramlb)
{
an localan2 = (an)this.b.get(paramlb);
an localan1 = localan2;
if (localan2 == null)
{
localan1 = new an(a);
this.b.putIfAbsent(paramlb, localan1);
}
return localan1;
}
public ConcurrentHashMap<lb, an> a()
{
return this.b;
}
public void a(lb paramlb, int paramInt)
{
a(paramlb).a(paramInt, 2);
}
public void a(lb paramlb, long paramLong, int paramInt)
{
if (paramInt == 0) {
a(paramlb).a(paramLong, 0);
}
do
{
return;
if (paramInt == 1)
{
a(paramlb).a(paramLong, 1);
return;
}
} while (paramInt != 2);
a(paramlb).a(paramLong, 2);
}
}
/* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes5-dex2jar.jar!/com/tencent/tencentmap/mapsdk/a/aj.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 1,604 | java | aj.java | Java | [] | null | [] | package com.tencent.tencentmap.mapsdk.a;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class aj
{
public static final List<Integer> a;
private ConcurrentHashMap<lb, an> b = new ConcurrentHashMap();
static
{
ArrayList localArrayList = new ArrayList();
a = localArrayList;
localArrayList.add(Integer.valueOf(5));
a.add(Integer.valueOf(10));
a.add(Integer.valueOf(50));
a.add(Integer.valueOf(100));
a.add(Integer.valueOf(200));
a.add(Integer.valueOf(500));
a.add(Integer.valueOf(1000));
a.add(Integer.valueOf(2000));
a.add(Integer.valueOf(3000));
}
public an a(lb paramlb)
{
an localan2 = (an)this.b.get(paramlb);
an localan1 = localan2;
if (localan2 == null)
{
localan1 = new an(a);
this.b.putIfAbsent(paramlb, localan1);
}
return localan1;
}
public ConcurrentHashMap<lb, an> a()
{
return this.b;
}
public void a(lb paramlb, int paramInt)
{
a(paramlb).a(paramInt, 2);
}
public void a(lb paramlb, long paramLong, int paramInt)
{
if (paramInt == 0) {
a(paramlb).a(paramLong, 0);
}
do
{
return;
if (paramInt == 1)
{
a(paramlb).a(paramLong, 1);
return;
}
} while (paramInt != 2);
a(paramlb).a(paramLong, 2);
}
}
/* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes5-dex2jar.jar!/com/tencent/tencentmap/mapsdk/a/aj.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 1,604 | 0.615869 | 0.581234 | 71 | 21.380281 | 21.726446 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.56338 | false | false | 13 |
ccdf64ee1325a1fd90fd32c5a3d0467bee5f0eea | 2,705,829,400,303 | b5e953cc6ee0b0d420fa5b264ef17d54e8a7fa6b | /LiftDrag/test/database/SQLiteConnectionTest.java | a06fac184ace2cf71536262afda4cc30d30011a4 | [] | no_license | porcellus/CranfieldUniSETCGroupProject | https://github.com/porcellus/CranfieldUniSETCGroupProject | 90598b6059ee1d3cdd8ed131f89e83af7d2c2f14 | 8b4fc0112507ac3ef98ca89153b24e3751547362 | refs/heads/master | 2016-09-08T00:20:13.819000 | 2015-03-27T15:05:27 | 2015-03-27T15:05:27 | 31,076,051 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package database;
import static org.junit.Assert.*;
import java.io.File;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import session.OptimizationResult;
import session.Session;
public class SQLiteConnectionTest
{
SQLiteConnection database;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
File file = new File("data.db");
file.getAbsolutePath();
file.delete();
}
@Before
public void setUp() {
database = new SQLiteConnection();
database.connection();
}
@Test
public void testConnection()
{
Boolean sessionExists = false;
Boolean iterationExists = false;
String tableName;
DatabaseMetaData md;
try
{
md = database.c.getMetaData();
ResultSet rs = md.getTables(null, null, "%", null);
while (rs.next())
{
tableName = rs.getString(3);
if(sessionExists == false && tableName.equals("SESSION"))
sessionExists = true;
if(iterationExists == false && tableName.equals("ITERATION"))
iterationExists = true;
}
database.close();
assertTrue(sessionExists && iterationExists);
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testCreateSession()
{
String username = "qwerty";
String password = "superpassword";
try
{
MessageDigest md5;
md5 = MessageDigest.getInstance("MD5");
String encodePwd = (new HexBinaryAdapter()).marshal(md5.digest(password.getBytes()));
database.createSession(username, password);
String sql="SELECT COUNT(ID) AS FOUND, ID, MINANGLE, MAXANGLE, MINTHICKNESS, MAXTHICKNESS, MINCAMBER, MAXCAMBER FROM SESSION"+" WHERE NAME=\""+username+"\" AND PWD=\""+encodePwd+"\" ;";
ResultSet rs = database.stmt.executeQuery( sql );
rs.next();
int numberRows = rs.getInt("FOUND");
database.close();
assertEquals(numberRows, 1);
} catch (SQLException e)
{
e.printStackTrace();
} catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
}
}
@Test
public void testLoginSession()
{
String username = "qwerty2";
String password = "superpassword2";
int ID = 10;
double minangle = 1;
double maxangle = 2;
double minthickness = 3;
double maxthickness = 4;
double mincamber = 5;
double maxcamber = 6;
try
{
Session uploadedSession = database.createSession(username, password);
uploadedSession.setParameters(minangle, maxangle, mincamber, maxcamber, minthickness, maxthickness);
database.setSessionParameters(uploadedSession);
Session downloadedSession = database.loginSession(username, password);
database.close();
assertTrue(uploadedSession.equals(downloadedSession));
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testIsSessionExisting()
{
String username = "qwerty3";
String password = "superpassword3";
try
{
Session uploadedSession = database.createSession(username, password);
assertTrue(database.isSessionExisting(username));
database.close();
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testGetSetResult()
{
String username = "qwerty4";
String password = "superpassword4";
double angle = 1;
double camber = 2;
double thickness = 3;
double lift = 4;
double drag = 5;
try
{
Session session = database.createSession(username, password);
OptimizationResult uploadedResult = new OptimizationResult();
uploadedResult.set(angle, camber, thickness, lift, drag);
database.setResult(uploadedResult, session.getId());
OptimizationResult downloadedResult = database.getResult(database.getIterationNum(session.getId()), session.getId());
database.close();
assertTrue(uploadedResult.equals(downloadedResult));
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testGetIterationNum()
{
String username = "qwerty5";
String password = "superpassword5";
double angle = 6;
double camber = 7;
double thickness = 8;
double lift = 9;
double drag = 10;
int oldId, newId;
Session session;
try
{
session = database.createSession(username, password);
oldId = database.getIterationNum(session.getId());
OptimizationResult uploadedResult = new OptimizationResult();
uploadedResult.set(angle, camber, thickness, lift, drag);
database.setResult(uploadedResult, session.getId());
newId = database.getIterationNum(session.getId());
database.close();
assertEquals(oldId + 1, newId);
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| UTF-8 | Java | 4,995 | java | SQLiteConnectionTest.java | Java | [
{
"context": " void testCreateSession()\n\t{\n\t\tString username = \"qwerty\";\n\t\tString password = \"superpassword\";\n\t\t\n\t\ttry\n\t",
"end": 1559,
"score": 0.9995589256286621,
"start": 1553,
"tag": "USERNAME",
"value": "qwerty"
},
{
"context": "\tString username = \"qwerty\"... | null | [] | package database;
import static org.junit.Assert.*;
import java.io.File;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import session.OptimizationResult;
import session.Session;
public class SQLiteConnectionTest
{
SQLiteConnection database;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
File file = new File("data.db");
file.getAbsolutePath();
file.delete();
}
@Before
public void setUp() {
database = new SQLiteConnection();
database.connection();
}
@Test
public void testConnection()
{
Boolean sessionExists = false;
Boolean iterationExists = false;
String tableName;
DatabaseMetaData md;
try
{
md = database.c.getMetaData();
ResultSet rs = md.getTables(null, null, "%", null);
while (rs.next())
{
tableName = rs.getString(3);
if(sessionExists == false && tableName.equals("SESSION"))
sessionExists = true;
if(iterationExists == false && tableName.equals("ITERATION"))
iterationExists = true;
}
database.close();
assertTrue(sessionExists && iterationExists);
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testCreateSession()
{
String username = "qwerty";
String password = "<PASSWORD>";
try
{
MessageDigest md5;
md5 = MessageDigest.getInstance("MD5");
String encodePwd = (new HexBinaryAdapter()).marshal(md5.digest(password.getBytes()));
database.createSession(username, password);
String sql="SELECT COUNT(ID) AS FOUND, ID, MINANGLE, MAXANGLE, MINTHICKNESS, MAXTHICKNESS, MINCAMBER, MAXCAMBER FROM SESSION"+" WHERE NAME=\""+username+"\" AND PWD=\""+encodePwd+"\" ;";
ResultSet rs = database.stmt.executeQuery( sql );
rs.next();
int numberRows = rs.getInt("FOUND");
database.close();
assertEquals(numberRows, 1);
} catch (SQLException e)
{
e.printStackTrace();
} catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
}
}
@Test
public void testLoginSession()
{
String username = "qwerty2";
String password = "<PASSWORD>";
int ID = 10;
double minangle = 1;
double maxangle = 2;
double minthickness = 3;
double maxthickness = 4;
double mincamber = 5;
double maxcamber = 6;
try
{
Session uploadedSession = database.createSession(username, password);
uploadedSession.setParameters(minangle, maxangle, mincamber, maxcamber, minthickness, maxthickness);
database.setSessionParameters(uploadedSession);
Session downloadedSession = database.loginSession(username, password);
database.close();
assertTrue(uploadedSession.equals(downloadedSession));
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testIsSessionExisting()
{
String username = "qwerty3";
String password = "<PASSWORD>";
try
{
Session uploadedSession = database.createSession(username, password);
assertTrue(database.isSessionExisting(username));
database.close();
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testGetSetResult()
{
String username = "qwerty4";
String password = "<PASSWORD>";
double angle = 1;
double camber = 2;
double thickness = 3;
double lift = 4;
double drag = 5;
try
{
Session session = database.createSession(username, password);
OptimizationResult uploadedResult = new OptimizationResult();
uploadedResult.set(angle, camber, thickness, lift, drag);
database.setResult(uploadedResult, session.getId());
OptimizationResult downloadedResult = database.getResult(database.getIterationNum(session.getId()), session.getId());
database.close();
assertTrue(uploadedResult.equals(downloadedResult));
} catch (SQLException e)
{
e.printStackTrace();
}
}
@Test
public void testGetIterationNum()
{
String username = "qwerty5";
String password = "<PASSWORD>";
double angle = 6;
double camber = 7;
double thickness = 8;
double lift = 9;
double drag = 10;
int oldId, newId;
Session session;
try
{
session = database.createSession(username, password);
oldId = database.getIterationNum(session.getId());
OptimizationResult uploadedResult = new OptimizationResult();
uploadedResult.set(angle, camber, thickness, lift, drag);
database.setResult(uploadedResult, session.getId());
newId = database.getIterationNum(session.getId());
database.close();
assertEquals(oldId + 1, newId);
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 4,976 | 0.688889 | 0.682082 | 212 | 22.561321 | 24.068123 | 188 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.372642 | false | false | 13 |
416c2b68422bfb57fa23119470d63aa57d4cc3b4 | 36,421,322,684,693 | 315c57b7eb52510530201918b903838611f1b8c6 | /src/goryachev/common/util/WeakVector.java | 1122c6843954493ea517f83626cd10d1d354056d | [
"Apache-2.0",
"LGPL-3.0-only"
] | permissive | andy-goryachev/FxDock | https://github.com/andy-goryachev/FxDock | b4a787fbd1a8d941f4c8e867b3f61a6daa8a6349 | a5bfb3f67771b83965752971e6538800f3273134 | refs/heads/master | 2023-04-11T09:56:34.928000 | 2023-03-22T06:18:38 | 2023-03-22T06:18:38 | 56,991,188 | 47 | 15 | Apache-2.0 | false | 2018-09-12T22:06:04 | 2016-04-24T19:51:54 | 2018-09-10T23:16:09 | 2018-09-12T22:06:04 | 2,974 | 14 | 5 | 3 | Java | false | null | // Copyright © 2012-2023 Andy Goryachev <andy@goryachev.com>
package goryachev.common.util;
/**
* Synchronized List of WeakListeners.
*/
public class WeakVector<T>
extends WeakList<T>
{
public WeakVector()
{
}
public WeakVector(int size)
{
super(size);
}
public synchronized CList<T> asList()
{
return super.asList();
}
public synchronized T get(int ix)
{
return super.get(ix);
}
public synchronized void add(T item)
{
super.add(item);
}
public synchronized void add(int index, T item)
{
super.add(index, item);
}
public synchronized int size()
{
return super.size();
}
public synchronized void remove(T item)
{
super.remove(item);
}
public synchronized void remove(int ix)
{
super.remove(ix);
}
}
| UTF-8 | Java | 835 | java | WeakVector.java | Java | [
{
"context": "// Copyright © 2012-2023 Andy Goryachev <andy@goryachev.com>\r\npackage goryachev.common.ut",
"end": 39,
"score": 0.9998729825019836,
"start": 25,
"tag": "NAME",
"value": "Andy Goryachev"
},
{
"context": "// Copyright © 2012-2023 Andy Goryachev <andy@goryachev.com>\r\np... | null | [] | // Copyright © 2012-2023 <NAME> <<EMAIL>>
package goryachev.common.util;
/**
* Synchronized List of WeakListeners.
*/
public class WeakVector<T>
extends WeakList<T>
{
public WeakVector()
{
}
public WeakVector(int size)
{
super(size);
}
public synchronized CList<T> asList()
{
return super.asList();
}
public synchronized T get(int ix)
{
return super.get(ix);
}
public synchronized void add(T item)
{
super.add(item);
}
public synchronized void add(int index, T item)
{
super.add(index, item);
}
public synchronized int size()
{
return super.size();
}
public synchronized void remove(T item)
{
super.remove(item);
}
public synchronized void remove(int ix)
{
super.remove(ix);
}
}
| 816 | 0.611511 | 0.601918 | 61 | 11.672132 | 15.131903 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.098361 | false | false | 13 |
8e396de685ba41906243078e2fbd3383a9991f81 | 38,740,605,012,962 | e291b8d3065a0b687401514936feea7f8da93ea3 | /src/test/java/com/ccjiuhong/download/MagnetTest.java | 60e01bf78391810273c8541e4f566de3b343ebc3 | [
"MIT"
] | permissive | lhing17/rocketDownloader | https://github.com/lhing17/rocketDownloader | 903d7bc56b53c7ad0ac284aca4b4369eb4c95713 | 130ce2753ac535904fb9c7abdabb4bd1ee8bc8d7 | refs/heads/master | 2022-12-22T19:03:11.148000 | 2020-02-04T02:53:01 | 2020-02-04T02:53:01 | 194,212,580 | 2 | 0 | MIT | false | 2022-12-10T15:11:10 | 2019-06-28T05:36:39 | 2020-02-04T02:53:12 | 2022-12-10T15:11:09 | 429 | 2 | 0 | 14 | Java | false | false | package com.ccjiuhong.download;
import bt.magnet.MagnetUri;
import bt.magnet.MagnetUriParser;
import bt.metainfo.IMetadataService;
import bt.metainfo.MetadataService;
import bt.runtime.Config;
import org.junit.Test;
/**
* @author G. Seinfeld
* @since 2019/12/13
*/
public class MagnetTest {
@Test
public void magnetMetadata() {
Config config = new Config() {
@Override
public int getNumOfHashingThreads() {
return 5;
}
};
IMetadataService service = new MetadataService();
String magentUrl = "magnet:?xt=urn:btih:0031573652B8B29ED0B6A636BF3987887F332989";
MagnetUri magnetUri = MagnetUriParser.lenientParser().parse(magentUrl);
System.out.println(magnetUri.getTorrentId());
// MetadataConsumer metadataConsumer = new MetadataConsumer(service, magnetUri.getTorrentId(), config);
// Torrent torrent = metadataConsumer.waitForTorrent();
// System.out.println(torrent.getName());
// System.out.println(torrent.getCreationDate());
// System.out.println(torrent.getCreatedBy());
// System.out.println(torrent.getTorrentId());
// System.out.println(torrent.getChunkSize());
// System.out.println(torrent.getSize());
}
}
| UTF-8 | Java | 1,285 | java | MagnetTest.java | Java | [
{
"context": "ime.Config;\nimport org.junit.Test;\n\n/**\n * @author G. Seinfeld\n * @since 2019/12/13\n */\npublic class MagnetTest ",
"end": 244,
"score": 0.9998531341552734,
"start": 233,
"tag": "NAME",
"value": "G. Seinfeld"
}
] | null | [] | package com.ccjiuhong.download;
import bt.magnet.MagnetUri;
import bt.magnet.MagnetUriParser;
import bt.metainfo.IMetadataService;
import bt.metainfo.MetadataService;
import bt.runtime.Config;
import org.junit.Test;
/**
* @author <NAME>
* @since 2019/12/13
*/
public class MagnetTest {
@Test
public void magnetMetadata() {
Config config = new Config() {
@Override
public int getNumOfHashingThreads() {
return 5;
}
};
IMetadataService service = new MetadataService();
String magentUrl = "magnet:?xt=urn:btih:0031573652B8B29ED0B6A636BF3987887F332989";
MagnetUri magnetUri = MagnetUriParser.lenientParser().parse(magentUrl);
System.out.println(magnetUri.getTorrentId());
// MetadataConsumer metadataConsumer = new MetadataConsumer(service, magnetUri.getTorrentId(), config);
// Torrent torrent = metadataConsumer.waitForTorrent();
// System.out.println(torrent.getName());
// System.out.println(torrent.getCreationDate());
// System.out.println(torrent.getCreatedBy());
// System.out.println(torrent.getTorrentId());
// System.out.println(torrent.getChunkSize());
// System.out.println(torrent.getSize());
}
}
| 1,280 | 0.673152 | 0.642023 | 36 | 34.694443 | 25.581915 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.638889 | false | false | 13 |
df7fe991b2218073b7cdab213f73ca60a627f9af | 35,184,372,106,813 | 3318a0bf531286ed699b19692c8bc6fda7000231 | /Logistica-API/src/main/java/com/logistica/services/Commands/Needs/INeedsService.java | b97b98fa5c90c4c1588663e081b2b750c0c47084 | [] | no_license | Abdelilah00/Logistica | https://github.com/Abdelilah00/Logistica | 76aeba663b9eaa3a67a2b14585ed250e5a187f4e | 78b0f64d0541c5a1ab7a7cb93e271bc0d9fda4eb | refs/heads/main | 2023-07-11T13:35:12.319000 | 2023-06-24T15:09:10 | 2023-06-24T15:09:10 | 354,976,620 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.logistica.services.Commands.Needs;
import com.alexy.services.IBaseCrudService;
import com.logistica.domains.Commands.Needs;
import com.logistica.dtos.Commands.Needs.NeedsCreateDto;
import com.logistica.dtos.Commands.Needs.NeedsDto;
import com.logistica.dtos.Commands.Needs.NeedsUpdateDto;
public interface INeedsService extends IBaseCrudService<Needs, NeedsDto, NeedsCreateDto, NeedsUpdateDto> {
}
| UTF-8 | Java | 413 | java | INeedsService.java | Java | [] | null | [] | package com.logistica.services.Commands.Needs;
import com.alexy.services.IBaseCrudService;
import com.logistica.domains.Commands.Needs;
import com.logistica.dtos.Commands.Needs.NeedsCreateDto;
import com.logistica.dtos.Commands.Needs.NeedsDto;
import com.logistica.dtos.Commands.Needs.NeedsUpdateDto;
public interface INeedsService extends IBaseCrudService<Needs, NeedsDto, NeedsCreateDto, NeedsUpdateDto> {
}
| 413 | 0.845036 | 0.845036 | 11 | 36.545456 | 31.935627 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 13 |
8ce0fd8dbc9d410403187c579956f07a70493321 | 36,790,689,865,155 | 54f6c9cfad7eeceeb544ba7e13c6dbd1543b82f8 | /src/personal/modelo/Personal.java | 7ae04607bf08c4f6d7f6e2c26f0df760c01649dc | [] | no_license | juliogoma/lezama | https://github.com/juliogoma/lezama | c5178c73d73d2561bbfe3eb71af77ae0ccb9447c | 36fcbb5249235a6ae12fed471415eea62cced404 | refs/heads/master | 2021-01-02T08:40:53.587000 | 2013-06-04T05:20:09 | 2013-06-04T05:20:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package personal.modelo;
import java.util.Date;
import persona.modelo.Persona;
public class Personal extends Persona{
private String codColegio;
private String cargo;
private String estado;
private String fechContrato;
private String usuario;
private String password;
public Personal(){}
public Personal(String codColegio, String cargo, String estado, String fechContrato, String usuario, String password, Integer id, String dni, String nombre, String apePaterno, String apeMaterno, String sexo, String estadoCivil, String fechaNac, String lugarNac, String telefono, String correo, String celular) {
super(id, dni, nombre, apePaterno, apeMaterno, sexo, estadoCivil, fechaNac, lugarNac, telefono, correo, celular);
this.codColegio = codColegio;
this.cargo = cargo;
this.estado = estado;
this.fechContrato = fechContrato;
this.usuario = usuario;
this.password = password;
}
public String getCodColegio() {
return codColegio;
}
public void setCodColegio(String codColegio) {
this.codColegio = codColegio;
}
public String getCargo() {
return cargo;
}
public void setCargo(String cargo) {
this.cargo = cargo;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getFechContrato() {
return fechContrato;
}
public void setFechContrato(String fechContrato) {
this.fechContrato = fechContrato;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| UTF-8 | Java | 1,946 | java | Personal.java | Java | [
{
"context": "chContrato = fechContrato;\r\n this.usuario = usuario;\r\n this.password = password;\r\n }\r\n\r\n ",
"end": 921,
"score": 0.8619288802146912,
"start": 914,
"tag": "USERNAME",
"value": "usuario"
},
{
"context": " this.usuario = usuario;\r\n th... | null | [] | package personal.modelo;
import java.util.Date;
import persona.modelo.Persona;
public class Personal extends Persona{
private String codColegio;
private String cargo;
private String estado;
private String fechContrato;
private String usuario;
private String password;
public Personal(){}
public Personal(String codColegio, String cargo, String estado, String fechContrato, String usuario, String password, Integer id, String dni, String nombre, String apePaterno, String apeMaterno, String sexo, String estadoCivil, String fechaNac, String lugarNac, String telefono, String correo, String celular) {
super(id, dni, nombre, apePaterno, apeMaterno, sexo, estadoCivil, fechaNac, lugarNac, telefono, correo, celular);
this.codColegio = codColegio;
this.cargo = cargo;
this.estado = estado;
this.fechContrato = fechContrato;
this.usuario = usuario;
this.password = <PASSWORD>;
}
public String getCodColegio() {
return codColegio;
}
public void setCodColegio(String codColegio) {
this.codColegio = codColegio;
}
public String getCargo() {
return cargo;
}
public void setCargo(String cargo) {
this.cargo = cargo;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getFechContrato() {
return fechContrato;
}
public void setFechContrato(String fechContrato) {
this.fechContrato = fechContrato;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| 1,948 | 0.643371 | 0.643371 | 75 | 23.946667 | 39.102905 | 315 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.746667 | false | false | 13 |
18485d23e32e7ef53a039573ce431231921cccb5 | 9,131,100,516,224 | 6fc79e7fa98c879e34f768de477af0f4f752b5bc | /note/Thread_04_Sync_Withdraw.java | 4331deadae3dfddadcc575a296cb10b515f1b366 | [] | no_license | AKASHTHAKURN/whatsup | https://github.com/AKASHTHAKURN/whatsup | da43738d2e54c5ac14d25f2c3682b6dea38eb7dc | 10761599e7ab1870a76ca492259faa89feff5767 | refs/heads/master | 2022-12-25T17:55:02.548000 | 2020-10-02T16:42:53 | 2020-10-02T16:42:53 | 300,677,356 | 0 | 0 | null | true | 2020-10-02T16:42:55 | 2020-10-02T16:41:03 | 2020-10-02T16:41:05 | 2020-10-02T16:42:54 | 7,155 | 0 | 0 | 0 | null | false | false | package tct_summary;
import java.util.concurrent.locks.ReentrantLock;
// 같은 동작을 하는 스레드 사용 시 Thread(Runnable arg0) 형태로 실행해야 한다 -> 객체 공유
public class Thread_04_Sync_Withdraw {
public static void main(String[] args) throws InterruptedException {
Runnable tr = new WithdrawThread();
Thread t1 = new Thread(tr);
Thread t2 = new Thread(tr);
t1.start();
t2.start();
t1.join();
t2.join();
}
}
class Account {
// class 멤버변수로 선언해야 한다
static ReentrantLock lock = new ReentrantLock();
private int balance = 3000;
Account() {
System.out.println("Account created =========");
}
public int getBalance() {
return balance;
}
// 동기화
public synchronized void withdrawSync(int money) {
if (balance >= money) {
balance -= money;
System.out.println("["+ Thread.currentThread().getName() + "]" + "balance:"+getBalance());
}
}
// Mutex
public void withdrawMutex(int money) {
lock.lock();
if (balance >= money) {
balance -= money;
System.out.println("["+ Thread.currentThread().getName() + "]" + "balance:"+getBalance());
}
lock.unlock();
}
}
class WithdrawThread implements Runnable {
Account acc;
WithdrawThread() {
acc = new Account();
}
public void run() {
while(acc.getBalance()> 0) {
// 100, 200, 300중의 한 값을 임으로 선택해서 출금(withdraw)
int money = (int)(Math.random() * 3 + 1) * 100;
acc.withdrawSync(money);
// acc.withdrawMutex(money);
try {
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
} | UHC | Java | 1,760 | java | Thread_04_Sync_Withdraw.java | Java | [] | null | [] | package tct_summary;
import java.util.concurrent.locks.ReentrantLock;
// 같은 동작을 하는 스레드 사용 시 Thread(Runnable arg0) 형태로 실행해야 한다 -> 객체 공유
public class Thread_04_Sync_Withdraw {
public static void main(String[] args) throws InterruptedException {
Runnable tr = new WithdrawThread();
Thread t1 = new Thread(tr);
Thread t2 = new Thread(tr);
t1.start();
t2.start();
t1.join();
t2.join();
}
}
class Account {
// class 멤버변수로 선언해야 한다
static ReentrantLock lock = new ReentrantLock();
private int balance = 3000;
Account() {
System.out.println("Account created =========");
}
public int getBalance() {
return balance;
}
// 동기화
public synchronized void withdrawSync(int money) {
if (balance >= money) {
balance -= money;
System.out.println("["+ Thread.currentThread().getName() + "]" + "balance:"+getBalance());
}
}
// Mutex
public void withdrawMutex(int money) {
lock.lock();
if (balance >= money) {
balance -= money;
System.out.println("["+ Thread.currentThread().getName() + "]" + "balance:"+getBalance());
}
lock.unlock();
}
}
class WithdrawThread implements Runnable {
Account acc;
WithdrawThread() {
acc = new Account();
}
public void run() {
while(acc.getBalance()> 0) {
// 100, 200, 300중의 한 값을 임으로 선택해서 출금(withdraw)
int money = (int)(Math.random() * 3 + 1) * 100;
acc.withdrawSync(money);
// acc.withdrawMutex(money);
try {
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
} | 1,760 | 0.585956 | 0.568402 | 89 | 16.58427 | 20.70163 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.831461 | false | false | 13 |
ef245b3377589706c61b6fe84fc6b1f66dc7c045 | 34,359,742,883 | 3ff8dffecd1e5f13a503c58df658df0bda2f8304 | /src/main/java/App.java | 1ef35474096cfd78aa6a185940c5ef470fb4f15e | [] | no_license | dimajolkin/calculator-java | https://github.com/dimajolkin/calculator-java | 5593d63253a5f7687bd8b91a45cf1a4322b58d29 | d25ecd328194b84ac80fec02fa171f4a8dd5550c | refs/heads/master | 2021-01-19T18:01:13.953000 | 2017-08-23T15:13:35 | 2017-08-23T15:13:35 | 101,105,962 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import controller.FormController;
import view.Form;
public class App {
public static void main(String[] args) {
FormController controller = new FormController();
Form f = new Form(controller);
f.showForm();
}
} | UTF-8 | Java | 245 | java | App.java | Java | [] | null | [] | import controller.FormController;
import view.Form;
public class App {
public static void main(String[] args) {
FormController controller = new FormController();
Form f = new Form(controller);
f.showForm();
}
} | 245 | 0.653061 | 0.653061 | 11 | 21.363636 | 18.621946 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 13 |
097776a2f76f46f16a8ae7fd17ac29e466c7db8d | 34,359,743,378 | c0ebd339bba20d7076427f845490a3f69b7f2579 | /Util_FiexedSocket/src/com/SHGroup/FixedSocket/FixedServerSocket.java | 360aa2af49bb74905bad1e0b2bc62a26a899ebb0 | [] | no_license | sunghun7511/FixedSocket | https://github.com/sunghun7511/FixedSocket | ee70574874e796e2e7076025482d9336d36a681f | c8ada78347a106d4564ff2c571d07d63b7db03a4 | refs/heads/master | 2021-01-19T11:42:51.140000 | 2017-02-17T08:10:58 | 2017-02-17T08:10:58 | 82,272,714 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.SHGroup.FixedSocket;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
public class FixedServerSocket extends ServerSocket {
private Timer t;
private HashMap<FixedSocket, SocketData> sData = new HashMap<FixedSocket, SocketData>();
private boolean isClose = false;
private SocketEvent e;
public FixedServerSocket(int port, SocketEvent e) throws IOException {
super(port);
this.e = e;
e.onStart();
t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
for (Map.Entry<FixedSocket, SocketData> e : sData.entrySet()) {
if ((System.currentTimeMillis() - e.getValue().lastGet) <= 500l) {
try {
e.getKey().sendEmpty();
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
try {
close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
}, 80l, 80l);
}
@Override
public void close() throws IOException {
if (isClose) {
throw new IOException("ServerSocket is Already Close!");
}
for (Map.Entry<FixedSocket, SocketData> e : sData.entrySet()) {
e.getKey().close();
}
t.cancel();
super.close();
if (e != null)
e.onClose();
isClose = true;
super.close();
}
@Override
public FixedSocket accept() throws IOException {
Socket s = super.accept();
FixedSocket fs = (FixedSocket) s;
fs.startSetup(e);
return fs;
}
private class SocketData {
long lastGet = System.currentTimeMillis();
}
}
| UTF-8 | Java | 1,679 | java | FixedServerSocket.java | Java | [] | null | [] | package com.SHGroup.FixedSocket;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
public class FixedServerSocket extends ServerSocket {
private Timer t;
private HashMap<FixedSocket, SocketData> sData = new HashMap<FixedSocket, SocketData>();
private boolean isClose = false;
private SocketEvent e;
public FixedServerSocket(int port, SocketEvent e) throws IOException {
super(port);
this.e = e;
e.onStart();
t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
for (Map.Entry<FixedSocket, SocketData> e : sData.entrySet()) {
if ((System.currentTimeMillis() - e.getValue().lastGet) <= 500l) {
try {
e.getKey().sendEmpty();
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
try {
close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
}, 80l, 80l);
}
@Override
public void close() throws IOException {
if (isClose) {
throw new IOException("ServerSocket is Already Close!");
}
for (Map.Entry<FixedSocket, SocketData> e : sData.entrySet()) {
e.getKey().close();
}
t.cancel();
super.close();
if (e != null)
e.onClose();
isClose = true;
super.close();
}
@Override
public FixedSocket accept() throws IOException {
Socket s = super.accept();
FixedSocket fs = (FixedSocket) s;
fs.startSetup(e);
return fs;
}
private class SocketData {
long lastGet = System.currentTimeMillis();
}
}
| 1,679 | 0.625968 | 0.621799 | 70 | 21.985714 | 19.246145 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.842857 | false | false | 13 |
be7f4cac023557c27525b40e782c76a207812ed6 | 6,227,702,587,491 | 1db6ecb8152eca13d3d9c8c1b70212fd29873195 | /cs509resources/WordMap/src/shapes/controller/RedoController.java | ad995060bdc82fe6f576a041215251dd9413a52f | [] | no_license | bucky1995/CS_509_DSS | https://github.com/bucky1995/CS_509_DSS | 207b50815e9eb78cfa4572d29e36ced769fd76b1 | d6a2137a870c28e4b75b1a2ba34ec4fb2023c634 | refs/heads/master | 2021-07-14T04:19:54.632000 | 2019-09-24T02:58:26 | 2019-09-24T02:58:26 | 209,081,349 | 0 | 0 | null | false | 2020-10-13T16:12:09 | 2019-09-17T14:48:09 | 2019-09-24T02:58:35 | 2020-10-13T16:12:07 | 1,183 | 0 | 0 | 1 | Java | false | false | package shapes.controller;
import shapes.model.Model;
import shapes.view.ApplicationPanel;
public class RedoController {
Model model;
ApplicationPanel canvas;
public RedoController(Model m, ApplicationPanel canvas) {
this.model = m;
this.canvas = canvas;
}
public boolean process() {
Move m = model.removeRedoMove();
if (m == null) { return false; }
if (m.execute()) {
model.recordRedoneMove(m);
}
// force board to redraw
canvas.redraw();
canvas.repaint();
return true;
}
}
| UTF-8 | Java | 546 | java | RedoController.java | Java | [] | null | [] | package shapes.controller;
import shapes.model.Model;
import shapes.view.ApplicationPanel;
public class RedoController {
Model model;
ApplicationPanel canvas;
public RedoController(Model m, ApplicationPanel canvas) {
this.model = m;
this.canvas = canvas;
}
public boolean process() {
Move m = model.removeRedoMove();
if (m == null) { return false; }
if (m.execute()) {
model.recordRedoneMove(m);
}
// force board to redraw
canvas.redraw();
canvas.repaint();
return true;
}
}
| 546 | 0.650183 | 0.650183 | 28 | 17.428572 | 14.425742 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false | 13 |
0dad1c30c1b9eafb4710038a4cf9b5f40a7006a8 | 15,272,903,709,658 | a95fbe4532cd3eb84f63906167f3557eda0e1fa3 | /src/main/java/l2f/gameserver/listener/actor/npc/OnDecayListener.java | 4cf9797b805ad61893565fc78fcb891ddb59e3ff | [
"MIT"
] | permissive | Kryspo/L2jRamsheart | https://github.com/Kryspo/L2jRamsheart | a20395f7d1f0f3909ae2c30ff181c47302d3b906 | 98c39d754f5aba1806f92acc9e8e63b3b827be49 | refs/heads/master | 2021-04-12T10:34:51.419000 | 2018-03-26T22:41:39 | 2018-03-26T22:41:39 | 126,892,421 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package l2f.gameserver.listener.actor.npc;
import l2f.gameserver.listener.NpcListener;
import l2f.gameserver.model.instances.NpcInstance;
public interface OnDecayListener extends NpcListener
{
public void onDecay(NpcInstance actor);
}
| UTF-8 | Java | 238 | java | OnDecayListener.java | Java | [] | null | [] | package l2f.gameserver.listener.actor.npc;
import l2f.gameserver.listener.NpcListener;
import l2f.gameserver.model.instances.NpcInstance;
public interface OnDecayListener extends NpcListener
{
public void onDecay(NpcInstance actor);
}
| 238 | 0.836134 | 0.823529 | 9 | 25.444445 | 22.588646 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 13 |
bc64230578df30e06eb025fbe433f31572df2a03 | 15,839,839,396,013 | ce48751145e7dcc9dbff8f5e89d5885aab6d0410 | /com.sampleautomation/src/main/java/com/cucumber/grid/pages/actions/Action_CarDekhoHomePage.java | 2bd44981c8b960b85fd064d4f6826e391cd8980c | [] | no_license | hkumar7878/mobileAutomation | https://github.com/hkumar7878/mobileAutomation | 39811b1e74cc1309c4f2d76f4cc0cff383543e41 | cd10491052fd992723102da27ca9129516821cd7 | refs/heads/master | 2023-05-13T10:39:45.458000 | 2019-06-11T21:17:17 | 2019-06-11T21:17:17 | 191,450,774 | 0 | 0 | null | false | 2023-05-09T18:08:48 | 2019-06-11T21:15:21 | 2019-06-11T21:17:49 | 2023-05-09T18:08:45 | 60 | 0 | 0 | 1 | Java | false | false | package com.cucumber.grid.pages.actions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.PageFactory;
import com.cucumber.grid.pages.locators.LocatorsCarDekho_HomePage;
//import com.cucumber.parallel.baseSteps.steps.BaseSteps;
import com.cucumber.parallel.baseSteps.steps.BaseSteps;
public class Action_CarDekhoHomePage extends BaseSteps{
LocatorsCarDekho_HomePage obj_locatorsCarDekho_HomePage=new LocatorsCarDekho_HomePage();
public Action_CarDekhoHomePage()
{
this.obj_locatorsCarDekho_HomePage= new LocatorsCarDekho_HomePage();
PageFactory.initElements(BaseSteps.getDriver(), obj_locatorsCarDekho_HomePage);
}
public void moveToNewCarMenu()
{
try{
System.out.println(getDriver());
Actions action = new Actions(getDriver());
action.moveToElement(obj_locatorsCarDekho_HomePage.newCarMenu).perform();
try {
Thread.sleep(4000);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Inside move to new car menu");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
public void clickSearchNewCarLink()
{
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
obj_locatorsCarDekho_HomePage.searchNewCarLink.click();
}
}
| UTF-8 | Java | 1,373 | java | Action_CarDekhoHomePage.java | Java | [] | null | [] | package com.cucumber.grid.pages.actions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.PageFactory;
import com.cucumber.grid.pages.locators.LocatorsCarDekho_HomePage;
//import com.cucumber.parallel.baseSteps.steps.BaseSteps;
import com.cucumber.parallel.baseSteps.steps.BaseSteps;
public class Action_CarDekhoHomePage extends BaseSteps{
LocatorsCarDekho_HomePage obj_locatorsCarDekho_HomePage=new LocatorsCarDekho_HomePage();
public Action_CarDekhoHomePage()
{
this.obj_locatorsCarDekho_HomePage= new LocatorsCarDekho_HomePage();
PageFactory.initElements(BaseSteps.getDriver(), obj_locatorsCarDekho_HomePage);
}
public void moveToNewCarMenu()
{
try{
System.out.println(getDriver());
Actions action = new Actions(getDriver());
action.moveToElement(obj_locatorsCarDekho_HomePage.newCarMenu).perform();
try {
Thread.sleep(4000);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Inside move to new car menu");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
public void clickSearchNewCarLink()
{
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
obj_locatorsCarDekho_HomePage.searchNewCarLink.click();
}
}
| 1,373 | 0.725419 | 0.719592 | 51 | 24.921568 | 25.38476 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.784314 | false | false | 13 |
8d46b195b95572da81370865e9bdca129baa2f95 | 24,824,910,978,286 | 7a6a2800e3f9dbb0144cfa62d9d86a9842113b13 | /sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageReadSettingsTests.java | 8930383533dd332d5f4f35d3b9a13dcc9820eadb | [
"LGPL-2.1-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LicenseRef-scancode-generic-cla"
] | permissive | joshfree/azure-sdk-for-java | https://github.com/joshfree/azure-sdk-for-java | 3f5d2cacee44d9bf8c0b16a4bbd54065e20a55cd | d96d0333112997b0ee5aa03aacfad2d0b0e7d1d4 | refs/heads/main | 2022-11-08T18:41:42.079000 | 2022-11-04T22:38:22 | 2022-11-04T22:38:22 | 298,635,515 | 0 | 0 | MIT | true | 2020-09-25T17:15:28 | 2020-09-25T17:15:27 | 2020-09-25T14:38:05 | 2020-09-25T17:14:37 | 1,272,233 | 0 | 0 | 0 | null | false | false | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.datafactory.generated;
import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datafactory.models.AzureFileStorageReadSettings;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public final class AzureFileStorageReadSettingsTests {
@Test
public void testDeserialize() {
AzureFileStorageReadSettings model =
BinaryData
.fromString("{\"type\":\"AzureFileStorageReadSettings\",\"enablePartitionDiscovery\":false,\"\":{}}")
.toObject(AzureFileStorageReadSettings.class);
Assertions.assertEquals(false, model.enablePartitionDiscovery());
}
@Test
public void testSerialize() {
AzureFileStorageReadSettings model = new AzureFileStorageReadSettings().withEnablePartitionDiscovery(false);
model = BinaryData.fromObject(model).toObject(AzureFileStorageReadSettings.class);
Assertions.assertEquals(false, model.enablePartitionDiscovery());
}
}
| UTF-8 | Java | 1,178 | java | AzureFileStorageReadSettingsTests.java | Java | [] | null | [] | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.datafactory.generated;
import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datafactory.models.AzureFileStorageReadSettings;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public final class AzureFileStorageReadSettingsTests {
@Test
public void testDeserialize() {
AzureFileStorageReadSettings model =
BinaryData
.fromString("{\"type\":\"AzureFileStorageReadSettings\",\"enablePartitionDiscovery\":false,\"\":{}}")
.toObject(AzureFileStorageReadSettings.class);
Assertions.assertEquals(false, model.enablePartitionDiscovery());
}
@Test
public void testSerialize() {
AzureFileStorageReadSettings model = new AzureFileStorageReadSettings().withEnablePartitionDiscovery(false);
model = BinaryData.fromObject(model).toObject(AzureFileStorageReadSettings.class);
Assertions.assertEquals(false, model.enablePartitionDiscovery());
}
}
| 1,178 | 0.744482 | 0.744482 | 28 | 41.07143 | 34.07547 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
6986c4730add43434fd7cd8f18ef5583f4695451 | 3,968,549,792,926 | 7060e03b45861787d43a5d8290b2025e56b8b68f | /backend/store-sale/src/main/java/org/demoiselle/jee7/example/store/sale/service/InfoREST.java | 161ed4832b73a7e39eb288f191be09f20615c48e | [] | no_license | luiz158/example-store | https://github.com/luiz158/example-store | a13a71b95095275fa57611da84bba79e7c53a203 | f5a6c5fa12db8f731b024d670202930f05fb929f | refs/heads/master | 2021-01-20T03:21:24.842000 | 2017-02-17T19:32:19 | 2017-02-17T19:32:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.demoiselle.jee7.example.store.sale.service;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.demoiselle.jee.core.message.DemoiselleMessage;
import org.demoiselle.jee.security.annotation.Cors;
import org.jose4j.json.internal.json_simple.JSONObject;
import io.swagger.annotations.Api;
@Path("info")
@Api("System Information")
public class InfoREST {
@Inject
private DemoiselleMessage messages;
@SuppressWarnings("unchecked")
@GET
@Path("ping")
@Cors
@Produces({ MediaType.APPLICATION_JSON })
public Response ping() throws Exception {
JSONObject json = new JSONObject();
json.put("result", "pong");
return Response.ok().entity(json).build();
}
@GET
@Path("version")
@Produces("text/plain")
public String getMessage() throws Exception {
return messages.version();
}
} | UTF-8 | Java | 943 | java | InfoREST.java | Java | [] | null | [] | package org.demoiselle.jee7.example.store.sale.service;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.demoiselle.jee.core.message.DemoiselleMessage;
import org.demoiselle.jee.security.annotation.Cors;
import org.jose4j.json.internal.json_simple.JSONObject;
import io.swagger.annotations.Api;
@Path("info")
@Api("System Information")
public class InfoREST {
@Inject
private DemoiselleMessage messages;
@SuppressWarnings("unchecked")
@GET
@Path("ping")
@Cors
@Produces({ MediaType.APPLICATION_JSON })
public Response ping() throws Exception {
JSONObject json = new JSONObject();
json.put("result", "pong");
return Response.ok().entity(json).build();
}
@GET
@Path("version")
@Produces("text/plain")
public String getMessage() throws Exception {
return messages.version();
}
} | 943 | 0.751856 | 0.749735 | 42 | 21.476191 | 18.239462 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.928571 | false | false | 13 |
de8a11a7a8e2ed0e8fbedd8f56cc081f18e13a26 | 6,803,228,201,037 | 84204bddf51d5ed137d51dbef82a7905a294d50b | /app/src/main/java/com/pillowtechnologies/mohamedaliaddi/compete/SignUpActivity.java | 8522d3c75da5aee61a101e6113237b2d9402546e | [] | no_license | qqkikia/Compete | https://github.com/qqkikia/Compete | bd73f00b056ea5eb40704c55c5088e39327a115a | 6c4254ac5ff1b725f79cbfea9d642d1e0b941d0c | refs/heads/master | 2021-01-10T04:47:59.337000 | 2016-01-26T19:26:54 | 2016-01-26T19:26:54 | 49,422,222 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pillowtechnologies.mohamedaliaddi.compete;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import java.util.ArrayList;
import java.util.Arrays;
public class SignUpActivity extends AppCompatActivity {
CallbackManager callbackManager;
ArrayList<String> perms = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
perms.add("public_profile");
setContentView(R.layout.activity_sign_up);
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager,new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
toGeneral();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException error) {
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_sign_up, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void Login(View view){
LoginManager.getInstance().logInWithReadPermissions(this, perms);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
public void toGeneral(){
Intent intent = new Intent (this,GeneralActivity.class);
startActivity(intent);
}
}
| UTF-8 | Java | 2,599 | java | SignUpActivity.java | Java | [] | null | [] | package com.pillowtechnologies.mohamedaliaddi.compete;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import java.util.ArrayList;
import java.util.Arrays;
public class SignUpActivity extends AppCompatActivity {
CallbackManager callbackManager;
ArrayList<String> perms = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
perms.add("public_profile");
setContentView(R.layout.activity_sign_up);
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager,new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
toGeneral();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException error) {
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_sign_up, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void Login(View view){
LoginManager.getInstance().logInWithReadPermissions(this, perms);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
public void toGeneral(){
Intent intent = new Intent (this,GeneralActivity.class);
startActivity(intent);
}
}
| 2,599 | 0.68334 | 0.682955 | 87 | 28.873564 | 24.878927 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.528736 | false | false | 13 |
0d94ecceee82510a828f338fb9a8a18e9fea7c38 | 25,615,184,963,046 | 8c21cbfb920b9c07e5a7acd40fc266722be1f473 | /src/main/java/springboot/service/admin/user/PermissionService.java | 4adb7253f40c36c041e5c391b5a8e2a4169f7c33 | [] | no_license | qq793373859/pc | https://github.com/qq793373859/pc | 638fc6ed455ede07cb756ca19869a63125e0865f | 10e5cf0003baa7e7c26871f205e62ac2d70f26b9 | refs/heads/master | 2020-03-11T06:24:40.157000 | 2018-08-13T01:28:14 | 2018-08-13T01:28:14 | 129,829,116 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package springboot.service.admin.user;
import java.util.List;
import springboot.bean.admin.user.Permission;
public interface PermissionService{
public Permission getPermissionById(String id);
public List<Permission> getPermissionByPermission(Permission permission);
public void insert(Permission permission);
public List<Permission> getMenus(List<String> list);
}
| UTF-8 | Java | 394 | java | PermissionService.java | Java | [] | null | [] | package springboot.service.admin.user;
import java.util.List;
import springboot.bean.admin.user.Permission;
public interface PermissionService{
public Permission getPermissionById(String id);
public List<Permission> getPermissionByPermission(Permission permission);
public void insert(Permission permission);
public List<Permission> getMenus(List<String> list);
}
| 394 | 0.77665 | 0.77665 | 16 | 22.625 | 24.276726 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false | 13 |
aee4bc1b6223bc36bbac7d1dab51dbc3825b69be | 18,176,301,609,373 | c7de6450bde36dcd9d7c51b820d4075212ed0baa | /OCA_TOPICS/src/com/oca/suresh/boolean_/Q54.java | 4cdcf16b687cea8f4ff4691ca4a2b858520c73c0 | [] | no_license | Suresh322/OCA_Practice | https://github.com/Suresh322/OCA_Practice | 9716c2e31230e0984405099f54e5e047c8b547de | 777ad3411440f59b87d72a21a0034b418640c4d5 | refs/heads/master | 2020-07-23T11:05:41.843000 | 2019-09-10T11:26:12 | 2019-09-10T11:26:12 | 207,537,963 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oca.suresh.boolean_;
public class Q54
{
public static void main(String[] args)
{
float var1 = (12_345.01>=123_45.00)?12_456:124_56.02f;
float var2 = var1+1024;
System.out.println(var2);
}
}
| UTF-8 | Java | 247 | java | Q54.java | Java | [] | null | [] | package com.oca.suresh.boolean_;
public class Q54
{
public static void main(String[] args)
{
float var1 = (12_345.01>=123_45.00)?12_456:124_56.02f;
float var2 = var1+1024;
System.out.println(var2);
}
}
| 247 | 0.578947 | 0.433198 | 13 | 17 | 19.728931 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 13 |
cc44af903376e10036fb1235cf26783765438192 | 29,137,058,149,166 | 43646e0bf7b29748be32617626b8ca66521b7e4c | /src/main/java/com/accenture/rishikeshpoorun/configs/WebSecurityConfig.java | 3fdd878f21ed0aca6ebeb978c78ef8a6ed52b139 | [] | no_license | rpoorun/carrental | https://github.com/rpoorun/carrental | 3098383c19e1796ec00693a2b8b08df088a1f435 | 71d25ede9cd60ebfdd580159e74a19117899e902 | refs/heads/master | 2020-03-17T17:12:13.991000 | 2018-06-04T08:50:35 | 2018-06-04T08:50:35 | 133,778,859 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.accenture.rishikeshpoorun.configs;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true, securedEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
/**
* Global http security configuration.
* @param http HTTP security configuration
* @throws Exception thrown when a configuration error occurs
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/index","/").permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/customer").hasAnyRole("CUSTOMER", "ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/index")
.permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/secured").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/index")
.permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/rest")
.hasRole("WS")
.anyRequest().authenticated()
.and()
.formLogin()
.permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/signedIndex").hasAnyRole("CUSTOMER", "ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll();
}
/**
* In memory authentication configuration using AuthenticationManagerBuilder
*/
/*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("customer").password("1234").roles("CUSTOMER");
auth.inMemoryAuthentication().withUser("admin").password("1234").roles("ADMIN");
auth.inMemoryAuthentication().withUser("webservice").password("1234").roles("WS");
}
//*/
/**
* Database authentication configuration using AuthenticationManagerBuilder
*/
/*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth, DataSource dataSource) throws Exception {
String userQuery = "SELECT national_id, password FROM user_table WHERE national_id =?";
String authoritiesQuery ="select national_id, 'ROLE_ADMIN' FROM user_table where national_id =?";
auth.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(userQuery)
.authoritiesByUsernameQuery(authoritiesQuery)
.passwordEncoder(NoOpPasswordEncoder.getInstance());
}
//*/
/**
* Encoder bean definition.
* @return Encoder bean instance
*/
// @Bean
// public PasswordEncoder encoder(){
//
// return NoOpPasswordEncoder.getInstance();
// }
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
}
| UTF-8 | Java | 4,132 | java | WebSecurityConfig.java | Java | [
{
"context": "ryAuthentication().withUser(\"customer\").password(\"1234\").roles(\"CUSTOMER\");\r\n auth.inMemoryAuthen",
"end": 2862,
"score": 0.9993751049041748,
"start": 2858,
"tag": "PASSWORD",
"value": "1234"
},
{
"context": "emoryAuthentication().withUser(\"admin\").pass... | null | [] | package com.accenture.rishikeshpoorun.configs;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true, securedEnabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
/**
* Global http security configuration.
* @param http HTTP security configuration
* @throws Exception thrown when a configuration error occurs
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/index","/").permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/customer").hasAnyRole("CUSTOMER", "ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/index")
.permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/secured").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/index")
.permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/rest")
.hasRole("WS")
.anyRequest().authenticated()
.and()
.formLogin()
.permitAll();
http.csrf().disable()
.authorizeRequests()
.antMatchers("/signedIndex").hasAnyRole("CUSTOMER", "ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll();
}
/**
* In memory authentication configuration using AuthenticationManagerBuilder
*/
/*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("customer").password("<PASSWORD>").roles("CUSTOMER");
auth.inMemoryAuthentication().withUser("admin").password("<PASSWORD>").roles("ADMIN");
auth.inMemoryAuthentication().withUser("webservice").password("<PASSWORD>").roles("WS");
}
//*/
/**
* Database authentication configuration using AuthenticationManagerBuilder
*/
/*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth, DataSource dataSource) throws Exception {
String userQuery = "SELECT national_id, password FROM user_table WHERE national_id =?";
String authoritiesQuery ="select national_id, 'ROLE_ADMIN' FROM user_table where national_id =?";
auth.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(userQuery)
.authoritiesByUsernameQuery(authoritiesQuery)
.passwordEncoder(NoOpPasswordEncoder.getInstance());
}
//*/
/**
* Encoder bean definition.
* @return Encoder bean instance
*/
// @Bean
// public PasswordEncoder encoder(){
//
// return NoOpPasswordEncoder.getInstance();
// }
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
}
| 4,150 | 0.613746 | 0.610116 | 122 | 31.860655 | 28.910635 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.377049 | false | false | 13 |
9d5eee48365e281243195dd943e28d26e319cd69 | 10,290,741,658,143 | 81282d1d734bc5279c26189c772fe25f4f6e6750 | /src/main/java/com/sftc/web/model/vo/swaggerRequest/RegisterMerchantVO.java | aae7274da88c756b81a072323a2a6b2ebdbe40f3 | [] | no_license | moutainhigh/wencai-dev | https://github.com/moutainhigh/wencai-dev | c163d0b54b2091bdc1f6ce905e5b103b54646706 | df3b95ed9320c748cbc1d61217759552883b76db | refs/heads/master | 2023-03-15T17:41:47.758000 | 2018-02-09T07:41:20 | 2018-02-09T07:41:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sftc.web.model.vo.swaggerRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Created by xf on 2017/10/23.
*/
@ApiModel(value = "注册的用户信息包装类")
public class RegisterMerchantVO {
@ApiModelProperty(name = "mobile",value = "用户手机",example = "13272306247",required = true)
private String mobile;
@ApiModelProperty(name = "attributes",required = true)
private RegisterAttributesVO attributes;
public String getMobile() {return mobile;}
public void setMobile(String mobile) {this.mobile = mobile;}
public RegisterAttributesVO getAttributes() {return attributes;}
public void setAttributes(RegisterAttributesVO attributes) {this.attributes = attributes;}
}
| UTF-8 | Java | 777 | java | RegisterMerchantVO.java | Java | [
{
"context": "r.annotations.ApiModelProperty;\n\n/**\n * Created by xf on 2017/10/23.\n */\n@ApiModel(value = \"注册的用户信息包装类\"",
"end": 156,
"score": 0.9518893957138062,
"start": 154,
"tag": "USERNAME",
"value": "xf"
}
] | null | [] | package com.sftc.web.model.vo.swaggerRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Created by xf on 2017/10/23.
*/
@ApiModel(value = "注册的用户信息包装类")
public class RegisterMerchantVO {
@ApiModelProperty(name = "mobile",value = "用户手机",example = "13272306247",required = true)
private String mobile;
@ApiModelProperty(name = "attributes",required = true)
private RegisterAttributesVO attributes;
public String getMobile() {return mobile;}
public void setMobile(String mobile) {this.mobile = mobile;}
public RegisterAttributesVO getAttributes() {return attributes;}
public void setAttributes(RegisterAttributesVO attributes) {this.attributes = attributes;}
}
| 777 | 0.750334 | 0.724967 | 23 | 31.565218 | 29.61026 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 13 |
0389d962feecfc91e0153030ecf5a857070cd18d | 34,351,148,468,624 | 9c177a489b8af316e2bcca28f79226e272075513 | /src/main/java/javas/DemoAbstractclass.java | ee8ba93ed7ab83a79bc672aa1dd3045fd795d1bd | [] | no_license | Vikramsingh01/demo | https://github.com/Vikramsingh01/demo | 9d946756fdf85c8a26aa2398198ea57abac80bda | fdfc2f889f7bc5982cec72514ad38fdef502d8d7 | refs/heads/master | 2021-06-20T08:35:11.039000 | 2021-06-12T08:29:29 | 2021-06-12T08:29:29 | 130,354,272 | 0 | 0 | null | false | 2021-06-12T08:27:44 | 2018-04-20T11:40:28 | 2021-06-12T08:27:31 | 2021-06-12T08:27:44 | 37,608 | 0 | 0 | 1 | Java | false | false | package javas;
public abstract class DemoAbstractclass {
void sunday() {
System.out.println("sunday");
}
void monday() { System.out.println("monday"); }
abstract void tuesday();
}
class dbcchild extends DemoAbstractclass {
@Override
void tuesday() {
System.out.println("dbcachield tuesday");
}
} | UTF-8 | Java | 328 | java | DemoAbstractclass.java | Java | [] | null | [] | package javas;
public abstract class DemoAbstractclass {
void sunday() {
System.out.println("sunday");
}
void monday() { System.out.println("monday"); }
abstract void tuesday();
}
class dbcchild extends DemoAbstractclass {
@Override
void tuesday() {
System.out.println("dbcachield tuesday");
}
} | 328 | 0.670732 | 0.670732 | 24 | 12.708333 | 16.364288 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false | 13 |
0c6b87184d8771466c5fc7853eef69d7796cb816 | 36,988,258,366,044 | e40c5fdb362b3d8ae60f467c47be9a6aae2dfba1 | /test/Test.java | f26e72fd8890fd475e9e27028c4532ef88dee400 | [] | no_license | INTEGRALSYSTEMSOFTWARE/Proyecto_Programacion | https://github.com/INTEGRALSYSTEMSOFTWARE/Proyecto_Programacion | 12954ba3e737286fdfec4280721e926e3d74b386 | 102180361124bc025c5e1aea3d75727deea0942d | refs/heads/master | 2021-01-10T17:50:39.419000 | 2016-04-12T16:10:59 | 2016-04-12T16:10:59 | 51,499,889 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Area{
private double largo, ancho, alto;
public Area(){}//Constructor
public Area(double ml,double ma){ //Constructor
largo=ml;
ancho=ma;
}
public void Medidas(double ml, double ma, double mal){//Metodo para asignar las tres meidaa
largo = ml; ancho = ma; alto = mal;
}
}
class Plafon{
private Area res1;//variable del tipo area
public Plafon(){
}
protected void msgMedidaErronea(){
System.out.println("Ingresa una medida correcta");
}
public Plafon (double ml, double ma){
res1 = new Area (ml, ma);//mandamos a llamar el constructor
if (ml < 0 && ma < 0){
msgMedidaErronea();
ml = -ml;
ma = -ma;
}
}
class Muro{
private Area res2;
public Muro(){
}
protected void msgMedidaErronea(){
System.out.println("Ingresa un digito correcto");
}
public Muro (double ml, double mal){
res2 = new Area(ml, mal);
if (ml < 0 && mal < 0){
msgMedidaErronea();
ml = -ml;
mal= -mal;
}
}
}
class Materiales{
private Muro lista;
private double colgante, amarre, canaleta, liston, angulo, tabr, ps1;
private double rdmx, cinta;
public Materiales(){
}
protected void msgIngresaUnaMedida(){
System.out.println("Ingresa una Medida");
}
protected void msgLosMAterialesSon(){
System.out.println("Los Materiales que requieres para tu proyecto son:");
}
public Materiales (double col, double arr, double can, double lis, double ang, double tr, double s1){
lista = new Muro (ml,mal);
if ( res2 < 0) {
msgIngresaUnaMedida();
}
}
}
public class Test{
public static void main(String[] args) {
}
}
| UTF-8 | Java | 1,617 | java | Test.java | Java | [] | null | [] | class Area{
private double largo, ancho, alto;
public Area(){}//Constructor
public Area(double ml,double ma){ //Constructor
largo=ml;
ancho=ma;
}
public void Medidas(double ml, double ma, double mal){//Metodo para asignar las tres meidaa
largo = ml; ancho = ma; alto = mal;
}
}
class Plafon{
private Area res1;//variable del tipo area
public Plafon(){
}
protected void msgMedidaErronea(){
System.out.println("Ingresa una medida correcta");
}
public Plafon (double ml, double ma){
res1 = new Area (ml, ma);//mandamos a llamar el constructor
if (ml < 0 && ma < 0){
msgMedidaErronea();
ml = -ml;
ma = -ma;
}
}
class Muro{
private Area res2;
public Muro(){
}
protected void msgMedidaErronea(){
System.out.println("Ingresa un digito correcto");
}
public Muro (double ml, double mal){
res2 = new Area(ml, mal);
if (ml < 0 && mal < 0){
msgMedidaErronea();
ml = -ml;
mal= -mal;
}
}
}
class Materiales{
private Muro lista;
private double colgante, amarre, canaleta, liston, angulo, tabr, ps1;
private double rdmx, cinta;
public Materiales(){
}
protected void msgIngresaUnaMedida(){
System.out.println("Ingresa una Medida");
}
protected void msgLosMAterialesSon(){
System.out.println("Los Materiales que requieres para tu proyecto son:");
}
public Materiales (double col, double arr, double can, double lis, double ang, double tr, double s1){
lista = new Muro (ml,mal);
if ( res2 < 0) {
msgIngresaUnaMedida();
}
}
}
public class Test{
public static void main(String[] args) {
}
}
| 1,617 | 0.650587 | 0.643166 | 89 | 17.078651 | 21.570488 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.539326 | false | false | 13 |
049f53167264493b28f5561fb86e7d8997634ef9 | 38,439,957,301,887 | ca63eeda5fd9dbec51ce26732e2a7d0a2ed777e5 | /java/com/Grog4r/mod/Grog4rMod.java | c3c620f8f686b1d8706ef102c963302afaa815b8 | [] | no_license | Grog4r/Ruby-and-Bananas | https://github.com/Grog4r/Ruby-and-Bananas | a4f6903e84a806f11b8fb9e3b0cda97ee788ca11 | c870941044d984f1592b989ab670768b19ba1fd7 | refs/heads/master | 2023-06-02T08:23:17.681000 | 2021-06-07T16:33:28 | 2021-06-07T16:33:28 | 263,573,127 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.Grog4r.mod;
import com.Grog4r.mod.init.BlockInitNew;
import com.Grog4r.mod.init.ItemInitNew;
import com.Grog4r.mod.objects.blocks.BananaTree;
import com.Grog4r.mod.world.gen.RubyOreGeneration;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.IForgeRegistry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@Mod("grog4rmod")
@Mod.EventBusSubscriber(modid = Grog4rMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Grog4rMod {
public static final Logger LOGGER = LogManager.getLogger();
public static final String MOD_ID = "grog4rmod";
public Grog4rMod() {
final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::setup);
modEventBus.addListener(this::doClientStuff);
ItemInitNew.ITEMS.register(modEventBus);
BlockInitNew.BLOCKS.register(modEventBus);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public static void onRegisterItems(final RegistryEvent.Register<Item> event) {
final IForgeRegistry<Item> registry = event.getRegistry();
BlockInitNew.BLOCKS.getEntries().stream().filter(block -> !(block.get() instanceof BananaTree)).map(RegistryObject::get).forEach(block -> {
final Item.Properties properties = new Item.Properties().group(Grog4rMod.TAB);
final BlockItem blockItem = new BlockItem(block, properties);
blockItem.setRegistryName(block.getRegistryName());
registry.register(blockItem);
});
LOGGER.debug("Registered BlockItems!");
}
private void setup(final FMLCommonSetupEvent event) {
}
private void doClientStuff(final FMLClientSetupEvent event) {
}
@SubscribeEvent
public static void loadCompleteEvent(FMLLoadCompleteEvent event) {
RubyOreGeneration.setupOreGeneration();
}
public static final ItemGroup TAB = new ItemGroup("grog4rTab") {
@Override
public ItemStack createIcon() {
return new ItemStack(ItemInitNew.RUBY.get());
}
};
}
| UTF-8 | Java | 2,813 | java | Grog4rMod.java | Java | [] | null | [] | package com.Grog4r.mod;
import com.Grog4r.mod.init.BlockInitNew;
import com.Grog4r.mod.init.ItemInitNew;
import com.Grog4r.mod.objects.blocks.BananaTree;
import com.Grog4r.mod.world.gen.RubyOreGeneration;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.IForgeRegistry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@Mod("grog4rmod")
@Mod.EventBusSubscriber(modid = Grog4rMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Grog4rMod {
public static final Logger LOGGER = LogManager.getLogger();
public static final String MOD_ID = "grog4rmod";
public Grog4rMod() {
final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener(this::setup);
modEventBus.addListener(this::doClientStuff);
ItemInitNew.ITEMS.register(modEventBus);
BlockInitNew.BLOCKS.register(modEventBus);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public static void onRegisterItems(final RegistryEvent.Register<Item> event) {
final IForgeRegistry<Item> registry = event.getRegistry();
BlockInitNew.BLOCKS.getEntries().stream().filter(block -> !(block.get() instanceof BananaTree)).map(RegistryObject::get).forEach(block -> {
final Item.Properties properties = new Item.Properties().group(Grog4rMod.TAB);
final BlockItem blockItem = new BlockItem(block, properties);
blockItem.setRegistryName(block.getRegistryName());
registry.register(blockItem);
});
LOGGER.debug("Registered BlockItems!");
}
private void setup(final FMLCommonSetupEvent event) {
}
private void doClientStuff(final FMLClientSetupEvent event) {
}
@SubscribeEvent
public static void loadCompleteEvent(FMLLoadCompleteEvent event) {
RubyOreGeneration.setupOreGeneration();
}
public static final ItemGroup TAB = new ItemGroup("grog4rTab") {
@Override
public ItemStack createIcon() {
return new ItemStack(ItemInitNew.RUBY.get());
}
};
}
| 2,813 | 0.749022 | 0.744045 | 76 | 36.013157 | 29.504457 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.552632 | false | false | 13 |
6a98d8339f03c86c1eee0a19f2cd1a7c3d016071 | 38,439,957,303,722 | 9d0f97c3b014406f47f24d722a0402ad730602d7 | /src/main/java/com/springstudy/method4/UserServiceImpl.java | 16f1f7d3ee23fe33a0dfc912e8b5160c7cc010fb | [] | no_license | ihaohong/aop-demo | https://github.com/ihaohong/aop-demo | 800504b95fca4758e4fdceb18747d4965928d78f | 74e3cd889cd8d928b6be05675ee76dbd6ad8d190 | refs/heads/master | 2021-04-29T13:45:30.794000 | 2018-02-16T14:36:36 | 2018-02-16T14:36:36 | 121,759,467 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.springstudy.method4;
/**
* @author haohong
*/
public class UserServiceImpl {
public void getUserList() throws Exception {
System.out.println("connect db");
long sleep = (long) (Math.random() * 5000);
// 模拟5秒内的数据库查询
Thread.sleep(sleep);
System.out.println("return user list");
}
}
| UTF-8 | Java | 363 | java | UserServiceImpl.java | Java | [
{
"context": "package com.springstudy.method4;\n\n/**\n * @author haohong\n */\npublic class UserServiceImpl {\n public voi",
"end": 56,
"score": 0.9922031164169312,
"start": 49,
"tag": "USERNAME",
"value": "haohong"
}
] | null | [] | package com.springstudy.method4;
/**
* @author haohong
*/
public class UserServiceImpl {
public void getUserList() throws Exception {
System.out.println("connect db");
long sleep = (long) (Math.random() * 5000);
// 模拟5秒内的数据库查询
Thread.sleep(sleep);
System.out.println("return user list");
}
}
| 363 | 0.618076 | 0.600583 | 14 | 23.5 | 18.172781 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 13 |
16d6d731a9205e4df0e25f053fb709e33ead90b0 | 37,142,877,188,252 | 5b5c2b9a820c5c5d9fe7978f369af5058448c4e9 | /superpom/capa_api_rest/src/main/java/es/dhr/eritrium/windows/rest/Rest.java | 96366f0029f6d6603313281c2c294c70f219f1f0 | [] | no_license | danielherrero/eritrium_contenedor_windows | https://github.com/danielherrero/eritrium_contenedor_windows | 57045dc528533d414d86181d5d7b67d5d6fa8f3c | a63e6c18fe976e6d5481f9cdbc5c78702ba5f8f2 | refs/heads/master | 2021-09-10T05:02:11.628000 | 2021-09-04T07:39:31 | 2021-09-04T07:39:31 | 168,711,962 | 0 | 0 | null | false | 2020-10-13T11:52:24 | 2019-02-01T14:47:10 | 2020-06-05T15:01:54 | 2020-10-13T11:52:23 | 48 | 0 | 0 | 1 | Java | false | false | package es.dhr.eritrium.windows.rest;
import java.util.Date;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/test")
@RequestScoped
public class Rest {
@GET
@Path("/test")
@Produces(MediaType.TEXT_PLAIN)
public Response test() {
return Response.ok("Hola desde msi en fin de semana en remoto recompilado Hora:" + new Date().toString()).build();
}
}
| UTF-8 | Java | 512 | java | Rest.java | Java | [] | null | [] | package es.dhr.eritrium.windows.rest;
import java.util.Date;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/test")
@RequestScoped
public class Rest {
@GET
@Path("/test")
@Produces(MediaType.TEXT_PLAIN)
public Response test() {
return Response.ok("Hola desde msi en fin de semana en remoto recompilado Hora:" + new Date().toString()).build();
}
}
| 512 | 0.742188 | 0.742188 | 21 | 23.380953 | 24.627659 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.809524 | false | false | 13 |
74e066d75659f3e0db7121cb733fcbc612abc29d | 38,740,605,021,803 | 310dca572a52d8b14a86082d51b12ab2731e66a0 | /src/gui/NewJFrame.java | 47600e38a3a8644870750333c958e8d0691ce835 | [] | no_license | nik0143v/information-Security-lasb | https://github.com/nik0143v/information-Security-lasb | 50f274b3fd0a77bbafcbc136c4c95532f78970da | a2d6a8675a92940f02be3b790dadd3758f39f7bd | refs/heads/master | 2021-01-10T06:27:21.628000 | 2013-03-29T06:08:10 | 2013-03-29T06:08:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gui;
import symmetric.PolyalphabeticCipher;
/**
*
* @author egor
*/
public class NewJFrame extends javax.swing.JFrame {
/**
* Creates new form NewJFrame
*/
public NewJFrame() {
initComponents();
setLocationRelativeTo(null);
}
/**
* 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() {
inputLine = new javax.swing.JTextField();
encodeLine = new javax.swing.JTextField();
decodeLine = new javax.swing.JTextField();
encodeButton = new javax.swing.JButton();
decodeButton = new javax.swing.JButton();
clearButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
algorithmTabbedPane = new javax.swing.JTabbedPane();
symmetricPanel = new javax.swing.JPanel();
SymA_magic = new javax.swing.JRadioButton();
SymA_poly = new javax.swing.JRadioButton();
asymmetricPanel = new javax.swing.JPanel();
PGPPanel = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
encodeButton.setText("encode");
encodeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
encodeButtonActionPerformed(evt);
}
});
decodeButton.setText("decode");
decodeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
decodeButtonActionPerformed(evt);
}
});
clearButton.setText("clear");
clearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearButtonActionPerformed(evt);
}
});
jLabel1.setText("Input");
jLabel2.setText("encode");
jLabel3.setText("decode");
SymA_magic.setText("magic Square");
SymA_magic.setToolTipText("");
SymA_poly.setText("polyalphabetic cipher");
javax.swing.GroupLayout symmetricPanelLayout = new javax.swing.GroupLayout(symmetricPanel);
symmetricPanel.setLayout(symmetricPanelLayout);
symmetricPanelLayout.setHorizontalGroup(
symmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(symmetricPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(symmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(SymA_magic)
.addComponent(SymA_poly))
.addContainerGap(247, Short.MAX_VALUE))
);
symmetricPanelLayout.setVerticalGroup(
symmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(symmetricPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(SymA_magic)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(SymA_poly)
.addContainerGap())
);
algorithmTabbedPane.addTab("Symmetric", symmetricPanel);
javax.swing.GroupLayout asymmetricPanelLayout = new javax.swing.GroupLayout(asymmetricPanel);
asymmetricPanel.setLayout(asymmetricPanelLayout);
asymmetricPanelLayout.setHorizontalGroup(
asymmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 380, Short.MAX_VALUE)
);
asymmetricPanelLayout.setVerticalGroup(
asymmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 72, Short.MAX_VALUE)
);
algorithmTabbedPane.addTab("Asymmetric", asymmetricPanel);
javax.swing.GroupLayout PGPPanelLayout = new javax.swing.GroupLayout(PGPPanel);
PGPPanel.setLayout(PGPPanelLayout);
PGPPanelLayout.setHorizontalGroup(
PGPPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 380, Short.MAX_VALUE)
);
PGPPanelLayout.setVerticalGroup(
PGPPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 72, Short.MAX_VALUE)
);
algorithmTabbedPane.addTab("PGP", PGPPanel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(decodeLine)
.addComponent(inputLine, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(encodeLine)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(encodeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(42, 42, 42)
.addComponent(decodeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(algorithmTabbedPane))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(algorithmTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(16, 16, 16)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(inputLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(encodeLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(decodeLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(encodeButton)
.addComponent(clearButton)
.addComponent(decodeButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
algorithmTabbedPane.getAccessibleContext().setAccessibleDescription("");
pack();
}// </editor-fold>//GEN-END:initComponents
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
// clear all lines
inputLine.setText(null);
encodeLine.setText(null);
decodeLine.setText(null);
}//GEN-LAST:event_clearButtonActionPerformed
private void encodeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_encodeButtonActionPerformed
String inputText = inputLine.getText();
String encode = "";
if (algorithmTabbedPane.getSelectedComponent() == symmetricPanel) {
if (SymA_magic.isSelected()) {
//encode = MagicSquaer().encode(inputText);
} else {
encode = new PolyalphabeticCipher().encode(inputText);
}
}
encodeLine.setText(encode);
}//GEN-LAST:event_encodeButtonActionPerformed
private void decodeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_decodeButtonActionPerformed
String encode = encodeLine.getText();
String decode = "";
if (algorithmTabbedPane.getSelectedComponent() == symmetricPanel) {
if (SymA_magic.isSelected()) {
//encode = MagicSquaer().decode(inputText);
} else {
decode = new PolyalphabeticCipher().decode(encode);
}
}
decodeLine.setText(decode);
}//GEN-LAST:event_decodeButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel PGPPanel;
private javax.swing.JRadioButton SymA_magic;
private javax.swing.JRadioButton SymA_poly;
private javax.swing.JTabbedPane algorithmTabbedPane;
private javax.swing.JPanel asymmetricPanel;
private javax.swing.JButton clearButton;
private javax.swing.JButton decodeButton;
private javax.swing.JTextField decodeLine;
private javax.swing.JButton encodeButton;
private javax.swing.JTextField encodeLine;
private javax.swing.JTextField inputLine;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel symmetricPanel;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 12,718 | java | NewJFrame.java | Java | [
{
"context": "symmetric.PolyalphabeticCipher;\n\n/**\n *\n * @author egor\n */\npublic class NewJFrame extends javax.swing.JF",
"end": 176,
"score": 0.9766577482223511,
"start": 172,
"tag": "USERNAME",
"value": "egor"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gui;
import symmetric.PolyalphabeticCipher;
/**
*
* @author egor
*/
public class NewJFrame extends javax.swing.JFrame {
/**
* Creates new form NewJFrame
*/
public NewJFrame() {
initComponents();
setLocationRelativeTo(null);
}
/**
* 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() {
inputLine = new javax.swing.JTextField();
encodeLine = new javax.swing.JTextField();
decodeLine = new javax.swing.JTextField();
encodeButton = new javax.swing.JButton();
decodeButton = new javax.swing.JButton();
clearButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
algorithmTabbedPane = new javax.swing.JTabbedPane();
symmetricPanel = new javax.swing.JPanel();
SymA_magic = new javax.swing.JRadioButton();
SymA_poly = new javax.swing.JRadioButton();
asymmetricPanel = new javax.swing.JPanel();
PGPPanel = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
encodeButton.setText("encode");
encodeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
encodeButtonActionPerformed(evt);
}
});
decodeButton.setText("decode");
decodeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
decodeButtonActionPerformed(evt);
}
});
clearButton.setText("clear");
clearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearButtonActionPerformed(evt);
}
});
jLabel1.setText("Input");
jLabel2.setText("encode");
jLabel3.setText("decode");
SymA_magic.setText("magic Square");
SymA_magic.setToolTipText("");
SymA_poly.setText("polyalphabetic cipher");
javax.swing.GroupLayout symmetricPanelLayout = new javax.swing.GroupLayout(symmetricPanel);
symmetricPanel.setLayout(symmetricPanelLayout);
symmetricPanelLayout.setHorizontalGroup(
symmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(symmetricPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(symmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(SymA_magic)
.addComponent(SymA_poly))
.addContainerGap(247, Short.MAX_VALUE))
);
symmetricPanelLayout.setVerticalGroup(
symmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(symmetricPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(SymA_magic)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(SymA_poly)
.addContainerGap())
);
algorithmTabbedPane.addTab("Symmetric", symmetricPanel);
javax.swing.GroupLayout asymmetricPanelLayout = new javax.swing.GroupLayout(asymmetricPanel);
asymmetricPanel.setLayout(asymmetricPanelLayout);
asymmetricPanelLayout.setHorizontalGroup(
asymmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 380, Short.MAX_VALUE)
);
asymmetricPanelLayout.setVerticalGroup(
asymmetricPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 72, Short.MAX_VALUE)
);
algorithmTabbedPane.addTab("Asymmetric", asymmetricPanel);
javax.swing.GroupLayout PGPPanelLayout = new javax.swing.GroupLayout(PGPPanel);
PGPPanel.setLayout(PGPPanelLayout);
PGPPanelLayout.setHorizontalGroup(
PGPPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 380, Short.MAX_VALUE)
);
PGPPanelLayout.setVerticalGroup(
PGPPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 72, Short.MAX_VALUE)
);
algorithmTabbedPane.addTab("PGP", PGPPanel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(decodeLine)
.addComponent(inputLine, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(encodeLine)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(encodeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(42, 42, 42)
.addComponent(decodeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(algorithmTabbedPane))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(algorithmTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(16, 16, 16)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(inputLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(encodeLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(decodeLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(encodeButton)
.addComponent(clearButton)
.addComponent(decodeButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
algorithmTabbedPane.getAccessibleContext().setAccessibleDescription("");
pack();
}// </editor-fold>//GEN-END:initComponents
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
// clear all lines
inputLine.setText(null);
encodeLine.setText(null);
decodeLine.setText(null);
}//GEN-LAST:event_clearButtonActionPerformed
private void encodeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_encodeButtonActionPerformed
String inputText = inputLine.getText();
String encode = "";
if (algorithmTabbedPane.getSelectedComponent() == symmetricPanel) {
if (SymA_magic.isSelected()) {
//encode = MagicSquaer().encode(inputText);
} else {
encode = new PolyalphabeticCipher().encode(inputText);
}
}
encodeLine.setText(encode);
}//GEN-LAST:event_encodeButtonActionPerformed
private void decodeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_decodeButtonActionPerformed
String encode = encodeLine.getText();
String decode = "";
if (algorithmTabbedPane.getSelectedComponent() == symmetricPanel) {
if (SymA_magic.isSelected()) {
//encode = MagicSquaer().decode(inputText);
} else {
decode = new PolyalphabeticCipher().decode(encode);
}
}
decodeLine.setText(decode);
}//GEN-LAST:event_decodeButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel PGPPanel;
private javax.swing.JRadioButton SymA_magic;
private javax.swing.JRadioButton SymA_poly;
private javax.swing.JTabbedPane algorithmTabbedPane;
private javax.swing.JPanel asymmetricPanel;
private javax.swing.JButton clearButton;
private javax.swing.JButton decodeButton;
private javax.swing.JTextField decodeLine;
private javax.swing.JButton encodeButton;
private javax.swing.JTextField encodeLine;
private javax.swing.JTextField inputLine;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel symmetricPanel;
// End of variables declaration//GEN-END:variables
}
| 12,718 | 0.650338 | 0.64507 | 274 | 45.416058 | 35.007328 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.547445 | false | false | 13 |
90fe16fd477df65c67a533c8dee7e45cba7e2e64 | 15,951,508,605,505 | 6ae8fe539583d993b4bcadf4774edfe96e36879c | /Classroom-Voting/main/model/FreeTime.java | 500beba912bc1ba9f7cab0fb5645b70329737ece | [] | no_license | jontxuander/Classroom-Voting | https://github.com/jontxuander/Classroom-Voting | d06c0c0bc83158052325ffc25aac6769c3763787 | 714cda3ceabb3b7c926fde0f259690c8607a350e | refs/heads/master | 2020-06-17T00:01:13.108000 | 2016-11-28T20:48:20 | 2016-11-28T20:48:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
public class FreeTime {
private String timeOption;
private int timeVotes;
public FreeTime(String timeOption, int timeVotes){
this.timeOption = timeOption;
this.timeVotes = timeVotes;
}
public String getTimeOptions() {
return timeOption;
}
public void setTimeOptions(String timeOption) {
this.timeOption = timeOption;
}
public int getTimeVotes() {
return timeVotes;
}
public void setTimeVotes(int timeVotes) {
this.timeVotes = timeVotes;
}
}
| UTF-8 | Java | 523 | java | FreeTime.java | Java | [] | null | [] | package model;
public class FreeTime {
private String timeOption;
private int timeVotes;
public FreeTime(String timeOption, int timeVotes){
this.timeOption = timeOption;
this.timeVotes = timeVotes;
}
public String getTimeOptions() {
return timeOption;
}
public void setTimeOptions(String timeOption) {
this.timeOption = timeOption;
}
public int getTimeVotes() {
return timeVotes;
}
public void setTimeVotes(int timeVotes) {
this.timeVotes = timeVotes;
}
}
| 523 | 0.686424 | 0.686424 | 29 | 16.034483 | 16.039783 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.37931 | false | false | 13 |
e2966fa8a12eb992ac3505f6ff9c27fe97c0e3e5 | 36,180,804,526,328 | 055b2e4dce5e6ac4986c7071dafb0d0badc33bc2 | /AndroidClient/app/src/main/java/vendetta/picar/connection/ConnectionStateEn.java | 93a713206b0bc5571b57960f6aef23a1b08deab7 | [
"MIT"
] | permissive | Ppjose/PiCar-1 | https://github.com/Ppjose/PiCar-1 | 4df11d6de45478a0210bece44eae04d21a62add6 | 5c5d8f3bd3cecf45ed51d33ebc9dc334e9d16ec0 | refs/heads/master | 2022-10-25T22:29:14.817000 | 2020-06-14T10:38:56 | 2020-06-14T10:38:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vendetta.picar.connection;
/**
* Created by Vendetta on 29-Apr-18.
*/
public enum ConnectionStateEn {
CONNECTING,
CONNECTED,
DISCONNECTED
}
| UTF-8 | Java | 164 | java | ConnectionStateEn.java | Java | [
{
"context": "kage vendetta.picar.connection;\n\n/**\n * Created by Vendetta on 29-Apr-18.\n */\n\npublic enum ConnectionStateEn ",
"end": 62,
"score": 0.9989008903503418,
"start": 54,
"tag": "NAME",
"value": "Vendetta"
}
] | null | [] | package vendetta.picar.connection;
/**
* Created by Vendetta on 29-Apr-18.
*/
public enum ConnectionStateEn {
CONNECTING,
CONNECTED,
DISCONNECTED
}
| 164 | 0.695122 | 0.670732 | 11 | 13.909091 | 13.419488 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 13 |
82d462f315cbf19b7e56be7897d8fa122a20c6d0 | 38,388,417,692,202 | bf119bc47430e5182b29add06bed9c703156c185 | /Day_n_Night/app/src/main/java/daynight/daynnight/Inventaire.java | 7322877d6c0396171e10de4ed79bdcea386c47be | [] | no_license | Andlat/SIM-2018 | https://github.com/Andlat/SIM-2018 | 9386caa226fffd8df2b1b7d264e66d9f4420a629 | 409ec498df5a6f48b910b248d227d2b650e75576 | refs/heads/master | 2022-04-05T18:12:57.343000 | 2020-01-26T19:56:42 | 2020-01-26T19:56:42 | 118,802,214 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package daynight.daynnight;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Point;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.support.design.widget.CoordinatorLayout.LayoutParams;
import android.widget.LinearLayout;
import java.util.ArrayList;
import java.util.List;
import static daynight.daynnight.ListeObjets.newInstance;
import static daynight.daynnight.MainActivity.SurChangementActivity;
import static daynight.daynnight.MainActivity.joueur;
import static daynight.daynnight.MainActivity.onPause;
public class Inventaire extends AppCompatActivity
{
//Variables
static Inventaire inventaire = new Inventaire();
static Boolean choix = false;
ImageView boutique;
TabLayout tabObjets;
ViewPager viewPager;
Fragment outilsFragment = newInstance(MainActivity.joueur.getOutilsInventaire());
Fragment skinsFragment = newInstance(MainActivity.joueur.getSkinsInventaire());
Fragment decorationsFragment = newInstance(MainActivity.joueur.getDecorationsInventaire());
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_inventaire);
inventaire = this;
notifyBarreDOutilsUpdate(this, new Bundle(), R.id.layout_barreDOutils);
//Attribuer
boutique = (ImageView) findViewById(R.id.boutique);
tabObjets = (TabLayout) findViewById(R.id.tabObjets);
viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new SectionPagerAdapter(getSupportFragmentManager()));
tabObjets.setupWithViewPager(viewPager);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
final int width = size.x;
final int height = size.y;
boutique.setOnTouchListener(new View.OnTouchListener()
{
float xRepere;
float yRepere;
float xCoord;
float yCoord;
float Xdiff;
float Ydiff;
@Override
public boolean onTouch(View view, MotionEvent event)
{
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
xRepere = event.getRawX();
yRepere = event.getRawY();
break;
case MotionEvent.ACTION_UP:
if (Xdiff <= 20 && Ydiff <= 20 && Xdiff >= -20 && Ydiff >= -20)
{
view.performClick();
startActivity(new Intent(Inventaire.this, Boutique.class));
finish();
SurChangementActivity = true;
}
break;
case MotionEvent.ACTION_MOVE:
Xdiff = event.getRawX() - xRepere;
Ydiff = event.getRawY() - yRepere;
if (Xdiff > 20 || Ydiff > 20 || Xdiff < -20 || Ydiff < -20)
{
xCoord = event.getRawX() - view.getWidth()/2;
yCoord = event.getRawY() - view.getHeight()/(1.2f);
if((xCoord + view.getWidth()) < width && (xCoord) > 0)
{
layoutParams.leftMargin = (int) xCoord;
}
if((yCoord + view.getHeight()*(1.3f)) < height && (yCoord) > tabObjets.getHeight())
{
layoutParams.topMargin = (int) yCoord;
}
}
view.setLayoutParams(layoutParams);
break;
}
return true;
}
});
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
{
}
else if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
LinearLayout layoutBarreDOutils = (LinearLayout) findViewById(R.id.layout_barreDOutils);
ViewGroup.LayoutParams params = layoutBarreDOutils.getLayoutParams();
params.width = height;
layoutBarreDOutils.setLayoutParams(params);
}
}
@Override
protected void onPause()
{
super.onPause();
//onPause = false;
}
@Override
protected void onStop()
{
if(SurChangementActivity)//TODO le problème est ici
{
MainActivity.musiqueDeFond.pause();
MainActivity.ma.sauvegardeJoueur(joueur);
}
super.onStop();
}
@Override
protected void onResume()
{
if(MainActivity.joueur.getMusique())
{
MainActivity.musiqueDeFond.start();
}
super.onResume();
}
@Override
public void onBackPressed()
{
super.onBackPressed();
SurChangementActivity = false;
}
//Méthodes
public void notifyBarreDOutilsUpdate(AppCompatActivity activity, Bundle bundle, int res)
{
Fragment barreDOutils = new BarreDOutils();
barreDOutils.setArguments(bundle);
FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
transaction.replace(res, barreDOutils);
transaction.commit();
}
//custom ArrayAdapter
public class SectionPagerAdapter extends FragmentPagerAdapter {
public SectionPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return outilsFragment;
case 1:
return skinsFragment;
case 2:
return decorationsFragment;
default:
return newInstance(new ArrayList<Outil>());
}
}
@Override
public int getCount() {
return 3;
}
//TODO allo
@Override
public void notifyDataSetChanged() {
super.notifyDataSetChanged();
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "Outils";
case 1:
return "Skins";
case 2:
return "Décorations";
default:
return "Vide";
}
}
}
}
| UTF-8 | Java | 7,515 | java | Inventaire.java | Java | [] | null | [] | package daynight.daynnight;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Point;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.support.design.widget.CoordinatorLayout.LayoutParams;
import android.widget.LinearLayout;
import java.util.ArrayList;
import java.util.List;
import static daynight.daynnight.ListeObjets.newInstance;
import static daynight.daynnight.MainActivity.SurChangementActivity;
import static daynight.daynnight.MainActivity.joueur;
import static daynight.daynnight.MainActivity.onPause;
public class Inventaire extends AppCompatActivity
{
//Variables
static Inventaire inventaire = new Inventaire();
static Boolean choix = false;
ImageView boutique;
TabLayout tabObjets;
ViewPager viewPager;
Fragment outilsFragment = newInstance(MainActivity.joueur.getOutilsInventaire());
Fragment skinsFragment = newInstance(MainActivity.joueur.getSkinsInventaire());
Fragment decorationsFragment = newInstance(MainActivity.joueur.getDecorationsInventaire());
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_inventaire);
inventaire = this;
notifyBarreDOutilsUpdate(this, new Bundle(), R.id.layout_barreDOutils);
//Attribuer
boutique = (ImageView) findViewById(R.id.boutique);
tabObjets = (TabLayout) findViewById(R.id.tabObjets);
viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new SectionPagerAdapter(getSupportFragmentManager()));
tabObjets.setupWithViewPager(viewPager);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
final int width = size.x;
final int height = size.y;
boutique.setOnTouchListener(new View.OnTouchListener()
{
float xRepere;
float yRepere;
float xCoord;
float yCoord;
float Xdiff;
float Ydiff;
@Override
public boolean onTouch(View view, MotionEvent event)
{
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
xRepere = event.getRawX();
yRepere = event.getRawY();
break;
case MotionEvent.ACTION_UP:
if (Xdiff <= 20 && Ydiff <= 20 && Xdiff >= -20 && Ydiff >= -20)
{
view.performClick();
startActivity(new Intent(Inventaire.this, Boutique.class));
finish();
SurChangementActivity = true;
}
break;
case MotionEvent.ACTION_MOVE:
Xdiff = event.getRawX() - xRepere;
Ydiff = event.getRawY() - yRepere;
if (Xdiff > 20 || Ydiff > 20 || Xdiff < -20 || Ydiff < -20)
{
xCoord = event.getRawX() - view.getWidth()/2;
yCoord = event.getRawY() - view.getHeight()/(1.2f);
if((xCoord + view.getWidth()) < width && (xCoord) > 0)
{
layoutParams.leftMargin = (int) xCoord;
}
if((yCoord + view.getHeight()*(1.3f)) < height && (yCoord) > tabObjets.getHeight())
{
layoutParams.topMargin = (int) yCoord;
}
}
view.setLayoutParams(layoutParams);
break;
}
return true;
}
});
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
{
}
else if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
LinearLayout layoutBarreDOutils = (LinearLayout) findViewById(R.id.layout_barreDOutils);
ViewGroup.LayoutParams params = layoutBarreDOutils.getLayoutParams();
params.width = height;
layoutBarreDOutils.setLayoutParams(params);
}
}
@Override
protected void onPause()
{
super.onPause();
//onPause = false;
}
@Override
protected void onStop()
{
if(SurChangementActivity)//TODO le problème est ici
{
MainActivity.musiqueDeFond.pause();
MainActivity.ma.sauvegardeJoueur(joueur);
}
super.onStop();
}
@Override
protected void onResume()
{
if(MainActivity.joueur.getMusique())
{
MainActivity.musiqueDeFond.start();
}
super.onResume();
}
@Override
public void onBackPressed()
{
super.onBackPressed();
SurChangementActivity = false;
}
//Méthodes
public void notifyBarreDOutilsUpdate(AppCompatActivity activity, Bundle bundle, int res)
{
Fragment barreDOutils = new BarreDOutils();
barreDOutils.setArguments(bundle);
FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();
transaction.replace(res, barreDOutils);
transaction.commit();
}
//custom ArrayAdapter
public class SectionPagerAdapter extends FragmentPagerAdapter {
public SectionPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return outilsFragment;
case 1:
return skinsFragment;
case 2:
return decorationsFragment;
default:
return newInstance(new ArrayList<Outil>());
}
}
@Override
public int getCount() {
return 3;
}
//TODO allo
@Override
public void notifyDataSetChanged() {
super.notifyDataSetChanged();
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "Outils";
case 1:
return "Skins";
case 2:
return "Décorations";
default:
return "Vide";
}
}
}
}
| 7,515 | 0.573083 | 0.568424 | 223 | 32.6861 | 24.989508 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533632 | false | false | 13 |
0606f9e9e5deb110f1942d65ad40170d2af29590 | 13,288,628,813,930 | 68e0aaec2bc1bd919ea09991cc3cad5b672e745c | /Rank/src/main/java/fighting/Inputs/FighterInputs.java | 9045ccdfef77aa564d5c3438d22094050e1f689c | [] | no_license | ACompleteNoobSmoke/MMARanking | https://github.com/ACompleteNoobSmoke/MMARanking | 37384259c7ab660b14cb3b331aa4b5b0ece4d4f0 | e9da63b04441b9257c27c157921578c547bfb3c4 | refs/heads/master | 2023-04-26T14:31:28.552000 | 2021-05-17T16:50:10 | 2021-05-17T16:50:10 | 282,690,647 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fighting.Inputs;
public class FighterInputs {
// Get first name input from user
public static String getFirstName() {
String firstName = "";
while (firstName.isBlank()) {
System.out.print("Enter First Name: ");
firstName = ScannerInputs.getString();
}
return firstName;
}
// Get last name input from user
public static String getLastName() {
String lastName = "";
while (lastName.isBlank()) {
System.out.print("Enter Last Name: ");
lastName = ScannerInputs.getString();
}
return lastName;
}
// Get age input from user
public static int getAge() {
int age = 0;
while (age < 19 || age > 45) {
System.out.print("Enter Age: ");
age = ScannerInputs.getInt();
}
return age;
}
// Get nickname input from user
public static String getNickName() {
String nickName = "";
System.out.print("Enter Nickname: ");
nickName = ScannerInputs.getString();
return nickName;
}
// Get gender input from user
public static String getGender() {
String gender = "";
while (gender.isBlank()) {
System.out.print("Enter Gender(M/F): ");
gender = ScannerInputs.getString();
gender = pickGender(gender);
}
return gender;
}
// Get gender according to input
private static String pickGender(String gender) {
if (gender.equalsIgnoreCase("Male") || (gender.charAt(0) == 'M') || (gender.charAt(0) == 'm')) {
gender = "Male";
} else if (gender.equalsIgnoreCase("Female") || (gender.charAt(0) == 'F') || (gender.charAt(0) == 'f')) {
gender = "Female";
} else {
return "";
}
return gender;
}
// Get wins input from user
public static int getWins() {
int wins = -1;
while (wins < 0 || wins > 45) {
System.out.print("Enter Wins: ");
wins = ScannerInputs.getInt();
winsStatement(wins);
}
return wins;
}
// Get wins statement display
private static void winsStatement(int wins) {
if (wins < 0) {
System.err.println("Wins Cannot Be Less Than 0\n");
} else if (wins > 45) {
System.err.println("Wins Cannot Be More Than 45\n");
} else {
System.out.println(wins + " Win(s) Has Been Saved\n");
}
}
// Get losses input from user
public static int getLosses() {
int losses = -1;
while (losses < 0 || losses > 20) {
System.out.print("Enter Losses: ");
losses = ScannerInputs.getInt();
lossStatement(losses);
}
return losses;
}
// Get losses statement display
private static void lossStatement(int losses) {
if (losses < 0) {
System.err.println("Losses Cannot Be Less Than 0\n");
} else if (losses > 20) {
System.err.println("Wins Cannot Be More Than 20\n");
} else {
System.out.println(losses + " Loss(es) Has Been Saved\n");
}
}
// Get draws input from user
public static int getDraws() {
int draws = -1;
while (draws < 0 || draws > 10) {
System.out.print("Enter Draws: ");
draws = ScannerInputs.getInt();
drawsStatement(draws);
}
return draws;
}
// Get draws statement display
private static void drawsStatement(int draws) {
if (draws < 0) {
System.err.println("Draws Cannot Be Less Than 0\n");
} else if (draws > 10) {
System.err.println("Draws Cannot Be More Than 10\n");
} else {
System.out.println(draws + " Draw(s) Has Been Saved\n");
}
}
// Get no contest input from user
public static int getNoContest() {
int noContest = -1;
while (noContest < 0 || noContest > 5) {
System.out.print("Enter No Contest: ");
noContest = ScannerInputs.getInt();
noContestStatement(noContest);
}
return noContest;
}
// Get no contest statement display
private static void noContestStatement(int noContest) {
if (noContest < 0) {
System.err.println("No Contest Cannot Be Less Than 0\n");
} else if (noContest > 5) {
System.err.println("No Contest Cannot Be More Than 5\n");
} else {
System.out.println(noContest + " No Contest(s) Has Been Saved\n");
}
}
} | UTF-8 | Java | 4,672 | java | FighterInputs.java | Java | [] | null | [] | package fighting.Inputs;
public class FighterInputs {
// Get first name input from user
public static String getFirstName() {
String firstName = "";
while (firstName.isBlank()) {
System.out.print("Enter First Name: ");
firstName = ScannerInputs.getString();
}
return firstName;
}
// Get last name input from user
public static String getLastName() {
String lastName = "";
while (lastName.isBlank()) {
System.out.print("Enter Last Name: ");
lastName = ScannerInputs.getString();
}
return lastName;
}
// Get age input from user
public static int getAge() {
int age = 0;
while (age < 19 || age > 45) {
System.out.print("Enter Age: ");
age = ScannerInputs.getInt();
}
return age;
}
// Get nickname input from user
public static String getNickName() {
String nickName = "";
System.out.print("Enter Nickname: ");
nickName = ScannerInputs.getString();
return nickName;
}
// Get gender input from user
public static String getGender() {
String gender = "";
while (gender.isBlank()) {
System.out.print("Enter Gender(M/F): ");
gender = ScannerInputs.getString();
gender = pickGender(gender);
}
return gender;
}
// Get gender according to input
private static String pickGender(String gender) {
if (gender.equalsIgnoreCase("Male") || (gender.charAt(0) == 'M') || (gender.charAt(0) == 'm')) {
gender = "Male";
} else if (gender.equalsIgnoreCase("Female") || (gender.charAt(0) == 'F') || (gender.charAt(0) == 'f')) {
gender = "Female";
} else {
return "";
}
return gender;
}
// Get wins input from user
public static int getWins() {
int wins = -1;
while (wins < 0 || wins > 45) {
System.out.print("Enter Wins: ");
wins = ScannerInputs.getInt();
winsStatement(wins);
}
return wins;
}
// Get wins statement display
private static void winsStatement(int wins) {
if (wins < 0) {
System.err.println("Wins Cannot Be Less Than 0\n");
} else if (wins > 45) {
System.err.println("Wins Cannot Be More Than 45\n");
} else {
System.out.println(wins + " Win(s) Has Been Saved\n");
}
}
// Get losses input from user
public static int getLosses() {
int losses = -1;
while (losses < 0 || losses > 20) {
System.out.print("Enter Losses: ");
losses = ScannerInputs.getInt();
lossStatement(losses);
}
return losses;
}
// Get losses statement display
private static void lossStatement(int losses) {
if (losses < 0) {
System.err.println("Losses Cannot Be Less Than 0\n");
} else if (losses > 20) {
System.err.println("Wins Cannot Be More Than 20\n");
} else {
System.out.println(losses + " Loss(es) Has Been Saved\n");
}
}
// Get draws input from user
public static int getDraws() {
int draws = -1;
while (draws < 0 || draws > 10) {
System.out.print("Enter Draws: ");
draws = ScannerInputs.getInt();
drawsStatement(draws);
}
return draws;
}
// Get draws statement display
private static void drawsStatement(int draws) {
if (draws < 0) {
System.err.println("Draws Cannot Be Less Than 0\n");
} else if (draws > 10) {
System.err.println("Draws Cannot Be More Than 10\n");
} else {
System.out.println(draws + " Draw(s) Has Been Saved\n");
}
}
// Get no contest input from user
public static int getNoContest() {
int noContest = -1;
while (noContest < 0 || noContest > 5) {
System.out.print("Enter No Contest: ");
noContest = ScannerInputs.getInt();
noContestStatement(noContest);
}
return noContest;
}
// Get no contest statement display
private static void noContestStatement(int noContest) {
if (noContest < 0) {
System.err.println("No Contest Cannot Be Less Than 0\n");
} else if (noContest > 5) {
System.err.println("No Contest Cannot Be More Than 5\n");
} else {
System.out.println(noContest + " No Contest(s) Has Been Saved\n");
}
}
} | 4,672 | 0.536173 | 0.526327 | 153 | 29.542484 | 21.348642 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.496732 | false | false | 13 |
1d2d19c4da1b7392df6e671714903cab8701a57e | 34,127,810,177,633 | ebc5134f77d543843c41b3a0189d6adbf78a2e17 | /NavXLibrary/NavX/NavX.java | 2d9fac663e523d772d01e8d4d457eff348cdc97e | [] | no_license | bullbots/NavXLibrary | https://github.com/bullbots/NavXLibrary | 339d0ab92d7498d2d91361b22291a95aaadaf3db | a332a1d1946e37d686f6d45bb942da7c990bbcd5 | refs/heads/master | 2016-09-10T13:04:13.022000 | 2015-04-22T01:29:33 | 2015-04-22T01:29:33 | 34,361,439 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package NavX;
import src.com.kauailabs.nav6.frc.IMUAdvanced;
import edu.wpi.first.wpilibj.SerialPort;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class NavX
{
SerialPort serial_port;
IMUAdvanced imu;
public NavX()
{
try
{
serial_port = new SerialPort(57600,SerialPort.Port.kMXP);
// You can add a second parameter to modify the
// update rate (in hz) from 4 to 100. The default is 100.
// If you need to minimize CPU load, you can set it to a
// lower value, as shown here, depending upon your needs.
// You can also use the IMUAdvanced class for advanced
// features.
byte update_rate_hz = 50;
//imu = new IMU(serial_port,update_rate_hz);
imu = new IMUAdvanced(serial_port,update_rate_hz);
}
catch( Exception ex )
{
}
}
}
| UTF-8 | Java | 816 | java | NavX.java | Java | [] | null | [] | package NavX;
import src.com.kauailabs.nav6.frc.IMUAdvanced;
import edu.wpi.first.wpilibj.SerialPort;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
public class NavX
{
SerialPort serial_port;
IMUAdvanced imu;
public NavX()
{
try
{
serial_port = new SerialPort(57600,SerialPort.Port.kMXP);
// You can add a second parameter to modify the
// update rate (in hz) from 4 to 100. The default is 100.
// If you need to minimize CPU load, you can set it to a
// lower value, as shown here, depending upon your needs.
// You can also use the IMUAdvanced class for advanced
// features.
byte update_rate_hz = 50;
//imu = new IMU(serial_port,update_rate_hz);
imu = new IMUAdvanced(serial_port,update_rate_hz);
}
catch( Exception ex )
{
}
}
}
| 816 | 0.672794 | 0.654412 | 34 | 23 | 22.50098 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.147059 | false | false | 13 |
3b32246fe60f3674cc19154082ebb22000dfb30b | 35,545,149,376,517 | b26522590e2db51d8108661c7e231bc1f341486a | /jaxrs-project/src/main/java/com/example/web/ws/client/BooksClient.java | afef7b205dba99485f8bc1ab8781566eeb5b7017 | [] | no_license | marcozfr/javaexamples | https://github.com/marcozfr/javaexamples | 1101ae8caaecb4578cf171e69a92252645eb253c | 3214af4afadbde92a5036126cb04db8d7945f594 | refs/heads/master | 2022-12-21T00:40:20.209000 | 2020-09-24T03:39:32 | 2020-09-24T03:39:32 | 54,417,834 | 0 | 1 | null | false | 2022-12-10T04:34:34 | 2016-03-21T19:47:01 | 2020-09-24T03:39:44 | 2022-12-10T04:34:33 | 19,107 | 0 | 1 | 25 | Java | false | false | package com.example.web.ws.client;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Response;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;
import com.fasterxml.jackson.databind.ObjectMapper;
public class BooksClient {
public static void main(String[] args) throws InterruptedException, ExecutionException {
CatalogWServiceImplService service = new CatalogWServiceImplService();
CatalogWServiceImpl serviceImpl = service.getCatalogWServiceImplPort();
// List<AppBook> books = serviceImpl.getBook("");
Future resp = serviceImpl.getBookAsync("", new BookHandler());
System.out.println("Finishing method main ");
// wait until book handler thread finishes
Thread.sleep(15*1000);
System.out.println("exiting");
}
static class BookHandler implements AsyncHandler<GetBookResponse>{
@Override
public void handleResponse(Response<GetBookResponse> res) {
try {
ObjectMapper om = new ObjectMapper();
GetBookResponse response = res.get();
response.getReturn().stream().forEach(a -> {
try {
Thread.sleep(1000);
System.out.println(om.writeValueAsString(a));
} catch (Exception e) {
e.printStackTrace();
}
});
} catch (InterruptedException | ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
static class BookSoapHandler implements SOAPHandler<SOAPMessageContext>{
@Override
public boolean handleMessage(SOAPMessageContext context) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean handleFault(SOAPMessageContext context) {
// TODO Auto-generated method stub
return false;
}
@Override
public void close(MessageContext context) {
// TODO Auto-generated method stub
}
@Override
public Set<QName> getHeaders() {
// TODO Auto-generated method stub
return null;
}
}
}
| UTF-8 | Java | 2,606 | java | BooksClient.java | Java | [] | null | [] | package com.example.web.ws.client;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Response;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;
import com.fasterxml.jackson.databind.ObjectMapper;
public class BooksClient {
public static void main(String[] args) throws InterruptedException, ExecutionException {
CatalogWServiceImplService service = new CatalogWServiceImplService();
CatalogWServiceImpl serviceImpl = service.getCatalogWServiceImplPort();
// List<AppBook> books = serviceImpl.getBook("");
Future resp = serviceImpl.getBookAsync("", new BookHandler());
System.out.println("Finishing method main ");
// wait until book handler thread finishes
Thread.sleep(15*1000);
System.out.println("exiting");
}
static class BookHandler implements AsyncHandler<GetBookResponse>{
@Override
public void handleResponse(Response<GetBookResponse> res) {
try {
ObjectMapper om = new ObjectMapper();
GetBookResponse response = res.get();
response.getReturn().stream().forEach(a -> {
try {
Thread.sleep(1000);
System.out.println(om.writeValueAsString(a));
} catch (Exception e) {
e.printStackTrace();
}
});
} catch (InterruptedException | ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
static class BookSoapHandler implements SOAPHandler<SOAPMessageContext>{
@Override
public boolean handleMessage(SOAPMessageContext context) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean handleFault(SOAPMessageContext context) {
// TODO Auto-generated method stub
return false;
}
@Override
public void close(MessageContext context) {
// TODO Auto-generated method stub
}
@Override
public Set<QName> getHeaders() {
// TODO Auto-generated method stub
return null;
}
}
}
| 2,606 | 0.595549 | 0.591711 | 83 | 30.397591 | 24.26408 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.373494 | false | false | 13 |
c4dac564ab47d19148d8af8ea27e2480f5d68d63 | 39,298,950,758,929 | 88443f740f1402b22c525c705a5c1657ef998c2b | /src/main/java/com/paveltrofymov/codesamples/char_counter/console/Console.java | 0ecd5ad42696818c6f032faf7d814fa1eb9c1640 | [] | no_license | Paveltrof86/JavaCodeSamples | https://github.com/Paveltrof86/JavaCodeSamples | ca3dcab24bac58214e910add442ece4508446564 | 9e4e09f465cda98a34002abdca22ef1f19f8aef4 | refs/heads/main | 2023-03-08T10:20:56.129000 | 2021-02-21T18:14:24 | 2021-02-21T18:14:24 | 340,938,385 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.paveltrofymov.codesamples.char_counter.console;
import com.paveltrofymov.codesamples.char_counter.services.StringAnalyser;
import com.paveltrofymov.codesamples.char_counter.services.StringAnalyserCacheProxy;
import java.util.Scanner;
public class Console {
static final String REQUEST_TO_DO = "Enter a string to run the programm:\nor \"ESC\" to exit";
static final String ESC = "esc";
static final String ESC_MESSAGE = "Program was terminated by the user!";
private Scanner scanner;
private StringAnalyser analyser = new StringAnalyserCacheProxy();
public Console() {}
public Console(StringAnalyser analyser) {
this.analyser = analyser;
}
public void run() {
scanner = new Scanner(System.in);
boolean exit = false;
while (!exit) {
printMessage(REQUEST_TO_DO);
String userInputStr = readLine();
exit = isExit(userInputStr);
if (!exit) {
String result = analyser.analyse(userInputStr);
printMessage(result);
}
}
printMessage(ESC_MESSAGE);
scanner.close();
}
//use package-private modifier to run junit tests
/*private*/ void printMessage(String message) {
System.out.println(message);
}
//use package-private modifier to run junit tests
/*private*/ String readLine() {
return scanner.nextLine();
}
private boolean isExit(String userInputStr) {
return userInputStr.equalsIgnoreCase(ESC);
}
}
| UTF-8 | Java | 1,577 | java | Console.java | Java | [] | null | [] | package com.paveltrofymov.codesamples.char_counter.console;
import com.paveltrofymov.codesamples.char_counter.services.StringAnalyser;
import com.paveltrofymov.codesamples.char_counter.services.StringAnalyserCacheProxy;
import java.util.Scanner;
public class Console {
static final String REQUEST_TO_DO = "Enter a string to run the programm:\nor \"ESC\" to exit";
static final String ESC = "esc";
static final String ESC_MESSAGE = "Program was terminated by the user!";
private Scanner scanner;
private StringAnalyser analyser = new StringAnalyserCacheProxy();
public Console() {}
public Console(StringAnalyser analyser) {
this.analyser = analyser;
}
public void run() {
scanner = new Scanner(System.in);
boolean exit = false;
while (!exit) {
printMessage(REQUEST_TO_DO);
String userInputStr = readLine();
exit = isExit(userInputStr);
if (!exit) {
String result = analyser.analyse(userInputStr);
printMessage(result);
}
}
printMessage(ESC_MESSAGE);
scanner.close();
}
//use package-private modifier to run junit tests
/*private*/ void printMessage(String message) {
System.out.println(message);
}
//use package-private modifier to run junit tests
/*private*/ String readLine() {
return scanner.nextLine();
}
private boolean isExit(String userInputStr) {
return userInputStr.equalsIgnoreCase(ESC);
}
}
| 1,577 | 0.641725 | 0.641725 | 53 | 28.754717 | 24.9391 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415094 | false | false | 13 |
315c860c7e6550ba97f87971a74e146209469f88 | 35,845,797,082,455 | c8866848c05e249c985c6f8d9675659b257c1a85 | /Amazing Barista/SippinStop.java | 21659ba5a8fc049b0915550206c8e694817ba305 | [] | no_license | Aravind-Rajadurai/Amazing-Barista- | https://github.com/Aravind-Rajadurai/Amazing-Barista- | 8bb880f697f47ba31064230f24520b5494bb4e1e | 1e70b96ec3d194fcae36b3982a8409f8d26d686a | refs/heads/main | 2023-02-23T10:41:58.317000 | 2021-01-28T01:46:18 | 2021-01-28T01:46:18 | 333,599,358 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
public class SippinStop {
}
| UTF-8 | Java | 50 | java | SippinStop.java | Java | [] | null | [] | package model;
public class SippinStop {
}
| 50 | 0.66 | 0.66 | 5 | 8 | 10.01998 | 25 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 13 |
39dea474fac061701197307cd0faa1258976fe45 | 35,124,242,591,326 | 6cc05521de2ae2b01f5740ba4b1ff64c0466368f | /Core/src/com/kmr/langpack/StringBufferCls.java | 528b9852c714abbddee28e344463f7ec338604e1 | [] | no_license | manoharkonde/practice | https://github.com/manoharkonde/practice | 5c104105f42bb50c10a47c02f09710ccfbf2ef1d | c49a7c8339220d7a70e7a395f45de1a7ffb67f90 | refs/heads/master | 2020-04-14T23:23:39.243000 | 2019-01-09T04:34:53 | 2019-01-09T04:34:53 | 164,200,668 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kmr.langpack;
public class StringBufferCls {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer();
System.out.println(sb.capacity());
sb.append("manoharvenkatchinmanoharvenkatch34+23");
System.out.println(sb.capacity());
System.out.println("==SB initial Capacity==");
StringBuffer sb2 = new StringBuffer(4);
System.out.println(sb2.capacity());
sb2.append("manoharmanohar1618");
System.out.println(sb2.toString());
System.out.println(sb2.capacity());
System.out.println(sb2.toString());
System.out.println("==String==");
StringBuffer sb3 = new StringBuffer("manohar");
System.out.println(sb3.capacity());
sb3.delete(5,9);
System.out.println(sb3.toString());
}
}
| UTF-8 | Java | 788 | java | StringBufferCls.java | Java | [] | null | [] | package com.kmr.langpack;
public class StringBufferCls {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer();
System.out.println(sb.capacity());
sb.append("manoharvenkatchinmanoharvenkatch34+23");
System.out.println(sb.capacity());
System.out.println("==SB initial Capacity==");
StringBuffer sb2 = new StringBuffer(4);
System.out.println(sb2.capacity());
sb2.append("manoharmanohar1618");
System.out.println(sb2.toString());
System.out.println(sb2.capacity());
System.out.println(sb2.toString());
System.out.println("==String==");
StringBuffer sb3 = new StringBuffer("manohar");
System.out.println(sb3.capacity());
sb3.delete(5,9);
System.out.println(sb3.toString());
}
}
| 788 | 0.666244 | 0.639594 | 27 | 28.185184 | 17.81185 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 13 |
ccf36dfbe1a0772a9a104e23879111dfaf2081e8 | 8,409,546,028,505 | 7715bd04327d1c352c00ffc190e644ce31d46be0 | /library/src/main/java/lushengpan/com/supportlibrary/utils/TextUilts.java | ba430e88d80c24c2acd53ae72c3a0e9b94b3ae5e | [] | no_license | lushengpan/SupportLibrary | https://github.com/lushengpan/SupportLibrary | daf482874b0c5c9f9b3093f7344e2fff6fab12ab | cf4b0c2a027e1c6a1ac40f2c85c913b830854c19 | refs/heads/master | 2021-01-19T15:35:07.916000 | 2018-12-06T03:11:34 | 2018-12-06T03:11:34 | 88,223,607 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lushengpan.com.supportlibrary.utils;
import android.content.Context;
import android.text.TextPaint;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
/**
* Created by lushengpan on 2016/12/28.
*/
public class TextUilts {
/**
* 检查字符串,不存在则赋值
*
* @param str 需要检测的字符串
* @param storage 复制的字符串
* @return
*/
public static boolean sStringValid(String str, String storage) {
if (str != null && str.trim().length() > 0) {
return true;
}
if (storage != null && storage.trim().length() > 0) {
str = storage;
return true;
}
return false;
}
/**
* 手机号码加密
*
* @param phone
* @return
*/
public static String PhoneEncryption(String phone) {
if (phone.length() == 11) {
// String phoneState = phone.substring(0, 3);
// String phoneEnd = phone.substring(phone.length() - 3, phone.length());
// return phoneState + "*****" + phoneEnd;
StringBuffer buffer = new StringBuffer(phone);
buffer.replace(3, phone.length() - 3, "*****");
return buffer.toString();
} else {
return "";
}
}
/**
* 规范数字的显示
*
* @param num
* @return 如01,12
*/
public static String Addzero(int num) {
if (num < 10) {
return "0" + num;
}
return num + "";
}
/**
* 获取字体的宽度
*
* @param context
* @param text
* @param textSize
* @return
*/
public static float TextWidth(Context context, String text, int textSize) {
TextPaint paint = new TextPaint();
float scaledDensity = (context.getResources()).getDisplayMetrics().scaledDensity;
paint.setTextSize(scaledDensity * textSize);
return paint.measureText(text);
}
/**
* 转化成带2为小数的字符串
* @param str
* @return
*/
public static String SumConversionStr(double str) {
java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return df.format(str);
}
/**
* 转化成带2为小数的double类型的
*
* @param str
* @return
*/
public static Double SumConversionDou(double str) {
java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return Double.parseDouble(df.format(str));
}
public static String ToDBC(String input) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == 12288) {
c[i] = (char) 32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
/**
* 替换、过滤特殊字符
* @param str
* @return
* @throws PatternSyntaxException
*/
public static String StringFilter(String str) throws PatternSyntaxException {
str = str.replaceAll("【", "[").replaceAll("】", "]").replaceAll("!", "!").replaceAll("(", "(").replaceAll(")", ")");// 替换中文标号
String regEx = "[『』]"; // 清除掉特殊字符
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
return m.replaceAll("").trim();
}
}
| UTF-8 | Java | 3,534 | java | TextUilts.java | Java | [
{
"context": "l.regex.PatternSyntaxException;\n\n/**\n * Created by lushengpan on 2016/12/28.\n */\n\npublic class TextUilts {\n\n\n ",
"end": 250,
"score": 0.9996801018714905,
"start": 240,
"tag": "USERNAME",
"value": "lushengpan"
}
] | null | [] | package lushengpan.com.supportlibrary.utils;
import android.content.Context;
import android.text.TextPaint;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
/**
* Created by lushengpan on 2016/12/28.
*/
public class TextUilts {
/**
* 检查字符串,不存在则赋值
*
* @param str 需要检测的字符串
* @param storage 复制的字符串
* @return
*/
public static boolean sStringValid(String str, String storage) {
if (str != null && str.trim().length() > 0) {
return true;
}
if (storage != null && storage.trim().length() > 0) {
str = storage;
return true;
}
return false;
}
/**
* 手机号码加密
*
* @param phone
* @return
*/
public static String PhoneEncryption(String phone) {
if (phone.length() == 11) {
// String phoneState = phone.substring(0, 3);
// String phoneEnd = phone.substring(phone.length() - 3, phone.length());
// return phoneState + "*****" + phoneEnd;
StringBuffer buffer = new StringBuffer(phone);
buffer.replace(3, phone.length() - 3, "*****");
return buffer.toString();
} else {
return "";
}
}
/**
* 规范数字的显示
*
* @param num
* @return 如01,12
*/
public static String Addzero(int num) {
if (num < 10) {
return "0" + num;
}
return num + "";
}
/**
* 获取字体的宽度
*
* @param context
* @param text
* @param textSize
* @return
*/
public static float TextWidth(Context context, String text, int textSize) {
TextPaint paint = new TextPaint();
float scaledDensity = (context.getResources()).getDisplayMetrics().scaledDensity;
paint.setTextSize(scaledDensity * textSize);
return paint.measureText(text);
}
/**
* 转化成带2为小数的字符串
* @param str
* @return
*/
public static String SumConversionStr(double str) {
java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return df.format(str);
}
/**
* 转化成带2为小数的double类型的
*
* @param str
* @return
*/
public static Double SumConversionDou(double str) {
java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return Double.parseDouble(df.format(str));
}
public static String ToDBC(String input) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == 12288) {
c[i] = (char) 32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
/**
* 替换、过滤特殊字符
* @param str
* @return
* @throws PatternSyntaxException
*/
public static String StringFilter(String str) throws PatternSyntaxException {
str = str.replaceAll("【", "[").replaceAll("】", "]").replaceAll("!", "!").replaceAll("(", "(").replaceAll(")", ")");// 替换中文标号
String regEx = "[『』]"; // 清除掉特殊字符
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
return m.replaceAll("").trim();
}
}
| 3,534 | 0.528477 | 0.51199 | 141 | 22.659575 | 23.22411 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.361702 | false | false | 13 |
ee796f74afb2477cfa991ea081e0e7f62abc1187 | 37,323,265,826,839 | cfd48dc2b0c9f2d59b4336909be8d5d929879a16 | /bigdata-hadoop/src/main/java/cn/aezo/hadoop/mapreduce/a02_topn/TKey.java | ec07ee5f2ac84865b7f9631927513dc9132f0970 | [
"Apache-2.0"
] | permissive | oldinaction/smjava | https://github.com/oldinaction/smjava | 2d36a9baec2f07a2bfeffb3ddf10721230edc940 | 2da3392f05c91c845dae3d8e38b89e74da04990a | refs/heads/master | 2022-12-13T03:28:10.477000 | 2021-08-23T02:17:44 | 2021-08-23T02:17:44 | 86,198,823 | 1 | 0 | Apache-2.0 | false | 2022-11-24T01:53:54 | 2017-03-26T01:08:23 | 2021-08-23T02:47:05 | 2022-11-24T01:53:51 | 39,648 | 0 | 0 | 26 | Java | false | false | package cn.aezo.hadoop.mapreduce.a02_topn;
import org.apache.hadoop.io.WritableComparable;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
// 自定义类型必须实现接口:序列化、反序列化、比较器
public class TKey implements WritableComparable<TKey> {
private int year ;
private int month;
private int day;
// 温度
private int wd;
// 地区
private String location;
@Override
public int compareTo(TKey that) {
// 为了让案例中使用sortComparator,此处先按正序排(实际此处按照降序排之后,就无需额外定义排序器)
int c1 = Integer.compare(this.year, that.getYear());
if(c1 == 0){
int c2 = Integer.compare(this.month, that.getMonth());
if(c2 == 0) {
return Integer.compare(this.day,that.getDay());
}
return c2;
}
return c1;
}
@Override
public void write(DataOutput out) throws IOException {
// 一次把数据写入到字节数组
out.writeInt(year);
out.writeInt(month);
out.writeInt(day);
out.writeInt(wd);
out.writeUTF(location);
}
@Override
public void readFields(DataInput in) throws IOException {
// 按顺序从字节数组中读取数据
this.year = in.readInt();
this.month=in.readInt();
this.day=in.readInt();
this.wd=in.readInt();
this.location = in.readUTF();
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getWd() {
return wd;
}
public void setWd(int wd) {
this.wd = wd;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}
| UTF-8 | Java | 2,172 | java | TKey.java | Java | [] | null | [] | package cn.aezo.hadoop.mapreduce.a02_topn;
import org.apache.hadoop.io.WritableComparable;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
// 自定义类型必须实现接口:序列化、反序列化、比较器
public class TKey implements WritableComparable<TKey> {
private int year ;
private int month;
private int day;
// 温度
private int wd;
// 地区
private String location;
@Override
public int compareTo(TKey that) {
// 为了让案例中使用sortComparator,此处先按正序排(实际此处按照降序排之后,就无需额外定义排序器)
int c1 = Integer.compare(this.year, that.getYear());
if(c1 == 0){
int c2 = Integer.compare(this.month, that.getMonth());
if(c2 == 0) {
return Integer.compare(this.day,that.getDay());
}
return c2;
}
return c1;
}
@Override
public void write(DataOutput out) throws IOException {
// 一次把数据写入到字节数组
out.writeInt(year);
out.writeInt(month);
out.writeInt(day);
out.writeInt(wd);
out.writeUTF(location);
}
@Override
public void readFields(DataInput in) throws IOException {
// 按顺序从字节数组中读取数据
this.year = in.readInt();
this.month=in.readInt();
this.day=in.readInt();
this.wd=in.readInt();
this.location = in.readUTF();
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getWd() {
return wd;
}
public void setWd(int wd) {
this.wd = wd;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
}
| 2,172 | 0.574018 | 0.568983 | 92 | 20.586956 | 17.156031 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413043 | false | false | 13 |
3ec9f5af3dcf4aa718ac19570cb684db0538a33a | 38,929,583,577,298 | 7ced7fe6031137d9ffc2fad525b897843c1a80a4 | /src/main/java/com/callumm/es/Server.java | 8e0805ae3076c695bb4f43f1e669e8a284b03618 | [] | no_license | PixelYeti/EmbeddedSystems | https://github.com/PixelYeti/EmbeddedSystems | ce0cd089294bebcf05a7c53c75dbd1e65d70dbef | b6effa44f38d25a1e39fb181425343c928a5df65 | refs/heads/master | 2020-03-27T15:27:41.499000 | 2018-08-30T13:55:30 | 2018-08-30T13:55:30 | 146,719,557 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.callumm.es;
import com.callumm.es.runnable.Listen;
public class Server {
private static Thread listenThread = null;
public static void startServer() {
// Start listening
listenThread = new Thread(new Listen());
listenThread.start();
}
public static void killListenThread() {
listenThread.interrupt();
}
}
| UTF-8 | Java | 375 | java | Server.java | Java | [] | null | [] | package com.callumm.es;
import com.callumm.es.runnable.Listen;
public class Server {
private static Thread listenThread = null;
public static void startServer() {
// Start listening
listenThread = new Thread(new Listen());
listenThread.start();
}
public static void killListenThread() {
listenThread.interrupt();
}
}
| 375 | 0.650667 | 0.650667 | 19 | 18.736841 | 17.938028 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 13 |
76c94eae5f977a4adad138ae9299d313fac85363 | 38,929,583,578,373 | 76fc8e6c220df135fb2393ff53448a99d41f4b67 | /src/com/sourcebits/weatherapp/bussinessenities/WeatherAtLocation.java | 4b60df22a6668bdac85ecea3372f1e2424b0101f | [] | no_license | sourcebits-harinadh/Weather-App | https://github.com/sourcebits-harinadh/Weather-App | aaf8735d129d1b908c8a8ee349859af1cb451545 | ef220c01c31189b89eab7b89a02084771886a579 | refs/heads/master | 2020-06-04T06:51:39.920000 | 2012-09-04T14:21:24 | 2012-09-04T14:21:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sourcebits.weatherapp.bussinessenities;
/**
* @author Harinadh.
* Entity for Weather At a particular Location.
*/
public class WeatherAtLocation {
/** array of Current Weather Condition entities at given location.*/
private CurrentWeatherCondition currentWeatherCondition[] = null;
/** array of Future Weather information entities at given location.*/
private FutureWeatherInfoEntity futureWeatherInfoEntity[] = null;
/** location name.*/
private String queryLocation = null;
/** location type.*/
private String locationType = null;
/** time offset.*/
private long offsetInMilliseconds ;
public CurrentWeatherCondition[] getCurrentWeatherCondition() {
return currentWeatherCondition;
}
public void setCurrentWeatherCondition(
CurrentWeatherCondition[] currentWeatherCondition) {
this.currentWeatherCondition = currentWeatherCondition;
}
public FutureWeatherInfoEntity[] getFutureWeatherInfoEntity() {
return futureWeatherInfoEntity;
}
public void setFutureWeatherInfoEntity(
FutureWeatherInfoEntity[] futureWeatherInfoEntity) {
this.futureWeatherInfoEntity = futureWeatherInfoEntity;
}
public String getQueryLocation() {
return queryLocation;
}
public void setQueryLocation(String queryLocation) {
this.queryLocation = queryLocation;
}
public String getLocationType() {
return locationType;
}
public void setLocationType(String locationType) {
this.locationType = locationType;
}
public long getOffsetInMilliseconds() {
return offsetInMilliseconds;
}
public void setOffsetInMilliseconds(long offsetInMilliseconds) {
this.offsetInMilliseconds = offsetInMilliseconds;
}
}
| UTF-8 | Java | 1,658 | java | WeatherAtLocation.java | Java | [
{
"context": "ebits.weatherapp.bussinessenities;\n\n/**\n * @author Harinadh.\n * Entity for Weather At a particular Location.\n",
"end": 76,
"score": 0.999653697013855,
"start": 68,
"tag": "NAME",
"value": "Harinadh"
}
] | null | [] | package com.sourcebits.weatherapp.bussinessenities;
/**
* @author Harinadh.
* Entity for Weather At a particular Location.
*/
public class WeatherAtLocation {
/** array of Current Weather Condition entities at given location.*/
private CurrentWeatherCondition currentWeatherCondition[] = null;
/** array of Future Weather information entities at given location.*/
private FutureWeatherInfoEntity futureWeatherInfoEntity[] = null;
/** location name.*/
private String queryLocation = null;
/** location type.*/
private String locationType = null;
/** time offset.*/
private long offsetInMilliseconds ;
public CurrentWeatherCondition[] getCurrentWeatherCondition() {
return currentWeatherCondition;
}
public void setCurrentWeatherCondition(
CurrentWeatherCondition[] currentWeatherCondition) {
this.currentWeatherCondition = currentWeatherCondition;
}
public FutureWeatherInfoEntity[] getFutureWeatherInfoEntity() {
return futureWeatherInfoEntity;
}
public void setFutureWeatherInfoEntity(
FutureWeatherInfoEntity[] futureWeatherInfoEntity) {
this.futureWeatherInfoEntity = futureWeatherInfoEntity;
}
public String getQueryLocation() {
return queryLocation;
}
public void setQueryLocation(String queryLocation) {
this.queryLocation = queryLocation;
}
public String getLocationType() {
return locationType;
}
public void setLocationType(String locationType) {
this.locationType = locationType;
}
public long getOffsetInMilliseconds() {
return offsetInMilliseconds;
}
public void setOffsetInMilliseconds(long offsetInMilliseconds) {
this.offsetInMilliseconds = offsetInMilliseconds;
}
}
| 1,658 | 0.784077 | 0.784077 | 65 | 24.507692 | 24.074324 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.123077 | false | false | 13 |
3a4cf226310c5008b595edb0f231de5ba8d202ad | 34,651,796,191,318 | 63152c4f60c3be964e9f4e315ae50cb35a75c555 | /sql/core/target/java/org/apache/spark/sql/execution/datasources/SaveIntoDataSourceCommand$.java | ef71d132ce6e73d7e8af36bbfae91f7e0be566f0 | [
"EPL-1.0",
"Classpath-exception-2.0",
"LicenseRef-scancode-unicode",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"GCC-exception-3.1",
"LGPL-2.0-or-later",
"CDDL-1.0",
"MIT",
"CC-BY-SA-3.0",
"NAIST-2003",
"LGPL-2.1-only",
"LicenseRef-scancode-other... | permissive | PowersYang/spark-cn | https://github.com/PowersYang/spark-cn | 76c407d774e35d18feb52297c68c65889a75a002 | 06a0459999131ee14864a69a15746c900e815a14 | refs/heads/master | 2022-12-11T20:18:37.376000 | 2020-03-30T09:48:22 | 2020-03-30T09:48:22 | 219,248,341 | 0 | 0 | Apache-2.0 | false | 2022-12-05T23:46:17 | 2019-11-03T03:55:17 | 2020-03-30T09:51:51 | 2022-12-05T23:46:17 | 122,973 | 0 | 0 | 13 | HTML | false | false | package org.apache.spark.sql.execution.datasources;
public class SaveIntoDataSourceCommand$ extends scala.runtime.AbstractFunction4<org.apache.spark.sql.catalyst.plans.logical.LogicalPlan, org.apache.spark.sql.sources.CreatableRelationProvider, scala.collection.immutable.Map<java.lang.String, java.lang.String>, org.apache.spark.sql.SaveMode, org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand> implements scala.Serializable {
/**
* Static reference to the singleton instance of this Scala object.
*/
public static final SaveIntoDataSourceCommand$ MODULE$ = null;
public SaveIntoDataSourceCommand$ () { throw new RuntimeException(); }
}
| UTF-8 | Java | 672 | java | SaveIntoDataSourceCommand$.java | Java | [] | null | [] | package org.apache.spark.sql.execution.datasources;
public class SaveIntoDataSourceCommand$ extends scala.runtime.AbstractFunction4<org.apache.spark.sql.catalyst.plans.logical.LogicalPlan, org.apache.spark.sql.sources.CreatableRelationProvider, scala.collection.immutable.Map<java.lang.String, java.lang.String>, org.apache.spark.sql.SaveMode, org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand> implements scala.Serializable {
/**
* Static reference to the singleton instance of this Scala object.
*/
public static final SaveIntoDataSourceCommand$ MODULE$ = null;
public SaveIntoDataSourceCommand$ () { throw new RuntimeException(); }
}
| 672 | 0.808036 | 0.806548 | 8 | 83 | 121.067131 | 394 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
2fc5a53417cb60222c933ce81c02147a27cb95f9 | 23,287,312,709,525 | e6f8eb0e0b0e79102e7fc752db59a11a3774f20d | /app/src/main/java/com/iet/ietiansdiary/navigation_activities/developers/list_data.java | 386832d5434f695e610fd680f0c55075d8c8ec1f | [] | no_license | abdulGitHb/Ietians_diary | https://github.com/abdulGitHb/Ietians_diary | e3a0d083fc8352cf7e5801465e0c34568c3787a7 | 0d1f8fbbbc75620d9b332c673f8826f16d42c966 | refs/heads/master | 2023-06-20T08:15:45.694000 | 2021-07-18T11:49:08 | 2021-07-18T11:49:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iet.ietiansdiary.navigation_activities.developers;
public class list_data {
private String mName;
private String mImgUrl;
public list_data(){
}
public list_data(String name,String imgUrl){
if (name.trim().equals("")){
name="No Name";
}
mName=name;
mImgUrl=imgUrl;
}
public String getName() {
return mName;
}
public void setName(String name) {
mName=name;
}
public String getImgUrl() {
return mImgUrl;
}
public void setImgUrl(String imgUrl) {
mImgUrl=imgUrl;
}
}
| UTF-8 | Java | 612 | java | list_data.java | Java | [] | null | [] | package com.iet.ietiansdiary.navigation_activities.developers;
public class list_data {
private String mName;
private String mImgUrl;
public list_data(){
}
public list_data(String name,String imgUrl){
if (name.trim().equals("")){
name="No Name";
}
mName=name;
mImgUrl=imgUrl;
}
public String getName() {
return mName;
}
public void setName(String name) {
mName=name;
}
public String getImgUrl() {
return mImgUrl;
}
public void setImgUrl(String imgUrl) {
mImgUrl=imgUrl;
}
}
| 612 | 0.578431 | 0.578431 | 32 | 18.125 | 15.921192 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.34375 | false | false | 13 |
83483d92e492f80a43c40f1ead935878b4b47856 | 29,729,763,628,821 | 4de42ea03460ab8b34be8d7e459161c1facf07e6 | /observer/PathObjectStatus.java | 3a0fc829f9ea39ff13434299c47abad4dc2f38a5 | [] | no_license | SergR-SPB/TestForDigitalDesign | https://github.com/SergR-SPB/TestForDigitalDesign | e504a21619ed43ef803e209aff593f5354d1f666 | f74b2f162a30b793ccf6fb651d6df1f12c9eefcf | refs/heads/master | 2020-03-15T15:54:32.998000 | 2018-05-05T07:09:34 | 2018-05-05T07:09:34 | 132,223,472 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.directory.observer;
public enum PathObjectStatus {
CREATED, DELETED, MODIFIED, MOVED
}
| UTF-8 | Java | 109 | java | PathObjectStatus.java | Java | [] | null | [] | package com.directory.observer;
public enum PathObjectStatus {
CREATED, DELETED, MODIFIED, MOVED
}
| 109 | 0.733945 | 0.733945 | 5 | 19.799999 | 15.942396 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 13 |
5e565ff660886a8ac887714c2ba6ce412581060f | 9,646,496,568,337 | e26aa4a39caf8b9bcbed476eb7135597ea5bd8ea | /domain/model/src/main/java/co/com/bancolombia/model/configmodel/gateways/ConfigRepository.java | ba291bcad43e597cf9490b28fee3740287a76992 | [] | no_license | JuanRaveC/demo-async-dynamo | https://github.com/JuanRaveC/demo-async-dynamo | f57eb28f57ad3de301b24d0db7964d2eecd3f117 | 067215a16ab0c756805d924c3059e5fcb3d91f45 | refs/heads/main | 2023-06-17T12:14:14.419000 | 2021-07-14T19:23:15 | 2021-07-14T19:23:15 | 357,598,088 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package co.com.bancolombia.model.configmodel.gateways;
import co.com.bancolombia.model.configmodel.ConfigModel;
import reactor.core.publisher.Mono;
public interface ConfigRepository {
Mono<ConfigModel> getModel(String id);
}
| UTF-8 | Java | 231 | java | ConfigRepository.java | Java | [] | null | [] | package co.com.bancolombia.model.configmodel.gateways;
import co.com.bancolombia.model.configmodel.ConfigModel;
import reactor.core.publisher.Mono;
public interface ConfigRepository {
Mono<ConfigModel> getModel(String id);
}
| 231 | 0.813853 | 0.813853 | 8 | 27.875 | 22.50243 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
a8378b6dcf124ce74b6aa84d0adb8f651bc30de9 | 1,589,137,970,191 | 4a737573240c3afd777764f9932e12c818973fc8 | /spring-server/src/main/java/io/lozzikit/users/repositories/UserRepository.java | f412cf5d84f1a26b904c1c48bd20078988723650 | [] | no_license | LozziKit/microservice-users-and-teams | https://github.com/LozziKit/microservice-users-and-teams | 53446ec6d110c7fa041fe855ff0d9d0fb0e45b83 | eb789fda8bcfb9fe41128730ce39c4fa798fcbfd | refs/heads/master | 2021-09-05T14:37:10.290000 | 2018-01-28T23:23:55 | 2018-01-28T23:23:55 | 109,398,287 | 0 | 0 | null | false | 2018-01-25T21:03:11 | 2017-11-03T13:24:11 | 2017-11-17T17:51:09 | 2018-01-25T21:03:11 | 253 | 0 | 0 | 5 | Java | false | null | package io.lozzikit.users.repositories;
import io.lozzikit.users.entities.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface UserRepository extends JpaRepository<UserEntity, Long> {
UserEntity findByUsername(String username);
@Override
List<UserEntity> findAll();
@Override
List<UserEntity> findAll(Iterable<Long> iterable);
} | UTF-8 | Java | 431 | java | UserRepository.java | Java | [] | null | [] | package io.lozzikit.users.repositories;
import io.lozzikit.users.entities.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface UserRepository extends JpaRepository<UserEntity, Long> {
UserEntity findByUsername(String username);
@Override
List<UserEntity> findAll();
@Override
List<UserEntity> findAll(Iterable<Long> iterable);
} | 431 | 0.75174 | 0.75174 | 17 | 23.470589 | 24.423031 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 13 |
b8f754aea2cc32362e0d8a3e3f36ff082b08efd4 | 12,335,146,101,954 | 9dfb2a42bd1163c10463016125729af86155b732 | /app/src/main/java/com/buddy/tiki/service/PaymentManager.java | 55378a3b485a00fedc30f5ac6947533b727be770 | [] | no_license | chefer/TikiDec | https://github.com/chefer/TikiDec | 1315794882331b5d662e89edd6127a213c0b6d10 | 0669e3e3b0dba5e6291c401e7291b1c33068400c | refs/heads/master | 2020-03-25T03:45:44.137000 | 2017-06-14T05:03:57 | 2017-06-14T05:03:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.buddy.tiki.service;
import android.support.v4.util.ArrayMap;
import com.buddy.tiki.protocol.web.PaymentApi;
import com.buddy.tiki.service.base.BaseManager;
import com.buddy.tiki.service.base.BaseManager.HttpResultFunc;
import com.buddy.tiki.service.base.HttpRequestBody;
import io.reactivex.Observable;
public class PaymentManager extends BaseManager {
private PaymentApi f932d;
protected void mo2110b() {
this.f932d = (PaymentApi) this.b.getServiceInstance(PaymentApi.class);
}
public Observable<Boolean> buyVideoMessage(String videoId) {
ArrayMap<String, Object> params = new ArrayMap();
params.put("videoId", videoId);
return this.f932d.buyVideoMessage(HttpRequestBody.getInstance().generateRequestParams(params, "1245TOPTWEAKr99TYkjh")).map(new HttpResultFunc());
}
public Observable<Boolean> googleRecharge(String receipt, String signtrue) {
ArrayMap<String, Object> params = new ArrayMap();
params.put("receipt", receipt);
params.put("signtrue", signtrue);
return this.f932d.googleRecharge(HttpRequestBody.getInstance().generateRequestParams(params, "I7Y6TOPTWEAKr99TYpl1")).map(new HttpResultFunc());
}
}
| UTF-8 | Java | 1,221 | java | PaymentManager.java | Java | [] | null | [] | package com.buddy.tiki.service;
import android.support.v4.util.ArrayMap;
import com.buddy.tiki.protocol.web.PaymentApi;
import com.buddy.tiki.service.base.BaseManager;
import com.buddy.tiki.service.base.BaseManager.HttpResultFunc;
import com.buddy.tiki.service.base.HttpRequestBody;
import io.reactivex.Observable;
public class PaymentManager extends BaseManager {
private PaymentApi f932d;
protected void mo2110b() {
this.f932d = (PaymentApi) this.b.getServiceInstance(PaymentApi.class);
}
public Observable<Boolean> buyVideoMessage(String videoId) {
ArrayMap<String, Object> params = new ArrayMap();
params.put("videoId", videoId);
return this.f932d.buyVideoMessage(HttpRequestBody.getInstance().generateRequestParams(params, "1245TOPTWEAKr99TYkjh")).map(new HttpResultFunc());
}
public Observable<Boolean> googleRecharge(String receipt, String signtrue) {
ArrayMap<String, Object> params = new ArrayMap();
params.put("receipt", receipt);
params.put("signtrue", signtrue);
return this.f932d.googleRecharge(HttpRequestBody.getInstance().generateRequestParams(params, "I7Y6TOPTWEAKr99TYpl1")).map(new HttpResultFunc());
}
}
| 1,221 | 0.74611 | 0.723178 | 29 | 41.103447 | 38.875881 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.827586 | false | false | 13 |
2f58dcaad5c6f1468131417e7f9f02ab99223a15 | 20,950,850,475,770 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/TestNonAggregatingLogHandler.java | dd7bb4f8dbb8dcb273fe7810d106e75b3544bf3b | [] | no_license | STAMP-project/dspot-experiments | https://github.com/STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919000 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | false | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | 2022-02-18T17:43:31 | 2023-01-26T23:57:40 | 651,434 | 12 | 14 | 5 | null | false | false | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler;
import YarnConfiguration.DEFAULT_NM_LOG_RETAIN_SECONDS;
import YarnConfiguration.LOG_AGGREGATION_ENABLED;
import YarnConfiguration.NM_LOG_DIRS;
import YarnConfiguration.NM_LOG_RETAIN_SECONDS;
import java.io.File;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.AbstractFileSystem;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.event.InlineDispatcher;
import org.apache.hadoop.yarn.server.api.ContainerType;
import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMMemoryStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.mockito.internal.matchers.VarargMatcher;
public class TestNonAggregatingLogHandler {
DeletionService mockDelService;
Configuration conf;
DrainDispatcher dispatcher;
private TestNonAggregatingLogHandler.ApplicationEventHandler appEventHandler;
String user = "testuser";
ApplicationId appId;
ApplicationAttemptId appAttemptId;
ContainerId container11;
LocalDirsHandlerService dirsHandler;
@Test
public void testLogDeletion() throws IOException {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 2);
String localLogDirsString = ((localLogDirs[0].getAbsolutePath()) + ",") + (localLogDirs[1].getAbsolutePath());
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, 0L);
dirsHandler.init(conf);
NonAggregatingLogHandler rawLogHandler = new NonAggregatingLogHandler(dispatcher, mockDelService, dirsHandler, new NMNullStateStoreService());
NonAggregatingLogHandler logHandler = Mockito.spy(rawLogHandler);
AbstractFileSystem spylfs = Mockito.spy(FileContext.getLocalFSFileContext().getDefaultFileSystem());
FileContext lfs = FileContext.getFileContext(spylfs, conf);
Mockito.doReturn(lfs).when(logHandler).getLocalFileContext(ArgumentMatchers.isA(Configuration.class));
FsPermission defaultPermission = FsPermission.getDirDefault().applyUMask(lfs.getUMask());
final FileStatus fs = new FileStatus(0, true, 1, 0, System.currentTimeMillis(), 0, defaultPermission, "", "", new Path(localLogDirs[0].getAbsolutePath()));
Mockito.doReturn(fs).when(spylfs).getFileStatus(ArgumentMatchers.isA(Path.class));
logHandler.init(conf);
logHandler.start();
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent(appId, user, null, null));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
Path[] localAppLogDirs = new Path[2];
localAppLogDirs[0] = new Path(localLogDirs[0].getAbsolutePath(), appId.toString());
localAppLogDirs[1] = new Path(localLogDirs[1].getAbsolutePath(), appId.toString());
TestNonAggregatingLogHandler.testDeletionServiceCall(mockDelService, user, 5000, localAppLogDirs);
logHandler.close();
for (int i = 0; i < (localLogDirs.length); i++) {
FileUtils.deleteDirectory(localLogDirs[i]);
}
}
@Test
public void testDelayedDelete() throws IOException {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 2);
String localLogDirsString = ((localLogDirs[0].getAbsolutePath()) + ",") + (localLogDirs[1].getAbsolutePath());
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, DEFAULT_NM_LOG_RETAIN_SECONDS);
dirsHandler.init(conf);
NonAggregatingLogHandler logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler);
logHandler.init(conf);
logHandler.start();
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent(appId, user, null, null));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
Path[] localAppLogDirs = new Path[2];
localAppLogDirs[0] = new Path(localLogDirs[0].getAbsolutePath(), appId.toString());
localAppLogDirs[1] = new Path(localLogDirs[1].getAbsolutePath(), appId.toString());
ScheduledThreadPoolExecutor mockSched = ((TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor) (logHandler)).mockSched;
Mockito.verify(mockSched).schedule(ArgumentMatchers.any(Runnable.class), ArgumentMatchers.eq(10800L), ArgumentMatchers.eq(TimeUnit.SECONDS));
logHandler.close();
for (int i = 0; i < (localLogDirs.length); i++) {
FileUtils.deleteDirectory(localLogDirs[i]);
}
}
@Test
public void testStop() throws Exception {
NonAggregatingLogHandler aggregatingLogHandler = new NonAggregatingLogHandler(null, null, null, new NMNullStateStoreService());
// It should not throw NullPointerException
aggregatingLogHandler.stop();
TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(null, null, null);
logHandler.init(new Configuration());
stop();
Mockito.verify(logHandler.mockSched).shutdown();
Mockito.verify(logHandler.mockSched).awaitTermination(ArgumentMatchers.eq(10L), ArgumentMatchers.eq(TimeUnit.SECONDS));
Mockito.verify(logHandler.mockSched).shutdownNow();
close();
aggregatingLogHandler.close();
}
@Test
public void testHandlingApplicationFinishedEvent() throws IOException {
DeletionService delService = new DeletionService(null);
NonAggregatingLogHandler aggregatingLogHandler = new NonAggregatingLogHandler(new InlineDispatcher(), delService, dirsHandler, new NMNullStateStoreService());
dirsHandler.init(conf);
dirsHandler.start();
delService.init(conf);
delService.start();
aggregatingLogHandler.init(conf);
aggregatingLogHandler.start();
// It should NOT throw RejectedExecutionException
aggregatingLogHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
aggregatingLogHandler.stop();
// It should NOT throw RejectedExecutionException after stopping
// handler service.
aggregatingLogHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
aggregatingLogHandler.close();
}
private class NonAggregatingLogHandlerWithMockExecutor extends NonAggregatingLogHandler {
private ScheduledThreadPoolExecutor mockSched;
public NonAggregatingLogHandlerWithMockExecutor(Dispatcher dispatcher, DeletionService delService, LocalDirsHandlerService dirsHandler) {
this(dispatcher, delService, dirsHandler, new NMNullStateStoreService());
}
public NonAggregatingLogHandlerWithMockExecutor(Dispatcher dispatcher, DeletionService delService, LocalDirsHandlerService dirsHandler, NMStateStoreService stateStore) {
super(dispatcher, delService, dirsHandler, stateStore);
}
@Override
ScheduledThreadPoolExecutor createScheduledThreadPoolExecutor(Configuration conf) {
mockSched = Mockito.mock(ScheduledThreadPoolExecutor.class);
return mockSched;
}
}
/* Test to ensure that we handle the cleanup of directories that may not have
the application log dirs we're trying to delete or may have other problems.
Test creates 7 log dirs, and fails the directory check for 4 of them and
then checks to ensure we tried to delete only the ones that passed the
check.
*/
@Test
public void testFailedDirLogDeletion() throws Exception {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 7);
final List<String> localLogDirPaths = new ArrayList<String>(localLogDirs.length);
for (int i = 0; i < (localLogDirs.length); i++) {
localLogDirPaths.add(localLogDirs[i].getAbsolutePath());
}
String localLogDirsString = StringUtils.join(localLogDirPaths, ",");
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, 0L);
LocalDirsHandlerService mockDirsHandler = Mockito.mock(LocalDirsHandlerService.class);
NonAggregatingLogHandler rawLogHandler = new NonAggregatingLogHandler(dispatcher, mockDelService, mockDirsHandler, new NMNullStateStoreService());
NonAggregatingLogHandler logHandler = Mockito.spy(rawLogHandler);
AbstractFileSystem spylfs = Mockito.spy(FileContext.getLocalFSFileContext().getDefaultFileSystem());
FileContext lfs = FileContext.getFileContext(spylfs, conf);
Mockito.doReturn(lfs).when(logHandler).getLocalFileContext(ArgumentMatchers.isA(Configuration.class));
logHandler.init(conf);
logHandler.start();
TestNonAggregatingLogHandler.runMockedFailedDirs(logHandler, appId, user, mockDelService, mockDirsHandler, conf, spylfs, lfs, localLogDirs);
logHandler.close();
}
@Test
public void testRecovery() throws Exception {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 2);
String localLogDirsString = ((localLogDirs[0].getAbsolutePath()) + ",") + (localLogDirs[1].getAbsolutePath());
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, DEFAULT_NM_LOG_RETAIN_SECONDS);
dirsHandler.init(conf);
appEventHandler.resetLogHandlingEvent();
Assert.assertFalse(appEventHandler.receiveLogHandlingFinishEvent());
NMStateStoreService stateStore = new NMMemoryStateStoreService();
stateStore.init(conf);
stateStore.start();
TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler, stateStore);
logHandler.init(conf);
start();
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent(appId, user, null, null));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
// simulate a restart and verify deletion is rescheduled
close();
logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler, stateStore);
logHandler.init(conf);
start();
ArgumentCaptor<Runnable> schedArg = ArgumentCaptor.forClass(Runnable.class);
Mockito.verify(logHandler.mockSched).schedule(schedArg.capture(), ArgumentMatchers.anyLong(), ArgumentMatchers.eq(TimeUnit.MILLISECONDS));
// execute the runnable and verify another restart has nothing scheduled
schedArg.getValue().run();
close();
logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler, stateStore);
logHandler.init(conf);
start();
Mockito.verify(logHandler.mockSched, Mockito.never()).schedule(ArgumentMatchers.any(Runnable.class), ArgumentMatchers.anyLong(), ArgumentMatchers.any(TimeUnit.class));
// wait events get drained.
this.dispatcher.await();
Assert.assertTrue(appEventHandler.receiveLogHandlingFinishEvent());
appEventHandler.resetLogHandlingEvent();
Assert.assertFalse(appEventHandler.receiveLogHandlingFailedEvent());
// send an app finish event against a removed app
handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
this.dispatcher.await();
// verify to receive a log failed event.
Assert.assertTrue(appEventHandler.receiveLogHandlingFailedEvent());
Assert.assertFalse(appEventHandler.receiveLogHandlingFinishEvent());
close();
}
static class DeletePathsMatcher implements ArgumentMatcher<Path[]> , VarargMatcher {
// to get rid of serialization warning
static final long serialVersionUID = 0;
private transient Path[] matchPaths;
DeletePathsMatcher(Path... matchPaths) {
this.matchPaths = matchPaths;
}
@Override
public boolean matches(Path[] varargs) {
return new EqualsBuilder().append(matchPaths, varargs).isEquals();
}
// function to get rid of FindBugs warning
private void readObject(ObjectInputStream os) throws NotSerializableException {
throw new NotSerializableException(this.getClass().getName());
}
}
class ApplicationEventHandler implements EventHandler<ApplicationEvent> {
private boolean logHandlingFinished = false;
private boolean logHandlingFailed = false;
@Override
public void handle(ApplicationEvent event) {
switch (event.getType()) {
case APPLICATION_LOG_HANDLING_FINISHED :
logHandlingFinished = true;
break;
case APPLICATION_LOG_HANDLING_FAILED :
logHandlingFailed = true;
default :
// do nothing.
}
}
public boolean receiveLogHandlingFinishEvent() {
return logHandlingFinished;
}
public boolean receiveLogHandlingFailedEvent() {
return logHandlingFailed;
}
public void resetLogHandlingEvent() {
logHandlingFinished = false;
logHandlingFailed = false;
}
}
}
| UTF-8 | Java | 17,161 | java | TestNonAggregatingLogHandler.java | Java | [
{
"context": "EventHandler appEventHandler;\n\n String user = \"testuser\";\n\n ApplicationId appId;\n\n ApplicationAttem",
"end": 3158,
"score": 0.9995746612548828,
"start": 3150,
"tag": "USERNAME",
"value": "testuser"
}
] | null | [] | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler;
import YarnConfiguration.DEFAULT_NM_LOG_RETAIN_SECONDS;
import YarnConfiguration.LOG_AGGREGATION_ENABLED;
import YarnConfiguration.NM_LOG_DIRS;
import YarnConfiguration.NM_LOG_RETAIN_SECONDS;
import java.io.File;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.AbstractFileSystem;
import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.event.InlineDispatcher;
import org.apache.hadoop.yarn.server.api.ContainerType;
import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMMemoryStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatcher;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.mockito.internal.matchers.VarargMatcher;
public class TestNonAggregatingLogHandler {
DeletionService mockDelService;
Configuration conf;
DrainDispatcher dispatcher;
private TestNonAggregatingLogHandler.ApplicationEventHandler appEventHandler;
String user = "testuser";
ApplicationId appId;
ApplicationAttemptId appAttemptId;
ContainerId container11;
LocalDirsHandlerService dirsHandler;
@Test
public void testLogDeletion() throws IOException {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 2);
String localLogDirsString = ((localLogDirs[0].getAbsolutePath()) + ",") + (localLogDirs[1].getAbsolutePath());
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, 0L);
dirsHandler.init(conf);
NonAggregatingLogHandler rawLogHandler = new NonAggregatingLogHandler(dispatcher, mockDelService, dirsHandler, new NMNullStateStoreService());
NonAggregatingLogHandler logHandler = Mockito.spy(rawLogHandler);
AbstractFileSystem spylfs = Mockito.spy(FileContext.getLocalFSFileContext().getDefaultFileSystem());
FileContext lfs = FileContext.getFileContext(spylfs, conf);
Mockito.doReturn(lfs).when(logHandler).getLocalFileContext(ArgumentMatchers.isA(Configuration.class));
FsPermission defaultPermission = FsPermission.getDirDefault().applyUMask(lfs.getUMask());
final FileStatus fs = new FileStatus(0, true, 1, 0, System.currentTimeMillis(), 0, defaultPermission, "", "", new Path(localLogDirs[0].getAbsolutePath()));
Mockito.doReturn(fs).when(spylfs).getFileStatus(ArgumentMatchers.isA(Path.class));
logHandler.init(conf);
logHandler.start();
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent(appId, user, null, null));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
Path[] localAppLogDirs = new Path[2];
localAppLogDirs[0] = new Path(localLogDirs[0].getAbsolutePath(), appId.toString());
localAppLogDirs[1] = new Path(localLogDirs[1].getAbsolutePath(), appId.toString());
TestNonAggregatingLogHandler.testDeletionServiceCall(mockDelService, user, 5000, localAppLogDirs);
logHandler.close();
for (int i = 0; i < (localLogDirs.length); i++) {
FileUtils.deleteDirectory(localLogDirs[i]);
}
}
@Test
public void testDelayedDelete() throws IOException {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 2);
String localLogDirsString = ((localLogDirs[0].getAbsolutePath()) + ",") + (localLogDirs[1].getAbsolutePath());
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, DEFAULT_NM_LOG_RETAIN_SECONDS);
dirsHandler.init(conf);
NonAggregatingLogHandler logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler);
logHandler.init(conf);
logHandler.start();
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent(appId, user, null, null));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
Path[] localAppLogDirs = new Path[2];
localAppLogDirs[0] = new Path(localLogDirs[0].getAbsolutePath(), appId.toString());
localAppLogDirs[1] = new Path(localLogDirs[1].getAbsolutePath(), appId.toString());
ScheduledThreadPoolExecutor mockSched = ((TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor) (logHandler)).mockSched;
Mockito.verify(mockSched).schedule(ArgumentMatchers.any(Runnable.class), ArgumentMatchers.eq(10800L), ArgumentMatchers.eq(TimeUnit.SECONDS));
logHandler.close();
for (int i = 0; i < (localLogDirs.length); i++) {
FileUtils.deleteDirectory(localLogDirs[i]);
}
}
@Test
public void testStop() throws Exception {
NonAggregatingLogHandler aggregatingLogHandler = new NonAggregatingLogHandler(null, null, null, new NMNullStateStoreService());
// It should not throw NullPointerException
aggregatingLogHandler.stop();
TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(null, null, null);
logHandler.init(new Configuration());
stop();
Mockito.verify(logHandler.mockSched).shutdown();
Mockito.verify(logHandler.mockSched).awaitTermination(ArgumentMatchers.eq(10L), ArgumentMatchers.eq(TimeUnit.SECONDS));
Mockito.verify(logHandler.mockSched).shutdownNow();
close();
aggregatingLogHandler.close();
}
@Test
public void testHandlingApplicationFinishedEvent() throws IOException {
DeletionService delService = new DeletionService(null);
NonAggregatingLogHandler aggregatingLogHandler = new NonAggregatingLogHandler(new InlineDispatcher(), delService, dirsHandler, new NMNullStateStoreService());
dirsHandler.init(conf);
dirsHandler.start();
delService.init(conf);
delService.start();
aggregatingLogHandler.init(conf);
aggregatingLogHandler.start();
// It should NOT throw RejectedExecutionException
aggregatingLogHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
aggregatingLogHandler.stop();
// It should NOT throw RejectedExecutionException after stopping
// handler service.
aggregatingLogHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
aggregatingLogHandler.close();
}
private class NonAggregatingLogHandlerWithMockExecutor extends NonAggregatingLogHandler {
private ScheduledThreadPoolExecutor mockSched;
public NonAggregatingLogHandlerWithMockExecutor(Dispatcher dispatcher, DeletionService delService, LocalDirsHandlerService dirsHandler) {
this(dispatcher, delService, dirsHandler, new NMNullStateStoreService());
}
public NonAggregatingLogHandlerWithMockExecutor(Dispatcher dispatcher, DeletionService delService, LocalDirsHandlerService dirsHandler, NMStateStoreService stateStore) {
super(dispatcher, delService, dirsHandler, stateStore);
}
@Override
ScheduledThreadPoolExecutor createScheduledThreadPoolExecutor(Configuration conf) {
mockSched = Mockito.mock(ScheduledThreadPoolExecutor.class);
return mockSched;
}
}
/* Test to ensure that we handle the cleanup of directories that may not have
the application log dirs we're trying to delete or may have other problems.
Test creates 7 log dirs, and fails the directory check for 4 of them and
then checks to ensure we tried to delete only the ones that passed the
check.
*/
@Test
public void testFailedDirLogDeletion() throws Exception {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 7);
final List<String> localLogDirPaths = new ArrayList<String>(localLogDirs.length);
for (int i = 0; i < (localLogDirs.length); i++) {
localLogDirPaths.add(localLogDirs[i].getAbsolutePath());
}
String localLogDirsString = StringUtils.join(localLogDirPaths, ",");
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, 0L);
LocalDirsHandlerService mockDirsHandler = Mockito.mock(LocalDirsHandlerService.class);
NonAggregatingLogHandler rawLogHandler = new NonAggregatingLogHandler(dispatcher, mockDelService, mockDirsHandler, new NMNullStateStoreService());
NonAggregatingLogHandler logHandler = Mockito.spy(rawLogHandler);
AbstractFileSystem spylfs = Mockito.spy(FileContext.getLocalFSFileContext().getDefaultFileSystem());
FileContext lfs = FileContext.getFileContext(spylfs, conf);
Mockito.doReturn(lfs).when(logHandler).getLocalFileContext(ArgumentMatchers.isA(Configuration.class));
logHandler.init(conf);
logHandler.start();
TestNonAggregatingLogHandler.runMockedFailedDirs(logHandler, appId, user, mockDelService, mockDirsHandler, conf, spylfs, lfs, localLogDirs);
logHandler.close();
}
@Test
public void testRecovery() throws Exception {
File[] localLogDirs = TestNonAggregatingLogHandler.getLocalLogDirFiles(this.getClass().getName(), 2);
String localLogDirsString = ((localLogDirs[0].getAbsolutePath()) + ",") + (localLogDirs[1].getAbsolutePath());
conf.set(NM_LOG_DIRS, localLogDirsString);
conf.setBoolean(LOG_AGGREGATION_ENABLED, false);
conf.setLong(NM_LOG_RETAIN_SECONDS, DEFAULT_NM_LOG_RETAIN_SECONDS);
dirsHandler.init(conf);
appEventHandler.resetLogHandlingEvent();
Assert.assertFalse(appEventHandler.receiveLogHandlingFinishEvent());
NMStateStoreService stateStore = new NMMemoryStateStoreService();
stateStore.init(conf);
stateStore.start();
TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler, stateStore);
logHandler.init(conf);
start();
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent(appId, user, null, null));
logHandler.handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
// simulate a restart and verify deletion is rescheduled
close();
logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler, stateStore);
logHandler.init(conf);
start();
ArgumentCaptor<Runnable> schedArg = ArgumentCaptor.forClass(Runnable.class);
Mockito.verify(logHandler.mockSched).schedule(schedArg.capture(), ArgumentMatchers.anyLong(), ArgumentMatchers.eq(TimeUnit.MILLISECONDS));
// execute the runnable and verify another restart has nothing scheduled
schedArg.getValue().run();
close();
logHandler = new TestNonAggregatingLogHandler.NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler, stateStore);
logHandler.init(conf);
start();
Mockito.verify(logHandler.mockSched, Mockito.never()).schedule(ArgumentMatchers.any(Runnable.class), ArgumentMatchers.anyLong(), ArgumentMatchers.any(TimeUnit.class));
// wait events get drained.
this.dispatcher.await();
Assert.assertTrue(appEventHandler.receiveLogHandlingFinishEvent());
appEventHandler.resetLogHandlingEvent();
Assert.assertFalse(appEventHandler.receiveLogHandlingFailedEvent());
// send an app finish event against a removed app
handle(new org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent(appId));
this.dispatcher.await();
// verify to receive a log failed event.
Assert.assertTrue(appEventHandler.receiveLogHandlingFailedEvent());
Assert.assertFalse(appEventHandler.receiveLogHandlingFinishEvent());
close();
}
static class DeletePathsMatcher implements ArgumentMatcher<Path[]> , VarargMatcher {
// to get rid of serialization warning
static final long serialVersionUID = 0;
private transient Path[] matchPaths;
DeletePathsMatcher(Path... matchPaths) {
this.matchPaths = matchPaths;
}
@Override
public boolean matches(Path[] varargs) {
return new EqualsBuilder().append(matchPaths, varargs).isEquals();
}
// function to get rid of FindBugs warning
private void readObject(ObjectInputStream os) throws NotSerializableException {
throw new NotSerializableException(this.getClass().getName());
}
}
class ApplicationEventHandler implements EventHandler<ApplicationEvent> {
private boolean logHandlingFinished = false;
private boolean logHandlingFailed = false;
@Override
public void handle(ApplicationEvent event) {
switch (event.getType()) {
case APPLICATION_LOG_HANDLING_FINISHED :
logHandlingFinished = true;
break;
case APPLICATION_LOG_HANDLING_FAILED :
logHandlingFailed = true;
default :
// do nothing.
}
}
public boolean receiveLogHandlingFinishEvent() {
return logHandlingFinished;
}
public boolean receiveLogHandlingFailedEvent() {
return logHandlingFailed;
}
public void resetLogHandlingEvent() {
logHandlingFinished = false;
logHandlingFailed = false;
}
}
}
| 17,161 | 0.740516 | 0.736962 | 320 | 52.625 | 44.691967 | 218 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.975 | false | false | 13 |
caad6db1268b50a702c0791a5fd3ec190ec216b7 | 33,741,263,081,049 | 4c8c1a758ad21c18156ceb2e6bcea6211d9c95a3 | /src/com/lanqiao/randomobject/Panguin.java | 1912c0303dc0bf66e947184f473c357fb24d4e40 | [] | no_license | liaoshanggang/Test | https://github.com/liaoshanggang/Test | c226f030d86db26887b04376c4bb6db2cd148fec | 49196076bc2d3d036a7d1c8d87f99a5c6e6583da | refs/heads/master | 2021-06-18T00:05:48.992000 | 2017-06-13T12:09:29 | 2017-06-13T12:09:29 | 92,383,924 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lanqiao.randomobject;
public class Panguin extends Pet{
String sex;
public void print(){
System.out.println("Panguin");
}
public Panguin() {
super();
// TODO Auto-generated constructor stub
}
public Panguin(String name,String sex) {
super(name);
// TODO Auto-generated constructor stub
this.sex = sex;
}
}
| UTF-8 | Java | 372 | java | Panguin.java | Java | [] | null | [] | package com.lanqiao.randomobject;
public class Panguin extends Pet{
String sex;
public void print(){
System.out.println("Panguin");
}
public Panguin() {
super();
// TODO Auto-generated constructor stub
}
public Panguin(String name,String sex) {
super(name);
// TODO Auto-generated constructor stub
this.sex = sex;
}
}
| 372 | 0.637097 | 0.637097 | 23 | 14.173913 | 15.092907 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.304348 | false | false | 13 |
67371a0ad50fa5e4370d8df09c399fd7bdf38f22 | 7,335,804,198,809 | cc2427882d5c54a90169003cdc6107a5ac8fc67f | /src/main/java/com/github/harbby/gadtry/graph/impl/DefaultGraph.java | 9414b38b011abdded3d6697574f27ee6769cd26d | [
"Apache-2.0"
] | permissive | harbby/gadtry | https://github.com/harbby/gadtry | 7fc2c48735174a8e6798450be0fe142de5e6c8b6 | 826dd47a7fea50d9c293ee4db962798c923f69d2 | refs/heads/master | 2023-08-04T14:40:41.376000 | 2023-07-12T04:35:03 | 2023-07-17T14:48:34 | 159,493,178 | 39 | 12 | Apache-2.0 | false | 2021-08-20T05:41:27 | 2018-11-28T11:43:35 | 2021-08-17T04:14:05 | 2021-08-20T05:41:27 | 17,398 | 37 | 9 | 0 | Java | false | false | /*
* Copyright (C) 2018 The GadTry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.harbby.gadtry.graph.impl;
import com.github.harbby.gadtry.graph.Graph;
import com.github.harbby.gadtry.graph.GraphEdge;
import com.github.harbby.gadtry.graph.GraphNode;
import com.github.harbby.gadtry.graph.Route;
import com.github.harbby.gadtry.graph.SearchBuilder;
import com.github.harbby.gadtry.graph.canvas.CanvasBuilder;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.Objects.requireNonNull;
/**
* 默认graph
* 采用普通左二叉树遍历法
* default 采用普通串行遍历(非并行)
*/
public class DefaultGraph<N, E>
implements Graph<N, E>
{
private final GraphNode<N, E> root;
private final Map<N, GraphNode<N, E>> nodes;
public DefaultGraph(
GraphNode<N, E> root,
Map<N, GraphNode<N, E>> nodes)
{
this.root = root;
this.nodes = nodes;
}
@Override
public void addNode(N node)
{
throw new UnsupportedOperationException();
}
@Override
public void addEdge(N n1, N n2)
{
throw new UnsupportedOperationException();
}
@Override
public List<Route<N, E>> searchRuleRoute(N in, Function<Route<N, E>, Boolean> rule)
{
GraphNode<N, E> begin = requireNonNull(nodes.get(in), "NO SUCH Node " + in);
return new SearchBuilder<>(this, begin)
.mode(SearchBuilder.Mode.DEPTH_FIRST)
.nextRule(rule)
.search()
.getRoutes();
}
@Override
public List<Route<N, E>> searchRuleRoute(Function<Route<N, E>, Boolean> rule)
{
return new SearchBuilder<>(this, root)
.mode(SearchBuilder.Mode.DEPTH_FIRST)
.nextRule(rule)
.search()
.getRoutes();
}
@SafeVarargs
@Override
public final Route<N, E> getRoute(N... nodeIds)
{
GraphNode<N, E> begin = requireNonNull(nodes.get(nodeIds[0]), "NO SUCH Node " + nodeIds[0]);
Route.Builder<N, E> route = Route.builder(begin);
for (int i = 1; i < nodeIds.length; i++) {
GraphEdge<N, E> edge = begin.getNextNode(nodeIds[i]).orElseThrow(() -> new IllegalArgumentException("NO SUCH ROUTE"));
route.add(edge);
begin = edge.getOutNode();
}
return route.create();
}
@Override
public GraphNode<N, E> getNode(N id)
{
return requireNonNull(nodes.get(id), "NO SUCH Node " + id);
}
@Override
public List<String> printShow()
{
List<GraphNode<?, ?>> nodes = root.nextNodes().stream().map(GraphEdge::getOutNode).collect(Collectors.toList());
return GraphUtil.printShow(nodes);
}
@Override
public CanvasBuilder<N, E> saveAsCanvas()
{
return new CanvasBuilder<>(root, nodes);
}
public void saveAsCanvas(File path)
throws IOException
{
this.saveAsCanvas().save(path);
}
@Override
public Iterable<String> printShow(N id)
{
GraphNode<N, E> firstNode = requireNonNull(nodes.get(id), "NO SUCH Node " + id);
List<String> builder = GraphUtil.printShow(firstNode);
builder.forEach(System.out::println);
return builder;
}
@Override
public List<GraphNode<N, E>> findNode(Function<GraphNode<N, E>, Boolean> rule)
{
return nodes.values().stream().filter(rule::apply).collect(Collectors.toList());
}
@Override
public SearchBuilder<N, E> search()
{
return new SearchBuilder<>(this, root);
}
}
| UTF-8 | Java | 4,277 | java | DefaultGraph.java | Java | [
{
"context": "ations under the License.\n */\npackage com.github.harbby.gadtry.graph.impl;\n\nimport com.github.harbby.gadt",
"end": 631,
"score": 0.6779689788818359,
"start": 626,
"tag": "USERNAME",
"value": "arbby"
}
] | null | [] | /*
* Copyright (C) 2018 The GadTry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.harbby.gadtry.graph.impl;
import com.github.harbby.gadtry.graph.Graph;
import com.github.harbby.gadtry.graph.GraphEdge;
import com.github.harbby.gadtry.graph.GraphNode;
import com.github.harbby.gadtry.graph.Route;
import com.github.harbby.gadtry.graph.SearchBuilder;
import com.github.harbby.gadtry.graph.canvas.CanvasBuilder;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.Objects.requireNonNull;
/**
* 默认graph
* 采用普通左二叉树遍历法
* default 采用普通串行遍历(非并行)
*/
public class DefaultGraph<N, E>
implements Graph<N, E>
{
private final GraphNode<N, E> root;
private final Map<N, GraphNode<N, E>> nodes;
public DefaultGraph(
GraphNode<N, E> root,
Map<N, GraphNode<N, E>> nodes)
{
this.root = root;
this.nodes = nodes;
}
@Override
public void addNode(N node)
{
throw new UnsupportedOperationException();
}
@Override
public void addEdge(N n1, N n2)
{
throw new UnsupportedOperationException();
}
@Override
public List<Route<N, E>> searchRuleRoute(N in, Function<Route<N, E>, Boolean> rule)
{
GraphNode<N, E> begin = requireNonNull(nodes.get(in), "NO SUCH Node " + in);
return new SearchBuilder<>(this, begin)
.mode(SearchBuilder.Mode.DEPTH_FIRST)
.nextRule(rule)
.search()
.getRoutes();
}
@Override
public List<Route<N, E>> searchRuleRoute(Function<Route<N, E>, Boolean> rule)
{
return new SearchBuilder<>(this, root)
.mode(SearchBuilder.Mode.DEPTH_FIRST)
.nextRule(rule)
.search()
.getRoutes();
}
@SafeVarargs
@Override
public final Route<N, E> getRoute(N... nodeIds)
{
GraphNode<N, E> begin = requireNonNull(nodes.get(nodeIds[0]), "NO SUCH Node " + nodeIds[0]);
Route.Builder<N, E> route = Route.builder(begin);
for (int i = 1; i < nodeIds.length; i++) {
GraphEdge<N, E> edge = begin.getNextNode(nodeIds[i]).orElseThrow(() -> new IllegalArgumentException("NO SUCH ROUTE"));
route.add(edge);
begin = edge.getOutNode();
}
return route.create();
}
@Override
public GraphNode<N, E> getNode(N id)
{
return requireNonNull(nodes.get(id), "NO SUCH Node " + id);
}
@Override
public List<String> printShow()
{
List<GraphNode<?, ?>> nodes = root.nextNodes().stream().map(GraphEdge::getOutNode).collect(Collectors.toList());
return GraphUtil.printShow(nodes);
}
@Override
public CanvasBuilder<N, E> saveAsCanvas()
{
return new CanvasBuilder<>(root, nodes);
}
public void saveAsCanvas(File path)
throws IOException
{
this.saveAsCanvas().save(path);
}
@Override
public Iterable<String> printShow(N id)
{
GraphNode<N, E> firstNode = requireNonNull(nodes.get(id), "NO SUCH Node " + id);
List<String> builder = GraphUtil.printShow(firstNode);
builder.forEach(System.out::println);
return builder;
}
@Override
public List<GraphNode<N, E>> findNode(Function<GraphNode<N, E>, Boolean> rule)
{
return nodes.values().stream().filter(rule::apply).collect(Collectors.toList());
}
@Override
public SearchBuilder<N, E> search()
{
return new SearchBuilder<>(this, root);
}
}
| 4,277 | 0.63301 | 0.629936 | 146 | 27.965754 | 27.020391 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.582192 | false | false | 13 |
b82cf6a4fbc2c587b4add4fee0ed450964b6e5d9 | 15,942,918,623,385 | 04bc9a2a266d38493406cb9c58cde3cfdbbface9 | /src/main/java/com/platform/project/olo/model/Subject.java | 9761d5717fa498716f44dc5a8334521c06a827ec | [] | no_license | bailihua93/patholo | https://github.com/bailihua93/patholo | 54e7679ca801326bb0e4a9dc2e43df327796e27d | 5ac524c4251d7dac733c5eedf9d72864eebde982 | refs/heads/master | 2020-09-26T15:15:01.688000 | 2019-01-11T00:44:23 | 2019-01-11T00:44:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.platform.project.olo.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@SuppressWarnings("serial")
@Entity
@Table(name="tb_subject")
public class Subject implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@Column
private String name;
@Column
private String address;
@Column
private String synopsis;
@Column
private Boolean visible;
@Column
private Integer sortId;
@Column
private Integer pid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Boolean getVisible() {
return visible;
}
public void setVisible(Boolean visible) {
this.visible = visible;
}
public String getSynopsis() {
return synopsis;
}
public void setSynopsis(String synopsis) {
this.synopsis = synopsis;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
}
| UTF-8 | Java | 1,543 | java | Subject.java | Java | [] | null | [] | package com.platform.project.olo.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@SuppressWarnings("serial")
@Entity
@Table(name="tb_subject")
public class Subject implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@Column
private String name;
@Column
private String address;
@Column
private String synopsis;
@Column
private Boolean visible;
@Column
private Integer sortId;
@Column
private Integer pid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Boolean getVisible() {
return visible;
}
public void setVisible(Boolean visible) {
this.visible = visible;
}
public String getSynopsis() {
return synopsis;
}
public void setSynopsis(String synopsis) {
this.synopsis = synopsis;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
}
| 1,543 | 0.693454 | 0.693454 | 78 | 17.782051 | 13.970342 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.346154 | false | false | 13 |
95a248660401e38dc691eee8f6d3c7daf2584ec7 | 21,698,174,779,817 | 0d168d04ab0c159f833c6d1bf9de5f16e4bc72e4 | /android/app/src/main/java/com/example/yyz/nswbnb_android/AddPropertyActivity.java | a56898bc1ffdc040f56b99efa53567867cdd35de | [] | no_license | Jeffrey0621/NSWBNB | https://github.com/Jeffrey0621/NSWBNB | 590ad5331f4fbb9001da1bc4169244d1973124c2 | 79d28af11aa600613012523128a914a876d670da | refs/heads/master | 2020-07-27T21:46:57.900000 | 2019-11-03T04:12:44 | 2019-11-03T04:12:44 | 209,221,467 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.yyz.nswbnb_android;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.donkingliang.imageselector.utils.ImageSelector;
import com.donkingliang.imageselector.utils.ImageSelectorUtils;
import com.example.yyz.nswbnb_android.BaseBean.UpLoadImageBean;
import com.google.gson.Gson;
import com.wang.avi.AVLoadingIndicatorView;
import org.angmarch.views.NiceSpinner;
import org.angmarch.views.OnSpinnerItemSelectedListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import es.dmoral.toasty.Toasty;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class AddPropertyActivity extends AppCompatActivity {
private EditText property_name, property_price, property_description, property_amenities;
private Button property_save, property_upload;
private NiceSpinner property_guest_number, property_bedroom_number, property_bed_number, property_bathroom_number,
property_type, property_city, property_country, property_suburb;
private List<String> numguest, numbed, numbedroom, numbathroom;
private List<String> proptype;
private static final int REQUEST_CODE = 0x00000011;
private ArrayList<String> imagesurl = new ArrayList<>();
private AVLoadingIndicatorView avi;
private ArrayList<String> country = new ArrayList<>();
private ArrayList<String> city = new ArrayList<>();
private ArrayList<ArrayList<String>> suburb = new ArrayList<>();
private ArrayList<String> suburb1 = new ArrayList<>();
private ArrayList<String> suburb2 = new ArrayList<>();
private LinearLayout checklist;
private List<CheckBox> checkBoxList = new ArrayList<CheckBox>();
private ArrayList<String> selected;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_property);
initView();
intiData();
checkFunction();
initToolBar();
property_save.setEnabled(false);
property_upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ImageSelector.builder()
.useCamera(true)
.setSingle(false)
.setMaxSelectCount(5)
.setSelected(selected)
.setViewImage(true) //Click to enlarge the image
.start(AddPropertyActivity.this, REQUEST_CODE);
}
});
property_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String checkstr = "";
for (CheckBox checkBox : checkBoxList) {
if (checkBox.isChecked()) {
checkstr += checkBox.getText().toString() + ",";
}
}
if(checkstr == ""||property_name.getText().toString() == "" || property_guest_number.getSelectedItem().toString() == "number of guests" ||
property_bed_number.getSelectedItem().toString() == "number of beds" || property_bedroom_number.getSelectedItem().toString() == "number of bedrooms"||
property_bathroom_number.getSelectedItem().toString() == "number of bathrooms" || property_type.getSelectedItem().toString() == "" ||
property_country.getSelectedIndex() == 0 || property_city.getSelectedIndex() == 0 ||
property_suburb.getSelectedIndex() == 0 ||
property_price.getText().toString() == "" || property_description.getText().toString() == "" || imagesurl.size() != 5){
Toasty.error(AddPropertyActivity.this, "All information are needed.", Toast.LENGTH_SHORT, true).show();
}else {
String finalurls = imagesurl.get(0);
for (int i = 1; i < imagesurl.size(); i++) {
finalurls = finalurls + "," + imagesurl.get(i);
}
SharedPreferences sharedPreferences = AddPropertyActivity.this.getSharedPreferences("USERINFO", Activity.MODE_PRIVATE);
int userid = sharedPreferences.getInt("userid",0);
OkHttpClient okHttpClient = new OkHttpClient();
FormBody.Builder formbody = new FormBody.Builder();
String token =sharedPreferences.getString("token","");
formbody.add("host_id", String.valueOf(userid));
formbody.add("name", property_name.getText().toString());
formbody.add("num_guests", property_guest_number.getSelectedItem().toString());
formbody.add("num_bedrooms", property_bedroom_number.getSelectedItem().toString());
formbody.add("num_beds", property_bed_number.getSelectedItem().toString());
formbody.add("num_bathrooms", property_bathroom_number.getSelectedItem().toString());
formbody.add("property_type", property_type.getSelectedItem().toString());
formbody.add("country", property_country.getSelectedItem().toString());
formbody.add("city", property_city.getSelectedItem().toString());
formbody.add("suburb", property_suburb.getSelectedItem().toString());
formbody.add("price", String.valueOf((Integer.valueOf(property_price.getText().toString())*100)));
formbody.add("description", property_description.getText().toString());
formbody.add("amenities", checkstr.substring(0, checkstr.length() - 1));
formbody.add("image_urls", finalurls);
formbody.add("token", token);
Request request = new Request.Builder()
.url("http://nswbnb.herokuapp.com/api/accommodation")
.post(formbody.build())
.build();
okHttpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Toasty.error(AddPropertyActivity.this, e.toString(), Toast.LENGTH_SHORT, true).show();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.code() == 201){
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toasty.success(AddPropertyActivity.this, "Add successfully", Toast.LENGTH_SHORT, true).show();
Intent intent = new Intent(AddPropertyActivity.this,MainActivity.class);
startActivity(intent);
}
});
}
}
});
}
}
});
}
private void initToolBar() {
Toolbar toolbar = findViewById(R.id.add_property_toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
selected = data.getStringArrayListExtra(ImageSelector.SELECT_RESULT);
if (requestCode == REQUEST_CODE && data != null&&selected.size()==5) {
ArrayList<String> images = data.getStringArrayListExtra(
ImageSelectorUtils.SELECT_RESULT);
boolean isCameraImage = data.getBooleanExtra(ImageSelector.IS_CAMERA_IMAGE, false);
property_upload.setVisibility(View.GONE);
try {
for (int i = 0; i < images.size(); i++) {
avi.show();
avi.setVisibility(View.VISIBLE);
uploadImage(images.get(i));
}
} catch (IOException e) {
e.printStackTrace();
}
}else {
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toasty.error(AddPropertyActivity.this, "At least 5 pictures.", Toast.LENGTH_SHORT, true).show();
}
});
}
}
public String uploadImage(String imagePath) throws IOException {
final OkHttpClient okHttpClient = new OkHttpClient();
File file = new File(imagePath);
final RequestBody image = RequestBody.create(MediaType.parse("image/jpg"), file);
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", imagePath, image)
.build();
Request request = new Request.Builder()
.url("https://imgurl.org/api/upload")
.post(requestBody)
.build();
final UpLoadImageBean upLoadImageBean;
okHttpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.e("fail", e.toString());
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
avi.hide();
avi.setVisibility(View.GONE);
property_upload.setText("Upload failed,upload again.");
imagesurl.clear();
property_upload.setVisibility(View.VISIBLE);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String n = response.body().string();
UpLoadImageBean upLoadImageBean = new Gson().fromJson(n, UpLoadImageBean.class);
imagesurl.add(upLoadImageBean.getUrl());
Log.e("success", String.valueOf(upLoadImageBean.getUrl()));
if (imagesurl.size() == 5) {
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
property_save.setEnabled(true);
avi.hide();
avi.setVisibility(View.GONE);
}
});
}
}
});
return "url";
}
private void initView() {
property_name = findViewById(R.id.property_name);
property_guest_number = findViewById(R.id.property_guest_number);
property_bedroom_number = findViewById(R.id.property_bedroom_number);
property_bed_number = findViewById(R.id.property_bed_number);
property_bathroom_number = findViewById(R.id.property_bathroom_number);
property_type = findViewById(R.id.property_type);
property_price = findViewById(R.id.property_price);
property_description = findViewById(R.id.property_description);
property_save = findViewById(R.id.property_save);
property_upload = findViewById(R.id.property_upload);
avi = findViewById(R.id.avi);
property_country = findViewById(R.id.property_country);
property_city = findViewById(R.id.property_city);
property_suburb = findViewById(R.id.property_suburb);
checklist = findViewById(R.id.checklist);
}
private void intiData() {
country.add("Australia");
country.add("Australia");
city.add("Sydney");
city.add("Randwick");
suburb1.add("city");
suburb1.add("test");
suburb2.add("Zetland");
suburb2.add("Kingsford");
suburb2.add("Surry Hills");
suburb.add(suburb1);
suburb.add(suburb2);
numguest = new LinkedList<>(Arrays.asList("number of guests","1", "2", "3", "4", "5", "6"));
property_guest_number.setTag("number of guests");
property_guest_number.attachDataSource(numguest);
numbed = new LinkedList<>(Arrays.asList("number of beds","1", "2", "3"));
property_bed_number.attachDataSource(numbed);
numbedroom = new LinkedList<>(Arrays.asList("number of bedrooms","1", "2", "3"));
property_bedroom_number.attachDataSource(numbedroom);
numbathroom = new LinkedList<>(Arrays.asList("number of bathrooms","1", "2", "3"));
property_bathroom_number.attachDataSource(numbathroom);
proptype = new LinkedList<>(Arrays.asList("Apartment", "unit", "house"));
property_type.attachDataSource(proptype);
property_country.attachDataSource(country);
property_city.attachDataSource(city);
property_suburb.attachDataSource(suburb.get(0));
property_country.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener() {
@Override
public void onItemSelected(NiceSpinner parent, View view, int position, long id) {
String a = property_country.getItemAtPosition(position).toString();
Log.e("country", a);
}
});
property_city.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener() {
@Override
public void onItemSelected(NiceSpinner parent, View view, int position, long id) {
property_suburb.attachDataSource(suburb.get(position));
String b = property_city.getItemAtPosition(position).toString();
Log.e("city", b);
}
});
property_suburb.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener() {
@Override
public void onItemSelected(NiceSpinner parent, View view, int position, long id) {
String c = property_suburb.getItemAtPosition(position).toString();
Log.e("suburb", c);
}
});
}
private void checkFunction() {
String[] strArr = {"TV", "Kitchen", "Elevator", "WIFI", "Balcony", "Washer"};
for (String str : strArr) {
CheckBox checkBox = (CheckBox) View.inflate(this, R.layout.checkbox, null);
checkBox.setText(str);
checklist.addView(checkBox);
checkBoxList.add(checkBox);
}
}
}
| UTF-8 | Java | 15,625 | java | AddPropertyActivity.java | Java | [
{
"context": ");\n\n city.add(\"Sydney\");\n city.add(\"Randwick\");\n\n suburb1.add(\"city\");\n suburb1.",
"end": 12921,
"score": 0.9964439272880554,
"start": 12913,
"tag": "NAME",
"value": "Randwick"
},
{
"context": " suburb2.add(\"Zetland\");\n ... | null | [] | package com.example.yyz.nswbnb_android;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.donkingliang.imageselector.utils.ImageSelector;
import com.donkingliang.imageselector.utils.ImageSelectorUtils;
import com.example.yyz.nswbnb_android.BaseBean.UpLoadImageBean;
import com.google.gson.Gson;
import com.wang.avi.AVLoadingIndicatorView;
import org.angmarch.views.NiceSpinner;
import org.angmarch.views.OnSpinnerItemSelectedListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import es.dmoral.toasty.Toasty;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class AddPropertyActivity extends AppCompatActivity {
private EditText property_name, property_price, property_description, property_amenities;
private Button property_save, property_upload;
private NiceSpinner property_guest_number, property_bedroom_number, property_bed_number, property_bathroom_number,
property_type, property_city, property_country, property_suburb;
private List<String> numguest, numbed, numbedroom, numbathroom;
private List<String> proptype;
private static final int REQUEST_CODE = 0x00000011;
private ArrayList<String> imagesurl = new ArrayList<>();
private AVLoadingIndicatorView avi;
private ArrayList<String> country = new ArrayList<>();
private ArrayList<String> city = new ArrayList<>();
private ArrayList<ArrayList<String>> suburb = new ArrayList<>();
private ArrayList<String> suburb1 = new ArrayList<>();
private ArrayList<String> suburb2 = new ArrayList<>();
private LinearLayout checklist;
private List<CheckBox> checkBoxList = new ArrayList<CheckBox>();
private ArrayList<String> selected;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_property);
initView();
intiData();
checkFunction();
initToolBar();
property_save.setEnabled(false);
property_upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ImageSelector.builder()
.useCamera(true)
.setSingle(false)
.setMaxSelectCount(5)
.setSelected(selected)
.setViewImage(true) //Click to enlarge the image
.start(AddPropertyActivity.this, REQUEST_CODE);
}
});
property_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String checkstr = "";
for (CheckBox checkBox : checkBoxList) {
if (checkBox.isChecked()) {
checkstr += checkBox.getText().toString() + ",";
}
}
if(checkstr == ""||property_name.getText().toString() == "" || property_guest_number.getSelectedItem().toString() == "number of guests" ||
property_bed_number.getSelectedItem().toString() == "number of beds" || property_bedroom_number.getSelectedItem().toString() == "number of bedrooms"||
property_bathroom_number.getSelectedItem().toString() == "number of bathrooms" || property_type.getSelectedItem().toString() == "" ||
property_country.getSelectedIndex() == 0 || property_city.getSelectedIndex() == 0 ||
property_suburb.getSelectedIndex() == 0 ||
property_price.getText().toString() == "" || property_description.getText().toString() == "" || imagesurl.size() != 5){
Toasty.error(AddPropertyActivity.this, "All information are needed.", Toast.LENGTH_SHORT, true).show();
}else {
String finalurls = imagesurl.get(0);
for (int i = 1; i < imagesurl.size(); i++) {
finalurls = finalurls + "," + imagesurl.get(i);
}
SharedPreferences sharedPreferences = AddPropertyActivity.this.getSharedPreferences("USERINFO", Activity.MODE_PRIVATE);
int userid = sharedPreferences.getInt("userid",0);
OkHttpClient okHttpClient = new OkHttpClient();
FormBody.Builder formbody = new FormBody.Builder();
String token =sharedPreferences.getString("token","");
formbody.add("host_id", String.valueOf(userid));
formbody.add("name", property_name.getText().toString());
formbody.add("num_guests", property_guest_number.getSelectedItem().toString());
formbody.add("num_bedrooms", property_bedroom_number.getSelectedItem().toString());
formbody.add("num_beds", property_bed_number.getSelectedItem().toString());
formbody.add("num_bathrooms", property_bathroom_number.getSelectedItem().toString());
formbody.add("property_type", property_type.getSelectedItem().toString());
formbody.add("country", property_country.getSelectedItem().toString());
formbody.add("city", property_city.getSelectedItem().toString());
formbody.add("suburb", property_suburb.getSelectedItem().toString());
formbody.add("price", String.valueOf((Integer.valueOf(property_price.getText().toString())*100)));
formbody.add("description", property_description.getText().toString());
formbody.add("amenities", checkstr.substring(0, checkstr.length() - 1));
formbody.add("image_urls", finalurls);
formbody.add("token", token);
Request request = new Request.Builder()
.url("http://nswbnb.herokuapp.com/api/accommodation")
.post(formbody.build())
.build();
okHttpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Toasty.error(AddPropertyActivity.this, e.toString(), Toast.LENGTH_SHORT, true).show();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(response.code() == 201){
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toasty.success(AddPropertyActivity.this, "Add successfully", Toast.LENGTH_SHORT, true).show();
Intent intent = new Intent(AddPropertyActivity.this,MainActivity.class);
startActivity(intent);
}
});
}
}
});
}
}
});
}
private void initToolBar() {
Toolbar toolbar = findViewById(R.id.add_property_toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
selected = data.getStringArrayListExtra(ImageSelector.SELECT_RESULT);
if (requestCode == REQUEST_CODE && data != null&&selected.size()==5) {
ArrayList<String> images = data.getStringArrayListExtra(
ImageSelectorUtils.SELECT_RESULT);
boolean isCameraImage = data.getBooleanExtra(ImageSelector.IS_CAMERA_IMAGE, false);
property_upload.setVisibility(View.GONE);
try {
for (int i = 0; i < images.size(); i++) {
avi.show();
avi.setVisibility(View.VISIBLE);
uploadImage(images.get(i));
}
} catch (IOException e) {
e.printStackTrace();
}
}else {
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toasty.error(AddPropertyActivity.this, "At least 5 pictures.", Toast.LENGTH_SHORT, true).show();
}
});
}
}
public String uploadImage(String imagePath) throws IOException {
final OkHttpClient okHttpClient = new OkHttpClient();
File file = new File(imagePath);
final RequestBody image = RequestBody.create(MediaType.parse("image/jpg"), file);
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", imagePath, image)
.build();
Request request = new Request.Builder()
.url("https://imgurl.org/api/upload")
.post(requestBody)
.build();
final UpLoadImageBean upLoadImageBean;
okHttpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.e("fail", e.toString());
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
avi.hide();
avi.setVisibility(View.GONE);
property_upload.setText("Upload failed,upload again.");
imagesurl.clear();
property_upload.setVisibility(View.VISIBLE);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String n = response.body().string();
UpLoadImageBean upLoadImageBean = new Gson().fromJson(n, UpLoadImageBean.class);
imagesurl.add(upLoadImageBean.getUrl());
Log.e("success", String.valueOf(upLoadImageBean.getUrl()));
if (imagesurl.size() == 5) {
AddPropertyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
property_save.setEnabled(true);
avi.hide();
avi.setVisibility(View.GONE);
}
});
}
}
});
return "url";
}
private void initView() {
property_name = findViewById(R.id.property_name);
property_guest_number = findViewById(R.id.property_guest_number);
property_bedroom_number = findViewById(R.id.property_bedroom_number);
property_bed_number = findViewById(R.id.property_bed_number);
property_bathroom_number = findViewById(R.id.property_bathroom_number);
property_type = findViewById(R.id.property_type);
property_price = findViewById(R.id.property_price);
property_description = findViewById(R.id.property_description);
property_save = findViewById(R.id.property_save);
property_upload = findViewById(R.id.property_upload);
avi = findViewById(R.id.avi);
property_country = findViewById(R.id.property_country);
property_city = findViewById(R.id.property_city);
property_suburb = findViewById(R.id.property_suburb);
checklist = findViewById(R.id.checklist);
}
private void intiData() {
country.add("Australia");
country.add("Australia");
city.add("Sydney");
city.add("Randwick");
suburb1.add("city");
suburb1.add("test");
suburb2.add("Zetland");
suburb2.add("Kingsford");
suburb2.add("<NAME>");
suburb.add(suburb1);
suburb.add(suburb2);
numguest = new LinkedList<>(Arrays.asList("number of guests","1", "2", "3", "4", "5", "6"));
property_guest_number.setTag("number of guests");
property_guest_number.attachDataSource(numguest);
numbed = new LinkedList<>(Arrays.asList("number of beds","1", "2", "3"));
property_bed_number.attachDataSource(numbed);
numbedroom = new LinkedList<>(Arrays.asList("number of bedrooms","1", "2", "3"));
property_bedroom_number.attachDataSource(numbedroom);
numbathroom = new LinkedList<>(Arrays.asList("number of bathrooms","1", "2", "3"));
property_bathroom_number.attachDataSource(numbathroom);
proptype = new LinkedList<>(Arrays.asList("Apartment", "unit", "house"));
property_type.attachDataSource(proptype);
property_country.attachDataSource(country);
property_city.attachDataSource(city);
property_suburb.attachDataSource(suburb.get(0));
property_country.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener() {
@Override
public void onItemSelected(NiceSpinner parent, View view, int position, long id) {
String a = property_country.getItemAtPosition(position).toString();
Log.e("country", a);
}
});
property_city.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener() {
@Override
public void onItemSelected(NiceSpinner parent, View view, int position, long id) {
property_suburb.attachDataSource(suburb.get(position));
String b = property_city.getItemAtPosition(position).toString();
Log.e("city", b);
}
});
property_suburb.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener() {
@Override
public void onItemSelected(NiceSpinner parent, View view, int position, long id) {
String c = property_suburb.getItemAtPosition(position).toString();
Log.e("suburb", c);
}
});
}
private void checkFunction() {
String[] strArr = {"TV", "Kitchen", "Elevator", "WIFI", "Balcony", "Washer"};
for (String str : strArr) {
CheckBox checkBox = (CheckBox) View.inflate(this, R.layout.checkbox, null);
checkBox.setText(str);
checklist.addView(checkBox);
checkBoxList.add(checkBox);
}
}
}
| 15,620 | 0.58496 | 0.5808 | 354 | 43.138416 | 32.800468 | 174 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.898305 | false | false | 13 |
6f53bd6d4fd44c0b6df64be82b7a99006298bdf5 | 3,813,931,002,258 | 8c0c204e49fc3fb330a96d3b1c171b56601a9fe1 | /app/src/main/java/com/tsurkis/timdicatorsampleapp/Adapter.java | 9657c4e76c48fb01af6ba8140d661eff6af85ba2 | [
"Apache-2.0"
] | permissive | TSurkis/Timdicator | https://github.com/TSurkis/Timdicator | 4bb1e7bdeebaee1914d1d9c57a97d3d4fd52564d | 164f8e69d87f9cb05b676eef86bae1cfece142af | refs/heads/master | 2021-05-05T23:28:09.049000 | 2019-03-18T11:35:22 | 2019-03-18T11:35:22 | 116,719,324 | 25 | 7 | Apache-2.0 | false | 2019-03-18T11:35:23 | 2018-01-08T19:35:30 | 2019-03-17T10:08:43 | 2019-03-18T11:35:22 | 2,480 | 15 | 5 | 0 | Java | false | null | package com.tsurkis.timdicatorsampleapp;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class Adapter extends RecyclerView.Adapter<Adapter.AdapterViewHolder> {
private List<String> colors;
Adapter(List<String> colors) {
this.colors = colors;
}
@NonNull
@Override
public AdapterViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position) {
View rootView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_page, viewGroup, false);
return new AdapterViewHolder(rootView);
}
@Override
public void onBindViewHolder(@NonNull AdapterViewHolder adapterViewHolder, int position) {
adapterViewHolder.bind(colors.get(position));
}
@Override
public int getItemCount() {
return colors.size();
}
static class AdapterViewHolder extends RecyclerView.ViewHolder {
private TextView colorTextView;
private ViewGroup container;
AdapterViewHolder(@NonNull View itemView) {
super(itemView);
colorTextView = itemView.findViewById(R.id.color_text_view);
container = itemView.findViewById(R.id.container);
}
private void bind(String color) {
colorTextView.setText(color);
container.setBackgroundColor(Color.parseColor(color));
}
}
}
| UTF-8 | Java | 1,485 | java | Adapter.java | Java | [] | null | [] | package com.tsurkis.timdicatorsampleapp;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class Adapter extends RecyclerView.Adapter<Adapter.AdapterViewHolder> {
private List<String> colors;
Adapter(List<String> colors) {
this.colors = colors;
}
@NonNull
@Override
public AdapterViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position) {
View rootView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_page, viewGroup, false);
return new AdapterViewHolder(rootView);
}
@Override
public void onBindViewHolder(@NonNull AdapterViewHolder adapterViewHolder, int position) {
adapterViewHolder.bind(colors.get(position));
}
@Override
public int getItemCount() {
return colors.size();
}
static class AdapterViewHolder extends RecyclerView.ViewHolder {
private TextView colorTextView;
private ViewGroup container;
AdapterViewHolder(@NonNull View itemView) {
super(itemView);
colorTextView = itemView.findViewById(R.id.color_text_view);
container = itemView.findViewById(R.id.container);
}
private void bind(String color) {
colorTextView.setText(color);
container.setBackgroundColor(Color.parseColor(color));
}
}
}
| 1,485 | 0.753535 | 0.752862 | 55 | 26 | 27.012455 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472727 | false | false | 13 |
25de56f86354b2a02efe0ba6ebfdc72591fa503a | 8,229,157,376,605 | 10388ad235f26e620c53791fe24f315d0d395941 | /wallet_admin/src/com/wallet/harex/model/OfferingCpn.java | 06d4a5dac731b400be8b33a4a55b153c7b9de0de | [] | no_license | vjava114/javaSources | https://github.com/vjava114/javaSources | 9b7df3eb68ab4373bfe1fefadbeb71f141f3139c | 682b3f37a5bd067a22aea9f9551090edccc5afe3 | refs/heads/master | 2016-09-05T13:44:59.910000 | 2015-07-18T02:44:43 | 2015-07-18T02:44:43 | 39,264,405 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wallet.harex.model;
import com.rocomo.common.model.Common;
@SuppressWarnings("serial")
public class OfferingCpn extends Common {
private Integer seq; // ¹øÈ£
private String offerId;
private String cpnId;
private String cpnNo;
private String cpnName;
private String valSdate;
private String valEdate;
private String dcType;
private Integer minPayPrice;
private Integer maxDcPrice;
private Integer dcRate;
private Integer dcPrice;
private String cpnDupUsableYn;
private String membDupUsableYn;
private String shopOnlyYn;
private String dcUnit;
private String roundType;
private String cpnNotiUrl;
private String calcBaseCd;
private Integer calcBasePrice;
private Integer expDcPrice;
private String regDttm;
private String lastDttm;
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getOfferId() {
return offerId;
}
public void setOfferId(String offerId) {
this.offerId = offerId;
}
public String getCpnId() {
return cpnId;
}
public void setCpnId(String cpnId) {
this.cpnId = cpnId;
}
public String getCpnNo() {
return cpnNo;
}
public void setCpnNo(String cpnNo) {
this.cpnNo = cpnNo;
}
public String getCpnName() {
return cpnName;
}
public void setCpnName(String cpnName) {
this.cpnName = cpnName;
}
public String getValSdate() {
return valSdate;
}
public void setValSdate(String valSdate) {
this.valSdate = valSdate;
}
public String getValEdate() {
return valEdate;
}
public void setValEdate(String valEdate) {
this.valEdate = valEdate;
}
public String getDcType() {
return dcType;
}
public void setDcType(String dcType) {
this.dcType = dcType;
}
public Integer getMinPayPrice() {
return minPayPrice;
}
public void setMinPayPrice(Integer minPayPrice) {
this.minPayPrice = minPayPrice;
}
public Integer getMaxDcPrice() {
return maxDcPrice;
}
public void setMaxDcPrice(Integer maxDcPrice) {
this.maxDcPrice = maxDcPrice;
}
public Integer getDcRate() {
return dcRate;
}
public void setDcRate(Integer dcRate) {
this.dcRate = dcRate;
}
public Integer getDcPrice() {
return dcPrice;
}
public void setDcPrice(Integer dcPrice) {
this.dcPrice = dcPrice;
}
public String getCpnDupUsableYn() {
return cpnDupUsableYn;
}
public void setCpnDupUsableYn(String cpnDupUsableYn) {
this.cpnDupUsableYn = cpnDupUsableYn;
}
public String getMembDupUsableYn() {
return membDupUsableYn;
}
public void setMembDupUsableYn(String membDupUsableYn) {
this.membDupUsableYn = membDupUsableYn;
}
public String getShopOnlyYn() {
return shopOnlyYn;
}
public void setShopOnlyYn(String shopOnlyYn) {
this.shopOnlyYn = shopOnlyYn;
}
public String getDcUnit() {
return dcUnit;
}
public void setDcUnit(String dcUnit) {
this.dcUnit = dcUnit;
}
public String getRoundType() {
return roundType;
}
public void setRoundType(String roundType) {
this.roundType = roundType;
}
public String getCpnNotiUrl() {
return cpnNotiUrl;
}
public void setCpnNotiUrl(String cpnNotiUrl) {
this.cpnNotiUrl = cpnNotiUrl;
}
public String getCalcBaseCd() {
return calcBaseCd;
}
public void setCalcBaseCd(String calcBaseCd) {
this.calcBaseCd = calcBaseCd;
}
public Integer getCalcBasePrice() {
return calcBasePrice;
}
public void setCalcBasePrice(Integer calcBasePrice) {
this.calcBasePrice = calcBasePrice;
}
public Integer getExpDcPrice() {
return expDcPrice;
}
public void setExpDcPrice(Integer expDcPrice) {
this.expDcPrice = expDcPrice;
}
public String getRegDttm() {
return regDttm;
}
public void setRegDttm(String regDttm) {
this.regDttm = regDttm;
}
public String getLastDttm() {
return lastDttm;
}
public void setLastDttm(String lastDttm) {
this.lastDttm = lastDttm;
}
}
| WINDOWS-1252 | Java | 3,809 | java | OfferingCpn.java | Java | [] | null | [] | package com.wallet.harex.model;
import com.rocomo.common.model.Common;
@SuppressWarnings("serial")
public class OfferingCpn extends Common {
private Integer seq; // ¹øÈ£
private String offerId;
private String cpnId;
private String cpnNo;
private String cpnName;
private String valSdate;
private String valEdate;
private String dcType;
private Integer minPayPrice;
private Integer maxDcPrice;
private Integer dcRate;
private Integer dcPrice;
private String cpnDupUsableYn;
private String membDupUsableYn;
private String shopOnlyYn;
private String dcUnit;
private String roundType;
private String cpnNotiUrl;
private String calcBaseCd;
private Integer calcBasePrice;
private Integer expDcPrice;
private String regDttm;
private String lastDttm;
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getOfferId() {
return offerId;
}
public void setOfferId(String offerId) {
this.offerId = offerId;
}
public String getCpnId() {
return cpnId;
}
public void setCpnId(String cpnId) {
this.cpnId = cpnId;
}
public String getCpnNo() {
return cpnNo;
}
public void setCpnNo(String cpnNo) {
this.cpnNo = cpnNo;
}
public String getCpnName() {
return cpnName;
}
public void setCpnName(String cpnName) {
this.cpnName = cpnName;
}
public String getValSdate() {
return valSdate;
}
public void setValSdate(String valSdate) {
this.valSdate = valSdate;
}
public String getValEdate() {
return valEdate;
}
public void setValEdate(String valEdate) {
this.valEdate = valEdate;
}
public String getDcType() {
return dcType;
}
public void setDcType(String dcType) {
this.dcType = dcType;
}
public Integer getMinPayPrice() {
return minPayPrice;
}
public void setMinPayPrice(Integer minPayPrice) {
this.minPayPrice = minPayPrice;
}
public Integer getMaxDcPrice() {
return maxDcPrice;
}
public void setMaxDcPrice(Integer maxDcPrice) {
this.maxDcPrice = maxDcPrice;
}
public Integer getDcRate() {
return dcRate;
}
public void setDcRate(Integer dcRate) {
this.dcRate = dcRate;
}
public Integer getDcPrice() {
return dcPrice;
}
public void setDcPrice(Integer dcPrice) {
this.dcPrice = dcPrice;
}
public String getCpnDupUsableYn() {
return cpnDupUsableYn;
}
public void setCpnDupUsableYn(String cpnDupUsableYn) {
this.cpnDupUsableYn = cpnDupUsableYn;
}
public String getMembDupUsableYn() {
return membDupUsableYn;
}
public void setMembDupUsableYn(String membDupUsableYn) {
this.membDupUsableYn = membDupUsableYn;
}
public String getShopOnlyYn() {
return shopOnlyYn;
}
public void setShopOnlyYn(String shopOnlyYn) {
this.shopOnlyYn = shopOnlyYn;
}
public String getDcUnit() {
return dcUnit;
}
public void setDcUnit(String dcUnit) {
this.dcUnit = dcUnit;
}
public String getRoundType() {
return roundType;
}
public void setRoundType(String roundType) {
this.roundType = roundType;
}
public String getCpnNotiUrl() {
return cpnNotiUrl;
}
public void setCpnNotiUrl(String cpnNotiUrl) {
this.cpnNotiUrl = cpnNotiUrl;
}
public String getCalcBaseCd() {
return calcBaseCd;
}
public void setCalcBaseCd(String calcBaseCd) {
this.calcBaseCd = calcBaseCd;
}
public Integer getCalcBasePrice() {
return calcBasePrice;
}
public void setCalcBasePrice(Integer calcBasePrice) {
this.calcBasePrice = calcBasePrice;
}
public Integer getExpDcPrice() {
return expDcPrice;
}
public void setExpDcPrice(Integer expDcPrice) {
this.expDcPrice = expDcPrice;
}
public String getRegDttm() {
return regDttm;
}
public void setRegDttm(String regDttm) {
this.regDttm = regDttm;
}
public String getLastDttm() {
return lastDttm;
}
public void setLastDttm(String lastDttm) {
this.lastDttm = lastDttm;
}
}
| 3,809 | 0.739816 | 0.739553 | 171 | 21.251463 | 15.053547 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.666667 | false | false | 13 |
e133969c84315a303d6662f0b763579b84911a07 | 14,035,953,185,159 | 4189f14a49f03159c10ccd1783d3f9c43e834150 | /src/main/java/com/stackroute/q7.java | 7376ba6de2c7b2760cdca153b4cc579307d1bbe8 | [] | no_license | Prakharboy/javaassignment | https://github.com/Prakharboy/javaassignment | 710f8dc900de7bef139baa9f2ef95bb932718ca3 | 2abc8937a8c54ef21fe3b54de6d75a78e81bb3f5 | refs/heads/master | 2021-07-11T02:07:46.220000 | 2019-09-09T11:05:02 | 2019-09-09T11:05:02 | 207,289,305 | 0 | 0 | null | false | 2020-10-13T15:55:06 | 2019-09-09T11:03:17 | 2019-09-09T11:06:19 | 2020-10-13T15:55:05 | 18 | 0 | 0 | 1 | Java | false | false |
package com.stackroute;
public class q7 {
private String firstname,lastname;
private int salaryy,agee;
public static String getname(String fn,String ln,String age,String salary) {
q7 newhello =new q7();
int agec=Integer.parseInt(age);
int salaryc=Integer.parseInt(salary);
newhello.sett(fn,ln,agec,salaryc);
int cc=newhello.isvalid(agec);
if(cc==0)
{
return "invalid age age should be in range 18-60";
}
if(cc==-1)
{
return "age cant be greater than 100 and less than 0";
}
return newhello.dispname();
}
public String dispname()
{
return this.firstname;
}
public void sett(String fnf,String lnf,int age,int salary)
{
this.firstname=fnf;
this.lastname=lnf;
this.agee=age;
this.salaryy=salary;
}
public int isvalid(int agef)
{
if(agef>=100||agef<=0)
{
return -1;
}
if(agef<=60&&agef>=18)
{
return 1;
}
else
return 0;
}
}
| UTF-8 | Java | 1,094 | java | q7.java | Java | [] | null | [] |
package com.stackroute;
public class q7 {
private String firstname,lastname;
private int salaryy,agee;
public static String getname(String fn,String ln,String age,String salary) {
q7 newhello =new q7();
int agec=Integer.parseInt(age);
int salaryc=Integer.parseInt(salary);
newhello.sett(fn,ln,agec,salaryc);
int cc=newhello.isvalid(agec);
if(cc==0)
{
return "invalid age age should be in range 18-60";
}
if(cc==-1)
{
return "age cant be greater than 100 and less than 0";
}
return newhello.dispname();
}
public String dispname()
{
return this.firstname;
}
public void sett(String fnf,String lnf,int age,int salary)
{
this.firstname=fnf;
this.lastname=lnf;
this.agee=age;
this.salaryy=salary;
}
public int isvalid(int agef)
{
if(agef>=100||agef<=0)
{
return -1;
}
if(agef<=60&&agef>=18)
{
return 1;
}
else
return 0;
}
}
| 1,094 | 0.548446 | 0.526508 | 59 | 17.525423 | 18.346344 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542373 | false | false | 13 |
7c7bd747df076a4923ab2a69387b3fe9e0169d3f | 31,945,966,811,395 | e891851aea83d9346c17a19863ea3c6ba8dd9f36 | /basic/src/designpattern/responsibility/Officer.java | ef57bae8939d1449d9eb4d08e9987b3c0e58944b | [] | no_license | EragoGeneral/spring-boot-learning | https://github.com/EragoGeneral/spring-boot-learning | 5d077ba63645f76e490b28a41f35469b69cf6944 | 7b2fa3fbdac1e0f632b5bcf9239dc3ed321bf87e | refs/heads/master | 2022-07-04T03:16:45.479000 | 2019-08-01T11:58:32 | 2019-08-01T11:58:32 | 139,143,414 | 1 | 0 | null | false | 2022-06-20T23:51:52 | 2018-06-29T11:52:00 | 2020-08-10T15:33:38 | 2022-06-20T23:51:49 | 43,203 | 0 | 0 | 5 | JavaScript | false | false | package designpattern.responsibility;
public abstract class Officer {
protected String name;
protected Officer successor;
public Officer(String name) {
super();
this.name = name;
}
public void setSuccessor(Officer successor) {
this.successor = successor;
}
public abstract void handleMission(Mission mission);
}
| UTF-8 | Java | 333 | java | Officer.java | Java | [] | null | [] | package designpattern.responsibility;
public abstract class Officer {
protected String name;
protected Officer successor;
public Officer(String name) {
super();
this.name = name;
}
public void setSuccessor(Officer successor) {
this.successor = successor;
}
public abstract void handleMission(Mission mission);
}
| 333 | 0.747748 | 0.747748 | 19 | 16.526316 | 17.242445 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.157895 | false | false | 13 |
60e0c5eedb4e69c2b9b9e05598697c1f77bdd2ca | 4,793,183,519,056 | 6186429fa65af5712e28267e738d299dba687a7c | /src/main/java/com/aspl/org/dao/CompanyMasterDao.java | 7d021837d7ba9665e8acb7cdc5495de35f127daa | [] | no_license | sougata143/PurchaseModuleApplication | https://github.com/sougata143/PurchaseModuleApplication | fb76c2c6d7629dfd3f502e6ea3d54a46320232e1 | fa066bcf7a2c455c359758be9db31b1f563fba0f | refs/heads/master | 2023-08-07T09:35:52.551000 | 2019-11-07T12:08:33 | 2019-11-07T12:08:33 | 220,228,178 | 0 | 0 | null | false | 2023-07-22T20:55:58 | 2019-11-07T12:07:55 | 2019-11-07T12:09:06 | 2023-07-22T20:55:55 | 1,251 | 0 | 0 | 3 | Java | false | false | package com.aspl.org.dao;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.aspl.org.entity.CompanyMaster;
@Repository
public interface CompanyMasterDao extends JpaRepository<CompanyMaster, Integer> {
CompanyMaster findByCompanyName(String companyName);
}
| UTF-8 | Java | 364 | java | CompanyMasterDao.java | Java | [] | null | [] | package com.aspl.org.dao;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.aspl.org.entity.CompanyMaster;
@Repository
public interface CompanyMasterDao extends JpaRepository<CompanyMaster, Integer> {
CompanyMaster findByCompanyName(String companyName);
}
| 364 | 0.832418 | 0.832418 | 15 | 23.266666 | 26.428436 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 13 |
9de147ec18aace7364d1b256005a277cbacbb7e7 | 6,700,149,003,228 | a4e8d657e43855ea0df881bb0cd3f36f51f64e39 | /vim/src/zjr/vim/thread/SfcLinkThread.java | d8a850c52030f459e1f440ebe38df42c77c73e4d | [] | no_license | HHHenrik/NFV_MAMO | https://github.com/HHHenrik/NFV_MAMO | 420679ea751af85fba8a7d04c140b6297de5159a | 3fff194dd5f4a401007adc0ea05ba726ce3a9a67 | refs/heads/master | 2021-06-12T08:10:35.664000 | 2018-12-07T14:10:50 | 2018-12-07T14:10:50 | 158,503,189 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package zjr.vim.thread;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class SfcLinkThread implements Runnable {
private int sfcId = 1;
private int linkId = 0;
private int alarmLevel = 0;
private float bwUtilRate = 70;
private float bwThreUp = 85;
private float bwThreDown = 15;
private int delay = 5;
private int delayThreshold = 10;
private JSONArray sfcLinkData = new JSONArray();
public volatile boolean sfcLinkFlag = false;
private ReentrantReadWriteLock sfcLinkLock = new ReentrantReadWriteLock();
@Override
public void run(){
while (true){
sfcLinkLock.writeLock().lock();
try{
if (sfcLinkFlag){
sfcLinkData = new JSONArray();
sfcLinkFlag = false;
}
int flag = Math.random() > 0.5 ? 1 : 0;
if (flag == 1){
Random random = new Random();
int offset = random.nextInt(7);
bwUtilRate = 70 + offset * 5;
}else if (flag == 0){
Random random = new Random();
int offset = random.nextInt(15);
bwUtilRate = 70 - offset * 5;
}
if (bwUtilRate > 10 && bwUtilRate < 85){
alarmLevel = 0;
}
else if (bwUtilRate >= 85 && bwUtilRate < 90 || bwUtilRate <= 15 && bwUtilRate > 10)
alarmLevel = 1;
else if (bwUtilRate >= 90 && bwUtilRate < 95 || bwUtilRate <= 10 && bwUtilRate > 5)
alarmLevel = 2;
else if (bwUtilRate >= 95 && bwUtilRate < 100 || bwUtilRate >= 5 && bwUtilRate < 0)
alarmLevel = 3;
else if (bwUtilRate == 100 || bwUtilRate == 0)
alarmLevel = 4;
JSONObject sfcLink = new JSONObject();
sfcLink.put("sfcId", sfcId);
sfcLink.put("linkId", linkId);
sfcLink.put("bw_util_rate", bwUtilRate);
sfcLink.put("bw_thre_up", bwThreUp);
sfcLink.put("bw_thre_down", bwThreDown);
sfcLink.put("delay", delay);
sfcLink.put("delay_threshold", delayThreshold);
sfcLink.put("alarm_level", alarmLevel);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currentTime = sdf.format(date);
sfcLink.put("current_time", currentTime);
sfcLinkData.put(sfcLink);
sfcLinkLock.writeLock().unlock();
Thread.sleep(30000);
}catch (JSONException e){
e.printStackTrace();
}catch (InterruptedException e){
e.printStackTrace();
}
}
}
public JSONArray getSfcLinkData() {
return sfcLinkData;
}
}
| UTF-8 | Java | 3,183 | java | SfcLinkThread.java | Java | [] | null | [] | package zjr.vim.thread;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class SfcLinkThread implements Runnable {
private int sfcId = 1;
private int linkId = 0;
private int alarmLevel = 0;
private float bwUtilRate = 70;
private float bwThreUp = 85;
private float bwThreDown = 15;
private int delay = 5;
private int delayThreshold = 10;
private JSONArray sfcLinkData = new JSONArray();
public volatile boolean sfcLinkFlag = false;
private ReentrantReadWriteLock sfcLinkLock = new ReentrantReadWriteLock();
@Override
public void run(){
while (true){
sfcLinkLock.writeLock().lock();
try{
if (sfcLinkFlag){
sfcLinkData = new JSONArray();
sfcLinkFlag = false;
}
int flag = Math.random() > 0.5 ? 1 : 0;
if (flag == 1){
Random random = new Random();
int offset = random.nextInt(7);
bwUtilRate = 70 + offset * 5;
}else if (flag == 0){
Random random = new Random();
int offset = random.nextInt(15);
bwUtilRate = 70 - offset * 5;
}
if (bwUtilRate > 10 && bwUtilRate < 85){
alarmLevel = 0;
}
else if (bwUtilRate >= 85 && bwUtilRate < 90 || bwUtilRate <= 15 && bwUtilRate > 10)
alarmLevel = 1;
else if (bwUtilRate >= 90 && bwUtilRate < 95 || bwUtilRate <= 10 && bwUtilRate > 5)
alarmLevel = 2;
else if (bwUtilRate >= 95 && bwUtilRate < 100 || bwUtilRate >= 5 && bwUtilRate < 0)
alarmLevel = 3;
else if (bwUtilRate == 100 || bwUtilRate == 0)
alarmLevel = 4;
JSONObject sfcLink = new JSONObject();
sfcLink.put("sfcId", sfcId);
sfcLink.put("linkId", linkId);
sfcLink.put("bw_util_rate", bwUtilRate);
sfcLink.put("bw_thre_up", bwThreUp);
sfcLink.put("bw_thre_down", bwThreDown);
sfcLink.put("delay", delay);
sfcLink.put("delay_threshold", delayThreshold);
sfcLink.put("alarm_level", alarmLevel);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currentTime = sdf.format(date);
sfcLink.put("current_time", currentTime);
sfcLinkData.put(sfcLink);
sfcLinkLock.writeLock().unlock();
Thread.sleep(30000);
}catch (JSONException e){
e.printStackTrace();
}catch (InterruptedException e){
e.printStackTrace();
}
}
}
public JSONArray getSfcLinkData() {
return sfcLinkData;
}
}
| 3,183 | 0.523091 | 0.502042 | 85 | 36.44706 | 22.217379 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.823529 | false | false | 13 |
fd9e1abed69218478eed9f6f24c3dd3bec2233cc | 12,017,318,527,444 | 97ffccba1ba733432c5766d231c0eca1153c2629 | /src/com/company/Main.java | 3315ea8cc72ecaa718c2f9fb192af297ee5cf93e | [] | no_license | CrimTart/HackerU-SameSymbolsSubstring | https://github.com/CrimTart/HackerU-SameSymbolsSubstring | c2726905f0c1e5a92c832b57804c2c552ec7a1fb | 3898bb29f5e90f8d8c3270ee20d16fa9fb27997b | refs/heads/master | 2020-04-01T04:43:01.620000 | 2018-10-13T13:25:47 | 2018-10-13T13:25:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company;
import java.util.Scanner;
//Given a string s and a number n, find the last (from left to right) instance
//of a substring of s, which is a sequence of at least n repeating (same) symbols
public class Main {
public static void main(String[] args) {
String s;
int n;
Scanner sc = new Scanner(System.in);
try {
System.out.println("Input original string: ");
s = sc.nextLine();
if (s == null || s.length() == 0 ) {
System.out.println("Empty original string.");
throw new IllegalArgumentException();
}
System.out.println("Input an integer: ");
n = sc.nextInt();
if (n <= 0) n = 1; //if n is not positive, any one symbol is a candidate
//The last instance is the same as the first instance in a reversed string
StringBuilder sb = (new StringBuilder(s)).reverse();
StringBuilder answer = new StringBuilder(String.valueOf(sb.charAt(0)));
for (int i = 1; i < sb.length(); i++) {
char ch = sb.charAt(i);
if (ch == answer.charAt(0)) answer.append(ch);
else {
if (answer.length() >= n) break;
else answer = new StringBuilder(String.valueOf(ch));//A lot of work for GC =(
}
}
if (answer.length() >= n) System.out.println("Target substring: " + answer);
else System.out.println("Target substring not found.");
}
catch(Exception e){
System.out.println("Please put in valid parameters");
}
}
}
| UTF-8 | Java | 1,686 | java | Main.java | Java | [] | null | [] | package com.company;
import java.util.Scanner;
//Given a string s and a number n, find the last (from left to right) instance
//of a substring of s, which is a sequence of at least n repeating (same) symbols
public class Main {
public static void main(String[] args) {
String s;
int n;
Scanner sc = new Scanner(System.in);
try {
System.out.println("Input original string: ");
s = sc.nextLine();
if (s == null || s.length() == 0 ) {
System.out.println("Empty original string.");
throw new IllegalArgumentException();
}
System.out.println("Input an integer: ");
n = sc.nextInt();
if (n <= 0) n = 1; //if n is not positive, any one symbol is a candidate
//The last instance is the same as the first instance in a reversed string
StringBuilder sb = (new StringBuilder(s)).reverse();
StringBuilder answer = new StringBuilder(String.valueOf(sb.charAt(0)));
for (int i = 1; i < sb.length(); i++) {
char ch = sb.charAt(i);
if (ch == answer.charAt(0)) answer.append(ch);
else {
if (answer.length() >= n) break;
else answer = new StringBuilder(String.valueOf(ch));//A lot of work for GC =(
}
}
if (answer.length() >= n) System.out.println("Target substring: " + answer);
else System.out.println("Target substring not found.");
}
catch(Exception e){
System.out.println("Please put in valid parameters");
}
}
}
| 1,686 | 0.538553 | 0.534994 | 45 | 36.466667 | 29.614262 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.622222 | false | false | 13 |
7e13bdec00d602bbdcce72b6644a770a11febac0 | 13,151,189,875,357 | f296bab9e5815f9aa4b38051ef84981c715b387a | /BE/src/main/java/codesquad/issueTracker/dto/issue/response/IssueDetailMilestoneResponse.java | 2b96554eea7024c0bf946e9c0861564bdbed61f9 | [] | no_license | d-h-k/issue-tracker | https://github.com/d-h-k/issue-tracker | 85e1814e49d3ef7aeff98daba62ff668de807917 | 742d1bcc64c4ab4b79ba99f2b7b8a64c275fde39 | refs/heads/team-1 | 2023-06-25T00:20:02.538000 | 2021-07-22T10:03:22 | 2021-07-22T10:03:22 | 374,498,987 | 5 | 4 | null | true | 2021-07-22T10:03:23 | 2021-06-07T01:14:12 | 2021-06-28T08:28:23 | 2021-07-22T10:03:22 | 977 | 3 | 3 | 6 | null | false | false | package codesquad.issueTracker.dto.issue.response;
import codesquad.issueTracker.domain.Milestone;
import lombok.Getter;
@Getter
public class IssueDetailMilestoneResponse {
private final Long id;
private final String title;
private final Long totalIssueCount;
private final Long openIssueCount;
public IssueDetailMilestoneResponse(Milestone milestone, Long totalIssueCount, Long openIssueCount) {
this.id = milestone.getId();
this.title = milestone.getTitle();
this.totalIssueCount = totalIssueCount;
this.openIssueCount = openIssueCount;
}
}
| UTF-8 | Java | 603 | java | IssueDetailMilestoneResponse.java | Java | [] | null | [] | package codesquad.issueTracker.dto.issue.response;
import codesquad.issueTracker.domain.Milestone;
import lombok.Getter;
@Getter
public class IssueDetailMilestoneResponse {
private final Long id;
private final String title;
private final Long totalIssueCount;
private final Long openIssueCount;
public IssueDetailMilestoneResponse(Milestone milestone, Long totalIssueCount, Long openIssueCount) {
this.id = milestone.getId();
this.title = milestone.getTitle();
this.totalIssueCount = totalIssueCount;
this.openIssueCount = openIssueCount;
}
}
| 603 | 0.749585 | 0.749585 | 20 | 29.15 | 25.495636 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65 | false | false | 13 |
b8c321d04767945ef2d98571971fe4e7eb108118 | 32,839,319,965,067 | b72b5ba213c9ad021e2533f1e7fba5a36c07a82d | /src/test/java/ua/logic/mockitoExample/MyClassTest.java | 560a0f49274174e09cdff84ad4bd962b916ec573 | [] | no_license | Log1c/frameworkUnderstanding | https://github.com/Log1c/frameworkUnderstanding | 76e4fa28c4f0f76ea7cd19bb90ce98fd49f89693 | 97d577b63110d8ac0243da861d6feec65a11603c | refs/heads/master | 2022-01-25T05:13:28.410000 | 2022-01-08T16:59:06 | 2022-01-08T16:59:06 | 154,999,766 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.logic.mockitoExample;
import org.junit.*;
import org.mockito.*;
import static org.mockito.Mockito.doReturn;
public class MyClassTest {
@Mock
private MyClass myClass;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
public void test1() {
// would work fine
doReturn("test").when(myClass).anotherMethodInClass();
}
@Test
public void test2() {
// would throw a NullPointerException
// when(myClass.anotherMethodInClass()).thenReturn("test");
String a = myClass.anotherMethodInClass();
System.out.println(a);
}
}
| UTF-8 | Java | 650 | java | MyClassTest.java | Java | [] | null | [] | package ua.logic.mockitoExample;
import org.junit.*;
import org.mockito.*;
import static org.mockito.Mockito.doReturn;
public class MyClassTest {
@Mock
private MyClass myClass;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
public void test1() {
// would work fine
doReturn("test").when(myClass).anotherMethodInClass();
}
@Test
public void test2() {
// would throw a NullPointerException
// when(myClass.anotherMethodInClass()).thenReturn("test");
String a = myClass.anotherMethodInClass();
System.out.println(a);
}
}
| 650 | 0.638462 | 0.635385 | 30 | 20.666666 | 18.96195 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
a02362fa45b20a439b4a2cf81ab40f82adc09fde | 10,866,267,281,512 | 10bfb8d023194d20b8622fb0e7f7b235a862f60a | /src/opticalnetwork/EnlaceOptico.java | 194d06a1a208b1f4e83e4a29575eac38b96fe078 | [] | no_license | nkmg/space-d_simulator | https://github.com/nkmg/space-d_simulator | a0c33182f69f67f6c2606809fff813035f764d98 | d0e624bc86305f9756ad0f9fb0ed93c417fce1a1 | refs/heads/master | 2021-12-23T08:32:44.317000 | 2017-11-08T20:01:05 | 2017-11-08T20:01:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package opticalnetwork;
import java.util.HashMap;
import graph.Caminho;
import graph.Enlace;
import graph.No;
/**
*@author Alaelson Jatobá
*@version 1.0
*updated in February 2, 2016
*/
public class EnlaceOptico implements Enlace {
private String id;
private No noEsquerda;
private No noDireita;
private double peso;
private double tempoPropagacao;
private boolean ativado;
private double distancia;
private LinkStateTable linkStateTable;
/**Saves the dimension as primary key and the path*/
private HashMap<Integer,Caminho> dimensionPathTable;
public EnlaceOptico (){
this.dimensionPathTable = new HashMap<Integer, Caminho>();
}
/**
* The constructor
* @param esq left node of the edge
* @param dir right node of the edge
*/
public EnlaceOptico ( No esq, No dir ) {
this();
this.id =criaID(esq, dir);
this.noEsquerda = esq;
this.noDireita = dir;
this.peso = 1.0;
this.tempoPropagacao = 0.0;
this.ativado = true;
this.distancia = 1.0;
this.linkStateTable = new LinkStateTable();
}
private String criaID( No esq, No dir ){
StringBuilder builder = new StringBuilder();
builder.append(esq.getId());
builder.append("-");
builder.append(dir.getId());
return builder.toString();
}
/**
* @param origem No origem
* @param destino No de destino
* @param distancia Distancia em Km
* */
public EnlaceOptico (double distancia, No origem, No destino) {
this(origem,destino);
setDistancia(distancia);
setTempoPropagacao(distancia/200000);//divide pela velocidade da luz na fibra
}
/**
* @param origem No origem
* @param destino No de destino
* @param distancia � a distancia em Km
* @param ativado configura o estado do enlace
* */
public EnlaceOptico ( No origem, No destino, double distancia, boolean ativado ) {
this(distancia, origem, destino);
setAtivado(ativado);
}
/**
* @param origem No origem
* @param destino No de destino
* @param ativado configura o estado do enlace
* */
public EnlaceOptico ( No origem, No destino, boolean ativado ) {
this(origem, destino);
setAtivado(ativado);
}
@Override
public No getNoDireita() {
return noDireita;
}
@Override
public No getNoEsquerda() {
return noEsquerda;
}
@Override
public void setNoDireita(No destino) {
this.noDireita = destino;
}
@Override
public void setNoEsquerda(No origem) {
this.noEsquerda = origem;
}
/**
* Retorna o tempo de propaga��o do enlace
* @return tempoPropacacao � o tempo de propagacao do enlace
* */
public double getTempoPropagacao() {
return tempoPropagacao;
}
/**
* @param tempoPropacacao � o tempo de propagacao do enlace
* */
public void setTempoPropagacao(double tempoPropagacao) {
this.tempoPropagacao = tempoPropagacao;
}
@Override
public double getPeso() {
return peso;
}
@Override
public void setPeso(double peso) {
this.peso = peso;
}
@Override
public boolean isAtivado() {
return ativado;
}
@Override
public void setAtivado(boolean ativado) {
this.ativado = ativado;
}
@Override
public String toString(){
StringBuilder builder = new StringBuilder();
builder.append(id);
return builder.toString();
}
@Override
public String getId() {
return id;
}
@Override
public double getDistancia() {
return distancia;
}
@Override
public void setDistancia(double distancia) {
this.distancia = distancia;
}
/**
* Starts a state table for each spectrum array in each dimension
* @param dimensions a int value which representing the number of dimensions in the link. Eg. The number of fibers.
* @param mask the mask as a boolean array be installed in each row of the state table.
*
* */
@Override
public void installStateTable ( int dimensions, Boolean[] mask ) {
linkStateTable.installStateTable(dimensions, mask);
}
/**
* Returns a boolean array representing the spectral slots of a dimension (Eg. SMF fiber or mode)
* @param dimension is the index of the dimension
* @return {@link Boolean}[] a boolean array
* */
@Override
public Boolean[] getStateSpectralArray (int dimension) {
return this.linkStateTable.getStateSpectralArray(dimension);
}
/**
* @return the linkStateTable
*/
public LinkStateTable getLinkStateTable() {
return linkStateTable;
}
/**
* @param linkStateTable the linkStateTable to set
*/
public void setLinkStateTable(LinkStateTable linkStateTable) {
this.linkStateTable = linkStateTable;
}
/**
* @return the dimensionPathTable
*/
public HashMap<Integer,Caminho> getDimensionPathTable() {
return dimensionPathTable;
}
/**
* @param dimensionPathTable the dimensionPathTable to set
*/
public void setDimensionPathTable(HashMap<Integer,Caminho> dimensionPathTable) {
this.dimensionPathTable = dimensionPathTable;
}
/**
* Adds the dimension as primary key and the path in a hashmap
* @param dimension
* @param path
*/
public void addDimensionInPathTable(Integer dimension, Caminho path) {
this.dimensionPathTable.put(dimension, path);
}
/**
* Returns the path which is using the dimension specified
* @param dimension
* @return
*/
public Caminho getPathInDimensionPathTable(int dimension) {
return this.dimensionPathTable.get(dimension);
}
public boolean isDimensionBelongsPath (int dimension, Caminho path) {
Caminho pathSaved = this.dimensionPathTable.get(dimension);
if (path.equals(pathSaved)) {
return true;
}
return false;
}
}
| UTF-8 | Java | 5,463 | java | EnlaceOptico.java | Java | [
{
"context": "mport graph.Enlace;\nimport graph.No;\n\n/**\n*@author Alaelson Jatobá\n*@version 1.0\n*updated in February 2, 2016\n*/\npub",
"end": 141,
"score": 0.9998904466629028,
"start": 126,
"tag": "NAME",
"value": "Alaelson Jatobá"
}
] | null | [] | package opticalnetwork;
import java.util.HashMap;
import graph.Caminho;
import graph.Enlace;
import graph.No;
/**
*@author <NAME>
*@version 1.0
*updated in February 2, 2016
*/
public class EnlaceOptico implements Enlace {
private String id;
private No noEsquerda;
private No noDireita;
private double peso;
private double tempoPropagacao;
private boolean ativado;
private double distancia;
private LinkStateTable linkStateTable;
/**Saves the dimension as primary key and the path*/
private HashMap<Integer,Caminho> dimensionPathTable;
public EnlaceOptico (){
this.dimensionPathTable = new HashMap<Integer, Caminho>();
}
/**
* The constructor
* @param esq left node of the edge
* @param dir right node of the edge
*/
public EnlaceOptico ( No esq, No dir ) {
this();
this.id =criaID(esq, dir);
this.noEsquerda = esq;
this.noDireita = dir;
this.peso = 1.0;
this.tempoPropagacao = 0.0;
this.ativado = true;
this.distancia = 1.0;
this.linkStateTable = new LinkStateTable();
}
private String criaID( No esq, No dir ){
StringBuilder builder = new StringBuilder();
builder.append(esq.getId());
builder.append("-");
builder.append(dir.getId());
return builder.toString();
}
/**
* @param origem No origem
* @param destino No de destino
* @param distancia Distancia em Km
* */
public EnlaceOptico (double distancia, No origem, No destino) {
this(origem,destino);
setDistancia(distancia);
setTempoPropagacao(distancia/200000);//divide pela velocidade da luz na fibra
}
/**
* @param origem No origem
* @param destino No de destino
* @param distancia � a distancia em Km
* @param ativado configura o estado do enlace
* */
public EnlaceOptico ( No origem, No destino, double distancia, boolean ativado ) {
this(distancia, origem, destino);
setAtivado(ativado);
}
/**
* @param origem No origem
* @param destino No de destino
* @param ativado configura o estado do enlace
* */
public EnlaceOptico ( No origem, No destino, boolean ativado ) {
this(origem, destino);
setAtivado(ativado);
}
@Override
public No getNoDireita() {
return noDireita;
}
@Override
public No getNoEsquerda() {
return noEsquerda;
}
@Override
public void setNoDireita(No destino) {
this.noDireita = destino;
}
@Override
public void setNoEsquerda(No origem) {
this.noEsquerda = origem;
}
/**
* Retorna o tempo de propaga��o do enlace
* @return tempoPropacacao � o tempo de propagacao do enlace
* */
public double getTempoPropagacao() {
return tempoPropagacao;
}
/**
* @param tempoPropacacao � o tempo de propagacao do enlace
* */
public void setTempoPropagacao(double tempoPropagacao) {
this.tempoPropagacao = tempoPropagacao;
}
@Override
public double getPeso() {
return peso;
}
@Override
public void setPeso(double peso) {
this.peso = peso;
}
@Override
public boolean isAtivado() {
return ativado;
}
@Override
public void setAtivado(boolean ativado) {
this.ativado = ativado;
}
@Override
public String toString(){
StringBuilder builder = new StringBuilder();
builder.append(id);
return builder.toString();
}
@Override
public String getId() {
return id;
}
@Override
public double getDistancia() {
return distancia;
}
@Override
public void setDistancia(double distancia) {
this.distancia = distancia;
}
/**
* Starts a state table for each spectrum array in each dimension
* @param dimensions a int value which representing the number of dimensions in the link. Eg. The number of fibers.
* @param mask the mask as a boolean array be installed in each row of the state table.
*
* */
@Override
public void installStateTable ( int dimensions, Boolean[] mask ) {
linkStateTable.installStateTable(dimensions, mask);
}
/**
* Returns a boolean array representing the spectral slots of a dimension (Eg. SMF fiber or mode)
* @param dimension is the index of the dimension
* @return {@link Boolean}[] a boolean array
* */
@Override
public Boolean[] getStateSpectralArray (int dimension) {
return this.linkStateTable.getStateSpectralArray(dimension);
}
/**
* @return the linkStateTable
*/
public LinkStateTable getLinkStateTable() {
return linkStateTable;
}
/**
* @param linkStateTable the linkStateTable to set
*/
public void setLinkStateTable(LinkStateTable linkStateTable) {
this.linkStateTable = linkStateTable;
}
/**
* @return the dimensionPathTable
*/
public HashMap<Integer,Caminho> getDimensionPathTable() {
return dimensionPathTable;
}
/**
* @param dimensionPathTable the dimensionPathTable to set
*/
public void setDimensionPathTable(HashMap<Integer,Caminho> dimensionPathTable) {
this.dimensionPathTable = dimensionPathTable;
}
/**
* Adds the dimension as primary key and the path in a hashmap
* @param dimension
* @param path
*/
public void addDimensionInPathTable(Integer dimension, Caminho path) {
this.dimensionPathTable.put(dimension, path);
}
/**
* Returns the path which is using the dimension specified
* @param dimension
* @return
*/
public Caminho getPathInDimensionPathTable(int dimension) {
return this.dimensionPathTable.get(dimension);
}
public boolean isDimensionBelongsPath (int dimension, Caminho path) {
Caminho pathSaved = this.dimensionPathTable.get(dimension);
if (path.equals(pathSaved)) {
return true;
}
return false;
}
}
| 5,453 | 0.713683 | 0.710198 | 248 | 20.983871 | 22.249315 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.387097 | false | false | 13 |
7445ff7a02f75198920b39e3869124c3e6f9bf52 | 6,528,350,312,794 | 2f1806c1ca7d0c75c42a5e791fc94fa819315b3b | /src/main/java/org/sterl/jsui/api/ServerException.java | 1e78702454b9ff528a16217ba6d7b9e727aa8bd1 | [] | no_license | sterlp/myInvoice | https://github.com/sterlp/myInvoice | ad6dddb401b3ac273e07c54f0319b11bf1d7de26 | dac2ca29bcf4b7d3140ab683f4c15b1fd8000bd9 | refs/heads/master | 2021-01-20T02:12:52.622000 | 2017-09-16T13:15:30 | 2017-09-16T13:15:30 | 89,390,367 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.sterl.jsui.api;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import javax.json.JsonValue;
import javax.validation.ConstraintViolation;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* Simple class represents a server exception
*/
@Data @EqualsAndHashCode(of = {"code", "message"})
@XmlRootElement
public class ServerException {
private int code;
private String message;
private List<ValidationError> validationErrors;
// jersy moxy sucks for maps so we make it right here
public JsonObjectBuilder toJson() {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("code", code);
if (message != null) result.add("message", message);
JsonObjectBuilder ves = null;
if (this.validationErrors != null && !validationErrors.isEmpty()) {
ves = Json.createObjectBuilder();
for (ValidationError ve : validationErrors) {
ves.add(ve.getPath(), ve.toJson());
}
}
if (ves != null) result.add("validationErrors", ves);
return result;
}
public void addValidationErrors(Set<ConstraintViolation<?>> constraintViolations) {
if (constraintViolations != null && !constraintViolations.isEmpty()) {
validationErrors = constraintViolations.stream().map(cv -> ValidationError.of(cv)).collect(Collectors.toList());
}
}
}
| UTF-8 | Java | 1,700 | java | ServerException.java | Java | [] | null | [] | package org.sterl.jsui.api;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import javax.json.JsonValue;
import javax.validation.ConstraintViolation;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* Simple class represents a server exception
*/
@Data @EqualsAndHashCode(of = {"code", "message"})
@XmlRootElement
public class ServerException {
private int code;
private String message;
private List<ValidationError> validationErrors;
// jersy moxy sucks for maps so we make it right here
public JsonObjectBuilder toJson() {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("code", code);
if (message != null) result.add("message", message);
JsonObjectBuilder ves = null;
if (this.validationErrors != null && !validationErrors.isEmpty()) {
ves = Json.createObjectBuilder();
for (ValidationError ve : validationErrors) {
ves.add(ve.getPath(), ve.toJson());
}
}
if (ves != null) result.add("validationErrors", ves);
return result;
}
public void addValidationErrors(Set<ConstraintViolation<?>> constraintViolations) {
if (constraintViolations != null && !constraintViolations.isEmpty()) {
validationErrors = constraintViolations.stream().map(cv -> ValidationError.of(cv)).collect(Collectors.toList());
}
}
}
| 1,700 | 0.690588 | 0.690588 | 51 | 32.333332 | 25.273148 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.647059 | false | false | 13 |
758f1e9c5e6dd8c87b2f35c04645bc96501b7907 | 18,253,611,036,921 | 90d47ccc810c657a6e829f4ad7b4e956637ae1c8 | /src/java/model/MonHoc.java | 57fc08fc7a6d15a39cb7eb0b31187059b6d92b1a | [] | no_license | tuanTaAnh/SQA_nhom17_Tuan | https://github.com/tuanTaAnh/SQA_nhom17_Tuan | e6ec7b5fd741312c2d3794bab0e7863b4c79e989 | 0e246f1a5ad2cffa834a4752ec89488bcba5068a | refs/heads/master | 2023-05-09T00:28:34.409000 | 2021-05-29T17:15:42 | 2021-05-29T17:15:42 | 372,028,303 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
public class MonHoc {
private String maMH;
private String tenMH;
private int soTC;
private String giangVien;
private double hocphi;
public MonHoc() {
}
public MonHoc(String maMH, String tenMH, int soTC, double hocphi, String giangVien) {
this.maMH = maMH;
this.tenMH = tenMH;
this.soTC = soTC;
this.hocphi = hocphi;
this.giangVien = giangVien;
}
public String getMaMH() {
return maMH;
}
public void setMaMH(String maMH) {
this.maMH = maMH;
}
public String getTenMH() {
return tenMH;
}
public void setTenMH(String tenMH) {
this.tenMH = tenMH;
}
public int getSoTC() {
return soTC;
}
public void setSoTC(int soTC) {
this.soTC = soTC;
}
public double getHocphi() {
return hocphi;
}
public void setHocphi(double hocphi) {
this.hocphi = hocphi;
}
public String getGiangVien() {
return giangVien;
}
public void setGiangVien(String giangVien) {
this.giangVien = giangVien;
}
}
| UTF-8 | Java | 1,210 | java | MonHoc.java | Java | [] | null | [] | package model;
public class MonHoc {
private String maMH;
private String tenMH;
private int soTC;
private String giangVien;
private double hocphi;
public MonHoc() {
}
public MonHoc(String maMH, String tenMH, int soTC, double hocphi, String giangVien) {
this.maMH = maMH;
this.tenMH = tenMH;
this.soTC = soTC;
this.hocphi = hocphi;
this.giangVien = giangVien;
}
public String getMaMH() {
return maMH;
}
public void setMaMH(String maMH) {
this.maMH = maMH;
}
public String getTenMH() {
return tenMH;
}
public void setTenMH(String tenMH) {
this.tenMH = tenMH;
}
public int getSoTC() {
return soTC;
}
public void setSoTC(int soTC) {
this.soTC = soTC;
}
public double getHocphi() {
return hocphi;
}
public void setHocphi(double hocphi) {
this.hocphi = hocphi;
}
public String getGiangVien() {
return giangVien;
}
public void setGiangVien(String giangVien) {
this.giangVien = giangVien;
}
}
| 1,210 | 0.542149 | 0.542149 | 62 | 17.516129 | 16.458885 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.403226 | false | false | 13 |
23fb4e79a7d69f26961aaf3432ff8f27df20e9d3 | 29,497,835,451,130 | 3ac31f7a8b4e1bc040d6d6fccc7a89692e474200 | /Labpro2/app/src/main/java/com/example/labpro2/Client.java | 36980630b4ce51acf876059bdd96ce9d7feeac8c | [] | no_license | JamesGitauM/MobileApp | https://github.com/JamesGitauM/MobileApp | c0351ee79cdb3b2345da3923b6a59c41b660a85d | 60d5c82541aa0870c858f284d4f5fc4671029687 | refs/heads/master | 2022-11-06T09:49:20.382000 | 2020-06-23T07:33:04 | 2020-06-23T07:33:04 | 274,336,674 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.labpro2;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity(tableName = "client_table")
public class Client {
@PrimaryKey(autoGenerate = true)
private int cid;
private String ccode;
private String cname;
private String emailaddress;
private String physicaladdress;
//private int mobile;
//constructor
public Client(String ccode, String cname, String emailaddress, String physicaladdress) {
this.ccode = ccode;
this.cname = cname;
this.emailaddress = emailaddress;
this.physicaladdress = physicaladdress;
}
// setter methods
public void setCid(int cid) {
this.cid = cid;
}
//getter methods
public int getCid() {
return cid;
}
public String getCcode() {
return ccode;
}
public String getCname() {
return cname;
}
public String getEmailaddress() {
return emailaddress;
}
public String getPhysicaladdress() {
return physicaladdress;
}
}
| UTF-8 | Java | 1,061 | java | Client.java | Java | [] | null | [] | package com.example.labpro2;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity(tableName = "client_table")
public class Client {
@PrimaryKey(autoGenerate = true)
private int cid;
private String ccode;
private String cname;
private String emailaddress;
private String physicaladdress;
//private int mobile;
//constructor
public Client(String ccode, String cname, String emailaddress, String physicaladdress) {
this.ccode = ccode;
this.cname = cname;
this.emailaddress = emailaddress;
this.physicaladdress = physicaladdress;
}
// setter methods
public void setCid(int cid) {
this.cid = cid;
}
//getter methods
public int getCid() {
return cid;
}
public String getCcode() {
return ccode;
}
public String getCname() {
return cname;
}
public String getEmailaddress() {
return emailaddress;
}
public String getPhysicaladdress() {
return physicaladdress;
}
}
| 1,061 | 0.638077 | 0.637135 | 53 | 19.018867 | 17.388449 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415094 | false | false | 13 |
09987c90675ae6d0e3082964a09597026f7ac510 | 6,751,688,656,083 | 5b72af02fb796b6fede971269efc3659cd2ff443 | /common/tarot-core-service/src/main/generated-java/com/myee/tarot/apiold/dao/UploadAccessLogDao.java | bb4860c8cf006a0d82a070629001177176d47cb0 | [] | no_license | bulong0721/tarot | https://github.com/bulong0721/tarot | ed665ad14d256afcb034a7c2633e861fada443cc | 902a456c7690a0a199a8ba246ee7f9fe2c1960f7 | refs/heads/master | 2021-01-23T21:39:23.856000 | 2016-12-30T03:28:28 | 2016-12-30T03:28:28 | 57,170,943 | 5 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.myee.tarot.apiold.dao;
import com.myee.tarot.apiold.domain.UploadAccessLog;
import com.myee.tarot.core.dao.GenericEntityDao;
import com.myee.tarot.core.util.PageResult;
import com.myee.tarot.core.util.WhereRequest;
/**
* Created by Chay on 2016/8/10.
*/
public interface UploadAccessLogDao extends GenericEntityDao<Long, UploadAccessLog> {
PageResult<UploadAccessLog> getLevel1Analysis(WhereRequest whereRequest);
}
| UTF-8 | Java | 436 | java | UploadAccessLogDao.java | Java | [
{
"context": "e.tarot.core.util.WhereRequest;\n\n/**\n * Created by Chay on 2016/8/10.\n */\npublic interface UploadAccessLo",
"end": 251,
"score": 0.9056090116500854,
"start": 247,
"tag": "USERNAME",
"value": "Chay"
}
] | null | [] | package com.myee.tarot.apiold.dao;
import com.myee.tarot.apiold.domain.UploadAccessLog;
import com.myee.tarot.core.dao.GenericEntityDao;
import com.myee.tarot.core.util.PageResult;
import com.myee.tarot.core.util.WhereRequest;
/**
* Created by Chay on 2016/8/10.
*/
public interface UploadAccessLogDao extends GenericEntityDao<Long, UploadAccessLog> {
PageResult<UploadAccessLog> getLevel1Analysis(WhereRequest whereRequest);
}
| 436 | 0.805046 | 0.786697 | 13 | 32.53846 | 28.380966 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 13 |
17b5106b0fc7db81dcc10e3b3d90288b9a244f35 | 9,732,395,898,009 | 5e527a4b3984d3d03d9062df8b02fbea739a9f77 | /src/Test11_swing/MyWindow.java | aa1985b551abb605ca66cf583208b066dcd7232f | [] | no_license | Mishyaz/JavaLearning | https://github.com/Mishyaz/JavaLearning | 399ef0f50ec5bc98b85c5ebd6941198b3f375c83 | a8b773fe92c6ad5c58d248d9a6800460f834d294 | refs/heads/master | 2020-06-11T00:56:03.056000 | 2016-12-23T18:57:26 | 2016-12-23T18:57:26 | 75,828,697 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Test11_swing;
import javax.swing.*;
import java.awt.*;
public class MyWindow extends JFrame {
public MyWindow() throws HeadlessException {
setSize(400, 300);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("Java dive");
// JButton jButton = new JButton("Learn java");
add(new JButton("Java"), BorderLayout.SOUTH);
add(new JButton("Java1"), BorderLayout.WEST);
add(new JButton("Java2"), BorderLayout.EAST);
add(new JButton("Java3"), BorderLayout.NORTH);
setVisible(true);
}
}
| UTF-8 | Java | 582 | java | MyWindow.java | Java | [] | null | [] | package Test11_swing;
import javax.swing.*;
import java.awt.*;
public class MyWindow extends JFrame {
public MyWindow() throws HeadlessException {
setSize(400, 300);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("Java dive");
// JButton jButton = new JButton("Learn java");
add(new JButton("Java"), BorderLayout.SOUTH);
add(new JButton("Java1"), BorderLayout.WEST);
add(new JButton("Java2"), BorderLayout.EAST);
add(new JButton("Java3"), BorderLayout.NORTH);
setVisible(true);
}
}
| 582 | 0.651203 | 0.632302 | 18 | 31.333334 | 20.901888 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.944444 | false | false | 13 |
09eb78042ffee75d722ae2f3e3b7cf4f2a18ffbd | 13,211,319,407,556 | 1946b88fa656aa3be1a990ae953df109e87c5c3a | /org.eclipse.scout.saml/src-gen/org/eclipse/scout/saml/saml/RadioGroupElement.java | d5892d32838658cd672618fe864824bbc92e182a | [] | no_license | BSI-Business-Systems-Integration-AG/org.eclipse.scout.xtext | https://github.com/BSI-Business-Systems-Integration-AG/org.eclipse.scout.xtext | 6a62387755a928fb35d89a5957886bf46494c163 | 8e6645cd4766a846a0fd73d3f3829fb347d81581 | refs/heads/master | 2016-09-06T08:21:40.558000 | 2013-05-23T17:02:59 | 2013-05-23T17:02:59 | 5,937,777 | 0 | 0 | null | false | 2014-02-12T10:25:05 | 2012-09-24T17:04:23 | 2013-11-21T12:20:03 | 2013-08-06T15:12:01 | 28,227 | 0 | 2 | 1 | Java | null | null | /**
*/
package org.eclipse.scout.saml.saml;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Radio Group Element</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.scout.saml.saml.RadioGroupElement#getOptions <em>Options</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.scout.saml.saml.SamlPackage#getRadioGroupElement()
* @model
* @generated
*/
public interface RadioGroupElement extends GenericValueFieldElement
{
/**
* Returns the value of the '<em><b>Options</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.scout.saml.saml.RadioButtonElement}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Options</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Options</em>' containment reference list.
* @see org.eclipse.scout.saml.saml.SamlPackage#getRadioGroupElement_Options()
* @model containment="true"
* @generated
*/
EList<RadioButtonElement> getOptions();
} // RadioGroupElement
| UTF-8 | Java | 1,245 | java | RadioGroupElement.java | Java | [] | null | [] | /**
*/
package org.eclipse.scout.saml.saml;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Radio Group Element</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.scout.saml.saml.RadioGroupElement#getOptions <em>Options</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.scout.saml.saml.SamlPackage#getRadioGroupElement()
* @model
* @generated
*/
public interface RadioGroupElement extends GenericValueFieldElement
{
/**
* Returns the value of the '<em><b>Options</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.scout.saml.saml.RadioButtonElement}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Options</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Options</em>' containment reference list.
* @see org.eclipse.scout.saml.saml.SamlPackage#getRadioGroupElement_Options()
* @model containment="true"
* @generated
*/
EList<RadioButtonElement> getOptions();
} // RadioGroupElement
| 1,245 | 0.666667 | 0.666667 | 41 | 29.365854 | 30.462896 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | false | false | 13 |
f3fbda37b99dba03f626cfd1c0993a6669fc8bd8 | 20,023,137,543,991 | b417944294337786853910c36ca4358d74a78176 | /SklepGUI.java | bbeab7ecd8878c4b9a77f9f0ee66052609a1c631 | [] | no_license | teamWSIZ/obiektowe2014 | https://github.com/teamWSIZ/obiektowe2014 | 1c8864bd1d735a14a88eb149687851402d959044 | be6357e307c83ed5dd7aff5925100a959839bdf5 | refs/heads/master | 2016-09-06T09:37:48.153000 | 2015-02-28T13:40:54 | 2015-02-28T13:40:54 | 25,069,519 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import javax.swing.*;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.Set;
import java.util.TreeSet;
class Produkt implements Comparable {
Integer pid;
String nazwa;
int cena;
Produkt(int pid, String nazwa, int cena) {
this.pid = pid;
this.nazwa = nazwa;
this.cena = cena;
}
@Override
public String toString() {
return nazwa;
}
@Override
public int compareTo(Object o) {
Produkt drugi = (Produkt)o;
if (this.nazwa==drugi.nazwa) return pid.compareTo(drugi.pid);
return nazwa.compareTo(drugi.nazwa);
}
}
class Klient implements Comparable {
Integer kid;
String nazwisko;
String imie;
Klient(Integer kid, String nazwisko, String imie) {
this.kid = kid;
this.nazwisko = nazwisko;
this.imie = imie;
}
@Override
public String toString() {
return nazwisko + " " + imie;
}
@Override
public int compareTo(Object o) {
Klient drugi = (Klient)o;
if ((this.nazwisko + this.imie)==drugi.nazwisko+drugi.imie) {
return this.kid.compareTo(drugi.kid);
} else {
return (this.nazwisko+this.imie).compareTo(drugi.nazwisko+drugi.imie);
}
}
}
/**
* Created by mareckip on 17.01.15.
*/
public class SklepGUI {
private JPanel panel1;
private JPanel kontrola;
private JPanel zamowienie;
private JComboBox comboBox1;
private JComboBox comboBox2;
private JTextField a0TextField;
private JButton button1;
private JTextArea textArea1;
public SklepGUI() {
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String sztuk = a0TextField.getText();
Integer n = 0;
try {
n = Integer.parseInt(sztuk);
} catch (Exception ee) {return;}
Klient selectedKlient = (Klient)comboBox1.getSelectedItem();
Produkt selectedProduct = (Produkt)comboBox2.getSelectedItem();
try {
Statement stm = DriverManager.getConnection("jdbc:sqlite:/home/mareckip/aa/test/sklep.db").createStatement();
String qu = "insert into zamowienia(kid,pid,ilosc) values ('" +
selectedKlient.kid + "','" +
selectedProduct.pid + "','" +
n + "');";
int rs = stm.executeUpdate(qu);
} catch (SQLException se) {
textArea1.append("DB error occured");
return;
}
textArea1.append("Wybrano klienta " + selectedKlient + " (kid:" + selectedKlient.kid +")\n");
textArea1.append("prod:" + selectedProduct.toString() + "(pid:" + selectedProduct.pid + ")\n");
}
});
}
Set<Klient> wczytajKlientowZBazy() throws Exception {
Class.forName("org.sqlite.JDBC");
Connection c = DriverManager.getConnection("jdbc:sqlite:/home/mareckip/aa/test/sklep.db");
Statement stm = c.createStatement();
ResultSet rs = stm.executeQuery("select * from klienci");
Set<Klient> poz = new TreeSet<Klient>();
while (rs.next()) {
Klient tmp = new Klient(rs.getInt("kid"),rs.getString("nazwisko"),rs.getString("imie"));
poz.add(tmp);
}
return poz;
}
Set<Produkt> wczytajProduktyZBazy() throws Exception {
Class.forName("org.sqlite.JDBC");
Connection c = DriverManager.getConnection("jdbc:sqlite:/home/mareckip/aa/test/sklep.db");
Statement stm = c.createStatement();
ResultSet rs = stm.executeQuery("select * from produkty");
Set<Produkt> poz = new TreeSet<Produkt>();
while (rs.next()) {
Produkt tmp = new Produkt(rs.getInt("pid"),rs.getString("nazwa"),rs.getInt("cena"));
poz.add(tmp);
}
return poz;
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
}
JFrame frame = new JFrame("SklepGUI");
frame.setContentPane(new SklepGUI().panel1);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
private void createUIComponents() throws Exception {
comboBox1 = new JComboBox();
for(Klient s : wczytajKlientowZBazy())
comboBox1.addItem(s);
comboBox2 = new JComboBox();
for(Produkt p : wczytajProduktyZBazy()) {
comboBox2.addItem(p);
}
}
}
| UTF-8 | Java | 4,929 | java | SklepGUI.java | Java | [
{
"context": "+drugi.imie);\n }\n }\n}\n\n/**\n * Created by mareckip on 17.01.15.\n */\npublic class SklepGUI {\n priv",
"end": 1397,
"score": 0.9995071887969971,
"start": 1389,
"tag": "USERNAME",
"value": "mareckip"
}
] | null | [] | import javax.swing.*;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.Set;
import java.util.TreeSet;
class Produkt implements Comparable {
Integer pid;
String nazwa;
int cena;
Produkt(int pid, String nazwa, int cena) {
this.pid = pid;
this.nazwa = nazwa;
this.cena = cena;
}
@Override
public String toString() {
return nazwa;
}
@Override
public int compareTo(Object o) {
Produkt drugi = (Produkt)o;
if (this.nazwa==drugi.nazwa) return pid.compareTo(drugi.pid);
return nazwa.compareTo(drugi.nazwa);
}
}
class Klient implements Comparable {
Integer kid;
String nazwisko;
String imie;
Klient(Integer kid, String nazwisko, String imie) {
this.kid = kid;
this.nazwisko = nazwisko;
this.imie = imie;
}
@Override
public String toString() {
return nazwisko + " " + imie;
}
@Override
public int compareTo(Object o) {
Klient drugi = (Klient)o;
if ((this.nazwisko + this.imie)==drugi.nazwisko+drugi.imie) {
return this.kid.compareTo(drugi.kid);
} else {
return (this.nazwisko+this.imie).compareTo(drugi.nazwisko+drugi.imie);
}
}
}
/**
* Created by mareckip on 17.01.15.
*/
public class SklepGUI {
private JPanel panel1;
private JPanel kontrola;
private JPanel zamowienie;
private JComboBox comboBox1;
private JComboBox comboBox2;
private JTextField a0TextField;
private JButton button1;
private JTextArea textArea1;
public SklepGUI() {
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String sztuk = a0TextField.getText();
Integer n = 0;
try {
n = Integer.parseInt(sztuk);
} catch (Exception ee) {return;}
Klient selectedKlient = (Klient)comboBox1.getSelectedItem();
Produkt selectedProduct = (Produkt)comboBox2.getSelectedItem();
try {
Statement stm = DriverManager.getConnection("jdbc:sqlite:/home/mareckip/aa/test/sklep.db").createStatement();
String qu = "insert into zamowienia(kid,pid,ilosc) values ('" +
selectedKlient.kid + "','" +
selectedProduct.pid + "','" +
n + "');";
int rs = stm.executeUpdate(qu);
} catch (SQLException se) {
textArea1.append("DB error occured");
return;
}
textArea1.append("Wybrano klienta " + selectedKlient + " (kid:" + selectedKlient.kid +")\n");
textArea1.append("prod:" + selectedProduct.toString() + "(pid:" + selectedProduct.pid + ")\n");
}
});
}
Set<Klient> wczytajKlientowZBazy() throws Exception {
Class.forName("org.sqlite.JDBC");
Connection c = DriverManager.getConnection("jdbc:sqlite:/home/mareckip/aa/test/sklep.db");
Statement stm = c.createStatement();
ResultSet rs = stm.executeQuery("select * from klienci");
Set<Klient> poz = new TreeSet<Klient>();
while (rs.next()) {
Klient tmp = new Klient(rs.getInt("kid"),rs.getString("nazwisko"),rs.getString("imie"));
poz.add(tmp);
}
return poz;
}
Set<Produkt> wczytajProduktyZBazy() throws Exception {
Class.forName("org.sqlite.JDBC");
Connection c = DriverManager.getConnection("jdbc:sqlite:/home/mareckip/aa/test/sklep.db");
Statement stm = c.createStatement();
ResultSet rs = stm.executeQuery("select * from produkty");
Set<Produkt> poz = new TreeSet<Produkt>();
while (rs.next()) {
Produkt tmp = new Produkt(rs.getInt("pid"),rs.getString("nazwa"),rs.getInt("cena"));
poz.add(tmp);
}
return poz;
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
}
JFrame frame = new JFrame("SklepGUI");
frame.setContentPane(new SklepGUI().panel1);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
private void createUIComponents() throws Exception {
comboBox1 = new JComboBox();
for(Klient s : wczytajKlientowZBazy())
comboBox1.addItem(s);
comboBox2 = new JComboBox();
for(Produkt p : wczytajProduktyZBazy()) {
comboBox2.addItem(p);
}
}
}
| 4,929 | 0.58166 | 0.576588 | 152 | 31.427631 | 26.282774 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585526 | false | false | 13 |
bf7c2765b20cad182551df7e05aea8c31ab5667c | 7,112,465,911,150 | 5a1a052b8c6735122d358a22ec7db861e4c203e8 | /src/java/rjs/jia/believes.java | 4bf0069ba4fdae77620f80cf5760b5972f877b13 | [] | no_license | amdia/supervisor | https://github.com/amdia/supervisor | a21c651b445dd937893b1214453e9bbf9c563679 | b8754fbbe8223ad4730a3fbe942de70136067033 | refs/heads/master | 2020-07-03T12:28:56.224000 | 2020-02-03T17:01:52 | 2020-02-03T17:01:52 | 201,901,210 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rjs.jia;
import java.util.Iterator;
import jason.JasonException;
import jason.asSemantics.DefaultInternalAction;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
import jason.asSyntax.LogicalFormula;
import jason.asSyntax.Term;
@SuppressWarnings("serial")
public class believes extends DefaultInternalAction {
@Override public int getMinArgs() {
return 1;
}
@Override public int getMaxArgs() {
return 1;
}
@Override protected void checkArguments(Term[] args) throws JasonException {
super.checkArguments(args); // check number of arguments
if (!(args[0] instanceof LogicalFormula))
throw JasonException.createWrongArgument(this,"first argument must be a formula");
}
@Override
public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
checkArguments(args);
LogicalFormula logExpr = (LogicalFormula)args[0];
Iterator<Unifier> iu = logExpr.logicalConsequence(ts.getAg(), un);
if (iu != null && iu.hasNext()) {
return true;
}else {
return false;
}
}
}
| UTF-8 | Java | 1,164 | java | believes.java | Java | [] | null | [] | package rjs.jia;
import java.util.Iterator;
import jason.JasonException;
import jason.asSemantics.DefaultInternalAction;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
import jason.asSyntax.LogicalFormula;
import jason.asSyntax.Term;
@SuppressWarnings("serial")
public class believes extends DefaultInternalAction {
@Override public int getMinArgs() {
return 1;
}
@Override public int getMaxArgs() {
return 1;
}
@Override protected void checkArguments(Term[] args) throws JasonException {
super.checkArguments(args); // check number of arguments
if (!(args[0] instanceof LogicalFormula))
throw JasonException.createWrongArgument(this,"first argument must be a formula");
}
@Override
public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
checkArguments(args);
LogicalFormula logExpr = (LogicalFormula)args[0];
Iterator<Unifier> iu = logExpr.logicalConsequence(ts.getAg(), un);
if (iu != null && iu.hasNext()) {
return true;
}else {
return false;
}
}
}
| 1,164 | 0.686426 | 0.68299 | 40 | 28.1 | 25.887062 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 13 |
0eff25252ac4899b4085f68e654ce347ccbdabb1 | 77,309,474,385 | b3450122eef42e40eb6df9f815be620e8cb53451 | /day01/src/com/oxysa/list/ListDemo06.java | 6333686f7c38f71282af8c414c5bd0ed8b44822d | [] | no_license | 873387751/yummy | https://github.com/873387751/yummy | 2e49986726a7bff0f5bfe42c01e3f388b8698f14 | 628c39e4230a43e732eb6c81af1d74068b7c5343 | refs/heads/master | 2021-04-20T22:15:05.146000 | 2020-03-24T13:45:42 | 2020-03-24T13:45:42 | 249,720,910 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oxysa.list;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
//案例: 演示LinkedList集合存储字符串然后遍历.
public class ListDemo06 {
public static void main(String[] args) {
LinkedList<String> list = new LinkedList<>();
list.add("hello");
list.add("world");
list.add("java");
//遍历集合
//第一种 迭代器
Iterator<String> it = list.iterator();
while (it.hasNext()){
System.out.println(it.next());
}
System.out.println("==============================");
//第二种 List体系独有的列表迭代器
ListIterator<String> its = list.listIterator();
while (its.hasNext()){
System.out.println(its.next());
}
System.out.println("==============================");
//第三种 增强for
for (String s : list){
System.out.println(s);
}
System.out.println("==============================");
//第四种 普通for
for (int i = 0; i <list.size() ; i++) {
System.out.println(list.get(i));
}
}
}
| UTF-8 | Java | 1,199 | java | ListDemo06.java | Java | [] | null | [] | package com.oxysa.list;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
//案例: 演示LinkedList集合存储字符串然后遍历.
public class ListDemo06 {
public static void main(String[] args) {
LinkedList<String> list = new LinkedList<>();
list.add("hello");
list.add("world");
list.add("java");
//遍历集合
//第一种 迭代器
Iterator<String> it = list.iterator();
while (it.hasNext()){
System.out.println(it.next());
}
System.out.println("==============================");
//第二种 List体系独有的列表迭代器
ListIterator<String> its = list.listIterator();
while (its.hasNext()){
System.out.println(its.next());
}
System.out.println("==============================");
//第三种 增强for
for (String s : list){
System.out.println(s);
}
System.out.println("==============================");
//第四种 普通for
for (int i = 0; i <list.size() ; i++) {
System.out.println(list.get(i));
}
}
}
| 1,199 | 0.487761 | 0.485041 | 45 | 23.51111 | 19.126041 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.422222 | false | false | 13 |
c016472eef24f705a14e081734d4433c0ff93d34 | 77,309,477,608 | 9b2892d629491c076cfab9b417e0d080a70c4666 | /simple-step11/src/main/java/com/baogex/springframework/apo/framework/JdkDynamicAopProxy.java | 9cd8f8799985b6530b8a0c13a7af39e8553d9159 | [] | no_license | a563831546/simple-spring | https://github.com/a563831546/simple-spring | cc8683a514a9b0e9e5d76205e5ff203e6020175c | 26f86ac4a0a611f2e0fd267aa7b5dc0515e6b014 | refs/heads/master | 2023-07-09T16:01:03.241000 | 2021-08-16T23:38:06 | 2021-08-16T23:38:06 | 391,901,345 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.baogex.springframework.apo.framework;
import com.baogex.springframework.apo.AdvisedSupport;
import org.aopalliance.intercept.MethodInterceptor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author : baogex.com
* @since : 2021-08-10
*/
public class JdkDynamicAopProxy implements AopProxy, InvocationHandler {
// 增强支持封装参数
private AdvisedSupport advisedSupport;
public JdkDynamicAopProxy(AdvisedSupport advisedSupport) {
this.advisedSupport = advisedSupport;
}
@Override
public Object getProxy() {
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
advisedSupport.getTargetSource().getTargetClass(),
this);
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// 获取被代理目标对象
Object target = this.advisedSupport.getTargetSource().getTarget();
// 函数是否与生产的切面匹配器
if (advisedSupport.getMethodMatcher().matches(method, target.getClass())) {
MethodInterceptor interceptor = advisedSupport.getMethodInterceptor();
return interceptor.invoke(new ReflectiveMethodInvocation(target, method, args));
}
return method.invoke(target, args);
}
public AdvisedSupport getAdvisedSupport() {
return advisedSupport;
}
public void setAdvisedSupport(AdvisedSupport advisedSupport) {
this.advisedSupport = advisedSupport;
}
}
| UTF-8 | Java | 1,628 | java | JdkDynamicAopProxy.java | Java | [
{
"context": "\nimport java.lang.reflect.Proxy;\n\n/**\n * @author : baogex.com\n * @since : 2021-08-10\n */\npublic class ",
"end": 286,
"score": 0.8761549592018127,
"start": 285,
"tag": "EMAIL",
"value": "b"
},
{
"context": "mport java.lang.reflect.Proxy;\n\n/**\n * @author : baoge... | null | [] | package com.baogex.springframework.apo.framework;
import com.baogex.springframework.apo.AdvisedSupport;
import org.aopalliance.intercept.MethodInterceptor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author : baogex.com
* @since : 2021-08-10
*/
public class JdkDynamicAopProxy implements AopProxy, InvocationHandler {
// 增强支持封装参数
private AdvisedSupport advisedSupport;
public JdkDynamicAopProxy(AdvisedSupport advisedSupport) {
this.advisedSupport = advisedSupport;
}
@Override
public Object getProxy() {
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
advisedSupport.getTargetSource().getTargetClass(),
this);
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// 获取被代理目标对象
Object target = this.advisedSupport.getTargetSource().getTarget();
// 函数是否与生产的切面匹配器
if (advisedSupport.getMethodMatcher().matches(method, target.getClass())) {
MethodInterceptor interceptor = advisedSupport.getMethodInterceptor();
return interceptor.invoke(new ReflectiveMethodInvocation(target, method, args));
}
return method.invoke(target, args);
}
public AdvisedSupport getAdvisedSupport() {
return advisedSupport;
}
public void setAdvisedSupport(AdvisedSupport advisedSupport) {
this.advisedSupport = advisedSupport;
}
}
| 1,628 | 0.700893 | 0.695791 | 49 | 31 | 27.761374 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.489796 | false | false | 13 |
dd1b52999b6b0edcfebe4b3e2cf71527e4d86b2d | 12,652,973,704,516 | 535e5d97d44fd42fca2a6fc68b3b566046ffa6c2 | /android/support/v4/app/ao.java | 0879e2365270eebcc62a6edbe20b07049733f086 | [] | no_license | eric-lanita/BigRoadTruckingLogbookApp_v21.0.12_source_from_JADX | https://github.com/eric-lanita/BigRoadTruckingLogbookApp_v21.0.12_source_from_JADX | 47566c288bc89777184b73ef0eb199b61de39f82 | fb84301d90ec083ce06c68a3828cf99d8855c007 | refs/heads/master | 2021-09-01T07:02:52.500000 | 2017-12-25T15:06:05 | 2017-12-25T15:06:05 | 115,346,008 | 0 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package android.support.v4.app;
import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.v4.app.aq.C0174a;
import android.support.v4.app.aq.C0174a.C0167a;
import android.util.Log;
public final class ao extends C0174a {
public static final C0167a f592a = new C01681();
private static final C0170b f593g;
private final String f594b;
private final CharSequence f595c;
private final CharSequence[] f596d;
private final boolean f597e;
private final Bundle f598f;
static class C01681 implements C0167a {
C01681() {
}
}
public static final class C0169a {
private final String f587a;
private CharSequence f588b;
private CharSequence[] f589c;
private boolean f590d = true;
private Bundle f591e = new Bundle();
public C0169a(String str) {
if (str == null) {
throw new IllegalArgumentException("Result key can't be null");
}
this.f587a = str;
}
public C0169a m748a(CharSequence charSequence) {
this.f588b = charSequence;
return this;
}
public C0169a m750a(CharSequence[] charSequenceArr) {
this.f589c = charSequenceArr;
return this;
}
public C0169a m749a(boolean z) {
this.f590d = z;
return this;
}
public C0169a m747a(Bundle bundle) {
if (bundle != null) {
this.f591e.putAll(bundle);
}
return this;
}
public ao m751a() {
return new ao(this.f587a, this.f588b, this.f589c, this.f590d, this.f591e);
}
}
interface C0170b {
Bundle mo129a(Intent intent);
}
static class C0171c implements C0170b {
C0171c() {
}
public Bundle mo129a(Intent intent) {
return ap.m767a(intent);
}
}
static class C0172d implements C0170b {
C0172d() {
}
public Bundle mo129a(Intent intent) {
Log.w("RemoteInput", "RemoteInput is only supported from API Level 16");
return null;
}
}
static class C0173e implements C0170b {
C0173e() {
}
public Bundle mo129a(Intent intent) {
return ar.m769a(intent);
}
}
private ao(String str, CharSequence charSequence, CharSequence[] charSequenceArr, boolean z, Bundle bundle) {
this.f594b = str;
this.f595c = charSequence;
this.f596d = charSequenceArr;
this.f597e = z;
this.f598f = bundle;
}
public String mo130a() {
return this.f594b;
}
public CharSequence mo131b() {
return this.f595c;
}
public CharSequence[] mo132c() {
return this.f596d;
}
public boolean mo133d() {
return this.f597e;
}
public Bundle mo134e() {
return this.f598f;
}
public static Bundle m761a(Intent intent) {
return f593g.mo129a(intent);
}
static {
if (VERSION.SDK_INT >= 20) {
f593g = new C0171c();
} else if (VERSION.SDK_INT >= 16) {
f593g = new C0173e();
} else {
f593g = new C0172d();
}
}
}
| UTF-8 | Java | 3,330 | java | ao.java | Java | [] | null | [] | package android.support.v4.app;
import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.v4.app.aq.C0174a;
import android.support.v4.app.aq.C0174a.C0167a;
import android.util.Log;
public final class ao extends C0174a {
public static final C0167a f592a = new C01681();
private static final C0170b f593g;
private final String f594b;
private final CharSequence f595c;
private final CharSequence[] f596d;
private final boolean f597e;
private final Bundle f598f;
static class C01681 implements C0167a {
C01681() {
}
}
public static final class C0169a {
private final String f587a;
private CharSequence f588b;
private CharSequence[] f589c;
private boolean f590d = true;
private Bundle f591e = new Bundle();
public C0169a(String str) {
if (str == null) {
throw new IllegalArgumentException("Result key can't be null");
}
this.f587a = str;
}
public C0169a m748a(CharSequence charSequence) {
this.f588b = charSequence;
return this;
}
public C0169a m750a(CharSequence[] charSequenceArr) {
this.f589c = charSequenceArr;
return this;
}
public C0169a m749a(boolean z) {
this.f590d = z;
return this;
}
public C0169a m747a(Bundle bundle) {
if (bundle != null) {
this.f591e.putAll(bundle);
}
return this;
}
public ao m751a() {
return new ao(this.f587a, this.f588b, this.f589c, this.f590d, this.f591e);
}
}
interface C0170b {
Bundle mo129a(Intent intent);
}
static class C0171c implements C0170b {
C0171c() {
}
public Bundle mo129a(Intent intent) {
return ap.m767a(intent);
}
}
static class C0172d implements C0170b {
C0172d() {
}
public Bundle mo129a(Intent intent) {
Log.w("RemoteInput", "RemoteInput is only supported from API Level 16");
return null;
}
}
static class C0173e implements C0170b {
C0173e() {
}
public Bundle mo129a(Intent intent) {
return ar.m769a(intent);
}
}
private ao(String str, CharSequence charSequence, CharSequence[] charSequenceArr, boolean z, Bundle bundle) {
this.f594b = str;
this.f595c = charSequence;
this.f596d = charSequenceArr;
this.f597e = z;
this.f598f = bundle;
}
public String mo130a() {
return this.f594b;
}
public CharSequence mo131b() {
return this.f595c;
}
public CharSequence[] mo132c() {
return this.f596d;
}
public boolean mo133d() {
return this.f597e;
}
public Bundle mo134e() {
return this.f598f;
}
public static Bundle m761a(Intent intent) {
return f593g.mo129a(intent);
}
static {
if (VERSION.SDK_INT >= 20) {
f593g = new C0171c();
} else if (VERSION.SDK_INT >= 16) {
f593g = new C0173e();
} else {
f593g = new C0172d();
}
}
}
| 3,330 | 0.564565 | 0.477477 | 138 | 23.130434 | 20.009356 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.42029 | false | false | 13 |
eb05b9887cf75b22be7f949c1a113038c5cac56d | 30,434,138,264,345 | f84feee14d5f7dca5e0031539bb7df1b462bbf3c | /org.projectusus.ui.dependencygraph/src/org/projectusus/ui/dependencygraph/common/DependencyGraphModel.java | 65e134746d238d53687fbdbd7d16b8fb28466529 | [] | no_license | usus/usus-plugins | https://github.com/usus/usus-plugins | 96ec449788af433ec7230b71c8f100ab70781bfb | 840a705cb0d97fbb256cc6d202150291892f9dfd | refs/heads/master | 2021-01-02T22:52:00.335000 | 2018-01-03T14:39:04 | 2018-01-03T14:39:04 | 2,630,778 | 11 | 3 | null | false | 2017-10-06T11:59:39 | 2011-10-23T13:53:47 | 2017-03-09T15:34:05 | 2017-10-06T11:59:38 | 66,695 | 9 | 6 | 26 | Java | null | null | package org.projectusus.ui.dependencygraph.common;
import java.util.Set;
import org.projectusus.ui.dependencygraph.nodes.GraphNode;
public abstract class DependencyGraphModel {
private Set<? extends GraphNode> nodes;
private boolean changed = false;
public boolean isChanged() {
return nodes == null || changed;
}
public void resetChanged() {
this.changed = false;
}
public Set<? extends GraphNode> getGraphNodes() {
if( nodes == null ) {
nodes = getRefreshedNodes();
}
return nodes;
}
protected abstract Set<? extends GraphNode> getRefreshedNodes();
public void invalidate() {
Set<? extends GraphNode> freshNodes = getRefreshedNodes();
if( nodes != null ) {
if( !freshNodes.equals( nodes ) ) {
nodes = freshNodes;
changed = true;
}
}
}
}
| UTF-8 | Java | 925 | java | DependencyGraphModel.java | Java | [] | null | [] | package org.projectusus.ui.dependencygraph.common;
import java.util.Set;
import org.projectusus.ui.dependencygraph.nodes.GraphNode;
public abstract class DependencyGraphModel {
private Set<? extends GraphNode> nodes;
private boolean changed = false;
public boolean isChanged() {
return nodes == null || changed;
}
public void resetChanged() {
this.changed = false;
}
public Set<? extends GraphNode> getGraphNodes() {
if( nodes == null ) {
nodes = getRefreshedNodes();
}
return nodes;
}
protected abstract Set<? extends GraphNode> getRefreshedNodes();
public void invalidate() {
Set<? extends GraphNode> freshNodes = getRefreshedNodes();
if( nodes != null ) {
if( !freshNodes.equals( nodes ) ) {
nodes = freshNodes;
changed = true;
}
}
}
}
| 925 | 0.595676 | 0.595676 | 39 | 22.717949 | 20.869495 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.