blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1e54e2213047741158854424c4145adbd03b7221 | 1c27d270944d004e5a889abf67ce66e80e6fbf91 | /app/src/main/java/com/aapreneur/vpay/Fragment/profile.java | cbaf7cce0dbb4f77e69e59e07251b6639a81cf5c | [] | no_license | caishun/vpay | aa4e8aa44ac49e2480b07c00c5dba97234d984b3 | dead4be79d53574cb97eab9b68507a6c7c69cd0c | refs/heads/master | 2021-09-08T11:00:56.875050 | 2018-06-02T15:41:10 | 2018-06-02T15:41:10 | 136,007,776 | 0 | 0 | null | 2018-06-04T10:14:24 | 2018-06-04T10:14:23 | null | UTF-8 | Java | false | false | 6,726 | java | package com.aapreneur.vpay.Fragment;
/**
* Created by Anmol Pratap Singh on 28-01-2018.
*/
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.aapreneur.vpay.CircleTransform;
import com.aapreneur.vpay.Resources.Configuration;
import com.aapreneur.vpay.checkout;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import com.aapreneur.vpay.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class profile extends Fragment{
private TextView name;
private ImageView image;
private TextView mobile;
private TextView acoountNumber;
private TextView IFSC;
private TextView tvemail;
FirebaseAuth mAuth;
public profile() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_profile, container, false);
mAuth = FirebaseAuth.getInstance();
FirebaseUser user = mAuth.getCurrentUser();
name =(TextView)view.findViewById(R.id.name);
mobile = (TextView)view.findViewById(R.id.mobile);
image=(ImageView)view.findViewById(R.id.profile);
acoountNumber=(TextView)view.findViewById(R.id.account);
IFSC = (TextView)view.findViewById(R.id.ifsc);
tvemail = (TextView)view.findViewById(R.id.email);
if (user != null) {
name.setText(user.getDisplayName());
mobile.setText(user.getPhoneNumber());
new ReadAccount().execute();
new ReadProfile().execute();
Glide.with(this)
.load(user.getPhotoUrl())
.crossFade()
.thumbnail(0.5f)
.bitmapTransform(new CircleTransform(getActivity()))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(image);
}
return view;
}
class ReadAccount extends AsyncTask< Void, Void, Void > {
ProgressDialog dialog;
int jIndex=0;
String name,number,ifsc;
FirebaseAuth mAuth;
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Nullable
@Override
public Void doInBackground(Void...params) {
mAuth = FirebaseAuth.getInstance();
FirebaseUser user = mAuth.getCurrentUser();
JSONArray jsonArray = Configuration.readAccount(user.getUid());
try {
if (jsonArray != null) {
if (jsonArray.length() > 0) {
int lenArray = jsonArray.length();
if (lenArray > 0) {
for (; jIndex < lenArray; jIndex++) {
JSONObject innerObject = jsonArray.getJSONObject(jIndex);
String id = innerObject.getString("id");
name = innerObject.getString("name");
number = innerObject.getString("number");
ifsc = innerObject.getString("ifsc");
}
}
}
} else {
}
} catch (JSONException je) {
//Log.i(Controller.TAG, "" + je.getLocalizedMessage());
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
IFSC.setText(ifsc);
acoountNumber.setText(number);
}
}
class ReadProfile extends AsyncTask< Void, Void, Void > {
ProgressDialog dialog;
int jIndex=0;
String name,email;
FirebaseAuth mAuth;
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new ProgressDialog(getActivity());
dialog.setTitle("Please Wait...");
dialog.setMessage("Getting Your Profile");
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(false);
dialog.show();
}
@Nullable
@Override
public Void doInBackground(Void...params) {
mAuth = FirebaseAuth.getInstance();
FirebaseUser user = mAuth.getCurrentUser();
JSONArray jsonArray = Configuration.readProfile(user.getUid());
try {
if (jsonArray != null) {
if (jsonArray.length() > 0) {
int lenArray = jsonArray.length();
if (lenArray > 0) {
for (; jIndex < lenArray; jIndex++) {
JSONObject innerObject = jsonArray.getJSONObject(jIndex);
String id = innerObject.getString("id");
name = innerObject.getString("name");
email = innerObject.getString("email");
}
}
}
} else {
}
} catch (JSONException je) {
//Log.i(Controller.TAG, "" + je.getLocalizedMessage());
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
tvemail.setText(email);
dialog.dismiss();
}
}
}
| [
"anmolpratapsingh1997@gmail.com"
] | anmolpratapsingh1997@gmail.com |
7e30ba8f63795d717a803d304f5e68ea80620b7c | 0db9e6a66b1e6e8dfe258c6d8c92541916b797ce | /AndroidStudioProjects/Android-master/Cliqdbase/app/src/main/java/com/cliqdbase/app/general/Dialogs.java | e2f5734c082a1dfaf5dcb52799c26ccd37755a6d | [] | no_license | HannahShulman/Cliqdbase | 0659a55687067fc92aa41dbb8ac313c34b6ca2f3 | b5eef9efa58a71e9269ada34d7fb757f91007004 | refs/heads/master | 2020-12-30T13:21:19.274157 | 2017-05-13T22:57:50 | 2017-05-13T22:57:50 | 91,207,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,430 | java | package com.cliqdbase.app.general;
import android.support.annotation.NonNull;
import android.widget.EditText;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import com.cliqdbase.app.R;
import com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerDialog;
/**
* Created by Yuval on 07/05/2015.
*
* @author Yuval Siev
*/
public class Dialogs {
public static CalendarDatePickerDialog createBirthdayDatePickerDialog(final EditText editText) {
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
CalendarDatePickerDialog datePicker = CalendarDatePickerDialog.newInstance(
new CalendarDatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(CalendarDatePickerDialog calendarDatePickerDialog, int year, int monthOfYear, int dateOfMonth) {
monthOfYear++;
String dateOfBirth = dateOfMonth + "/" + monthOfYear + "/" + year;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
Date date;
try {
// Formatting the date based on the user's locale.
date = simpleDateFormat.parse(dateOfBirth);
showPickedDateOnEditText(editText, date);
} catch (ParseException e) { /* Ignore */ }
}
},
cal.get(Calendar.YEAR) - 18,
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH));
datePicker.setYearRange(1900, cal.get(Calendar.YEAR) - 1);
return datePicker;
}
public static void showPickedDateOnEditText(@NonNull EditText editText, @NonNull Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
String dateOfBirthToPresent = sdf.format(date);
editText.setError(null); // Making sure that all previous errors has been deleted.
editText.setBackgroundResource(R.drawable.edit_text_box); // Setting the edit text box to the original non-error view
editText.setText(dateOfBirthToPresent);
}
}
| [
"chani1991"
] | chani1991 |
c518e2690fcd34396d4ec3ba79cec94f63b70174 | ace00e8de74e709e32f6001e835dec4fc379d71a | /Assing_3/src/com/company/SortPlayers.java | 9b86e7dcdcb14aa224850d9b398a12286b17ab62 | [] | no_license | ayushi19031/MafiaMultiplayerSimulation | a42f350d8ee44025f0cd3cf4cac7c1b9d20d69c4 | 9a8bb3e1c705cf6570730c7607f10590bcebfaf3 | refs/heads/main | 2023-01-07T06:58:41.234036 | 2020-11-06T13:22:07 | 2020-11-06T13:22:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package com.company;
import java.util.Comparator;
public class SortPlayers implements Comparator<Player> {
public int compare(Player p1, Player p2){
int[] a = new int[2];
int mafia = 5;
int detect = 4;
int heal = 3;
int commoner = 2;
if (p1 instanceof Mafia){
a[0] = mafia;
}
if (p2 instanceof Mafia){
a[1] = mafia;
}
if (p1 instanceof Detective){
a[0] = detect;
}
if (p2 instanceof Detective){
a[1] = detect;
}
if (p1 instanceof Healer){
a[0] = heal;
}
if (p2 instanceof Healer){
a[1] = heal;
}
if (p1 instanceof Commoner){
a[0] = commoner;
}
if (p2 instanceof Commoner){
a[1] = commoner;
}
return a[0] - a[1];
}
}
| [
"ayushi19031@iiitd.ac.in"
] | ayushi19031@iiitd.ac.in |
77007c7f2a3fcbb211d76170d63694539cb0336b | ecfac4c1e074ba7088e99c94f58305b09c9c8228 | /ePNK-app-tutorial/org.pnml.tools.epnk.tutorials.app.simulator/src/org/pnml/tools/epnk/tutorials/app/simulator/application/EnabledTransitionHandler.java | 3b3324968f580950569f3eec40a265cdf7aa14a9 | [] | no_license | Mikfor/VendingMachine | 126f253ef836461e50c9607bfb50f38e0ff26f79 | 9610836879ee1eb16b1560dc87fc88dec39b77e9 | refs/heads/master | 2021-01-19T07:13:22.403456 | 2017-04-07T09:34:41 | 2017-04-07T09:34:41 | 87,528,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,284 | java | package org.pnml.tools.epnk.tutorials.app.simulator.application;
import java.util.Collection;
import java.util.HashSet;
import org.eclipse.draw2d.MouseEvent;
import org.pnml.tools.epnk.annotations.netannotations.NetAnnotation;
import org.pnml.tools.epnk.annotations.netannotations.NetAnnotations;
import org.pnml.tools.epnk.annotations.netannotations.ObjectAnnotation;
import org.pnml.tools.epnk.applications.ui.IActionHandler;
import org.pnml.tools.epnk.helpers.NetFunctions;
import org.pnml.tools.epnk.pnmlcoremodel.TransitionNode;
import org.pnml.tools.epnk.tutorials.app.simulator.techsimannotations.EnabledTransition;
import org.pnml.tools.epnk.tutorials.app.simulator.techsimannotations.InvolvedArc;
import org.pnml.tools.epnk.tutorials.app.technical.Arc;
import org.pnml.tools.epnk.tutorials.app.technical.Transition;
/**
* Action handler dealing with mouse clicks on EnableTransition annotations.
* It will fire the transition, if it is enabled.
*
* @author ekki@dtu.dk
*
*/
public class EnabledTransitionHandler implements IActionHandler {
private TechnicalSimulator application;
public EnabledTransitionHandler(TechnicalSimulator application) {
super();
this.application = application;
}
@Override
public boolean mouseDoubleClicked(MouseEvent arg0, ObjectAnnotation annotation) {
// FlatAccess flatAccess = application.getFlatAccess();
NetAnnotations netAnnotations = application.getNetAnnotations();
NetAnnotation current = netAnnotations.getCurrent();
if (current.getObjectAnnotations().contains(annotation)) {
Object object = annotation.getObject();
if (object instanceof TransitionNode) {
// object = flatAccess.resolve((TransitionNode) object);
object = NetFunctions.resolve((TransitionNode) object);
}
if (object instanceof Transition && annotation instanceof EnabledTransition) {
Transition transition = (Transition) object;
EnabledTransition enabledTransition = (EnabledTransition) annotation;
if (enabledTransition.isEnabled()) {
// compute the in-arcs marked as inactive by the user
Collection<Arc> inactiveInArcs = new HashSet<Arc>();
for (InvolvedArc a: enabledTransition.getIn()) {
Object o = a.getObject();
if (o instanceof Arc && !a.isActive()) {
inactiveInArcs.add((Arc) o);
}
}
// compute the out-arcs marked as inactive by the user
Collection<Arc> inactiveOutArcs = new HashSet<Arc>();
for (InvolvedArc a: enabledTransition.getOut()) {
Object o = a.getObject();
if (o instanceof Arc && !a.isActive()) {
inactiveOutArcs.add((Arc) o);
}
}
// fire the transition. Note that the inactive in and out arcs are not
// really necessary here; they are used to demonstrate how some additional
// information could be passed to the fire method if needed.
return application.fireTransition(transition, inactiveInArcs, inactiveOutArcs);
}
}
}
return false;
}
@Override
public boolean mousePressed(MouseEvent arg0, ObjectAnnotation annotation) {
return false;
}
@Override
public boolean mouseReleased(MouseEvent arg0, ObjectAnnotation annotation) {
return false;
}
}
| [
"ibsenb@ibsens-mbp.eduroam.wireless.dtu.dk"
] | ibsenb@ibsens-mbp.eduroam.wireless.dtu.dk |
9c8acaabff935d9b3f3057f5617621893ffdd993 | 1cace1b0b2e12b5ba4902c94b6b16b0db5bf32b7 | /src/main/java/com/bisratmk/roboresume/roboresume/RoboresumeApplication.java | 536837453ab63b8d06bfaac8587b0e9b55658a4e | [] | no_license | BisratMKebede/RoboResumeFinal | 92259e0d67715ed23e7eca1aa9d40485441b3228 | 9254ce67934e702a7e067ce2ef00dedbea608ae3 | refs/heads/master | 2021-05-08T13:36:28.472877 | 2018-02-02T19:54:21 | 2018-02-02T19:54:21 | 120,023,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.bisratmk.roboresume.roboresume;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RoboresumeApplication {
public static void main(String[] args) {
SpringApplication.run(RoboresumeApplication.class, args);
}
}
| [
"bmknigussie@gmail.com"
] | bmknigussie@gmail.com |
e6e160c3b0f983a58a9865aaee821488656c1b29 | 23b9cf65e3377c2e91445503a9f2bbfd1c93be22 | /Java/workspace/Java1-Chapter14/test/com/skilldistillery/stringtest/StringTest.java | bd691d95f95f44a9b34e6d86ec08f18fed11e398 | [] | no_license | TravisWay/Skill-Distillery | 6d596529664e9e492d40d0e92f081fe6e32cf473 | 153ae2cbb070761e7accc0ca291f41c608ecefb1 | refs/heads/master | 2021-01-23T10:43:27.491949 | 2017-07-14T01:03:29 | 2017-07-14T01:03:29 | 93,082,758 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,728 | java | package com.skilldistillery.stringtest;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
import sun.security.util.Length;
public class StringTest {
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void test_CharAt_returns_character_at_index() {
String tester = "abcde";
assertEquals('a', tester.charAt(0));
assertEquals('e', tester.charAt(4));
}
@Test
public void test_CharAt_throws_IndexOutOfBounds_for_negative_or_notless_than_Length_of_string(){
try {
String tester = "0123";
tester.charAt(4);
fail("Should have thrown exception here");
} catch (IndexOutOfBoundsException e) {
// TODO: handle exception
}
}
@Test
public void test_Concat(){
String tester = "abc";
String tester2 = "def";
assertEquals("abcdef",tester.concat(tester2));
}
@Test
public void test_contains(){
String tester = "abc";
assertEquals(true,tester.contains("a"));
}
@Test
public void test_contains_if_String_is_null_throws_NullPointerException(){
try {
String tester= null;
tester.contains("a");
fail("Should have thrown a Null Pointer Exception");
} catch (NullPointerException e) {
// TODO: handle exception
}
}
@Test
public void testendsWith(){
String tester = "abcd";
assertEquals(true,tester.endsWith("d"));
}
@Test
public void testindexOf(){
String tester ="abcd";
assertEquals(2, tester.indexOf("c"));
}
@Test
public void testisEmpty(){
String tester ="abcd";
assertEquals(false, tester.isEmpty());
}
}
| [
"travis_sti@yahoo.com"
] | travis_sti@yahoo.com |
8a9339b5a2c3256a2023300b98518e38dd0473bf | 810c67990dc291d31723691defa68e35f20405c3 | /okhttpmanager/src/main/java/com/dpzx/okhttpmanager/User.java | 4f98d699faabfa969c6fa19f437f3cd6057bf88f | [
"Apache-2.0"
] | permissive | iblue007/okhttpManager-master | 2c6105cd47144fb421324321de3eddec2a04c217 | 62ecdfb53f88d7e7b768bc4f044d7919f29dbe8f | refs/heads/master | 2020-04-27T15:35:39.082410 | 2019-03-08T02:07:27 | 2019-03-08T02:07:27 | 174,452,175 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.dpzx.okhttpmanager;
public class User {
public String username ;
public String password ;
public User() {
// TODO Auto-generated constructor stub
}
public User(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public String toString()
{
return "User{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
'}';
}
}
| [
"744639775@qq.com"
] | 744639775@qq.com |
ec9a4b6a42e8c1a2b845ec6bd23ad478f330c307 | c1b833c9ca7b01a760c1bcb8c7c4607933618d80 | /src/main/java/com/lhf/exam/service/FoodService.java | c09138f60fb1acd4947da3806e1808a765854078 | [] | no_license | liumuping/Test | 96424e15a2f7b1175cfc6f5125fb9fdad364c99a | 1c0e62ceed702fcf85a3fa97499248e09c14ef93 | refs/heads/master | 2020-04-05T10:34:38.765564 | 2018-11-09T03:11:14 | 2018-11-09T03:11:14 | 156,803,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,854 | java | package com.lhf.exam.service;
import com.lhf.exam.dao.IFoodDao;
import com.lhf.exam.pojo.Food;
import com.lhf.exam.pojo.FoodSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@Scope("prototype")
public class FoodService implements IFoodService {
@Autowired
private IFoodDao iFoodDao;
@Override
public List<FoodSet> getFoodSet(int start, int length) {
List<FoodSet> foodsets = new ArrayList<>();
foodsets = iFoodDao.getFoodSet(start, length);
return foodsets;
}
@Override
public List<FoodSet> getFoodSetAll() {
List<FoodSet> foodsets = new ArrayList<>();
foodsets = iFoodDao.getFoodSetAll();
return foodsets;
}
@Override
public List<Food> getFoodAll() {
List<Food> foods = new ArrayList<>();
foods = iFoodDao.getFoodAll();
return foods;
}
@Override
public List<Food> getFood(int start, int length) {
List<Food> foods = new ArrayList<>();
foods = iFoodDao.getFood(start, length);
return foods;
}
@Override
public Food getFoodById(int foodId) {
Food food = new Food();
food = iFoodDao.getFoodById(foodId);
return food;
}
@Override
public boolean updateFoodSet(String oldset, String newset) {
Boolean flag = false;
flag = iFoodDao.updateFoodSet(oldset, newset);
return flag;
}
@Override
public boolean insertFoodSet(String name) {
Boolean flag = false;
flag = iFoodDao.insertFoodSet(name);
return flag;
}
@Override
public boolean insertFood(Food food) {
Boolean flag = false;
flag = iFoodDao.insertFood(food);
return flag;
}
@Override
public boolean updateFood(Food food) {
Boolean flag = false;
flag = iFoodDao.updateFood(food);
return flag;
}
@Override
public boolean deleteFood(int foodId) {
Boolean flag = false;
flag = iFoodDao.deleteFood(foodId);
return flag;
}
@Override
public boolean deleteFoodByFoodSetId(int foodSetId) {
Boolean flag = false;
flag = iFoodDao.deleteFoodByFoodSetId(foodSetId);
return flag;
}
@Override
public boolean deleteFoodSet(int foodSetId) {
Boolean flag = false;
flag = iFoodDao.deleteFoodSet(foodSetId);
return flag;
}
@Override
public int getCount() {
int flag = 0;
flag = iFoodDao.getCount();
return flag;
}
@Override
public int getFoodSetCount() {
int flag = 0;
flag = iFoodDao.getFoodSetCount();
return flag;
}
}
| [
"824406768@qq.com"
] | 824406768@qq.com |
66aa0008cc052114cfcb4f77ffcc927158641d35 | ebb5358188a449728ccac988c84b088f138432bb | /src/homework10/task4/MyArrayList.java | fa5756b9712916f0c8acbb1d7ed3e9eb1ad3a01a | [] | no_license | MaxParastiuk/EssentialHomeWork | d7123603a3147f9e4a73be38e0bc347f892a3bd1 | bac18386f56df3bfa855d087242e773b3b5727d2 | refs/heads/master | 2023-04-06T00:02:33.573044 | 2021-04-18T14:10:11 | 2021-04-18T14:10:11 | 350,726,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,985 | java | package homework10.task4;
import java.util.Arrays;
import java.util.Iterator;
public class MyArrayList<E> implements List<E> {
public static void main(String[] args) {
List<String> list = new MyArrayList<>();
list.add("Pig");
list.add("Hamster");
list.add("Wolf");
System.out.println(list);
list.set(1, "Dog");
System.out.println(list);
System.out.println(list.get(1));
System.out.println(list.size());
list.remove(1);
System.out.println(list);
}
private E[] values;
public MyArrayList() {
values = (E[]) new Object[0];
}
@Override
public boolean add(E e) {
try {
E[] tmp = values;
values = (E[]) new Object[tmp.length + 1];
System.arraycopy(tmp, 0, values, 0, tmp.length);
values[values.length - 1] = e;
return true;
} catch (ClassCastException ex) {
ex.printStackTrace();
}
return false;
}
@Override
public void remove(int index) {
try {
E[] tmp = values;
values = (E[]) new Object[tmp.length - 1];
System.arraycopy(tmp, 0, values, 0, index);
int amountElemAfterIndex = tmp.length - index - 1;
System.arraycopy(tmp, index + 1, values,index,amountElemAfterIndex );
}catch (ClassCastException ex){
ex.printStackTrace();
}
}
@Override
public E get(int index) {
return values[index];
}
@Override
public int size() {
return values.length;
}
@Override
public void set(int index, E e) {
values[index] = e;
}
@Override
public String toString() {
return "MyArrayList{" +
"values=" + Arrays.toString(values) +
'}';
}
@Override
public Iterator<E> iterator() {
return new ArrayIterator<>(values);
}
}
| [
"parastukm@gmail.com"
] | parastukm@gmail.com |
39e425f3af9125c219161c290d5ecf520a116394 | 187bf185e63ed2f88814bca3ec4ed9df7ea18bd3 | /src/main/java/com/zzn/demo/util/ExportExcelByJson.java | 95cc7264ab9779135cdfb04902ce33898333a8a8 | [] | no_license | wjymo/fengtu-test | 46e7eaad58eb10b4a9f36d2382e015a8b095758e | e2a420eb194b6867c4aa54001a9db70d09590893 | refs/heads/master | 2023-01-23T07:16:54.487968 | 2020-12-09T02:17:23 | 2020-12-09T02:17:23 | 319,816,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,766 | java | package com.zzn.demo.util;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
public class ExportExcelByJson {
private static Logger log = LoggerFactory.getLogger(ExportExcelByJson.class);
/**
* 工作薄对象
*/
public SXSSFWorkbook wb;
/**
* 工作表对象
*/
private Sheet sheet;
/**
* 样式列表
*/
private Map<String, CellStyle> styles;
/**
* 当前行号
*/
private int rownum;
/**
* 注解列表(Object[]{ ExcelField, Field/Method })
*/
List<Object[]> annotationList = Lists.newArrayList();
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param cls 实体对象,通过annotation.ExportField获取标题
*/
public ExportExcelByJson(String title, Class<?> cls){
this(title, cls, 1);
}
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param cls 实体对象,通过annotation.ExportField获取标题
* @param type 导出类型(1:导出模板;2:导出数据)
* @param groups 导入分组
*/
public ExportExcelByJson(String title, Class<?> cls, int type, int... groups){
// Get annotation field
Field[] fs = cls.getDeclaredFields();
for (Field f : fs){
//获取字段上加的@Excel注解
ExcelField ef = f.getAnnotation(ExcelField.class);
if (ef != null && (ef.type()==0 || ef.type()==type)){
//根据字段注解中配置的groups进行分组
if (groups!=null && groups.length>0){
boolean inGroup = false;
for (int g : groups){
if (inGroup){
break;
}
for (int efg : ef.groups()){
if (g == efg){
inGroup = true;
annotationList.add(new Object[]{ef, f});
break;
}
}
}
}else{
//若无group属性,则直接将字段和对应的注解加入到一个全局的注解链表中,用于之后进行统一的排序
annotationList.add(new Object[]{ef, f});
}
}
}
// Get annotation method
Method[] ms = cls.getDeclaredMethods();
for (Method m : ms){
//获取方法上的注解
ExcelField ef = m.getAnnotation(ExcelField.class);
if (ef != null && (ef.type()==0 || ef.type()==type)){
if (groups!=null && groups.length>0){
boolean inGroup = false;
for (int g : groups){
if (inGroup){
break;
}
for (int efg : ef.groups()){
if (g == efg){
inGroup = true;
annotationList.add(new Object[]{ef, m});
break;
}
}
}
}else{
annotationList.add(new Object[]{ef, m});
}
}
}
// 对字段进行排序 Field sorting
Collections.sort(annotationList, new Comparator<Object[]>() {
public int compare(Object[] o1, Object[] o2) {
return new Integer(((ExcelField)o1[0]).sort()).compareTo(
new Integer(((ExcelField)o2[0]).sort()));
};
});
// Initialize
List<String> headerList = Lists.newArrayList();
for (Object[] os : annotationList){
//获取注解title属性值
String t = ((ExcelField)os[0]).title();
// 如果是导出,则去掉注释
if (type==1){
String[] ss = StringUtils.split(t, "**", 2);
if (ss.length==2){
t = ss[0];
}
}
//将字段名称保存在一个list中,交给初始化方法使用
headerList.add(t);
}
initialize(title, headerList);
}
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param headers 表头数组
*/
public ExportExcelByJson(String title, String[] headers) {
initialize(title, Lists.newArrayList(headers));
}
/**
* 构造函数
* @param title 表格标题,传“空值”,表示无标题
* @param headerList 表头列表
*/
public ExportExcelByJson(String title, List<String> headerList) {
initialize(title, headerList);
}
/**
* 初始化函数
* @param title 表格标题,传“空值”,表示无标题
* @param headerList 表头列表
*/
private void initialize(String title, List<String> headerList) {
this.wb = new SXSSFWorkbook(500);
this.sheet = wb.createSheet("Export");
this.styles = createStyles(wb);
// Create title
if (StringUtils.isNotBlank(title)){
Row titleRow = sheet.createRow(rownum++);
titleRow.setHeightInPoints(30);
Cell titleCell = titleRow.createCell(0);
titleCell.setCellStyle(styles.get("title"));
titleCell.setCellValue(title);
sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(),
titleRow.getRowNum(), titleRow.getRowNum(), headerList.size()-1));
}
// Create header
if (headerList == null){
throw new RuntimeException("headerList not null!");
}
Row headerRow = sheet.createRow(rownum++);
headerRow.setHeightInPoints(16);
for (int i = 0; i < headerList.size(); i++) {
Cell cell = headerRow.createCell(i);
cell.setCellStyle(styles.get("header"));
String[] ss = StringUtils.split(headerList.get(i), "**", 2);
if (ss.length==2){
cell.setCellValue(ss[0]);
Comment comment = this.sheet.createDrawingPatriarch().createCellComment(
new XSSFClientAnchor(0, 0, 0, 0, (short) 3, 3, (short) 5, 6));
comment.setString(new XSSFRichTextString(ss[1]));
cell.setCellComment(comment);
}else{
cell.setCellValue(headerList.get(i));
}
//sheet.autoSizeColumn(i);
// 解决自动设置列宽中文失效的问题
sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 2 );
}
for (int i = 0; i < headerList.size(); i++) {
int colWidth = sheet.getColumnWidth(i)*2;
sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth);
}
log.debug("Initialize success.");
}
/**
* 创建表格样式
* @param wb 工作薄对象
* @return 样式列表
*/
private Map<String, CellStyle> createStyles(Workbook wb) {
Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
CellStyle style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
Font titleFont = wb.createFont();
titleFont.setFontName("Arial");
titleFont.setFontHeightInPoints((short) 16);
titleFont.setBold(true);
style.setFont(titleFont);
styles.put("title", style);
style = wb.createCellStyle();
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
Font dataFont = wb.createFont();
dataFont.setFontName("Arial");
dataFont.setFontHeightInPoints((short) 10);
style.setFont(dataFont);
styles.put("data", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.LEFT);
styles.put("data1", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
styles.put("data2", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.RIGHT);
styles.put("data3", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
// style.setWrapText(true);
style.setAlignment(HorizontalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font headerFont = wb.createFont();
headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10);
headerFont.setBold(true);
headerFont.setColor(IndexedColors.WHITE.getIndex());
style.setFont(headerFont);
styles.put("header", style);
return styles;
}
/**
* 添加一行
* @return 行对象
*/
public Row addRow(){
return sheet.createRow(rownum++);
}
/**
* 添加一个单元格
* @param row 添加的行
* @param column 添加列号
* @param val 添加值
* @return 单元格对象
*/
public Cell addCell(Row row, int column, Object val){
return this.addCell(row, column, val, 0, Class.class);
}
/**
* 添加一个单元格
* @param row 添加的行
* @param column 添加列号
* @param val 添加值
* @param align 对齐方式(1:靠左;2:居中;3:靠右)
* @return 单元格对象
*/
public Cell addCell(Row row, int column, Object val, int align, Class<?> fieldType){
Cell cell = row.createCell(column);
CellStyle style = styles.get("data"+(align>=1&&align<=3?align:""));
try {
if (val == null){
cell.setCellValue("");
} else if (val instanceof String) {
cell.setCellValue((String) val);
} else if (val instanceof Integer) {
cell.setCellValue((Integer) val);
} else if (val instanceof Long) {
cell.setCellValue((Long) val);
} else if (val instanceof Double) {
cell.setCellValue((Double) val);
} else if (val instanceof Float) {
cell.setCellValue((Float) val);
} else if (val instanceof Date) {
DataFormat format = wb.createDataFormat();
style.setDataFormat(format.getFormat("yyyy-MM-dd"));
cell.setCellValue((Date) val);
} else {
if (fieldType != Class.class){
cell.setCellValue((String)fieldType.getMethod("setValue", Object.class).invoke(null, val));
}else{
cell.setCellValue((String)Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
"fieldtype."+val.getClass().getSimpleName()+"Type")).getMethod("setValue", Object.class).invoke(null, val));
}
}
} catch (Exception ex) {
log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
cell.setCellValue(val.toString());
}
cell.setCellStyle(style);
return cell;
}
/**
* 添加数据(通过annotation.ExportField添加数据)
* @return list 数据列表
*/
public ExportExcelByJson setDataJsonList(List<JSONObject> list){
for (JSONObject e : list){
int colunm = 0;
Row row = this.addRow();
StringBuilder sb = new StringBuilder();
for (Object[] os : annotationList){
ExcelField ef = (ExcelField)os[0];
Object val = null;
// Get entity value
try{
if (StringUtils.isNotBlank(ef.value())){
// val = Reflections.invokeGetter(e, ef.value());
val=e.get(ef.value());
}else{
if (os[1] instanceof Field){
// val = Reflections.invokeGetter(e, ((Field)os[1]).getName());
val=e.get(((Field)os[1]).getName());
}else if (os[1] instanceof Method){
val = Reflections.invokeMethod(e, ((Method)os[1]).getName(), new Class[] {}, new Object[] {});
}
}
}catch(Exception ex) {
// Failure to ignore
log.info(ex.toString());
val = "";
}
this.addCell(row, colunm++, val, ef.align(), ef.fieldType());
sb.append(val + ", ");
}
log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
}
return this;
}
/**
* 输出数据流
* @param os 输出数据流
*/
public ExportExcelByJson write(OutputStream os) throws IOException{
wb.write(os);
return this;
}
/**
* 输出到客户端
* @param fileName 输出文件名
*/
public ExportExcelByJson write(HttpServletResponse response, String fileName) throws IOException{
response.reset();
response.setContentType("application/octet-stream; charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename="+Encodes.urlEncode(fileName));
write(response.getOutputStream());
return this;
}
/**
* 输出到流
* @param fileName 输出文件名
*/
public ExportExcelByJson write2stream(OutputStream outputStream, String fileName) throws IOException{
// response.reset();
// response.setContentType("application/octet-stream; charset=utf-8");
// response.setHeader("Content-Disposition", "attachment; filename="+Encodes.urlEncode(fileName));
write(outputStream);
return this;
}
/**
* 输出到文件
* @param name 输出文件名
*/
public ExportExcelByJson writeFile(String name) throws FileNotFoundException, IOException{
FileOutputStream os = new FileOutputStream(name);
this.write(os);
return this;
}
/**
* 清理临时文件
*/
public ExportExcelByJson dispose(){
wb.dispose();
return this;
}
// /**
// * 导出测试
// */
// public static void main(String[] args) throws Throwable {
//
// List<String> headerList = Lists.newArrayList();
// for (int i = 1; i <= 10; i++) {
// headerList.add("表头"+i);
// }
//
// List<String> dataRowList = Lists.newArrayList();
// for (int i = 1; i <= headerList.size(); i++) {
// dataRowList.add("数据"+i);
// }
//
// List<List<String>> dataList = Lists.newArrayList();
// for (int i = 1; i <=1000000; i++) {
// dataList.add(dataRowList);
// }
//
// ExportExcel ee = new ExportExcel("表格标题", headerList);
//
// for (int i = 0; i < dataList.size(); i++) {
// Row row = ee.addRow();
// for (int j = 0; j < dataList.get(i).size(); j++) {
// ee.addCell(row, j, dataList.get(i).get(j));
// }
// }
//
// ee.writeFile("target/export.xlsx");
//
// ee.dispose();
//
// log.debug("Export success.");
// }
}
| [
"80005542@sfmail.sf-express.com"
] | 80005542@sfmail.sf-express.com |
857a6ce0983e71dad12c38ccba503c9626a90fa5 | bc0726b0ec083823d54dd442ea2b70be2d23bc61 | /src/util/LogUtil.java | 676a917b80ca6dc19dc45823149a865eb705a15c | [] | no_license | yutian1993/CodeSnakeMagic | 84de30113dda3170d2543dff5323e0ca36a0e34c | a3bc1bf3e78e465a14260877e08b9d68d09ec6cb | refs/heads/master | 2020-12-23T22:56:25.493913 | 2017-05-27T03:42:58 | 2017-05-27T03:42:58 | 92,567,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package util;
import a.j.k.a.P;
/**
* Created by yutian on 2017/5/13.
*/
public class LogUtil {
//Log信息级别设置
private static final boolean G_INFOR = false;
private static final boolean G_ERROR = false;
/**
* 输出日志信息
* @param info
*/
public static void infor(String info) {
if (G_INFOR) {
System.out.println(info);
}
}
/**
* 输出日志信息
* @param tag
* @param info
*/
public static void infor(String tag, String info) {
if (G_INFOR) {
System.out.println(tag + " " + info);
}
}
/**
* 输出错误日志信息
* @param tag
* @param err
*/
public static void error(String tag, String err) {
if (G_ERROR) {
System.err.println(tag + " " + err);
}
}
/**
* 输出错误日志信息
* @param err
*/
public static void error(String err) {
if (G_ERROR) {
System.err.println(err);
}
}
}
| [
"wuwenchuan1993@gmail.com"
] | wuwenchuan1993@gmail.com |
2e9882268938d16d259dd7673edc7e7d10775f4a | 355e95c8df28828d47d6ce66b07691911c82a297 | /ViewModel/src/test/java/com/duke/viewmodel/ExampleUnitTest.java | 5bf80e9e449afb4874cb6047ce4144fba4d0b7ab | [] | no_license | mengzhinan/Lifecycle_LiveData_ViewModel_demo | 2dd21bfcc86870ff1b01afbee69dcc2324fb2aa0 | 63e1f72f23af43706ef919b25c78aa73ad2a107e | refs/heads/master | 2020-07-03T00:56:38.896969 | 2019-08-12T15:38:57 | 2019-08-12T15:38:57 | 201,732,434 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.duke.viewmodel;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"136239173@qq.com"
] | 136239173@qq.com |
52f8b9b1dd1cd30da201227f26d5212f309f8254 | 4b3071a4d34c79ed56a1638c5d101f25fe2396d9 | /qa.qanary_component-Earl-RelationLinking/src/main/java/eu/wdaqua/qanary/earlrel/EarlRelationLinking.java | 00331478a8f58f387f0d36ccdcfe641ad2d719d6 | [
"MIT"
] | permissive | kunwar-abhinav-aditya/qanary_qa | 31ccf38e88bbcbb870e90cd2c104c7c418397bb4 | b22c8bde453fe4ccf1972ddb032e48c5a4a9a9b7 | refs/heads/master | 2020-03-28T18:55:22.721640 | 2018-11-04T23:28:00 | 2018-11-04T23:28:00 | 148,916,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,770 | java | package eu.wdaqua.qanary.earlrel;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import eu.wdaqua.qanary.commons.QanaryMessage;
import eu.wdaqua.qanary.commons.QanaryQuestion;
import eu.wdaqua.qanary.commons.QanaryUtils;
import eu.wdaqua.qanary.component.QanaryComponent;
@Component
/**
* This component connected automatically to the Qanary pipeline.
* The Qanary pipeline endpoint defined in application.properties (spring.boot.admin.url)
* @see <a href="https://github.com/WDAqua/Qanary/wiki/How-do-I-integrate-a-new-component-in-Qanary%3F" target="_top">Github wiki howto</a>
*/
public class EarlRelationLinking extends QanaryComponent {
private static final Logger logger = LoggerFactory.getLogger(EarlRelationLinking.class);
/**
* implement this method encapsulating the functionality of your Qanary
* component
*/
@Override
public QanaryMessage process(QanaryMessage myQanaryMessage) throws Exception{
logger.info("process: {}", myQanaryMessage);
// TODO: implement processing of question
QanaryUtils myQanaryUtils = this.getUtils(myQanaryMessage);
QanaryQuestion<String> myQanaryQuestion = new QanaryQuestion(myQanaryMessage);
String myQuestion = myQanaryQuestion.getTextualRepresentation();
//String myQuestion = "Who is the president of Russia?";
ArrayList<Selection> selections = new ArrayList<Selection>();
logger.info("Question {}", myQuestion);
String thePath = URLEncoder.encode(myQuestion, "UTF-8");
logger.info("thePath {}", thePath);
JSONObject msg = new JSONObject();
msg.put("nlquery", myQuestion);
String jsonThePath = msg.toString();
try {
String[] entityLinkCmd = { "curl", "-XPOST", "http://sda.tech/earl/api/processQuery", "-H",
"Content-Type: application/json", "-d", jsonThePath };
// logger.info("EntityLinkCmd: {}",Arrays.toString(entityLinkCmd));
ProcessBuilder processEL = new ProcessBuilder(entityLinkCmd);
// logger.info("ProcessEL: {}", processEL.command());
Process pEL = processEL.start();
// logger.error("Process PEL: {}", IOUtils.toString(pEL.getErrorStream()));
InputStream instreamEL = pEL.getInputStream();
String textEL = IOUtils.toString(instreamEL, StandardCharsets.UTF_8.name());
JSONObject response = new JSONObject(textEL);
JSONObject lists = response.getJSONObject("rerankedlists");
//System.out.println(lists);
JSONArray chunks = response.getJSONArray("chunktext");
//System.out.println(chunks +"\n" + lists);
for (int i = 0; i < chunks.length(); i++) {
JSONObject ja = chunks.getJSONObject(i);
String str = ja.getString("class").toLowerCase();
if(str.equals("relation")) {
Selection s = new Selection();
int start = ja.getInt("surfacestart");
int end = start + ja.getInt("surfacelength") - 1;
String link = lists.getJSONArray(i+"").getJSONArray(0).getString(1);
s.begin = start;
s.end = end;
s.link = link;
System.out.println(start+" "+end+" "+link);
selections.add(s);
}
}
}
catch (JSONException e) {
logger.error("Except: {}", e);
}
catch (IOException e) {
logger.error("Except: {}", e);
// TODO Auto-generated catch block
}
catch (Exception e) {
logger.error("Except: {}", e);
// TODO Auto-generated catch block
}
for (Selection s : selections) {
String sparql = "PREFIX qa: <http://www.wdaqua.eu/qa#> " //
+ "PREFIX oa: <http://www.w3.org/ns/openannotation/core/> " //
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " //
+ "INSERT { " + "GRAPH <" + myQanaryQuestion.getOutGraph() + "> { " //
+ " ?a a qa:AnnotationOfRelation . " //
+ " ?a oa:hasTarget [ " //
+ " a oa:SpecificResource; " //
+ " oa:hasSource <" + myQanaryQuestion.getUri() + ">; " //
+ " oa:hasSelector [ " //
+ " a oa:TextPositionSelector ; " //
+ " oa:start \"" + s.begin + "\"^^xsd:nonNegativeInteger ; " //
+ " oa:end \"" + s.end + "\"^^xsd:nonNegativeInteger " //
+ " ] " //
+ " ] . " //
+ " ?a oa:hasBody <" + s.link + "> ;" //
+ " oa:annotatedBy <http://earlrelationlinker.com> ; " //
+ " oa:AnnotatedAt ?time " + "}} " //
+ "WHERE { " //
+ " BIND (IRI(str(RAND())) AS ?a) ."//
+ " BIND (now() as ?time) " //
+ "}";
logger.debug("Sparql query: {}", sparql);
myQanaryUtils.updateTripleStore(sparql);
}
logger.info("store data in graph {}", myQanaryMessage.getValues().get(myQanaryMessage.getEndpoint()));
// TODO: insert data in QanaryMessage.outgraph
logger.info("apply vocabulary alignment on outgraph");
// TODO: implement this (custom for every component)
return myQanaryMessage;
}
class Selection {
public int begin;
public int end;
public String link;
}
}
| [
"kunwar.abhinav.aditya@gmail.com"
] | kunwar.abhinav.aditya@gmail.com |
1cb475f288a29f6ff7112b2b0a4278c41fc0b7db | d93504a04f3759cfe04bf5eccc6bf3e91c62943f | /src/main/java/com/progmasters/blog/service/CommentService.java | 07b079c7b45616c7937b333eaa4c68969d11e879 | [] | no_license | Cskr5/simple-blog | c870373e0a7b05c2137205a420aa3486ee327932 | e367f0df4a8c6efde9438d18b7da7c75a8978474 | refs/heads/master | 2023-01-08T17:38:02.263193 | 2020-08-24T17:46:24 | 2020-08-24T17:46:24 | 311,722,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package com.progmasters.blog.service;
import com.progmasters.blog.domain.Comment;
import com.progmasters.blog.domain.Post;
import com.progmasters.blog.dto.CommentDetailsItem;
import com.progmasters.blog.dto.PostDetailsItem;
import com.progmasters.blog.repository.CommentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class CommentService {
private CommentRepository commentRepository;
private PostService postService;
@Autowired
public CommentService(CommentRepository commentRepository, PostService postService) {
this.commentRepository = commentRepository;
this.postService = postService;
}
public void createComment(CommentDetailsItem commentDetailsItem, Long postId) {
Post post = postService.getPost(postId);
Comment comment = new Comment(commentDetailsItem,post);
commentRepository.save(comment);
}
}
| [
"kristof.csef@gmail.com"
] | kristof.csef@gmail.com |
28ea59dd028f7340d6c17908b01d1bed5c713c90 | b69a4d5380dd199685ad168d37953041a5ea2f05 | /src/main/java/xyz/n7mn/dev/neta/sand/sand/SandCommand.java | a2f71303f2a659cf7d76874fa316aa6423d80c2c | [] | no_license | YululiServer/Sand | 4322a13ae2f9d65ea28142e453e9495c07ce7058 | 8e5f37fb9d6dfa5d1d08094dab6c6d021585edc8 | refs/heads/master | 2022-12-17T23:53:29.900833 | 2020-09-09T10:25:58 | 2020-09-09T10:25:58 | 294,078,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package xyz.n7mn.dev.neta.sand.sand;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Random;
public class SandCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player){
Player player = (Player) sender;
int i = new Random().nextInt(18);
if (i == 8 || i == 11){
ItemStack itemStack = new ItemStack(Material.GRAVEL);
player.getInventory().addItem(itemStack);
} else {
ItemStack itemStack = new ItemStack(Material.SAND);
player.getInventory().addItem(itemStack);
}
}
return true;
}
}
| [
"kassi_0123@kassi-hp.info"
] | kassi_0123@kassi-hp.info |
fa58f2d774bb67259890746cb07673e76b9f89c8 | 643776ac89d193a699e5cf7eef1f7f2d69bc68f2 | /src/com/itgodfan/action/AddCartAgainAction.java | 534b528b120077552d2679b771350615ca347c04 | [] | no_license | GodFaan/lottery-ssh-last | 79f0c44a3ae9807619b9bfbbe70298641568cccf | 44a8f97c070890c717d8db6bd56f1572f52c9063 | refs/heads/master | 2020-06-12T04:35:29.891905 | 2019-07-14T02:39:25 | 2019-07-14T02:39:25 | 194,195,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,738 | java | package com.itgodfan.action;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.apache.struts2.ServletActionContext;
import com.itgodfan.bean.LotteryCart;
import com.itgodfan.bean.User;
import com.itgodfan.service.LotteryCartService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
/**
* @Description:从历史记录中追号,再次添加到购物车
* @author: GodFan
* @date: 2019年6月10日
*/
public class AddCartAgainAction extends ActionSupport {
User user;
LotteryCartService lotteryCartService;
LotteryCart lotteryCart;
public void setUser(User user) {
this.user = user;
}
public void setLotteryCartService(LotteryCartService lotteryCartService) {
this.lotteryCartService = lotteryCartService;
}
public void setLotteryCart(LotteryCart lotteryCart) {
this.lotteryCart = lotteryCart;
}
public String cart() {
System.out.println("ke yihui xian ke ");
Date adate = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
lotteryCart.setAdate(df.format(adate));
User user = (User) ActionContext.getContext().getSession().get("user");
lotteryCart.setNumber(ServletActionContext.getRequest().getParameter("history.number"));
lotteryCart.setUsername(user.getName());
int price = 2;
lotteryCart.setPrice(price);
int num = 1;
lotteryCart.setCount(num);
int sum = price * num;
lotteryCart.setSum(sum);
lotteryCartService.add(lotteryCart);
List<LotteryCart> list = lotteryCartService.findAll(user.getName());
ServletActionContext.getRequest().setAttribute("cartlist", list);//回显到购物车页面
System.out.println("ke yihui xian ke ");
return SUCCESS;
}
}
| [
"2290085034@qq.com"
] | 2290085034@qq.com |
80fe599590e5239ae65f932c903bdff91e1491ed | 936d570ad113e32154d60c554292779bb4d42075 | /ux-service/course/src/main/java/com/ux/controller/CourseController.java | a89d798cfdfd4b7a59a673f89850a27870966904 | [] | no_license | Hahahahx/firstSpringCloud | 64d247f2db915c6c76b6e48fa5ef8a97a0528829 | f7aea8714f06ee3312b2110e484012d0d7b99c35 | refs/heads/master | 2022-11-12T06:12:39.670093 | 2020-06-29T08:44:44 | 2020-06-29T08:44:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package com.ux.controller;
import com.alibaba.fastjson.JSON;
import com.ux.CourseInfo;
import com.ux.CourseInfosRequest;
import com.ux.service.CourseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 课程对外服务接口
* @Author: ux
* @CreateDate: 2020/6/10 11:08
*/
@Slf4j
@RestController
public class CourseController {
@Resource
private CourseService service;
/**
* 获取课程
*
* 如果不通过网关访问则,127.0.0.1:7001/ux-course/get/course?id=
* (应该用)网关访问方式, 127.0.0.1:9000/xh/ux-course/get/course?id=
* @param id
* @return
*/
@GetMapping("/get/course")
public CourseInfo getCourseInfo(Long id){
log.info("/ux-course:get course -> {}",id);
return service.getCourseInfo(id);
}
@PostMapping("/get/courses")
public List<CourseInfo> getCourseInfos(
@RequestBody CourseInfosRequest request
){
log.info("/ux-course:get courses -> {}", JSON.toJSONString(request));
return service.getCourseInfos(request);
}
}
| [
"45379017+Hahahahx@users.noreply.github.com"
] | 45379017+Hahahahx@users.noreply.github.com |
daff4b2ad028c8efa39b3149ecd8360fd9f36552 | 7e02f58d78bb10bf96c7dd383ef4072cecf03287 | /leopard-test/src/test/java/io/leopard/test/mock/stubbing/AssertMethodHandlerTest.java | 287c96a950960c663fca8f2d4a9052f6d87535d5 | [] | no_license | iopass4/leopard | 849ec2a6af47a6deacf17d76c835ef51dd38af72 | 304f002ebfc89a0bda26ebe33ce6959f9ead8d2f | refs/heads/master | 2021-01-17T08:18:30.956585 | 2015-02-24T06:54:18 | 2015-02-24T06:54:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package io.leopard.test.mock.stubbing;
import java.lang.reflect.Method;
import org.junit.Assert;
import org.junit.Test;
public class AssertMethodHandlerTest {
public static class MethodHandlerImpl extends AssertMethodHandler {
@Override
public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
return null;
}
}
@Test
public void setMock() {
MethodHandlerImpl methodHandler = new MethodHandlerImpl();
methodHandler.setMock("str");
Assert.assertNotNull(methodHandler.getMock());
}
} | [
"tanhaichao@gmail.com"
] | tanhaichao@gmail.com |
8ceed345b537790ff1a353703a0bcc4fdfe06edb | 0185f1f5711c15922cdf4701aaa0c3583dc92bea | /src/test/java/com/shez/test/config/WebConfigurerTestController.java | 5e241cb07bc9fabbe01abfcc033f05ccff869292 | [] | no_license | shehzad-d/jhip-test1 | c0f12ce369d2463701a60e58d1c882d1d6050328 | b54254d99cbcd9d1481f56bc2e6afb845a6abf09 | refs/heads/master | 2021-05-26T05:49:50.810900 | 2018-04-02T10:17:12 | 2018-04-02T10:17:12 | 127,735,896 | 0 | 1 | null | 2020-09-18T11:54:50 | 2018-04-02T09:38:16 | Java | UTF-8 | Java | false | false | 376 | java | package com.shez.test.config;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class WebConfigurerTestController {
@GetMapping("/api/test-cors")
public void testCorsOnApiPath() {
}
@GetMapping("/test/test-cors")
public void testCorsOnOtherPath() {
}
}
| [
"shehzad.ditta@gmail.com"
] | shehzad.ditta@gmail.com |
6fb58b8881f1ce1c6f3e43640aeffcf62e53c7ef | ca992e8df8bdb3a75b02284f8fca8db5a0a64311 | /bos_management/src/main/java/cn/itcast/bos/dao/PermissionRepository.java | d3081b50b79192de3618989ed5303167c8b32c00 | [] | no_license | chenxup/bos | d992e6b2aa2ade9cf24279f36c4174df06cb7726 | c0a81b746b902f5db66add91029956279b2670e0 | refs/heads/master | 2021-07-08T14:27:26.032566 | 2017-10-06T08:33:04 | 2017-10-06T08:33:04 | 103,370,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 575 | java | package cn.itcast.bos.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import cn.itcast.bos.domain.system.Permission;
public interface PermissionRepository extends JpaRepository<Permission,Integer>,JpaSpecificationExecutor<Permission> {
@Query("select distinct p from Permission p inner join p.roles r inner join r.users u where u.id=?")
List<Permission> findByUser(Integer id);
}
| [
"123"
] | 123 |
13bb1f0255c7ba4894e87ce232ee508048d15940 | 8f0f57aa5d7a94a2f1699d14f6411c30db06a413 | /src/main/java/org/csu/fastfish/persistence/OrderMapper.java | c18a65969a9376a410f9956027749e1721c3b80e | [] | no_license | HK-IWTR/FastFish | cbdc9cfda18e34ca6f90b5930803bf817f4c68d8 | 848d483aaa99d194aa7a3161997c7234b4c4c468 | refs/heads/master | 2022-04-23T17:13:15.503277 | 2020-04-21T06:24:36 | 2020-04-21T06:24:36 | 254,647,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package org.csu.fastfish.persistence;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.csu.fastfish.domain.Order;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface OrderMapper {
@Select("select * from orders where username = #{username} ")
List<Order> getOrdersByUsername(String username);
@Insert("insert into orders (username, nata_name, event_date, event_time, order_time, price, picture) " +
"values (#{username},#{nata_name},#{event_date},#{event_time}, #{order_time}, #{price}, #{picture}) ")
void insertOrder(Order order);
@Delete("delete from orders where id = #{orderId}")
void cancelOrderById(int orderId);
}
| [
"1433612902@qq.com"
] | 1433612902@qq.com |
59478038966bc5ab0001edfba3475578cf23593d | 8679c1b269edb868415211667911b01ee087c82b | /src/main/java/be/jcrafters/pastebin/DumpRecogniser.java | 43a1c33d47a33efa2ec05eb61d0d46100b4dc851 | [] | no_license | YThibos/code-with-quarkus | 16c1ba1586bbbb4081e180f0fcd3962ea228bb95 | 4c71ace228ccbaf15abc635a5b19c60e92aa8542 | refs/heads/master | 2023-07-13T09:49:23.420653 | 2021-08-31T11:43:29 | 2021-08-31T11:43:29 | 394,668,045 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package be.jcrafters.pastebin;
import javax.enterprise.context.RequestScoped;
@RequestScoped
public class DumpRecogniser {
public Dump handle(String stringDump) {
return new Dump(stringDump);
}
}
| [
"yannick.thibos@gmail.com"
] | yannick.thibos@gmail.com |
9c578afa42c01fd38a71c1a599407cf99789f67d | 42cacab1520c74d393c9b159484853e2cbf29fdd | /src/main/java/com/devglan/model/InternalEntity/Constants.java | 7248d237888c88ed82114a65e4f05c5484616283 | [] | no_license | kelvinlocc/spring-boot-jwt-auth | a7ed13903c07c022375b7588bf196554741aa564 | 8a5e8412e21181010ff45740ec85eabd7a3344cf | refs/heads/master | 2020-03-21T05:52:04.407916 | 2018-07-03T10:25:59 | 2018-07-03T10:25:59 | 138,185,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.devglan.model.InternalEntity;
public class Constants {
public static final long ACCESS_TOKEN_VALIDITY_SECONDS = 60*60*60;
public static final String SIGNING_KEY = "devglan123r";
public static final String TOKEN_PREFIX = "Bearer ";
public static final String HEADER_STRING = "Authorization";
}
| [
"ccloadust@gmail.com"
] | ccloadust@gmail.com |
d6ff92e3f2cf80329c340952f2e06c2091d0739e | 27548bfd4f26f5d8b458b50e2914563d5ab99374 | /src/codegen/org.ect.codegen.reo2constraints/src/org/ect/codegen/reo2constraints/generator/ElementConverter.java | 803006e6ca3d909fda0f67ec97106c82c44bd4c1 | [] | no_license | behnaaz/extensible-coordination-tools | bafa0b2ba810bf6a9ac5478133330b430993c753 | 16d447a241ad87096d45f657b8efb832f133414a | refs/heads/master | 2021-01-17T04:45:53.202800 | 2016-05-20T14:55:53 | 2016-05-20T14:55:53 | 39,437,821 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,788 | java | /*******************************************************************************
* <copyright>
* This file is part of the Extensible Coordination Tools (ECT).
* Copyright (c) 2013 ECT developers.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* </copyright>
*******************************************************************************/
package org.ect.codegen.reo2constraints.generator;
import org.ect.codegen.reo2constraints.visitor.ContextVisitor;
import org.ect.codegen.reo2constraints.visitor.DataConstraintVisitor;
import org.ect.codegen.reo2constraints.visitor.PriorityVisitor;
import org.ect.codegen.reo2constraints.visitor.SyncVisitor;
import org.ect.reo.*;
import org.ect.reo.channels.*;
import org.ect.reo.components.*;
import org.ect.reo.semantics.ReoScope;
import org.ect.reo.util.PrimitiveEndNames;
public class ElementConverter {
private SyncVisitor syncVisitor = null;
private ContextVisitor cntxVisitor = null;
public ContextVisitor getCntxVisitor() {
return cntxVisitor;
}
private DataConstraintVisitor dataVisitor = null;
private PriorityVisitor pritVisitor = null;
private StateManager statemgr;
private Preprocessing info = null;
public ElementConverter(Preprocessing info, StateManager statemgr) {
this.info = info;
this.statemgr = statemgr;
initialize();
}
public ElementConverter(PrimitiveEndNames names) {
// TODO Auto-generated constructor stub
}
public void setScope(ReoScope element) {
// TODO Auto-generated method stub
}
public Process convert(Connectable element, String name) {
// TODO Auto-generated method stub
return null;
}
private void initialize(){
if (info.isContextSensitive())
cntxVisitor = new ContextVisitor(statemgr, info);
else
syncVisitor = new SyncVisitor(statemgr, info);
if (info.isDataSensitive())
dataVisitor = new DataConstraintVisitor(statemgr, info);
if (info.isPrioritySensitive())
pritVisitor = new PriorityVisitor(info, this);
}
public Constraint generateConstraints(Node n) {
Constraint semantics = new Constraint();
if (n.getName() == null) {
System.out.println("***WARNING! " + n + " has no name!");
}
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit(n));
}else{
String cnf = syncVisitor.visit(n);
semantics.setSyncCons(cnf);
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit(n));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit(n));
}
if (info.isTimeSensitive()){
}
return semantics;
}
public Constraint generateConstraints(Primitive p) {
Constraint semantics = new Constraint();
if (p.getName() == null) {
System.out.println("***WARNING! " + p + " has no name!");
}
if (p instanceof Sync){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((Sync) p));
}else{
semantics.setSyncCons(syncVisitor.visit((Sync) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((Sync) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((Sync) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof SyncDrain){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((SyncDrain) p));
}else{
semantics.setSyncCons(syncVisitor.visit((SyncDrain) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((SyncDrain) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((SyncDrain) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof LossySync){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((LossySync) p));
}else{
semantics.setSyncCons(syncVisitor.visit((LossySync) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((LossySync) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((LossySync) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof Writer){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((Writer) p));
}else{
semantics.setSyncCons(syncVisitor.visit((Writer) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((Writer) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((Writer) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof Reader){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((Reader) p));
}else{
semantics.setSyncCons(syncVisitor.visit((Reader) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((Reader) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((Reader) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof FIFO) {
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((FIFO) p));
}else{
semantics.setSyncCons(syncVisitor.visit((FIFO) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((FIFO) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((FIFO) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof Filter){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((Filter) p));
}else{
semantics.setSyncCons(syncVisitor.visit((Filter) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((Filter) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((Filter) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof SyncSpout){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((SyncSpout) p));
}else{
semantics.setSyncCons(syncVisitor.visit((SyncSpout) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((SyncSpout) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((SyncSpout) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof AsyncDrain){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((AsyncDrain) p));
}else{
semantics.setSyncCons(syncVisitor.visit((AsyncDrain) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((AsyncDrain) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((AsyncDrain) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof AsyncSpout){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((AsyncSpout) p));
}else{
semantics.setSyncCons(syncVisitor.visit((AsyncSpout) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((AsyncSpout) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((AsyncSpout) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof Timer){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((Timer) p));
}else{
semantics.setSyncCons(syncVisitor.visit((Timer) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((Timer) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((Timer) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof PrioritySync){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((PrioritySync) p));
}else{
semantics.setSyncCons(syncVisitor.visit((PrioritySync) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((PrioritySync) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((PrioritySync) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof BlockingSync){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((BlockingSync) p));
}else{
semantics.setSyncCons(syncVisitor.visit((BlockingSync) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((BlockingSync) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((BlockingSync) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof BlockingSinkSync){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((BlockingSinkSync) p));
}else{
semantics.setSyncCons(syncVisitor.visit((BlockingSinkSync) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((BlockingSinkSync) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((BlockingSinkSync) p));
}
if (info.isTimeSensitive()){
}
}
else if (p instanceof BlockingSourceSync){
if (info.isContextSensitive()){
semantics.setCntxCons(cntxVisitor.visit((BlockingSourceSync) p));
}else{
semantics.setSyncCons(syncVisitor.visit((BlockingSourceSync) p));
}
if (info.isDataSensitive()){
semantics.setDataCons(dataVisitor.visit((BlockingSourceSync) p));
}
if (info.isPrioritySensitive()){
semantics.setPrioCons(pritVisitor.visit((BlockingSourceSync) p));
}
if (info.isTimeSensitive()){
}
}
return semantics;
}
}
| [
"henshin.ck@gmail.com"
] | henshin.ck@gmail.com |
296b0815253eae7e5a2e8b8c7abb2a5f169e5c30 | 3d440936f2f6e634dde63f0c72443e9236701a2b | /src/main/java/com/bardab/budgettracker/dao/categories/PlannedExpensesDao.java | 0102c66f7830f03639a1b7456aa7ef5ca36c3d68 | [] | no_license | BarDab/BudgetTracker | 311b7c0d392166c8c12963069d78e8dd7ed05c10 | d6e0439eb20a366f48d808d63585ffdcf9fb1d36 | refs/heads/master | 2022-06-21T16:27:18.280174 | 2021-01-18T20:05:18 | 2021-01-18T20:05:18 | 249,461,173 | 0 | 0 | null | 2022-02-10T03:34:17 | 2020-03-23T14:57:31 | Java | UTF-8 | Java | false | false | 3,227 | java | package com.bardab.budgettracker.dao.categories;
import com.bardab.budgettracker.dao.AbstractDAO;
import com.bardab.budgettracker.model.BudgetExpenses;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import javax.persistence.Query;
import java.time.YearMonth;
public class PlannedExpensesDao extends AbstractDAO<BudgetExpenses> {
private SessionFactory sessionFactory;
public PlannedExpensesDao(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public BudgetExpenses findByYearMonth(YearMonth yearMonth) {
BudgetExpenses budgetExpenses =null;
Session session=null;
try{
session = getSessionFactory().openSession();
session.beginTransaction();
budgetExpenses = session.bySimpleNaturalId(BudgetExpenses.class).load(yearMonth);
session.getTransaction().commit();
}
catch (Exception e){
if(session.getTransaction()!=null){
logger.info("\n ..........Transaction is being rolled back...........\n");
session.getTransaction().rollback();
}
System.out.println(e.getMessage());
}
finally {
if (session != null) {
session.close();
}
}
return budgetExpenses;
}
@Override
public SessionFactory getSessionFactory() {
return this.sessionFactory;
}
@Override
public BudgetExpenses findByID(long id) {
BudgetExpenses budgetExpenses =null;
Session session=null;
try{
session = getSessionFactory().openSession();
session.beginTransaction();
budgetExpenses = session.get(BudgetExpenses.class,id);
session.getTransaction().commit();
}
catch (Exception e){
if(session.getTransaction()!=null){
logger.info("\n ..........Transaction is being rolled back...........\n");
session.getTransaction().rollback();
}
System.out.println(e.getMessage());
}
finally {
if (session != null) {
session.close();
}
}
return budgetExpenses;
}
public BudgetExpenses getLastFixedCostsRecord(){
BudgetExpenses budgetExpenses =null;
Session session=null;
try{
session = getSessionFactory().openSession();
session.beginTransaction();
Query query = session.createQuery("from PlannedExpenses order by budget_ID desc");
query.setMaxResults(1);
budgetExpenses = (BudgetExpenses) query.getSingleResult();
session.getTransaction().commit();
}
catch (Exception e){
if(session.getTransaction()!=null){
logger.info("\n ..........Transaction is being rolled back...........\n");
session.getTransaction().rollback();
}
System.out.println(e.getMessage());
}
finally {
if (session != null) {
session.close();
}
}
return budgetExpenses;
}
}
| [
"barpl7@gmail.com"
] | barpl7@gmail.com |
d8268428c49e4d5f1cef3303a4aa588c34a27d1e | d5515553d071bdca27d5d095776c0e58beeb4a9a | /src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java | d23c3179355c1d8adc88271fa762e8ef5098b45c | [] | no_license | ccamel/plantuml | 29dfda0414a3dbecc43696b63d4dadb821719489 | 3100d49b54ee8e98537051e071915e2060fe0b8e | refs/heads/master | 2022-07-07T12:03:37.351931 | 2016-12-14T21:01:03 | 2016-12-14T21:01:03 | 77,067,872 | 1 | 0 | null | 2022-05-30T09:56:21 | 2016-12-21T16:26:58 | Java | UTF-8 | Java | false | false | 3,813 | java | /* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.activitydiagram3.command;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.Rainbow;
public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
public CommandRepeatWhile3() {
super(getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(//
new RegexLeaf("^"), //
new RegexLeaf("repeat[%s]?while"), //
new RegexLeaf("[%s]*"), //
new RegexOr(//
new RegexConcat(new RegexLeaf("TEST3", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
new RegexLeaf("WHEN3", "\\((.+?)\\)"), //
new RegexLeaf("[%s]*(not)[%s]*"), //
new RegexLeaf("OUT3", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST4", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(not)[%s]*"), //
new RegexLeaf("OUT4", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST2", "\\((.*?)\\)"), //
new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
new RegexLeaf("WHEN2", "\\((.+?)\\)") //
), //
new RegexLeaf("TEST1", "(?:\\((.*)\\))?") //
), //
new RegexLeaf("[%s]*"), //
new RegexOptional(new RegexConcat( //
new RegexOr(//
new RegexLeaf("->"), //
new RegexLeaf("COLOR", CommandArrow3.STYLE_COLORS)), //
new RegexLeaf("[%s]*"), //
new RegexOr(//
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("")) //
)), //
new RegexLeaf(";?$"));
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
final Display test = Display.getWithNewlines(arg.getLazzy("TEST", 0));
final Display yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0));
final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0));
final String colorString = arg.get("COLOR", 0);
final Rainbow rainbow;
if (colorString == null) {
rainbow = Rainbow.none();
} else {
rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam()
.colorArrowSeparationSpace());
}
final Display linkLabel = Display.getWithNewlines(arg.get("LABEL", 0));
return diagram.repeatWhile(test, yes, out, linkLabel, rainbow);
}
}
| [
"plantuml@gmail.com"
] | plantuml@gmail.com |
04222483169c700ec62c94bc38e5a0d79b5e5c7c | 978f8e0107e19dfbb7d71c28b4c745f29da30ae4 | /java文档资料/java/spring/spring/word/全用xml配置的ssh的架构 案例/myShopping/src/cn/wulin/action/AuthorAction.java | 0927951f65d20287faf9df4a174f23c4e8502b79 | [] | no_license | buyaoyongroot/wulin_java_resources_repository | e9eb134fa14b80de32124a911902f737e44cf078 | de2ffc06e4227a7a5e4068243d8e8745865a9e23 | refs/heads/master | 2022-03-08T09:52:24.172318 | 2019-11-15T02:04:05 | 2019-11-15T02:04:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package cn.wulin.action;
import cn.wulin.base.ModelDrivenBaseAction;
import cn.wulin.domain.Author;
public class AuthorAction extends ModelDrivenBaseAction<Author>{
private static final long serialVersionUID = 8170603451090522065L;
public String list() throws Exception {
return null;
}
}
| [
"1178649872@qq.com"
] | 1178649872@qq.com |
7205f690135ea81604b95edf0bbe1be7ee9659db | c1deede8dd493d6773cffeb6df59d298d762736b | /src/main/java/si/test/backend/coding/challenge/service/impl/ActorService.java | 5a3a6d3e7fe35051f32861822469bbdefbe20df7 | [] | no_license | anzeg/DemoApplication | 8f235e99a7ffc5e0e134a84bba25ac7c0fffe186 | d73bf400a28109be460efd31e8584eecd99e1186 | refs/heads/master | 2020-04-23T03:07:57.204250 | 2019-03-06T01:00:12 | 2019-03-06T01:00:12 | 170,869,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,334 | java | package si.test.backend.coding.challenge.service.impl;
import com.kumuluz.ee.rest.beans.QueryParameters;
import com.kumuluz.ee.rest.utils.JPAUtils;
import si.test.backend.coding.challenge.entities.Actors;
import si.test.backend.coding.challenge.entities.Movies;
import si.test.backend.coding.challenge.service.IActorService;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
import java.util.List;
@RequestScoped
public class ActorService implements IActorService {
@PersistenceContext
private EntityManager em;
@Inject
MovieService movieService;
@Override
public Actors getActor(Integer actorId) {
return em.find(Actors.class, actorId);
}
@Override
public List<Actors> getActors(QueryParameters query) {
List<Actors> actors = JPAUtils.queryEntities(em, Actors.class, query);
return actors;
}
@Override
public Long getActorCount(QueryParameters query) {
Long count = JPAUtils.queryEntitiesCount(em, Actors.class, query);
return count;
}
@Override
@Transactional
public void save(Actors actor) {
if (actor != null) {
em.persist(actor);
}
}
@Override
@Transactional
public void delete(Integer actorId) {
Actors Actor = em.find(Actors.class, actorId);
if (Actor != null) {
em.remove(Actor);
}
}
@Override
@Transactional
public void addMovieToActor(Integer actorId, Long imdbId) {
if (actorId != null && imdbId != null) {
Actors existActors = getActor(actorId);
Movies existMovie = movieService.getMovie(imdbId);
if (existActors == null){
throw new RuntimeException("Actor with actorId=" + actorId + " doesn't exist");
} else if(existMovie == null) {
throw new RuntimeException("Movie with imdbId=" + imdbId + " doesn't exist");
}
existActors.getMovies().add(existMovie);
existMovie.getActors().add(existActors);
} else{
throw new RuntimeException("Missing requeired input parameters imdbId=" + imdbId + " or actorId=" + actorId);
}
}
@Override
@Transactional
public void removeMovieFromActor(Integer actorId, Long imdbId) {
if (actorId != null && imdbId != null) {
Actors existActors = getActor(actorId);
Movies existMovie = movieService.getMovie(imdbId);
if (existActors == null){
throw new RuntimeException("Actor with actorId=" + actorId + " doesn't exist");
} else if(existMovie == null) {
throw new RuntimeException("Movie with imdbId=" + imdbId + " doesn't exist");
}
if(existActors.getMovies().contains(existMovie)){
existActors.getMovies().remove(existMovie);
}
if(existMovie.getActors().contains(existActors)){
existMovie.getActors().remove(existActors);
}
} else{
throw new RuntimeException("Missing requeired input parameters imdbId=" + imdbId + " or actorId=" + actorId);
}
}
}
| [
"anze.germovsek@gmail.com"
] | anze.germovsek@gmail.com |
c319da79e0355e605870b99d8017469d5682b0d1 | 1612332a8faf69c58bac371e3c52b9dc344830b1 | /joyqueue-server/joyqueue-broker-core/src/main/java/com/jd/joyqueue/broker/consumer/converter/JoyQueueToInternalMessageConverter.java | 3a682ab607817c6c4a022d7e6b25b3b16ade624a | [
"Apache-2.0"
] | permissive | fengkuok/joyqueue | 83b94d5d6723460bda8e5a0aead9e75f9535a281 | af861ae8f8e809e20b82d6ace50db5eb67ab1bc9 | refs/heads/master | 2020-07-01T16:25:21.987538 | 2019-07-31T07:01:57 | 2019-07-31T07:01:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,648 | java | /**
* 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.jd.joyqueue.broker.consumer.converter;
import com.jd.joyqueue.message.BrokerMessage;
import com.jd.joyqueue.message.Message;
import com.jd.joyqueue.message.SourceType;
import com.jd.joyqueue.network.serializer.BatchMessageSerializer;
import java.util.List;
/**
* JoyQueueToInternalMessageConverter
* author: gaohaoxiang
* email: gaohaoxiang@jd.com
* date: 2019/4/24
*/
public class JoyQueueToInternalMessageConverter extends AbstractInternalMessageConverter {
@Override
public BrokerMessage convert(BrokerMessage message) {
if (!message.isCompressed() || Message.CompressionType.ZLIB.equals(message.getCompressionType())) {
return message;
}
message.setBody(message.getDecompressedBody());
return message;
}
@Override
public List<BrokerMessage> convertBatch(BrokerMessage message) {
message.setBody(message.getDecompressedBody());
return BatchMessageSerializer.deserialize(message);
}
@Override
public Byte type() {
return SourceType.JOYQUEUE.getValue();
}
} | [
"gaohaoxiang@jd.com"
] | gaohaoxiang@jd.com |
151cf1b10b0575a92aab2357352566cb030880cd | 53415369c65f70ec4742e9f62e6b395007b1bc5c | /src/main/java/com/example/gbpsvc/service/getBestPrice/GetBestPriceImplV3.java | fb2d7aeffc973912c3e5d9bc595455230a9f49c2 | [] | no_license | jorge-cue/gbpsvc | 3194ae22f66120be3945de2c080cbd81c7a73eb9 | d9744a4775b6f1c870904baba282317fc6a1556a | refs/heads/master | 2020-06-26T08:03:52.514101 | 2020-02-01T23:29:34 | 2020-02-01T23:29:34 | 199,579,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,886 | java | package com.example.gbpsvc.service.getBestPrice;
import com.example.gbpsvc.adapter.dto.StoreSkuPriceDTO;
import com.example.gbpsvc.adapter.store.StoreAdapter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@Slf4j
@Service("getBestPriceV3")
public class GetBestPriceImplV3 implements GetBestPrice {
private final StoreAdapter storeAdapter;
public GetBestPriceImplV3(StoreAdapter storeAdapter, Executor executor) {
this.storeAdapter = storeAdapter;
}
public Optional<StoreSkuPriceDTO> getBestPrice(String sku, Iterable<String> stores) {
// Launch Asynchronous requests to stores, collect all CompletableFutures to claim responses after.
@SuppressWarnings("unchecked")
CompletableFuture<StoreSkuPriceDTO>[] futures = StreamSupport.stream(stores.spliterator(), false)
.map(storeId -> CompletableFuture.supplyAsync(() -> storeAdapter.getPriceByStoreIdAndSku(storeId, sku))
/*
* Handles completion of CompletableFuture, when completed skuPrice has a value an throwable is null
* and vice versa when completedExceptionally skuPrice is null and throwable is the exception used to
* complete the future.
*/
.handle((skuPrice, throwable) -> {
if (throwable != null) {
log.error(throwable.getMessage());
return StoreSkuPriceDTO.builder().storeId(storeId).sku(sku).error(throwable.getMessage()).build();
}
return skuPrice;
}
))
.toArray(CompletableFuture[]::new);
List<StoreSkuPriceDTO> results = Arrays.stream(futures).parallel()
.map(CompletableFuture::join)
.sorted(Comparator.comparing(StoreSkuPriceDTO::getStoreId))
.peek(storeSkuPriceDTO -> log.info("Received Store/Sku: {}", storeSkuPriceDTO))
.collect(Collectors.toList());
log.info("Number of successfully received prices: " + results.stream().filter(s -> s.getError() == null).count());
log.info("Number of error on received prices: " + results.stream().filter(s -> s.getError() != null).count());
return results.stream().parallel()
.filter(p -> p.getError() == null)
.min(Comparator.comparing(StoreSkuPriceDTO::getPrice));
}
}
| [
"jorge.cue@gmail.com"
] | jorge.cue@gmail.com |
8a7b63563358bdb0749fce3dfef9611ae0c6fcaf | 69c0f6720f9c91e8272ce5911e96e9f4ad48467d | /src/main/java/com/zblog/web/support/CookieRemberManager.java | 42ea72ccf2b3b403d0a22f93d7f72e2573d9bee9 | [
"Apache-2.0"
] | permissive | hawklithm/zblog | aa5050b103f243cbe2cbd31787684e7f30e97f1d | e43123cdbf3e5ce0c13092e7f8eefc47a3ced80d | refs/heads/master | 2021-01-17T14:50:53.841129 | 2016-08-08T14:34:02 | 2016-08-08T14:34:02 | 47,021,731 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,130 | java | package com.zblog.web.support;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zblog.core.Constants;
import com.zblog.core.dal.entity.User;
import com.zblog.core.plugin.ApplicationContextUtil;
import com.zblog.core.security.HashCalculator;
import com.zblog.core.security.Hex;
import com.zblog.core.util.CookieUtil;
import com.zblog.core.util.IdGenerator;
import com.zblog.core.util.StringUtils;
import com.zblog.service.UserService;
/**
* 基于cookie的会话管理器
*
* @author zhou
*
*/
public class CookieRemberManager{
private static final String COOKIE_KEY = IdGenerator.uuid19();
public static User extractValidRememberMeCookieUser(HttpServletRequest request, HttpServletResponse response){
CookieUtil cookieUtil = new CookieUtil(request, response);
String token = cookieUtil.getCookie(Constants.COOKIE_CONTEXT_ID);
if(StringUtils.isBlank(token))
return null;
String[] cookieTokens = token.split(":");
if(cookieTokens.length != 3)
return null;
long tokenExpiryTime;
try{
tokenExpiryTime = new Long(cookieTokens[1]).longValue();
}catch(Exception e){
return null;
}
if(isTokenExpired(tokenExpiryTime))
return null;
UserService userService = ApplicationContextUtil.getBean(UserService.class);
User user = userService.loadById(cookieTokens[0]);
if(user == null)
return null;
String expectTokenSignature = makeTokenSignature(cookieTokens[0], tokenExpiryTime, user.getPassword());
return expectTokenSignature.equals(cookieTokens[2]) ? user : null;
}
/**
* 用户id和密码生成cookie
*
* @param request
* @param response
* @param userid
* @param password
* @param remeber
*/
public static void loginSuccess(HttpServletRequest request, HttpServletResponse response, String userid,
String password, boolean remeber){
long tokenExpiryTime = remeber ? System.currentTimeMillis() + 7 * 24 * 3600 : -1;
CookieUtil cookieUtil = new CookieUtil(request, response);
String cookieValue = userid + ":" + tokenExpiryTime + ":" + makeTokenSignature(userid, tokenExpiryTime, password);
if(remeber){
cookieUtil.setCookie(Constants.COOKIE_CONTEXT_ID, cookieValue, true, 7 * 24 * 3600);
}else{
cookieUtil.setCookie(Constants.COOKIE_CONTEXT_ID, cookieValue, true);
}
}
private static String makeTokenSignature(String userid, long tokenExpiryTime, String password){
String s = userid + ":" + Long.toString(tokenExpiryTime) + ":" + password + ":" + COOKIE_KEY;
return Hex.bytes2Hex(HashCalculator.md5(s.getBytes()));
}
public static void logout(HttpServletRequest request, HttpServletResponse response){
CookieUtil cookieUtil = new CookieUtil(request, response);
cookieUtil.removeCokie(Constants.COOKIE_CONTEXT_ID);
}
/**
* 当前登录token是否过期
*
* @param tokenExpiryTime
* @return
*/
private static boolean isTokenExpired(long tokenExpiryTime){
return tokenExpiryTime == -1 ? false : tokenExpiryTime < System.currentTimeMillis();
}
}
| [
"woshipmx1991@sina.com"
] | woshipmx1991@sina.com |
e05aaf9949d1c73891ffccca6ccdb6b15710ec10 | ba762e6168bfd33b8ca248e6ff9036de6a5a4ebc | /StopWatchDemo/src/main/java/com/example/stopwatchdemo/StopWatchDemoApplication.java | a90ef3debef254834535f3339b792fc7810c0e08 | [] | no_license | purushottamkaushik/SpringBootPrograms | 85bf852e8d6ffb520dfacbf03b0d33938ff8db47 | 97f8dc173059bc978e9fdc758eee15ac4bea6753 | refs/heads/master | 2023-05-02T11:53:55.597381 | 2021-05-18T16:07:27 | 2021-05-18T16:07:27 | 368,593,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.example.stopwatchdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StopWatchDemoApplication {
public static void main(String[] args) {
SpringApplication.run(StopWatchDemoApplication.class, args);
}
}
| [
"purushottamkaushik96@gmail.com"
] | purushottamkaushik96@gmail.com |
734b685ab14059ee2a589249ebb354f509a2ee9d | 9f907527f44fdfc33b5add9f8d313bbeb96d1192 | /src/codeforces/contests301_400/problemset320/PingPong.java | 09ecb470835a9cc70f019a698d1d2a3bb40b5a88 | [] | no_license | kocko/algorithms | 7af7052b13a080992dcfbff57171a2cac7c50c67 | 382b6b50538220a26e1af1644e72a4e1796374b6 | refs/heads/master | 2023-08-03T21:15:27.070471 | 2023-08-03T14:39:45 | 2023-08-03T14:39:45 | 45,342,667 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,196 | java | package codeforces.contests301_400.problemset320;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class PingPong implements Closeable {
private InputReader in = new InputReader(System.in);
private PrintWriter out = new PrintWriter(System.out);
private class Interval {
int a;
int b;
private Interval(int a, int b) {
this.a = a;
this.b = b;
}
}
private boolean[][] graph = new boolean[101][101];
private boolean[] visited;
private void dfs(int u) {
visited[u] = true;
for (int i = 1; i < 101; i++) {
if (graph[u][i] && !visited[i]) {
dfs(i);
}
}
}
public void solve() {
int n = in.ni();
Interval[] intervals = new Interval[101];
int idx = 1;
for (int c = 1; c <= n; c++) {
int type = in.ni();
int u = in.ni(), v = in.ni();
if (type == 1) {
Interval interval = new Interval(u, v);
intervals[idx] = interval;
for (int i = 1; i <= idx; i++) {
if (reachable(intervals[i], interval)) {
graph[i][idx] = true;
}
if (reachable(interval, intervals[i])) {
graph[idx][i] = true;
}
}
idx++;
} else {
visited = new boolean[101];
dfs(u);
out.println(visited[v] ? "YES" : "NO");
}
}
}
private boolean reachable(Interval m, Interval n) {
return (m.a > n.a && m.a < n.b) || (m.b > n.a && m.b < n.b);
}
@Override
public void close() throws IOException {
in.close();
out.close();
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int ni() {
return Integer.parseInt(next());
}
public long nl() {
return Long.parseLong(next());
}
public void close() throws IOException {
reader.close();
}
}
public static void main(String[] args) throws IOException {
try (PingPong instance = new PingPong()) {
instance.solve();
}
}
}
| [
"konstantin.yovkov@tis.biz"
] | konstantin.yovkov@tis.biz |
30158e65e5070192cc166cd02fd77060a5bab44d | a3f14f5add2d194b6230d7c2d01f99b81e6df31b | /src/main/java/lk/ijse/dep/exception/ResponseExceptionUtil.java | 65ce63e65d04dbe9fa5e9695b6d5fe55f2de79b6 | [] | no_license | TharangaMahavila/ijse-assignment-1 | 8316bb3154439f8b98582a5668d73e222a789842 | c67487aec35bc2f37ba3b840122e6fe9c25cf4e5 | refs/heads/main | 2023-02-23T17:06:55.390595 | 2021-02-02T02:31:01 | 2021-02-02T02:31:01 | 334,898,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,630 | java | package lk.ijse.dep.exception;
import lk.ijse.dep.dto.ErrorDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ResponseExceptionUtil {
static final Logger logger = LoggerFactory.getLogger(ResponseExceptionUtil.class);
public static void handle(Throwable t, HttpServletResponse resp) throws IOException {
resp.setContentType("application/json");
Jsonb jsonb = JsonbBuilder.create();
ErrorDTO dto = new ErrorDTO();
dto.setError("Internal server error");
dto.setMessage(t.getMessage());
if (t instanceof HttpResponseException) {
HttpResponseException ex = (HttpResponseException) t;
dto.setStatus(ex.getStatusCode());
resp.setStatus(ex.getStatusCode());
switch (ex.getStatusCode()) {
case 400:
dto.setError("Bad request");
dto.setMessage(ex.getMessage());
break;
case 404:
dto.setError("Not found");
dto.setMessage(ex.getMessage());
break;
case 500:
logger.error(ex.getMessage(), ex);
break;
default:
// We are good here :)
}
} else {
resp.setStatus(500);
logger.error("Something went wrong", t);
}
resp.getWriter().println(jsonb.toJson(dto));
}
}
| [
"tharangamahavila@gmail.com"
] | tharangamahavila@gmail.com |
c158c16dfdddae5c268be2dbcfc4f6006624231b | 3b72e5ec91db3f307f7e46b0313a902136e69340 | /src/main/java/com/aj/DisruptorDemoApplication.java | 23fae39c35b7fc0bf7398f1fa40ed9e27946c626 | [] | no_license | archine/disruptor-demo | b77f675e8d8bbed0a24879cc6219548b6a17e86f | 712943c787941c957405fca1781a62fca0b1ea49 | refs/heads/master | 2020-05-30T05:13:32.909460 | 2019-05-31T08:09:00 | 2019-05-31T08:09:00 | 189,554,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package com.aj;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DisruptorDemoApplication {
public static void main(String[] args) {
SpringApplication.run(DisruptorDemoApplication.class, args);
}
}
| [
"a87096937@qq.com"
] | a87096937@qq.com |
329535c3bbe82b9601609440c87a4efdbf2ecdc9 | 75a0e697133fe0ba62b52d386dbb378e6239d8cc | /rest-template-client/src/main/java/ru/pankov/template/RestTemplateApplication.java | 233538b63b105a519fb23671c6f08b562fd485f2 | [] | no_license | MaximPnk/gb-spring-cloud | 3ca92521437f9bf3c81ddf0f7b0a07f23d5d6efc | 7003de64f4fe3555707cf35a98eb7265c0eb7d79 | refs/heads/master | 2023-03-17T07:10:07.885877 | 2021-03-21T15:03:18 | 2021-03-21T15:03:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package ru.pankov.template;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RestTemplateApplication {
public static void main(String[] args) {
SpringApplication.run(RestTemplateApplication.class, args);
}
}
| [
"adm.mjkee@yandex.ru"
] | adm.mjkee@yandex.ru |
022ea889433af061065f029493b16377a1c91577 | 3aad3750b53bbc4b3e83b8fe8317ccabdb8af7d9 | /src/codechicken/wirelessredstone/core/WRCoreClientProxy.java | cb06e6439907f0e2b3782f4a228eaa1da9a19879 | [
"MIT"
] | permissive | Chicken-Bones/WirelessRedstone | 7f35d33891d0186f8b56dbcc38f0a14ebb0f0732 | 0c7fff755a3dc5a585f886b78cd3da72f9ff9f97 | refs/heads/master | 2021-01-17T08:10:44.925419 | 2016-07-13T14:14:00 | 2016-07-13T14:14:00 | 22,309,500 | 13 | 20 | MIT | 2020-09-25T21:54:50 | 2014-07-27T11:36:26 | Java | UTF-8 | Java | false | false | 1,186 | java | package codechicken.wirelessredstone.core;
import codechicken.core.ClientUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import codechicken.core.CCUpdateChecker;
import codechicken.lib.packet.PacketCustom;
import cpw.mods.fml.common.Mod;
import static codechicken.wirelessredstone.core.WirelessRedstoneCore.*;
public class WRCoreClientProxy extends WRCoreProxy
{
@Override
public void init()
{
if(SaveManager.config().getTag("checkUpdates").getBooleanValue(true))
CCUpdateChecker.updateCheck("WR-CBE", WirelessRedstoneCore.class.getAnnotation(Mod.class).version());
ClientUtils.enhanceSupportersList("WR-CBE|Core");
super.init();
PacketCustom.assignHandler(channel, new WRCoreCPH());
}
public void openItemWirelessGui(EntityPlayer entityplayer)
{
Minecraft.getMinecraft().displayGuiScreen(new GuiRedstoneWireless(entityplayer.inventory));
}
public void openTileWirelessGui(EntityPlayer entityplayer, ITileWireless tile)
{
Minecraft.getMinecraft().displayGuiScreen(new GuiRedstoneWireless(entityplayer.inventory, tile));
}
}
| [
"mehvids@gmail.com"
] | mehvids@gmail.com |
0e272a3c38f094f0dc848e35de0685312c16cc91 | a51f79ceac36ab0e261b65adf48dafe50b60bf34 | /src/main/java/com/kon/domain/PersistentAuditEvent.java | 3ae351b93cc67f724a6e1b776ae83abb286837d3 | [] | no_license | macxk/jhipsterdemo | cf553ba9e833cf6d1c4ee25a13661c6a6fb37db0 | 59d1161d90cbf4e9496fd2be403c3c57301b0635 | refs/heads/master | 2020-04-05T08:20:21.195564 | 2018-11-08T11:51:07 | 2018-11-08T11:51:07 | 156,710,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,541 | java | package com.kon.domain;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.Instant;
import java.util.HashMap;
import java.util.Objects;
import java.util.Map;
/**
* Persist AuditEvent managed by the Spring Boot actuator.
*
* @see org.springframework.boot.actuate.audit.AuditEvent
*/
@Document(collection = "jhi_persistent_audit_event")
public class PersistentAuditEvent implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Field("event_id")
private String id;
@NotNull
private String principal;
@Field("event_date")
private Instant auditEventDate;
@Field("event_type")
private String auditEventType;
private Map<String, String> data = new HashMap<>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal;
}
public Instant getAuditEventDate() {
return auditEventDate;
}
public void setAuditEventDate(Instant auditEventDate) {
this.auditEventDate = auditEventDate;
}
public String getAuditEventType() {
return auditEventType;
}
public void setAuditEventType(String auditEventType) {
this.auditEventType = auditEventType;
}
public Map<String, String> getData() {
return data;
}
public void setData(Map<String, String> data) {
this.data = data;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PersistentAuditEvent persistentAuditEvent = (PersistentAuditEvent) o;
return !(persistentAuditEvent.getId() == null || getId() == null) && Objects.equals(getId(), persistentAuditEvent.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "PersistentAuditEvent{" +
"principal='" + principal + '\'' +
", auditEventDate=" + auditEventDate +
", auditEventType='" + auditEventType + '\'' +
'}';
}
}
| [
"xiekun132@163.com"
] | xiekun132@163.com |
0119c68cc92f0984f29c12288ea49700cc19f086 | 0a71bbf445bc7fad83bf990f41618a483e875f7a | /GestionEmploi/src/main/java/tn/emploi/polytech/repository/EtudiantRepository.java | 1bcfd3b16ef36919b21e24a95835bcc241e2ecf5 | [] | no_license | anisMissa/GestionEmploi | 01fe4ca17f8c26bcb316dfc0cc1317444b572a64 | a115cd883e465fc627429f43660047781523fd97 | refs/heads/master | 2021-01-20T01:04:17.616356 | 2017-04-24T09:34:15 | 2017-04-24T09:34:15 | 89,214,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package tn.emploi.polytech.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import tn.emploi.polytech.entities.Etudiant;
@Repository
public interface EtudiantRepository extends JpaRepository<Etudiant, Long> {
public Etudiant findByNomAndPrenomAndAddress(String nom, String prenom, String address);
}
| [
"Anis"
] | Anis |
0a5138b2cd43b3485ae7abef9aeb9d6266132f31 | 578b943b176a929f59d2858afdbf3ed55c1332e8 | /AlgoPractise/src/Algo/oracle/BinarySearchTree.java | 039629466c4e7e035331007bc38eee64fc464da4 | [] | no_license | nitinpokhriyal/algopractise | 301e70d41c7ae634c6d2f1c24be1133bcdeed82a | c991c7307942d6e90552f0b71a17d638c46c0c26 | refs/heads/master | 2021-01-19T00:46:42.070907 | 2019-01-08T19:58:55 | 2019-01-08T19:58:55 | 63,659,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | package Algo.oracle;
import Algo.oracle.Node;
public class BinarySearchTree {
int h;
Node rootNode;
Node lastNode;
public void insert(Node node,int value){
if(rootNode==null){
rootNode=new Node(value);
return;
}
if(node.getData()>value){
Node lChild=node.getlChild();
if(lChild!=null){
insert(lChild,value);
}else{
System.out.println(" Inserted " + value + " to left of "
+ node.getData());
node.setlChild(new Node(value));
}
}else{
Node rChild=node.getrChild();
if(rChild!=null){
insert(rChild,value);
}else{
System.out.println(" Inserted " + value + " to right of "
+ node.getData());
node.setrChild(new Node(value));
}
}
}
public void printInOrder(Node node) {
if (node != null) {
printInOrder(node.getlChild());
System.out.println(" Traversed " + node.getData());
printInOrder(node.getrChild());
}
}
public static void main(String[] args){
BinarySearchTree binary=new BinarySearchTree();
Node node=new Node(3);
binary.rootNode=node;
binary.insert(node, 1);
binary.insert(node, 5);
binary.insert(node, 7);
binary.insert(node, 2);
binary.insert(node, 4);
binary.printInOrder(node);
}
}
| [
"nitinpokhriyal@gmail.com"
] | nitinpokhriyal@gmail.com |
53aed044c9aea5b4e899377d76c388862e808949 | 516165394e2884aad456c2514a0369c8bf18e584 | /personManagers/src/com/wy/form/EmployeeForm.java | a8f7132f19afeef1d03fff23404e14c8bf875664 | [] | no_license | gougou-Hub/Person_Managers | 5ea20b89e7a3962c5b286183e8d4c3ad2dcda8c7 | 493e03f4029571a2b6a1c0994ee467896fb51d0d | refs/heads/master | 2020-04-02T12:44:00.776074 | 2018-10-24T06:20:48 | 2018-10-24T06:24:16 | 154,448,815 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,213 | java | /**
*
*/
package com.wy.form;
import org.apache.struts.action.ActionForm;
/**
* @author Haitao Sun
*
*/
public class EmployeeForm extends ActionForm{
private Integer id;
private String em_serialNumber = "";
private String em_name = "";
private String em_sex = "鐢�";
private String em_age="";
private String em_IDCard = "";
private String em_born = "";
private String em_nation = "姹�";
private String em_marriage = "鏈";
private String em_visage = "鏃�";
private String em_ancestralHome = "";
private String em_tel = "";
private String em_address = "";
private String em_afterschool = "";
private String em_speciality = "";
private String em_culture = "鏈鐢�";
private String em_startime = "";
private String em_departmentId = "";
private String em_typework = "绋嬪簭鍛�";
private String em_creatime = "";
private String em_createName=null;
private String em_bz="鏃�";
public String getEm_bz() {
return em_bz.trim();
}
public void setEm_bz(String em_bz) {
this.em_bz = em_bz;
}
public String getEm_address() {
return em_address.trim();
}
public void setEm_address(String em_address) {
this.em_address = em_address;
}
public String getEm_afterschool() {
return em_afterschool.trim();
}
public void setEm_afterschool(String em_afterschool) {
this.em_afterschool = em_afterschool;
}
public String getEm_ancestralHome() {
return em_ancestralHome.trim();
}
public void setEm_ancestralHome(String em_ancestralHome) {
this.em_ancestralHome = em_ancestralHome;
}
public String getEm_born() {
return em_born.trim();
}
public void setEm_born(String em_born) {
this.em_born = em_born;
}
public String getEm_creatime() {
return em_creatime.trim();
}
public void setEm_creatime(String em_creatime) {
this.em_creatime = em_creatime;
}
public String getEm_culture() {
return em_culture.trim();
}
public void setEm_culture(String em_culture) {
this.em_culture = em_culture;
}
public String getEm_departmentId() {
return em_departmentId.trim();
}
public void setEm_departmentId(String em_departmentId) {
this.em_departmentId = em_departmentId;
}
public String getEm_IDCard() {
return em_IDCard.trim();
}
public void setEm_IDCard(String em_IDCard) {
this.em_IDCard = em_IDCard;
}
public String getEm_marriage() {
return em_marriage.trim();
}
public void setEm_marriage(String em_marriage) {
this.em_marriage = em_marriage;
}
public String getEm_name() {
return em_name.trim();
}
public void setEm_name(String em_name) {
this.em_name = em_name;
}
public String getEm_nation() {
return em_nation.trim();
}
public void setEm_nation(String em_nation) {
this.em_nation = em_nation;
}
public String getEm_serialNumber() {
return em_serialNumber.trim();
}
public void setEm_serialNumber(String em_serialNumber) {
this.em_serialNumber = em_serialNumber;
}
public String getEm_sex() {
return em_sex.trim();
}
public void setEm_sex(String em_sex) {
this.em_sex = em_sex;
}
public String getEm_speciality() {
return em_speciality.trim();
}
public void setEm_speciality(String em_speciality) {
this.em_speciality = em_speciality;
}
public String getEm_startime() {
return em_startime.trim();
}
public void setEm_startime(String em_startime) {
this.em_startime = em_startime;
}
public String getEm_tel() {
return em_tel.trim();
}
public void setEm_tel(String em_tel) {
this.em_tel = em_tel;
}
public String getEm_typework() {
return em_typework.trim();
}
public void setEm_typework(String em_typework) {
this.em_typework = em_typework;
}
public String getEm_visage() {
return em_visage.trim();
}
public void setEm_visage(String em_visage) {
this.em_visage = em_visage;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEm_createName() {
return em_createName.trim();
}
public void setEm_createName(String em_createName) {
this.em_createName = em_createName;
}
public String getEm_age() {
return em_age.trim();
}
public void setEm_age(String em_age) {
this.em_age = em_age;
}
}
| [
"877840256@qq.com"
] | 877840256@qq.com |
2497ede4cb8d4c7e6a2b7ea27e68f9fd5f42b46c | c0fde2f4c324de788b41aa8306f2bca2de27d787 | /src/main/java/lt/sdacademy/advanced_features/generics/exercise1/Main.java | 12b312e093df3e07c5a5f26515d0247bcce6641f | [] | no_license | EmilijaZukauskiene/FirstGIT | 9877a1501e82e7104bcaa8a8f7a0afe901ab0d18 | fd42e2f3257ec3cb6d88e26a05be69ebfc67487d | refs/heads/master | 2022-06-10T09:51:42.257764 | 2020-02-28T21:01:12 | 2020-02-28T21:01:12 | 223,590,508 | 0 | 0 | null | 2022-05-20T21:27:44 | 2019-11-23T13:11:27 | Java | UTF-8 | Java | false | false | 950 | java | package lt.sdacademy.advanced_features.generics.exercise1;
import lt.sdacademy.advanced_features.inheritance.animals.Animal;
import org.apache.log4j.Logger;
import java.util.Arrays;
import java.util.List;
public class Main {
private static final Logger logger = Logger.getLogger(Main.class); //LOGER
public static void main(String[] args) {
logger.error("Labas rytas!"); //LOGER
StoreGenericValues values = new StoreGenericValues();
values.storeValue("Tekstas");
values.storeValue(123);
values.storeValue(12.4);
List item = values.getItems();
for (Object items : item) {
System.out.println("Items in list: " + item);
}
}
}
//Create a simple Generic class, that will give a possibility, to store any kind of value within.
// Add object of type String, Integer and Double to array of that Generic type.
// Print all values of the array within a loop.*/ | [
"emilija2020@protonmail.com"
] | emilija2020@protonmail.com |
6717ebc373692308b7ccddbf1cb4ab8d80dbeaa6 | e47806dd0988bdfe8549deaa1156415174652c31 | /CountryFinder/app/src/main/java/com/countryfinder/countrylisting/repository/CountryRepository.java | 70ad5995463ea08385c180d147f97fd9cb15ce3a | [] | no_license | Sathish-Kumar-Kanagaraj/country_list | 88a4fd389dc1afbab33bb826838f80e231b88a6e | 086d042ace3b1c2c9aa1264894d06f1503ee97a2 | refs/heads/master | 2022-12-28T18:06:03.878913 | 2020-10-05T12:58:28 | 2020-10-05T12:58:28 | 299,029,943 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,296 | java | package com.countryfinder.countrylisting.repository;
import android.util.Log;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.countryfinder.countrylisting.model.Locations;
import com.countryfinder.server.ICountryAPIServices;
import com.countryfinder.server.RestClient;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class CountryRepository {
ICountryAPIServices iCountryAPIServices;
public CountryRepository() {
iCountryAPIServices = RestClient.getRetrofit().create(ICountryAPIServices.class);
}
public LiveData<List<Locations>> getCountryListData() {
final MutableLiveData<List<Locations>> countryListData = new MutableLiveData<>();
Call<List<Locations>> locationApiCall = iCountryAPIServices.getAllLocations();
locationApiCall.enqueue(new Callback<List<Locations>>() {
@Override
public void onResponse(Call<List<Locations>> call, Response<List<Locations>> response) {
countryListData.setValue(response.body());
}
@Override
public void onFailure(Call<List<Locations>> call, Throwable t) {
}
});
return countryListData;
}
}
| [
"sathishkumar.k@contus.in"
] | sathishkumar.k@contus.in |
1051dd0ce9f95070377a759cb791419f95178960 | 519df241b7db4ba6cacbee2a0fa5f358acb6c647 | /week-04/day-2/src/Aircraft/Aircraft.java | d61a7ebc6ae4390d3046bf87fe92727594403e3d | [] | no_license | green-fox-academy/salankiv | 806d7a8bf0c3d9772fa2bef0640203c34e05a0bb | 20c40b3a9cd70640892f2234c0b44eea43b15128 | refs/heads/master | 2021-08-08T02:43:09.369997 | 2017-11-09T11:39:25 | 2017-11-09T11:39:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package Aircraft;
public class Aircraft {
int currentAmmo;
int maxAmmo;
int baseDamage;
int allDamage;
String type;
String status;
public Aircraft() {
this.currentAmmo = 0;
}
public int fight() {
this.allDamage = this.currentAmmo * this.baseDamage;
this.currentAmmo = 0;
return allDamage;
}
public int refill(int ammo) {
if (ammo >= this.maxAmmo - this.currentAmmo) {
int temp = this.maxAmmo - this.currentAmmo;
this.currentAmmo = this.maxAmmo;
return ammo - temp;
} else {
this.currentAmmo += ammo;
return 0;
}
}
public String getType() {
return this.type;
}
public String getStatus() {
return this.status = "Type: " + this.type + " Ammo: " + this.currentAmmo + " Base Damage: " + this.baseDamage + " All Damage: " + this.allDamage;
}
}
| [
"salankiv5@gmail.com"
] | salankiv5@gmail.com |
cbd7195b3a39d468f3ca5c9e6af08a1f773a9a5b | 0ca0a9544a59a631c87f655aa4066fd0edc23016 | /src/Student.java | 80e79b169e1bb13da1556b767f9658ca7af6f945 | [] | no_license | rathana-voy/shortCourseCode | 570f8fd2514c92a029f0b86b1bdb629dcd50387b | 94e5b293870b01ac0b1175bb7b15702daf9e0463 | refs/heads/master | 2020-12-02T12:46:59.364480 | 2017-07-07T21:14:17 | 2017-07-07T21:14:17 | 96,594,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java |
public class Student {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) throws InvalidAge {
if(age<=0) throw new InvalidAge("IlligalAgeException! age cannot smaller then number 0");
else this.age = age;
}
@Override
public String toString() {
return "Student [name=" + name + ", age=" + age + "]";
}
}
| [
"rathanavoy@hotmail.com"
] | rathanavoy@hotmail.com |
046a5e9c2c26de1017b6a91df057a3cc151da53e | 7f04fd1786ffe9cd68cef0b73925bc9de6aaa280 | /rbac-lib/src/main/java/org/binyu/rbac/authz/ResourcePermissionHandler.java | 33a6d7daf98870ed306a995e4d684a758d78d682 | [] | no_license | bin-yu/rbac | 128b06f964e6f972f8bab30ea27ee656a4b24d79 | 0da2b1285e78d6aba16c6c95862ea9c6a92f56a3 | refs/heads/master | 2020-04-06T06:37:15.870054 | 2015-05-26T08:39:20 | 2015-05-26T08:39:22 | 35,794,092 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | /********************************************************************
* File Name: ResourcePermissionHandler.java
*
* Date Created: Mar 11, 2015
*
* ------------------------------------------------------------------
* Copyright (C) 2010 Symantec Corporation. All Rights Reserved.
*
*******************************************************************/
// PACKAGE/IMPORTS --------------------------------------------------
package org.binyu.rbac.authz;
import org.binyu.rbac.dtos.ResourcePermission;
import org.springframework.security.web.FilterInvocation;
/**
* Interface for Resource's PermissionHandler
*/
public interface ResourcePermissionHandler {
// CONSTANTS ------------------------------------------------------
// CLASS VARIABLES ------------------------------------------------
// INSTANCE VARIABLES ---------------------------------------------
// CONSTRUCTORS ---------------------------------------------------
// PUBLIC METHODS -------------------------------------------------
boolean checkPermission(ResourcePermission permissionOfUser,
FilterInvocation invocation);
// PROTECTED METHODS ----------------------------------------------
// PRIVATE METHODS ------------------------------------------------
// ACCESSOR METHODS -----------------------------------------------
}
| [
"yubin_sch@hotmail.com"
] | yubin_sch@hotmail.com |
eb7d48028420fe1afabe508158afeca5f187b56d | b3b475496de089aeb7d797f39d28c06e8839fae4 | /src/main/java/com/fatesg/fashion_boot/service/GalleryImagesService.java | c936882f3854f041b2f020595883e2f1ffdca8ac | [] | no_license | matheuscrok/projeto-fashion-boot | 7bab22d768f1bb72372d562ae33a5f7d213b38d1 | 576becd7db39e806bacf72fffd13de55b4c23a7f | refs/heads/master | 2023-06-25T23:12:35.411329 | 2021-08-02T22:19:54 | 2021-08-02T22:19:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | package com.fatesg.fashion_boot.service;
import com.fatesg.fashion_boot.entity.GalleryImages;
import com.fatesg.fashion_boot.repository.GalleryImagesRepository;
import com.fatesg.fashion_boot.service.exception.ObjectNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class GalleryImagesService {
final GalleryImagesRepository repository;
public GalleryImages save(GalleryImages galleryImages) {
galleryImages.setId(null);
return repository.save(galleryImages);
}
public Page<GalleryImages> listAllPage(Pageable pageable) {
return repository.findAll(pageable);
}
public List<GalleryImages> listAll() {
return repository.findAll();
}
public List<GalleryImages> listAllByProductId(Long id) {
return repository.findAllByProductId(id);
}
public GalleryImages findByIdOrThrowRequestException(Long id) {
return repository.findById(id).orElseThrow(() -> new ObjectNotFoundException("Marca não localizada"));
}
public void delete(Long id) {
findByIdOrThrowRequestException(id);
try {
repository.deleteById(id);
}catch (DataIntegrityViolationException e){
throw new DataIntegrityViolationException("Não é posssivel apagar, pois está associada a um produto");
}
}
public void replace(GalleryImages objeto) {
GalleryImages categoriaSaved = findByIdOrThrowRequestException(objeto.getId());
repository.save(objeto);
}
}
| [
"watlasrick@hotmail.com"
] | watlasrick@hotmail.com |
84527e5ee47f613d4063ff40934b89116939221b | d921375e14497ffe839ad6b6fb46613bfa74384e | /merkletree/Leaf.java | eec224667e95f7300f27be8e3af4a6af09e7cf99 | [] | no_license | chengyingsong/BigDataExperiment | 31cffc6e487733a8194347874564637548700848 | b368220e9d4cc4e79c0cad093e4e49df84ff7136 | refs/heads/main | 2023-01-01T12:38:19.293123 | 2020-10-23T11:09:42 | 2020-10-23T11:09:42 | 306,609,039 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,290 | java | package merkletree;
import java.util.List;
/**
* Represents a Merkle Tree leaf, consisting of a list
* of blocks of arbitrary data. The arbitrary data in each block
* is represented as a byte array.
*/
public class Leaf {
// The data to be stored in this node
private List<byte[]> dataBlock;
private final String filename;
private MerkleTree father=null;
/**
* Initialises the leaf node, which consists
* of the specified block of data.
*
* @param dataBlock Data block to be placed in the leaf node
*/
//构造函数
public Leaf(final List<byte[]> dataBlock,String filename)
{
this.dataBlock = dataBlock;
this.filename = filename;
}
public void setDataBlock(List<byte[]> dataBlock){this.dataBlock =dataBlock;}
public void setFather(MerkleTree father){this.father = father;}
public MerkleTree getFather(){return this.father;}
public String getFilename()
{
return this.filename;
}
/**
* @return The data block associated with this leaf node
*/
public List<byte[]> getDataBlock()
{
return (dataBlock);
}
/**
* Returns a string representation of the specified
* byte array, with the values represented in hex. The
* values are comma separated and enclosed within square
* brackets.
*
* @param array The byte array
*
* @return Bracketed string representation of hex values
*/
public String toHexString(final byte[] array)
{
final StringBuilder str = new StringBuilder();
str.append("[");
boolean isFirst = true;
for(int idx=0; idx<array.length; idx++)
{
final byte b = array[idx];
if (isFirst)
{
//str.append(Integer.toHexString(i));
isFirst = false;
}
else
{
//str.append("," + Integer.toHexString(i));
str.append(",");
}
//has
final int hiVal = (b & 0xF0) >> 4;
final int loVal = b & 0x0F;
str.append((char) ('0' + (hiVal + (hiVal / 10 * 7))));
str.append((char) ('0' + (loVal + (loVal / 10 * 7))));
}
str.append("]");
return(str.toString());
}
/**
* Returns a string representation of the data block
*/
public String toString()
{
final StringBuilder str = new StringBuilder();
for(byte[] block: dataBlock)
{
str.append(toHexString(block));
}
return(str.toString());
}
}
| [
"1617127436@qq.com"
] | 1617127436@qq.com |
d816e98c37cabc1ef60f259ce5becded84b9b550 | 25b82ef548bc2c7467b85358754703a379277159 | /TicketService/src/test/java/com/dnyanshree/TicketService/reserveSeatsTest.java | 21b18399b012e30cb872ec95271b7399a47ead8d | [] | no_license | Dnyanshree/TicketServiceProject | 12b084498760008db8d4ceb1a5f642beeb7c522d | f3e623f34057da5879029a910ba5a4a1e1dcf2f1 | refs/heads/master | 2021-01-17T20:53:22.308437 | 2016-07-28T04:52:15 | 2016-07-28T04:52:23 | 64,343,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package com.dnyanshree.TicketService;
import static org.junit.Assert.*;
import java.util.Optional;
import org.junit.Test;
public class reserveSeatsTest {
@Test
public void testReserveSeats() {
TicketServiceImpl tickets = new TicketServiceImpl();
tickets.init();
tickets.findAndHoldSeats(2, Optional.ofNullable(1), Optional.ofNullable(4), "a@c.com");
String actual =tickets.reserveSeats(5465, "a@c.com");
String expected = String.valueOf(5465);
assertEquals(expected, actual);
}
}
| [
"dnyanshree@gmail.com"
] | dnyanshree@gmail.com |
8ed18afdeaa868dc3764d36f466c8b42dc94ff63 | a3d8936409b07a57b74473288d4f67aed43ded55 | /src/main/java/org/mario/vo/response/RespSaveParamDataVO.java | 3e9ca4d1a9e4422758cde965f0d367c206af95c0 | [] | no_license | Simba-cheng/mario | a8903a673794a4f7de6b40414615cfbeb7f2e1bf | 8dce80019b237fa1bbe6021963110ab89b4283c3 | refs/heads/master | 2022-07-01T21:04:37.237283 | 2022-06-21T01:23:23 | 2022-06-21T01:23:23 | 170,873,727 | 1 | 0 | null | 2022-06-21T01:23:24 | 2019-02-15T14:01:05 | Java | UTF-8 | Java | false | false | 139 | java | package org.mario.vo.response;
/**
* @author CYX
* @date: 2019/2/28 22:25
*/
public class RespSaveParamDataVO extends ResponseVO {
}
| [
"simba_cheng@163.com"
] | simba_cheng@163.com |
202728bb7cc86bb67c02c3fc5c0c521b361762f8 | 7dac70dc27cfec282274756bb03f112f0f10c382 | /Mybatis/13.Mybatis_Ann_OneToMore/src/com/select/pojo/Product.java | 080eaa6d32f89d65994c548f6ef76665c60d2c31 | [] | no_license | Autovy/Java_SSM_Example | 9bc76695dff5103d3ad1cf1004f9cd2fc1d00f1e | 0eebd15919cbbbbda9207bc70fdb30b2578ba4d3 | refs/heads/main | 2023-06-08T00:27:48.186606 | 2021-06-25T09:29:03 | 2021-06-25T09:29:03 | 380,095,034 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | package com.select.pojo;
public class Product {
private int id;
private String name;
private float price;
private Category category;
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public int getId(){
return id;
}
public void setId(){
this.id = id;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public float getPrice(){
return price;
}
public void setPrice(float price){
this.price = price;
}
public String toString(){
return "Product [id=" + id + ", name=" + name + ", price=" + price + "]";
}
}
| [
"2732330795@qq.com"
] | 2732330795@qq.com |
8c0d81b69b221fd968a1bd84cb3382fa27c59b72 | 30a6cd2c355aa8ba0b24cbfd15ff44b8fc80b1e2 | /src/main/java/pl/mateuszhajdus/Serwis_Samochodowy_U_Grubego/SerwisSamochodowyUGrubegoApplication.java | 5ad588db8dc8c83265496c6ea976870ec1283146 | [] | no_license | MathHajdus/SerwisSamochodowyUGrubego | 7a032933a30254736a566d486d40895c84652792 | f1ec82094f0295467890f60b77ff22252aeafc00 | refs/heads/master | 2021-06-19T00:53:54.584386 | 2019-08-05T17:56:17 | 2019-08-05T17:56:17 | 199,289,144 | 0 | 0 | null | 2021-04-26T19:23:13 | 2019-07-28T13:13:36 | Java | UTF-8 | Java | false | false | 376 | java | package pl.mateuszhajdus.Serwis_Samochodowy_U_Grubego;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SerwisSamochodowyUGrubegoApplication {
public static void main(String[] args) {
SpringApplication.run(SerwisSamochodowyUGrubegoApplication.class, args);
}
}
| [
"ula749@wp.pl"
] | ula749@wp.pl |
335b9fb8ab69fd33d7a08b89fd6939941bbde002 | 1c6fdc01317bea90fc891394aed224225c9101cd | /home/home-parent/home-cart-service/src/main/java/com/kai/home/cart/dao/OmsCartItemMapper.java | 3431f0a16f2f2af88754fc346994224431494f67 | [] | no_license | MENGRUStyle/xiangmu | cd0c16ec8081f3bd2e54978602d148e58d2c930a | 45f2d01019912680b57bf76d5ef427415e73777e | refs/heads/master | 2022-12-29T12:51:52.596088 | 2020-10-19T10:11:09 | 2020-10-19T10:11:09 | 305,314,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.kai.home.cart.dao;
import com.kai.home.product.pojo.OmsCartItem;
import tk.mybatis.mapper.common.Mapper;
public interface OmsCartItemMapper extends Mapper<OmsCartItem> {
}
| [
"admin@admin.com"
] | admin@admin.com |
4d541f4eaf885313eb1888c5a07f08abc198a53d | cebac229f168e9bee3945d214674afb1dbbaf12a | /lab3/tcp4/Mailbox.java | 9d39ecff785c88bb43b0a93de3d6157e292927c8 | [] | no_license | johannesnilsson/EDA095 | 0de5989da4cbd7901a0cb5be26633728050f0e73 | ae03c273e1cc31fae9ff4ae6f6a3340f528d336a | refs/heads/master | 2021-01-23T03:12:45.124326 | 2017-06-01T14:51:44 | 2017-06-01T14:51:44 | 86,058,016 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package tcp4;
import java.net.Socket;
import java.util.Vector;
public class Mailbox {
String message ="";
boolean noMessage = true;
public Mailbox(){
}
/**
* Add a message to the mailbox.
* @param s The message.
*/
public synchronized void addMessage(String s, String threadName){
// add message to string.
message += "(" +threadName +"): " +s +"\r";
noMessage = false;
// notifies that a message is available to readThread
notifyAll();
}
/**
* Method waits until there is a message to retrieve.
* @return The available message.
*/
public synchronized String removeMessage(){
try{
// we won't print empty messages with this condition
// also, we dont need processor time until there actually is an message for us
while(noMessage) wait();
} catch (Exception e){
e.printStackTrace();
}
// clear and retrieve the string holding message
String temp = message;
message = "";
noMessage = true;
return temp;
}
}
| [
"dat12ehu@student.lu.se"
] | dat12ehu@student.lu.se |
130cb6c34b21bbb864b96289588aba25ce55de48 | e2eade4149cf7e669b5e4be902c905b165e0e1f4 | /src/SocialSim.java | 5bde544cf58ffd251c94c23d95267eb2e999a1a2 | [] | no_license | BunningsWarehouseOfficial/DSA-Assignment | 300721f5b8d9d5449b6a718634db34652a60750c | cba38b74283bedd24a244d004b715d63b23cf35e | refs/heads/master | 2022-03-04T19:15:22.107577 | 2019-10-28T08:29:47 | 2019-10-28T08:29:47 | 216,938,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,387 | java | /* Author: Kristian Rados (19764285)
Created: 23/10/2019
Last Modified: 28/10/2019 */
import java.util.*;
public class SocialSim
{
public static void main(String[] args)
{
try
{
if (args.length == 5)
{ //Checking for simulation mode
if (args[0].equals("-s"))
{
String networkFile, eventFile;
double pLike, pFollow;
networkFile = args[1];
eventFile = args[2];
pLike = Double.parseDouble(args[3]);
pFollow = Double.parseDouble(args[4]);
if (pLike > 1 || pFollow > 1 || pLike < 0 || pFollow < 0)
{
throw new IllegalArgumentException("Probabilities " +
"must by >= 0 and <= 1");
}
else
{
simulation(networkFile, eventFile, pLike, pFollow);
}
}
else
{ //Checking for an incorrect command line argument
throw new IllegalArgumentException("Command line argument" +
"must either be the -i flag for the interactive" +
"testing environment or the -s flag for simulation " +
"mode");
}
}
else if (args.length == 1)
{ //Checking for interactive mode
if (args[0].equals("-i"))
{
menu();
}
else
{ //Checking for an incorrect command line argument
throw new IllegalArgumentException("Command line argument" +
"must either be the -i flag for the interactive" +
"testing environment or the -s flag for simulation " +
"mode");
}
}
else if (args.length == 0)
{ //No command line flags
usageInfo();
}
else
{ //Checking for > 1 command line arguments
throw new IllegalArgumentException("Invalid number of command" +
"line arguments, run program with the -i flag, the -s " +
"flag or no flags");
}
}
catch (NumberFormatException e1)
{
System.out.println(e1.getMessage());
}
catch (IllegalArgumentException e2)
{
System.out.println("Error: " + e2.getMessage());
}
catch (Exception e3)
{
System.out.println(e3.getMessage());
}
}
/* Runs simulation mode, outputting statistics to a file after each timestep */
private static void simulation(String networkFile, String eventFile,
double probLike, double probFollow)
{
Network n;
String filename;
try
{ //Load the network
n = IO.loadNetwork(networkFile);
n.setProbLike(probLike);
n.setProbFollow(probFollow);
//Load events file
IO.loadEvents(eventFile, n);
filename = IO.newLogfile(networkFile, eventFile, probLike,
probFollow);
if (filename != null)
{
long startTime = System.nanoTime();
boolean status = true;
String logText;
DSAQueue checkStale = new DSAQueue();
DSAQueue textQueue = new DSAQueue();
int stepNum = 1; //Always runs first time
while (status == true && (n.getEventsCount() != 0 ||
n.getNPosts() != n.getNPostsStale() || stepNum == 1))
{
timeStep(n, checkStale);
displayStats(n, textQueue);
logText = "";
while (!textQueue.isEmpty())
{
logText += (String)textQueue.dequeue();
}
logText += n.emptyTimeStepText();
status = IO.appendLogFile(filename, logText, stepNum);
stepNum++;
}
if (status == true)
{
//Displaying popularity 'leaderboards' at end of logfile
logText = "";
displayPopular(n, textQueue);
while (!textQueue.isEmpty())
{
logText += textQueue.dequeue();
}
IO.appendLogFile(filename, logText, 0);
System.out.println("Successfully ran simulation");
long endTime = System.nanoTime();
System.out.println("Time Taken: " + (int)((double)(endTime
- startTime) / 1000000.0) + "ms");
}
else
{ //In case of some file IO failure
System.out.println("Simulation failed");
}
}
}
catch (IllegalArgumentException e1)
{
System.out.println(e1.getMessage());
}
catch (IndexOutOfBoundsException e2)
{
System.out.println("Error: Invalid colon placement in file");
}
}
/* Main menu for the interactive testing environment */
private static void menu()
{
Scanner sc = new Scanner(System.in);
Network network = new Network();
DSAQueue checkStale = new DSAQueue();
String filename;
int cmd = -1;
do
{
try
{
System.out.println("\n[1] Load Network\n[2] Load Events File" +
"\n[3] Set Probabilities \n[4] Node Operations" +
"\n[5] Edge Operations\n[6] New Post\n[7] Display Network" +
"\n[8] Display Statistics \n[9] Update (Run Timestep)" +
"\n[10] Save Network\n[0] Exit\n");
cmd = Integer.parseInt(sc.nextLine());
switch (cmd)
{
case 1: //Load Network
double pLike, pFollow;
//Carrying over probabilities to keep them consistent
pLike = network.getProbLike();
pFollow = network.getProbFollow();
System.out.print("Filename: ");
filename = sc.nextLine();
try
{
network = IO.loadNetwork(filename);
network.setProbLike(pLike);
network.setProbFollow(pFollow);
}
catch (IllegalArgumentException e1)
{
System.out.println(e1.getMessage());
}
catch (IndexOutOfBoundsException e2)
{
System.out.println("Error: Invalid colon " +
"placement in file");
}
break;
case 2: //Load Events
System.out.print("Filename: ");
filename = sc.nextLine();
try
{
IO.loadEvents(filename, network);
}
catch (IllegalArgumentException e1)
{
System.out.println(e1.getMessage());
}
catch (IndexOutOfBoundsException e2)
{
System.out.println("Error: Invalid colon " +
"placement in file");
}
break;
case 3: //Probabilities
setProbabilities(network);
break;
case 4: //Node Ops
nodeOperations(network);
break;
case 5: //Edge Ops
edgeOperations(network);
break;
case 6: //New Post
newPost(network);
break;
case 7: //Display Network
network.displayAsList();
break;
case 8: //Display Stats
DSAQueue stats = new DSAQueue();
displayStats(network, stats);
displayPopular(network, stats);
System.out.println("\nProb. Like: " +
network.getProbLike());
System.out.println("Prob. Follow: " +
network.getProbFollow());
while (!stats.isEmpty())
{
System.out.print(stats.dequeue());
}
break;
case 9: //Run Timestep
timeStep(network, checkStale);
break;
case 10: //Save
System.out.print("Filename: ");
filename = sc.nextLine();
IO.saveNetwork(filename, network);
break;
default:
if (cmd != 0)
{
System.out.println("Error: Invalid selection");
}
break;
}
}
catch (IllegalArgumentException | InputMismatchException e1)
{
System.out.println("Error: Invalid input");
}
} while (cmd != 0);
}
/* Setting the probabilities in interactive mode */
private static void setProbabilities(Network network)
{
Scanner sc = new Scanner(System.in);
double probLike, probFollow;
System.out.print("Prob. Like: ");
probLike = Double.parseDouble(sc.nextLine());
network.setProbLike(probLike);
System.out.print("Prob. Follow: ");
probFollow = Double.parseDouble(sc.nextLine());
network.setProbFollow(probFollow);
}
/* Sub-menu for node operations */
private static void nodeOperations(Network network)
{
Scanner sc = new Scanner(System.in);
String name = "";
int cmd;
System.out.println("[1] Find Node\n[2] Insert Node\n[3] Delete " +
"Node\n[0] Back\n");
cmd = Integer.parseInt(sc.nextLine());
try
{
switch (cmd)
{ //Using trim to remove excess whitespace
case 1:
System.out.print("Node/Person Name: ");
name = sc.nextLine().trim();
network.findNode(name);
break;
case 2:
System.out.print("Node/Person Name: ");
name = sc.nextLine().trim();
Person newNode = new Person(name);
network.addVertex(name, newNode);
System.out.println("'" + name + "' was successfully added" +
" to the network");
break;
case 3:
System.out.print("Node/Person Name: ");
name = sc.nextLine().trim();
network.removeVertex(name);
System.out.println("'" + name + "' was successfully" +
" removed from the network");
break;
case 0:
break;
default:
System.out.println("Error: Invalid selection");
break;
}
}
catch (IllegalArgumentException e1)
{
System.out.println("Error: Node '" + name + "' already exists");
}
catch (NoSuchElementException e2)
{
System.out.println("Error: Could not find node '" + name + "'");
}
}
/* Sub-menu for edge operations */
private static void edgeOperations(Network network)
{
Scanner sc = new Scanner(System.in);
String followee, follower;
int cmd;
System.out.println("[1] Add Follow\n[2] Remove Follow\n[0] Back\n");
cmd = Integer.parseInt(sc.nextLine());
try
{
switch (cmd)
{ //Using trim to remove excess whitespace
case 1:
System.out.print("Followee Name: ");
followee = sc.nextLine().trim();
System.out.print("Follower Name: ");
follower = sc.nextLine().trim();
network.addEdge(followee, follower);
System.out.println("Link successfully added");
break;
case 2:
System.out.print("Followee Name: ");
followee = sc.nextLine().trim();
System.out.print("Follower Name: ");
follower = sc.nextLine().trim();
network.removeEdge(followee, follower);
System.out.println("Link successfully removed");
break;
case 0:
break;
default:
System.out.println("Error: Invalid selection");
break;
}
}
catch (IllegalArgumentException e)
{
System.out.println(e.getMessage());
}
}
/* Manually adding a new post to the events queue */
private static void newPost(Network network)
{
Scanner sc = new Scanner(System.in);
String poster, text;
double clickbait;
System.out.println("The post will be added to events/timestep queue");
System.out.print("Poster: ");
poster = sc.nextLine();
if (network.hasVertex(poster))
{
try
{
Post newPost;
System.out.print("Post Text: ");
text = sc.nextLine();
System.out.print("Clickbait Factor: ");
clickbait = Double.parseDouble(sc.nextLine());
newPost = new Post(poster, text, clickbait);
network.addEvent(newPost, 'P');
}
catch (IllegalArgumentException e)
{
System.out.println(e.getMessage());
}
}
else
{
System.out.println("Error: This person isn't in the network");
}
}
/* Displaying network statistics */
private static void displayStats(Network n, DSAQueue queue)
{
queue.enqueue("\nNodes: " + n.getVertexCount());
queue.enqueue("\nEdges: " + n.getEdgeCount());
queue.enqueue("\nPosts: " + n.getNPosts() + " (" +
n.getNPostsStale() + " stale)");
queue.enqueue("\nEvents in Timestep Queue: " + n.getEventsCount() +
"\n");
}
/* Displaying people and posts in order of popularity */
private static void displayPopular(Network n, DSAQueue queue)
{
Person[] people;
Post[] posts;
people = sortPeople(n);
posts = sortPosts(n);
queue.enqueue("\nPeople in Order of Total Followers:");
queue.enqueue("\n===================================\n");
for (int ii = people.length - 1; ii >= 0; ii--)
{
queue.enqueue(people[ii].getName() + ": " +
people[ii].getNFollowers() + "\n");
}
queue.enqueue("\nPosts in Order of Likes:");
queue.enqueue("\n========================\n");
for (int jj = posts.length - 1; jj >= 0; jj--)
{
queue.enqueue(posts[jj].getPoster() + ": " +
posts[jj].getLikes() + "\n'" +
posts[jj].getText() + "'\n");
}
}
/* Sorting people in the network by number of followers */
private static Person[] sortPeople(Network n)
{
int ii;
DSALinkedList people = n.getAllVertexValues();
Person[] array = new Person[people.getCount()];
ii = 0;
for (Object o : people)
{
array[ii] = (Person)o;
ii++;
}
mergeSort(array);
return array;
}
/* Sorting posts in the network by number of likes */
private static Post[] sortPosts(Network n)
{
int ii;
DSALinkedList posts = n.getPosts();
Post[] array = new Post[posts.getCount()];
ii = 0;
for (Object o : posts)
{
array[ii] = (Post)o;
ii++;
}
mergeSort(array);
return array;
}
/* Steps through the simulation by one unit of 'time', pulling an event out
of the queue and spreading any shared posts through the network */
private static void timeStep(Network network, DSAQueue checkStale)
{
String name, followee, follower;
Person person, poster, viewer;
DSAQueue sharers, followers;
Post post, sharedPost;
int count;
char tag;
//Pulling next new event from events queue
tag = network.peekQueueTag();
switch (tag)
{
case 'A':
person = (Person)network.dequeueEvent();
if (network.hasVertex(person.getName()))
{
System.out.println("Error: '" + person.getName() + "' is " +
"already in the network, can't add");
}
else
{
network.addVertex(person.getName(), person);
network.enqueueTimeStepText("\n- A: Added '" +
person.getName() + "' to network");
}
break;
case 'R':
name = (String)network.dequeueEvent();
if (!network.hasVertex(name))
{
System.out.println("Error: '" + name + "' is " +
"not in the network, can't be removed");
}
else
{
network.removeVertex(name);
network.enqueueTimeStepText("\n- R: Removed '" + name +
"' from network");
}
break;
case 'F':
followee = (String)network.dequeueEvent();
follower = (String) network.dequeueEvent();
if (!network.hasVertex(followee))
{
System.out.println("Error: '" + followee + "' is not in " +
"the network, can't be a followee");
}
else if (!network.hasVertex(follower))
{
System.out.println("Error: '" + follower + "' is not in " +
"the network, can't be a follower");
}
else if (network.hasEdge(followee, follower))
{
System.out.println("Error: '" + follower + "' already " +
"follows '" + followee + "'");
}
else
{
network.addEdge(followee, follower);
network.enqueueTimeStepText("\n- F: '" + follower + "' " +
"now follows '" + followee + "'");
}
break;
case 'U':
followee = (String)network.dequeueEvent();
follower = (String)network.dequeueEvent();
if (!network.hasVertex(followee))
{
System.out.println("Error: '" + followee + "' is not in " +
"the network, can't be unfollowed");
}
else if (!network.hasVertex(follower))
{
System.out.println("Error: '" + follower + "' is not in " +
"the network, can't remove follow");
}
else if (!network.hasEdge(followee, follower))
{
System.out.println("Error: '" + follower + "' doesn't " +
"follow '" + followee + "', can't unfollow");
}
else
{
network.removeEdge(followee, follower);
network.enqueueTimeStepText("\n- U: '" + follower + "' " +
"unfollowed '" + followee + "'");
}
break;
case 'P':
post = (Post)network.dequeueEvent();
if (!network.hasVertex(post.getPoster()))
{
System.out.println("Error: '" + post.getPoster() + "' is " +
"not in the network, can't post");
}
else
{
poster = (Person)network.getVertexValue(post.getPoster());
poster.addJustShared(post);
poster.addPost();
network.addPost(post);
network.enqueueTimeStepText("\n- P: '" + poster.getName() +
"' created a post\n > '" + post.getText() + "'");
checkStale.enqueue(post);
}
break;
}
//Search network, checking for posts just 'shared' to spread them
sharers = network.findSharers();
while (!sharers.isEmpty())
{
//Get the person who shared a post
person = (Person)sharers.dequeue();
//Retrieve the post being shared from person's sharing queue
sharedPost = (Post)person.getJustShared().dequeue();
//Get the original poster
poster = (Person)network.getVertexValue(sharedPost.getPoster());
followers = network.getAdjacentValues(person.getName());
while (!followers.isEmpty())
{
viewer = (Person)followers.dequeue();
viewer.viewPost(sharedPost, poster, network);
// ^ numSeen on post updated here
}
}
//Check to see if any posts have become 'stale'
count = checkStale.getCount();
for (int ii = 0; ii < count; ii++)
{
int current, prev;
Post checking = (Post)checkStale.dequeue();
current = checking.getNumSeen();
prev = checking.getNumSeenPrev();
if (current != prev)
{ //Has changed: not stale
checking.updateNumSeenPrev(); //Make prev = current
checkStale.enqueue(checking); //Have it checked next timeStep
}
else
{ //Hasn't changed: stale
checking.setStale(true);
network.addPostStale();
network.enqueueTimeStepText("\n- STALE: Post by '" +
checking.getPoster() + "'\n > '" +
checking.getText() + "'");
}
}
}
/* Display general usage information to user about running program, including
a description of the two modes and their flags */
private static void usageInfo()
{
System.out.println("This is a program for analysing the spread of " +
"information through a social network.\nEach person is a node in" +
" a network and every time someone follows another person, it " +
"creates a connection (edge) between them.");
System.out.println("\nIn interactive mode, you can step through the " +
"simulation, tweak the network and view the details of individual" +
" people in the network mid-simulation.\nTo use interactive mode," +
" run program as 'SocialSim -i'");
System.out.println("\nIn simulation mode, the program runs the entire" +
" simulation using the starting parameters provided on the " +
"command line and keeps a log of all events that occur at each " +
"time step. This log is saved to a dated log file.\nTo use " +
"simulation mode, run program as 'SocialSim -s <netfile> " +
"<eventfile> <prob_like> <prob_follow>'");
}
//SORTING
//The Rest of This File is
//Obtained from Kristian Rados DSA Practical 8 Work
// mergeSort - front-end for kick-starting the recursive algorithm
private static void mergeSort(Object[] A)
{
int leftIdx, rightIdx;
leftIdx = 0;
rightIdx = A.length - 1;
mergeSortRecurse(A, leftIdx, rightIdx);
}//mergeSort()
private static Object[] mergeSortRecurse(Object[] A, int leftIdx,
int rightIdx)
{
if (leftIdx < rightIdx)
{
int midIdx;
midIdx = (leftIdx + rightIdx) / 2;
mergeSortRecurse(A, leftIdx, midIdx); //Sort left half of subarray
mergeSortRecurse(A, midIdx + 1, rightIdx); //Sort right half
merge((Comparable[])A, leftIdx, midIdx, rightIdx);
} //Base case: array is already sorted (only one element)
return A;
}//mergeSortRecurse()
private static Object[] merge(Comparable[] A, int leftIdx, int midIdx,
int rightIdx)
{
int ii, jj, kk;
Object[] tempA = new Object[rightIdx - leftIdx + 1];
ii = leftIdx; //Idx for the 'front' of left subarray
jj = midIdx + 1; //Idx for the 'front' of right subarray
kk = 0; //Idx for next free element in tempA
//Merge subarrays into tempA
while (ii <= midIdx && jj <= rightIdx)
{
if (A[ii].compareTo(A[jj]) <= 0) //Use <= for stable sort
{
tempA[kk] = A[ii]; //Take from left subarray
ii++;
}
else
{
tempA[kk] = A[jj]; //Take from right subarray
jj++;
}
kk++;
}
for (ii = ii; ii <= midIdx; ii++) //Flush remainder from left
{
tempA[kk] = A[ii];
kk++;
}
for (jj = jj; jj <= rightIdx; jj++) //Flush remainder from right
{
tempA[kk] = A[jj];
kk++;
}
for (kk = leftIdx; kk <= rightIdx; kk++) //Copy now sorted tempA to A
{
A[kk] = (Comparable)tempA[kk - leftIdx]; /*Use kk - leftIdx to
align tempA to 0*/
}
return A;
}//merge()
}
| [
"kristianrados40@gmail.com"
] | kristianrados40@gmail.com |
4dd035a3ea4b6058cc1cd9536a25c28da040d2e4 | 432bc72f094b732d332c42eeab6a2f9156c42b92 | /Stefan-Muehlbauer-Task5/features/Console/de/smba/compression/frontend/benchmarking/ConsoleBenchmarker.java | eff5d2b6ee790ba45570293ca9c446f148caa3d9 | [
"Apache-2.0"
] | permissive | TUBS-ISF/spl2015.stefan.muehlbauer | 07668f6f77e3d21622ef1f19854d562d1eedee77 | 7d54c769ede763159b7d346bcac870f9f2a70100 | refs/heads/master | 2021-01-22T06:03:17.109210 | 2015-07-19T18:58:10 | 2015-07-19T18:58:10 | 34,481,583 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package de.smba.compression.frontend.benchmarking;
import de.smba.compression.frontend.benchmarking.AbstractConsoleBenchmarker;
public class ConsoleBenchmarker extends AbstractConsoleBenchmarker {
public double benchmark(String before, String after) {
return 0.0;
}
} | [
"s.muehlbauer@student.ucc.ie"
] | s.muehlbauer@student.ucc.ie |
f96fe1dda745a44c3d37d27b3436697fcecb4a70 | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2007-08-13/seasar2-2.4.17/s2-extension/src/main/java/org/seasar/extension/dbcp/ConnectionWrapper.java | fbb82f4f499c814f6dbc97362a186573a822521d | [
"Apache-2.0"
] | permissive | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,189 | java | /*
* Copyright 2004-2007 the Seasar Foundation and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.seasar.extension.dbcp;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
/**
* コネクションをラップするためのインターフェースです。 {@link ConnectionPool}で管理するのはこのインターフェースのオブジェクトです。
*
* @author higa
*
*/
public interface ConnectionWrapper extends Connection {
/**
* 本当にクローズします。 {@link Connection#close()}を呼び出すとプールに返るだけで実際にはクローズしません。
*/
void closeReally();
/**
* 解放します。
*
* @throws SQLException
* SQL例外が発生した場合
*/
void release() throws SQLException;
/**
* 初期化します。
*
* @param localTx
* トランザクション中かどうか
*/
void init(boolean localTx);
/**
* クリーンアップします。
*/
void cleanup();
/**
* 物理的なコネクションを返します。
*
* @return 物理的なコネクション
*/
Connection getPhysicalConnection();
/**
* XAリソースを返します。
*
* @return XAリソース
*/
XAResource getXAResource();
/**
* XAコネクションを返します。
*
* @return XAコネクション
*/
XAConnection getXAConnection();
} | [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
] | koichik@319488c0-e101-0410-93bc-b5e51f62721a |
2aaa3a7d9ed84b4e2198603bb906cc2e90cb7d1e | 8a86f37d2404198bacd2f75fba3112cd78e71d81 | /1-Learn/PlayMp3Correctly/app/src/androidTest/java/com/jikexueyuan/playmp3correctly/ApplicationTest.java | df55a6b90edad25d8b802df38be74136095896da | [] | no_license | BinYangXian/AndroidStudioProjects | 86791a16b99570aeb585524f03ccea3d3360596a | 9438f0271625eb30de846bb3c2e8f14be2cf069c | refs/heads/master | 2020-12-25T09:57:45.860434 | 2016-07-30T02:27:12 | 2016-07-30T02:27:12 | 62,277,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.jikexueyuan.playmp3correctly;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"350852832@qq.com"
] | 350852832@qq.com |
e3e1063c77a54b7705ab698cb8ffe4ed9e103e68 | e45e40e28b36cd825496c5a1ee26a8ad5950279b | /src/main/java/com/sk/mba/business/domain/Member.java | e870f805d603c58031790ebd29bc8258c3614ee0 | [] | no_license | changwskr/mbc | b301ffaffd23a6cb7158e8710e70d4c3e2e3c718 | 72f1b96f0fb96c5cd05a8810cc7c6d33750df43e | refs/heads/main | 2023-06-19T10:07:58.799230 | 2021-07-12T05:24:20 | 2021-07-12T05:24:20 | 384,093,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 910 | java | package com.sk.mba.business.domain;
import javax.persistence.*;
@Entity
public class Member {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; //시스템에 저장하기 위해 사용하는 키값
@Column(name = "name") // 데이타베이스의 컬럼명이 name과 매핑된다.
private String name; //이름은 고객이 직접 화면에서 올려준다.
@Column(name = "juso") // 데이타베이스의 컬럼명이 juso와 매핑된다.
private String juso;
public String getJuso() {
return juso;
}
public void setJuso(String juso) {
this.juso = juso;
}
// alt+insert
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"changwskr@naver.com"
] | changwskr@naver.com |
8c3eb440edd1813084767ba22a53a0c887328cf5 | 0baf93547e1fc2420f226add8f6c0b5f9f95fc32 | /.svn/pristine/8c/8c3eb440edd1813084767ba22a53a0c887328cf5.svn-base | 8636210d999b543869e323b5b85f7b221e6761a1 | [] | no_license | wlqja36/pds | f69657d58f129824ebfa70eccf9cfba9b74b5b86 | dfd4197b4123cabc2efa9598307af0cb139b54c2 | refs/heads/master | 2023-08-30T02:49:13.346395 | 2021-11-15T08:14:41 | 2021-11-15T08:14:41 | 428,175,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | package nexacro.sample.service.dao.ibatis.btrip_detail;
import java.util.List;
import nexacro.sample.vo.UserVO;
import nexacro.sample.vo.btripVO.Btrip_ManagementVO;
import nexacro.sample.vo.btrip_detailVO.Btrip_detailVO;
import org.springframework.stereotype.Repository;
import com.nexacro.spring.dao.ibatis.NexacroIbatisAbstractDAO;
/**
* Test를 위한 DAO Sample Class
*
* @author Park SeongMin
* @since 08.12.2015
* @version 1.0
* @see
*/
@Repository("btr_DetailDAO")
public class Btr_DetailDAO extends NexacroIbatisAbstractDAO {
public List<Btrip_detailVO> selectUserVOList(Btrip_detailVO searchVO) {
return (List<Btrip_detailVO>) list("btrip_detail.selectbtrVOList", searchVO);
}
public void insertUserVO(Btrip_detailVO btrdetail) {
insert("btrip_detail.insertbtrVOList", btrdetail);
}
public void updateUserVO(Btrip_detailVO btrdetail) {
update("btrip_detail.updatebtrVOList", btrdetail);
}
public void deleteUserVO(Btrip_detailVO btrdetail) {
delete("btrip_detail.deletebtrVOList", btrdetail);
}
}
| [
"wlqja36@naver.com"
] | wlqja36@naver.com | |
54c5717c9be4bfa2595f6cd5a5927968011dfa8e | 6117cc2c481355d20b25a47e1d557609b784ac75 | /src/main/java/interview/bean/Invoice.java | 0f9b48cf94f585ad6467afa25dad82b6fb284c38 | [] | no_license | kocko/interview | 4a7b1d9926746c55cfdd031aab2c55911a434ec6 | eb374d691f1d181797624d0f479a836e2f9f2113 | refs/heads/master | 2021-01-19T13:50:28.817760 | 2014-11-20T13:54:31 | 2014-11-20T13:54:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,354 | java | package interview.bean;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
@XmlRootElement
public class Invoice {
private String id;
private String invoiceNo;
private String buyer;
private BigDecimal amount;
private String currency;
private String purchaseOrder;
private String invoiceImage;
private String imageName;
private Integer itemNumber;
private BigDecimal itemAmount;
private Double quantity;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getInvoiceNo() {
return invoiceNo;
}
@XmlElement(name = "invoice_number")
public void setInvoiceNo(String invoiceNo) {
this.invoiceNo = invoiceNo;
}
public String getBuyer() {
return buyer;
}
public void setBuyer(String buyer) {
this.buyer = buyer;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getPurchaseOrder() {
return purchaseOrder;
}
@XmlElement(name = "purchase_order")
public void setPurchaseOrder(String purchaseOrder) {
this.purchaseOrder = purchaseOrder;
}
public String getInvoiceImage() {
return invoiceImage;
}
@XmlTransient
public void setInvoiceImage(String invoiceImage) {
this.invoiceImage = invoiceImage;
}
public String getImageName() {
return imageName;
}
@XmlElement(name = "image_name")
public void setImageName(String imageName) {
this.imageName = imageName;
}
public Integer getItemNumber() {
return itemNumber;
}
@XmlElement(name = "item_number")
public void setItemNumber(Integer itemNumber) {
this.itemNumber = itemNumber;
}
public BigDecimal getItemAmount() {
return itemAmount;
}
@XmlElement(name = "item_amount")
public void setItemAmount(BigDecimal itemAmount) {
this.itemAmount = itemAmount;
}
public Double getQuantity() {
return quantity;
}
public void setQuantity(Double quantity) {
this.quantity = quantity;
}
}
| [
"konstantin.yovkov@gmail.com"
] | konstantin.yovkov@gmail.com |
648e0d405b3cc4a8ad73f8fa666286217dde304b | 8f79c7405212d947a945b3093363865462e92008 | /src/Catalog/WriteToFile.java | 49b868ab7b11d842077130df230788b78ac43cf6 | [] | no_license | AnaMariaAvram/JavaProject | ef8b7b336174d35050d193356e06ee11c7929111 | 5347f6d5accd2d51b9eb96a07177e7b6feec2718 | refs/heads/main | 2023-05-04T09:26:16.672176 | 2021-05-26T16:25:44 | 2021-05-26T16:25:44 | 353,317,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,403 | java | package Catalog;
import Catalog.Exceptions.FileWritingException;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
public class WriteToFile {
public static void writeUsingFileOutputStream(String text, String path) throws FileWritingException {
try (FileOutputStream out = new FileOutputStream(path)) {
out.write(text.getBytes());
} catch (IOException e) {
throw new FileWritingException("Something went wrong in writeUsingFileOutputStream method", e);
}
}
public static void writeUsingFileWriter(String text, String path) throws FileWritingException {
try (FileWriter fileWriter = new FileWriter(path)) {
fileWriter.append(text);
} catch (IOException e) {
throw new FileWritingException("Something went wrong in writeUsingFileWriter method", e);
}
}
public static void writeUsingBufferedOutputStream(String text, String path) throws FileWritingException {
try (BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(
new FileOutputStream(path))) {
bufferedOutputStream.write(text.getBytes());
} catch (IOException e) {
throw new FileWritingException("Something went wrong in writeUsingBufferedOutputStream method", e);
}
}
}
| [
"62396340+AnaMariaAvram@users.noreply.github.com"
] | 62396340+AnaMariaAvram@users.noreply.github.com |
b995a9ca2e9b8b167c6a9240ddbff1ad1a8b23c8 | 5774d0e6dd58f9b83939eb77b0c0b38edb091e65 | /src/m0/e2/Main.java | a027af6f5ecabb78ac8e3ba3ac2c9066723a03ed | [] | no_license | DDBull/generics101 | ed09aa57bcf508678571fb3bf74b13509f879d69 | cdf0ea991682d4d93a15973ab23dde0b7fe4d27f | refs/heads/main | 2023-04-26T11:03:40.482177 | 2021-05-16T13:54:04 | 2021-05-16T13:54:04 | 367,865,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package m0.e2;
public class Main {
public static void main(String[] args) {
Tuple2<Long, String> stringTuple2 = new Tuple2<>(12L, "Slava");
System.out.println(stringTuple2.getLeft() + 21L);
}
}
| [
"dyussupov.d@gmail.com"
] | dyussupov.d@gmail.com |
f6500c5594e2b53b8d919c9f4eefba35286f7be9 | c4118fc097fc8d906598417df6b11753f2f20ce2 | /src/test/java/pages/LoginPage.java | 409ea4430d5a6aa14ca257fed454eafb1b280555 | [] | no_license | cavac96/uiChallenge | 163f095f8601e00d780b78e500f0b246efe59f33 | b3522052469861f8abf37e44a2a45146ed3e9eb9 | refs/heads/master | 2020-04-27T19:39:09.744200 | 2019-03-26T16:09:10 | 2019-03-26T16:09:10 | 174,628,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,077 | java | package pages;
import models.User;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class LoginPage extends BasePage {
@FindBy(id = "username")
private WebElement usernameField;
@FindBy(id = "password")
private WebElement passwordField;
@FindBy(id = "login")
private WebElement loginButton;
public LoginPage(WebDriver webDriver) {
super(webDriver);
}
public HomePage fillInForm(User user) {
getWebDriverFacade().waitForInvisiblePageLoader();
waitForForm();
usernameField.sendKeys(user.getUsername());
passwordField.sendKeys(user.getPassword());
clickOnButton();
return PageFactory.initElements(getWebDriverFacade().getWebDriver(), HomePage.class);
}
public void clickOnButton() {
loginButton.click();
}
public void waitForForm() {
getWebDriverFacade().waitForVisibilityOfElement(usernameField);
getWebDriverFacade().waitForVisibilityOfElement(passwordField);
getWebDriverFacade().waitForVisibilityOfElement(loginButton);
}
public String getModalText() {
//By modalLocation = By.xpath(Paths.LOGIN_MODAL_TEXT);
By modalLocation = By.xpath("//div[@class='modal-body' and contains(text(), 'Usuario y/o')]");
getWebDriverFacade().waitForVisibilityOfElementLocated(modalLocation);
WebElement modalContent = getWebDriverFacade().findElementByLocator(modalLocation);
return modalContent.getText();
}
public WebElement getModalButton() {
//By modalLocation = By.xpath(Paths.LOGIN_MODAL_BUTTON);
By modalLocation = By.xpath("//button[contains(text(), 'Intentar de Nuevo')]");
getWebDriverFacade().waitForElementLocatedToBeClickable(modalLocation);
return getWebDriverFacade().findElementByLocator(modalLocation);
}
public void acceptModal() {
getModalButton().click();
}
}
| [
"cavac96@gmail.com"
] | cavac96@gmail.com |
7705867f8ac09324366395da9f01e213c603eaf9 | ce8d20d737fc6cf6aad246449c01fd959df2901f | /BanqueSI/src/main/java/org/glsid/entities/CompteCourant.java | c7ac3ead75965d2712a479e03f0eda08873c1d08 | [] | no_license | maradjah/BanqueSI | af9d48d2fd1dc85032a730e5d8a79ff9f370a506 | 1ab060f8e5d57dd66a6d9c8372f903217dda634a | refs/heads/master | 2021-06-28T03:56:44.117709 | 2017-09-14T18:15:41 | 2017-09-14T18:15:41 | 103,566,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package org.glsid.entities;
import java.util.Date;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlType;
@Entity
@DiscriminatorValue("CC")
@XmlType(name = "CC")
public class CompteCourant extends Compte {
private double decouvert;
public double getDecouvert() {
return decouvert;
}
public void setDecouvert(double decouvert) {
this.decouvert = decouvert;
}
public CompteCourant(String codeCompte, Date dateCreation, double solde,
double decouvert) {
super(codeCompte, dateCreation, solde);
this.decouvert = decouvert;
}
public CompteCourant() {
super();
// TODO Auto-generated constructor stub
}
}
| [
"erradja.marwane@gmail.com"
] | erradja.marwane@gmail.com |
b40eac2a9bf1532b4b20fdfcf88fcbc95f30e1b6 | fc435f02a7fe09497f722ca0fce77d16dcbd0dc6 | /src/by/it/kudelich/lesson06/TaskC1.java | 4f257b729a9e51fccd2d743b477fc31057aef7f4 | [] | no_license | DaryaLoban/cs2018-01-08 | 28b1f5c9301c3b1d0f6ad50393d9334f8b6215a6 | 4d3e626861d9ed3f00c8e48afd4272e379a3344c | refs/heads/master | 2021-05-13T20:49:34.129814 | 2018-01-21T23:05:11 | 2018-01-21T23:05:11 | 116,920,507 | 0 | 0 | null | 2018-01-10T06:58:55 | 2018-01-10T06:58:55 | null | UTF-8 | Java | false | false | 1,460 | java | package by.it.kudelich.lesson06;
/*
Доработайте класс Dog.
1) Добавьте два новых поля с геттерами и сеттерми (!!!!)
private int weight; //вес собаки
private double power; //сила укуса собаки
2) Напишите экземплярный метод в классе Dog
boolean win(Dog otherDog)
{... тело метода...}
который рассчитывает, кто из двух собак победит эта (this) или та (otherDog).
Расчет должен быть таким.
Шансы на победу = 0.2 * возраст + 0.3 * вес + 0.5 * силу укуса.
Побеждает та собака, у которой больше шансов на победу.
Если победила эта (this), то метод win возвращает true, иначе false
3) Проверка.
В классе TaskC1 с клавиатуры через Scanner вводятся две собаки в формате
кличка возраст вес сила
кличка возраст вес сила
(всего получается 8 чтений разных данных)
Создайте этих собак, определите победителя с помощью созданного
в классе Dog метода boolean win(Dog dog).
Напечатайте кличку победителя.
*/
public class TaskC1 {
}
| [
"kudeliches@gmail.com"
] | kudeliches@gmail.com |
a3301fea44fc4c7bad061d0fe286d0ba313921a2 | cd6f9c0f342a9317bb38246f46aa65047d3eccf3 | /ITAcademyJAVA/src/by/sugako/lesson11/aboutInterfaces/Payable.java | 0a10f27fcca7324fc370c48aa4535a85a11baa93 | [] | no_license | Tzeentche/studentChecker | df4d6cef12769765a0d94fcf93c990372f579fca | 21bba27b3238f9d86d538010027ff0358b35d479 | refs/heads/master | 2023-06-30T00:28:05.017226 | 2023-06-20T18:45:02 | 2023-06-20T18:45:02 | 343,214,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package by.sugako.lesson11.aboutInterfaces;
public interface Payable {
void pay();
}
| [
"ilyasugako87@gmail.com"
] | ilyasugako87@gmail.com |
9ada4149201e9b87bf56698b164bb00ca012c73c | 6b34e9f52ebd095dc190ee9e89bcb5c95228aed6 | /l2gw-core/highfive/loginserver/java/ru/l2gw/extensions/ccpGuard/login/crypt/ProtectionCrypt.java | b7c511496114921bb704036c7e1ad3c1ca90268d | [] | no_license | tablichka/play4 | 86c057ececdb81f24fc493c7557b7dbb7260218d | b0c7d142ab162b7b37fe79d203e153fcf440a8a6 | refs/heads/master | 2022-04-25T17:04:32.244384 | 2020-04-27T12:59:45 | 2020-04-27T12:59:45 | 259,319,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,683 | java | package ru.l2gw.extensions.ccpGuard.login.crypt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import ru.l2gw.extensions.ccpGuard.ConfigProtect;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.StringTokenizer;
/**
* @author: rage
* @date: 03.03.12 16:28
*/
public class ProtectionCrypt
{
private static final Log _log = LogFactory.getLog(ProtectionCrypt.class.getSimpleName());
private static byte [] KeyData = new byte[272];
int x;
int y;
byte[] state = new byte[256];
final int arcfour_byte()
{
int x;
int y;
int sx, sy;
x = (this.x + 1) & 0xff;
sx = (int) state[x];
y = (sx + this.y) & 0xff;
sy = (int) state[y];
this.x = x;
this.y = y;
state[y] = (byte) (sx & 0xff);
state[x] = (byte) (sy & 0xff);
return (int) state[((sx + sy) & 0xff)];
}
public void setModKey(int key)
{
byte[] bKey = new byte[16];
intToBytes(getValue((byte) (key & 0xff)), bKey, 0);
intToBytes(getValue((byte) (key >> 0x08 & 0xff)), bKey, 4);
intToBytes(getValue((byte) (key >> 0x10 & 0xff)), bKey, 8);
intToBytes(getValue((byte) (key >> 0x18 & 0xff)), bKey, 12);
setKey(bKey);
}
public synchronized void doCrypt(byte[] src, int srcOff, byte[] dest, int destOff, int len)
{
int end = srcOff + len;
for(int si = srcOff, di = destOff; si < end; si++, di++)
dest[di] = (byte) (((int) src[si] ^ arcfour_byte()) & 0xff);
}
public void setKey(byte[] key)
{
int t, u;
int counter;
this.x = 0;
this.y = 0;
for(counter = 0; counter < 256; counter++)
state[counter] = (byte) counter;
int keyindex = 0;
int stateindex = 0;
for(counter = 0; counter < 256; counter++)
{
t = (int) state[counter];
stateindex = (stateindex + key[keyindex] + t) & 0xff;
u = (int) state[stateindex];
state[stateindex] = (byte) (t & 0xff);
state[counter] = (byte) (u & 0xff);
if(++keyindex >= key.length)
keyindex = 0;
}
}
public static int bytesToInt(byte[] array, int offset)
{
return (((int) array[offset++] & 0xff) | (((int) array[offset++] & 0xff) << 8) | (((int) array[offset++] & 0xff) << 16) | (((int) array[offset++] & 0xff) << 24));
}
public static void intToBytes(int value, byte[] array, int offset)
{
array[offset++] = (byte) (value & 0xff);
array[offset++] = (byte) (value >> 0x08 & 0xff);
array[offset++] = (byte) (value >> 0x10 & 0xff);
array[offset++] = (byte) (value >> 0x18 & 0xff);
}
public static int getValue(int idx)
{
return bytesToInt(KeyData, idx & 0xFF);
}
public static void loadProtectData()
{
if(!ConfigProtect.PROTECT_LOGIN_ANTIBRUTE)
return;
LineNumberReader reader = null;
try
{
File file = new File("config/loginprotect.key");
if(!file.exists())
{
_log.warn("ProtectManager: file config/loginprotect.key not found!");
return;
}
reader = new LineNumberReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
String line;
int i = 0;
while((line = reader.readLine()) != null)
{
StringTokenizer st = new StringTokenizer(line);
while(st.hasMoreTokens())
{
int l = Integer.decode(st.nextToken());
KeyData[i] = (byte) l;
i++;
}
}
}
catch(Exception e)
{
_log.warn("ProtectManager: error while reading config/loginprotect.key " + e);
e.printStackTrace();
}
finally
{
try
{
if(reader != null)
reader.close();
}
catch(Exception e2)
{
// nothing
}
}
}
}
| [
"ubuntu235@gmail.com"
] | ubuntu235@gmail.com |
72b55313f3c5b5ec0b45d9ee79e12649fd0274c4 | 0a5b58b35f58e9ee171f6412b936444a41b1b5cb | /app/src/main/java/com/qiu/base/sample/binder/SimpleBinder.java | 4260f36592771d6f31c09434b96e964062b0d66b | [] | no_license | QiuZhiyuan/CommonBase | d11f45d72152bc3e5deab024127c07d2b9cf189d | 61e38307036266a2b3bbe936d35ba70d6444fca4 | refs/heads/master | 2023-07-27T21:15:57.361691 | 2021-09-08T08:45:55 | 2021-09-08T08:54:40 | 274,591,919 | 0 | 0 | null | 2020-09-11T14:56:54 | 2020-06-24T06:24:40 | Java | UTF-8 | Java | false | false | 946 | java | package com.qiu.base.sample.binder;
import android.os.Binder;
import android.os.Parcel;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.qiu.base.lib.tools.Logger;
public class SimpleBinder extends Binder {
public static final int REMOTE_CODE = 100;
@Override
protected boolean onTransact(int code, @NonNull Parcel data, @Nullable Parcel reply, int flags)
throws RemoteException {
switch (code) {
case REMOTE_CODE:
int a = data.readInt();
int b = data.readInt();
int result = (a + b) * 2;
if (reply != null) {
reply.writeInt(result);
}
Logger.d("Simple binder a:" + a + " b:" + b + " result:" + result);
return true;
}
return super.onTransact(code, data, reply, flags);
}
}
| [
"845026103@qq.com"
] | 845026103@qq.com |
0b13f28f6021aaf3b0c065264119d0aad957e341 | fda08c2cbfd0cdbdb56c29d3dcfa517d5e8cfab8 | /src/NewPcapAnalyzer.java | 62121e8aff980cf2f765d6ffd3d7559339b76a67 | [] | no_license | Parmida93/Network-Project | 5974428d93d591460d48f1ca0d7f95c38e96081a | c5f0abbfaa6d908599dba9cfde7df3950ffe6d02 | refs/heads/master | 2020-12-24T21:28:22.911082 | 2016-05-14T22:48:04 | 2016-05-14T22:48:04 | 57,175,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,885 | java | import org.jnetpcap.packet.PcapPacket;
import org.jnetpcap.protocol.network.Ip4;
import org.jnetpcap.protocol.tcpip.Tcp;
import org.jnetpcap.protocol.tcpip.Udp;
public class NewPcapAnalyzer {
public MyPacket createTCPPacket(PcapPacket packet,MyPacket myPacket, int IPHeaderStartPoint, int counter, MyPcapAnalyzer myPcapAnalyzer, long initTime){
int last4Bit = 0x000F;
int temp = packet.getByte(IPHeaderStartPoint) & last4Bit;
int IPHeaderSize = temp * 4;
int TCPHeaderStartPoint = IPHeaderStartPoint + IPHeaderSize;
// myPacket.setID(counter);
myPacket.setSourcePort(packet.getByteArray(TCPHeaderStartPoint , 2) );
myPacket.setDestPort(packet.getByteArray(TCPHeaderStartPoint + 2 , 2) );
myPacket.setSeqNum(packet.getByteArray(TCPHeaderStartPoint + 4 , 4) );
myPacket.setAckNum(packet.getByteArray(TCPHeaderStartPoint + 8 , 4) );
myPacket.setWindowSize(packet.getByteArray(TCPHeaderStartPoint + 14 , 2) );
int first4Bit = 0x00F0;
temp = packet.getByte(TCPHeaderStartPoint + 12);
temp = (temp & first4Bit) >> 4;
int TCPHeaderSize = temp * 4;
myPacket.setDataLen(packet.getByteArray(IPHeaderStartPoint + 2 , 2), IPHeaderSize, TCPHeaderSize);
Tcp tcp = new Tcp();
packet.hasHeader(tcp);
// myPacket.setTotalSize(tcp.getLength());
myPacket.setDataLen(tcp.getPayloadLength() + tcp.getPostfixLength());
myPacket.setHeaderSize(tcp.getHeaderLength());
byte typeByte = packet.getByte(TCPHeaderStartPoint + 13);
Integer[] typeIndexes = myPcapAnalyzer.typeDetector(typeByte);
myPacket.setType(typeIndexes);
if( (typeIndexes[0] == 6) || (typeIndexes.length > 1 && typeIndexes[1] == 6 ) ){
byte[] MSS = packet.getByteArray(TCPHeaderStartPoint + 22 , 2);
myPacket.setMMS(Integer.parseInt(myPacket.toDecimal(MSS)));
}
return myPacket;
}
public MyPacket createUDPPacket(PcapPacket packet,MyPacket myPacket, long initTime){
Udp udp = new Udp();
if(packet.hasHeader(udp)){
myPacket.setSourcePort(udp.source());
myPacket.setDestPort(udp.destination());
myPacket.setDataLen(udp.length() - udp.getHeaderLength());
myPacket.setHeaderSize(udp.getHeaderLength());
// myPacket.setHe
// JNetPcapFormatter.
// udp.getHeader();
}
return myPacket;
}
public MyPacket setIPLayer(PcapPacket packet,MyPacket myPacket, long initTime){
Ip4 ip = new Ip4();
if (packet.hasHeader(ip)) {
myPacket.setSourceIP(ip.source());
myPacket.setDestIP(ip.destination());
}
long currentTime = packet.getCaptureHeader().timestampInMicros();
myPacket.setAbsoluteTime(currentTime);
myPacket.setTime(currentTime - initTime);
Integer[] arr = {8};
myPacket.setType(arr);
// myPacket.setTotalSize(packet.getTotalSize());
myPacket.setTotalSize(packet.size());
return myPacket;
}
}
| [
"rashidiansina@gmail.com"
] | rashidiansina@gmail.com |
4b77fb03cc736e1cea2f00e41d5cf288110f162b | e89277ec3c1b5980eed8c19939a65f2b80f2b60d | /src/org/sablecc/sablecc/semantics/Alternative.java | 2c1b81abf7a3c93d93bb4effb6471171597d0389 | [
"Apache-2.0"
] | permissive | SableCC/sablecc | b844c4e918fd09096075f1ec49f55b76e6c5b51f | 378fc74a2e8213567149a6c676d79d7630e87640 | refs/heads/master | 2023-03-11T03:44:14.785650 | 2018-09-13T01:10:02 | 2018-09-13T01:10:02 | 328,567 | 107 | 18 | Apache-2.0 | 2018-09-13T01:11:52 | 2009-10-06T14:42:08 | Java | UTF-8 | Java | false | false | 10,759 | java | /* This file is part of SableCC ( http://sablecc.org ).
*
* See the NOTICE file distributed with this work for copyright information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sablecc.sablecc.semantics;
import java.util.*;
import org.sablecc.exception.*;
import org.sablecc.sablecc.syntax3.analysis.*;
import org.sablecc.sablecc.syntax3.node.*;
public class Alternative
extends LocalDeclaration {
private Grammar grammar;
private Production production;
private AAlternative declaration;
private List<Element> elements;
private LocalNameSpace<Element> localNameSpace;
private AlternativeTransformation alternativeTransformation;
// Cached values
private boolean nameIsCached;
private String name;
private Token location;
Alternative(
Grammar grammar,
Production production,
AAlternative declaration) {
this.grammar = grammar;
this.production = production;
this.declaration = declaration;
}
@Override
public String getName() {
if (!this.nameIsCached) {
TAlternativeName alternativeName
= this.declaration.getAlternativeName();
if (alternativeName != null) {
String text = alternativeName.getText();
this.name = text.substring(1, text.length() - 2);
this.nameIsCached = true;
}
else {
Node parent = this.declaration.parent();
if (parent instanceof AParserProduction) {
AParserProduction production = (AParserProduction) parent;
if (production.getAlternatives().size() == 1) {
this.name = "";
this.nameIsCached = true;
}
}
else {
ATreeProduction production = (ATreeProduction) parent;
if (production.getAlternatives().size() == 1) {
this.name = "";
this.nameIsCached = true;
}
}
if (!this.nameIsCached) {
this.declaration.apply(new TreeWalker() {
@Override
public void caseAAlternative(
AAlternative node) {
if (node.getElements().size() == 0) {
Alternative.this.name = "empty";
Alternative.this.nameIsCached = true;
}
else {
visit(node.getElements().getFirst());
}
}
@Override
public void caseAElement(
AElement node) {
TElementName elementName = node.getElementName();
if (elementName != null) {
String text = elementName.getText();
Alternative.this.name
= text.substring(1, text.length() - 2);
Alternative.this.nameIsCached = true;
}
else {
visit(node.getElementBody());
}
}
@Override
public void caseANormalElementBody(
ANormalElementBody node) {
PUnaryOperator unaryOperator
= node.getUnaryOperator();
if (unaryOperator == null
|| unaryOperator instanceof AZeroOrOneUnaryOperator) {
visit(node.getUnit());
}
else {
// anonymous
Alternative.this.nameIsCached = true;
}
}
@Override
public void caseASeparatedElementBody(
ASeparatedElementBody node) {
// anonymous
Alternative.this.nameIsCached = true;
}
@Override
public void caseANameUnit(
ANameUnit node) {
Alternative.this.name
= node.getIdentifier().getText();
Alternative.this.nameIsCached = true;
}
@Override
public void caseAIdentifierCharUnit(
AIdentifierCharUnit node) {
String text = node.getIdentifierChar().getText();
Alternative.this.name
= text.substring(1, text.length() - 1);
Alternative.this.nameIsCached = true;
}
@Override
public void caseACharUnit(
ACharUnit node) {
// anonymous
Alternative.this.nameIsCached = true;
}
@Override
public void caseAIdentifierStringUnit(
AIdentifierStringUnit node) {
String text = node.getIdentifierString().getText();
Alternative.this.name
= text.substring(1, text.length() - 1);
Alternative.this.nameIsCached = true;
}
@Override
public void caseAStringUnit(
AStringUnit node) {
// anonymous
Alternative.this.nameIsCached = true;
}
@Override
public void caseAEndUnit(
AEndUnit node) {
Alternative.this.name = "end";
Alternative.this.nameIsCached = true;
}
});
if (!this.nameIsCached) {
throw new InternalException(
"unhandled case: " + this.declaration);
}
}
}
}
return this.name;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append(getInternalName());
sb.append(":}");
for (Element element : this.elements) {
sb.append(" " + element);
}
return sb.toString();
}
public Production getProduction() {
return this.production;
}
public List<Element> getElements() {
return this.elements;
}
public Token getLocation() {
if (this.location == null) {
this.location = this.declaration.getAlternativeName();
if (this.location == null) {
this.location = this.declaration.getEmptyKeyword();
if (this.location == null) {
AElement element
= (AElement) this.declaration.getElements().get(0);
this.location = element.getSelectionKeyword();
if (this.location == null) {
this.location = element.getElementName();
if (this.location == null) {
PElementBody pElementBody
= element.getElementBody();
if (pElementBody instanceof ANormalElementBody) {
ANormalElementBody elementBody
= (ANormalElementBody) pElementBody;
PUnit unit = elementBody.getUnit();
unit.apply(new DepthFirstAdapter() {
@Override
public void defaultCase(
Node node) {
Alternative.this.location
= (Token) node;
}
});
}
else {
ASeparatedElementBody elementBody
= (ASeparatedElementBody) pElementBody;
this.location = elementBody.getLPar();
}
}
}
}
}
}
return this.location;
}
void setElements(
List<Element> elements) {
if (this.elements != null) {
throw new InternalException("elements is already set");
}
this.elements = elements;
this.localNameSpace = new LocalNameSpace<>(elements);
}
void setDeclaredTransformation(
AlternativeTransformation alternativeTransformation) {
if (this.alternativeTransformation != null) {
Token location = this.alternativeTransformation.getLocation();
throw SemanticException.semanticError("The alternative "
+ getProduction().getName() + "." + getName()
+ " was already transformed on line " + location.getLine()
+ " char " + location.getPos() + ".",
alternativeTransformation.getLocation());
}
this.alternativeTransformation = alternativeTransformation;
}
}
| [
"egagnon@j-meg.com"
] | egagnon@j-meg.com |
b0c7c7daa1293b792c8198b8b5f2db44a0a82d57 | 59e576ec14dbf799ec55f0f603efccca756fe4f0 | /Assignment2/DataAccess/src/main/java/jdbcDAO/JPlayerDAO.java | 5a7d3b6e366893da0df664115f197fbc436e09b5 | [] | no_license | andreeacoporiie/CoporiieAndreea-SD | e2e557730a68ee7c8c0dfbc47995aec6fd12ffc5 | c4dda7748b48c221325b3e19f2bd86b944b77bb2 | refs/heads/master | 2021-04-15T08:18:31.934522 | 2018-05-28T12:38:01 | 2018-05-28T12:38:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package jdbcDAO;
import java.util.List;
import dao.PlayerDAO;
import entity.Player;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
@SuppressWarnings("restriction")
public class JPlayerDAO implements PlayerDAO {
@Override
public Player findById(int id) {
throw new NotImplementedException();
}
@Override
public void insert(Player objectToCreate) {
throw new NotImplementedException();
}
@Override
public void update(Player objectToUpdate) {
throw new NotImplementedException();
}
@Override
public void delete(Player objectToDelete) {
throw new NotImplementedException();
}
@Override
public List<Player> findAll() {
throw new NotImplementedException();
}
@Override
public Player findByMail(String mail) {
throw new NotImplementedException();
}
}
| [
"coporiie.andreea@gmail.com"
] | coporiie.andreea@gmail.com |
871a962a6fa3e177ea623470958610a0ca6b03e9 | c394ac12d0170122db96ff37c9edb84533f69aea | /app/src/main/java/com/roscasend/android/virtualphonecaller/service/CallReceiver.java | 35d5758487c14bfbd0cedc05774af71ccf6a58bb | [] | no_license | aurelianr/VirtualPhoneCaller | 00209e49beab29f5b754d83c64df4d4a082128ec | eb3d3a77643886bbab049e8d45e63b73afa29612 | refs/heads/master | 2020-09-15T09:40:05.787872 | 2016-08-26T05:57:20 | 2016-08-26T05:57:20 | 66,620,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,011 | java | package com.roscasend.android.virtualphonecaller.service;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import com.roscasend.android.virtualphonecaller.business.bean.TelephoneNumberBean;
import com.roscasend.android.virtualphonecaller.business.controller.PhoneDataController;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
public class CallReceiver extends PhonecallReceiver {
private String fullNumber = "";
private boolean isValid;
private BeeperControl beeperControl;
@Override
protected void onIncomingCallReceived(Context ctx, String number, Date start)
{
Log.i("TAG", "onIncomingCallReceived call " + number);
}
@Override
protected void onIncomingCallAnswered(Context ctx, String number, Date start)
{
Log.i("TAG", "onIncomingCallAnswered call");
}
@Override
protected void onIncomingCallEnded(Context ctx, String number, Date start, Date end)
{
Log.i("TAG", "onIncomingCallEnded call");
}
@Override
protected void onOutgoingCallStarted(final Context ctx, String number, Date start)
{
Log.i("TAG", "outgping call started " + number);
beeperControl = new BeeperControl(number);
beeperControl.beepForAnHour(ctx);
}
private void endCall(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
Class c = null;
try {
c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
Object telephonyService = m.invoke(tm); // Get the internal ITelephony object
c = Class.forName(telephonyService.getClass().getName()); // Get its class
m = c.getDeclaredMethod("endCall"); // Get the "endCall()" method
m.setAccessible(true); // Make it accessible
m.invoke(telephonyService); // invoke endCall()
} catch (ClassNotFoundException e) {
Log.e("TAG", "missed call" + e.getMessage());
} catch (NoSuchMethodException e) {
Log.e("TAG", "missed call" + e.getMessage());
} catch (InvocationTargetException e) {
Log.e("TAG", "missed call" + e.getMessage());
} catch (IllegalAccessException e) {
Log.e("TAG", "missed call" + e.getMessage());
}
}
@Override
protected void onOutgoingCallEnded(Context ctx, final String number, Date start, Date end)
{
final long time = end.getTime() - start.getTime();
Toast.makeText(ctx, "Durata apelului efectuat pentru " + number + " a fost de : " + (time /1000) +"s", Toast.LENGTH_LONG).show();
Log.i("TAG", "outgoinc call ended "+ start.getTime() + " - " + end.getTime());
TelephoneNumberBean bean = new TelephoneNumberBean();
if (time /1000 < 4) {
bean.setValid(false);
} else {
bean.setValid(true);
}
bean.setCalled(true);
bean.setNumber(number);
PhoneDataController.getInstance().addTelephoneNumbers(bean);
if (beeperControl != null ) {
beeperControl.abort();
// beeperControl.scheduler.shutdown();
}
}
@Override
protected void onMissedCall(Context ctx, String number, Date start)
{
Log.i("TAG", "missed call");
}
class BeeperControl {
private final ScheduledExecutorService scheduler =
Executors.newScheduledThreadPool(1);
private String number;
public BeeperControl (String number) {
this.number= number;
}
public void beepForAnHour(final Context ctx) {
final Runnable beeper = new Runnable() {
public void run() {
Log.e("BeeperControl", "inchid apelul pentru numarul " + number);
// abortBroadcast();
endCall(ctx);
}
};
final ScheduledFuture<?> beeperHandle =
scheduler.scheduleAtFixedRate(beeper, 0, 3, TimeUnit.SECONDS);
scheduler.schedule(new Runnable() {
public void run() { beeperHandle.cancel(true); }
}, 3, TimeUnit.SECONDS);
}
public void abort() {
if(!scheduler.isTerminated()) {
scheduler.shutdown();
}
}
}
interface ITelephony {
boolean endCall();
void answerRingingCall();
void silenceRinger();
}
}
| [
"aurelian1008@gmail.com"
] | aurelian1008@gmail.com |
c79b49dd164d7ddc51b6519cae2c8b3b8a05a232 | 5cd2c3cd32532d98f8f7b70d5f86d077c209ed6a | /swocean/src/main/java/com/dct/swocean/common/Advertising.java | d7a630ac4479244d1109ccd8b0ca86080062781a | [] | no_license | eric218/genealogy-boot1 | 6022ad3410a167fe327775bc2a32c45bde9d3fb6 | d6c1d58af82041b6ff42ba5af701b4fdd944a390 | refs/heads/master | 2020-04-02T22:00:56.211169 | 2018-11-02T10:44:24 | 2018-11-02T10:44:24 | 154,818,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | package com.dct.swocean.common;
import java.io.Serializable;
/**
*
* 家族文化和家长产业上大广告的数据和大广告地址
*
*/
public class Advertising implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String areaName; //家族地址
private String constantName; //姓氏
private String pinyin; //家族地址拼音
private String file_path; //图片地址
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getConstantName() {
return constantName;
}
public void setConstantName(String constantName) {
this.constantName = constantName;
}
public String getPinyin() {
return pinyin;
}
public void setPinyin(String pinyin) {
this.pinyin = pinyin;
}
public String getFile_path() {
return file_path;
}
public void setFile_path(String file_path) {
this.file_path = file_path;
}
}
| [
"wei.wang40@dxc.com"
] | wei.wang40@dxc.com |
3426d40fa4840c85b7dd80b5ed4de4bd0598104e | c451b265c5ed4cf2dfb80c284ca30d3a5208a750 | /src/dao/GoodsDao.java | 0c110a235f6c46f6d35fc6ea721b3d23b3d2e556 | [] | no_license | AntonioShi/project02 | 4fe2941ef9ac8d2565644188aeb871a22c6d9e14 | 95cdf6b91850422e6f53a2751f8e117ea53564ff | refs/heads/master | 2020-03-15T20:03:16.219439 | 2018-05-06T09:24:52 | 2018-05-06T09:24:52 | 132,323,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,090 | java | package dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import database.DbBean;
import bean.Good;
public class GoodsDao {
public List<Good> getAll(){
DbBean dbBean=new DbBean();
List<Good> goods=new ArrayList<Good>();
try {
ResultSet rs=dbBean.executeQuery("select * from goods");
while(rs.next()){
Good good=new Good();
good.setName(rs.getString("name"));
good.setPrice(rs.getDouble("price"));
goods.add(good);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return goods;
}
public List<Good> getAllWithDbBean(DbBean dbBean){
List<Good> goods=new ArrayList<Good>();
try {
ResultSet rs=dbBean.executeQueryWithoutConnection("select * from goods");
while(rs.next()){
Good good=new Good();
good.setName(rs.getString("name"));
good.setPrice(rs.getDouble("price"));
goods.add(good);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return goods;
}
public List<Good> getOnePage(DbBean dbBean, Integer page,Integer pageSize){
List<Good> goods=new ArrayList<Good>();
Integer start= (page-1)*pageSize;
String sql="select * from goods limit "+start.toString()+","+pageSize.toString();
try {
ResultSet rs=dbBean.executeQueryWithoutConnection(sql);
while(rs.next()){
Good good=new Good();
good.setName(rs.getString("name"));
good.setPrice(rs.getDouble("price"));
goods.add(good);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return goods;
}
public Integer getCount(DbBean dbBean){
String sql="select count(*) as aa from goods";
Integer c=0;
try {
ResultSet rs=dbBean.executeQueryWithoutConnection(sql);
while(rs.next()){
c=rs.getInt("aa");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return c;
}
}
| [
"syc694482337@outlook.com"
] | syc694482337@outlook.com |
8f229cde80b8abbd1aa1125826527d493fb5e80c | 57d7b4f3de608fed23ada55f9c65947efbfce026 | /src/Patient.java | 2adeb6cac38e074d2e9a6c0474d6e1714367a2ac | [] | no_license | fedi-dayeg/Gestion_cabinet_medical | af14b6027215de718b9164c52a812749a2f8d74b | 879c4ac06f5d6a7963c03f0adb9777eda7bb4ac0 | refs/heads/master | 2020-05-16T14:02:25.763023 | 2019-04-23T20:31:16 | 2019-04-23T20:31:16 | 183,091,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,891 | java | import java.util.Date;
import java.util.Scanner;
public class Patient implements TGestion {
private int id;
private String nom;
private String prenom;
private String adresse;
private String dateNaissence;
private String lieuNaissence;
private String etatCivil;
/*public Patient(int id, String nom, String prenom, String adresse, String dateNaissence, String lieuNaissence, String etatCivil) {
this.id = id;
this.nom = nom;
this.prenom = prenom;
this.adresse = adresse;
this.dateNaissence = dateNaissence;
this.lieuNaissence = lieuNaissence;
this.etatCivil = etatCivil;
}*/
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public String getAdresse() {
return adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
public String getDateNaissence() {
return dateNaissence;
}
public void setDateNaissence(String dateNaissence) {
this.dateNaissence = dateNaissence;
}
public String getLieuNaissence() {
return lieuNaissence;
}
public void setLieuNaissence(String lieuNaissence) {
this.lieuNaissence = lieuNaissence;
}
public String getEtatCivil() {
return etatCivil;
}
public void setEtatCivil(String etatCivil) {
this.etatCivil = etatCivil;
}
public void afficher(){
System.out.println("ID: " + this.getId());
System.out.println("Nom: " + this.getNom());
System.out.println("Prenom: " + this.getPrenom());
System.out.println("Adresse: " + this.getAdresse());
System.out.println("Date de Naissence: " + this.getDateNaissence());
System.out.println("Lieu De Naissence: " + this.getLieuNaissence());
System.out.println("Etat Civile: " + this.getEtatCivil());
}
public void cree(){
Scanner sc = new Scanner(System.in);
System.out.println("Donner Id: ");
this.id = sc.nextInt();
System.out.println("Donner le Nom");
this.nom = sc.next();
System.out.println("Donner le Prenom");
this.prenom = sc.next();
System.out.println("Donner le Adresse");
this.adresse = sc.next();
System.out.println("Donner le Date de Naissence");
this.dateNaissence = sc.next();
System.out.println("Donner le Lieu de Naissence");
this.dateNaissence = sc.next();
System.out.println("Donner Etat Civile");
this.dateNaissence = sc.next();
}
}
| [
"fedi.dayeg@hotmail.com"
] | fedi.dayeg@hotmail.com |
d7aaa9d820b751fbb52f8f4236d836dd18ca4fc8 | b0326909d51962e62436c8f39ca1cb1c36f62108 | /app/com/fixit/model/group/GroupFactory.java | a8fc7293644ebdb5390b3eab6b3470bb1776a460 | [
"Apache-2.0"
] | permissive | alefebvre-fixit/fixit | 6560a799c3a1f29c24a2a10d5a5ecd7aec94816f | 73b6683b87213635336395170695b523f1e941c8 | refs/heads/master | 2020-05-29T23:10:35.689066 | 2017-07-21T15:42:10 | 2017-07-21T15:42:10 | 26,295,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.fixit.model.group;
import java.util.Date;
import com.fixit.model.user.YaUser;
public class GroupFactory {
public static final Group createGroup(YaUser user) {
Group result = new Group();
result.setCreationDate(new Date());
result.setModificationDate(result.getCreationDate());
result.setUsername(user.getUsername());
result.getSponsors().add(user.getUsername());
result.setCity(user.getProfile().getCity());
result.setCountry(user.getProfile().getCountry());
return result;
}
}
| [
"antoinelefebvre@gmail.com"
] | antoinelefebvre@gmail.com |
412b7e46962761e5b3cc45c35c1bab8e9ba1c97b | e3de66c885365f9b9ca06899a5cf5e6add778bc1 | /WON-HO/UI/app/src/test/java/kr/co/ipdisk/home35/ui/ExampleUnitTest.java | dca1aa4957185e417185893c0dbb312c1a469b0b | [] | no_license | boncheul92nd/PRIMA | c02f5c4f96a829d815ce5231b5f51d203626463b | 5af84c590dce8d63a994cf661e77c02ae5bd0c66 | refs/heads/master | 2021-01-01T19:05:28.087210 | 2017-11-23T11:58:53 | 2017-11-23T11:58:53 | 98,505,849 | 0 | 0 | null | 2017-10-18T02:21:34 | 2017-07-27T07:17:43 | JavaScript | UTF-8 | Java | false | false | 400 | java | package kr.co.ipdisk.home35.ui;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"wonho.park83@gmail.com"
] | wonho.park83@gmail.com |
a101c035593d82773e966d804bb7f579ceac9b22 | 2f9fd52388f307150ae98f6b0aacacbc2f740458 | /src/main/java/com/pyhis/orgmanagment/controller/UserController.java | e029df0870e2e935a7f3eb48b0827e4b50cde137 | [] | no_license | pangsonyo/phis3.0 | 99ddb007e2ed7641187a2d7036819fd99b0adca8 | 095002f93bc0d00906b516c09967d8810821c5e9 | refs/heads/master | 2020-03-25T18:34:52.539761 | 2018-09-11T09:22:22 | 2018-09-11T09:22:22 | 144,038,152 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,598 | java | package com.pyhis.orgmanagment.controller;
import com.pyhis.orgmanagment.VO.ResultVO;
import com.pyhis.orgmanagment.common.Const;
import com.pyhis.orgmanagment.config.RedisService;
import com.pyhis.orgmanagment.entity.User;
import com.pyhis.orgmanagment.service.UserService;
import com.pyhis.orgmanagment.utils.CookieUtil;
import com.pyhis.orgmanagment.utils.JsonUtil;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@RestController
@RequestMapping("user")
@Log4j2
public class UserController {
@Autowired
UserService userService;
@Autowired
RedisService redisService;
@GetMapping("login")
public ResultVO<User> login(String userName, String password, HttpSession session, HttpServletResponse response) {
ResultVO<User> user = userService.login(userName, password);
if (user.isSuccess()) {
// CookieUtil.writeLoginToken(response, session.getId());
// CookieUtil.readLoginToken(request);
// CookieUtil.delLoginToken(request,response);
// redisService.setEx(session.getId(), JsonUtil.obj2String(user.getData()), Const.RedisCacheExtime.REDIS_SESSION_EXTIME);
// log.info("write Redis Success key:{}", session.getId());
}
return user;
}
@PostMapping("getUserInfo")
public ResultVO<User> getUserInfo(HttpServletRequest request) {
String loginToken = CookieUtil.readLoginToken(request);
if (StringUtils.isEmpty(loginToken)) {
return ResultVO.createByErrorMessage("用户未登陆,无法获取当前用户的信息");
}
// String userJsonStr = redisService.get(loginToken);
// User user = JsonUtil.string2Obj(userJsonStr, User.class);
// if (user != null) {
// return ResultVO.createBySuccess(user);
// }
return ResultVO.createByErrorMessage("用户未登陆,无法获取当前用户的信息");
}
@PostMapping("logout")
public ResultVO<String> logout(HttpServletRequest request, HttpServletResponse response,HttpSession session){
String loginToken = CookieUtil.readLoginToken(request);
CookieUtil.delLoginToken(request,response);
redisService.del(loginToken);
session.removeAttribute(Const.CURRENT_USER);
return ResultVO.createBySuccess();
}
}
| [
"1015614034@qq.com"
] | 1015614034@qq.com |
d68854f34599317e223d7493eb2a01a9dcf23ba7 | f4a2ed19b278475bbbe206de4995459c55455645 | /src/Main/Main.java | a26093a6f37ead8870b4f4cb394218fec313470c | [] | no_license | RamiroFX/BakerManagerOld | d667b62fe1238f9b19544eaa9b89f2a56cead7c6 | 8b13420a51bdf35677e681717f0ca096c0440d7c | refs/heads/master | 2020-04-11T13:54:35.859754 | 2016-07-14T23:19:40 | 2016-07-14T23:19:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Main;
import MenuPrincipal.MenuPrincipal;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
* @author Usuario
*/
public class Main {
/**
* @param args the command line arguments
*/
private static UIManager.LookAndFeelInfo apariencias[] = UIManager.getInstalledLookAndFeels();
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(apariencias[1].getClassName());
} catch (ClassNotFoundException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
Inicio inicio = new Inicio();
inicio.mostrarLogin();
}
}
| [
"mr.ramiro@hotmail.com"
] | mr.ramiro@hotmail.com |
de85657c9a524e115674abe886032531a5d329bb | 1e1caa4d28bb5b4e6c2b205128bee998618efc53 | /src/test/java/com/thinksee/jzoffer/J61ZigzagTest.java | 05b6742d0d96dab96902479f99b6f7a078193677 | [] | no_license | thinksee/ts-jzoffer | 95b9604719348cad7032ecb70c32ba79cfe01ec2 | 7740e01c6793cbfd6ef49688abd72198c1d3a854 | refs/heads/master | 2020-06-01T15:28:31.442997 | 2019-06-18T03:16:46 | 2019-06-18T03:16:46 | 190,834,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package com.thinksee.jzoffer;
import org.junit.Test;
public class J61ZigzagTest {
@Test
public void testExample(){
}
}
| [
"tzoezftf@gmail.com"
] | tzoezftf@gmail.com |
c7a5af4cbaddc46ad6826c52bcd1404eef22ac12 | de1cda237890a0d7a66cda2188caef3efcedd6f6 | /yaya/jbms/src/test/java/ActiveCodeTest.java | b7269b7acfa3e084c7361f03cad475730c957697 | [] | no_license | gewuxy/jx_backend | 98525725d8e7af1728d1753f1444f4b56779db6e | 7d6f24e45f8f8ca05d76b5f147b607b5b33fb04b | refs/heads/master | 2021-04-09T10:18:28.607080 | 2018-03-13T05:36:51 | 2018-03-13T05:36:51 | 125,453,798 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | import cn.medcn.common.utils.ActiveCodeUtils;
import cn.medcn.user.model.ActiveCode;
import cn.medcn.user.service.ActiveCodeService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
/**
* Created by lixuan on 2017/5/5.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:spring-context-common.xml"})
public class ActiveCodeTest {
@Autowired
private ActiveCodeService activeCodeService;
@Test
public void testAddCode(){
for(int i=0; i < 100; i ++){
ActiveCode code = new ActiveCode();
code.setUsed(false);
code.setCode(ActiveCodeUtils.genericActiveCode());
code.setOnwerid(14);
code.setSendTime(new Date());
code.setActived(true);
activeCodeService.insert(code);
}
}
}
| [
"lixuan@medcn.cn"
] | lixuan@medcn.cn |
95178a70ebb6646d512a5863bc8d44f41e54492f | 4939a0ba3ff6e387c23e4928a7a5b707a2b41244 | /org/spongepowered/asm/mixin/Interface$Remap.java | 9fce6d0597c5caef05c18a4091e39f0d7089b18a | [] | no_license | XeonLyfe/Glow-1.0.4-Deobf-Source-Leak | 39356b4e9ec35d6631aa811ec65005a2ae1a95ab | fd3b7315a80ec56bc86dfa9db87bde35327dde5d | refs/heads/master | 2022-03-29T03:51:08.343934 | 2019-11-30T01:58:05 | 2019-11-30T01:58:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package org.spongepowered.asm.mixin;
public enum Remap
{
ALL,
FORCE(true),
ONLY_PREFIXED,
NONE;
private final boolean forceRemap;
private static final Remap[] $VALUES;
public static Remap[] values() {
return Remap.$VALUES.clone();
}
public static Remap valueOf(final String s) {
return Enum.valueOf(Remap.class, s);
}
private Remap() {
this(false);
}
private Remap(final boolean forceRemap) {
this.forceRemap = forceRemap;
}
public boolean forceRemap() {
return this.forceRemap;
}
static {
$VALUES = new Remap[] { Remap.ALL, Remap.FORCE, Remap.ONLY_PREFIXED, Remap.NONE };
}
}
| [
"57571957+RIPBackdoored@users.noreply.github.com"
] | 57571957+RIPBackdoored@users.noreply.github.com |
de8909419da7795218b674e02b55d07f0b17b283 | 11515e0d6deb632ece5602513086ee96d98d0259 | /gulimall-product/src/main/java/com/atguigu/gulimall/product/entity/SpuInfoDescEntity.java | 184af53d99569e3e3246ac3af740271670d581dd | [
"Apache-2.0"
] | permissive | bestfancc/gulimall | dda34d29e21be53cf0c8e71694653cca615c68c3 | 0fe90367c539b35b891160648a7871aba70c7b58 | refs/heads/master | 2023-04-14T02:49:54.170615 | 2021-04-20T11:37:46 | 2021-04-20T11:37:46 | 359,789,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.atguigu.gulimall.product.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* spu信息介绍
*
* @author fancc
* @email bestfancc@gmail.com
* @date 2021-03-11 15:24:05
*/
@Data
@TableName("pms_spu_info_desc")
public class SpuInfoDescEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商品id
*/
@TableId
private Long spuId;
/**
* 商品介绍
*/
private String decript;
}
| [
"729940801@qq.com"
] | 729940801@qq.com |
aa233c2c581855e2c3b43304cc36267d2466bd2d | 2bae978bf70f8d1e1e4896a9819e9ad5f95bc89f | /zuul_lab/s2g-zuul/s2g-zuul-core/src/main/java/io/spring2go/zuul/mobile/Stats.java | 0edc10d2e10dd5e81d9d8672697500d90c4191fa | [
"MIT"
] | permissive | xinlc/microservices-in-action | 00ee3843c888dee92c00f7625021ac5a5beb03f9 | 2c67bc0f029bdffca0f647a2b60541e931573273 | refs/heads/master | 2022-07-20T21:55:06.070831 | 2020-02-05T05:48:36 | 2020-02-05T05:48:36 | 212,609,078 | 1 | 0 | MIT | 2022-07-07T22:14:38 | 2019-10-03T15:06:27 | Java | UTF-8 | Java | false | false | 797 | java | package io.spring2go.zuul.mobile;
import io.spring2go.zuul.context.RequestContext;
import io.spring2go.zuul.filters.ZuulFilter;
import io.spring2go.zuul.monitoring.StatManager;
public class Stats extends ZuulFilter {
@Override
public String filterType() {
return "post";
}
@Override
public int filterOrder() {
return 20000;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
int status = ctx.getResponseStatusCode();
StatManager sm = StatManager.getManager();
sm.collectRequestStats(ctx.getRequest());
sm.collectRouteStatusStats(ctx.getRouteName(), status);
return null;
}
}
| [
"xinlichao2016@gmail.com"
] | xinlichao2016@gmail.com |
4f0b46d94da344069d37e9a65e46df05742253c7 | a4aa16911b06c1d7845c633c8dae2ef1f1430d4e | /src/cz/stanov/slick2048/GameBoardManipulator.java | 996e185cbf477664594353bc575a7920d2f8f1f0 | [] | no_license | StaNov/Slick2048 | 66eea3645ccf66bee77bcfebe923043cb05e5cce | 49341adba506d017fc7c17bbb17a2794873e8f8d | refs/heads/master | 2020-05-18T05:46:36.768709 | 2014-06-28T18:59:51 | 2014-06-28T18:59:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,388 | java | package cz.stanov.slick2048;
import cz.stanov.slick2048.gameobject.Board;
import cz.stanov.slick2048.gameobject.Tile;
import java.util.Random;
import static cz.stanov.slick2048.Constants.BOARD_SIZE;
import static cz.stanov.slick2048.Constants.INITIAL_FILLED_TILES;
public class GameBoardManipulator {
private Board board;
private Random random;
public GameBoardManipulator(Board board) {
this.board = board;
this.random = new Random();
}
public void init() {
fillBoardWithEmptyTiles(board);
for (int i = 0; i < INITIAL_FILLED_TILES; i++) {
generateNewTiles();
}
}
private void fillBoardWithEmptyTiles(Board board) {
for (int x = 0; x < BOARD_SIZE; x++) {
for (int y = 0; y < BOARD_SIZE; y++) {
board.setTileAt(x, y, Tile.emptyTile());
}
}
}
public void generateNewTiles() {
while (true) {
int x = random.nextInt(BOARD_SIZE);
int y = random.nextInt(BOARD_SIZE);
if (tileIsEmpty(x, y)) {
board.setTileAt(x,y, new Tile());
break;
// TODO přepsat bez breaku
}
}
}
public void markAllTilesAsNotMerged() {
for (int x = 0; x < BOARD_SIZE; x++) {
for (int y = 0; y < BOARD_SIZE; y++) {
board.getTileAt(x,y).setAlreadyMerged(false);
}
}
}
public boolean moveRight() {
boolean anyTileWasMoved = false;
for (int x = BOARD_SIZE - 2; x >= 0; x--) {
for (int y = 0; y < BOARD_SIZE; y++) {
boolean tileWasMoved = tryMoveTileFromTo(x, y, x+1, y);
if (tileWasMoved) {
anyTileWasMoved = true;
}
}
}
return anyTileWasMoved;
}
public boolean moveLeft() {
boolean anyTileWasMoved = false;
for (int x = 1; x < BOARD_SIZE; x++) {
for (int y = 0; y < BOARD_SIZE; y++) {
boolean tileWasMoved = tryMoveTileFromTo(x, y, x-1, y);
if (tileWasMoved) {
anyTileWasMoved = true;
}
}
}
return anyTileWasMoved;
}
public boolean moveUp() {
boolean anyTileWasMoved = false;
for (int y = 1; y < BOARD_SIZE; y++) {
for (int x = 0; x < BOARD_SIZE; x++) {
boolean tileWasMoved = tryMoveTileFromTo(x, y, x, y-1);
if (tileWasMoved) {
anyTileWasMoved = true;
}
}
}
return anyTileWasMoved;
}
public boolean moveDown() {
boolean anyTileWasMoved = false;
for (int y = BOARD_SIZE - 2; y >= 0; y--) {
for (int x = 0; x < BOARD_SIZE; x++) {
boolean tileWasMoved = tryMoveTileFromTo(x, y, x, y+1);
if (tileWasMoved) {
anyTileWasMoved = true;
}
}
}
return anyTileWasMoved;
}
private boolean tryMoveTileFromTo(int fromX, int fromY, int toX, int toY) {
if (tileIsEmpty(fromX, fromY)) {
// dont move an empty tile
return false;
}
if (toX < 0 || toY < 0 || toX >= BOARD_SIZE || toY >= BOARD_SIZE) {
// dont move an edge tile
return false;
}
Tile fromTile = board.getTileAt(fromX, fromY);
Tile toTile = board.getTileAt(toX, toY);
if (toTile.isEmpty()) {
board.setTileAt(toX,toY, fromTile);
board.setTileAt(fromX,fromY, Tile.emptyTile());
tryMoveTileFromTo(toX, toY, toX + (toX - fromX), toY + (toY - fromY));
} else if (toTile.equals(fromTile) && ! toTile.isAlreadyMerged()) {
Tile mergedTile = new Tile(toTile.getValue() * 2);
mergedTile.setAlreadyMerged(true);
board.setTileAt(toX,toY, mergedTile);
board.setTileAt(fromX,fromY, Tile.emptyTile());
} else {
return false;
}
return true;
}
private boolean tileIsEmpty(int x, int y) {
return board.getTileAt(x,y).isEmpty();
}
private boolean tileIsInMostRightColumn(int xCoordinate) {
return xCoordinate == BOARD_SIZE - 1;
}
}
| [
"stanovec@gmail.com"
] | stanovec@gmail.com |
0470ec8b0605f5964e1a1549cc31e818a7a370b2 | 998c9c606cd230a46d479bb4c106c1a05719502d | /src/main/java/com/jpademo/controller/CommonController.java | 543317b4fda6a53ba8719a4b1b7b7887bbf022b7 | [] | no_license | karunakaranG/JPAAssocitaionMapping_Springboot | 91d69a9f4d817f42c3446a6bdb37999be686452e | 8a651a3b7b477ee57dcceada8e663d45788e7aee | refs/heads/main | 2023-02-12T12:25:35.239084 | 2021-01-09T09:54:56 | 2021-01-09T09:54:56 | 328,123,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,315 | java | package com.jpademo.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jpademo.model.User;
import com.jpademo.service.UserService;
@RestController
@RequestMapping("/Commoncontroller")
public class CommonController {
@Autowired
UserService userService;
@GetMapping("/getUsers")
public String getUsers(){
return userService.getAllUsers().toString();
}
@GetMapping("/getUserByName/{name}")
public String getUserByName(@PathVariable String name) {
return userService.getUserByName(name).toString();
}
@GetMapping("/getUserByNameAndAgeAndProfession/{name}/{age}/{profession}")
public String getUserByNameAndAgeAndProfession(@PathVariable String name,@PathVariable int age,@PathVariable String profession) {
return userService.getUserByNameAndAgeAndProfession(name,age,profession).toString();
}
@GetMapping("/getUserByNameAndProfession/{name}/{profession}")
public String getUserByNameAndProfession(@PathVariable String name,@PathVariable String profession) {
return userService.getUserByNameAndProfession(name,profession).toString();
}
@GetMapping("/countByProfession/{profession}")
public long countByProfession(@PathVariable String profession) {
return userService.countByProfession(profession);
}
@DeleteMapping("/deleteByName/{name}")
public String deleteByName(@PathVariable String name) {
System.out.println(name);
return userService.deleteByName(name).toString();
}
@PutMapping("/UpdateByUserID")
public String UpdateByUserID(@RequestBody User user ) {
return userService.UpdateByUserID(user).toString();
}
@PostMapping("/insertUser")
public String insertUser(@RequestBody User user) {
return userService.insertUser(user).toString();
}
}
| [
"karunakaran12021995@gmail.com"
] | karunakaran12021995@gmail.com |
4fd5449a34f684d220440cfcc24852a5f53a97df | f81d3bb87b601505962eab833555f7b9d22f65a5 | /src/which/me/utilty/SesListener.java | ba96f580fe35a430620ac2f8d870239c9397e0ee | [] | no_license | myegdfz/ShopOnline | 556bd74daf2bd44bf618b55a6ad264a2949c275a | fed6d1d87c6d165a4d40db88f49ef541d4cc8b88 | refs/heads/master | 2020-04-27T21:50:46.774312 | 2019-03-09T16:39:03 | 2019-03-09T16:39:03 | 174,714,159 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package which.me.utilty;
import javax.servlet.annotation.WebListener;
import which.me.Bean.*;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import java.util.HashMap;
/**
* Application Lifecycle Listener implementation class SesListener
*
*/
@WebListener
public class SesListener implements HttpSessionListener {
/**
* Default constructor.
*/
public SesListener() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpSessionListener#sessionCreated(HttpSessionEvent)
*/
public void sessionCreated(HttpSessionEvent arg0) {
// TODO Auto-generated method stub
System.out.println("创建session对象");
HashMap<String, goodsBean> gwc = new HashMap<String, goodsBean>();
arg0.getSession().setAttribute("gwc", gwc);
}
/**
* @see HttpSessionListener#sessionDestroyed(HttpSessionEvent)
*/
public void sessionDestroyed(HttpSessionEvent arg0) {
// TODO Auto-generated method stub
System.out.println("销毁session对象");
}
}
| [
"myegdfz@aliyun.com"
] | myegdfz@aliyun.com |
65952226cf686267108cc6f7261fc4d322a3b557 | 72434c9e6ede452235eae81cbe88b5ef3460d32a | /Cliente/app/src/main/java/calc4fun/cliente/MessageActivity.java | 26e7127cd6fd3afc24be49a7c7c24f02793586a4 | [] | no_license | pis2016g8/proyecto2016 | ac50382f9b899b33fe2aef0a8e45360b258f21f4 | b4ddd42561cb17987ece18b05296e0e57956bb6a | refs/heads/master | 2020-07-02T07:45:28.074078 | 2016-11-21T02:46:03 | 2016-11-21T02:46:03 | 74,319,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,464 | java | package calc4fun.cliente;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
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.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import calc4fun.cliente.BussinesLayer.Controladores.ClientController;
import calc4fun.cliente.DataTypes.DataListaMensajes;
import calc4fun.cliente.DataTypes.DataMensaje;
public class MessageActivity extends AppCompatActivity {
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
private SectionsPagerAdapter mSectionsPagerAdapter;
/**
* The {@link ViewPager} that will host the section contents.
*/
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Bandeja de Mensajes");
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
/* FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});*/
}
@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_message, 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.
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment implements ListView.OnItemClickListener {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static int count = 0;
private static final String ARG_SECTION_NUMBER = "section_number";
private static List<DataMensaje> leidos = new ArrayList<DataMensaje>();
private static List<DataMensaje> nuevos = new ArrayList<DataMensaje>();
private static Fragment parteLeidos = null;
private static Fragment parteNuevos = null;
private static ListView listaMensajesLeidos = null;
private static ListView listaMensajesNuevos = null;
private int myId;
public PlaceholderFragment() {
}
/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_message, container, false);
rootView.setBackgroundResource(R.drawable.fondopantalla);
myId = getArguments().getInt(ARG_SECTION_NUMBER);
if (myId == 0)
{
parteNuevos = this;
listaMensajesNuevos = (ListView)rootView.findViewById(R.id.message_list);
listaMensajesNuevos.setOnItemClickListener(this);
//listaMensajesNuevos.setAdapter(new MessageListAdapter(this.getContext(), nuevos));
}
else
{
parteLeidos = this;
listaMensajesLeidos = (ListView)rootView.findViewById(R.id.message_list);
listaMensajesLeidos.setOnItemClickListener(this);
//listaMensajesLeidos.setAdapter(new MessageListAdapter(this.getContext(), leidos));
}
new GetMessagesTask().execute();
return rootView;
}
@Override
public void onItemClick(AdapterView parent, View view, int position, long id) {
//1 - open message
DataMensaje mensaje = (DataMensaje)parent.getItemAtPosition(position);
//ejecuto nueva activity pare leer el mensaje
Intent showMessageIntent = new Intent(getActivity(), MessageViewActivity.class );
new MarkAsReadTask().execute(new DataMensaje[]{mensaje});
showMessageIntent.putExtra("mensaje", mensaje);// se le pasa el id del mensaje o la clase directamente puesta como parseable
startActivity(showMessageIntent);
if( myId == 0){
nuevos.remove(position);
leidos.add(mensaje);
listaMensajesNuevos.setAdapter(new MessageListAdapter(parteNuevos.getContext(), nuevos));
listaMensajesLeidos.setAdapter(new MessageListAdapter(parteLeidos.getContext(), leidos));
}
//2 - change message from list if myId = 0
}
public class MessageListAdapter extends BaseAdapter{
List<DataMensaje> list;
Context context;
public MessageListAdapter(Context context, List<DataMensaje> list){
this.context = context;
this.list = list;
}
@Override
public int getCount() {
return this.list.size();
}
@Override
public Object getItem(int position) {
return this.list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.message_list_item, parent, false);
}
((TextView) convertView.findViewById(R.id.message_item_subject)).setText(list.get(position).getAsunto());
((TextView) convertView.findViewById(R.id.message_item_preview)).setText(list.get(position).getContenido());
return convertView;
}
}
private class GetMessagesTask extends AsyncTask<Void,Void,DataListaMensajes>{
public GetMessagesTask(){}
@Override
protected DataListaMensajes doInBackground(Void... params) {
try {
if (myId == 0) {
return ClientController.getInstance().getMensajesNuevos();
} else {
return ClientController.getInstance().getMensajesViejos();
}
} catch (Exception e) {
return null;
}
}
@Override
protected void onPostExecute(DataListaMensajes resultado){
if (resultado != null){
if (myId == 0){
nuevos = resultado.getMensajes();//lo cambio y luego reseteo el adapter para provocar refresh
listaMensajesNuevos.setAdapter(new MessageListAdapter(parteNuevos.getContext(), nuevos));
}
else {
leidos = resultado.getMensajes();
listaMensajesLeidos.setAdapter(new MessageListAdapter(parteLeidos.getContext(), leidos));
}
}
}
}
private class MarkAsReadTask extends AsyncTask<DataMensaje,Void,Boolean> {
public MarkAsReadTask() {
}
@Override
protected Boolean doInBackground(DataMensaje... params) {
try {
if (myId == 0) {
return ClientController.getInstance().marcarMensajeLeido(params[0].getId());
} else {
throw new Exception("Error se trato de marcar como leido un mensaje ya leido segun la interfaz");
}
} catch (Exception e) {
Log.e("MSG_NO_MARCADO", e.getMessage());
return false;
}
}
}
}
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return PlaceholderFragment.newInstance(position );
}
@Override
public int getCount() {
// Show 2 total pages.
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "NO LEIDOS";
case 1:
return "LEIDOS";
}
return null;
}
}
}
| [
"alejandro.guggeri@fing.edu.uy"
] | alejandro.guggeri@fing.edu.uy |
d7d7b12ce875cb4e49590c184906960a10fe2f4a | a5fb9a52a75533ba4d1b9cdcabeb6bcc98e2a28d | /rxflux/src/androidTest/java/com/lean/rxflux/ApplicationTest.java | a96211dd720b821ed6403498a771cfe80e04bf2b | [] | no_license | feynmanzhang/RxFlux | 7a3a5db20027be556a2bf8582b4ff7897a7731a3 | 7863a6a24ec63fe50eb68969c298eb15cda5cda6 | refs/heads/master | 2020-06-30T17:18:45.881432 | 2016-10-09T01:54:36 | 2016-10-09T01:54:36 | 65,920,228 | 2 | 0 | null | 2016-08-17T16:01:28 | 2016-08-17T15:41:13 | null | UTF-8 | Java | false | false | 346 | java | package com.lean.rxflux;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"zhangliliang@101.com"
] | zhangliliang@101.com |
11a46102cfa57385e205fa22175a1ffa2f7c7929 | c567d952fbf166b972facb150550aa1d5907df68 | /src/main/java/com/javaframwork/SpringbootWebsocketExampleApplication.java | 262e5854a711bdf2a2350e74b43f69b12db8b206 | [] | no_license | yadavgovind/springboot-websocket-example | fa1459deae66e46874ba3856e46748766274b954 | f9e9321dd1c7a4b8f63a71589a8fbd9f4e214ed0 | refs/heads/master | 2023-01-27T16:24:28.066058 | 2020-12-03T08:07:28 | 2020-12-03T08:07:28 | 316,925,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.javaframwork;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootWebsocketExampleApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootWebsocketExampleApplication.class, args);
}
}
| [
"govind.yadav@edufront.co.in"
] | govind.yadav@edufront.co.in |
bfa15dfd7657f85706ee4453419638346faffde0 | 39e32f672b6ef972ebf36adcb6a0ca899f49a094 | /dcm4jboss-all/tags/DCM4CHEE_2_17_3-RC1/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/movescu/ForwardService2.java | 7039959451ef302d7966e5ac60a8b05ee21fbfca | [
"Apache-2.0"
] | permissive | medicayun/medicayundicom | 6a5812254e1baf88ad3786d1b4cf544821d4ca0b | 47827007f2b3e424a1c47863bcf7d4781e15e814 | refs/heads/master | 2021-01-23T11:20:41.530293 | 2017-06-05T03:11:47 | 2017-06-05T03:11:47 | 93,123,541 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 22,393 | java | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is part of dcm4che, an implementation of DICOM(TM) in
* Java(TM), available at http://sourceforge.net/projects/dcm4che.
*
* The Initial Developer of the Original Code is
* Agfa-Gevaert Group.
* Portions created by the Initial Developer are Copyright (C) 2003-2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* See @authors listed below.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.dcm4chex.archive.dcm.movescu;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.Map.Entry;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.dcm4che.data.Dataset;
import org.dcm4che.data.DcmElement;
import org.dcm4che.data.DcmObjectFactory;
import org.dcm4che.dict.Tags;
import org.dcm4che.util.DTFormat;
import org.dcm4cheri.util.StringUtils;
import org.dcm4chex.archive.common.Availability;
import org.dcm4chex.archive.common.SeriesStored;
import org.dcm4chex.archive.config.DicomPriority;
import org.dcm4chex.archive.config.ForwardingRules;
import org.dcm4chex.archive.config.RetryIntervalls;
import org.dcm4chex.archive.ejb.interfaces.ContentManager;
import org.dcm4chex.archive.ejb.interfaces.ContentManagerHome;
import org.dcm4chex.archive.mbean.TemplatesDelegate;
import org.dcm4chex.archive.util.ContentHandlerAdapter;
import org.dcm4chex.archive.util.EJBHomeFactory;
import org.jboss.system.ServiceMBeanSupport;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
* @author Gunter Zeilinger <gunterze@gmail.com>
* @version $Revision: 15369 $ $Date: 2011-05-03 16:20:15 +0800 (周二, 03 5月 2011) $
* @since Apr 17, 2007
*/
public class ForwardService2 extends ServiceMBeanSupport {
private static final String FORWARD_XSL = "forward.xsl";
private static final String FORWARD_PRIORS_XSL = "forward_priors.xsl";
private static final String ALL = "ALL";
private static final String NONE = "NONE";
private static final String[] EMPTY = {};
private String[] forwardOnInstanceLevelFromAETs = EMPTY;
private final NotificationListener seriesStoredListener = new NotificationListener() {
public void handleNotification(Notification notif, Object handback) {
ForwardService2.this.onSeriesStored((SeriesStored) notif.getUserData());
}
};
private ObjectName storeScpServiceName;
private ObjectName moveScuServiceName;
private TemplatesDelegate templates = new TemplatesDelegate(this);
private boolean logForwardPriorXML = true;
private boolean ignoreNotLocalRetrievable;
public static final SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
public final String getConfigDir() {
return templates.getConfigDir();
}
public final void setConfigDir(String path) {
templates.setConfigDir(path);
}
public final ObjectName getTemplatesServiceName() {
return templates.getTemplatesServiceName();
}
public final void setTemplatesServiceName(ObjectName serviceName) {
templates.setTemplatesServiceName(serviceName);
}
public final ObjectName getMoveScuServiceName() {
return moveScuServiceName;
}
public final void setMoveScuServiceName(ObjectName moveScuServiceName) {
this.moveScuServiceName = moveScuServiceName;
}
public final ObjectName getStoreScpServiceName() {
return storeScpServiceName;
}
public final void setStoreScpServiceName(ObjectName storeScpServiceName) {
this.storeScpServiceName = storeScpServiceName;
}
public String getForwardOnInstanceLevelFromAETs() {
return forwardOnInstanceLevelFromAETs == null ? ALL
: forwardOnInstanceLevelFromAETs.length == 0 ? NONE
: StringUtils.toString(forwardOnInstanceLevelFromAETs, ',');
}
public void setForwardOnInstanceLevelFromAETs(String s) {
forwardOnInstanceLevelFromAETs = ALL.equals(s) ? null
: NONE.equals(s) ? EMPTY : StringUtils.split(s, ',');
}
private boolean isForwardOnInstanceLevelFromAET(String aet) {
if (forwardOnInstanceLevelFromAETs == null) {
return true;
}
for (int i = 0; i < forwardOnInstanceLevelFromAETs.length; i++) {
if (aet.equals(forwardOnInstanceLevelFromAETs[i]))
return true;
}
return false;
}
public boolean isLogForwardPriorXML() {
return logForwardPriorXML;
}
public void setLogForwardPriorXML(boolean logForwardPriorXML) {
this.logForwardPriorXML = logForwardPriorXML;
}
public boolean isIgnoreNotLocalRetrievable() {
return ignoreNotLocalRetrievable;
}
public void setIgnoreNotLocalRetrievable(boolean ignoreNotLocalRetrievable) {
this.ignoreNotLocalRetrievable = ignoreNotLocalRetrievable;
}
protected void startService() throws Exception {
server.addNotificationListener(storeScpServiceName,
seriesStoredListener, SeriesStored.NOTIF_FILTER, null);
}
protected void stopService() throws Exception {
server.removeNotificationListener(storeScpServiceName,
seriesStoredListener, SeriesStored.NOTIF_FILTER, null);
}
private void onSeriesStored(final SeriesStored stored) {
if (stored.getRetrieveAET() == null && ignoreNotLocalRetrievable) {
log.warn("Ignore SeriesStored notification! Reason: Series is not locally retrievable.");
return;
}
Templates tpl = templates.getTemplatesForAET(
stored.getSourceAET(), FORWARD_XSL);
if (tpl != null) {
Dataset ds = DcmObjectFactory.getInstance().newDataset();
ds.putAll(stored.getPatientAttrs());
ds.putAll(stored.getStudyAttrs());
ds.putAll(stored.getSeriesAttrs());
final Calendar cal = Calendar.getInstance();
try {
log.debug("Forward2 transform input:");
log.debug(ds);
xslt(cal, stored.getSourceAET(), stored.getRetrieveAET(), null,
ds, tpl, new DefaultHandler(){
public void startElement(String uri, String localName,
String qName, Attributes attrs) {
if (qName.equals("destination")) {
if (attrs.getValue("includePrior") == null || !scheduleMoveWithPriors(stored, attrs, cal) ) {
scheduleMove(stored.getRetrieveAET(),
attrs.getValue("aet"),
toPriority(attrs.getValue("priority")),
null,
stored.getStudyInstanceUID(),
stored.getSeriesInstanceUID(),
sopIUIDsOrNull(stored),
toScheduledTime(cal, attrs.getValue("delay")));
}
}
}
});
} catch (Exception e) {
log.error("Applying forwarding rules to " + stored + " fails:", e);
}
}
}
private boolean scheduleMoveWithPriors(final SeriesStored stored, final Attributes attrs, final Calendar cal) {
log.info("scheduleMoveWithPriors! attrs:"+attrs);
String includePriors = attrs.getValue("includePrior");
Templates tpl = templates.getTemplatesForAET(
stored.getSourceAET(), FORWARD_PRIORS_XSL);
if (tpl == null) {
log.warn("Missing forward_priors.xsl! source AET:"+stored.getSourceAET()+" includePriors:"+includePriors);
return false;
}
Properties transformParams = toTransformParams(attrs);
long delay = toScheduledTime(cal, attrs.getValue("delay"));
try {
Set<Dataset> priors = findPriors(stored, attrs);
log.debug("priors found:"+priors.size());
if (priors.isEmpty()) {
log.info("No priors found to forward!");
return false;
}
Map<String, Map<String, Set<String>>> studies = getPriorsToForward(
stored, cal, tpl, transformParams, priors);
ensureSeriesStoredInForward(stored, studies);
String retrAET = stored.getRetrieveAET();
String destAET = attrs.getValue("aet");
int priority = toPriority(attrs.getValue("priority"));
Map<String, Set<String>> series;
String studyIUID;
for ( Entry<String, Map<String, Set<String>>> studyEntry : studies.entrySet()) {
studyIUID = studyEntry.getKey();
series = studyEntry.getValue();
if (series == null || series.isEmpty()) {
scheduleMove(retrAET, destAET, priority, null, studyIUID, null, null, delay);
} else {
for (Entry<String,Set<String>> seriesEntry : series.entrySet()) {
scheduleMove(retrAET, destAET, priority, null,
studyIUID, seriesEntry.getKey(), sopIUIDsOrNull(seriesEntry.getValue()), delay);
}
}
}
return true;
} catch (Exception x) {
log.error("Failed to schedule forward with priors!", x);
return false;
}
}
private String[] sopIUIDsOrNull(Set<String> instances) {
if (instances == null || instances.isEmpty()) {
return null;
}
return instances.toArray(new String[instances.size()]);
}
private Properties toTransformParams(final Attributes attrs) {
Properties transformParams = new Properties();
for (int i = 0, len=attrs.getLength() ; i < len ; i++) {
transformParams.setProperty(attrs.getQName(i), attrs.getValue(i));
}
return transformParams;
}
private void ensureSeriesStoredInForward(final SeriesStored stored,
final Map<String, Map<String, Set<String>>> studies) {
Map<String,Set<String>> series = studies.get(stored.getStudyInstanceUID());
if (series == null) {
log.debug("Study of SeriesStored not in forwardWithPriors! Add studyIUID:"+stored.getStudyInstanceUID());
series = new HashMap<String,Set<String>>();
studies.put(stored.getStudyInstanceUID(), series);
series.put(stored.getSeriesInstanceUID(), new HashSet<String>());
}
if (series.size() > 0) {
Set<String> instances = series.get(stored.getSeriesInstanceUID());
if (instances == null || instances.isEmpty()) {
String[] iuids = sopIUIDsOrNull(stored);
if (iuids != null && iuids.length > 0) {
for (int i = 0 ; i < iuids.length ; i++) {
instances.add(iuids[i]);
}
}
}
} else {
log.debug("Study of SeriesStored has no series referenced! -> forward whole study!");
}
}
private Map<String, Map<String, Set<String>>> getPriorsToForward(
final SeriesStored stored, final Calendar cal, Templates tpl,
Properties transformParams, Set<Dataset> priors)
throws TransformerFactoryConfigurationError,
TransformerConfigurationException, SAXException, IOException {
final Map<String,Map<String,Set<String>>> studies = new HashMap<String,Map<String,Set<String>>>();
if (logForwardPriorXML ) {
FileOutputStream fos = null;
try {
File logFile = new File(System.getProperty("jboss.server.log.dir"),
"forward_prior/"+new DTFormat().format(new Date())+".xml");
logFile.getParentFile().mkdirs();
TransformerHandler thLog = tf.newTransformerHandler();
fos = new FileOutputStream(logFile);
thLog.setResult(new StreamResult(fos));
transformPrior(stored, priors, thLog);
log.info("ForwardPrior XML logged in "+logFile);
} finally {
if (fos != null) {
try {
fos.close();
} catch(Exception ignore) {}
}
}
}
TransformerHandler th = prepareTransformHandler(cal, stored.getSourceAET(), stored.getRetrieveAET(),
transformParams, tpl, new DefaultHandler() {
public void startElement(String uri, String localName,
String qName, Attributes attrs) {
if (qName.equals("forward")) {
add(studies, attrs);
}
}
});
transformPrior(stored, priors, th);
return studies;
}
private void transformPrior(final SeriesStored stored, Set<Dataset> priors,
TransformerHandler th) throws SAXException, IOException {
ContentHandlerAdapter cha = new ContentHandlerAdapter(th);
cha.forcedStartDocument();
cha.startElement("forward");
cha.startElement("seriesStored");
stored.getIAN().writeDataset2(cha, null, null, 64, null);
cha.endElement("seriesStored");
cha.startElement("priors");
for (Dataset ds : priors) {
ds.writeDataset2(cha, null, null, 64, null);
}
cha.endElement("priors");
cha.endElement("forward");
cha.forcedEndDocument();
}
private Set<Dataset> findPriors(SeriesStored stored, Attributes attrs) {
boolean instanceLevel = "INSTANCE".equals(attrs.getValue("level"));
String avail = attrs.getValue("availability");
int minAvail = avail == null ? Availability.NEARLINE : Availability.toInt(avail);
String retrAETsVal = attrs.getValue("retrAETs");
String[] retrAETs = null;
if (retrAETsVal == null) {
retrAETs = new String[]{stored.getRetrieveAET()};
} else if (retrAETsVal.trim().length() > 0 && !NONE.equals(retrAETsVal)) {
retrAETs = StringUtils.split(retrAETsVal, '\\');
}
String modalities = attrs.getValue("modalities");
String notOlderThan = attrs.getValue("notOlderThan");
Long createdAfter = null;
if (notOlderThan != null) {
createdAfter = new Long(System.currentTimeMillis()-RetryIntervalls.parseInterval(notOlderThan));
}
try {
return getContentManager().getPriorInfos(stored.getStudyInstanceUID(), instanceLevel,
minAvail, createdAfter, retrAETs, StringUtils.split(modalities, '\\'));
} catch (Exception x) {
log.error("Failed to get prior studies for seriesStored:"+stored,x);
return null;
}
}
private boolean add(Map<String,Map<String,Set<String>>> studies, Attributes attrs) {
String studyIUID = attrs.getValue("studyIUID");
if (studyIUID == null) {
log.warn("Missing studyIUID attribute in destination element of forward_priors.xsl! Ignored!");
return false;
}
Map<String,Set<String>> series = studies.get(studyIUID);
if (series == null) {
series = new HashMap<String,Set<String>>();
studies.put(studyIUID, series);
}
String seriesIUID = attrs.getValue("seriesIUID");
String iuid = attrs.getValue("iuid");
if (seriesIUID != null) {
Set<String> instances = series.get(seriesIUID);
if (instances == null) {
instances = new HashSet<String>();
series.put(seriesIUID, instances);
}
if (iuid != null) {
instances.add(iuid);
}
} else if (iuid != null) {
log.warn("forward_priors.xsl: Missing seriesIUID attribute (sop iuid:"+iuid+
")! SOP Instance UID ignored! -> Study Level");
}
return true;
}
private String[] sopIUIDsOrNull(SeriesStored seriesStored) {
int numI = seriesStored.getNumberOfInstances();
if (numI > 1 && !isForwardOnInstanceLevelFromAET(
seriesStored.getSourceAET())) {
return null;
}
String[] iuids = new String[numI];
DcmElement sq = seriesStored.getIAN().getItem(Tags.RefSeriesSeq)
.get(Tags.RefSOPSeq);
for (int i = 0; i < iuids.length; i++) {
iuids[i] = sq.getItem(i).getString(Tags.RefSOPInstanceUID);
}
return iuids;
}
private static int toPriority(String s) {
return s != null ? DicomPriority.toCode(s) : 0;
}
private long toScheduledTime(Calendar cal, String s) {
if (s == null || s.length() == 0) {
return 0;
}
int index = s.indexOf('!');
if (index == -1) {
return cal.getTimeInMillis() + RetryIntervalls.parseInterval(s);
}
if (index != 0) {
cal.setTimeInMillis(cal.getTimeInMillis()
+ RetryIntervalls.parseInterval(s.substring(0, index)));
}
return ForwardingRules.afterBusinessHours(cal, s.substring(index+1));
}
private static void xslt(Calendar cal, String sourceAET, String retrieveAET, Properties params,
Dataset ds, Templates tpl, ContentHandler ch)
throws TransformerConfigurationException, IOException {
TransformerHandler th = prepareTransformHandler(cal, sourceAET,
retrieveAET, params, tpl, ch);
ds.writeDataset2(th, null, null, 64, null);
}
private static TransformerHandler prepareTransformHandler(Calendar cal,
String sourceAET, String retrieveAET, Properties params,
Templates tpl, ContentHandler ch)
throws TransformerFactoryConfigurationError,
TransformerConfigurationException {
TransformerHandler th = tf.newTransformerHandler(tpl);
Transformer t = th.getTransformer();
t.setParameter("source-aet", sourceAET);
t.setParameter("retrieve-aet", retrieveAET);
t.setParameter("year", new Integer(cal.get(Calendar.YEAR)));
t.setParameter("month", new Integer(cal.get(Calendar.MONTH)+1));
t.setParameter("date", new Integer(cal.get(Calendar.DAY_OF_MONTH)));
t.setParameter("day", new Integer(cal.get(Calendar.DAY_OF_WEEK)-1));
t.setParameter("hour", new Integer(cal.get(Calendar.HOUR_OF_DAY)));
if (params != null) {
for (Entry<?, ?> e :params.entrySet()) {
t.setParameter((String)e.getKey(), e.getValue());
}
}
th.setResult(new SAXResult(ch));
return th;
}
private void scheduleMove(String retrieveAET, String destAET, int priority,
String pid, String studyIUID, String seriesIUID, String[] sopIUIDs,
long scheduledTime) {
try {
server.invoke(moveScuServiceName, "scheduleMove", new Object[] {
retrieveAET, destAET, new Integer(priority), pid,
studyIUID, seriesIUID, sopIUIDs, new Long(scheduledTime) },
new String[] { String.class.getName(),
String.class.getName(), int.class.getName(),
String.class.getName(), String.class.getName(),
String.class.getName(), String[].class.getName(),
long.class.getName() });
} catch (Exception e) {
log.error("Schedule Move failed:", e);
}
}
private ContentManager getContentManager() throws Exception {
ContentManagerHome home = (ContentManagerHome) EJBHomeFactory
.getFactory().lookup(ContentManagerHome.class,
ContentManagerHome.JNDI_NAME);
return home.create();
}
}
| [
"liliang_lz@icloud.com"
] | liliang_lz@icloud.com |
5d8dfe39d6a4f29b56400e32f73e1e94ef429f9b | 5cddd189b10fca6fe745b0133980d0bf5ae5a656 | /src/main/java/com/mqxu/sm/factory/ServiceFacotry.java | 731d7cfceaadf7f0bfd072f80f4e03568945ebe9 | [] | no_license | cly162/studentmanager | a59ee86e9c4578c389e3c32fb87f58be7c6a8e0a | e624ce86654fb023df75a05fc8c01610cdf43cae | refs/heads/main | 2023-01-13T13:40:56.799910 | 2020-11-26T10:51:25 | 2020-11-26T10:51:25 | 316,200,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.mqxu.sm.factory;
import com.mqxu.sm.service.AdminService;
import com.mqxu.sm.service.impl.AdminServiceImpl;
/**
* @ClassName ServiceFacotry
* @Description TODO
* @Author yoRoll.z
* @Date 2020/11/20
**/
public class ServiceFacotry {
public static AdminService getAdminServiceInstance(){
return new AdminServiceImpl();
}
}
| [
"1621592369@qq.com"
] | 1621592369@qq.com |
476403b505eb9b984fb7d5713d5e85942dbdb4da | cb963c872d93f8e05ddf7cde611d26a274d12b21 | /SnakeServidor/src/ss/SocketServidor.java | aa7f5a73dc26b8e59b2bbeb0e941389d4986b916 | [] | no_license | rperezll/SerpienteOnline | 1621c84671469f2f4ad788d571d7cad09d9a6685 | cd1cd5741098f6d03ea2e645dc54e7ec44152765 | refs/heads/master | 2021-04-30T22:43:45.967986 | 2017-06-03T11:27:11 | 2017-06-03T11:27:11 | 61,911,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,976 | java | package ss;
import java.io.*;
import java.net.*;
/**
* En esta clase se definen los metodos y funciones necesarios para la conexión con
* el cliente. Envio y interpretación de los mensajes recibidos.
* @author: ROBERTO PÉREZ LLANOS
* @version: 19/06/2016
*/
public class SocketServidor extends Thread {
int codigoCliente;
boolean parar=true;
static final int Puerto=2000;
Socket skCliente;
InputStream auxin;
DataInputStream flujo_entrada;
OutputStream auxout;
static DataOutputStream flujo_salida;
Modelo modelo;
/**
* Constructor del Socket. Crea una entidad de modelo y los correspondiente flujos
* para la correcta transmisión de datos. Además de enviar y recibir, interpreta
* los mensajes del cliente según su tipo.
*/
public SocketServidor(Socket sCliente, int codCliente) throws IOException {
this.modelo = new Modelo();
this.skCliente = sCliente;
this.codigoCliente=codCliente;
auxin = skCliente.getInputStream();
flujo_entrada= new DataInputStream( auxin );
auxout = skCliente.getOutputStream();
flujo_salida= new DataOutputStream( auxout );
}
SocketServidor(){} //Constructor vacio
/**
* Realiza el envio de los datos deseados al cliente
*/
static void enviarServidor (String mensaje) throws IOException {
flujo_salida.writeUTF(mensaje);
flujo_salida.flush();
}
/**
* Cierra los flujos de transmisión de datos con el cliente
*/
void cerrarConexion() throws IOException{
flujo_salida.close();
auxout.close();
flujo_entrada.close();
auxin.close();
skCliente.close();
}
/**
* [Thread SOCKET SERVIDOR]. Recibe los datos del cliente de forma ininterrumpida.
* Además, es aquí donde se interpretan los mensajes segú su tipo.
*/
@Override
public void run (){
try{
String mensaje="";
while (parar){
mensaje=flujo_entrada.readUTF();
String[] men = ((String) mensaje).split(";");
if (men[0].equals("REINICIAR")){
modelo.inicio();
//new SocketServidor(this.skCliente,this.codigoCliente).start();
}else if(men[0].equals("PARAR")){ //Mensaje de finalizar sesión
Modelo.parar=false;
cerrarConexion();
break;
}else if (men[0].equals("LISTO")){ //Mensaje de establecimiento de la conexión + dimensiones del tablero
Modelo.parar=true;
System.out.println("3: [Envío de las dimensiones del tablero]");
flujo_salida.writeUTF(Integer.toString(modelo.ANCHO)+";"+Integer.toString(modelo.ALTO));
modelo.inicio();
}else if (men[0].equals("DIR")){ //Mensaje de cambio de dirección
if (men[1].equals("ARRIBA")){
if (!Modelo.direccion.equals("ABAJO"))
this.modelo.setDireccion("ARRIBA");
}else if (men[1].equals("ABAJO")){
if (!Modelo.direccion.equals("ARRIBA"))
this.modelo.setDireccion("ABAJO");
}else if (men[1].equals("DERECHA")){
if (!Modelo.direccion.equals("IZQUIERDA"))
this.modelo.setDireccion("DERECHA");
}else if (men[1].equals("IZQUIERDA")){
if (!Modelo.direccion.equals("DERECHA"))
this.modelo.setDireccion("IZQUIERDA");
}
}
}
System.out.println("4: [Se ha cerrado la conexión con el cliente " + this.codigoCliente+ "]");
}catch( Exception e ) {
System.out.println( e.getMessage());
}
}
} | [
"Roberto Pérez llanos"
] | Roberto Pérez llanos |
c38d7db837c1da940012053ace8e41f5cbb3ef1f | 17ef0beedc2a0284bb727b14872ac152b8ca2a54 | /bitrafael-client/src/main/java/com/generalbytes/bitrafael/api/wallet/xmr/core/ed25519/fast/ge_p1p1_to_p3.java | 6938a2117d28d2644e6d7159f4ee0d302d46660e | [] | no_license | nmarley/bitrafael_public | 1b57c31f425ba047bd66e3fd51071ff7c2c6bd60 | e9039e41aec9f6fc7b42a162f17df64eadf4aa3b | refs/heads/master | 2020-08-08T01:45:52.567826 | 2019-09-02T09:35:07 | 2019-09-02T09:35:07 | 213,664,271 | 0 | 0 | null | 2019-10-08T14:23:15 | 2019-10-08T14:23:14 | null | UTF-8 | Java | false | false | 320 | java | package com.generalbytes.bitrafael.api.wallet.xmr.core.ed25519.fast;
public class ge_p1p1_to_p3 {
//CONVERT #include "ge.h"
/*
r = p
*/
public static void ge_p1p1_to_p3(ge_p3 r,ge_p1p1 p)
{
fe_mul.fe_mul(r.X,p.X,p.T);
fe_mul.fe_mul(r.Y,p.Y,p.Z);
fe_mul.fe_mul(r.Z,p.Z,p.T);
fe_mul.fe_mul(r.T,p.X,p.Y);
}
}
| [
"karel.kyovsky@generalbytes.com"
] | karel.kyovsky@generalbytes.com |
136cb3ece1877b307ac91c6b7d9ef61c79f9d68b | 9c6f7b933334c8ef3a511a1432323a2a263100c7 | /src/com/example/member/controller/MyLocation.java | e974def929a29498bae4bcd8833ba73630f06ce9 | [] | no_license | aperm/SampleSpring | 8c1a325a95efbddea2e036450d494886fac7e6fa | b0785b97bfbb7401014bda34a0c111e9fba94818 | refs/heads/master | 2016-08-12T04:15:57.870256 | 2015-05-30T09:18:27 | 2015-05-30T09:18:27 | 36,551,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package com.example.member.controller;
public class MyLocation {
}
| [
"aperm86@gmail.com"
] | aperm86@gmail.com |
cb55c035ec58d13a0318da6c2315d88b82565b89 | 4c7b5021a201e086e2879d36f69b03c63f6369df | /api-gateway/src/main/java/com/jacksonfang/api/controller/UserController.java | 1a70433df2f1d9a19b794e0d6071d164212b6602 | [] | no_license | cloris-cc/houses-services | 5e9ddb150d709d2eea8323531b000b631ea84c1e | ade5ad9087209795fb0aa9a5f014cb9aa8b77d49 | refs/heads/master | 2023-08-04T04:01:11.094144 | 2019-09-25T10:35:14 | 2019-09-25T10:35:14 | 207,121,805 | 0 | 0 | null | 2023-07-22T15:39:57 | 2019-09-08T14:07:43 | CSS | UTF-8 | Java | false | false | 819 | java | package com.jacksonfang.api.controller;
import com.jacksonfang.api.model.User;
import com.jacksonfang.common.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
/**
* @author Jacky
* Date: 2019/3/17
* Time: 19:10
*/
@RestController
public class UserController {
private static final String URL = "http://user-service/user";
@Autowired
RestTemplate restTemplate;
@PostMapping("/auth")
public RestResponse auth(@RequestBody User user) {
return restTemplate.postForObject(URL + "/auth", user, RestResponse.class);
}
}
| [
"clorisforcoding@gmail.com"
] | clorisforcoding@gmail.com |
5e3c03312bb4f2cf688cc7af2381c70cf1037719 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/appbrand/jsapi/g/a/a$19.java | 8857bd5d15fba14de16461e336ea50c7e5204161 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,385 | java | package com.tencent.mm.plugin.appbrand.jsapi.g.a;
import com.tencent.mapsdk.raster.model.IndoorMapPoi;
import com.tencent.mapsdk.raster.model.LatLng;
import com.tencent.mapsdk.raster.model.MapPoi;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.tencentmap.mapsdk.map.TencentMap.OnMapPoiClickListener;
final class a$19
implements TencentMap.OnMapPoiClickListener
{
a$19(a parama)
{
}
public final void onClicked(MapPoi paramMapPoi)
{
AppMethodBeat.i(51168);
if (this.hNv.hNd != null)
{
b.p localp = new b.p();
localp.latitude = paramMapPoi.getPosition().getLatitude();
localp.longitude = paramMapPoi.getPosition().getLongitude();
localp.name = paramMapPoi.getName();
if (((paramMapPoi instanceof IndoorMapPoi)) && (!bo.isNullOrNil(((IndoorMapPoi)paramMapPoi).getBuildingId())))
{
localp.buildingId = ((IndoorMapPoi)paramMapPoi).getBuildingId();
localp.floorName = ((IndoorMapPoi)paramMapPoi).getFloorName();
}
this.hNv.hNd.a(localp);
}
AppMethodBeat.o(51168);
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes2-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.appbrand.jsapi.g.a.a.19
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
4b75239fb7d21324b92e76001ff5b5f25ca9c350 | a33aac97878b2cb15677be26e308cbc46e2862d2 | /data/libgdx/btRigidBodyFloatData_getCollisionObjectData.java | 239986b8ae24d1e561dfa44264b98a6fa711fadd | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | public btCollisionObjectFloatData getCollisionObjectData() {
long cPtr = DynamicsJNI.btRigidBodyFloatData_collisionObjectData_get(swigCPtr, this);
return (cPtr == 0) ? null : new btCollisionObjectFloatData(cPtr, false);
}
| [
"bdqnghi@gmail.com"
] | bdqnghi@gmail.com |
483531be899a909c41e3b091989dd893f1845aaa | b998b375e53c0d8141db7f8e07cb01b494ed3d0a | /boot.oat_files/arm64/dex/out1/com/android/internal/os/SmartManagerProvider.java | 7079a33b2c7f46a5070b9d9e6d6c4af0cba8adb5 | [] | no_license | atthisaccount/SPay-inner-workings | c3b6256c8ed10c2492d19eca8e63f656cd855be2 | 6dd83a6ea0916c272423ea0dc1fa3757baa632e7 | refs/heads/master | 2022-03-22T04:12:05.100198 | 2019-10-06T13:25:49 | 2019-10-06T13:25:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,877 | java | package com.android.internal.os;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import com.android.internal.telephony.PhoneConstants;
public class SmartManagerProvider extends ContentProvider {
static final int ALL_PACKAGES = 1;
static final int BATTERY_DELTA = 2;
static final int PACKAGE_NAME = 4;
static final int POWER_CONSUMING_PACKAGES = 3;
static final UriMatcher uriMatcher = new UriMatcher(-1);
BatteryStatsDBHelper batteryStatsDBHelper;
static {
uriMatcher.addURI(SMProviderContract.PROVIDER_NAME, "Battery_Delta", 2);
uriMatcher.addURI(SMProviderContract.PROVIDER_NAME, "power_consuming_packages", 3);
uriMatcher.addURI(SMProviderContract.PROVIDER_NAME, PhoneConstants.APN_TYPE_ALL, 1);
}
public boolean onCreate() {
this.batteryStatsDBHelper = BatteryStatsDBHelper.getInstance(getContext());
if (this.batteryStatsDBHelper != null) {
return true;
}
return false;
}
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
Cursor cursor = null;
if (uri != null) {
synchronized (this.batteryStatsDBHelper) {
SQLiteDatabase database = this.batteryStatsDBHelper.getReadableDatabase();
BatteryStatsDBHelper batteryStatsDBHelper;
switch (uriMatcher.match(uri)) {
case 1:
String table_name = uri.getLastPathSegment();
if (!PhoneConstants.APN_TYPE_ALL.equals(table_name)) {
cursor = database.query("[" + table_name + "]", projection, selection, selectionArgs, sortOrder, null, null);
break;
}
cursor = database.rawQuery("SELECT name FROM sqlite_master WHERE type='table' AND name!='android_metadata' AND name!='Battery_Delta' AND name!='power_consuming_packages' AND name!='null' AND name!='all'", null);
break;
case 2:
batteryStatsDBHelper = this.batteryStatsDBHelper;
cursor = database.query("Battery_Delta", projection, selection, selectionArgs, sortOrder, null, null);
break;
case 3:
batteryStatsDBHelper = this.batteryStatsDBHelper;
cursor = database.query("power_consuming_packages", projection, selection, selectionArgs, sortOrder, null, null);
break;
default:
String contentURI = uri.toString();
if (contentURI.contains(SMProviderContract.URL)) {
String newURI = contentURI.replace("content://com.sec.smartmanager.provider/", "");
if (!newURI.isEmpty()) {
cursor = database.query("[" + newURI + "]", projection, selection, selectionArgs, sortOrder, null, null);
break;
}
}
throw new IllegalArgumentException("Unknown URI " + uri);
break;
}
}
}
return cursor;
}
public String getType(Uri uri) {
return null;
}
public Uri insert(Uri uri, ContentValues values) {
return null;
}
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
}
| [
"pandalion98@gmail.com"
] | pandalion98@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.