blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bb5b0f41907f375b315a5cfbdbb19075c43d2ab2 | 561e6becd0d6c85c69e9134cf5d5de96006cb7b4 | /app/src/main/java/com/systrack/admission/fragment/AttendanceManagement/ManageAttendanceFragment.java | ad2b651606586bf6b9286aabcdd166e46c9231f5 | [] | no_license | Dharaaa/admition | ea1999598cfc979913ed1865865c162d8eeb66c9 | b2fd9b3d609a5deb58b5b6989bfb00acb4547999 | refs/heads/master | 2023-07-08T14:25:47.795752 | 2021-08-09T07:04:15 | 2021-08-09T07:04:15 | 394,176,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,021 | java | package com.systrack.admission.fragment.AttendanceManagement;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.systrack.admission.Activity.ManageEmployeeCourseAllActivity;
import com.systrack.admission.Activity.ManageEmployeeDepartmentActivity;
import com.systrack.admission.Activity.ManageEmployeeMediumByCourseActivity;
import com.systrack.admission.AppController;
import com.systrack.admission.R;
import java.util.Calendar;
/**
* A simple {@link Fragment} subclass.
*/
public class ManageAttendanceFragment extends Fragment {
View view;
LinearLayout search_employee;
EditText course_edittext,medium_edittext,department_edittext,date_edittext;
AppController appController;
TextView error;
ImageView back_arrow;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragement_manage_attendance, container, false);
appController = (AppController) getActivity().getApplicationContext();
appController.setManageAttendanceSteamId(null);
appController.setManageAttendanceStreamName(null);
appController.setManageAttendanceMedium(null);
appController.setManageAttendanceDepartmetId(null);
appController.setManageAttendanceDepartmentName(null);
date_edittext=view.findViewById(R.id.date_edittext);
course_edittext=view.findViewById(R.id.course_edittext);
course_edittext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
appController.setManageAttendanceMedium(null);
appController.setManageEmpCourseFlag("ManageAttendance");
Intent i=new Intent(getActivity(), ManageEmployeeCourseAllActivity.class);
startActivity(i);
}
});
medium_edittext=view.findViewById(R.id.medium_edittext);
medium_edittext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
appController.setManageEmpMediumFlag("ManageAttendance");
Intent i=new Intent(getActivity(), ManageEmployeeMediumByCourseActivity.class);
startActivity(i);
}
});
department_edittext=view.findViewById(R.id.department_edittext);
department_edittext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
appController.setManageEmpDepartmentFlag("ManageAttendance");
Intent i=new Intent(getActivity(), ManageEmployeeDepartmentActivity.class);
startActivity(i);
}
});
date_edittext=view.findViewById(R.id.date_edittext);
date_edittext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(),new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) {
int myYear = year;
int myday = dayOfMonth;
int myMonth = monthOfYear+1;
Calendar c = Calendar.getInstance();
appController.setManageAttendanceDate(myMonth+"/"+myday+"/"+myYear);
date_edittext.setText(myday+"/"+myMonth+"/"+myYear);
}
},year, month,day);
datePickerDialog.show();
}
});
search_employee=view.findViewById(R.id.search_employee);
search_employee.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(course_edittext.getText().toString().equals("")){
error.setVisibility(View.VISIBLE);
error.setText("Course data required" );
}else if(medium_edittext.getText().toString().equals("")){
error.setVisibility(View.VISIBLE);
error.setText("Medium data required" );
}else if(department_edittext.getText().toString().equals("")){
error.setVisibility(View.VISIBLE);
error.setText("Department data required" );
}else if(date_edittext.getText().toString().equals("")){
error.setVisibility(View.VISIBLE);
error.setText("Date required" );
}else{
SearchManageAttendanceFragment coursefragment = new SearchManageAttendanceFragment();
FragmentTransaction country = getFragmentManager().beginTransaction();
country.replace(R.id.frame, coursefragment);
country.commit();
}
}
});
back_arrow=(ImageView) view.findViewById(R.id.back_arrow) ;
back_arrow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AttendanceMgtMenuFragment coursefragment = new AttendanceMgtMenuFragment();
FragmentTransaction country = getFragmentManager().beginTransaction();
country.replace(R.id.frame, coursefragment);
country.commit();
}
});
return view;
}
@Override
public void onResume() {
super.onResume();
Log.e("OnREsume ","Calles ");
if(appController.getManageAttendanceStreamName()!=null){
course_edittext.setText(appController.getManageAttendanceStreamName());
}else{
course_edittext.setText("");
}
if(appController.getManageAttendanceMedium()!=null){
medium_edittext.setText(appController.getManageAttendanceMedium());
}else{
medium_edittext.setText("");
}
if(appController.getManageAttendanceDepartmentName()!=null){
department_edittext.setText(appController.getManageAttendanceDepartmentName());
}else{
department_edittext.setText("");
}
}
}
| [
"gondaliyadhara92@gmail.com"
] | gondaliyadhara92@gmail.com |
1768dbd7f67405f062971dbfb939b66293805c23 | dd91160574613bda26b84634982dfbb668f9cd4e | /src/main/java/gyakorlás/vizsga2felkészülés/Trainer.java | 68ae1d9ef56638b594c0f929fcdfb9770b494b34 | [] | no_license | djtesla/training-solutions | fbaa6216e151be39e0ceef7bcb1466652d56f9e4 | 4d54a4d5573ae897bef7bcd55cc779d92414d57b | refs/heads/master | 2023-07-15T21:38:59.893443 | 2021-09-06T06:02:13 | 2021-09-06T06:02:13 | 308,435,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package gyakorlás.vizsga2felkészülés;
import gyakorlás.TrafficLight;
import java.util.ArrayList;
import java.util.List;
public class Trainer extends Human {
private String name;
private List<Course> courses = new ArrayList<>();
public Trainer() {
}
@Override
public String getName() {
return name;
}
public Trainer(String name, int age, List<Course> courses) {
this.courses = courses;
}
public List<Course> getCourses() {
return courses;
}
public void sayHello() {
System.out.println("Hello");
}
public void setCourses(List<Course> courses) {
this.courses = courses;
}
@Override
public int getFreeTime() {
return 5;
}
}
| [
"djtesla@gmailcom"
] | djtesla@gmailcom |
4a11227b90696d43a5e27abc4a97d06039517811 | 7f9839efbb6340075729455501152f2bfdbbdb80 | /warehouse/src/main/java/com/cn/entity/Input.java | 13f12823c874beb223994c340ce5d1afb65164b7 | [] | no_license | ShiinaRay/java-web-warehouse | b19040d2a10fce95314df6e72f982894880c7475 | 4c72f000ecdc3fb1287bddaf1819850f45b9029b | refs/heads/master | 2023-07-15T11:31:21.747701 | 2021-08-19T05:36:32 | 2021-08-19T05:36:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package com.cn.entity;
public class Input {
private String gno;
private String infactory;
private String intime;
private String inplace;
private String innumber;
public Input(String gno, String infactory, String intime, String inplace, String innumber) {
super();
this.gno = gno;
this.infactory = infactory;
this.intime = intime;
this.inplace = inplace;
this.innumber = innumber;
}
public Input() {
}
public String getGno() {
return gno;
}
public void setGno(String gno) {
this.gno = gno;
}
public String getInfactory() {
return infactory;
}
public void setInfactory(String infactory) {
this.infactory = infactory;
}
public String getIntime() {
return intime;
}
public void setIntime(String intime) {
this.intime = intime;
}
public String getInplace() {
return inplace;
}
public void setInplace(String inplace) {
this.inplace = inplace;
}
public String getInnumber() {
return innumber;
}
public void setInnumber(String innumber) {
this.innumber = innumber;
}
}
| [
"1403061739@qq.com"
] | 1403061739@qq.com |
68abb8816a0f50b861b85725acd8b425a4ec2c9a | 1e54adb638f9ebd041a85563ebd69563e098262e | /AppWS/src/main/java/br/com/ifpb/AppWS/services/TreatmentDataBase.java | 06bf4fd60b4105c159f24b317ea5dcfe52234ad7 | [] | no_license | JoaquimCMH/Analyzer | 53e95682f5d8fbe34677b9b1b5adb56d6231a0d9 | 5b7f9795b31580629e5b880b2655a9055e304633 | refs/heads/master | 2021-01-01T20:42:33.990226 | 2015-10-29T22:46:17 | 2015-10-29T22:46:17 | 30,715,063 | 9 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,051 | java | package br.com.ifpb.AppWS.services;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jsoup.Jsoup;
import br.com.ifpb.AppWS.model.InQuestion;
public class TreatmentDataBase {
public static final Map<String, List<InQuestion>> TEST_BASE = selectTestBaseByTags(0.3);
public TreatmentDataBase() {
}
public static Map<String, List<InQuestion>> selectTestBaseByTags(double testPorc) {
Map<String, List<InQuestion>> testBaseByTags = new HashMap<String, List<InQuestion>>();
Map<String, List<InQuestion>> listQuestionsByTags = questionsByTags();
Set<String> tags = listQuestionsByTags.keySet();
for (String tag : tags) {
List<InQuestion> questionsByTag = listQuestionsByTags.get(tag);
double amountOfElements = questionsByTag.size() * testPorc;
for (int i = 0; i < amountOfElements; i++) {
List<InQuestion> questions = new ArrayList<InQuestion>();
questions.add(questionsByTag.get(i));
List<InQuestion> putIfAbsent = testBaseByTags.putIfAbsent(tag,
questions);
if (putIfAbsent != null) {
putIfAbsent.add(questionsByTag.get(i));
testBaseByTags.put(tag, putIfAbsent);
}
}
}
return testBaseByTags;
}
private static Map<String, List<InQuestion>> questionsByTags() {
List<InQuestion> questions = new CsvFileReader().readCsvFile();
Map<String, List<InQuestion>> tagQuestions = new HashMap<String, List<InQuestion>>();
for (InQuestion inQuestion : questions) {
List<InQuestion> bodyQuestions = new ArrayList<InQuestion>();
bodyQuestions.add(inQuestion);
List<InQuestion> putIfAbsent = tagQuestions.putIfAbsent(
inQuestion.getTag(), bodyQuestions);
if (putIfAbsent != null) {
putIfAbsent.add(inQuestion);
tagQuestions.put(inQuestion.getTag(), putIfAbsent);
}
}
return tagQuestions;
}
public String clearRatings(String content) {
String[] codes = { "code" };
int i = 0;
while (content.contains("<" + codes[i] + ">")) {
if (content.contains("<" + codes[i] + ">")
&& content.contains("</" + codes[i] + ">")) {
int posicaoInicial = content.indexOf("<" + codes[i] + ">");
int posicaoFinal = content.indexOf("</" + codes[i] + ">")
+ codes[i].length() + 3;
for (int j = posicaoInicial; j < posicaoFinal; j++) {
content = removeCharAt(content, posicaoInicial);
}
}
}
return html2text(content);
}
public String replaceAndClearTag (String tag){
tag = tag.replace("><", ", ");
tag = removeChar(tag, '<');
tag = removeChar(tag, '>');
return tag;
}
public String removeCharAt(String s, int pos) {
return s.substring(0, pos) + s.substring(pos + 1);
}
public String html2text(String html) {
return Jsoup.parse(html).text();
}
public String removeChar(String s, char c) {
String r = "";
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) != c)
r += s.charAt(i);
}
return r;
}
}
| [
"joaquim.cmh@gmail.com"
] | joaquim.cmh@gmail.com |
78c412e4d545633368a2818ffcdb80c34f01e556 | c1b23a03926012ccee280b3895f100cec61d2407 | /topdeep_web_common/server/common-core/src/main/java/topdeep/commonfund/entity/hundsun/B014Input.java | 9aaaa4cac48eafa8c4234562d7c14daca7178aa9 | [] | no_license | zhuangxiaotian/project | a0e548c88f01339993097d99ac68adcba9d11171 | d0c96854b3678209c9a25d07c9729c613fe66d38 | refs/heads/master | 2020-12-05T23:14:27.354448 | 2016-09-01T07:19:22 | 2016-09-01T07:19:22 | 67,108,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package topdeep.commonfund.entity.hundsun;
import java.io.Serializable;
import java.util.*;
import common.util.param.PropertyAttribute;
/**
* 汇付渠道当前银行卡查询(B014)
*/
public class B014Input extends HundsunBaseInput implements Serializable {
/**
* 交易账号,
*/
private String tradeacco = "";
/**
* 初始化参数
*/
public B014Input() {
this.setFunction("B014");
this.setChannel("1");
this.setUsertype("p");
this.setSignmode("md5");
this.setVersion("v1.0");
this.setFormat("json");
}
/**
* 交易账号,
*/
public String getTradeacco() {
return this.tradeacco;
}
/**
* 交易账号,
*/
public void setTradeacco(String value)
{
this.tradeacco = value;
}
public void serializeToMap(Map<String, String> inputMap) {
super.serializeToMap(inputMap);
inputMap.put("tradeacco", this.tradeacco);
}
}
| [
"xtian.zhuang@topdeep.com"
] | xtian.zhuang@topdeep.com |
3a0d7436527596dd30e2eb28bb49fc29d13e9614 | 7823a4c680a54b7071b53bc0a106ce0e8cf06097 | /AltoRendimiento-ejb/src/java/entities/Mdcvdp.java | 250e0c2017140fc45591404434f3fb2bd405f183 | [] | no_license | leyo007/ARPrePro | f29a7a7d990e591b644439ab6d57ee1ad7bf32a5 | f347ae1c78a3c672c751be45aff65d7581f73307 | refs/heads/master | 2020-03-17T15:37:08.553956 | 2019-04-02T16:39:39 | 2019-04-02T16:39:39 | 133,715,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,477 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author lvillavicencio
*/
@Entity
@Table(name = "mdcvdp")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Mdcvdp.findAll", query = "SELECT m FROM Mdcvdp m")
, @NamedQuery(name = "Mdcvdp.findById", query = "SELECT m FROM Mdcvdp m WHERE m.id = :id")
, @NamedQuery(name = "Mdcvdp.findByVivecon", query = "SELECT m FROM Mdcvdp m WHERE m.vivecon = :vivecon")
, @NamedQuery(name = "Mdcvdp.findByEstcivil", query = "SELECT m FROM Mdcvdp m WHERE m.estcivil = :estcivil")
, @NamedQuery(name = "Mdcvdp.findByHijos", query = "SELECT m FROM Mdcvdp m WHERE m.hijos = :hijos")
, @NamedQuery(name = "Mdcvdp.findByHerma", query = "SELECT m FROM Mdcvdp m WHERE m.herma = :herma")
, @NamedQuery(name = "Mdcvdp.findByProvres", query = "SELECT m FROM Mdcvdp m WHERE m.provres = :provres")
, @NamedQuery(name = "Mdcvdp.findByCiudres", query = "SELECT m FROM Mdcvdp m WHERE m.ciudres = :ciudres")
, @NamedQuery(name = "Mdcvdp.findByTipovivienda", query = "SELECT m FROM Mdcvdp m WHERE m.tipovivienda = :tipovivienda")
, @NamedQuery(name = "Mdcvdp.findByTelfijo", query = "SELECT m FROM Mdcvdp m WHERE m.telfijo = :telfijo")
, @NamedQuery(name = "Mdcvdp.findByTelfmovil", query = "SELECT m FROM Mdcvdp m WHERE m.telfmovil = :telfmovil")
, @NamedQuery(name = "Mdcvdp.findByDir", query = "SELECT m FROM Mdcvdp m WHERE m.dir = :dir")
, @NamedQuery(name = "Mdcvdp.findByMail", query = "SELECT m FROM Mdcvdp m WHERE m.mail = :mail")
, @NamedQuery(name = "Mdcvdp.findByLvlse", query = "SELECT m FROM Mdcvdp m WHERE m.lvlse = :lvlse")
, @NamedQuery(name = "Mdcvdp.findByAnoproyecto", query = "SELECT m FROM Mdcvdp m WHERE m.anoproyecto = :anoproyecto")
, @NamedQuery(name = "Mdcvdp.findByAnoinicio", query = "SELECT m FROM Mdcvdp m WHERE m.anoinicio = :anoinicio")
, @NamedQuery(name = "Mdcvdp.findByAnoendeporte", query = "SELECT m FROM Mdcvdp m WHERE m.anoendeporte = :anoendeporte")
, @NamedQuery(name = "Mdcvdp.findByTcalen", query = "SELECT m FROM Mdcvdp m WHERE m.tcalen = :tcalen")
, @NamedQuery(name = "Mdcvdp.findByTcami", query = "SELECT m FROM Mdcvdp m WHERE m.tcami = :tcami")
, @NamedQuery(name = "Mdcvdp.findByTshort", query = "SELECT m FROM Mdcvdp m WHERE m.tshort = :tshort")
, @NamedQuery(name = "Mdcvdp.findByTmedias", query = "SELECT m FROM Mdcvdp m WHERE m.tmedias = :tmedias")
, @NamedQuery(name = "Mdcvdp.findByTcalzado", query = "SELECT m FROM Mdcvdp m WHERE m.tcalzado = :tcalzado")})
public class Mdcvdp implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Size(max = 2147483647)
@Column(name = "vivecon")
private String vivecon;
@Size(max = 2147483647)
@Column(name = "estcivil")
private String estcivil;
@Column(name = "hijos")
private Integer hijos;
@Column(name = "herma")
private Integer herma;
@Size(max = 2147483647)
@Column(name = "provres")
private String provres;
@Size(max = 2147483647)
@Column(name = "ciudres")
private String ciudres;
@Size(max = 2147483647)
@Column(name = "tipovivienda")
private String tipovivienda;
@Column(name = "telfijo")
private Integer telfijo;
@Column(name = "telfmovil")
private Integer telfmovil;
@Size(max = 2147483647)
@Column(name = "dir")
private String dir;
@Size(max = 2147483647)
@Column(name = "mail")
private String mail;
@Size(max = 2147483647)
@Column(name = "lvlse")
private String lvlse;
@Column(name = "anoproyecto")
private Integer anoproyecto;
@Column(name = "anoinicio")
private Integer anoinicio;
@Column(name = "anoendeporte")
private Integer anoendeporte;
@Size(max = 2147483647)
@Column(name = "tcalen")
private String tcalen;
@Size(max = 2147483647)
@Column(name = "tcami")
private String tcami;
@Size(max = 2147483647)
@Column(name = "tshort")
private String tshort;
@Size(max = 2147483647)
@Column(name = "tmedias")
private String tmedias;
@Size(max = 2147483647)
@Column(name = "tcalzado")
private String tcalzado;
@JoinColumn(name = "persona", referencedColumnName = "iddep")
@ManyToOne(optional = false)
private Mdpersonast persona;
public Mdcvdp() {
}
public Mdcvdp(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getVivecon() {
return vivecon;
}
public void setVivecon(String vivecon) {
this.vivecon = vivecon;
}
public String getEstcivil() {
return estcivil;
}
public void setEstcivil(String estcivil) {
this.estcivil = estcivil;
}
public Integer getHijos() {
return hijos;
}
public void setHijos(Integer hijos) {
this.hijos = hijos;
}
public Integer getHerma() {
return herma;
}
public void setHerma(Integer herma) {
this.herma = herma;
}
public String getProvres() {
return provres;
}
public void setProvres(String provres) {
this.provres = provres;
}
public String getCiudres() {
return ciudres;
}
public void setCiudres(String ciudres) {
this.ciudres = ciudres;
}
public String getTipovivienda() {
return tipovivienda;
}
public void setTipovivienda(String tipovivienda) {
this.tipovivienda = tipovivienda;
}
public Integer getTelfijo() {
return telfijo;
}
public void setTelfijo(Integer telfijo) {
this.telfijo = telfijo;
}
public Integer getTelfmovil() {
return telfmovil;
}
public void setTelfmovil(Integer telfmovil) {
this.telfmovil = telfmovil;
}
public String getDir() {
return dir;
}
public void setDir(String dir) {
this.dir = dir;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getLvlse() {
return lvlse;
}
public void setLvlse(String lvlse) {
this.lvlse = lvlse;
}
public Integer getAnoproyecto() {
return anoproyecto;
}
public void setAnoproyecto(Integer anoproyecto) {
this.anoproyecto = anoproyecto;
}
public Integer getAnoinicio() {
return anoinicio;
}
public void setAnoinicio(Integer anoinicio) {
this.anoinicio = anoinicio;
}
public Integer getAnoendeporte() {
return anoendeporte;
}
public void setAnoendeporte(Integer anoendeporte) {
this.anoendeporte = anoendeporte;
}
public String getTcalen() {
return tcalen;
}
public void setTcalen(String tcalen) {
this.tcalen = tcalen;
}
public String getTcami() {
return tcami;
}
public void setTcami(String tcami) {
this.tcami = tcami;
}
public String getTshort() {
return tshort;
}
public void setTshort(String tshort) {
this.tshort = tshort;
}
public String getTmedias() {
return tmedias;
}
public void setTmedias(String tmedias) {
this.tmedias = tmedias;
}
public String getTcalzado() {
return tcalzado;
}
public void setTcalzado(String tcalzado) {
this.tcalzado = tcalzado;
}
public Mdpersonast getPersona() {
return persona;
}
public void setPersona(Mdpersonast persona) {
this.persona = persona;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Mdcvdp)) {
return false;
}
Mdcvdp other = (Mdcvdp) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entities.Mdcvdp[ id=" + id + " ]";
}
}
| [
"lvillavicencio@sistemas24.senader.local"
] | lvillavicencio@sistemas24.senader.local |
041f494e03f526aad4789a7375a4d49be9b63205 | f39795fc36e408b1b67beb4bd16f48bf563edb5f | /app/src/main/java/com/example/e_doctor/core/Preferencias.java | c1ea8506c10463e7d71e9784bc59fb26fadcd0a7 | [] | no_license | KeilaRubio/E-DOCTOR | 24c81216c3521f04efbbaa23068e5c57b4d9706e | 49f8f5c74675f95d37724dbefa256a89bbb08bce | refs/heads/master | 2020-07-25T03:18:31.680416 | 2019-09-13T22:00:48 | 2019-09-13T22:00:48 | 208,148,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,149 | java | package com.example.e_doctor.core;
import android.content.Context;
import android.content.SharedPreferences;
//import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
/**
* Created by PC-JANINA on 8/4/2018.
*/
public class Preferencias{
public static SharedPreferences mPreferencias;
public static SharedPreferences.Editor mEditor;
public static SharedPreferences pSharedPref;
public static SharedPreferences.Editor editor;
//etiquetas para la clave: se usa el nombre del paquete
private static final String PREF_USUARIO = AppController.getInstance().getPackageName()+".usuario";
private static final String PREF_TIPO_USUARIO = AppController.getInstance().getPackageName()+".usertype";
private static final String PREF_REGISTRADO_SERVIDOR = AppController.getInstance().getPackageName()+".registered";
private static final String PREF_REGID = AppController.getInstance().getPackageName() + ".regid";
private static final String PREF_AYUDA = AppController.getInstance().getPackageName()+ ".ayuda";
private static final String ACCESS_TOKEN = AppController.getInstance().getPackageName()+ ".accessToken";
private static final String REFRESH_TOKEN = AppController.getInstance().getPackageName()+ ".refreshToken";
private static final String PREF_REGISTRADO_SERVIDOR_MOBILE = AppController.getInstance().getPackageName()+ ".mobile";
private static final String UID_USUARIO = AppController.getInstance().getPackageName()+ ".uidUsuario";
private static final String PREF_TIPO_PLAN = AppController.getInstance().getPackageName()+ ".tipoPlan";
private static final String PREF_TIPO_PLAN_X_BOTON= AppController.getInstance().getPackageName()+ ".tipoPlanBoton";
private static final String PREF_POLITICAS = AppController.getInstance().getPackageName()+ ".politicas";
private static final String PREF_TIPO_TOKEN = AppController.getInstance().getPackageName()+ ".tipoToken";
private static final String PREF_IS_AFILIADO = AppController.getInstance().getPackageName()+ ".afiliado";
private static final String PREF_NOTICIAS_TITULO = AppController.getInstance().getPackageName()+ ".noticiasTitulo";
private static final String PREF_NOTICIAS_MENSAJE = AppController.getInstance().getPackageName()+ ".noticiasMensaje";
private static final String PREF_INICIAR_NOTICIAS = AppController.getInstance().getPackageName()+ ".iniciarNoticias";
//preferencias nuevas
private static final String PREF_CORREO_PRE_REGISTRADO = AppController.getInstance().getPackageName()+".correoPreRegistrado";
public Preferencias(Context context){
mPreferencias = PreferenceManager.getDefaultSharedPreferences(context);
// pSharedPref = AppController.getInstance().getSharedPreferences(PREF_ASIST_LAT_LNG, Context.MODE_PRIVATE);
// editor = pSharedPref.edit();
}
public String getUsuario() {
return mPreferencias.getString(PREF_USUARIO, "");
}
public void setUsuario(String usuario) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_USUARIO, usuario);
mEditor.commit();
}
public String getTipoUsuario() {
return mPreferencias.getString(PREF_TIPO_USUARIO, "");
}
public void setTipoUsuario(String tipoUsuario) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_TIPO_USUARIO, tipoUsuario);
mEditor.commit();
}
public boolean getRegistradoServidor() {
return mPreferencias.getBoolean(PREF_REGISTRADO_SERVIDOR, false);
}
public void setRegistradoServidor(boolean registrado) {
mEditor = mPreferencias.edit();
mEditor.putBoolean(PREF_REGISTRADO_SERVIDOR, registrado);
mEditor.commit();
}
public String getRegId() {
return mPreferencias.getString(PREF_REGID, "");
}
public void setRegId(String regid) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_REGID, regid);
mEditor.commit();
}
public boolean getAyuda() {
return mPreferencias.getBoolean(PREF_AYUDA, true);
}
public void setAyuda(boolean ayuda) {
mEditor = mPreferencias.edit();
mEditor.putBoolean(PREF_AYUDA, ayuda);
mEditor.commit();
}
public String getAccessToken() {
return mPreferencias.getString(ACCESS_TOKEN, "");
}
public void setAccessToken(String accessToken) {
mEditor = mPreferencias.edit();
mEditor.putString(ACCESS_TOKEN, accessToken);
mEditor.commit();
}
public String getRefreshToken() {
return mPreferencias.getString(REFRESH_TOKEN, "");
}
public void setRefreshToken(String refreshToken) {
mEditor = mPreferencias.edit();
mEditor.putString(REFRESH_TOKEN, refreshToken);
mEditor.commit();
}
public String getUidUsuario() {
return mPreferencias.getString(UID_USUARIO,"");
}
public void setUidUsuario(String uidUsuario) {
mEditor = mPreferencias.edit();
mEditor.putString(UID_USUARIO, uidUsuario);
mEditor.commit();
}
public boolean getRegistradoServidorMobile() {
return mPreferencias.getBoolean(PREF_REGISTRADO_SERVIDOR_MOBILE, false);
}
public void setRegistradoServidorMobile(boolean registrado) {
mEditor = mPreferencias.edit();
mEditor.putBoolean(PREF_REGISTRADO_SERVIDOR_MOBILE, registrado);
mEditor.commit();
}
public String getTipoPlan() {
return mPreferencias.getString(PREF_TIPO_PLAN, "");
}
public void setTipoPlan(String tipoServicio) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_TIPO_PLAN, tipoServicio);
mEditor.commit();
}
public String getTipoPlanBoton() {
return mPreferencias.getString(PREF_TIPO_PLAN_X_BOTON, "");
}
public void setTipoPlanBoton(String tipoServicio) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_TIPO_PLAN_X_BOTON, tipoServicio);
mEditor.commit();
}
public String getCorreoPreregistrado() {
return mPreferencias.getString(PREF_CORREO_PRE_REGISTRADO, "");
}
public void setCorreoPreregistrado(String correo) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_CORREO_PRE_REGISTRADO, correo);
mEditor.commit();
}
public String getPoliticas() {
return mPreferencias.getString(PREF_POLITICAS, "");
}
public void setPoliticas(String politicas) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_POLITICAS, politicas);
mEditor.commit();
}
public String getPrefTipoToken() {
return mPreferencias.getString(PREF_TIPO_TOKEN, "");
}
public void setPrefTipoToken(String tipoToken) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_TIPO_TOKEN, tipoToken);
mEditor.commit();
}
public String getIsAfiliado() {
return mPreferencias.getString(PREF_IS_AFILIADO, "");
}
public void setIsAfiliado(String usuario) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_IS_AFILIADO, usuario);
mEditor.commit();
}
public String getPrefNoticiasTitulo() {
return mPreferencias.getString(PREF_NOTICIAS_TITULO, "");
}
public void setPrefNoticiasTitulo(String titulo) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_NOTICIAS_TITULO, titulo);
mEditor.commit();
}
public String getPrefNoticiasMensaje() {
return mPreferencias.getString(PREF_NOTICIAS_MENSAJE, "");
}
public void setPrefNoticiasMensaje(String mensaje) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_NOTICIAS_MENSAJE, mensaje);
mEditor.commit();
}
public String getPrefNoticias() {
return mPreferencias.getString(PREF_INICIAR_NOTICIAS, "");
}
public void setPrefNoticias(String mensaje) {
mEditor = mPreferencias.edit();
mEditor.putString(PREF_INICIAR_NOTICIAS, mensaje);
mEditor.commit();
}
}
| [
"keila.rubio96@gmail.com"
] | keila.rubio96@gmail.com |
a32787c9c040dc93a1bdd6206f6826ffecbb1b78 | 45cab25ebb4356d86b40133b1ddaa98f3b2043d0 | /Shopify/src/util/Order.java | f08bad34c5ea7c6f61e4d058c9f003c178885709 | [] | no_license | OrlyYachbes/Storify | a3143104018d02b890a8d808a9c95546fa2232ea | f80a3c515b8faa9f6756faf348f298d3212f207b | refs/heads/master | 2022-11-24T09:55:51.322903 | 2020-07-09T12:23:18 | 2020-07-09T12:23:18 | 264,894,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package util;
import java.util.HashMap;
public class Order {
private int orderId;
private HashMap<Integer,Integer> orderList = new HashMap<Integer, Integer>(); //******
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public HashMap<Integer, Integer> getOrderList() {
return orderList;
}
public void setOrderList(HashMap<Integer, Integer> orderList) {
this.orderList = orderList;
}
}
| [
"ORLY@DESKTOP-7G2AC6S"
] | ORLY@DESKTOP-7G2AC6S |
37e26d71e07288d4b02a0bb69941e7c42fea132a | ccd109d45fde62bfa14bf941875c8891d8cbde06 | /src/main/java/com/example/demo/seckill/validator/IsMobileValidator.java | 79b7cd0de8958fcd21ad3b5d2688eb7219ba6c39 | [] | no_license | Orakky/demo-mongo | dab6b419aa82f97ba7a32dd9ed5d77b37cdc36dc | 4f0fc5dcb2e41bf8c2530d7c55c60a319812053b | refs/heads/master | 2023-07-13T02:42:54.557197 | 2021-08-19T09:39:31 | 2021-08-19T09:39:31 | 361,702,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 934 | java | package com.example.demo.seckill.validator;
import com.example.demo.seckill.common.ValidateUtil;
import org.apache.commons.lang.StringUtils;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
* 手机号码校验规则
*/
public class IsMobileValidator implements ConstraintValidator<IsMobile,String> {
private boolean required = false;
@Override
public void initialize(IsMobile constraintAnnotation) {
required = constraintAnnotation.required();
}
@Override
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
if(required){
//必填
}else{
//非必填
if(StringUtils.isEmpty(value)){
return true;
}else{
return ValidateUtil.isMobile(value);
}
}
return false;
}
}
| [
"long1349@163.com"
] | long1349@163.com |
1d843c2177fba8e82a10d008b0575796e0ce8f67 | fda0e80a02781621cf5b4421e83254ba77b6b424 | /src/persistanceService/StudentDAO.java | 140cd3bb4f8b57ff81376bf39a94a19cd4e377de | [] | no_license | adelababinciuc/TehnologiiJavaLab5 | ab962c42de5a62a86d2bb3c1706e2e07d0d39024 | a88af4061d0cb33d30b21985ecaaebe7e2b526d4 | refs/heads/master | 2021-01-10T14:50:19.711093 | 2015-11-04T00:38:06 | 2015-11-04T00:38:06 | 45,299,187 | 0 | 0 | null | 2015-11-02T19:23:17 | 2015-10-31T11:30:22 | Java | UTF-8 | Java | false | false | 985 | java | package persistanceService;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import model.Student;
public class StudentDAO extends DBConnection{
public void insertStudent(Student student) throws SQLException{
getConnection().createStatement().executeUpdate(
"insert into student (name, cnp, placeOfBirth) values "
+ "('" + student.getName() + "', '" + student.getCnp() + "', '" + student.getPlaceOfBirth() + "')");
}
public List<Student> getStudentListDB() throws SQLException {
PreparedStatement ps = getConnection().prepareStatement("select * from student");
List<Student> studentList = new ArrayList<Student>();
ResultSet result = ps.executeQuery();
while (result.next()) {
studentList.add(new Student(result.getInt("student_id"), result.getString("name"), result.getString("cnp"), result.getString("placeofbirth")));
}
return studentList;
}
}
| [
"babinciuc.adela@gmail.com"
] | babinciuc.adela@gmail.com |
448b05174bc381da65575331cbb85a95da4d867a | d6c9d7f1831ff8ff224b51834bfd77d178491ac5 | /app/src/main/java/com/example/q/pocketmusic/module/home/profile/user/other/OtherProfileActivity.java | 1be5211ed5e83c1cefbcc9731f56989130d6f7a4 | [] | no_license | kikiChuang/PocketMusic | 84b8ed4cb6a1af6b30604a27b8edd217f46067a0 | 7c3ef688f1ffdad25c67c23b82459cd0877fcb2f | refs/heads/master | 2021-08-16T06:14:49.255811 | 2017-11-19T04:34:48 | 2017-11-19T04:34:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,992 | java | package com.example.q.pocketmusic.module.home.profile.user.other;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.q.pocketmusic.R;
import com.example.q.pocketmusic.config.pic.DisplayStrategy;
import com.example.q.pocketmusic.data.bean.MyUser;
import com.example.q.pocketmusic.module.common.AuthActivity;
import butterknife.BindView;
import butterknife.OnClick;
public class OtherProfileActivity extends AuthActivity<OtherProfilePresenter.IView, OtherProfilePresenter>
implements OtherProfilePresenter.IView {
@BindView(R.id.tab_layout)
TabLayout tabLayout;
@BindView(R.id.view_pager)
ViewPager viewPager;
@BindView(R.id.head_iv)
ImageView headIv;
@BindView(R.id.user_signature_tv)
TextView userSignatureTv;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.interest_tv)
TextView interestTv;
private OtherAdapter adapter;
public MyUser otherUser;
public final static String PARAM_USER = "other_user";
@Override
protected OtherProfilePresenter createPresenter() {
return new OtherProfilePresenter(this);
}
@Override
public int setContentResource() {
return R.layout.activity_other_profile;
}
@Override
public void initUserView() {
otherUser = (MyUser) getIntent().getSerializableExtra(PARAM_USER);
initToolbar(toolbar, otherUser.getNickName());
adapter = new OtherAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
userSignatureTv.setText(otherUser.getSignature());
new DisplayStrategy().displayCircle(getCurrentContext(), otherUser.getHeadImg(), headIv);
}
@OnClick(R.id.interest_tv)
public void onViewClicked() {
presenter.interestOther(otherUser);
}
}
| [
"812568684@qq.com"
] | 812568684@qq.com |
65526849ba99dc6d7e95f7297598d5005bcf5f7e | d50afde8a6e3e13b15970bed9a776fcef246e6e8 | /facebooksdk/src/main/java/com/facebook/login/DeviceAuthDialog.java | f25a5b22dd84f9e012a81006dbee7fb35e151a8e | [] | no_license | V-zhangyunxiang/LoginShareSDK | 51edce81d31e05db27a54e43294f55fe99f8e184 | 751c336f9a726c3ca410f3ea5982ff553c7faa5f | refs/heads/master | 2021-06-22T13:29:56.560955 | 2017-08-17T08:02:25 | 2017-08-17T08:02:25 | 93,589,429 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,027 | java | /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.facebook.login;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.text.Html;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.cmplay.util.GameResId;
import com.facebook.AccessToken;
import com.facebook.AccessTokenSource;
import com.facebook.FacebookActivity;
import com.facebook.FacebookException;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.GraphRequestAsyncTask;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.facebook.internal.Utility;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Date;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class DeviceAuthDialog extends DialogFragment {
private static final String DEVICE_OUATH_ENDPOINT = "oauth/device";
private static final String REQUEST_STATE_KEY = "request_state";
private ProgressBar progressBar;
private TextView confirmationCode;
private DeviceAuthMethodHandler deviceAuthMethodHandler;
private AtomicBoolean completed = new AtomicBoolean();
private volatile GraphRequestAsyncTask currentGraphRequestPoll;
private volatile ScheduledFuture scheduledPoll;
private volatile RequestState currentRequestState;
private Dialog dialog;
// Used to tell if we are destroying the fragment because it was dismissed or dismissing the
// fragment because it is being destroyed.
private boolean isBeingDestroyed = false;
@Nullable
@Override
public View onCreateView(
LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
FacebookActivity facebookActivity = (FacebookActivity) getActivity();
LoginFragment fragment = (LoginFragment)facebookActivity.getCurrentFragment();
deviceAuthMethodHandler = (DeviceAuthMethodHandler)fragment
.getLoginClient()
.getCurrentHandler();
if (savedInstanceState != null) {
RequestState requestState = savedInstanceState.getParcelable(REQUEST_STATE_KEY);
if (requestState != null) {
setCurrentRequestState(requestState);
}
}
return view;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
dialog = new Dialog(getActivity(), GameResId.getStyleResIDByName(getActivity(), "com_facebook_auth_dialog"));
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(GameResId.getLayoutResIDByName(getActivity(), "com_facebook_device_auth_dialog_fragment"), null);
progressBar = (ProgressBar)view.findViewById(GameResId.getIdResIDByName(getActivity(), "progress_bar"));
confirmationCode = (TextView)view.findViewById(GameResId.getIdResIDByName(getActivity(), "confirmation_code"));
Button cancelButton = (Button) view.findViewById(GameResId.getIdResIDByName(getActivity(), "cancel_button"));
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onCancel();
}
});
TextView instructions = (TextView)view.findViewById(
GameResId.getIdResIDByName(getActivity(), "com_facebook_device_auth_instructions"));
instructions.setText(
Html.fromHtml(getString(GameResId.getStringResIDByName(getActivity(), "com_facebook_device_auth_instructions"))));
dialog.setContentView(view);
return dialog;
}
@Override
public void onDismiss(final DialogInterface dialog) {
super.onDismiss(dialog);
if (!isBeingDestroyed) {
onCancel();
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (currentRequestState != null) {
outState.putParcelable(REQUEST_STATE_KEY, currentRequestState);
}
}
@Override
public void onDestroy() {
// Set this to true so we know if we are being destroyed and then dismissing the dialog
// Or if we are dismissing the dialog and then destroying the fragment. In latter we want
// to do a cancel callback.
isBeingDestroyed = true;
completed.set(true);
super.onDestroy();
if (currentGraphRequestPoll != null) {
currentGraphRequestPoll.cancel(true);
}
if (scheduledPoll != null) {
scheduledPoll.cancel(true);
}
}
public void startLogin(final LoginClient.Request request) {
Bundle parameters = new Bundle();
parameters.putString("type", "device_code");
parameters.putString("client_id", FacebookSdk.getApplicationId());
parameters.putString("scope", TextUtils.join(",", request.getPermissions()));
GraphRequest graphRequest = new GraphRequest(
null,
DEVICE_OUATH_ENDPOINT,
parameters,
HttpMethod.POST,
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
if (response.getError() != null) {
onError(response.getError().getException());
return;
}
JSONObject jsonObject = response.getJSONObject();
RequestState requestState = new RequestState();
try {
requestState.setUserCode(jsonObject.getString("user_code"));
requestState.setRequestCode(jsonObject.getString("code"));
requestState.setInterval(jsonObject.getLong("interval"));
} catch (JSONException ex) {
onError(new FacebookException(ex));
return;
}
setCurrentRequestState(requestState);
}
});
graphRequest.executeAsync();
}
private void setCurrentRequestState(RequestState currentRequestState) {
this.currentRequestState = currentRequestState;
confirmationCode.setText(currentRequestState.getUserCode());
confirmationCode.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
// If we polled within the last interval schedule a poll else start a poll.
if (currentRequestState.withinLastRefreshWindow()) {
schedulePoll();
} else {
poll();
}
}
private void poll() {
currentRequestState.setLastPoll(new Date().getTime());
currentGraphRequestPoll = getPollRequest().executeAsync();
}
private void schedulePoll() {
scheduledPoll = DeviceAuthMethodHandler.getBackgroundExecutor().schedule(
new Runnable() {
@Override
public void run() {
poll();
}
},
currentRequestState.getInterval(),
TimeUnit.SECONDS);
}
private GraphRequest getPollRequest() {
Bundle parameters = new Bundle();
parameters.putString("type", "device_token");
parameters.putString("client_id", FacebookSdk.getApplicationId());
parameters.putString("code", currentRequestState.getRequestCode());
return new GraphRequest(
null,
DEVICE_OUATH_ENDPOINT,
parameters,
HttpMethod.POST,
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
// Check if the request was already cancelled
if (completed.get()) {
return;
}
FacebookRequestError error = response.getError();
if (error != null) {
// We need to decide if this is a fatal error by checking the error
// message text
String errorMessage = error.getErrorMessage();
if (errorMessage.equals("authorization_pending") ||
errorMessage.equals("slow_down")) {
// Keep polling. If we got the slow down message just ignore
schedulePoll();
return;
} else if (errorMessage.equals("authorization_declined") ||
errorMessage.equals("code_expired")) {
onCancel();
return;
}
onError(response.getError().getException());
return;
}
try {
JSONObject resultObject = response.getJSONObject();
onSuccess(resultObject.getString("access_token"));
} catch (JSONException ex) {
onError(new FacebookException(ex));
}
}
});
}
private void onSuccess(final String accessToken) {
Bundle parameters = new Bundle();
parameters.putString("fields", "id,permissions");
AccessToken temporaryToken = new AccessToken(
accessToken,
FacebookSdk.getApplicationId(),
"0",
null,
null,
null,
null,
null);
GraphRequest request = new GraphRequest(
temporaryToken,
"me",
parameters,
HttpMethod.GET,
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
if (completed.get()) {
return;
}
if (response.getError() != null) {
onError(response.getError().getException());
return;
}
String userId;
Utility.PermissionsPair permissions;
try {
JSONObject jsonObject = response.getJSONObject();
userId = jsonObject.getString("id");
permissions = Utility.handlePermissionResponse(jsonObject);
} catch (JSONException ex) {
onError(new FacebookException(ex));
return;
}
deviceAuthMethodHandler.onSuccess(
accessToken,
FacebookSdk.getApplicationId(),
userId,
permissions.getGrantedPermissions(),
permissions.getDeclinedPermissions(),
AccessTokenSource.DEVICE_AUTH,
null,
null);
dialog.dismiss();
}
});
request.executeAsync();
}
private void onError(FacebookException ex) {
if (!completed.compareAndSet(false, true)) {
return;
}
deviceAuthMethodHandler.onError(ex);
dialog.dismiss();
}
private void onCancel() {
if (!completed.compareAndSet(false, true)) {
// Should not have happened but we called cancel twice
return;
}
if (deviceAuthMethodHandler != null) {
// We are detached and cannot send a cancel message back
deviceAuthMethodHandler.onCancel();
}
dialog.dismiss();
}
private static class RequestState implements Parcelable{
private String userCode;
private String requestCode;
private long interval;
private long lastPoll;
RequestState() {}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public String getRequestCode() {
return requestCode;
}
public void setRequestCode(String requestCode) {
this.requestCode = requestCode;
}
public long getInterval() {
return interval;
}
public void setInterval(long interval) {
this.interval = interval;
}
public void setLastPoll(long lastPoll) {
this.lastPoll = lastPoll;
}
protected RequestState(Parcel in) {
userCode = in.readString();
requestCode = in.readString();
interval = in.readLong();
lastPoll = in.readLong();
}
/**
*
* @return True if the current time is less than last poll time + polling interval.
*/
public boolean withinLastRefreshWindow() {
if (lastPoll == 0) {
return false;
}
long diff = new Date().getTime() - lastPoll - interval * 1000L;
return diff < 0;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(userCode);
dest.writeString(requestCode);
dest.writeLong(interval);
dest.writeLong(lastPoll);
}
@SuppressWarnings("unused")
public static final Parcelable.Creator<RequestState> CREATOR =
new Parcelable.Creator<RequestState>() {
@Override
public RequestState createFromParcel(Parcel in) {
return new RequestState(in);
}
@Override
public RequestState[] newArray(int size) {
return new RequestState[size];
}
};
}
}
| [
"owlzhang95@gmail.com"
] | owlzhang95@gmail.com |
31f75ca1df7bbe31184be7b7b92cbc95864e45e8 | 5d04f56906801ab830ceb7d8ef954035c1617430 | /src/org/usfirst/frc/team2848/robot/commands/auton/RedPosition1.java | efac5492849a04fccdfab20c476894bff806929c | [] | no_license | AllSparks2848/FRC2017 | 305ccebab4c79708bdbc8619a71bc7ab0be40c1b | c26ba7449ee5001624c62946f0a6479eaa82d5ec | refs/heads/master | 2021-01-20T03:59:33.916037 | 2017-05-06T22:00:36 | 2017-05-06T22:00:36 | 89,616,487 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java | package org.usfirst.frc.team2848.robot.commands.auton;
import org.usfirst.frc.team2848.robot.Robot;
import org.usfirst.frc.team2848.robot.commands.drive.AllOmnis;
import org.usfirst.frc.team2848.robot.commands.drive.BackAway;
import org.usfirst.frc.team2848.robot.commands.drive.DriveToDistHigh;
import org.usfirst.frc.team2848.robot.commands.drive.DriveToDistance;
import org.usfirst.frc.team2848.robot.commands.drive.GyroTurn;
import org.usfirst.frc.team2848.robot.commands.drive.NoOmnis;
import org.usfirst.frc.team2848.robot.commands.drive.ShiftHigh;
import org.usfirst.frc.team2848.robot.commands.drive.ShiftLow;
import org.usfirst.frc.team2848.robot.commands.drive.TestZeroGyro;
import org.usfirst.frc.team2848.robot.commands.drive.VisionTurn;
import org.usfirst.frc.team2848.robot.commands.intake.IntakePID;
import org.usfirst.frc.team2848.robot.commands.intake.SpitGearBreakBeam;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
*
*/
public class RedPosition1 extends CommandGroup {
public RedPosition1() {
// NON VISION
/*addSequential(new ShiftLow());
addSequential(new NoOmnis());
addSequential(new ZeroIntake());
addSequential(new testZeroGyro());
addSequential(new DriveToDistance(70.3));
addSequential(new Wait(.75));
addParallel(new IntakePIDNonStop(Robot.intake.spitPos));
addSequential (new GyroTurn(60));
addSequential(new Wait(.75));
addSequential(new DriveToDistance(62));
addSequential(new Wait(.75)); */
//NON VISION
addSequential(new ShiftLow());
addSequential(new NoOmnis());
addParallel(new ZeroAndVisionPos());
addSequential(new TestZeroGyro());
addSequential(new DriveToDistance(74.3));
//addParallel(new IntakePIDNonStop(Robot.intake.spitPos));
addSequential (new GyroTurn(60));
addSequential(new DriveToDistance(30)); //was 30
addSequential(new VisionTurn());
addSequential(new IntakePID(Robot.intake.spitPos));
addSequential(new DriveToDistance(34)); //was 34
addParallel(new SpitGearBreakBeam());
addSequential(new BackAway());
addSequential(new TestZeroGyro());
addSequential(new GyroTurn(-60));
addSequential(new ShiftHigh());
addSequential(new AllOmnis());
addSequential(new DriveToDistHigh(125));
}
}
| [
"18187@jcpstudents.org"
] | 18187@jcpstudents.org |
899bd1bd022a1b89780a9ca616566d923336f692 | c687ab01e2dccf2d2cda6f84e59d9dc76d87128e | /GroupwareL11/src/main/java/com/mju/groupware/service/ProfessorServiceImpl.java | a353bcdbae12a0adb4bc63fb4aaf956ae8d64625 | [] | no_license | yjyjChoi/2021_TeamProject | 121491bf2096491774992cd54d6b35723db6daf7 | 1beb2949c80ebffd72e4bcfc9449b965a2ff5483 | refs/heads/main | 2023-06-15T20:32:14.190027 | 2021-06-14T12:49:40 | 2021-06-14T12:49:40 | 385,421,662 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,848 | java | package com.mju.groupware.service;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mju.groupware.dao.ProfessorDao;
import com.mju.groupware.dto.Professor;
@Service
public class ProfessorServiceImpl implements ProfessorService{
@Autowired
private ProfessorDao professorDao;
@Override
public void InsertInformation(Professor professor) {
professorDao.InsertInformation(professor);
}
@Override
public void UpdateUserID(Professor professor) {
professorDao.UpdateUserID(professor);
}
@Override
public void UpdateProfessorColleges(Professor professor) {
professorDao.UpdateProfessorColleges(professor);
}
@Override
public void UpdateProfessorMajor(Professor professor) {
professorDao.UpdateProfessorMajor(professor);
}
@Override
public void UpdateProfessorRoom(Professor professor) {
professorDao.UpdateProfessorRoom(professor);
}
@Override
public void UpdateProfessorRoomNum(Professor professor) {
professorDao.UpdateProfessorRoomNum(professor);
}
@Override
public ArrayList<String> SelectProfessorProfileInfo(String userID) {
ArrayList<String> ProfessorInfo = new ArrayList<String>();
ProfessorInfo = professorDao.SelectProfessorProfileInfo(userID);
return ProfessorInfo;
}
@Override
public Professor SelectProfessorInfo(String userID) {
return professorDao.SelectProfessorInfo(userID);
}
@Override
public void InsertWithdrawalProfessor(Professor professor) {
professorDao.InsertWithdrawalprofessor(professor);
}
@Override
public void DeleteWithdrawalProfessor(Professor professor) {
professorDao.DeleteWithdrawalprofessor(professor);
}
@Override
public void DeleteWithdrawalProfessorList(String string) {
professorDao.DeleteWithdrawalprofessorList(string);
}
}
| [
"48897085+yjyjChoi@users.noreply.github.com"
] | 48897085+yjyjChoi@users.noreply.github.com |
e82f2998964121b335f60b08195c964b5f466264 | e54f6b2b0da03f54d5a3f48e427f628cac675abb | /src/flightTrackApp/Capital.java | 1b6c877830ff252dc79f00fcd5a5f582ef3fe225 | [] | no_license | tugrulhkarabulut/FlightTrackApp | afa1677807e87f6f5135cb4ad04721ddc28a928e | 9570a7db58987e0608b81926976ecfb62b5cfb2d | refs/heads/master | 2022-07-11T06:14:27.245138 | 2020-05-14T16:03:14 | 2020-05-14T16:03:14 | 263,961,029 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package flightTrackApp;
public class Capital {
public static int numCapitals = 0;
private String name;
private int id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Capital(String name) {
numCapitals++;
this.id = numCapitals;
this.name = name;
}
public String toString() {
return name;
}
}
| [
"="
] | = |
1c5e8bb704f867d8c23804171117c2b8ab9e2caf | ebb91f8170706aaab667d1432ec70af4b3d8d756 | /app/src/main/java/con/xiaweizi/dashboardview/MainActivity.java | 1e7ee27afbe47adf66fade0e58cfd7e34ee13026 | [] | no_license | xiaweizi/CoderPDemo | 1ce2dac952aa437a460a4b12b64f6d10a8714abc | 6a256c4bc5377da021cf6de15c894654066c889a | refs/heads/master | 2020-04-14T22:55:06.716864 | 2019-01-25T03:12:30 | 2019-01-25T03:12:30 | 164,183,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package con.xiaweizi.dashboardview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class MainActivity extends AppCompatActivity {
private View view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
view = findViewById(R.id.view);
}
}
| [
"1012126908@qq.com"
] | 1012126908@qq.com |
f8bb1c0cae738601e17098d4978a52fc87351688 | 82d2bd946b6e7c6b60f5e5005d3115079b5d2400 | /books/src/main/java/userbooks/service/search/BookSearchServiceImpl.java | 088ce4c0b75fd491791db1913ecfc2e9c32d30b9 | [] | no_license | yjlee1004/userBooks | 6badff455f7709ba9a043280fc04cea5099e41f7 | b6aa815e3ac9f5dd47a5dc1e0e054f392cd77dc4 | refs/heads/master | 2020-03-23T03:24:50.235745 | 2018-07-16T13:57:03 | 2018-07-16T13:57:03 | 141,029,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,487 | java | package userbooks.service.search;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import userbooks.dto.*;
import userbooks.service.history.SearchHistory;
import userbooks.util.BooksPage;
import userbooks.util.BooksPageImpl;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yjlee on 2018-07-15.
*/
@Service
public class BookSearchServiceImpl implements BookSearchService {
@Autowired
SearchHistory searchHistory;
@Autowired
ExternalSearchFactory externalSearchFactory;
@Override
@Transactional
public BooksPage<BookDto> getBooks(KakaoSearchDataDto kakaoSearchDataDto, UserDto userDto) {
BooksPage<BookDto> bookList = null;
ExternalSearch externalSearch = externalSearchFactory.getSearchBean(ExternalSearchCompany.KAKAO);
KakaoSearchResultDto kakaoSearchResultDto = (KakaoSearchResultDto) externalSearch.getSearchData(kakaoSearchDataDto);
List<BookDto> bookDtos = new ArrayList<>();
searchHistory.save(new SearchWordDto(kakaoSearchDataDto.getSearchWord(),userDto));
return new BooksPageImpl<BookDto>(bookDtos,new PageImpl<BookDto>(bookDtos
,kakaoSearchDataDto.getPageable(),kakaoSearchResultDto.getKakaoBookHeader().getTotalCount()));
}
}
| [
"yjlee3854@gmail.com"
] | yjlee3854@gmail.com |
67d40085e46e67a3ddfaaa56ab0b90c5fd1f0541 | 6f77d846c9ce20211b3dab4ed8bad48d0fb4b873 | /src/java/clases/TipoDeUsuario.java | dabf108f87afb0631a14760c45357984e3a858a0 | [] | no_license | FernandoSepulvedaVergara/WebServiceServiExpress | 4b9bf197bd00a128f6f797369be7aee4850e193e | b9388be6e2db46044279387af8aa8a404692911e | refs/heads/master | 2022-11-22T01:40:17.143876 | 2020-07-22T20:44:05 | 2020-07-22T20:44:05 | 271,157,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package clases;
public class TipoDeUsuario {
private int idTipoDeUsuario;
private String tipoDeUsuario;
public TipoDeUsuario(int idTipoDeUsuario, String tipoDeUsuario) {
this.idTipoDeUsuario = idTipoDeUsuario;
this.tipoDeUsuario = tipoDeUsuario;
}
public TipoDeUsuario() {
this.idTipoDeUsuario = 0;
this.tipoDeUsuario = null;
}
public int getIdTipoDeUsuario() {
return idTipoDeUsuario;
}
public void setIdTipoDeUsuario(int idTipoDeUsuario) {
this.idTipoDeUsuario = idTipoDeUsuario;
}
public String getTipoDeUsuario() {
return tipoDeUsuario;
}
public void setTipoDeUsuario(String tipoDeUsuario) {
this.tipoDeUsuario = tipoDeUsuario;
}
}
| [
"fernandosepulvda@gmail.com"
] | fernandosepulvda@gmail.com |
87c3f8f77025c46a26d6bd8bc25d0c1dceba1d9b | cea17f7983b375a25399824c922dde9ccf5054b6 | /src/practice/dev/ds/BTNode.java | 48122e9aa09fcf57899dbf900644176b73efe5b7 | [] | no_license | devndone/dev-practice-java | 5fd7f4626a8020e7f8ec7ff72ea997f85a0b3cc4 | aad98610677c285895190e7d333c9a015e398433 | refs/heads/master | 2020-12-05T18:18:43.803325 | 2020-05-24T20:13:20 | 2020-05-24T20:13:20 | 66,736,452 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,566 | java | package practice.dev.ds;
/**
* Class BTNode
* @author tnguyen
*/
public class BTNode<K extends Comparable, V>
{
public final static int MIN_DEGREE = 5;
public final static int LOWER_BOUND_KEYNUM = MIN_DEGREE - 1;
public final static int UPPER_BOUND_KEYNUM = (MIN_DEGREE * 2) - 1;
protected boolean mIsLeaf;
protected int mCurrentKeyNum;
protected BTKeyValue<K, V> mKeys[];
protected BTNode mChildren[];
public BTNode() {
mIsLeaf = true;
mCurrentKeyNum = 0;
mKeys = new BTKeyValue[UPPER_BOUND_KEYNUM];
mChildren = new BTNode[UPPER_BOUND_KEYNUM + 1];
}
protected static BTNode getChildNodeAtIndex(BTNode btNode, int keyIdx, int nDirection) {
if (btNode.mIsLeaf) {
return null;
}
keyIdx += nDirection;
if ((keyIdx < 0) || (keyIdx > btNode.mCurrentKeyNum)) {
return null;
}
return btNode.mChildren[keyIdx];
}
protected static BTNode getLeftChildAtIndex(BTNode btNode, int keyIdx) {
return getChildNodeAtIndex(btNode, keyIdx, 0);
}
protected static BTNode getRightChildAtIndex(BTNode btNode, int keyIdx) {
return getChildNodeAtIndex(btNode, keyIdx, 1);
}
protected static BTNode getLeftSiblingAtIndex(BTNode parentNode, int keyIdx) {
return getChildNodeAtIndex(parentNode, keyIdx, -1);
}
protected static BTNode getRightSiblingAtIndex(BTNode parentNode, int keyIdx) {
return getChildNodeAtIndex(parentNode, keyIdx, 1);
}
}
| [
"devndone@gmail.com"
] | devndone@gmail.com |
01a7acf773628c8504a5927611e5d0f7fae68e08 | c2792c6a2b43e7daa52fbad35bdd992b11ef1842 | /src/State.java | 8e28b799a7f3efa0a6aa81052230bc67aa673d87 | [] | no_license | naharon034/DataParser | dac65ad96a7509d15548fa4a6d6cf95040e4f5b0 | 7a1026ff78e799b7b530a34756186ba4f26b9b34 | refs/heads/master | 2020-04-25T20:53:40.952043 | 2019-03-25T16:12:01 | 2019-03-25T16:12:01 | 173,063,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | import java.util.List;
import java.util.ArrayList;
//public class State {
// private String name;
// private List<County> counties;
//
// public State(String name) {
// this.name = name;
// counties = new ArrayList<County>();
// }
// public void addCounty(County c){
// counties.add(c);
// }
// public void removeCounty(County c){
// counties.remove(c);
// }
// public County removeCounty(int index){
// return counties.remove(index);
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public List<County> getCountries() {
// return counties;
// }
//
// public void setCountries(List<County> countries) {
// this.counties = countries;
// }
//} | [
"naharon034@student.fuhsd.org"
] | naharon034@student.fuhsd.org |
3c0c99d597f4a779e43dbfba0515fec48e2c5206 | 6bb75074f72a08f40f7d8f08ea655f0778e2cc9b | /app/src/main/java/io/github/andres_vasquez/attendacelist/viewmodel/PersonViewModel.java | 642f3ffb61de7e765f5dba381b901262915ee115 | [] | no_license | andres-vasquez/android-mvvm-attendance | c9551e5d63b9040c8b3c4192db2c585b2588efb0 | 497dc85c82d6e97941064e1b1c2409dcda2e12c2 | refs/heads/master | 2020-12-25T18:42:50.167902 | 2017-06-18T21:44:38 | 2017-06-18T21:44:38 | 93,979,208 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | package io.github.andres_vasquez.attendacelist.viewmodel;
import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData;
import android.support.annotation.Nullable;
import java.util.List;
import io.github.andres_vasquez.attendacelist.db.entity.PersonEntity;
import io.github.andres_vasquez.attendacelist.repository.PersonRepositoryImpl;
/**
* Created by andresvasquez on 6/11/17.
*/
public class PersonViewModel extends AndroidViewModel{
public PersonRepositoryImpl personRepository;
@Nullable
private LiveData<List<PersonEntity>> mPersonList;
public PersonViewModel(Application application) {
super(application);
personRepository =new PersonRepositoryImpl(application);
// Receive changes
subscribeToDbChanges();
}
/**
* Get all persons in LiveData variable
*/
private void subscribeToDbChanges() {
//TODO Step 10: Bind the person List LiveData
}
@Nullable
public LiveData<List<PersonEntity>> getPersonList() {
return mPersonList;
}
/**
* Get one person in LiveData variable
* @param personId Id of person to observe
* @return livedata object
*/
@Nullable
public LiveData<PersonEntity> getPerson(int personId) {
//TODO Step 11: Bind the single person LiveData
return null;
}
}
| [
"andres.vasquez.a@hotmail.com"
] | andres.vasquez.a@hotmail.com |
83ea0373b7e156e78cb10a42c9f4a8223e11d3ac | 6d60a8adbfdc498a28f3e3fef70366581aa0c5fd | /codebase/selected/339583.java | 07f92eaa16d5d71ac1dff811611d4569540bea35 | [] | no_license | rayhan-ferdous/code2vec | 14268adaf9022d140a47a88129634398cd23cf8f | c8ca68a7a1053d0d09087b14d4c79a189ac0cf00 | refs/heads/master | 2022-03-09T08:40:18.035781 | 2022-02-27T23:57:44 | 2022-02-27T23:57:44 | 140,347,552 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,124 | java | package net.sourceforge.javautil.common.reflection.cache;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import net.sourceforge.javautil.common.reflection.ReflectionContext;
/**
* A class property descriptor and access bridge. A property
* is a getter and/or setter that follows the Java Beans specification.
*
* @author elponderador
* @author $Author: ponderator $
* @version $Id: ClassProperty.java 2722 2011-01-16 05:38:59Z ponderator $
*/
public class ClassProperty extends ClassMember implements IClassMemberWritableValue {
/**
* The name of the property
*/
protected final String name;
/**
* The reader method of the property, null if not readable
*/
protected final ClassMethod reader;
/**
* The writer method of the property, null if not writable
*/
protected final ClassMethod writer;
/**
* The type of this property
*/
protected final Class<?> type;
/**
* @param descriptor The {@link ClassMember#descriptor}
* @param name The {@link #name}
* @param reader The {@link #reader}
* @param writer The {@link #writer}
*/
public ClassProperty(ClassDescriptor descriptor, String name, ClassMethod reader, ClassMethod writer) {
super(descriptor);
this.name = name;
this.reader = reader;
this.writer = writer;
this.type = reader != null ? reader.getReturnType() : writer.getParameterTypes()[0];
}
/**
* @return The descriptor
*/
public ClassDescriptor<?> getDescriptor() {
return descriptor;
}
/**
* If this is a write only property, the annotation will be retrieved from the
* writer method, otherwise from the reader method.
*
* @param <A> The annotation type
* @param clazz The annotation class
* @return The annotation if present, otherwise null
*/
public <A extends Annotation> A getAnnotation(Class<A> clazz) {
A annotation = reader != null ? reader.getAnnotation(clazz) : null;
return annotation == null && writer != null ? writer.getAnnotation(clazz) : annotation;
}
@Override
public Annotation[] getAnnotations() {
return reader == null ? writer.getAnnotations() : reader.getAnnotations();
}
@Override
public Class getBaseType() {
return reader == null ? writer.getBaseType() : reader.getBaseType();
}
@Override
public Method getJavaMember() {
return reader == null ? writer.getJavaMember() : reader.getJavaMember();
}
@Override
public boolean isStatic() {
return Modifier.isStatic(this.getJavaMember().getModifiers());
}
/**
* @return The {@link #name}
*/
public String getName() {
return name;
}
/**
* @return The {@link #reader}
*/
public ClassMethod getReader() {
return reader;
}
/**
* @return The {@link #writer}
*/
public ClassMethod getWriter() {
return writer;
}
/**
* If false, {@link #getValue(Object)} will fail.
*
* @return True if this property is readable, otherwise false
*/
public boolean isReadable() {
return this.reader != null;
}
/**
* If false, {@link #setValue(Object, Object)} will fail.
*
* @return True if this property is writable, otherwise false
*/
public boolean isWritable() {
return this.writer != null;
}
/**
* @return The {@link #type}
*/
public Class<?> getType() {
return type;
}
/**
* @return The generic type of this property
*/
public Type getGenericType() {
return reader == null ? writer.getGenericParameterTypes()[0] : reader.getGenericReturnType();
}
/**
* @return A descriptor for the {@link #type}
*/
public ClassDescriptor<?> getTypeDescriptor() {
return descriptor.cache.getDescriptor(type);
}
/**
* Set the current value of the property on the instance or class.
*
* @param instance The instance on which to set the property, null if it is a static property
* @param value The value to assign to the property of the instance/class
*
* @see #isWritable()
* @throws ClassPropertyAccessException
*/
public void setValue(Object instance, Object value) {
if (writer == null) throw new ClassPropertyAccessException(descriptor, this, "Property not writable");
writer.invoke(instance, value);
}
/**
* Get the current value of the property on the instance or class.
*
* @param instance The instance on which to get the property, null if it is a static property
* @return The current value of the property
*
* @see #isReadable()
* @throws ClassPropertyAccessException
*/
public Object getValue(Object instance) {
if (reader == null) throw new ClassPropertyAccessException(descriptor, this, "Property not readable");
return reader.invoke(instance);
}
}
| [
"aaponcseku@gmail.com"
] | aaponcseku@gmail.com |
83973b4579f35bc16027c10fd5c4e0c281cd54b7 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2.java | f1e428987e7c1e1aa3e90fec2179093dd420e339 | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 714 | java |
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* 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.
*/
public class Main {
public static void main() {
try {
} final<caret>
}
}
| [
"roman.shevchenko@jetbrains.com"
] | roman.shevchenko@jetbrains.com |
3ed9b2e7ebac3ef9ed365e2822d02e18a66dae58 | 6cfbdf73a787c377b94a794c265777c466ffedb1 | /Indexador/src/test/java/MyMainClass.java | 8cfe493f03a8f6ada5cc79764d8d4c0c16246493 | [] | no_license | PianoBar22/DLC2021-MotorBusqueda | 30711a3c2e0d18106281d9e4dff203a366e4f43f | 28ea77c9871bad6d3852d99dc45381f78464fd75 | refs/heads/master | 2023-05-29T16:21:57.497253 | 2021-06-11T20:15:49 | 2021-06-11T20:15:49 | 361,952,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java |
import java.io.File;
import utn.dlc.entidades.Documento;
import utn.dlc.indexador.ProcesadorArchivos;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author CC31899077
*/
public class MyMainClass {
public static void main(String[] args) {
ProcesadorArchivos procesa = new ProcesadorArchivos();
System.out.println("hoasd");
procesa.procesarCarpeta(new File("C:\\UTN\\DLC\\POMMotorBusqueda\\Documentos\\Prueba"));
}
}
| [
"frhernandez22@gmail.com"
] | frhernandez22@gmail.com |
975e333c19f34e7a7563064cb310e8639f4c805d | 25456252e7343a3ae16dadb28170ad12681179f8 | /frameworks/opt/net/ethernet/java/com/android/server/ethernet/EthernetNetworkFactory.java | 8256d5865f29841eee52f3bc02d5e5f70f5e7b26 | [] | no_license | fengjixuchui/AndroidFrameworksSourceCode-master | 3600c9f658192933261203b630704dc588458e2d | b3a496a1920eb936e5cbca156ba040cc95756e28 | refs/heads/master | 2023-04-13T00:32:56.025288 | 2020-04-14T09:49:44 | 2020-04-14T09:49:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,326 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.server.ethernet;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.DhcpResults;
import android.net.EthernetManager;
import android.net.InterfaceConfiguration;
import android.net.IpConfiguration;
import android.net.IpConfiguration.IpAssignment;
import android.net.IpConfiguration.ProxySettings;
import android.net.LinkProperties;
import android.net.NetworkAgent;
import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
import android.net.NetworkUtils;
import android.net.StaticIpConfiguration;
import android.os.Handler;
import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.net.BaseNetworkObserver;
import java.io.FileDescriptor;
/**
* Manages connectivity for an Ethernet interface.
*
* Ethernet Interfaces may be present at boot time or appear after boot (e.g.,
* for Ethernet adapters connected over USB). This class currently supports
* only one interface. When an interface appears on the system (or is present
* at boot time) this class will start tracking it and bring it up, and will
* attempt to connect when requested. Any other interfaces that subsequently
* appear will be ignored until the tracked interface disappears. Only
* interfaces whose names match the <code>config_ethernet_iface_regex</code>
* regular expression are tracked.
*
* This class reports a static network score of 70 when it is tracking an
* interface and that interface's link is up, and a score of 0 otherwise.
*
* @hide
*/
class EthernetNetworkFactory {
private static final String NETWORK_TYPE = "Ethernet";
private static final String TAG = "EthernetNetworkFactory";
private static final int NETWORK_SCORE = 70;
private static final boolean DBG = true;
/** Tracks interface changes. Called from NetworkManagementService. */
private InterfaceObserver mInterfaceObserver;
/** For static IP configuration */
private EthernetManager mEthernetManager;
/** To set link state and configure IP addresses. */
private INetworkManagementService mNMService;
/* To communicate with ConnectivityManager */
private NetworkCapabilities mNetworkCapabilities;
private NetworkAgent mNetworkAgent;
private LocalNetworkFactory mFactory;
private Context mContext;
/** Product-dependent regular expression of interface names we track. */
private static String mIfaceMatch = "";
/** Data members. All accesses to these must be synchronized(this). */
private static String mIface = "";
private String mHwAddr;
private static boolean mLinkUp;
private NetworkInfo mNetworkInfo;
private LinkProperties mLinkProperties;
EthernetNetworkFactory() {
mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORK_TYPE, "");
mLinkProperties = new LinkProperties();
initNetworkCapabilities();
}
private class LocalNetworkFactory extends NetworkFactory {
LocalNetworkFactory(String name, Context context, Looper looper) {
super(looper, context, name, new NetworkCapabilities());
}
protected void startNetwork() {
onRequestNetwork();
}
protected void stopNetwork() {
}
}
/**
* Updates interface state variables.
* Called on link state changes or on startup.
*/
private void updateInterfaceState(String iface, boolean up) {
if (!mIface.equals(iface)) {
return;
}
Log.d(TAG, "updateInterface: " + iface + " link " + (up ? "up" : "down"));
synchronized(this) {
mLinkUp = up;
mNetworkInfo.setIsAvailable(up);
if (!up) {
// Tell the agent we're disconnected. It will call disconnect().
mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr);
}
updateAgent();
// set our score lower than any network could go
// so we get dropped. TODO - just unregister the factory
// when link goes down.
mFactory.setScoreFilter(up ? NETWORK_SCORE : -1);
}
}
private class InterfaceObserver extends BaseNetworkObserver {
@Override
public void interfaceLinkStateChanged(String iface, boolean up) {
updateInterfaceState(iface, up);
}
@Override
public void interfaceAdded(String iface) {
maybeTrackInterface(iface);
}
@Override
public void interfaceRemoved(String iface) {
stopTrackingInterface(iface);
}
}
private void setInterfaceUp(String iface) {
// Bring up the interface so we get link status indications.
try {
mNMService.setInterfaceUp(iface);
String hwAddr = null;
InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
if (config == null) {
Log.e(TAG, "Null iterface config for " + iface + ". Bailing out.");
return;
}
synchronized (this) {
if (mIface.isEmpty()) {
mIface = iface;
mHwAddr = config.getHardwareAddress();
mNetworkInfo.setIsAvailable(true);
mNetworkInfo.setExtraInfo(mHwAddr);
} else {
Log.e(TAG, "Interface unexpectedly changed from " + iface + " to " + mIface);
mNMService.setInterfaceDown(iface);
}
}
} catch (RemoteException e) {
Log.e(TAG, "Error upping interface " + mIface + ": " + e);
}
}
private boolean maybeTrackInterface(String iface) {
// If we don't already have an interface, and if this interface matches
// our regex, start tracking it.
if (!iface.matches(mIfaceMatch) || !mIface.isEmpty())
return false;
Log.d(TAG, "Started tracking interface " + iface);
setInterfaceUp(iface);
return true;
}
private void stopTrackingInterface(String iface) {
if (!iface.equals(mIface))
return;
Log.d(TAG, "Stopped tracking interface " + iface);
// TODO: Unify this codepath with stop().
synchronized (this) {
NetworkUtils.stopDhcp(mIface);
mIface = "";
mHwAddr = null;
mNetworkInfo.setExtraInfo(null);
mLinkUp = false;
mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr);
updateAgent();
mNetworkAgent = null;
mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORK_TYPE, "");
mLinkProperties = new LinkProperties();
}
}
private boolean setStaticIpAddress(StaticIpConfiguration staticConfig) {
if (staticConfig.ipAddress != null &&
staticConfig.gateway != null &&
staticConfig.dnsServers.size() > 0) {
try {
Log.i(TAG, "Applying static IPv4 configuration to " + mIface + ": " + staticConfig);
InterfaceConfiguration config = mNMService.getInterfaceConfig(mIface);
config.setLinkAddress(staticConfig.ipAddress);
mNMService.setInterfaceConfig(mIface, config);
return true;
} catch(RemoteException|IllegalStateException e) {
Log.e(TAG, "Setting static IP address failed: " + e.getMessage());
}
} else {
Log.e(TAG, "Invalid static IP configuration.");
}
return false;
}
public void updateAgent() {
synchronized (EthernetNetworkFactory.this) {
if (mNetworkAgent == null) return;
if (DBG) {
Log.i(TAG, "Updating mNetworkAgent with: " +
mNetworkCapabilities + ", " +
mNetworkInfo + ", " +
mLinkProperties);
}
mNetworkAgent.sendNetworkCapabilities(mNetworkCapabilities);
mNetworkAgent.sendNetworkInfo(mNetworkInfo);
mNetworkAgent.sendLinkProperties(mLinkProperties);
// never set the network score below 0.
mNetworkAgent.sendNetworkScore(mLinkUp? NETWORK_SCORE : 0);
}
}
/* Called by the NetworkFactory on the handler thread. */
public void onRequestNetwork() {
// TODO: Handle DHCP renew.
Thread dhcpThread = new Thread(new Runnable() {
public void run() {
if (DBG) Log.i(TAG, "dhcpThread(+" + mIface + "): mNetworkInfo=" + mNetworkInfo);
LinkProperties linkProperties;
IpConfiguration config = mEthernetManager.getConfiguration();
if (config.getIpAssignment() == IpAssignment.STATIC) {
if (!setStaticIpAddress(config.getStaticIpConfiguration())) {
// We've already logged an error.
return;
}
linkProperties = config.getStaticIpConfiguration().toLinkProperties(mIface);
} else {
mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, mHwAddr);
DhcpResults dhcpResults = new DhcpResults();
// TODO: Handle DHCP renewals better.
// In general runDhcp handles DHCP renewals for us, because
// the dhcp client stays running, but if the renewal fails,
// we will lose our IP address and connectivity without
// noticing.
if (!NetworkUtils.runDhcp(mIface, dhcpResults)) {
Log.e(TAG, "DHCP request error:" + NetworkUtils.getDhcpError());
// set our score lower than any network could go
// so we get dropped.
mFactory.setScoreFilter(-1);
return;
}
linkProperties = dhcpResults.toLinkProperties(mIface);
}
if (config.getProxySettings() == ProxySettings.STATIC ||
config.getProxySettings() == ProxySettings.PAC) {
linkProperties.setHttpProxy(config.getHttpProxy());
}
String tcpBufferSizes = mContext.getResources().getString(
com.android.internal.R.string.config_ethernet_tcp_buffers);
if (TextUtils.isEmpty(tcpBufferSizes) == false) {
linkProperties.setTcpBufferSizes(tcpBufferSizes);
}
synchronized(EthernetNetworkFactory.this) {
if (mNetworkAgent != null) {
Log.e(TAG, "Already have a NetworkAgent - aborting new request");
return;
}
mLinkProperties = linkProperties;
mNetworkInfo.setIsAvailable(true);
mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, mHwAddr);
// Create our NetworkAgent.
mNetworkAgent = new NetworkAgent(mFactory.getLooper(), mContext,
NETWORK_TYPE, mNetworkInfo, mNetworkCapabilities, mLinkProperties,
NETWORK_SCORE) {
public void unwanted() {
synchronized(EthernetNetworkFactory.this) {
if (this == mNetworkAgent) {
NetworkUtils.stopDhcp(mIface);
mLinkProperties.clear();
mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null,
mHwAddr);
updateAgent();
mNetworkAgent = null;
try {
mNMService.clearInterfaceAddresses(mIface);
} catch (Exception e) {
Log.e(TAG, "Failed to clear addresses or disable ipv6" + e);
}
} else {
Log.d(TAG, "Ignoring unwanted as we have a more modern " +
"instance");
}
}
};
};
}
}
});
dhcpThread.start();
}
/**
* Begin monitoring connectivity
*/
public synchronized void start(Context context, Handler target) {
// The services we use.
IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
mNMService = INetworkManagementService.Stub.asInterface(b);
mEthernetManager = (EthernetManager) context.getSystemService(Context.ETHERNET_SERVICE);
// Interface match regex.
mIfaceMatch = context.getResources().getString(
com.android.internal.R.string.config_ethernet_iface_regex);
// Create and register our NetworkFactory.
mFactory = new LocalNetworkFactory(NETWORK_TYPE, context, target.getLooper());
mFactory.setCapabilityFilter(mNetworkCapabilities);
mFactory.setScoreFilter(-1); // this set high when we have an iface
mFactory.register();
mContext = context;
// Start tracking interface change events.
mInterfaceObserver = new InterfaceObserver();
try {
mNMService.registerObserver(mInterfaceObserver);
} catch (RemoteException e) {
Log.e(TAG, "Could not register InterfaceObserver " + e);
}
// If an Ethernet interface is already connected, start tracking that.
// Otherwise, the first Ethernet interface to appear will be tracked.
try {
final String[] ifaces = mNMService.listInterfaces();
for (String iface : ifaces) {
synchronized(this) {
if (maybeTrackInterface(iface)) {
// We have our interface. Track it.
// Note: if the interface already has link (e.g., if we
// crashed and got restarted while it was running),
// we need to fake a link up notification so we start
// configuring it. Since we're already holding the lock,
// any real link up/down notification will only arrive
// after we've done this.
if (mNMService.getInterfaceConfig(iface).hasFlag("running")) {
updateInterfaceState(iface, true);
}
break;
}
}
}
} catch (RemoteException e) {
Log.e(TAG, "Could not get list of interfaces " + e);
}
}
public synchronized void stop() {
NetworkUtils.stopDhcp(mIface);
// ConnectivityService will only forget our NetworkAgent if we send it a NetworkInfo object
// with a state of DISCONNECTED or SUSPENDED. So we can't simply clear our NetworkInfo here:
// that sets the state to IDLE, and ConnectivityService will still think we're connected.
//
// TODO: stop using explicit comparisons to DISCONNECTED / SUSPENDED in ConnectivityService,
// and instead use isConnectedOrConnecting().
mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr);
mLinkUp = false;
updateAgent();
mLinkProperties = new LinkProperties();
mNetworkAgent = null;
mIface = "";
mHwAddr = null;
mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORK_TYPE, "");
mFactory.unregister();
}
private void initNetworkCapabilities() {
mNetworkCapabilities = new NetworkCapabilities();
mNetworkCapabilities.addTransportType(NetworkCapabilities.TRANSPORT_ETHERNET);
mNetworkCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
mNetworkCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED);
// We have no useful data on bandwidth. Say 100M up and 100M down. :-(
mNetworkCapabilities.setLinkUpstreamBandwidthKbps(100 * 1000);
mNetworkCapabilities.setLinkDownstreamBandwidthKbps(100 * 1000);
}
synchronized void dump(FileDescriptor fd, IndentingPrintWriter pw, String[] args) {
if (!TextUtils.isEmpty(mIface)) {
pw.println("Tracking interface: " + mIface);
pw.increaseIndent();
pw.println("MAC address: " + mHwAddr);
pw.println("Link state: " + (mLinkUp ? "up" : "down"));
pw.decreaseIndent();
} else {
pw.println("Not tracking any interface");
}
pw.println();
pw.println("NetworkInfo: " + mNetworkInfo);
pw.println("LinkProperties: " + mLinkProperties);
pw.println("NetworkAgent: " + mNetworkAgent);
}
}
| [
"351181429@qq.com"
] | 351181429@qq.com |
87d231c6cf3f707917e4348e956d784108bcb364 | cd5022c44c2028590acb307c0ee06cdea9632600 | /dms-app/src/main/java/it/akademija/controller/GroupController.java | 0993b71cb5149cb10128ebe6a80228272311c120 | [] | no_license | JustasMarkauskas/Document-Management-System | 4c058bf7fc1f90cc543f858dca3decbc738c983f | 908ebf192ea9307dc8caa6827ef8cf55f6eb9bcb | refs/heads/master | 2022-02-07T09:34:43.965244 | 2020-03-26T14:24:30 | 2020-03-26T14:24:30 | 235,521,802 | 1 | 1 | null | 2022-02-01T01:01:25 | 2020-01-22T07:34:09 | Java | UTF-8 | Java | false | false | 5,740 | java | package it.akademija.controller;
import java.util.List;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import it.akademija.model.group.GroupForClient;
import it.akademija.model.group.NewGroup;
import it.akademija.service.GroupService;
@RestController
@RequestMapping(value = "/api/group")
public class GroupController {
private static final Logger LOGGER = LoggerFactory.getLogger(GroupController.class);
private final GroupService groupService;
@Autowired
public GroupController(GroupService groupService) {
this.groupService = groupService;
}
@RequestMapping(method = RequestMethod.GET)
@ApiOperation(value = "Get Groups", notes = "Returns list of all groups")
public List<GroupForClient> getGroupsForClient() {
return groupService.getGroupsForClient();
}
@RequestMapping(path = "/starting-with/{groupNameText}", method = RequestMethod.GET)
@ApiOperation(value = "Get Groups starting with", notes = "Returns list of groups starting with passed String")
public List<GroupForClient> getGroupsForClient(@PathVariable String groupNameText) {
return groupService.getGroupsForClientContaining(groupNameText);
}
@RequestMapping(path = "/{groupName}", method = RequestMethod.GET)
@ApiOperation(value = "Get Group", notes = "Returns group, group users, group doc types by group name")
public GroupForClient getGroupForClient(@PathVariable String groupName) {
return groupService.getGroupForClient(groupName);
}
@RequestMapping(path = "/group-names", method = RequestMethod.GET)
@ApiOperation(value = "Get all group names", notes = "Returns list of all group names")
public List<String> getAllGroupNames() {
return groupService.getAllGroupNames();
}
@RequestMapping(method = RequestMethod.POST)
@ApiOperation(value = "Create group", notes = "Creates group with data")
public ResponseEntity<String> saveGroup(@ApiParam(required = true) @Valid @RequestBody final NewGroup newGroup) {
if (groupService.findByGroupName(newGroup.getId()) == null) {
LOGGER.info("Action by {}. Created group: {}",
SecurityContextHolder.getContext().getAuthentication().getName(), newGroup.getId());
groupService.saveGroup(newGroup);
return new ResponseEntity<String>("Saved succesfully", HttpStatus.CREATED);
} else {
LOGGER.warn("Action by {}. Group {} is not created",
SecurityContextHolder.getContext().getAuthentication().getName(), newGroup.getId());
return new ResponseEntity<String>("Failed to create group", HttpStatus.CONFLICT);
}
}
@RequestMapping(path = "/update-comment/{groupName}", method = RequestMethod.PUT)
@ApiOperation(value = "Update group comment", notes = "Update group comment")
public void updateGroupComment(@ApiParam(required = true) @PathVariable String groupName,
@Valid @RequestBody final NewGroup newGroup) {
groupService.updateGroupComment(groupName, newGroup);
LOGGER.info("Action by {}. Updated group comment for group: {}",
SecurityContextHolder.getContext().getAuthentication().getName(), groupName);
}
@RequestMapping(path = "/update-group-doctypes-for-approval/{groupName}", method = RequestMethod.PUT)
@ApiOperation(value = "Update group doc types for approval", notes = "Add/update doc types for approval to group")
public void updateDocTypeForApproval(@ApiParam(required = true) @PathVariable String groupName,
@Valid @RequestParam final List<String> docTypesForApprovalNames) {
groupService.updateDocTypesForApproval(groupName, docTypesForApprovalNames);
LOGGER.info("Action by {}. Updated group DFA for group: {}. After update DFA names: {}",
SecurityContextHolder.getContext().getAuthentication().getName(), groupName, docTypesForApprovalNames);
}
@RequestMapping(path = "/update-group-doctypes-for-creation/{groupName}", method = RequestMethod.PUT)
@ApiOperation(value = "Update group doc types for creation", notes = "Add/update doc types for creation to group")
public void updateDocTypeForCreation(@ApiParam(required = true) @PathVariable String groupName,
@Valid @RequestParam final List<String> docTypesForCreationNames) {
groupService.updateDocTypesForCreation(groupName, docTypesForCreationNames);
LOGGER.info("Action by {}. Updated group DFC for group: {}. After update DFC names: {}",
SecurityContextHolder.getContext().getAuthentication().getName(), groupName, docTypesForCreationNames);
}
@RequestMapping(method = RequestMethod.DELETE)
@ApiOperation(value = "Deletes group by name", notes = "Usefull for testing")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteGroupByName(@RequestParam final String groupName) {
groupService.deleteGroupByName(groupName);
}
@RequestMapping(path = "/comment", method = RequestMethod.DELETE)
@ApiOperation(value = "Deletes groups by comment", notes = "Usefull for testing")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteGroupsByComment(@RequestParam final String comment) {
groupService.deleteGroupsByComment(comment);
}
}
| [
"giedrius.genys@gmail.com"
] | giedrius.genys@gmail.com |
966f12f617e9a9c5dbd0daf424909493a6b2a9cc | 5e617eb133e7182ab0d7db420a28aed347f869ae | /src/mqtt/MqttTopicSubscription.java | b7e5378e856dee399aa9d6ef39115a10bab31faf | [] | no_license | BlakeCode/MQTT | 0b4d0724335d1207e636600347930ef125e44562 | 61cc0e1bf8ffc7e4a369a82117052db688ee87f3 | refs/heads/master | 2023-01-05T02:35:06.237638 | 2020-10-20T03:09:26 | 2020-10-20T03:09:26 | 302,305,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,085 | java | package mqtt;
public class MqttTopicSubscription {
private String topicFilter;
private MqttQoS mqttQoS;
private boolean isNoLocal;
private boolean isRetainAsPublished;
private int retainhandlingOption;
private final int Reserved = 0;
public MqttTopicSubscription(String topicFilter, MqttQoS mqttQoS, boolean isNoLocal, boolean isRetainAsPublished, int retainhandlingOption) {
this.topicFilter = topicFilter;
this.mqttQoS = mqttQoS;
this.isNoLocal = isNoLocal;
this.isRetainAsPublished = isRetainAsPublished;
this.retainhandlingOption = retainhandlingOption;
}
public MqttTopicSubscription(String topicFilter) {
this(topicFilter, null, false, false, 0);
}
// Get Methord
public String getTopicFilter() { return topicFilter; }
public MqttQoS getMqttQoS() { return mqttQoS; }
public boolean isNoLocal() { return isNoLocal; }
public boolean isRetainAsPublished() { return isRetainAsPublished; }
public int getRetainhandlingOption() { return retainhandlingOption; }
}
| [
"472369577@qq.com"
] | 472369577@qq.com |
f2771c234dbf5e6929e1daa8346a740eea031729 | d7116bd6da53058dc95f33e60f5fb5ebcfb28954 | /src/main/java/org/wso2/custom/saml/CustomSAMLAssertionBuilder.java | 8ba5cd9b4005c918f41de21d71a234a41ef66d09 | [] | no_license | nipunthathsara/wso2-custom-asseertion-builder | c1f96c58d69a589ba9aa52f7aa2ea645a4ca58a8 | c33f42e8798188d35b83d044b46bf11e6d805c06 | refs/heads/master | 2022-04-22T06:06:31.122982 | 2020-04-14T13:54:18 | 2020-04-14T13:54:18 | 255,622,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,266 | java | package org.wso2.custom.saml;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import org.opensaml.Configuration;
import org.opensaml.common.SAMLVersion;
import org.opensaml.saml1.core.NameIdentifier;
import org.opensaml.saml2.core.Assertion;
import org.opensaml.saml2.core.Attribute;
import org.opensaml.saml2.core.AttributeStatement;
import org.opensaml.saml2.core.AttributeValue;
import org.opensaml.saml2.core.Audience;
import org.opensaml.saml2.core.AudienceRestriction;
import org.opensaml.saml2.core.AuthenticatingAuthority;
import org.opensaml.saml2.core.AuthnContext;
import org.opensaml.saml2.core.AuthnContextClassRef;
import org.opensaml.saml2.core.AuthnStatement;
import org.opensaml.saml2.core.Conditions;
import org.opensaml.saml2.core.NameID;
import org.opensaml.saml2.core.Subject;
import org.opensaml.saml2.core.SubjectConfirmation;
import org.opensaml.saml2.core.SubjectConfirmationData;
import org.opensaml.saml2.core.impl.AssertionBuilder;
import org.opensaml.saml2.core.impl.AttributeBuilder;
import org.opensaml.saml2.core.impl.AttributeStatementBuilder;
import org.opensaml.saml2.core.impl.AudienceBuilder;
import org.opensaml.saml2.core.impl.AudienceRestrictionBuilder;
import org.opensaml.saml2.core.impl.AuthnContextBuilder;
import org.opensaml.saml2.core.impl.AuthnContextClassRefBuilder;
import org.opensaml.saml2.core.impl.AuthnStatementBuilder;
import org.opensaml.saml2.core.impl.ConditionsBuilder;
import org.opensaml.saml2.core.impl.NameIDBuilder;
import org.opensaml.saml2.core.impl.SubjectBuilder;
import org.opensaml.saml2.core.impl.SubjectConfirmationBuilder;
import org.opensaml.saml2.core.impl.SubjectConfirmationDataBuilder;
import org.opensaml.xml.schema.XSString;
import org.opensaml.xml.schema.impl.XSStringBuilder;
import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.core.util.IdentityCoreConstants;
import org.wso2.carbon.identity.sso.saml.SAMLSSOConstants;
import org.wso2.carbon.identity.sso.saml.builders.AuthenticatingAuthorityImpl;
import org.wso2.carbon.identity.sso.saml.builders.SignKeyDataHolder;
import org.wso2.carbon.identity.sso.saml.builders.assertion.DefaultSAMLAssertionBuilder;
import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOAuthnReqDTO;
import org.wso2.carbon.identity.sso.saml.util.SAMLSSOUtil;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
public class CustomSAMLAssertionBuilder extends DefaultSAMLAssertionBuilder {
private static Log log = LogFactory.getLog(CustomSAMLAssertionBuilder.class);
private String userAttributeSeparator = IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR_DEFAULT;
public static final String USER_STORE_DOMAIN_PREFIX = "wso2.com";
@Override
public Assertion buildAssertion(SAMLSSOAuthnReqDTO authReqDTO, DateTime notOnOrAfter, String sessionId) throws IdentityException {
try {
DateTime currentTime = new DateTime();
Assertion samlAssertion = new AssertionBuilder().buildObject();
samlAssertion.setID(SAMLSSOUtil.createID());
samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
samlAssertion.setIssueInstant(currentTime);
Subject subject = new SubjectBuilder().buildObject();
NameID nameId = new NameIDBuilder().buildObject();
nameId.setValue(USER_STORE_DOMAIN_PREFIX + "/" + authReqDTO.getUser().getAuthenticatedSubjectIdentifier());
if (authReqDTO.getNameIDFormat() != null) {
nameId.setFormat(authReqDTO.getNameIDFormat());
} else {
nameId.setFormat(NameIdentifier.EMAIL);
}
subject.setNameID(nameId);
log.info("Name id : " + nameId);
SubjectConfirmation subjectConfirmation = new SubjectConfirmationBuilder()
.buildObject();
subjectConfirmation.setMethod(SAMLSSOConstants.SUBJECT_CONFIRM_BEARER);
SubjectConfirmationData scData = new SubjectConfirmationDataBuilder().buildObject();
scData.setRecipient(authReqDTO.getAssertionConsumerURL());
scData.setNotOnOrAfter(notOnOrAfter);
if (!authReqDTO.isIdPInitSSOEnabled()) {
scData.setInResponseTo(authReqDTO.getId());
}
subjectConfirmation.setSubjectConfirmationData(scData);
subject.getSubjectConfirmations().add(subjectConfirmation);
if (authReqDTO.getRequestedRecipients() != null && authReqDTO.getRequestedRecipients().length > 0) {
for (String recipient : authReqDTO.getRequestedRecipients()) {
subjectConfirmation = new SubjectConfirmationBuilder()
.buildObject();
subjectConfirmation.setMethod(SAMLSSOConstants.SUBJECT_CONFIRM_BEARER);
scData = new SubjectConfirmationDataBuilder().buildObject();
scData.setRecipient(recipient);
scData.setNotOnOrAfter(notOnOrAfter);
if (!authReqDTO.isIdPInitSSOEnabled()) {
scData.setInResponseTo(authReqDTO.getId());
}
subjectConfirmation.setSubjectConfirmationData(scData);
subject.getSubjectConfirmations().add(subjectConfirmation);
}
}
samlAssertion.setSubject(subject);
addAuthStatement(authReqDTO, sessionId, samlAssertion);
/*
* If <AttributeConsumingServiceIndex> element is in the <AuthnRequest> and according to
* the spec 2.0 the subject MUST be in the assertion
*/
Map<String, String> claims = SAMLSSOUtil.getAttributes(authReqDTO);
if (claims != null && !claims.isEmpty()) {
AttributeStatement attrStmt = buildAttributeStatement(claims);
if (attrStmt != null) {
samlAssertion.getAttributeStatements().add(attrStmt);
}
}
AudienceRestriction audienceRestriction = new AudienceRestrictionBuilder()
.buildObject();
Audience issuerAudience = new AudienceBuilder().buildObject();
issuerAudience.setAudienceURI(authReqDTO.getIssuerWithDomain());
audienceRestriction.getAudiences().add(issuerAudience);
if (authReqDTO.getRequestedAudiences() != null) {
for (String requestedAudience : authReqDTO.getRequestedAudiences()) {
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(requestedAudience);
audienceRestriction.getAudiences().add(audience);
}
}
Conditions conditions = new ConditionsBuilder().buildObject();
conditions.setNotBefore(currentTime);
conditions.setNotOnOrAfter(notOnOrAfter);
conditions.getAudienceRestrictions().add(audienceRestriction);
samlAssertion.setConditions(conditions);
if (authReqDTO.getDoSignAssertions()) {
SAMLSSOUtil.setSignature(samlAssertion, authReqDTO.getSigningAlgorithmUri(), authReqDTO
.getDigestAlgorithmUri(), new SignKeyDataHolder(authReqDTO.getUser()
.getAuthenticatedSubjectIdentifier()));
}
return samlAssertion;
} catch (Exception e) {
log.error("Error when reading claim values for generating SAML Response", e);
throw IdentityException.error(
"Error when reading claim values for generating SAML Response", e);
}
}
private AttributeStatement buildAttributeStatement(Map<String, String> claims) {
String claimSeparator = claims.get(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
if (StringUtils.isNotBlank(claimSeparator)) {
userAttributeSeparator = claimSeparator;
}
claims.remove(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
AttributeStatement attStmt = new AttributeStatementBuilder().buildObject();
Iterator<Map.Entry<String, String>> iterator = claims.entrySet().iterator();
boolean atLeastOneNotEmpty = false;
for (int i = 0; i < claims.size(); i++) {
Map.Entry<String, String> claimEntry = iterator.next();
String claimUri = claimEntry.getKey();
String claimValue = claimEntry.getValue();
if (claimUri != null && !claimUri.trim().isEmpty() && claimValue != null && !claimValue.trim().isEmpty()) {
atLeastOneNotEmpty = true;
Attribute attribute = new AttributeBuilder().buildObject();
attribute.setName(claimUri);
//setting NAMEFORMAT attribute value to basic attribute profile
attribute.setNameFormat(SAMLSSOConstants.NAME_FORMAT_BASIC);
// look
// https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaAnyTypes
XSStringBuilder stringBuilder = (XSStringBuilder) Configuration.getBuilderFactory().
getBuilder(XSString.TYPE_NAME);
XSString stringValue;
//Need to check if the claim has multiple values
if (userAttributeSeparator != null && claimValue.contains(userAttributeSeparator)) {
StringTokenizer st = new StringTokenizer(claimValue, userAttributeSeparator);
while (st.hasMoreElements()) {
String attValue = st.nextElement().toString();
if (attValue != null && attValue.trim().length() > 0) {
stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringValue.setValue(attValue);
attribute.getAttributeValues().add(stringValue);
}
}
} else {
stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
stringValue.setValue(claimValue);
attribute.getAttributeValues().add(stringValue);
}
attStmt.getAttributes().add(attribute);
}
}
if (atLeastOneNotEmpty) {
return attStmt;
} else {
return null;
}
}
private void addAuthStatement(SAMLSSOAuthnReqDTO authReqDTO, String sessionId, Assertion samlAssertion) {
DateTime authnInstant = new DateTime();
if (authReqDTO.getIdpAuthenticationContextProperties().get(SAMLSSOConstants.AUTHN_CONTEXT_CLASS_REF) != null
&& !authReqDTO.getIdpAuthenticationContextProperties().get(SAMLSSOConstants.AUTHN_CONTEXT_CLASS_REF)
.isEmpty()) {
List<Map<String, Object>> authenticationContextProperties = authReqDTO
.getIdpAuthenticationContextProperties().get(SAMLSSOConstants.AUTHN_CONTEXT_CLASS_REF);
for (Map<String, Object> authenticationContextProperty : authenticationContextProperties) {
if (authenticationContextProperty.get(SAMLSSOConstants.PASS_THROUGH_DATA) != null) {
List<String> authnContextClassRefList = (List<String>) authenticationContextProperty
.get(SAMLSSOConstants.PASS_THROUGH_DATA);
if (!authnContextClassRefList.isEmpty()) {
String idpEntityId = null;
if (authenticationContextProperty.get(IdentityApplicationConstants.Authenticator
.SAML2SSO.IDP_ENTITY_ID) != null) {
idpEntityId = (String) authenticationContextProperty.get(IdentityApplicationConstants
.Authenticator.SAML2SSO.IDP_ENTITY_ID);
}
for (String authnContextClassRef : authnContextClassRefList) {
if (StringUtils.isNotBlank(authnContextClassRef)) {
if (log.isDebugEnabled()) {
log.debug("Passing AuthnContextClassRef: " + authnContextClassRef + " and " +
"AuthenticatingAuthority:" + idpEntityId + " in the AuthnStatement");
}
samlAssertion.getAuthnStatements().add(getAuthnStatement(authReqDTO, sessionId,
authnContextClassRef, authnInstant, idpEntityId));
}
}
}
}
}
}
}
private AuthnStatement getAuthnStatement(SAMLSSOAuthnReqDTO authReqDTO, String sessionId,
String authnContextClassRef, DateTime authnInstant, String idPEntityId) {
AuthnStatement authStmt = new AuthnStatementBuilder().buildObject();
authStmt.setAuthnInstant(authnInstant);
AuthnContext authContext = new AuthnContextBuilder().buildObject();
AuthnContextClassRef authCtxClassRef = new AuthnContextClassRefBuilder().buildObject();
authCtxClassRef.setAuthnContextClassRef(authnContextClassRef);
authContext.setAuthnContextClassRef(authCtxClassRef);
if (StringUtils.isNotBlank(idPEntityId)) {
AuthenticatingAuthority authenticatingAuthority = new AuthenticatingAuthorityImpl();
authenticatingAuthority.setURI(idPEntityId);
authContext.getAuthenticatingAuthorities().add(authenticatingAuthority);
}
authStmt.setAuthnContext(authContext);
if (authReqDTO.isDoSingleLogout()) {
authStmt.setSessionIndex(sessionId);
}
return authStmt;
}
} | [
"nipunthathsara@gmail.com"
] | nipunthathsara@gmail.com |
1d2f870594c4206a4000a61f5c6220e8d77ecdf6 | 147f38061d35e0d97a39b062c1b9a88bb40d84bb | /beauty.app/src/main/biz/com/beauty/controller/RoleController.java | bad47b224bea817cafc15e9bb0785a74239eff1d | [] | no_license | frinder6/beauty.app | 47cb371d2421a34f351553ac20625c050a6034fc | c47dfbde15d3d4b779bd1bfa59988cf11ce07083 | refs/heads/master | 2021-01-17T14:43:06.349956 | 2016-09-27T13:42:23 | 2016-09-27T13:42:23 | 54,475,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,871 | java | package com.beauty.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.beauty.entity.BeautyRole;
import com.beauty.entity.Page;
import com.beauty.model.Value;
import com.beauty.service.RoleService;
import com.beauty.util.CodeUtil;
import com.beauty.util.RedisUtil;
import com.beauty.util.StringUtil;
@Controller
@RequestMapping("/role")
public class RoleController {
@Autowired
private RoleService roleService;
@RequestMapping(value = "/load/page", produces = "application/json; charset=utf-8")
@ResponseBody
public List<?> queryPage() {
Map<String, Object> params = new HashMap<>();
params.put(RedisUtil._REDIS_CACHE_KEY, RedisUtil.getRedisKey("ROLE", params));
List<?> list = this.roleService.selectPage(params);
return list;
}
/*public Page queryPage(HttpServletRequest request, BeautyRole entity) {
Page page = new Page();
page.init(request);
Map<String, Object> params = new HashMap<String, Object>();
// 将page值设置到map中
page.pageToMap(BeautyRole.class, params);
params.put(RedisUtil._KEY_1, 1);
params.put(RedisUtil._REDIS_CACHE_KEY, RedisUtil.getRedisKey("ROLE", params));
int count = this.roleService.selectCount(params);
params.put(RedisUtil._KEY_2, 2);
params.put(RedisUtil._REDIS_CACHE_KEY, RedisUtil.getRedisKey("ROLE", params));
List<?> list = this.roleService.selectPage(params);
page.setResult(list, count + "", count + "");
return page;
}*/
@RequestMapping(value = "/add", produces = "application/json; charset=utf-8")
@ResponseBody
public Value persist(BeautyRole entity) {
entity.setCode(StringUtil.code(entity.getName()));
this.roleService.insertSelective(entity);
return new Value(CodeUtil.ADD_SUCCESS);
}
@RequestMapping(value = "/update", produces = "application/json; charset=utf-8")
@ResponseBody
public Value modify(BeautyRole entity) {
entity.setCode(StringUtil.code(entity.getName()));
this.roleService.updateByPrimaryKeySelective(entity);
return new Value(CodeUtil.EDIT_SUCCESS);
}
@RequestMapping(value = "/remove", produces = "application/json; charset=utf-8")
@ResponseBody
public Value delete(Value value) {
if (!value.getValues().isEmpty()) {
this.roleService.deleteByPrimaryKeys(value.getValues());
}
return new Value(CodeUtil.DELETE_SUCCESS);
}
@RequestMapping(value = "/load/id", produces = "application/json; charset=utf-8")
@ResponseBody
public BeautyRole load(@RequestParam("id") Long id) {
return this.roleService.selectByPrimaryKey(id);
}
}
| [
"frinder.liu@vipshop.com"
] | frinder.liu@vipshop.com |
947e308c78a545bdc4a436969fd267aac419ce4a | b56b17fb6db96b7d9ef1cf095132b038717b0b4c | /app/src/main/java/com/food/sofra/data/model/general/cities/generalListOfCities/CityData.java | 141dbf1e18a395113bbbbdf90981de617a1b7cb8 | [] | no_license | vetaprog85samir/Sofra | 378fabc6516b9056fc32b78e0de841434d09e17c | 7d91942978189f4771b66458bc8b158ce7b6e2e6 | refs/heads/master | 2022-07-29T04:29:26.573731 | 2020-05-23T23:02:41 | 2020-05-23T23:02:41 | 266,341,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java |
package com.food.sofra.data.model.general.cities.generalListOfCities;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class CityData {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("name")
@Expose
private String name;
public CityData(int id, String name) {
this.id = id;
this.name=name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"37863223+vetaprog85samir@users.noreply.github.com"
] | 37863223+vetaprog85samir@users.noreply.github.com |
fc95a292a91140dd8ad887c7e2d0a7c3d1d159ad | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_45b80e0910e412363f642bbd4c5a7ce0dfbb6b0d/PhysicsEngine/13_45b80e0910e412363f642bbd4c5a7ce0dfbb6b0d_PhysicsEngine_t.java | 0c76aac055a28fcc2cd24ff7ad16975bc016f185 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,126 | java |
public class PhysicsEngine {
public PhysicsEngine() {
}
public static void affectObject(GraphicsObject go, Vector force) {
}
public static boolean isColliding(GraphicsObject go1, GraphicsObject go2) {
double go1x1 = go1.getReferencePoint()[0];
double go1x2 = go1x1 + go1.getWidth();
double go1y1 = go1.getReferencePoint()[1];
double go1y2 = go1y1 + go1.getHeight();
double go2x1 = go2.getReferencePoint()[0];
double go2x2 = go2x1 + go2.getWidth();
double go2y1 = go2.getReferencePoint()[1];
double go2y2 = go2y1 + go2.getHeight();
System.out.println(go1y1 + " - " + go1y2);
System.out.println(go2y1 + " - " + go2y2);
System.out.println();
// If go2.x1 is IN BETWEEN of go1x1 and go1x2 OR go2x2 is IN BETWEEN go1x1 and go1x2
if( (go2x1 >= go1x1 && go2x1 <= go1x2) || (go2x2 >= go1x1 && go2x2 <= go1x2) ) {
// If go2.y1 OR go2.y2 is IN BETWEEN go1.y1 AND go1.y2
if( (go2y1 >= go1y1 && go2y1 <= go1y2) || (go2y2 >= go1y1 && go2y2 <= go1y2) ) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c36bff6e77607319a4d8f6f884738600531c7c85 | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_8930_deP.java | 2970f8e2994af75d6d41114fa11ba98273270a20 | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,399 | java | import com.sun.jna.Native;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
public class deP extends bik
{
private static Map kYK = new WeakHashMap();
private static final int kYL = 13;
public Kg kYM;
public short kYN;
public short type = 13;
public axA kYO;
private deP(bik parambik)
{
bik.a(parambik, true);
axA[] arrayOfaxA;
int i;
Iterator localIterator;
if ((parambik instanceof Iy)) {
bJW localbJW1 = ((Iy)parambik).bRp;
arrayOfaxA = new axA[] { c(parambik.a(localbJW1.field), localbJW1.type), null };
}
else
{
arrayOfaxA = new axA[parambik.buc().size() + 1];
i = 0;
for (localIterator = parambik.buc().values().iterator(); localIterator.hasNext(); ) {
bJW localbJW2 = (bJW)localIterator.next();
arrayOfaxA[(i++)] = parambik.c(localbJW2);
}
}
a(arrayOfaxA);
}
private deP(Object paramObject, Class paramClass) {
int i = Array.getLength(paramObject);
axA[] arrayOfaxA = new axA[i + 1];
axA localaxA = c(null, paramClass.getComponentType());
for (int j = 0; j < i; j++) {
arrayOfaxA[j] = localaxA;
}
a(arrayOfaxA);
}
protected List aR() {
return Arrays.asList(new String[] { "size", "alignment", "type", "elements" });
}
private void a(axA[] paramArrayOfaxA) {
this.kYO = new dcj(axA.SIZE * paramArrayOfaxA.length);
this.kYO.b(0L, paramArrayOfaxA, 0, paramArrayOfaxA.length);
write();
}
public static axA bi(Object paramObject) {
if (paramObject == null)
return JM.Um();
if ((paramObject instanceof Class))
return c(null, (Class)paramObject);
return c(paramObject, paramObject.getClass());
}
private static axA c(Object paramObject, Class paramClass) {
bXj localbXj = Native.q(paramClass);
if (localbXj != null) {
aEQ localaEQ = localbXj.X(paramClass);
if (localaEQ != null) {
paramClass = localaEQ.WJ();
}
}
synchronized (kYK) {
Object localObject1 = kYK.get(paramClass);
if ((localObject1 instanceof axA)) {
return (axA)localObject1;
}
if ((localObject1 instanceof deP)) {
return ((deP)localObject1).sF();
}
if (bIG.gIh) { if ((bik.cvT == null ? (bik.cvT = bik.cd("java.nio.Buffer")) : bik.cvT).isAssignableFrom(paramClass)); } else if (!(bik.cvB == null ? (bik.cvB = bik.cd("dBN")) : bik.cvB).isAssignableFrom(paramClass))
break label161;
kYK.put(paramClass, JM.Um());
return JM.Um();
label161: Object localObject2;
if ((bik.bRq == null ? (bik.bRq = bik.cd("bik")) : bik.bRq).isAssignableFrom(paramClass)) {
if (paramObject == null) paramObject = a(paramClass, bik.buu());
if ((bik.cvF == null ? (bik.cvF = bik.cd("ckM")) : bik.cvF).isAssignableFrom(paramClass)) {
kYK.put(paramClass, JM.Um());
return JM.Um();
}
localObject2 = new deP((bik)paramObject);
kYK.put(paramClass, localObject2);
return ((deP)localObject2).sF();
}
if ((bik.bZS == null ? (bik.bZS = bik.cd("arr")) : bik.bZS).isAssignableFrom(paramClass)) {
localObject2 = MK.k(paramClass);
return c(((MK)localObject2).a(paramObject, new qd()), ((MK)localObject2).WJ());
}
if (paramClass.isArray()) {
localObject2 = new deP(paramObject, paramClass);
kYK.put(paramObject, localObject2);
return ((deP)localObject2).sF();
}
throw new IllegalArgumentException("Unsupported Structure field type " + paramClass);
}
}
static axA d(Object paramObject, Class paramClass)
{
return c(paramObject, paramClass);
}
static
{
if (Native.cuK == 0)
throw new Error("Native library not initialized");
if (JM.Ud() == null)
throw new Error("FFI types not initialized");
kYK.put(Void.TYPE, JM.Ud());
kYK.put(bik.cvP == null ? (bik.cvP = bik.cd("java.lang.Void")) : bik.cvP, JM.Ud());
kYK.put(Float.TYPE, JM.Ue());
kYK.put(bik.cvM == null ? (bik.cvM = bik.cd("java.lang.Float")) : bik.cvM, JM.Ue());
kYK.put(Double.TYPE, JM.Uf());
kYK.put(bik.cvN == null ? (bik.cvN = bik.cd("java.lang.Double")) : bik.cvN, JM.Uf());
kYK.put(Long.TYPE, JM.Ug());
kYK.put(bik.cvL == null ? (bik.cvL = bik.cd("java.lang.Long")) : bik.cvL, JM.Ug());
kYK.put(Integer.TYPE, JM.Uh());
kYK.put(bik.cvK == null ? (bik.cvK = bik.cd("java.lang.Integer")) : bik.cvK, JM.Uh());
kYK.put(Short.TYPE, JM.Ui());
kYK.put(bik.cvI == null ? (bik.cvI = bik.cd("java.lang.Short")) : bik.cvI, JM.Ui());
axA localaxA = Native.cuL == 2 ? JM.Uj() : JM.Uk();
kYK.put(Character.TYPE, localaxA);
kYK.put(bik.cvJ == null ? (bik.cvJ = bik.cd("java.lang.Character")) : bik.cvJ, localaxA);
kYK.put(Byte.TYPE, JM.Ul());
kYK.put(bik.cvH == null ? (bik.cvH = bik.cd("java.lang.Byte")) : bik.cvH, JM.Ul());
kYK.put(bik.bZT == null ? (bik.bZT = bik.cd("axA")) : bik.bZT, JM.Um());
kYK.put(bik.bRr == null ? (bik.bRr = bik.cd("java.lang.String")) : bik.bRr, JM.Um());
kYK.put(bik.bRs == null ? (bik.bRs = bik.cd("cFg")) : bik.bRs, JM.Um());
kYK.put(Boolean.TYPE, JM.Uk());
kYK.put(bik.cvG == null ? (bik.cvG = bik.cd("java.lang.Boolean")) : bik.cvG, JM.Uk());
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
79f66098716165d84f8b992699e9a8fbaba1d559 | 2a39be604fb32b177cc9e4859ea35770387f60e4 | /live-dao/src/main/java/com/homvee/livebroadcast/dao/room/RoomDao.java | 7eea305fd57c9c893b97720d70ee21c96f07f09e | [] | no_license | tanghomvee/live-broadcast | 42fa69bc90a72fefdced9c4911a6fde92b1f5bcb | b906c0ed7d33bf5ae8e3dd3b99186307d9dbd971 | refs/heads/master | 2020-03-23T06:34:32.525748 | 2018-09-30T02:00:19 | 2018-09-30T02:00:19 | 141,216,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,960 | java | package com.homvee.livebroadcast.dao.room;
import com.homvee.livebroadcast.dao.room.model.Room;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* Copyright (c) 2018$. ddyunf.com all rights reserved
*
* @author Homvee.Tang(tanghongwei@ddcloudf.com)
* @version V1.0
* @Description Network Interface Card Dao
* @date 2018-04-16 17:42
*/
public interface RoomDao extends JpaRepository<Room, Long> , RoomDaoExt{
/**
* find by url
* @param url
* @param userId
* @param yn
* @return
*/
List<Room> findByUrlAndUserIdAndYn(String url, Long userId, Integer yn);
/**
* find by like roomName
* @param roomName
* @param userId
* @param yn
* @return
*/
List<Room> findByRoomNameContainingAndUserIdAndYn(String roomName, Long userId, Integer yn);
/**
* find by url
* @param url
* @param val
* @return
*/
Room findByUrlAndYn(String url, Integer val);
/**
* find by user Id
* @param userId
* @param yn
* @return
*/
List<Room> findByUserIdAndYn(Long userId, Integer yn);
/**
* del
* @param ids
* @return
*/
@Modifying
@Query(value = "update t_room set yn=0 ,changeTime=now() where id in(?1)" , nativeQuery = true)
Integer delByIds(List<Long> ids);
/**
* find all
* @param ways
* @param yn
* @return
*/
List<Room> findByWayInAndYn(List<Integer> ways ,Integer yn);
/**
* find
* @param acctId
* @param userId
* @return
*/
@Query(value = "select * from t_room where yn=1 and userId=?2 and way !=3 and id in(select roomId from t_content where yn=1 and userId=?2 and acctId=?1)" , nativeQuery = true)
List<Room> findByAcctIdAndUserId(Long acctId, Long userId);
}
| [
"Wert324tang"
] | Wert324tang |
f2e04f81203de956f0475dfb8cab4552e1a2f507 | a4c413ca0a2e363fe00cf44a2ed576b92a8ad1d5 | /client/src/main/java/com/sc/cloud/client/Atributes.java | 8d1adfa08c72fc7be4bd930f0425cd5ff11c9cf7 | [] | no_license | Shamil09/DropBox | 374460f8bc671b98781781cea8a088a08c26c075 | b99abdfffe6785ecd3d0b6dcbf8ea5f3b32d36e6 | refs/heads/master | 2020-03-29T20:25:48.931848 | 2018-09-30T13:44:24 | 2018-09-30T13:56:25 | 150,311,760 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.sc.cloud.client;
import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
public class Atributes {
private final String name,type;
private final long saze;
private final FileTime date;
public Atributes(String name, String type, long saze, FileTime date) {
this.name = name;
this.type = type;
this.saze = saze;
this.date=date;
}
public String getName() {
return name;
}
public String getType() {
return type;
}
public long getSaze() {
return saze;
}
public FileTime getDate() {
return date;
}
}
| [
"Shama_bid@mail.ru"
] | Shama_bid@mail.ru |
c67a2b5b11612ab626bdb87d74b3579b82d0ed75 | 32f4c96133660c09ef103a24bc5e500352b8ee68 | /HtmlUnit-Demo/src/main/java/cn/mrdear/util/ModelUtil.java | 387341255bd5d2b85523f835f9f4c33910cbfd6d | [] | no_license | RohanHarichandan/JavaWEB | 2456ee35da77bbf72fb2a4b2f27ce0163ed5bfd1 | c2c33a529c0d89b2c041854600f7799118e30839 | refs/heads/master | 2023-08-21T18:34:15.563127 | 2021-10-14T17:29:07 | 2021-10-14T17:29:07 | 417,222,909 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package cn.mrdear.util;
import java.util.Random;
/**
* @author Niu Li
* @date 2016/10/8
*/
public class ModelUtil {
private static final String[] letters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V" ,
"W","X","Y","Z","0","1","2","3","4","5","6","7","8","9"};
//B7-24-D6-39-59-BC-B2-AE-E1-B2-B3-64-24-60-ED-C0
public static String generateId(){
StringBuilder builder = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 16; i++) {
if (i != 15){
builder.append(letters[random.nextInt(letters.length)]).append(letters[random.nextInt(letters.length)]).append("-");
}else {
builder.append(letters[random.nextInt(letters.length)]).append(letters[random.nextInt(letters.length)]);
}
}
return builder.toString();
}
}
| [
"niudear@foxmail.com"
] | niudear@foxmail.com |
9279f79297d56e103b573ba2f2cfc935257163ad | 2f0499820c08676707e2cf85ba83892659625dc7 | /src/main/java/springboot/service/Courseservice.java | 068b79f54a8af2fffd2a5e618b4a30f896ab3e0b | [] | no_license | Dheerajsingh1234/SpringBoot | 2152dd80ed778beb26278a2383498e1c02c0f764 | 915052787f4e01a21637c3836d682d5a6cd72f32 | refs/heads/master | 2022-12-04T13:33:08.112456 | 2020-08-14T17:38:34 | 2020-08-14T17:38:34 | 287,589,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package springboot.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import springboot.response.Course;
@Service
public class Courseservice {
@Autowired
private CourseRepository courserepository;
public List<Course> getAll(String topicid) {
// TODO Auto-generated method stub
//return null;
List<Course> Courses=new ArrayList<>();
courserepository.findBytopicId(topicid).forEach(Courses::add);
return Courses;
}
public Optional<Course> course(String id) {
// TODO Auto-generated method stub
return courserepository.findById(id);
//return null;
}
public Course addCourse(Course course) {
// TODO Auto-generated method stub
return courserepository.save(course);
//courserepository.save(course);
}
public void deleteCourse(String id) {
// TODO Auto-generated method stub
//courserepository.deleteById(id);
}
public void updateCourse(Course course) {
// TODO Auto-generated method stub
//courserepository.save(course);
}
}
| [
"dheerajsingh1234"
] | dheerajsingh1234 |
aaa3a0268c8351b45387d305b0d4279f4aa02065 | 4b41630a1adeb8678ec07dfc15869e6a17398863 | /com.rockwellcollins.atc.agree/src-gen/com/rockwellcollins/atc/agree/agree/OrderStatement.java | 449b4a719030ccadd5ae42a926e46de603fe2925 | [] | permissive | philip-alldredge/AGREE | 5fd5ef16f05410f92ea1673de08018dffa3329db | 8a0cd05fd920318f67c9ddc3b574153acacab891 | refs/heads/master | 2022-12-28T09:50:37.697453 | 2020-06-25T21:31:04 | 2020-06-25T21:31:04 | 275,892,835 | 0 | 0 | BSD-3-Clause | 2020-06-29T18:16:40 | 2020-06-29T18:16:39 | null | UTF-8 | Java | false | false | 1,045 | java | /**
*/
package com.rockwellcollins.atc.agree.agree;
import org.eclipse.emf.common.util.EList;
import org.osate.aadl2.NamedElement;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Order Statement</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link com.rockwellcollins.atc.agree.agree.OrderStatement#getComps <em>Comps</em>}</li>
* </ul>
*
* @see com.rockwellcollins.atc.agree.agree.AgreePackage#getOrderStatement()
* @model
* @generated
*/
public interface OrderStatement extends SpecStatement
{
/**
* Returns the value of the '<em><b>Comps</b></em>' reference list.
* The list contents are of type {@link org.osate.aadl2.NamedElement}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Comps</em>' reference list.
* @see com.rockwellcollins.atc.agree.agree.AgreePackage#getOrderStatement_Comps()
* @model
* @generated
*/
EList<NamedElement> getComps();
} // OrderStatement
| [
"thomas.logan@collins.com"
] | thomas.logan@collins.com |
e4133acdab2f924cafee3e5312945230a0b3bd6e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_27385ddacdc49cfa22151f34806301fbc2de098d/FWar/10_27385ddacdc49cfa22151f34806301fbc2de098d_FWar_s.java | 8560aa41f086e140784c811d1e269a364cdd70c2 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 11,132 | java | package com.massivecraft.factions;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.zcore.persist.Entity;
public class FWar extends Entity{
public transient Set<InventoryView> tempInvs= new HashSet<InventoryView>();
public transient Set<InventoryView> tempInvsFromTarget = new HashSet<InventoryView>();
public Map<String,Integer> items = new HashMap<String,Integer>();
public int money;
public int moneyFromTarget;
public Map<String,Integer> itemsToPay = new HashMap<String,Integer>();
private String attackerFactionID, targetFactionID;
public Faction getAttackerFaction(){ return Factions.i.get(attackerFactionID);}
public Faction getTargetFaction(){ return Factions.i.get(targetFactionID);}
public boolean isStarted;
public boolean isWar;
public long time;
public long timeToNextPayForMorePlayersThenTarget;
public long timeToDeleteFWar;
public FWar(Faction attacker, Faction target){
this.attach();
this.attackerFactionID=attacker.getId();
this.targetFactionID=target.getId();
this.isStarted = false; // Obviously the war isn't started yet
this.isWar = false;//No War until time passed
this.timeToDeleteFWar = System.currentTimeMillis();
}
public void startWar(){
this.isStarted = true;
/* Set the relation to enemy */
//attackerFaction.setRelationWish(targetFaction, Relation.ENEMY);
/* Set time */
this.time = System.currentTimeMillis();
/* Send the messages to both of the factions */
getTargetFaction().sendMessage("Eurer Fraktion wurde eine Forderung gestellt, in hhe von "+getDemandsAsString());
getTargetFaction().sendMessage("Die Forderung kam von "+getAttackerFaction().getTag()+" und falls ihr nicht innerhalb "+getTimeToWar()+" bezahlt, werden sie angreifen!");
getAttackerFaction().sendMessage("Eure Fraktion hat "+getTargetFaction().getTag()+" Forderungen in hhe von "+getDemandsAsString()+" gestellt");
getAttackerFaction().sendMessage("Falls sie nicht innerhalb "+getTimeToWar()+" zahlen, kommt es zum Krieg!");
/* Copy items */
itemsToPay= new HashMap<String, Integer>(items);
}
public String getDemandsAsString(){
String ausgabe="";
if(Conf.econEnabled){
if(this.money>0)
ausgabe=ausgabe+Econ.moneyString(this.money)+", ";
}
int i=0;
for(String itemString:items.keySet()){
MaterialData item=convertStringToMaterialData(itemString);
i++;
if(i>1 && i < items.size()) ausgabe=ausgabe+", ";
if(i==items.size()) ausgabe=ausgabe+" und ";
Integer args=items.get(itemString);
ausgabe=ausgabe+args+" "+item;
}
return ausgabe;
}
public String getTimeToWar(){
long timeToWar=(Conf.fwarHoursUntilWarStartsAfterDemand*60*60*1000)-(System.currentTimeMillis()-this.time);
return (int)Math.floor(timeToWar/(60*60*1000))+"h "+(int)Math.floor(timeToWar%(60*60*1000)/(60*1000))+"min";
}
public long getMilliTimeToWar(){
long timeToWar=(Conf.fwarHoursUntilWarStartsAfterDemand*60*60*1000)-(System.currentTimeMillis()-this.time);
return timeToWar;
}
public long getMilliTimeToDeleteFWar(){
long timeToDeleteFWar=(30*60*1000)-(System.currentTimeMillis()-this.timeToDeleteFWar);
return timeToDeleteFWar;
}
public static void checkForDeleteFWars(){
for(FWar war:FWars.i.get()){
if(war.isStarted==false){
if(war.getMilliTimeToDeleteFWar()<0){
war.remove();
war.getAttackerFaction().sendMessage(ChatColor.GOLD+"Kriegserklrungen gegen "+ChatColor.GREEN+war.getTargetFaction().getTag()+ChatColor.GOLD+" wurden abgebrochen da ihr lnger als 30 Minuten gebraucht habt diese auszuarbeiten!");
}
}
}
}
public static void setRelationshipWhenTimeToWarIsOver(){
for(FWar war:FWars.i.get()){
if(!war.isWar){
if(war.getMilliTimeToWar()<=0){
war.isWar=true;
war.getAttackerFaction().setRelationWish(war.getTargetFaction(), Relation.ENEMY);
war.getTargetFaction().setRelationWish(war.getAttackerFaction(), Relation.ENEMY);
war.getAttackerFaction().sendMessage(ChatColor.GOLD+"Der Krieg gegen die Fraktion "+ChatColor.GREEN+war.getTargetFaction().getTag()+ChatColor.GOLD+" hat begonnen!");
war.getTargetFaction().sendMessage(ChatColor.GOLD+"Der Krieg gegen die Fraktion "+ChatColor.GREEN+war.getAttackerFaction().getTag()+ChatColor.GOLD+" hat begonnen!");
war.timeToNextPayForMorePlayersThenTarget = System.currentTimeMillis();
}
}
}
}
public long getMilliTimeToNextPay(){
long timeToPay=(24*60*60*1000)-(System.currentTimeMillis()-this.timeToNextPayForMorePlayersThenTarget);
return timeToPay;
}
public static void payForMorePlayersThenTarget(){
if(Conf.econEnabled){
for(FWar war:FWars.i.get()){
if(war.isWar){
if(war.getMilliTimeToNextPay()<0){
if(war.getAttackerFaction().getFPlayers().size()>war.getTargetFaction().getFPlayers().size()){
int zwischenwert=war.getAttackerFaction().getFPlayers().size()-war.getTargetFaction().getFPlayers().size();
if(Econ.modifyMoney(war.getAttackerFaction(), -(zwischenwert*10), "", "for paying the Playerdifference in a War")){
}else{
war.remove();
war.getAttackerFaction().sendMessage("Der Krieg gegen "+war.getTargetFaction().getTag()+" wurde beendet da ihr kein Geld mehr habt um die Spielerdifferenz auszugleichen!");
war.getTargetFaction().sendMessage("Der Krieg gegen "+war.getAttackerFaction().getTag()+" wurde beendet da sie kein Geld mehr habt um die Spielerdifferenz auszugleichen!");
}
}
war.timeToNextPayForMorePlayersThenTarget = System.currentTimeMillis();
}
}
}
}
}
public void addTempInventory(InventoryView inv){
tempInvs.add(inv);
}
public void removeTempInventory(InventoryView inv){
if(tempInvs.contains(inv)){
for(ItemStack istack:inv.getTopInventory().getContents()){
if(istack!=null){
if(istack.getEnchantments().isEmpty()){ //Forbid enchanted items
if(istack.getDurability()==0){ //Forbid damaged items
boolean blackContains=false;
for(String string:Conf.fwarItemBlackList){
MaterialData mat=convertStringToMaterialData(string);
if(mat.getItemTypeId()==istack.getTypeId() && mat.getData()==istack.getData().getData()){
blackContains=true;
}
}
if(!blackContains){
Integer args;
if(items.get(convertMaterialDataToString(istack.getData()))==null){
args=istack.getAmount();
items.put(convertMaterialDataToString(istack.getData()), args);
}
else{
Integer argsOLD = items.get(convertMaterialDataToString(istack.getData()));
args=argsOLD+istack.getAmount();
items.put(convertMaterialDataToString(istack.getData()), args);
}
}else{
inv.getPlayer().getWorld().dropItem(inv.getPlayer().getLocation(), istack);
FPlayers.i.get((Player) inv.getPlayer()).sendMessage(ChatColor.RED+""+istack.getData().getData()+" ist auf der Blacklist. Du kannst es nicht verwenden.");
}
}else{
inv.getPlayer().getWorld().dropItem(inv.getPlayer().getLocation(), istack);
FPlayers.i.get((Player) inv.getPlayer()).sendMessage(ChatColor.RED+"Du kannst keine kaputte Items verwenden!");
}
}else{
inv.getPlayer().getWorld().dropItem(inv.getPlayer().getLocation(), istack);
FPlayers.i.get((Player) inv.getPlayer()).sendMessage(ChatColor.RED+"Du kannst keine verzauberte Items verwenden!");
}
}
}
inv.getTopInventory().clear();
tempInvs.remove(inv);
}
}
public void addTempInventoryFromTarget(InventoryView inv){
tempInvsFromTarget.add(inv);
}
public void removeTempInventoryFromTarget(InventoryView inv){
tempInvsFromTarget.remove(inv);
}
public void remove(){
FWars.i.detach(this);
for(String matString:items.keySet()){
MaterialData mat=convertStringToMaterialData(matString);
Integer args;
if(getAttackerFaction().factionInventory.get(matString)==null){
getAttackerFaction().factionInventory.put(convertMaterialDataToString(mat), items.get(matString));
}else{
args=items.get(matString);
Integer argsOLD=getAttackerFaction().factionInventory.get(matString);
args=args+ argsOLD;
getAttackerFaction().factionInventory.put(convertMaterialDataToString(mat), args);
}
}
if(getAttackerFaction().getRelationTo(getTargetFaction())==Relation.ENEMY){
getAttackerFaction().setRelationWish(getTargetFaction(), Relation.NEUTRAL);
getTargetFaction().setRelationWish(getAttackerFaction(), Relation.NEUTRAL);
}
}
// Get functions
public static FWar get(Faction attackerFaction, Faction targetFaction){
for(FWar war:FWars.i.get()){
if(war.getAttackerFaction()==attackerFaction){
if(war.getTargetFaction()==targetFaction){
return war;
}
}
}
return null;
}
public static FWar getAsAttacker(Faction faction){
for(FWar war:FWars.i.get()){
if(war.getAttackerFaction()==faction){
return war;
}
}
return null;
}
public static FWar getAsTarget(Faction faction){
for(FWar war:FWars.i.get()){
if(war.getTargetFaction()==faction){
return war;
}
}
return null;
}
// Other static functions
public static void removeFactionWars(Faction faction){
for(FWar war:FWars.i.get()){
if(war.getAttackerFaction()==faction || war.getTargetFaction() == faction){
war.remove();
}
}
}
public static FWar getWar(Faction attacker, Faction target){
for(FWar war:FWars.i.get()){
if(war.getAttackerFaction()==attacker && war.getTargetFaction() == target){
return war;
}
}
return null;
}
public static String convertMaterialDataToString(MaterialData mat){
String text = ""+mat.getItemTypeId()+":"+mat.getData()+"";
P.p.log(text);
return text;
}
public static MaterialData convertStringToMaterialData(String text){
String[] parts = text.split(":");
P.p.log("!!"+parts[0]+":"+parts[1]+"!!");
MaterialData mat=new MaterialData(Integer.parseInt(parts[0]), (byte)Integer.parseInt(parts[1]));
return mat;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
5d4217134fbc6bb68c976550049dbf231e9a0183 | 0861afa19ab21e33e2a20610ea252a8becc5ac09 | /SocialNetworks/src/hamiltonianpath/HamiltonianPath.java | 9a00979a38e9845c250516ddc41dcf65580a691d | [
"MIT"
] | permissive | rageshn/Java-Specialization-UC-SanDiego | 30c2385a0dcc653025bde1f7e0f227424f08d5a9 | 9259aee445a1bdeb1d7cb7e36b4faf856c73e39c | refs/heads/master | 2021-01-19T14:36:25.575725 | 2017-04-13T13:39:52 | 2017-04-13T13:39:52 | 88,173,099 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,790 | java | package hamiltonianpath;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.ArrayList;
import geometricshapes.GraphLoader;
import geometricshapes.TwitterGraph;
public class HamiltonianPath {
/*
* This method loads the data set and creates the Graph object
*
* @param - tGraph: TwitterGraph object which needs to be loaded with data
*
* @return: Twitter Graph object loaded with data.
*/
public TwitterGraph load(TwitterGraph tGraph) {
tGraph = new TwitterGraph();
GraphLoader.loadGraph(tGraph, "data/twitter_7.txt");
return tGraph;
}
/*
* This method process the Twitter Graph and checks whether the graph has
* Hamiltonian Path or not. If there exists a path, that will be returned,
* else null will be returned.
*
* @param - tGraph: Graph to be checked
*
* @return: Returns the path, else null.
*/
public List<Integer> getHamiltonianPath(TwitterGraph tGraph, Integer startNode, Integer destinationNode) {
HashMap<Integer, HashSet<Integer>> graph = tGraph.exportGraph();
//Gets all the possible paths between start and destination
List<List<Integer>> allPossiblePaths = getAllPaths(graph, startNode, destinationNode);
for (List<Integer> path : allPossiblePaths) {
//If there exists an edge between the current and the next element in the list,
//then the path is valid and it will be returned.
if (isValidPath(graph, startNode, path, destinationNode)) {
List<Integer> fullPath = new ArrayList<Integer>();
fullPath.add(0, startNode);
fullPath.addAll(path);
fullPath.add(destinationNode);
return fullPath;
}
}
return null;
}
/*
* This helper method returns the all the permutation of the paths.
*
* @param - graph: The graph object
*
* @param - startNode: starting node in graph
*
* @param - destination: Destination node in the graph
*
* @return - List<List<Integer>>: List of all possible paths.
*/
private List<List<Integer>> getAllPaths(HashMap<Integer, HashSet<Integer>> graph, Integer startNode,
Integer destination) {
List<List<Integer>> allPermutations = null;
try {
List<Integer> nodesList = new LinkedList<Integer>();
for (Integer node : graph.keySet()) {
//Except for start and destination, all remaining nodes will be added
if (node != startNode && node != destination) {
nodesList.add(node);
}
}
allPermutations = generatePerm(nodesList);
} catch (Exception ex) {
System.out.println("Exception while getting path: " + ex.getMessage());
}
return allPermutations;
}
/*
* This method computes the permutation of paths between all the vertices
* except start and end vertices.
*
* @param - original: The vertices in the graph except start and
* destination.
*
* @return - List<List<Integer>>: List of all paths
*/
private List<List<Integer>> generatePerm(List<Integer> original) {
if (original.size() == 0) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
result.add(new ArrayList<Integer>());
return result;
}
Integer firstElement = original.remove(0);
List<List<Integer>> returnValue = new ArrayList<List<Integer>>();
List<List<Integer>> permutations = generatePerm(original);
for (List<Integer> smallerPermutated : permutations) {
for (int index = 0; index <= smallerPermutated.size(); index++) {
List<Integer> temp = new ArrayList<Integer>(smallerPermutated);
temp.add(index, firstElement);
returnValue.add(temp);
}
}
return returnValue;
}
/*
* This method checks whether the path is a valid path or not.
*
* @param - graph: Graph object
*
* @param - start: Start Vertex.
*
* @param - path: path between start and destination vertices.
*
* @param - end: Destination vertex.
*
* @return - boolean: returns true if its a valid path, else false.
*/
private boolean isValidPath(HashMap<Integer, HashSet<Integer>> graph, Integer start, List<Integer> path,
Integer end) {
int index = 0;
//If the graph has only one element
if (graph.size() < 2) {
return false;
} else if (graph.size() == 2) {
//If it has only 2 elements, returns true if there exists a path between the start and destination
if (graph.get(start).contains(end)) {
return true;
}
else {
return false;
}
}
Integer current = start;
while (index < path.size()) {
HashSet<Integer> neighbors_current = graph.get(current);
Integer nextElement = path.get(index);
//Checks whether the next element in the list is in current elements' neighbors.
if (neighbors_current.contains(nextElement)) {
current = nextElement;
index++;
} else {
return false;
}
}
//Checks whether the destination is last element's neighbor
HashSet<Integer> last_neighbors = graph.get(current);
if (last_neighbors.contains(end)) {
return true;
}
return false;
}
/*
* Computes permutation for provided count - (Not used)
*/
private long getPermutation(int graphSize) {
if (graphSize == 1) {
return 1;
}
return graphSize * getPermutation(graphSize - 1);
}
/*
* Helper method to print the path
*/
private void printPath(List<Integer> path) {
System.out.println("The path between start and destination is..");
int index = 0;
while(index < path.size()) {
System.out.print(path.get(index) + " -> ");
index++;
}
}
public static void main(String[] args) {
HamiltonianPath hPath = new HamiltonianPath();
TwitterGraph tGraph = hPath.load(new TwitterGraph());
List<Integer> path = hPath.getHamiltonianPath(tGraph, 1, 5);
if(path != null) {
hPath.printPath(path);
}
else {
System.out.println("No hamiltonian path exists between the start and end vertex");
}
}
}
| [
"ragesh.narayanan@gmail.com"
] | ragesh.narayanan@gmail.com |
cf6702443fca5e2d7911015dc09fdaaaf589d474 | 777c58340dff4ead098eac0a6bbde94801d1b1d8 | /components/org.wso2.is.migration/migration-service/src/main/java/org/wso2/carbon/is/migration/service/v5120/migrator/ApplicationRedirectURLMigrator.java | 166cb23941682f821250c2dfaabbfe14cc773c1c | [
"Apache-2.0"
] | permissive | JKAUSHALYA/identity-migration-resources | 7c13556668ddf5128f311167d84ec34a81fc2297 | 082c006d911742dae0c81f332c84e6dd87fe3392 | refs/heads/master | 2021-06-21T17:10:15.978719 | 2021-04-29T10:33:20 | 2021-04-29T10:33:20 | 216,979,686 | 0 | 0 | Apache-2.0 | 2019-10-23T06:00:52 | 2019-10-23T06:00:52 | null | UTF-8 | Java | false | false | 16,367 | java | package org.wso2.carbon.is.migration.service.v5120.migrator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig;
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig;
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.core.migrate.MigrationClientException;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
import org.wso2.carbon.is.migration.service.Migrator;
import org.wso2.carbon.is.migration.service.v5120.dao.ApplicationDAO;
import org.wso2.carbon.is.migration.util.Constant;
import org.wso2.carbon.is.migration.util.ReportUtil;
import org.wso2.carbon.is.migration.util.Schema;
import org.wso2.carbon.is.migration.util.Utility;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.Resource;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.user.api.Tenant;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.OAUTH2;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.SAML2;
import static org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants.DEFAULT_SP_CONFIG;
import static org.wso2.carbon.is.migration.util.Constant.REPORT_PATH;
public class ApplicationRedirectURLMigrator extends Migrator {
private static final Logger log = LoggerFactory.getLogger(ApplicationRedirectURLMigrator.class);
private static final String SP_REDIRECT_URL_RESOURCE_PATH = "/identity/config/relyingPartyRedirectUrls";
private ReportUtil reportUtil;
@Override
public void dryRun() throws MigrationClientException {
log.info(Constant.MIGRATION_LOG + "Executing dry run for {}", this.getClass().getName());
Properties migrationProperties = getMigratorConfig().getParameters();
String reportPath = (String) migrationProperties.get(REPORT_PATH);
try {
reportUtil = new ReportUtil(reportPath);
reportUtil.writeMessage("\n--- Summery of the report - Relying party Urls Migration ---\n");
reportUtil.writeMessage(
String.format("%40s | %40s | %40s | %40s", "Application ", "RelyingParty", "RedirectURL",
"Tenant Domain"));
log.info(Constant.MIGRATION_LOG + "Started the dry run of Relying party Urls migration.");
// Migrate super tenant
migratingRelyingPartyURL(reportPath, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.toString(), true);
// Migrate other tenants
Set<Tenant> tenants = Utility.getTenants();
for (Tenant tenant : tenants) {
if (isIgnoreForInactiveTenants() && !tenant.isActive()) {
log.info(Constant.MIGRATION_LOG + "Tenant " + tenant.getDomain() + " is inactive. Redirect " +
"URLs migration will be skipped. ");
} else {
migratingRelyingPartyURL(reportPath, tenant.getDomain(), true);
}
}
reportUtil.commit();
} catch (IOException e) {
log.error(Constant.MIGRATION_LOG + "Error while constructing the DryRun report.", e);
}
}
private void migratingRelyingPartyURL(String reportPath, String tenantDomain, boolean isDryRun) throws MigrationClientException {
List<ServiceProvider> applications = new ArrayList();
Map<String, String> applicationAccessURLs = new HashMap<>();
log.info("............................................................................................");
if (isDryRun) {
log.info(Constant.MIGRATION_LOG + "Started dry run of migrating redirect URLs for tenant: " + tenantDomain);
} else {
log.info(Constant.MIGRATION_LOG + "Started migrating redirect URLs for tenant: " + tenantDomain);
}
Properties relyingPartyDetails = getRelyingPartyRedirectUrlValues(tenantDomain);
if (relyingPartyDetails == null) {
log.info(Constant.MIGRATION_LOG + "There are no relying party redirect URLs configured for the tenant: "
+ tenantDomain);
return;
}
for (Object key : relyingPartyDetails.keySet()) {
ServiceProvider sp;
String relyingParty = key.toString();
ArrayList relyingPartyPropValue = ((ArrayList) relyingPartyDetails.get(relyingParty));
if (StringUtils.isNotEmpty(relyingParty) && CollectionUtils.isNotEmpty(relyingPartyPropValue)) {
if (relyingPartyPropValue.get(0) == null) {
continue;
}
String redirectUrl = relyingPartyPropValue.get(0).toString();
if (StringUtils.isEmpty(redirectUrl)) continue;
// Retrieve an application of which oauth2 is configured as the inbound auth config.
sp = getServiceProviderByRelyingParty(relyingParty, tenantDomain, OAUTH2);
if (sp == null) {
// Retrieve an application of which saml2 is configured as the inbound auth config.
sp = getServiceProviderByRelyingParty(relyingParty, tenantDomain, SAML2);
}
if (sp != null) {
String applicationName = sp.getApplicationName();
if (StringUtils.isEmpty(sp.getAccessUrl())) {
applications.add(sp);
if (isDryRun) {
reportUtil.writeMessage(String.format("%40s | %40s | %40s | %40s ", applicationName,
relyingParty, redirectUrl, tenantDomain));
} else {
applicationAccessURLs.put(applicationName, redirectUrl);
migrateRedirectURLFromRegistryToApplication(relyingParty, tenantDomain, sp, redirectUrl);
}
} else if (!redirectUrl.equals(sp.getAccessUrl())) {
applications.add(sp);
String message = String.format("Conflicting relying-party redirect URL: %s, found for the " +
"application: %s, where the access URL is already set to: %s by default or by" +
" another relying-party configuration. Please resolve the conflict and re-run" +
" the migration.", redirectUrl, applicationName, sp.getAccessUrl());
log.error(message);
if (isDryRun) {
reportUtil.writeMessage(String.format("%40s | %40s | %40s | %40s ", applicationName,
relyingParty, redirectUrl, tenantDomain));
} else {
throw new MigrationClientException(message);
}
}
}
}
}
if (CollectionUtils.isNotEmpty(applications)) {
applications.stream().collect(Collectors.groupingBy(Function.identity(),
Collectors.counting()))
.entrySet().stream()
.filter(e -> e.getValue() > 1L)
.map(e -> e.getKey())
.collect(Collectors.toList())
.forEach(sp -> reportIssues(sp, reportPath, isDryRun));
}
if (!isDryRun) {
removeRelyingPartyRedirectUrlsFRomRegistry(tenantDomain);
}
}
private void reportIssues(ServiceProvider sp, String reportPath, boolean isDryRun) {
if (isDryRun) {
String message = "There are multiple relyingParty values defined for the application: " +
sp.getApplicationName() + " Refer the report at " + reportPath + " to get more details and find " +
"duplicates and resolve the issues by deleting duplicates from the config registry at path: " +
SP_REDIRECT_URL_RESOURCE_PATH;
log.error(Constant.MIGRATION_LOG + message);
} else {
String message = "There were multiple relyingParty values defined for the application: " +
sp.getApplicationName() + ". As the application access URL is set to the last occurrence. Please "
+ "manually verify the access url of this application.";
log.warn(Constant.MIGRATION_LOG + message);
}
}
@Override
public void migrate() throws MigrationClientException {
// Migrate super tenant
migratingRelyingPartyURL(null, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.toString(), false);
Set<Tenant> tenants = Utility.getTenants();
for (Tenant tenant : tenants) {
String tenantDomain = tenant.getDomain();
log.info(Constant.MIGRATION_LOG + "Started to migrate redirect URLs for tenant: " + tenantDomain);
if (isIgnoreForInactiveTenants() && !tenant.isActive()) {
log.info(Constant.MIGRATION_LOG + "Tenant " + tenant.getDomain() + " is inactive. Skipping redirect " +
"URLs migration. ");
continue;
} else {
migratingRelyingPartyURL(null, tenant.getDomain(), false);
}
}
}
/**
* Returns Properties which contains the redirect url configured in the registry against relying party.
*
* @param tenantDomain Tenant Domain.
* @return Redirect URL.
*/
private static Properties getRelyingPartyRedirectUrlValues(String tenantDomain) {
if (log.isDebugEnabled()) {
log.debug("Retrieving configured url against relying parties for tenant domain : " +
tenantDomain);
}
int tenantId;
if (StringUtils.isEmpty(tenantDomain)) {
if (log.isDebugEnabled()) {
log.debug("Tenant domain is not available. Hence using super tenant domain");
}
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
tenantId = MultitenantConstants.SUPER_TENANT_ID;
} else {
tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
}
try {
IdentityTenantUtil.initializeRegistry(tenantId, tenantDomain);
Registry registry = IdentityTenantUtil.getConfigRegistry(tenantId);
if (registry.resourceExists(SP_REDIRECT_URL_RESOURCE_PATH)) {
Resource resource = registry.get(SP_REDIRECT_URL_RESOURCE_PATH);
if (resource != null) {
return resource.getProperties();
}
}
} catch (RegistryException e) {
log.error(Constant.MIGRATION_LOG + "Error while getting data from the registry.", e);
} catch (IdentityException e) {
log.error(Constant.MIGRATION_LOG + "Error while initializing the registry for : " + tenantDomain, e);
}
return null;
}
/**
* Returns Properties which contains the redirect url configured in the registry against relying party.
*
* @param tenantDomain Tenant Domain.
* @return Redirect URL.
*/
private static void removeRelyingPartyRedirectUrlsFRomRegistry(String tenantDomain) {
if (log.isDebugEnabled()) {
log.debug("Removing configured redirect url against relying parties for tenant domain : " +
tenantDomain);
}
int tenantId;
if (StringUtils.isEmpty(tenantDomain)) {
if (log.isDebugEnabled()) {
log.debug("Tenant domain is not available. Hence using super tenant domain");
}
tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
tenantId = MultitenantConstants.SUPER_TENANT_ID;
} else {
tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
}
try {
IdentityTenantUtil.initializeRegistry(tenantId, tenantDomain);
Registry registry = IdentityTenantUtil.getConfigRegistry(tenantId);
if (registry.resourceExists(SP_REDIRECT_URL_RESOURCE_PATH)) {
registry.delete(SP_REDIRECT_URL_RESOURCE_PATH);
}
} catch (RegistryException e) {
log.error(Constant.MIGRATION_LOG + "Error while removing data from the registry.", e);
} catch (IdentityException e) {
log.error(Constant.MIGRATION_LOG + "Error while initializing the registry for : " + tenantDomain, e);
}
}
/**
* If the relying party is a valid inbound authenticator configured in the application, then update the
* applications access URL with the redirect URL defined in the registry (SP_REDIRECT_URL_RESOURCE_PATH) for
* relying party
*
* @param relyingParty
* @param tenantDomain
* @param sp
* @param redirectUrl
*/
private void migrateRedirectURLFromRegistryToApplication(String relyingParty, String tenantDomain,
ServiceProvider sp, String redirectUrl) {
InboundAuthenticationConfig inboundAuthenticationConfig = sp.getInboundAuthenticationConfig();
InboundAuthenticationRequestConfig[] inboundAuthenticationRequestConfig = inboundAuthenticationConfig
.getInboundAuthenticationRequestConfigs();
for (InboundAuthenticationRequestConfig inboundAuth : inboundAuthenticationRequestConfig) {
if (relyingParty.equals(inboundAuth.getInboundAuthKey())) {
log.info("Updating the application: " + sp.getApplicationName() + " access URL with redirect URL: " +
redirectUrl + " configured for relyingParty: " + relyingParty);
sp.setAccessUrl(redirectUrl);
try (Connection connection = getDataSource(Schema.IDENTITY.getName()).getConnection()) {
new ApplicationDAO().updateAccessURL(connection, sp.getApplicationName(),
redirectUrl, IdentityTenantUtil.getTenantId(tenantDomain));
} catch (SQLException e) {
log.error(Constant.MIGRATION_LOG + "Unable to update the application: "
+ sp.getApplicationName() + " with accessURL:" + relyingParty, e);
} catch (MigrationClientException e) {
log.error(Constant.MIGRATION_LOG + "Unable to update the application: "
+ sp.getApplicationName() + " with accessURL:" + relyingParty, e);
}
break;
}
}
}
private static ServiceProvider getServiceProviderByRelyingParty(String relyingParty, String tenantDomain, String
type) {
ServiceProvider sp = null;
try {
sp = ApplicationManagementService.getInstance().getServiceProviderByClientId(relyingParty,
type, tenantDomain);
if (sp != null && DEFAULT_SP_CONFIG.equals(sp.getApplicationName())) {
return null;
}
} catch (IdentityApplicationManagementException e) {
log.warn("Unable to retrieve an application for the relying party: " + relyingParty + " of type: " +
type + " in the tenant: " + tenantDomain);
}
return sp;
}
}
| [
"ayeshad.09@cse.mrt.ac.lk"
] | ayeshad.09@cse.mrt.ac.lk |
c812a5292f5f566af52b323491816c69a31898de | d11df99700da4d13a97f768df4d8e44e1d836a7e | /courseComposicao/src/entities/HorasContrato.java | 8a0af1bd3a57fc86de3e30bd85ab99688a3bc1bc | [] | no_license | WBoness/courseJava | 48739eaca45b1cfc00e6ac4699a3fde28c0271a3 | 4610afb90f88fa8d64bce5644b73a88520002e53 | refs/heads/master | 2020-04-27T18:27:11.643774 | 2019-04-15T03:19:28 | 2019-04-15T03:19:28 | 174,470,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package entities;
import java.util.Date;
public class HorasContrato {
private Date data;
private Double valorPorHora;
private Integer horas;
public Double valorTotal() {
return (this.horas * this.valorPorHora);
}
public HorasContrato() {
}
public HorasContrato(Date data, Double valorPorHora, Integer horas) {
this.data = data;
this.valorPorHora = valorPorHora;
this.horas = horas;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
public Double getValorPorHora() {
return valorPorHora;
}
public void setValorPorHora(Double valorPorHora) {
this.valorPorHora = valorPorHora;
}
public Integer getHoras() {
return horas;
}
public void setHoras(Integer horas) {
this.horas = horas;
}
@Override
public String toString() {
return "HorasContrato [data=" + data + ", valorPorHora=" + valorPorHora + ", horas=" + horas + "]";
}
}
| [
"wbonesss@gmail.com"
] | wbonesss@gmail.com |
3c3fab4d617e48af0195b81873195f7a01a55d76 | c472e88948c3f3ebbf437bd66ce209cc84219064 | /Java/src/InterfaceImp.java | 346249965eb1b4b227add17c0b5d5a5d0c85ec4f | [] | no_license | Haseeb1987/Java-Core | 96d67e78b80daea97e605413823ebcddc9c50dfe | 4d42dbd8df4f321ce3a8dc23de9e009edbc89144 | refs/heads/master | 2020-12-27T19:27:36.186540 | 2020-02-03T17:38:36 | 2020-02-03T17:38:36 | 238,022,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java |
public class InterfaceImp implements IGeneral{
@Override
public void done() {
System.out.println("This is InterfaceImp done");
}
@Override
public void see() {
System.out.println("This is InterfaceImp see");
}
}
| [
"60616489+Haseeb1987@users.noreply.github.com"
] | 60616489+Haseeb1987@users.noreply.github.com |
aa0d9b28a31e76efbc4d09edbc6d43ba5223c3f4 | e8104a1239ef91bf100eaec8244029cb8ea68c0a | /Project/ffse-fbms/src/fasttrackse/ffse1703/fbms/controller/quanlyduan/PageNotFoundTeam1Controller.java | 40f7fb5c492bdb9e74f3ec2f58c9db06b8a0b6e3 | [] | no_license | FASTTRACKSE/FFSE1703.JavaWeb | 72b868b34a934bb9504a218011ccce668d278ad6 | b659082bf40c5d2128092ab3a3addd3caff770e9 | refs/heads/master | 2021-06-07T09:22:16.125557 | 2021-03-05T04:52:01 | 2021-03-05T04:52:01 | 137,868,312 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package fasttrackse.ffse1703.fbms.controller.quanlyduan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class PageNotFoundTeam1Controller {
@RequestMapping("/403")
public String pageAccessDenied() {
return "QuanTriHeThong/error-403";
}
@RequestMapping("/404")
public String pageNotFound() {
return "QuanTriHeThong/error-404";
}
}
| [
"ffse1702010@st.fasttrack.edu.vn"
] | ffse1702010@st.fasttrack.edu.vn |
1900a988887c6bb9077f83184c69f159f4fd79fd | 60c1be6171f1a8a944b5dd9e64547ffb6a31604e | /이성우/chapter_06/p188_StudentTest4.java | ca0d513655b94df8bd7adb10490073c0277d73e3 | [] | no_license | KOSMO-Study/java-study | 73013024b8f4e069c004351ee79f51e5c96abc89 | bc326db63d30efc0595982796038c0045c56bd29 | refs/heads/main | 2023-08-23T05:34:50.941201 | 2021-09-19T13:43:09 | 2021-09-19T13:43:09 | 385,534,314 | 0 | 2 | null | 2021-07-13T13:45:06 | 2021-07-13T08:35:11 | Java | UTF-8 | Java | false | false | 2,292 | java | package chapter_06;
public class p188_StudentTest4 {
public static void main(String[] args) {
/*
* static 매서드 또한 static 변수처럼,
*
* 인스턴스 참조변수가 아닌,
*
* 클래스 이름으로 직접 호출 할 수 있다.
*
*/
p187_Student2 studentLee = new p187_Student2(); // 생성자를 이용하여, 학생 인스턴스를 생성.
studentLee.setStudentName("이지원"); // setStudentName() 메서드 사용하여 "이지원" 입력.
System.out.println(p187_Student2.getSerialNum()); // 클래스 p187_Student2 이름으로 serialNum 변수를 참조할수 없다.
// p187_Student2 에서 serialNum 변수를 private 로 지정하였기 때문.
// serialNum 값을 얻으러면 getSerialNum() 메서드를 사용하여 리턴받아야 한다.
System.out.println(studentLee.studentName + " 학번 : " + studentLee.studentID); // studentLee 학생의 이름과 학번 출력.
p187_Student2 studentSon = new p187_Student2(); // 생성자를 이용하여, 학생 인스턴스를 생성.
studentSon.setStudentName("손수경"); // setStudentName() 메서드 사용하여 "손수경" 입력.
System.out.println(p187_Student2.getSerialNum()); // 클래스 p187_Student2 이름으로 serialNum 변수를 참조할수 없다.
// p187_Student2 에서 serialNum 변수를 private 로 지정하였기 때문.
// serialNum 값을 얻으러면 getSerialNum() 메서드를 사용하여 리턴받아야 한다.
System.out.println(studentSon.studentName + " 학번 : " + studentSon.studentID); // studentSon 학생의 이름과 학번 출력.
}
}
| [
"noel7752@gmail.com"
] | noel7752@gmail.com |
e79c8279627a446ba966209e58b856f7c46d37ab | f070ea18beab9ba03bbdbb37f279d4ebbd5e07ca | /src/paint/models/LineShape.java | 7c9f5b62ecf87b47e0ec5adf2424669fb5083cb2 | [] | no_license | bishoyngendy/Picaso-Paint-Application | c6505ab882cf5532cbd68f42b74e9385a6b993c7 | bf5053ccf9eb81709034fdc95f7412e459d96c66 | refs/heads/master | 2021-06-11T19:40:40.329570 | 2017-01-28T15:59:16 | 2017-01-28T15:59:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java |
package paint.models;
/**
* CS 221 : Object Oriented Programming.
* Assignment 2 : Picaso Paint Application (PPA)
* @author Bishoy Nader & Marc Magdi
* November 2016
*/
public class LineShape extends PolygonShape {
/**
* Default constructor.
*/
public LineShape() {
this.minimumNumberOfVericesToDraw = 2;
this.minimumNumberOfPointsToDraw = 2;
}
}
| [
"programajor@gmail.com"
] | programajor@gmail.com |
2ff72d7c82ec2ae587b0c3eb4ef10f5a46222eb2 | d7dab538d6fc5390c5160c28f5c8231834c0a406 | /src/main/java/javax/ims/core/ServiceMethod.java | acd4aa1171be3c3eb6feea079fc2754c52de4bb2 | [
"Apache-2.0"
] | permissive | fhg-fokus-nubomedia/nubomedia-ims-connector | 037cbcc11c2f053fc3c159b3c53735dcc27fdcaf | a6dac8810f779c75351355cdd03933fedf07a99a | refs/heads/master | 2020-04-06T06:42:11.608858 | 2016-07-29T12:40:34 | 2016-07-29T12:40:34 | 49,443,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,062 | java | package javax.ims.core;
/**
* <p>The ServiceMethod interface provides methods to manipulate the next outgoing request message and to inspect previously sent request and response messages.
* The headers and body parts that are set will be transmitted in the next message that is triggered by an interface method, see code example below:
*
* @author amo
* @version 1.0
*/
public interface ServiceMethod
{
/**
* Returns the user identity of the remote endpoint of this ServiceMethod.
* This method will return null if the ServiceMethod is a Subscription or a Publication
*
* @return the remote user identity or null
*/
public abstract String getRemoteUserId();
/**
* This method returns a handle to the next outgoing request Message within this ServiceMethod to be
* manipulated by the local endpoint.
*
* @return the next outgoing request Message created for this ServiceMethod
*/
public abstract Message getNextRequest();
/**
* This method enables the user to inspect a previously sent or received request message. It is only possible to inspect the last request of each interface method identifier.
* This method will return null if the interface method identifier has not been sent/received.
*
* @param method - the interface method identifier
* @return the request Message
* @throws IllegalArgumentException - if the method argument is not a valid identifier
*/
public Message getPreviousRequest(int method) throws IllegalArgumentException;
/**
* This method enables the user to inspect previously sent or received response messages. It is only possible to inspect the response(s) for the last request of each interface method identifier.
* This method will return null if the interface method identifier has not been sent/received.
*
* @param method - the interface method identifier
* @return an array containing all responses associated to the method
*/
public Message[] getPreviousResponses(int method);
}
| [
"alice.cheambe@fokus.fraunhofer.de"
] | alice.cheambe@fokus.fraunhofer.de |
11b0fac3a29ae1a8cfbd4004dba2eff33da69dce | 19599ad278e170175f31f3544f140a8bc4ee6bab | /src/com/ametis/cms/web/validator/BillingItemValidator.java | 7f5d00951129270197166fbac32f6494d48eaf3d | [] | no_license | andreHer/owlexaGIT | a2a0df83cd64a399e1c57bb6451262434e089631 | 426df1790443e8e8dd492690d6b7bd8fd37fa3d7 | refs/heads/master | 2021-01-01T04:26:16.039616 | 2016-05-12T07:37:20 | 2016-05-12T07:37:20 | 58,693,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java |
package com.ametis.cms.web.validator;
import com.ametis.cms.datamodel.*;
import com.ametis.cms.web.form.*;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
// imports+
// imports-
/**
* BillingItem is a mapping of billing_item Table.
*/
public class BillingItemValidator implements Validator
// extends+
// extends-
{
public boolean supports(Class clazz) {
return BillingItemForm.class.isAssignableFrom(clazz);
}
public void validate(Object obj, Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"billingItemId","BILLING_ITEM_ID_REQUIRED","billingItemId is required");
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"createdTime","CREATED_TIME_REQUIRED","createdTime is required");
// foreign affairs
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"memberImportId","MEMBER_IMPORT_ID_REQUIRED",
"memberImportId is required");
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"claimId","CLAIM_ID_REQUIRED",
"claimId is required");
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"clientId","CLIENT_ID_REQUIRED",
"clientId is required");
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"memberId","MEMBER_ID_REQUIRED",
"memberId is required");
ValidationUtils.rejectIfEmptyOrWhitespace
(errors,"policyId","POLICY_ID_REQUIRED",
"policyId is required");
// -- foreign affairs end
}
// class+
// class-
}
| [
"mashuri@7a4bab5d-9f4e-4b47-a10f-b21823e054b7"
] | mashuri@7a4bab5d-9f4e-4b47-a10f-b21823e054b7 |
2e8e324eece1a5ff51bbfd59e2052777b7dba80a | ca160ed05c4f8e598325f34a4ca516189f71e0b7 | /broadcasttest/app/src/main/java/com/hth/broadcasttest/DJISimulatorApplication.java | 98ea6301871b06abb63bd48be2771dfaf3478a6f | [] | no_license | Jonghoe/HTH | a3c3833eed28d0ca64844b2d12ff1ade793018e3 | 654125483e245cec6f8bf934f3134f9964a8108c | refs/heads/master | 2020-03-18T17:58:51.955184 | 2018-11-21T02:34:25 | 2018-11-21T02:34:25 | 135,064,163 | 0 | 1 | null | 2018-08-08T02:35:10 | 2018-05-27T16:40:11 | Java | UTF-8 | Java | false | false | 6,131 | java | package com.hth.broadcasttest;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.Toast;
import dji.common.error.DJIError;
import dji.common.error.DJISDKError;
import dji.sdk.base.BaseComponent;
import dji.sdk.base.BaseProduct;
import dji.sdk.products.Aircraft;
import dji.sdk.sdkmanager.DJISDKManager;
public class DJISimulatorApplication extends Application {
private static final String TAG = DJISimulatorApplication.class.getName();
public static final String FLAG_CONNECTION_CHANGE = "com_dji_simulatorDemo_connection_change";
private static BaseProduct mProduct;
private Handler mHandler;
private DJISDKManager.SDKManagerCallback mDJISDKManagerCallback;
private Application instance;
public void setContext(Application application) {
instance = application;
}
@Override
public Context getApplicationContext() {
return instance;
}
public DJISimulatorApplication() {
}
/**
* Gets instance of the specific product connected after the
* API KEY is successfully validated. Please make sure the
* API_KEY has been added in the Manifest
*/
public static synchronized BaseProduct getProductInstance() {
if (null == mProduct) {
mProduct = DJISDKManager.getInstance().getProduct();
}
return mProduct;
}
public static boolean isAircraftConnected() {
return getProductInstance() != null && getProductInstance() instanceof Aircraft;
}
public static synchronized Aircraft getAircraftInstance() {
if (!isAircraftConnected()) return null;
return (Aircraft) getProductInstance();
}
@Override
public void onCreate() {
super.onCreate();
mHandler = new Handler(Looper.getMainLooper());
/**
* When starting SDK services, an instance of interface DJISDKManager.DJISDKManagerCallback will be used to listen to
* the SDK Registration result and the product changing.
*/
mDJISDKManagerCallback = new DJISDKManager.SDKManagerCallback() {
//Listens to the SDK registration result
@Override
public void onRegister(DJIError error) {
if(error == DJISDKError.REGISTRATION_SUCCESS) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "Register Success", Toast.LENGTH_LONG).show();
}
});
DJISDKManager.getInstance().startConnectionToProduct();
} else {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "Register sdk fails, check network is available", Toast.LENGTH_LONG).show();
}
});
}
Log.e("TAG", error.toString());
}
@Override
public void onProductDisconnect() {
Log.d("TAG", "onProductDisconnect");
notifyStatusChange();
}
@Override
public void onProductConnect(BaseProduct baseProduct) {
Log.d("TAG", String.format("onProductConnect newProduct:%s", baseProduct));
notifyStatusChange();
}
@Override
public void onComponentChange(BaseProduct.ComponentKey componentKey, BaseComponent oldComponent,
BaseComponent newComponent) {
if (newComponent != null) {
newComponent.setComponentListener(new BaseComponent.ComponentListener() {
@Override
public void onConnectivityChange(boolean isConnected) {
Log.d("TAG", "onComponentConnectivityChanged: " + isConnected);
notifyStatusChange();
}
});
}
Log.d("TAG",
String.format("onComponentChange key:%s, oldComponent:%s, newComponent:%s",
componentKey,
oldComponent,
newComponent));
}
};
//Check the permissions before registering the application for android system 6.0 above.
int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
int permissionCheck2 = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.READ_PHONE_STATE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (permissionCheck == 0 && permissionCheck2 == 0)) {
//This is used to start SDK services and initiate SDK.
DJISDKManager.getInstance().registerApp(getApplicationContext(), mDJISDKManagerCallback);
Toast.makeText(getApplicationContext(), "registering, pls wait...", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Please check if the permission is granted.", Toast.LENGTH_LONG).show();
}
}
private void notifyStatusChange() {
mHandler.removeCallbacks(updateRunnable);
mHandler.postDelayed(updateRunnable, 500);
}
private Runnable updateRunnable = new Runnable() {
@Override
public void run() {
Intent intent = new Intent(FLAG_CONNECTION_CHANGE);
getApplicationContext().sendBroadcast(intent);
}
};
} | [
"leejiho0306@naver.com"
] | leejiho0306@naver.com |
f911269cc579dc4c12a18887173f7b71366a979f | c163cdc9d446b9ff2dea864d0472ef2b99d40065 | /src/ChatServer/ThreadPool.java | 86c88b6dd777fed524f36c533fa49ecd55aea834 | [] | no_license | LIELY200/Chat-Application | aed3862f937a484c5e40c8270a38f35ef0c1fa78 | c60735defabbbc91989e318571ecce9cf07d4510 | refs/heads/master | 2020-03-27T06:42:13.020120 | 2018-08-25T20:46:59 | 2018-08-25T20:46:59 | 146,128,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | package ChatServer;
import java.util.ArrayList;
import java.util.concurrent.LinkedBlockingQueue;
/**
* This class represents a thread pool
*/
public class ThreadPool {
// A thread safe list of tasks
private LinkedBlockingQueue<Runnable> tasksQueue;
// An array of the threads
private ArrayList<WorkingThread> threadsList;
public ThreadPool(int maxNumberOfThread) {
this(maxNumberOfThread, false, "");
}
public ThreadPool(int maxNumberOfThread, boolean shouldPrintTrace, String name) {
tasksQueue = new LinkedBlockingQueue<Runnable>();
threadsList = new ArrayList<WorkingThread>();
for(int i = 0; i< maxNumberOfThread; i++) {
WorkingThread workingThread = new WorkingThread(tasksQueue, shouldPrintTrace, name);
threadsList.add(workingThread);
workingThread.start();
}
}
/**
* Executes a task on an avaliable thread
* @param task to perform
*/
public synchronized void executeTask(Runnable task) {
tasksQueue.add(task);
}
/**
* Stops all the working threads
*/
public synchronized void stopThreads() {
for(WorkingThread t : this.threadsList) {
t.terminate();
}
}
}
| [
"LIELY200@GMAIL.COM"
] | LIELY200@GMAIL.COM |
b4e15ae23d80d87cad5fa7661c90aee885d2aecc | c025a04a2ea048bac76d6b3dbcdbdfe7dfb8eb0f | /src/main/java/PatternMediator/resources/classes/Cargos/DefaultCargo.java | 6e1f1337dc8fadac1ae30c4d9fd6b91b93f34b58 | [] | no_license | AlexanderSayner/PatternMediator | 2c005369e67dfa3fb07cf1f909cfff52447fb0be | 96d8d7f13af607ea7fa55e101d3b5795e3aeb168 | refs/heads/master | 2021-01-04T11:52:36.336617 | 2020-02-14T14:27:34 | 2020-02-14T14:27:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package PatternMediator.resources.classes.Cargos;
import PatternMediator.resources.enums.CargoTypes;
import PatternMediator.resources.interfaces.Airport;
import PatternMediator.resources.interfaces.Cargo;
/**
*
* @author comrade
*/
public class DefaultCargo extends AbstractCargo implements Cargo {
public DefaultCargo(Airport destination, Integer size) {
super(CargoTypes.Default, size, destination);
}
}
| [
"t.badamshin@mediasoft.team"
] | t.badamshin@mediasoft.team |
d7156b546ee1a275bb1c26737eee9dab6df31ef4 | 4036bd47b040d59d833dd2181da0d42dbbb9c486 | /src/main/java/com/socblog/services/TagService.java | b9bac9e3c094f471cdb61a17b2ac2c394e3f4930 | [] | no_license | romantulchak/soc-blog-core | 240730496120f072d9bbdacf4747419e956becef | 222df02200cc1d015ad3ae64b8bfbf58dabd8f81 | refs/heads/master | 2022-11-25T07:02:43.979274 | 2020-07-31T18:24:47 | 2020-07-31T18:24:47 | 261,021,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package com.socblog.services;
import com.socblog.dto.TagDTO;
import com.socblog.models.Post;
import com.socblog.models.Tag;
import com.socblog.models.User;
import org.springframework.http.ResponseEntity;
import java.util.List;
public interface TagService {
List<TagDTO> getAllTags();
ResponseEntity<?> createTag(Tag tag, User user);
ResponseEntity<?> editTag(Tag tag);
ResponseEntity<?> deleteTag(Tag tag);
}
| [
"kzzxd29@gmail.com"
] | kzzxd29@gmail.com |
72877e8f1c4282b699c930efac8e43fa98517f84 | 0ae8ac63b5e69abb36a547f09ae23cc98cafbda9 | /sky-biz-develop/sky-biz-parent/sky-biz-webpf/src/main/java/com/swn/eapp/dto/AbstractDTO.java | 789601e46f232f2ef52ca8d7e15b0c07cd0676c0 | [] | no_license | iamsakon/Sky-Biz | 8ca3dda264b5a69eb8e7b885ddf6d33e916237e8 | 77d729a27f2b3ab365874ec5e76e527c07027658 | refs/heads/master | 2021-01-19T00:03:21.615660 | 2016-06-21T11:45:31 | 2016-06-21T11:45:31 | 48,142,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | package com.swn.eapp.dto;
import java.io.Serializable;
public class AbstractDTO implements Serializable{
/**
*
*/
private static final long serialVersionUID = -2159052830534474685L;
long id;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
| [
"sakon.bluechip@gmail.com"
] | sakon.bluechip@gmail.com |
3acec179f02baae3097e8aab81a6048e3fbe97d5 | 0c5c599d0cba9d756d8dae80121785826ed7deb4 | /aula1/src/app/Exercicio12.java | 00d21f8d6deb333fcc15ce76905758844828f059 | [] | no_license | TiagoMarquess/aulas-java | 87c92cb081a53dfd5ecf4660dd02674062a27582 | e66ee2346d796ad81fac94889a6270da0abfd464 | refs/heads/master | 2020-12-06T06:59:51.229981 | 2020-01-07T17:19:29 | 2020-01-07T17:19:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | package app;
import java.util.Scanner;
public class Exercicio12 {
public static void main(String[] args) {
// variaveis
try {
int idade = 0; // vai receber a idade
Scanner ler = new Scanner(System.in); // scanner responsável por ler as informações digitadas
// entrada das informações
System.out.printf("Informe a idade: ");
idade = ler.nextInt(); // idade vai receber a informação digitada pelo usuario
// processamento
if (idade < 16) { // Se a idade for menor que 16, informa que não pode votar
System.out.println("Não pode votar!");
}
if (idade == 16 || idade == 17 || idade > 70) { // Se a idade for 16, 17 ou maior que 70 anos.
System.out.println("Voto facultativo!");
}
if (idade >= 18 && idade <= 70) { // se a idade foir maior ou igual a 18 ou menor ou igual a 70
System.out.println("Voto obrigatorio!");
}
ler.close();
} catch (Exception e) { // se o usuario digitar algo diferente de uma idade entra na exeção
System.out.println("Idade invalida!"); // mensagem de erro
}
} // fim do main
} // fim do algoritmo | [
"pedrosolbm@gmail.com"
] | pedrosolbm@gmail.com |
79d7d7ccbee7ec9dbc588a3966046919bbf19eca | cec1602d23034a8f6372c019e5770773f893a5f0 | /sources/com/inuker/bluetooth/library/connect/listener/WriteDescriptorListener.java | 161dbe19319fc1ed6614ffd557a5f68c8db745c5 | [] | no_license | sengeiou/zeroner_app | 77fc7daa04c652a5cacaa0cb161edd338bfe2b52 | e95ae1d7cfbab5ca1606ec9913416dadf7d29250 | refs/heads/master | 2022-03-31T06:55:26.896963 | 2020-01-24T09:20:37 | 2020-01-24T09:20:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package com.inuker.bluetooth.library.connect.listener;
import android.bluetooth.BluetoothGattDescriptor;
public interface WriteDescriptorListener extends GattResponseListener {
void onDescriptorWrite(BluetoothGattDescriptor bluetoothGattDescriptor, int i);
}
| [
"johan@sellstrom.me"
] | johan@sellstrom.me |
4c0a061b4e70160f2a860cb859c899ad667943b7 | b9c3cc43d219916a5e0c1c1e8813d71de27f0398 | /imvelo_android/app/src/main/java/com/example/imvelo/ui/slideshow/SlideshowFragment.java | 73106aa4f03a8ec527ea410f2f6b5b1ee870c9aa | [] | no_license | Paul595/imvelo | 7cc0855b914a196842b209944c9f6be7f53df387 | 9cbaa9feb6103507e7e26011d983148ec90e4674 | refs/heads/master | 2022-04-20T14:12:50.470884 | 2020-02-20T11:58:26 | 2020-02-20T11:58:26 | 210,683,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package com.example.imvelo.ui.slideshow;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.support.annotation.Nullable;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import com.example.imvelo.R;
public class SlideshowFragment extends Fragment {
private SlideshowViewModel slideshowViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
slideshowViewModel =
ViewModelProviders.of(this).get(SlideshowViewModel.class);
View root = inflater.inflate(R.layout.fragment_slideshow, container, false);
final TextView textView = root.findViewById(R.id.text_slideshow);
slideshowViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"45532233+Paul595@users.noreply.github.com"
] | 45532233+Paul595@users.noreply.github.com |
9a282d55aa2874231fe114154b7e6d2f130f2f57 | 0aa06a25f06686356a9baa60c0d75bc2045d57f7 | /src/main/java/com/bridgelabz/demo/component/DepartmentBean.java | 7b673b05356e6c61034664a4b5769e26de235b51 | [] | no_license | HajarePratik/SpringBoot_Logger | 52153c38c5603ff0ba574eb30fcdd275364be868 | 32b12a814772f8724a1415934a0488928da16bb4 | refs/heads/main | 2023-06-15T10:17:48.985265 | 2021-07-08T11:39:19 | 2021-07-08T11:39:19 | 384,102,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.bridgelabz.demo.component;
import org.springframework.stereotype.Component;
@Component
public class DepartmentBean {
private String deptName;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}
| [
"pratikhajare09@gmail.com"
] | pratikhajare09@gmail.com |
ac565f7a8d7580c83d6ac9b0ce80e9f1ca2b1bdf | 6b5acd9b7f4012c6ae7b41f47d9761cdd267a37d | /lib/src/com/ryg/dynamicload/DLBasePluginActivity.java | 2b2649760f0a84e1c330eea3668a8775505d47c3 | [] | no_license | yuxinLi/dynamic-load-pluginapk-level2 | 6562dc10e0364f62ac1bb08b94d1ddc3c5c55d00 | b7881b8d30088b3181ea8f2f320cc962dc0de6c8 | refs/heads/master | 2021-01-17T08:44:22.092056 | 2016-08-15T10:54:23 | 2016-08-15T10:54:23 | 65,725,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,376 | java | /*
* Copyright (C) 2014 singwhatiwanna(任玉刚) <singwhatiwanna@gmail.com>
*
* collaborator:田啸,宋思宇,Mr.Simple
*
* 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.ryg.dynamicload;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.WindowManager;
import com.ryg.dynamicload.internal.DLIntent;
import com.ryg.dynamicload.internal.DLPluginManager;
import com.ryg.dynamicload.internal.DLPluginPackage;
import com.ryg.utils.DLConstants;
/**
* note: can use that like this.
*
* @see {@link DLBasePluginActivity.that}
* @author renyugang
*/
public class DLBasePluginActivity extends Activity implements DLPlugin {
private static final String TAG = "DLBasePluginActivity";
/**
* 代理activity,可以当作Context来使用,会根据需要来决定是否指向this
*/
protected Activity mProxyActivity;
/**
* 等同于mProxyActivity,可以当作Context来使用,会根据需要来决定是否指向this<br/>
* 可以当作this来使用
*/
protected Activity that;
protected DLPluginManager mPluginManager;
protected DLPluginPackage mPluginPackage;
protected int mFrom = DLConstants.FROM_INTERNAL;
@Override
public void attach(Activity proxyActivity, DLPluginPackage pluginPackage) {
Log.d(TAG, "attach: proxyActivity= " + proxyActivity);
mProxyActivity = (Activity) proxyActivity;
that = mProxyActivity;
mPluginPackage = pluginPackage;
}
@Override
public void onCreate(Bundle savedInstanceState) {
if (savedInstanceState != null) {
mFrom = savedInstanceState.getInt(DLConstants.FROM, DLConstants.FROM_INTERNAL);
}
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onCreate(savedInstanceState);
mProxyActivity = this;
that = mProxyActivity;
}
mPluginManager = DLPluginManager.getInstance(that);
Log.d(TAG, "onCreate: from= "
+ (mFrom == DLConstants.FROM_INTERNAL ? "DLConstants.FROM_INTERNAL" : "FROM_EXTERNAL"));
}
@Override
public void setContentView(View view) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.setContentView(view);
} else {
mProxyActivity.setContentView(view);
}
}
@Override
public void setContentView(View view, LayoutParams params) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.setContentView(view, params);
} else {
mProxyActivity.setContentView(view, params);
}
}
@Override
public void setContentView(int layoutResID) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.setContentView(layoutResID);
} else {
mProxyActivity.setContentView(layoutResID);
}
}
@Override
public void addContentView(View view, LayoutParams params) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.addContentView(view, params);
} else {
mProxyActivity.addContentView(view, params);
}
}
@Override
public View findViewById(int id) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.findViewById(id);
} else {
return mProxyActivity.findViewById(id);
}
}
@Override
public Intent getIntent() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getIntent();
} else {
return mProxyActivity.getIntent();
}
}
@Override
public ClassLoader getClassLoader() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getClassLoader();
} else {
return mProxyActivity.getClassLoader();
}
}
@Override
public Resources getResources() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getResources();
} else {
return mProxyActivity.getResources();
}
}
@Override
public String getPackageName() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getPackageName();
} else {
return mPluginPackage.packageName;
}
}
@Override
public LayoutInflater getLayoutInflater() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getLayoutInflater();
} else {
return mProxyActivity.getLayoutInflater();
}
}
@Override
public MenuInflater getMenuInflater() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getMenuInflater();
} else {
return mProxyActivity.getMenuInflater();
}
}
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getSharedPreferences(name, mode);
} else {
return mProxyActivity.getSharedPreferences(name, mode);
}
}
@Override
public Context getApplicationContext() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getApplicationContext();
} else {
return mProxyActivity.getApplicationContext();
}
}
@Override
public WindowManager getWindowManager() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getWindowManager();
} else {
return mProxyActivity.getWindowManager();
}
}
@Override
public Window getWindow() {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getWindow();
} else {
return mProxyActivity.getWindow();
}
}
@Override
public Object getSystemService(String name) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.getSystemService(name);
} else {
return mProxyActivity.getSystemService(name);
}
}
@Override
public void finish() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.finish();
} else {
mProxyActivity.finish();
}
}
@Override
public void onBackPressed() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onBackPressed();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void onStart() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onStart();
}
}
@Override
public void onRestart() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onRestart();
}
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onRestoreInstanceState(savedInstanceState);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onSaveInstanceState(outState);
}
}
public void onNewIntent(Intent intent) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onNewIntent(intent);
}
}
@Override
public void onResume() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onResume();
}
}
@Override
public void onPause() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onPause();
}
}
@Override
public void onStop() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onStop();
}
}
@Override
public void onDestroy() {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onDestroy();
}
}
public boolean onTouchEvent(MotionEvent event) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.onTouchEvent(event);
}
return false;
}
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.onKeyUp(keyCode, event);
}
return false;
}
public void onWindowAttributesChanged(WindowManager.LayoutParams params) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onWindowAttributesChanged(params);
}
}
public void onWindowFocusChanged(boolean hasFocus) {
if (mFrom == DLConstants.FROM_INTERNAL) {
super.onWindowFocusChanged(hasFocus);
}
}
public boolean onCreateOptionsMenu(Menu menu) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return super.onCreateOptionsMenu(menu);
}
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
if (mFrom == DLConstants.FROM_INTERNAL) {
return onOptionsItemSelected(item);
}
return false;
}
/**
* @param dlIntent
* @return may be {@link #START_RESULT_SUCCESS},
* {@link #START_RESULT_NO_PKG}, {@link #START_RESULT_NO_CLASS},
* {@link #START_RESULT_TYPE_ERROR}
*/
public int startPluginActivity(DLIntent dlIntent) {
return startPluginActivityForResult(dlIntent, -1);
}
/**
* @param dlIntent
* @return may be {@link #START_RESULT_SUCCESS},
* {@link #START_RESULT_NO_PKG}, {@link #START_RESULT_NO_CLASS},
* {@link #START_RESULT_TYPE_ERROR}
*/
public int startPluginActivityForResult(DLIntent dlIntent, int requestCode) {
if (mFrom == DLConstants.FROM_EXTERNAL) {
if (dlIntent.getPluginPackage() == null) {
dlIntent.setPluginPackage(mPluginPackage.packageName);
}
}
// 注意:这里传入 that , 即 代理Activity, 实际也是用 代理Activity 启动
return mPluginManager.startPluginActivityForResult(that, dlIntent, requestCode);
}
public int startPluginService(DLIntent dlIntent) {
if (mFrom == DLConstants.FROM_EXTERNAL) {
if (dlIntent.getPluginPackage() == null) {
dlIntent.setPluginPackage(mPluginPackage.packageName);
}
}
return mPluginManager.startPluginService(that, dlIntent);
}
public int stopPluginService(DLIntent dlIntent) {
if (mFrom == DLConstants.FROM_EXTERNAL) {
if (dlIntent.getPluginPackage() == null) {
dlIntent.setPluginPackage(mPluginPackage.packageName);
}
}
return mPluginManager.stopPluginService(that, dlIntent);
}
public int bindPluginService(DLIntent dlIntent, ServiceConnection conn, int flags) {
if (mFrom == DLConstants.FROM_EXTERNAL) {
if (dlIntent.getPluginPackage() == null) {
dlIntent.setPluginPackage(mPluginPackage.packageName);
}
}
return mPluginManager.bindPluginService(that, dlIntent, conn, flags);
}
public int unBindPluginService(DLIntent dlIntent, ServiceConnection conn) {
if (mFrom == DLConstants.FROM_EXTERNAL) {
if (dlIntent.getPluginPackage() == null)
dlIntent.setPluginPackage(mPluginPackage.packageName);
}
return mPluginManager.unBindPluginService(that, dlIntent, conn);
}
// /**
// * 直接调用that.startService
// * that 可能有两种情况
// * 1.指向this
// * 2.指向DLProxyActivity
// */
// public ComponentName startService(Intent service) {
// return that.startService(service);
// }
//
// @Override
// public boolean stopService(Intent name) {
// // TODO Auto-generated method stub
// return super.stopService(name);
// }
//
// @Override
// public boolean bindService(Intent service, ServiceConnection conn, int flags) {
// // TODO Auto-generated method stub
// return super.bindService(service, conn, flags);
// }
//
// @Override
// public void unbindService(ServiceConnection conn) {
// // TODO Auto-generated method stub
// super.unbindService(conn);
// }
}
| [
"liyx@13322.com"
] | liyx@13322.com |
e9f79ef67aeb7f8b45f773b142799b6e475e76ce | 88ae531edae050cf8a2400ccaa0618e35a9fa0fa | /OptionalsEvaluation/ExerciseValidation/src/test/java/academy/everyonecodes/validation/ArtworksEndpointTest.java | 55098fe10620f2794198ddcebc8f3ab72b858058 | [] | no_license | Atlantisland/backend-module | 442f25de001d88206ce40f8bb95fbc2966b8085f | b038f0d6f88eab3512b6218e9a41b2a702c0bc8b | refs/heads/master | 2022-12-24T19:29:04.189942 | 2020-09-28T07:01:22 | 2020-09-28T07:01:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,066 | java | package academy.everyonecodes.validation;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.verify;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class ArtworksEndpointTest {
@Autowired
TestRestTemplate testRestTemplate;
@MockBean
TextService service;
String url ="/artworks";
@Test
void post(){
Rating rating = new Rating(2);
Artwork artwork = new Artwork("name", rating);
testRestTemplate.postForObject(url, artwork, Artwork.class);
verify(service).returnSameText(artwork.getName());
}
}
// I think that I should have created a repository class as well and to use it here...but no I am running out of time now
// So I just let it like this | [
"egkougko@gmail.com"
] | egkougko@gmail.com |
dbeed93effe9e59cd05973fb77a143e199b8a79f | 41fb0f33d314367e9ffc409f9538e00ef3953a60 | /src/main/java/com/bhavya/rsql/entity/StudentEntity.java | 6d3d3beadc7c60280e69461b059c26f8e2915caa | [] | no_license | BhavyaDyavarishetty/RSQL-parser | 4b8b890599d6519778ee1d23a7c9ff4a50ea2402 | 949d9f946b5d33cc061ec342e9a7468f745c6d68 | refs/heads/master | 2022-01-07T04:56:44.816081 | 2019-04-30T22:07:41 | 2019-04-30T22:07:41 | 177,847,794 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.bhavya.rsql.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.List;
@Data
@Entity
@Table(name = "student")
public class StudentEntity {
@Id
@GeneratedValue
@Column(name = "id", nullable = false)
private Integer id;
@Basic
private String name;
@Basic
private String email;
@ManyToMany
private List<CourseEntity> courses;
}
| [
"bhavya.shankar01@gmail.com"
] | bhavya.shankar01@gmail.com |
e1b4aaa770e65b3455895b9a4a8bf2192b5626f2 | 6b9d76efc94f3dd388c2d41c2bed5d1b2d0bc008 | /src/test/java/com/github/nalloc/impl/StructTest.java | 7401366ded97e3e08a97984fea80c012aba6e67c | [
"Apache-2.0"
] | permissive | iuliandumitru/nalloc | b2620c6b90468b7ac90d2565d3776425eaf04798 | 1c3c2a6cf7f26e604a5705d75a4218708ae20e24 | refs/heads/master | 2021-05-28T08:55:45.578534 | 2013-08-10T06:32:20 | 2013-08-10T06:32:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,656 | 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.github.nalloc.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import org.junit.Test;
import com.github.nalloc.Array;
import com.github.nalloc.NativeHeapAllocator;
import com.github.nalloc.Pointer;
import com.github.nalloc.Struct;
import com.github.nalloc.Struct.Field;
import com.github.nalloc.Struct.Type;
/**
* Unit tests for {@link Struct}.
*
* @author Antti Laisi
*/
public class StructTest {
@Test
public void shouldGetAndSetSimpleTypes() {
try(Pointer<SimpleTypes> ptr = struct(SimpleTypes.class)) {
SimpleTypes simple = ptr.deref();
simple.lnumber(Long.MAX_VALUE);
simple.inumber(Integer.MIN_VALUE);
simple.c('\u20AC');
simple.b(Byte.MAX_VALUE);
assertEquals(Long.MAX_VALUE, simple.lnumber());
assertEquals(Integer.MIN_VALUE, simple.inumber());
assertEquals('\u20AC', simple.c());
assertEquals(Byte.MAX_VALUE, simple.b());
assertEquals(15, simple.getSize());
}
}
@Test
public void shouldGetAndSetArrayTypes() {
try(Pointer<ArrayTypes> ptr = struct(ArrayTypes.class)) {
ArrayTypes arrays = ptr.deref();
arrays.barray(new byte[]{'1','2'});
arrays.carray(new char[]{'1','2','3'});
arrays.iarray(new int[]{1,2,3,4});
arrays.larray(new long[]{1,2,3,4,5});
arrays.string("123456");
assertTrue(Arrays.equals(new byte[]{'1','2'}, arrays.barray()));
assertTrue(Arrays.equals(new char[]{'1','2','3'}, arrays.carray()));
assertTrue(Arrays.equals(new int[]{1,2,3,4}, arrays.iarray()));
assertTrue(Arrays.equals(new long[]{1,2,3,4,5}, arrays.larray()));
assertEquals("123456", arrays.string());
assertEquals(76, arrays.getSize());
}
}
@Test
public void shouldGetAndSetCCompatible() {
try(Pointer<CCompatible> ptr = struct(CCompatible.class)) {
CCompatible compatible = ptr.deref();
compatible.l(Long.MIN_VALUE);
compatible.c('$');
compatible.carray(new char[]{'x','a','_'});
compatible.string("123");
compatible.string2("123-too-long");
assertEquals(Long.MIN_VALUE, compatible.l());
assertEquals('$', compatible.c());
assertTrue(Arrays.equals(new char[]{'x','a'}, compatible.carray()));
assertEquals("123", compatible.string());
assertEquals("123", compatible.string2());
assertEquals(24, compatible.getSize());
}
}
@Test
public void shouldGetNestedStructs() {
try(Pointer<WithNestedStruct> ptr = struct(WithNestedStruct.class)) {
WithNestedStruct nested = ptr.deref();
nested.compatible().string("12");
assertEquals("12", nested.compatible().string());
assertEquals(nested.compatible().getSize(), nested.getSize());
}
}
@Test
public void shouldGetNestedStructArrays() {
try(Pointer<WithNestedArray> ptr = struct(WithNestedArray.class)) {
WithNestedArray array = ptr.deref();
array.array().get(1).compatible().string("AB");
assertEquals("AB", array.array().get(1).compatible().string());
assertEquals(2 * array.array().get(0).getSize(), array.getSize());
}
}
<T> Pointer<T> struct(final Class<T> structType) {
return NativeHeapAllocator.Factory.create(structType).malloc(structType);
}
// types
@Struct({
@Field(name="lnumber", type=Type.LONG),
@Field(name="inumber", type=Type.INT),
@Field(name="c", type=Type.CHAR),
@Field(name="b", type=Type.BYTE) })
static interface SimpleTypes {
long lnumber();
void lnumber(final long value);
int inumber();
void inumber(final int value);
char c();
void c(final char value);
byte b();
void b(final byte value);
long getSize();
}
@Struct({
@Field(name="barray", type=Type.BYTE, len=2),
@Field(name="carray", type=Type.CHAR, len=3),
@Field(name="iarray", type=Type.INT, len=4),
@Field(name="larray", type=Type.LONG, len=5),
@Field(name="string", type=Type.STRING, len=6) })
static interface ArrayTypes {
byte[] barray();
void barray(final byte[] value);
char[] carray();
void carray(final char[] value);
int[] iarray();
void iarray(final int[] value);
long[] larray();
void larray(final long[] value);
String string();
void string(final String value);
long getSize();
}
@Struct(c=true, pad=8, value={
@Field(name="l", type=Type.LONG),
@Field(name="c", type=Type.CHAR),
@Field(name="carray", type=Type.CHAR, len=2),
@Field(name="string", type=Type.STRING, len=4),
@Field(name="string2", type=Type.STRING, len=4)})
static interface CCompatible {
long l();
void l(final long value);
char c();
void c(final char value);
char[] carray();
void carray(final char[] value);
String string();
void string(final String value);
String string2();
void string2(final String value);
long getSize();
}
@Struct(c=true, pad=8, value={
@Field(name="compatible", type=Type.STRUCT, struct=CCompatible.class) })
static interface WithNestedStruct {
CCompatible compatible();
long getSize();
}
@Struct(c=true, pad=8, value={
@Field(name="array", type=Type.STRUCT, struct=WithNestedStruct.class, len=2) })
static interface WithNestedArray {
Array<WithNestedStruct> array();
long getSize();
}
}
| [
"alaisi@iki.fi"
] | alaisi@iki.fi |
37017dc4849b2cae875ed46cacaacbe6962d41c1 | aac1bea3895dba13590517e1faf68149d7b976cc | /src/Util/Teste.java | cda0a996ed2c49d450c8e89e556222d8a7acd879 | [] | no_license | joobond/projetobruno | 81ab5b5134decbb6f5dd98caf7717d46fb53fe7d | 9b3218e7ae8d0b6723368746dd89fe7eb94d4f58 | refs/heads/master | 2021-04-06T05:19:50.888025 | 2018-06-19T21:33:05 | 2018-06-19T21:33:05 | 125,293,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,694 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Util;
import DAO.CategoriaDAO;
import DAO.ClienteDAO;
import DAO.FuncionarioDAO;
import DAO.IngredienteDAO;
import DAO.ProdutoDAO;
import Model.CategoriaModel;
import Model.ClienteModel;
import Model.FuncionarioModel;
import Model.IngredienteModel;
import Model.ProdutoModel;
import Model.UsuarioModel;
/**
*
* @author Bond
*/
public class Teste {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// IngredienteModel i = new IngredienteModel();
// i.setNome("Calabresa");
// i.setQuantidade(3);
// i.setData_ultima_compra("14/02/2018");
// i.setValor_ultima_compra((float) 4.50);
//
// IngredienteDAO id = new IngredienteDAO();
// id.inserir(i);
// for(IngredienteModel i1 : id.obterTodos()){
// System.out.println("-- Ingrediente --");
// System.out.println(i1.toString());
// System.out.println("----------------------");
// }
// IngredienteModel i1 = new IngredienteModel();
// i1.setId(2);
// System.out.println(id.excluir(i1.getId()));
//
// System.out.println(id.obterPorPK(i1.getId()));
// ClienteModel c = new ClienteModel();
// c.setNome_completo("João Bond");
// c.setCpf("1234567");
// c.setData_nascimento("01/09/1998");
// c.setPontos(0);
// c.setTelefone(992019585);
// c.setAtividade(true);
// ClienteDAO cd = new ClienteDAO();
// cd.inserir(c);
// c.setId(1);
// cd.inativar(c);
// System.out.println(cd.obterPorPK(c.getId()));
// for(ClienteModel c : cd.obterTodos()){
// System.out.println(c.toString());
// }
// FuncionarioModel f = new FuncionarioModel();
// f.setNome_completo("Karolayne Braz");
// f.setCpf("32456");
// f.setData_nascimento("11/08/2000");
// f.setTelefone(3245678);
// f.setSalario(1500);
// FuncionarioDAO fd = new FuncionarioDAO();
// fd.inserir(f);
// f.setId(1);
// fd.excluir(f);
// System.out.println(fd.obterPorPK(f.getId()));
// for(FuncionarioModel f : fd.obterTodos()){
// System.out.println(f.toString());
// }
// CategoriaModel ca = new CategoriaModel();
// ca.setNome("Assados");
// ca.setAtividade(true);
//
// CategoriaDAO cad = new CategoriaDAO();
//cad.inserir(ca);
// for(CategoriaModel cat : cad.obterTodos()){
// System.out.println(cat.toString());
// }
// ProdutoModel p = new ProdutoModel();
// p.setDescricao("Fanta Laranja 350ml");
//
// CategoriaModel c = new CategoriaModel();
// c.setId(2);
//
// p.setCategoria(c);
// p.setQuantidade(2);
// p.setValor((float)3.50);
// p.setAtividade(true);
//
// ProdutoDAO pd = new ProdutoDAO();
// pd.inserir(p);
////
// for(ProdutoModel pt : pd.obterTodos()){
// System.out.println("----------------------");
// System.out.println("-- Produtos --");
// System.out.println(pt.toString());
// }
/* for (UsuarioModel usuario : userDAO.obterTodos()) {
System.out.println(usuario.toString());
}*/
}
}
| [
"jobond46@gmail.com"
] | jobond46@gmail.com |
ec1f67d7e9628221d62a8f4f5ad83c22f98053f4 | 23d21d575da06d8a0f0c3a266915df321b5154eb | /java/designpattern/src/main/java/designpattern/gof_builder/sample03/NutrionCreator.java | 819fc13e592d5551200d4e8446bba821ca411f5e | [] | no_license | keepinmindsh/sample | 180431ce7fce20808e65d885eab1ca3dca4a76a9 | 4169918f432e9008b4715f59967f3c0bd619d3e6 | refs/heads/master | 2023-04-30T19:26:44.510319 | 2023-04-23T12:43:43 | 2023-04-23T12:43:43 | 248,352,910 | 4 | 0 | null | 2023-03-05T23:20:43 | 2020-03-18T22:03:16 | Java | UTF-8 | Java | false | false | 240 | java | package designpattern.gof_builder.sample03;
public class NutrionCreator {
public static void main(String[] args) {
NutrionFacts.Builder builder = new NutrionFacts.Builder(20, 1);
builder.calories(20).Build();
}
}
| [
"keepinmindsh@gmail.com"
] | keepinmindsh@gmail.com |
a8e4b88fc0087eea42b45059fcbe0b0819fa17e7 | 988dfeed731a2e755191a66dbd87fd269d7dd6ff | /src/main/java/ar/com/german/ExpresionesLibres/server/guice/ServerModule.java | 3cb50f14b423e62b9222e988d96e7b8aa37f157e | [] | no_license | germanmr/expresioneslibresjava | 36b4de268816c660943a0ad62fd9b02a1fe103fb | 434e783810730192502aaa004d433265a077f938 | refs/heads/master | 2021-05-19T21:29:55.594297 | 2020-01-10T15:43:54 | 2020-01-10T15:43:54 | 23,370,131 | 0 | 0 | null | 2020-10-13T02:18:30 | 2014-08-26T23:25:08 | Java | UTF-8 | Java | false | false | 812 | java | package ar.com.german.ExpresionesLibres.server.guice;
import com.gwtplatform.dispatch.rpc.server.guice.HandlerModule;
import ar.com.german.ExpresionesLibres.server.dispatch.ObtenerDesicionHandler;
import ar.com.german.ExpresionesLibres.server.dispatch.ObtenerEntidadDeCsvHandler;
import ar.com.german.ExpresionesLibres.shared.modelo.dispatch.ObtenerDesicionAction;
import ar.com.german.ExpresionesLibres.shared.modelo.dispatch.ObtenerEntidadDeCsvAction;
//import com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl;
public class ServerModule extends HandlerModule {
@Override
protected void configureHandlers() {
bindHandler(ObtenerDesicionAction.class, ObtenerDesicionHandler.class);
bindHandler(ObtenerEntidadDeCsvAction.class, ObtenerEntidadDeCsvHandler.class);
}
} | [
"german.munioz.romano@gmail"
] | german.munioz.romano@gmail |
72b0d4921566ef353c4e5d13f7300bc0e819f6c0 | 255ff79057c0ff14d0b760fc2d6da1165f1806c8 | /02JavaStep02/04Ja-va基础教程-小白的福音资料/day02(计算机基础知识$java语言基础)/day2_code/讲师代码/5_赋值运算符/Test1_Operator.java | 9cb0096b95c2cff1645c73f26bbf278aa1d6532f | [] | no_license | wjphappy90/Resource | 7f1f817d323db5adae06d26da17dfc09ee5f9d3a | 6574c8399f3cdfb6d6b39cd64dc9507e784a2549 | refs/heads/master | 2022-07-30T03:33:59.869345 | 2020-08-10T02:31:35 | 2020-08-10T02:31:35 | 285,701,650 | 2 | 6 | null | null | null | null | GB18030 | Java | false | false | 368 | java | class Test1_Operator {
public static void main(String[] args) {
// 面试题:看下面的程序是否有问题,如果有问题,请指出并说明理由。
//short s=1;s = s+1; //当short与int进行运算的时候,会提升为int类型,两个int类型相加的结果也是int类型
short s=1;s+=1; //s = (short)(s + 1);
System.out.println(s);
}
}
| [
"981146457@qq.com"
] | 981146457@qq.com |
603483c0ed1fbef17a78ed5271c06c5806dcfd25 | f62e813cd0486ebe4ae66bc98a9ca1a5cc84cb16 | /im/src/main/java/com/android/im/imeventbus/IMDeleteRecentEvent.java | 500bf0abc6fecd97db442582415471587069ba8b | [] | no_license | loading103/im_master | f61fe6b51d7b1f414525482b4faf5b163ecbf05b | 478fcdee3c346945b5998c19532f1d90909a87d5 | refs/heads/master | 2022-11-04T03:05:16.286749 | 2020-06-21T02:57:00 | 2020-06-21T02:57:00 | 273,819,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.android.im.imeventbus;
public class IMDeleteRecentEvent {
private int position;
public IMDeleteRecentEvent() {
}
public IMDeleteRecentEvent(int position) {
this.position = position;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
}
| [
"951686695@qq.com"
] | 951686695@qq.com |
1b8b4e85322bb341c984b13fc4d6c6b03ae5fa7a | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_2/src/b/b/g/h/Calc_1_2_11674.java | 53f33baf7ff514c3f20d267b2ee388c923e53a5d | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package b.b.g.h;
public class Calc_1_2_11674 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
ac36ab5d9a864a5b5629d0ba3827524de13fcb6d | 764672688e0faee19b87017b1d85cd5b3335ed7b | /Exercise02/MovieFlxUsingActivity/app/src/main/java/com/example/movieflxusingactivity/MainActivity.java | 880c2a7b1051fc837e83ab39f15b910ceb9d4517 | [] | no_license | prasantgnit/Android | 6fa20431faed9e938dfa856323431ad98f2df47c | 32a9cb793d6abf0cd3524514a6a43a5ee345783d | refs/heads/master | 2020-07-11T08:56:19.730642 | 2019-08-26T14:48:10 | 2019-08-26T14:48:10 | 204,496,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java | package com.example.movieflxusingactivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private RecyclerView recycleview;
private int[] image = {R.drawable.pic01, R.drawable.pic02,R.drawable.pic03, R.drawable.pic04,
R.drawable.pic05, R.drawable.pic06, R.drawable.pic07, R.drawable.pic08, R.drawable.pic09,
R.drawable.pic10};
private RecyclerView.LayoutManager layoutManager;
private List<String> list;
private List<String> movie_disp;
private List<String> movie_cast;
private RecyclerAdapter adapter;
// private RecyclerAdapter adapter01;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recycleview = findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(this);
recycleview.setLayoutManager(layoutManager);
list = Arrays.asList(getResources().getStringArray(R.array.moviename));
movie_disp = Arrays.asList(getResources().getStringArray(R.array.moviedisp));
movie_cast = Arrays.asList(getResources().getStringArray(R.array.moviecast));
adapter = new RecyclerAdapter(image,list,this,movie_cast,movie_disp);
//adapter01 = new RecyclerAdapter(image);
recycleview.setHasFixedSize(true);
recycleview.setAdapter(adapter);
}
}
| [
"54543439+prasantgnit@users.noreply.github.com"
] | 54543439+prasantgnit@users.noreply.github.com |
028c139fd003dc533048a9e758669be161d3e8e0 | f1bca21d943b258c994856e87e48b11551b8d6cb | /app/src/main/java/com/qiscus/mychatui/ui/groupchatcreation/ContactViewHolder.java | 5531872612524a7b5e40a7c91731a5db806c20ad | [] | no_license | rajapulau/qiscus-chat-sdk-android-sample | 8d31058df7ac5f0aebb0985fafb3a025175fa75c | 239195974c93440ba5e3108ebbce8f2ad69f94be | refs/heads/master | 2020-06-08T07:22:49.611121 | 2019-05-31T06:31:43 | 2019-05-31T06:31:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,875 | java | package com.qiscus.mychatui.ui.groupchatcreation;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.request.RequestOptions;
import com.qiscus.mychatui.R;
import com.qiscus.mychatui.ui.adapter.OnItemClickListener;
import com.qiscus.nirmana.Nirmana;
/**
* Created on : May 17, 2018
* Author : zetbaitsu
* Name : Zetra
* GitHub : https://github.com/zetbaitsu
*/
public class ContactViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView itemName;
private ImageView picture;
private View viewCheck;
private OnItemClickListener onItemClickListener;
public ContactViewHolder(View itemView, OnItemClickListener onItemClickListener) {
super(itemView);
this.onItemClickListener = onItemClickListener;
itemView.setOnClickListener(this);
itemName = itemView.findViewById(R.id.name);
picture = itemView.findViewById(R.id.avatar);
viewCheck = itemView.findViewById(R.id.img_view_check);
}
public void bind(SelectableUser selectableUser) {
Nirmana.getInstance().get()
.setDefaultRequestOptions(new RequestOptions()
.placeholder(R.drawable.ic_qiscus_avatar)
.error(R.drawable.ic_qiscus_avatar)
.dontAnimate())
.load(selectableUser.getUser().getAvatarUrl())
.into(picture);
itemName.setText(selectableUser.getUser().getName());
viewCheck.setVisibility(selectableUser.isSelected() ? View.VISIBLE : View.GONE);
}
@Override
public void onClick(View v) {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(getAdapterPosition());
}
}
}
| [
"adicaturnugroho@gmail.com"
] | adicaturnugroho@gmail.com |
767201054a3e7d415282f257e0e52047e511c772 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /java/java-tests/testData/refactoring/extractMethodNew/SuggestChangeSignatureOneParamMultipleTimesInside.java | a345233a9c3705694a86f7a99b5450af1ae0e0a9 | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 279 | java | public class Test {
{
int x = 0;
<selection>System.out.println("foo");
System.out.println("foo");
System.out.println(x);</selection>
System.out.println("bar");
System.out.println("bar");
System.out.println(x);
}
} | [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
0d4ab4a733732aebb95bf03c25a039a243721bd5 | 3601e7b30f912a92197015617c4b118ed372941e | /src/minizoo/c/filter/AbstractFilter.java | 36a1dcf265fe47ef9d7b2b33d755542289be0035 | [] | no_license | grhbit/swing-minizoo | 421a7e43c32e533831926f4220bdff1a348f67ed | 4e1a4bf360c35db69380ff2348a79cb531a860a6 | refs/heads/master | 2021-05-27T01:47:09.383807 | 2014-06-13T05:12:07 | 2014-06-13T05:12:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java | package minizoo.c.filter;
import java.awt.*;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ColorModel;
public abstract class AbstractFilter implements BufferedImageOp {
public abstract BufferedImage filter(
BufferedImage src, BufferedImage dest);
public Rectangle2D getBounds2D(BufferedImage src) {
return new Rectangle(0, 0, src.getWidth(),
src.getHeight());
}
public BufferedImage createCompatibleDestImage(
BufferedImage src, ColorModel destCM) {
if (destCM == null) {
destCM = src.getColorModel();
}
return new BufferedImage(destCM,
destCM.createCompatibleWritableRaster(
src.getWidth(), src.getHeight()),
destCM.isAlphaPremultiplied(), null);
}
public Point2D getPoint2D(Point2D srcPt,
Point2D dstPt) {
return (Point2D) srcPt.clone();
}
public RenderingHints getRenderingHints() {
return null;
}
} | [
"g.passcode@gmail.com"
] | g.passcode@gmail.com |
476bcf15242a3aff8bdbfbb6ac0dd29c30b4a4dd | c54984e1e72d4ac2b0d90d38baecddceb2f822dd | /Android_github/shared-element-transitions-master/app/src/main/java/com/mikescamell/sharedelementtransitions/recycler_view/recycler_view_to_fragment/RecyclerViewFragment.java | e8b766bcbbb9ed3a89fc5ae6385afad1ca13adfb | [
"MIT"
] | permissive | dicksonorengo/Android | f805932f825eb382a50ba0a5ce60561064a45502 | 74961186c768371d0d1645c25933b16aa3a927fe | refs/heads/master | 2020-09-18T19:01:10.040313 | 2019-08-22T10:23:40 | 2019-08-22T10:23:40 | 224,171,351 | 1 | 0 | null | 2019-11-26T11:04:23 | 2019-11-26T11:04:22 | null | UTF-8 | Java | false | false | 2,675 | java | package com.mikescamell.sharedelementtransitions.recycler_view.recycler_view_to_fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.mikescamell.sharedelementtransitions.R;
import com.mikescamell.sharedelementtransitions.recycler_view.AnimalGalleryAdapter;
import com.mikescamell.sharedelementtransitions.recycler_view.AnimalItem;
import com.mikescamell.sharedelementtransitions.recycler_view.AnimalItemClickListener;
import com.mikescamell.sharedelementtransitions.recycler_view.Utils;
public class RecyclerViewFragment extends Fragment implements AnimalItemClickListener {
public static final String TAG = RecyclerViewFragment.class.getSimpleName();
public RecyclerViewFragment() {
// Required empty public constructor
}
public static RecyclerViewFragment newInstance() {
return new RecyclerViewFragment();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.activity_recycler_view, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
AnimalGalleryAdapter animalGalleryAdapter = new AnimalGalleryAdapter(Utils.generateAnimalItems(getContext()), this);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2);
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.setAdapter(animalGalleryAdapter);
}
@Override
public void onAnimalItemClick(int pos, AnimalItem animalItem, ImageView sharedImageView) {
Fragment animalDetailFragment = AnimalDetailFragment.newInstance(animalItem, ViewCompat.getTransitionName(sharedImageView));
getFragmentManager()
.beginTransaction()
.addSharedElement(sharedImageView, ViewCompat.getTransitionName(sharedImageView))
.addToBackStack(TAG)
.replace(R.id.content, animalDetailFragment)
.commit();
}
} | [
"43146486+Nursultan-Rzabekov@users.noreply.github.com"
] | 43146486+Nursultan-Rzabekov@users.noreply.github.com |
e17a251040d1e86ccdfe8774d896dcf096810737 | 4c08e115527f9b0f09e1fb8fd57f4d3ab3248a43 | /src/main/java/com/centropoly/oxo/converters/NullWrappingCollectionConverter.java | 71591187a4a69d39d5494d91331dc6fd8d6a2c42 | [] | no_license | PaulMaas/OXOFramework | 8ea707aed4957aab635484e61d199bf2ffc2fad9 | e90e89cc5a75ddac26c3a34f4b9b881504afe247 | refs/heads/master | 2022-10-29T02:41:08.912034 | 2022-10-09T04:21:23 | 2022-10-09T04:21:23 | 14,353,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | package com.centropoly.oxo.converters;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.collections.CollectionConverter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.mapper.Mapper;
/**
* @author Paul van der Maas
*/
public class NullWrappingCollectionConverter extends CollectionConverter
{
public NullWrappingCollectionConverter(Mapper mapper)
{
super(mapper);
}
public NullWrappingCollectionConverter(Mapper mapper, Class type)
{
super(mapper, type);
}
@Override
protected void writeCompleteItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer)
{
super.writeCompleteItem(item, context, writer);
}
@Override
protected void writeNullItem(MarshallingContext context, HierarchicalStreamWriter writer)
{
super.writeNullItem(context, writer);
}
}
| [
"paul.van.der.maas@signify.com"
] | paul.van.der.maas@signify.com |
dad043de6514aee5468ae9c85a2e3adc0f80d08a | e032dab934c4fa3ff55da94de2f15d246a4aed8c | /nio-and-netty/src/main/java/wr1ttenyu/f1nal/study/netty/httpserver/NettyHttpServer.java | 190d9446c514a583976c0d7e1242d5e177e0865c | [] | no_license | wr1ttenyu/f1nal | 9d21aeb1ae14505fc2e9add9220f81719840f37f | fd27d32d2f877ea98c19d892d13df36a99059a46 | refs/heads/master | 2022-07-07T02:15:25.931532 | 2020-06-11T01:19:16 | 2020-06-11T01:19:16 | 207,061,707 | 0 | 0 | null | 2022-01-12T23:05:07 | 2019-09-08T04:31:27 | Java | UTF-8 | Java | false | false | 1,006 | java | package wr1ttenyu.f1nal.study.netty.httpserver;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
public class NettyHttpServer {
public static void main(String[] args) {
EventLoopGroup bossGroup = new NioEventLoopGroup(1);
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap server = new ServerBootstrap();
server.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ServerChannelInitializer());
ChannelFuture bindCf = server.bind(8955).sync();
ChannelFuture closeCf = bindCf.channel().closeFuture().sync();
} catch (Exception e) {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}
| [
"xingyu.zhao@bangdao-tech.com"
] | xingyu.zhao@bangdao-tech.com |
daee4a6719f63bb05d8aaadb02ad5c96960a2542 | 5abd3817fb1c104d56642ca33b0e0bea25eca067 | /mymall/mymall-pojo/src/main/java/com/zhc/mymall/pojo/Item.java | 9b518ac15da00a1da6ce7d30ed652eae596065c2 | [] | no_license | hai5246/mymall | 6abf5547e8a8b5f351225ddc6ff8b58603fd1327 | e10d9d8f8e8a6eec314047f0fd89f7212d6526c0 | refs/heads/master | 2022-11-29T19:29:49.138593 | 2020-08-22T08:12:23 | 2020-08-22T08:12:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,875 | java | package com.zhc.mymall.pojo;
import org.apache.solr.client.solrj.beans.Field;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
public class Item implements Serializable {
@Field
private Long id;
@Field("item_title") // 表示 持久化对象 的属性和solr业务字段的映射关系
private String title;
@Field("item_sell_point")
private String sellPoint;
@Field("item_price")
private Double price;
private Integer stockCount;
private Integer num;
private String barcode;
@Field("item_image")
private String image;
private Long categoryid;
private String status;
private Date createTime;
private Date updateTime;
private String itemSn;
private Double costPirce;
private Double marketPrice;
private String isDefault;
private Long goodsId;
private String sellerId;
private String cartThumbnail;
@Field("item_category_name")
private String category;
private String brand;
@Field("item_desc")
private String spec;
private String seller;
private Map<String,String> specMap;
public Map<String, String> getSpecMap() {
return specMap;
}
public void setSpecMap(Map<String, String> specMap) {
this.specMap = specMap;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
public String getSellPoint() {
return sellPoint;
}
public void setSellPoint(String sellPoint) {
this.sellPoint = sellPoint == null ? null : sellPoint.trim();
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Integer getStockCount() {
return stockCount;
}
public void setStockCount(Integer stockCount) {
this.stockCount = stockCount;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode == null ? null : barcode.trim();
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image == null ? null : image.trim();
}
public Long getCategoryid() {
return categoryid;
}
public void setCategoryid(Long categoryid) {
this.categoryid = categoryid;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getItemSn() {
return itemSn;
}
public void setItemSn(String itemSn) {
this.itemSn = itemSn == null ? null : itemSn.trim();
}
public Double getCostPirce() {
return costPirce;
}
public void setCostPirce(Double costPirce) {
this.costPirce = costPirce;
}
public Double getMarketPrice() {
return marketPrice;
}
public void setMarketPrice(Double marketPrice) {
this.marketPrice = marketPrice;
}
public String getIsDefault() {
return isDefault;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault == null ? null : isDefault.trim();
}
public Long getGoodsId() {
return goodsId;
}
public void setGoodsId(Long goodsId) {
this.goodsId = goodsId;
}
public String getSellerId() {
return sellerId;
}
public void setSellerId(String sellerId) {
this.sellerId = sellerId == null ? null : sellerId.trim();
}
public String getCartThumbnail() {
return cartThumbnail;
}
public void setCartThumbnail(String cartThumbnail) {
this.cartThumbnail = cartThumbnail == null ? null : cartThumbnail.trim();
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category == null ? null : category.trim();
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand == null ? null : brand.trim();
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec == null ? null : spec.trim();
}
public String getSeller() {
return seller;
}
public void setSeller(String seller) {
this.seller = seller == null ? null : seller.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", title=").append(title);
sb.append(", sellPoint=").append(sellPoint);
sb.append(", price=").append(price);
sb.append(", stockCount=").append(stockCount);
sb.append(", num=").append(num);
sb.append(", barcode=").append(barcode);
sb.append(", image=").append(image);
sb.append(", categoryid=").append(categoryid);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", itemSn=").append(itemSn);
sb.append(", costPirce=").append(costPirce);
sb.append(", marketPrice=").append(marketPrice);
sb.append(", isDefault=").append(isDefault);
sb.append(", goodsId=").append(goodsId);
sb.append(", sellerId=").append(sellerId);
sb.append(", cartThumbnail=").append(cartThumbnail);
sb.append(", category=").append(category);
sb.append(", brand=").append(brand);
sb.append(", spec=").append(spec);
sb.append(", seller=").append(seller);
sb.append("]");
return sb.toString();
}
} | [
"972026328@qq.com"
] | 972026328@qq.com |
6c17d68b2fac0519a20ab5ec3c40203e00b82f9d | a7b868c8c81984dbcb17c1acc09c0f0ab8e36c59 | /src/main/java/com/alipay/api/response/AlipayOpenInstantdeliveryMerchantshopBatchqueryResponse.java | d98ef9cd747586c5dc047c56ec2d20e21993ef10 | [
"Apache-2.0"
] | permissive | 1755616537/alipay-sdk-java-all | a7ebd46213f22b866fa3ab20c738335fc42c4043 | 3ff52e7212c762f030302493aadf859a78e3ebf7 | refs/heads/master | 2023-02-26T01:46:16.159565 | 2021-02-02T01:54:36 | 2021-02-02T01:54:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,538 | java | package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.MerchantShopDTO;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.open.instantdelivery.merchantshop.batchquery response.
*
* @author auto create
* @since 1.0, 2021-02-01 11:10:43
*/
public class AlipayOpenInstantdeliveryMerchantshopBatchqueryResponse extends AlipayResponse {
private static final long serialVersionUID = 3237124317278791138L;
/**
* 当前页码
*/
@ApiField("page_no")
private Long pageNo;
/**
* 分页数量, 最大50。
*/
@ApiField("page_size")
private Long pageSize;
/**
* 门店列表数据。
*/
@ApiListField("records")
@ApiField("merchant_shop_d_t_o")
private List<MerchantShopDTO> records;
/**
* 总数量
*/
@ApiField("total_no")
private Long totalNo;
public void setPageNo(Long pageNo) {
this.pageNo = pageNo;
}
public Long getPageNo( ) {
return this.pageNo;
}
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
public Long getPageSize( ) {
return this.pageSize;
}
public void setRecords(List<MerchantShopDTO> records) {
this.records = records;
}
public List<MerchantShopDTO> getRecords( ) {
return this.records;
}
public void setTotalNo(Long totalNo) {
this.totalNo = totalNo;
}
public Long getTotalNo( ) {
return this.totalNo;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
7a1923146139ab9b4013118df30be75ab3cfe1f4 | f0905ebb4eda558ee856aa62236dcf05cd02f6f7 | /src/main/java/cn/supcon/dao/chche/RedisDao.java | 6c9d7146bac560e3eea4055cf6a0f37f806c5bd2 | [] | no_license | yangyinglong/seckill | 39844443203f9da776adb9865177a94e6874b286 | e834db4ce41fe1e9ed8452c5d2af44f32ad53733 | refs/heads/master | 2020-04-16T07:54:25.577389 | 2019-01-22T09:07:09 | 2019-01-22T09:07:09 | 165,403,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,417 | java | package cn.supcon.dao.chche;
import cn.supcon.entity.Seckill;
import com.dyuproject.protostuff.LinkedBuffer;
import com.dyuproject.protostuff.ProtostuffIOUtil;
import com.dyuproject.protostuff.runtime.RuntimeSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class RedisDao {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final JedisPool jedisPool;
private RuntimeSchema<Seckill> schema = RuntimeSchema.createFrom(Seckill.class);
public RedisDao(String ip, int port) {
jedisPool = new JedisPool(ip, port);
}
public Seckill getSeckill(long seckillId) {
try {
Jedis jedis = jedisPool.getResource();
try {
String key = "seckill:" + seckillId;
// 没有实现内部序列化
// get -> byte[] 反序列化 -> Object
// 采用自定义序列化
// protustuff : pojo
// 在redis中根据key查找
byte[] bytes = jedis.get(key.getBytes());
if (bytes != null) {
// 空对象
Seckill seckill = schema.newMessage();
ProtostuffIOUtil.mergeFrom(bytes, seckill, schema);
return seckill;
} else {
return null;
}
} finally {
jedis.close();
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
public String putSeckill(Seckill seckill) {
// set Object -> 序列化 -> byte[]
try {
Jedis jedis = jedisPool.getResource();
try {
String key = "seckill:" + seckill.getSeckillId();
byte[] bytes = ProtostuffIOUtil.toByteArray(seckill, schema,
LinkedBuffer.allocate(LinkedBuffer.DEFAULT_BUFFER_SIZE));
// 设置超时缓存
int timeout = 60 * 60;
String result = jedis.setex(key.getBytes(), timeout, bytes);
return result;
} finally {
jedis.close();
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return "error";
}
}
}
| [
"yangyl96@foxmail.com"
] | yangyl96@foxmail.com |
fa49de6b05973af126d7d283cb730346f2b149fe | 0b341d234ad1f366322098708591f23146d0e56b | /src/main/java/ru/job4j/io/Matches.java | 2a5edb3f88449c189ae8c7f3b775d91bda8ce9eb | [] | no_license | eskendarov/job4j_tracker | eea356eaaa4b7928e2eff8ec86f3f96c81f400af | 56fa123f9142e883dd6ce96dfaa96a375af7c3ec | refs/heads/master | 2023-08-15T09:10:18.692177 | 2021-10-04T14:33:15 | 2021-10-04T14:33:15 | 259,375,475 | 1 | 0 | null | 2020-04-27T15:37:14 | 2020-04-27T15:37:14 | null | UTF-8 | Java | false | false | 1,606 | java | package ru.job4j.io;
import java.util.Scanner;
/**
* Игра 11. Смысл игры в следующем. На столе лежат 11 спичек. Два игрока по очереди берут от 1 до 3 спичек.
* Выигрывает тот, кто забрал последние спички.
* @author Enver Eskendarov
*/
public class Matches {
public static void main(String[] args) {
int amount = 11;
boolean gamer1 = true;
Scanner input = new Scanner(System.in);
while (amount > 0) {
if (gamer1) {
System.out.println("Игрок №1, введите количество спичек");
} else {
System.out.println("Игрок №2, введите количество спичек");
}
int took = Integer.valueOf(input.nextLine());
if (took <= 3 && took > 0) {
if (amount - took < 0) {
System.out.println("Вы не можете взять больше чем осталось!");
} else {
amount = amount - took;
System.out.println("Отобрано " + took + ", осталось " + amount + " спичек");
gamer1 = !gamer1;
}
} else {
System.out.println("Допустимое количество спичек 1-3");
}
}
System.out.println("Вы выиграли, отобрав последние спички, игра завершена!");
}
}
| [
"envereskendarov@gmail.com"
] | envereskendarov@gmail.com |
4d9410f96873d4199f8dc1a1c7e938d4c40c332e | 5cd999b2b9c65043be5917153e3abae76d80ba4d | /StringsAndBasicsOfTextProcessing/StringAsObject_9.java | f880585bb1c6d147fb8507ed5a4ab06e03e0c468 | [] | no_license | ArtSCactus/Practice | 8262f761b6b3287eca37893dfd8727361df9f4b2 | 510bd9dfe80431482a02e24cfbd5371b740e0651 | refs/heads/master | 2020-05-28T02:12:34.396217 | 2019-10-28T12:57:13 | 2019-10-28T12:57:13 | 188,850,309 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,845 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Practice.StringsAndBasicsOfTextProcessing;
import java.util.Scanner;
/**
* Task condition: 9. Посчитать количество строчных (маленьких) и прописных
* (больших) букв в введенной строке. Учитывать только английские буквы.
*
* @author ArtSCactus
*/
public class StringAsObject_9 {
static void methodLauncher() {
Scanner in = new Scanner(System.in);
System.out.print("Enter a row: ");
String row = in.nextLine();
System.out.println("Result: ");
countLetters(row);
}
/**
* Printring amount of uppercase and lowercase english letters in a given row.
*
* @param givenRow
* @return
*/
static void countLetters(String givenRow) {
if (givenRow.isEmpty()) {
return;
}
int lowerCounter = 0;
int upperCounter = 0;
for (int index = 0; index < givenRow.length(); index++) {
//check for belonging to the English language
if (((givenRow.charAt(index) >= 'a') && (givenRow.charAt(index) <= 'z')) || ((givenRow.charAt(index) >= 'A') && (givenRow.charAt(index) <= 'Z'))) {
if (givenRow.charAt(index) != ' ') {
if (Character.isUpperCase(givenRow.charAt(index))) {
upperCounter++;
} else {
lowerCounter++;
}
}
}
}
System.out.println("In uppercase: " + upperCounter + " letters\nIn lowercase: " + lowerCounter + " lowerCounter");
}
}
| [
"artemir14@gmail.com"
] | artemir14@gmail.com |
f3ced1489e79efb5dfcbcc9871a802c36db77426 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/jaxrs-jersey/generated/src/gen/java/org/openapitools/model/ComDayCqDamCoreProcessMetadataProcessorProcessInfo.java | 4c418ea1ce7fa2700ac99c44a256232bee847414 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | Java | false | false | 4,710 | java | /*
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.model.ComDayCqDamCoreProcessMetadataProcessorProcessProperties;
import javax.validation.constraints.*;
/**
* ComDayCqDamCoreProcessMetadataProcessorProcessInfo
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2019-08-05T00:58:47.028Z[GMT]")
public class ComDayCqDamCoreProcessMetadataProcessorProcessInfo {
@JsonProperty("pid")
private String pid = null;
@JsonProperty("title")
private String title = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("properties")
private ComDayCqDamCoreProcessMetadataProcessorProcessProperties properties = null;
public ComDayCqDamCoreProcessMetadataProcessorProcessInfo pid(String pid) {
this.pid = pid;
return this;
}
/**
* Get pid
* @return pid
**/
@JsonProperty("pid")
@ApiModelProperty(value = "")
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public ComDayCqDamCoreProcessMetadataProcessorProcessInfo title(String title) {
this.title = title;
return this;
}
/**
* Get title
* @return title
**/
@JsonProperty("title")
@ApiModelProperty(value = "")
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public ComDayCqDamCoreProcessMetadataProcessorProcessInfo description(String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
**/
@JsonProperty("description")
@ApiModelProperty(value = "")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public ComDayCqDamCoreProcessMetadataProcessorProcessInfo properties(ComDayCqDamCoreProcessMetadataProcessorProcessProperties properties) {
this.properties = properties;
return this;
}
/**
* Get properties
* @return properties
**/
@JsonProperty("properties")
@ApiModelProperty(value = "")
public ComDayCqDamCoreProcessMetadataProcessorProcessProperties getProperties() {
return properties;
}
public void setProperties(ComDayCqDamCoreProcessMetadataProcessorProcessProperties properties) {
this.properties = properties;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComDayCqDamCoreProcessMetadataProcessorProcessInfo comDayCqDamCoreProcessMetadataProcessorProcessInfo = (ComDayCqDamCoreProcessMetadataProcessorProcessInfo) o;
return Objects.equals(this.pid, comDayCqDamCoreProcessMetadataProcessorProcessInfo.pid) &&
Objects.equals(this.title, comDayCqDamCoreProcessMetadataProcessorProcessInfo.title) &&
Objects.equals(this.description, comDayCqDamCoreProcessMetadataProcessorProcessInfo.description) &&
Objects.equals(this.properties, comDayCqDamCoreProcessMetadataProcessorProcessInfo.properties);
}
@Override
public int hashCode() {
return Objects.hash(pid, title, description, properties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComDayCqDamCoreProcessMetadataProcessorProcessInfo {\n");
sb.append(" pid: ").append(toIndentedString(pid)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
0d18553470a6647fde524775afb8c79f582ac7e1 | 131f33c9772de63142841922d947bd22ed9d0984 | /app/src/main/java/com/example/linux/muscleapp/ui/dates/interactor/AddDateInteractor.java | a639a95c222c8e3a03ea8844816ef755a4aa09f1 | [] | no_license | SalvadorMunoz/MuscleApp | 71aa8308c33d0925289bf0104fbe8a2f510db548 | 1cc63c98940c8ed01fc1bc43b1a78fc4ae89518d | refs/heads/master | 2018-09-30T05:25:57.760474 | 2018-06-15T11:20:58 | 2018-06-15T11:20:58 | 106,417,465 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.example.linux.muscleapp.ui.dates.interactor;
import com.example.linux.muscleapp.data.db.pojo.SessionDate;
import java.util.ArrayList;
/**
* Created by linux on 2/12/17.
*/
public interface AddDateInteractor {
void loadDates(OnLoadDatesFinished onLoadDatesFinished);
void addDate(SessionDate sessionDate,OnLoadDatesFinished onLoadDatesFinished);
void deleteDate(int position,OnLoadDatesFinished onLoadDatesFinished);
interface OnLoadDatesFinished{
void onSuccess(ArrayList<SessionDate> dates);
}
}
| [
"salvi.8_94@hotmail.com"
] | salvi.8_94@hotmail.com |
0890112a70defec922c35f63d8d524ecb5e02688 | 4c9edd390e5557a4c77d72a573f07ae21a2e06c9 | /android/minvest/app/src/main/java/com/example/chrisg/minvest/drawer/DrawerAdapter.java | 7ae2cb9f31a49bf85e52466f4d7c3129222efb5f | [] | no_license | ink-su/minvest | f1858520cf2d38646e65ccf5743144c15ea43190 | 5db5914ccf826446662191151d3e3bf3750123ac | refs/heads/master | 2021-06-08T16:17:24.223410 | 2016-11-22T03:18:09 | 2016-11-22T03:18:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package com.example.chrisg.minvest.drawer;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.chrisg.minvest.R;
import java.lang.reflect.Array;
/**
* Created by chrisg on 11/12/16.
*/
public class DrawerAdapter extends ArrayAdapter {
private Context context;
public DrawerAdapter(Context context, String[] str) {
super(context, 0 ,str);
this.context = context;
}
private class ViewHolder{
ImageView imageView;
TextView textView;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
String option = (String)getItem(position);
ViewHolder vh;
if(convertView == null){
convertView = LayoutInflater.from(context).inflate(R.layout.drawer_item,parent,false);
vh = new ViewHolder();
vh.imageView = (ImageView) convertView.findViewById(R.id.drawer_icon);
vh.textView = (TextView)convertView.findViewById(R.id.drawer_text);
convertView.setTag(vh);
}else{
vh = (ViewHolder)convertView.getTag();
}
vh.textView.setText(option);
Drawable drawable;
if(option.equals("Account")){
drawable = context.getDrawable(R.drawable.ic_wallet);
}else if(option.equals("Analytics")){
drawable = context.getDrawable(R.drawable.ic_graph);
}else{
drawable = context.getDrawable(R.drawable.ic_quit);
}
int color = context.getColor(R.color.colorPrimaryDark);
drawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
vh.imageView.setImageDrawable(drawable);
return convertView;
}
}
| [
"cgaboury@live.com"
] | cgaboury@live.com |
2a537198c4f4f6731ddeda9d4c4ae73658868121 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /P9-8.0/src/main/java/com/android/server/rms/iaware/srms/SRMSDumpRadar.java | c6f427a581d2bf864e142fe2e4a92728d50e414a | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,735 | java | package com.android.server.rms.iaware.srms;
import android.app.mtm.iaware.appmng.AppMngConstant.AppStartReason;
import android.app.mtm.iaware.appmng.AppMngConstant.AppStartSource;
import android.rms.iaware.AwareConstant;
import android.rms.iaware.AwareConstant.FeatureType;
import android.rms.iaware.AwareLog;
import android.rms.iaware.StatisticsData;
import android.text.TextUtils;
import android.util.ArrayMap;
import com.android.server.mtm.iaware.appmng.DecisionMaker;
import com.android.server.mtm.iaware.appmng.appstart.AwareAppStartupPolicy;
import java.util.ArrayList;
import java.util.Map.Entry;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class SRMSDumpRadar {
private static final int INTERVAL_ELAPSED_TIME = 4;
private static final int RESOURCE_FEATURE_ID = FeatureType.getFeatureId(FeatureType.FEATURE_RESOURCE);
private static final String TAG = "SRMSDumpRadar";
private static volatile SRMSDumpRadar mSRMSDumpRadar;
private static final String[] mSubTypeList = new String[]{"EnterFgKeyAppBQ", "EnterBgKeyAppBQ"};
private ArrayList<Integer> mBigDataList = new ArrayList(4);
private ArrayMap<String, TrackFakeData> mFakeDataList = new ArrayMap();
private long mFakeStartTime = this.mStartTime;
private long mStartTime = System.currentTimeMillis();
private ArrayMap<String, StartupData> mStartupDataList = new ArrayMap();
private ArrayList<StatisticsData> mStatisticsData = null;
private static class StartupData {
private ArrayMap<String, int[]> mReasonList;
/* synthetic */ StartupData(String pkg, StartupData -this1) {
this(pkg);
}
private StartupData(String pkg) {
this.mReasonList = new ArrayMap();
}
private void increase(String[] keys, int[]... values) {
int length = keys.length;
int i = 0;
int index = 0;
while (i < length) {
String k = keys[i];
int index2 = index + 1;
int[] val = values[index];
if (!(val == null || TextUtils.isEmpty(k))) {
int size = val.length;
int[] v = (int[]) this.mReasonList.get(k);
if (v == null) {
v = new int[size];
System.arraycopy(val, 0, v, 0, size);
this.mReasonList.put(k, v);
} else if (size == v.length) {
for (int i2 = 0; i2 < v.length; i2++) {
v[i2] = v[i2] + val[i2];
}
} else {
AwareLog.w(SRMSDumpRadar.TAG, "increase dis-match array size");
}
}
i++;
index = index2;
}
}
private boolean isAllowConsistent(boolean onlyDiff, int totalAlw) {
boolean z = true;
if (!onlyDiff) {
return false;
}
int[] values;
int smtAlw = 0;
int index = this.mReasonList.indexOfKey("I");
if (index >= 0) {
values = (int[]) this.mReasonList.valueAt(index);
if (values != null && values.length > 0) {
smtAlw = values[0];
}
}
int usrAlw = 0;
index = this.mReasonList.indexOfKey("U");
if (index >= 0) {
values = (int[]) this.mReasonList.valueAt(index);
if (values != null && values.length > 1) {
usrAlw = values[0] + values[1];
}
}
if (totalAlw != smtAlw + usrAlw) {
z = false;
}
return z;
}
private boolean isNeedReport(int threshold, boolean onlyDiff) {
int[] values;
int totalAlw = 0;
int nonIawareAlw = 0;
int index = this.mReasonList.indexOfKey("T");
if (index >= 0) {
values = (int[]) this.mReasonList.valueAt(index);
if (values != null && values.length > 1) {
totalAlw = values[0];
nonIawareAlw = values[1];
}
}
if (isAllowConsistent(onlyDiff, totalAlw - nonIawareAlw)) {
return false;
}
if (totalAlw >= threshold) {
return true;
}
if (totalAlw == 0) {
index = this.mReasonList.indexOfKey("I");
if (index >= 0) {
values = (int[]) this.mReasonList.valueAt(index);
if (values != null && values.length > 0 && values[values.length - 1] > 0) {
return true;
}
}
index = this.mReasonList.indexOfKey("U");
if (index >= 0) {
values = (int[]) this.mReasonList.valueAt(index);
return values != null && values.length > 0 && values[values.length - 1] > 0;
}
}
}
private String encodeString() {
int i = 0;
String[] tagOrderList = new String[]{"T", "U", "I", "H", "O", AppStartSource.THIRD_ACTIVITY.getDesc(), AppStartSource.THIRD_BROADCAST.getDesc(), AppStartSource.SYSTEM_BROADCAST.getDesc(), AppStartSource.START_SERVICE.getDesc(), AppStartSource.BIND_SERVICE.getDesc(), AppStartSource.PROVIDER.getDesc(), AppStartSource.SCHEDULE_RESTART.getDesc(), AppStartSource.JOB_SCHEDULE.getDesc(), AppStartSource.ALARM.getDesc(), AppStartSource.ACCOUNT_SYNC.getDesc(), AppStartReason.DEFAULT.getDesc(), AppStartReason.SYSTEM_APP.getDesc(), AppStartReason.LIST.getDesc()};
StringBuilder result = new StringBuilder();
boolean firstInsert = true;
int length = tagOrderList.length;
while (i < length) {
String tag = tagOrderList[i];
int size = this.mReasonList.size();
for (int i2 = 0; i2 < size; i2++) {
String key = (String) this.mReasonList.keyAt(i2);
if (key.startsWith(tag)) {
String stat = getStatString((int[]) this.mReasonList.valueAt(i2));
if (!TextUtils.isEmpty(stat)) {
if (!firstInsert) {
result.append(',');
}
result.append(key).append('=').append(stat);
firstInsert = false;
}
}
}
i++;
}
return result.toString();
}
private String getStatString(int[] values) {
StringBuilder result = new StringBuilder();
boolean noZero = false;
int size = values.length;
for (int i = 0; i < size; i++) {
if (values[i] > 0) {
result.append(values[i]);
noZero = true;
}
if (i < size - 1) {
result.append('#');
}
}
if (!noZero) {
result.delete(0, result.length());
}
return result.toString();
}
}
private static class TrackFakeData {
String cmp;
private ArrayMap<String, Integer> mStatusList = new ArrayMap();
public TrackFakeData(String cmp) {
this.cmp = cmp;
}
public void updateStatus(String status) {
Integer count = (Integer) this.mStatusList.get(status);
if (count == null) {
this.mStatusList.put(status, Integer.valueOf(1));
} else {
this.mStatusList.put(status, Integer.valueOf(count.intValue() + 1));
}
}
public String toJsonStr() {
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("cmp", this.cmp);
for (Entry entry : this.mStatusList.entrySet()) {
jsonObj.put((String) entry.getKey(), ((Integer) entry.getValue()).intValue());
}
} catch (JSONException e) {
AwareLog.e(SRMSDumpRadar.TAG, "TrackFakeData.toJsonStr catch JSONException.");
}
return jsonObj.toString();
}
}
private int getBigdataThreshold(boolean beta) {
AwareAppStartupPolicy policy = AwareAppStartupPolicy.self();
if (policy != null) {
return policy.getBigdataThreshold(beta);
}
return 0;
}
private JSONObject makeStartupJson(boolean forBeta, boolean clear, boolean onlyDiff) {
String pkgPrefix = "com.";
int prefixStart = "com.".length() - 1;
int threshold = getBigdataThreshold(forBeta);
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("feature", "appstart");
jsonObj.put("start", this.mStartTime);
long currentTime = System.currentTimeMillis();
if (clear) {
this.mStartTime = currentTime;
}
jsonObj.put("end", currentTime);
int index = 0;
JSONObject dataJson = new JSONObject();
for (Entry<String, StartupData> item : this.mStartupDataList.entrySet()) {
String pkg = (String) item.getKey();
StartupData startupData = (StartupData) item.getValue();
if (startupData.isNeedReport(threshold, onlyDiff)) {
if (pkg.startsWith("com.")) {
dataJson.put(pkg.substring(prefixStart), startupData.encodeString());
} else {
dataJson.put(pkg, startupData.encodeString());
}
index++;
}
}
dataJson.put("inf", "V" + DecisionMaker.getInstance().getVersion() + CPUCustBaseConfig.CPUCONFIG_INVALID_STR + index + CPUCustBaseConfig.CPUCONFIG_INVALID_STR + this.mStartupDataList.size());
JSONArray jsonArray = new JSONArray();
jsonArray.put(dataJson);
jsonObj.put("data", jsonArray);
} catch (JSONException e) {
AwareLog.e(TAG, "makeStartupJson catch JSONException e: " + e);
}
return jsonObj;
}
public void updateStartupData(String pkg, String[] keys, int[]... values) {
if (!TextUtils.isEmpty(pkg) && keys != null && values != null && keys.length == values.length) {
synchronized (this.mStartupDataList) {
StartupData startupData = (StartupData) this.mStartupDataList.get(pkg);
if (startupData != null) {
startupData.increase(keys, values);
} else {
startupData = new StartupData(pkg, null);
startupData.increase(keys, values);
this.mStartupDataList.put(pkg, startupData);
}
}
}
}
public String saveStartupBigData(boolean forBeta, boolean clear, boolean onlyDiff) {
String data;
synchronized (this.mStartupDataList) {
data = makeStartupJson(forBeta, clear, onlyDiff).toString();
if (clear) {
this.mStartupDataList.clear();
}
}
AwareLog.d(TAG, "saveStartupBigData forBeta=" + forBeta + ", clear=" + clear);
return data;
}
public static SRMSDumpRadar getInstance() {
if (mSRMSDumpRadar == null) {
synchronized (SRMSDumpRadar.class) {
if (mSRMSDumpRadar == null) {
mSRMSDumpRadar = new SRMSDumpRadar();
}
}
}
return mSRMSDumpRadar;
}
private SRMSDumpRadar() {
int i;
for (i = 0; i < 4; i++) {
this.mBigDataList.add(Integer.valueOf(0));
}
this.mStatisticsData = new ArrayList();
for (i = 0; i <= 1; i++) {
this.mStatisticsData.add(new StatisticsData(RESOURCE_FEATURE_ID, 2, mSubTypeList[i], 0, 0, 0, System.currentTimeMillis(), 0));
}
}
public ArrayList<StatisticsData> getStatisticsData() {
ArrayList<StatisticsData> dataList = new ArrayList();
synchronized (this.mStatisticsData) {
for (int i = 0; i <= 1; i++) {
dataList.add(new StatisticsData(RESOURCE_FEATURE_ID, 2, mSubTypeList[i], ((StatisticsData) this.mStatisticsData.get(i)).getOccurCount(), 0, 0, ((StatisticsData) this.mStatisticsData.get(i)).getStartTime(), System.currentTimeMillis()));
}
resetStatisticsData();
}
AwareLog.d(TAG, "SRMS getStatisticsData success");
return dataList;
}
public void updateStatisticsData(int subTypeCode) {
if (subTypeCode >= 0 && subTypeCode <= 1) {
synchronized (this.mStatisticsData) {
StatisticsData data = (StatisticsData) this.mStatisticsData.get(subTypeCode);
data.setOccurCount(data.getOccurCount() + 1);
}
} else if (subTypeCode < 10 || subTypeCode > 13) {
AwareLog.e(TAG, "error subTypeCode");
} else {
updateBigData(subTypeCode - 10);
}
}
private void resetStatisticsData() {
synchronized (this.mStatisticsData) {
for (int i = 0; i <= 1; i++) {
((StatisticsData) this.mStatisticsData.get(i)).setSubType(mSubTypeList[i]);
((StatisticsData) this.mStatisticsData.get(i)).setOccurCount(0);
((StatisticsData) this.mStatisticsData.get(i)).setStartTime(System.currentTimeMillis());
((StatisticsData) this.mStatisticsData.get(i)).setEndTime(0);
}
}
}
public String saveSRMSBigData(boolean clear) {
StringBuilder data;
synchronized (this.mBigDataList) {
data = new StringBuilder("[iAwareSRMSStatis_Start]\n").append(makeSRMSJson().toString()).append("\n[iAwareSRMSStatis_End]");
if (clear) {
resetBigData();
}
}
AwareLog.d(TAG, "SRMS saveSRMSBigData success:" + data);
return data.toString();
}
private void updateBigData(int interval) {
synchronized (this.mBigDataList) {
this.mBigDataList.set(interval, Integer.valueOf(((Integer) this.mBigDataList.get(interval)).intValue() + 1));
}
}
private void resetBigData() {
for (int i = 0; i < 4; i++) {
this.mBigDataList.set(i, Integer.valueOf(0));
}
}
private JSONObject makeSRMSJson() {
int countElapsedTimeLess20 = ((Integer) this.mBigDataList.get(0)).intValue();
int countElapsedTimeLess60 = ((Integer) this.mBigDataList.get(1)).intValue();
int countElapsedTimeLess100 = ((Integer) this.mBigDataList.get(2)).intValue();
int countElapsedTimeMore100 = ((Integer) this.mBigDataList.get(3)).intValue();
JSONObject jsonObj = new JSONObject();
try {
jsonObj.put("elapsedTime_less20", countElapsedTimeLess20);
jsonObj.put("elapsedTime_less60", countElapsedTimeLess60);
jsonObj.put("elapsedTime_less100", countElapsedTimeLess100);
jsonObj.put("elapsedTime_more100", countElapsedTimeMore100);
} catch (JSONException e) {
AwareLog.e(TAG, "make json error");
}
return jsonObj;
}
public String getFakeBigData(boolean forBeta, boolean clear) {
if (!forBeta) {
return null;
}
StringBuilder sb = new StringBuilder();
getFakeDetailData(sb, forBeta, clear);
if (clear) {
this.mFakeStartTime = System.currentTimeMillis();
}
AwareLog.d(TAG, "getFakeBigData success data : " + sb.toString());
return sb.toString();
}
private void getFakeDetailData(StringBuilder sb, boolean forBeta, boolean clear) {
if (forBeta && sb != null) {
synchronized (this.mFakeDataList) {
sb.append("\n[iAwareFake_Start]\nstartTime: ").append(String.valueOf(this.mFakeStartTime));
for (Entry<String, TrackFakeData> dataEntry : this.mFakeDataList.entrySet()) {
TrackFakeData data = (TrackFakeData) dataEntry.getValue();
if (data != null) {
String dataStr = data.toJsonStr();
if (dataStr != null && dataStr.length() > 0) {
sb.append("\n").append(dataStr.replace("\\", ""));
}
}
}
sb.append("\nendTime: ").append(String.valueOf(System.currentTimeMillis())).append("\n[iAwareFake_End]");
if (clear) {
this.mFakeDataList.clear();
}
}
}
}
public void updateFakeData(String cmp, String status) {
if (isBetaUser() && cmp != null && status != null) {
synchronized (this.mFakeDataList) {
TrackFakeData fakeData = (TrackFakeData) this.mFakeDataList.get(cmp);
if (fakeData == null) {
fakeData = new TrackFakeData(cmp);
this.mFakeDataList.put(cmp, fakeData);
}
fakeData.updateStatus(status);
}
}
}
private boolean isBetaUser() {
return AwareConstant.CURRENT_USER_TYPE == 3;
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
40d2b9745cc3ee3193b3e23ac533388aa18e661d | 1c3d8c0287f6c88700a1ffca7878827e905b1b26 | /src/ofwidataserver/ApplicationActionBarAdvisor.java | 7fae4b03b49dd49c99012651edc95031fab32e65 | [] | no_license | lihangyu89/ofw-idataserver | 3a28304e1057d03967e52e7e257061c87ec984ec | 4449524f5ba3016d6f72dd9fa073b7d083a15d1d | refs/heads/master | 2020-03-11T19:14:29.388052 | 2013-10-08T09:27:58 | 2013-10-08T09:27:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package ofwidataserver;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(IWorkbenchWindow window) {
}
protected void fillMenuBar(IMenuManager menuBar) {
}
}
| [
"zhaolei-dlut@163.com"
] | zhaolei-dlut@163.com |
d0d6b41fd6387df0a041acdc7a04662c6ce6ffab | 2b28ab0c23f1468d3064252c70b5034a3e178fdf | /utils/MySharedPreference.java | 83fe4a0c21386465fa2738df0618f2d7047ad366 | [] | no_license | Sc4pego4t/dayPlanner | 2c6364818b327acb70842d26ce5b37919d1f3e34 | 6bc505dffbaaabb707dbc20d94d1d966fff5924f | refs/heads/master | 2020-04-02T19:46:19.252052 | 2018-09-19T19:05:28 | 2018-09-19T19:05:28 | 154,745,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,347 | java | package ru.scapegoats.dayplanner.utils;
import android.content.SharedPreferences;
import android.util.ArraySet;
import android.util.Log;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import ru.scapegoats.dayplanner.activity.main.CardContent;
import ru.scapegoats.dayplanner.activity.main.MainView;
import ru.scapegoats.dayplanner.modules.AbstractActivity;
public class MySharedPreference {
private final static String TODO_LIST="list";
private final static String KEY_TEXT="text";
private final static String KEY_TIME="time";
private final static String DIVIDER="#~&";
public static List<CardContent> getTodoList(AbstractActivity activity){
SharedPreferences preferences=activity.getSharedPreferences(TODO_LIST,0);
List<CardContent> list = new ArrayList<>();
List<String> text = null;
List<String> time = null;
try {
text = Arrays.asList(preferences.getString(KEY_TEXT, null).split(DIVIDER));
time = Arrays.asList(preferences.getString(KEY_TIME, null).split(DIVIDER));
if(text.get(0).equals(""))
throw new NullPointerException();
for (int i=0;i<text.size();i++){
list.add(new CardContent(time.get(i),text.get(i)));
}
} catch (Exception e) {
e.printStackTrace();
}
Log.e("qwe",list.size()+"");
return list;
}
private static void saveListToPreference(List<CardContent> list, AbstractActivity activity){
//sort and save list
SharedPreferences.Editor editor=activity.getSharedPreferences(TODO_LIST,0).edit();
StringBuilder text = new StringBuilder();
StringBuilder time = new StringBuilder();
//bubble sort
for(int i=0; i<list.size();i++){
for(int j=0;j<list.size()-1;j++){
CardContent tempCard;
if(list.get(j).getIntTime()>list.get(j+1).getIntTime()){
tempCard=list.get(j);
list.set(j,list.get(j+1));
list.set(j+1,tempCard);
}
}
}
for (CardContent card : list) {
//do not add divider to a last element
text.append(card.getText()).append(DIVIDER);
time.append(card.getTime()).append(DIVIDER);
}
editor.putString(KEY_TEXT,text.toString());
editor.putString(KEY_TIME, time.toString());
editor.apply();
}
public static void deleteElementFromList(int position, AbstractActivity activity){
List<CardContent> list=getTodoList(activity);
list.remove(position);
saveListToPreference(list,activity);
}
public static void addElementToList(CardContent newElement, AbstractActivity activity){
List<CardContent> list= getTodoList(activity);
list.add(newElement);
saveListToPreference(list,activity);
}
public static void changeElementFromList(CardContent newElement,int position, AbstractActivity activity){
List<CardContent> list= getTodoList(activity);
list.set(position,newElement);
Log.e("asd","CHAANGE");
saveListToPreference(list,activity);
}
}
| [
"andreygluhih99@gmail.com"
] | andreygluhih99@gmail.com |
76f754e5e3a4f652d49c43818d9e129bf665afdc | 22580f166fdcfbdaa053f8a219be96c7089174c7 | /refresh-header/src/main/java/com/example/jh/refresh_header/FlyRefreshHeader.java | 5725124b6cbfbb3273d55f99ba12c737c4c91921 | [] | no_license | jinhuizxc/SmartRefresh | 96d79c618e0b3fb0f7fd20455f23503c761dd410 | 27809aecf82b3612e6952c3cbe20ff630f1ec58f | refs/heads/master | 2020-03-19T08:35:04.385676 | 2018-06-06T17:12:10 | 2018-06-06T17:12:10 | 136,217,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,698 | java | package com.example.jh.refresh_header;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.animation.PathInterpolatorCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import com.example.jh.refresh_header.flyrefresh.MountainSceneView;
import com.example.jh.refresh_layout.api.RefreshHeader;
import com.example.jh.refresh_layout.api.RefreshKernel;
import com.example.jh.refresh_layout.api.RefreshLayout;
import com.example.jh.refresh_layout.header.FalsifyHeader;
import com.example.jh.refresh_layout.util.DensityUtil;
/**
* 纸飞机和山丘
* Created by SCWANG on 2017/6/6.
* from https://github.com/race604/FlyRefresh
*/
public class FlyRefreshHeader extends FalsifyHeader implements RefreshHeader {
protected View mFlyView;
protected AnimatorSet mFlyAnimator;
protected RefreshLayout mRefreshLayout;
protected RefreshKernel mRefreshKernel;
protected MountainSceneView mSceneView;
protected int mOffset = 0;
protected float mCurrentPercent;
protected boolean mIsRefreshing = false;
//<editor-fold desc="View">
public FlyRefreshHeader(Context context) {
super(context);
}
public FlyRefreshHeader(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FlyRefreshHeader(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
//</editor-fold>
//<editor-fold desc="RefreshHeader">
@Override
public void onMoving(boolean isDragging, float percent, int offset, int height, int maxDragHeight) {
if (isDragging || !mIsRefreshing) {
if (offset < 0) {
if (mOffset > 0) {
offset = 0;
percent = 0;
} else {
return;
}
}
mOffset = offset;
mCurrentPercent = percent;
if (mSceneView != null) {
mSceneView.updatePercent(percent);
final View sceneView = mSceneView;
sceneView.postInvalidate();
}
if (mFlyView != null) {
if (height + maxDragHeight > 0) {
mFlyView.setRotation((-45f) * offset / (height + maxDragHeight));
} else {
mFlyView.setRotation((-45f) * percent);
}
}
}
}
// @Override
// public void onReleasing(float percent, int offset, int height, int maxDragHeight) {
// if (!mIsRefreshing) {
// onPulling(percent, offset, height, maxDragHeight);
// }
// }
//
// @Override
// public void onPulling(float percent, int offset, int height, int maxDragHeight) {
// if (offset < 0) {
// if (mOffset > 0) {
// offset = 0;
// percent = 0;
// } else {
// return;
// }
// }
// mOffset = offset;
// mCurrentPercent = percent;
// if (mSceneView != null) {
// mSceneView.updatePercent(percent);
// mSceneView.postInvalidate();
// }
// if (mFlyView != null) {
// if (height + maxDragHeight > 0) {
// mFlyView.setRotation((-45f) * offset / (height + maxDragHeight));
// } else {
// mFlyView.setRotation((-45f) * percent);
// }
// }
// }
@Override
public void onReleased(@NonNull RefreshLayout layout, int height, int maxDragHeight) {
/*
* 提前关闭 下拉视图偏移
*/
mRefreshKernel.animSpinner(0);
if (mCurrentPercent > 0) {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(mCurrentPercent, 0);
valueAnimator.setDuration(300);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
onMoving(true,(float) animation.getAnimatedValue(), 0, 0, 0);
// onPulling((float) animation.getAnimatedValue(), 0, 0, 0);
}
});
valueAnimator.start();
mCurrentPercent = 0;
}
if (mFlyView != null && !mIsRefreshing) {
if (mFlyAnimator != null) {
mFlyAnimator.end();
mFlyView.clearAnimation();
}
mIsRefreshing = true;
layout.setEnableRefresh(false);
final int offDistX = ((View) mRefreshLayout).getWidth()-mFlyView.getLeft();
final int offDistY = -(mFlyView.getTop() - mOffset) * 2 / 3;
ObjectAnimator transX = ObjectAnimator.ofFloat(mFlyView, "translationX", 0, offDistX);
ObjectAnimator transY = ObjectAnimator.ofFloat(mFlyView, "translationY", 0, offDistY);
transY.setInterpolator(PathInterpolatorCompat.create(0.7f, 1f));
ObjectAnimator rotation = ObjectAnimator.ofFloat(mFlyView, "rotation", mFlyView.getRotation(), 0);
rotation.setInterpolator(new DecelerateInterpolator());
ObjectAnimator rotationX = ObjectAnimator.ofFloat(mFlyView, "rotationX", mFlyView.getRotationX(), 50);
rotationX.setInterpolator(new DecelerateInterpolator());
AnimatorSet flyUpAnim = new AnimatorSet();
flyUpAnim.setDuration(800);
flyUpAnim.playTogether(transX
,transY
,rotation
,rotationX
, ObjectAnimator.ofFloat(mFlyView, "scaleX", mFlyView.getScaleX(), 0.5f)
, ObjectAnimator.ofFloat(mFlyView, "scaleY", mFlyView.getScaleY(), 0.5f)
);
mFlyAnimator = flyUpAnim;
mFlyAnimator.start();
}
}
/**
* @param colors 对应Xml中配置的 srlPrimaryColor srlAccentColor
* @deprecated 请使用 {@link RefreshLayout#setPrimaryColorsId(int...)}
*/
@Override
@Deprecated
public void setPrimaryColors(@ColorInt int ... colors) {
if (colors.length > 0) {
if (mSceneView != null) {
mSceneView.setPrimaryColor(colors[0]);
}
}
}
@Override
public void onInitialized(@NonNull RefreshKernel kernel, int height, int maxDragHeight) {
mRefreshKernel = kernel;
mRefreshLayout = kernel.getRefreshLayout();
mRefreshLayout.setEnableOverScrollDrag(false);
}
@Override
public int onFinish(@NonNull RefreshLayout layout, boolean success) {
if (mIsRefreshing) {
finishRefresh();
}
return super.onFinish(layout, success);
}
//</editor-fold>
//<editor-fold desc="API">
public void setUp(@Nullable MountainSceneView sceneView, @Nullable View flyView) {
mFlyView = flyView;
mSceneView = sceneView;
}
public void finishRefresh() {
finishRefresh(null);
}
public void finishRefresh(final AnimatorListenerAdapter listenerAdapter) {
if (mFlyView == null || !mIsRefreshing || mRefreshLayout == null) {
return;
}
if (mFlyAnimator != null) {
mFlyAnimator.end();
mFlyView.clearAnimation();
}
mIsRefreshing = false;
mRefreshLayout.finishRefresh(0);
final int offDistX = -mFlyView.getRight();
final int offDistY = -DensityUtil.dp2px(10);
AnimatorSet flyDownAnim = new AnimatorSet();
flyDownAnim.setDuration(800);
ObjectAnimator transX1 = ObjectAnimator.ofFloat(mFlyView, "translationX", mFlyView.getTranslationX(), offDistX);
ObjectAnimator transY1 = ObjectAnimator.ofFloat(mFlyView, "translationY", mFlyView.getTranslationY(), offDistY);
transY1.setInterpolator(PathInterpolatorCompat.create(0.1f, 1f));
ObjectAnimator rotation1 = ObjectAnimator.ofFloat(mFlyView, "rotation", mFlyView.getRotation(), 0);
ObjectAnimator rotationX1 = ObjectAnimator.ofFloat(mFlyView, "rotationX", mFlyView.getRotationX(), 30);
rotation1.setInterpolator(new AccelerateInterpolator());
flyDownAnim.playTogether(transX1, transY1
, rotation1
, rotationX1
, ObjectAnimator.ofFloat(mFlyView, "scaleX", mFlyView.getScaleX(), 0.9f)
, ObjectAnimator.ofFloat(mFlyView, "scaleY", mFlyView.getScaleY(), 0.9f)
);
flyDownAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (mFlyView != null) {
mFlyView.setRotationY(180);
}
}
});
AnimatorSet flyInAnim = new AnimatorSet();
flyInAnim.setDuration(800);
flyInAnim.setInterpolator(new DecelerateInterpolator());
ObjectAnimator tranX2 = ObjectAnimator.ofFloat(mFlyView, "translationX", offDistX, 0);
ObjectAnimator tranY2 = ObjectAnimator.ofFloat(mFlyView, "translationY", offDistY, 0);
ObjectAnimator rotationX2 = ObjectAnimator.ofFloat(mFlyView, "rotationX", 30, 0);
flyInAnim.playTogether(tranX2, tranY2
, rotationX2
, ObjectAnimator.ofFloat(mFlyView, "scaleX", 0.9f, 1f)
, ObjectAnimator.ofFloat(mFlyView, "scaleY", 0.9f, 1f)
);
flyInAnim.setStartDelay(100);
flyInAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (mFlyView != null) {
mFlyView.setRotationY(0);
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (mRefreshLayout != null) {
mRefreshLayout.setEnableRefresh(true);
}
if (listenerAdapter != null) {
listenerAdapter.onAnimationEnd(animation);
}
}
});
mFlyAnimator = new AnimatorSet();
mFlyAnimator.playSequentially(flyDownAnim, flyInAnim);
mFlyAnimator.start();
}
//</editor-fold>
}
| [
"1004260403@qq.com"
] | 1004260403@qq.com |
3b8f489aab2340021a7ba9614e880751c448b360 | 76852b1b29410436817bafa34c6dedaedd0786cd | /sources-2020-07-19-tempmail/sources/com/google/android/gms/common/a.java | 008450d5967fd2bcd9a57610f867f7d7c70bb877 | [] | no_license | zteeed/tempmail-apks | 040e64e07beadd8f5e48cd7bea8b47233e99611c | 19f8da1993c2f783b8847234afb52d94b9d1aa4c | refs/heads/master | 2023-01-09T06:43:40.830942 | 2020-11-04T18:55:05 | 2020-11-04T18:55:05 | 310,075,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,989 | java | package com.google.android.gms.common;
import android.content.Context;
import android.os.RemoteException;
import android.os.StrictMode;
import android.util.Log;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.internal.zzm;
import com.google.android.gms.common.internal.zzn;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.dynamite.DynamiteModule;
import javax.annotation.CheckReturnValue;
@CheckReturnValue
final class a {
/* renamed from: a reason: collision with root package name */
private static volatile zzm f2676a;
/* renamed from: b reason: collision with root package name */
private static final Object f2677b = new Object();
/* renamed from: c reason: collision with root package name */
private static Context f2678c;
static i a(String str, c cVar, boolean z, boolean z2) {
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
try {
return d(str, cVar, z, z2);
} finally {
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
}
static final /* synthetic */ String b(boolean z, String str, c cVar) throws Exception {
boolean z2 = true;
if (z || !d(str, cVar, true, false).f2946a) {
z2 = false;
}
return i.e(str, cVar, z, z2);
}
/* JADX WARNING: Code restructure failed: missing block: B:13:0x0019, code lost:
return;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
static synchronized void c(android.content.Context r2) {
/*
java.lang.Class<com.google.android.gms.common.a> r0 = com.google.android.gms.common.a.class
monitor-enter(r0)
android.content.Context r1 = f2678c // Catch:{ all -> 0x001a }
if (r1 != 0) goto L_0x0011
if (r2 == 0) goto L_0x0018
android.content.Context r2 = r2.getApplicationContext() // Catch:{ all -> 0x001a }
f2678c = r2 // Catch:{ all -> 0x001a }
monitor-exit(r0)
return
L_0x0011:
java.lang.String r2 = "GoogleCertificates"
java.lang.String r1 = "GoogleCertificates has been initialized already"
android.util.Log.w(r2, r1) // Catch:{ all -> 0x001a }
L_0x0018:
monitor-exit(r0)
return
L_0x001a:
r2 = move-exception
monitor-exit(r0)
throw r2
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.common.a.c(android.content.Context):void");
}
private static i d(String str, c cVar, boolean z, boolean z2) {
try {
if (f2676a == null) {
Preconditions.k(f2678c);
synchronized (f2677b) {
if (f2676a == null) {
f2676a = zzn.E(DynamiteModule.e(f2678c, DynamiteModule.k, "com.google.android.gms.googlecertificates").d("com.google.android.gms.common.GoogleCertificatesImpl"));
}
}
}
Preconditions.k(f2678c);
try {
if (f2676a.D1(new zzk(str, cVar, z, z2), ObjectWrapper.b0(f2678c.getPackageManager()))) {
return i.f();
}
return i.c(new b(z, str, cVar));
} catch (RemoteException e2) {
Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e2);
return i.b("module call", e2);
}
} catch (DynamiteModule.LoadingException e3) {
Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e3);
String valueOf = String.valueOf(e3.getMessage());
return i.b(valueOf.length() != 0 ? "module init: ".concat(valueOf) : new String("module init: "), e3);
}
}
}
| [
"zteeed@minet.net"
] | zteeed@minet.net |
44be45eb57441a0bdf734ac0bae4f7baabcf6fab | d81f6a896dace4eb31b326743776d55982333c12 | /artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/transaction/ProtonTransactionRefsOperation.java | 7b48ac0d0f9623d3d8b879fa5477d66f5920b052 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | michaelandrepearce/activemq-artemis | a19fda7c97a232b320551d6b2bd46ad34a693b6e | fafbd7e2e5953e03573088577be620828cd77bc5 | refs/heads/master | 2021-10-08T09:52:26.277367 | 2019-03-12T19:53:07 | 2019-03-12T19:53:07 | 90,807,775 | 1 | 1 | Apache-2.0 | 2018-05-23T17:42:35 | 2017-05-10T01:29:30 | Java | UTF-8 | Java | false | false | 3,047 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.protocol.amqp.proton.transaction;
import java.util.LinkedList;
import java.util.Map;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.server.MessageReference;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.ServerConsumer;
import org.apache.activemq.artemis.core.server.impl.QueueImpl;
import org.apache.activemq.artemis.core.server.impl.RefsOperation;
import org.apache.activemq.artemis.core.transaction.Transaction;
import org.apache.qpid.proton.engine.Delivery;
/**
* AMQP Protocol has different TX Rollback behaviour for Acks depending on whether an AMQP delivery has been settled
* or not. This class extends the Core RefsOperation used for normal acks. In the case where deliveries have been
* settled, normal Ack rollback is applied. For cases where deliveries are unsettled and rolled back, we increment
* the delivery count and return to the consumer.
*/
public class ProtonTransactionRefsOperation extends RefsOperation {
public ProtonTransactionRefsOperation(final Queue queue, StorageManager storageManager) {
super(queue, storageManager);
}
@Override
public void rollbackRedelivery(Transaction txn, MessageReference ref, long timeBase, Map<QueueImpl, LinkedList<MessageReference>> queueMap) throws Exception {
ProtonTransactionImpl tx = (ProtonTransactionImpl) txn;
if (tx.getDeliveries().containsKey(ref)) {
Delivery del = tx.getDeliveries().get(ref).getA();
ServerConsumer consumer = (ServerConsumer) tx.getDeliveries().get(ref).getB().getBrokerConsumer();
// Rollback normally if the delivery is not settled or a forced TX rollback is done (e.g. connection drop).
if (del.remotelySettled() || !tx.isDischarged()) {
super.rollbackRedelivery(tx, ref, timeBase, queueMap);
} else {
ref.incrementDeliveryCount();
consumer.backToDelivering(ref);
del.disposition(del.getLocalState() == null ? del.getDefaultDeliveryState() : del.getLocalState());
}
} else {
super.rollbackRedelivery(tx, ref, timeBase, queueMap);
}
}
}
| [
"clebertsuconic@apache.org"
] | clebertsuconic@apache.org |
7bc9b4ef30866e6ea121a93799a852ca25ccf7dd | e48d5874b4f2e3d73cba69575e08aecdbaee8549 | /BebidaMs/src/main/java/entities/Insumo.java | 98e726c5485f0a9355de8080b6b30d63e7d7c5b6 | [] | no_license | biancalr/PDSCfullProject | b290141d612721ddda6eb3c89180d0c5d508df1c | c04b8a319b88f8f316d46b270e5b88c2fcafe765 | refs/heads/master | 2020-09-20T17:03:45.392901 | 2019-12-14T02:18:25 | 2019-12-14T02:18:25 | 224,543,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,953 | java | package entities;
import java.io.Serializable;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import enums.TipoInsumo;
@Entity
@Table
@Access(AccessType.FIELD)
public class Insumo implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Enumerated(EnumType.ORDINAL)
private TipoInsumo tipoInsumo;
@NotBlank
private String nomeInsumo;
private String descricao;
@NotNull
@DecimalMin(value = "0.0")
private double preco;
public Insumo() {
super();
}
public Insumo(Long id, TipoInsumo tipoInsumo, @NotBlank String nomeInsumo, String descricao,
@NotNull @DecimalMin("0.0") double preco) {
super();
this.id = id;
this.tipoInsumo = tipoInsumo;
this.nomeInsumo = nomeInsumo;
this.descricao = descricao;
this.preco = preco;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public TipoInsumo getTipoInsumo() {
return tipoInsumo;
}
public void setTipoInsumo(TipoInsumo tipoInsumo) {
this.tipoInsumo = tipoInsumo;
}
public String getNomeInsumo() {
return nomeInsumo;
}
public void setNomeInsumo(String nomeInsumo) {
this.nomeInsumo = nomeInsumo;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public double getPreco() {
return preco;
}
public void setPreco(double preco) {
this.preco = preco;
}
}
| [
"bianca@bianca"
] | bianca@bianca |
4f9cfe004d1f0b99a457799580517f3e9dae300d | bc2ba91982ad828bc81417ca112b07de2bedc062 | /src/test/java/tgseminar/controller/UpdateControllerTest.java | ad32510212a958d1a03cdacf57ca05797ff18c3f | [] | no_license | shin1ogawa/tgseminar | e8a36a59e5bf1911c97c5880d86ba5b37f6da016 | f6540c700ea96ee25db967b82cc2b26e38dace24 | refs/heads/master | 2016-09-06T13:45:33.042863 | 2013-06-14T07:40:19 | 2013-06-14T07:40:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,891 | java | package tgseminar.controller;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.util.Date;
import javax.servlet.ServletException;
import org.junit.Test;
import org.slim3.datastore.Datastore;
import org.slim3.tester.ControllerTestCase;
import org.slim3.tester.TestEnvironment;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.apphosting.api.ApiProxy;
public class UpdateControllerTest extends ControllerTestCase {
@Test
public void respond400IfIdNotSpecified() throws NullPointerException,
IllegalArgumentException, IOException, ServletException {
// tester.param("id", "1");
tester.param("title", "To-Do #1");
tester.start("/Update");
// assert response from server is 400
assertThat(tester.response.getStatus(), is(400));
}
@Test
public void respond400IfIdSpecifiedIsNotNumeric()
throws NullPointerException, IllegalArgumentException, IOException,
ServletException {
tester.param("id", "a");
tester.param("title", "To-Do #1");
tester.start("/Update");
// assert response from server is 400
assertThat(tester.response.getStatus(), is(400));
}
@Test
public void respond400IfTitleNotSpecified() throws NullPointerException,
IllegalArgumentException, IOException, ServletException {
tester.param("id", "1");
// tester.param("title", "To-Do #1");
tester.start("/Update");
// assert response from server is 400
assertThat(tester.response.getStatus(), is(400));
}
@Test
public void respond404IfEntityIsNotExist() throws NullPointerException,
IllegalArgumentException, IOException, ServletException {
tester.param("id", "3");
tester.param("title", "To-Do #3 modified");
tester.start("/Update");
assertThat(tester.response.getStatus(), is(404));
}
@Test
public void respond403IfEntityIsAnotherUsers() throws NullPointerException,
IllegalArgumentException, IOException, ServletException {
Entity entity = Datastore.getOrNull(Datastore.createKey("ToDo", 2));
assertThat("Pre-condition", entity, is(notNullValue()));
assertThat("Pre-condition", (String) entity.getProperty("createdBy"),
is(not("loginuser@example.com")));
tester.param("id", "2");
tester.param("title", "To-Do #2 modified");
tester.start("/Update");
assertThat(tester.response.getStatus(), is(403));
}
@Test
public void respond200() throws NullPointerException,
IllegalArgumentException, IOException, ServletException {
tester.param("id", "1");
tester.param("title", "To-Do #1 modified");
tester.start("/Update");
assertThat(tester.response.getStatus(), is(200));
}
@Test
public void success() throws NullPointerException,
IllegalArgumentException, IOException, ServletException {
String modifiedTitle = "To-Do #1 modified";
tester.param("id", "1");
tester.param("title", modifiedTitle);
tester.start("/Update");
Key key = Datastore.createKey("ToDo", 1);
Entity entity = Datastore.get(key);
assertThat((String) entity.getProperty("title"), is(modifiedTitle));
}
@Override
public void setUp() throws Exception {
super.setUp();
TestEnvironment environment = (TestEnvironment) ApiProxy
.getCurrentEnvironment();
environment.setEmail("loginuser@example.com");
Entity entity1 = new Entity(Datastore.createKey("ToDo", 1));
entity1.setProperty("title", "To-Do #1");
entity1.setProperty("createdBy", "loginuser@example.com");
entity1.setProperty("createdAt", new Date());
Entity entity2 = new Entity(Datastore.createKey("ToDo", 2));
entity2.setProperty("title", "To-Do #2");
entity2.setProperty("createdBy", "anotheruser@example.com");
entity2.setProperty("createdAt", new Date());
Datastore.put(entity1, entity2);
}
}
| [
"shin1ogawa@gmail.com"
] | shin1ogawa@gmail.com |
e35ae147179a99974c517482d570e63f0bbd0595 | 420f8f61fa55063f95fbf53605d8895572bfb723 | /wxpay_demo/src/main/java/com/github/wxpay/sdk/Config.java | 410e48ac0ad256228387b73b3936f92aed97a6f5 | [] | no_license | likuiz/git-test | c1a4b52cf69d485a6e4fb5c5be6337675c668e09 | d317a8cda9591ac14f7dd1e329e479d1d50e8df3 | refs/heads/master | 2020-06-26T21:31:46.840112 | 2019-07-31T02:26:24 | 2019-07-31T02:26:24 | 199,763,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | package com.github.wxpay.sdk;
import java.io.InputStream;
public class Config extends WXPayConfig {
String getAppID() {
return "wx8397f8696b538317";
}
String getMchID() {
return "1473426802";
}
String getKey() {
return "T6m9iK73b0kn9g5v426MKfHQH7X8rKwb";
}InputStream getCertStream() {
return null;
}
IWXPayDomain getWXPayDomain() {
return new IWXPayDomain() {
public void report(String s, long l, Exception e) {
}
public DomainInfo getDomain(WXPayConfig wxPayConfig) {
return new DomainInfo("api.mch.weixin.qq.com",true);
}
};
}
}
| [
"likui@itcast.cn"
] | likui@itcast.cn |
ed631b3a69ed636b98ee908796dd0a264cd2aa2d | 09ea94e9bf7a27f1d7336622947e77ef77406344 | /src/libary/managment/system/IssueBook.java | f132bec983238f1d3d7b224d0dd6504bfbe7d4fc | [] | no_license | sumanmahat/LibraryManagment | 4ed1abf74b930ad6f5641315db00d8791e3f2f33 | e2409dfc66d511a9c35b9f26a62e61269b12a4d1 | refs/heads/master | 2022-11-05T15:44:01.487602 | 2020-06-23T04:06:18 | 2020-06-23T04:06:18 | 274,305,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,351 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package libary.managment.system;
import Project.ConnectionProvider;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
/**
*
* @author mahat
*/
public class IssueBook extends javax.swing.JFrame {
/**
* Creates new form IssueBook
*/
public IssueBook() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel5 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txt_bookid = new javax.swing.JTextField();
txt_studentid = new javax.swing.JTextField();
jDateChooser1 = new com.toedter.calendar.JDateChooser();
jDateChooser2 = new com.toedter.calendar.JDateChooser();
btn_issue = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jLabel5.setText("jLabel5");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setLocation(new java.awt.Point(325, 125));
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("BookId:");
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(144, 89, -1, -1));
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel2.setText("StudentID:");
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(144, 131, -1, -1));
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel3.setText("Issue Date:");
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(144, 188, -1, -1));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel4.setText("Due Date:");
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(144, 236, -1, -1));
getContentPane().add(txt_bookid, new org.netbeans.lib.awtextra.AbsoluteConstraints(352, 81, 170, 32));
txt_studentid.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_studentidActionPerformed(evt);
}
});
getContentPane().add(txt_studentid, new org.netbeans.lib.awtextra.AbsoluteConstraints(352, 131, 170, 32));
getContentPane().add(jDateChooser1, new org.netbeans.lib.awtextra.AbsoluteConstraints(352, 181, 170, 29));
getContentPane().add(jDateChooser2, new org.netbeans.lib.awtextra.AbsoluteConstraints(352, 228, 170, 30));
btn_issue.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_issue.setIcon(new javax.swing.ImageIcon(getClass().getResource("/save-icon--1.png"))); // NOI18N
btn_issue.setText("Issue");
btn_issue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_issueActionPerformed(evt);
}
});
getContentPane().add(btn_issue, new org.netbeans.lib.awtextra.AbsoluteConstraints(149, 340, -1, -1));
jButton2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/libary/managment/system/red-x-mark-transparent-background-3.png"))); // NOI18N
jButton2.setText("Close");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 340, -1, -1));
jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/123456.png"))); // NOI18N
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>//GEN-END:initComponents
private void txt_studentidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_studentidActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_studentidActionPerformed
private void btn_issueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_issueActionPerformed
// TODO add your handling code here:
SimpleDateFormat dformat = new SimpleDateFormat("dd-MM-yyyy");
String bookId = txt_bookid.getText();
String studentId = txt_studentid.getText();
String issueDate = dformat.format(jDateChooser1.getDate());
String dueDate = dformat.format(jDateChooser2.getDate());
String returnBook = "No";
try{
Connection con = ConnectionProvider.getCon();
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from book where bookId= '"+bookId+"'");
if(rs.next()){
ResultSet rs1 = st.executeQuery("select * from student where studentId = '"+studentId+"'");
if(rs1.next()){
st.executeUpdate("insert into issue values('"+bookId+"','"+studentId+"','"+issueDate+"','"+dueDate+"','"+returnBook+"')");
JOptionPane.showConfirmDialog(null, "Book Succesfully Issued");
setVisible(false);
new IssueBook().setVisible(true);
}else{
JOptionPane.showConfirmDialog(null, "Incorrect StudentID");
}
}else{
JOptionPane.showConfirmDialog(null, "Incorrect BookId");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, "Connection error");
}
}//GEN-LAST:event_btn_issueActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
setVisible(false);
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.txt_bookid */
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new IssueBook().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btn_issue;
private javax.swing.JButton jButton2;
private com.toedter.calendar.JDateChooser jDateChooser1;
private com.toedter.calendar.JDateChooser jDateChooser2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JTextField txt_bookid;
private javax.swing.JTextField txt_studentid;
// End of variables declaration//GEN-END:variables
}
| [
"mahatsuman007@gmail.com"
] | mahatsuman007@gmail.com |
08f7856f330ca86b7ec75c20637905b5ef299ae4 | 6f8901129f76926bb8daf21e41968c336eed8980 | /app/src/main/java/com/inerun/dropinsta/data/TransactionData.java | 11c75ef7ac269ee0af5def8f9e3baebcd47f97fb | [] | no_license | vinay-a/DropInsta | 214444d02036a72e52d470a601853c310cdb4923 | 19d386948ed47d6643d5210d9853a715af31198b | refs/heads/master | 2021-01-09T05:53:09.084545 | 2017-02-03T13:21:38 | 2017-02-03T13:21:38 | 80,813,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,901 | java | package com.inerun.dropinsta.data;
/**
* Created by vinay on 23/01/17.
*/
public class TransactionData {
boolean iscard;
String totalamount, transcid, collectedby,currency;
String barcode;
String transtype;
String transTimeStamp;
public TransactionData(boolean iscard, String totalamount, String transcid, String collectedby, String currency, String barcode,String transtype,String transTimeStamp) {
this.iscard = iscard;
this.totalamount = totalamount;
this.transcid = transcid;
this.collectedby = collectedby;
this.currency = currency;
this.barcode = barcode;
this.transtype = transtype;
this.transTimeStamp = transTimeStamp;
}
public String getCurrency() {
return currency;
}
public String getBarcode() {
return barcode;
}
public String getTranstype() {
return transtype;
}
public String getTransTimeStamp() {
return transTimeStamp;
}
public TransactionData(boolean iscard, String totalamount, String transcid, String collectedby) {
this.iscard = iscard;
this.totalamount = totalamount;
this.transcid = transcid;
this.collectedby = collectedby;
}
public boolean iscard() {
return iscard;
}
public void setIscard(boolean iscard) {
this.iscard = iscard;
}
public String getTotalamount() {
return totalamount;
}
public void setTotalamount(String totalamount) {
this.totalamount = totalamount;
}
public String getTranscid() {
return transcid;
}
public void setTranscid(String transcid) {
this.transcid = transcid;
}
public String getCollectedby() {
return collectedby;
}
public void setCollectedby(String collectedby) {
this.collectedby = collectedby;
}
}
| [
"vineet.t@inerun.com"
] | vineet.t@inerun.com |
2226b4bd0d4f00ee848aa2f29f0e3abf7b569d25 | 212c2211c14d5fbf39a86b0632b809bf6a474b16 | /study-previous/src/main/java/practice03/prob7/Bird.java | c80e0e9aae9fcd6f9a59e8791d25041b6fe61e63 | [] | no_license | songk1992/bitacademydiary | 30e4f7c374135a82ebd02059b4249753d9b9afca | 0acd3956365c7d7b3bd4d3887c3a98bcb9af334a | refs/heads/master | 2023-02-03T16:55:30.322900 | 2020-12-18T08:56:36 | 2020-12-18T08:56:36 | 319,233,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package practice03.prob7;
public class Bird {
private String name;
private int legs;
private int length;
public void fly() {
}
public void sing() {
System.out.println("소리내어 웁니다.");
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public String toString() {
return "이름은 " + name + " 입니다";
}
}
| [
"zuppiy@naver.com"
] | zuppiy@naver.com |
55a83eceface410115d751a62e0f1a465534f7d7 | 50ede2975b0cf9ecb05e859d521ccb970a0617cf | /Multithreading/SimpleThread.java | 9cb6c1c2f2d6ed078ad1df65efd84fde26063cde | [] | no_license | vishaljohri/AlgorithmPool | 1a2848d161b012bbe95330cb2832a4ae9af26641 | feb79762e9ab1b69e5a3eb685a38003b21361450 | refs/heads/master | 2021-01-23T14:06:12.111996 | 2016-09-23T06:52:20 | 2016-09-23T06:52:20 | 59,443,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java |
public class SimpleThread extends Thread{
@Override
public void run() {
for(int i = 1; i < 20; i++) {
System.out.println("iteration: " + i + " thread: " + Thread.currentThread().getName());
}
}
public static void main(String[] args) {
SimpleThread st1 = new SimpleThread();
st1.setName("Thread1");
SimpleThread st2 = new SimpleThread();
st2.setName("Thread2");
st1.start();
st2.start();
}
}
| [
"vishaljohri@yahoo.co.in"
] | vishaljohri@yahoo.co.in |
a1742bf398ef453f5eb6cd3868bb77d37ecc634c | 0bb292a10b8b4215c9f5d3b38921a5350a5c735c | /src/main/java/ch/bergturbenthal/hs485/frontend/gwtfrontend/server/running/primitive/PrimitiveEventSource.java | 5c3928a73e5218fb9b48dce7ff417a3270f3a90e | [] | no_license | koa/hs485-gwtfrontend | 0b186b69ec752988bf8b1b2ae6e6157b03db655b | d618d13428708278591c4581a86c02e1cb2af074 | refs/heads/master | 2022-09-05T15:21:02.226242 | 2022-08-19T13:42:10 | 2022-08-19T13:42:10 | 2,295,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package ch.bergturbenthal.hs485.frontend.gwtfrontend.server.running.primitive;
public interface PrimitiveEventSource {
}
| [
"andreas.koenig@berg-turbenthal.ch"
] | andreas.koenig@berg-turbenthal.ch |
61450542b6a7135853ccb264de51e85fed5241b5 | 246f2be1162532f2efb1a477b4b88aadcfc81524 | /results/eureka/6b09030e95e118a784ca7ec616398a4f0e384bcd/transformed/evosuite_6/evosuite-tests/com/netflix/appinfo/ApplicationInfoManager_ESTest.java | c0752a7608485d660453282aef13322e87856aaa | [] | no_license | semantic-conflicts/SemanticConflicts | 4d2f05bf2e5fa289233429ed8f1614b0b14c2e5e | c5684bbde00dfbd27c828b5798edbec0e284597a | refs/heads/master | 2022-12-05T03:11:57.983183 | 2020-08-25T13:54:24 | 2020-08-25T13:54:24 | 267,826,586 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 13,730 | java | /*
* This file was automatically generated by EvoSuite
* Thu Apr 30 04:36:12 GMT 2020
*/
package com.netflix.appinfo;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.netflix.appinfo.ApplicationInfoManager;
import com.netflix.appinfo.CloudInstanceConfig;
import com.netflix.appinfo.DataCenterInfo;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.appinfo.MyDataCenterInstanceConfig;
import java.util.HashMap;
import java.util.Map;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.System;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class ApplicationInfoManager_ESTest extends ApplicationInfoManager_ESTest_scaffolding {
@Test(timeout = 11000)
public void test00() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
InstanceInfo instanceInfo0 = applicationInfoManager0.getInfo();
HashMap<String, String> hashMap0 = new HashMap<String, String>();
// Undeclared exception!
try {
applicationInfoManager0.registerAppMetadata(hashMap0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test01() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.getInstance();
String string0 = "";
applicationInfoManager0.unregisterStatusChangeListener(string0);
}
@Test(timeout = 11000)
public void test02() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.getInstance();
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus0 = InstanceInfo.InstanceStatus.UP;
// Undeclared exception!
try {
applicationInfoManager0.setInstanceStatus(instanceInfo_InstanceStatus0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test03() throws Throwable {
EurekaInstanceConfig eurekaInstanceConfig0 = null;
InstanceInfo instanceInfo0 = mock(InstanceInfo.class, new ViolatedAssumptionAnswer());
InstanceInfo instanceInfo1 = new InstanceInfo(instanceInfo0);
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus0 = InstanceInfo.InstanceStatus.DOWN;
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus1 = instanceInfo1.setStatus(instanceInfo_InstanceStatus0);
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager(eurekaInstanceConfig0, instanceInfo1);
String string0 = " => ";
ApplicationInfoManager.StatusChangeListener applicationInfoManager_StatusChangeListener0 = mock(ApplicationInfoManager.StatusChangeListener.class, new ViolatedAssumptionAnswer());
doReturn(string0).when(applicationInfoManager_StatusChangeListener0).getId();
applicationInfoManager0.registerStatusChangeListener(applicationInfoManager_StatusChangeListener0);
applicationInfoManager0.setInstanceStatus(instanceInfo_InstanceStatus1);
// Undeclared exception!
try {
applicationInfoManager0.initComponent(eurekaInstanceConfig0);
} catch(RuntimeException e) {
//
// Failed to initialize ApplicationInfoManager
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test04() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
String string0 = "";
applicationInfoManager0.unregisterStatusChangeListener(string0);
}
@Test(timeout = 11000)
public void test05() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.getInstance();
applicationInfoManager0.instance.listeners = applicationInfoManager0.listeners;
applicationInfoManager0.instance.instanceInfo = applicationInfoManager0.instanceInfo;
String string0 = "";
applicationInfoManager0.unregisterStatusChangeListener(string0);
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus0 = InstanceInfo.InstanceStatus.STARTING;
InstanceInfo instanceInfo0 = null;
applicationInfoManager0.instanceInfo = instanceInfo0;
// Undeclared exception!
try {
applicationInfoManager0.setInstanceStatus(instanceInfo_InstanceStatus0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test06() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
ApplicationInfoManager.StatusChangeListener applicationInfoManager_StatusChangeListener0 = mock(ApplicationInfoManager.StatusChangeListener.class, new ViolatedAssumptionAnswer());
doReturn((String) null).when(applicationInfoManager_StatusChangeListener0).getId();
// Undeclared exception!
try {
applicationInfoManager0.registerStatusChangeListener(applicationInfoManager_StatusChangeListener0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.util.concurrent.ConcurrentHashMap", e);
}
}
@Test(timeout = 11000)
public void test07() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.getInstance();
String string0 = "bk|6Ri";
applicationInfoManager0.instance.unregisterStatusChangeListener(string0);
ApplicationInfoManager.StatusChangeListener applicationInfoManager_StatusChangeListener0 = mock(ApplicationInfoManager.StatusChangeListener.class, new ViolatedAssumptionAnswer());
doReturn((String) null).when(applicationInfoManager_StatusChangeListener0).getId();
// Undeclared exception!
try {
applicationInfoManager0.registerStatusChangeListener(applicationInfoManager_StatusChangeListener0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.util.concurrent.ConcurrentHashMap", e);
}
}
@Test(timeout = 11000)
public void test08() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
String string0 = null;
// Undeclared exception!
try {
applicationInfoManager0.instance.unregisterStatusChangeListener(string0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.util.concurrent.ConcurrentHashMap", e);
}
}
@Test(timeout = 11000)
public void test09() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
InstanceInfo instanceInfo0 = applicationInfoManager0.getInfo();
HashMap<String, String> hashMap0 = new HashMap<String, String>();
String string0 = null;
String string1 = "@`+";
String string2 = hashMap0.put(string0, string1);
// Undeclared exception!
try {
applicationInfoManager0.registerAppMetadata(hashMap0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test10() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
HashMap<String, String> hashMap0 = new HashMap<String, String>();
// Undeclared exception!
try {
applicationInfoManager0.registerAppMetadata(hashMap0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test11() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager();
EurekaInstanceConfig eurekaInstanceConfig0 = null;
// Undeclared exception!
try {
applicationInfoManager0.initComponent(eurekaInstanceConfig0);
} catch(RuntimeException e) {
//
// Failed to initialize ApplicationInfoManager
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test12() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.getInstance();
applicationInfoManager0.instance.config = applicationInfoManager0.config;
ApplicationInfoManager.instance = applicationInfoManager0;
InstanceInfo instanceInfo0 = applicationInfoManager0.getInfo();
// Undeclared exception!
try {
applicationInfoManager0.instance.initComponent(ApplicationInfoManager.instance.config);
} catch(RuntimeException e) {
//
// Failed to initialize ApplicationInfoManager
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test13() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.instance;
ApplicationInfoManager applicationInfoManager1 = ApplicationInfoManager.instance;
ApplicationInfoManager.instance = applicationInfoManager0;
applicationInfoManager1.instance.instanceInfo = ApplicationInfoManager.instance.instanceInfo;
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus0 = InstanceInfo.InstanceStatus.UNKNOWN;
// Undeclared exception!
try {
applicationInfoManager0.instance.setInstanceStatus(instanceInfo_InstanceStatus0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.ApplicationInfoManager", e);
}
}
@Test(timeout = 11000)
public void test14() throws Throwable {
EurekaInstanceConfig eurekaInstanceConfig0 = null;
InstanceInfo instanceInfo0 = null;
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager(eurekaInstanceConfig0, instanceInfo0);
String string0 = null;
MyDataCenterInstanceConfig myDataCenterInstanceConfig0 = null;
try {
myDataCenterInstanceConfig0 = new MyDataCenterInstanceConfig(string0);
} catch(NoClassDefFoundError e) {
}
}
@Test(timeout = 11000)
public void test15() throws Throwable {
ApplicationInfoManager applicationInfoManager0 = ApplicationInfoManager.instance;
String string0 = null;
// Undeclared exception!
try {
applicationInfoManager0.unregisterStatusChangeListener(string0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("java.util.concurrent.ConcurrentHashMap", e);
}
}
@Test(timeout = 11000)
public void test16() throws Throwable {
EurekaInstanceConfig eurekaInstanceConfig0 = null;
InstanceInfo instanceInfo0 = mock(InstanceInfo.class, new ViolatedAssumptionAnswer());
InstanceInfo instanceInfo1 = new InstanceInfo(instanceInfo0);
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus0 = InstanceInfo.InstanceStatus.DOWN;
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus1 = instanceInfo1.setStatus(instanceInfo_InstanceStatus0);
instanceInfo1.setIsCoordinatingDiscoveryServer();
ApplicationInfoManager applicationInfoManager0 = new ApplicationInfoManager(eurekaInstanceConfig0, instanceInfo1);
String string0 = " => ";
ApplicationInfoManager.StatusChangeListener applicationInfoManager_StatusChangeListener0 = mock(ApplicationInfoManager.StatusChangeListener.class, new ViolatedAssumptionAnswer());
doReturn(string0).when(applicationInfoManager_StatusChangeListener0).getId();
applicationInfoManager0.registerStatusChangeListener(applicationInfoManager_StatusChangeListener0);
ApplicationInfoManager.instance = applicationInfoManager0;
InstanceInfo.InstanceStatus instanceInfo_InstanceStatus2 = InstanceInfo.InstanceStatus.UNKNOWN;
applicationInfoManager0.setInstanceStatus(instanceInfo_InstanceStatus2);
ApplicationInfoManager applicationInfoManager1 = ApplicationInfoManager.getInstance();
Map<String, String> map0 = null;
// Undeclared exception!
try {
ApplicationInfoManager.instance.registerAppMetadata(map0);
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.netflix.appinfo.InstanceInfo", e);
}
}
}
| [
"semantic.conflicts@gmail.com"
] | semantic.conflicts@gmail.com |
165118b913ca7bcef70ffb2f1a8950af543e3eab | 37f622caef0552ae4a5b90ea6ff64f9bbd22f8af | /visual/Window.java | a32c5e724a4234670253c3533bf0ba12d059519a | [] | no_license | Mattachoo/Tinvey | a086b96b9847124710bb58060961d2dbb742f816 | d4cdfd1dcb6f11aab216be49f808aae099a82251 | refs/heads/master | 2021-01-10T17:04:26.825714 | 2015-11-17T06:18:10 | 2015-11-17T06:18:10 | 46,256,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java |
package visual;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class Window extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Test Window");
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 12));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: #336699;");
Button buttonCurrent = new Button("Current");
buttonCurrent.setPrefSize(100, 20);
Button buttonProjected = new Button("Projected");
buttonProjected.setPrefSize(100, 20);
hbox.getChildren().addAll(buttonCurrent, buttonProjected);
Scene sc = new Scene(hbox, 300, 250);
primaryStage.setScene(sc);
primaryStage.show();
}
}
| [
"sarused@gmail.com"
] | sarused@gmail.com |
720fa51e0876aa0694915fb442882047370a4328 | ea141d8341c0901417b319cae84928e62d3f4f30 | /src/fileservicelab/FileService.java | 4dd7baba1b502a0ee2850270372331eaad45f35c | [] | no_license | kraymond6/FileServiceLab | 410e82183c445f46a5662dc71019bb3b9e01a768 | 44787beb48ffef3e108e97c3a4867b299eec1145 | refs/heads/master | 2021-01-13T02:14:44.744433 | 2015-04-13T19:45:16 | 2015-04-13T19:45:16 | 33,889,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fileservicelab;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
/**
*
* @author Kallie
*/
public class FileService {
private ReaderStrategy fileReader;
private WriterStrategy fileWriter;
private String readPath;
private String writePath;
private FormatStrategy readFormat;
private FormatStrategy writeFormat;
public FileService(ReaderStrategy fileReader, WriterStrategy fileWriter){
this.fileReader = fileReader;
this.fileWriter = fileWriter;
this.writePath = fileWriter.getPath();
this.readPath = fileReader.getPath();
this.readFormat = fileReader.getFormatter();
this.writeFormat = fileWriter.getFormatter();
}
public List<LinkedHashMap<String,String>> getRecords() throws IOException{
return fileReader.readRecords();
}
public void overwriteRecords(List<LinkedHashMap<String,String>> newData) throws IOException{
fileWriter.update(newData);
}
public void addRecords(List<LinkedHashMap<String,String>> newData) throws IOException{
fileWriter.addRecords(newData);
}
}
| [
"Kallie@Kallies_Laptop"
] | Kallie@Kallies_Laptop |
28a251ff338980c366ba40e18c7bf619c0fa7481 | 1b38220762b58170cf2b053c294ee05c48737d98 | /ticket-reservation/src/main/java/com/walmartlabs/TicketService.java | 661e8fea7225181d1b4b24487214765a02531e36 | [] | no_license | aswinsv/Walmart-Labs | c8cfa12372f6a065a0003f7bb9b4d12af824c99f | 0a6163728f9597c4898d1e207db414fcec125ad3 | refs/heads/master | 2020-03-31T11:47:52.194249 | 2018-10-09T05:18:19 | 2018-10-09T05:18:19 | 152,191,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package com.walmartlabs;
public interface TicketService {
/**
* The number of seats in the venue that are not reserved
*
* @return the number of tickets available in the venue
*/
int numSeatsAvailable();
/**
* Find and hold the best available seats for a customer
*
* @param numSeats the number of seats to find and hold
* @param customerEmail unique identifier for the customer
* @return a SeatHold object identifying the specific seats and related
* information
**/
SeatHold findAndHoldSeats(int numSeats, String customerEmail) throws Exception;
/**
* Commit seats held for a specific customer
*
* @param seatHoldId the seat hold identifier
* @param customerEmail the email address of the customer to which the seat hold
* is assigned
* @return a reservation confirmation code
*/
String reserveSeats(Long seatHoldId, String customerEmail);
} | [
"aswinras@andrew.cmu.edu"
] | aswinras@andrew.cmu.edu |
558f7bab1fec7d8daba841698305ad495ab6671a | c2c03a6600fe16c32932bddf96d9810f08dc342e | /src/aima/test/core/unit/search/uninformed/BreadthFirstSearchTest.java | 9415da1275b2f39af23932f9cdf5ec9ed0efb5b1 | [
"Apache-2.0"
] | permissive | batectin/minesweeper-ai | e02c235034a38d407d56681c89456334c8bff8dc | a23146204f2178e03520917bb2b5b5b1701e6917 | refs/heads/master | 2021-01-22T10:26:21.582040 | 2015-06-02T18:53:07 | 2015-06-02T18:53:07 | 36,781,097 | 1 | 0 | null | 2015-06-03T05:03:00 | 2015-06-03T05:02:59 | null | UTF-8 | Java | false | false | 2,997 | java | package aima.test.core.unit.search.uninformed;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import aima.core.agent.Action;
import aima.core.environment.nqueens.NQueensBoard;
import aima.core.environment.nqueens.NQueensFunctionFactory;
import aima.core.environment.nqueens.NQueensGoalTest;
import aima.core.search.framework.Problem;
import aima.core.search.framework.Search;
import aima.core.search.framework.SearchAgent;
import aima.core.search.framework.TreeSearch;
import aima.core.search.uninformed.BreadthFirstSearch;
public class BreadthFirstSearchTest {
@Test
public void testBreadthFirstSuccesfulSearch() throws Exception {
Problem problem = new Problem(new NQueensBoard(8),
NQueensFunctionFactory.getIActionsFunction(),
NQueensFunctionFactory.getResultFunction(),
new NQueensGoalTest());
Search search = new BreadthFirstSearch(new TreeSearch());
SearchAgent agent = new SearchAgent(problem, search);
List<Action> actions = agent.getActions();
assertCorrectPlacement(actions);
Assert.assertEquals("1665", agent.getInstrumentation().getProperty(
"nodesExpanded"));
Assert.assertEquals("8.0", agent.getInstrumentation().getProperty(
"pathCost"));
}
@Test
public void testBreadthFirstUnSuccesfulSearch() throws Exception {
Problem problem = new Problem(new NQueensBoard(3),
NQueensFunctionFactory.getIActionsFunction(),
NQueensFunctionFactory.getResultFunction(),
new NQueensGoalTest());
Search search = new BreadthFirstSearch(new TreeSearch());
SearchAgent agent = new SearchAgent(problem, search);
List<Action> actions = agent.getActions();
Assert.assertEquals(0, actions.size());
Assert.assertEquals("6", agent.getInstrumentation().getProperty(
"nodesExpanded"));
Assert.assertEquals("0", agent.getInstrumentation().getProperty(
"pathCost"));
}
//
// PRIVATE METHODS
//
private void assertCorrectPlacement(List<Action> actions) {
Assert.assertEquals(8, actions.size());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 0 , 0 ) ]", actions
.get(0).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 1 , 4 ) ]", actions
.get(1).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 2 , 7 ) ]", actions
.get(2).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 3 , 5 ) ]", actions
.get(3).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 4 , 2 ) ]", actions
.get(4).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 5 , 6 ) ]", actions
.get(5).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 6 , 1 ) ]", actions
.get(6).toString());
Assert.assertEquals(
"Action[name==placeQueenAt, location== ( 7 , 3 ) ]", actions
.get(7).toString());
}
}
| [
"felix.infinite@gmail.com"
] | felix.infinite@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.