blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8cc421d264283abe51460db198f0a9b546544e9f | 8,237,747,276,110 | b7a93a89b5c4ca36efc44703bca4bad641d4b46c | /CoreJava/src/Session/Program_4_shape.java | 0c21a816bd86450259c900cabe49fd6237697d2c | [] | no_license | Vishky99/VK_CoreJava | https://github.com/Vishky99/VK_CoreJava | b5967e372d129afbe061b06fdc0a8321c51fb28e | 870edc2ebeeebe0f292820208c36284d4e4836e8 | refs/heads/master | 2023-09-05T12:26:52.914000 | 2021-10-14T17:58:56 | 2021-10-14T17:58:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Session;
class Shape{
void area() {
System.out.println("\nCalculating area:");
}
void draw() {
System.out.println("Drawing shape:");
}
}
class Circle extends Shape{
void area(double r) {
super.area();
System.out.println("Area of circle: "+(3.14*r*r));
}
void draw() {
super.draw();
System.out.println("Circle drawn");
}
}
class Triangle extends Shape{
void area(double h, double b) {
super.area();
System.out.println("Area of triangle: "+(h*b)/2);
}
void draw() {
super.draw();
System.out.println("Triangle drawn");
}
}
class Square extends Shape{
void area(double a) {
super.area();
System.out.println("Area of square: "+a*a);
}
void draw() {
super.draw();
System.out.println("Square drawn");
}
}
public class Program_4_shape {
public static void main(String[] args) {
// TODO Auto-generated method stub
Circle c = new Circle();
c.area(23.05);
c.draw();
Triangle t = new Triangle();
t.area(15, 9);
t.draw();
Square s = new Square();
s.area(5);
s.draw();
}
}
| UTF-8 | Java | 1,047 | java | Program_4_shape.java | Java | [] | null | [] | package Session;
class Shape{
void area() {
System.out.println("\nCalculating area:");
}
void draw() {
System.out.println("Drawing shape:");
}
}
class Circle extends Shape{
void area(double r) {
super.area();
System.out.println("Area of circle: "+(3.14*r*r));
}
void draw() {
super.draw();
System.out.println("Circle drawn");
}
}
class Triangle extends Shape{
void area(double h, double b) {
super.area();
System.out.println("Area of triangle: "+(h*b)/2);
}
void draw() {
super.draw();
System.out.println("Triangle drawn");
}
}
class Square extends Shape{
void area(double a) {
super.area();
System.out.println("Area of square: "+a*a);
}
void draw() {
super.draw();
System.out.println("Square drawn");
}
}
public class Program_4_shape {
public static void main(String[] args) {
// TODO Auto-generated method stub
Circle c = new Circle();
c.area(23.05);
c.draw();
Triangle t = new Triangle();
t.area(15, 9);
t.draw();
Square s = new Square();
s.area(5);
s.draw();
}
}
| 1,047 | 0.621777 | 0.60936 | 63 | 15.619047 | 14.851037 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.52381 | false | false | 2 |
946ff4140725763eafd6743aa86b7d3cf872ecde | 18,554,258,751,473 | 0b9e96d0969c1dbfbe16fc33cd24a39c762949b1 | /src/main/java/com/wiatec/boblive/service/voucher/VoucherAdminService.java | 386cb98d33ca973b07774ce2f68f663fd69cf345 | [] | no_license | xcpxcp198608/web_boblive | https://github.com/xcpxcp198608/web_boblive | aba4c7078863350aa3acd4b945b4ecb1dbc5e717 | a697171d049a766f1c9446b61ece1367a40b8601 | refs/heads/master | 2019-05-18T04:28:50.034000 | 2017-12-05T09:10:19 | 2017-12-05T09:10:19 | 95,432,087 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wiatec.boblive.service.voucher;
import com.wiatec.boblive.common.result.EnumResult;
import com.wiatec.boblive.common.result.ResultInfo;
import com.wiatec.boblive.common.result.ResultMaster;
import com.wiatec.boblive.orm.dao.voucher.VoucherAdminDao;
import com.wiatec.boblive.orm.pojo.voucher.VoucherAdminInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class VoucherAdminService {
private Logger logger = LoggerFactory.getLogger(VoucherAdminService.class);
@Resource
private VoucherAdminDao voucherAdminDao;
public ResultInfo signIn(VoucherAdminInfo voucherAdminInfo){
try {
int permission = voucherAdminDao.selectPermission(voucherAdminInfo);
if(permission <= 0){
return ResultMaster.error(EnumResult.ERROR_USERNAME_PASSWORD_NO_MATCH);
}
return ResultMaster.success();
}catch (Exception e){
logger.debug(e.getMessage());
return ResultMaster.error(EnumResult.ERROR_USERNAME_PASSWORD_NO_MATCH);
}
}
}
| UTF-8 | Java | 1,161 | java | VoucherAdminService.java | Java | [] | null | [] | package com.wiatec.boblive.service.voucher;
import com.wiatec.boblive.common.result.EnumResult;
import com.wiatec.boblive.common.result.ResultInfo;
import com.wiatec.boblive.common.result.ResultMaster;
import com.wiatec.boblive.orm.dao.voucher.VoucherAdminDao;
import com.wiatec.boblive.orm.pojo.voucher.VoucherAdminInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class VoucherAdminService {
private Logger logger = LoggerFactory.getLogger(VoucherAdminService.class);
@Resource
private VoucherAdminDao voucherAdminDao;
public ResultInfo signIn(VoucherAdminInfo voucherAdminInfo){
try {
int permission = voucherAdminDao.selectPermission(voucherAdminInfo);
if(permission <= 0){
return ResultMaster.error(EnumResult.ERROR_USERNAME_PASSWORD_NO_MATCH);
}
return ResultMaster.success();
}catch (Exception e){
logger.debug(e.getMessage());
return ResultMaster.error(EnumResult.ERROR_USERNAME_PASSWORD_NO_MATCH);
}
}
}
| 1,161 | 0.732989 | 0.730405 | 34 | 33.14706 | 26.835154 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
97d20c44f30a5bc9e0cdeb4aa9fe89b0eb5489a4 | 7,387,343,796,163 | 49aeea395141d394683bb1474a0a969c29a881b6 | /question-course/src/main/java/com/chris/question/course/controller/CourseTypeController.java | c341d924bc92eab915b9ebbf9340e7415c9de059 | [
"Apache-2.0"
] | permissive | lg0125/QuestionWeb | https://github.com/lg0125/QuestionWeb | 7cd3931b454ed22609e38b054c766d132cc0e6d2 | 874ef3b5bbc3752b15b84fb9f1c0c6390113edd7 | refs/heads/main | 2023-04-01T16:00:14.546000 | 2021-04-11T11:34:44 | 2021-04-11T11:34:44 | 326,203,928 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chris.question.course.controller;
import com.chris.question.course.pojo.CourseType;
import com.chris.question.course.service.CourseTypeService;
import com.chris.question.common.utils.R;
import com.chris.question.course.vo.Option;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
@CrossOrigin
@RestController
@RequestMapping("courseType/service")
public class CourseTypeController {
@Autowired
private CourseTypeService courseTypeService;
@PostMapping("/insertion")
public R insertCourseType(@RequestBody CourseType courseType){
courseTypeService.insertCourseType(courseType);
return R.ok();
}
@DeleteMapping("/deleting/{courseTypeId}")
public R deleteCourseType(@PathVariable String courseTypeId){
courseTypeService.deleteCourseType(courseTypeId);
return R.ok();
}
@PutMapping("/updating")
public R updateCourseType(@RequestBody CourseType courseType){
courseTypeService.updateCourseType(courseType);
return R.ok();
}
@GetMapping("/getting/{courseTypeId}")
public R getCourseType(@PathVariable String courseTypeId){
return R.ok().put("courseType",courseTypeService.getCourseType(courseTypeId));
}
//TODO
@GetMapping("/list")
public R getCourseTypeList(){
List<CourseType> majorList = courseTypeService.getCourseTypeList();
List<Option> majorOptions = majorList.stream()
.map(major -> {
Option option = new Option();
option.setLabel(major.getName());
option.setValue(Long.parseLong(major.getId()));
return option;
}).collect(Collectors.toList());
return R.ok().put("majorOptions",majorOptions);
}
}
| UTF-8 | Java | 1,907 | java | CourseTypeController.java | Java | [] | null | [] | package com.chris.question.course.controller;
import com.chris.question.course.pojo.CourseType;
import com.chris.question.course.service.CourseTypeService;
import com.chris.question.common.utils.R;
import com.chris.question.course.vo.Option;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
@CrossOrigin
@RestController
@RequestMapping("courseType/service")
public class CourseTypeController {
@Autowired
private CourseTypeService courseTypeService;
@PostMapping("/insertion")
public R insertCourseType(@RequestBody CourseType courseType){
courseTypeService.insertCourseType(courseType);
return R.ok();
}
@DeleteMapping("/deleting/{courseTypeId}")
public R deleteCourseType(@PathVariable String courseTypeId){
courseTypeService.deleteCourseType(courseTypeId);
return R.ok();
}
@PutMapping("/updating")
public R updateCourseType(@RequestBody CourseType courseType){
courseTypeService.updateCourseType(courseType);
return R.ok();
}
@GetMapping("/getting/{courseTypeId}")
public R getCourseType(@PathVariable String courseTypeId){
return R.ok().put("courseType",courseTypeService.getCourseType(courseTypeId));
}
//TODO
@GetMapping("/list")
public R getCourseTypeList(){
List<CourseType> majorList = courseTypeService.getCourseTypeList();
List<Option> majorOptions = majorList.stream()
.map(major -> {
Option option = new Option();
option.setLabel(major.getName());
option.setValue(Long.parseLong(major.getId()));
return option;
}).collect(Collectors.toList());
return R.ok().put("majorOptions",majorOptions);
}
}
| 1,907 | 0.690089 | 0.690089 | 58 | 31.879311 | 24.20393 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.448276 | false | false | 2 |
cca175854c92857e813a2011072294c3d2fc3dd6 | 7,387,343,797,132 | 711d3722aa138e204a9ede376d7643dc6295d932 | /EmergingStartups Project/EmergingStartups/src/main/java/com/aastha/myapp/controller/UserValidator.java | ea5fe01f33b7c44d6bdf00a28c0b98d448682173 | [] | no_license | aasthagrover/Projects | https://github.com/aasthagrover/Projects | 423a5306a11c20113aca1238f80ddcc936127457 | 5ac75f6bf34be844b63b6052607de1644787c366 | refs/heads/master | 2021-01-01T04:51:42.606000 | 2017-06-14T14:46:36 | 2017-06-14T14:46:36 | 57,855,476 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aastha.myapp.controller;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import com.aastha.myapp.pojo.User;
import org.springframework.validation.ValidationUtils;
@Component
public class UserValidator implements Validator{
@Override
public boolean supports(Class aClass) {
return aClass.equals(User.class);
}
public void validate(Object obj, Errors errors)
{
User user = (User) obj;
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstName", "error.invalid.firstName", "First Name Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastName", "error.invalid.lastName", "Last Name Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "error.invalid.username", "User Name Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "error.invalid.password", "Password Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "gender", "error.invalid.gender", "Gender Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "roleType", "error.invalid.roleType", "Role Type Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email.emailId", "error.invalid.email.emailId", "Email Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "location.locationname", "error.invalid.location.locationname", "Location Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "category.categoryName", "error.invalid.categoryName.categoryName", "Category Required");
}
}
| UTF-8 | Java | 1,665 | java | UserValidator.java | Java | [
{
"context": "ls.rejectIfEmptyOrWhitespace(errors, \"password\", \"error.invalid.password\", \"Password Required\");\n ValidationUtils.r",
"end": 975,
"score": 0.9831033945083618,
"start": 953,
"tag": "PASSWORD",
"value": "error.invalid.password"
},
{
"context": "s, \"password... | null | [] | package com.aastha.myapp.controller;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import com.aastha.myapp.pojo.User;
import org.springframework.validation.ValidationUtils;
@Component
public class UserValidator implements Validator{
@Override
public boolean supports(Class aClass) {
return aClass.equals(User.class);
}
public void validate(Object obj, Errors errors)
{
User user = (User) obj;
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstName", "error.invalid.firstName", "First Name Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastName", "error.invalid.lastName", "Last Name Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "error.invalid.username", "User Name Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "<PASSWORD>", "Password <PASSWORD>");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "gender", "error.invalid.gender", "Gender Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "roleType", "error.invalid.roleType", "Role Type Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email.emailId", "error.invalid.email.emailId", "Email Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "location.locationname", "error.invalid.location.locationname", "Location Required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "category.categoryName", "error.invalid.categoryName.categoryName", "Category Required");
}
}
| 1,655 | 0.763363 | 0.763363 | 35 | 46.57143 | 49.269108 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.485714 | false | false | 2 |
db17b85495ae4266bcc698bcf2cda0c1221a1a0b | 16,630,113,397,785 | 44e4437f0504cf16079f10083f533de5a9e7d2c5 | /app/src/main/java/com/example/freesbet/Redbull.java | fca3c16a9974877e79cdcf4d07b99e62cbd47060 | [] | no_license | rulogas/FreesBet | https://github.com/rulogas/FreesBet | 7b2e5ab363aa2ff78e1c87fe1baf929e129bf780 | a4f914dbff4742f55b1b80ac81f84ca8f5cc9e2e | refs/heads/master | 2020-05-05T10:21:21.037000 | 2019-05-25T15:15:21 | 2019-05-25T15:15:21 | 179,940,493 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.freesbet;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableString;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.example.freesbet.bases.BaseActivity;
import com.example.freesbet.bases.CustomAdpaterSpinner;
import com.example.freesbet.bases.EventoLista;
import com.example.freesbet.bases.RVAdapter;
import com.example.freesbet.widgets.CheckLogout;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.ListenerRegistration;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
public class Redbull extends BaseActivity
implements NavigationView.OnNavigationItemSelectedListener {
NavigationView navigationView;
View headerView;
CircleImageView circleImageViewUsuarioMenu;
TextView textViewNivelUsuarioHeaderMenu;
@BindView(R.id.spinner_redbull)
Spinner mSpinerPaises;
private String [] mNombresSpinner;
private String [] mUrlsImagenesSpinner;
CustomAdpaterSpinner adpaterSpinner;
@BindView(R.id.recyclerView_eventos_redbull)
RecyclerView rv;
ProgressDialog progressDialog;
private List<EventoLista> eventos = new ArrayList<>();
RVAdapter adapter;
@BindView(R.id.textView_noHayEventos)
TextView textViewNohayEventos;
//Firestore
FirebaseFirestore db;
ListenerRegistration registration;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_redbull);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(getResources().getText(R.string.title_activity_redbull));
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
Menu menu = navigationView.getMenu();
MenuItem ligas= menu.findItem(R.id.ligas);
SpannableString stringLigas = new SpannableString(ligas.getTitle());
stringLigas.setSpan(new TextAppearanceSpan(this, R.style.ColorOpcionesMenu), 0, stringLigas.length(), 0);
ligas.setTitle(stringLigas);
MenuItem competiciones= menu.findItem(R.id.competiciones);
SpannableString stringCompeticiones = new SpannableString(competiciones.getTitle());
stringCompeticiones.setSpan(new TextAppearanceSpan(this, R.style.ColorOpcionesMenu), 0, stringCompeticiones.length(), 0);
competiciones.setTitle(stringCompeticiones);
navigationView.setNavigationItemSelectedListener(this);
cargarInfoUsuarioMenu();
circleImageViewUsuarioMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
irPerfil();
}
});
inicializarSpinner();
db = FirebaseFirestore.getInstance();
initializeRecyclerView();
mSpinerPaises.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (registration != null){
registration.remove();
}
getEventos(mNombresSpinner[position]);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
for(int i = 0; i < menu.size(); i++){
Drawable drawable = menu.getItem(i).getIcon();
if(drawable != null) {
drawable.mutate();
drawable.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
}
}
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
/*if (id == R.id.action_settings) {
return true;
}*/
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
// Handle navigation view item clicks here.
int id=item.getItemId();
switch (id){
case R.id.opcion_todos:
Intent intent1= new Intent(Redbull.this,Home.class);
startActivity(intent1);
finish();
break;
case R.id.opcion_menu_fms:
Intent intent2= new Intent(Redbull.this,Fms.class);
startActivity(intent2);
finish();
break;
case R.id.opcion_menu_redbull:
drawer.closeDrawer(GravityCompat.START);
break;
case R.id.opcion_menu_bdm:
Intent intent4= new Intent(Redbull.this,Bdm.class);
startActivity(intent4);
finish();
break;
case R.id.opcion_supremaciamc:
Intent intent5= new Intent(Redbull.this,Supremacia.class);
startActivity(intent5);
finish();
break;
case R.id.opcion_ivita_amigos:
Intent intent6= new Intent(Redbull.this,Invita.class);
startActivity(intent6);
finish();
break;
case R.id.opcion_ajustes_cuenta:
Intent intent7= new Intent(Redbull.this,Ajustes.class);
startActivity(intent7);
finish();
break;
case R.id.opcion_logout:
CheckLogout dialogFragment = new CheckLogout();
FragmentManager fragmentManager = getSupportFragmentManager();
dialogFragment.show(fragmentManager,"checkLogout");
break;
case R.id.opcion_premios:
Intent intent8= new Intent(Redbull.this,Premios.class);
startActivity(intent8);
finish();
break;
// this is done, now let us go and intialise the home page.
// after this lets start copying the above.
// FOLLOW MEEEEE>>>
}
drawer.closeDrawer(GravityCompat.START);
return true;
}
private void inicializarSpinner(){
mNombresSpinner = new String[]{"Todos","España", "Argentina", "Mexico", "Chile"};
mUrlsImagenesSpinner = new String[]{"https://www.materialui.co/materialIcons/places/all_inclusive_white_192x192.png",
"http://flags.fmcdn.net/data/flags/w580/es.png",
"https://cdn.pixabay.com/photo/2013/07/13/14/14/argentina-162229_960_720.png",
"http://flags.fmcdn.net/data/flags/w580/mx.png",
"http://flags.fmcdn.net/data/flags/w580/cl.png"};
adpaterSpinner = new CustomAdpaterSpinner(this,mNombresSpinner,mUrlsImagenesSpinner);
mSpinerPaises.setAdapter(adpaterSpinner);
}
private void initializeRecyclerView() {
LinearLayoutManager llm = new LinearLayoutManager(Redbull.this);
rv.setLayoutManager(llm);
}
private void getEventos(String filtroZona) {
//Query
Query query = null;
if (filtroZona.equalsIgnoreCase("todos")){
query = db.collection("eventos")
.whereEqualTo("finalizado", false)
.whereEqualTo("evento","Red Bull")
.orderBy("fecha", Query.Direction.ASCENDING);
}else{
query = db.collection("eventos")
.whereEqualTo("finalizado", false)
.whereEqualTo("evento","Red Bull")
.whereEqualTo("zona","Red Bull - "+filtroZona)
.orderBy("fecha", Query.Direction.ASCENDING);
}
registration =query.addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@Nullable QuerySnapshot value,
@Nullable FirebaseFirestoreException e) {
if (e != null) {
Log.w("Listener EventoLista", "Listen failed.", e);
return;
}
if (value != null && !value.isEmpty()){
textViewNohayEventos.setVisibility(View.GONE);
rv.setVisibility(View.VISIBLE);
eventos.clear();
for (QueryDocumentSnapshot document : value) {
Log.d("EventoLista", document.getId() + " => " + document.getData());
Map<String, Object> eventoListaDb = document.getData();
/*List<Map<String,Object>> listaApuestasDb = (List<Map<String,Object>>)eventoListaDb.get("apuestas") ;
int numeroJugadoresDb = listaApuestasDb.size();*/
String pattern = "dd-MM-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String fecha = simpleDateFormat.format((Date) eventoListaDb.get("fecha"));
EventoLista eventoLista = new EventoLista(document.getId(),(String)eventoListaDb.get("nombre"),
(String)eventoListaDb.get("zona"),
(String)eventoListaDb.get("urlImagen"),
fecha,
((Long)eventoListaDb.get("numeroApuestas")).intValue());
eventos.add(eventoLista);
}
adapter = new RVAdapter(eventos, Redbull.this);
rv.setAdapter(adapter);
Log.d("Listener EventoLista", "Eventos actuales en: " + eventos);
}
else{
textViewNohayEventos.setVisibility(View.VISIBLE);
rv.setVisibility(View.GONE);
}
}
});
}
private void cargarInfoUsuarioMenu(){
headerView = navigationView.getHeaderView(0);
TextView textViewNombreUsuarioHeaderMenu = headerView.findViewById(R.id.textView_nombreUsuario_headerMenu);
textViewNombreUsuarioHeaderMenu.setText(nombreUsuario);
circleImageViewUsuarioMenu = headerView.findViewById(R.id.circleview_header_perfil_usuario);
Glide.with(getApplicationContext()).load(photoUrlUsuario).into(circleImageViewUsuarioMenu);
textViewNivelUsuarioHeaderMenu = headerView.findViewById(R.id.textView_NivelUsuario_headerMenu);
// cargarNivel
db = FirebaseFirestore.getInstance();
DocumentReference docRef = db.collection("usuarios").document(idUsuario);
docRef.addSnapshotListener(new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@javax.annotation.Nullable DocumentSnapshot documentSnapshot, @javax.annotation.Nullable FirebaseFirestoreException e) {
if (documentSnapshot.exists()) {
Log.d("Usuario", "DocumentSnapshot data: " + documentSnapshot.getData());
Map<String, Object> user = documentSnapshot.getData();
int nivel =((Long) user.get("nivel")).intValue();
textViewNivelUsuarioHeaderMenu.setText("Nivel "+Integer.toString(nivel));
} else {
Log.d("Usuario", "No such document");
}
}
});
}
private void irPerfil(){
startActivity(Redbull.this,Ajustes.class);
finish();
}
}
| UTF-8 | Java | 14,296 | java | Redbull.java | Java | [] | null | [] | package com.example.freesbet;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableString;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.example.freesbet.bases.BaseActivity;
import com.example.freesbet.bases.CustomAdpaterSpinner;
import com.example.freesbet.bases.EventoLista;
import com.example.freesbet.bases.RVAdapter;
import com.example.freesbet.widgets.CheckLogout;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.ListenerRegistration;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
public class Redbull extends BaseActivity
implements NavigationView.OnNavigationItemSelectedListener {
NavigationView navigationView;
View headerView;
CircleImageView circleImageViewUsuarioMenu;
TextView textViewNivelUsuarioHeaderMenu;
@BindView(R.id.spinner_redbull)
Spinner mSpinerPaises;
private String [] mNombresSpinner;
private String [] mUrlsImagenesSpinner;
CustomAdpaterSpinner adpaterSpinner;
@BindView(R.id.recyclerView_eventos_redbull)
RecyclerView rv;
ProgressDialog progressDialog;
private List<EventoLista> eventos = new ArrayList<>();
RVAdapter adapter;
@BindView(R.id.textView_noHayEventos)
TextView textViewNohayEventos;
//Firestore
FirebaseFirestore db;
ListenerRegistration registration;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_redbull);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(getResources().getText(R.string.title_activity_redbull));
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view);
Menu menu = navigationView.getMenu();
MenuItem ligas= menu.findItem(R.id.ligas);
SpannableString stringLigas = new SpannableString(ligas.getTitle());
stringLigas.setSpan(new TextAppearanceSpan(this, R.style.ColorOpcionesMenu), 0, stringLigas.length(), 0);
ligas.setTitle(stringLigas);
MenuItem competiciones= menu.findItem(R.id.competiciones);
SpannableString stringCompeticiones = new SpannableString(competiciones.getTitle());
stringCompeticiones.setSpan(new TextAppearanceSpan(this, R.style.ColorOpcionesMenu), 0, stringCompeticiones.length(), 0);
competiciones.setTitle(stringCompeticiones);
navigationView.setNavigationItemSelectedListener(this);
cargarInfoUsuarioMenu();
circleImageViewUsuarioMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
irPerfil();
}
});
inicializarSpinner();
db = FirebaseFirestore.getInstance();
initializeRecyclerView();
mSpinerPaises.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (registration != null){
registration.remove();
}
getEventos(mNombresSpinner[position]);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
for(int i = 0; i < menu.size(); i++){
Drawable drawable = menu.getItem(i).getIcon();
if(drawable != null) {
drawable.mutate();
drawable.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
}
}
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
/*if (id == R.id.action_settings) {
return true;
}*/
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
// Handle navigation view item clicks here.
int id=item.getItemId();
switch (id){
case R.id.opcion_todos:
Intent intent1= new Intent(Redbull.this,Home.class);
startActivity(intent1);
finish();
break;
case R.id.opcion_menu_fms:
Intent intent2= new Intent(Redbull.this,Fms.class);
startActivity(intent2);
finish();
break;
case R.id.opcion_menu_redbull:
drawer.closeDrawer(GravityCompat.START);
break;
case R.id.opcion_menu_bdm:
Intent intent4= new Intent(Redbull.this,Bdm.class);
startActivity(intent4);
finish();
break;
case R.id.opcion_supremaciamc:
Intent intent5= new Intent(Redbull.this,Supremacia.class);
startActivity(intent5);
finish();
break;
case R.id.opcion_ivita_amigos:
Intent intent6= new Intent(Redbull.this,Invita.class);
startActivity(intent6);
finish();
break;
case R.id.opcion_ajustes_cuenta:
Intent intent7= new Intent(Redbull.this,Ajustes.class);
startActivity(intent7);
finish();
break;
case R.id.opcion_logout:
CheckLogout dialogFragment = new CheckLogout();
FragmentManager fragmentManager = getSupportFragmentManager();
dialogFragment.show(fragmentManager,"checkLogout");
break;
case R.id.opcion_premios:
Intent intent8= new Intent(Redbull.this,Premios.class);
startActivity(intent8);
finish();
break;
// this is done, now let us go and intialise the home page.
// after this lets start copying the above.
// FOLLOW MEEEEE>>>
}
drawer.closeDrawer(GravityCompat.START);
return true;
}
private void inicializarSpinner(){
mNombresSpinner = new String[]{"Todos","España", "Argentina", "Mexico", "Chile"};
mUrlsImagenesSpinner = new String[]{"https://www.materialui.co/materialIcons/places/all_inclusive_white_192x192.png",
"http://flags.fmcdn.net/data/flags/w580/es.png",
"https://cdn.pixabay.com/photo/2013/07/13/14/14/argentina-162229_960_720.png",
"http://flags.fmcdn.net/data/flags/w580/mx.png",
"http://flags.fmcdn.net/data/flags/w580/cl.png"};
adpaterSpinner = new CustomAdpaterSpinner(this,mNombresSpinner,mUrlsImagenesSpinner);
mSpinerPaises.setAdapter(adpaterSpinner);
}
private void initializeRecyclerView() {
LinearLayoutManager llm = new LinearLayoutManager(Redbull.this);
rv.setLayoutManager(llm);
}
private void getEventos(String filtroZona) {
//Query
Query query = null;
if (filtroZona.equalsIgnoreCase("todos")){
query = db.collection("eventos")
.whereEqualTo("finalizado", false)
.whereEqualTo("evento","Red Bull")
.orderBy("fecha", Query.Direction.ASCENDING);
}else{
query = db.collection("eventos")
.whereEqualTo("finalizado", false)
.whereEqualTo("evento","Red Bull")
.whereEqualTo("zona","Red Bull - "+filtroZona)
.orderBy("fecha", Query.Direction.ASCENDING);
}
registration =query.addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@Nullable QuerySnapshot value,
@Nullable FirebaseFirestoreException e) {
if (e != null) {
Log.w("Listener EventoLista", "Listen failed.", e);
return;
}
if (value != null && !value.isEmpty()){
textViewNohayEventos.setVisibility(View.GONE);
rv.setVisibility(View.VISIBLE);
eventos.clear();
for (QueryDocumentSnapshot document : value) {
Log.d("EventoLista", document.getId() + " => " + document.getData());
Map<String, Object> eventoListaDb = document.getData();
/*List<Map<String,Object>> listaApuestasDb = (List<Map<String,Object>>)eventoListaDb.get("apuestas") ;
int numeroJugadoresDb = listaApuestasDb.size();*/
String pattern = "dd-MM-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String fecha = simpleDateFormat.format((Date) eventoListaDb.get("fecha"));
EventoLista eventoLista = new EventoLista(document.getId(),(String)eventoListaDb.get("nombre"),
(String)eventoListaDb.get("zona"),
(String)eventoListaDb.get("urlImagen"),
fecha,
((Long)eventoListaDb.get("numeroApuestas")).intValue());
eventos.add(eventoLista);
}
adapter = new RVAdapter(eventos, Redbull.this);
rv.setAdapter(adapter);
Log.d("Listener EventoLista", "Eventos actuales en: " + eventos);
}
else{
textViewNohayEventos.setVisibility(View.VISIBLE);
rv.setVisibility(View.GONE);
}
}
});
}
private void cargarInfoUsuarioMenu(){
headerView = navigationView.getHeaderView(0);
TextView textViewNombreUsuarioHeaderMenu = headerView.findViewById(R.id.textView_nombreUsuario_headerMenu);
textViewNombreUsuarioHeaderMenu.setText(nombreUsuario);
circleImageViewUsuarioMenu = headerView.findViewById(R.id.circleview_header_perfil_usuario);
Glide.with(getApplicationContext()).load(photoUrlUsuario).into(circleImageViewUsuarioMenu);
textViewNivelUsuarioHeaderMenu = headerView.findViewById(R.id.textView_NivelUsuario_headerMenu);
// cargarNivel
db = FirebaseFirestore.getInstance();
DocumentReference docRef = db.collection("usuarios").document(idUsuario);
docRef.addSnapshotListener(new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@javax.annotation.Nullable DocumentSnapshot documentSnapshot, @javax.annotation.Nullable FirebaseFirestoreException e) {
if (documentSnapshot.exists()) {
Log.d("Usuario", "DocumentSnapshot data: " + documentSnapshot.getData());
Map<String, Object> user = documentSnapshot.getData();
int nivel =((Long) user.get("nivel")).intValue();
textViewNivelUsuarioHeaderMenu.setText("Nivel "+Integer.toString(nivel));
} else {
Log.d("Usuario", "No such document");
}
}
});
}
private void irPerfil(){
startActivity(Redbull.this,Ajustes.class);
finish();
}
}
| 14,296 | 0.6312 | 0.626513 | 361 | 38.598339 | 28.841854 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714681 | false | false | 2 |
4bf7c2374fc51903f341c18b9f62e019d239316c | 8,169,027,812,943 | 166c5f0bea755b702806a16e6035939e67bc9392 | /exercise_one/src/TotalOrderInterfaceRMI.java | 24e964457ea8a84bd7af09a4521494d5ba9f87f7 | [] | no_license | xjmxmt/da_exercises | https://github.com/xjmxmt/da_exercises | 3a650b17e58dd98582c15561c74b357fd64d7d00 | c4f8612301bd5f3d6d8b4206b127f775c476d249 | refs/heads/main | 2023-01-31T18:13:54.497000 | 2020-12-16T13:52:04 | 2020-12-16T13:52:04 | 313,434,947 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.TreeMap;
import java.util.Queue;
public interface TotalOrderInterfaceRMI extends Remote {
public void setId(int i) throws RemoteException;
public int getId() throws RemoteException;
public void setName(int i) throws RemoteException;
public String getName() throws RemoteException;
public void setProcessList(TotalOrder[] registryList) throws RemoteException;
public TotalOrder[] getProcessList() throws RemoteException;
public void setAck(Message msg) throws RemoteException;
public TreeMap<ScalarClock, Integer> getAckMap() throws RemoteException;
public Queue<Message> getReceivedMsg() throws RemoteException;
public String getReceivedOrderedMsg() throws RemoteException;
public String getDeliveredMsg() throws RemoteException;
public Message broadcast(String s) throws RemoteException;
public void checkWaitList(Message msg) throws RemoteException;
public void receive(Message msg) throws RemoteException;
public void deliver(Message msg) throws RemoteException;
}
| UTF-8 | Java | 1,103 | java | TotalOrderInterfaceRMI.java | Java | [] | null | [] | import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.TreeMap;
import java.util.Queue;
public interface TotalOrderInterfaceRMI extends Remote {
public void setId(int i) throws RemoteException;
public int getId() throws RemoteException;
public void setName(int i) throws RemoteException;
public String getName() throws RemoteException;
public void setProcessList(TotalOrder[] registryList) throws RemoteException;
public TotalOrder[] getProcessList() throws RemoteException;
public void setAck(Message msg) throws RemoteException;
public TreeMap<ScalarClock, Integer> getAckMap() throws RemoteException;
public Queue<Message> getReceivedMsg() throws RemoteException;
public String getReceivedOrderedMsg() throws RemoteException;
public String getDeliveredMsg() throws RemoteException;
public Message broadcast(String s) throws RemoteException;
public void checkWaitList(Message msg) throws RemoteException;
public void receive(Message msg) throws RemoteException;
public void deliver(Message msg) throws RemoteException;
}
| 1,103 | 0.793291 | 0.793291 | 22 | 49.136364 | 21.784681 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909091 | false | false | 2 |
86aaa65f7bf1622535ce036a670bf65022c547c9 | 15,401,752,735,959 | 1000358d005a2f1913099e02c09e939a0f967140 | /app/src/main/java/com/cardenas/adan/mascotas/view/fragment/impl/MascotaFragmentRecyclerview.java | 36f7308a6bea0273d0cf566343f205212b809709 | [] | no_license | adanCardenas/Mascotas | https://github.com/adanCardenas/Mascotas | 9de82938817ac42688d70960e4d8743d80a97ac4 | b38169ffed91f901d704d994f1589c60a2d600cb | refs/heads/master | 2021-01-18T22:16:49.022000 | 2016-11-13T18:31:43 | 2016-11-13T18:31:43 | 72,403,319 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cardenas.adan.mascotas.view.fragment.impl;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.cardenas.adan.mascotas.activities.MascotasFavoritas;
import com.cardenas.adan.mascotas.R;
import com.cardenas.adan.mascotas.adapter.MascotaAdapter;
import com.cardenas.adan.mascotas.model.Mascota;
import com.cardenas.adan.mascotas.presenter.fragment.IMascotaFragmentRecyclerViewPresenter;
import com.cardenas.adan.mascotas.presenter.fragment.impl.MascotaFragmentRecyclerViewPresenter;
import com.cardenas.adan.mascotas.view.fragment.IMascotaFragmentRecyclerView;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class MascotaFragmentRecyclerview extends Fragment implements IMascotaFragmentRecyclerView{
private List<Mascota> mascotas;
private RecyclerView listaMascotas;
private IMascotaFragmentRecyclerViewPresenter presenter;
public MascotaFragmentRecyclerview() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_mascota,container,false);
listaMascotas = (RecyclerView) view.findViewById(R.id.Main_RecyclerView);
presenter = new MascotaFragmentRecyclerViewPresenter(this,getContext());
return view;
}
public void mascotasFavoritas(View view){
Intent intent = new Intent(getActivity(),MascotasFavoritas.class);
startActivity(intent);
}
@Override
public void generarLinearLayout(int orientacion) {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(orientacion);
listaMascotas.setLayoutManager(linearLayoutManager);
}
@Override
public void generarGridLayout(int numeroGrids) {
}
@Override
public MascotaAdapter crearAdaptador(List<Mascota> mascotas) {
MascotaAdapter adapter = new MascotaAdapter(mascotas,getActivity(),getContext());
return adapter;
}
@Override
public void inicializarAdaptadorReciclerView(MascotaAdapter adaptador) {
listaMascotas.setAdapter(adaptador);
}
}
| UTF-8 | Java | 2,444 | java | MascotaFragmentRecyclerview.java | Java | [] | null | [] | package com.cardenas.adan.mascotas.view.fragment.impl;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.cardenas.adan.mascotas.activities.MascotasFavoritas;
import com.cardenas.adan.mascotas.R;
import com.cardenas.adan.mascotas.adapter.MascotaAdapter;
import com.cardenas.adan.mascotas.model.Mascota;
import com.cardenas.adan.mascotas.presenter.fragment.IMascotaFragmentRecyclerViewPresenter;
import com.cardenas.adan.mascotas.presenter.fragment.impl.MascotaFragmentRecyclerViewPresenter;
import com.cardenas.adan.mascotas.view.fragment.IMascotaFragmentRecyclerView;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class MascotaFragmentRecyclerview extends Fragment implements IMascotaFragmentRecyclerView{
private List<Mascota> mascotas;
private RecyclerView listaMascotas;
private IMascotaFragmentRecyclerViewPresenter presenter;
public MascotaFragmentRecyclerview() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_mascota,container,false);
listaMascotas = (RecyclerView) view.findViewById(R.id.Main_RecyclerView);
presenter = new MascotaFragmentRecyclerViewPresenter(this,getContext());
return view;
}
public void mascotasFavoritas(View view){
Intent intent = new Intent(getActivity(),MascotasFavoritas.class);
startActivity(intent);
}
@Override
public void generarLinearLayout(int orientacion) {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(orientacion);
listaMascotas.setLayoutManager(linearLayoutManager);
}
@Override
public void generarGridLayout(int numeroGrids) {
}
@Override
public MascotaAdapter crearAdaptador(List<Mascota> mascotas) {
MascotaAdapter adapter = new MascotaAdapter(mascotas,getActivity(),getContext());
return adapter;
}
@Override
public void inicializarAdaptadorReciclerView(MascotaAdapter adaptador) {
listaMascotas.setAdapter(adaptador);
}
}
| 2,444 | 0.772504 | 0.771277 | 77 | 30.740259 | 31.245739 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.519481 | false | false | 2 |
751b8ab1b1ca33cefd80c9869dee40bb99078b27 | 2,602,750,188,577 | 595a46e1ed98c7053fe60f6098bbbfcd718d1295 | /app/src/main/java/blackcap/nationalescape/Uitility/LoginCheck.java | 2ebdfd44013c101c374979889c3c19d9de4cd0e1 | [] | no_license | parkHG1234/NationalEscape | https://github.com/parkHG1234/NationalEscape | d2444078fead85c90d3ac9b464f6e5f9c31db095 | 3458af8466fdb7a13b36d7d35e76eb949a830b4c | refs/heads/master | 2021-07-30T10:51:06.163000 | 2021-07-29T01:16:33 | 2021-07-29T01:16:33 | 184,858,575 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package blackcap.nationalescape.Uitility;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
/**
* Created by 박효근 on 2018-02-12.
*/
public class LoginCheck extends AppCompatActivity {
SharedPreferences preferences; //캐쉬 데이터 생성
public String LoginPk(){
preferences = getSharedPreferences("blahblah", MODE_PRIVATE);
String Pk = preferences.getString("Pk", ".");
return Pk;
}
}
| UTF-8 | Java | 476 | java | LoginCheck.java | Java | [
{
"context": "ppcompat.app.AppCompatActivity;\n\n/**\n * Created by 박효근 on 2018-02-12.\n */\n\npublic class LoginCheck exten",
"end": 156,
"score": 0.9997881054878235,
"start": 153,
"tag": "NAME",
"value": "박효근"
}
] | null | [] | package blackcap.nationalescape.Uitility;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
/**
* Created by 박효근 on 2018-02-12.
*/
public class LoginCheck extends AppCompatActivity {
SharedPreferences preferences; //캐쉬 데이터 생성
public String LoginPk(){
preferences = getSharedPreferences("blahblah", MODE_PRIVATE);
String Pk = preferences.getString("Pk", ".");
return Pk;
}
}
| 476 | 0.714912 | 0.697368 | 17 | 25.82353 | 22.742123 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false | 2 |
10aff364f6dbd861fa696468af6174e3e56fd933 | 32,031,866,104,273 | ae91bafe3976f622a704a622c16c50c646634679 | /src/main/java/com/start/ChromeDriverManager.java | 6eb656bb6551620bfe19f1f9080996dfeefb2d6a | [] | no_license | thermiknator/AutomationProject | https://github.com/thermiknator/AutomationProject | 8edf1cf5f6da8e449dd5bfa131ddeef59f84fa1a | 599ea7df269582a942ff1261320120e65f26ba65 | refs/heads/master | 2023-05-14T22:25:49.617000 | 2020-04-16T16:27:13 | 2020-04-16T16:27:13 | 249,221,859 | 0 | 0 | null | false | 2023-05-09T18:45:43 | 2020-03-22T16:14:48 | 2020-04-16T16:27:51 | 2023-05-09T18:45:40 | 14,605 | 0 | 0 | 1 | Java | false | false | package com.start;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.io.File;
public class ChromeDriverManager extends DriverManager {
private ChromeDriverService chService;
@Override
public void startService() {
String pathname = getPathName();
if (null == chService) {
try {
chService = new ChromeDriverService.Builder()
.usingDriverExecutable(new File(pathname))
.usingAnyFreePort()
.build();
chService.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void stopService() {
if (null != chService && chService.isRunning())
chService.stop();
}
@Override
public void createDriver() {
// DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
// capabilities.setCapability(ChromeOptions.CAPABILITY, options);
// driver = new ChromeDriver(chService, capabilities);
driver = new ChromeDriver(chService, options);
}
private String getPathName(){
String chromedriverPath = "src/main/resources/Drivers/chromedriver";
if(System.getProperty("os.name").toLowerCase().contains("win")) {
chromedriverPath += ".exe";
}
return chromedriverPath;
}
}
| UTF-8 | Java | 1,668 | java | ChromeDriverManager.java | Java | [] | null | [] | package com.start;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.io.File;
public class ChromeDriverManager extends DriverManager {
private ChromeDriverService chService;
@Override
public void startService() {
String pathname = getPathName();
if (null == chService) {
try {
chService = new ChromeDriverService.Builder()
.usingDriverExecutable(new File(pathname))
.usingAnyFreePort()
.build();
chService.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void stopService() {
if (null != chService && chService.isRunning())
chService.stop();
}
@Override
public void createDriver() {
// DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
// capabilities.setCapability(ChromeOptions.CAPABILITY, options);
// driver = new ChromeDriver(chService, capabilities);
driver = new ChromeDriver(chService, options);
}
private String getPathName(){
String chromedriverPath = "src/main/resources/Drivers/chromedriver";
if(System.getProperty("os.name").toLowerCase().contains("win")) {
chromedriverPath += ".exe";
}
return chromedriverPath;
}
}
| 1,668 | 0.620504 | 0.620504 | 54 | 29.888889 | 23.432856 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 2 |
589bab066562974a998e604e044d1332e7515c14 | 10,118,942,973,578 | 965d09919e697365bfeb5d16c16257adb89a2540 | /src/test/java/net/kumasi/storytime/test/PersonAssignmentEntityFactoryForTest.java | 26336c7ad1f9edf0934311be0dcc7e085de4856c | [] | no_license | obasola/storytime-service | https://github.com/obasola/storytime-service | 4bc2cd87bdfbda4d488da0b0d80db0b5622c6908 | 8c1b018f9de13e012243a5db471eb8773a764d93 | refs/heads/master | 2021-01-22T19:53:56.294000 | 2017-03-18T19:25:58 | 2017-03-18T19:25:58 | 85,252,317 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.kumasi.storytime.test;
import net.kumasi.storytime.model.jpa.PersonAssignmentEntity;
public class PersonAssignmentEntityFactoryForTest {
private MockValues mockValues = new MockValues();
public PersonAssignmentEntity newPersonAssignmentEntity() {
Integer personIdperson = mockValues.nextInteger();
Integer requirementIdrequirement = mockValues.nextInteger();
PersonAssignmentEntity personAssignmentEntity = new PersonAssignmentEntity();
personAssignmentEntity.setPersonIdperson(personIdperson);
personAssignmentEntity.setRequirementIdrequirement(requirementIdrequirement);
return personAssignmentEntity;
}
}
| UTF-8 | Java | 644 | java | PersonAssignmentEntityFactoryForTest.java | Java | [] | null | [] | package net.kumasi.storytime.test;
import net.kumasi.storytime.model.jpa.PersonAssignmentEntity;
public class PersonAssignmentEntityFactoryForTest {
private MockValues mockValues = new MockValues();
public PersonAssignmentEntity newPersonAssignmentEntity() {
Integer personIdperson = mockValues.nextInteger();
Integer requirementIdrequirement = mockValues.nextInteger();
PersonAssignmentEntity personAssignmentEntity = new PersonAssignmentEntity();
personAssignmentEntity.setPersonIdperson(personIdperson);
personAssignmentEntity.setRequirementIdrequirement(requirementIdrequirement);
return personAssignmentEntity;
}
}
| 644 | 0.838509 | 0.838509 | 20 | 31.200001 | 29.707911 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3 | false | false | 2 |
070bb1f02b9c949f0466b9192c8a13fdf9a4767a | 4,105,988,743,551 | fc8e6ec6c61ea6917c3767e3e6f5eab8071af503 | /vadim_davidenko/src/main/java/hw9/taxi/service/AuthorizationServiceImpl.java | b998e5beb6cbda8c647e836a2271ed14800ca018 | [] | no_license | sokhoda/proff291 | https://github.com/sokhoda/proff291 | 3b9fab20351346ff42aee9982f2c9b4bb1840c1b | ca5f640d51378c84d29706d7c194585a63b91aa7 | refs/heads/master | 2020-04-19T10:48:26.311000 | 2016-09-10T20:10:37 | 2016-09-10T20:10:37 | 67,597,607 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hw9.taxi.service;
import hw9.taxi.dao.UserDao;
import hw9.taxi.domain.User;
import hw9.taxi.exception.AuthenticationException;
import org.omg.CORBA.UserException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Locale;
/**
* Created by Вадим on 28.02.2016.
*/
@Service
@Scope("singleton")
@Transactional
public class AuthorizationServiceImpl implements AuthorizationService {
@Autowired
private UserDao userDao;
public AuthorizationServiceImpl() {
Locale.setDefault(Locale.ENGLISH);
}
public boolean register(String login, String id, String pass)
throws AuthenticationException {
if (userDao.findByLogin(login) != null) {
throw new AuthenticationException("User with such login already exists");
} else {
User newUser = new User(login, id, pass);
if (userDao.create(newUser) != null) return true;
}
return false;
}
public boolean isRegistered(String login, String pass) {
return (userDao.findByLoginAndPassword(login, pass) != null);
}
}
| UTF-8 | Java | 1,286 | java | AuthorizationServiceImpl.java | Java | [
{
"context": "onal;\n\nimport java.util.Locale;\n\n/**\n * Created by Вадим on 28.02.2016.\n */\n\n@Service\n@Scope(\"singleton\")\n",
"end": 450,
"score": 0.9997982978820801,
"start": 445,
"tag": "NAME",
"value": "Вадим"
}
] | null | [] | package hw9.taxi.service;
import hw9.taxi.dao.UserDao;
import hw9.taxi.domain.User;
import hw9.taxi.exception.AuthenticationException;
import org.omg.CORBA.UserException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Locale;
/**
* Created by Вадим on 28.02.2016.
*/
@Service
@Scope("singleton")
@Transactional
public class AuthorizationServiceImpl implements AuthorizationService {
@Autowired
private UserDao userDao;
public AuthorizationServiceImpl() {
Locale.setDefault(Locale.ENGLISH);
}
public boolean register(String login, String id, String pass)
throws AuthenticationException {
if (userDao.findByLogin(login) != null) {
throw new AuthenticationException("User with such login already exists");
} else {
User newUser = new User(login, id, pass);
if (userDao.create(newUser) != null) return true;
}
return false;
}
public boolean isRegistered(String login, String pass) {
return (userDao.findByLoginAndPassword(login, pass) != null);
}
}
| 1,286 | 0.715847 | 0.706479 | 44 | 28.113636 | 24.822292 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.522727 | false | false | 2 |
1be57dfaf82230457de9a32e5a67357b76860630 | 15,848,429,333,261 | dc04ad52acd1313a0e8a1353eedf309ec53bc1b3 | /core/src/com/tcg/light/entities/buffs/Stock.java | 424d482cd77f075d16cf6b94f33cd8cc6b8f0b1e | [] | no_license | JoseRivas1998/project-light | https://github.com/JoseRivas1998/project-light | 49b4eac53488ecd378e9757e31521ace3e06eab0 | b64bf689bab61cfa7cc8efa4efc9c4b10b32bf3e | refs/heads/master | 2020-05-17T17:22:58.792000 | 2015-04-06T08:12:41 | 2015-04-06T08:12:41 | 29,171,543 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tcg.light.entities.buffs;
import com.badlogic.gdx.math.Vector2;
public class Stock extends Buff {
public Stock(Vector2 pos) {
super("1up.png", pos, "1up");
}
}
| UTF-8 | Java | 180 | java | Stock.java | Java | [] | null | [] | package com.tcg.light.entities.buffs;
import com.badlogic.gdx.math.Vector2;
public class Stock extends Buff {
public Stock(Vector2 pos) {
super("1up.png", pos, "1up");
}
}
| 180 | 0.705556 | 0.683333 | 11 | 15.363636 | 16.460823 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 2 |
8467905be75bb88003cfdddb585fcdca2aada496 | 26,757,646,281,712 | 40b34684a7c6e59aa68ebe1049e5b4bfcaae8411 | /src/br/sys/Financeiro/CadSaida.java | 2fe700d7a816c6fe100728d0739b0381a2dd5925 | [] | no_license | betorods/SysFitness1.1 | https://github.com/betorods/SysFitness1.1 | e09d1bc9b36beca825f9c08cd6cd892c1502e38d | 5c57e7f4c3c30abffe8d1d31f1093db63337cde5 | refs/heads/master | 2021-01-19T22:04:36.273000 | 2015-06-07T17:26:23 | 2015-06-07T17:26:23 | 33,500,082 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.sys.Financeiro;
import br.sys.Bean.Saida;
import br.sys.DAO.SaidaDAO;
/**
*
* @author Alberto
*/
public class CadSaida extends javax.swing.JInternalFrame {
/**
* Creates new form saida
*/
public CadSaida() {
initComponents();
}
public void limpar(){
descricao.setText("");
valor.setText("");
matriculaDoFuncionario.setText("");
dataPagamento.setText("");
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
valor = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
matriculaDoFuncionario = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
limpar = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
Salvar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
descricao = new javax.swing.JEditorPane();
jLabel3 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
dataPagamento = new javax.swing.JFormattedTextField();
jLabel34 = new javax.swing.JLabel();
setTitle("Outras Saídas");
jLabel5.setText("Matricula do Funcionario");
matriculaDoFuncionario.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
matriculaDoFuncionarioKeyReleased(evt);
}
});
jLabel2.setText("Valor ");
jLabel4.setText("Data do Pagamento");
limpar.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\paintbrush.png")); // NOI18N
limpar.setText("Limpar");
limpar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
limparActionPerformed(evt);
}
});
jButton3.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\cancel.png")); // NOI18N
jButton3.setText("Cancelar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
Salvar.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\SysFitness1.1\\src\\br\\sys\\Imagens\\money_add.png")); // NOI18N
Salvar.setText("Salvar");
Salvar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SalvarActionPerformed(evt);
}
});
jScrollPane1.setViewportView(descricao);
jLabel3.setText("Descrição da despesa");
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\SysFitness1.1\\src\\br\\sys\\Imagens\\ícone-pagamento cópia.png")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
);
try {
dataPagamento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-##-##")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
dataPagamento.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dataPagamentoActionPerformed(evt);
}
});
jLabel34.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel34.setForeground(new java.awt.Color(153, 153, 153));
jLabel34.setText("Ex: 2012-12-31");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(Salvar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(limpar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 429, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(matriculaDoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(valor, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(33, 33, 33)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel34)
.addComponent(dataPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)))
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {Salvar, jButton3, limpar});
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(matriculaDoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dataPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel34)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(limpar)
.addComponent(Salvar))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void SalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SalvarActionPerformed
Saida saida = new Saida();
SaidaDAO saidaDAO = new SaidaDAO();
saida.setId_funcionario(Integer.parseInt(matriculaDoFuncionario.getText()));
saida.setValor(Float.parseFloat(valor.getText()));
saida.setDataSaida(dataPagamento.getText());
saida.setDescricao(descricao.getText());
saidaDAO.inserirSaida(saida);
// limparCampos();
// JOptionPane.showMessageDialog(null,"Cadastro Realizado com Sucesso.");
}//GEN-LAST:event_SalvarActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
this.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed
private void limparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limparActionPerformed
limpar();
}//GEN-LAST:event_limparActionPerformed
private void matriculaDoFuncionarioKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_matriculaDoFuncionarioKeyReleased
}//GEN-LAST:event_matriculaDoFuncionarioKeyReleased
private void dataPagamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataPagamentoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_dataPagamentoActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Salvar;
private javax.swing.JFormattedTextField dataPagamento;
private javax.swing.JEditorPane descricao;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton limpar;
private javax.swing.JTextField matriculaDoFuncionario;
private javax.swing.JTextField valor;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 13,393 | java | CadSaida.java | Java | [
{
"context": "da;\nimport br.sys.DAO.SaidaDAO;\n\n/**\n *\n * @author Alberto\n */\npublic class CadSaida extends javax.swing.JIn",
"end": 293,
"score": 0.9982268810272217,
"start": 286,
"tag": "NAME",
"value": "Alberto"
},
{
"context": "par.setIcon(new javax.swing.ImageIcon(\"C:\\\\... | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.sys.Financeiro;
import br.sys.Bean.Saida;
import br.sys.DAO.SaidaDAO;
/**
*
* @author Alberto
*/
public class CadSaida extends javax.swing.JInternalFrame {
/**
* Creates new form saida
*/
public CadSaida() {
initComponents();
}
public void limpar(){
descricao.setText("");
valor.setText("");
matriculaDoFuncionario.setText("");
dataPagamento.setText("");
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
valor = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
matriculaDoFuncionario = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
limpar = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
Salvar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
descricao = new javax.swing.JEditorPane();
jLabel3 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
dataPagamento = new javax.swing.JFormattedTextField();
jLabel34 = new javax.swing.JLabel();
setTitle("Outras Saídas");
jLabel5.setText("Matricula do Funcionario");
matriculaDoFuncionario.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
matriculaDoFuncionarioKeyReleased(evt);
}
});
jLabel2.setText("Valor ");
jLabel4.setText("Data do Pagamento");
limpar.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\paintbrush.png")); // NOI18N
limpar.setText("Limpar");
limpar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
limparActionPerformed(evt);
}
});
jButton3.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\cancel.png")); // NOI18N
jButton3.setText("Cancelar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
Salvar.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\SysFitness1.1\\src\\br\\sys\\Imagens\\money_add.png")); // NOI18N
Salvar.setText("Salvar");
Salvar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SalvarActionPerformed(evt);
}
});
jScrollPane1.setViewportView(descricao);
jLabel3.setText("Descrição da despesa");
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\SysFitness1.1\\src\\br\\sys\\Imagens\\ícone-pagamento cópia.png")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
);
try {
dataPagamento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-##-##")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
dataPagamento.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dataPagamentoActionPerformed(evt);
}
});
jLabel34.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel34.setForeground(new java.awt.Color(153, 153, 153));
jLabel34.setText("Ex: 2012-12-31");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(Salvar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(limpar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 429, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(matriculaDoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(valor, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(33, 33, 33)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel34)
.addComponent(dataPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)))
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {Salvar, jButton3, limpar});
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(matriculaDoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dataPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel34)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(limpar)
.addComponent(Salvar))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void SalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SalvarActionPerformed
Saida saida = new Saida();
SaidaDAO saidaDAO = new SaidaDAO();
saida.setId_funcionario(Integer.parseInt(matriculaDoFuncionario.getText()));
saida.setValor(Float.parseFloat(valor.getText()));
saida.setDataSaida(dataPagamento.getText());
saida.setDescricao(descricao.getText());
saidaDAO.inserirSaida(saida);
// limparCampos();
// JOptionPane.showMessageDialog(null,"Cadastro Realizado com Sucesso.");
}//GEN-LAST:event_SalvarActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
this.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed
private void limparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limparActionPerformed
limpar();
}//GEN-LAST:event_limparActionPerformed
private void matriculaDoFuncionarioKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_matriculaDoFuncionarioKeyReleased
}//GEN-LAST:event_matriculaDoFuncionarioKeyReleased
private void dataPagamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataPagamentoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_dataPagamentoActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Salvar;
private javax.swing.JFormattedTextField dataPagamento;
private javax.swing.JEditorPane descricao;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton limpar;
private javax.swing.JTextField matriculaDoFuncionario;
private javax.swing.JTextField valor;
// End of variables declaration//GEN-END:variables
}
| 13,393 | 0.653122 | 0.64035 | 262 | 50.099236 | 41.07159 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.59542 | false | false | 2 |
0d8a8330f290ebdbedc5eca1a167a4ad4fdf2906 | 11,699,490,938,509 | e7b8c45b50d20008981e0603daf8b5d9ebf960da | /src/main/java/me/rainnny/api/hotbar/Button.java | f3d75107e987a5f1745d402e5a3581be0bef84a5 | [] | no_license | Rainnny7/PluginLibraryTemplate | https://github.com/Rainnny7/PluginLibraryTemplate | e9cbff5d9ddb034e209062dabd8e57880503ed46 | 4b3f971327d96ad5f95c864057543d3735819dce | refs/heads/master | 2022-12-13T13:43:16.376000 | 2020-09-06T05:56:56 | 2020-09-06T05:56:56 | 290,917,103 | 2 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.rainnny.api.hotbar;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import me.rainnny.api.util.Callback;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
/**
* @author Braydon
*/
@RequiredArgsConstructor @Getter
public class Button {
private final String id;
private final ItemStack item;
private Callback<PlayerInteractEvent> interactCallback;
private Callback<PlayerInteractEntityEvent> interactEntityEvent;
/**
* Create a new button with an itemstack and an event
* @param id - The id of the button
* @param item - The item you would like the button to be
* @param event - The event that gets called when you click on the item
*/
public Button(String id, ItemStack item, Callback<PlayerInteractEvent> event) {
this.id = id;
this.item = item;
interactCallback = event;
}
/**
* Adds a entity interact event to your button
* @param callback - The entity interact event
* @return the button
*/
public Button withInteractEntityEvent(Callback<PlayerInteractEntityEvent> callback) {
interactEntityEvent = callback;
return this;
}
} | UTF-8 | Java | 1,282 | java | Button.java | Java | [
{
"context": "rt org.bukkit.inventory.ItemStack;\n\n/**\n * @author Braydon\n */\n@RequiredArgsConstructor @Getter\npublic class",
"end": 302,
"score": 0.949626624584198,
"start": 295,
"tag": "NAME",
"value": "Braydon"
}
] | null | [] | package me.rainnny.api.hotbar;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import me.rainnny.api.util.Callback;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
/**
* @author Braydon
*/
@RequiredArgsConstructor @Getter
public class Button {
private final String id;
private final ItemStack item;
private Callback<PlayerInteractEvent> interactCallback;
private Callback<PlayerInteractEntityEvent> interactEntityEvent;
/**
* Create a new button with an itemstack and an event
* @param id - The id of the button
* @param item - The item you would like the button to be
* @param event - The event that gets called when you click on the item
*/
public Button(String id, ItemStack item, Callback<PlayerInteractEvent> event) {
this.id = id;
this.item = item;
interactCallback = event;
}
/**
* Adds a entity interact event to your button
* @param callback - The entity interact event
* @return the button
*/
public Button withInteractEntityEvent(Callback<PlayerInteractEntityEvent> callback) {
interactEntityEvent = callback;
return this;
}
} | 1,282 | 0.712169 | 0.712169 | 41 | 30.292683 | 24.400364 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.439024 | false | false | 2 |
981a21a3c5fa062e6fe32fb184d249d1d1867649 | 6,674,379,199,592 | 2e841e9a11eeb68a3efc0fd26b4daab3ed5fb656 | /src/java/com/badiyan/uk/online/beans/MineralRatioBean.java | 723841e0c6340532aacebbc0d2a0ffb91f5ea4ba | [] | no_license | marlostueve/valonyx-legacy | https://github.com/marlostueve/valonyx-legacy | 83fc45696364108679eca0d59dc5fc03512bedd5 | 7c879346eaa23c880739aadcbc9f06676e7ec8a1 | refs/heads/main | 2023-01-29T21:08:31.165000 | 2020-12-13T20:32:49 | 2020-12-13T20:32:49 | 320,857,443 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* MineralRatioBean.java
*
* Created on June 25, 2007, 8:55 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.badiyan.uk.online.beans;
import com.badiyan.torque.*;
import com.badiyan.uk.beans.*;
import com.badiyan.uk.exceptions.*;
import java.beans.*;
import java.util.*;
import org.apache.torque.*;
import org.apache.torque.util.Criteria;
import java.math.BigDecimal;
/**
*
* @author marlo
* @version
*/
public class
MineralRatioBean
extends com.badiyan.uk.beans.CUBean
implements java.io.Serializable
{
// CLASS VARIABLES
private static HashMap ratios = new HashMap(19);
// CLASS METHODS
public static void
delete(int _id)
throws TorqueException
{
Criteria crit = new Criteria();
crit.add(MineralRatioPeer.MINERAL_RATIOS_ID, _id);
MineralRatioPeer.doDelete(crit);
}
public static MineralRatioBean
getMineralRatio(int _id)
throws TorqueException, ObjectNotFoundException
{
Integer key = new Integer(_id);
MineralRatioBean ratio = (MineralRatioBean)ratios.get(key);
if (ratio == null)
{
Criteria crit = new Criteria();
crit.add(MineralRatioPeer.MINERAL_RATIOS_ID, _id);
List objList = MineralRatioPeer.doSelect(crit);
if (objList.size() == 0)
throw new ObjectNotFoundException("Could not locate mineral ratio with id: " + _id);
ratio = MineralRatioBean.getMineralRatio((MineralRatio)objList.get(0));
}
return ratio;
}
private static MineralRatioBean
getMineralRatio(MineralRatio _ratio)
{
Integer key = new Integer(_ratio.getMineralRatiosId());
MineralRatioBean ratio = (MineralRatioBean)ratios.get(key);
if (ratio == null)
{
ratio = new MineralRatioBean(_ratio);
ratios.put(key, ratio);
}
return ratio;
}
public static Vector
getMineralRatios(PersonBean _person)
throws TorqueException
{
Vector vec = new Vector();
Criteria crit = new Criteria();
crit.add(MineralRatioPeer.PERSON_ID, _person.getId());
crit.addAscendingOrderByColumn(MineralRatioPeer.ANALYSIS_DATE);
Iterator obj_itr = MineralRatioPeer.doSelect(crit).iterator();
while (obj_itr.hasNext())
vec.addElement(MineralRatioBean.getMineralRatio((MineralRatio)obj_itr.next()));
return vec;
}
// INSTANCE VARIABLES
private MineralRatio ratio;
// CONSTRUCTORS
public
MineralRatioBean()
{
ratio = new MineralRatio();
isNew = true;
}
public
MineralRatioBean(MineralRatio _ratio)
{
ratio = _ratio;
isNew = false;
}
// INSTANCE METHODS
/*
*<table name="MINERAL_RATIO" idMethod="native">
<column name="MINERAL_RATIOS_ID" primaryKey="true" required="true" type="INTEGER" autoIncrement="true"/>
<column name="PERSON_ID" required="true" type="INTEGER"/>
<column name="CA_MG" type="DECIMAL"/>
<column name="CA_K" type="DECIMAL"/>
<column name="NA_MG" type="DECIMAL"/>
<column name="NA_K" type="DECIMAL"/>
<column name="ZN_CU" type="DECIMAL"/>
<column name="CA_P" type="DECIMAL"/>
<column name="OXIDATION_TYPE" size="100" type="VARCHAR"/>
<column name="NOTES" type="LONGVARCHAR"/>
<column name="ANALYSIS_DATE" required="true" type="TIMESTAMP"/>
<column name="CREATION_DATE" required="true" type="TIMESTAMP"/>
<column name="MODIFICATION_DATE" required="false" type="TIMESTAMP"/>
<column name="CREATE_PERSON_ID" required="false" type="INTEGER"/>
<column name="MODIFY_PERSON_ID" required="false" type="INTEGER"/>
<foreign-key foreignTable="PERSON">
<reference local="PERSON_ID" foreign="PERSONID"/>
</foreign-key>
<foreign-key foreignTable="PERSON">
<reference local="CREATE_PERSON_ID" foreign="PERSONID"/>
</foreign-key>
<foreign-key foreignTable="PERSON">
<reference local="MODIFY_PERSON_ID" foreign="PERSONID"/>
</foreign-key>
</table>
*/
public boolean
hiddenCopper()
{
if ((this.getCu() != null) && (this.getCu().floatValue() < 1.0f))
return true;
if ((this.getCa() != null) && (this.getCa().floatValue() > 50.0f))
return true;
if ((this.getHg() != null) && (this.getHg().floatValue() > 0.06f))
return true;
if ((this.getNaK() != null) && (this.getNaK().floatValue() < 2.50f))
return true;
if ((this.getK() != null) && (this.getK().floatValue() < 4.0f))
return true;
return false;
}
public String
getHiddenCopperString()
{
String str = null;
if ((this.getCu() != null) && (this.getCu().floatValue() < 1.0f))
str = "Cu < 1";
if ((this.getCa() != null) && (this.getCa().floatValue() > 50.0f))
{
if (str == null)
str = "Ca > 50";
else
str += ", Ca > 50";
}
if ((this.getHg() != null) && (this.getHg().floatValue() > 0.06f))
{
if (str == null)
str = "Hg >.06";
else
str += ", Hg >.06";
}
if ((this.getNaK() != null) && (this.getNaK().floatValue() < 2.50f))
{
if (str == null)
str = "Na/K ratio < 2.5";
else
str += ", Na/K ratio < 2.5";
}
if ((this.getK() != null) && (this.getK().floatValue() < 4.0f))
{
if (str == null)
str = "K < 4";
else
str += ", K < 4";
}
if (str == null)
return "No Hidden CU found";
return str;
}
public PersonBean
getPerson()
throws TorqueException, ObjectNotFoundException, UniqueObjectNotFoundException
{
return UKOnlinePersonBean.getPerson(ratio.getPersonId());
}
public void
setPerson(UKOnlinePersonBean _person)
throws TorqueException
{
ratio.setPersonId(_person.getId());
}
public String
getNotesString()
{
String str = ratio.getNotes();
if (str == null)
return "";
return str;
}
public int
getId()
{
return ratio.getMineralRatiosId();
}
public String
getLabel()
{
Date analysis_date = ratio.getAnalysisDate();
if (analysis_date == null)
return "";
String analysis_date_str = CUBean.getUserDateString(analysis_date);
return analysis_date_str + " (" + this.getCaMgString() + " - " + this.getCaKString() + " - " + this.getNaMgString() + " - " + this.getNaKString() + " - " + this.getZnCuString() + " - " + this.getCaPString() + ") " + this.getOxidationType();
}
public String
getValue()
{
return ratio.getMineralRatiosId() + "";
}
public Date
getAnalysisDate()
{
return ratio.getAnalysisDate();
}
public String
getAnalysisDateString()
{
Date analysis_date = ratio.getAnalysisDate();
if (analysis_date == null)
return "";
String analysis_date_str = CUBean.getUserDateString(analysis_date);
return analysis_date_str;
}
public BigDecimal
getCa()
{
return ratio.getCa();
}
public BigDecimal
getK()
{
return ratio.getK();
}
public BigDecimal
getCu()
{
return ratio.getCu();
}
public BigDecimal
getHg()
{
return ratio.getHg();
}
public BigDecimal
getCaMg()
{
return ratio.getCaMg();
}
public BigDecimal
getCaK()
{
return ratio.getCaK();
}
public BigDecimal
getNaMg()
{
return ratio.getNaMg();
}
public BigDecimal
getNaK()
{
return ratio.getNaK();
}
public BigDecimal
getZnCu()
{
return ratio.getZnCu();
}
public BigDecimal
getCaP()
{
return ratio.getCaP();
}
public String
getCaString()
{
BigDecimal value = ratio.getCa();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getKString()
{
BigDecimal value = ratio.getK();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCuString()
{
BigDecimal value = ratio.getCu();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getHgString()
{
BigDecimal value = ratio.getHg();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCaMgString()
{
BigDecimal value = ratio.getCaMg();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCaKString()
{
BigDecimal value = ratio.getCaK();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getNaMgString()
{
BigDecimal value = ratio.getNaMg();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getNaKString()
{
BigDecimal value = ratio.getNaK();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getZnCuString()
{
BigDecimal value = ratio.getZnCu();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCaPString()
{
BigDecimal value = ratio.getCaP();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getOxidationType()
{
return ratio.getOxidationType();
}
public void
getNotes(String _notes)
{
ratio.setNotes(_notes);
}
protected void
insertObject()
throws com.badiyan.uk.exceptions.ObjectAlreadyExistsException, com.badiyan.uk.exceptions.IllegalValueException, Exception
{
if (ratio.getCreatePersonId() < 1)
throw new IllegalValueException("Create person not set for mineral ratio");
ratio.setCreationDate(new Date());
ratio.save();
Integer key = new Integer(ratio.getMineralRatiosId());
MineralRatioBean.ratios.put(key, this);
}
public void
setAnalysisDate(Date _date)
{
ratio.setAnalysisDate(_date);
}
public void
setCa(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCa(value);
}
public void
setK(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setK(value);
}
public void
setCu(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCu(value);
}
public void
setHg(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setHg(value);
}
public void
setCaMg(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCaMg(value);
}
public void
setCaK(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCaK(value);
}
public void
setNaMg(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setNaMg(value);
}
public void
setNaK(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setNaK(value);
}
public void
setZnCu(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setZnCu(value);
}
public void
setCaP(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCaP(value);
}
public void
setOxidationType(String _oxidationType)
{
ratio.setOxidationType(_oxidationType);
}
public void
setNotes(String _notes)
{
ratio.setNotes(_notes);
}
public void
setCreateOrModifyPerson(PersonBean _person)
throws TorqueException
{
if (isNew)
ratio.setCreatePersonId(_person.getId());
else
ratio.setModifyPersonId(_person.getId());
}
protected void
updateObject()
throws com.badiyan.uk.exceptions.ObjectAlreadyExistsException, com.badiyan.uk.exceptions.IllegalValueException, Exception
{
if (ratio.getModifyPersonId() < 1)
throw new IllegalValueException("Modify person not set for mineral ratio");
ratio.setModificationDate(new Date());
ratio.save();
}
} | UTF-8 | Java | 12,596 | java | MineralRatioBean.java | Java | [
{
"context": "\n\nimport java.math.BigDecimal;\n\n/**\n *\n * @author marlo\n * @version \n */\npublic class\nMineralRatioBean\n\te",
"end": 476,
"score": 0.9838088750839233,
"start": 471,
"tag": "USERNAME",
"value": "marlo"
}
] | null | [] | /*
* MineralRatioBean.java
*
* Created on June 25, 2007, 8:55 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.badiyan.uk.online.beans;
import com.badiyan.torque.*;
import com.badiyan.uk.beans.*;
import com.badiyan.uk.exceptions.*;
import java.beans.*;
import java.util.*;
import org.apache.torque.*;
import org.apache.torque.util.Criteria;
import java.math.BigDecimal;
/**
*
* @author marlo
* @version
*/
public class
MineralRatioBean
extends com.badiyan.uk.beans.CUBean
implements java.io.Serializable
{
// CLASS VARIABLES
private static HashMap ratios = new HashMap(19);
// CLASS METHODS
public static void
delete(int _id)
throws TorqueException
{
Criteria crit = new Criteria();
crit.add(MineralRatioPeer.MINERAL_RATIOS_ID, _id);
MineralRatioPeer.doDelete(crit);
}
public static MineralRatioBean
getMineralRatio(int _id)
throws TorqueException, ObjectNotFoundException
{
Integer key = new Integer(_id);
MineralRatioBean ratio = (MineralRatioBean)ratios.get(key);
if (ratio == null)
{
Criteria crit = new Criteria();
crit.add(MineralRatioPeer.MINERAL_RATIOS_ID, _id);
List objList = MineralRatioPeer.doSelect(crit);
if (objList.size() == 0)
throw new ObjectNotFoundException("Could not locate mineral ratio with id: " + _id);
ratio = MineralRatioBean.getMineralRatio((MineralRatio)objList.get(0));
}
return ratio;
}
private static MineralRatioBean
getMineralRatio(MineralRatio _ratio)
{
Integer key = new Integer(_ratio.getMineralRatiosId());
MineralRatioBean ratio = (MineralRatioBean)ratios.get(key);
if (ratio == null)
{
ratio = new MineralRatioBean(_ratio);
ratios.put(key, ratio);
}
return ratio;
}
public static Vector
getMineralRatios(PersonBean _person)
throws TorqueException
{
Vector vec = new Vector();
Criteria crit = new Criteria();
crit.add(MineralRatioPeer.PERSON_ID, _person.getId());
crit.addAscendingOrderByColumn(MineralRatioPeer.ANALYSIS_DATE);
Iterator obj_itr = MineralRatioPeer.doSelect(crit).iterator();
while (obj_itr.hasNext())
vec.addElement(MineralRatioBean.getMineralRatio((MineralRatio)obj_itr.next()));
return vec;
}
// INSTANCE VARIABLES
private MineralRatio ratio;
// CONSTRUCTORS
public
MineralRatioBean()
{
ratio = new MineralRatio();
isNew = true;
}
public
MineralRatioBean(MineralRatio _ratio)
{
ratio = _ratio;
isNew = false;
}
// INSTANCE METHODS
/*
*<table name="MINERAL_RATIO" idMethod="native">
<column name="MINERAL_RATIOS_ID" primaryKey="true" required="true" type="INTEGER" autoIncrement="true"/>
<column name="PERSON_ID" required="true" type="INTEGER"/>
<column name="CA_MG" type="DECIMAL"/>
<column name="CA_K" type="DECIMAL"/>
<column name="NA_MG" type="DECIMAL"/>
<column name="NA_K" type="DECIMAL"/>
<column name="ZN_CU" type="DECIMAL"/>
<column name="CA_P" type="DECIMAL"/>
<column name="OXIDATION_TYPE" size="100" type="VARCHAR"/>
<column name="NOTES" type="LONGVARCHAR"/>
<column name="ANALYSIS_DATE" required="true" type="TIMESTAMP"/>
<column name="CREATION_DATE" required="true" type="TIMESTAMP"/>
<column name="MODIFICATION_DATE" required="false" type="TIMESTAMP"/>
<column name="CREATE_PERSON_ID" required="false" type="INTEGER"/>
<column name="MODIFY_PERSON_ID" required="false" type="INTEGER"/>
<foreign-key foreignTable="PERSON">
<reference local="PERSON_ID" foreign="PERSONID"/>
</foreign-key>
<foreign-key foreignTable="PERSON">
<reference local="CREATE_PERSON_ID" foreign="PERSONID"/>
</foreign-key>
<foreign-key foreignTable="PERSON">
<reference local="MODIFY_PERSON_ID" foreign="PERSONID"/>
</foreign-key>
</table>
*/
public boolean
hiddenCopper()
{
if ((this.getCu() != null) && (this.getCu().floatValue() < 1.0f))
return true;
if ((this.getCa() != null) && (this.getCa().floatValue() > 50.0f))
return true;
if ((this.getHg() != null) && (this.getHg().floatValue() > 0.06f))
return true;
if ((this.getNaK() != null) && (this.getNaK().floatValue() < 2.50f))
return true;
if ((this.getK() != null) && (this.getK().floatValue() < 4.0f))
return true;
return false;
}
public String
getHiddenCopperString()
{
String str = null;
if ((this.getCu() != null) && (this.getCu().floatValue() < 1.0f))
str = "Cu < 1";
if ((this.getCa() != null) && (this.getCa().floatValue() > 50.0f))
{
if (str == null)
str = "Ca > 50";
else
str += ", Ca > 50";
}
if ((this.getHg() != null) && (this.getHg().floatValue() > 0.06f))
{
if (str == null)
str = "Hg >.06";
else
str += ", Hg >.06";
}
if ((this.getNaK() != null) && (this.getNaK().floatValue() < 2.50f))
{
if (str == null)
str = "Na/K ratio < 2.5";
else
str += ", Na/K ratio < 2.5";
}
if ((this.getK() != null) && (this.getK().floatValue() < 4.0f))
{
if (str == null)
str = "K < 4";
else
str += ", K < 4";
}
if (str == null)
return "No Hidden CU found";
return str;
}
public PersonBean
getPerson()
throws TorqueException, ObjectNotFoundException, UniqueObjectNotFoundException
{
return UKOnlinePersonBean.getPerson(ratio.getPersonId());
}
public void
setPerson(UKOnlinePersonBean _person)
throws TorqueException
{
ratio.setPersonId(_person.getId());
}
public String
getNotesString()
{
String str = ratio.getNotes();
if (str == null)
return "";
return str;
}
public int
getId()
{
return ratio.getMineralRatiosId();
}
public String
getLabel()
{
Date analysis_date = ratio.getAnalysisDate();
if (analysis_date == null)
return "";
String analysis_date_str = CUBean.getUserDateString(analysis_date);
return analysis_date_str + " (" + this.getCaMgString() + " - " + this.getCaKString() + " - " + this.getNaMgString() + " - " + this.getNaKString() + " - " + this.getZnCuString() + " - " + this.getCaPString() + ") " + this.getOxidationType();
}
public String
getValue()
{
return ratio.getMineralRatiosId() + "";
}
public Date
getAnalysisDate()
{
return ratio.getAnalysisDate();
}
public String
getAnalysisDateString()
{
Date analysis_date = ratio.getAnalysisDate();
if (analysis_date == null)
return "";
String analysis_date_str = CUBean.getUserDateString(analysis_date);
return analysis_date_str;
}
public BigDecimal
getCa()
{
return ratio.getCa();
}
public BigDecimal
getK()
{
return ratio.getK();
}
public BigDecimal
getCu()
{
return ratio.getCu();
}
public BigDecimal
getHg()
{
return ratio.getHg();
}
public BigDecimal
getCaMg()
{
return ratio.getCaMg();
}
public BigDecimal
getCaK()
{
return ratio.getCaK();
}
public BigDecimal
getNaMg()
{
return ratio.getNaMg();
}
public BigDecimal
getNaK()
{
return ratio.getNaK();
}
public BigDecimal
getZnCu()
{
return ratio.getZnCu();
}
public BigDecimal
getCaP()
{
return ratio.getCaP();
}
public String
getCaString()
{
BigDecimal value = ratio.getCa();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getKString()
{
BigDecimal value = ratio.getK();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCuString()
{
BigDecimal value = ratio.getCu();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getHgString()
{
BigDecimal value = ratio.getHg();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCaMgString()
{
BigDecimal value = ratio.getCaMg();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCaKString()
{
BigDecimal value = ratio.getCaK();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getNaMgString()
{
BigDecimal value = ratio.getNaMg();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getNaKString()
{
BigDecimal value = ratio.getNaK();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getZnCuString()
{
BigDecimal value = ratio.getZnCu();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getCaPString()
{
BigDecimal value = ratio.getCaP();
if (value == null)
return "";
return value.setScale(3, BigDecimal.ROUND_HALF_UP).toString();
}
public String
getOxidationType()
{
return ratio.getOxidationType();
}
public void
getNotes(String _notes)
{
ratio.setNotes(_notes);
}
protected void
insertObject()
throws com.badiyan.uk.exceptions.ObjectAlreadyExistsException, com.badiyan.uk.exceptions.IllegalValueException, Exception
{
if (ratio.getCreatePersonId() < 1)
throw new IllegalValueException("Create person not set for mineral ratio");
ratio.setCreationDate(new Date());
ratio.save();
Integer key = new Integer(ratio.getMineralRatiosId());
MineralRatioBean.ratios.put(key, this);
}
public void
setAnalysisDate(Date _date)
{
ratio.setAnalysisDate(_date);
}
public void
setCa(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCa(value);
}
public void
setK(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setK(value);
}
public void
setCu(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCu(value);
}
public void
setHg(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setHg(value);
}
public void
setCaMg(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCaMg(value);
}
public void
setCaK(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCaK(value);
}
public void
setNaMg(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setNaMg(value);
}
public void
setNaK(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setNaK(value);
}
public void
setZnCu(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setZnCu(value);
}
public void
setCaP(String _val)
throws NumberFormatException
{
BigDecimal value = new BigDecimal(_val);
value.setScale(3, BigDecimal.ROUND_HALF_UP);
ratio.setCaP(value);
}
public void
setOxidationType(String _oxidationType)
{
ratio.setOxidationType(_oxidationType);
}
public void
setNotes(String _notes)
{
ratio.setNotes(_notes);
}
public void
setCreateOrModifyPerson(PersonBean _person)
throws TorqueException
{
if (isNew)
ratio.setCreatePersonId(_person.getId());
else
ratio.setModifyPersonId(_person.getId());
}
protected void
updateObject()
throws com.badiyan.uk.exceptions.ObjectAlreadyExistsException, com.badiyan.uk.exceptions.IllegalValueException, Exception
{
if (ratio.getModifyPersonId() < 1)
throw new IllegalValueException("Modify person not set for mineral ratio");
ratio.setModificationDate(new Date());
ratio.save();
}
} | 12,596 | 0.646158 | 0.639886 | 591 | 20.31472 | 23.139227 | 245 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.456853 | false | false | 2 |
2a3c1039d9671a18677373e22dfb7a06965c71f2 | 28,879,360,117,901 | 85a515681a54807624b62d4ec164d64c42c95d67 | /src/main/java/example/deeplearning/nn/util/Dropout.java | 64b200ac6eaac12b44eafd89d48fc748c4774b51 | [] | no_license | re53min/DeepLearning | https://github.com/re53min/DeepLearning | 4a3d94b1a4b3d179f30bd324f41d806b712cf9e2 | cfd56f0abde8f852298e84abe3232832849a397f | refs/heads/master | 2021-01-10T05:01:30.242000 | 2016-04-03T08:23:12 | 2016-04-03T08:23:12 | 53,501,373 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package example.deeplearning.nn.util;
import java.util.Random;
/**
* Created by b1012059 on 2016/03/31.
*/
public class Dropout {
public Dropout(){
}
/**
* Dropout
* @param size
* @param p
* @param rng
* @return
*/
public static int[] dropout(int size, double p, Random rng){
int mask[] = new int[size];
for(int i = 0; i < size; i++) {
mask[i] = Distribution.binomial(1, p, rng);
}
return mask;
}
}
| UTF-8 | Java | 502 | java | Dropout.java | Java | [
{
"context": "util;\n\nimport java.util.Random;\n\n/**\n * Created by b1012059 on 2016/03/31.\n */\npublic class Dropout {\n\n pu",
"end": 92,
"score": 0.9994180202484131,
"start": 84,
"tag": "USERNAME",
"value": "b1012059"
}
] | null | [] |
package example.deeplearning.nn.util;
import java.util.Random;
/**
* Created by b1012059 on 2016/03/31.
*/
public class Dropout {
public Dropout(){
}
/**
* Dropout
* @param size
* @param p
* @param rng
* @return
*/
public static int[] dropout(int size, double p, Random rng){
int mask[] = new int[size];
for(int i = 0; i < size; i++) {
mask[i] = Distribution.binomial(1, p, rng);
}
return mask;
}
}
| 502 | 0.521912 | 0.488048 | 29 | 16.275862 | 16.919477 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false | 2 |
520684803f7e938a0c2616c399e3b1a9ff0872ab | 17,480,516,914,867 | 679a5052848e8742a19e123dce3443058a039afe | /Atividade Java POO/DadosPatinete.java | 6eb4fa391e37c75e428fc7d4cf05a45355283085 | [] | no_license | BrunoMouraB/Java | https://github.com/BrunoMouraB/Java | 409b2c8a29713a3febd107723493769b13bdf126 | 62b91be230438523287f3386459ca58ffa65d8d0 | refs/heads/master | 2022-11-28T20:15:07.397000 | 2020-08-02T02:00:40 | 2020-08-02T02:00:40 | 277,665,936 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package POO;
public class DadosPatinete {
public static void main(String[] args) {
Patinete patinete = new Patinete("38", "Adidas", false, 0 , 30);
System.out.println(patinete.mostrarDados());
System.out.println("\n");
System.out.println(patinete.andar());
}
}
| UTF-8 | Java | 302 | java | DadosPatinete.java | Java | [] | null | [] | package POO;
public class DadosPatinete {
public static void main(String[] args) {
Patinete patinete = new Patinete("38", "Adidas", false, 0 , 30);
System.out.println(patinete.mostrarDados());
System.out.println("\n");
System.out.println(patinete.andar());
}
}
| 302 | 0.625828 | 0.609272 | 12 | 24.083334 | 23.588339 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 2 |
14f34cf3c548c6b9cf0cca28af5b928f419b1531 | 14,465,449,876,848 | c465c615ed1b40dad6214ad359416fe06857755a | /ProfileManager/src/com/samsung/profilemanager/util/CustomProfileUtil.java | 3b0bd729d98335510f20a3cdc901fb87e8eecd1e | [] | no_license | coder-neo/android | https://github.com/coder-neo/android | 44bf84db58ab9bbbab12ac7d4a9871c21a297fe5 | 9f2b822913206ce590db20afd8fe4c220f168f70 | refs/heads/master | 2016-08-11T15:45:05.086000 | 2016-01-10T19:08:14 | 2016-01-10T19:08:14 | 49,378,529 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.samsung.profilemanager.util;
import java.util.ArrayList;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import com.samsung.profilemanager.constants.AppConstants;
import com.samsung.profilemanager.models.IModel;
import com.samsung.profilemanager.models.ProfileModel;
public class CustomProfileUtil extends BaseUtil{
public static final String CUSTOM_PROFILE_TABLE="Custom_Profile_Table";
private Context mContext;
private String TAG="CustomProfileClass";
public CustomProfileUtil(Context context) {
// TODO Auto-generated constructor stub
mContext=context;
}
//Check for time not equal to 0
public ArrayList<IModel> getServiceData()
{
int id=0;
ArrayList<IModel> resultList=new ArrayList<IModel>();
ProfileModel mProfileModel;
String selection=AppConstants.SET_PROFILE_TIME+" <> ?";
String [] selectionArgs={""+id};
Cursor resultCursor=mContext.getContentResolver().query(AppConstants.CUSTOM_PROFILE_URI, null, selection, selectionArgs, null);
//Log.i(TAG,"Service Data No of records "+resultCursor.getCount());
for(resultCursor.moveToFirst();!resultCursor.isAfterLast();resultCursor.moveToNext())
{
if(resultCursor.getLong(resultCursor.getColumnIndex(AppConstants.SET_PROFILE_TIME))!=0)
{
mProfileModel=new ProfileModel();
mProfileModel.setProfileID(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.CUSTOM_PROFILE_ID)));
mProfileModel.setProfileName(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.PROFILE_NAME)));
mProfileModel.setBluetoothEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.BLUETOOTH))));
mProfileModel.setWifiEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.WIFI))));
mProfileModel.setGPSEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.GPS))));
mProfileModel.setMediaVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.MEDIA_VOLUME)));
mProfileModel.setNotficationVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.NOTIFICATION_VOLUME)));
mProfileModel.setRingVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.RING_VOLUME)));
mProfileModel.setAlarmVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.ALARM_VOLUME)));
mProfileModel.setTimeActivated(resultCursor.getLong(resultCursor.getColumnIndex(AppConstants.SET_PROFILE_TIME)));
resultList.add(mProfileModel);
Log.i(TAG,"Service record added "+mProfileModel.getProfileName());
}
}
return resultList;
}
@Override
public ArrayList<IModel> getData() {
// TODO Auto-generated method stub
ProfileModel mProfileModel;
Log.i(TAG, "Get data called");
ArrayList<IModel> resultList=new ArrayList<IModel>();
Cursor resultCursor=mContext.getContentResolver().query(AppConstants.CUSTOM_PROFILE_URI, null, null, null, null);
//retrieving the data from the cursor
if(resultCursor!=null)
{
Log.i(TAG, "No of records "+resultCursor.getCount());
for(resultCursor.moveToFirst();!resultCursor.isAfterLast();resultCursor.moveToNext())
{
mProfileModel=new ProfileModel();
mProfileModel.setProfileID(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.CUSTOM_PROFILE_ID)));
mProfileModel.setProfileName(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.PROFILE_NAME)));
mProfileModel.setWifiEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.WIFI))));
mProfileModel.setBluetoothEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.BLUETOOTH))));
mProfileModel.setGPSEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.GPS))));
mProfileModel.setBrightness(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.BRIGHTNESS)));
mProfileModel.setRingVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.RING_VOLUME)));
mProfileModel.setMediaVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.MEDIA_VOLUME)));
mProfileModel.setNotficationVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.NOTIFICATION_VOLUME)));
mProfileModel.setAlarmVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.ALARM_VOLUME)));
mProfileModel.setTimeActivated(resultCursor.getLong(resultCursor.getColumnIndex(AppConstants.SET_PROFILE_TIME)));
resultList.add(mProfileModel);
Log.i(TAG, "Profile record added "+mProfileModel.getProfileName());
}
resultCursor.close();
}
else
{
Log.i(TAG, "getData Cursor is null");
}
return resultList;
}
@Override
public ContentValues setContentValues(IModel recieveData)
{
ContentValues updatedValues=new ContentValues();
ProfileModel mProfileModel =(ProfileModel)recieveData;
updatedValues.put(AppConstants.PROFILE_NAME, mProfileModel.getProfileName());
updatedValues.put(AppConstants.WIFI, String.valueOf(mProfileModel.isWifiEnabled()));
updatedValues.put(AppConstants.GPS, "false");
updatedValues.put(AppConstants.BLUETOOTH, String.valueOf(mProfileModel.isBluetoothEnabled()));
updatedValues.put(AppConstants.BRIGHTNESS, mProfileModel.getBrightness());
updatedValues.put(AppConstants.RING_VOLUME, mProfileModel.getRingVolume());
updatedValues.put(AppConstants.MEDIA_VOLUME, mProfileModel.getMediaVolume());
updatedValues.put(AppConstants.NOTIFICATION_VOLUME, mProfileModel.getNotficationVolume());
updatedValues.put(AppConstants.ALARM_VOLUME, mProfileModel.getAlarmVolume());
updatedValues.put(AppConstants.SET_PROFILE_TIME,mProfileModel.getTimeActivated());
return updatedValues;
}
@Override
public boolean updateData(IModel recievedData)
{
ProfileModel mProfileModel=(ProfileModel)recievedData;
ContentValues mContentValues=setContentValues(mProfileModel);
mContext.getContentResolver().update(AppConstants.CUSTOM_PROFILE_URI, mContentValues, null, null);
Log.i(TAG, "UpdateData function in"+TAG);
return true;
}
@Override
public boolean deleteData(IModel recieveData)
{
ProfileModel mProfileModel=(ProfileModel)recieveData;
String [] selectionArgs={mProfileModel.getProfileName()};
int result = mContext.getContentResolver().delete(AppConstants.CUSTOM_PROFILE_URI, null, selectionArgs);
if (result==0)
return false;
return true;
}
}
| UTF-8 | Java | 6,640 | java | CustomProfileUtil.java | Java | [] | null | [] | package com.samsung.profilemanager.util;
import java.util.ArrayList;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import com.samsung.profilemanager.constants.AppConstants;
import com.samsung.profilemanager.models.IModel;
import com.samsung.profilemanager.models.ProfileModel;
public class CustomProfileUtil extends BaseUtil{
public static final String CUSTOM_PROFILE_TABLE="Custom_Profile_Table";
private Context mContext;
private String TAG="CustomProfileClass";
public CustomProfileUtil(Context context) {
// TODO Auto-generated constructor stub
mContext=context;
}
//Check for time not equal to 0
public ArrayList<IModel> getServiceData()
{
int id=0;
ArrayList<IModel> resultList=new ArrayList<IModel>();
ProfileModel mProfileModel;
String selection=AppConstants.SET_PROFILE_TIME+" <> ?";
String [] selectionArgs={""+id};
Cursor resultCursor=mContext.getContentResolver().query(AppConstants.CUSTOM_PROFILE_URI, null, selection, selectionArgs, null);
//Log.i(TAG,"Service Data No of records "+resultCursor.getCount());
for(resultCursor.moveToFirst();!resultCursor.isAfterLast();resultCursor.moveToNext())
{
if(resultCursor.getLong(resultCursor.getColumnIndex(AppConstants.SET_PROFILE_TIME))!=0)
{
mProfileModel=new ProfileModel();
mProfileModel.setProfileID(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.CUSTOM_PROFILE_ID)));
mProfileModel.setProfileName(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.PROFILE_NAME)));
mProfileModel.setBluetoothEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.BLUETOOTH))));
mProfileModel.setWifiEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.WIFI))));
mProfileModel.setGPSEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.GPS))));
mProfileModel.setMediaVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.MEDIA_VOLUME)));
mProfileModel.setNotficationVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.NOTIFICATION_VOLUME)));
mProfileModel.setRingVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.RING_VOLUME)));
mProfileModel.setAlarmVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.ALARM_VOLUME)));
mProfileModel.setTimeActivated(resultCursor.getLong(resultCursor.getColumnIndex(AppConstants.SET_PROFILE_TIME)));
resultList.add(mProfileModel);
Log.i(TAG,"Service record added "+mProfileModel.getProfileName());
}
}
return resultList;
}
@Override
public ArrayList<IModel> getData() {
// TODO Auto-generated method stub
ProfileModel mProfileModel;
Log.i(TAG, "Get data called");
ArrayList<IModel> resultList=new ArrayList<IModel>();
Cursor resultCursor=mContext.getContentResolver().query(AppConstants.CUSTOM_PROFILE_URI, null, null, null, null);
//retrieving the data from the cursor
if(resultCursor!=null)
{
Log.i(TAG, "No of records "+resultCursor.getCount());
for(resultCursor.moveToFirst();!resultCursor.isAfterLast();resultCursor.moveToNext())
{
mProfileModel=new ProfileModel();
mProfileModel.setProfileID(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.CUSTOM_PROFILE_ID)));
mProfileModel.setProfileName(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.PROFILE_NAME)));
mProfileModel.setWifiEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.WIFI))));
mProfileModel.setBluetoothEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.BLUETOOTH))));
mProfileModel.setGPSEnabled(Boolean.parseBoolean(resultCursor.getString(resultCursor.getColumnIndex(AppConstants.GPS))));
mProfileModel.setBrightness(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.BRIGHTNESS)));
mProfileModel.setRingVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.RING_VOLUME)));
mProfileModel.setMediaVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.MEDIA_VOLUME)));
mProfileModel.setNotficationVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.NOTIFICATION_VOLUME)));
mProfileModel.setAlarmVolume(resultCursor.getInt(resultCursor.getColumnIndex(AppConstants.ALARM_VOLUME)));
mProfileModel.setTimeActivated(resultCursor.getLong(resultCursor.getColumnIndex(AppConstants.SET_PROFILE_TIME)));
resultList.add(mProfileModel);
Log.i(TAG, "Profile record added "+mProfileModel.getProfileName());
}
resultCursor.close();
}
else
{
Log.i(TAG, "getData Cursor is null");
}
return resultList;
}
@Override
public ContentValues setContentValues(IModel recieveData)
{
ContentValues updatedValues=new ContentValues();
ProfileModel mProfileModel =(ProfileModel)recieveData;
updatedValues.put(AppConstants.PROFILE_NAME, mProfileModel.getProfileName());
updatedValues.put(AppConstants.WIFI, String.valueOf(mProfileModel.isWifiEnabled()));
updatedValues.put(AppConstants.GPS, "false");
updatedValues.put(AppConstants.BLUETOOTH, String.valueOf(mProfileModel.isBluetoothEnabled()));
updatedValues.put(AppConstants.BRIGHTNESS, mProfileModel.getBrightness());
updatedValues.put(AppConstants.RING_VOLUME, mProfileModel.getRingVolume());
updatedValues.put(AppConstants.MEDIA_VOLUME, mProfileModel.getMediaVolume());
updatedValues.put(AppConstants.NOTIFICATION_VOLUME, mProfileModel.getNotficationVolume());
updatedValues.put(AppConstants.ALARM_VOLUME, mProfileModel.getAlarmVolume());
updatedValues.put(AppConstants.SET_PROFILE_TIME,mProfileModel.getTimeActivated());
return updatedValues;
}
@Override
public boolean updateData(IModel recievedData)
{
ProfileModel mProfileModel=(ProfileModel)recievedData;
ContentValues mContentValues=setContentValues(mProfileModel);
mContext.getContentResolver().update(AppConstants.CUSTOM_PROFILE_URI, mContentValues, null, null);
Log.i(TAG, "UpdateData function in"+TAG);
return true;
}
@Override
public boolean deleteData(IModel recieveData)
{
ProfileModel mProfileModel=(ProfileModel)recieveData;
String [] selectionArgs={mProfileModel.getProfileName()};
int result = mContext.getContentResolver().delete(AppConstants.CUSTOM_PROFILE_URI, null, selectionArgs);
if (result==0)
return false;
return true;
}
}
| 6,640 | 0.786747 | 0.786145 | 132 | 48.303032 | 41.800198 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.886364 | false | false | 2 |
b77c1b7db2b6347ad6487c1e7d276643f99fb472 | 26,628,797,262,146 | 0d37c87e5c11fa83bcce191b7493f064813bfaac | /app/src/main/java/com/example/ads/estaciojf/quiz/MainActivity.java | 490bdf551fcf0e1adb6aa59414775d8f7a4eb865 | [] | no_license | estaciojf/Quiz | https://github.com/estaciojf/Quiz | d98551e6a28d977073473326fea050fdfdcce350 | 38451f8f6a29e9221401c2690b243fc94039b43b | refs/heads/master | 2020-07-23T10:58:20.461000 | 2019-09-22T13:30:59 | 2019-09-22T13:30:59 | 207,536,101 | 0 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.ads.estaciojf.quiz;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MainActivity extends AppCompatActivity {
// Atributos da classe - Elementos do Layout
RadioGroup radioGroup;
RadioButton radioButton1;
RadioButton radioButton2;
RadioButton radioButton3;
TextView questionText;
// Listas de RadioButtons e Perguntas
List<RadioButton> listRadioButtons;
ArrayList<Question> listQuestions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Endereço da base de perguntas
String url = "http://www.json-generator.com/api/json/get/coUPnGlShu?indent=2";
// Inicia a lista de Perguntas
listQuestions = new ArrayList<>();
// Método que faz o link entre os atributos da classe e os ids de elementos do layout
bindViews();
// Inicia a lista de RadioButtons e adiciona na lista
listRadioButtons = new ArrayList<RadioButton>();
listRadioButtons.add(radioButton1);
listRadioButtons.add(radioButton2);
listRadioButtons.add(radioButton3);
// Faz a consulta na base de perguntas
new JsonTask().execute(url);
// Evento que captura o click em qualquer RadioButton
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if (i == R.id.radioButton1){
selectRadioButton(radioButton1);
Log.i("Radio", "Radio 1");
}
if (i == R.id.radioButton2){
selectRadioButton(radioButton2);
Log.i("Radio", "Radio 2");
}
if (i == R.id.radioButton3){
selectRadioButton(radioButton3);
Log.i("Radio", "Radio 3");
}
}
});
}
// Método que faz o link entre os atributos da classe e os ids de elementos do layout
private void bindViews () {
radioGroup = findViewById(R.id.radioGroup);
radioButton1 = findViewById(R.id.radioButton1);
radioButton2 = findViewById(R.id.radioButton2);
radioButton3 = findViewById(R.id.radioButton3);
questionText = findViewById(R.id.questionText);
}
// Método que altera as cores do RadioButton de acordo com o click
private void selectRadioButton (RadioButton radioButton) {
// Forma atualizada - ContextCompat.getColor(context, R.color.color_name)
radioButton.setTextColor(getResources().getColor(R.color.accent));
// Loop na lista de RadioButtons
// Verifica se o elemento da iteração está marcado
// Se não muda a cor
for (RadioButton radio : listRadioButtons) {
Log.i("Radio", radio.toString() + " " + radio.isChecked());
if(radio.isChecked())
validarResposta(radio);
if (!radio.isChecked())
radio.setTextColor(getResources().getColor(R.color.primaryText));
}
}
private void atualizaLayout(){
Log.i("Debug", listQuestions.get(0).getQuestion());
questionText.setText(listQuestions.get(0).getQuestion());
radioButton1.setText(listQuestions.get(0).getOption1());
radioButton2.setText(listQuestions.get(0).getOption2());
radioButton3.setText(listQuestions.get(0).getOption3());
}
// Comparar o opção com a resposta correta
private void validarResposta(RadioButton radioChecked){
int respostaCorreta = listQuestions.get(0).getAnswer();
Log.i("Resposta", (String) radioChecked.getText() + " " + respostaCorreta);
}
// Classe interna que faz a requisição na base de dados de perguntas
public class JsonTask extends AsyncTask<String, String, String> {
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected String doInBackground(String... params) {
HttpURLConnection connection = null;
BufferedReader reader = null;
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
InputStream stream = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(stream));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
buffer.append(line+"\n");
Log.d("Response: ", "> " + line);
}
return buffer.toString();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.disconnect();
}
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
Log.i("Questions"," " + result);
try {
JSONObject listaJson = new JSONObject(result);
JSONArray questions = listaJson.getJSONArray("questions");
// Mapeamento da base de dados com o modelo
for (int i = 0 ; i < questions.length() ; i ++) {
JSONObject question = questions.getJSONObject(i);
String pergunta = question.getString("question");
String opt1 = question.getString("option1");
String opt2 = question.getString("option2");
String opt3 = question.getString("option3");
int answer = question.getInt("answer");
Question questionModel = new Question(pergunta, opt1, opt2, opt3, answer);
listQuestions.add(questionModel);
}
atualizaLayout();
Log.i("Question Main", listQuestions.get(0).getOption2());
}catch (JSONException e){e.printStackTrace();}
}
}
}
| UTF-8 | Java | 7,297 | java | MainActivity.java | Java | [] | null | [] | package com.example.ads.estaciojf.quiz;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MainActivity extends AppCompatActivity {
// Atributos da classe - Elementos do Layout
RadioGroup radioGroup;
RadioButton radioButton1;
RadioButton radioButton2;
RadioButton radioButton3;
TextView questionText;
// Listas de RadioButtons e Perguntas
List<RadioButton> listRadioButtons;
ArrayList<Question> listQuestions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Endereço da base de perguntas
String url = "http://www.json-generator.com/api/json/get/coUPnGlShu?indent=2";
// Inicia a lista de Perguntas
listQuestions = new ArrayList<>();
// Método que faz o link entre os atributos da classe e os ids de elementos do layout
bindViews();
// Inicia a lista de RadioButtons e adiciona na lista
listRadioButtons = new ArrayList<RadioButton>();
listRadioButtons.add(radioButton1);
listRadioButtons.add(radioButton2);
listRadioButtons.add(radioButton3);
// Faz a consulta na base de perguntas
new JsonTask().execute(url);
// Evento que captura o click em qualquer RadioButton
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if (i == R.id.radioButton1){
selectRadioButton(radioButton1);
Log.i("Radio", "Radio 1");
}
if (i == R.id.radioButton2){
selectRadioButton(radioButton2);
Log.i("Radio", "Radio 2");
}
if (i == R.id.radioButton3){
selectRadioButton(radioButton3);
Log.i("Radio", "Radio 3");
}
}
});
}
// Método que faz o link entre os atributos da classe e os ids de elementos do layout
private void bindViews () {
radioGroup = findViewById(R.id.radioGroup);
radioButton1 = findViewById(R.id.radioButton1);
radioButton2 = findViewById(R.id.radioButton2);
radioButton3 = findViewById(R.id.radioButton3);
questionText = findViewById(R.id.questionText);
}
// Método que altera as cores do RadioButton de acordo com o click
private void selectRadioButton (RadioButton radioButton) {
// Forma atualizada - ContextCompat.getColor(context, R.color.color_name)
radioButton.setTextColor(getResources().getColor(R.color.accent));
// Loop na lista de RadioButtons
// Verifica se o elemento da iteração está marcado
// Se não muda a cor
for (RadioButton radio : listRadioButtons) {
Log.i("Radio", radio.toString() + " " + radio.isChecked());
if(radio.isChecked())
validarResposta(radio);
if (!radio.isChecked())
radio.setTextColor(getResources().getColor(R.color.primaryText));
}
}
private void atualizaLayout(){
Log.i("Debug", listQuestions.get(0).getQuestion());
questionText.setText(listQuestions.get(0).getQuestion());
radioButton1.setText(listQuestions.get(0).getOption1());
radioButton2.setText(listQuestions.get(0).getOption2());
radioButton3.setText(listQuestions.get(0).getOption3());
}
// Comparar o opção com a resposta correta
private void validarResposta(RadioButton radioChecked){
int respostaCorreta = listQuestions.get(0).getAnswer();
Log.i("Resposta", (String) radioChecked.getText() + " " + respostaCorreta);
}
// Classe interna que faz a requisição na base de dados de perguntas
public class JsonTask extends AsyncTask<String, String, String> {
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected String doInBackground(String... params) {
HttpURLConnection connection = null;
BufferedReader reader = null;
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
InputStream stream = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(stream));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
buffer.append(line+"\n");
Log.d("Response: ", "> " + line);
}
return buffer.toString();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.disconnect();
}
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
Log.i("Questions"," " + result);
try {
JSONObject listaJson = new JSONObject(result);
JSONArray questions = listaJson.getJSONArray("questions");
// Mapeamento da base de dados com o modelo
for (int i = 0 ; i < questions.length() ; i ++) {
JSONObject question = questions.getJSONObject(i);
String pergunta = question.getString("question");
String opt1 = question.getString("option1");
String opt2 = question.getString("option2");
String opt3 = question.getString("option3");
int answer = question.getInt("answer");
Question questionModel = new Question(pergunta, opt1, opt2, opt3, answer);
listQuestions.add(questionModel);
}
atualizaLayout();
Log.i("Question Main", listQuestions.get(0).getOption2());
}catch (JSONException e){e.printStackTrace();}
}
}
}
| 7,297 | 0.594372 | 0.58792 | 214 | 33.037384 | 25.136423 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542056 | false | false | 2 |
db52b0b73581a0edd6a3b8d4dd980629af21307b | 13,030,930,803,864 | 728463de02b9911b8cf7b54b575cad6c224daa8e | /app/src/main/java/com/tutorial/ScientToolsApp/AdapterClass.java | 271fe6e03b20ae1b7e4cd31d20251542cbdd4b51 | [] | no_license | dharshini28/ScientToolsApp | https://github.com/dharshini28/ScientToolsApp | 8d0aafca65aca017c3544eff4c67a9cdd8b277b3 | 7ac3137c34cf22406edc821e6dbcd293cb69b2c0 | refs/heads/master | 2020-12-01T12:40:37.328000 | 2020-01-03T10:23:47 | 2020-01-03T10:23:47 | 230,628,519 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tutorial.ScientToolsApp;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.support.annotation.NonNull;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
public class AdapterClass extends RecyclerView.Adapter<AdapterClass.MyViewHolder> {
ArrayList<username> list;
public AdapterClass(ArrayList<username> list){
this.list = list;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup,int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.listlayout,viewGroup,false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder,int i) {
myViewHolder.name.setText(list.get(i).getName());
myViewHolder.rollno.setText(list.get(i).getRollno());
}
@Override
public int getItemCount() {
return list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView name,rollno;
public MyViewHolder(@NonNull View ItemView){
super(ItemView);
name = itemView.findViewById(R.id.tvname);
rollno = itemView.findViewById(R.id.tvrollno);
}
}
}
| UTF-8 | Java | 1,347 | java | AdapterClass.java | Java | [] | null | [] | package com.tutorial.ScientToolsApp;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.support.annotation.NonNull;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
public class AdapterClass extends RecyclerView.Adapter<AdapterClass.MyViewHolder> {
ArrayList<username> list;
public AdapterClass(ArrayList<username> list){
this.list = list;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup,int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.listlayout,viewGroup,false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder,int i) {
myViewHolder.name.setText(list.get(i).getName());
myViewHolder.rollno.setText(list.get(i).getRollno());
}
@Override
public int getItemCount() {
return list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView name,rollno;
public MyViewHolder(@NonNull View ItemView){
super(ItemView);
name = itemView.findViewById(R.id.tvname);
rollno = itemView.findViewById(R.id.tvrollno);
}
}
}
| 1,347 | 0.702301 | 0.701559 | 45 | 28.933332 | 26.524118 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 2 |
babaa92aea49256ecc826544d929aa3240c2128e | 15,272,903,731,662 | a22453585ed2860bc2a2945b2d1745d3791306ce | /partition/src/com/internousdev/partition/dao/GoItemDetailDAO.java | 5f3907d162fcd863bfee2ffb42f5b083520c87fc | [] | no_license | internousdevwork/partition | https://github.com/internousdevwork/partition | a5ead7f5b39499a7b438235b53c7b90ee4dc5d39 | 9de35683ac8b4f19501ce8613876d8a2fd93e829 | refs/heads/master | 2019-07-08T07:55:54.954000 | 2017-04-28T07:04:06 | 2017-04-28T07:04:06 | 88,596,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.internousdev.partition.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.internousdev.partition.dto.ItemDTO;
import com.internousdev.partition.util.DBConnector;
/**DBから商品情報を取得するクラス
* @author NAOKO IZUMI
*
*/
public class GoItemDetailDAO {
/**
* item_idによりDBから商品情報を取得するメソッド
* @param itemId 商品ID
* @return itemList 商品情報が入ったリストを返す
*/
public ArrayList<ItemDTO> select (int itemId){
DBConnector db = new DBConnector("partition");
Connection con = db.getConnection();
ItemDTO dto = new ItemDTO();
ArrayList<ItemDTO> itemList = new ArrayList<ItemDTO>();
String sql = "select * from item where item_id=?";
try{
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, itemId);
ResultSet rs = ps.executeQuery();
while(rs.next()){
dto.setItemId(rs.getInt("item_id"));
dto.setItemName(rs.getString("item_name"));
dto.setImgAddress(rs.getString("img_address"));
dto.setPrice(rs.getFloat("price"));
dto.setItemCategory(rs.getInt("item_category"));
dto.setOverview(rs.getString("overview"));
itemList.add(dto);
}
}catch(SQLException e){
e.printStackTrace();
}
try{
con.close();
}catch(SQLException e){
e.printStackTrace();
}
return itemList;
}
}
| UTF-8 | Java | 1,526 | java | GoItemDetailDAO.java | Java | [
{
"context": "il.DBConnector;\r\n\r\n/**DBから商品情報を取得するクラス\r\n * @author NAOKO IZUMI\r\n *\r\n */\r\npublic class GoItemDetailDAO {\r\n\r\n\t/**\r",
"end": 358,
"score": 0.9987600445747375,
"start": 347,
"tag": "NAME",
"value": "NAOKO IZUMI"
}
] | null | [] | /**
*
*/
package com.internousdev.partition.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.internousdev.partition.dto.ItemDTO;
import com.internousdev.partition.util.DBConnector;
/**DBから商品情報を取得するクラス
* @author <NAME>
*
*/
public class GoItemDetailDAO {
/**
* item_idによりDBから商品情報を取得するメソッド
* @param itemId 商品ID
* @return itemList 商品情報が入ったリストを返す
*/
public ArrayList<ItemDTO> select (int itemId){
DBConnector db = new DBConnector("partition");
Connection con = db.getConnection();
ItemDTO dto = new ItemDTO();
ArrayList<ItemDTO> itemList = new ArrayList<ItemDTO>();
String sql = "select * from item where item_id=?";
try{
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, itemId);
ResultSet rs = ps.executeQuery();
while(rs.next()){
dto.setItemId(rs.getInt("item_id"));
dto.setItemName(rs.getString("item_name"));
dto.setImgAddress(rs.getString("img_address"));
dto.setPrice(rs.getFloat("price"));
dto.setItemCategory(rs.getInt("item_category"));
dto.setOverview(rs.getString("overview"));
itemList.add(dto);
}
}catch(SQLException e){
e.printStackTrace();
}
try{
con.close();
}catch(SQLException e){
e.printStackTrace();
}
return itemList;
}
}
| 1,521 | 0.672727 | 0.672028 | 58 | 22.655172 | 18.133177 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.913793 | false | false | 2 |
d667517cfb01930b1d759af17230f87e33ebea9f | 14,671,608,339,647 | 0c2352c06062e92c19b3e2698e7e98cea1453c19 | /app/system/TimeUtil.java | 02d76fcc2de8fb714ec4c2673d0c25cbf1c585e3 | [] | no_license | dioh76/ProjectMSrv | https://github.com/dioh76/ProjectMSrv | 332424323d7b8a5f8ab4260f7466531ba7848380 | b7b86b32f746726fc6f40ec88dc87e02f9ab648e | refs/heads/master | 2020-05-20T19:25:41.680000 | 2014-03-16T10:19:27 | 2014-03-16T10:19:27 | 13,914,421 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package system;
import java.sql.Timestamp;
import java.util.Calendar;
public final class TimeUtil {
public static long getCurrent()
{
return Calendar.getInstance().getTime().getTime();
}
public static long diffFromNow( Timestamp rhs )
{
Timestamp now = new Timestamp( TimeUtil.getCurrent() );
return now.getTime() - rhs.getTime();
}
public static long toDay( long day )
{
return day * 24L * 60L * 60L * 1000L;
}
public static long second( long sec ) {
return sec * 1000L;
}
public static long minute( long min ) {
return min * 60L * 1000L;
}
} | UTF-8 | Java | 579 | java | TimeUtil.java | Java | [] | null | [] | package system;
import java.sql.Timestamp;
import java.util.Calendar;
public final class TimeUtil {
public static long getCurrent()
{
return Calendar.getInstance().getTime().getTime();
}
public static long diffFromNow( Timestamp rhs )
{
Timestamp now = new Timestamp( TimeUtil.getCurrent() );
return now.getTime() - rhs.getTime();
}
public static long toDay( long day )
{
return day * 24L * 60L * 60L * 1000L;
}
public static long second( long sec ) {
return sec * 1000L;
}
public static long minute( long min ) {
return min * 60L * 1000L;
}
} | 579 | 0.678756 | 0.644214 | 31 | 17.709677 | 18.66028 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.225806 | false | false | 2 |
2d44ca259b22128762507493a676ccd2bbd9bf9a | 395,137,025,408 | 7ab1f64793c4d8b30b1eff6ec0a4df87883065ad | /awesome-netty-zk/src/main/java/org/north/netty/zk/utils/CreateMode.java | 89522262d70ffbe3e753d06db98290763856bc72 | [] | no_license | wangyaoDgit/awesome-netty | https://github.com/wangyaoDgit/awesome-netty | 7cd16b10c89305d40e3abc4005671929fbbccce8 | f039e701cc0e43d96f2df59eb67d9d90691011c8 | refs/heads/master | 2021-02-05T16:39:29.580000 | 2019-11-25T04:20:32 | 2019-11-25T04:20:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.north.netty.zk.utils;
public enum CreateMode {
/**
* 永久性节点
*/
PERSISTENT (0),
/**
* 永久性顺序节点
*/
PERSISTENT_SEQUENTIAL (2),
/**
* 临时节点
*/
EPHEMERAL (1),
/**
* 临时顺序节点
*/
EPHEMERAL_SEQUENTIAL (3);
private int flag;
CreateMode(int flag){
this.flag = flag;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
}
| UTF-8 | Java | 529 | java | CreateMode.java | Java | [] | null | [] | package org.north.netty.zk.utils;
public enum CreateMode {
/**
* 永久性节点
*/
PERSISTENT (0),
/**
* 永久性顺序节点
*/
PERSISTENT_SEQUENTIAL (2),
/**
* 临时节点
*/
EPHEMERAL (1),
/**
* 临时顺序节点
*/
EPHEMERAL_SEQUENTIAL (3);
private int flag;
CreateMode(int flag){
this.flag = flag;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
}
| 529 | 0.486598 | 0.478351 | 32 | 14.15625 | 10.338367 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28125 | false | false | 2 |
a57e9ec8f35ac27ac1e14ae567bcc8f03dfe0d32 | 32,736,240,766,071 | fc93278413fd53239cbbb24de4e0545d7416a2fd | /src/ihm/FenetrePrincipale.java | 0d01c4c7fc17cf8dd3e152a4a150926202e70cc8 | [] | no_license | mpira/fitness | https://github.com/mpira/fitness | 0baa33d21eeec86e1e3819a488eafea3f5236550 | cd04b026dd57ba494022e3e369d0d69cdf76604b | refs/heads/master | 2021-01-25T12:14:30.832000 | 2014-06-02T17:14:06 | 2014-06-02T17:14:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ihm;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.Spring;
import javax.swing.SpringLayout;
import javax.swing.border.Border;
public class FenetrePrincipale extends JFrame{
private JLabel lb_titre=null;
private JButton btn_conf=null;
private JButton btn_annuler=null;
private JPanel container=new JPanel();
private Dimension dim_label=new Dimension(150,25);
private Dimension dim_bouton=new Dimension(100,25);
private Dimension dim_comp=new Dimension(80,35);
private GridLayout gl=new GridLayout(4,2,30,30);
private JButton cours=new JButton("Cours collectifs");
private JButton membres=new JButton("Membres");
private JButton guests=new JButton("Guests");
private JButton produit=new JButton("Produits");
private JButton coach=new JButton("Coachs");
private JButton employe=new JButton("Employés");
private JButton prof=new JButton("Professeurs cours");
private DefaultComboBoxModel comboModel;
private JComboBox combo;
private Font font=new Font("Verdana", Font.BOLD, 24);
private Font font2=new Font("Script",Font.BOLD,24);
private Font font3=new Font("Comic Sans",Font.BOLD,24);
private JButton ajoutMembre=new JButton("Ajouter");
private JButton modifierMembre=new JButton("Modifier");
private JPanel panMembre=new JPanel();
private JPanel containerCentre=new JPanel();
public FenetrePrincipale(){
super();
build();
}
private void build() {
this.setTitle("Fitness Club");
this.setSize(300,250);
this.setLocationRelativeTo(null);
this.setResizable(false);
//Je modifie l'icone de la fenetre
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CardLayout cl = new CardLayout();
//Liste des noms de nos conteneurs pour la pile de cartes
container.setLayout(new BorderLayout());
lb_titre=new JLabel("FITNESS CLUB");
lb_titre.setHorizontalAlignment(JLabel.CENTER);
lb_titre.setPreferredSize(new Dimension(400,75));
lb_titre.setFont(new Font("Verdana",Font.BOLD,32));
lb_titre.setForeground(Color.BLACK);
//lb_titre.setBackground(Color.WHITE);
lb_titre.setOpaque(true);
container.setBackground(Color.magenta);
container.add(lb_titre , BorderLayout.NORTH);
//Ici je rajoute les bouton dans des panels pour pouvoir rajouter des composant dans groupés avc mon bouton
//Bouton Membres
containerCentre.setLayout(gl);
membres.setBackground(Color.YELLOW);
membres.setFont(font);
membres.setEnabled(false);
panMembre.setLayout(new BorderLayout());
panMembre.add(membres,BorderLayout.CENTER);
panMembre.add(ajoutMembre,BorderLayout.SOUTH);
panMembre.add(modifierMembre,BorderLayout.NORTH);
containerCentre.add(panMembre);
guests.setBackground(Color.YELLOW);
guests.setFont(font);
containerCentre.add(guests);
cours.setBackground(Color.YELLOW);
cours.setFont(font);
containerCentre.add(cours);
prof.setBackground(Color.YELLOW);
prof.setFont(font);
containerCentre.add(prof);
employe.setBackground(Color.YELLOW);
employe.setFont(font);
containerCentre.add(employe);
coach.setBackground(Color.YELLOW);
coach.setFont(font);
containerCentre.add(coach);
produit.setBackground(Color.YELLOW);
produit.setFont(font);
containerCentre.add(produit);
comboModel=new DefaultComboBoxModel();
comboModel.addElement("Theme par Defaut");
comboModel.addElement("Theme 1");
comboModel.addElement("Theme 2");
combo=new JComboBox(comboModel);
combo.setBackground(Color.BLACK);
combo.setForeground(Color.YELLOW);
combo.setFont(font);
containerCentre.add(combo);
combo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JComboBox combo=(JComboBox) event.getSource();
System.out.println("Selected Item = " + combo.getSelectedItem());
if("Theme 1".equals(combo.getSelectedItem())){
membres.setBackground(Color.RED);
membres.setFont(font2);
membres.setForeground(Color.BLACK);
cours.setBackground(Color.RED);
cours.setFont(font2);
cours.setForeground(Color.BLACK);
prof.setBackground(Color.RED);
prof.setFont(font2);
prof.setForeground(Color.BLACK);
coach.setBackground(Color.RED);
coach.setFont(font2);
coach.setForeground(Color.BLACK);
guests.setBackground(Color.RED);
guests.setFont(font2);
guests.setForeground(Color.BLACK);
produit.setBackground(Color.RED);
produit.setFont(font2);
produit.setForeground(Color.BLACK);
employe.setBackground(Color.RED);
employe.setFont(font2);
employe.setForeground(Color.BLACK);
containerCentre.setBackground(Color.WHITE);
}
else if("Theme 2".equals(combo.getSelectedItem())){
membres.setBackground(Color.blue);
membres.setFont(font3);
membres.setForeground(Color.YELLOW);
cours.setBackground(Color.blue);
cours.setFont(font3);
cours.setForeground(Color.YELLOW);
prof.setBackground(Color.blue);
prof.setFont(font3);
prof.setForeground(Color.YELLOW);
coach.setBackground(Color.blue);
coach.setFont(font3);
coach.setForeground(Color.YELLOW);
guests.setBackground(Color.blue);
guests.setFont(font3);
guests.setForeground(Color.YELLOW);
produit.setBackground(Color.blue);
produit.setFont(font3);
produit.setForeground(Color.YELLOW);
employe.setBackground(Color.blue);
employe.setFont(font3);
employe.setForeground(Color.YELLOW);
containerCentre.setBackground(Color.green);
}else{
membres.setBackground(Color.YELLOW);
membres.setFont(font);
membres.setForeground(Color.BLACK);
guests.setBackground(Color.YELLOW);
guests.setFont(font);
guests.setForeground(Color.BLACK);
cours.setBackground(Color.YELLOW);
cours.setFont(font);
cours.setForeground(Color.BLACK);
prof.setBackground(Color.YELLOW);
prof.setFont(font);
prof.setForeground(Color.BLACK);
employe.setBackground(Color.YELLOW);
employe.setFont(font);
employe.setForeground(Color.BLACK);
coach.setBackground(Color.YELLOW);
coach.setFont(font);
coach.setForeground(Color.BLACK);
produit.setBackground(Color.YELLOW);
produit.setFont(font);
produit.setForeground(Color.BLACK);
containerCentre.setBackground(Color.lightGray);
}
}
});
container.add(containerCentre,BorderLayout.CENTER);
//container.add(label2);
//container.add(jtf);
ImageIcon icone = new ImageIcon("images/IMG_4437.PNG");
JLabel image = new JLabel(icone);
container.add(image,BorderLayout.WEST);
this.setContentPane(container);
this.pack();
this.setVisible(true);
}
}
| ISO-8859-1 | Java | 7,672 | java | FenetrePrincipale.java | Java | [] | null | [] | package ihm;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.Spring;
import javax.swing.SpringLayout;
import javax.swing.border.Border;
public class FenetrePrincipale extends JFrame{
private JLabel lb_titre=null;
private JButton btn_conf=null;
private JButton btn_annuler=null;
private JPanel container=new JPanel();
private Dimension dim_label=new Dimension(150,25);
private Dimension dim_bouton=new Dimension(100,25);
private Dimension dim_comp=new Dimension(80,35);
private GridLayout gl=new GridLayout(4,2,30,30);
private JButton cours=new JButton("Cours collectifs");
private JButton membres=new JButton("Membres");
private JButton guests=new JButton("Guests");
private JButton produit=new JButton("Produits");
private JButton coach=new JButton("Coachs");
private JButton employe=new JButton("Employés");
private JButton prof=new JButton("Professeurs cours");
private DefaultComboBoxModel comboModel;
private JComboBox combo;
private Font font=new Font("Verdana", Font.BOLD, 24);
private Font font2=new Font("Script",Font.BOLD,24);
private Font font3=new Font("Comic Sans",Font.BOLD,24);
private JButton ajoutMembre=new JButton("Ajouter");
private JButton modifierMembre=new JButton("Modifier");
private JPanel panMembre=new JPanel();
private JPanel containerCentre=new JPanel();
public FenetrePrincipale(){
super();
build();
}
private void build() {
this.setTitle("Fitness Club");
this.setSize(300,250);
this.setLocationRelativeTo(null);
this.setResizable(false);
//Je modifie l'icone de la fenetre
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CardLayout cl = new CardLayout();
//Liste des noms de nos conteneurs pour la pile de cartes
container.setLayout(new BorderLayout());
lb_titre=new JLabel("FITNESS CLUB");
lb_titre.setHorizontalAlignment(JLabel.CENTER);
lb_titre.setPreferredSize(new Dimension(400,75));
lb_titre.setFont(new Font("Verdana",Font.BOLD,32));
lb_titre.setForeground(Color.BLACK);
//lb_titre.setBackground(Color.WHITE);
lb_titre.setOpaque(true);
container.setBackground(Color.magenta);
container.add(lb_titre , BorderLayout.NORTH);
//Ici je rajoute les bouton dans des panels pour pouvoir rajouter des composant dans groupés avc mon bouton
//Bouton Membres
containerCentre.setLayout(gl);
membres.setBackground(Color.YELLOW);
membres.setFont(font);
membres.setEnabled(false);
panMembre.setLayout(new BorderLayout());
panMembre.add(membres,BorderLayout.CENTER);
panMembre.add(ajoutMembre,BorderLayout.SOUTH);
panMembre.add(modifierMembre,BorderLayout.NORTH);
containerCentre.add(panMembre);
guests.setBackground(Color.YELLOW);
guests.setFont(font);
containerCentre.add(guests);
cours.setBackground(Color.YELLOW);
cours.setFont(font);
containerCentre.add(cours);
prof.setBackground(Color.YELLOW);
prof.setFont(font);
containerCentre.add(prof);
employe.setBackground(Color.YELLOW);
employe.setFont(font);
containerCentre.add(employe);
coach.setBackground(Color.YELLOW);
coach.setFont(font);
containerCentre.add(coach);
produit.setBackground(Color.YELLOW);
produit.setFont(font);
containerCentre.add(produit);
comboModel=new DefaultComboBoxModel();
comboModel.addElement("Theme par Defaut");
comboModel.addElement("Theme 1");
comboModel.addElement("Theme 2");
combo=new JComboBox(comboModel);
combo.setBackground(Color.BLACK);
combo.setForeground(Color.YELLOW);
combo.setFont(font);
containerCentre.add(combo);
combo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JComboBox combo=(JComboBox) event.getSource();
System.out.println("Selected Item = " + combo.getSelectedItem());
if("Theme 1".equals(combo.getSelectedItem())){
membres.setBackground(Color.RED);
membres.setFont(font2);
membres.setForeground(Color.BLACK);
cours.setBackground(Color.RED);
cours.setFont(font2);
cours.setForeground(Color.BLACK);
prof.setBackground(Color.RED);
prof.setFont(font2);
prof.setForeground(Color.BLACK);
coach.setBackground(Color.RED);
coach.setFont(font2);
coach.setForeground(Color.BLACK);
guests.setBackground(Color.RED);
guests.setFont(font2);
guests.setForeground(Color.BLACK);
produit.setBackground(Color.RED);
produit.setFont(font2);
produit.setForeground(Color.BLACK);
employe.setBackground(Color.RED);
employe.setFont(font2);
employe.setForeground(Color.BLACK);
containerCentre.setBackground(Color.WHITE);
}
else if("Theme 2".equals(combo.getSelectedItem())){
membres.setBackground(Color.blue);
membres.setFont(font3);
membres.setForeground(Color.YELLOW);
cours.setBackground(Color.blue);
cours.setFont(font3);
cours.setForeground(Color.YELLOW);
prof.setBackground(Color.blue);
prof.setFont(font3);
prof.setForeground(Color.YELLOW);
coach.setBackground(Color.blue);
coach.setFont(font3);
coach.setForeground(Color.YELLOW);
guests.setBackground(Color.blue);
guests.setFont(font3);
guests.setForeground(Color.YELLOW);
produit.setBackground(Color.blue);
produit.setFont(font3);
produit.setForeground(Color.YELLOW);
employe.setBackground(Color.blue);
employe.setFont(font3);
employe.setForeground(Color.YELLOW);
containerCentre.setBackground(Color.green);
}else{
membres.setBackground(Color.YELLOW);
membres.setFont(font);
membres.setForeground(Color.BLACK);
guests.setBackground(Color.YELLOW);
guests.setFont(font);
guests.setForeground(Color.BLACK);
cours.setBackground(Color.YELLOW);
cours.setFont(font);
cours.setForeground(Color.BLACK);
prof.setBackground(Color.YELLOW);
prof.setFont(font);
prof.setForeground(Color.BLACK);
employe.setBackground(Color.YELLOW);
employe.setFont(font);
employe.setForeground(Color.BLACK);
coach.setBackground(Color.YELLOW);
coach.setFont(font);
coach.setForeground(Color.BLACK);
produit.setBackground(Color.YELLOW);
produit.setFont(font);
produit.setForeground(Color.BLACK);
containerCentre.setBackground(Color.lightGray);
}
}
});
container.add(containerCentre,BorderLayout.CENTER);
//container.add(label2);
//container.add(jtf);
ImageIcon icone = new ImageIcon("images/IMG_4437.PNG");
JLabel image = new JLabel(icone);
container.add(image,BorderLayout.WEST);
this.setContentPane(container);
this.pack();
this.setVisible(true);
}
}
| 7,672 | 0.716036 | 0.707692 | 234 | 31.777779 | 16.328157 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.863248 | false | false | 2 |
c89eabf0b349d77d28ea5719a53d44c8021c2469 | 32,736,240,766,742 | eec95da0ecae61a5ef13858083c04f5f49a17fd6 | /gulimall-ums/src/main/java/com/atguigu/gulimall/ums/dao/MemberCollectSubjectDao.java | 3fc0a4333d04eb7ef3cf98d836c11ba8a60bbd19 | [
"Apache-2.0"
] | permissive | cccchenzinan/gulimall | https://github.com/cccchenzinan/gulimall | a874e5a1cdfadfa837f4f01b27a3bec7f0ec45ac | 7f87f74bebec36df37d25bf5c459b3c75f72cc32 | refs/heads/master | 2022-07-25T16:29:32.980000 | 2019-08-02T14:40:48 | 2019-08-02T14:40:48 | 200,005,453 | 0 | 0 | Apache-2.0 | false | 2022-06-21T01:34:57 | 2019-08-01T08:00:32 | 2019-08-02T14:41:16 | 2022-06-21T01:34:54 | 2,714 | 0 | 0 | 12 | JavaScript | false | false | package com.atguigu.gulimall.ums.dao;
import com.atguigu.gulimall.ums.entity.MemberCollectSubjectEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 会员收藏的专题活动
*
* @author chenzinan
* @email kukuchenzinan@outlook.com
* @date 2019-08-01 18:54:51
*/
@Mapper
public interface MemberCollectSubjectDao extends BaseMapper<MemberCollectSubjectEntity> {
}
| UTF-8 | Java | 439 | java | MemberCollectSubjectDao.java | Java | [
{
"context": "notations.Mapper;\n\n/**\n * 会员收藏的专题活动\n * \n * @author chenzinan\n * @email kukuchenzinan@outlook.com\n * @date 2019",
"end": 249,
"score": 0.9996647834777832,
"start": 240,
"tag": "USERNAME",
"value": "chenzinan"
},
{
"context": "**\n * 会员收藏的专题活动\n * \n * @author chen... | null | [] | package com.atguigu.gulimall.ums.dao;
import com.atguigu.gulimall.ums.entity.MemberCollectSubjectEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 会员收藏的专题活动
*
* @author chenzinan
* @email <EMAIL>
* @date 2019-08-01 18:54:51
*/
@Mapper
public interface MemberCollectSubjectDao extends BaseMapper<MemberCollectSubjectEntity> {
}
| 421 | 0.790974 | 0.75772 | 17 | 23.764706 | 26.16358 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false | 2 |
5503c6f309a519adecb41ae8ad48c88c86478dcc | 26,620,207,321,512 | 609931e525525f33e5abc489be5b4cf6abff5b1e | /yiban-framework-core_1.7/src/main/java/com/yiban/framework/core/configure/WebappConfiguration.java | 02c2fdb982aa47c216d9f53fb662d83083a6852c | [] | no_license | bellmit/reconciliation-flow | https://github.com/bellmit/reconciliation-flow | 7961b0ac8279926772ba3aa631899c05ccfb0ad1 | e9f2a3b144011709fecfc1a5decb7bcc469c82f4 | refs/heads/master | 2023-08-07T22:52:52.846000 | 2021-09-14T02:24:57 | 2021-09-14T02:24:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yiban.framework.core.configure;
import javax.servlet.Filter;
import javax.servlet.MultipartConfigElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
@Configuration
@ConditionalOnWebApplication
public class WebappConfiguration extends WebMvcConfigurerAdapter {
private static Logger LOGGER = LoggerFactory.getLogger(WebappConfiguration.class);
@Bean
public Filter characterEncodingFilter() {
final CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding(Charsets.UTF_8.name());
characterEncodingFilter.setForceEncoding(true);
return characterEncodingFilter;
}
@Bean
public StringHttpMessageConverter stringHttpMessageConverter() {
return new StringHttpMessageConverter(Charsets.UTF_8);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setSupportedMediaTypes(ImmutableList.of(MediaType.TEXT_HTML, MediaType.APPLICATION_JSON));
return converter;
}
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
String maxFileSize = "10MB";
String maxRequestSize = "10MB";
LOGGER.info("multipart.max-file-size: {}, multipart.max-file-size: {}", maxFileSize, maxRequestSize);
factory.setMaxFileSize(maxFileSize);
factory.setMaxRequestSize(maxRequestSize);
return factory.createMultipartConfig();
}
/**
* 拦截器设置
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
}
}
| UTF-8 | Java | 2,429 | java | WebappConfiguration.java | Java | [] | null | [] | package com.yiban.framework.core.configure;
import javax.servlet.Filter;
import javax.servlet.MultipartConfigElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
@Configuration
@ConditionalOnWebApplication
public class WebappConfiguration extends WebMvcConfigurerAdapter {
private static Logger LOGGER = LoggerFactory.getLogger(WebappConfiguration.class);
@Bean
public Filter characterEncodingFilter() {
final CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding(Charsets.UTF_8.name());
characterEncodingFilter.setForceEncoding(true);
return characterEncodingFilter;
}
@Bean
public StringHttpMessageConverter stringHttpMessageConverter() {
return new StringHttpMessageConverter(Charsets.UTF_8);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setSupportedMediaTypes(ImmutableList.of(MediaType.TEXT_HTML, MediaType.APPLICATION_JSON));
return converter;
}
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
String maxFileSize = "10MB";
String maxRequestSize = "10MB";
LOGGER.info("multipart.max-file-size: {}, multipart.max-file-size: {}", maxFileSize, maxRequestSize);
factory.setMaxFileSize(maxFileSize);
factory.setMaxRequestSize(maxRequestSize);
return factory.createMultipartConfig();
}
/**
* 拦截器设置
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
}
}
| 2,429 | 0.832989 | 0.828028 | 67 | 35.104477 | 31.657276 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.313433 | false | false | 2 |
040c32edfc7dedc3a88c3b066430f8f5368f79a8 | 26,620,207,320,005 | 6206e84a4744f0680c52d2400a190669c3bb6316 | /src/mensajeriarmi/objetos/Bodega.java | a4438ee820ca0c4c30a4f5e1e8e4aaebe1560ed6 | [] | no_license | Andresr31/mensajeriaRMI | https://github.com/Andresr31/mensajeriaRMI | e1a37c7fcc11c58ab21eac99c4182025c83b9728 | 5d9380bc54e3ccc6b45bbcba1c21280559f64c5b | refs/heads/master | 2022-06-13T13:22:49.863000 | 2020-05-05T05:00:29 | 2020-05-05T05:00:29 | 259,741,992 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mensajeriarmi.objetos;
import mensajeriarmi.bodega.*;
import mensajeriarmi.paquete.Paquete;
import java.rmi.*;
import java.util.ArrayList;
import mensajeriarmi.cliente.ClienteRMI;
import mensajeriarmi.paquete.Ubicacion;
/**
* @author Carlos Andres Rojas
* @author David Salgado Ospina
*/
public interface Bodega extends Remote{
public String almacenar(Paquete paquete)
throws RemoteException;
//agregar parametro => ubicacion ubicacion
public String solicitarEnvio(Ubicacion ubicacion, double capacidadTotal, ClienteRMI c)
throws RemoteException;
public ArrayList<Camion> obtenerRegistroCamiones()throws RemoteException;
}
| UTF-8 | Java | 877 | java | Bodega.java | Java | [
{
"context": "t mensajeriarmi.paquete.Ubicacion;\n\n/**\n * @author Carlos Andres Rojas\n * @author David Salgado Ospina\n */\npublic interf",
"end": 449,
"score": 0.9998924732208252,
"start": 430,
"tag": "NAME",
"value": "Carlos Andres Rojas"
},
{
"context": "on;\n\n/**\n * @author ... | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mensajeriarmi.objetos;
import mensajeriarmi.bodega.*;
import mensajeriarmi.paquete.Paquete;
import java.rmi.*;
import java.util.ArrayList;
import mensajeriarmi.cliente.ClienteRMI;
import mensajeriarmi.paquete.Ubicacion;
/**
* @author <NAME>
* @author <NAME>
*/
public interface Bodega extends Remote{
public String almacenar(Paquete paquete)
throws RemoteException;
//agregar parametro => ubicacion ubicacion
public String solicitarEnvio(Ubicacion ubicacion, double capacidadTotal, ClienteRMI c)
throws RemoteException;
public ArrayList<Camion> obtenerRegistroCamiones()throws RemoteException;
}
| 850 | 0.753706 | 0.753706 | 29 | 29.241379 | 24.665564 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517241 | false | false | 2 |
ea29abbc732a0849f4f4ce6910451b2f9bb71c84 | 13,520,557,081,959 | 1c1c24858085baf32cc76fc1eb24e503f03988ca | /src/java/com/lateroad/bank/controller/StatisticsController.java | bc3fa95de092f2b740d5092c19f2f45b869cf771 | [] | no_license | LateRoad/Internet-Banking-Client | https://github.com/LateRoad/Internet-Banking-Client | 19886cc98f80f7cd5b7db1842a21b06501ed2d78 | 8e344facb3b74be8009c952075a4af5b0db6a0a8 | refs/heads/master | 2021-04-06T10:52:25.230000 | 2018-03-09T19:00:51 | 2018-03-09T19:00:51 | 124,581,626 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lateroad.bank.controller;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import java.net.URL;
import java.util.ResourceBundle;
public class StatisticsController implements Initializable{
@FXML
private LineChart<?, ?> lineChart;
@FXML
private CategoryAxis x;
@FXML
private NumberAxis y;
@Override
public void initialize(URL location, ResourceBundle resources) {
XYChart.Series series = new XYChart.Series();
series.getData().add(new XYChart.Data<>("12/10/17", 10));
series.getData().add(new XYChart.Data<>("13/10/17", 40));
series.getData().add(new XYChart.Data<>("14/10/17", 70));
series.getData().add(new XYChart.Data<>("15/10/17", 65));
series.getData().add(new XYChart.Data<>("16/11/17", 69));
series.getData().add(new XYChart.Data<>("20/11/17", 100));
series.getData().add(new XYChart.Data<>("25/11/17", 120));
series.setName("График переводов");
lineChart.getData().addAll(series);
}
}
| UTF-8 | Java | 1,204 | java | StatisticsController.java | Java | [] | null | [] | package com.lateroad.bank.controller;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import java.net.URL;
import java.util.ResourceBundle;
public class StatisticsController implements Initializable{
@FXML
private LineChart<?, ?> lineChart;
@FXML
private CategoryAxis x;
@FXML
private NumberAxis y;
@Override
public void initialize(URL location, ResourceBundle resources) {
XYChart.Series series = new XYChart.Series();
series.getData().add(new XYChart.Data<>("12/10/17", 10));
series.getData().add(new XYChart.Data<>("13/10/17", 40));
series.getData().add(new XYChart.Data<>("14/10/17", 70));
series.getData().add(new XYChart.Data<>("15/10/17", 65));
series.getData().add(new XYChart.Data<>("16/11/17", 69));
series.getData().add(new XYChart.Data<>("20/11/17", 100));
series.getData().add(new XYChart.Data<>("25/11/17", 120));
series.setName("График переводов");
lineChart.getData().addAll(series);
}
}
| 1,204 | 0.673675 | 0.624895 | 38 | 30.289474 | 24.398994 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.815789 | false | false | 2 |
44d321649234329b3e5c6d91e291c3514a18a90e | 2,482,491,121,771 | 6f05f7d5a67b6bb87956a22b988067ec772ba966 | /data/test/java/17405a20c3aac16befd4b6704981aa0b55a1abbaProcessServiceImpl.java | 437e2196a782887b938eec5bf50b8d2c355c0ace | [
"MIT"
] | permissive | harshp8l/deep-learning-lang-detection | https://github.com/harshp8l/deep-learning-lang-detection | 93b6d24a38081597c610ecf9b1f3b92c7d669be5 | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | refs/heads/master | 2020-04-07T18:07:00.697000 | 2018-11-29T23:21:23 | 2018-11-29T23:21:23 | 158,597,498 | 0 | 0 | MIT | true | 2018-11-21T19:36:42 | 2018-11-21T19:36:41 | 2018-10-25T04:08:03 | 2018-08-24T13:01:04 | 42,815 | 0 | 0 | 0 | null | false | null | package com.zh.web.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.zh.core.model.Pager;
import com.zh.web.dao.ProcessDao;
import com.zh.web.model.bean.ProcessBean;
import com.zh.web.service.ProcessService;
@Component("processService")
public class ProcessServiceImpl implements ProcessService {
@Autowired
private ProcessDao processDao;
@Override
public ProcessBean query(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.query(process);
}
@Override
public void update(ProcessBean process) {
// TODO Auto-generated method stub
processDao.update(process);
}
@Override
public List<ProcessBean> queryList(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.queryList(process);
}
@Override
public List<ProcessBean> queryList(ProcessBean process, Pager page) {
// TODO Auto-generated method stub
return processDao.queryPageList(process, page);
}
@Override
public Integer count(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.count(process);
}
@Override
public void delete(ProcessBean process) {
// TODO Auto-generated method stub
processDao.delete(process);
}
@Override
public Integer insert(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.insert(process);
}
}
| UTF-8 | Java | 1,439 | java | 17405a20c3aac16befd4b6704981aa0b55a1abbaProcessServiceImpl.java | Java | [] | null | [] | package com.zh.web.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.zh.core.model.Pager;
import com.zh.web.dao.ProcessDao;
import com.zh.web.model.bean.ProcessBean;
import com.zh.web.service.ProcessService;
@Component("processService")
public class ProcessServiceImpl implements ProcessService {
@Autowired
private ProcessDao processDao;
@Override
public ProcessBean query(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.query(process);
}
@Override
public void update(ProcessBean process) {
// TODO Auto-generated method stub
processDao.update(process);
}
@Override
public List<ProcessBean> queryList(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.queryList(process);
}
@Override
public List<ProcessBean> queryList(ProcessBean process, Pager page) {
// TODO Auto-generated method stub
return processDao.queryPageList(process, page);
}
@Override
public Integer count(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.count(process);
}
@Override
public void delete(ProcessBean process) {
// TODO Auto-generated method stub
processDao.delete(process);
}
@Override
public Integer insert(ProcessBean process) {
// TODO Auto-generated method stub
return processDao.insert(process);
}
}
| 1,439 | 0.770674 | 0.770674 | 61 | 22.590164 | 20.038795 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.147541 | false | false | 2 |
94514a6cd8873df5d3fe8875ef3a1c5ea1c94afd | 3,246,995,316,468 | 9f4e7f9e02ac31213121486ac95209c25ee65b17 | /app/src/main/java/com/ericyl/themedemo/util/DialogUtils.java | 285198c8ba420f4e73737b9860cd114d9e3f5388 | [] | no_license | hebin1016/ThemeDemo | https://github.com/hebin1016/ThemeDemo | 17e889f54b0103108780fe4c3308358b6b1f97e7 | 479a1bd4bfe2342a4261018b544eca0b31eb8246 | refs/heads/master | 2020-04-09T05:27:19.170000 | 2015-12-31T06:58:26 | 2015-12-31T06:58:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ericyl.themedemo.util;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import com.ericyl.themedemo.R;
/**
* Created by liangyu on 15/5/20.
*/
public class DialogUtils {
public static Dialog showDialogWithOneBtn(Context context, String title,
String msg) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setNeutralButton(context.getString(R.string.ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
dlg.cancel();
}
});
dialog = builder.create();
dialog.show();
return dialog;
}
public static Dialog showDialogWithOneBtn(Context context, String title,
String msg, String btnStr,
DialogInterface.OnClickListener btnListener) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setNeutralButton(btnStr, btnListener);
dialog = builder.create();
dialog.show();
return dialog;
}
public static Dialog showDialogWithTwoBtn(Context context, String title,
String msg, String btnStr,
DialogInterface.OnClickListener btnListener) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setPositiveButton(btnStr, btnListener);
builder.setNegativeButton(context.getString(R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
dialog = builder.create();
dialog.show();
return dialog;
}
public static Dialog showDialogWithTwoBtn(Context context, String title,
String msg, String okStr,
DialogInterface.OnClickListener okListener, String cancelStr,
DialogInterface.OnClickListener cancelListener) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setPositiveButton(okStr, okListener);
builder.setNegativeButton(cancelStr, cancelListener);
dialog = builder.create();
dialog.show();
return dialog;
}
}
| UTF-8 | Java | 3,072 | java | DialogUtils.java | Java | [
{
"context": "\nimport com.ericyl.themedemo.R;\n\n/**\n * Created by liangyu on 15/5/20.\n */\npublic class DialogUtils {\n\n p",
"end": 233,
"score": 0.9923846125602722,
"start": 226,
"tag": "USERNAME",
"value": "liangyu"
}
] | null | [] | package com.ericyl.themedemo.util;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import com.ericyl.themedemo.R;
/**
* Created by liangyu on 15/5/20.
*/
public class DialogUtils {
public static Dialog showDialogWithOneBtn(Context context, String title,
String msg) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setNeutralButton(context.getString(R.string.ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
dlg.cancel();
}
});
dialog = builder.create();
dialog.show();
return dialog;
}
public static Dialog showDialogWithOneBtn(Context context, String title,
String msg, String btnStr,
DialogInterface.OnClickListener btnListener) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setNeutralButton(btnStr, btnListener);
dialog = builder.create();
dialog.show();
return dialog;
}
public static Dialog showDialogWithTwoBtn(Context context, String title,
String msg, String btnStr,
DialogInterface.OnClickListener btnListener) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setPositiveButton(btnStr, btnListener);
builder.setNegativeButton(context.getString(R.string.cancel),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
dialog = builder.create();
dialog.show();
return dialog;
}
public static Dialog showDialogWithTwoBtn(Context context, String title,
String msg, String okStr,
DialogInterface.OnClickListener okListener, String cancelStr,
DialogInterface.OnClickListener cancelListener) {
Dialog dialog = null;
Builder builder = new Builder(context);
builder.setTitle(title);
builder.setMessage(msg);
builder.setPositiveButton(okStr, okListener);
builder.setNegativeButton(cancelStr, cancelListener);
dialog = builder.create();
dialog.show();
return dialog;
}
}
| 3,072 | 0.557292 | 0.555664 | 87 | 34.310345 | 26.82995 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.758621 | false | false | 2 |
84724a2f0bdc60595663c4afa13ce993e85c9b84 | 678,604,880,682 | b6a28a4e08197c251c1ceb9ac9ad1878ae7ffe02 | /ShopApp/src/main/java/com/example/myapplication/userUi/profile/settings/SettingsFragment.java | dd56e80791e17fd04ecc7ea2bfb153fc022dc28e | [] | no_license | MatinAloneBoy/ShopApp | https://github.com/MatinAloneBoy/ShopApp | 108b575c2c631c5457df19d0547d994a5a081546 | 4826dc55cffeb7172e8809f7f33e39bf8180c6eb | refs/heads/main | 2023-06-24T22:41:10.277000 | 2021-07-19T16:04:39 | 2021-07-19T16:04:39 | 385,190,043 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.myapplication.userUi.profile.settings;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.example.myapplication.R;
import com.example.myapplication.databinding.FragmentSettingsBinding;
import org.jetbrains.annotations.NotNull;
public class SettingsFragment extends Fragment {
private @NonNull FragmentSettingsBinding binding;
Button CNameButton,CPassButton,CPNButton,CProfilePhotoButton;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings,container,false);
binding = FragmentSettingsBinding.inflate(inflater, container, false);
View root = binding.getRoot();
CNameButton=binding.ChangeNameButton;
CPassButton=binding.ChangePasswordButton;
CPNButton=binding.ChangePhoneNumberButton;
CProfilePhotoButton=binding.ChangeProfilePhotoButton;
NavController navController = Navigation.findNavController(getActivity(), R.id.nav_host_fragment_activity_home);
CNameButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_changeNamePage);
}
});
CPassButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_changePasswordInSetting);
}
});
CPNButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_change_PhoneNumber_Page);
}
});
CProfilePhotoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_changeProfilePhotoPage);
}
});
return root;
}
} | UTF-8 | Java | 2,683 | java | SettingsFragment.java | Java | [] | null | [] | package com.example.myapplication.userUi.profile.settings;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.example.myapplication.R;
import com.example.myapplication.databinding.FragmentSettingsBinding;
import org.jetbrains.annotations.NotNull;
public class SettingsFragment extends Fragment {
private @NonNull FragmentSettingsBinding binding;
Button CNameButton,CPassButton,CPNButton,CProfilePhotoButton;
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings,container,false);
binding = FragmentSettingsBinding.inflate(inflater, container, false);
View root = binding.getRoot();
CNameButton=binding.ChangeNameButton;
CPassButton=binding.ChangePasswordButton;
CPNButton=binding.ChangePhoneNumberButton;
CProfilePhotoButton=binding.ChangeProfilePhotoButton;
NavController navController = Navigation.findNavController(getActivity(), R.id.nav_host_fragment_activity_home);
CNameButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_changeNamePage);
}
});
CPassButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_changePasswordInSetting);
}
});
CPNButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_change_PhoneNumber_Page);
}
});
CProfilePhotoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Navigation.findNavController(view).navigate(R.id.action_settingsFragment_to_changeProfilePhotoPage);
}
});
return root;
}
} | 2,683 | 0.719344 | 0.719344 | 69 | 37.898552 | 38.326267 | 213 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.623188 | false | false | 2 |
58705738af1b9e22c985b6b13669ba1b96e67844 | 33,603,824,182,711 | 84b6165b2bdc6a6398fce323e6277ab30e9d4691 | /app/src/main/java/com/xaehu/myapplication/base/BasePresenter.java | ce137806fdca28a69e2860a70a8bde8028662a76 | [] | no_license | xaEHu/libMVP | https://github.com/xaEHu/libMVP | 99af979e9d7a6a22b2b659d0e3d178624ab502db | 97f56cca1a25f9bf5d549730f7bf536396c4fd70 | refs/heads/master | 2020-07-22T17:32:57.950000 | 2019-09-09T10:40:18 | 2019-09-09T10:40:18 | 207,276,170 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xaehu.myapplication.base;
import com.xaehu.libmvp.base.BaseP;
import com.xaehu.libmvp.mvp.IView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* author : xaeHu
* e-mail : hsfemail@qq.com
* date : 2019/9/9 14:56
* desc :
*/
public class BasePresenter<V extends IView> extends BaseP<V> {
/**
* 网络请求的封装
*/
protected <M> void request(Observable<M> api, final OnRespListener<M> listener){
api.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<M>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(M value) {
if(getV() != null) {
listener.onSuccess(value);
}
}
@Override
public void onError(Throwable e) {
if(getV() != null){
listener.onFailed(e);
}
}
@Override
public void onComplete() {
}
});
}
public interface OnRespListener<M>{
void onSuccess(M value);
void onFailed(Throwable e);
}
}
| UTF-8 | Java | 1,568 | java | BasePresenter.java | Java | [
{
"context": ".reactivex.schedulers.Schedulers;\n\n/**\n * author : xaeHu\n * e-mail : hsfemail@qq.com\n * date : 2019/9/9 ",
"end": 340,
"score": 0.9995214939117432,
"start": 335,
"tag": "USERNAME",
"value": "xaeHu"
},
{
"context": "ers.Schedulers;\n\n/**\n * author : xaeHu\n * e-... | null | [] | package com.xaehu.myapplication.base;
import com.xaehu.libmvp.base.BaseP;
import com.xaehu.libmvp.mvp.IView;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* author : xaeHu
* e-mail : <EMAIL>
* date : 2019/9/9 14:56
* desc :
*/
public class BasePresenter<V extends IView> extends BaseP<V> {
/**
* 网络请求的封装
*/
protected <M> void request(Observable<M> api, final OnRespListener<M> listener){
api.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<M>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(M value) {
if(getV() != null) {
listener.onSuccess(value);
}
}
@Override
public void onError(Throwable e) {
if(getV() != null){
listener.onFailed(e);
}
}
@Override
public void onComplete() {
}
});
}
public interface OnRespListener<M>{
void onSuccess(M value);
void onFailed(Throwable e);
}
}
| 1,560 | 0.50193 | 0.495495 | 57 | 26.263159 | 20.425755 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.245614 | false | false | 2 |
a992a5f095ec3b60a95f2fda0ebfb1c968f5f108 | 8,761,733,352,319 | 38bf9639306e832ba997317bbd86878a1dafc812 | /Reina.java | 73e3553931dcbccbedc7429d14f0261add826e78 | [] | no_license | ashfirpo/conflictoEntreReinas | https://github.com/ashfirpo/conflictoEntreReinas | 7570197bdb7d487456fd4427eb50919d8d333cb7 | ea27342e81e9542dd5b9bba37989448c48be16a4 | refs/heads/master | 2020-03-21T01:10:10.389000 | 2018-06-19T18:06:27 | 2018-06-19T18:06:27 | 137,927,415 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package conflictoEntreReinas;
public class Reina {
private int id;
private int fila;
private int columna;
public Reina(int id, int fila, int columna)
{
this.id=id;
this.fila=fila;
this.columna=columna;
}
public void setId(int id)
{
this.id=id;
}
public int getId()
{
return this.id;
}
public int getFila()
{
return this.fila;
}
public int getColumna()
{
return this.columna;
}
public int compareTo(Reina r)
{
return this.id - r.id;
}
@Override
public boolean equals(Object r)
{
Reina param = (Reina)r;
return (this.fila==param.fila && this.columna==param.columna);
}
}
| UTF-8 | Java | 634 | java | Reina.java | Java | [] | null | [] | package conflictoEntreReinas;
public class Reina {
private int id;
private int fila;
private int columna;
public Reina(int id, int fila, int columna)
{
this.id=id;
this.fila=fila;
this.columna=columna;
}
public void setId(int id)
{
this.id=id;
}
public int getId()
{
return this.id;
}
public int getFila()
{
return this.fila;
}
public int getColumna()
{
return this.columna;
}
public int compareTo(Reina r)
{
return this.id - r.id;
}
@Override
public boolean equals(Object r)
{
Reina param = (Reina)r;
return (this.fila==param.fila && this.columna==param.columna);
}
}
| 634 | 0.649842 | 0.649842 | 49 | 11.938775 | 13.511005 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.428571 | false | false | 2 |
38126c6fd1a30f571a7ba14e6b4f470090de7ea7 | 10,557,029,619,045 | 4c355a994b342f55879d13de557338aec99db671 | /src/test/java/codeSignal/interview/arrays/FirstNotRepeatingCharacterTest.java | cc10cde4239b3f488358b64e4c984b355a0ecc48 | [] | no_license | priscilasanfer/logica | https://github.com/priscilasanfer/logica | 0dbff6405b7972afadc5adc35192bf33d34dfce8 | 04c9b970ab5f0919d62f2130b882fa485563bc88 | refs/heads/master | 2023-07-31T16:58:42.376000 | 2021-09-17T14:51:20 | 2021-09-17T14:51:20 | 309,848,606 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package codeSignal.interview.arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class FirstNotRepeatingCharacterTest {
@Test
public void teste1() {
String input = "abacabad";
char output = 'c';
Assertions.assertEquals(output, new FirstNotRepeatingCharacter().firstNotRepeatingCharacter(input));
}
@Test
public void teste2() {
String input = "abacabaabacaba";
char output = '_';
Assertions.assertEquals(output, new FirstNotRepeatingCharacter().firstNotRepeatingCharacter(input));
}
@Test
public void teste3() {
String input = "bcccccccb";
char output = '_';
Assertions.assertEquals(output, new FirstNotRepeatingCharacter().firstNotRepeatingCharacter(input));
}
}
| UTF-8 | Java | 808 | java | FirstNotRepeatingCharacterTest.java | Java | [] | null | [] | package codeSignal.interview.arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class FirstNotRepeatingCharacterTest {
@Test
public void teste1() {
String input = "abacabad";
char output = 'c';
Assertions.assertEquals(output, new FirstNotRepeatingCharacter().firstNotRepeatingCharacter(input));
}
@Test
public void teste2() {
String input = "abacabaabacaba";
char output = '_';
Assertions.assertEquals(output, new FirstNotRepeatingCharacter().firstNotRepeatingCharacter(input));
}
@Test
public void teste3() {
String input = "bcccccccb";
char output = '_';
Assertions.assertEquals(output, new FirstNotRepeatingCharacter().firstNotRepeatingCharacter(input));
}
}
| 808 | 0.678218 | 0.674505 | 28 | 27.857143 | 31.119257 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535714 | false | false | 2 |
99223973cdb5d48f8f00c007dd90a60808125822 | 33,732,673,196,658 | 9b6afd65e90f4bde700347ad09fd35b159fd5a9d | /src/com/codepath/apps/tweetapp/fragments/TweetsListFragment.java | d665e612385b7a6565a53046a859105d076de0bb | [] | no_license | dschreck/TweetTweet | https://github.com/dschreck/TweetTweet | d9643da39dcef7dbc1cc93527db31a5f8bb7d293 | c590e0d88aa3300defaf4c563b3432049fd796dd | refs/heads/master | 2021-01-13T01:26:31.984000 | 2014-02-14T00:01:17 | 2014-02-14T00:01:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.codepath.apps.tweetapp.fragments;
import java.util.ArrayList;
import org.json.JSONArray;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.codepath.apps.tweetapp.EndlessScrollListener;
import com.codepath.apps.tweetapp.R;
import com.codepath.apps.tweetapp.TweetsAdapter;
import com.codepath.apps.tweetapp.TwitterClient;
import com.codepath.apps.tweetapp.TwitterClientApp;
import com.codepath.apps.tweetapp.models.Tweet;
import com.loopj.android.http.JsonHttpResponseHandler;
public class TweetsListFragment extends Fragment {
TweetsAdapter adapter;
@Override
public View onCreateView(LayoutInflater inf, ViewGroup parent, Bundle savedInstanceState) {
return inf.inflate(R.layout.fragments_tweet_list, parent, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ArrayList<Tweet> tweets = new ArrayList<Tweet>();
ListView lvTweets = (ListView)getActivity().findViewById(R.id.lvTweets);
adapter = new TweetsAdapter(getActivity(), tweets);
lvTweets.setAdapter(adapter);
lvTweets.setOnScrollListener(new EndlessScrollListener() {
@Override
public void onLoadMore(int page, int totalItemsCount) {
// TODO Auto-generated method stub
loadMoreTweets(page);
}
});
}
public void loadMoreTweets(int offset) {
TwitterClient client = TwitterClientApp.getRestClient();
client.getHomeTimeline(offset+20, new JsonHttpResponseHandler() {
public void onSuccess(JSONArray json) {
ArrayList<Tweet> tweets = Tweet.fromJson(json);
adapter.addAll(tweets);
}
});
}
public TweetsAdapter getAdapter() {
return adapter;
}
}
| UTF-8 | Java | 1,819 | java | TweetsListFragment.java | Java | [] | null | [] | package com.codepath.apps.tweetapp.fragments;
import java.util.ArrayList;
import org.json.JSONArray;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.codepath.apps.tweetapp.EndlessScrollListener;
import com.codepath.apps.tweetapp.R;
import com.codepath.apps.tweetapp.TweetsAdapter;
import com.codepath.apps.tweetapp.TwitterClient;
import com.codepath.apps.tweetapp.TwitterClientApp;
import com.codepath.apps.tweetapp.models.Tweet;
import com.loopj.android.http.JsonHttpResponseHandler;
public class TweetsListFragment extends Fragment {
TweetsAdapter adapter;
@Override
public View onCreateView(LayoutInflater inf, ViewGroup parent, Bundle savedInstanceState) {
return inf.inflate(R.layout.fragments_tweet_list, parent, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ArrayList<Tweet> tweets = new ArrayList<Tweet>();
ListView lvTweets = (ListView)getActivity().findViewById(R.id.lvTweets);
adapter = new TweetsAdapter(getActivity(), tweets);
lvTweets.setAdapter(adapter);
lvTweets.setOnScrollListener(new EndlessScrollListener() {
@Override
public void onLoadMore(int page, int totalItemsCount) {
// TODO Auto-generated method stub
loadMoreTweets(page);
}
});
}
public void loadMoreTweets(int offset) {
TwitterClient client = TwitterClientApp.getRestClient();
client.getHomeTimeline(offset+20, new JsonHttpResponseHandler() {
public void onSuccess(JSONArray json) {
ArrayList<Tweet> tweets = Tweet.fromJson(json);
adapter.addAll(tweets);
}
});
}
public TweetsAdapter getAdapter() {
return adapter;
}
}
| 1,819 | 0.77845 | 0.7768 | 60 | 29.316668 | 23.887579 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.783333 | false | false | 2 |
7e6779ec95f2bf674f7fec9c4b7b80321e0f26c8 | 33,732,673,196,153 | 0abe5028c03911a2c0817daf9ac8d83e005bc88f | /java6/src/com/dev/java6/concurrency/execution/Consumer.java | c64ad9f9b9ff448c0137dd6fb2fa5801d4bf78ab | [] | no_license | rupeshraut/repo1 | https://github.com/rupeshraut/repo1 | 5b869a6d7f5c781a3e56459c3af16dea0bc0032b | f9e7b354dbc0de67d4fa4af03fed64922c268054 | refs/heads/master | 2022-12-07T19:10:53.819000 | 2020-02-01T07:39:35 | 2020-02-01T07:39:35 | 5,184,080 | 0 | 0 | null | false | 2022-12-05T23:48:15 | 2012-07-25T20:20:43 | 2020-02-01T07:39:43 | 2022-12-05T23:48:15 | 112 | 1 | 0 | 15 | Java | false | false | package com.dev.java6.concurrency.execution;
import java.util.Date;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* The Class Consumer.
*/
public class Consumer extends AbstractWorker<Integer> {
/** The Constant LOGGER. */
private static final Logger LOGGER = Logger.getLogger(Consumer.class.getName());
/**
* Instantiates a new consumer.
*
* @param queue
* the queue
*/
public Consumer(Queue<Integer> queue) {
super(queue);
}
/**
*
* @throws InterruptedException
* the interrupted exception
* @see com.dev.java6.concurrency.execution.AbstractWorker#sleepStrategy()
*/
@Override
void sleepStrategy() throws InterruptedException {
TimeUnit.MILLISECONDS.sleep(1000);
}
/**
*
* @param queue
* the queue
* @see com.dev.java6.concurrency.execution.AbstractWorker#perform(java.util.
* Queue)
*/
@Override
void perform(final Queue<Integer> queue) {
if (queue.size() > 0) {
Integer integer = queue.poll();
if (integer != null) {
LOGGER.log(Level.INFO, new Date().getTime() + ", " + this.getName() + " >> " + integer);
}// if
}// if
}// process()
}// Worker | UTF-8 | Java | 1,305 | java | Consumer.java | Java | [] | null | [] | package com.dev.java6.concurrency.execution;
import java.util.Date;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* The Class Consumer.
*/
public class Consumer extends AbstractWorker<Integer> {
/** The Constant LOGGER. */
private static final Logger LOGGER = Logger.getLogger(Consumer.class.getName());
/**
* Instantiates a new consumer.
*
* @param queue
* the queue
*/
public Consumer(Queue<Integer> queue) {
super(queue);
}
/**
*
* @throws InterruptedException
* the interrupted exception
* @see com.dev.java6.concurrency.execution.AbstractWorker#sleepStrategy()
*/
@Override
void sleepStrategy() throws InterruptedException {
TimeUnit.MILLISECONDS.sleep(1000);
}
/**
*
* @param queue
* the queue
* @see com.dev.java6.concurrency.execution.AbstractWorker#perform(java.util.
* Queue)
*/
@Override
void perform(final Queue<Integer> queue) {
if (queue.size() > 0) {
Integer integer = queue.poll();
if (integer != null) {
LOGGER.log(Level.INFO, new Date().getTime() + ", " + this.getName() + " >> " + integer);
}// if
}// if
}// process()
}// Worker | 1,305 | 0.628352 | 0.622222 | 55 | 21.763636 | 22.510574 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.145455 | false | false | 2 |
98e554d3ea6d89afb11b4a195f4d752c7297a2d1 | 8,589,934,656,878 | 98630d4b5997eaa188588f51f29aa4dbedc35613 | /shop-item/shop-item-interface/src/main/java/com/lwg/pojo/Category.java | 86f2961e22998986c28ca8deec333b41d2cd7a16 | [] | no_license | lwg729/shop | https://github.com/lwg729/shop | 7a75efd2323dc5f6c3fab167de73e2cc5b42c555 | ab10fe4caf277f8702e4f2d3e6939802b2bb6edb | refs/heads/master | 2023-04-05T14:38:16.015000 | 2021-04-18T08:58:00 | 2021-04-18T08:58:00 | 327,000,697 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lwg.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 功能描述:商品类别
*
* @Author: lwg
* @Date: 2021/1/8 0:17
*/
@Table(name = "tb_category")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private Long parentId;
private Boolean isParent;
private Integer sort;
}
| UTF-8 | Java | 632 | java | Category.java | Java | [
{
"context": "ersistence.Table;\n\n/**\n * 功能描述:商品类别\n *\n * @Author: lwg\n * @Date: 2021/1/8 0:17\n */\n\n@Table(name = \"tb_ca",
"end": 290,
"score": 0.9996100664138794,
"start": 287,
"tag": "USERNAME",
"value": "lwg"
}
] | null | [] | package com.lwg.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 功能描述:商品类别
*
* @Author: lwg
* @Date: 2021/1/8 0:17
*/
@Table(name = "tb_category")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private Long parentId;
private Boolean isParent;
private Integer sort;
}
| 632 | 0.7443 | 0.729642 | 32 | 18.1875 | 14.154146 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.40625 | false | false | 2 |
87709c20fb522ee6a2b120fe9073e7730bc4a7da | 2,216,203,169,991 | 30bee773a0fcfdd137ce84e842e3e4f1d9d363eb | /src/test/java/com/mariiapasichna/service/RoleServiceTests.java | 7d9793bc9b32569cf187611c7febbc40d8b24f6f | [] | no_license | mariiapasichna/To-Do_List_WebApp | https://github.com/mariiapasichna/To-Do_List_WebApp | bedcb964bdacd4c8767cb36f2c5994c7abd4855c | cb3ff291536c2c86189b53213f3f205cd841f9bf | refs/heads/master | 2023-02-12T13:13:36.431000 | 2021-01-06T22:17:36 | 2021-01-06T22:17:36 | 323,166,430 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mariiapasichna.service;
import com.mariiapasichna.exception.NullEntityReferenceException;
import com.mariiapasichna.model.Role;
import com.mariiapasichna.repository.RoleRepository;
import com.mariiapasichna.service.implementation.RoleServiceImpl;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.persistence.EntityNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Optional;
@ExtendWith(SpringExtension.class)
public class RoleServiceTests {
private RoleService roleService;
private Role role;
@MockBean
private RoleRepository roleRepository;
@BeforeEach
public void setUp() {
roleService = new RoleServiceImpl(roleRepository);
role = new Role();
role.setName("TestRole");
Mockito.when(roleRepository.save(role)).thenReturn(role);
Mockito.when(roleRepository.save(null)).thenThrow(IllegalArgumentException.class);
Mockito.when(roleRepository.findById(role.getId())).thenReturn(Optional.ofNullable(role));
Mockito.when(roleRepository.findById(100L)).thenThrow(EntityNotFoundException.class);
Mockito.doNothing().when(roleRepository).delete(role);
Mockito.when(roleRepository.findAll()).thenReturn(Arrays.asList(role));
}
@Test
public void createRoleTest() {
Assertions.assertEquals(roleService.create(role), role);
Assertions.assertThrows(NullEntityReferenceException.class, () -> roleService.create(null));
Mockito.verify(roleRepository, Mockito.times(1)).save(role);
}
@Test
public void readByIdRoleTest() {
Assertions.assertEquals(roleService.readById(role.getId()), role);
Assertions.assertThrows(EntityNotFoundException.class, () -> roleService.readById(100L));
Mockito.verify(roleRepository, Mockito.times(1)).findById(role.getId());
}
@Test
public void updateRoleTest() {
Role newRole = new Role();
newRole.setId(100L);
Assertions.assertEquals(roleService.update(role), role);
Assertions.assertThrows(EntityNotFoundException.class, () -> roleService.update(newRole));
Assertions.assertThrows(NullEntityReferenceException.class, () -> roleService.update(null));
Mockito.verify(roleRepository, Mockito.times(1)).findById(role.getId());
Mockito.verify(roleRepository, Mockito.times(1)).save(role);
}
@Test
public void deleteRoleTest() {
roleService.delete(role.getId());
Assertions.assertThrows(EntityNotFoundException.class, () -> roleService.delete(100L));
Mockito.verify(roleRepository, Mockito.times(1)).findById(role.getId());
Mockito.verify(roleRepository, Mockito.times(1)).delete(role);
}
@Test
public void getAllRoleTest() {
Assertions.assertEquals(roleService.getAll(), Arrays.asList(role));
Mockito.when(roleRepository.findAll()).thenReturn(new ArrayList<>());
Assertions.assertEquals(roleService.getAll(), new ArrayList<>());
Mockito.verify(roleRepository, Mockito.times(2)).findAll();
}
} | UTF-8 | Java | 3,384 | java | RoleServiceTests.java | Java | [] | null | [] | package com.mariiapasichna.service;
import com.mariiapasichna.exception.NullEntityReferenceException;
import com.mariiapasichna.model.Role;
import com.mariiapasichna.repository.RoleRepository;
import com.mariiapasichna.service.implementation.RoleServiceImpl;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.persistence.EntityNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Optional;
@ExtendWith(SpringExtension.class)
public class RoleServiceTests {
private RoleService roleService;
private Role role;
@MockBean
private RoleRepository roleRepository;
@BeforeEach
public void setUp() {
roleService = new RoleServiceImpl(roleRepository);
role = new Role();
role.setName("TestRole");
Mockito.when(roleRepository.save(role)).thenReturn(role);
Mockito.when(roleRepository.save(null)).thenThrow(IllegalArgumentException.class);
Mockito.when(roleRepository.findById(role.getId())).thenReturn(Optional.ofNullable(role));
Mockito.when(roleRepository.findById(100L)).thenThrow(EntityNotFoundException.class);
Mockito.doNothing().when(roleRepository).delete(role);
Mockito.when(roleRepository.findAll()).thenReturn(Arrays.asList(role));
}
@Test
public void createRoleTest() {
Assertions.assertEquals(roleService.create(role), role);
Assertions.assertThrows(NullEntityReferenceException.class, () -> roleService.create(null));
Mockito.verify(roleRepository, Mockito.times(1)).save(role);
}
@Test
public void readByIdRoleTest() {
Assertions.assertEquals(roleService.readById(role.getId()), role);
Assertions.assertThrows(EntityNotFoundException.class, () -> roleService.readById(100L));
Mockito.verify(roleRepository, Mockito.times(1)).findById(role.getId());
}
@Test
public void updateRoleTest() {
Role newRole = new Role();
newRole.setId(100L);
Assertions.assertEquals(roleService.update(role), role);
Assertions.assertThrows(EntityNotFoundException.class, () -> roleService.update(newRole));
Assertions.assertThrows(NullEntityReferenceException.class, () -> roleService.update(null));
Mockito.verify(roleRepository, Mockito.times(1)).findById(role.getId());
Mockito.verify(roleRepository, Mockito.times(1)).save(role);
}
@Test
public void deleteRoleTest() {
roleService.delete(role.getId());
Assertions.assertThrows(EntityNotFoundException.class, () -> roleService.delete(100L));
Mockito.verify(roleRepository, Mockito.times(1)).findById(role.getId());
Mockito.verify(roleRepository, Mockito.times(1)).delete(role);
}
@Test
public void getAllRoleTest() {
Assertions.assertEquals(roleService.getAll(), Arrays.asList(role));
Mockito.when(roleRepository.findAll()).thenReturn(new ArrayList<>());
Assertions.assertEquals(roleService.getAll(), new ArrayList<>());
Mockito.verify(roleRepository, Mockito.times(2)).findAll();
}
} | 3,384 | 0.729314 | 0.7237 | 82 | 40.280487 | 31.243448 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.804878 | false | false | 2 |
2374c094ef56701687073bc338f0ba2ed95e74c1 | 23,089,744,245,126 | fd8dce9f3120b356db6fd1a6e23b7b40fd9b9ff7 | /src/main/java/br/com/taoshu/resource/TurmaResource.java | 20b4fac85829c1b7ffaf7645d4949122ff1c3563 | [] | no_license | carlosschuenck/taoshu-api | https://github.com/carlosschuenck/taoshu-api | ea03d24dfb095375637b097b62ed1a93892b35fd | 73a9a85021f3cb42fec1e9be871d8325529b4b67 | refs/heads/master | 2022-12-22T00:46:23.716000 | 2019-07-01T00:49:27 | 2019-07-01T00:49:27 | 134,191,623 | 0 | 0 | null | false | 2022-12-10T05:11:43 | 2018-05-20T22:22:10 | 2019-07-01T00:50:07 | 2022-12-10T05:11:43 | 120 | 0 | 0 | 2 | Java | false | false | package br.com.taoshu.resource;
import br.com.taoshu.entity.Turma;
import br.com.taoshu.service.TurmaService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by Carlos Schuenck on 20/05/2018.
*/
@RestController
@RequestMapping("/turma")
public class TurmaResource {
private final TurmaService turmaService;
public TurmaResource(TurmaService turmaService) {
this.turmaService = turmaService;
}
@GetMapping
public ResponseEntity<List<Turma>> buscarTodos() {
return ResponseEntity.ok(turmaService.buscarTodos());
}
@GetMapping("/{id}")
public ResponseEntity<Turma> buscarPorId(@PathVariable Integer id) {
return ResponseEntity.ok(turmaService.buscarPorId(id));
}
@PostMapping
public ResponseEntity<Turma> inserir(@RequestBody Turma turma) {
return ResponseEntity.status(HttpStatus.CREATED).body(turmaService.inserir(turma));
}
@PutMapping
public ResponseEntity<Turma> atualizar(@RequestBody Turma turma) {
return ResponseEntity.ok(turmaService.atualizar(turma));
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deletar(@PathVariable Integer id) {
turmaService.deletar(id);
return ResponseEntity.noContent().build();
}
}
| UTF-8 | Java | 1,394 | java | TurmaResource.java | Java | [
{
"context": "tion.*;\n\nimport java.util.List;\n\n/**\n * Created by Carlos Schuenck on 20/05/2018.\n */\n@RestController\n@RequestMappin",
"end": 311,
"score": 0.9998573064804077,
"start": 296,
"tag": "NAME",
"value": "Carlos Schuenck"
}
] | null | [] | package br.com.taoshu.resource;
import br.com.taoshu.entity.Turma;
import br.com.taoshu.service.TurmaService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by <NAME> on 20/05/2018.
*/
@RestController
@RequestMapping("/turma")
public class TurmaResource {
private final TurmaService turmaService;
public TurmaResource(TurmaService turmaService) {
this.turmaService = turmaService;
}
@GetMapping
public ResponseEntity<List<Turma>> buscarTodos() {
return ResponseEntity.ok(turmaService.buscarTodos());
}
@GetMapping("/{id}")
public ResponseEntity<Turma> buscarPorId(@PathVariable Integer id) {
return ResponseEntity.ok(turmaService.buscarPorId(id));
}
@PostMapping
public ResponseEntity<Turma> inserir(@RequestBody Turma turma) {
return ResponseEntity.status(HttpStatus.CREATED).body(turmaService.inserir(turma));
}
@PutMapping
public ResponseEntity<Turma> atualizar(@RequestBody Turma turma) {
return ResponseEntity.ok(turmaService.atualizar(turma));
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deletar(@PathVariable Integer id) {
turmaService.deletar(id);
return ResponseEntity.noContent().build();
}
}
| 1,385 | 0.722382 | 0.716643 | 49 | 27.44898 | 25.495146 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.306122 | false | false | 2 |
975f31f0f6af88c56cdd1c2b22538b97cccb48c9 | 39,462,159,524,850 | 807cf061b80765075601f80ee79b830aac0cd84e | /src/main/java/cheanxin/service/LoanLogService.java | c66d52453e170f284af35c707405a81bfe6adaca | [] | no_license | hezudaopp/cheanxin | https://github.com/hezudaopp/cheanxin | 655828fde1726647830ef18423f0067240dd0707 | f2bbd5f47e8d776222750754003dae3126818a68 | refs/heads/master | 2017-12-16T10:20:03.392000 | 2017-06-16T06:19:18 | 2017-06-16T06:19:18 | 77,495,056 | 3 | 2 | null | false | 2017-06-09T09:32:47 | 2016-12-28T02:01:32 | 2017-02-23T08:34:28 | 2017-06-09T09:32:47 | 15,099 | 2 | 2 | 0 | Java | null | null | package cheanxin.service;
import cheanxin.domain.LoanLog;
import java.util.List;
/**
* 贷款操作日志service类
* Created by Jawinton on 17/02/08.
*/
public interface LoanLogService {
/**
* 保存贷款操作日志
* @param unsavedLoanLog
* @return
*/
LoanLog save(LoanLog unsavedLoanLog);
/**
* 判断贷款操作日志是否存在
* @param loanId
* @param fromStatus
* @param toStatus
* @return
*/
boolean isExists(long loanId, int fromStatus, int toStatus);
/**
* 贷款日志列表
* @param loanId
* @param fromStatus
* @param toStatus
* @return
*/
List<LoanLog> list(long loanId, int fromStatus, int toStatus);
}
| UTF-8 | Java | 734 | java | LoanLogService.java | Java | [
{
"context": "va.util.List;\n\n/**\n * 贷款操作日志service类\n * Created by Jawinton on 17/02/08.\n */\npublic interface LoanLogService ",
"end": 128,
"score": 0.9988164901733398,
"start": 120,
"tag": "USERNAME",
"value": "Jawinton"
}
] | null | [] | package cheanxin.service;
import cheanxin.domain.LoanLog;
import java.util.List;
/**
* 贷款操作日志service类
* Created by Jawinton on 17/02/08.
*/
public interface LoanLogService {
/**
* 保存贷款操作日志
* @param unsavedLoanLog
* @return
*/
LoanLog save(LoanLog unsavedLoanLog);
/**
* 判断贷款操作日志是否存在
* @param loanId
* @param fromStatus
* @param toStatus
* @return
*/
boolean isExists(long loanId, int fromStatus, int toStatus);
/**
* 贷款日志列表
* @param loanId
* @param fromStatus
* @param toStatus
* @return
*/
List<LoanLog> list(long loanId, int fromStatus, int toStatus);
}
| 734 | 0.607784 | 0.598802 | 36 | 17.555555 | 15.873536 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false | 2 |
80f1135dfef2382ea87b45ae963c03fc6e744e9a | 39,470,749,460,612 | 0299e8589c4f1b08606c4f51da6175d2ac727487 | /src/lt/bit/hw/Op004.java | d70548d5870866dd631e02c43e15690e3ac94b5b | [] | no_license | KestutisAndriunas/Homeworks | https://github.com/KestutisAndriunas/Homeworks | 473888e2922619a12c7a913361d3b3295cefc554 | 86e23977f3def7c0e006f52d7ff2bf0cc7c4bc0f | refs/heads/master | 2022-02-13T13:50:46.846000 | 2019-08-07T06:40:20 | 2019-08-07T06:40:20 | 198,229,822 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lt.bit.hw;
/*Parašykite programą, kuri kompiuterio ekrane atspausdina konstantą π = 3,14 ... .
Konstantą parodykite 5 skaitmenų po kablelio tikslumu.*/
public class Op004 {
public static void main(String[] args) {
double numberPi = Math.PI;
System.out.format("%.5f%n", numberPi );
}
}
| UTF-8 | Java | 326 | java | Op004.java | Java | [] | null | [] | package lt.bit.hw;
/*Parašykite programą, kuri kompiuterio ekrane atspausdina konstantą π = 3,14 ... .
Konstantą parodykite 5 skaitmenų po kablelio tikslumu.*/
public class Op004 {
public static void main(String[] args) {
double numberPi = Math.PI;
System.out.format("%.5f%n", numberPi );
}
}
| 326 | 0.675 | 0.65 | 12 | 25.666666 | 26.093847 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
4ee27ab9acae50c1dea986f89631d7b9ee95de4a | 39,496,519,273,354 | 83ef52d8c6c7c2eb376c3453fec5b2c48efef39d | /app/src/main/java/com/iused/main/ProductDetailsActivity_Negotiable.java | 257a99823ace9ffd2359dd408734f157536bb4ed | [] | no_license | johndpope/IUsed | https://github.com/johndpope/IUsed | 8ccf701f38c5696d3940368d1d820ea4f791c8d4 | f47fcb051af5f7aaaea609b89c0d77b243401861 | refs/heads/master | 2020-07-05T11:00:36.703000 | 2017-02-09T12:34:19 | 2017-02-09T12:34:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iused.main;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.iused.R;
import com.iused.adapters.FullImageAdapter;
import com.iused.bean.MainProductsBean;
import com.iused.introduction.LoginActivity;
import com.iused.utils.AsyncTaskListener;
import com.iused.utils.Constants;
import com.iused.utils.HttpAsync;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.viewpagerindicator.CirclePageIndicator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.TimeZone;
import java.util.Timer;
import java.util.TimerTask;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by Antto on 29-09-2016.
*/
public class ProductDetailsActivity_Negotiable extends AppCompatActivity implements AsyncTaskListener{
Intent intent = null;
// ImageView img_product;
private TextView txt_name_first_letter = null;
private TextView txt_name = null;
private TextView txt_request_price = null;
private TextView txt_product_description = null;
private Button btn_buy_now= null;
private EditText edt_offer_price= null;
private EditText edt_offer_minutes= null;
private EditText edt_deadline_type= null;
private HashMap<String, String> para = null;
public static HashMap<String, String> para_buy_request = null;
private AsyncTaskListener listener = null;
private int offer_min_price=0;
public SharedPreferences mpref = null;
private ProgressDialog progressDialog= null;
private TextView txt_product_name=null;
private TextView txt_used_for=null;
private TextView txt_currency_code=null;
private TextView txt_distance=null;
private TextView txt_condition=null;
String currentDateTimeString = "";
String locale ="";
String timezone="";
private List<String> gallery = null;
private ArrayList<String> gallery_images=null;
ViewPager viewPager;
private static int currentPage = 0;
private static int NUM_PAGES = 0;
private CircleImageView img_seller_image=null;
private ImageView img_play_video=null;
public String str_video_link=null;
private Typeface face,face1=null;
MainProductsBean mainProductsBean=null;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_product_details_negotiable);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// getSupportActionBar().setTitle("Product Details");
// mainProductsBean= (MainProductsBean) getIntent().getSerializableExtra("negotiable_bean");
// Log.e("product_name",mainProductsBean.getProductName());
progressDialog= new ProgressDialog(ProductDetailsActivity_Negotiable.this);
listener = ProductDetailsActivity_Negotiable.this;
intent=getIntent();
getSupportActionBar().setTitle(intent.getStringExtra("name"));
mpref = getSharedPreferences("user_details", MODE_PRIVATE);
if (mpref != null)
// img_product = (ImageView) findViewById(R.id.img_product);
txt_name_first_letter= (TextView) findViewById(R.id.txt_name_first_letter);
txt_name= (TextView) findViewById(R.id.txt_name);
txt_request_price= (TextView) findViewById(R.id.txt_product_price);
txt_product_description= (TextView) findViewById(R.id.txt_description);
edt_offer_price= (EditText) findViewById(R.id.edt_offer_price);
edt_offer_minutes= (EditText) findViewById(R.id.edt_deadline);
edt_deadline_type= (EditText) findViewById(R.id.edt_deadline_type);
btn_buy_now = (Button) findViewById(R.id.btn_buy_now_negotiable);
txt_product_name= (TextView) findViewById(R.id.txt_product_name);
txt_used_for= (TextView) findViewById(R.id.txt_used_for);
txt_currency_code= (TextView) findViewById(R.id.curr_code);
viewPager = (ViewPager) findViewById(R.id.view_pager);
txt_distance= (TextView) findViewById(R.id.txt_distance);
img_seller_image= (CircleImageView) findViewById(R.id.img_seller_image);
txt_condition= (TextView) findViewById(R.id.txt_condition);
img_play_video= (ImageView) findViewById(R.id.img_play_video);
// gallery=new ArrayList<String>();
face= Typeface.createFromAsset(getAssets(), "fonts/bariolbd.otf");
// edt_offer_price.setTypeface(face);
edt_offer_minutes.setTypeface(face);
edt_deadline_type.setTypeface(face);
txt_product_name.setText(intent.getStringExtra("name"));
txt_used_for.setText(intent.getStringExtra("used_for")+" Old");
txt_request_price.setText(mpref.getString("currency_symbol","")+" "+intent.getStringExtra("price"));
txt_product_description.setText(intent.getStringExtra("description"));
txt_currency_code.setText(mpref.getString("currency_symbol",""));
txt_condition.setText(intent.getStringExtra("condition"));
txt_distance.setText(Math.round(Double.parseDouble(intent.getStringExtra("distance")))+" Km(s) away");
locale = getApplicationContext().getResources().getConfiguration().locale.getDisplayCountry();
Date today = Calendar.getInstance().getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
currentDateTimeString = formatter.format(today);
timezone= TimeZone.getDefault().getDisplayName();
try {
Picasso.with(getApplicationContext())
.load(intent.getStringExtra("posted_image"))
//.placeholder(R.drawable.user_placeholder) not considering has thumbnails are small size
//.error(R.drawable.user_placeholder_error)
// .resize(200,200)
.into(img_seller_image,new PicassoCallback(intent.getStringExtra("posted_image")));
}catch (Exception e){
Picasso.with(getApplicationContext())
.load("http://52.41.70.254/pics/user.jpg")
//.placeholder(R.drawable.user_placeholder) not considering has thumbnails are small size
//.error(R.drawable.user_placeholder_error)
// .resize(200,200)
.into(img_seller_image,new PicassoCallback(intent.getStringExtra("posted_image")));
}
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
// img_product.setTransitionName("profile");
// }
// Picasso.with(getApplicationContext())
// .load(intent.getStringExtra("image"))
// //.placeholder(R.drawable.user_placeholder) not considering has thumbnails are small size
// //.error(R.drawable.user_placeholder_error)
// .into(img_product,new PicassoCallback(intent.getStringExtra("image")));
btn_buy_now.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edt_offer_price.getWindowToken(), 0);
imm.hideSoftInputFromWindow(edt_offer_minutes.getWindowToken(), 0);
if(edt_offer_price.getText().toString().equalsIgnoreCase("")){
Toast.makeText(getApplicationContext(),txt_name.getText().toString()+" is looking for a better offer than the current offer "+mpref.getString("currency_symbol","")+" "+intent.getStringExtra("price"),Toast.LENGTH_SHORT).show();
}
// else if(Long.parseLong(edt_offer_price.getText().toString())<offer_min_price){
// Toast.makeText(getApplicationContext(),"Offer price should be greater than or equal to "+offer_min_price,Toast.LENGTH_LONG).show();
// }
else if(edt_offer_minutes.getText().toString().equalsIgnoreCase("")){
Toast.makeText(getApplicationContext(),"Please enter the valid deadline",Toast.LENGTH_SHORT).show();
}
else if(Integer.parseInt(edt_offer_minutes.getText().toString())<2){
Toast.makeText(getApplicationContext(),"Deadline must be between 2-23 hours",Toast.LENGTH_LONG).show();
}
else if(Integer.parseInt(edt_offer_minutes.getText().toString())>23){
Toast.makeText(getApplicationContext(),"Deadline must be between 2-23 hours",Toast.LENGTH_LONG).show();
}
else {
para_buy_request = new HashMap<>();
para_buy_request.put("UserId", mpref.getString("user_id",""));
para_buy_request.put("ProductId", intent.getStringExtra("product_id"));
para_buy_request.put("Datetime",currentDateTimeString);
para_buy_request.put("Amount",edt_offer_price.getText().toString());
para_buy_request.put("OfferTill",Integer.parseInt(edt_offer_minutes.getText().toString())*60+"");
para_buy_request.put("Qty",intent.getStringExtra("qty_remaining"));
if(mpref.getString("guest_status","").equalsIgnoreCase("0")){
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
intent.putExtra("offer_negotiable","negotiable");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
else {
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();
Log.e("products_details", para_buy_request.toString());
HttpAsync httpAsync1 = new HttpAsync(getApplicationContext(), listener, Constants.BASE_URL+"PurchaseRequests", para_buy_request, 2, "buy_request");
httpAsync1.execute();
}
}
}
});
para = new HashMap<>();
para.put("UserId", mpref.getString("user_id",""));
para.put("ProductId", intent.getStringExtra("product_id"));
para.put("Datetime",currentDateTimeString);
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();
Log.e("products_details", para.toString());
HttpAsync httpAsync1 = new HttpAsync(getApplicationContext(), listener, Constants.BASE_URL+"ProductDetail", para, 2, "product_details");
httpAsync1.execute();
img_play_video.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// File file = new File(str_video_link);
// Intent intent = new Intent(Intent.ACTION_VIEW);
// intent.setDataAndType(Uri.fromFile(file), "video/*");
// startActivity(intent);
Intent intent=new Intent(getApplicationContext(),FullVideoUserActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("video_url",str_video_link);
startActivity(intent);
}
});
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
@Override
public void onTaskCancelled(String data) {
}
@Override
public void onTaskComplete(String result, String tag) {
progressDialog.dismiss();
if(result.equalsIgnoreCase("fail")){
try {
Toast.makeText(getApplicationContext(),"No Internet Connection",Toast.LENGTH_SHORT).show();
}catch (Exception e){
}
}
else {
if(tag.equalsIgnoreCase("product_details")){
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(result);
if (jsonObject != null){
if(jsonObject.getString("errFlag").equalsIgnoreCase("0")){
JSONArray jsonsendarr = jsonObject.optJSONArray("Data");
if (jsonsendarr.length() > 0){
for (int i = 0; i < jsonsendarr.length(); i++){
if (jsonObject != null){
JSONObject volumobject = jsonsendarr.getJSONObject(i);
txt_name_first_letter.setText(String.valueOf(volumobject.getString("UserName").charAt(0)).toUpperCase());
txt_name.setText(volumobject.getString("UserName"));
offer_min_price=volumobject.getInt("NextBidShouldBe");
// Log.e("NextBidShouldBe",offer_min_price+"");
// gallery.add(volumobject.getString("ImageLinks"));
gallery=new ArrayList<String>( Arrays.asList(volumobject.getString("ImageLinks").split("\\s*,\\s*")));
gallery_images=new ArrayList<>(gallery);
str_video_link=volumobject.getString("VideoLinks");
if(str_video_link.equalsIgnoreCase("")){
img_play_video.setVisibility(View.GONE);
}
else {
img_play_video.setVisibility(View.VISIBLE);
}
if(gallery_images!=null && gallery_images.size()>0) {
NUM_PAGES = gallery_images.size();
}else
{
NUM_PAGES = 1;
}
// Auto start of viewpager
final Handler handler = new Handler();
final Runnable Update = new Runnable() {
public void run() {
if (currentPage == NUM_PAGES) {
currentPage = 0;
}
viewPager.setCurrentItem(currentPage++, true);
}
};
Timer swipeTimer = new Timer();
swipeTimer.schedule(new TimerTask() {
@Override
public void run() {
handler.post(Update);
}
}, 3000, 3000);
if(gallery_images!=null && gallery_images.size()>0) {
FullImageAdapter adapter = new FullImageAdapter(this, gallery_images);
viewPager.setAdapter(adapter);
CirclePageIndicator indicator = (CirclePageIndicator)
findViewById(R.id.indicator);
if(gallery_images.size()==1){
indicator.setVisibility(View.INVISIBLE);
// viewPager.setVisibility(View.GONE);
// img_product.setVisibility(View.VISIBLE);
}
else {
// viewPager.setVisibility(View.VISIBLE);
// img_product.setVisibility(View.GONE);
final float density = getResources().getDisplayMetrics().density;
indicator.setFillColor(0xFFFFFFFF);
indicator.setStrokeColor(0xFFFFFFFF);
indicator.setStrokeWidth(1);
indicator.setRadius(6 * density);
indicator.setViewPager(viewPager);
//Set circle indicator radius
indicator.setRadius(5 * density);
}
indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
currentPage = position;
}
@Override
public void onPageScrolled(int pos, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int pos) {
}
});
}
}
}
}
}
// Toast.makeText(getApplicationContext(),jsonObject.getString("errMsg"),Toast.LENGTH_SHORT).show();
}
}catch (JSONException e){
e.printStackTrace();
}
}
else if(tag.equalsIgnoreCase("buy_request")){
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(result);
if (jsonObject != null){
if(jsonObject.getString("errFlag").equalsIgnoreCase("0")){
Toast.makeText(getApplicationContext(),jsonObject.getString("errMsg"),Toast.LENGTH_LONG).show();
Intent intent=new Intent(getApplicationContext(),MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
else {
// Toast.makeText(getApplicationContext(),jsonObject.getString("errMsg"),Toast.LENGTH_LONG).show();
AlertDialog alertDialog=new AlertDialog.Builder(ProductDetailsActivity_Negotiable.this).setMessage(jsonObject.getString("errMsg"))
.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Intent intent=new Intent(getApplicationContext(),MainActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent);
// finish();
dialog.dismiss();
}
}).show();
}
}
}catch (JSONException e){
e.printStackTrace();
}
}
}
}
class PicassoCallback implements Callback {
String thumbnail_poster;
public PicassoCallback(String thumbnail) {
this.thumbnail_poster=thumbnail;
}
@Override
public void onSuccess() {
}
@Override
public void onError() {
// loadRottenPoster=true;
Picasso.with(getApplicationContext()).load("http://52.41.70.254/pics/user.jpg").into(img_seller_image);
}
}
}
| UTF-8 | Java | 22,326 | java | ProductDetailsActivity_Negotiable.java | Java | [
{
"context": "ircleimageview.CircleImageView;\n\n/**\n * Created by Antto on 29-09-2016.\n */\npublic class ProductDetailsAct",
"end": 1740,
"score": 0.9992141127586365,
"start": 1735,
"tag": "NAME",
"value": "Antto"
}
] | null | [] | package com.iused.main;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.iused.R;
import com.iused.adapters.FullImageAdapter;
import com.iused.bean.MainProductsBean;
import com.iused.introduction.LoginActivity;
import com.iused.utils.AsyncTaskListener;
import com.iused.utils.Constants;
import com.iused.utils.HttpAsync;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.viewpagerindicator.CirclePageIndicator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.TimeZone;
import java.util.Timer;
import java.util.TimerTask;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by Antto on 29-09-2016.
*/
public class ProductDetailsActivity_Negotiable extends AppCompatActivity implements AsyncTaskListener{
Intent intent = null;
// ImageView img_product;
private TextView txt_name_first_letter = null;
private TextView txt_name = null;
private TextView txt_request_price = null;
private TextView txt_product_description = null;
private Button btn_buy_now= null;
private EditText edt_offer_price= null;
private EditText edt_offer_minutes= null;
private EditText edt_deadline_type= null;
private HashMap<String, String> para = null;
public static HashMap<String, String> para_buy_request = null;
private AsyncTaskListener listener = null;
private int offer_min_price=0;
public SharedPreferences mpref = null;
private ProgressDialog progressDialog= null;
private TextView txt_product_name=null;
private TextView txt_used_for=null;
private TextView txt_currency_code=null;
private TextView txt_distance=null;
private TextView txt_condition=null;
String currentDateTimeString = "";
String locale ="";
String timezone="";
private List<String> gallery = null;
private ArrayList<String> gallery_images=null;
ViewPager viewPager;
private static int currentPage = 0;
private static int NUM_PAGES = 0;
private CircleImageView img_seller_image=null;
private ImageView img_play_video=null;
public String str_video_link=null;
private Typeface face,face1=null;
MainProductsBean mainProductsBean=null;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_product_details_negotiable);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// getSupportActionBar().setTitle("Product Details");
// mainProductsBean= (MainProductsBean) getIntent().getSerializableExtra("negotiable_bean");
// Log.e("product_name",mainProductsBean.getProductName());
progressDialog= new ProgressDialog(ProductDetailsActivity_Negotiable.this);
listener = ProductDetailsActivity_Negotiable.this;
intent=getIntent();
getSupportActionBar().setTitle(intent.getStringExtra("name"));
mpref = getSharedPreferences("user_details", MODE_PRIVATE);
if (mpref != null)
// img_product = (ImageView) findViewById(R.id.img_product);
txt_name_first_letter= (TextView) findViewById(R.id.txt_name_first_letter);
txt_name= (TextView) findViewById(R.id.txt_name);
txt_request_price= (TextView) findViewById(R.id.txt_product_price);
txt_product_description= (TextView) findViewById(R.id.txt_description);
edt_offer_price= (EditText) findViewById(R.id.edt_offer_price);
edt_offer_minutes= (EditText) findViewById(R.id.edt_deadline);
edt_deadline_type= (EditText) findViewById(R.id.edt_deadline_type);
btn_buy_now = (Button) findViewById(R.id.btn_buy_now_negotiable);
txt_product_name= (TextView) findViewById(R.id.txt_product_name);
txt_used_for= (TextView) findViewById(R.id.txt_used_for);
txt_currency_code= (TextView) findViewById(R.id.curr_code);
viewPager = (ViewPager) findViewById(R.id.view_pager);
txt_distance= (TextView) findViewById(R.id.txt_distance);
img_seller_image= (CircleImageView) findViewById(R.id.img_seller_image);
txt_condition= (TextView) findViewById(R.id.txt_condition);
img_play_video= (ImageView) findViewById(R.id.img_play_video);
// gallery=new ArrayList<String>();
face= Typeface.createFromAsset(getAssets(), "fonts/bariolbd.otf");
// edt_offer_price.setTypeface(face);
edt_offer_minutes.setTypeface(face);
edt_deadline_type.setTypeface(face);
txt_product_name.setText(intent.getStringExtra("name"));
txt_used_for.setText(intent.getStringExtra("used_for")+" Old");
txt_request_price.setText(mpref.getString("currency_symbol","")+" "+intent.getStringExtra("price"));
txt_product_description.setText(intent.getStringExtra("description"));
txt_currency_code.setText(mpref.getString("currency_symbol",""));
txt_condition.setText(intent.getStringExtra("condition"));
txt_distance.setText(Math.round(Double.parseDouble(intent.getStringExtra("distance")))+" Km(s) away");
locale = getApplicationContext().getResources().getConfiguration().locale.getDisplayCountry();
Date today = Calendar.getInstance().getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
currentDateTimeString = formatter.format(today);
timezone= TimeZone.getDefault().getDisplayName();
try {
Picasso.with(getApplicationContext())
.load(intent.getStringExtra("posted_image"))
//.placeholder(R.drawable.user_placeholder) not considering has thumbnails are small size
//.error(R.drawable.user_placeholder_error)
// .resize(200,200)
.into(img_seller_image,new PicassoCallback(intent.getStringExtra("posted_image")));
}catch (Exception e){
Picasso.with(getApplicationContext())
.load("http://52.41.70.254/pics/user.jpg")
//.placeholder(R.drawable.user_placeholder) not considering has thumbnails are small size
//.error(R.drawable.user_placeholder_error)
// .resize(200,200)
.into(img_seller_image,new PicassoCallback(intent.getStringExtra("posted_image")));
}
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
// img_product.setTransitionName("profile");
// }
// Picasso.with(getApplicationContext())
// .load(intent.getStringExtra("image"))
// //.placeholder(R.drawable.user_placeholder) not considering has thumbnails are small size
// //.error(R.drawable.user_placeholder_error)
// .into(img_product,new PicassoCallback(intent.getStringExtra("image")));
btn_buy_now.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edt_offer_price.getWindowToken(), 0);
imm.hideSoftInputFromWindow(edt_offer_minutes.getWindowToken(), 0);
if(edt_offer_price.getText().toString().equalsIgnoreCase("")){
Toast.makeText(getApplicationContext(),txt_name.getText().toString()+" is looking for a better offer than the current offer "+mpref.getString("currency_symbol","")+" "+intent.getStringExtra("price"),Toast.LENGTH_SHORT).show();
}
// else if(Long.parseLong(edt_offer_price.getText().toString())<offer_min_price){
// Toast.makeText(getApplicationContext(),"Offer price should be greater than or equal to "+offer_min_price,Toast.LENGTH_LONG).show();
// }
else if(edt_offer_minutes.getText().toString().equalsIgnoreCase("")){
Toast.makeText(getApplicationContext(),"Please enter the valid deadline",Toast.LENGTH_SHORT).show();
}
else if(Integer.parseInt(edt_offer_minutes.getText().toString())<2){
Toast.makeText(getApplicationContext(),"Deadline must be between 2-23 hours",Toast.LENGTH_LONG).show();
}
else if(Integer.parseInt(edt_offer_minutes.getText().toString())>23){
Toast.makeText(getApplicationContext(),"Deadline must be between 2-23 hours",Toast.LENGTH_LONG).show();
}
else {
para_buy_request = new HashMap<>();
para_buy_request.put("UserId", mpref.getString("user_id",""));
para_buy_request.put("ProductId", intent.getStringExtra("product_id"));
para_buy_request.put("Datetime",currentDateTimeString);
para_buy_request.put("Amount",edt_offer_price.getText().toString());
para_buy_request.put("OfferTill",Integer.parseInt(edt_offer_minutes.getText().toString())*60+"");
para_buy_request.put("Qty",intent.getStringExtra("qty_remaining"));
if(mpref.getString("guest_status","").equalsIgnoreCase("0")){
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
intent.putExtra("offer_negotiable","negotiable");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
else {
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();
Log.e("products_details", para_buy_request.toString());
HttpAsync httpAsync1 = new HttpAsync(getApplicationContext(), listener, Constants.BASE_URL+"PurchaseRequests", para_buy_request, 2, "buy_request");
httpAsync1.execute();
}
}
}
});
para = new HashMap<>();
para.put("UserId", mpref.getString("user_id",""));
para.put("ProductId", intent.getStringExtra("product_id"));
para.put("Datetime",currentDateTimeString);
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();
Log.e("products_details", para.toString());
HttpAsync httpAsync1 = new HttpAsync(getApplicationContext(), listener, Constants.BASE_URL+"ProductDetail", para, 2, "product_details");
httpAsync1.execute();
img_play_video.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// File file = new File(str_video_link);
// Intent intent = new Intent(Intent.ACTION_VIEW);
// intent.setDataAndType(Uri.fromFile(file), "video/*");
// startActivity(intent);
Intent intent=new Intent(getApplicationContext(),FullVideoUserActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("video_url",str_video_link);
startActivity(intent);
}
});
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
@Override
public void onTaskCancelled(String data) {
}
@Override
public void onTaskComplete(String result, String tag) {
progressDialog.dismiss();
if(result.equalsIgnoreCase("fail")){
try {
Toast.makeText(getApplicationContext(),"No Internet Connection",Toast.LENGTH_SHORT).show();
}catch (Exception e){
}
}
else {
if(tag.equalsIgnoreCase("product_details")){
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(result);
if (jsonObject != null){
if(jsonObject.getString("errFlag").equalsIgnoreCase("0")){
JSONArray jsonsendarr = jsonObject.optJSONArray("Data");
if (jsonsendarr.length() > 0){
for (int i = 0; i < jsonsendarr.length(); i++){
if (jsonObject != null){
JSONObject volumobject = jsonsendarr.getJSONObject(i);
txt_name_first_letter.setText(String.valueOf(volumobject.getString("UserName").charAt(0)).toUpperCase());
txt_name.setText(volumobject.getString("UserName"));
offer_min_price=volumobject.getInt("NextBidShouldBe");
// Log.e("NextBidShouldBe",offer_min_price+"");
// gallery.add(volumobject.getString("ImageLinks"));
gallery=new ArrayList<String>( Arrays.asList(volumobject.getString("ImageLinks").split("\\s*,\\s*")));
gallery_images=new ArrayList<>(gallery);
str_video_link=volumobject.getString("VideoLinks");
if(str_video_link.equalsIgnoreCase("")){
img_play_video.setVisibility(View.GONE);
}
else {
img_play_video.setVisibility(View.VISIBLE);
}
if(gallery_images!=null && gallery_images.size()>0) {
NUM_PAGES = gallery_images.size();
}else
{
NUM_PAGES = 1;
}
// Auto start of viewpager
final Handler handler = new Handler();
final Runnable Update = new Runnable() {
public void run() {
if (currentPage == NUM_PAGES) {
currentPage = 0;
}
viewPager.setCurrentItem(currentPage++, true);
}
};
Timer swipeTimer = new Timer();
swipeTimer.schedule(new TimerTask() {
@Override
public void run() {
handler.post(Update);
}
}, 3000, 3000);
if(gallery_images!=null && gallery_images.size()>0) {
FullImageAdapter adapter = new FullImageAdapter(this, gallery_images);
viewPager.setAdapter(adapter);
CirclePageIndicator indicator = (CirclePageIndicator)
findViewById(R.id.indicator);
if(gallery_images.size()==1){
indicator.setVisibility(View.INVISIBLE);
// viewPager.setVisibility(View.GONE);
// img_product.setVisibility(View.VISIBLE);
}
else {
// viewPager.setVisibility(View.VISIBLE);
// img_product.setVisibility(View.GONE);
final float density = getResources().getDisplayMetrics().density;
indicator.setFillColor(0xFFFFFFFF);
indicator.setStrokeColor(0xFFFFFFFF);
indicator.setStrokeWidth(1);
indicator.setRadius(6 * density);
indicator.setViewPager(viewPager);
//Set circle indicator radius
indicator.setRadius(5 * density);
}
indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
currentPage = position;
}
@Override
public void onPageScrolled(int pos, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int pos) {
}
});
}
}
}
}
}
// Toast.makeText(getApplicationContext(),jsonObject.getString("errMsg"),Toast.LENGTH_SHORT).show();
}
}catch (JSONException e){
e.printStackTrace();
}
}
else if(tag.equalsIgnoreCase("buy_request")){
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(result);
if (jsonObject != null){
if(jsonObject.getString("errFlag").equalsIgnoreCase("0")){
Toast.makeText(getApplicationContext(),jsonObject.getString("errMsg"),Toast.LENGTH_LONG).show();
Intent intent=new Intent(getApplicationContext(),MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
else {
// Toast.makeText(getApplicationContext(),jsonObject.getString("errMsg"),Toast.LENGTH_LONG).show();
AlertDialog alertDialog=new AlertDialog.Builder(ProductDetailsActivity_Negotiable.this).setMessage(jsonObject.getString("errMsg"))
.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Intent intent=new Intent(getApplicationContext(),MainActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent);
// finish();
dialog.dismiss();
}
}).show();
}
}
}catch (JSONException e){
e.printStackTrace();
}
}
}
}
class PicassoCallback implements Callback {
String thumbnail_poster;
public PicassoCallback(String thumbnail) {
this.thumbnail_poster=thumbnail;
}
@Override
public void onSuccess() {
}
@Override
public void onError() {
// loadRottenPoster=true;
Picasso.with(getApplicationContext()).load("http://52.41.70.254/pics/user.jpg").into(img_seller_image);
}
}
}
| 22,326 | 0.538207 | 0.534175 | 468 | 46.705128 | 35.418537 | 246 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.700855 | false | false | 2 |
f70d85b1298e27081fa0c8fe243aeba0e237f40a | 1,082,331,828,311 | 6cdc3a91999e3fe82bf1d169eec9d360d6d2c645 | /src/main/java/hbasedemo/hbasedemo/constant/TableInfo.java | 3740c72b892d75adccf6d5e3ce7781cf76f3af93 | [] | no_license | JianqingHe/hbase-demo | https://github.com/JianqingHe/hbase-demo | 410294d55a1fc2509a85c9490b196f69177c909f | e27248c400c67be23640e93132a6b6c30b8fcc1f | refs/heads/master | 2022-05-27T17:39:42.578000 | 2019-05-31T09:56:39 | 2019-05-31T09:56:39 | 189,571,458 | 0 | 0 | null | false | 2022-05-20T20:58:50 | 2019-05-31T09:56:36 | 2019-07-16T02:19:22 | 2022-05-20T20:58:50 | 16 | 0 | 0 | 1 | Java | false | false | package hbasedemo.hbasedemo.constant;
/**
* @author hejq
* @date 2019/5/31 11:41
*/
public class TableInfo {
/**
* 表名称
*/
public final static String TABLE_NAME = "hb_test";
/**
* 列名
*/
public final static String ROW_NAME = "user";
/**
* familyName
*/
public final static String FAMILY_NAME = "f1";
}
| UTF-8 | Java | 371 | java | TableInfo.java | Java | [
{
"context": "kage hbasedemo.hbasedemo.constant;\n\n/**\n * @author hejq\n * @date 2019/5/31 11:41\n */\npublic class TableIn",
"end": 58,
"score": 0.9996604919433594,
"start": 54,
"tag": "USERNAME",
"value": "hejq"
}
] | null | [] | package hbasedemo.hbasedemo.constant;
/**
* @author hejq
* @date 2019/5/31 11:41
*/
public class TableInfo {
/**
* 表名称
*/
public final static String TABLE_NAME = "hb_test";
/**
* 列名
*/
public final static String ROW_NAME = "user";
/**
* familyName
*/
public final static String FAMILY_NAME = "f1";
}
| 371 | 0.554017 | 0.520776 | 23 | 14.695652 | 16.653593 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | false | false | 2 |
4d3d3b785f97d8f63f49d18539e23ceb0815c90b | 37,769,942,433,866 | ead22323a82e3f9a1f8fdfe645abda2c67d5101d | /HtmlText/src/com/easy/htmltext/listener/SpannedParser.java | 384899eee7911b4d5744a47f337fc9d30f64a3c1 | [
"Apache-2.0"
] | permissive | KouChengjian/HtmlTextView | https://github.com/KouChengjian/HtmlTextView | 2e0c7e7a45493ec7ccdc69d06858b118fd840be4 | b660631058740e0f979dde21c58bbd70dde29845 | refs/heads/master | 2020-09-22T09:40:50.299000 | 2016-09-06T01:59:49 | 2016-09-06T01:59:49 | 67,213,587 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.easy.htmltext.listener;
import android.text.Html;
import android.text.Spanned;
/**
* Created by zhou on 16-7-27.
*/
public interface SpannedParser {
Spanned parse(String source, Html.ImageGetter imageGetter);
}
| UTF-8 | Java | 233 | java | SpannedParser.java | Java | [
{
"context": "l;\nimport android.text.Spanned;\n\n/**\n * Created by zhou on 16-7-27.\n */\npublic interface SpannedParser {\n",
"end": 115,
"score": 0.9958212375640869,
"start": 111,
"tag": "USERNAME",
"value": "zhou"
}
] | null | [] | package com.easy.htmltext.listener;
import android.text.Html;
import android.text.Spanned;
/**
* Created by zhou on 16-7-27.
*/
public interface SpannedParser {
Spanned parse(String source, Html.ImageGetter imageGetter);
}
| 233 | 0.742489 | 0.72103 | 13 | 16.923077 | 19.261208 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 2 |
83ccf82f0b79d3b446c260e5561b88bc983088db | 39,573,828,673,487 | 4650bcb95e0d926ec24c3c0d8542b580018da417 | /sample/src/main/java/com/meowmau/lifecycle4android/sample/action/ToastAction.java | 364f7f1594c054ed92abccfb6a7c1778b35cc3e9 | [
"BSD-3-Clause"
] | permissive | pickerweng/Lifecycle4Android | https://github.com/pickerweng/Lifecycle4Android | 8b9c5dbb1ae7d9f715617eda125fc2f889898c35 | 4f1cbe990259b652d9fa9186d255b933a2429596 | refs/heads/master | 2021-01-10T05:36:20.384000 | 2015-11-18T13:30:56 | 2015-11-18T13:30:56 | 46,413,456 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2015, Picker Weng
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Lifecycle4Android nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Project:
* Lifecycle4Android
*
* File:
* ToastAction.java
*
* Author:
* Picker Weng (pickerweng@gmail.com)
*/
package com.meowmau.lifecycle4android.sample.action;
import android.app.Activity;
import android.app.Fragment;
import android.widget.Toast;
import com.meowmau.lifecycle4android.core.LifecycleAction;
import com.meowmau.lifecycle4android.app.LifecycleState;
import com.meowmau.lifecycle4android.app.Parameter;
import com.meowmau.lifecycle4android.sample.R;
/**
* A toast action shows the example to display a toast when the lifecycle is in the onPause.
*
* @author Picker Weng <pickerweng@gmail.com>
* @since 2015/11/10
*/
public class ToastAction implements LifecycleAction {
@Override
public void exec(LifecycleState state, Activity activity, Parameter parameter) {
final String appName = activity.getResources().getString(R.string.app_name);
if (state == LifecycleState.OnPause) {
Toast.makeText(activity, String.format("[%s] %s Activity lifecycle %s", appName, getClass().getSimpleName(), state.toString()), Toast.LENGTH_SHORT).show();
}
}
@Override
public void exec(LifecycleState state, Fragment fragment, Parameter parameter) {
final String appName = fragment.getActivity().getResources().getString(R.string.app_name);
if (state == LifecycleState.OnPause) {
Toast.makeText(fragment.getActivity(), String.format("[%s] %s Fragment lifecycle %s", appName, getClass().getSimpleName(), state.toString()), Toast.LENGTH_SHORT).show();
}
}
}
| UTF-8 | Java | 3,143 | java | ToastAction.java | Java | [
{
"context": "/*\n * Copyright (c) 2015, Picker Weng\n * All rights reserved.\n *\n * Redistribution and ",
"end": 37,
"score": 0.9998581409454346,
"start": 26,
"tag": "NAME",
"value": "Picker Weng"
},
{
"context": "File:\n * ToastAction.java\n *\n * Author:\n * Picker Weng (... | null | [] | /*
* Copyright (c) 2015, <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of Lifecycle4Android nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Project:
* Lifecycle4Android
*
* File:
* ToastAction.java
*
* Author:
* <NAME> (<EMAIL>)
*/
package com.meowmau.lifecycle4android.sample.action;
import android.app.Activity;
import android.app.Fragment;
import android.widget.Toast;
import com.meowmau.lifecycle4android.core.LifecycleAction;
import com.meowmau.lifecycle4android.app.LifecycleState;
import com.meowmau.lifecycle4android.app.Parameter;
import com.meowmau.lifecycle4android.sample.R;
/**
* A toast action shows the example to display a toast when the lifecycle is in the onPause.
*
* @author <NAME> <<EMAIL>>
* @since 2015/11/10
*/
public class ToastAction implements LifecycleAction {
@Override
public void exec(LifecycleState state, Activity activity, Parameter parameter) {
final String appName = activity.getResources().getString(R.string.app_name);
if (state == LifecycleState.OnPause) {
Toast.makeText(activity, String.format("[%s] %s Activity lifecycle %s", appName, getClass().getSimpleName(), state.toString()), Toast.LENGTH_SHORT).show();
}
}
@Override
public void exec(LifecycleState state, Fragment fragment, Parameter parameter) {
final String appName = fragment.getActivity().getResources().getString(R.string.app_name);
if (state == LifecycleState.OnPause) {
Toast.makeText(fragment.getActivity(), String.format("[%s] %s Fragment lifecycle %s", appName, getClass().getSimpleName(), state.toString()), Toast.LENGTH_SHORT).show();
}
}
}
| 3,102 | 0.742284 | 0.736239 | 73 | 42.054794 | 38.899902 | 181 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.671233 | false | false | 2 |
13b6e4828f594202867b6c3547d8a8af08234710 | 24,567,213,003,783 | 1fcfc8d3c8e8eee746a143c6209686055f6c676b | /session8-master/src/comparatorexample/App.java | 69403a6092c8ae03d44c54722fd0cdb6997afb9e | [] | no_license | alialaghbandrad/Java-2-Object-Oriented-Programming | https://github.com/alialaghbandrad/Java-2-Object-Oriented-Programming | d2b81f384e9e3d45cf57feee0dca9576563b34af | c79285298bca3d2208bbd7263abf781e7863a03e | refs/heads/main | 2023-06-07T05:05:48.813000 | 2021-06-25T22:27:30 | 2021-06-25T22:27:30 | 380,361,779 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package comparatorexample;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
class Student {
private String name;
private int score;
public Student(String name, int score) {
this.name = name;
this.score = score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
@Override
public String toString() {
return "Student [name=" + name + ", score=" + score + "]";
}
}
class Employee {
private String name;
private double salary;
public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
if (salary >= 0.0) {
this.salary = salary;
}
this.salary = 0.0;
}
@Override
public String toString() {
return "Employee [name=" + name + ", salary=" + salary + "]";
}
}
public class App {
public static void main(String[] args) {
// List<Employee> listEmployee = new ArrayList<Employee>();
//
// Employee emp1 = new Employee("B", 1000);
// listEmployee.add(emp1);
//
// listEmployee.add(new Employee("A", 4000));
// listEmployee.add(new Employee("D", 2000));
// listEmployee.add(new Employee("C", 6000));
//
//
// for(Employee emp : listEmployee) {
// System.out.println(emp);
// }
//
// //To sort the data and then send the data
// //Collections.sort(listEmployee);
//
// System.out.println("after sort");
//
//
// for(Employee emp : listEmployee) {
// System.out.println(emp);
// }
List<Student> studentList= new ArrayList<Student>();
studentList.add(new Student("TOTO", 6));
studentList.add(new Student("POPO", 1));
studentList.add(new Student("JOJO", 8));
studentList.add(new Student("COCO", 4));
studentList.forEach(std -> System.out.println(std));
Collections.sort(studentList, new ScoreCompartor());
System.out.println("after sort by score");
studentList.forEach(std -> System.out.println(std));
Collections.sort(studentList, new NameCompartor());
System.out.println("after sort by name");
studentList.forEach(std -> System.out.println(std));
//java 8 comparator
Comparator<Student> cm2 = Comparator.comparing(Student::getScore);
Collections.sort(studentList, cm2);
}
}
| UTF-8 | Java | 2,618 | java | App.java | Java | [
{
"context": "ayList<Student>();\n\t\tstudentList.add(new Student(\"TOTO\", 6));\n\t\tstudentList.add(new Student(\"POPO\", 1));",
"end": 1937,
"score": 0.9996197819709778,
"start": 1933,
"tag": "NAME",
"value": "TOTO"
},
{
"context": "udent(\"TOTO\", 6));\n\t\tstudentList.add(new St... | null | [] | package comparatorexample;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
class Student {
private String name;
private int score;
public Student(String name, int score) {
this.name = name;
this.score = score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
@Override
public String toString() {
return "Student [name=" + name + ", score=" + score + "]";
}
}
class Employee {
private String name;
private double salary;
public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
if (salary >= 0.0) {
this.salary = salary;
}
this.salary = 0.0;
}
@Override
public String toString() {
return "Employee [name=" + name + ", salary=" + salary + "]";
}
}
public class App {
public static void main(String[] args) {
// List<Employee> listEmployee = new ArrayList<Employee>();
//
// Employee emp1 = new Employee("B", 1000);
// listEmployee.add(emp1);
//
// listEmployee.add(new Employee("A", 4000));
// listEmployee.add(new Employee("D", 2000));
// listEmployee.add(new Employee("C", 6000));
//
//
// for(Employee emp : listEmployee) {
// System.out.println(emp);
// }
//
// //To sort the data and then send the data
// //Collections.sort(listEmployee);
//
// System.out.println("after sort");
//
//
// for(Employee emp : listEmployee) {
// System.out.println(emp);
// }
List<Student> studentList= new ArrayList<Student>();
studentList.add(new Student("TOTO", 6));
studentList.add(new Student("POPO", 1));
studentList.add(new Student("JOJO", 8));
studentList.add(new Student("COCO", 4));
studentList.forEach(std -> System.out.println(std));
Collections.sort(studentList, new ScoreCompartor());
System.out.println("after sort by score");
studentList.forEach(std -> System.out.println(std));
Collections.sort(studentList, new NameCompartor());
System.out.println("after sort by name");
studentList.forEach(std -> System.out.println(std));
//java 8 comparator
Comparator<Student> cm2 = Comparator.comparing(Student::getScore);
Collections.sort(studentList, cm2);
}
}
| 2,618 | 0.648969 | 0.637892 | 153 | 16.111111 | 18.363987 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.607843 | false | false | 2 |
c75ec76b68063a468dab32a22b6b18710f608016 | 28,501,402,999,981 | e34ca8a3906ef27b40858a8be8f3f6a434f68726 | /src/Assigment/C6.java | 79c248a8f2c6a9837c7886188f9549ed0591e7c9 | [] | no_license | Rahulsharma713096/Simple-Java-Programs | https://github.com/Rahulsharma713096/Simple-Java-Programs | edc7783300159e543960d0fd743130e7e6f0c43a | 381e71b3b4f5954ea390fd335bdda60a955df403 | refs/heads/master | 2022-12-11T22:57:53.776000 | 2020-09-02T05:44:07 | 2020-09-02T05:44:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Assigment;
import java.util.Scanner;
public class C6 {
public static void main(String[] args) { int temp;
Scanner sc=new Scanner(System.in);
System.out.println("Enter The size of array:");
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<=arr.length-1;i++) {
System.out.println("Enter the"+i+"th values:");
arr[i]=sc.nextInt();}
System.out.println("The Arrays values Before Sorting:");
for(int i=0;i<=arr.length-1;i++) {
System.out.print(arr[i]+" ");}
//Selection Sorting
for(int i=0;i<=arr.length-1;i++) {
for(int j=i;j<=arr.length-1;j++) {
if(arr[i]>arr[j]) { temp=arr[i]; arr[i]=arr[j]; arr[j]=temp;}
}
}
System.out.println("\n The Arrays values After Sorting:");
for(int i=0;i<=arr.length-1;i++) {
System.out.print(arr[i]+" ");}
sc.close();
}
}
| UTF-8 | Java | 913 | java | C6.java | Java | [] | null | [] | package Assigment;
import java.util.Scanner;
public class C6 {
public static void main(String[] args) { int temp;
Scanner sc=new Scanner(System.in);
System.out.println("Enter The size of array:");
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<=arr.length-1;i++) {
System.out.println("Enter the"+i+"th values:");
arr[i]=sc.nextInt();}
System.out.println("The Arrays values Before Sorting:");
for(int i=0;i<=arr.length-1;i++) {
System.out.print(arr[i]+" ");}
//Selection Sorting
for(int i=0;i<=arr.length-1;i++) {
for(int j=i;j<=arr.length-1;j++) {
if(arr[i]>arr[j]) { temp=arr[i]; arr[i]=arr[j]; arr[j]=temp;}
}
}
System.out.println("\n The Arrays values After Sorting:");
for(int i=0;i<=arr.length-1;i++) {
System.out.print(arr[i]+" ");}
sc.close();
}
}
| 913 | 0.549836 | 0.538883 | 26 | 32.96154 | 15.887781 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.923077 | false | false | 2 |
dd1a292203e46f6a97f2fd0a127de360a915fd2e | 7,791,070,731,429 | de6128d5e4221677aef571a876df8b53a08b5cd3 | /android/04-gestureListener/app/src/main/java/com/github/chetangandhi/gestureListener/MyTextView.java | 98f4a42a5c6c521e011675460544159bf9bf5355 | [] | no_license | ssijonson/realTimeRendering | https://github.com/ssijonson/realTimeRendering | 2d97fa7a20d94aae460a8496283247c1c5ad962f | d0a37138dbf8a618976ac292ee35e67382499601 | refs/heads/master | 2023-03-16T19:48:29.889000 | 2018-10-16T19:35:58 | 2018-10-16T19:35:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.chetangandhi.gestureListener;
import android.widget.TextView;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.GestureDetector.OnDoubleTapListener;
public class MyTextView extends TextView implements OnGestureListener, OnDoubleTapListener {
private GestureDetector gestureDetector = null;
MyTextView(Context context) {
super(context);
this.setText(R.string.text_message);
this.setTextSize(60);
this.setTextColor(Color.GREEN);
this.setGravity(Gravity.CENTER);
this.gestureDetector = new GestureDetector(context, this, null, false);
this.gestureDetector.setOnDoubleTapListener(this);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int eventAction = event.getAction();
if (!this.gestureDetector.onTouchEvent(event)) {
super.onTouchEvent(event);
}
return true;
}
@Override
public boolean onDoubleTap(MotionEvent event) {
this.setText(R.string.text_double_tap);
return true;
}
@Override
public boolean onDoubleTapEvent(MotionEvent event) {
// Do nothing here as we have implemented onDoubleTap methid, just return true.
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent event) {
this.setText(R.string.text_single_tap_confirmed);
return true;
}
@Override
public boolean onDown(MotionEvent event) {
// Do nothing here as we have implemented onSingleTapConfirmed method, just return true.
return true;
}
@Override
public boolean onFling(MotionEvent eventStart, MotionEvent eventEnd, float velocityX, float velocityY) {
this.setText(R.string.text_fling);
return true;
}
@Override
public void onLongPress(MotionEvent event) {
this.setText(R.string.text_long_press);
}
@Override
public void onShowPress(MotionEvent event) {
}
@Override
public boolean onScroll(MotionEvent eventStart, MotionEvent eventEnd, float distanceX, float distanceY) {
this.setText(R.string.text_scroll);
return true;
}
@Override
public boolean onSingleTapUp(MotionEvent event) {
return true;
}
}
| UTF-8 | Java | 2,466 | java | MyTextView.java | Java | [
{
"context": "package com.github.chetangandhi.gestureListener;\n\nimport android.widget.TextView;",
"end": 31,
"score": 0.9769217371940613,
"start": 19,
"tag": "USERNAME",
"value": "chetangandhi"
}
] | null | [] | package com.github.chetangandhi.gestureListener;
import android.widget.TextView;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.GestureDetector.OnDoubleTapListener;
public class MyTextView extends TextView implements OnGestureListener, OnDoubleTapListener {
private GestureDetector gestureDetector = null;
MyTextView(Context context) {
super(context);
this.setText(R.string.text_message);
this.setTextSize(60);
this.setTextColor(Color.GREEN);
this.setGravity(Gravity.CENTER);
this.gestureDetector = new GestureDetector(context, this, null, false);
this.gestureDetector.setOnDoubleTapListener(this);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int eventAction = event.getAction();
if (!this.gestureDetector.onTouchEvent(event)) {
super.onTouchEvent(event);
}
return true;
}
@Override
public boolean onDoubleTap(MotionEvent event) {
this.setText(R.string.text_double_tap);
return true;
}
@Override
public boolean onDoubleTapEvent(MotionEvent event) {
// Do nothing here as we have implemented onDoubleTap methid, just return true.
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent event) {
this.setText(R.string.text_single_tap_confirmed);
return true;
}
@Override
public boolean onDown(MotionEvent event) {
// Do nothing here as we have implemented onSingleTapConfirmed method, just return true.
return true;
}
@Override
public boolean onFling(MotionEvent eventStart, MotionEvent eventEnd, float velocityX, float velocityY) {
this.setText(R.string.text_fling);
return true;
}
@Override
public void onLongPress(MotionEvent event) {
this.setText(R.string.text_long_press);
}
@Override
public void onShowPress(MotionEvent event) {
}
@Override
public boolean onScroll(MotionEvent eventStart, MotionEvent eventEnd, float distanceX, float distanceY) {
this.setText(R.string.text_scroll);
return true;
}
@Override
public boolean onSingleTapUp(MotionEvent event) {
return true;
}
}
| 2,466 | 0.693431 | 0.69262 | 89 | 26.707865 | 26.801477 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.494382 | false | false | 2 |
f45c96458c376186a9ffe9cef2327aad745c5ea8 | 11,836,929,914,406 | e1ca2583af84ff12a09f9f698bc638ea9f9676cb | /src/io/gearworks/turfpoints/database/DatabaseManager.java | 8f9540ba9350b8020313617b90999d3a8a78e2d1 | [] | no_license | Gearworks/TurfPoints | https://github.com/Gearworks/TurfPoints | 8a190a3fe52ce8e009552827d1c06114bf0527ba | e3f1d943b917866126d8812a955f379ad96ff554 | refs/heads/master | 2021-01-01T18:29:06.998000 | 2014-05-28T00:26:34 | 2014-05-28T00:26:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.gearworks.turfpoints.database;
import io.gearworks.turfpoints.TurfPoints;
import io.gearworks.turfpoints.database.queries.QueryAddCredits;
import io.gearworks.turfpoints.database.queries.QueryAddPoints;
import io.gearworks.turfpoints.database.task.Consumer;
import io.gearworks.turfpoints.player.LocalPlayer;
import io.gearworks.turfpoints.utilities.Messaging;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DatabaseManager {
private ConnectionPool connectionPool;
private Consumer consumer;
private FileConfiguration config = TurfPoints.getInstance ().getConfig ();
private Connection conn;
public DatabaseManager (){
try{
Messaging.info (config.getString ("mysql.host"));
connectionPool = new ConnectionPool (config.getString ("mysql.host"),
config.getInt ("mysql.port"),
config.getString ("mysql.database"),
config.getString ("mysql.user"),
config.getString ("mysql.pass"));
Connection connection = connectionPool.getConnection ();
if (connection == null){
Messaging.severe ("Could not create a connection to the MySQL server, stopping plugin...");
Bukkit.getPluginManager ().disablePlugin (TurfPoints.getInstance ());
}
connection.close ();
} catch (NullPointerException exception){
Messaging.severe ("Error while initializing: %s", new Object[]{exception.getMessage ()});
exception.printStackTrace();
} catch (Exception exception){
Messaging.severe ("Error while initializing: %s", new Object[]{exception.getMessage ()});
exception.printStackTrace();
}
consumer = new Consumer ();
conn = getMysqlConnection ();
}
/**
* Made static to be easily accessed across the plugin to allow other classes to queue queries
*
* @return consumer
*/
public Consumer getConsumer (){
return consumer;
}
/**
*
* @return the connection to the MySQL server
*/
private Connection getMysqlConnection (){
try{
return connectionPool.getConnection ();
}catch (SQLException exception){
Messaging.severe ("SQL Exception while fetching connection: %s", new Object[]{exception.getMessage ()});
exception.printStackTrace ();
}
return null;
}
public Connection getConnection (){
return conn;
}
/**
* Will run a result set to check to see if we get any values back from the credits table
*
* @param playerName
* @return true if the player exists in the database, otherwise false
*/
public boolean playerExistsCredits (final String playerName) throws SQLException{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM credits WHERE playername = '%s'", playerName)).executeQuery ();
if (rs.next ()){
return true;
}
rs.close ();
return false;
}
/**
* Will run a result set to check to see if we get any values back from the points table
*
* @param playerName
* @return true if the player exists in the database, otherwise false
*/
public boolean playerExistsPoints (final String playerName) throws SQLException{
ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM points WHERE playername = '%s'", playerName)).executeQuery ();
if (rs.next ()){
return true;
}
rs.close ();
return false;
}
/**
* Needs to be done right away in order for the player loading to happen with nothing null
*
* @param localPlayer
*/
public void createPlayerCredits (final String localPlayer) throws SQLException{
final PreparedStatement ps = conn.prepareStatement (String.format ("INSERT INTO credits (`playername`, `points`, `online`) VALUES ('%s', 0, 1)",
localPlayer));
ps.execute ();
}
/**
* Needs to be done right away in order for the player loading to happen with nothing null
*
* @param localPlayer
*/
public void createPlayerPoints (final String localPlayer) throws SQLException{
final PreparedStatement ps = conn.prepareStatement (String.format ("INSERT INTO points (`playername`, `points`) VALUES ('%s', 0)",
localPlayer));
ps.execute ();
}
public int getPlayerPoints (final LocalPlayer localPlayer){
try{
if (!playerExistsPoints (localPlayer.getBukkitPlayer ().getName ()))
createPlayerPoints (localPlayer.getBukkitPlayer ().getName ());
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM points WHERE playername = '%s'", localPlayer.getBukkitPlayer ().getName ())).executeQuery ();
while (rs.next ()){
return rs.getInt ("points");
}
}catch (SQLException e) {
e.printStackTrace ();
}
return -1;
}
public void addPlayerPoints (int points, String name){
try{
if (!playerExistsPoints (name))
createPlayerPoints (name);
getConsumer ().queueQuery (new QueryAddPoints (points, name));
}catch(SQLException e){
e.printStackTrace ();
}
}
public int getPlayerCredits (final LocalPlayer localPlayer){
try{
// Need to create the player into the database
if (!playerExistsCredits (localPlayer.getBukkitPlayer ().getName ()))
createPlayerCredits (localPlayer.getBukkitPlayer ().getName ());
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `credits` WHERE playername = '%s'", localPlayer.getBukkitPlayer ().getName ())).executeQuery ();
while (rs.next ()){
return rs.getInt ("points");
}
}catch (SQLException e){
e.printStackTrace ();
}
return -1;
}
public void addPlayerCredits (int points, String name){
try{
if (!playerExistsCredits (name))
createPlayerCredits (name);
getConsumer ().queueQuery (new QueryAddCredits (points, name));
}catch(SQLException e){
e.printStackTrace ();
}
}
/**
*
* @param name
* @return true if the player has their name into the vbver table, otherwise false
*/
public boolean isLinkedAttempted (final String name){
try{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `vbver` WHERE `mcname` = '%s'", name)).executeQuery ();
while (rs.next ())
return true;
}catch(SQLException e){
e.printStackTrace ();
}
return false;
}
/**
*
* @param name
* @param key
* @return true if the player enters the same key in the database, otherwise false
*/
public boolean keyMatches (final String name, final String key){
try{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `vbver` WHERE `mcname` = '%s'", name)).executeQuery ();
while (rs.next ()){
if (key.equals (rs.getString ("verkey"))) return true;
}
}catch (SQLException e){
e.printStackTrace ();
}
return false;
}
/**
*
* @param name
* @return true if the player has already been verified, otherwise false
*/
public boolean isVerified (final String name){
try{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `vbver` WHERE `mcname` = '%s'", name)).executeQuery ();
while (rs.next ()){
if (rs.getInt ("verified") == 1)
return true;
}
}catch (SQLException e){
e.printStackTrace ();
}
return false;
}
}
| UTF-8 | Java | 8,417 | java | DatabaseManager.java | Java | [] | null | [] | package io.gearworks.turfpoints.database;
import io.gearworks.turfpoints.TurfPoints;
import io.gearworks.turfpoints.database.queries.QueryAddCredits;
import io.gearworks.turfpoints.database.queries.QueryAddPoints;
import io.gearworks.turfpoints.database.task.Consumer;
import io.gearworks.turfpoints.player.LocalPlayer;
import io.gearworks.turfpoints.utilities.Messaging;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DatabaseManager {
private ConnectionPool connectionPool;
private Consumer consumer;
private FileConfiguration config = TurfPoints.getInstance ().getConfig ();
private Connection conn;
public DatabaseManager (){
try{
Messaging.info (config.getString ("mysql.host"));
connectionPool = new ConnectionPool (config.getString ("mysql.host"),
config.getInt ("mysql.port"),
config.getString ("mysql.database"),
config.getString ("mysql.user"),
config.getString ("mysql.pass"));
Connection connection = connectionPool.getConnection ();
if (connection == null){
Messaging.severe ("Could not create a connection to the MySQL server, stopping plugin...");
Bukkit.getPluginManager ().disablePlugin (TurfPoints.getInstance ());
}
connection.close ();
} catch (NullPointerException exception){
Messaging.severe ("Error while initializing: %s", new Object[]{exception.getMessage ()});
exception.printStackTrace();
} catch (Exception exception){
Messaging.severe ("Error while initializing: %s", new Object[]{exception.getMessage ()});
exception.printStackTrace();
}
consumer = new Consumer ();
conn = getMysqlConnection ();
}
/**
* Made static to be easily accessed across the plugin to allow other classes to queue queries
*
* @return consumer
*/
public Consumer getConsumer (){
return consumer;
}
/**
*
* @return the connection to the MySQL server
*/
private Connection getMysqlConnection (){
try{
return connectionPool.getConnection ();
}catch (SQLException exception){
Messaging.severe ("SQL Exception while fetching connection: %s", new Object[]{exception.getMessage ()});
exception.printStackTrace ();
}
return null;
}
public Connection getConnection (){
return conn;
}
/**
* Will run a result set to check to see if we get any values back from the credits table
*
* @param playerName
* @return true if the player exists in the database, otherwise false
*/
public boolean playerExistsCredits (final String playerName) throws SQLException{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM credits WHERE playername = '%s'", playerName)).executeQuery ();
if (rs.next ()){
return true;
}
rs.close ();
return false;
}
/**
* Will run a result set to check to see if we get any values back from the points table
*
* @param playerName
* @return true if the player exists in the database, otherwise false
*/
public boolean playerExistsPoints (final String playerName) throws SQLException{
ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM points WHERE playername = '%s'", playerName)).executeQuery ();
if (rs.next ()){
return true;
}
rs.close ();
return false;
}
/**
* Needs to be done right away in order for the player loading to happen with nothing null
*
* @param localPlayer
*/
public void createPlayerCredits (final String localPlayer) throws SQLException{
final PreparedStatement ps = conn.prepareStatement (String.format ("INSERT INTO credits (`playername`, `points`, `online`) VALUES ('%s', 0, 1)",
localPlayer));
ps.execute ();
}
/**
* Needs to be done right away in order for the player loading to happen with nothing null
*
* @param localPlayer
*/
public void createPlayerPoints (final String localPlayer) throws SQLException{
final PreparedStatement ps = conn.prepareStatement (String.format ("INSERT INTO points (`playername`, `points`) VALUES ('%s', 0)",
localPlayer));
ps.execute ();
}
public int getPlayerPoints (final LocalPlayer localPlayer){
try{
if (!playerExistsPoints (localPlayer.getBukkitPlayer ().getName ()))
createPlayerPoints (localPlayer.getBukkitPlayer ().getName ());
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM points WHERE playername = '%s'", localPlayer.getBukkitPlayer ().getName ())).executeQuery ();
while (rs.next ()){
return rs.getInt ("points");
}
}catch (SQLException e) {
e.printStackTrace ();
}
return -1;
}
public void addPlayerPoints (int points, String name){
try{
if (!playerExistsPoints (name))
createPlayerPoints (name);
getConsumer ().queueQuery (new QueryAddPoints (points, name));
}catch(SQLException e){
e.printStackTrace ();
}
}
public int getPlayerCredits (final LocalPlayer localPlayer){
try{
// Need to create the player into the database
if (!playerExistsCredits (localPlayer.getBukkitPlayer ().getName ()))
createPlayerCredits (localPlayer.getBukkitPlayer ().getName ());
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `credits` WHERE playername = '%s'", localPlayer.getBukkitPlayer ().getName ())).executeQuery ();
while (rs.next ()){
return rs.getInt ("points");
}
}catch (SQLException e){
e.printStackTrace ();
}
return -1;
}
public void addPlayerCredits (int points, String name){
try{
if (!playerExistsCredits (name))
createPlayerCredits (name);
getConsumer ().queueQuery (new QueryAddCredits (points, name));
}catch(SQLException e){
e.printStackTrace ();
}
}
/**
*
* @param name
* @return true if the player has their name into the vbver table, otherwise false
*/
public boolean isLinkedAttempted (final String name){
try{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `vbver` WHERE `mcname` = '%s'", name)).executeQuery ();
while (rs.next ())
return true;
}catch(SQLException e){
e.printStackTrace ();
}
return false;
}
/**
*
* @param name
* @param key
* @return true if the player enters the same key in the database, otherwise false
*/
public boolean keyMatches (final String name, final String key){
try{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `vbver` WHERE `mcname` = '%s'", name)).executeQuery ();
while (rs.next ()){
if (key.equals (rs.getString ("verkey"))) return true;
}
}catch (SQLException e){
e.printStackTrace ();
}
return false;
}
/**
*
* @param name
* @return true if the player has already been verified, otherwise false
*/
public boolean isVerified (final String name){
try{
final ResultSet rs = conn.prepareStatement (String.format ("SELECT * FROM `vbver` WHERE `mcname` = '%s'", name)).executeQuery ();
while (rs.next ()){
if (rs.getInt ("verified") == 1)
return true;
}
}catch (SQLException e){
e.printStackTrace ();
}
return false;
}
}
| 8,417 | 0.59261 | 0.591897 | 252 | 32.400795 | 36.036385 | 183 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 2 |
1c6b890e7eaffd6c2b6b622902d47a1f911d0d93 | 13,013,750,958,319 | a7b58cc6176c1beba8ddb65ed0ff1ae2fe9fb5f9 | /app/src/main/java/com/example/makeaguess/ProfileFrag.java | 96e73f78f0d74985b39ba12d44e85ef5edf957d8 | [] | no_license | Sayantan729/MakeAGuessGuessingGame | https://github.com/Sayantan729/MakeAGuessGuessingGame | 4275d718214edce340dbab5ebcee9a6dc4abf850 | 0ade4612b9164208f7234d0811167e343e40f67d | refs/heads/master | 2020-06-24T06:25:26.810000 | 2019-08-16T18:16:08 | 2019-08-16T18:16:08 | 198,879,195 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.makeaguess;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import io.realm.Realm;
import io.realm.RealmResults;
import io.realm.Sort;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
*
* to handle interaction events.
* Use the {@link ProfileFrag#newInstance} factory method to
* create an instance of this fragment.
*/
public class ProfileFrag extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private TextView profilename,ranka,rankf,animalcurrent,animalbest,flowercurrent,flowerbest;
public ProfileFrag() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment ProfileFrag.
*/
// TODO: Rename and change types and number of parameters
public static ProfileFrag newInstance(String param1, String param2) {
ProfileFrag fragment = new ProfileFrag();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_profile, container, false);
profilename=view.findViewById(R.id.profilename);
ranka=view.findViewById(R.id.ranka);
rankf=view.findViewById(R.id.rankf);
animalbest=view.findViewById(R.id.animalbest);
animalcurrent=view.findViewById(R.id.animalcurrent);
flowerbest=view.findViewById(R.id.flowerbest);
flowercurrent=view.findViewById(R.id.flowercurrent);
Realm realm=Realm.getDefaultInstance();
String name=getArguments().getString("Name");
Player playerb=realm.where(Player.class).equalTo("id",name+"flowers").findFirst();
Player playera=realm.where(Player.class).equalTo("id",name+"animals").findFirst();
RealmResults<Player> a=realm.where(Player.class).equalTo("gametype","animals")
.findAll().sort("score", Sort.DESCENDING);
RealmResults<Player> b=realm.where(Player.class).equalTo("gametype","flowers")
.findAll().sort("score", Sort.DESCENDING);
profilename.setText(name);
if(playera==null)
{
ranka.setText("Animals\nNone");
//rankf.setText("Flowers\nNone");
animalcurrent.setText("0");
animalbest.setText("0");
}
else
{
int rank=a.indexOf(playera);
ranka.setText("Animals\n"+(rank+1));
animalcurrent.setText(""+playera.getScore());
animalbest.setText(""+playera.getBestScore());
}
if(playerb==null)
{
rankf.setText("Flowers\nNone");
flowercurrent.setText("0");
flowerbest.setText("0");
}
else
{
int rank=b.indexOf(playerb);
rankf.setText("Flowers\n"+(rank+1));
flowercurrent.setText(""+playerb.getScore());
flowerbest.setText(""+playerb.getBestScore());
}
return view;
}
// TODO: Rename method, update argument and hook method into UI event
@Override
public void onDetach() {
super.onDetach();
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
}
| UTF-8 | Java | 4,877 | java | ProfileFrag.java | Java | [] | null | [] | package com.example.makeaguess;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import io.realm.Realm;
import io.realm.RealmResults;
import io.realm.Sort;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
*
* to handle interaction events.
* Use the {@link ProfileFrag#newInstance} factory method to
* create an instance of this fragment.
*/
public class ProfileFrag extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private TextView profilename,ranka,rankf,animalcurrent,animalbest,flowercurrent,flowerbest;
public ProfileFrag() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment ProfileFrag.
*/
// TODO: Rename and change types and number of parameters
public static ProfileFrag newInstance(String param1, String param2) {
ProfileFrag fragment = new ProfileFrag();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_profile, container, false);
profilename=view.findViewById(R.id.profilename);
ranka=view.findViewById(R.id.ranka);
rankf=view.findViewById(R.id.rankf);
animalbest=view.findViewById(R.id.animalbest);
animalcurrent=view.findViewById(R.id.animalcurrent);
flowerbest=view.findViewById(R.id.flowerbest);
flowercurrent=view.findViewById(R.id.flowercurrent);
Realm realm=Realm.getDefaultInstance();
String name=getArguments().getString("Name");
Player playerb=realm.where(Player.class).equalTo("id",name+"flowers").findFirst();
Player playera=realm.where(Player.class).equalTo("id",name+"animals").findFirst();
RealmResults<Player> a=realm.where(Player.class).equalTo("gametype","animals")
.findAll().sort("score", Sort.DESCENDING);
RealmResults<Player> b=realm.where(Player.class).equalTo("gametype","flowers")
.findAll().sort("score", Sort.DESCENDING);
profilename.setText(name);
if(playera==null)
{
ranka.setText("Animals\nNone");
//rankf.setText("Flowers\nNone");
animalcurrent.setText("0");
animalbest.setText("0");
}
else
{
int rank=a.indexOf(playera);
ranka.setText("Animals\n"+(rank+1));
animalcurrent.setText(""+playera.getScore());
animalbest.setText(""+playera.getBestScore());
}
if(playerb==null)
{
rankf.setText("Flowers\nNone");
flowercurrent.setText("0");
flowerbest.setText("0");
}
else
{
int rank=b.indexOf(playerb);
rankf.setText("Flowers\n"+(rank+1));
flowercurrent.setText(""+playerb.getScore());
flowerbest.setText(""+playerb.getBestScore());
}
return view;
}
// TODO: Rename method, update argument and hook method into UI event
@Override
public void onDetach() {
super.onDetach();
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
}
| 4,877 | 0.64999 | 0.644659 | 143 | 33.104897 | 25.434053 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.559441 | false | false | 2 |
03fc7bb1539be36b8606ed23a8d82ed18607a12d | 23,124,103,978,499 | 27bef9c15f3a083b0d518257431e2ab0e5dc3f8c | /src/main/java/vn/com/vuong/main/TemplateTest.java | 677f362c44120001e46ea229bbf94af861dd4dbd | [] | no_license | BuiVuong0105/RedisCacheJava | https://github.com/BuiVuong0105/RedisCacheJava | 7f3b5df35bcf485c82ef4f166145e5c701842dfe | 4210eff1f8bdf5bad65dda029033b902afb42c17 | refs/heads/master | 2020-03-25T11:55:21.588000 | 2018-08-06T16:20:58 | 2018-08-06T16:20:58 | 143,753,948 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vn.com.vuong.main;
import java.util.List;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import vn.com.vuong.config.ApplicationConfig;
import vn.com.vuong.entity.Person;
public class TemplateTest {
static ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfig.class);
static RedisTemplate<String, Person> redisTemplate = (RedisTemplate) context.getBean("redisTemplate");
static StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) context.getBean("stringRedisTemplate");
public static void stringTemplateTest() {
ValueOperations<String, String> valueOps = stringRedisTemplate.opsForValue();
valueOps.set("vuong", "Bui");
System.out.println(valueOps.get("vuong"));
}
public static void simpleValueOperation() {
ValueOperations<String, Person> valueOperations = redisTemplate.opsForValue();
valueOperations.set("vuong", new Person("Vuong", 24, "Ha Noi"));
System.out.println(valueOperations.get("vuong"));
}
public static void listValueOperation () {
ListOperations<String, Person> listOperations = redisTemplate.opsForList();
listOperations.rightPush("listPerson", new Person("Vuong", 24, "Ha Noi"));
listOperations.rightPush("listPerson", new Person("Toan", 16, "Ha Noi"));
listOperations.leftPush("listPerson", new Person("Dang", 24, "Ha Noi"));
System.out.println(listOperations.leftPop("listPerson"));// Dang
System.out.println(listOperations.rightPop("listPerson"));// Toan
System.out.println(listOperations.index("listPerson", 1)); // Toan
List<Person> listPerson = listOperations.range("listPerson", 1, 2);
System.out.println(listPerson);// vuong
}
public static void setValueOperation () {
SetOperations<String, Person> setOperations = redisTemplate.opsForSet();
setOperations.add("setPerson0", new Person("Vuong", 24, "Ha Noi"));
setOperations.add("setPerson0", new Person("Tiến", 24, "Ha Noi"));
setOperations.add("setPerson1", new Person("Toan", 16, "Ha Noi"));
setOperations.add("setPerson2", new Person("Dang", 24, "Ha Noi"));
setOperations.add("setPerson2", new Person("Tiến", 24, "Ha Noi"));
System.out.println(setOperations.members("setPerson0"));// Lấy tất cả các member của set0
System.out.println(setOperations.difference("setPerson0", "setPerson1")); // Person trong setPerson khác vs setPerson1
System.out.println(setOperations.union("setPerson0", "setPerson1")); // Gôp 2 Set thành 1
System.out.println(setOperations.intersect("setPerson0", "setPerson2")); // Person trong set0 và set2
setOperations.remove("setPerson", new Person("Vuong", 24, "Ha Noi")); // Remove person trong Set
System.out.println(setOperations.pop("setPerson")); // Lấy ra và Remove trong set
}
public static void hashOperations() {
HashOperations<String, String, Person> hashOperations = redisTemplate.opsForHash();
hashOperations.putIfAbsent("persons", "p1", new Person("Vuong", 24, "Ha Noi")); // Sets the value of a hash hashKey only if hashKey does not exist.
hashOperations.put("persons", "p1", new Person("Loan", 24, "Ha Noi")); // Sets the value of a hash hashKey.
System.out.println("P1: "+ hashOperations.get("persons", "p1"));//Get value for given hashKey from hash at key.
System.out.println("Size: "+hashOperations.size("persons"));//Get size of hash at key.
Map<String, Person> map = hashOperations.entries("persons"); //Get entire hash stored at key.
System.out.println("Map: " + map);
System.out.println("Delete: " + hashOperations.delete("persons", "p1"));// Delete given hash hashKeys.
System.out.println("Map: " + map);
}
public static void boundListOperations() {
BoundListOperations<String, Person> cart = redisTemplate.boundListOps("cart");
System.out.println(cart.rightPop()); // Return and Remove last element bound key
cart.rightPush(new Person("Vuong", 24, "Ha Noi"));
cart.rightPush(new Person("Tien", 24, "Ha Noi"));
cart.rightPush(new Person("Tung", 24, "Ha Noi"));
System.out.println(cart.rightPop()); // Tung
System.out.println(cart.leftPop());// Vuong
}
public static void main(String[] args) {
stringTemplateTest();
simpleValueOperation();
listValueOperation();
setValueOperation();
hashOperations();
boundListOperations();
}
}
| UTF-8 | Java | 4,811 | java | TemplateTest.java | Java | [
{
"context": "lue();\n\t\tvalueOperations.set(\"vuong\", new Person(\"Vuong\", 24, \"Ha Noi\"));\n\t\tSystem.out.println(valueOpera",
"end": 1445,
"score": 0.9847316145896912,
"start": 1440,
"tag": "NAME",
"value": "Vuong"
},
{
"context": "istOperations.rightPush(\"listPerson\", new ... | null | [] | package vn.com.vuong.main;
import java.util.List;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import vn.com.vuong.config.ApplicationConfig;
import vn.com.vuong.entity.Person;
public class TemplateTest {
static ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfig.class);
static RedisTemplate<String, Person> redisTemplate = (RedisTemplate) context.getBean("redisTemplate");
static StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) context.getBean("stringRedisTemplate");
public static void stringTemplateTest() {
ValueOperations<String, String> valueOps = stringRedisTemplate.opsForValue();
valueOps.set("vuong", "Bui");
System.out.println(valueOps.get("vuong"));
}
public static void simpleValueOperation() {
ValueOperations<String, Person> valueOperations = redisTemplate.opsForValue();
valueOperations.set("vuong", new Person("Vuong", 24, "Ha Noi"));
System.out.println(valueOperations.get("vuong"));
}
public static void listValueOperation () {
ListOperations<String, Person> listOperations = redisTemplate.opsForList();
listOperations.rightPush("listPerson", new Person("Vuong", 24, "Ha Noi"));
listOperations.rightPush("listPerson", new Person("Toan", 16, "Ha Noi"));
listOperations.leftPush("listPerson", new Person("Dang", 24, "Ha Noi"));
System.out.println(listOperations.leftPop("listPerson"));// Dang
System.out.println(listOperations.rightPop("listPerson"));// Toan
System.out.println(listOperations.index("listPerson", 1)); // Toan
List<Person> listPerson = listOperations.range("listPerson", 1, 2);
System.out.println(listPerson);// vuong
}
public static void setValueOperation () {
SetOperations<String, Person> setOperations = redisTemplate.opsForSet();
setOperations.add("setPerson0", new Person("Vuong", 24, "Ha Noi"));
setOperations.add("setPerson0", new Person("Tiến", 24, "Ha Noi"));
setOperations.add("setPerson1", new Person("Toan", 16, "Ha Noi"));
setOperations.add("setPerson2", new Person("Dang", 24, "Ha Noi"));
setOperations.add("setPerson2", new Person("Tiến", 24, "Ha Noi"));
System.out.println(setOperations.members("setPerson0"));// Lấy tất cả các member của set0
System.out.println(setOperations.difference("setPerson0", "setPerson1")); // Person trong setPerson khác vs setPerson1
System.out.println(setOperations.union("setPerson0", "setPerson1")); // Gôp 2 Set thành 1
System.out.println(setOperations.intersect("setPerson0", "setPerson2")); // Person trong set0 và set2
setOperations.remove("setPerson", new Person("Vuong", 24, "Ha Noi")); // Remove person trong Set
System.out.println(setOperations.pop("setPerson")); // Lấy ra và Remove trong set
}
public static void hashOperations() {
HashOperations<String, String, Person> hashOperations = redisTemplate.opsForHash();
hashOperations.putIfAbsent("persons", "p1", new Person("Vuong", 24, "Ha Noi")); // Sets the value of a hash hashKey only if hashKey does not exist.
hashOperations.put("persons", "p1", new Person("Loan", 24, "<NAME>")); // Sets the value of a hash hashKey.
System.out.println("P1: "+ hashOperations.get("persons", "p1"));//Get value for given hashKey from hash at key.
System.out.println("Size: "+hashOperations.size("persons"));//Get size of hash at key.
Map<String, Person> map = hashOperations.entries("persons"); //Get entire hash stored at key.
System.out.println("Map: " + map);
System.out.println("Delete: " + hashOperations.delete("persons", "p1"));// Delete given hash hashKeys.
System.out.println("Map: " + map);
}
public static void boundListOperations() {
BoundListOperations<String, Person> cart = redisTemplate.boundListOps("cart");
System.out.println(cart.rightPop()); // Return and Remove last element bound key
cart.rightPush(new Person("Vuong", 24, "<NAME>"));
cart.rightPush(new Person("Tien", 24, "<NAME>"));
cart.rightPush(new Person("Tung", 24, "<NAME>"));
System.out.println(cart.rightPop()); // Tung
System.out.println(cart.leftPop());// Vuong
}
public static void main(String[] args) {
stringTemplateTest();
simpleValueOperation();
listValueOperation();
setValueOperation();
hashOperations();
boundListOperations();
}
}
| 4,811 | 0.744521 | 0.732832 | 98 | 47.887756 | 35.88641 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.642857 | false | false | 2 |
fdf538f0a1e6b580ed6364be4030b69742ae7886 | 32,830,730,018,287 | d8ab248ae5a8afb654bdd3f18e390b1cf3e2c0ca | /MainProject/com/pcmsolutions/device/EMU/E4/zcommands/preset/RenamePresetAllZMTC.java | e8420e7c8bd8295e7aa839ce01c791762e906d53 | [] | no_license | nico75000/zoeos | https://github.com/nico75000/zoeos | e2391f8f13f672e1d1c536cc2299878e38e81ede | a8853f8cf71556693931b3647d30741fa6260b07 | refs/heads/master | 2021-01-01T03:44:21.813000 | 2009-11-05T03:48:22 | 2009-11-05T03:48:22 | 56,063,868 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pcmsolutions.device.EMU.E4.zcommands.preset;
import com.pcmsolutions.device.EMU.E4.preset.ContextBasicEditablePreset;
import com.pcmsolutions.device.EMU.E4.preset.PresetException;
import com.pcmsolutions.gui.FixedLengthTextField;
import com.pcmsolutions.gui.zcommand.AbstractZCommandField;
import com.pcmsolutions.gui.zcommand.ZCommandDialog;
import com.pcmsolutions.gui.zcommand.ZCommandField;
/**
* Created by IntelliJ IDEA.
* User: pmeehan
* Date: 22-Mar-2003
* Time: 14:36:45
* To change this template use Options | File Templates.
*/
public class RenamePresetAllZMTC extends AbstractContextBasicEditablePresetZMTCommand {
private static final ZCommandField<FixedLengthTextField, String> nameField = new AbstractZCommandField<FixedLengthTextField, String>(new FixedLengthTextField("", 16), "Name", "New name for all presets") {
public String getValue() {
return getComponent().getText();
}
};
private final static ZCommandDialog cmdDlg = new ZCommandDialog();
static {
cmdDlg.init("Rename all presets", new ZCommandField[]{nameField});
}
public int getMinNumTargets() {
return 2;
}
public String getMenuPathString() {
return ";Special naming";
}
public boolean handleTarget(ContextBasicEditablePreset p, int total, int curr) throws Exception {
nameField.getComponent().setText(p.getName());
nameField.getComponent().selectAll();
cmdDlg.run(new ZCommandDialog.Executable() {
public void execute() throws Exception {
ContextBasicEditablePreset[] presets = getTargets().toArray(new ContextBasicEditablePreset[numTargets()]);
for (ContextBasicEditablePreset p : presets)
try {
p.setPresetName(nameField.getValue());
} catch (PresetException e) {
}
}
});
return false;
}
public String getPresentationString() {
return "Rename all";
}
public String getDescriptiveString() {
return "Apply single name to all presets";
}
}
| UTF-8 | Java | 2,153 | java | RenamePresetAllZMTC.java | Java | [
{
"context": "dField;\n\n/**\n * Created by IntelliJ IDEA.\n * User: pmeehan\n * Date: 22-Mar-2003\n * Time: 14:36:45\n * To chan",
"end": 458,
"score": 0.9997234344482422,
"start": 451,
"tag": "USERNAME",
"value": "pmeehan"
}
] | null | [] | package com.pcmsolutions.device.EMU.E4.zcommands.preset;
import com.pcmsolutions.device.EMU.E4.preset.ContextBasicEditablePreset;
import com.pcmsolutions.device.EMU.E4.preset.PresetException;
import com.pcmsolutions.gui.FixedLengthTextField;
import com.pcmsolutions.gui.zcommand.AbstractZCommandField;
import com.pcmsolutions.gui.zcommand.ZCommandDialog;
import com.pcmsolutions.gui.zcommand.ZCommandField;
/**
* Created by IntelliJ IDEA.
* User: pmeehan
* Date: 22-Mar-2003
* Time: 14:36:45
* To change this template use Options | File Templates.
*/
public class RenamePresetAllZMTC extends AbstractContextBasicEditablePresetZMTCommand {
private static final ZCommandField<FixedLengthTextField, String> nameField = new AbstractZCommandField<FixedLengthTextField, String>(new FixedLengthTextField("", 16), "Name", "New name for all presets") {
public String getValue() {
return getComponent().getText();
}
};
private final static ZCommandDialog cmdDlg = new ZCommandDialog();
static {
cmdDlg.init("Rename all presets", new ZCommandField[]{nameField});
}
public int getMinNumTargets() {
return 2;
}
public String getMenuPathString() {
return ";Special naming";
}
public boolean handleTarget(ContextBasicEditablePreset p, int total, int curr) throws Exception {
nameField.getComponent().setText(p.getName());
nameField.getComponent().selectAll();
cmdDlg.run(new ZCommandDialog.Executable() {
public void execute() throws Exception {
ContextBasicEditablePreset[] presets = getTargets().toArray(new ContextBasicEditablePreset[numTargets()]);
for (ContextBasicEditablePreset p : presets)
try {
p.setPresetName(nameField.getValue());
} catch (PresetException e) {
}
}
});
return false;
}
public String getPresentationString() {
return "Rename all";
}
public String getDescriptiveString() {
return "Apply single name to all presets";
}
}
| 2,153 | 0.675801 | 0.667441 | 60 | 34.883335 | 36.034748 | 208 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.516667 | false | false | 2 |
cbf2592d8e9b43f499046e0ddee1e35a7a645aec | 32,830,730,017,383 | 8a26c0430728fb86e4323a357c2d060fe91c00e6 | /Camera/src/com/java57/nail/search/MapApiConst.java | 5f04039b15b088b7c036542f7603817ac8c58bc0 | [] | no_license | iamabook/java57 | https://github.com/iamabook/java57 | da61e1541a50e95e9603f013b2bf8fbee0955dd4 | 0d91e2cb6e5ae25e65405915081349a60f6c6b5c | refs/heads/master | 2016-09-07T12:08:10.356000 | 2014-12-09T07:29:13 | 2014-12-09T07:29:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.java57.nail.search;
public class MapApiConst {
// http://dna.daum.net/apis/mmaps
public static final String DAUM_MAPS_ANDROID_APP_API_KEY = "93af45459497d1bba17fb40c487f6d90807a9be5";
// http://dna.daum.net/apis/local
public static final String DAUM_MAPS_LOCAL_API_KEY = "738f367acba9c9dbca8f0caefda3a8183c7f19f9";
}
| UTF-8 | Java | 348 | java | MapApiConst.java | Java | [
{
"context": "tic final String DAUM_MAPS_ANDROID_APP_API_KEY = \"93af45459497d1bba17fb40c487f6d90807a9be5\";\n \n // http://dna.daum.net/apis/local\n ",
"end": 199,
"score": 0.999754786491394,
"start": 159,
"tag": "KEY",
"value": "93af45459497d1bba17fb40c487f6d90807a9be5"
},
{
... | null | [] | package com.java57.nail.search;
public class MapApiConst {
// http://dna.daum.net/apis/mmaps
public static final String DAUM_MAPS_ANDROID_APP_API_KEY = "<KEY>";
// http://dna.daum.net/apis/local
public static final String DAUM_MAPS_LOCAL_API_KEY = "<KEY>";
}
| 278 | 0.755747 | 0.62069 | 9 | 37.666668 | 37.48481 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 2 |
fe0b7a8a007f97d5441024b525a72914cb864b64 | 10,831,907,553,501 | eb4d2ec1751fed9655fef78c3b576bf6d15dce7c | /src/test/java/com/echoohce/jpa/hibernate/demo/DemoApplicationTests.java | 772c3baceecaa495479374fee113c967cb724426 | [
"Apache-2.0"
] | permissive | yugan2005/hibernate-course | https://github.com/yugan2005/hibernate-course | 1508dc1990394fc77f786323bea7fec9eaf76766 | 023a62eb00fbadb3f519413b40e6d290171bd14e | refs/heads/master | 2020-12-14T02:38:57.070000 | 2020-02-03T05:12:27 | 2020-02-03T05:12:27 | 234,609,418 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.echoohce.jpa.hibernate.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
@SpringBootTest
@DirtiesContext
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
| UTF-8 | Java | 299 | java | DemoApplicationTests.java | Java | [] | null | [] | package com.echoohce.jpa.hibernate.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
@SpringBootTest
@DirtiesContext
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
| 299 | 0.802676 | 0.802676 | 15 | 18.933332 | 20.273026 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 2 |
e63f5e6e0c923867640f20543a9b3019125c8d2e | 17,875,653,903,936 | 527d6e8de9e350bf923a66fc3cfe84396b4dd89d | /idea-plugin/src/main/java/ch/yvu/teststore/idea/plugin/model/TestStore.java | f5c104c66fea2cba8f514bcb06a9fda08c0e8cf0 | [
"MIT"
] | permissive | ybonjour/test-store | https://github.com/ybonjour/test-store | 144e12b690204120b575c2e2dbfcfc923f427356 | 6bfc5ce5b8e2bad82d1364e92810ad4722aad1c7 | refs/heads/master | 2023-01-07T22:18:07.786000 | 2019-08-02T10:37:29 | 2019-08-02T10:37:29 | 54,708,531 | 8 | 4 | MIT | false | 2023-01-07T07:02:46 | 2016-03-25T09:18:53 | 2021-08-18T15:30:33 | 2023-01-07T07:02:45 | 52,442 | 8 | 3 | 44 | Kotlin | false | false | package ch.yvu.teststore.idea.plugin.model;
import ch.yvu.teststore.idea.plugin.load.LoadTask;
import ch.yvu.teststore.idea.plugin.load.LoadTestSuites;
import javax.swing.*;
import java.awt.event.MouseEvent;
public class TestStore extends Model {
public TestStore(String baseUrl) {
super(baseUrl);
}
@Override
public Icon getIcon() {
return null;
}
@Override
public String getText() {
return getBaseUrl();
}
@Override
public LoadTask loadChildrenTask() {
return new LoadTestSuites(getBaseUrl());
}
@Override
public Runnable doubleClickAction() {
return null;
}
@Override
public Runnable rightClickAction(MouseEvent e) {
return null;
}
}
| UTF-8 | Java | 676 | java | TestStore.java | Java | [] | null | [] | package ch.yvu.teststore.idea.plugin.model;
import ch.yvu.teststore.idea.plugin.load.LoadTask;
import ch.yvu.teststore.idea.plugin.load.LoadTestSuites;
import javax.swing.*;
import java.awt.event.MouseEvent;
public class TestStore extends Model {
public TestStore(String baseUrl) {
super(baseUrl);
}
@Override
public Icon getIcon() {
return null;
}
@Override
public String getText() {
return getBaseUrl();
}
@Override
public LoadTask loadChildrenTask() {
return new LoadTestSuites(getBaseUrl());
}
@Override
public Runnable doubleClickAction() {
return null;
}
@Override
public Runnable rightClickAction(MouseEvent e) {
return null;
}
}
| 676 | 0.738166 | 0.738166 | 40 | 15.9 | 17.093567 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 2 |
a9712999b10f3e3ee1d8de9566769eeaa3b7dbd2 | 31,911,607,039,943 | 56b7ca394915586c83faf41b37c2684a7716ad19 | /homeWork1/src/hw3m14/ScoreList.java | 1e40327e8c7a97cb65b5742c12f898cba89117d7 | [] | no_license | zhjali/com.study_android.repository | https://github.com/zhjali/com.study_android.repository | a45bb3665d1bf320a52552644917b44f02d3e1ca | d2278ca6d29f18251d59168852b8b3762ff2f7d6 | refs/heads/master | 2021-01-19T06:08:33.408000 | 2014-05-22T11:32:55 | 2014-05-22T11:32:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hw3m14;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class ScoreList {
public static void main(String[] args) throws IOException {
String[] name = { "mailoaoer", "zhuding", "zhujiji" };
File file = new File("C:\\1.txt");
DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
DataInputStream in = new DataInputStream(new FileInputStream(file));
Integer[] age = { 23, 43, 64 };
Double[] score = { 45.2, 69.3, 90.9 };
for (int i = 0; i < name.length; i++) {
out.writeUTF(name[i]);
out.writeInt(age[i]);
out.writeDouble(score[i]);
out.flush();
}
for(int i = 0; i< name.length ; i++){
String name1 = in.readUTF();
int age1 = in.readInt();
double socre1 = in.readDouble();
System.out.println(name1 + "\t" + age1 +"\t" + socre1);
}
}
}
| UTF-8 | Java | 1,010 | java | ScoreList.java | Java | [
{
"context": "] args) throws IOException {\n\t\tString[] name = { \"mailoaoer\", \"zhuding\", \"zhujiji\" };\n\t\tFile file = new File(",
"end": 378,
"score": 0.9463253021240234,
"start": 369,
"tag": "NAME",
"value": "mailoaoer"
},
{
"context": "s IOException {\n\t\tString[] name = {... | null | [] | package hw3m14;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class ScoreList {
public static void main(String[] args) throws IOException {
String[] name = { "mailoaoer", "zhuding", "zhujiji" };
File file = new File("C:\\1.txt");
DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
DataInputStream in = new DataInputStream(new FileInputStream(file));
Integer[] age = { 23, 43, 64 };
Double[] score = { 45.2, 69.3, 90.9 };
for (int i = 0; i < name.length; i++) {
out.writeUTF(name[i]);
out.writeInt(age[i]);
out.writeDouble(score[i]);
out.flush();
}
for(int i = 0; i< name.length ; i++){
String name1 = in.readUTF();
int age1 = in.readInt();
double socre1 = in.readDouble();
System.out.println(name1 + "\t" + age1 +"\t" + socre1);
}
}
}
| 1,010 | 0.676238 | 0.649505 | 33 | 29.60606 | 18.979956 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.393939 | false | false | 2 |
4876243066c2572feaefd995fb85f3a2612a87ec | 19,851,338,844,602 | 7c87a85b35e47d4640283d12c40986e7b8a78e6f | /moneyfeed-openapi-wechat/moneyfeed-openapi-wechat-api/src/main/java/com/newhope/openapi/api/vo/response/order/OrderStatusResult.java | 60b1e39d07ea5a035b8d3e007eebf1388cc528dd | [] | no_license | newbigTech/moneyfeed | https://github.com/newbigTech/moneyfeed | 191b0bd4c98b49fa6be759ed16817b96c6e853b3 | 2bd8bdd10ddfde3f324060f7b762ec3ed6e25667 | refs/heads/master | 2020-04-24T13:05:44.308000 | 2019-01-15T07:59:03 | 2019-01-15T07:59:03 | 171,975,920 | 0 | 3 | null | true | 2019-02-22T01:53:12 | 2019-02-22T01:53:12 | 2019-01-15T08:00:40 | 2019-01-15T08:00:39 | 2,041 | 0 | 0 | 0 | null | false | null | package com.newhope.openapi.api.vo.response.order;
import com.newhope.moneyfeed.api.vo.response.Result;
import io.swagger.annotations.ApiModelProperty;
/**
* Create by yyq on 2018/12/04
*/
public class OrderStatusResult extends Result {
private static final long serialVersionUID = 1901728842228219244L;
@ApiModelProperty(name = "status", notes = "订单状态")
private String status;
@ApiModelProperty(name = "id", notes = "订单主键id")
private Long id;
@ApiModelProperty(name="payFlag",notes="是否已经支付成功")
private Boolean payFlag;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Boolean getPayFlag() {
return payFlag;
}
public void setPayFlag(Boolean payFlag) {
this.payFlag = payFlag;
}
}
| UTF-8 | Java | 1,011 | java | OrderStatusResult.java | Java | [
{
"context": "annotations.ApiModelProperty;\r\n\r\n/**\r\n * Create by yyq on 2018/12/04\r\n */\r\npublic class OrderStatusResul",
"end": 180,
"score": 0.999606728553772,
"start": 177,
"tag": "USERNAME",
"value": "yyq"
}
] | null | [] | package com.newhope.openapi.api.vo.response.order;
import com.newhope.moneyfeed.api.vo.response.Result;
import io.swagger.annotations.ApiModelProperty;
/**
* Create by yyq on 2018/12/04
*/
public class OrderStatusResult extends Result {
private static final long serialVersionUID = 1901728842228219244L;
@ApiModelProperty(name = "status", notes = "订单状态")
private String status;
@ApiModelProperty(name = "id", notes = "订单主键id")
private Long id;
@ApiModelProperty(name="payFlag",notes="是否已经支付成功")
private Boolean payFlag;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Boolean getPayFlag() {
return payFlag;
}
public void setPayFlag(Boolean payFlag) {
this.payFlag = payFlag;
}
}
| 1,011 | 0.642492 | 0.614913 | 42 | 21.309525 | 20.068321 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 2 |
6d8a332a735cadf1ee6c50967060dfd7ee1ec6e1 | 13,726,715,503,734 | 0a80c1d23bc4a2f279aab1020f0d6812725e3a73 | /easyconfig-server/src/main/java/com/gome/fup/easyconfig/handler/ConfigHandler.java | 333957cff39be70aa2bdc1f6b9beeda9f9aa77d4 | [] | no_license | 729533572/EasyConfig | https://github.com/729533572/EasyConfig | b3598e0c0d04014990113dafd206fe75d57358d0 | 66f74d1b5136f082a67e822336083e00252766c3 | refs/heads/master | 2022-04-08T01:55:39.639000 | 2017-08-29T06:57:45 | 2017-08-29T06:57:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gome.fup.easyconfig.handler;
import com.gome.fup.easyconfig.common.Config;
import com.gome.fup.easyconfig.common.Request;
import com.gome.fup.easyconfig.common.Response;
import com.gome.fup.easyconfig.service.ConfigService;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.List;
/**
* Created by fupeng-ds on 2017/7/14.
*/
public class ConfigHandler extends SimpleChannelInboundHandler<Request> {
private ConfigService configService;
@Override
protected void channelRead0(ChannelHandlerContext ctx, Request request) throws Exception {
List<Config> configs = configService.getPropertyByProjectIdAndGroupName(request.getProjectId(), request.getGroupName(), request.getKey());
Response response = buildResponse(request.getProjectId(), request.getGroupName(), configs);
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}
private Response buildResponse(String projectId, String groupName, List<Config> configs) {
Response response = new Response();
response.setProjectId(projectId);
response.setGroupName(groupName);
response.setConfigs(configs);
return response;
}
public ConfigHandler(ConfigService configService) {
this.configService = configService;
}
}
| UTF-8 | Java | 1,415 | java | ConfigHandler.java | Java | [
{
"context": "andler;\n\nimport java.util.List;\n\n/**\n * Created by fupeng-ds on 2017/7/14.\n */\npublic class ConfigHandler exte",
"end": 436,
"score": 0.9995787739753723,
"start": 427,
"tag": "USERNAME",
"value": "fupeng-ds"
}
] | null | [] | package com.gome.fup.easyconfig.handler;
import com.gome.fup.easyconfig.common.Config;
import com.gome.fup.easyconfig.common.Request;
import com.gome.fup.easyconfig.common.Response;
import com.gome.fup.easyconfig.service.ConfigService;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.List;
/**
* Created by fupeng-ds on 2017/7/14.
*/
public class ConfigHandler extends SimpleChannelInboundHandler<Request> {
private ConfigService configService;
@Override
protected void channelRead0(ChannelHandlerContext ctx, Request request) throws Exception {
List<Config> configs = configService.getPropertyByProjectIdAndGroupName(request.getProjectId(), request.getGroupName(), request.getKey());
Response response = buildResponse(request.getProjectId(), request.getGroupName(), configs);
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}
private Response buildResponse(String projectId, String groupName, List<Config> configs) {
Response response = new Response();
response.setProjectId(projectId);
response.setGroupName(groupName);
response.setConfigs(configs);
return response;
}
public ConfigHandler(ConfigService configService) {
this.configService = configService;
}
}
| 1,415 | 0.761837 | 0.756184 | 39 | 35.282051 | 33.945618 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 2 |
53f0a9f37e7b36d02d6fa6458d4a16207c71b3de | 8,452,495,658,905 | c170b4f2fb0e25673a3cdbbbb3173003f8e3075e | /src/객체프로젝트/Game1.java | d94bd83ffb5b6be2ade090f048bccc5b3ba5c6b6 | [] | no_license | tlqckd0/tlqckd0-java_school_Project | https://github.com/tlqckd0/tlqckd0-java_school_Project | 9d9e80764e22f3b6678b1aa0ac0fffd88d7d6a62 | a3a1217d358e47e245028a41887a8cb7e4e51504 | refs/heads/master | 2021-08-02T08:58:33.699000 | 2021-07-20T01:22:54 | 2021-07-20T01:22:54 | 248,480,927 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | ///////////////////////
//////지최찾기프레임///////
///////////////////////
package 객체프로젝트;
import javax.swing.*;
import 객체프로젝트.Game2.game2FinishFrame.buttonlistener;
import java.lang.Thread;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.Random;
class MyButton extends JButton {
private static int num = 0;
int x, y;// 버튼 크기저장
int index;// 버튼의 번호
int flag = 2; // 0 이면 깃발표시 1이면 물음표 2이면 표시 X
int surroundMineNum = 0;// 주위에있는 지뢰의 개수
boolean gamefinish = false;// 게임끝나면 true
boolean clickCheck = false;// 버튼을 클릭했는지 확인
boolean mine = false;// 지뢰인지 아닌지
boolean gamewin = false;// 게임성공하면 true
public MyButton() {
index = num++;
}
static public void reset() {
num = 0;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
x = this.getWidth();
y = this.getHeight();
if (clickCheck == true && mine == true && flag == 2) {// 지뢰를 클릭
this.setBackground(Color.RED);
g.fillOval(x / 4, y / 4, x / 2, y / 2);
g.drawLine(x / 4, y / 4, (x * 3) / 4, (y * 3) / 4);
g.drawLine((x * 3) / 4, y / 4, x / 4, (y * 3) / 4);
} else if (gamefinish == true && mine == true && flag == 2 && gamewin == false) {// 졌을때 종료후 출력
g.fillOval(x / 4, y / 4, x / 2, y / 2);
g.drawLine(x / 4, y / 4, (x * 3) / 4, (y * 3) / 4);
g.drawLine((x * 3) / 4, y / 4, x / 4, (y * 3) / 4);
} else if (flag == 0 && clickCheck == true && mine == false && gamefinish == true) {// 잘못된 깃발표기
g.fillOval(x / 4, y / 4, x / 2, y / 2);
g.drawLine(x / 4, y / 4, (x * 3) / 4, (y * 3) / 4);
g.drawLine((x * 3) / 4, y / 4, x / 4, (y * 3) / 4);
g.setColor(Color.RED);
g.drawLine(0, 0, x, y);
g.drawLine(x, 0, 0, y);
} else if (flag == 0 || (gamefinish == true && mine == true && flag == 2 && gamewin == true)) {// 깃발 마크
g.setColor(Color.RED);
g.fillRect(0, 0, x / 2, y / 2);
g.setColor(Color.BLACK);
g.drawLine(x / 2, 0, x / 2, y);
g.fillRect(0, (y * 3) / 4, x, y);
} else if (flag == 1) {// 물음표 표기
g.setFont(new Font("궁서체", Font.BOLD, 30));
g.drawString("?", x / 3, (y * 3) / 4);
}
}
}
public class Game1 extends JFrame {
JFrame mygame1 = this;
// 현제상태 0 일반 1성공 2실패
private int state = 0;
// 게임하는사람
private String player;
// 번호달린 버튼 생성
private MyButton button[];
private Reset resetbutton = new Reset();
// 지뢰위치
private int mineLocation[];
// 게임크기, 지뢰개수, 길발갯수, 시간
private int gameSize;
private int numOfMine;
private int numOfFlag;
private int time = 0;
private int leftButtonNum;
// 위치 버튼 오른쪽부터 시계방향으로 빙글
private int buttonSurround[] = new int[8];
// 게임패널
private JPanel gamePanel;
// 정보출력패널
private JPanel showPanel = new JPanel();
private JLabel flagLabel = new JLabel();
// 타이머
Timer timer = new Timer();
// 승리 프레임
JButton resetButton = new JButton("다시하기");
JButton goStart = new JButton("시작메뉴");
JButton exit = new JButton("종료");
public Game1(int size, int mineNum) {
setTitle("Game1");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gameSize = size;
numOfMine = mineNum;
numOfFlag = mineNum;
leftButtonNum = size * size;
// 지뢰생성
MakeMine();
// 버튼주위인댁스확인용
MakebuttonSurround();
setLayout(new BorderLayout());
// 설정화면 표시
showPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
// 타이머
flagLabel.setText("MINE : " + numOfFlag);
flagLabel.setFont(new Font("Gothic", Font.PLAIN, 30));
flagLabel.setBackground(Color.WHITE);
flagLabel.setOpaque(true);
showPanel.add(flagLabel);
// 게임리셋
resetbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
restart();
}
});
showPanel.setBackground(Color.DARK_GRAY);
showPanel.add(resetbutton);
showPanel.add(timer);
// 게임패널설정
gamePanel = new JPanel();
gamePanel.setLayout(new GridLayout(gameSize, gameSize));
// 버튼 정보 입력 1
inputdata1();
// 버튼 정보 입력2
inputdata2();
// 채크
check();
// 패널부착
add(showPanel, BorderLayout.NORTH);
add(gamePanel, BorderLayout.CENTER);
setSize(gameSize * 45, gameSize * 45);
setVisible(true);
}
// 버튼확인(핵)
public void check() {
System.out.println("");
int count = 0;
for (int i = 0; i < gameSize; i++) {
for (int j = 0; j < gameSize; j++) {
if (button[count].mine == false)
System.out.print(button[count].surroundMineNum + "\t");
else
System.out.print("mine\t");
count++;
}
System.out.println("");
}
}
// 재시작!
public void restart() {
gamePanel.removeAll();// 게임패널 초기화
timer.finish();// 현제 타이머 종료
state = 0;// 상태초기화
time = 0;// 시간초기화
leftButtonNum = gameSize * gameSize;
numOfFlag = numOfMine;
flagLabel.setText("MINE : " + numOfFlag);
showPanel.remove(timer);// 타이머지우고
timer = new Timer();// 새거 다시담 (스래드 공부를 덜해서 초기화하는방법을 모르겠습니다..)
showPanel.add(timer);
MyButton.reset();
MakeMine();
inputdata1();
inputdata2();
check();
gamePanel.revalidate();
timer.revalidate();
}
// 지뢰 인댁스
public void MakeMine() {
// 지뢰갯수
mineLocation = new int[numOfMine];
// 난수생성(지뢰위치)
Random r = new Random();
for (int i = 0; i < mineLocation.length; i++) {
mineLocation[i] = r.nextInt(gameSize * gameSize);
for (int j = 0; j < i; j++) {
if (mineLocation[i] == mineLocation[j]) {
i--;
break;
}
}
}
}
// 버튼정보입력 1
public void inputdata1() {
button = new MyButton[gameSize * gameSize];
for (int i = 0; i < gameSize * gameSize; i++) {
button[i] = new MyButton();
// button[i].setPreferredSize(new Dimension(50, 50));
button[i].setFont(new Font("궁서체", Font.BOLD, 10));
// 버튼에 지뢰추가
for (int k = 0; k < mineLocation.length; k++) {
if (button[i].index == mineLocation[k])
button[i].mine = true;
}
// 채크
if (button[i].mine == true) {
System.out.print(button[i].index + " ");
}
button[i].addMouseListener(new MyActionListener());
gamePanel.add(button[i]);
}
}
// 버튼주위 지뢰갯수
public void inputdata2() {
for (int m = 0; m < gameSize * gameSize; m++) {
int num = 0;
// 버튼 위치마다 계산이 달라서..
// buttonSurround[] =
// {1,gameSize+1,gameSize,gameSize-1,-1,-gameSize-1,-gameSize,-gameSize+1};
if (button[m].mine == false) {
// case 1 좌상단
if (m == 0) {
for (int i = 0; i <= 2; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 2 상단
if ((m >= 1) && (m <= gameSize - 2)) {
for (int i = 0; i <= 4; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 3 우상단
if (m == gameSize - 1) {
for (int i = 2; i <= 4; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 4 좌측
if ((m % gameSize == 0) && m != gameSize * (gameSize - 1)) {
for (int i = 0; i <= 2; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
for (int i = 6; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 6 우측
if (((m % gameSize) == (gameSize - 1)) && (m != gameSize * gameSize - 1)) {
for (int i = 2; i <= 6; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 7 좌하단
if (m == gameSize * (gameSize - 1)) {
if (button[m + buttonSurround[0]].mine == true)
num++;
for (int i = 6; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 8 하단
if (m >= gameSize * (gameSize - 1) + 1 && m <= gameSize * gameSize - 2) {
if (button[m + buttonSurround[0]].mine == true)
num++;
for (int i = 4; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 9 우하단
if (m == gameSize * gameSize - 1) {
for (int i = 4; i <= 6; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 5 중앙
for (int i = 0; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
}
}
}
// 위치정보 만들기 3시방향부터 시계방향으로
public void MakebuttonSurround() {
buttonSurround[0] = 1;
buttonSurround[1] = gameSize + 1;
buttonSurround[2] = gameSize;
buttonSurround[3] = gameSize - 1;
buttonSurround[4] = -1;
buttonSurround[5] = -gameSize - 1;
buttonSurround[6] = -gameSize;
buttonSurround[7] = -gameSize + 1;
}
// 버튼입력 이벤트
class MyActionListener extends MouseAdapter {
public void mouseReleased(MouseEvent e) {
MyButton b = (MyButton) e.getSource();
if (b.isEnabled() == true) {// 안눌린상태여만..
if (e.isPopupTrigger() == true) {// 우클릭이벤트 <깃발, ?>표기
if (b.flag == 2) {// 깃발표시하기
b.flag = 0;
b.clickCheck = true;
numOfFlag--;
flagLabel.setText("MINE : " + numOfFlag);
winOption();
repaint();
} else if (b.flag == 0) {// 물음표 표시하기
b.flag = 1;
numOfFlag++;
flagLabel.setText("MINE : " + numOfFlag);
repaint();
} else {// 처음으로
b.flag = 2;
b.clickCheck = false;
repaint();
}
} else {// 그냥 클릭
if (b.flag == 2) {
if (b.mine == true) {// 지뢰를 클릭했을때...
state = 2;// 실패
b.clickCheck = true;
clickAllButton();
timer.finish();
repaint();
}
if (b.mine == false) {
if (b.surroundMineNum == 0) {// 0일경우 주위를 채크
b.setEnabled(false);
b.clickCheck = true;
leftButtonNum--;
checkSurround(b.index);
winOption();
} else {
b.setText(b.surroundMineNum + "");
leftButtonNum--;
b.clickCheck = true;
b.setEnabled(false);
winOption();
}
}
}
}
}
System.out.println("left button:" + leftButtonNum);
}
}
// 승리조건
public void winOption() {
int count = 0;
for (int i = 0; i < gameSize * gameSize; i++) {
if (button[i].flag == 0 && button[i].mine == true) // 지뢰위에 깃발표시할 경우
count++;
if ((count + leftButtonNum) == numOfMine) {// 승리조건 만족 = 위의 조건 + 남은 버튼의수가 지뢰의 갯수와 같을때
state = 1;// 승리상태
repaint();
timer.finish();
clickAllButton();
// 정보입력패널
new game1FinishFrame();
count = 0;
break;
}
}
}
// 모든 버튼 누르기(승리 or 패배)
public void clickAllButton() {
for (int i = 0; i < gameSize * gameSize; i++) {// 모든 버튼을 ..
if (state == 1)
button[i].gamewin = true;
button[i].gamefinish = true;// 게임종료
if (button[i].surroundMineNum != 0)// 주위의 지뢰 표시
button[i].setText(button[i].surroundMineNum + "");
button[i].setEnabled(false);
}
}
// {1,gameSize+1,gameSize,gameSize-1,-1,-gameSize-1,-gameSize,-gameSize+1};
// 버튼이 0일경우 주위채크
// 밑의함수 길이 줄이기
public void simplecheck(int index, int i) {
int num = index + buttonSurround[i];
if (button[num].clickCheck == false) {// 안눌려져 있을때
if (button[num].surroundMineNum == 0) {
button[num].clickCheck = true;
button[num].setEnabled(false);
leftButtonNum--;
checkSurround(num);
} else {
button[num].setText(button[num].surroundMineNum + "");
button[num].clickCheck = true;
button[num].setEnabled(false);
leftButtonNum--;
}
} else
return;
}
public void checkSurround(int index) {
if (index == 0) {// case 1 좌상단
for (int i = 0; i <= 2; i++) {
simplecheck(index, i);
}
} else if ((index >= 1) && (index <= gameSize - 2)) {// case 2 상단
for (int i = 0; i <= 4; i++) {
simplecheck(index, i);
}
} else if (index == gameSize - 1) {// case 3 우상단
for (int i = 2; i <= 4; i++) {
simplecheck(index, i);
}
} else if ((index % gameSize == 0) && index != 0 && index != gameSize * (gameSize - 1)) {// case 4 좌측
for (int i = 0; i <= 2; i++) {
simplecheck(index, i);
}
for (int i = 6; i <= 7; i++) {
simplecheck(index, i);
}
} else if (((index % gameSize) == (gameSize - 1)) && (index != gameSize * gameSize - 1)
&& (index != gameSize - 1)) {// case 6 우측
for (int i = 2; i <= 6; i++) {
simplecheck(index, i);
}
} else if (index == gameSize * (gameSize - 1)) {// case 7 좌하단
simplecheck(index, 0);
for (int i = 6; i <= 7; i++) {
simplecheck(index, i);
}
} else if (index >= gameSize * (gameSize - 1) + 1 && index <= gameSize * gameSize - 2) {// case 8 하단
simplecheck(index, 0);
for (int i = 4; i <= 7; i++) {
simplecheck(index, i);
}
} else if (index == gameSize * gameSize - 1) { // case 9 우하단
for (int i = 4; i <= 6; i++) {
simplecheck(index, i);
}
} else {// case 5 중앙
for (int i = 0; i <= 7; i++) {
simplecheck(index, i);
}
}
}
// 리셋버튼 // 표정그림
class Reset extends JButton {
int x, y;
public Reset() {
this.setPreferredSize(new Dimension(48, 48));
}
public void paintComponent(Graphics g) {
x = this.getWidth();
y = this.getHeight();
super.paintComponent(g);
if (state == 0) {// 일반 표정
g.setColor(Color.YELLOW);
g.fillOval(0, 0, x, y);
g.setColor(Color.BLACK);
g.fillRect(x / 3 - 3, y / 3, 6, 6);
g.fillRect((x * 2) / 3 - 3, y / 3, 6, 6);
g.drawArc(x / 3, y / 2, x / 3, y / 3, 180, 180);
} else if (state == 1) {// 성공!! 표정
g.setColor(Color.YELLOW);
g.fillOval(0, 0, x, y);
g.setColor(Color.BLACK);
g.drawArc(x / 6, y / 6, x / 3, y / 3, 0, 180);
g.drawArc(x / 2, y / 6, x / 3, y / 3, 0, 180);
g.drawArc(x / 3, y / 2, x / 3, y / 3, 180, 180);
} else {// 실패 표정..
g.setColor(Color.YELLOW);
g.fillOval(0, 0, x, y);
g.setColor(Color.BLACK);
g.drawLine(x / 6, y / 6, x / 2, y / 2);
g.drawLine(x / 2, y / 2, (x * 5) / 6, y / 6);
g.drawLine(x / 6, y / 2, x / 2, y / 6);
g.drawLine(x / 2, y / 6, (x * 5) / 6, y / 2);
g.drawLine(x / 3, (y * 5) / 6, (x * 2) / 3, (y * 5) / 6);
}
}
}
// 타이머 설정
class Timer extends JPanel {
private boolean flag = false;
public void finish() {
flag = true;
}
public Timer() {
setLayout(new FlowLayout());
JLabel timerLabel = new JLabel();
timerLabel.setFont(new Font("Gothic", Font.PLAIN, 30));
TimerThread th = new TimerThread(timerLabel);
add(timerLabel);
th.start();
}
class TimerThread extends Thread {
private JLabel timerLabel;
public TimerThread(JLabel timerLabel) {
this.timerLabel = timerLabel;
}
public void run() {
while (flag == false) {
timerLabel.setText("TIME : " + Integer.toString(time));
time++;
try {
sleep(1000);
if (flag == true)
return;
} catch (InterruptedException e) {
return;
}
}
}
}
}
// 게임 끝난후
class game1FinishFrame extends JFrame {
JPanel panel[] = new JPanel[3];
JLabel infoLabel = new JLabel("이름을 입력하세요");
public game1FinishFrame() {
setTitle("지뢰찾기");
setLayout(new GridLayout(3, 0));
// 승리!! 패널
panel[0] = new JPanel();
JLabel winLabel = new JLabel("승리!!");
winLabel.setFont(new Font("굴림체", Font.BOLD, 30));
panel[0].add(winLabel);
// 이름입력 패널
panel[1] = new JPanel();
panel[1].add(infoLabel);
JTextField nameField = new JTextField(20);
nameField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTextField jf = (JTextField) e.getSource();
player = jf.getText();
// 이름을 입력해야 다시하기가능
resetButton.setEnabled(true);
// "score1.txt"에 저장
try {
File f = new File("score1.txt");
FileWriter fw = new FileWriter(f, true);
fw.write((time - 1) + " " + player + " " + gameSize + "\r\n");// 걸린시간 , 이름 , 게임사이즈
fw.close();
} catch (IOException e1) {
e1.printStackTrace();
}
nameField.setEditable(false);// 이름은 한번만 입력가능
infoLabel.setText("저장되었습니다.");
}
});
panel[1].add(nameField);
panel[2] = new JPanel();
resetButton.addActionListener(new buttonlistener());
resetButton.setEnabled(false);
goStart.addActionListener(new buttonlistener());
exit.addActionListener(new buttonlistener());
panel[2].add(resetButton);
panel[2].add(goStart);
panel[2].add(exit);
add(panel[0]);
add(panel[1]);
add(panel[2]);
setSize(300, 200);
setVisible(true);
}
class buttonlistener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == resetButton) {
restart();
dispose();
} else if (e.getSource() == goStart) {// 시작메뉴
new GameStart();
mygame1.dispose();
dispose();
} else
System.exit(1);
}
}
}
}
| UHC | Java | 18,130 | java | Game1.java | Java | [] | null | [] | ///////////////////////
//////지최찾기프레임///////
///////////////////////
package 객체프로젝트;
import javax.swing.*;
import 객체프로젝트.Game2.game2FinishFrame.buttonlistener;
import java.lang.Thread;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.Random;
class MyButton extends JButton {
private static int num = 0;
int x, y;// 버튼 크기저장
int index;// 버튼의 번호
int flag = 2; // 0 이면 깃발표시 1이면 물음표 2이면 표시 X
int surroundMineNum = 0;// 주위에있는 지뢰의 개수
boolean gamefinish = false;// 게임끝나면 true
boolean clickCheck = false;// 버튼을 클릭했는지 확인
boolean mine = false;// 지뢰인지 아닌지
boolean gamewin = false;// 게임성공하면 true
public MyButton() {
index = num++;
}
static public void reset() {
num = 0;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
x = this.getWidth();
y = this.getHeight();
if (clickCheck == true && mine == true && flag == 2) {// 지뢰를 클릭
this.setBackground(Color.RED);
g.fillOval(x / 4, y / 4, x / 2, y / 2);
g.drawLine(x / 4, y / 4, (x * 3) / 4, (y * 3) / 4);
g.drawLine((x * 3) / 4, y / 4, x / 4, (y * 3) / 4);
} else if (gamefinish == true && mine == true && flag == 2 && gamewin == false) {// 졌을때 종료후 출력
g.fillOval(x / 4, y / 4, x / 2, y / 2);
g.drawLine(x / 4, y / 4, (x * 3) / 4, (y * 3) / 4);
g.drawLine((x * 3) / 4, y / 4, x / 4, (y * 3) / 4);
} else if (flag == 0 && clickCheck == true && mine == false && gamefinish == true) {// 잘못된 깃발표기
g.fillOval(x / 4, y / 4, x / 2, y / 2);
g.drawLine(x / 4, y / 4, (x * 3) / 4, (y * 3) / 4);
g.drawLine((x * 3) / 4, y / 4, x / 4, (y * 3) / 4);
g.setColor(Color.RED);
g.drawLine(0, 0, x, y);
g.drawLine(x, 0, 0, y);
} else if (flag == 0 || (gamefinish == true && mine == true && flag == 2 && gamewin == true)) {// 깃발 마크
g.setColor(Color.RED);
g.fillRect(0, 0, x / 2, y / 2);
g.setColor(Color.BLACK);
g.drawLine(x / 2, 0, x / 2, y);
g.fillRect(0, (y * 3) / 4, x, y);
} else if (flag == 1) {// 물음표 표기
g.setFont(new Font("궁서체", Font.BOLD, 30));
g.drawString("?", x / 3, (y * 3) / 4);
}
}
}
public class Game1 extends JFrame {
JFrame mygame1 = this;
// 현제상태 0 일반 1성공 2실패
private int state = 0;
// 게임하는사람
private String player;
// 번호달린 버튼 생성
private MyButton button[];
private Reset resetbutton = new Reset();
// 지뢰위치
private int mineLocation[];
// 게임크기, 지뢰개수, 길발갯수, 시간
private int gameSize;
private int numOfMine;
private int numOfFlag;
private int time = 0;
private int leftButtonNum;
// 위치 버튼 오른쪽부터 시계방향으로 빙글
private int buttonSurround[] = new int[8];
// 게임패널
private JPanel gamePanel;
// 정보출력패널
private JPanel showPanel = new JPanel();
private JLabel flagLabel = new JLabel();
// 타이머
Timer timer = new Timer();
// 승리 프레임
JButton resetButton = new JButton("다시하기");
JButton goStart = new JButton("시작메뉴");
JButton exit = new JButton("종료");
public Game1(int size, int mineNum) {
setTitle("Game1");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gameSize = size;
numOfMine = mineNum;
numOfFlag = mineNum;
leftButtonNum = size * size;
// 지뢰생성
MakeMine();
// 버튼주위인댁스확인용
MakebuttonSurround();
setLayout(new BorderLayout());
// 설정화면 표시
showPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
// 타이머
flagLabel.setText("MINE : " + numOfFlag);
flagLabel.setFont(new Font("Gothic", Font.PLAIN, 30));
flagLabel.setBackground(Color.WHITE);
flagLabel.setOpaque(true);
showPanel.add(flagLabel);
// 게임리셋
resetbutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
restart();
}
});
showPanel.setBackground(Color.DARK_GRAY);
showPanel.add(resetbutton);
showPanel.add(timer);
// 게임패널설정
gamePanel = new JPanel();
gamePanel.setLayout(new GridLayout(gameSize, gameSize));
// 버튼 정보 입력 1
inputdata1();
// 버튼 정보 입력2
inputdata2();
// 채크
check();
// 패널부착
add(showPanel, BorderLayout.NORTH);
add(gamePanel, BorderLayout.CENTER);
setSize(gameSize * 45, gameSize * 45);
setVisible(true);
}
// 버튼확인(핵)
public void check() {
System.out.println("");
int count = 0;
for (int i = 0; i < gameSize; i++) {
for (int j = 0; j < gameSize; j++) {
if (button[count].mine == false)
System.out.print(button[count].surroundMineNum + "\t");
else
System.out.print("mine\t");
count++;
}
System.out.println("");
}
}
// 재시작!
public void restart() {
gamePanel.removeAll();// 게임패널 초기화
timer.finish();// 현제 타이머 종료
state = 0;// 상태초기화
time = 0;// 시간초기화
leftButtonNum = gameSize * gameSize;
numOfFlag = numOfMine;
flagLabel.setText("MINE : " + numOfFlag);
showPanel.remove(timer);// 타이머지우고
timer = new Timer();// 새거 다시담 (스래드 공부를 덜해서 초기화하는방법을 모르겠습니다..)
showPanel.add(timer);
MyButton.reset();
MakeMine();
inputdata1();
inputdata2();
check();
gamePanel.revalidate();
timer.revalidate();
}
// 지뢰 인댁스
public void MakeMine() {
// 지뢰갯수
mineLocation = new int[numOfMine];
// 난수생성(지뢰위치)
Random r = new Random();
for (int i = 0; i < mineLocation.length; i++) {
mineLocation[i] = r.nextInt(gameSize * gameSize);
for (int j = 0; j < i; j++) {
if (mineLocation[i] == mineLocation[j]) {
i--;
break;
}
}
}
}
// 버튼정보입력 1
public void inputdata1() {
button = new MyButton[gameSize * gameSize];
for (int i = 0; i < gameSize * gameSize; i++) {
button[i] = new MyButton();
// button[i].setPreferredSize(new Dimension(50, 50));
button[i].setFont(new Font("궁서체", Font.BOLD, 10));
// 버튼에 지뢰추가
for (int k = 0; k < mineLocation.length; k++) {
if (button[i].index == mineLocation[k])
button[i].mine = true;
}
// 채크
if (button[i].mine == true) {
System.out.print(button[i].index + " ");
}
button[i].addMouseListener(new MyActionListener());
gamePanel.add(button[i]);
}
}
// 버튼주위 지뢰갯수
public void inputdata2() {
for (int m = 0; m < gameSize * gameSize; m++) {
int num = 0;
// 버튼 위치마다 계산이 달라서..
// buttonSurround[] =
// {1,gameSize+1,gameSize,gameSize-1,-1,-gameSize-1,-gameSize,-gameSize+1};
if (button[m].mine == false) {
// case 1 좌상단
if (m == 0) {
for (int i = 0; i <= 2; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 2 상단
if ((m >= 1) && (m <= gameSize - 2)) {
for (int i = 0; i <= 4; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 3 우상단
if (m == gameSize - 1) {
for (int i = 2; i <= 4; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 4 좌측
if ((m % gameSize == 0) && m != gameSize * (gameSize - 1)) {
for (int i = 0; i <= 2; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
for (int i = 6; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 6 우측
if (((m % gameSize) == (gameSize - 1)) && (m != gameSize * gameSize - 1)) {
for (int i = 2; i <= 6; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 7 좌하단
if (m == gameSize * (gameSize - 1)) {
if (button[m + buttonSurround[0]].mine == true)
num++;
for (int i = 6; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 8 하단
if (m >= gameSize * (gameSize - 1) + 1 && m <= gameSize * gameSize - 2) {
if (button[m + buttonSurround[0]].mine == true)
num++;
for (int i = 4; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 9 우하단
if (m == gameSize * gameSize - 1) {
for (int i = 4; i <= 6; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
continue;
}
// case 5 중앙
for (int i = 0; i <= 7; i++) {
if (button[m + buttonSurround[i]].mine == true)
num++;
}
button[m].surroundMineNum = num;
}
}
}
// 위치정보 만들기 3시방향부터 시계방향으로
public void MakebuttonSurround() {
buttonSurround[0] = 1;
buttonSurround[1] = gameSize + 1;
buttonSurround[2] = gameSize;
buttonSurround[3] = gameSize - 1;
buttonSurround[4] = -1;
buttonSurround[5] = -gameSize - 1;
buttonSurround[6] = -gameSize;
buttonSurround[7] = -gameSize + 1;
}
// 버튼입력 이벤트
class MyActionListener extends MouseAdapter {
public void mouseReleased(MouseEvent e) {
MyButton b = (MyButton) e.getSource();
if (b.isEnabled() == true) {// 안눌린상태여만..
if (e.isPopupTrigger() == true) {// 우클릭이벤트 <깃발, ?>표기
if (b.flag == 2) {// 깃발표시하기
b.flag = 0;
b.clickCheck = true;
numOfFlag--;
flagLabel.setText("MINE : " + numOfFlag);
winOption();
repaint();
} else if (b.flag == 0) {// 물음표 표시하기
b.flag = 1;
numOfFlag++;
flagLabel.setText("MINE : " + numOfFlag);
repaint();
} else {// 처음으로
b.flag = 2;
b.clickCheck = false;
repaint();
}
} else {// 그냥 클릭
if (b.flag == 2) {
if (b.mine == true) {// 지뢰를 클릭했을때...
state = 2;// 실패
b.clickCheck = true;
clickAllButton();
timer.finish();
repaint();
}
if (b.mine == false) {
if (b.surroundMineNum == 0) {// 0일경우 주위를 채크
b.setEnabled(false);
b.clickCheck = true;
leftButtonNum--;
checkSurround(b.index);
winOption();
} else {
b.setText(b.surroundMineNum + "");
leftButtonNum--;
b.clickCheck = true;
b.setEnabled(false);
winOption();
}
}
}
}
}
System.out.println("left button:" + leftButtonNum);
}
}
// 승리조건
public void winOption() {
int count = 0;
for (int i = 0; i < gameSize * gameSize; i++) {
if (button[i].flag == 0 && button[i].mine == true) // 지뢰위에 깃발표시할 경우
count++;
if ((count + leftButtonNum) == numOfMine) {// 승리조건 만족 = 위의 조건 + 남은 버튼의수가 지뢰의 갯수와 같을때
state = 1;// 승리상태
repaint();
timer.finish();
clickAllButton();
// 정보입력패널
new game1FinishFrame();
count = 0;
break;
}
}
}
// 모든 버튼 누르기(승리 or 패배)
public void clickAllButton() {
for (int i = 0; i < gameSize * gameSize; i++) {// 모든 버튼을 ..
if (state == 1)
button[i].gamewin = true;
button[i].gamefinish = true;// 게임종료
if (button[i].surroundMineNum != 0)// 주위의 지뢰 표시
button[i].setText(button[i].surroundMineNum + "");
button[i].setEnabled(false);
}
}
// {1,gameSize+1,gameSize,gameSize-1,-1,-gameSize-1,-gameSize,-gameSize+1};
// 버튼이 0일경우 주위채크
// 밑의함수 길이 줄이기
public void simplecheck(int index, int i) {
int num = index + buttonSurround[i];
if (button[num].clickCheck == false) {// 안눌려져 있을때
if (button[num].surroundMineNum == 0) {
button[num].clickCheck = true;
button[num].setEnabled(false);
leftButtonNum--;
checkSurround(num);
} else {
button[num].setText(button[num].surroundMineNum + "");
button[num].clickCheck = true;
button[num].setEnabled(false);
leftButtonNum--;
}
} else
return;
}
public void checkSurround(int index) {
if (index == 0) {// case 1 좌상단
for (int i = 0; i <= 2; i++) {
simplecheck(index, i);
}
} else if ((index >= 1) && (index <= gameSize - 2)) {// case 2 상단
for (int i = 0; i <= 4; i++) {
simplecheck(index, i);
}
} else if (index == gameSize - 1) {// case 3 우상단
for (int i = 2; i <= 4; i++) {
simplecheck(index, i);
}
} else if ((index % gameSize == 0) && index != 0 && index != gameSize * (gameSize - 1)) {// case 4 좌측
for (int i = 0; i <= 2; i++) {
simplecheck(index, i);
}
for (int i = 6; i <= 7; i++) {
simplecheck(index, i);
}
} else if (((index % gameSize) == (gameSize - 1)) && (index != gameSize * gameSize - 1)
&& (index != gameSize - 1)) {// case 6 우측
for (int i = 2; i <= 6; i++) {
simplecheck(index, i);
}
} else if (index == gameSize * (gameSize - 1)) {// case 7 좌하단
simplecheck(index, 0);
for (int i = 6; i <= 7; i++) {
simplecheck(index, i);
}
} else if (index >= gameSize * (gameSize - 1) + 1 && index <= gameSize * gameSize - 2) {// case 8 하단
simplecheck(index, 0);
for (int i = 4; i <= 7; i++) {
simplecheck(index, i);
}
} else if (index == gameSize * gameSize - 1) { // case 9 우하단
for (int i = 4; i <= 6; i++) {
simplecheck(index, i);
}
} else {// case 5 중앙
for (int i = 0; i <= 7; i++) {
simplecheck(index, i);
}
}
}
// 리셋버튼 // 표정그림
class Reset extends JButton {
int x, y;
public Reset() {
this.setPreferredSize(new Dimension(48, 48));
}
public void paintComponent(Graphics g) {
x = this.getWidth();
y = this.getHeight();
super.paintComponent(g);
if (state == 0) {// 일반 표정
g.setColor(Color.YELLOW);
g.fillOval(0, 0, x, y);
g.setColor(Color.BLACK);
g.fillRect(x / 3 - 3, y / 3, 6, 6);
g.fillRect((x * 2) / 3 - 3, y / 3, 6, 6);
g.drawArc(x / 3, y / 2, x / 3, y / 3, 180, 180);
} else if (state == 1) {// 성공!! 표정
g.setColor(Color.YELLOW);
g.fillOval(0, 0, x, y);
g.setColor(Color.BLACK);
g.drawArc(x / 6, y / 6, x / 3, y / 3, 0, 180);
g.drawArc(x / 2, y / 6, x / 3, y / 3, 0, 180);
g.drawArc(x / 3, y / 2, x / 3, y / 3, 180, 180);
} else {// 실패 표정..
g.setColor(Color.YELLOW);
g.fillOval(0, 0, x, y);
g.setColor(Color.BLACK);
g.drawLine(x / 6, y / 6, x / 2, y / 2);
g.drawLine(x / 2, y / 2, (x * 5) / 6, y / 6);
g.drawLine(x / 6, y / 2, x / 2, y / 6);
g.drawLine(x / 2, y / 6, (x * 5) / 6, y / 2);
g.drawLine(x / 3, (y * 5) / 6, (x * 2) / 3, (y * 5) / 6);
}
}
}
// 타이머 설정
class Timer extends JPanel {
private boolean flag = false;
public void finish() {
flag = true;
}
public Timer() {
setLayout(new FlowLayout());
JLabel timerLabel = new JLabel();
timerLabel.setFont(new Font("Gothic", Font.PLAIN, 30));
TimerThread th = new TimerThread(timerLabel);
add(timerLabel);
th.start();
}
class TimerThread extends Thread {
private JLabel timerLabel;
public TimerThread(JLabel timerLabel) {
this.timerLabel = timerLabel;
}
public void run() {
while (flag == false) {
timerLabel.setText("TIME : " + Integer.toString(time));
time++;
try {
sleep(1000);
if (flag == true)
return;
} catch (InterruptedException e) {
return;
}
}
}
}
}
// 게임 끝난후
class game1FinishFrame extends JFrame {
JPanel panel[] = new JPanel[3];
JLabel infoLabel = new JLabel("이름을 입력하세요");
public game1FinishFrame() {
setTitle("지뢰찾기");
setLayout(new GridLayout(3, 0));
// 승리!! 패널
panel[0] = new JPanel();
JLabel winLabel = new JLabel("승리!!");
winLabel.setFont(new Font("굴림체", Font.BOLD, 30));
panel[0].add(winLabel);
// 이름입력 패널
panel[1] = new JPanel();
panel[1].add(infoLabel);
JTextField nameField = new JTextField(20);
nameField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTextField jf = (JTextField) e.getSource();
player = jf.getText();
// 이름을 입력해야 다시하기가능
resetButton.setEnabled(true);
// "score1.txt"에 저장
try {
File f = new File("score1.txt");
FileWriter fw = new FileWriter(f, true);
fw.write((time - 1) + " " + player + " " + gameSize + "\r\n");// 걸린시간 , 이름 , 게임사이즈
fw.close();
} catch (IOException e1) {
e1.printStackTrace();
}
nameField.setEditable(false);// 이름은 한번만 입력가능
infoLabel.setText("저장되었습니다.");
}
});
panel[1].add(nameField);
panel[2] = new JPanel();
resetButton.addActionListener(new buttonlistener());
resetButton.setEnabled(false);
goStart.addActionListener(new buttonlistener());
exit.addActionListener(new buttonlistener());
panel[2].add(resetButton);
panel[2].add(goStart);
panel[2].add(exit);
add(panel[0]);
add(panel[1]);
add(panel[2]);
setSize(300, 200);
setVisible(true);
}
class buttonlistener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == resetButton) {
restart();
dispose();
} else if (e.getSource() == goStart) {// 시작메뉴
new GameStart();
mygame1.dispose();
dispose();
} else
System.exit(1);
}
}
}
}
| 18,130 | 0.559351 | 0.536078 | 646 | 24.873066 | 18.888281 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.750774 | false | false | 2 |
2065865e8071f4ac88debd63cbcb64f893fccec5 | 13,967,233,666,284 | 8fd7da4ee94b5079dbb19f7eb8d4abc99695cfdf | /AutomationProject/Billing/billing/com/util/BillingCommon.java | 134258179f36c5e31466abf556778e6f64145dd1 | [] | no_license | jyotsnagupta/AutomationProjects | https://github.com/jyotsnagupta/AutomationProjects | 374bd63ff3aa10ca511389e53acc6109b8833242 | 50e320fdf389a5ca8036455aa959dc2fc8e0b94e | refs/heads/master | 2021-01-22T06:58:55.974000 | 2015-05-24T15:08:14 | 2015-05-24T15:08:14 | 35,146,447 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package billing.com.util;
public class BillingCommon {
}
| UTF-8 | Java | 59 | java | BillingCommon.java | Java | [] | null | [] | package billing.com.util;
public class BillingCommon {
}
| 59 | 0.762712 | 0.762712 | 5 | 10.8 | 12.859238 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 2 |
0eb6c1c7474db685156fa5b162246855f8fda194 | 8,031,588,862,606 | cd1c295e9cc5f79836cc34313df8f74ce0798e45 | /src/fundamentos/arrays/MatrizAlunos.java | c7f909a331bca4b3adc2cb02f213b335eb4f1b5f | [] | no_license | stzu98/myTrash | https://github.com/stzu98/myTrash | 4dfee7dfadce819d082f6d985d23c0340437a907 | b83374d0bda82967188b14a913d0ffaf92c42a92 | refs/heads/master | 2022-06-22T10:49:51.411000 | 2020-05-05T13:53:38 | 2020-05-05T13:53:38 | 261,481,693 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fundamentos.arrays;
import java.util.Arrays;
import java.util.Scanner;
public class MatrizAlunos {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.print("Digite a quantidade de alunos: ");
int a = sc.nextInt();
System.out.print("Digite a quantidade de notas: ");
int n = sc.nextInt();
System.out.println();
double[][] aluno = new double[a][n];
for(int i = 0; i < aluno.length; i++) {
for(int j = 0; j < aluno[i].length; j ++) {
System.out.print("Nota: " + (i + 1) + " :");
aluno[i][j] = sc.nextDouble();
}
}
System.out.println();
double ac1 = 0;
double ac2 = 0;
for(int i = 0; i < aluno.length; i++) {
ac1 = 0;
for(int j = 0; j < aluno[i].length; j++) {
ac1 += aluno[i][j];
ac2 += aluno[i][j];
}
double media = ac1/n;
System.out.printf("Média do " + (i + 1) + "a Aluno: %.1f \n", media);
}
System.out.printf("Média da turma : %.1f \n", ac2/(a * n));
System.out.println();
for(double[] notas : aluno) {
System.out.println(Arrays.toString(notas));
}
}
}
| ISO-8859-2 | Java | 1,173 | java | MatrizAlunos.java | Java | [] | null | [] | package fundamentos.arrays;
import java.util.Arrays;
import java.util.Scanner;
public class MatrizAlunos {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
System.out.print("Digite a quantidade de alunos: ");
int a = sc.nextInt();
System.out.print("Digite a quantidade de notas: ");
int n = sc.nextInt();
System.out.println();
double[][] aluno = new double[a][n];
for(int i = 0; i < aluno.length; i++) {
for(int j = 0; j < aluno[i].length; j ++) {
System.out.print("Nota: " + (i + 1) + " :");
aluno[i][j] = sc.nextDouble();
}
}
System.out.println();
double ac1 = 0;
double ac2 = 0;
for(int i = 0; i < aluno.length; i++) {
ac1 = 0;
for(int j = 0; j < aluno[i].length; j++) {
ac1 += aluno[i][j];
ac2 += aluno[i][j];
}
double media = ac1/n;
System.out.printf("Média do " + (i + 1) + "a Aluno: %.1f \n", media);
}
System.out.printf("Média da turma : %.1f \n", ac2/(a * n));
System.out.println();
for(double[] notas : aluno) {
System.out.println(Arrays.toString(notas));
}
}
}
| 1,173 | 0.560205 | 0.544833 | 55 | 20.290909 | 19.104185 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.745455 | false | false | 2 |
400bf64c46073dcf5939b1220d131feb2c57258a | 17,368,847,765,195 | af2aa2d3929216b379e6fc6f55be75f6fcad7fb3 | /demo/src/main/java/com/example/demo/model/Campaign.java | 95a98dc62cf486a381a1d849f3cbf448acc53a85 | [] | no_license | esinkavak/shoppingCart | https://github.com/esinkavak/shoppingCart | 0a8c846b73fa24007ad88ee54fcccbcc7d560adf | a44c559291befe21b74e126894f00af3be18aa7c | refs/heads/master | 2020-04-14T02:24:30.628000 | 2019-10-16T13:38:41 | 2019-10-16T13:38:41 | 163,582,012 | 1 | 0 | null | false | 2019-04-27T13:17:18 | 2018-12-30T11:22:32 | 2018-12-30T11:51:26 | 2019-04-27T13:17:17 | 20,252 | 1 | 0 | 0 | null | false | false | package com.example.demo.model;
import com.example.demo.common.DiscountType;
public class Campaign {
private Category category;
private double ratio;
private int itemCount;
private DiscountType discountType;
public Campaign() {
super();
}
public Campaign(Category category, double ratio, int itemCount, DiscountType discountType) {
super();
this.category = category;
this.ratio = ratio;
this.itemCount = itemCount;
this.discountType = discountType;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public double getRatio() {
return ratio;
}
public void setRatio(double ratio) {
this.ratio = ratio;
}
public int getItemCount() {
return itemCount;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount;
}
public DiscountType getDiscountType() {
return discountType;
}
public void setDiscountType(DiscountType discountType) {
this.discountType = discountType;
}
}
| UTF-8 | Java | 1,077 | java | Campaign.java | Java | [] | null | [] | package com.example.demo.model;
import com.example.demo.common.DiscountType;
public class Campaign {
private Category category;
private double ratio;
private int itemCount;
private DiscountType discountType;
public Campaign() {
super();
}
public Campaign(Category category, double ratio, int itemCount, DiscountType discountType) {
super();
this.category = category;
this.ratio = ratio;
this.itemCount = itemCount;
this.discountType = discountType;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public double getRatio() {
return ratio;
}
public void setRatio(double ratio) {
this.ratio = ratio;
}
public int getItemCount() {
return itemCount;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount;
}
public DiscountType getDiscountType() {
return discountType;
}
public void setDiscountType(DiscountType discountType) {
this.discountType = discountType;
}
}
| 1,077 | 0.69545 | 0.69545 | 56 | 17.232143 | 18.643259 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.339286 | false | false | 2 |
74f91f35ff1a63ce61577b507a6cd0d844fa061e | 26,379,689,152,848 | 16550f198ef59e13c229d5e7767d3fc77ce79145 | /ParisMetro.java | 2f2ae3f5050b4d14435058d40870ec25409393ae | [] | no_license | Dalga082/ParisMetro | https://github.com/Dalga082/ParisMetro | 05f1f8530f729196b50b294da0b28f84cdc6b63b | 1f839ef2cd984ffb3feb6e149d2b6dc07af436b9 | refs/heads/master | 2020-05-12T21:42:12.869000 | 2019-04-15T19:25:55 | 2019-04-15T19:25:55 | 181,550,647 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.StringTokenizer;
import net.datastructures.AdjacencyMapGraph;
//import net.datastructures.Dijkstra;
import net.datastructures.Edge;
import net.datastructures.Graph;
import net.datastructures.GraphAlgorithms;
import net.datastructures.Map;
import net.datastructures.Vertex;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
public class ParisMetro {
private int numOfVertices;
private int numOfEdges;
private String[] stationsInOrder;
private Graph<Integer, Integer> sGraph;
private Hashtable<Integer, Vertex<Integer>> vertices;
private static final Integer WALKING_CONSTANT = new Integer(90);
/** Identify all the stations belonging to the
same line as station N1. */
public ParisMetro(Integer N1) throws Exception, IOException {
// System.out.println("Constructor 1\n");
FileReader file = new FileReader("metro.txt");
sGraph = new AdjacencyMapGraph<Integer, Integer>(true);
readMetro(file);
printAll(N1, -1, -1);
}
/** Find the shortest path between stations N1 & N2.
Print all stations of the path in order.
Print the total travel time. */
public ParisMetro(Integer N1, Integer N2) throws Exception, IOException {
// System.out.println("Constructor 2\n");
FileReader file = new FileReader("metro.txt");
sGraph = new AdjacencyMapGraph<Integer, Integer>(true);
readMetro(file);
printAll(N1, N2, -1);
}
/** Find the shortest path between stations N1 & N2
knowing that the line on which station N3 is situated is
not functioning. (Station N3 is an endpoint of its line.)
Print all stations of the path in order.
Print the total travel time. */
public ParisMetro(Integer N1, Integer N2, Integer N3) throws Exception, IOException {
// System.out.println("Constructor 3\n");
FileReader file = new FileReader("metro.txt");
sGraph = new AdjacencyMapGraph<Integer, Integer>(true);
readMetro(file);
printAll(N1, N2, N3);
}
public void readMetro(FileReader filename) {
try {
vertices = new Hashtable<Integer, Vertex<Integer>>();
BufferedReader metroFile = new BufferedReader(filename);
int lineNumber = 0;
boolean space = false;
boolean sdw = false;
String line = metroFile.readLine();
String currentStation = "";
while (line != null) {
if (lineNumber == 0) {
StringTokenizer tmpTok = new StringTokenizer(line);
String bugCharString = tmpTok.nextToken();
int ch=0;
if (bugCharString.length() == 4) { // ...this takes care of an invisible "\uFEFF" character if present.
System.out.println(bugCharString.length());
while(line.charAt(ch)!= '3'){
ch++;
}
//ch = 1;
}
else { // bugCharString.length() == 3 ...this means there is no "\uFEFF" character in front of "376".
System.out.println(bugCharString.length());
//ch = 0;
}
String strNumOfVertices = "";
String strNumOfEdges = "";
while (ch < line.length()) {
if (line.charAt(ch) == ' ') {
space = true;
ch++;
}
if (space) {
strNumOfEdges = strNumOfEdges + line.charAt(ch);
}
else {
strNumOfVertices = strNumOfVertices + line.charAt(ch);
}
ch++;
}
space = false;
numOfVertices = Integer.parseInt(strNumOfVertices);
numOfEdges = Integer.parseInt(strNumOfEdges);
System.out.println(numOfVertices);
System.out.println(numOfEdges);
stationsInOrder = new String[numOfVertices];
}
else {
StringTokenizer sTokenizer = new StringTokenizer(line);
String token = sTokenizer.nextToken();
if (token.equals("$")) {
sdw = true;
line = metroFile.readLine();
sTokenizer = new StringTokenizer(line);
token = sTokenizer.nextToken();
}
if (!sdw) {
for (int ch = 0; ch < line.length(); ch++) {
if ((line.charAt(ch) == ' ') && !space) {
space = true;
ch++;
}
if (space) {
currentStation = currentStation + line.charAt(ch);
}
}
space = false;
stationsInOrder[lineNumber-1] = currentStation;
currentStation = "";
}
else { // (sdw) // [ SOURCE DESTINATION WEIGHT ]
Integer source = new Integer(token);
token = sTokenizer.nextToken();
Integer dest = new Integer(token);
token = sTokenizer.nextToken();
Integer weight = new Integer(token);
if (weight == -1) {
weight = WALKING_CONSTANT;
}
Vertex<Integer> sv = vertices.get(source);
if (sv == null) {
sv = sGraph.insertVertex(source);
vertices.put(source, sv);
}
Vertex<Integer> dv = vertices.get(dest);
if (dv == null) {
dv = sGraph.insertVertex(dest);
vertices.put(dest, dv);
}
if (sGraph.getEdge(sv, dv) == null) {
Edge<Integer> e = sGraph.insertEdge(sv, dv, weight);
}
}
}
line = metroFile.readLine();
lineNumber++;
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
/**
* Helper routine to get a Vertex (Position) from a string naming the vertex
* Modified by Thais Bardini on November 19th, 2017 (tbard069@uottawa.ca)
*/
public Vertex<Integer> getVertex(Integer vert) throws Exception {
for (Vertex<Integer> v : sGraph.vertices()) {
if (v.getElement().equals(vert)) {
return v;
}
}
throw new Exception("Vertex not in graph: " + vert);
}
/**
* Print the shortest distances
* Modified by Thais Bardini on November 19th, 2017 (tbard069@uottawa.ca)
* @throws Exception
*/
public void printAll(Integer start, Integer fin, Integer broke) throws Exception {
if (fin == -1 && broke == -1) {
System.out.println("Printing all stations on the same line as station " + start + ":");
Vertex<Integer> vSource = getVertex(start);
GraphAlgorithms dj = new GraphAlgorithms();
dj.DFSComplete(sGraph, vSource, stationsInOrder);
System.out.println();
}
else if (broke == -1) {
System.out.println("Printing shortest path from station " + start + " to station " + fin + ":");
Vertex<Integer> vSource = getVertex(start);
Vertex<Integer> vGoal = getVertex(fin);
GraphAlgorithms dj = new GraphAlgorithms();
Map<Vertex<Integer>, Integer> result = dj.shortestPathLengths(sGraph, vSource, vGoal);
List<Integer> interV = dj.verticesInShortestPath(sGraph, vSource, vGoal);
for (Integer i : interV) {
System.out.print(i + " ");
}
System.out.println("\n\nTotal travel time: " + result.get(vGoal) + " seconds.");
System.out.println("Total travel time is around: " + Math.round((float)result.get(vGoal)/60) + " minutes.\n");
}
else {
System.out.println("Printing shortest path from station " + start + " to station " + fin + " when the line containing station " + broke + " is closed:");
// Vertex<Integer> vBroke = getVertex(broke);
// for (Edge<Integer> e : sGraph.outgoingEdges(vBroke)) {
// if (e.getElement() != 90) {
// Vertex<Integer> vb = sGraph.opposite(vBroke, e);
// if (vb != null) {
// if (sGraph.inDegree(vb) <= 2 && sGraph.inDegree(vBroke) <= 2) {
// sGraph.removeVertex(vBroke);
// vBroke = vb;
// }
// else {
// vBroke = vb;
// }
// }
// }
// }
Vertex<Integer> vSource = getVertex(start);
Vertex<Integer> vGoal = getVertex(fin);
GraphAlgorithms dj = new GraphAlgorithms();
Map<Vertex<Integer>, Integer> result = dj.shortestPathLengths(sGraph, vSource, vGoal);
List<Integer> interV = dj.verticesInShortestPath(sGraph, vSource, vGoal);
for (Integer i : interV) {
System.out.print(i + " ");
}
System.out.println("\n\nTotal travel time: " + result.get(vGoal) + " seconds.");
System.out.println("Total travel time is around: " + Math.round((float)result.get(vGoal)/60) + " minutes.\n");
}
}
public static void main(String[] args) {
if (args.length == 1) {
System.out.print("\nOne INPUT: ");
System.out.println("N1 = " + args[0] + "\n");
Integer N1 = new Integer(args[0]);
try {
ParisMetro pM = new ParisMetro(N1);
}
catch (Exception except) {
System.err.println(except);
except.printStackTrace();
}
}
else if (args.length == 2) {
System.out.print("\nTwo INPUTS: ");
System.out.println("N1 = " + args[0] + " N2 = " + args[1] + "\n");
Integer N1 = new Integer(args[0]);
Integer N2 = new Integer(args[1]);
try {
ParisMetro pM = new ParisMetro(N1, N2);
}
catch (Exception except) {
System.err.println(except);
except.printStackTrace();
}
}
else if (args.length == 3) {
System.out.print("\nThree INPUTS: ");
System.out.println("N1 = " + args[0] + " N2 = " + args[1] + " N3 = " + args[2] + "\n");
Integer N1 = new Integer(args[0]);
Integer N2 = new Integer(args[1]);
Integer N3 = new Integer(args[2]);
try {
ParisMetro pM = new ParisMetro(N1, N2, N3);
}
catch (Exception except) {
System.err.println(except);
except.printStackTrace();
}
}
}
} | UTF-8 | Java | 10,183 | java | ParisMetro.java | Java | [
{
"context": "n) from a string naming the vertex\n\t * Modified by Thais Bardini on November 19th, 2017 (tbard069@uottawa.ca) \n\t *",
"end": 6254,
"score": 0.9999059438705444,
"start": 6241,
"tag": "NAME",
"value": "Thais Bardini"
},
{
"context": "Modified by Thais Bardini on Novemb... | null | [] | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.StringTokenizer;
import net.datastructures.AdjacencyMapGraph;
//import net.datastructures.Dijkstra;
import net.datastructures.Edge;
import net.datastructures.Graph;
import net.datastructures.GraphAlgorithms;
import net.datastructures.Map;
import net.datastructures.Vertex;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
public class ParisMetro {
private int numOfVertices;
private int numOfEdges;
private String[] stationsInOrder;
private Graph<Integer, Integer> sGraph;
private Hashtable<Integer, Vertex<Integer>> vertices;
private static final Integer WALKING_CONSTANT = new Integer(90);
/** Identify all the stations belonging to the
same line as station N1. */
public ParisMetro(Integer N1) throws Exception, IOException {
// System.out.println("Constructor 1\n");
FileReader file = new FileReader("metro.txt");
sGraph = new AdjacencyMapGraph<Integer, Integer>(true);
readMetro(file);
printAll(N1, -1, -1);
}
/** Find the shortest path between stations N1 & N2.
Print all stations of the path in order.
Print the total travel time. */
public ParisMetro(Integer N1, Integer N2) throws Exception, IOException {
// System.out.println("Constructor 2\n");
FileReader file = new FileReader("metro.txt");
sGraph = new AdjacencyMapGraph<Integer, Integer>(true);
readMetro(file);
printAll(N1, N2, -1);
}
/** Find the shortest path between stations N1 & N2
knowing that the line on which station N3 is situated is
not functioning. (Station N3 is an endpoint of its line.)
Print all stations of the path in order.
Print the total travel time. */
public ParisMetro(Integer N1, Integer N2, Integer N3) throws Exception, IOException {
// System.out.println("Constructor 3\n");
FileReader file = new FileReader("metro.txt");
sGraph = new AdjacencyMapGraph<Integer, Integer>(true);
readMetro(file);
printAll(N1, N2, N3);
}
public void readMetro(FileReader filename) {
try {
vertices = new Hashtable<Integer, Vertex<Integer>>();
BufferedReader metroFile = new BufferedReader(filename);
int lineNumber = 0;
boolean space = false;
boolean sdw = false;
String line = metroFile.readLine();
String currentStation = "";
while (line != null) {
if (lineNumber == 0) {
StringTokenizer tmpTok = new StringTokenizer(line);
String bugCharString = tmpTok.nextToken();
int ch=0;
if (bugCharString.length() == 4) { // ...this takes care of an invisible "\uFEFF" character if present.
System.out.println(bugCharString.length());
while(line.charAt(ch)!= '3'){
ch++;
}
//ch = 1;
}
else { // bugCharString.length() == 3 ...this means there is no "\uFEFF" character in front of "376".
System.out.println(bugCharString.length());
//ch = 0;
}
String strNumOfVertices = "";
String strNumOfEdges = "";
while (ch < line.length()) {
if (line.charAt(ch) == ' ') {
space = true;
ch++;
}
if (space) {
strNumOfEdges = strNumOfEdges + line.charAt(ch);
}
else {
strNumOfVertices = strNumOfVertices + line.charAt(ch);
}
ch++;
}
space = false;
numOfVertices = Integer.parseInt(strNumOfVertices);
numOfEdges = Integer.parseInt(strNumOfEdges);
System.out.println(numOfVertices);
System.out.println(numOfEdges);
stationsInOrder = new String[numOfVertices];
}
else {
StringTokenizer sTokenizer = new StringTokenizer(line);
String token = sTokenizer.nextToken();
if (token.equals("$")) {
sdw = true;
line = metroFile.readLine();
sTokenizer = new StringTokenizer(line);
token = sTokenizer.nextToken();
}
if (!sdw) {
for (int ch = 0; ch < line.length(); ch++) {
if ((line.charAt(ch) == ' ') && !space) {
space = true;
ch++;
}
if (space) {
currentStation = currentStation + line.charAt(ch);
}
}
space = false;
stationsInOrder[lineNumber-1] = currentStation;
currentStation = "";
}
else { // (sdw) // [ SOURCE DESTINATION WEIGHT ]
Integer source = new Integer(token);
token = sTokenizer.nextToken();
Integer dest = new Integer(token);
token = sTokenizer.nextToken();
Integer weight = new Integer(token);
if (weight == -1) {
weight = WALKING_CONSTANT;
}
Vertex<Integer> sv = vertices.get(source);
if (sv == null) {
sv = sGraph.insertVertex(source);
vertices.put(source, sv);
}
Vertex<Integer> dv = vertices.get(dest);
if (dv == null) {
dv = sGraph.insertVertex(dest);
vertices.put(dest, dv);
}
if (sGraph.getEdge(sv, dv) == null) {
Edge<Integer> e = sGraph.insertEdge(sv, dv, weight);
}
}
}
line = metroFile.readLine();
lineNumber++;
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
/**
* Helper routine to get a Vertex (Position) from a string naming the vertex
* Modified by <NAME> on November 19th, 2017 (<EMAIL>)
*/
public Vertex<Integer> getVertex(Integer vert) throws Exception {
for (Vertex<Integer> v : sGraph.vertices()) {
if (v.getElement().equals(vert)) {
return v;
}
}
throw new Exception("Vertex not in graph: " + vert);
}
/**
* Print the shortest distances
* Modified by <NAME> on November 19th, 2017 (<EMAIL>)
* @throws Exception
*/
public void printAll(Integer start, Integer fin, Integer broke) throws Exception {
if (fin == -1 && broke == -1) {
System.out.println("Printing all stations on the same line as station " + start + ":");
Vertex<Integer> vSource = getVertex(start);
GraphAlgorithms dj = new GraphAlgorithms();
dj.DFSComplete(sGraph, vSource, stationsInOrder);
System.out.println();
}
else if (broke == -1) {
System.out.println("Printing shortest path from station " + start + " to station " + fin + ":");
Vertex<Integer> vSource = getVertex(start);
Vertex<Integer> vGoal = getVertex(fin);
GraphAlgorithms dj = new GraphAlgorithms();
Map<Vertex<Integer>, Integer> result = dj.shortestPathLengths(sGraph, vSource, vGoal);
List<Integer> interV = dj.verticesInShortestPath(sGraph, vSource, vGoal);
for (Integer i : interV) {
System.out.print(i + " ");
}
System.out.println("\n\nTotal travel time: " + result.get(vGoal) + " seconds.");
System.out.println("Total travel time is around: " + Math.round((float)result.get(vGoal)/60) + " minutes.\n");
}
else {
System.out.println("Printing shortest path from station " + start + " to station " + fin + " when the line containing station " + broke + " is closed:");
// Vertex<Integer> vBroke = getVertex(broke);
// for (Edge<Integer> e : sGraph.outgoingEdges(vBroke)) {
// if (e.getElement() != 90) {
// Vertex<Integer> vb = sGraph.opposite(vBroke, e);
// if (vb != null) {
// if (sGraph.inDegree(vb) <= 2 && sGraph.inDegree(vBroke) <= 2) {
// sGraph.removeVertex(vBroke);
// vBroke = vb;
// }
// else {
// vBroke = vb;
// }
// }
// }
// }
Vertex<Integer> vSource = getVertex(start);
Vertex<Integer> vGoal = getVertex(fin);
GraphAlgorithms dj = new GraphAlgorithms();
Map<Vertex<Integer>, Integer> result = dj.shortestPathLengths(sGraph, vSource, vGoal);
List<Integer> interV = dj.verticesInShortestPath(sGraph, vSource, vGoal);
for (Integer i : interV) {
System.out.print(i + " ");
}
System.out.println("\n\nTotal travel time: " + result.get(vGoal) + " seconds.");
System.out.println("Total travel time is around: " + Math.round((float)result.get(vGoal)/60) + " minutes.\n");
}
}
public static void main(String[] args) {
if (args.length == 1) {
System.out.print("\nOne INPUT: ");
System.out.println("N1 = " + args[0] + "\n");
Integer N1 = new Integer(args[0]);
try {
ParisMetro pM = new ParisMetro(N1);
}
catch (Exception except) {
System.err.println(except);
except.printStackTrace();
}
}
else if (args.length == 2) {
System.out.print("\nTwo INPUTS: ");
System.out.println("N1 = " + args[0] + " N2 = " + args[1] + "\n");
Integer N1 = new Integer(args[0]);
Integer N2 = new Integer(args[1]);
try {
ParisMetro pM = new ParisMetro(N1, N2);
}
catch (Exception except) {
System.err.println(except);
except.printStackTrace();
}
}
else if (args.length == 3) {
System.out.print("\nThree INPUTS: ");
System.out.println("N1 = " + args[0] + " N2 = " + args[1] + " N3 = " + args[2] + "\n");
Integer N1 = new Integer(args[0]);
Integer N2 = new Integer(args[1]);
Integer N3 = new Integer(args[2]);
try {
ParisMetro pM = new ParisMetro(N1, N2, N3);
}
catch (Exception except) {
System.err.println(except);
except.printStackTrace();
}
}
}
} | 10,145 | 0.582441 | 0.572326 | 377 | 26.013262 | 25.755375 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.514589 | false | false | 2 |
8c619dc2217a55dfa6c9cf09e2a0fee49ce14f7e | 11,295,764,014,721 | e338d39e765badbeb216911288b38058eeafbb48 | /src/main/java/com/damg/agreementsapiendpoints/agreementsapiendpoints/models/entities/User.java | eb4e6541264d6a553611aeeb7a16267871062d4d | [] | no_license | Sandokan8698/agreements-api-endpoint | https://github.com/Sandokan8698/agreements-api-endpoint | cd557e98312d637d9b0d5fff2edef96977d637dc | 0f0724ca85b01040c0bf146955d25a0deaf30ba3 | refs/heads/master | 2020-03-30T05:45:01.615000 | 2018-10-01T23:12:21 | 2018-10-01T23:12:21 | 150,817,386 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.damg.agreementsapiendpoints.agreementsapiendpoints.models.entities;
import com.damg.agreementsapiendpoints.agreementsapiendpoints.models.utils.Sexo;
import javax.persistence.*;
@Entity
@Table(name="users")
public class User extends BaseEntity {
private String sis_user_name;
private String sis_user_first_name;
private String sis_user_last_name;
private String sis_user_middle_name;
private String sis_user_email;
private String sis_user_dob;
private String sis_user_confidentiality_ind;
private Sexo sis_user_sex;
public User(String name , String first_name) {
setSis_user_name(name);
setSis_user_first_name(first_name);
setSis_user_last_name("");
setSis_user_middle_name("");
setSis_user_email("");
setSis_user_dob("");
setSis_user_confidentiality_ind("");
}
public User() {
}
public String getSis_user_name() {
return sis_user_name;
}
public String getSis_user_first_name() {
return sis_user_first_name;
}
public String getSis_user_last_name() {
return sis_user_last_name;
}
public String getSis_user_middle_name() {
return sis_user_middle_name;
}
public String getSis_user_email() {
return sis_user_email;
}
public String getSis_user_dob() {
return sis_user_dob;
}
public String getSis_user_confidentiality_ind() {
return sis_user_confidentiality_ind;
}
public Sexo getSis_user_sex() {
return sis_user_sex;
}
public void setSis_user_name(String sis_user_name) {
this.sis_user_name = sis_user_name;
}
public void setSis_user_first_name(String sis_user_first_name) {
this.sis_user_first_name = sis_user_first_name;
}
public void setSis_user_last_name(String sis_user_last_name) {
this.sis_user_last_name = sis_user_last_name;
}
public void setSis_user_middle_name(String sis_user_middle_name) {
this.sis_user_middle_name = sis_user_middle_name;
}
public void setSis_user_email(String sis_user_email) {
this.sis_user_email = sis_user_email;
}
public void setSis_user_dob(String sis_user_dob) {
this.sis_user_dob = sis_user_dob;
}
public void setSis_user_confidentiality_ind(String sis_user_confidentiality_ind) {
this.sis_user_confidentiality_ind = sis_user_confidentiality_ind;
}
public void setSis_user_sex(Sexo sis_user_sex) {
this.sis_user_sex = sis_user_sex;
}
}
| UTF-8 | Java | 2,565 | java | User.java | Java | [] | null | [] | package com.damg.agreementsapiendpoints.agreementsapiendpoints.models.entities;
import com.damg.agreementsapiendpoints.agreementsapiendpoints.models.utils.Sexo;
import javax.persistence.*;
@Entity
@Table(name="users")
public class User extends BaseEntity {
private String sis_user_name;
private String sis_user_first_name;
private String sis_user_last_name;
private String sis_user_middle_name;
private String sis_user_email;
private String sis_user_dob;
private String sis_user_confidentiality_ind;
private Sexo sis_user_sex;
public User(String name , String first_name) {
setSis_user_name(name);
setSis_user_first_name(first_name);
setSis_user_last_name("");
setSis_user_middle_name("");
setSis_user_email("");
setSis_user_dob("");
setSis_user_confidentiality_ind("");
}
public User() {
}
public String getSis_user_name() {
return sis_user_name;
}
public String getSis_user_first_name() {
return sis_user_first_name;
}
public String getSis_user_last_name() {
return sis_user_last_name;
}
public String getSis_user_middle_name() {
return sis_user_middle_name;
}
public String getSis_user_email() {
return sis_user_email;
}
public String getSis_user_dob() {
return sis_user_dob;
}
public String getSis_user_confidentiality_ind() {
return sis_user_confidentiality_ind;
}
public Sexo getSis_user_sex() {
return sis_user_sex;
}
public void setSis_user_name(String sis_user_name) {
this.sis_user_name = sis_user_name;
}
public void setSis_user_first_name(String sis_user_first_name) {
this.sis_user_first_name = sis_user_first_name;
}
public void setSis_user_last_name(String sis_user_last_name) {
this.sis_user_last_name = sis_user_last_name;
}
public void setSis_user_middle_name(String sis_user_middle_name) {
this.sis_user_middle_name = sis_user_middle_name;
}
public void setSis_user_email(String sis_user_email) {
this.sis_user_email = sis_user_email;
}
public void setSis_user_dob(String sis_user_dob) {
this.sis_user_dob = sis_user_dob;
}
public void setSis_user_confidentiality_ind(String sis_user_confidentiality_ind) {
this.sis_user_confidentiality_ind = sis_user_confidentiality_ind;
}
public void setSis_user_sex(Sexo sis_user_sex) {
this.sis_user_sex = sis_user_sex;
}
}
| 2,565 | 0.649123 | 0.649123 | 98 | 25.17347 | 23.590048 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 2 |
810a5fa860d48937fc3afa560fac177530afc386 | 4,733,053,990,736 | 25f88faeabdcdd056c69d119a10e5834baf99259 | /src/main/java/voxswirl/meta/TrigTools.java | 8c89518cfc38488006504be29a13628c0b12a5bb | [
"Apache-2.0"
] | permissive | Eisenwave/vox-swirl | https://github.com/Eisenwave/vox-swirl | ecc6f13cddef5723a554ddbaabf11f39a8470ac1 | d15a761966b39a9acb9865ada5b631015ed0747c | refs/heads/master | 2022-11-27T23:49:21.835000 | 2020-08-08T06:10:13 | 2020-08-08T06:10:13 | 286,570,936 | 0 | 0 | null | true | 2020-08-10T20:20:32 | 2020-08-10T20:20:31 | 2020-08-08T06:10:22 | 2020-08-08T06:10:20 | 757 | 0 | 0 | 0 | null | false | false | package voxswirl.meta;
import com.badlogic.gdx.math.MathUtils;
/**
* Created by Tommy Ettinger on 8/4/2020.
*/
public class TrigTools {
public static float sin_(float turns){
return MathUtils.sinDeg(turns * 360);
}
public static float cos_(float turns){
return MathUtils.cosDeg(turns * 360);
}
public static float atan2_(final float y, final float x)
{
if(y == 0.0 && x >= 0.0) return 0f;
final float ax = Math.abs(x), ay = Math.abs(y);
if(ax < ay)
{
final float a = ax / ay, s = a * a,
r = 0.25f - (((-0.0464964749f * s + 0.15931422f) * s - 0.327622764f) * s * a + a) * 0.15915494309189535f;
return (x < 0.0f) ? (y < 0.0f) ? 0.5f + r : 0.5f - r : (y < 0.0f) ? 1f - r : r;
}
else {
final float a = ay / ax, s = a * a,
r = (((-0.0464964749f * s + 0.15931422f) * s - 0.327622764f) * s * a + a) * 0.15915494309189535f;
return (x < 0.0f) ? (y < 0.0f) ? 0.5f + r : 0.5f - r : (y < 0.0f) ? 1f - r : r;
}
}
}
| UTF-8 | Java | 954 | java | TrigTools.java | Java | [
{
"context": "om.badlogic.gdx.math.MathUtils;\n\n/**\n * Created by Tommy Ettinger on 8/4/2020.\n */\npublic class TrigTools {\n\tpublic",
"end": 97,
"score": 0.9998814463615417,
"start": 83,
"tag": "NAME",
"value": "Tommy Ettinger"
}
] | null | [] | package voxswirl.meta;
import com.badlogic.gdx.math.MathUtils;
/**
* Created by <NAME> on 8/4/2020.
*/
public class TrigTools {
public static float sin_(float turns){
return MathUtils.sinDeg(turns * 360);
}
public static float cos_(float turns){
return MathUtils.cosDeg(turns * 360);
}
public static float atan2_(final float y, final float x)
{
if(y == 0.0 && x >= 0.0) return 0f;
final float ax = Math.abs(x), ay = Math.abs(y);
if(ax < ay)
{
final float a = ax / ay, s = a * a,
r = 0.25f - (((-0.0464964749f * s + 0.15931422f) * s - 0.327622764f) * s * a + a) * 0.15915494309189535f;
return (x < 0.0f) ? (y < 0.0f) ? 0.5f + r : 0.5f - r : (y < 0.0f) ? 1f - r : r;
}
else {
final float a = ay / ax, s = a * a,
r = (((-0.0464964749f * s + 0.15931422f) * s - 0.327622764f) * s * a + a) * 0.15915494309189535f;
return (x < 0.0f) ? (y < 0.0f) ? 0.5f + r : 0.5f - r : (y < 0.0f) ? 1f - r : r;
}
}
}
| 946 | 0.561845 | 0.416143 | 32 | 28.8125 | 30.585369 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.96875 | false | false | 2 |
8c15cdea00b36ef49ff713a4ea5074c771067490 | 20,624,432,990,560 | 45a6968bc2ef4007d16faeb6f710bd61872c87a1 | /src/main/java/Vista/Botones/BotonJugar.java | 6cb54a773adfedc7e936a9223835e56b75227b6a | [] | no_license | Tp2Algo3/Tp2T10 | https://github.com/Tp2Algo3/Tp2T10 | 2f544bd17df1bd0e88623ced7a1e436ee712a194 | f67884312b9e3b48768bdb50ce970451d1dc5824 | refs/heads/master | 2022-12-01T21:15:05.535000 | 2020-08-16T22:07:07 | 2020-08-16T22:07:07 | 280,260,017 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Vista.Botones;
import Controladores.BotonJugarEventHandler;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import java.util.ArrayList;
public class BotonJugar extends Button {
public BotonJugar(ArrayList<TextField> nombresJugadores) {
super("Jugar");
setOnAction(new BotonJugarEventHandler(nombresJugadores));
setPrefSize(100,50);
setCursor(Cursor.HAND);
}
}
| UTF-8 | Java | 466 | java | BotonJugar.java | Java | [] | null | [] | package Vista.Botones;
import Controladores.BotonJugarEventHandler;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import java.util.ArrayList;
public class BotonJugar extends Button {
public BotonJugar(ArrayList<TextField> nombresJugadores) {
super("Jugar");
setOnAction(new BotonJugarEventHandler(nombresJugadores));
setPrefSize(100,50);
setCursor(Cursor.HAND);
}
}
| 466 | 0.751073 | 0.740343 | 17 | 26.411764 | 19.982519 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.647059 | false | false | 2 |
cadefb44dbc342dc03e85d562c00c253841e6693 | 30,210,799,994,265 | 0fdaf8171dc2dc4358ea8bcabc276d0928af5379 | /src/main/java/org/openmbee/mdk/systems_reasoner/actions/AspectSelectionAction.java | 90e82a2aed561510f1060868dba5bcc79d74bc51 | [
"Apache-2.0"
] | permissive | Open-MBEE/mdk-systems-reasoner | https://github.com/Open-MBEE/mdk-systems-reasoner | fccc595a1c573251c1dc36711420e66aaa0ddd17 | 6a97591a25023a3f87e1e820b0c7b7f6814d2dd1 | refs/heads/develop | 2023-08-15T23:51:41.834000 | 2023-08-14T22:37:55 | 2023-08-14T22:37:55 | 233,664,723 | 0 | 1 | Apache-2.0 | false | 2023-09-12T22:29:33 | 2020-01-13T18:28:19 | 2023-08-14T22:38:02 | 2023-09-12T22:29:32 | 859 | 0 | 1 | 6 | Java | false | false | package org.openmbee.mdk.systems_reasoner.actions;
import com.google.common.collect.Lists;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.magicdraw.openapi.uml.SessionManager;
import com.nomagic.magicdraw.ui.dialogs.MDDialogParentProvider;
import com.nomagic.magicdraw.ui.dialogs.SelectElementInfo;
import com.nomagic.magicdraw.ui.dialogs.SelectElementTypes;
import com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlg;
import com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory;
import com.nomagic.uml2.ext.jmi.helpers.ModelHelper;
import com.nomagic.uml2.ext.jmi.helpers.StereotypesHelper;
import com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.DirectedRelationship;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Package;
import com.nomagic.uml2.ext.magicdraw.mdprofiles.Stereotype;
import org.openmbee.mdk.api.incubating.convert.Converters;
import org.openmbee.mdk.systems_reasoner.api.SRConstants;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class AspectSelectionAction extends SRAction {
public static final String DEFAULT_ID = "Add & Realize Aspect(s)";
private final Classifier classifier;
public AspectSelectionAction(Classifier classifier) {
super(DEFAULT_ID);
this.classifier = classifier;
}
@Override
public void actionPerformed(ActionEvent e) {
Project project = Application.getInstance().getProject();
if (project == null) {
return;
}
Stereotype aspectStereotype = (Stereotype) Converters.getIdToElementConverter().apply(SRConstants.ASPECT_STEREOTYPE_ID, project);
if (aspectStereotype == null) {
Application.getInstance().getGUILog().log("[ERROR] Aspect stereotype not found. Please add SysML Extensions as a used project. Aborting aspect creation.");
return;
}
List<java.lang.Class<?>> types = Lists.newArrayList(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class);
Frame dialogParent = MDDialogParentProvider.getProvider().getDialogParent();
ElementSelectionDlg dlg = ElementSelectionDlgFactory.create(dialogParent);
SelectElementTypes set = new SelectElementTypes(types, types, null, null);
SelectElementInfo sei = new SelectElementInfo(true, false, project.getPrimaryModel(), true);
ElementSelectionDlgFactory.initMultiple(dlg, set, sei, Collections.emptyList());
dlg.show();
if (!dlg.isOkClicked()) {
return;
}
SessionManager.getInstance().createSession(project, "Creating aspect");
Set<Classifier> initialAspects = classifier.getClientDependency().stream().filter(dependency -> StereotypesHelper.hasStereotypeOrDerived(dependency, aspectStereotype))
.map(DirectedRelationship::getTarget).filter(targets -> targets.size() == 1).map(targets -> targets.iterator().next()).filter(target -> target instanceof Classifier).map(target -> (Classifier) target).collect(Collectors.toSet());
Set<Classifier> finalAspects = dlg.getSelectedElements().stream().filter(element -> element instanceof Classifier).map(element -> (Classifier) element).collect(Collectors.toSet());
Set<Classifier> addedAspects = new HashSet<>(finalAspects);
addedAspects.removeAll(initialAspects);
addedAspects.forEach(aspect -> {
createDependencyWithStereotype(classifier, aspect, aspectStereotype);
new AspectRemedyAction(classifier, aspect).run();
});
SessionManager.getInstance().closeSession(project);
}
private static void setOwnerPackage(Element child, Element parent) {
while (!(parent instanceof Package)) {
parent = parent.getOwner();
}
child.setOwner(parent);
}
private static void createDependencyWithStereotype(Element from, Element to, Stereotype s) {
Dependency d = Project.getProject(from).getElementsFactory().createDependencyInstance();
ModelHelper.setClientElement(d, from);
ModelHelper.setSupplierElement(d, to);
StereotypesHelper.addStereotype(d, s);
setOwnerPackage(d, from);
}
}
| UTF-8 | Java | 4,571 | java | AspectSelectionAction.java | Java | [] | null | [] | package org.openmbee.mdk.systems_reasoner.actions;
import com.google.common.collect.Lists;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.magicdraw.openapi.uml.SessionManager;
import com.nomagic.magicdraw.ui.dialogs.MDDialogParentProvider;
import com.nomagic.magicdraw.ui.dialogs.SelectElementInfo;
import com.nomagic.magicdraw.ui.dialogs.SelectElementTypes;
import com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlg;
import com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory;
import com.nomagic.uml2.ext.jmi.helpers.ModelHelper;
import com.nomagic.uml2.ext.jmi.helpers.StereotypesHelper;
import com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.DirectedRelationship;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Package;
import com.nomagic.uml2.ext.magicdraw.mdprofiles.Stereotype;
import org.openmbee.mdk.api.incubating.convert.Converters;
import org.openmbee.mdk.systems_reasoner.api.SRConstants;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class AspectSelectionAction extends SRAction {
public static final String DEFAULT_ID = "Add & Realize Aspect(s)";
private final Classifier classifier;
public AspectSelectionAction(Classifier classifier) {
super(DEFAULT_ID);
this.classifier = classifier;
}
@Override
public void actionPerformed(ActionEvent e) {
Project project = Application.getInstance().getProject();
if (project == null) {
return;
}
Stereotype aspectStereotype = (Stereotype) Converters.getIdToElementConverter().apply(SRConstants.ASPECT_STEREOTYPE_ID, project);
if (aspectStereotype == null) {
Application.getInstance().getGUILog().log("[ERROR] Aspect stereotype not found. Please add SysML Extensions as a used project. Aborting aspect creation.");
return;
}
List<java.lang.Class<?>> types = Lists.newArrayList(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class);
Frame dialogParent = MDDialogParentProvider.getProvider().getDialogParent();
ElementSelectionDlg dlg = ElementSelectionDlgFactory.create(dialogParent);
SelectElementTypes set = new SelectElementTypes(types, types, null, null);
SelectElementInfo sei = new SelectElementInfo(true, false, project.getPrimaryModel(), true);
ElementSelectionDlgFactory.initMultiple(dlg, set, sei, Collections.emptyList());
dlg.show();
if (!dlg.isOkClicked()) {
return;
}
SessionManager.getInstance().createSession(project, "Creating aspect");
Set<Classifier> initialAspects = classifier.getClientDependency().stream().filter(dependency -> StereotypesHelper.hasStereotypeOrDerived(dependency, aspectStereotype))
.map(DirectedRelationship::getTarget).filter(targets -> targets.size() == 1).map(targets -> targets.iterator().next()).filter(target -> target instanceof Classifier).map(target -> (Classifier) target).collect(Collectors.toSet());
Set<Classifier> finalAspects = dlg.getSelectedElements().stream().filter(element -> element instanceof Classifier).map(element -> (Classifier) element).collect(Collectors.toSet());
Set<Classifier> addedAspects = new HashSet<>(finalAspects);
addedAspects.removeAll(initialAspects);
addedAspects.forEach(aspect -> {
createDependencyWithStereotype(classifier, aspect, aspectStereotype);
new AspectRemedyAction(classifier, aspect).run();
});
SessionManager.getInstance().closeSession(project);
}
private static void setOwnerPackage(Element child, Element parent) {
while (!(parent instanceof Package)) {
parent = parent.getOwner();
}
child.setOwner(parent);
}
private static void createDependencyWithStereotype(Element from, Element to, Stereotype s) {
Dependency d = Project.getProject(from).getElementsFactory().createDependencyInstance();
ModelHelper.setClientElement(d, from);
ModelHelper.setSupplierElement(d, to);
StereotypesHelper.addStereotype(d, s);
setOwnerPackage(d, from);
}
}
| 4,571 | 0.739444 | 0.737257 | 93 | 48.150539 | 43.747551 | 245 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.88172 | false | false | 2 |
92057330d6beaef8d1240a9fb3193b821e26ceec | 30,210,799,993,198 | f20691c73297f4aa370d387ae11e14ef949fdae0 | /app/src/main/java/com/masker/discover/search/SearchContract.java | 70227ccd5b509612d7ca576f069fe94152bba986 | [
"Apache-2.0"
] | permissive | shiguangyin/Discover | https://github.com/shiguangyin/Discover | 4726b831cc33721dd85a698489849bc8b6bedc45 | efc12cf44506bfa0295955683841e48a76cb5f41 | refs/heads/master | 2021-01-20T01:14:37.862000 | 2017-09-06T02:46:52 | 2017-09-06T02:46:52 | 89,244,785 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.masker.discover.search;
import com.masker.discover.base.BaseLikeView;
/**
* CreatedBy: masker
* Date: 2017/6/9
* Description:
*/
public interface SearchContract {
interface View extends BaseLikeView{
void showList(Object obj, boolean refresh);
void showLoading();
void hideLoading();
}
interface Presenter{
void searchCollections(String key,int page,int perPage,boolean refresh);
void searchPhotos(String key,int page,int perPage,boolean refresh);
void searchUsers(String key,int page,int perPage,boolean refresh);
}
}
| UTF-8 | Java | 604 | java | SearchContract.java | Java | [
{
"context": "ker.discover.base.BaseLikeView;\n\n/**\n * CreatedBy: masker\n * Date: 2017/6/9\n * Description:\n */\n\npublic int",
"end": 108,
"score": 0.9995832443237305,
"start": 102,
"tag": "USERNAME",
"value": "masker"
}
] | null | [] | package com.masker.discover.search;
import com.masker.discover.base.BaseLikeView;
/**
* CreatedBy: masker
* Date: 2017/6/9
* Description:
*/
public interface SearchContract {
interface View extends BaseLikeView{
void showList(Object obj, boolean refresh);
void showLoading();
void hideLoading();
}
interface Presenter{
void searchCollections(String key,int page,int perPage,boolean refresh);
void searchPhotos(String key,int page,int perPage,boolean refresh);
void searchUsers(String key,int page,int perPage,boolean refresh);
}
}
| 604 | 0.69702 | 0.687086 | 24 | 24.166666 | 25.03442 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 2 |
608ea898226d843847f2e995ab8dc556a9aff5b6 | 30,210,799,992,307 | 6eba87bee316fef46e51bbcd1e1704598324d57d | /src/main/java/com/bubeau/apartmentserver/service/CategoriesServiceImpl.java | b3ab559cbf2d14e4c6fb7e3d833983b4ec7504be | [] | no_license | rakumarr/apartment | https://github.com/rakumarr/apartment | d1fcbe64abbcb75ae9cf895573dd666298dd5477 | 735a4c4e4a5bcb337d74b041747828be3152032b | refs/heads/master | 2020-05-07T01:03:20.863000 | 2019-05-05T11:07:09 | 2019-05-05T11:07:09 | 180,257,391 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bubeau.apartmentserver.service;
import java.util.Optional;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bubeau.apartmentserver.models.Categories;
import com.bubeau.apartmentserver.repository.CategoriesRepository;
@Service
public class CategoriesServiceImpl implements CategoriesService {
@Autowired
CategoriesRepository categoriesRepository;
@Override
public void add(ObjectId id, String category) {
// TODO Auto-generated method stub
Optional<Categories> categories = categoriesRepository.findAll().stream()
.filter(apt -> apt.getApartmentId().equals(id.toString())).findFirst();
if(categories.isPresent()) {
Categories categoryObj = categories.get();
if(!categoryObj.getCategory().contains(category)) {
categoryObj.getCategory().add(category);
categoriesRepository.save(categoryObj);
}
} else {
throw new RuntimeException("Apartment Category not configured");
}
}
}
| UTF-8 | Java | 1,034 | java | CategoriesServiceImpl.java | Java | [] | null | [] | package com.bubeau.apartmentserver.service;
import java.util.Optional;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bubeau.apartmentserver.models.Categories;
import com.bubeau.apartmentserver.repository.CategoriesRepository;
@Service
public class CategoriesServiceImpl implements CategoriesService {
@Autowired
CategoriesRepository categoriesRepository;
@Override
public void add(ObjectId id, String category) {
// TODO Auto-generated method stub
Optional<Categories> categories = categoriesRepository.findAll().stream()
.filter(apt -> apt.getApartmentId().equals(id.toString())).findFirst();
if(categories.isPresent()) {
Categories categoryObj = categories.get();
if(!categoryObj.getCategory().contains(category)) {
categoryObj.getCategory().add(category);
categoriesRepository.save(categoryObj);
}
} else {
throw new RuntimeException("Apartment Category not configured");
}
}
}
| 1,034 | 0.781431 | 0.781431 | 34 | 29.411764 | 25.752348 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.558824 | false | false | 2 |
718f64346162d12f821eec204208d06519b5b2ed | 30,769,145,757,889 | e25f5c978c8b51238ff57d913f187fd42cf6d5fc | /taotao-manager/taotao-manager-service/src/main/java/com/soul/service/impl/ItemCatServiceImpl.java | d2264a7e51f367c894b08a9d08ac2a98f63b384c | [] | no_license | guoyu07/taotao | https://github.com/guoyu07/taotao | 4691f95f8558e0a33213f62ff8e769226784df90 | 4990c25622586d60de9fe1ec9eeef7acdcee8c70 | refs/heads/master | 2021-05-04T21:35:28.978000 | 2017-11-25T03:34:47 | 2017-11-25T03:34:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.soul.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.soul.common.pojo.EUTreeNode;
import com.soul.mapper.TbItemCatMapper;
import com.soul.pojo.TbItemCat;
import com.soul.pojo.TbItemCatExample;
import com.soul.pojo.TbItemCatExample.Criteria;
import com.soul.service.ItemCatService;
@Service
@Transactional
public class ItemCatServiceImpl implements ItemCatService {
@Resource
private TbItemCatMapper itemCatMapper;
@Override
public List<EUTreeNode> getCatList(Long parentId) {
List<EUTreeNode> result = new ArrayList<>();
EUTreeNode euTreeNode;
TbItemCatExample example = new TbItemCatExample();
Criteria criteria = example.createCriteria();
criteria.andParentIdEqualTo((long) parentId);
List<TbItemCat> list = itemCatMapper.selectByExample(example);
for (TbItemCat tbItemCat : list) {
euTreeNode = new EUTreeNode();
euTreeNode.setId(tbItemCat.getId());
euTreeNode.setText(tbItemCat.getName());
euTreeNode.setState(tbItemCat.getIsParent()?"closed":"open");
result.add(euTreeNode);
}
return result;
}
}
| UTF-8 | Java | 1,290 | java | ItemCatServiceImpl.java | Java | [] | null | [] | package com.soul.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.soul.common.pojo.EUTreeNode;
import com.soul.mapper.TbItemCatMapper;
import com.soul.pojo.TbItemCat;
import com.soul.pojo.TbItemCatExample;
import com.soul.pojo.TbItemCatExample.Criteria;
import com.soul.service.ItemCatService;
@Service
@Transactional
public class ItemCatServiceImpl implements ItemCatService {
@Resource
private TbItemCatMapper itemCatMapper;
@Override
public List<EUTreeNode> getCatList(Long parentId) {
List<EUTreeNode> result = new ArrayList<>();
EUTreeNode euTreeNode;
TbItemCatExample example = new TbItemCatExample();
Criteria criteria = example.createCriteria();
criteria.andParentIdEqualTo((long) parentId);
List<TbItemCat> list = itemCatMapper.selectByExample(example);
for (TbItemCat tbItemCat : list) {
euTreeNode = new EUTreeNode();
euTreeNode.setId(tbItemCat.getId());
euTreeNode.setText(tbItemCat.getName());
euTreeNode.setState(tbItemCat.getIsParent()?"closed":"open");
result.add(euTreeNode);
}
return result;
}
}
| 1,290 | 0.752713 | 0.752713 | 46 | 26.043478 | 21.029955 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.521739 | false | false | 2 |
b78b83243105464b0c732b961cd7bff23c8d407c | 10,350,871,238,726 | 43ec3dc076e6ed0c7ec019d60011d0b01751b49d | /modulo-07 (Desenvolvimento com frameworks e componentes)/CursoFa7EJB/test/exercicio6/EmployeeServiceTest.java | d5af0d840b31129bc9cffe68a96ef6d9205d30e8 | [
"MIT"
] | permissive | clairtonluz/especializacao-em-arquitetura | https://github.com/clairtonluz/especializacao-em-arquitetura | 0d0989683f5d655ae0aa157cc91456187d72d12c | 8359d8c5f8663d0aeb6d4d1eb158182821b469ff | refs/heads/master | 2021-01-21T05:03:18.907000 | 2016-06-22T23:16:10 | 2016-06-22T23:16:10 | 41,456,809 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package exercicio6;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import javax.jms.JMSException;
import javax.naming.NamingException;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.xstream.XStream;
import br.gov.fa7.cursoejb.exercicio1.JNDIUtils;
import br.gov.fa7.cursoejb.exercicio6.async.EmployeeService;
public class EmployeeServiceTest {
private EmployeeService employeeService;
@Before
public void setup() throws NamingException {
employeeService = JNDIUtils.lookup(
"ejb:CursoFa7/CursoFa7EJB/EmployeeService!br.gov.fa7.cursoejb.exercicio6.async.EmployeeService");
}
@Test
public void testCarregarXml() throws ParseException, IOException {
List<Map<String, Object>> list = readFile();
employeeService.importItems(list);
}
@Test
public void testCarregarXmlJMS() throws ParseException, IOException, JMSException {
List<Map<String, Object>> list = readFile();
employeeService.queueImportItems(list);
}
private List<Map<String, Object>> readFile() {
return (List<Map<String, Object>>) new XStream().fromXML(new File("employee.xml"));
}
}
| UTF-8 | Java | 1,186 | java | EmployeeServiceTest.java | Java | [] | null | [] | package exercicio6;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import javax.jms.JMSException;
import javax.naming.NamingException;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.xstream.XStream;
import br.gov.fa7.cursoejb.exercicio1.JNDIUtils;
import br.gov.fa7.cursoejb.exercicio6.async.EmployeeService;
public class EmployeeServiceTest {
private EmployeeService employeeService;
@Before
public void setup() throws NamingException {
employeeService = JNDIUtils.lookup(
"ejb:CursoFa7/CursoFa7EJB/EmployeeService!br.gov.fa7.cursoejb.exercicio6.async.EmployeeService");
}
@Test
public void testCarregarXml() throws ParseException, IOException {
List<Map<String, Object>> list = readFile();
employeeService.importItems(list);
}
@Test
public void testCarregarXmlJMS() throws ParseException, IOException, JMSException {
List<Map<String, Object>> list = readFile();
employeeService.queueImportItems(list);
}
private List<Map<String, Object>> readFile() {
return (List<Map<String, Object>>) new XStream().fromXML(new File("employee.xml"));
}
}
| 1,186 | 0.77656 | 0.768971 | 46 | 24.782608 | 25.842258 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.195652 | false | false | 2 |
13cd8fcefb746900f0d1a676616aa314a2f3fad9 | 33,320,356,283,236 | d001f89426bc60668ecfb11383b78bffc0cdbbdc | /spring-aop/src/main/java/com/gjw/service/UserService.java | 7320c9217a6a5ee1b351f3325570c694b765f3e7 | [] | no_license | GJW459/JavaEEDemo | https://github.com/GJW459/JavaEEDemo | e1dad48ff34843387a854de4318ea053c8a65554 | 35f1603d9d3709e70a566f89fd182656b94120c2 | refs/heads/main | 2023-02-23T05:10:49.235000 | 2021-01-28T04:07:23 | 2021-01-28T04:07:23 | 333,641,307 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gjw.service;
import com.gjw.Annotaion.MetricTime;
import com.gjw.Entity.User;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class UserService {
@Resource
private User user;
public void insert(){
System.out.println("插入person1");
}
@MetricTime("register")
public User register(String email,String password,String name){
user.setEmail(email);
user.setName(name);
user.setPassword(password);
return user;
}
}
| UTF-8 | Java | 548 | java | UserService.java | Java | [
{
"context": " user.setName(name);\n user.setPassword(password);\n return user;\n }\n}\n",
"end": 512,
"score": 0.9902912974357605,
"start": 504,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package com.gjw.service;
import com.gjw.Annotaion.MetricTime;
import com.gjw.Entity.User;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class UserService {
@Resource
private User user;
public void insert(){
System.out.println("插入person1");
}
@MetricTime("register")
public User register(String email,String password,String name){
user.setEmail(email);
user.setName(name);
user.setPassword(<PASSWORD>);
return user;
}
}
| 550 | 0.683824 | 0.681985 | 28 | 18.428572 | 17.298697 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false | 2 |
b1c429176f4a81223efa401ad0174bc0113aeae0 | 10,634,339,027,915 | fb7013e8ea42d01745ba3dd830a522280d0c41d7 | /src/main/java/com/example/employee/service/EmpModelService.java | 5e20f76f822141a7dfd9167194539f4264eafeea | [] | no_license | AnjaliMohan-U/CRUD-Employee | https://github.com/AnjaliMohan-U/CRUD-Employee | 182e19a1ae4060ad4414d1c24d58ef6c153ccf76 | b3edbd9537e961d69a4a9398073952304c9ed684 | refs/heads/master | 2023-09-01T19:37:42.663000 | 2021-10-22T09:55:56 | 2021-10-22T09:55:56 | 418,869,524 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.employee.service;
import com.example.employee.employee.Employee;
import com.example.employee.hardcode.EmployeeInitService;
import com.example.employee.hardcode.EmployeeInitService;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class EmpModelService {
List<Employee> employees = new ArrayList<>();
EmployeeInitService initservice = new EmployeeInitService();
public List<Employee> getEmployeeList(){
return initservice.getAllEmployees();
}
public List<Employee> retrieveByCountry() {
return employees.stream().filter(emp-> emp.getLoc_id().startsWith("I")).collect(Collectors.toList());
}
}
//
//employees.stream().filter(emp -> emp.getLoc_id().startsWith("I")).forEach(emp -> {
// System.out
// .println("employee id: " + emp.getEmp_id() + " - " + " employee name: " + emp.getEmp_name() + "\n"); | UTF-8 | Java | 945 | java | EmpModelService.java | Java | [] | null | [] | package com.example.employee.service;
import com.example.employee.employee.Employee;
import com.example.employee.hardcode.EmployeeInitService;
import com.example.employee.hardcode.EmployeeInitService;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class EmpModelService {
List<Employee> employees = new ArrayList<>();
EmployeeInitService initservice = new EmployeeInitService();
public List<Employee> getEmployeeList(){
return initservice.getAllEmployees();
}
public List<Employee> retrieveByCountry() {
return employees.stream().filter(emp-> emp.getLoc_id().startsWith("I")).collect(Collectors.toList());
}
}
//
//employees.stream().filter(emp -> emp.getLoc_id().startsWith("I")).forEach(emp -> {
// System.out
// .println("employee id: " + emp.getEmp_id() + " - " + " employee name: " + emp.getEmp_name() + "\n"); | 945 | 0.711111 | 0.711111 | 27 | 34.037037 | 31.365801 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 2 |
ffefa587c4789638d2ac3813b10fd61134b48fec | 33,148,557,618,169 | 8ffc59fe6352018d4f2ccdcafddd47302c74d24c | /Downloads/jt/jt-web/src/main/java/com/jt/web/service/CartService.java | ef021374a882043e9aa6cb34afc31b5c6f0c718a | [] | no_license | chenzhedsy521/jt | https://github.com/chenzhedsy521/jt | a8b7b950ed2fb0954416b717d24ca8903e33b72a | d75121a3cf164a38de338f124ae3e5ae5452f331 | refs/heads/master | 2021-01-21T14:33:12.338000 | 2017-06-24T16:55:03 | 2017-06-24T16:55:03 | 95,299,463 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jt.web.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jt.common.service.HttpClientService;
import com.jt.web.pojo.Cart;
import com.jt.web.pojo.Item;
@Service
public class CartService{
@Autowired
private HttpClientService httpClientService;
private static final ObjectMapper MAPPER = new ObjectMapper();
//http://cart.jt.com/cart/query/{userId}
public List<Cart> show(Long userId) throws Exception{
String url = "http://cart.jt.com/cart/query/"+userId;
String jsonData = httpClientService.doGet(url, "utf-8");
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, Cart.class));
}
return (List<Cart>)obj;
}
//保存商品到购物车 http://cart.jt.com/cart/save
public void saveCart(Long userId, Long itemId, Integer num) throws Exception{
//1.调用后台系统,获取3个冗余字段
String url = "http://manage.jt.com/item/"+itemId;
String jsonItem = httpClientService.doGet(url, "utf-8");
Item item = MAPPER.readValue(jsonItem, Item.class);
//2.调用购物车系统接口,保存商品到购物车
url = "http://cart.jt.com/cart/save";
Map<String, String> params = new HashMap<String,String>();
params.put("userId", userId+"");
params.put("itemId", itemId+"");
params.put("num", num+"");
//从后台系统中获取数据,保存到对象中
params.put("itemTitle", item.getTitle());
try{
params.put("itemImage", item.getImage().split(",")[0]);
}catch(Exception e){
//todo: 写日志
}
params.put("itemPrice", item.getPrice()+"");
httpClientService.doPost(url, params, "utf-8");
}
//商品更新 http://cart.jt.com/cart/update/num/{userId}/{itemId}/{num}
public void updateNum(Long userId, Long itemId, Integer num) throws Exception{
String url = "http://cart.jt.com/cart/update/num/"+userId+"/"+itemId+"/"+num;
httpClientService.doGet(url, "utf-8");
}
//商品删除 http://cart.jt.com/cart/delete/{userId}/{itemId}
public void delete(Long userId, Long itemId) throws Exception{
String url = "http://cart.jt.com/cart/delete/"+userId+"/"+itemId;
httpClientService.doGet(url, "utf-8");
}
}
| UTF-8 | Java | 2,697 | java | CartService.java | Java | [] | null | [] | package com.jt.web.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jt.common.service.HttpClientService;
import com.jt.web.pojo.Cart;
import com.jt.web.pojo.Item;
@Service
public class CartService{
@Autowired
private HttpClientService httpClientService;
private static final ObjectMapper MAPPER = new ObjectMapper();
//http://cart.jt.com/cart/query/{userId}
public List<Cart> show(Long userId) throws Exception{
String url = "http://cart.jt.com/cart/query/"+userId;
String jsonData = httpClientService.doGet(url, "utf-8");
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, Cart.class));
}
return (List<Cart>)obj;
}
//保存商品到购物车 http://cart.jt.com/cart/save
public void saveCart(Long userId, Long itemId, Integer num) throws Exception{
//1.调用后台系统,获取3个冗余字段
String url = "http://manage.jt.com/item/"+itemId;
String jsonItem = httpClientService.doGet(url, "utf-8");
Item item = MAPPER.readValue(jsonItem, Item.class);
//2.调用购物车系统接口,保存商品到购物车
url = "http://cart.jt.com/cart/save";
Map<String, String> params = new HashMap<String,String>();
params.put("userId", userId+"");
params.put("itemId", itemId+"");
params.put("num", num+"");
//从后台系统中获取数据,保存到对象中
params.put("itemTitle", item.getTitle());
try{
params.put("itemImage", item.getImage().split(",")[0]);
}catch(Exception e){
//todo: 写日志
}
params.put("itemPrice", item.getPrice()+"");
httpClientService.doPost(url, params, "utf-8");
}
//商品更新 http://cart.jt.com/cart/update/num/{userId}/{itemId}/{num}
public void updateNum(Long userId, Long itemId, Integer num) throws Exception{
String url = "http://cart.jt.com/cart/update/num/"+userId+"/"+itemId+"/"+num;
httpClientService.doGet(url, "utf-8");
}
//商品删除 http://cart.jt.com/cart/delete/{userId}/{itemId}
public void delete(Long userId, Long itemId) throws Exception{
String url = "http://cart.jt.com/cart/delete/"+userId+"/"+itemId;
httpClientService.doGet(url, "utf-8");
}
}
| 2,697 | 0.673175 | 0.66927 | 75 | 32.146667 | 24.536608 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.88 | false | false | 2 |
0085e1b16cb0c4285e94ab7fa4800b3865e8dd76 | 1,022,202,240,687 | cbdd7d8ba5c84cf826b6886500bdc2ee5e78f66e | /安卓端代码/JsonUtil.java | 44283bce877a4a233ac51a23ad14274a20adbfdb | [] | no_license | enidia/car-recognization | https://github.com/enidia/car-recognization | ec3fd79dc3e072314e5c4841f7a75e58778b86ad | 6ca3fe6dac827250a8f619a7c0391f99236b1b4d | refs/heads/master | 2023-03-02T03:58:22.437000 | 2020-02-09T13:44:50 | 2020-02-09T13:44:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.lenovo.recognition;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
public class JsonUtil {
/**
* 地址
*/
private static final String INNER_URL = "http://10.33.1.120:8080/recognition/RegisterServlet";
/**
* TAG
*/
private final String TAG = getClass().getSimpleName();
private static final int USER_ID = 1;
/***
* 客户端调用的方法:传递参数向服务器中发送请求
*
* @param userId
* @param userName
* @return
*/
public static JSONObject getData(String userId, String userName) {
int modelId = USER_ID;
List<NameValuePair> list = new ArrayList<NameValuePair>();
list.add(new BasicNameValuePair("userId", userId));
list.add(new BasicNameValuePair("userName", userName));
return doPost(modelId, list);
}
/**
* * 请求服务器的方法
* *
* * @param model
* * @param paramList
* * @return
*
*/
private static JSONObject doPost(int model, List<NameValuePair> paramList) {
// 1.创建请求对象
HttpPost httpPost = new HttpPost(INNER_URL);
// post请求方式数据放在实体类中
HttpEntity entity = null;
try {
entity = new UrlEncodedFormEntity(paramList, HTTP.UTF_8);
httpPost.setEntity(entity);
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
// 2.创建客户端对象
HttpClient httpClient = new DefaultHttpClient();
// 3.客户端带着请求对象请求服务器端
try {
// 服务器端返回请求的数据
HttpResponse httpResponse = httpClient.execute(httpPost);
// 解析请求返回的数据
if (httpResponse != null
&& httpResponse.getStatusLine().getStatusCode() == 200) {
String element = EntityUtils.toString(httpResponse.getEntity(),
HTTP.UTF_8);
if (element.startsWith("{")) {
try {
return new JSONObject(element);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
| UTF-8 | Java | 3,147 | java | JsonUtil.java | Java | [
{
"context": " private static final String INNER_URL = \"http://10.33.1.120:8080/recognition/RegisterServlet\";\n /**\n *",
"end": 837,
"score": 0.9997654557228088,
"start": 826,
"tag": "IP_ADDRESS",
"value": "10.33.1.120"
},
{
"context": " *\n * @param userId\n... | null | [] | package com.example.lenovo.recognition;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
public class JsonUtil {
/**
* 地址
*/
private static final String INNER_URL = "http://10.33.1.120:8080/recognition/RegisterServlet";
/**
* TAG
*/
private final String TAG = getClass().getSimpleName();
private static final int USER_ID = 1;
/***
* 客户端调用的方法:传递参数向服务器中发送请求
*
* @param userId
* @param userName
* @return
*/
public static JSONObject getData(String userId, String userName) {
int modelId = USER_ID;
List<NameValuePair> list = new ArrayList<NameValuePair>();
list.add(new BasicNameValuePair("userId", userId));
list.add(new BasicNameValuePair("userName", userName));
return doPost(modelId, list);
}
/**
* * 请求服务器的方法
* *
* * @param model
* * @param paramList
* * @return
*
*/
private static JSONObject doPost(int model, List<NameValuePair> paramList) {
// 1.创建请求对象
HttpPost httpPost = new HttpPost(INNER_URL);
// post请求方式数据放在实体类中
HttpEntity entity = null;
try {
entity = new UrlEncodedFormEntity(paramList, HTTP.UTF_8);
httpPost.setEntity(entity);
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
// 2.创建客户端对象
HttpClient httpClient = new DefaultHttpClient();
// 3.客户端带着请求对象请求服务器端
try {
// 服务器端返回请求的数据
HttpResponse httpResponse = httpClient.execute(httpPost);
// 解析请求返回的数据
if (httpResponse != null
&& httpResponse.getStatusLine().getStatusCode() == 200) {
String element = EntityUtils.toString(httpResponse.getEntity(),
HTTP.UTF_8);
if (element.startsWith("{")) {
try {
return new JSONObject(element);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
| 3,147 | 0.608473 | 0.600615 | 99 | 28.565657 | 22.317345 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464646 | false | false | 2 |
6f0f74a86765d277d080309b32bd52f898a19632 | 1,022,202,242,727 | 63384e4bb86f59507caeb77c0be3737f3a3422ff | /assignment2/creditcard/src/main/java/no/hvl/dat250/jpa/creditcard/model/Person.java | 2d969d69fc37c5a429de3077e2d678cb939403e4 | [] | no_license | DanielBerge/dat250 | https://github.com/DanielBerge/dat250 | 77ca0da2e8e2881ea62411ba7c8f276318dda4a0 | a5329c65f20dda19f1847552c7ab07720e9f2db5 | refs/heads/master | 2022-12-18T20:09:04.134000 | 2020-09-28T12:51:54 | 2020-09-28T12:51:54 | 288,129,099 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package no.hvl.dat250.jpa.creditcard.model;
import lombok.Data;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Data
public class Person {
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Id
private String id;
@OneToMany(mappedBy = "people")
private final List<CreditCard> creditCards = new ArrayList<>();
@ManyToMany(mappedBy = "personList")
private final List<Address> addresses = new ArrayList<>();
}
| UTF-8 | Java | 481 | java | Person.java | Java | [] | null | [] | package no.hvl.dat250.jpa.creditcard.model;
import lombok.Data;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Data
public class Person {
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Id
private String id;
@OneToMany(mappedBy = "people")
private final List<CreditCard> creditCards = new ArrayList<>();
@ManyToMany(mappedBy = "personList")
private final List<Address> addresses = new ArrayList<>();
}
| 481 | 0.721414 | 0.715177 | 21 | 21.904762 | 21.053005 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.380952 | false | false | 2 |
0b0a3d2645dfc88c28b467dde5366aa0dcee5a00 | 28,492,813,089,191 | 892f60ccf4ca8f43a30f6fdd2f89d58b9e21ac41 | /Exercicios/MediaFinal.java | ceaea0c1ee8a80812650c0eddad1ad8f6893128a | [] | no_license | Debora2019/CourseFullStack | https://github.com/Debora2019/CourseFullStack | 7105f277cfac499e1b9465f4f37321664680d570 | 10d5044b5da11df22934b6ecf6ffdcf948bfbb15 | refs/heads/main | 2023-08-17T21:50:35.293000 | 2021-06-30T15:50:12 | 2021-06-30T15:50:12 | 368,827,430 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class MediaFinal {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Digite a 1ª nota: ");
Float n1 = input.nextFloat();
System.out.println("Digite a 2ª nota: ");
Float n2 = input.nextFloat();
System.out.println("Digite a 3ª nota: ");
Float n3 = input.nextFloat();
Float media = (n1 + n2 +n3)/3;
System.out.println("A média final é " + media);
if(media >= 16){
if (media >= 18){
System.out.println("Aprovado!");
}else{
System.out.println("Recuperação!");
} //fim do 2º if
}else {
System.out.println("Reprovado");
}
} //fim do 1º if
}
| UTF-8 | Java | 919 | java | MediaFinal.java | Java | [] | null | [] | import java.util.Scanner;
public class MediaFinal {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Digite a 1ª nota: ");
Float n1 = input.nextFloat();
System.out.println("Digite a 2ª nota: ");
Float n2 = input.nextFloat();
System.out.println("Digite a 3ª nota: ");
Float n3 = input.nextFloat();
Float media = (n1 + n2 +n3)/3;
System.out.println("A média final é " + media);
if(media >= 16){
if (media >= 18){
System.out.println("Aprovado!");
}else{
System.out.println("Recuperação!");
} //fim do 2º if
}else {
System.out.println("Reprovado");
}
} //fim do 1º if
}
| 919 | 0.463736 | 0.446154 | 34 | 25.705883 | 20.29855 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false | 2 |
0d8bc9453c962e885bf6112bd2125dd0f78b31cd | 6,682,969,149,637 | 9817eeed33fc7cf6add88123f6d19a157671b55f | /src/main/java/com/rentcar/repository/DiscountRepository.java | 4668d03478d1bf287a1ead0187b54ba2bdb6ec25 | [] | no_license | Dzmitry20/RentCarProject | https://github.com/Dzmitry20/RentCarProject | 58f21efb5226d1a22702c3dc7837cdc52af42313 | cbbfcf031e2b6e95951b3d20564e6440e230fba6 | refs/heads/main | 2023-08-30T08:49:05.993000 | 2021-11-11T16:54:20 | 2021-11-11T16:54:20 | 420,085,629 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rentcar.repository;
import com.rentcar.domain.Discount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DiscountRepository extends JpaRepository<Discount, Long> {
}
| UTF-8 | Java | 273 | java | DiscountRepository.java | Java | [] | null | [] | package com.rentcar.repository;
import com.rentcar.domain.Discount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DiscountRepository extends JpaRepository<Discount, Long> {
}
| 273 | 0.842491 | 0.842491 | 10 | 26.299999 | 26.717222 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
aeec0b0f2a29d33bf93e42850823629b08ac5e5f | 6,682,969,152,650 | e21c920953777f17922c12cd6410b7364ace4fba | /Java/src/arrays2d/SpiralPrint.java | 93e04a1287fcbe60934afe26a279ef7540094644 | [] | no_license | mudit999/Java-Foundation-DS | https://github.com/mudit999/Java-Foundation-DS | 5e2fba969d747394d373560957bb73d7ddc3fd96 | b92317dcddb8da2d6ab3fb65ab01ee752c8d2a97 | refs/heads/master | 2023-02-09T10:24:56.357000 | 2020-12-28T08:13:30 | 2020-12-28T08:13:30 | 324,938,219 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package arrays2d;
public class SpiralPrint {
public static void main(String args[]){
int[][] arr = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
// if (arr.length == 0) {
// return;
// }
int rows = arr.length;
int cols = arr[0].length;
int rs = 0;
int re = arr.length - 1;
int cs = 0;
int ce = arr[0].length - 1;
int count = 0;
while(count < rows*cols) {
for(int i = cs;i<=ce; i++) {
System.out.print(arr[rs][i] + " ");
count++;
}
rs++;
for(int i = rs;i<=re;i++) {
System.out.print(arr[i][ce] + " ");
count++;
}
ce--;
for(int i = ce;i>=cs; i--) {
System.out.print(arr[re][i] + " ");
count++;
}
re--;
for(int i = re;i>=rs; i--) {
System.out.print(arr[i][cs] + " ");
count++;
}
cs++;
}
}
} | UTF-8 | Java | 918 | java | SpiralPrint.java | Java | [] | null | [] | package arrays2d;
public class SpiralPrint {
public static void main(String args[]){
int[][] arr = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
// if (arr.length == 0) {
// return;
// }
int rows = arr.length;
int cols = arr[0].length;
int rs = 0;
int re = arr.length - 1;
int cs = 0;
int ce = arr[0].length - 1;
int count = 0;
while(count < rows*cols) {
for(int i = cs;i<=ce; i++) {
System.out.print(arr[rs][i] + " ");
count++;
}
rs++;
for(int i = rs;i<=re;i++) {
System.out.print(arr[i][ce] + " ");
count++;
}
ce--;
for(int i = ce;i>=cs; i--) {
System.out.print(arr[re][i] + " ");
count++;
}
re--;
for(int i = re;i>=rs; i--) {
System.out.print(arr[i][cs] + " ");
count++;
}
cs++;
}
}
} | 918 | 0.410675 | 0.375817 | 51 | 16.039215 | 14.569591 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.058824 | false | false | 2 |
1c6806f9e88a899c4efb7e6f9926f70212e7a3d7 | 19,456,201,899,625 | a9509aebcbb0ab76ef10c4420f691877260785fe | /src/Damas/Muta.java | a4654b59aa2ed5ebc1a888e4086bcd431b828831 | [] | no_license | FernandoPerea/Geneticos | https://github.com/FernandoPerea/Geneticos | f5ce8832803550c4bd550c249d8e815bdcf36ad0 | 808701e8aa788470e59770a68c41656b51d9cdf7 | refs/heads/master | 2023-05-17T19:45:34.675000 | 2021-06-15T19:20:42 | 2021-06-15T19:20:42 | 346,538,277 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Damas;
import java.util.Random;
/**
*
* @author Dell
*/
public class Muta {
public static void aplicarMutaAleatoria(Individuo p){
Random ran = new Random();
int pos = ran.nextInt(p.getGenotipo().length);
p.getGenotipo()[pos]= ran.nextInt(p.getGenotipo().length);;
p.calcularFit();
}
}
| UTF-8 | Java | 539 | java | Muta.java | Java | [
{
"context": "amas;\n\nimport java.util.Random;\n\n/**\n *\n * @author Dell\n */\npublic class Muta {\n public static void ap",
"end": 249,
"score": 0.9992417097091675,
"start": 245,
"tag": "NAME",
"value": "Dell"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Damas;
import java.util.Random;
/**
*
* @author Dell
*/
public class Muta {
public static void aplicarMutaAleatoria(Individuo p){
Random ran = new Random();
int pos = ran.nextInt(p.getGenotipo().length);
p.getGenotipo()[pos]= ran.nextInt(p.getGenotipo().length);;
p.calcularFit();
}
}
| 539 | 0.643785 | 0.643785 | 25 | 20.559999 | 24.488495 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 2 |
332587bd88831b97bff9ab66cbc43ad1438ad2bd | 1,056,561,971,702 | 14381be2c10d195113c4c2ce2901d2779f30e3b1 | /LearningJava.java | 98bfac426955ad1b702d4fc66f1952fc47459f6e | [] | no_license | sukanyajun92/Java-Codes | https://github.com/sukanyajun92/Java-Codes | 763b3a46aabf090e0b427662bfae23b5f1cb710e | 6f79145d9562057aaef8d0271aa6a9dff608521d | refs/heads/master | 2020-05-17T14:48:15.524000 | 2015-05-08T23:20:21 | 2015-05-08T23:20:21 | 35,306,150 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class LearningJava
{
static int x = 10;
public static void main(String[] args)
{
// TODO Auto-generated method stub
int a[] = { 1,2,3,4};
System.out.println(a instanceof Object);
int array[] = { 1,2,053,4};
int b[][] = { {1,2,4} , {2,2,1},{0,43,2}};
System.out.println(array[3]==b[0][2] );
System.out.print(" " + (array[2]==b[2][1]));
for (int x = 0; x < 5; x++)
{
//System.out.println("\n%%%%%" + x);
}
System.out.println("$$$$ " + x);
System.out.println("\n************************************");
Person p1 = new Person("John" , 10);
LearningJava java = new LearningJava();
Person p2 = java.change(p1);
System.out.println("Person p2 " + p2.name + "$$$" + p2.age);
System.out.println("Person p1 " + p1.name + "%%%" + p1.age);
System.out.println("-----------------------------------------");
String s = "Java";
String str = s.concat("JE 6");
System.out.println(s.concat("JE 6"));
System.out.println(str.replace('6' , '7'));
System.out.println("string = " + s);
}
private Person change(Object o)
{
Person p2 = (Person) o;
p2.age = 25;
return p2;
}
}
class Person
{
Person(String s, int i)
{
++pid;
name = s;
age = i;
}
static int pid;
String name;
int age;
}
| UTF-8 | Java | 1,280 | java | LearningJava.java | Java | [
{
"context": "********************\");\n\t\tPerson p1 = new Person(\"John\" , 10);\n\t\t\n\t\tLearningJava java = new LearningJava",
"end": 583,
"score": 0.9982019662857056,
"start": 579,
"tag": "NAME",
"value": "John"
}
] | null | [] |
public class LearningJava
{
static int x = 10;
public static void main(String[] args)
{
// TODO Auto-generated method stub
int a[] = { 1,2,3,4};
System.out.println(a instanceof Object);
int array[] = { 1,2,053,4};
int b[][] = { {1,2,4} , {2,2,1},{0,43,2}};
System.out.println(array[3]==b[0][2] );
System.out.print(" " + (array[2]==b[2][1]));
for (int x = 0; x < 5; x++)
{
//System.out.println("\n%%%%%" + x);
}
System.out.println("$$$$ " + x);
System.out.println("\n************************************");
Person p1 = new Person("John" , 10);
LearningJava java = new LearningJava();
Person p2 = java.change(p1);
System.out.println("Person p2 " + p2.name + "$$$" + p2.age);
System.out.println("Person p1 " + p1.name + "%%%" + p1.age);
System.out.println("-----------------------------------------");
String s = "Java";
String str = s.concat("JE 6");
System.out.println(s.concat("JE 6"));
System.out.println(str.replace('6' , '7'));
System.out.println("string = " + s);
}
private Person change(Object o)
{
Person p2 = (Person) o;
p2.age = 25;
return p2;
}
}
class Person
{
Person(String s, int i)
{
++pid;
name = s;
age = i;
}
static int pid;
String name;
int age;
}
| 1,280 | 0.517969 | 0.478906 | 63 | 19.301588 | 19.046005 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.333333 | false | false | 2 |
f2d49c5e1952e16a1a70a7c5a083f78b3a738023 | 33,603,824,171,222 | 9e8b655f236db487816694d4d037295c24d84d04 | /src/test/java/com/glosys/lms/dao/InplantTrainingTypeDaoTest.java | 76640c8267372c276a597c042635f4f8c9e411df | [] | no_license | radhadevi11/LmsApp | https://github.com/radhadevi11/LmsApp | 22f09b4e722fdfed872db5ee24659957409edf01 | cde0d96d8d9664bbd3fd8524407d0e0e5a80586c | refs/heads/master | 2022-02-24T14:02:55.474000 | 2019-10-26T14:07:53 | 2019-10-26T14:07:53 | 192,209,824 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.glosys.lms.dao;
import com.glosys.lms.entity.InplantTraining;
import com.glosys.lms.entity.InplantTrainingType;
import org.dbunit.JdbcDatabaseTester;
import org.dbunit.dataset.IDataSet;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import javax.persistence.EntityManager;
import java.io.FileNotFoundException;
import java.sql.SQLException;
import static org.junit.Assert.*;
public class InplantTrainingTypeDaoTest extends AbstractDaoTest {
protected static EntityManager em ;
@BeforeClass
public static void init() throws FileNotFoundException, SQLException {
em = emf.createEntityManager();
}
@Before
public void setUp() throws Exception {
JdbcDatabaseTester databaseTester = new JdbcDatabaseTester("org.h2.Driver", "jdbc:h2:mem:test");
String[] tables = {"inplantTrainingType"};
IDataSet dataSet = databaseTester.getConnection().createDataSet(tables);
databaseTester.setDataSet(dataSet);
databaseTester.onSetup();
}
@After
public void after(){
em.clear();
}
@Test
public void testSave(){
InplantTrainingTypeDao inplantTrainingTypeDao = new InplantTrainingTypeDao(em);
InplantTrainingType actual = inplantTrainingTypeDao.save(new InplantTrainingType
("class room", 25, 20, 20, 20, "overview", 0));
assertEquals("class room", actual.getModeOfTraining());
}
} | UTF-8 | Java | 1,485 | java | InplantTrainingTypeDaoTest.java | Java | [] | null | [] | package com.glosys.lms.dao;
import com.glosys.lms.entity.InplantTraining;
import com.glosys.lms.entity.InplantTrainingType;
import org.dbunit.JdbcDatabaseTester;
import org.dbunit.dataset.IDataSet;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import javax.persistence.EntityManager;
import java.io.FileNotFoundException;
import java.sql.SQLException;
import static org.junit.Assert.*;
public class InplantTrainingTypeDaoTest extends AbstractDaoTest {
protected static EntityManager em ;
@BeforeClass
public static void init() throws FileNotFoundException, SQLException {
em = emf.createEntityManager();
}
@Before
public void setUp() throws Exception {
JdbcDatabaseTester databaseTester = new JdbcDatabaseTester("org.h2.Driver", "jdbc:h2:mem:test");
String[] tables = {"inplantTrainingType"};
IDataSet dataSet = databaseTester.getConnection().createDataSet(tables);
databaseTester.setDataSet(dataSet);
databaseTester.onSetup();
}
@After
public void after(){
em.clear();
}
@Test
public void testSave(){
InplantTrainingTypeDao inplantTrainingTypeDao = new InplantTrainingTypeDao(em);
InplantTrainingType actual = inplantTrainingTypeDao.save(new InplantTrainingType
("class room", 25, 20, 20, 20, "overview", 0));
assertEquals("class room", actual.getModeOfTraining());
}
} | 1,485 | 0.721212 | 0.713805 | 49 | 29.32653 | 26.984037 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673469 | false | false | 2 |
054ece554c846b7b7d998d7669d82c2922f20c3b | 23,502,061,092,259 | 234d3f557d2b50b85c406b3fc61ad5e30625e5b2 | /src/main/java/com/tupa/app/data/service/BankServiceImpl.java | 8a810ec4a9a4b31d441692c027b786ad8256ebf0 | [] | no_license | Rajeshkankran/SpringSecurityJPA | https://github.com/Rajeshkankran/SpringSecurityJPA | 41b3c85aaf46d4a24a55efe71f29598fb470c622 | ba0801079d55f60fd12374a4c78c990a0c817570 | refs/heads/master | 2020-06-04T15:43:40.991000 | 2015-08-17T08:20:10 | 2015-08-17T08:20:10 | 40,111,049 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tupa.app.data.service;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.tupa.app.data.model.Bank;
import com.tupa.app.data.repository.BankRepository;
@Service
public class BankServiceImpl implements BankService {
@Resource
BankRepository bankRepo;
@Override
public Bank createBank(Bank bank) {
return bankRepo.save(bank);
}
}
| UTF-8 | Java | 395 | java | BankServiceImpl.java | Java | [] | null | [] | package com.tupa.app.data.service;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.tupa.app.data.model.Bank;
import com.tupa.app.data.repository.BankRepository;
@Service
public class BankServiceImpl implements BankService {
@Resource
BankRepository bankRepo;
@Override
public Bank createBank(Bank bank) {
return bankRepo.save(bank);
}
}
| 395 | 0.792405 | 0.792405 | 20 | 18.75 | 18.798603 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 2 |
123e2068ed3c27ebcc029002ea39a190e034f5d8 | 9,302,899,211,835 | 9958af291a59a57ee6db4ed5f320e0276d24cbea | /app/src/main/java/com/viettel/bss/viettelpos/v4/customer/activity/FragmentCustomerNew.java | 72452ed8a14c56f6882684dc9fc9bf616c95849c | [] | no_license | mincasoft/mBCCS_VTT_real_22022016 | https://github.com/mincasoft/mBCCS_VTT_real_22022016 | 32ace9ec32b0476959726f91bbb1853b56c78631 | 0434b4bf83d021f58ec557552ac0fb913a88db96 | refs/heads/master | 2020-05-16T12:51:00.358000 | 2018-01-02T07:49:09 | 2018-01-02T07:49:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.viettel.bss.viettelpos.v4.customer.activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import com.viettel.bss.viettelpos.v4.R;
import com.viettel.bss.viettelpos.v4.activity.FragmentCommon;
import com.viettel.bss.viettelpos.v4.commons.ReplaceFragment;
import com.viettel.bss.viettelpos.v4.customer.object.CustomerLoaiGiaytoOJ;
import java.util.ArrayList;
public class FragmentCustomerNew extends FragmentCommon {
private Spinner spinnerLoaigt;
private EditText editSogt;
private EditText editSotb;
private Button btnCheck;
private final ArrayList<CustomerLoaiGiaytoOJ> arrCustomerLoaiGiaytoOJs = new ArrayList<>();
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setTitleActionBar(act.getString(R.string.customers) + " - "
+ act.getString(R.string.customer_new));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
idLayout = R.layout.layout_customer_new;
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void unit(View v) {
spinnerLoaigt = (Spinner) v.findViewById(R.id.spinner_loaigt);
editSogt = (EditText) v.findViewById(R.id.edit_sogt);
editSotb = (EditText) v.findViewById(R.id.edit_sothuebao);
btnCheck = (Button) v.findViewById(R.id.btn_check);
btnCheck.setOnClickListener(this);
setData4Views();
}
private void setData4Views() {
// arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ(""));
arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ("giay to 1"));
arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ("giay to 2"));
arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ("giay to 3"));
ArrayAdapter<String> adapterLoaigt = new ArrayAdapter<>(act,
android.R.layout.simple_dropdown_item_1line, android.R.id.text1);
adapterLoaigt.add(act.getString(R.string.select_loaigiayto));
for (CustomerLoaiGiaytoOJ obj : arrCustomerLoaiGiaytoOJs) {
adapterLoaigt.add(obj.getName());
}
spinnerLoaigt.setAdapter(adapterLoaigt);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
super.onClick(arg0);
switch (arg0.getId()) {
case R.id.btn_check :
// toast("search");
ReplaceFragment.replaceFragment(act,
new FragmentCustomerRegister(), true);
break;
default :
break;
}
}
@Override
public void setPermission() {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 2,727 | java | FragmentCustomerNew.java | Java | [] | null | [] | package com.viettel.bss.viettelpos.v4.customer.activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import com.viettel.bss.viettelpos.v4.R;
import com.viettel.bss.viettelpos.v4.activity.FragmentCommon;
import com.viettel.bss.viettelpos.v4.commons.ReplaceFragment;
import com.viettel.bss.viettelpos.v4.customer.object.CustomerLoaiGiaytoOJ;
import java.util.ArrayList;
public class FragmentCustomerNew extends FragmentCommon {
private Spinner spinnerLoaigt;
private EditText editSogt;
private EditText editSotb;
private Button btnCheck;
private final ArrayList<CustomerLoaiGiaytoOJ> arrCustomerLoaiGiaytoOJs = new ArrayList<>();
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setTitleActionBar(act.getString(R.string.customers) + " - "
+ act.getString(R.string.customer_new));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
idLayout = R.layout.layout_customer_new;
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void unit(View v) {
spinnerLoaigt = (Spinner) v.findViewById(R.id.spinner_loaigt);
editSogt = (EditText) v.findViewById(R.id.edit_sogt);
editSotb = (EditText) v.findViewById(R.id.edit_sothuebao);
btnCheck = (Button) v.findViewById(R.id.btn_check);
btnCheck.setOnClickListener(this);
setData4Views();
}
private void setData4Views() {
// arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ(""));
arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ("giay to 1"));
arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ("giay to 2"));
arrCustomerLoaiGiaytoOJs.add(new CustomerLoaiGiaytoOJ("giay to 3"));
ArrayAdapter<String> adapterLoaigt = new ArrayAdapter<>(act,
android.R.layout.simple_dropdown_item_1line, android.R.id.text1);
adapterLoaigt.add(act.getString(R.string.select_loaigiayto));
for (CustomerLoaiGiaytoOJ obj : arrCustomerLoaiGiaytoOJs) {
adapterLoaigt.add(obj.getName());
}
spinnerLoaigt.setAdapter(adapterLoaigt);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
super.onClick(arg0);
switch (arg0.getId()) {
case R.id.btn_check :
// toast("search");
ReplaceFragment.replaceFragment(act,
new FragmentCustomerRegister(), true);
break;
default :
break;
}
}
@Override
public void setPermission() {
// TODO Auto-generated method stub
}
}
| 2,727 | 0.758709 | 0.753209 | 87 | 30.344828 | 24.956434 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.758621 | false | false | 2 |
80458916d5fcf2b54a5af1870ce4bed19e4cbfdc | 6,167,573,086,742 | c0e8bf7647653e2063102319e00047f32bbaa142 | /PortalCEPPF/src/main/java/br/com/ceppf/model/entity/User.java | 13bfd9cb57cfcebbd2d9ab94a559677b2c4e9ec7 | [] | no_license | furvao/PortalCEPPF | https://github.com/furvao/PortalCEPPF | 7206a901e8b12033bb2648ae24d587c587143c5d | 225b7987018593d5e3a5871641358e9e1265785e | refs/heads/master | 2021-01-20T05:33:51.695000 | 2017-06-03T14:06:12 | 2017-06-03T14:06:12 | 89,791,502 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.ceppf.model.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "user")
public class User {
@Id
@Column(name = "usu_id")
private Long id;
@Column(name = "usu_name")
private String name;
@Column(name = "usu_login")
private String login;
@Column(name = "usu_password")
private String password;
@Column(name = "usu_phone")
private String phone;
@Column(name = "usu_celphone")
private String celphone;
@Column(name = "usu_teacher")
private boolean teacher;
// private Team team;
public User() {
super();
}
public User(Long id, String name, String login, String password, String phone, String celphone, boolean teacher) {
super();
this.id = id;
this.name = name;
this.login = login;
this.password = password;
this.phone = phone;
this.celphone = celphone;
this.teacher = teacher;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCelphone() {
return celphone;
}
public void setCelphone(String celphone) {
this.celphone = celphone;
}
public boolean isTeacher() {
return teacher;
}
public void setTeacher(boolean teacher) {
this.teacher = teacher;
}
// public Team getTeam() {
// return team;
// }
//
// public void setTeam(Team team) {
// this.team = team;
// }
}
| UTF-8 | Java | 1,906 | java | User.java | Java | [
{
"context": "me = name;\n\t\tthis.login = login;\n\t\tthis.password = password;\n\t\tthis.phone = phone;\n\t\tthis.celphone = celphone",
"end": 901,
"score": 0.9990431666374207,
"start": 893,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "d setPassword(String password) {\n\... | null | [] | package br.com.ceppf.model.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "user")
public class User {
@Id
@Column(name = "usu_id")
private Long id;
@Column(name = "usu_name")
private String name;
@Column(name = "usu_login")
private String login;
@Column(name = "usu_password")
private String password;
@Column(name = "usu_phone")
private String phone;
@Column(name = "usu_celphone")
private String celphone;
@Column(name = "usu_teacher")
private boolean teacher;
// private Team team;
public User() {
super();
}
public User(Long id, String name, String login, String password, String phone, String celphone, boolean teacher) {
super();
this.id = id;
this.name = name;
this.login = login;
this.password = <PASSWORD>;
this.phone = phone;
this.celphone = celphone;
this.teacher = teacher;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = <PASSWORD>;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCelphone() {
return celphone;
}
public void setCelphone(String celphone) {
this.celphone = celphone;
}
public boolean isTeacher() {
return teacher;
}
public void setTeacher(boolean teacher) {
this.teacher = teacher;
}
// public Team getTeam() {
// return team;
// }
//
// public void setTeam(Team team) {
// this.team = team;
// }
}
| 1,910 | 0.679958 | 0.679958 | 116 | 15.431034 | 16.076982 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.267241 | false | false | 2 |
1111da7b742a21c5db655bbfa6b89b2e9ec46566 | 21,620,865,373,747 | 733ff97043dc7057d1e507e5a12f0ce293bc3d4b | /Tema9/Tema9/src/t9ej03/Gato.java | 305fc95e0dfba0ae3d581c6cfe02ece7350baa07 | [] | no_license | alejndr/EjerciciosProgramacionDaw | https://github.com/alejndr/EjerciciosProgramacionDaw | e78e4126e1e93449bce62e83141ec50f2b8a46d9 | c5943dad037ac6dc738d11a7799f9e9504551b0d | refs/heads/master | 2021-09-07T08:35:00.534000 | 2018-02-20T11:07:00 | 2018-02-20T11:07:00 | 105,865,674 | 1 | 1 | null | false | 2017-10-10T06:43:34 | 2017-10-05T08:22:02 | 2017-10-10T06:28:45 | 2017-10-10T06:43:34 | 66 | 1 | 1 | 0 | Java | null | null | package t9ej03;
/**
*
* @author alejandro
*/
public class Gato extends Mamifero {
public Gato(String nombre, String sexo) {
super(nombre, sexo);
}
public String getNombre() {
return nombre;
}
public String getSexo() {
return sexo;
}
public void maulla(){
System.out.println(this.nombre+" dice: Miau");
}
public void araña(){
System.out.println(this.nombre+" rasca el sofa.");
}
}
| UTF-8 | Java | 437 | java | Gato.java | Java | [
{
"context": "package t9ej03;\n\n/**\n *\n * @author alejandro\n */\npublic class Gato extends Mamifero {\n\n publi",
"end": 44,
"score": 0.9888518452644348,
"start": 35,
"tag": "USERNAME",
"value": "alejandro"
}
] | null | [] | package t9ej03;
/**
*
* @author alejandro
*/
public class Gato extends Mamifero {
public Gato(String nombre, String sexo) {
super(nombre, sexo);
}
public String getNombre() {
return nombre;
}
public String getSexo() {
return sexo;
}
public void maulla(){
System.out.println(this.nombre+" dice: Miau");
}
public void araña(){
System.out.println(this.nombre+" rasca el sofa.");
}
}
| 437 | 0.616973 | 0.610092 | 29 | 14.034483 | 15.858171 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.275862 | false | false | 2 |
bd5386935236447b505db85d29ee79be26fa4e78 | 12,592,844,139,509 | dbaca7a03dcf16d671d762173088d037dc9f56d8 | /Schemas/src/za/co/bayport/schema/PerformanceReportRequest.java | be4a838ff7973690bc388e28c99fdda8f000553f | [] | no_license | Jannievzyl/TestGit | https://github.com/Jannievzyl/TestGit | 6271efbf4783685660b3d6f0ff1ec82c3da0452b | d5c63fdcc1b17585a5cb9a1d16fdf0858795629f | refs/heads/master | 2018-01-08T04:12:13.196000 | 2016-01-19T09:30:39 | 2016-01-19T09:30:39 | 49,943,401 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.10.09 at 03:30:51 PM CAT
//
package za.co.bayport.schema;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* Performance report request
*
* <p>Java class for PerformanceReportRequest complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PerformanceReportRequest">
* <complexContent>
* <extension base="{}BaseServiceRequest">
* <sequence>
* <element name="level" type="{}ESource"/>
* <element name="agentCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="branchCode" type="{http://www.w3.org/2001/XMLSchema}long"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PerformanceReportRequest", propOrder = {
"level",
"agentCode",
"branchCode"
})
public class PerformanceReportRequest
extends BaseServiceRequest
{
@XmlElement(required = true)
protected ESource level;
@XmlElement(required = true)
protected String agentCode;
protected long branchCode;
/**
* Gets the value of the level property.
*
* @return
* possible object is
* {@link ESource }
*
*/
public ESource getLevel() {
return level;
}
/**
* Sets the value of the level property.
*
* @param value
* allowed object is
* {@link ESource }
*
*/
public void setLevel(ESource value) {
this.level = value;
}
/**
* Gets the value of the agentCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAgentCode() {
return agentCode;
}
/**
* Sets the value of the agentCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAgentCode(String value) {
this.agentCode = value;
}
/**
* Gets the value of the branchCode property.
*
*/
public long getBranchCode() {
return branchCode;
}
/**
* Sets the value of the branchCode property.
*
*/
public void setBranchCode(long value) {
this.branchCode = value;
}
}
| UTF-8 | Java | 2,865 | java | PerformanceReportRequest.java | Java | [] | null | [] | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.10.09 at 03:30:51 PM CAT
//
package za.co.bayport.schema;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* Performance report request
*
* <p>Java class for PerformanceReportRequest complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PerformanceReportRequest">
* <complexContent>
* <extension base="{}BaseServiceRequest">
* <sequence>
* <element name="level" type="{}ESource"/>
* <element name="agentCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="branchCode" type="{http://www.w3.org/2001/XMLSchema}long"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PerformanceReportRequest", propOrder = {
"level",
"agentCode",
"branchCode"
})
public class PerformanceReportRequest
extends BaseServiceRequest
{
@XmlElement(required = true)
protected ESource level;
@XmlElement(required = true)
protected String agentCode;
protected long branchCode;
/**
* Gets the value of the level property.
*
* @return
* possible object is
* {@link ESource }
*
*/
public ESource getLevel() {
return level;
}
/**
* Sets the value of the level property.
*
* @param value
* allowed object is
* {@link ESource }
*
*/
public void setLevel(ESource value) {
this.level = value;
}
/**
* Gets the value of the agentCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAgentCode() {
return agentCode;
}
/**
* Sets the value of the agentCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAgentCode(String value) {
this.agentCode = value;
}
/**
* Gets the value of the branchCode property.
*
*/
public long getBranchCode() {
return branchCode;
}
/**
* Sets the value of the branchCode property.
*
*/
public void setBranchCode(long value) {
this.branchCode = value;
}
}
| 2,865 | 0.604887 | 0.595113 | 120 | 22.875 | 22.799328 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.241667 | false | false | 2 |
80f8b7c55911c6bb55cb2690ccff2842da9193ef | 11,845,519,803,849 | ec3155550dfbbcba1428bc0d79081a1815de0243 | /org.amanzi.splash/src/org/amanzi/splash/importer/ExcelImporter.java | a8cf3e5489c438e5652b81aca06149debb171a0c | [] | no_license | AmanziTel/awe-splash | https://github.com/AmanziTel/awe-splash | b36e336ecc285af22fcafcd976ac339192642884 | b5ffe878a96dc9323f4cb287baef096aa906f7ed | refs/heads/master | 2021-01-21T11:39:54.887000 | 2011-08-23T09:06:49 | 2011-08-23T09:06:49 | 2,254,698 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* AWE - Amanzi Wireless Explorer
* http://awe.amanzi.org
* (C) 2008-2009, AmanziTel AB
*
* This library is provided under the terms of the Eclipse Public License
* as described at http://www.eclipse.org/legal/epl-v10.html. Any use,
* reproduction or distribution of the library constitutes recipient's
* acceptance of this agreement.
*
* This library is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.amanzi.splash.importer;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import org.amanzi.neo.services.nodes.SpreadsheetNode;
import org.amanzi.neo.services.ui.NeoUtils;
import org.amanzi.splash.swing.Cell;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.neo4j.graphdb.Transaction;
import com.eteks.openjeks.format.CellFormat;
/**
* Importer of Excel data into Splash
*
* @author Lagutko_N
* @since 1.0.0
*/
public class ExcelImporter extends AbstractImporter {
static private final Logger LOGGER = Logger.getLogger(ExcelImporter.class);
/**
* Parent Spreadsheet
*/
private SpreadsheetNode rootSpreadsheet;
/**
* Constructor
*
* @param containerPath path to Project that will contain new Spreadsheet
* @param fileName name of File to import
* @param stream content of File to import
* @param fileSize size of File to import
*/
public ExcelImporter(IPath containerPath, String fileName, InputStream stream, long fileSize) {
super(containerPath, fileName, stream, fileSize);
}
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException {
POIFSFileSystem fileSystem = null;
monitor.beginTask("Importing data from Excel", 100);
Transaction tx = NeoUtils.beginTransaction();
try
{
fileSystem = new POIFSFileSystem (fileContent);
HSSFWorkbook workBook = new HSSFWorkbook (fileSystem);
createRootSpreadsheet();
for (int i = 0; i < workBook.getNumberOfSheets(); i++) {
monitor.subTask("Sheet " + workBook.getSheetName(i));
createSheet(workBook.getSheetAt(i), workBook.getSheetName(i), tx);
monitor.worked(100 / workBook.getNumberOfSheets());
}
monitor.done();
}
catch (IOException e)
{
throw new InvocationTargetException(e);
}
finally {
tx.success();
tx.finish();
}
}
/**
* Creates a parent spreadsheet
*/
private void createRootSpreadsheet() {
createSpreadsheet(null);
this.rootSpreadsheet = super.spreadsheetNode;
}
/**
* Creates a child spreadsheet inside parent spreadsheet
*
* @param sheet sheet to import
* @param sheetName name of sheet
* @param monitor monitor
*/
@SuppressWarnings(value = {"deprecation", "unchecked"})
private void createSheet(HSSFSheet sheet, String sheetName, Transaction transaction) {
spreadsheetNode = null;
spreadsheetName = sheetName;
createSpreadsheet(rootSpreadsheet);
try
{
Iterator<HSSFRow> rows = sheet.rowIterator ();
while (rows.hasNext ())
{
HSSFRow row = rows.next ();
//display row number in the console.
LOGGER.debug("Row No.: " + row.getRowNum ());
//once get a row its time to iterate through cells.
Iterator<HSSFCell> cells = row.cellIterator ();
int R = row.getRowNum();
if ((R % 20) == 0) {
updateTransaction(transaction);
}
while (cells.hasNext ())
{
HSSFCell cell = cells.next ();
LOGGER.debug("Cell No.: " + cell.getCellNum ());
int C = cell.getCellNum();
/*
* Now we will get the cell type and display the values
* accordingly.
*/
switch (cell.getCellType ())
{
case HSSFCell.CELL_TYPE_NUMERIC :
{
// cell type numeric.
LOGGER.debug("====================================================");
LOGGER.debug("Numeric value: " + cell.getNumericCellValue ());
LOGGER.debug("====================================================");
String def = Double.toString(cell.getNumericCellValue());
Cell c = new Cell(R, C, def, def, new CellFormat());
//TODO: interpet!!!!!!
//Cell c = model.interpret(def, R, C);
saveCell(c);
break;
}
case HSSFCell.CELL_TYPE_STRING :
{
// cell type string.
HSSFRichTextString richTextString = cell.getRichStringCellValue ();
LOGGER.debug("====================================================");
LOGGER.debug("String value: " + richTextString.getString ());
LOGGER.debug("====================================================");
Cell c = new Cell(R,C,richTextString.getString (), richTextString.getString (), new CellFormat());
saveCell(c);
break;
}
case HSSFCell.CELL_TYPE_FORMULA:
// cell type string.
String cellFormula = "=" + cell.getCellFormula().toLowerCase();
Cell c = new Cell(R, C, cellFormula, cellFormula, new CellFormat());
//TODO: interpet!!!!!!
//Cell c = model.interpret(def, R, C);
saveCell(c);
LOGGER.debug("====================================================");
LOGGER.debug("Formula value: " + cellFormula);
LOGGER.debug("====================================================");
break;
default :
{
// types other than String and Numeric.
LOGGER.debug("Type not supported.");
break;
}
}
}
}
}
finally {
updateTransaction(transaction);
}
}
@Override
public SpreadsheetNode getSpreadsheet() {
return rootSpreadsheet;
}
}
| UTF-8 | Java | 7,947 | java | ExcelImporter.java | Java | [
{
"context": "mporter of Excel data into Splash\r\n * \r\n * @author Lagutko_N\r\n * @since 1.0.0\r\n */\r\npublic class ExcelImporter",
"end": 1420,
"score": 0.7819135785102844,
"start": 1411,
"tag": "USERNAME",
"value": "Lagutko_N"
}
] | null | [] | /* AWE - Amanzi Wireless Explorer
* http://awe.amanzi.org
* (C) 2008-2009, AmanziTel AB
*
* This library is provided under the terms of the Eclipse Public License
* as described at http://www.eclipse.org/legal/epl-v10.html. Any use,
* reproduction or distribution of the library constitutes recipient's
* acceptance of this agreement.
*
* This library is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.amanzi.splash.importer;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import org.amanzi.neo.services.nodes.SpreadsheetNode;
import org.amanzi.neo.services.ui.NeoUtils;
import org.amanzi.splash.swing.Cell;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.neo4j.graphdb.Transaction;
import com.eteks.openjeks.format.CellFormat;
/**
* Importer of Excel data into Splash
*
* @author Lagutko_N
* @since 1.0.0
*/
public class ExcelImporter extends AbstractImporter {
static private final Logger LOGGER = Logger.getLogger(ExcelImporter.class);
/**
* Parent Spreadsheet
*/
private SpreadsheetNode rootSpreadsheet;
/**
* Constructor
*
* @param containerPath path to Project that will contain new Spreadsheet
* @param fileName name of File to import
* @param stream content of File to import
* @param fileSize size of File to import
*/
public ExcelImporter(IPath containerPath, String fileName, InputStream stream, long fileSize) {
super(containerPath, fileName, stream, fileSize);
}
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException {
POIFSFileSystem fileSystem = null;
monitor.beginTask("Importing data from Excel", 100);
Transaction tx = NeoUtils.beginTransaction();
try
{
fileSystem = new POIFSFileSystem (fileContent);
HSSFWorkbook workBook = new HSSFWorkbook (fileSystem);
createRootSpreadsheet();
for (int i = 0; i < workBook.getNumberOfSheets(); i++) {
monitor.subTask("Sheet " + workBook.getSheetName(i));
createSheet(workBook.getSheetAt(i), workBook.getSheetName(i), tx);
monitor.worked(100 / workBook.getNumberOfSheets());
}
monitor.done();
}
catch (IOException e)
{
throw new InvocationTargetException(e);
}
finally {
tx.success();
tx.finish();
}
}
/**
* Creates a parent spreadsheet
*/
private void createRootSpreadsheet() {
createSpreadsheet(null);
this.rootSpreadsheet = super.spreadsheetNode;
}
/**
* Creates a child spreadsheet inside parent spreadsheet
*
* @param sheet sheet to import
* @param sheetName name of sheet
* @param monitor monitor
*/
@SuppressWarnings(value = {"deprecation", "unchecked"})
private void createSheet(HSSFSheet sheet, String sheetName, Transaction transaction) {
spreadsheetNode = null;
spreadsheetName = sheetName;
createSpreadsheet(rootSpreadsheet);
try
{
Iterator<HSSFRow> rows = sheet.rowIterator ();
while (rows.hasNext ())
{
HSSFRow row = rows.next ();
//display row number in the console.
LOGGER.debug("Row No.: " + row.getRowNum ());
//once get a row its time to iterate through cells.
Iterator<HSSFCell> cells = row.cellIterator ();
int R = row.getRowNum();
if ((R % 20) == 0) {
updateTransaction(transaction);
}
while (cells.hasNext ())
{
HSSFCell cell = cells.next ();
LOGGER.debug("Cell No.: " + cell.getCellNum ());
int C = cell.getCellNum();
/*
* Now we will get the cell type and display the values
* accordingly.
*/
switch (cell.getCellType ())
{
case HSSFCell.CELL_TYPE_NUMERIC :
{
// cell type numeric.
LOGGER.debug("====================================================");
LOGGER.debug("Numeric value: " + cell.getNumericCellValue ());
LOGGER.debug("====================================================");
String def = Double.toString(cell.getNumericCellValue());
Cell c = new Cell(R, C, def, def, new CellFormat());
//TODO: interpet!!!!!!
//Cell c = model.interpret(def, R, C);
saveCell(c);
break;
}
case HSSFCell.CELL_TYPE_STRING :
{
// cell type string.
HSSFRichTextString richTextString = cell.getRichStringCellValue ();
LOGGER.debug("====================================================");
LOGGER.debug("String value: " + richTextString.getString ());
LOGGER.debug("====================================================");
Cell c = new Cell(R,C,richTextString.getString (), richTextString.getString (), new CellFormat());
saveCell(c);
break;
}
case HSSFCell.CELL_TYPE_FORMULA:
// cell type string.
String cellFormula = "=" + cell.getCellFormula().toLowerCase();
Cell c = new Cell(R, C, cellFormula, cellFormula, new CellFormat());
//TODO: interpet!!!!!!
//Cell c = model.interpret(def, R, C);
saveCell(c);
LOGGER.debug("====================================================");
LOGGER.debug("Formula value: " + cellFormula);
LOGGER.debug("====================================================");
break;
default :
{
// types other than String and Numeric.
LOGGER.debug("Type not supported.");
break;
}
}
}
}
}
finally {
updateTransaction(transaction);
}
}
@Override
public SpreadsheetNode getSpreadsheet() {
return rootSpreadsheet;
}
}
| 7,947 | 0.482824 | 0.479678 | 218 | 34.454128 | 27.047024 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
57ab1ec97eee2a8626789404293f437125a94674 | 11,845,519,803,073 | 67adfb08fd4b684cb43faa9846dcab29a2ed8092 | /CollectionsTest/src/main/java/ua/GoIt/CollectionsTest/CollectionsTest.java | 5b03d4eae4f3deb037ce0c3d346a5f4f95de73d3 | [] | no_license | uazori/JavaEE | https://github.com/uazori/JavaEE | f696a551123ac91119cee7f7c8314a56bfdfefcf | 0acf2843123570bf015e1b601cb8156e8b837630 | refs/heads/master | 2020-12-25T20:53:54.774000 | 2016-06-18T17:59:30 | 2016-06-18T17:59:30 | 53,727,377 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.GoIt.CollectionsTest;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Created by Vadim on 11.03.2016.
*/
public class CollectionsTest {
String path = "result\\file.txt";
File file = new File(path);
FileWriter fileWriter;
BufferedWriter bufferedWriter;
public CollectionsTest() {
try {
if (!file.exists()) {
file.createNewFile();
}
fileWriter = new FileWriter(file.getAbsoluteFile());
bufferedWriter = new BufferedWriter(fileWriter);
} catch (IOException e) {
e.printStackTrace();
}
}
public void makeTest(int volume,int testCount){
try {
printHeader(volume);
printToFileArrayListTest(volume,testCount);
printToFileLinkedListTest(volume,testCount);
printToFileHashSetTest(volume,testCount);
printToFileTreeSetTest(volume,testCount);
bufferedWriter.write("\n");
bufferedWriter.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
private void printToFileArrayListTest(int volume,int testCount) throws IOException {
TestArrayList testArrayList = new TestArrayList(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10d | %10d | %10d | %10d | %15d | %15d |\r\n",
"ArrayList",
testArrayList.testAdd(),
testArrayList.testGet(),
testArrayList.testRemove(),
testArrayList.testContains(),
testArrayList.testPopulate(),
testArrayList.testIteratorAdd(),
testArrayList.testIteratorRemove()));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printToFileLinkedListTest(int volume, int testCount) throws IOException {
TestLinkedList testLinkedList = new TestLinkedList(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10d | %10d | %10d | %10d | %15d | %15d |\r\n",
"LinkedList",
testLinkedList.testAdd(),
testLinkedList.testGet(),
testLinkedList.testRemove(),
testLinkedList.testContains(),
testLinkedList.testPopulate(),
testLinkedList.testIteratorAdd(),
testLinkedList.testIteratorRemove()));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printToFileHashSetTest(int volume, int testCount) throws IOException {
TestHashSet testHashSet = new TestHashSet(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10s | %10d | %10d | %10d | %15s | %15s |\r\n",
"HashSet",
testHashSet.testAdd(),
"-",
testHashSet.testRemove(),
testHashSet.testContains(),
testHashSet.testPopulate(),
"-",
"-"));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printToFileTreeSetTest(int volume,int testCount) throws IOException {
TestTreeSet testHashSet = new TestTreeSet(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10s | %10d | %10d | %10d | %15s | %15s |\r\n",
"TreeSet",
testHashSet.testAdd(),
"-",
testHashSet.testRemove(),
testHashSet.testContains(),
testHashSet.testPopulate(),
"-",
"-"));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printHeader(int volume) throws IOException {
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.write(String.format("| %10d | %10s | %10s | %10s | %10s | %10s | %15s | %15s |\r\n", volume, "add","get","remove","contains","populate","iterator.add","iterator.remove"));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
public void printTableFromFile(){
Path pathToFile = Paths.get(path);
try (
InputStream in = Files.newInputStream(pathToFile);
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException x) {
System.err.println(x);
}
}
}
| UTF-8 | Java | 5,805 | java | CollectionsTest.java | Java | [
{
"context": "\nimport java.nio.file.Paths;\r\n\r\n/**\r\n * Created by Vadim on 11.03.2016.\r\n */\r\npublic class CollectionsTest",
"end": 167,
"score": 0.9968118667602539,
"start": 162,
"tag": "NAME",
"value": "Vadim"
}
] | null | [] | package ua.GoIt.CollectionsTest;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Created by Vadim on 11.03.2016.
*/
public class CollectionsTest {
String path = "result\\file.txt";
File file = new File(path);
FileWriter fileWriter;
BufferedWriter bufferedWriter;
public CollectionsTest() {
try {
if (!file.exists()) {
file.createNewFile();
}
fileWriter = new FileWriter(file.getAbsoluteFile());
bufferedWriter = new BufferedWriter(fileWriter);
} catch (IOException e) {
e.printStackTrace();
}
}
public void makeTest(int volume,int testCount){
try {
printHeader(volume);
printToFileArrayListTest(volume,testCount);
printToFileLinkedListTest(volume,testCount);
printToFileHashSetTest(volume,testCount);
printToFileTreeSetTest(volume,testCount);
bufferedWriter.write("\n");
bufferedWriter.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
private void printToFileArrayListTest(int volume,int testCount) throws IOException {
TestArrayList testArrayList = new TestArrayList(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10d | %10d | %10d | %10d | %15d | %15d |\r\n",
"ArrayList",
testArrayList.testAdd(),
testArrayList.testGet(),
testArrayList.testRemove(),
testArrayList.testContains(),
testArrayList.testPopulate(),
testArrayList.testIteratorAdd(),
testArrayList.testIteratorRemove()));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printToFileLinkedListTest(int volume, int testCount) throws IOException {
TestLinkedList testLinkedList = new TestLinkedList(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10d | %10d | %10d | %10d | %15d | %15d |\r\n",
"LinkedList",
testLinkedList.testAdd(),
testLinkedList.testGet(),
testLinkedList.testRemove(),
testLinkedList.testContains(),
testLinkedList.testPopulate(),
testLinkedList.testIteratorAdd(),
testLinkedList.testIteratorRemove()));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printToFileHashSetTest(int volume, int testCount) throws IOException {
TestHashSet testHashSet = new TestHashSet(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10s | %10d | %10d | %10d | %15s | %15s |\r\n",
"HashSet",
testHashSet.testAdd(),
"-",
testHashSet.testRemove(),
testHashSet.testContains(),
testHashSet.testPopulate(),
"-",
"-"));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printToFileTreeSetTest(int volume,int testCount) throws IOException {
TestTreeSet testHashSet = new TestTreeSet(volume,testCount);
bufferedWriter.write(String.format("| %10s | %10d | %10s | %10d | %10d | %10d | %15s | %15s |\r\n",
"TreeSet",
testHashSet.testAdd(),
"-",
testHashSet.testRemove(),
testHashSet.testContains(),
testHashSet.testPopulate(),
"-",
"-"));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
private void printHeader(int volume) throws IOException {
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.write(String.format("| %10d | %10s | %10s | %10s | %10s | %10s | %15s | %15s |\r\n", volume, "add","get","remove","contains","populate","iterator.add","iterator.remove"));
bufferedWriter.write(String.format("%80s\r\n", "-------------------------------------------------------------------------------------------------------------------"));
bufferedWriter.flush();
}
public void printTableFromFile(){
Path pathToFile = Paths.get(path);
try (
InputStream in = Files.newInputStream(pathToFile);
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException x) {
System.err.println(x);
}
}
}
| 5,805 | 0.467873 | 0.450646 | 170 | 32.14706 | 40.670506 | 194 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.882353 | false | false | 2 |
edd07f332e481882c6cd8de8c1b9249f22bf627f | 2,422,361,583,346 | 7a506b14356ec42667235b1898063410720740e0 | /bankingApplication/src/test/java/com/example/banking/controllertest/AccountControllerTest.java | c28dba5e6fd83134b9cac44381ed8f08f8148f98 | [] | no_license | sunilmanubolu/bank_demo | https://github.com/sunilmanubolu/bank_demo | c755ea250815c03e4e18799688bcfe199bf14681 | 53634bf0f56091e1a6aab1a4ad9f91f261b3da91 | refs/heads/master | 2023-03-13T19:37:14.630000 | 2021-03-02T09:27:56 | 2021-03-02T09:27:56 | 343,315,152 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.banking.controllertest;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.example.banking.controller.AccountController;
import com.example.banking.dto.CreateAccount;
import com.example.banking.helper.BankingHelper;
import com.example.banking.repository.CreateAccountRepository;
import com.example.banking.services.BankService;
import com.example.banking.services.TransactionsServices;
@RunWith(SpringJUnit4ClassRunner.class)
public class AccountControllerTest {
@InjectMocks
private AccountController accountController;
@Mock
private BankService bankService;
private MockMvc mockMvc;
@Before
public void init() {
this.mockMvc = MockMvcBuilders.standaloneSetup(this.accountController).build();
}
/*@Test
public void test() {
//fail("Not yet implemented");
assertFalse(true);
}*/
@Test
public void createAccount() throws Exception{
//this.mockMvc.perform(get("/createCustomerAccount"))
}
//List<CreateAccount> listOfUsers= new ArrayList<>();
//listOfUsers.add(new CreateAccount(1, "Amrutha", "Kanthimath", "amruthaKanthimath", "1000005050", "9482929767",
// "abcd abcd", "Savings", "amrutha.kanthimath@gmail.com", 100000, "BVYPA5458A", "123456789A"));
//listOfUsers.add(new CreateAccount(2, "Anitha", "Sharma", "anithaSharma", "1000005051", "9482929778", "abcd abcd", "Current", "anitha.sharma@gmail.com", 100000, "BVYPA5459B", "1234567abA"));
//listOfUsers.add(new CreateAccount(3, "Anusha", "Hiremath", "aushaHiremath", "1000005052", "9482929789", "abcd abcd", "Savings", "ausha.hiremath@gmail.com", 100000, "BVYPA5456B", "1234567bvA"));
//listOfUsers.add(new CreateAccount(4, "Avinash", "Sharma", "avinashSharma", "1000005053", "9482929790", "abcd abcd", "Current", "avinash.sharma@gmail.com", 100000, "BVYPA5457B", "1234567mnA"));
//listOfUsers.add(new CreateAccount(5, "Bhavana", "Prabhu", "bhavanaPrabhu", "1000005054", "9482929780", "abcd abcd", "Savings", "bhavana.prabhu@gmail.com", 100000, "BVYPA5454B", "1234567uyA"));
@Test
public void getAccountDetailsTest() throws Exception {/*
List<CreateAccount> listOfUsers= new ArrayList<>();
listOfUsers.add(new CreateAccount(1, "Amrutha", "Kanthimath", "amruthaKanthimath", "1000005050", "9482929767",
"abcd abcd", "Savings", "amrutha.kanthimath@gmail.com", 100000, "BVYPA5458A", "123456789A"));
Mockito.when(accountController.getListOfUsers()).thenReturn(listOfUsers);
this.mockMvc.perform(get("/getAcc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
// .andExpect("$", hasS)
.andExpect(jsonPath("$.[0]", is(1)))
.andExpect(jsonPath("$.[0]", is("Amrutha")))
.andExpect(jsonPath("$.[0]", is("Kanthimath")))
.andExpect(jsonPath("$.[0]", is("amruthaKanthimath")))
.andExpect(jsonPath("$.[0]", is("1000005050")))
.andExpect(jsonPath("$.[0]", is("9482929767")))
.andExpect(jsonPath("$.[0]", is("abcd abcd")))
.andExpect(jsonPath("$.[0]", is("Savings")))
.andExpect(jsonPath("$.[0]", is("amrutha.kanthimath@gmail.com")))
.andExpect(jsonPath("$.[0]", is(100000)))
.andExpect(jsonPath("$.[0]", is("BVYPA5458A")))
.andExpect(jsonPath("$.[0]", is("123456789A")));
Mockito.verify(accountController,times(1)).getListOfUsers();
verifyNoMoreInteractions(accountController);
*/}
}
| UTF-8 | Java | 4,441 | java | AccountControllerTest.java | Java | [
{
"context": "ist<>();\n\t//listOfUsers.add(new CreateAccount(1, \"Amrutha\", \"Kanthimath\", \"amruthaKanthimath\", \"1000005050\"",
"end": 2110,
"score": 0.9997761249542236,
"start": 2103,
"tag": "NAME",
"value": "Amrutha"
},
{
"context": "/listOfUsers.add(new CreateAccount(1, \"Am... | null | [] | package com.example.banking.controllertest;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.example.banking.controller.AccountController;
import com.example.banking.dto.CreateAccount;
import com.example.banking.helper.BankingHelper;
import com.example.banking.repository.CreateAccountRepository;
import com.example.banking.services.BankService;
import com.example.banking.services.TransactionsServices;
@RunWith(SpringJUnit4ClassRunner.class)
public class AccountControllerTest {
@InjectMocks
private AccountController accountController;
@Mock
private BankService bankService;
private MockMvc mockMvc;
@Before
public void init() {
this.mockMvc = MockMvcBuilders.standaloneSetup(this.accountController).build();
}
/*@Test
public void test() {
//fail("Not yet implemented");
assertFalse(true);
}*/
@Test
public void createAccount() throws Exception{
//this.mockMvc.perform(get("/createCustomerAccount"))
}
//List<CreateAccount> listOfUsers= new ArrayList<>();
//listOfUsers.add(new CreateAccount(1, "Amrutha", "Kanthimath", "amruthaKanthimath", "1000005050", "9482929767",
// "abcd abcd", "Savings", "<EMAIL>", 100000, "BVYPA5458A", "123456789A"));
//listOfUsers.add(new CreateAccount(2, "Anitha", "Sharma", "anithaSharma", "1000005051", "9482929778", "abcd abcd", "Current", "<EMAIL>", 100000, "BVYPA5459B", "1234567abA"));
//listOfUsers.add(new CreateAccount(3, "Anusha", "Hiremath", "aushaHiremath", "1000005052", "9482929789", "abcd abcd", "Savings", "<EMAIL>", 100000, "BVYPA5456B", "1234567bvA"));
//listOfUsers.add(new CreateAccount(4, "Avinash", "Sharma", "avinashSharma", "1000005053", "9482929790", "abcd abcd", "Current", "<EMAIL>", 100000, "BVYPA5457B", "1234567mnA"));
//listOfUsers.add(new CreateAccount(5, "Bhavana", "Prabhu", "bhavanaPrabhu", "1000005054", "9482929780", "abcd abcd", "Savings", "<EMAIL>", 100000, "BVYPA5454B", "1234567uyA"));
@Test
public void getAccountDetailsTest() throws Exception {/*
List<CreateAccount> listOfUsers= new ArrayList<>();
listOfUsers.add(new CreateAccount(1, "Amrutha", "Kanthimath", "amruthaKanthimath", "1000005050", "9482929767",
"abcd abcd", "Savings", "<EMAIL>", 100000, "BVYPA5458A", "123456789A"));
Mockito.when(accountController.getListOfUsers()).thenReturn(listOfUsers);
this.mockMvc.perform(get("/getAcc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
// .andExpect("$", hasS)
.andExpect(jsonPath("$.[0]", is(1)))
.andExpect(jsonPath("$.[0]", is("Amrutha")))
.andExpect(jsonPath("$.[0]", is("Kanthimath")))
.andExpect(jsonPath("$.[0]", is("amruthaKanthimath")))
.andExpect(jsonPath("$.[0]", is("1000005050")))
.andExpect(jsonPath("$.[0]", is("9482929767")))
.andExpect(jsonPath("$.[0]", is("abcd abcd")))
.andExpect(jsonPath("$.[0]", is("Savings")))
.andExpect(jsonPath("$.[0]", is("<EMAIL>")))
.andExpect(jsonPath("$.[0]", is(100000)))
.andExpect(jsonPath("$.[0]", is("BVYPA5458A")))
.andExpect(jsonPath("$.[0]", is("123456789A")));
Mockito.verify(accountController,times(1)).getListOfUsers();
verifyNoMoreInteractions(accountController);
*/}
}
| 4,311 | 0.725512 | 0.660662 | 102 | 42.539215 | 42.186253 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.882353 | false | false | 2 |
f43ef4e44478403b6ccc89c2bdb91b4fdcbcbf0c | 2,422,361,583,497 | 056e1d640c4682262d4901e742881a2846aec0cb | /src/main/java/com/zsy/sys/utils/CacheUtils.java | bd65f5bb38ff8dbde0f764a69dab4a91476ccf25 | [] | no_license | zhengsiyun/springboot_erp | https://github.com/zhengsiyun/springboot_erp | b3b6cedf8ebfe82f8d65773109631a7e86825bfe | 02999054d5e7ff9ca567082e57787e68f126f6aa | refs/heads/master | 2022-10-30T10:25:04.491000 | 2019-08-23T12:11:07 | 2019-08-23T12:11:07 | 203,981,264 | 1 | 0 | null | false | 2022-10-12T20:30:51 | 2019-08-23T10:55:36 | 2021-06-07T02:54:42 | 2022-10-12T20:30:50 | 1,525 | 1 | 0 | 6 | JavaScript | false | false | package com.zsy.sys.utils;
/**
* 缓存工具类
* @author zsy
*
*/
import java.util.HashMap;
import java.util.Map;
public class CacheUtils {
public static Map<String, String> CACHE_MAP = new HashMap<String, String>();
}
| UTF-8 | Java | 242 | java | CacheUtils.java | Java | [
{
"context": "kage com.zsy.sys.utils;\r\n/**\r\n * 缓存工具类\r\n * @author zsy\r\n *\r\n */\r\n\r\nimport java.util.HashMap;\r\nimport jav",
"end": 57,
"score": 0.9996055364608765,
"start": 54,
"tag": "USERNAME",
"value": "zsy"
}
] | null | [] | package com.zsy.sys.utils;
/**
* 缓存工具类
* @author zsy
*
*/
import java.util.HashMap;
import java.util.Map;
public class CacheUtils {
public static Map<String, String> CACHE_MAP = new HashMap<String, String>();
}
| 242 | 0.650862 | 0.650862 | 13 | 15.769231 | 20.279409 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 2 |
6084333cf1c234697a4012f050584425aa02fd3e | 9,646,496,591,992 | a7ecbdbc91f205550655900ea03e1cbfdfd22493 | /src/accountingApp/model/IncomeCategory.java | 619116b5a22a3c56eab06eb2f152d67589077d63 | [] | no_license | mihryundel/ui_lab3 | https://github.com/mihryundel/ui_lab3 | ef65d8e3942828181ba79e362743a3eec73f098d | 6f8be9aececc494ed067240c13f8142f55d312f3 | refs/heads/master | 2020-03-30T03:02:46.883000 | 2018-09-28T00:57:47 | 2018-09-28T00:57:47 | 150,665,486 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package accountingApp.model;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class IncomeCategory {
private StringProperty name;
private IntegerProperty sum;
public IncomeCategory() {
this("", 0);
}
public IncomeCategory(String name, Integer sum) {
this.name = new SimpleStringProperty(name);
this.sum = new SimpleIntegerProperty(sum);
}
public String getName() {
return name.get();
}
public StringProperty nameProperty() {
return name;
}
public void setName(String name) {
this.name.set(name);
}
public int getSum() {
return sum.get();
}
public IntegerProperty sumProperty() {
return sum;
}
public void setSum(int sum) {
this.sum.set(sum);
}
@Override
public String toString() {
return "IncomeCategory{" +
"name=" + name +
", sum=" + sum +
'}';
}
}
| UTF-8 | Java | 1,127 | java | IncomeCategory.java | Java | [] | null | [] | package accountingApp.model;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class IncomeCategory {
private StringProperty name;
private IntegerProperty sum;
public IncomeCategory() {
this("", 0);
}
public IncomeCategory(String name, Integer sum) {
this.name = new SimpleStringProperty(name);
this.sum = new SimpleIntegerProperty(sum);
}
public String getName() {
return name.get();
}
public StringProperty nameProperty() {
return name;
}
public void setName(String name) {
this.name.set(name);
}
public int getSum() {
return sum.get();
}
public IntegerProperty sumProperty() {
return sum;
}
public void setSum(int sum) {
this.sum.set(sum);
}
@Override
public String toString() {
return "IncomeCategory{" +
"name=" + name +
", sum=" + sum +
'}';
}
}
| 1,127 | 0.607808 | 0.606921 | 53 | 20.264151 | 17.413019 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.377358 | false | false | 2 |
b8c12be79d8d0fbbe204fef12ac2bcf6dc29a1c2 | 24,481,313,599,130 | 62e071884895332fa4d6aad56a57d993d958e538 | /WebDriver3/src/Google_indeed.java | fb1b1f6413f5cc3a2a01251c6455ebf3f29737f0 | [] | no_license | gouthi14/Basic-java-and-selenium-programs | https://github.com/gouthi14/Basic-java-and-selenium-programs | 8bea60c7740558c3906c60710b7dd8dd769d7960 | ac8b7cb8609d6caf31fa7bb3165c312361a411b0 | refs/heads/master | 2021-08-31T15:04:45.865000 | 2017-12-21T19:51:23 | 2017-12-21T19:51:23 | 115,042,054 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Google_indeed {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver","C:\\Users\\gouthamgoud\\Desktop\\selenium jars\\geckodriver-v0.15.0-win64\\geckodriver.exe");
WebDriver driver;
driver=new FirefoxDriver();
driver.get("https://www.google.com/");
driver.findElement(By.id("lst-ib")).sendKeys("www.youtube.com");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.findElement(By.className("r")).click();
driver.close();
}
}
| UTF-8 | Java | 749 | java | Google_indeed.java | Java | [
{
"context": ".setProperty(\"webdriver.gecko.driver\",\"C:\\\\Users\\\\gouthamgoud\\\\Desktop\\\\selenium jars\\\\geckodriver-v0.15.0-win6",
"end": 300,
"score": 0.9910112619400024,
"start": 289,
"tag": "USERNAME",
"value": "gouthamgoud"
}
] | null | [] | import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Google_indeed {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver","C:\\Users\\gouthamgoud\\Desktop\\selenium jars\\geckodriver-v0.15.0-win64\\geckodriver.exe");
WebDriver driver;
driver=new FirefoxDriver();
driver.get("https://www.google.com/");
driver.findElement(By.id("lst-ib")).sendKeys("www.youtube.com");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.findElement(By.className("r")).click();
driver.close();
}
}
| 749 | 0.70761 | 0.694259 | 29 | 24.827587 | 28.240433 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.758621 | false | false | 2 |
1353ec0f260dd1212ea350334ad71c514edab83a | 15,642,270,892,392 | b09b60d5b682471e3a2f894b4841781f722f720b | /MapMaker/src/gui/Utility.java | 122fc810769c851b8fd11f1940e802224d78eee8 | [] | no_license | Arclights/MCRailMap | https://github.com/Arclights/MCRailMap | dc6436e8e7c8b771ec5cfdc2bf4876a004f70dab | 9e926452a1d9bba522f7e34749183027e128aede | refs/heads/master | 2021-01-01T18:07:22.830000 | 2014-03-24T22:38:35 | 2014-03-24T22:38:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gui;
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Shape;
import settings.GUISettings;
public class Utility {
public static void paintGlow(Graphics2D g, Shape shape) {
int biggestStroke = 5;
g.setStroke(new BasicStroke(biggestStroke));
g.setColor(GUISettings.focusArray[2]);
g.draw(shape);
g.setStroke(new BasicStroke(biggestStroke / 2));
g.setColor(GUISettings.focusArray[1]);
g.draw(shape);
g.setStroke(new BasicStroke(biggestStroke / 3));
g.setColor(GUISettings.focusArray[0]);
g.draw(shape);
g.setStroke(new BasicStroke(1));
}
public static void resetStroke(Graphics2D g) {
g.setStroke(new BasicStroke(GUISettings.defaultStrokeWidth));
}
}
| UTF-8 | Java | 716 | java | Utility.java | Java | [] | null | [] | package gui;
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Shape;
import settings.GUISettings;
public class Utility {
public static void paintGlow(Graphics2D g, Shape shape) {
int biggestStroke = 5;
g.setStroke(new BasicStroke(biggestStroke));
g.setColor(GUISettings.focusArray[2]);
g.draw(shape);
g.setStroke(new BasicStroke(biggestStroke / 2));
g.setColor(GUISettings.focusArray[1]);
g.draw(shape);
g.setStroke(new BasicStroke(biggestStroke / 3));
g.setColor(GUISettings.focusArray[0]);
g.draw(shape);
g.setStroke(new BasicStroke(1));
}
public static void resetStroke(Graphics2D g) {
g.setStroke(new BasicStroke(GUISettings.defaultStrokeWidth));
}
}
| 716 | 0.744413 | 0.730447 | 31 | 22.096775 | 19.871124 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.516129 | false | false | 2 |
7112976842b676c8698e29ecc501a73abff337b2 | 3,367,254,399,691 | abf555d4f7ce0b145f691a17658346f35adcc12b | /Day05-10/src/com/vscore/ScoreMain.java | 6aa079dddddd2c48e6add7e1053a53ad415522c4 | [] | no_license | han1g/JavaStudy | https://github.com/han1g/JavaStudy | e9da501a069fa67d640f452cc71ba60100a213cd | 14f8bef389be9073b9eab5bf601385310d5d5022 | refs/heads/master | 2023-04-22T10:59:53.127000 | 2021-05-17T06:28:02 | 2021-05-17T06:28:02 | 363,157,179 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vscore;
import java.io.IOException;
public class ScoreMain {
public static void main(String[] args) throws IOException {
char ch = 1;//메뉴호출
Score score = new ScoreImpl();
while(ch != 0) {
do {
System.out.println("1.추가,2.수정,3.삭제,4.전체출력,5.학번검색,6.이름검색,7.종료 => ");
ch = (char) System.in.read();
System.in.read();
System.in.read();
//cr lf
}while(ch > '7' || ch < '1');
switch(ch) {
case '1': score.insert(); break;
case '2': score.update(); break;
case '3': score.delete(); break;
case '4': score.listAll(); break;
case '5': score.searchHak(); break;
case '6': score.searchName(); break;
case '7': System.exit(0); break;
}
}
}
}
| UTF-8 | Java | 757 | java | ScoreMain.java | Java | [] | null | [] | package com.vscore;
import java.io.IOException;
public class ScoreMain {
public static void main(String[] args) throws IOException {
char ch = 1;//메뉴호출
Score score = new ScoreImpl();
while(ch != 0) {
do {
System.out.println("1.추가,2.수정,3.삭제,4.전체출력,5.학번검색,6.이름검색,7.종료 => ");
ch = (char) System.in.read();
System.in.read();
System.in.read();
//cr lf
}while(ch > '7' || ch < '1');
switch(ch) {
case '1': score.insert(); break;
case '2': score.update(); break;
case '3': score.delete(); break;
case '4': score.listAll(); break;
case '5': score.searchHak(); break;
case '6': score.searchName(); break;
case '7': System.exit(0); break;
}
}
}
}
| 757 | 0.5811 | 0.554302 | 30 | 22.633333 | 17.588791 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.3 | false | false | 2 |
c9a2a847969e3555c2c50dd9c0e92caa2e4cf51e | 10,496,900,093,120 | 1183aba09ae31af8c5e2804749e45758f869d91d | /src/test/java/org/springframework/data/aerospike/repository/Address.java | e746bb0934f6f64cca7eddda8e2c2a59762ea4cd | [] | no_license | sudheerds/spring-data-aerospike | https://github.com/sudheerds/spring-data-aerospike | e7d66254342e1bc9eaeb83923bec43a89b1d36d8 | 617c3311bfe5ebf84990c4c871a5cd6c90c30b4c | refs/heads/master | 2021-05-11T06:16:38.357000 | 2018-01-04T20:31:39 | 2018-01-04T20:31:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*******************************************************************************
* Copyright (c) 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/**
*
*/
package org.springframework.data.aerospike.repository;
import java.io.Serializable;
/**
*
*
* @author Peter Milne
* @author Jean Mercier
*
*/
@SuppressWarnings("serial")
public class Address implements Serializable{
private String street;
private String zipCode;
private String city;
protected Address() {
}
/**
* @param street
* @param zipcode
* @param city
*/
public Address(String street, String zipcode, String city) {
this.street = street;
this.zipCode = zipcode;
this.city = city;
}
/**
* @return the street
*/
public String getStreet() {
return street;
}
/**
* @param street the street to set
*/
public void setStreet(String street) {
this.street = street;
}
/**
* @return the zipCode
*/
public String getZipCode() {
return zipCode;
}
/**
* @param zipCode the zipCode to set
*/
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((city == null) ? 0 : city.hashCode());
result = prime * result + ((street == null) ? 0 : street.hashCode());
result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Address other = (Address) obj;
if (city == null) {
if (other.city != null)
return false;
} else if (!city.equals(other.city))
return false;
if (street == null) {
if (other.street != null)
return false;
} else if (!street.equals(other.street))
return false;
if (zipCode == null) {
if (other.zipCode != null)
return false;
} else if (!zipCode.equals(other.zipCode))
return false;
return true;
}
}
| UTF-8 | Java | 2,823 | java | Address.java | Java | [
{
"context": "import java.io.Serializable;\n\n/**\n *\n *\n * @author Peter Milne\n * @author Jean Mercier\n *\n */\n@SuppressWarnings(",
"end": 907,
"score": 0.99981689453125,
"start": 896,
"tag": "NAME",
"value": "Peter Milne"
},
{
"context": "able;\n\n/**\n *\n *\n * @author Peter... | null | [] | /*******************************************************************************
* Copyright (c) 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/**
*
*/
package org.springframework.data.aerospike.repository;
import java.io.Serializable;
/**
*
*
* @author <NAME>
* @author <NAME>
*
*/
@SuppressWarnings("serial")
public class Address implements Serializable{
private String street;
private String zipCode;
private String city;
protected Address() {
}
/**
* @param street
* @param zipcode
* @param city
*/
public Address(String street, String zipcode, String city) {
this.street = street;
this.zipCode = zipcode;
this.city = city;
}
/**
* @return the street
*/
public String getStreet() {
return street;
}
/**
* @param street the street to set
*/
public void setStreet(String street) {
this.street = street;
}
/**
* @return the zipCode
*/
public String getZipCode() {
return zipCode;
}
/**
* @param zipCode the zipCode to set
*/
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((city == null) ? 0 : city.hashCode());
result = prime * result + ((street == null) ? 0 : street.hashCode());
result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Address other = (Address) obj;
if (city == null) {
if (other.city != null)
return false;
} else if (!city.equals(other.city))
return false;
if (street == null) {
if (other.street != null)
return false;
} else if (!street.equals(other.street))
return false;
if (zipCode == null) {
if (other.zipCode != null)
return false;
} else if (!zipCode.equals(other.zipCode))
return false;
return true;
}
}
| 2,812 | 0.613886 | 0.608927 | 131 | 20.549618 | 20.813316 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.366412 | false | false | 2 |
ed32d33b9a70111c7c9d5c7564fb70ac14889fe5 | 721,554,526,705 | 9ee7fd07255ed9c8ca503cc550ee4dc3667067fe | /src/main/java/com/example/demo/user/controller/UserController.java | 4614e244be041b76a4e4afd9ab274f24bf23303f | [] | no_license | NTDung141/chat-app-server | https://github.com/NTDung141/chat-app-server | bfe4d206c167b4138ee375ffb5166f64cced131a | a9f0ee37521e4922477c10f708f12db0f1d7829f | refs/heads/master | 2023-07-05T00:47:10.541000 | 2021-09-02T08:24:42 | 2021-09-02T08:24:42 | 399,076,261 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.user.controller;
import com.example.demo.chatbox.service.ChatBoxService;
import com.example.demo.user.mapper.UserMapper;
import com.example.demo.user.model.User;
import com.example.demo.user.model.UserDTO;
import com.example.demo.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@CrossOrigin(origins = "*", allowedHeaders = "*")
//@PreAuthorize("isAuthenticated()")
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {
private final UserService userService;
private final ChatBoxService chatBoxService;
@PutMapping("/add-chat-box/{user-id}/{chat-box-id}")
public ResponseEntity<UserDTO> updateUser(@PathVariable(name = "user-id") String userId, @PathVariable(name = "chat-box-id") String chatBoxId) {
User user = userService.findUserById(userId);
List<String> updatedChatBoxIdList = user.getChatBoxIdList();
updatedChatBoxIdList.add(chatBoxId);
user.setChatBoxIdList(updatedChatBoxIdList);
User updatedUser = userService.saveUser(user);
UserDTO updatedUserDTO = new UserMapper(chatBoxService, userService).mapToUserDTO(updatedUser);
return ResponseEntity.ok(updatedUserDTO);
}
@GetMapping("/all-user")
private ResponseEntity<List<UserDTO>> getAllUser() {
List<User> allUserList = userService.getAllUser();
List<UserDTO> allUserDTO = new ArrayList<UserDTO>();
for (User user : allUserList) {
UserDTO userDTO = new UserMapper(chatBoxService, userService).mapToUserDTO(user);
allUserDTO.add(userDTO);
}
return ResponseEntity.ok(allUserDTO);
}
@GetMapping("/{id}")
private ResponseEntity<UserDTO> getUserById(@PathVariable String id) {
User foundUser = userService.findUserById(id);
UserDTO foundUserDTO = new UserMapper(chatBoxService, userService).mapToUserDTO(foundUser);
return ResponseEntity.ok(foundUserDTO);
}
}
| UTF-8 | Java | 2,208 | java | UserController.java | Java | [] | null | [] | package com.example.demo.user.controller;
import com.example.demo.chatbox.service.ChatBoxService;
import com.example.demo.user.mapper.UserMapper;
import com.example.demo.user.model.User;
import com.example.demo.user.model.UserDTO;
import com.example.demo.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
@CrossOrigin(origins = "*", allowedHeaders = "*")
//@PreAuthorize("isAuthenticated()")
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {
private final UserService userService;
private final ChatBoxService chatBoxService;
@PutMapping("/add-chat-box/{user-id}/{chat-box-id}")
public ResponseEntity<UserDTO> updateUser(@PathVariable(name = "user-id") String userId, @PathVariable(name = "chat-box-id") String chatBoxId) {
User user = userService.findUserById(userId);
List<String> updatedChatBoxIdList = user.getChatBoxIdList();
updatedChatBoxIdList.add(chatBoxId);
user.setChatBoxIdList(updatedChatBoxIdList);
User updatedUser = userService.saveUser(user);
UserDTO updatedUserDTO = new UserMapper(chatBoxService, userService).mapToUserDTO(updatedUser);
return ResponseEntity.ok(updatedUserDTO);
}
@GetMapping("/all-user")
private ResponseEntity<List<UserDTO>> getAllUser() {
List<User> allUserList = userService.getAllUser();
List<UserDTO> allUserDTO = new ArrayList<UserDTO>();
for (User user : allUserList) {
UserDTO userDTO = new UserMapper(chatBoxService, userService).mapToUserDTO(user);
allUserDTO.add(userDTO);
}
return ResponseEntity.ok(allUserDTO);
}
@GetMapping("/{id}")
private ResponseEntity<UserDTO> getUserById(@PathVariable String id) {
User foundUser = userService.findUserById(id);
UserDTO foundUserDTO = new UserMapper(chatBoxService, userService).mapToUserDTO(foundUser);
return ResponseEntity.ok(foundUserDTO);
}
}
| 2,208 | 0.736413 | 0.736413 | 54 | 39.888889 | 29.420116 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62963 | false | false | 2 |
215a209baa7b3ae96673808aca7a3a5ba0a88879 | 14,242,111,579,597 | da8534fdb07bcd0fd223ffc44aeea890dfb7e156 | /src/model/Dingchedan.java | 6927d6aeb7970674fc958328033762d2b8ea23f2 | [] | no_license | daiyirui/logistics- | https://github.com/daiyirui/logistics- | cad3bc01fdd4e7357e72ac5dffebb1f9ef28e6aa | 9f158dd2abc0cfd99156d008914c5d5f37a8dd42 | refs/heads/master | 2021-01-23T10:29:57.967000 | 2017-06-02T04:48:06 | 2017-06-02T04:48:06 | 93,067,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="t_Dingchedan")
public class Dingchedan implements Serializable{
private static final long serialVersionUID = -7141419035239709511L;
private long id;
private String dingchedanhao;
private String dingchexingzhi;
private String yunshuxingzhi;
private String lianxiren;
private String dianhua;
private String chuanzhen;
private String youjian;
private Cheliang cheliang;
private Dingdan dingdan;
private Date createtime;
private String fenpeizhuangtai;//已分配车辆 ,未分配车辆
private User user;
@ManyToOne
@JoinColumn(name="userid")
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getFenpeizhuangtai() {
return fenpeizhuangtai;
}
public void setFenpeizhuangtai(String fenpeizhuangtai) {
this.fenpeizhuangtai = fenpeizhuangtai;
}
@Id
@GeneratedValue
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDingchedanhao() {
return dingchedanhao;
}
public void setDingchedanhao(String dingchedanhao) {
this.dingchedanhao = dingchedanhao;
}
public String getDingchexingzhi() {
return dingchexingzhi;
}
public void setDingchexingzhi(String dingchexingzhi) {
this.dingchexingzhi = dingchexingzhi;
}
public String getYunshuxingzhi() {
return yunshuxingzhi;
}
public void setYunshuxingzhi(String yunshuxingzhi) {
this.yunshuxingzhi = yunshuxingzhi;
}
public String getLianxiren() {
return lianxiren;
}
public void setLianxiren(String lianxiren) {
this.lianxiren = lianxiren;
}
public String getDianhua() {
return dianhua;
}
public void setDianhua(String dianhua) {
this.dianhua = dianhua;
}
public String getChuanzhen() {
return chuanzhen;
}
public void setChuanzhen(String chuanzhen) {
this.chuanzhen = chuanzhen;
}
public String getYoujian() {
return youjian;
}
public void setYoujian(String youjian) {
this.youjian = youjian;
}
@ManyToOne
@JoinColumn(name="cheliangid")
public Cheliang getCheliang() {
return cheliang;
}
public void setCheliang(Cheliang cheliang) {
this.cheliang = cheliang;
}
@ManyToOne
@JoinColumn(name="dingdanid")
public Dingdan getDingdan() {
return dingdan;
}
public void setDingdan(Dingdan dingdan) {
this.dingdan = dingdan;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
}
| UTF-8 | Java | 2,779 | java | Dingchedan.java | Java | [
{
"context": "ng = cheliang;\n\t}\n\n\t@ManyToOne\n\t@JoinColumn(name=\"dingdanid\")\n\tpublic Dingdan getDingdan() {\n\t\treturn dingdan",
"end": 2478,
"score": 0.7541391253471375,
"start": 2469,
"tag": "USERNAME",
"value": "dingdanid"
}
] | null | [] | package model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="t_Dingchedan")
public class Dingchedan implements Serializable{
private static final long serialVersionUID = -7141419035239709511L;
private long id;
private String dingchedanhao;
private String dingchexingzhi;
private String yunshuxingzhi;
private String lianxiren;
private String dianhua;
private String chuanzhen;
private String youjian;
private Cheliang cheliang;
private Dingdan dingdan;
private Date createtime;
private String fenpeizhuangtai;//已分配车辆 ,未分配车辆
private User user;
@ManyToOne
@JoinColumn(name="userid")
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getFenpeizhuangtai() {
return fenpeizhuangtai;
}
public void setFenpeizhuangtai(String fenpeizhuangtai) {
this.fenpeizhuangtai = fenpeizhuangtai;
}
@Id
@GeneratedValue
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDingchedanhao() {
return dingchedanhao;
}
public void setDingchedanhao(String dingchedanhao) {
this.dingchedanhao = dingchedanhao;
}
public String getDingchexingzhi() {
return dingchexingzhi;
}
public void setDingchexingzhi(String dingchexingzhi) {
this.dingchexingzhi = dingchexingzhi;
}
public String getYunshuxingzhi() {
return yunshuxingzhi;
}
public void setYunshuxingzhi(String yunshuxingzhi) {
this.yunshuxingzhi = yunshuxingzhi;
}
public String getLianxiren() {
return lianxiren;
}
public void setLianxiren(String lianxiren) {
this.lianxiren = lianxiren;
}
public String getDianhua() {
return dianhua;
}
public void setDianhua(String dianhua) {
this.dianhua = dianhua;
}
public String getChuanzhen() {
return chuanzhen;
}
public void setChuanzhen(String chuanzhen) {
this.chuanzhen = chuanzhen;
}
public String getYoujian() {
return youjian;
}
public void setYoujian(String youjian) {
this.youjian = youjian;
}
@ManyToOne
@JoinColumn(name="cheliangid")
public Cheliang getCheliang() {
return cheliang;
}
public void setCheliang(Cheliang cheliang) {
this.cheliang = cheliang;
}
@ManyToOne
@JoinColumn(name="dingdanid")
public Dingdan getDingdan() {
return dingdan;
}
public void setDingdan(Dingdan dingdan) {
this.dingdan = dingdan;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
}
| 2,779 | 0.738847 | 0.731955 | 166 | 15.608434 | 16.5219 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.168675 | false | false | 2 |
c04107345fe0724192684db1dedbe407f00b6f9b | 927,712,991,990 | 49f120b9a2173d4ce4113a46f448a9f5daf776f0 | /backup/src/main/java/com/yahoo/p081b/p083b/ExternalEventManager.java | bf4165db73810679e81b9124427a53f956f1fd9f | [] | no_license | iTimeTraveler/DecompileNewsDigest | https://github.com/iTimeTraveler/DecompileNewsDigest | b59f083eb99561faa7a5ad0be39076e007de9df7 | bbffbe9f650c6de51ab0c353ee7b047f3222d439 | refs/heads/master | 2020-04-24T07:53:12.845000 | 2019-03-02T14:42:25 | 2019-03-02T14:42:25 | 171,812,365 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yahoo.p081b.p083b;
/* renamed from: com.yahoo.b.b.g */
public class ExternalEventManager {
/* renamed from: a */
public static SnoopyEvents f5012a = new SnoopyEvents();
/* renamed from: b */
public static QOSEvents f5013b = new QOSEvents();
/* renamed from: a */
public void mo8676a(String str, String str2, Boolean bool) {
f5012a.mo8687b(str, str2, bool);
f5013b.mo8683b(str, str2, bool);
}
/* renamed from: a */
public void mo8679a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11) {
f5012a.mo8690b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11);
f5013b.mo8686b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11);
}
/* renamed from: a */
public void mo8677a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9) {
f5012a.mo8688b(str, str2, str3, str4, str5, str6, str7, str8, str9);
f5013b.mo8684b(str, str2, str3, str4, str5, str6, str7, str8, str9);
}
/* renamed from: a */
public void mo8678a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10) {
f5012a.mo8689b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10);
f5013b.mo8685b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10);
}
}
| UTF-8 | Java | 1,523 | java | ExternalEventManager.java | Java | [] | null | [] | package com.yahoo.p081b.p083b;
/* renamed from: com.yahoo.b.b.g */
public class ExternalEventManager {
/* renamed from: a */
public static SnoopyEvents f5012a = new SnoopyEvents();
/* renamed from: b */
public static QOSEvents f5013b = new QOSEvents();
/* renamed from: a */
public void mo8676a(String str, String str2, Boolean bool) {
f5012a.mo8687b(str, str2, bool);
f5013b.mo8683b(str, str2, bool);
}
/* renamed from: a */
public void mo8679a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11) {
f5012a.mo8690b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11);
f5013b.mo8686b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11);
}
/* renamed from: a */
public void mo8677a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9) {
f5012a.mo8688b(str, str2, str3, str4, str5, str6, str7, str8, str9);
f5013b.mo8684b(str, str2, str3, str4, str5, str6, str7, str8, str9);
}
/* renamed from: a */
public void mo8678a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10) {
f5012a.mo8689b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10);
f5013b.mo8685b(str, str2, str3, str4, str5, str6, str7, str8, str9, str10);
}
}
| 1,523 | 0.655286 | 0.532502 | 33 | 45.151516 | 45.229462 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.969697 | false | false | 2 |
5fbbf14c030fde074e79b01c328306384d1ed61a | 23,931,557,785,074 | 626b126724f6d72511ad229d83e0707d18db843e | /app/src/main/java/com/mission/schedule/constants/Const.java | 95ca77b747abf51bed9aa60ba0ab501e38dfdd83 | [] | no_license | lcf687619/TimeTaskSheet | https://github.com/lcf687619/TimeTaskSheet | 0c6aa23ab8e245ee1c58e0e90bc13e6e198309e0 | 0517cc7e9f8ef829f2436270e317a3840817dea9 | refs/heads/master | 2018-03-07T13:52:27.078000 | 2016-09-09T03:01:36 | 2016-09-09T03:01:36 | 62,857,135 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mission.schedule.constants;
public class Const {
/**
* 刷新同步
*/
public static final String SHUAXINDATA = "com.lcf.android.shuaxin";
/**
* 上传操作
*/
public static final String UPLOADDATA = "com.lcf.android.uploaddata";
public static final int REQUEST_CLIP_IMAGE = 2028;
public static final int REQUEST_TAKE_PHOTO = 2029;
}
| UTF-8 | Java | 363 | java | Const.java | Java | [] | null | [] | package com.mission.schedule.constants;
public class Const {
/**
* 刷新同步
*/
public static final String SHUAXINDATA = "com.lcf.android.shuaxin";
/**
* 上传操作
*/
public static final String UPLOADDATA = "com.lcf.android.uploaddata";
public static final int REQUEST_CLIP_IMAGE = 2028;
public static final int REQUEST_TAKE_PHOTO = 2029;
}
| 363 | 0.714697 | 0.691643 | 15 | 22.133333 | 25.155163 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.